[libjogl2-java] 46/58: Imported Upstream version 2.1.2
Tony Mancill
tmancill at moszumanska.debian.org
Thu Sep 4 03:59:25 UTC 2014
This is an automated email from the git hooks/post-receive script.
tmancill pushed a commit to branch master
in repository libjogl2-java.
commit 013905e97b300cf08b837bf64b4fb5729ad40790
Author: tony mancill <tmancill at debian.org>
Date: Fri Aug 29 18:46:23 2014 -0700
Imported Upstream version 2.1.2
---
.classpath | 2 +-
doc/HowToBuild.html | 41 +-
doc/Implementation/AWTPrinting.txt | 99 +
doc/Implementation/MultiThreading.txt | 31 +
doc/Overview-OpenGL-Evolution-And-JOGL.html | 8 +-
doc/uml/html-svg/class128002.html | 25 -
doc/uml/html-svg/class128069.html | 25 -
doc/uml/html-svg/class128130.html | 25 -
doc/uml/html-svg/class128197.html | 25 -
doc/uml/html-svg/class128258.html | 25 -
doc/uml/html-svg/class128325.html | 25 -
doc/uml/html-svg/class128386.html | 24 -
doc/uml/html-svg/class128453.html | 25 -
doc/uml/html-svg/class128581.html | 25 -
doc/uml/html-svg/class128709.html | 25 -
doc/uml/html-svg/class128837.html | 25 -
doc/uml/html-svg/class128965.html | 25 -
doc/uml/html-svg/class130117.html | 25 -
doc/uml/html-svg/class130245.html | 25 -
doc/uml/html-svg/class130501.html | 24 -
doc/uml/html-svg/class130629.html | 24 -
doc/uml/html-svg/class130757.html | 24 -
doc/uml/html-svg/class130885.html | 26 -
doc/uml/html-svg/class131013.html | 26 -
doc/uml/html-svg/class131141.html | 25 -
doc/uml/html-svg/class131269.html | 26 -
doc/uml/html-svg/class131397.html | 25 -
doc/uml/html-svg/class132549.html | 26 -
doc/uml/html-svg/class134914.html | 25 -
doc/uml/html-svg/class135042.html | 25 -
doc/uml/html-svg/class135170.html | 25 -
doc/uml/html-svg/classdiagrams.html | 6 +-
doc/uml/html-svg/classes.html | 56 +-
doc/uml/html-svg/classes_list.html | 56 +-
doc/uml/html-svg/fig128069.svg | 996 ++---
doc/uml/html-svg/fig134786.svg | 705 +--
doc/uml/html-svg/index-withframe.html | 31 +-
doc/uml/html-svg/index.html | 290 +-
doc/uml/html-svg/index_65.html | 6 +-
doc/uml/html-svg/index_67.html | 8 +-
doc/uml/html-svg/index_71.html | 52 +-
doc/uml/html-svg/index_74.html | 8 +-
doc/uml/html-svg/index_78.html | 6 +-
doc/uml/html-svg/index_79.html | 8 +-
doc/uml/html-svg/index_82.html | 6 +-
doc/uml/html-svg/metaclass135298.html | 25 -
doc/uml/html-svg/navig.html | 6 +-
doc/uml/html-svg/packages.html | 4 +-
doc/uml/html/classdiagrams.html | 6 +-
doc/uml/html/classes.html | 56 +-
doc/uml/html/classes_list.html | 4 +-
doc/uml/html/fig128069.png | Bin 56984 -> 103943 bytes
doc/uml/html/fig134786.png | Bin 45683 -> 85886 bytes
doc/uml/html/index-withframe.html | 31 +-
doc/uml/html/index.html | 110 +-
doc/uml/html/index_65.html | 6 +-
doc/uml/html/index_67.html | 8 +-
doc/uml/html/index_71.html | 52 +-
doc/uml/html/index_74.html | 8 +-
doc/uml/html/index_78.html | 6 +-
doc/uml/html/index_79.html | 8 +-
doc/uml/html/index_82.html | 6 +-
doc/uml/html/navig.html | 6 +-
doc/uml/html/packages.html | 4 +-
doc/uml/jogl/128069.diagram | 101 +-
doc/uml/jogl/134786.diagram | 75 +-
doc/uml/jogl/2.session | 15 +-
doc/uml/jogl/generation_settings | 2 +-
doc/uml/jogl/jogl.prj | 20 +-
jnlp-files/jogl-applet-bug816_glcanvas01.html | 32 +
jnlp-files/jogl-applet-bug816_glcanvas02a.html | 32 +
jnlp-files/jogl-applet-bug816_glcanvas02b.html | 32 +
jnlp-files/jogl-applet-bug816_layerpos03a.html | 32 +
jnlp-files/jogl-applet-bug816_layerpos03b.html | 32 +
jnlp-files/jogl-applet-bug818_gljpanel01.html | 34 +
jnlp-files/jogl-applet-bug848_glcanvas01.html | 32 +
...pplet-runner-newt-GraphTextDemo01b-napplet.html | 68 +
.../jogl-applet-runner-newt-MovieCube-napplet.html | 22 +-
jnlp-files/jogl-applet-runner-newt-MovieCube.html | 22 +-
jnlp-files/jogl-applet-runner-newt.jnlp | 3 +-
jnlp-files/jogl-test-applets.html | 27 +-
make/build-common.xml | 6 +
make/build-jogl.xml | 161 +-
make/build-nativewindow.xml | 9 +-
make/build-newt.xml | 24 +-
make/build-staticglgen.xml | 4 +-
make/build-test.xml | 58 +-
make/build.xml | 1 +
make/config/jogl/cgl-macosx.cfg | 2 +-
make/config/jogl/gl-common-gpubufferonly.cfg | 50 +
make/config/jogl/gl-common.cfg | 6 +
make/config/jogl/gl-es3-impl.cfg | 91 +
make/config/jogl/gl-es3.cfg | 98 -
make/config/jogl/gl-gl4bc.cfg | 3 +
make/config/jogl/gl-headers.cfg | 4 +-
make/config/jogl/gl-if-CustomJavaCode-es3.java | 4 +-
make/config/jogl/gl-if-es2.cfg | 3 +
make/config/jogl/gl-if-es3.cfg | 39 +
make/config/jogl/gl-if-gl.cfg | 1 +
make/config/jogl/gl-if-gl2.cfg | 3 +
make/config/jogl/gl-if-gl2_es1.cfg | 2 +
make/config/jogl/gl-if-gl2_es2.cfg | 1 +
make/config/jogl/gl-if-gl2_es3.cfg | 1 +
make/config/jogl/gl-if-gl2_gl3.cfg | 1 +
make/config/jogl/gl-if-gl3.cfg | 1 +
make/config/jogl/gl-if-gl3bc.cfg | 2 +-
make/config/jogl/gl-if-gl4.cfg | 1 +
make/config/jogl/gl-if-gl4_es3.cfg | 1 +
.../config/jogl/gl-impl-CustomJavaCode-common.java | 8 +-
make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java | 96 +-
make/config/jogl/gl-impl-CustomJavaCode-gles1.java | 45 +-
make/config/jogl/gl-impl-CustomJavaCode-gles3.java | 82 +-
make/config/jogl/gl2-common-cpubufferJavaCode.java | 13 +
.../jogl/gl2_es1-common-cpubufferJavaCode.java | 4 +
.../jogl/gl2_es2-common-cpubufferJavaCode.java | 4 +
make/config/jogl/gl3-headers.cfg | 4 +-
.../jogl/gl3bc-common-cpubufferJavaCode.java | 13 +
.../jogl/gl4bc-common-cpubufferJavaCode.java | 21 +
make/config/jogl/glu-gl2.cfg | 4 +-
make/config/nativewindow/jawt-macosx.cfg | 2 +-
make/doc/jogl/spec-overview.html | 18 +-
make/joglversion | 1 +
make/joglversion-all | 1 +
make/joglversion-test | 1 +
make/joglversion-test-android | 1 +
make/nativewindowversion | 1 +
make/newtversion | 1 +
make/resources/android/AndroidManifest-jogl.xml | 5 +-
make/resources/android/AndroidManifest-test.xml | 33 +-
make/resources/android/res-test/values/strings.xml | 4 +-
make/scripts/adb-launch-activity.sh | 3 +-
make/scripts/check-java-major-version.sh | 4 +
make/scripts/make.jogl.all.linux-x86_64.sh | 1 -
make/scripts/make.jogl.all.macosx-clang.sh | 29 +
make/scripts/make.jogl.all.macosx-java7.sh | 22 -
make/scripts/make.jogl.all.macosx.sh | 1 +
make/scripts/make.jogl.all.win32.bat | 4 +-
make/scripts/make.jogl.all.win64.bat | 4 +-
make/scripts/setenv-jogl.sh | 4 +-
make/scripts/tests-javaws-x64.bat | 2 +-
make/scripts/tests-osx-x64.sh | 2 +
make/scripts/tests-win.bat | 57 +-
make/scripts/tests-x32-dbg.bat | 16 +-
make/scripts/tests-x32.bat | 13 +-
make/scripts/tests-x64-dbg.bat | 31 +-
make/scripts/tests-x64.bat | 15 +-
make/scripts/tests-x64.sh | 9 +-
make/scripts/tests.sh | 99 +-
.../libavcodec/avcodec.h | 0
.../{ => lavc53_lavf53_lavu51}/libavcodec/avfft.h | 0
.../{ => lavc53_lavf53_lavu51}/libavcodec/dxva2.h | 0
.../{ => lavc53_lavf53_lavu51}/libavcodec/opt.h | 0
.../{ => lavc53_lavf53_lavu51}/libavcodec/vaapi.h | 0
.../{ => lavc53_lavf53_lavu51}/libavcodec/vda.h | 0
.../{ => lavc53_lavf53_lavu51}/libavcodec/vdpau.h | 0
.../libavcodec/version.h | 0
.../{ => lavc53_lavf53_lavu51}/libavcodec/xvmc.h | 0
.../libavformat/avformat.h | 0
.../{ => lavc53_lavf53_lavu51}/libavformat/avio.h | 0
.../libavformat/version.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/adler32.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/aes.h | 0
.../libavutil/attributes.h | 0
.../libavutil/audioconvert.h | 0
.../libavutil/avassert.h | 0
.../libavutil/avconfig.h | 0
.../libavutil/avstring.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/avutil.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/base64.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/bswap.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/common.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/cpu.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/crc.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/dict.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/error.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/eval.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/fifo.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/file.h | 0
.../libavutil/imgutils.h | 0
.../libavutil/intfloat.h | 0
.../libavutil/intfloat_readwrite.h | 0
.../libavutil/intreadwrite.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/lfg.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/log.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/lzo.h | 0
.../libavutil/mathematics.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/md5.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/mem.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/opt.h | 0
.../libavutil/parseutils.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/pixdesc.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/pixfmt.h | 0
.../libavutil/random_seed.h | 0
.../libavutil/rational.h | 0
.../libavutil/samplefmt.h | 0
.../{ => lavc53_lavf53_lavu51}/libavutil/sha.h | 0
.../libavcodec/avcodec.h | 4658 ++++++++++++++++++++
.../lavc54_lavf54_lavu52_lavr01/libavcodec/avfft.h | 116 +
.../lavc54_lavf54_lavu52_lavr01/libavcodec/dxva2.h | 88 +
.../libavcodec/old_codec_ids.h | 366 ++
.../lavc54_lavf54_lavu52_lavr01/libavcodec/vaapi.h | 173 +
.../lavc54_lavf54_lavu52_lavr01/libavcodec/vda.h | 217 +
.../lavc54_lavf54_lavu52_lavr01/libavcodec/vdpau.h | 94 +
.../libavcodec/version.h | 95 +
.../lavc54_lavf54_lavu52_lavr01/libavcodec/xvmc.h | 168 +
.../libavformat/avformat.h | 1749 ++++++++
.../lavc54_lavf54_lavu52_lavr01/libavformat/avio.h | 433 ++
.../libavformat/version.h | 71 +
.../libavresample/avresample.h | 379 ++
.../libavresample/version.h | 46 +
.../libavutil/adler32.h | 0
.../lavc54_lavf54_lavu52_lavr01/libavutil/aes.h | 67 +
.../libavutil/attributes.h | 122 +
.../libavutil/audio_fifo.h | 146 +
.../libavutil/audioconvert.h | 6 +
.../libavutil/avassert.h | 0
.../libavutil/avconfig.h | 0
.../libavutil/avstring.h | 191 +
.../lavc54_lavf54_lavu52_lavr01/libavutil/avutil.h | 275 ++
.../libavutil/base64.h | 0
.../libavutil/blowfish.h | 76 +
.../libavutil/bswap.h | 0
.../libavutil/channel_layout.h | 182 +
.../lavc54_lavf54_lavu52_lavr01/libavutil/common.h | 406 ++
.../lavc54_lavf54_lavu52_lavr01/libavutil/cpu.h | 84 +
.../lavc54_lavf54_lavu52_lavr01/libavutil/crc.h | 74 +
.../lavc54_lavf54_lavu52_lavr01/libavutil/dict.h | 129 +
.../lavc54_lavf54_lavu52_lavr01/libavutil/error.h | 83 +
.../libavutil/eval.h | 0
.../lavc54_lavf54_lavu52_lavr01/libavutil/fifo.h | 131 +
.../lavc54_lavf54_lavu52_lavr01/libavutil/file.h | 54 +
.../libavutil/imgutils.h | 138 +
.../libavutil/intfloat.h | 77 +
.../libavutil/intfloat_readwrite.h | 0
.../libavutil/intreadwrite.h | 549 +++
.../lavc54_lavf54_lavu52_lavr01/libavutil/lfg.h | 62 +
.../lavc54_lavf54_lavu52_lavr01/libavutil/log.h | 173 +
.../lavc54_lavf54_lavu52_lavr01/libavutil/lzo.h | 66 +
.../libavutil/mathematics.h | 111 +
.../lavc54_lavf54_lavu52_lavr01/libavutil/md5.h | 51 +
.../lavc54_lavf54_lavu52_lavr01/libavutil/mem.h | 183 +
.../libavutil/old_pix_fmts.h | 128 +
.../lavc54_lavf54_lavu52_lavr01/libavutil/opt.h | 516 +++
.../libavutil/parseutils.h | 0
.../libavutil/pixdesc.h | 223 +
.../lavc54_lavf54_lavu52_lavr01/libavutil/pixfmt.h | 268 ++
.../libavutil/random_seed.h | 0
.../libavutil/rational.h | 155 +
.../libavutil/samplefmt.h | 220 +
.../lavc54_lavf54_lavu52_lavr01/libavutil/sha.h | 76 +
.../lavc54_lavf54_lavu52_lavr01/libavutil/time.h | 39 +
.../libavutil/version.h | 87 +
.../lavc54_lavf54_lavu52_lavr01/libavutil/xtea.h | 61 +
.../libswresample/swresample.h | 311 ++
.../libswresample/version.h | 45 +
.../libavcodec/avcodec.h | 4277 ++++++++++++++++++
.../lavc55_lavf55_lavu52_lavr01/libavcodec/avfft.h | 116 +
.../lavc55_lavf55_lavu52_lavr01/libavcodec/dxva2.h | 88 +
.../lavc55_lavf55_lavu52_lavr01/libavcodec/vaapi.h | 173 +
.../lavc55_lavf55_lavu52_lavr01/libavcodec/vda.h | 142 +
.../lavc55_lavf55_lavu52_lavr01/libavcodec/vdpau.h | 160 +
.../libavcodec/version.h | 77 +
.../lavc55_lavf55_lavu52_lavr01/libavcodec/xvmc.h | 168 +
.../libavformat/avformat.h | 1708 +++++++
.../lavc55_lavf55_lavu52_lavr01/libavformat/avio.h | 433 ++
.../libavformat/version.h | 52 +
.../libavresample/avresample.h | 409 ++
.../libavresample/version.h | 52 +
.../libavutil/adler32.h | 0
.../lavc55_lavf55_lavu52_lavr01/libavutil/aes.h | 67 +
.../libavutil/attributes.h | 122 +
.../libavutil/audio_fifo.h | 146 +
.../libavutil/audioconvert.h | 6 +
.../libavutil/avassert.h | 0
.../libavutil/avconfig.h | 0
.../libavutil/avstring.h | 226 +
.../lavc55_lavf55_lavu52_lavr01/libavutil/avutil.h | 308 ++
.../libavutil/base64.h | 0
.../libavutil/blowfish.h | 76 +
.../libavutil/bswap.h | 0
.../lavc55_lavf55_lavu52_lavr01/libavutil/buffer.h | 267 ++
.../libavutil/channel_layout.h | 182 +
.../lavc55_lavf55_lavu52_lavr01/libavutil/common.h | 405 ++
.../lavc55_lavf55_lavu52_lavr01/libavutil/cpu.h | 84 +
.../lavc55_lavf55_lavu52_lavr01/libavutil/crc.h | 74 +
.../lavc55_lavf55_lavu52_lavr01/libavutil/dict.h | 146 +
.../lavc55_lavf55_lavu52_lavr01/libavutil/error.h | 83 +
.../libavutil/eval.h | 0
.../lavc55_lavf55_lavu52_lavr01/libavutil/fifo.h | 131 +
.../lavc55_lavf55_lavu52_lavr01/libavutil/file.h | 54 +
.../lavc55_lavf55_lavu52_lavr01/libavutil/frame.h | 491 +++
.../lavc55_lavf55_lavu52_lavr01/libavutil/hmac.h | 95 +
.../libavutil/imgutils.h | 138 +
.../libavutil/intfloat.h | 77 +
.../libavutil/intfloat_readwrite.h | 0
.../libavutil/intreadwrite.h | 549 +++
.../lavc55_lavf55_lavu52_lavr01/libavutil/lfg.h | 62 +
.../lavc55_lavf55_lavu52_lavr01/libavutil/log.h | 173 +
.../lavc55_lavf55_lavu52_lavr01/libavutil/lzo.h | 66 +
.../libavutil/mathematics.h | 111 +
.../lavc55_lavf55_lavu52_lavr01/libavutil/md5.h | 51 +
.../lavc55_lavf55_lavu52_lavr01/libavutil/mem.h | 209 +
.../libavutil/old_pix_fmts.h | 132 +
.../lavc55_lavf55_lavu52_lavr01/libavutil/opt.h | 516 +++
.../libavutil/parseutils.h | 0
.../libavutil/pixdesc.h | 276 ++
.../lavc55_lavf55_lavu52_lavr01/libavutil/pixfmt.h | 277 ++
.../libavutil/random_seed.h | 0
.../libavutil/rational.h | 155 +
.../libavutil/samplefmt.h | 220 +
.../lavc55_lavf55_lavu52_lavr01/libavutil/sha.h | 76 +
.../lavc55_lavf55_lavu52_lavr01/libavutil/time.h | 39 +
.../libavutil/version.h | 96 +
.../lavc55_lavf55_lavu52_lavr01/libavutil/xtea.h | 61 +
.../libswresample/swresample.h | 311 ++
.../libswresample/version.h | 45 +
make/stub_includes/macosx/OpenGL/OpenGL.h | 3 +-
.../com/jogamp/audio/windows/waveout/Audio.java | 10 +-
.../com/jogamp/audio/windows/waveout/Mixer.java | 32 +-
.../jogamp/audio/windows/waveout/SoundBuffer.java | 10 +-
.../com/jogamp/audio/windows/waveout/Track.java | 12 +-
.../com/jogamp/audio/windows/waveout/Vec3f.java | 11 +-
.../gluegen/opengl/BuildComposablePipeline.java | 173 +-
.../jogamp/gluegen/opengl/BuildStaticGLInfo.java | 38 +-
.../com/jogamp/gluegen/opengl/GLConfiguration.java | 40 +-
.../com/jogamp/gluegen/opengl/GLEmitter.java | 58 +-
.../gluegen/opengl/GLJavaMethodBindingEmitter.java | 16 +-
.../jogamp/gluegen/opengl/ant/StaticGLGenTask.java | 73 +-
.../opengl/nativesig/NativeSignatureEmitter.java | 18 +-
.../NativeSignatureJavaMethodBindingEmitter.java | 32 +-
.../gluegen/runtime/opengl/GLNameResolver.java | 20 +-
.../runtime/opengl/GLProcAddressResolver.java | 11 +-
.../com/jogamp/graph/curve/OutlineShape.java | 140 +-
.../classes/com/jogamp/graph/curve/Region.java | 68 +-
.../com/jogamp/graph/curve/opengl/GLRegion.java | 42 +-
.../jogamp/graph/curve/opengl/RegionRenderer.java | 24 +-
.../com/jogamp/graph/curve/opengl/RenderState.java | 33 +-
.../com/jogamp/graph/curve/opengl/Renderer.java | 84 +-
.../jogamp/graph/curve/opengl/TextRenderer.java | 60 +-
.../com/jogamp/graph/curve/tess/Triangulation.java | 2 +-
.../com/jogamp/graph/curve/tess/Triangulator.java | 12 +-
src/jogl/classes/com/jogamp/graph/font/Font.java | 35 +-
.../classes/com/jogamp/graph/font/FontFactory.java | 20 +-
.../classes/com/jogamp/graph/font/FontSet.java | 16 +-
.../classes/com/jogamp/graph/geom/Outline.java | 39 +-
.../classes/com/jogamp/graph/geom/Triangle.java | 11 +-
src/jogl/classes/com/jogamp/graph/geom/Vertex.java | 23 +-
.../com/jogamp/graph/geom/opengl/SVertex.java | 61 +-
src/jogl/classes/com/jogamp/opengl/FBObject.java | 790 ++--
.../com/jogamp/opengl/GLAutoDrawableDelegate.java | 65 +-
.../com/jogamp/opengl/GLEventListenerState.java | 118 +-
.../classes/com/jogamp/opengl/GLExtensions.java | 22 +-
.../com/jogamp/opengl/GLRendererQuirks.java | 206 +-
.../classes/com/jogamp/opengl/GLStateKeeper.java | 40 +-
.../opengl/GenericGLCapabilitiesChooser.java | 10 +-
.../classes/com/jogamp/opengl/JoglVersion.java | 42 +-
.../opengl/cg/CgDynamicLibraryBundleInfo.java | 25 +-
.../classes/com/jogamp/opengl/cg/CgException.java | 14 +-
.../classes/com/jogamp/opengl/math/Binary16.java | 569 +++
.../classes/com/jogamp/opengl/math/Binary32.java | 116 +
.../classes/com/jogamp/opengl/math/Binary64.java | 116 +
.../classes/com/jogamp/opengl/math/FixedPoint.java | 12 +-
.../classes/com/jogamp/opengl/math/FloatUtil.java | 88 +-
.../classes/com/jogamp/opengl/math/Quaternion.java | 40 +-
.../classes/com/jogamp/opengl/math/VectorUtil.java | 46 +-
.../com/jogamp/opengl/math/Vert2fImmutable.java | 4 +-
.../com/jogamp/opengl/math/geom/AABBox.java | 87 +-
.../com/jogamp/opengl/math/geom/Frustum.java | 82 +-
.../classes/com/jogamp/opengl/swt/GLCanvas.java | 314 +-
.../com/jogamp/opengl/util/AWTAnimatorImpl.java | 13 +-
.../classes/com/jogamp/opengl/util/Animator.java | 52 +-
.../com/jogamp/opengl/util/AnimatorBase.java | 110 +-
.../jogamp/opengl/util/DefaultAnimatorImpl.java | 12 +-
.../com/jogamp/opengl/util/FPSAnimator.java | 80 +-
.../com/jogamp/opengl/util/GLArrayDataClient.java | 114 +-
.../jogamp/opengl/util/GLArrayDataEditable.java | 29 +-
.../com/jogamp/opengl/util/GLArrayDataServer.java | 199 +-
.../com/jogamp/opengl/util/GLArrayDataWrapper.java | 152 +-
.../classes/com/jogamp/opengl/util/GLBuffers.java | 402 +-
.../com/jogamp/opengl/util/GLDrawableUtil.java | 48 +-
.../com/jogamp/opengl/util/GLPixelBuffer.java | 241 +-
.../jogamp/opengl/util/GLPixelStorageModes.java | 72 +-
.../com/jogamp/opengl/util/GLReadBufferUtil.java | 79 +-
src/jogl/classes/com/jogamp/opengl/util/Gamma.java | 14 +-
.../com/jogamp/opengl/util/ImmModeSink.java | 388 +-
.../classes/com/jogamp/opengl/util/PMVMatrix.java | 277 +-
.../com/jogamp/opengl/util/RandomTileRenderer.java | 237 +
.../classes/com/jogamp/opengl/util/TGAWriter.java | 16 +-
.../com/jogamp/opengl/util/TileRenderer.java | 537 +++
.../com/jogamp/opengl/util/TileRendererBase.java | 676 +++
.../classes/com/jogamp/opengl/util/TimeFrameI.java | 81 +
.../com/jogamp/opengl/util/av/AudioSink.java | 426 +-
.../jogamp/opengl/util/av/AudioSinkFactory.java | 15 +-
.../com/jogamp/opengl/util/av/GLMediaPlayer.java | 545 ++-
.../opengl/util/av/GLMediaPlayerFactory.java | 25 +-
.../jogamp/opengl/util/awt/AWTGLPixelBuffer.java | 142 +-
.../opengl/util/awt/AWTGLReadBufferUtil.java | 27 +-
.../com/jogamp/opengl/util/awt/ImageUtil.java | 26 +-
.../com/jogamp/opengl/util/awt/Overlay.java | 14 +-
.../com/jogamp/opengl/util/awt/Screenshot.java | 28 +-
.../com/jogamp/opengl/util/awt/TextRenderer.java | 103 +-
.../jogamp/opengl/util/awt/TextureRenderer.java | 28 +-
.../com/jogamp/opengl/util/gl2/BitmapCharRec.java | 18 +-
.../com/jogamp/opengl/util/gl2/BitmapFontRec.java | 18 +-
.../com/jogamp/opengl/util/gl2/CoordRec.java | 18 +-
.../classes/com/jogamp/opengl/util/gl2/GLUT.java | 52 +-
.../com/jogamp/opengl/util/gl2/GLUTBitmap8x13.java | 14 +-
.../com/jogamp/opengl/util/gl2/GLUTBitmap9x15.java | 14 +-
.../opengl/util/gl2/GLUTBitmapHelvetica10.java | 14 +-
.../opengl/util/gl2/GLUTBitmapHelvetica12.java | 14 +-
.../opengl/util/gl2/GLUTBitmapHelvetica18.java | 14 +-
.../opengl/util/gl2/GLUTBitmapTimesRoman10.java | 14 +-
.../opengl/util/gl2/GLUTBitmapTimesRoman24.java | 14 +-
.../opengl/util/gl2/GLUTStrokeMonoRoman.java | 14 +-
.../jogamp/opengl/util/gl2/GLUTStrokeRoman.java | 14 +-
.../com/jogamp/opengl/util/gl2/StrokeCharRec.java | 18 +-
.../com/jogamp/opengl/util/gl2/StrokeFontRec.java | 18 +-
.../com/jogamp/opengl/util/gl2/StrokeRec.java | 20 +-
.../com/jogamp/opengl/util/gl2/TileRenderer.java | 601 ---
.../com/jogamp/opengl/util/glsl/ShaderCode.java | 236 +-
.../com/jogamp/opengl/util/glsl/ShaderProgram.java | 49 +-
.../com/jogamp/opengl/util/glsl/ShaderState.java | 232 +-
.../com/jogamp/opengl/util/glsl/ShaderUtil.java | 54 +-
.../opengl/util/glsl/fixedfunc/FixedFuncUtil.java | 12 +-
.../util/glsl/fixedfunc/ShaderSelectionMode.java | 18 +-
.../jogamp/opengl/util/glsl/sdk/CompileShader.java | 7 +-
.../opengl/util/glsl/sdk/CompileShaderNVidia.java | 4 +
.../opengl/util/packrect/BackingStoreManager.java | 14 +-
.../com/jogamp/opengl/util/packrect/Level.java | 62 +-
.../com/jogamp/opengl/util/packrect/LevelSet.java | 40 +-
.../com/jogamp/opengl/util/packrect/Rect.java | 17 +-
.../jogamp/opengl/util/packrect/RectVisitor.java | 14 +-
.../opengl/util/packrect/RectanglePacker.java | 48 +-
.../com/jogamp/opengl/util/texture/Texture.java | 118 +-
.../jogamp/opengl/util/texture/TextureCoords.java | 17 +-
.../jogamp/opengl/util/texture/TextureData.java | 99 +-
.../com/jogamp/opengl/util/texture/TextureIO.java | 128 +-
.../opengl/util/texture/TextureSequence.java | 165 +-
.../jogamp/opengl/util/texture/TextureState.java | 168 +
.../opengl/util/texture/awt/AWTTextureData.java | 28 +-
.../opengl/util/texture/awt/AWTTextureIO.java | 18 +-
.../jogamp/opengl/util/texture/spi/DDSImage.java | 22 +-
.../jogamp/opengl/util/texture/spi/JPEGImage.java | 42 +-
.../opengl/util/texture/spi/LEDataInputStream.java | 40 +-
.../util/texture/spi/LEDataOutputStream.java | 29 +-
.../util/texture/spi/NetPbmTextureWriter.java | 37 +-
.../jogamp/opengl/util/texture/spi/PNGImage.java | 75 +-
.../jogamp/opengl/util/texture/spi/SGIImage.java | 40 +-
.../jogamp/opengl/util/texture/spi/TGAImage.java | 35 +-
.../opengl/util/texture/spi/TextureProvider.java | 14 +-
.../opengl/util/texture/spi/TextureWriter.java | 14 +-
.../util/texture/spi/awt/IIOTextureProvider.java | 17 +-
.../util/texture/spi/awt/IIOTextureWriter.java | 17 +-
src/jogl/classes/javax/media/opengl/DebugGL2.java | 2 +-
src/jogl/classes/javax/media/opengl/DebugGL3.java | 2 +-
.../classes/javax/media/opengl/DebugGL3bc.java | 2 +-
src/jogl/classes/javax/media/opengl/DebugGL4.java | 2 +-
.../classes/javax/media/opengl/DebugGLES2.java | 2 +-
.../media/opengl/DefaultGLCapabilitiesChooser.java | 32 +-
.../classes/javax/media/opengl/FPSCounter.java | 32 +-
.../javax/media/opengl/GLAnimatorControl.java | 16 +-
.../classes/javax/media/opengl/GLArrayData.java | 21 +-
.../classes/javax/media/opengl/GLAutoDrawable.java | 163 +-
src/jogl/classes/javax/media/opengl/GLBase.java | 133 +-
.../classes/javax/media/opengl/GLCapabilities.java | 23 +-
.../javax/media/opengl/GLCapabilitiesChooser.java | 16 +-
.../media/opengl/GLCapabilitiesImmutable.java | 10 +-
src/jogl/classes/javax/media/opengl/GLContext.java | 590 ++-
.../javax/media/opengl/GLDebugListener.java | 8 +-
.../classes/javax/media/opengl/GLDebugMessage.java | 117 +-
.../classes/javax/media/opengl/GLDrawable.java | 33 +-
.../javax/media/opengl/GLDrawableFactory.java | 282 +-
.../javax/media/opengl/GLEventListener.java | 22 +-
.../classes/javax/media/opengl/GLException.java | 14 +-
.../classes/javax/media/opengl/GLFBODrawable.java | 84 +-
.../media/opengl/GLOffscreenAutoDrawable.java | 22 +-
src/jogl/classes/javax/media/opengl/GLPbuffer.java | 4 +-
.../javax/media/opengl/GLPipelineFactory.java | 22 +-
src/jogl/classes/javax/media/opengl/GLProfile.java | 429 +-
.../classes/javax/media/opengl/GLRunnable.java | 20 +-
.../classes/javax/media/opengl/GLRunnable2.java | 14 +-
.../javax/media/opengl/GLSharedContextSetter.java | 146 +
.../classes/javax/media/opengl/GLUniformData.java | 15 +-
src/jogl/classes/javax/media/opengl/Threading.java | 52 +-
src/jogl/classes/javax/media/opengl/TraceGL2.java | 2 +-
src/jogl/classes/javax/media/opengl/TraceGL3.java | 2 +-
.../classes/javax/media/opengl/TraceGL3bc.java | 2 +-
src/jogl/classes/javax/media/opengl/TraceGL4.java | 2 +-
.../classes/javax/media/opengl/TraceGLES2.java | 2 +-
.../javax/media/opengl/awt/ComponentEvents.java | 14 +-
.../classes/javax/media/opengl/awt/GLCanvas.java | 381 +-
.../classes/javax/media/opengl/awt/GLJPanel.java | 651 ++-
.../javax/media/opengl/fixedfunc/GLMatrixFunc.java | 18 +-
.../media/opengl/fixedfunc/GLPointerFunc.java | 2 +-
.../media/opengl/fixedfunc/GLPointerFuncUtil.java | 10 +-
.../opengl/glu/GLUtessellatorCallbackAdapter.java | 12 +
.../jogamp/graph/curve/opengl/RegionFactory.java | 20 +-
.../graph/curve/opengl/RegionRendererImpl01.java | 25 +-
.../jogamp/graph/curve/opengl/RenderStateImpl.java | 17 +-
.../graph/curve/opengl/TextRendererImpl01.java | 26 +-
.../jogamp/graph/curve/opengl/VBORegion2PES2.java | 181 +-
.../jogamp/graph/curve/opengl/VBORegionSPES2.java | 37 +-
.../graph/curve/opengl/shader/AttributeNames.java | 12 +-
.../graph/curve/opengl/shader/UniformNames.java | 2 +-
.../jogamp/graph/curve/tess/CDTriangulator2D.java | 33 +-
.../jogamp/graph/curve/tess/GraphOutline.java | 10 +-
.../jogamp/graph/curve/tess/GraphVertex.java | 12 +-
.../classes/jogamp/graph/curve/tess/HEdge.java | 12 +-
src/jogl/classes/jogamp/graph/curve/tess/Loop.java | 30 +-
.../jogamp/graph/curve/text/GlyphShape.java | 20 +-
.../jogamp/graph/curve/text/GlyphString.java | 58 +-
src/jogl/classes/jogamp/graph/font/FontInt.java | 2 +-
.../classes/jogamp/graph/font/JavaFontLoader.java | 49 +-
.../jogamp/graph/font/UbuntuFontLoader.java | 123 +-
.../jogamp/graph/font/typecast/TypecastFont.java | 70 +-
.../font/typecast/TypecastFontConstructor.java | 14 +-
.../jogamp/graph/font/typecast/TypecastGlyph.java | 96 +-
.../graph/font/typecast/TypecastHMetrics.java | 20 +-
.../graph/font/typecast/TypecastRenderer.java | 26 +-
.../graph/font/typecast/ot/Disassembler.java | 8 +-
.../jogamp/graph/font/typecast/ot/Fixed.java | 4 +-
.../jogamp/graph/font/typecast/ot/Mnemonic.java | 8 +-
.../jogamp/graph/font/typecast/ot/OTFont.java | 37 +-
.../graph/font/typecast/ot/OTFontCollection.java | 4 +-
.../jogamp/graph/font/typecast/ot/OTGlyph.java | 8 +-
.../graph/font/typecast/ot/mac/ResourceData.java | 2 +-
.../graph/font/typecast/ot/mac/ResourceFile.java | 10 +-
.../graph/font/typecast/ot/mac/ResourceHeader.java | 6 +-
.../graph/font/typecast/ot/mac/ResourceMap.java | 10 +-
.../font/typecast/ot/mac/ResourceReference.java | 12 +-
.../graph/font/typecast/ot/mac/ResourceType.java | 10 +-
.../graph/font/typecast/ot/table/BaseTable.java | 111 +-
.../graph/font/typecast/ot/table/CffTable.java | 136 +-
.../graph/font/typecast/ot/table/Charstring.java | 2 +-
.../font/typecast/ot/table/CharstringType2.java | 21 +-
.../graph/font/typecast/ot/table/ClassDef.java | 8 +-
.../font/typecast/ot/table/ClassDefFormat1.java | 9 +-
.../font/typecast/ot/table/ClassDefFormat2.java | 9 +-
.../graph/font/typecast/ot/table/CmapFormat.java | 15 +-
.../graph/font/typecast/ot/table/CmapFormat0.java | 5 +-
.../graph/font/typecast/ot/table/CmapFormat2.java | 31 +-
.../graph/font/typecast/ot/table/CmapFormat4.java | 8 +-
.../graph/font/typecast/ot/table/CmapFormat6.java | 7 +-
.../font/typecast/ot/table/CmapFormatUnknown.java | 9 +-
.../font/typecast/ot/table/CmapIndexEntry.java | 4 +-
.../graph/font/typecast/ot/table/CmapTable.java | 13 +-
.../graph/font/typecast/ot/table/Coverage.java | 2 +-
.../font/typecast/ot/table/CoverageFormat1.java | 2 +
.../font/typecast/ot/table/CoverageFormat2.java | 2 +
.../graph/font/typecast/ot/table/CvtTable.java | 15 +-
.../graph/font/typecast/ot/table/Device.java | 8 +-
.../font/typecast/ot/table/DirectoryEntry.java | 6 +-
.../graph/font/typecast/ot/table/DsigEntry.java | 14 +-
.../graph/font/typecast/ot/table/DsigTable.java | 15 +-
.../graph/font/typecast/ot/table/FeatureList.java | 8 +-
.../font/typecast/ot/table/FeatureRecord.java | 2 +-
.../graph/font/typecast/ot/table/FpgmTable.java | 15 +-
.../graph/font/typecast/ot/table/GaspRange.java | 13 +-
.../graph/font/typecast/ot/table/GaspTable.java | 17 +-
.../typecast/ot/table/GlyfCompositeDescript.java | 9 +-
.../graph/font/typecast/ot/table/GlyfDescript.java | 8 +-
.../font/typecast/ot/table/GlyfSimpleDescript.java | 12 +-
.../graph/font/typecast/ot/table/GlyfTable.java | 8 +-
.../font/typecast/ot/table/GlyphDescription.java | 24 +-
.../graph/font/typecast/ot/table/GposTable.java | 7 +-
.../graph/font/typecast/ot/table/GsubTable.java | 24 +-
.../graph/font/typecast/ot/table/HdmxTable.java | 23 +-
.../graph/font/typecast/ot/table/HeadTable.java | 7 +-
.../graph/font/typecast/ot/table/HheaTable.java | 15 +-
.../graph/font/typecast/ot/table/HmtxTable.java | 3 +
.../jogamp/graph/font/typecast/ot/table/ID.java | 4 +-
.../graph/font/typecast/ot/table/KernSubtable.java | 12 +-
.../typecast/ot/table/KernSubtableFormat0.java | 12 +-
.../typecast/ot/table/KernSubtableFormat2.java | 10 +-
.../graph/font/typecast/ot/table/KernTable.java | 16 +-
.../graph/font/typecast/ot/table/KerningPair.java | 8 +-
.../graph/font/typecast/ot/table/LangSys.java | 10 +-
.../font/typecast/ot/table/LangSysRecord.java | 2 +-
.../graph/font/typecast/ot/table/Ligature.java | 4 +-
.../typecast/ot/table/LigatureSubstFormat1.java | 3 +-
.../graph/font/typecast/ot/table/LocaTable.java | 13 +-
.../graph/font/typecast/ot/table/Lookup.java | 2 +-
.../graph/font/typecast/ot/table/LookupList.java | 8 +-
.../typecast/ot/table/LookupSubtableFactory.java | 4 +-
.../graph/font/typecast/ot/table/LtshTable.java | 19 +-
.../graph/font/typecast/ot/table/MaxpTable.java | 17 +-
.../graph/font/typecast/ot/table/NameRecord.java | 19 +-
.../graph/font/typecast/ot/table/NameTable.java | 16 +-
.../graph/font/typecast/ot/table/Os2Table.java | 17 +-
.../graph/font/typecast/ot/table/Panose.java | 27 +-
.../graph/font/typecast/ot/table/PcltTable.java | 17 +-
.../graph/font/typecast/ot/table/PostTable.java | 21 +-
.../graph/font/typecast/ot/table/PrepTable.java | 15 +-
.../graph/font/typecast/ot/table/Program.java | 8 +-
.../graph/font/typecast/ot/table/RangeRecord.java | 2 +-
.../graph/font/typecast/ot/table/Script.java | 6 +-
.../graph/font/typecast/ot/table/ScriptList.java | 12 +-
.../graph/font/typecast/ot/table/ScriptRecord.java | 4 +-
.../font/typecast/ot/table/SignatureBlock.java | 11 +-
.../graph/font/typecast/ot/table/SingleSubst.java | 2 +-
.../font/typecast/ot/table/SingleSubstFormat1.java | 5 +-
.../font/typecast/ot/table/SingleSubstFormat2.java | 5 +-
.../graph/font/typecast/ot/table/TTCHeader.java | 12 +-
.../jogamp/graph/font/typecast/ot/table/Table.java | 12 +-
.../font/typecast/ot/table/TableDirectory.java | 3 +-
.../font/typecast/ot/table/TableException.java | 6 +-
.../graph/font/typecast/ot/table/TableFactory.java | 10 +-
.../graph/font/typecast/ot/table/VdmxTable.java | 43 +-
.../graph/font/typecast/ot/table/VheaTable.java | 5 +-
.../graph/font/typecast/ot/table/VmtxTable.java | 3 +
.../graph/font/typecast/t2/T2Interpreter.java | 146 +-
.../graph/font/typecast/tt/engine/Interpreter.java | 4 +-
.../graph/font/typecast/tt/engine/Parser.java | 1 +
.../jogamp/graph/geom/plane/AffineTransform.java | 50 +-
.../classes/jogamp/graph/geom/plane/Crossing.java | 26 +-
.../classes/jogamp/graph/geom/plane/Path2D.java | 47 +-
src/jogl/classes/jogamp/opengl/Debug.java | 21 +-
.../opengl/DesktopGLDynamicLibraryBundleInfo.java | 14 +-
.../opengl/DesktopGLDynamicLookupHelper.java | 11 +-
.../jogamp/opengl/ExtensionAvailabilityCache.java | 45 +-
src/jogl/classes/jogamp/opengl/FPSCounterImpl.java | 61 +-
.../classes/jogamp/opengl/GLAutoDrawableBase.java | 218 +-
.../classes/jogamp/opengl/GLBufferSizeTracker.java | 29 +-
.../jogamp/opengl/GLBufferStateTracker.java | 62 +-
src/jogl/classes/jogamp/opengl/GLContextImpl.java | 680 +--
.../classes/jogamp/opengl/GLContextShareSet.java | 196 +-
.../jogamp/opengl/GLDebugMessageHandler.java | 128 +-
.../jogamp/opengl/GLDrawableFactoryImpl.java | 113 +-
.../classes/jogamp/opengl/GLDrawableHelper.java | 271 +-
src/jogl/classes/jogamp/opengl/GLDrawableImpl.java | 70 +-
.../jogamp/opengl/GLDynamicLibraryBundleInfo.java | 19 +-
.../jogamp/opengl/GLDynamicLookupHelper.java | 10 +-
.../classes/jogamp/opengl/GLFBODrawableImpl.java | 153 +-
.../jogamp/opengl/GLGraphicsConfigurationUtil.java | 60 +-
.../jogamp/opengl/GLOffscreenAutoDrawableImpl.java | 45 +-
src/jogl/classes/jogamp/opengl/GLPbufferImpl.java | 16 +-
src/jogl/classes/jogamp/opengl/GLRunnableTask.java | 29 +-
src/jogl/classes/jogamp/opengl/GLStateTracker.java | 59 +-
.../classes/jogamp/opengl/GLVersionNumber.java | 20 +-
src/jogl/classes/jogamp/opengl/GLWorkerThread.java | 25 +-
src/jogl/classes/jogamp/opengl/GLXExtensions.java | 4 +-
.../jogamp/opengl/ListenerSyncedImplStub.java | 12 +-
src/jogl/classes/jogamp/opengl/MemoryObject.java | 2 +
src/jogl/classes/jogamp/opengl/ProjectFloat.java | 120 +-
.../jogamp/opengl/SharedResourceRunner.java | 208 +-
src/jogl/classes/jogamp/opengl/ThreadingImpl.java | 39 +-
.../jogamp/opengl/ToolkitThreadingPlugin.java | 16 +-
.../android/av/AndroidGLMediaPlayerAPI14.java | 418 +-
.../jogamp/opengl/awt/AWTThreadingPlugin.java | 19 +-
.../classes/jogamp/opengl/awt/AWTTilePainter.java | 389 ++
src/jogl/classes/jogamp/opengl/awt/AWTUtil.java | 16 +-
src/jogl/classes/jogamp/opengl/awt/Java2D.java | 49 +-
.../classes/jogamp/opengl/awt/VersionApplet.java | 15 +-
.../egl/DesktopES2DynamicLibraryBundleInfo.java | 31 +-
src/jogl/classes/jogamp/opengl/egl/EGLContext.java | 38 +-
.../classes/jogamp/opengl/egl/EGLDisplayUtil.java | 65 +-
.../classes/jogamp/opengl/egl/EGLDrawable.java | 21 +-
.../jogamp/opengl/egl/EGLDrawableFactory.java | 140 +-
.../opengl/egl/EGLDummyUpstreamSurfaceHook.java | 13 +-
.../opengl/egl/EGLDynamicLibraryBundleInfo.java | 30 +-
.../opengl/egl/EGLES1DynamicLibraryBundleInfo.java | 29 +-
.../opengl/egl/EGLES2DynamicLibraryBundleInfo.java | 39 +-
.../jogamp/opengl/egl/EGLExternalContext.java | 5 +-
.../opengl/egl/EGLGraphicsConfiguration.java | 58 +-
.../egl/EGLGraphicsConfigurationFactory.java | 71 +-
.../jogamp/opengl/egl/EGLOnscreenDrawable.java | 4 +-
.../jogamp/opengl/egl/EGLUpstreamSurfaceHook.java | 51 +-
.../jogamp/opengl/egl/EGLWrappedSurface.java | 10 +-
.../classes/jogamp/opengl/gl2/ProjectDouble.java | 92 +-
.../classes/jogamp/opengl/glu/GLUquadricImpl.java | 88 +-
src/jogl/classes/jogamp/opengl/glu/Glue.java | 16 +-
.../classes/jogamp/opengl/glu/error/Error.java | 16 +-
.../opengl/glu/gl2/nurbs/GL2CurveEvaluator.java | 8 +-
.../opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java | 8 +
.../opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java | 38 +-
.../jogamp/opengl/glu/mipmap/BuildMipmap.java | 198 +-
.../classes/jogamp/opengl/glu/mipmap/Extract.java | 8 +-
.../jogamp/opengl/glu/mipmap/Extract1010102.java | 26 +-
.../jogamp/opengl/glu/mipmap/Extract1555rev.java | 26 +-
.../opengl/glu/mipmap/Extract2101010rev.java | 26 +-
.../jogamp/opengl/glu/mipmap/Extract233rev.java | 20 +-
.../jogamp/opengl/glu/mipmap/Extract332.java | 20 +-
.../jogamp/opengl/glu/mipmap/Extract4444.java | 26 +-
.../jogamp/opengl/glu/mipmap/Extract4444rev.java | 26 +-
.../jogamp/opengl/glu/mipmap/Extract5551.java | 26 +-
.../jogamp/opengl/glu/mipmap/Extract565.java | 26 +-
.../jogamp/opengl/glu/mipmap/Extract565rev.java | 26 +-
.../jogamp/opengl/glu/mipmap/Extract8888.java | 26 +-
.../jogamp/opengl/glu/mipmap/Extract8888rev.java | 26 +-
.../jogamp/opengl/glu/mipmap/ExtractFloat.java | 16 +-
.../jogamp/opengl/glu/mipmap/ExtractPrimitive.java | 8 +-
.../jogamp/opengl/glu/mipmap/ExtractSByte.java | 16 +-
.../jogamp/opengl/glu/mipmap/ExtractSInt.java | 16 +-
.../jogamp/opengl/glu/mipmap/ExtractSShort.java | 16 +-
.../jogamp/opengl/glu/mipmap/ExtractUByte.java | 16 +-
.../jogamp/opengl/glu/mipmap/ExtractUInt.java | 16 +-
.../jogamp/opengl/glu/mipmap/ExtractUShort.java | 16 +-
.../jogamp/opengl/glu/mipmap/HalveImage.java | 276 +-
.../classes/jogamp/opengl/glu/mipmap/Image.java | 120 +-
.../classes/jogamp/opengl/glu/mipmap/Mipmap.java | 200 +-
.../opengl/glu/mipmap/PixelStorageModes.java | 14 +-
.../jogamp/opengl/glu/mipmap/ScaleInternal.java | 441 +-
.../jogamp/opengl/glu/mipmap/Type_Widget.java | 80 +-
src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java | 18 +-
.../jogamp/opengl/glu/nurbs/ArcSdirSorter.java | 2 +-
.../jogamp/opengl/glu/nurbs/ArcTdirSorter.java | 2 +-
.../classes/jogamp/opengl/glu/nurbs/Backend.java | 2 +-
src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java | 2 +-
.../classes/jogamp/opengl/glu/nurbs/Breakpt.java | 4 +-
.../jogamp/opengl/glu/nurbs/CArrayOfArcs.java | 32 +-
.../jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java | 22 +-
.../jogamp/opengl/glu/nurbs/CArrayOfFloats.java | 32 +-
.../opengl/glu/nurbs/CArrayOfQuiltspecs.java | 28 +-
.../classes/jogamp/opengl/glu/nurbs/Curve.java | 6 +-
.../classes/jogamp/opengl/glu/nurbs/Flist.java | 6 +-
.../classes/jogamp/opengl/glu/nurbs/Knotspec.java | 20 +-
.../jogamp/opengl/glu/nurbs/Knotvector.java | 14 +-
.../classes/jogamp/opengl/glu/nurbs/Mapdesc.java | 12 +-
.../jogamp/opengl/glu/nurbs/O_nurbscurve.java | 2 +-
.../classes/jogamp/opengl/glu/nurbs/Patchlist.java | 2 +-
.../classes/jogamp/opengl/glu/nurbs/Property.java | 6 +-
.../jogamp/opengl/glu/nurbs/Renderhints.java | 2 +-
.../jogamp/opengl/glu/nurbs/Subdivider.java | 6 +-
.../jogamp/opengl/glu/nurbs/TrimVertex.java | 4 +-
.../jogamp/opengl/glu/registry/Registry.java | 14 +-
.../opengl/glu/tessellator/PriorityQHeap.java | 7 +
.../opengl/glu/tessellator/PriorityQSort.java | 7 +
.../jogamp/opengl/glu/tessellator/Render.java | 3 +
.../jogamp/opengl/glu/tessellator/Sweep.java | 6 +-
.../jogamp/opengl/macosx/cgl/MacOSXCGLContext.java | 208 +-
.../opengl/macosx/cgl/MacOSXCGLDrawable.java | 10 +-
.../macosx/cgl/MacOSXCGLDrawableFactory.java | 29 +-
.../cgl/MacOSXCGLDynamicLibraryBundleInfo.java | 18 +-
.../macosx/cgl/MacOSXCGLGraphicsConfiguration.java | 63 +-
.../cgl/MacOSXCGLGraphicsConfigurationFactory.java | 19 +-
.../macosx/cgl/MacOSXExternalCGLContext.java | 5 +-
.../macosx/cgl/MacOSXPbufferCGLDrawable.java | 4 +-
.../MacOSXAWTCGLGraphicsConfigurationFactory.java | 13 +-
.../jogamp/opengl/openal/av/ALAudioSink.java | 821 +++-
.../jogamp/opengl/openal/av/ALDummyUsage.java | 3 -
.../classes/jogamp/opengl/util/GLArrayHandler.java | 24 +-
.../jogamp/opengl/util/GLArrayHandlerFlat.java | 14 +-
.../opengl/util/GLArrayHandlerInterleaved.java | 27 +-
.../jogamp/opengl/util/GLDataArrayHandler.java | 15 +-
.../jogamp/opengl/util/GLFixedArrayHandler.java | 21 +-
.../opengl/util/GLFixedArrayHandlerFlat.java | 11 +-
.../jogamp/opengl/util/GLVBOArrayHandler.java | 14 +-
.../jogamp/opengl/util/av/EGLMediaPlayerImpl.java | 65 +-
.../jogamp/opengl/util/av/GLMediaPlayerImpl.java | 1473 +++++--
.../jogamp/opengl/util/av/JavaSoundAudioSink.java | 170 +-
.../jogamp/opengl/util/av/NullAudioSink.java | 103 +-
.../jogamp/opengl/util/av/NullGLMediaPlayer.java | 137 +-
.../jogamp/opengl/util/av/SyncedRingbuffer.java | 286 --
.../av/impl/FFMPEGDynamicLibraryBundleInfo.java | 402 +-
.../opengl/util/av/impl/FFMPEGMediaPlayer.java | 1135 ++---
.../jogamp/opengl/util/av/impl/FFMPEGNatives.java | 276 ++
.../opengl/util/av/impl/FFMPEGStaticNatives.java | 41 +
.../opengl/util/av/impl/FFMPEGv08Natives.java | 78 +
.../opengl/util/av/impl/FFMPEGv09Natives.java | 78 +
.../opengl/util/av/impl/FFMPEGv10Natives.java | 78 +
.../opengl/util/av/impl/OMXGLMediaPlayer.java | 130 +-
.../jogamp/opengl/util/glsl/GLSLArrayHandler.java | 28 +-
.../opengl/util/glsl/GLSLArrayHandlerFlat.java | 13 +-
.../util/glsl/GLSLArrayHandlerInterleaved.java | 26 +-
.../jogamp/opengl/util/glsl/GLSLTextureRaster.java | 70 +-
.../opengl/util/glsl/fixedfunc/FixedFuncHook.java | 115 +-
.../util/glsl/fixedfunc/FixedFuncPipeline.java | 250 +-
.../jogamp/opengl/util/jpeg/JPEGDecoder.java | 144 +-
.../jogamp/opengl/util/pngj/FilterType.java | 2 +-
.../classes/jogamp/opengl/util/pngj/ImageInfo.java | 2 +-
.../classes/jogamp/opengl/util/pngj/ImageLine.java | 31 +-
.../jogamp/opengl/util/pngj/ImageLineHelper.java | 9 +-
.../jogamp/opengl/util/pngj/ImageLines.java | 8 +-
.../jogamp/opengl/util/pngj/PngHelperInternal.java | 3 +-
.../classes/jogamp/opengl/util/pngj/PngReader.java | 57 +-
.../classes/jogamp/opengl/util/pngj/PngWriter.java | 28 +-
.../jogamp/opengl/util/pngj/PngjException.java | 4 +-
.../opengl/util/pngj/PngjExceptionInternal.java | 4 +-
.../opengl/util/pngj/chunks/ChunkHelper.java | 16 +-
.../util/pngj/chunks/ChunkLoadBehaviour.java | 2 +-
.../opengl/util/pngj/chunks/ChunkPredicate.java | 2 +-
.../jogamp/opengl/util/pngj/chunks/ChunkRaw.java | 1 +
.../jogamp/opengl/util/pngj/chunks/ChunksList.java | 16 +-
.../util/pngj/chunks/ChunksListForWrite.java | 8 +-
.../jogamp/opengl/util/pngj/chunks/PngChunk.java | 2 +-
.../opengl/util/pngj/chunks/PngChunkBKGD.java | 6 +-
.../opengl/util/pngj/chunks/PngChunkMultiple.java | 4 +-
.../opengl/util/pngj/chunks/PngChunkSBIT.java | 2 +-
.../opengl/util/pngj/chunks/PngChunkSingle.java | 1 +
.../opengl/util/pngj/chunks/PngChunkTRNS.java | 2 +-
.../opengl/util/pngj/chunks/PngMetadata.java | 11 +-
.../opengl/windows/wgl/WGLGLCapabilities.java | 8 +-
.../classes/jogamp/opengl/windows/wgl/WGLUtil.java | 22 +-
.../windows/wgl/WindowsBitmapWGLDrawable.java | 4 +-
.../windows/wgl/WindowsExternalWGLContext.java | 7 +-
.../windows/wgl/WindowsPbufferWGLDrawable.java | 6 +-
.../opengl/windows/wgl/WindowsWGLContext.java | 18 +-
.../opengl/windows/wgl/WindowsWGLDrawable.java | 8 +-
.../windows/wgl/WindowsWGLDrawableFactory.java | 43 +-
.../wgl/WindowsWGLDynamicLibraryBundleInfo.java | 14 +-
.../wgl/WindowsWGLGraphicsConfiguration.java | 74 +-
.../WindowsWGLGraphicsConfigurationFactory.java | 43 +-
.../WindowsAWTWGLGraphicsConfigurationFactory.java | 23 +-
.../classes/jogamp/opengl/x11/glx/GLXUtil.java | 44 +-
.../opengl/x11/glx/X11ExternalGLXContext.java | 10 +-
.../opengl/x11/glx/X11ExternalGLXDrawable.java | 2 +-
.../jogamp/opengl/x11/glx/X11GLXContext.java | 28 +-
.../opengl/x11/glx/X11GLXDrawableFactory.java | 51 +-
.../x11/glx/X11GLXDynamicLibraryBundleInfo.java | 22 +-
.../x11/glx/X11GLXGraphicsConfiguration.java | 62 +-
.../glx/X11GLXGraphicsConfigurationFactory.java | 47 +-
src/jogl/native/GLContext.c | 46 +
src/jogl/native/JoglCommon.c | 40 -
src/jogl/native/libav/ffmpeg_dshow.c | 215 +
src/jogl/native/libav/ffmpeg_dshow.h | 47 +
src/jogl/native/libav/ffmpeg_impl_template.c | 1548 +++++++
.../native/libav/ffmpeg_lavc53_lavf53_lavu51.c | 33 +
.../libav/ffmpeg_lavc54_lavf54_lavu52_lavr01.c | 33 +
.../libav/ffmpeg_lavc55_lavf55_lavu52_lavr01.c | 33 +
src/jogl/native/libav/ffmpeg_static.c | 91 +
src/jogl/native/libav/ffmpeg_static.h | 50 +
src/jogl/native/libav/ffmpeg_tool.h | 119 +-
.../jogamp_opengl_util_av_impl_FFMPEGMediaPlayer.c | 784 ----
src/jogl/native/macosx/MacOSXCustomCGLCode.c | 2 +-
.../macosx/MacOSXWindowSystemInterface-calayer.m | 77 +-
.../jogamp_opengl_util_av_impl_OMXGLMediaPlayer.c | 4 +-
src/jogl/native/openmax/omx_tool.c | 12 +-
src/jogl/native/openmax/omx_tool.h | 4 +-
.../DelegatedUpstreamSurfaceHookMutableSize.java | 6 +-
...elegatedUpstreamSurfaceHookWithSurfaceSize.java | 8 +-
.../nativewindow/MutableGraphicsConfiguration.java | 4 +-
.../jogamp/nativewindow/NativeWindowVersion.java | 10 +-
.../UpstreamSurfaceHookMutableSize.java | 10 +-
.../nativewindow/awt/AWTGraphicsConfiguration.java | 27 +-
.../jogamp/nativewindow/awt/AWTGraphicsDevice.java | 14 +-
.../jogamp/nativewindow/awt/AWTGraphicsScreen.java | 15 +-
.../jogamp/nativewindow/awt/AWTPrintLifecycle.java | 175 +
.../nativewindow/awt/AWTWindowClosingProtocol.java | 4 +-
.../nativewindow/awt/DirectDataBufferInt.java | 297 ++
.../com/jogamp/nativewindow/awt/JAWTWindow.java | 227 +-
.../jogamp/nativewindow/egl/EGLGraphicsDevice.java | 30 +-
.../nativewindow/macosx/MacOSXGraphicsDevice.java | 11 +-
.../com/jogamp/nativewindow/swt/SWTAccessor.java | 168 +-
.../windows/WindowsGraphicsDevice.java | 13 +-
.../nativewindow/x11/X11GraphicsConfiguration.java | 16 +-
.../jogamp/nativewindow/x11/X11GraphicsDevice.java | 30 +-
.../jogamp/nativewindow/x11/X11GraphicsScreen.java | 13 +-
.../AbstractGraphicsConfiguration.java | 16 +-
.../media/nativewindow/AbstractGraphicsDevice.java | 46 +-
.../media/nativewindow/AbstractGraphicsScreen.java | 16 +-
.../javax/media/nativewindow/Capabilities.java | 46 +-
.../media/nativewindow/CapabilitiesChooser.java | 16 +-
.../media/nativewindow/CapabilitiesImmutable.java | 8 +-
.../nativewindow/DefaultCapabilitiesChooser.java | 25 +-
.../nativewindow/DefaultGraphicsConfiguration.java | 22 +-
.../media/nativewindow/DefaultGraphicsDevice.java | 34 +-
.../media/nativewindow/DefaultGraphicsScreen.java | 14 +-
.../nativewindow/GraphicsConfigurationFactory.java | 86 +-
.../javax/media/nativewindow/MutableSurface.java | 4 +-
.../javax/media/nativewindow/NativeSurface.java | 40 +-
.../media/nativewindow/NativeWindowException.java | 14 +-
.../media/nativewindow/NativeWindowFactory.java | 138 +-
.../media/nativewindow/OffscreenLayerOption.java | 12 +-
.../media/nativewindow/OffscreenLayerSurface.java | 22 +-
.../javax/media/nativewindow/ProxySurface.java | 61 +-
.../media/nativewindow/SurfaceUpdatedListener.java | 12 +-
.../javax/media/nativewindow/ToolkitLock.java | 14 +-
.../media/nativewindow/UpstreamSurfaceHook.java | 18 +-
.../javax/media/nativewindow/VisualIDHolder.java | 37 +-
.../media/nativewindow/WindowClosingProtocol.java | 4 +-
.../javax/media/nativewindow/util/Dimension.java | 38 +-
.../nativewindow/util/DimensionImmutable.java | 6 +-
.../javax/media/nativewindow/util/Insets.java | 34 +-
.../media/nativewindow/util/InsetsImmutable.java | 6 +-
.../javax/media/nativewindow/util/Point.java | 24 +-
.../media/nativewindow/util/PointImmutable.java | 8 +-
.../javax/media/nativewindow/util/Rectangle.java | 44 +-
.../nativewindow/util/RectangleImmutable.java | 12 +-
.../javax/media/nativewindow/util/SurfaceSize.java | 23 +-
.../classes/jogamp/nativewindow/Debug.java | 17 +-
.../DefaultGraphicsConfigurationFactoryImpl.java | 11 +-
.../jogamp/nativewindow/GlobalToolkitLock.java | 15 +-
.../jogamp/nativewindow/NWJNILibLoader.java | 39 +-
.../nativewindow/NativeWindowFactoryImpl.java | 17 +-
.../jogamp/nativewindow/NullToolkitLock.java | 11 +-
.../jogamp/nativewindow/ProxySurfaceImpl.java | 43 +-
.../jogamp/nativewindow/ResourceToolkitLock.java | 9 +-
.../nativewindow/SharedResourceToolkitLock.java | 19 +-
.../jogamp/nativewindow/SurfaceUpdatedHelper.java | 23 +-
.../jogamp/nativewindow/ToolkitProperties.java | 20 +-
.../jogamp/nativewindow/WrappedSurface.java | 13 +-
.../classes/jogamp/nativewindow/awt/AWTMisc.java | 70 +-
.../jogamp/nativewindow/jawt/JAWTJNILibLoader.java | 25 +-
.../classes/jogamp/nativewindow/jawt/JAWTUtil.java | 201 +-
.../nativewindow/jawt/JAWT_PlatformInfo.java | 14 +-
.../nativewindow/jawt/macosx/MacOSXJAWTWindow.java | 171 +-
.../jawt/windows/Win32SunJDKReflection.java | 15 +-
.../jawt/windows/WindowsJAWTWindow.java | 21 +-
.../nativewindow/jawt/x11/X11JAWTWindow.java | 23 +-
.../nativewindow/jawt/x11/X11SunJDKReflection.java | 15 +-
.../macosx/OSXDummyUpstreamSurfaceHook.java | 14 +-
.../jogamp/nativewindow/macosx/OSXUtil.java | 136 +-
.../windows/GDIDummyUpstreamSurfaceHook.java | 18 +-
.../jogamp/nativewindow/windows/GDISurface.java | 14 +-
.../jogamp/nativewindow/windows/GDIUtil.java | 36 +-
.../nativewindow/windows/RegisteredClass.java | 2 +-
.../windows/RegisteredClassFactory.java | 16 +-
.../x11/X11DummyUpstreamSurfaceHook.java | 14 +-
.../x11/X11GraphicsConfigurationFactory.java | 17 +-
.../classes/jogamp/nativewindow/x11/X11Util.java | 101 +-
.../awt/X11AWTGraphicsConfigurationFactory.java | 37 +-
src/nativewindow/native/JAWT_DrawingSurfaceInfo.c | 2 +-
.../native/macosx/NativeWindowProtocols.h | 28 +-
src/nativewindow/native/macosx/OSXmisc.m | 261 +-
src/newt/classes/com/jogamp/newt/Display.java | 36 +-
.../classes/com/jogamp/newt/MonitorDevice.java | 54 +-
src/newt/classes/com/jogamp/newt/MonitorMode.java | 94 +-
src/newt/classes/com/jogamp/newt/NewtFactory.java | 25 +-
src/newt/classes/com/jogamp/newt/NewtVersion.java | 10 +-
src/newt/classes/com/jogamp/newt/Screen.java | 36 +-
src/newt/classes/com/jogamp/newt/Window.java | 103 +-
.../classes/com/jogamp/newt/awt/NewtCanvasAWT.java | 366 +-
.../jogamp/newt/awt/applet/JOGLNewtApplet1Run.java | 31 +-
.../jogamp/newt/awt/applet/JOGLNewtAppletBase.java | 41 +-
.../jogamp/newt/event/DoubleTapScrollGesture.java | 347 ++
.../com/jogamp/newt/event/GestureHandler.java | 143 +
.../classes/com/jogamp/newt/event/InputEvent.java | 109 +-
.../classes/com/jogamp/newt/event/KeyAdapter.java | 12 +-
.../classes/com/jogamp/newt/event/KeyEvent.java | 258 +-
.../classes/com/jogamp/newt/event/KeyListener.java | 22 +-
.../com/jogamp/newt/event/MonitorEvent.java | 14 +-
.../com/jogamp/newt/event/MouseAdapter.java | 18 +-
.../classes/com/jogamp/newt/event/MouseEvent.java | 469 +-
.../com/jogamp/newt/event/MouseListener.java | 20 +-
.../classes/com/jogamp/newt/event/NEWTEvent.java | 32 +-
.../com/jogamp/newt/event/NEWTEventConsumer.java | 14 +-
.../com/jogamp/newt/event/NEWTEventFiFo.java | 10 +-
.../com/jogamp/newt/event/NEWTEventListener.java | 12 +-
.../classes/com/jogamp/newt/event/OutputEvent.java | 2 +-
.../com/jogamp/newt/event/PinchToZoomGesture.java | 228 +
.../com/jogamp/newt/event/TraceKeyAdapter.java | 12 +-
.../com/jogamp/newt/event/TraceMouseAdapter.java | 18 +-
.../com/jogamp/newt/event/TraceWindowAdapter.java | 17 +-
.../com/jogamp/newt/event/WindowAdapter.java | 17 +-
.../classes/com/jogamp/newt/event/WindowEvent.java | 18 +-
.../com/jogamp/newt/event/WindowListener.java | 18 +-
.../com/jogamp/newt/event/WindowUpdateEvent.java | 12 +-
.../com/jogamp/newt/event/awt/AWTAdapter.java | 36 +-
.../com/jogamp/newt/event/awt/AWTKeyAdapter.java | 14 +-
.../com/jogamp/newt/event/awt/AWTMouseAdapter.java | 22 +-
.../jogamp/newt/event/awt/AWTWindowAdapter.java | 46 +-
.../classes/com/jogamp/newt/opengl/GLWindow.java | 131 +-
.../classes/com/jogamp/newt/swt/NewtCanvasSWT.java | 136 +-
src/newt/classes/com/jogamp/newt/util/EDTUtil.java | 40 +-
.../classes/com/jogamp/newt/util/MainThread.java | 90 +-
.../com/jogamp/newt/util/MonitorModeUtil.java | 18 +-
src/newt/classes/jogamp/newt/Debug.java | 19 +-
src/newt/classes/jogamp/newt/DefaultEDTUtil.java | 47 +-
src/newt/classes/jogamp/newt/DisplayImpl.java | 129 +-
.../classes/jogamp/newt/MonitorDeviceImpl.java | 28 +-
src/newt/classes/jogamp/newt/MonitorModeProps.java | 44 +-
src/newt/classes/jogamp/newt/NEWTJNILibLoader.java | 45 +-
src/newt/classes/jogamp/newt/OffscreenWindow.java | 38 +-
src/newt/classes/jogamp/newt/ScreenImpl.java | 103 +-
.../classes/jogamp/newt/ScreenMonitorState.java | 18 +-
src/newt/classes/jogamp/newt/WindowImpl.java | 1266 ++++--
.../classes/jogamp/newt/awt/NewtFactoryAWT.java | 16 +-
.../jogamp/newt/awt/event/AWTNewtEventFactory.java | 80 +-
.../newt/awt/event/AWTParentWindowAdapter.java | 31 +-
.../jogamp/newt/driver/DriverClearFocus.java | 6 +-
.../jogamp/newt/driver/DriverUpdatePosition.java | 8 +-
.../jogamp/newt/driver/android/ScreenDriver.java | 60 +-
.../android/event/AndroidNewtEventFactory.java | 355 +-
.../android/event/AndroidNewtEventTranslator.java | 11 +-
.../classes/jogamp/newt/driver/awt/AWTCanvas.java | 44 +-
.../classes/jogamp/newt/driver/awt/AWTEDTUtil.java | 35 +-
.../jogamp/newt/driver/awt/DisplayDriver.java | 20 +-
.../jogamp/newt/driver/awt/ScreenDriver.java | 31 +-
.../jogamp/newt/driver/awt/WindowDriver.java | 63 +-
.../jogamp/newt/driver/bcm/egl/DisplayDriver.java | 15 +-
.../jogamp/newt/driver/bcm/egl/ScreenDriver.java | 29 +-
.../jogamp/newt/driver/bcm/egl/WindowDriver.java | 28 +-
.../newt/driver/bcm/vc/iv/DisplayDriver.java | 13 +-
.../jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java | 30 +-
.../jogamp/newt/driver/bcm/vc/iv/WindowDriver.java | 36 +-
.../newt/driver/intel/gdl/DisplayDriver.java | 15 +-
.../jogamp/newt/driver/intel/gdl/ScreenDriver.java | 31 +-
.../jogamp/newt/driver/intel/gdl/WindowDriver.java | 24 +-
.../jogamp/newt/driver/kd/DisplayDriver.java | 15 +-
.../jogamp/newt/driver/kd/ScreenDriver.java | 35 +-
.../jogamp/newt/driver/kd/WindowDriver.java | 28 +-
.../newt/driver/linux/LinuxEventDeviceTracker.java | 16 +-
.../newt/driver/linux/LinuxMouseTracker.java | 46 +-
.../jogamp/newt/driver/macosx/DisplayDriver.java | 21 +-
.../jogamp/newt/driver/macosx/MacKeyUtil.java | 38 +-
.../jogamp/newt/driver/macosx/ScreenDriver.java | 35 +-
.../jogamp/newt/driver/macosx/WindowDriver.java | 174 +-
.../jogamp/newt/driver/windows/DisplayDriver.java | 21 +-
.../jogamp/newt/driver/windows/ScreenDriver.java | 33 +-
.../jogamp/newt/driver/windows/WindowDriver.java | 134 +-
.../jogamp/newt/driver/x11/DisplayDriver.java | 30 +-
src/newt/classes/jogamp/newt/driver/x11/RandR.java | 22 +-
.../classes/jogamp/newt/driver/x11/RandR11.java | 66 +-
.../classes/jogamp/newt/driver/x11/RandR13.java | 60 +-
.../jogamp/newt/driver/x11/ScreenDriver.java | 78 +-
.../jogamp/newt/driver/x11/WindowDriver.java | 102 +-
.../classes/jogamp/newt/event/NEWTEventTask.java | 10 +-
src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java | 50 +-
.../jogamp/newt/swt/event/SWTNewtEventFactory.java | 48 +-
src/newt/native/MacWindow.m | 87 +-
src/newt/native/NewtMacWindow.m | 54 +-
src/newt/native/WindowsWindow.c | 464 +-
src/newt/native/X11Window.c | 6 +-
.../opengl/test/android/MovieCubeActivity0.java | 82 +-
.../test/android/MovieCubeActivityLauncher1a.java | 87 +
.../test/android/MovieCubeActivityLauncher1b.java | 87 +
.../opengl/test/android/MovieSimpleActivity0.java | 98 +-
.../opengl/test/android/MovieSimpleActivity1.java | 234 +-
.../android/MovieSimpleActivityLauncher00a.java | 87 -
.../android/MovieSimpleActivityLauncher00b.java | 4 +-
.../android/MovieSimpleActivityLauncher00c.java | 86 +
.../test/junit/graph/TestRegionRendererNEWT01.java | 3 +
.../test/junit/graph/TestTextRendererNEWT00.java | 3 +
.../test/junit/graph/TestTextRendererNEWT01.java | 3 +
.../test/junit/graph/TestTextRendererNEWT10.java | 3 +
.../jogl/acore/TestAWTCloseX11DisplayBug565.java | 3 +
.../acore/TestAddRemove01GLCanvasSwingAWT.java | 3 +
.../TestAddRemove02GLWindowNewtCanvasAWT.java | 3 +
.../jogl/acore/TestAddRemove03GLWindowNEWT.java | 3 +
.../acore/TestBug669RecursiveGLContext01NEWT.java | 3 +
.../acore/TestBug669RecursiveGLContext02NEWT.java | 3 +
.../test/junit/jogl/acore/TestBug692GL3VAO.java | 352 --
.../junit/jogl/acore/TestBug692GL3VAONEWT.java | 442 ++
.../junit/jogl/acore/TestCPUSourcingAPINEWT.java | 225 +
.../jogl/acore/TestFBOAutoDrawableDeadlockAWT.java | 31 +-
.../jogl/acore/TestFBOAutoDrawableFactoryNEWT.java | 133 +-
.../test/junit/jogl/acore/TestFBOMRTNEWT01.java | 3 +
.../junit/jogl/acore/TestFBOMix2DemosES2NEWT.java | 3 +
...tFBOOffThreadSharedContextMix2DemosES2NEWT.java | 103 +-
.../TestFBOOnThreadSharedContext1DemoES2NEWT.java | 92 +-
.../jogl/acore/TestGLAutoDrawableDelegateNEWT.java | 49 +-
...estGLAutoDrawableDelegateOnOffscrnCapsNEWT.java | 3 +
...estGLAutoDrawableFactoryES2OffscrnCapsNEWT.java | 109 +-
...estGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java | 121 +-
...TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java | 69 +-
...TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java | 3 +
...estGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java | 3 +
...LAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java | 3 +
.../jogl/acore/TestGLContextSurfaceLockNEWT.java | 3 +
.../test/junit/jogl/acore/TestGLDebug00NEWT.java | 3 +
.../test/junit/jogl/acore/TestGLDebug01NEWT.java | 3 +
.../jogl/acore/TestGLExtensionQueryOffscreen.java | 25 +-
.../junit/jogl/acore/TestGLMesaBug651NEWT.java | 3 +
.../junit/jogl/acore/TestGLMesaBug658NEWT.java | 3 +
.../test/junit/jogl/acore/TestGLPointsNEWT.java | 3 +
.../test/junit/jogl/acore/TestGLProfile00NEWT.java | 31 +-
.../test/junit/jogl/acore/TestGLProfile01NEWT.java | 3 +
.../jogl/acore/TestGLVersionParsing00NEWT.java | 3 +
.../test/junit/jogl/acore/TestGPUMemSec01NEWT.java | 24 +-
.../junit/jogl/acore/TestInitConcurrent01NEWT.java | 3 +
.../junit/jogl/acore/TestInitConcurrent02NEWT.java | 3 +
.../jogl/acore/TestMainVersionGLCanvasAWT.java | 3 +
.../jogl/acore/TestMainVersionGLWindowNEWT.java | 3 +
.../junit/jogl/acore/TestMapBufferRead01NEWT.java | 3 +
.../jogl/acore/TestNEWTCloseX11DisplayBug565.java | 27 +-
.../test/junit/jogl/acore/TestNVSwapGroupNEWT.java | 3 +
.../acore/TestOffscreenLayer01GLCanvasAWT.java | 3 +
.../acore/TestOffscreenLayer02NewtCanvasAWT.java | 5 +-
.../junit/jogl/acore/TestPBufferDeadlockAWT.java | 3 +
.../junit/jogl/acore/TestSharedContextListAWT.java | 46 +-
.../jogl/acore/TestSharedContextListNEWT.java | 23 +-
.../jogl/acore/TestSharedContextListNEWT2.java | 20 +-
.../jogl/acore/TestSharedContextNewtAWTBug523.java | 275 +-
.../jogl/acore/TestSharedContextVBOES1NEWT.java | 78 +-
.../jogl/acore/TestSharedContextVBOES2AWT3.java | 413 ++
.../jogl/acore/TestSharedContextVBOES2AWT3b.java | 329 ++
.../jogl/acore/TestSharedContextVBOES2NEWT.java | 242 -
.../jogl/acore/TestSharedContextVBOES2NEWT0.java | 270 ++
.../jogl/acore/TestSharedContextVBOES2NEWT1.java | 293 ++
.../jogl/acore/TestSharedContextVBOES2NEWT2.java | 356 ++
.../jogl/acore/TestSharedContextVBOES2NEWT3.java | 338 ++
.../jogl/acore/TestSharedContextVBOES2SWT3.java | 375 ++
.../acore/TestSharedContextWithJTabbedPaneAWT.java | 264 ++
.../junit/jogl/acore/TestShutdownCompleteAWT.java | 3 +
.../junit/jogl/acore/TestShutdownCompleteNEWT.java | 3 +
.../junit/jogl/acore/TestX11DefaultDisplay.java | 3 +
.../jogl/acore/ect/ExclusiveContextBase00.java | 3 +
.../jogl/acore/ect/ExclusiveContextBase00AWT.java | 3 +
.../jogl/acore/ect/ExclusiveContextBase00NEWT.java | 3 +
.../jogl/acore/ect/ExclusiveContextBase10.java | 3 +
.../jogl/acore/ect/ExclusiveContextBase10AWT.java | 3 +
.../jogl/acore/ect/ExclusiveContextBase10NEWT.java | 3 +
.../ect/TestExclusiveContext01VSyncAnimAWT.java | 4 +
.../ect/TestExclusiveContext01VSyncAnimNEWT.java | 3 +
.../ect/TestExclusiveContext02FPSAnimAWT.java | 3 +
.../ect/TestExclusiveContext02FPSAnimNEWT.java | 3 +
.../ect/TestExclusiveContext11VSyncAnimNEWT.java | 4 +
.../ect/TestExclusiveContext12FPSAnimNEWT.java | 3 +
.../acore/glels/GLContextDrawableSwitchBase.java | 96 +-
.../TestBug722GLContextDrawableSwitchNewt2AWT.java | 3 +
.../glels/TestGLContextDrawableSwitch01NEWT.java | 3 +
.../glels/TestGLContextDrawableSwitch02AWT.java | 192 +
.../glels/TestGLContextDrawableSwitch10NEWT.java | 3 +
.../TestGLContextDrawableSwitch11NewtAWT.java | 3 +
.../glels/TestGLContextDrawableSwitch12AWT.java | 3 +
.../TestGLContextDrawableSwitch21Newt2AWT.java | 3 +
.../opengl/test/junit/jogl/awt/TestAWT01GLn.java | 3 +
.../junit/jogl/awt/TestAWT02WindowClosing.java | 3 +
.../jogl/awt/TestAWT03GLCanvasRecreate01.java | 3 +
.../TestAWTCardLayoutAnimatorStartStopBug532.java | 3 +
.../junit/jogl/awt/TestBug460GLCanvasNPEAWT.java | 3 +
.../awt/TestBug461FBOSupersamplingSwingAWT.java | 49 +-
.../TestBug461PBufferSupersamplingSwingAWT.java | 3 +
.../opengl/test/junit/jogl/awt/TestBug551AWT.java | 3 +
.../opengl/test/junit/jogl/awt/TestBug572AWT.java | 54 +-
.../opengl/test/junit/jogl/awt/TestBug611AWT.java | 3 +
.../jogl/awt/TestBug642JSplitPaneMixHwLw01AWT.java | 3 +
.../awt/TestBug664GLCanvasSetVisibleSwingAWT.java | 3 +
.../jogl/awt/TestBug675BeansInDesignTimeAWT.java | 36 +-
...estBug816JTabbedPanelVisibilityB849B878AWT.java | 175 +
.../jogl/awt/TestBug816OSXCALayerPos01AWT.java | 486 ++
.../jogl/awt/TestBug816OSXCALayerPos02AWT.java | 153 +
.../awt/TestBug816OSXCALayerPos03aB729AWT.java | 165 +
.../awt/TestBug816OSXCALayerPos03bB849AWT.java | 171 +
.../awt/TestBug816OSXCALayerPos03cB849AWT.java | 173 +
.../jogl/awt/TestBug816OSXCALayerPos04aAWT.java | 152 +
.../jogl/awt/TestBug816OSXCALayerPos04bAWT.java | 152 +
.../awt/TestGLCanvasAWTActionDeadlock00AWT.java | 3 +
.../awt/TestGLCanvasAWTActionDeadlock01AWT.java | 3 +
.../awt/TestGLCanvasAWTActionDeadlock02AWT.java | 3 +
.../jogl/awt/TestGLJPanelTextureStateAWT.java | 282 ++
.../jogl/awt/TestIsRealizedConcurrency01AWT.java | 3 +
.../jogl/awt/TestJScrollPaneMixHwLw01AWT.java | 3 +
.../test/junit/jogl/awt/TestSwingAWT01GLn.java | 3 +
.../TestAWTTextRendererUseVertexArrayBug464.java | 3 +
.../junit/jogl/caps/TestBug605FlippedImageAWT.java | 88 +-
.../jogl/caps/TestBug605FlippedImageNEWT.java | 92 +-
.../junit/jogl/caps/TestMultisampleES1AWT.java | 21 +-
.../junit/jogl/caps/TestMultisampleES1NEWT.java | 3 +
.../junit/jogl/caps/TestMultisampleES2NEWT.java | 3 +
.../test/junit/jogl/caps/TestTranslucencyAWT.java | 3 +
.../test/junit/jogl/caps/TestTranslucencyNEWT.java | 3 +
.../opengl/test/junit/jogl/demos/GearsObject.java | 104 +-
.../junit/jogl/demos/TextureDraw01Accessor.java | 1 +
.../junit/jogl/demos/TextureSequenceDemo01.java | 2 +-
.../opengl/test/junit/jogl/demos/es1/GearsES1.java | 88 +-
.../test/junit/jogl/demos/es1/GearsObjectES1.java | 23 +-
.../test/junit/jogl/demos/es1/RedSquareES1.java | 102 +-
.../jogl/demos/es1/newt/TestGearsES1NEWT.java | 3 +
.../jogl/demos/es1/newt/TestOlympicES1NEWT.java | 3 +
.../jogl/demos/es1/newt/TestRedSquareES1NEWT.java | 3 +
.../opengl/test/junit/jogl/demos/es2/GearsES2.java | 442 +-
.../test/junit/jogl/demos/es2/GearsObjectES2.java | 47 +-
.../test/junit/jogl/demos/es2/RedSquareES2.java | 87 +-
.../jogl/demos/es2/TextureDraw01ES2Listener.java | 82 +-
.../demos/es2/TextureDraw02ES2ListenerFBO.java | 285 ++
.../jogl/demos/es2/TextureSequenceCubeES2.java | 62 +-
.../test/junit/jogl/demos/es2/av/MovieCube.java | 457 +-
.../test/junit/jogl/demos/es2/av/MovieSimple.java | 575 ++-
.../jogl/demos/es2/awt/Bug816AppletGLCanvas01.java | 134 +
.../demos/es2/awt/Bug816AppletGLCanvas02a.java | 89 +
.../demos/es2/awt/Bug816AppletGLCanvas02b.java | 89 +
.../es2/awt/Bug816AppletOSXCALayerPos03a.java | 102 +
.../es2/awt/Bug816AppletOSXCALayerPos03b.java | 101 +
.../jogl/demos/es2/awt/Bug848AppletGLCanvas01.java | 94 +
.../junit/jogl/demos/es2/awt/TestGearsES2AWT.java | 3 +
.../demos/es2/awt/TestGearsES2GLJPanelAWT.java | 3 +
.../demos/es2/awt/TestGearsES2GLJPanelsAWT.java | 5 +-
.../es2/newt/TestElektronenMultipliziererNEWT.java | 7 +-
.../jogl/demos/es2/newt/TestGearsES2NEWT.java | 82 +-
.../demos/es2/newt/TestGearsES2NewtCanvasAWT.java | 56 +-
.../demos/es2/newt/TestGearsES2NewtCanvasSWT.java | 3 +
.../jogl/demos/es2/newt/TestLandscapeES2NEWT.java | 3 +
.../es2/newt/TestLandscapeES2NewtCanvasAWT.java | 56 +-
.../jogl/demos/es2/newt/TestRedSquareES2NEWT.java | 9 +-
.../junit/jogl/demos/es2/swt/TestGearsES2SWT.java | 61 +-
.../opengl/test/junit/jogl/demos/gl2/Gears.java | 190 +-
.../jogl/demos/gl2/TextureDraw01GL2Listener.java | 34 +-
.../jogl/demos/gl2/awt/Bug818GLJPanelApplet.java | 306 ++
.../jogl/demos/gl2/awt/TestGLJPanelAWTBug450.java | 3 +
.../junit/jogl/demos/gl2/awt/TestGearsAWT.java | 15 +-
.../demos/gl2/awt/TestGearsAWTAnalyzeBug455.java | 3 +
.../jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java | 3 +
.../junit/jogl/demos/gl2/newt/TestGearsNEWT.java | 3 +
.../demos/gl2/newt/TestGearsNewtAWTWrapper.java | 3 +
.../junit/jogl/demos/gl2/newt/TestTeapotNEWT.java | 3 +
.../gl3/newt/TestGeomShader01TextureGL3NEWT.java | 3 +
.../junit/jogl/glsl/TestGLSLShaderState01NEWT.java | 3 +
.../junit/jogl/glsl/TestGLSLShaderState02NEWT.java | 3 +
.../test/junit/jogl/glsl/TestGLSLSimple01NEWT.java | 3 +
.../test/junit/jogl/glsl/TestRulerNEWT01.java | 3 +
.../jogl/glsl/TestShaderCompilationBug459AWT.java | 3 +
.../TestTransformFeedbackVaryingsBug407NEWT.java | 3 +
.../jogl/glu/TestBug365TextureGenerateMipMaps.java | 270 ++
.../jogl/glu/TestBug463ScaleImageMemoryAWT.java | 3 +
.../TestBug694ScaleImageUnpackBufferSizeAWT.java | 3 +
.../test/junit/jogl/math/TestBinary16NOUI.java | 715 +++
.../test/junit/jogl/math/TestBinary32NOUI.java | 93 +
.../test/junit/jogl/math/TestBinary64NOUI.java | 93 +
.../math/TestFloatUtil01MatrixMatrixMultNOUI.java | 3 +
.../jogl/math/TestGluUnprojectDoubleNOUI.java | 3 +
.../junit/jogl/math/TestGluUnprojectFloatNOUI.java | 3 +
.../test/junit/jogl/math/TestPMVMatrix01NEWT.java | 3 +
.../test/junit/jogl/math/TestPMVMatrix02NOUI.java | 5 +-
.../test/junit/jogl/math/TestPMVMatrix03NOUI.java | 3 +
...TestSwingAWTRobotUsageBeforeJOGLInitBug411.java | 3 +
.../offscreen/TestOffscreen01GLPBufferNEWT.java | 3 +
.../jogl/offscreen/TestOffscreen02BitmapNEWT.java | 3 +
.../TestNewtCanvasSWTBug628ResizeDeadlockAWT.java | 139 +-
.../test/junit/jogl/swt/TestNewtCanvasSWTGLn.java | 3 +
.../junit/jogl/swt/TestSWTAccessor03AWTGLn.java | 3 +
.../junit/jogl/swt/TestSWTBug643AsyncExec.java | 114 +-
.../jogl/swt/TestSWTEclipseGLCanvas01GLn.java | 3 +
.../junit/jogl/swt/TestSWTJOGLGLCanvas01GLn.java | 45 +-
.../test/junit/jogl/tile/OffscreenPrintable.java | 182 +
.../test/junit/jogl/tile/OnscreenPrintable.java | 165 +
.../opengl/test/junit/jogl/tile/PrintableBase.java | 88 +
.../tile/TestRandomTiledRendering2GL2NEWT.java | 193 +
.../jogl/tile/TestRandomTiledRendering3GL2AWT.java | 261 ++
.../junit/jogl/tile/TestTiledPrintingGearsAWT.java | 279 ++
.../jogl/tile/TestTiledPrintingGearsNewtAWT.java | 286 ++
.../jogl/tile/TestTiledPrintingGearsSwingAWT.java | 363 ++
.../jogl/tile/TestTiledPrintingGearsSwingAWT2.java | 340 ++
.../tile/TestTiledPrintingNIOImageSwingAWT.java | 320 ++
.../jogl/tile/TestTiledRendering1GL2NEWT.java | 243 +
.../junit/jogl/tile/TestTiledRendering2NEWT.java | 263 ++
.../test/junit/jogl/tile/TiledPrintingAWTBase.java | 273 ++
.../test/junit/jogl/tile/TransparentPanel.java | 59 +
.../jogl/util/DemoGL2ES1TextureImmModeSink.java | 34 +-
.../util/TestES1FixedFunctionPipelineNEWT.java | 39 +-
.../junit/jogl/util/TestImmModeSinkES1NEWT.java | 3 +
.../junit/jogl/util/TestImmModeSinkES2NEWT.java | 3 +
...7GLReadBufferUtilGLCTXDefFormatTypeES2NEWT.java | 130 +
.../TestGLReadBufferUtilTextureIOWrite01AWT.java | 3 +
.../TestGLReadBufferUtilTextureIOWrite01NEWT.java | 3 +
.../TestGLReadBufferUtilTextureIOWrite02AWT.java | 3 +
.../TestGLReadBufferUtilTextureIOWrite02NEWT.java | 3 +
.../jogl/util/texture/TestJPEGImage01NEWT.java | 7 +-
.../texture/TestJPEGJoglAWTBenchmarkNewtAWT.java | 3 +
.../texture/TestJPEGJoglAWTCompareNewtAWT.java | 7 +-
.../util/texture/TestJPEGTextureFromFileNEWT.java | 5 +-
.../jogl/util/texture/TestPNGImage00NEWT.java | 3 +
.../jogl/util/texture/TestPNGImage01NEWT.java | 7 +-
.../util/texture/TestPNGTextureFromFileAWT.java | 5 +-
.../util/texture/TestPNGTextureFromFileNEWT.java | 5 +-
.../util/texture/TestTGATextureFromFileNEWT.java | 5 +-
.../junit/jogl/util/texture/TestTexture01AWT.java | 3 +
.../junit/jogl/util/texture/TestTexture02AWT.java | 3 +
.../util/texture/TestTextureSequence01AWT.java | 3 +
.../util/texture/TestTextureSequence01NEWT.java | 3 +
.../newt/DemoCreateAndDisposeOnCloseNEWT.java | 140 +
.../opengl/test/junit/newt/TestCloseNewtAWT.java | 3 +
.../junit/newt/TestDisplayLifecycle01NEWT.java | 5 +-
.../junit/newt/TestDisplayLifecycle02NEWT.java | 3 +
.../test/junit/newt/TestEventSourceNotAWTBug.java | 3 +
.../test/junit/newt/TestFocus01SwingAWTRobot.java | 3 +
.../test/junit/newt/TestFocus02SwingAWTRobot.java | 3 +
.../newt/TestGLWindowInvisiblePointer01NEWT.java | 3 +
.../junit/newt/TestGLWindowWarpPointer01NEWT.java | 3 +
.../test/junit/newt/TestGLWindows00NEWT.java | 3 +
.../test/junit/newt/TestGLWindows01NEWT.java | 3 +
.../junit/newt/TestGLWindows02NEWTAnimated.java | 3 +
.../test/junit/newt/TestListenerCom01AWT.java | 3 +
.../test/junit/newt/TestRemoteGLWindows01NEWT.java | 3 +
.../test/junit/newt/TestRemoteWindow01NEWT.java | 3 +
.../junit/newt/TestWindowClosingProtocol01AWT.java | 3 +
.../newt/TestWindowClosingProtocol02NEWT.java | 3 +
.../newt/TestWindowClosingProtocol03NewtAWT.java | 3 +
.../opengl/test/junit/newt/TestWindows01NEWT.java | 3 +
.../junit/newt/event/BaseNewtEventModifiers.java | 8 +-
.../event/TestNewtEventModifiersAWTCanvas.java | 3 +
.../event/TestNewtEventModifiersNEWTWindowAWT.java | 3 +
.../event/TestNewtEventModifiersNewtCanvasAWT.java | 4 +-
.../TestNewtEventModifiersNewtCanvasSWTAWT.java | 4 +-
.../newt/event/TestNewtKeyCodeModifiersAWT.java | 3 +
.../test/junit/newt/event/TestNewtKeyCodesAWT.java | 3 +
.../newt/event/TestNewtKeyEventAutoRepeatAWT.java | 3 +
.../junit/newt/event/TestNewtKeyEventOrderAWT.java | 3 +
.../TestNewtKeyPressReleaseUnmaskRepeatAWT.java | 3 +
.../test/junit/newt/mm/TestScreenMode00aNEWT.java | 3 +
.../test/junit/newt/mm/TestScreenMode00bNEWT.java | 3 +
.../test/junit/newt/mm/TestScreenMode00cNEWT.java | 3 +
.../test/junit/newt/mm/TestScreenMode01aNEWT.java | 3 +
.../test/junit/newt/mm/TestScreenMode01bNEWT.java | 3 +
.../test/junit/newt/mm/TestScreenMode01cNEWT.java | 3 +
.../test/junit/newt/mm/TestScreenMode01dNEWT.java | 3 +
.../test/junit/newt/mm/TestScreenMode02aNEWT.java | 3 +
.../test/junit/newt/mm/TestScreenMode02bNEWT.java | 3 +
.../parenting/NewtAWTReparentingKeyAdapter.java | 111 +-
.../junit/newt/parenting/TestParenting01NEWT.java | 11 +-
.../junit/newt/parenting/TestParenting01aAWT.java | 3 +
.../junit/newt/parenting/TestParenting01aSWT.java | 3 +
.../junit/newt/parenting/TestParenting01bAWT.java | 3 +
.../junit/newt/parenting/TestParenting01cAWT.java | 3 +
.../newt/parenting/TestParenting01cSwingAWT.java | 3 +
.../junit/newt/parenting/TestParenting02AWT.java | 3 +
.../junit/newt/parenting/TestParenting02NEWT.java | 3 +
.../junit/newt/parenting/TestParenting03AWT.java | 7 +-
.../junit/newt/parenting/TestParenting04AWT.java | 3 +
.../junit/newt/parenting/TestParenting04SWT.java | 3 +
.../TestParentingFocusTraversal01AWT.java | 11 +-
.../TestTranslucentChildWindowBug632NEWT.java | 3 +
.../parenting/TestTranslucentParentingAWT.java | 3 +
.../opengl/test/junit/util/AWTRobotUtil.java | 258 +-
.../jogamp/opengl/test/junit/util/MiscUtils.java | 73 +-
.../jogamp/opengl/test/junit/util/UITestCase.java | 4 +-
www/index.html | 29 +-
www/media/c3d-mobile-01-coll01-160x160.png | Bin 0 -> 37461 bytes
www/media/c3d-mobile-01-pipes01-160x125.png | Bin 0 -> 29246 bytes
www/media/c3d-mobile-01-pipes07-160x120.png | Bin 0 -> 29844 bytes
1310 files changed, 76330 insertions(+), 21750 deletions(-)
diff --git a/.classpath b/.classpath
index 41f50c0..817f2b8 100644
--- a/.classpath
+++ b/.classpath
@@ -27,11 +27,11 @@
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry combineaccessrules="false" kind="src" path="/gluegen"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Ant"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/SWT"/>
<classpathentry kind="lib" path="/gluegen/make/lib/android-sdk/15/android.jar" sourcepath="/gluegen/make/lib/android-sdk/15/android-java-src.zip"/>
<classpathentry combineaccessrules="false" kind="src" path="/joal"/>
+ <classpathentry kind="lib" path="/gluegen/make/lib/junit.jar" sourcepath="/gluegen/make/lib/junit-sources.jar"/>
<classpathentry kind="output" path="build/eclipse-classes"/>
</classpath>
diff --git a/doc/HowToBuild.html b/doc/HowToBuild.html
index 529d100..3503859 100644
--- a/doc/HowToBuild.html
+++ b/doc/HowToBuild.html
@@ -136,25 +136,44 @@
<li> <a href="http://developer.apple.com/technologies/xcode.html">Xcode</a> for gcc, etc (included in OSX)</li>
</ul>
</li>
- <li> <b>Windows</b>/x86 (32-bit)
+ <li> <b>Windows</b>/x86 (32 bit)
<ul>
<li>Windows XP or later </li>
<li>git, see above</li>
- <li> <a href="http://www.mingw.org/">MinGW</a><br/>
- Read <a href="http://www.mingw.org/wiki/Getting_Started">MinGW Getting Started</a>.<br/>
- We used the download script <code>mingwdl.sh</code> shown at
- <a href="http://www.mingw.org/wiki/HOWTO_Install_the_MinGW_GCC_Compiler_Suite">HOWTO Install the MinGW GCC Compiler Suite</a>.<br/></li>
- <li> Not supported: Microsoft Visual C++ 6.0 or later, but may work. Last successful try in 2008.</li>
+ <li> <a href="http://mingw-w64.sourceforge.net/">MinGW64</a>
+ <ul>
+ <li> <a href="http://sourceforge.net/projects/mingwbuilds/files/mingw-builds-install/mingw-builds-install.exe/download">Installer</a>
+ <ul>
+ <li>mingw-build-install</li>
+ <li>version: 4.8.1</li>
+ <li>host: x32</li>
+ <li>threading: win32</li>
+ <li>exceptions: SJLJ</li>
+ <li>revision: 5</li>
+ </ul></li>
+ <li> or <a href="http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/">manual</a>
+ via <a href="http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.8.1/32-bit/threads-win32/sjlj/">7z archive file</a></li>
+ </ul></li>
</ul>
</li>
- <li> <b>Windows</b>/x86_64 (64-bit)<br/>
+ <li> <b>Windows</b>/x86_64 (64-bit)
<ul>
<li>Windows XP or later </li>
<li>git, see above</li>
- <li> <a href="http://mingw-w64.sourceforge.net/">MinGW64</a><br/>
- We used the build <code>mingw-w64-bin_x86_64-mingw_20100515_sezero.zip</code> available at
- <a href="http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/sezero_20100515/">MingW64 Personal Builds - sezero</a>.<br/></li>
- <li> Not supported: Microsoft Visual C++, never tried.</li>
+ <li> <a href="http://mingw-w64.sourceforge.net/">MinGW64</a>
+ <ul>
+ <li> <a href="http://sourceforge.net/projects/mingwbuilds/files/mingw-builds-install/mingw-builds-install.exe/download">Installer</a>
+ <ul>
+ <li>mingw-build-install</li>
+ <li>version: 4.8.1</li>
+ <li>host: x64</li>
+ <li>threading: win32</li>
+ <li>exceptions: SJLJ</li>
+ <li>revision: 5</li>
+ </ul></li>
+ <li> or <a href="http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/">manual</a>
+ via <a href="http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.8.1/64-bit/threads-win32/sjlj/">7z archive file</a></li>
+ </ul></li>
</ul>
</li>
</ul>
diff --git a/doc/Implementation/AWTPrinting.txt b/doc/Implementation/AWTPrinting.txt
new file mode 100644
index 0000000..f2fcbbd
--- /dev/null
+++ b/doc/Implementation/AWTPrinting.txt
@@ -0,0 +1,99 @@
+Screenshots of unit tests:
+ <http://jogamp.org/files/screenshots/printing/test01-awt/>
+
+Unit test producing the results:
+ Base Test Class:
+ <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java;hb=HEAD>
+ AWT:
+ <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java;hb=HEAD>
+ Swing:
+ <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java;hb=HEAD>
+
+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>
+ ...
+ AWTTilePainter (common code):
+ <http://jogamp.org/git/?p=jogl.git;a=blob;f=src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java;hb=HEAD>
+
++++
+
+Enhance lifecycle for AWT printing via AWTPrintLifecycle:
+
+We fit the frame into the imageable area with for 72 dpi,
+assuming that is the default AWT painting density.
+The frame borders are considered.
+
+The frame's scale factor 'scaleComp72' is used for the graphics print matrix
+of the overall print-job, hence no frame resize is required.
+
+The GL scale factor 'scaleGLMatXY', 72dpi/glDPI, is passed to the GL object
+which locally scales the print matrix and renders the scene with 1/scaleGLMatXY pixels.
+
+Before printing, we setup the GLCanvas, ..:
+ - move GLContext and GLEventListener -> offscreen
+ - offscreen is of tile-size
+
+this is performed w/ AWTPrintLifecycle.setupPrint(..).
+Impl. in GLCanvas, etc.
+
+After printing, AWTPrintLifecycle.releasePrint() shall be called. Impl. in GLCanvas .. etc.
+
+To perform AWTPrintLifecycle on all components in one container decorating PrinterJob.job(),
+one may use:
+
+ Container cont;
+ double scaleGLMatXY = 72.0/glDPI;
+ int numSamples = 0; // leave multisampling as-is
+ PrinterJob job;
+ ...
+ final AWTPrintLifecycle.Context ctx = AWTPrintLifecycle.Context.setupPrint(cont, scaleGLMatXY, scaleGLMatXY, numSamples);
+ try {
+ AWTEDTExecutor.singleton.invoke(true, new Runnable() {
+ public void run() {
+ try {
+ job.print();
+ } catch (PrinterException ex) {
+ ex.printStackTrace();
+ }
+ } });
+ } finally {
+ ctx.releasePrint();
+ }
+
++++
+
+Tiled rendering is used, i.e. at print(Graphics g),
+the clip bounds is used to setup the TiledRenderer's
+image size and the impl. renders all tiles.
+
+For the tiled reshape, a user component,
+i.e. GLEventListener reshape(x, y, width, height),
+needs to know about the current tile's position and image size.
+The tile size itself is passed as width and height
+as this is being used to set the current viewport.
+
+Hence the GLEventListener shall implement the
+TileRendererBase.TileRendererNotify interface!
+
++++
+
+Bugs:
+ - None in results
+
+ - GLCanvas: Workaround Bug 830 where onscreen MSAA cannot switch to offscreen FBO,
+ i.e. stay 'onscreen'
+
++++
+
+OSX local 'virtual' printer installation,
+i.e. print-to-file printer using cups:
+
+cupsctl FileDevice=Yes
+killall -HUP cupsd
+mkdir /data/lp
+chown jogamp /data/lp
+chmod ugo+rwx /data/lp
+lpadmin -p lprint -E -v file:/data/lp/out.ps -P /Library/Printers/PPDs/Contents/Resources/HP\ LaserJet\ 4\ Plus.gz
diff --git a/doc/Implementation/MultiThreading.txt b/doc/Implementation/MultiThreading.txt
index fb586e1..272204d 100644
--- a/doc/Implementation/MultiThreading.txt
+++ b/doc/Implementation/MultiThreading.txt
@@ -1,4 +1,9 @@
+Don't miss
+ Current 'violations' of synchronization/memory-barriers
+ using explicit locking:
+below ..
+
Locking
=========
@@ -92,3 +97,29 @@ Summary:
- swapBuffersImpl
- [Surface i/o] - if not locked already
++++
+
+Complying with synchronization/memory-barriers
+using explicit locking:
+
+- NativeSurface's handle access
+
+Current 'violations' of synchronization/memory-barriers
+using explicit locking:
+
+- Using 'volatile' to avoid locking for read-only access
+ with rare write access
+
+ - GLAutoDrawable's drawable reference
+
+ - GLAutoDrawable's context reference
+ Since 7f7a23dd0ddf106e6f0c69fc2a05ff92ac56200e
+
+ - GLContext's contextHandle
+ Since 7f7a23dd0ddf106e6f0c69fc2a05ff92ac56200e
+
+ - GLDrawableImpl's realized
+ Used for Pre-locking queries, whether drawable is realized
+
+- Misc 'volatile' usage:
+
diff --git a/doc/Overview-OpenGL-Evolution-And-JOGL.html b/doc/Overview-OpenGL-Evolution-And-JOGL.html
index 572fd37..c191b52 100644
--- a/doc/Overview-OpenGL-Evolution-And-JOGL.html
+++ b/doc/Overview-OpenGL-Evolution-And-JOGL.html
@@ -202,10 +202,10 @@ ensures the code complies with the GL2 and GLES2 profile and an implementation m
<h4>OpenGL Profile Models (UML)</h4>
<a href="uml/html/index-withframe.html">Complete UML with frames</a>.
-<h5><a href="uml/html-svg/fig128069.svg">Compatibility (Fixed Function and Programmable)</a></h5>
-<embed src="uml/html-svg/fig128069.svg" width="1024" height="1000" />
-<h5><a href="uml/html-svg/fig134786.svg">Core Only (Programmable)</a></h5>
-<embed src="uml/html-svg/fig134786.svg" width="1024" height="1000" />
+<h5><a href="uml/html/fig128069.png">Compatibility (Fixed Function and Programmable)</a></h5>
+<embed src="uml/html/fig128069.png" width="1024" height="1000" />
+<h5><a href="uml/html/fig134786.png">Core Only (Programmable)</a></h5>
+<embed src="uml/html/fig134786.png" width="1024" height="1000" />
<h3>References</h3>
<ul>
diff --git a/doc/uml/html-svg/class128002.html b/doc/uml/html-svg/class128002.html
deleted file mode 100644
index 7544725..0000000
--- a/doc/uml/html-svg/class128002.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GL3bc</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GL3bc</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_128002"></a>
-<p>Declaration :</p><ul>
-<li>Java : package interface GL3bc extends <a href="class128453.html#refclass128453"><b>GL2</b></a> </li><li>Php : interface GL3bc </li></ul><p>Directly inherited by : <a href="class128258.html#refclass128258"><b>GL4bc</b></a> <a href="class130501.html#refclass130501"><b>GL4bcImpl</b></a> </p>
-<p>Stereotype: interface</p>
-<div class="sub">
-</div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class128069.html b/doc/uml/html-svg/class128069.html
deleted file mode 100644
index bc9d4a7..0000000
--- a/doc/uml/html-svg/class128069.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GL</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GL</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_128069"></a>
-<p>Declaration :</p><ul>
-<li>Java : public interface GL extends <a href="class132549.html#refclass132549"><b>GLBase</b></a> </li><li>Php : public interface GL </li></ul><p>Directly inherited by : <a href="class128197.html#refclass128197"><b>GL2ES1</b></a> <a href="class128581.html#refclass128581"><b>GL2ES2</b></a> </p>
-<p>Stereotype: interface</p>
-<div class="sub">
-</div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class128130.html b/doc/uml/html-svg/class128130.html
deleted file mode 100644
index 2d07666..0000000
--- a/doc/uml/html-svg/class128130.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GL4</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GL4</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_128130"></a>
-<p>Declaration :</p><ul>
-<li>Java : package interface GL4 extends <a href="class128837.html#refclass128837"><b>GL3</b></a> </li><li>Php : interface GL4 </li></ul><p>Directly inherited by : <a href="class128258.html#refclass128258"><b>GL4bc</b></a> <a href="class130501.html#refclass130501"><b>GL4bcImpl</b></a> </p>
-<p>Stereotype: interface</p>
-<div class="sub">
-</div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class128197.html b/doc/uml/html-svg/class128197.html
deleted file mode 100644
index 24600b4..0000000
--- a/doc/uml/html-svg/class128197.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GL2ES1</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GL2ES1</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_128197"></a>
-<p>Declaration :</p><ul>
-<li>Java : public interface GL2ES1 extends <a href="class128069.html#refclass128069"><b>GL</b></a> </li><li>Php : public interface GL2ES1 </li></ul><p>Directly inherited by : <a href="class128453.html#refclass128453"><b>GL2</b></a> <a href="class128386.html#refclass128386"><b>GL2ES12</b></a> <a href="class128325.html#refclass128325"><b>GLES1</b></a> </p>
-<p>Stereotype: interface</p>
-<div class="sub">
-</div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class128258.html b/doc/uml/html-svg/class128258.html
deleted file mode 100644
index b9bedf7..0000000
--- a/doc/uml/html-svg/class128258.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GL4bc</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GL4bc</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_128258"></a>
-<p>Declaration :</p><ul>
-<li>Java : package interface GL4bc extends <a href="class128002.html#refclass128002"><b>GL3bc</b></a> </li><li>Php : interface GL4bc </li></ul><p>Directly inherited by : <a href="class130501.html#refclass130501"><b>GL4bcImpl</b></a> </p>
-<p>Stereotype: interface</p>
-<div class="sub">
-</div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class128325.html b/doc/uml/html-svg/class128325.html
deleted file mode 100644
index 50fef41..0000000
--- a/doc/uml/html-svg/class128325.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GLES1</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GLES1</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_128325"></a>
-<p>Declaration :</p><ul>
-<li>Java : public interface GLES1 extends <a href="class128197.html#refclass128197"><b>GL2ES1</b></a> </li><li>Php : public interface GLES1 </li></ul><p>Directly inherited by : <a href="class130757.html#refclass130757"><b>GLES1Impl</b></a> </p>
-<p>Stereotype: interface</p>
-<div class="sub">
-</div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class128386.html b/doc/uml/html-svg/class128386.html
deleted file mode 100644
index c2d4c78..0000000
--- a/doc/uml/html-svg/class128386.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GL2ES12</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GL2ES12</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_128386"></a>
-<p>Declaration :</p><ul>
-<li>Java : package class GL2ES12 implements <a href="class128197.html#refclass128197"><b>GL2ES1</b></a>, <a href="class128581.html#refclass128581"><b>GL2ES2</b></a> </li></ul><p>Stereotype: entity</p>
-<div class="sub">
-</div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class128453.html b/doc/uml/html-svg/class128453.html
deleted file mode 100644
index 9cce940..0000000
--- a/doc/uml/html-svg/class128453.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GL2</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GL2</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_128453"></a>
-<p>Declaration :</p><ul>
-<li>Java : public interface GL2 extends <a href="class128709.html#refclass128709"><b>GL2GL3</b></a> </li><li>Php : public interface GL2 </li></ul><p>Directly inherited by : <a href="class128002.html#refclass128002"><b>GL3bc</b></a> <a href="class130501.html#refclass130501"><b>GL4bcImpl</b></a> </p>
-<p>Stereotype: interface</p>
-<div class="sub">
-</div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class128581.html b/doc/uml/html-svg/class128581.html
deleted file mode 100644
index c13640b..0000000
--- a/doc/uml/html-svg/class128581.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GL2ES2</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GL2ES2</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_128581"></a>
-<p>Declaration :</p><ul>
-<li>Java : public interface GL2ES2 extends <a href="class128069.html#refclass128069"><b>GL</b></a> </li><li>Php : public interface GL2ES2 </li></ul><p>Directly inherited by : <a href="class128386.html#refclass128386"><b>GL2ES12</b></a> <a href="metaclass135298.html#refmetaclass135298"><b>GL2ES3</b></a> <a href="class128709.html#refclass128709"><b>GL2GL3</b></a> <a href="class128965.html#refclass128965"><b>GLES2</b></a> </p>
-<p>Stereotype: interface</p>
-<div class="sub">
-</div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class128709.html b/doc/uml/html-svg/class128709.html
deleted file mode 100644
index 6d44a4e..0000000
--- a/doc/uml/html-svg/class128709.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GL2GL3</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GL2GL3</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_128709"></a>
-<p>Declaration :</p><ul>
-<li>Java : public interface GL2GL3 extends <a href="class128581.html#refclass128581"><b>GL2ES2</b></a> </li><li>Php : public interface GL2GL3 </li></ul><p>Directly inherited by : <a href="class128453.html#refclass128453"><b>GL2</b></a> <a href="class128837.html#refclass128837"><b>GL3</b></a> </p>
-<p>Stereotype: interface</p>
-<div class="sub">
-</div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class128837.html b/doc/uml/html-svg/class128837.html
deleted file mode 100644
index ff077ee..0000000
--- a/doc/uml/html-svg/class128837.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GL3</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GL3</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_128837"></a>
-<p>Declaration :</p><ul>
-<li>Java : public interface GL3 extends <a href="class128709.html#refclass128709"><b>GL2GL3</b></a> </li><li>Php : public interface GL3 </li></ul><p>Directly inherited by : <a href="class128002.html#refclass128002"><b>GL3bc</b></a> <a href="class128130.html#refclass128130"><b>GL4</b></a> <a href="class130501.html#refclass130501"><b>GL4bcImpl</b></a> </p>
-<p>Stereotype: interface</p>
-<div class="sub">
-</div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class128965.html b/doc/uml/html-svg/class128965.html
deleted file mode 100644
index ffdf65f..0000000
--- a/doc/uml/html-svg/class128965.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GLES2</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GLES2</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_128965"></a>
-<p>Declaration :</p><ul>
-<li>Java : public interface GLES2 extends <a href="class128581.html#refclass128581"><b>GL2ES2</b></a> </li><li>Php : public interface GLES2 </li></ul><p>Directly inherited by : <a href="class130629.html#refclass130629"><b>GLES3Impl</b></a> </p>
-<p>Stereotype: interface</p>
-<div class="sub">
-</div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class130117.html b/doc/uml/html-svg/class130117.html
deleted file mode 100644
index eb593d2..0000000
--- a/doc/uml/html-svg/class130117.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GLContext</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GLContext</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_130117"></a>
-<p>Declaration :</p><ul>
-<li>Java : package abstract class GLContext </li></ul><div class="sub">
-<a name="ref0_130757"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="class130245.html#refclass130245"><b>GLDrawable</b></a>, multiplicity : 1</li><li>Java : private <a href="class130245.html#refclass130245"><b>GLDrawable</b></a> </li></ul><a name="ref0_134341"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="class132549.html#refclass132549"><b>GLBase</b></a>, multiplicity : 1</li><li>Java : private <a href="class132549.html#refclass132549"><b>GLBase</b></a> </li></ul></div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class130245.html b/doc/uml/html-svg/class130245.html
deleted file mode 100644
index 0662e8d..0000000
--- a/doc/uml/html-svg/class130245.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GLDrawable</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GLDrawable</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_130245"></a>
-<p>Declaration :</p><ul>
-<li>Java : package abstract class GLDrawable </li></ul><div class="sub">
-<a name="ref0_130629"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="class130117.html#refclass130117"><b>GLContext</b></a>, multiplicity : 0..1</li><li>Java : private <a href="class130117.html#refclass130117"><b>GLContext</b></a> </li></ul><a name="ref0_132421"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="class130885.html#refclass130885"><b>NativeWindow</b></a></li><li>Java : private <a href="class130885.html#refclass130885"><b>NativeWindow</b></a> </li></ul></div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class130501.html b/doc/uml/html-svg/class130501.html
deleted file mode 100644
index 656f8d6..0000000
--- a/doc/uml/html-svg/class130501.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GL4bcImpl</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GL4bcImpl</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_130501"></a>
-<p>Declaration :</p><ul>
-<li>Java : private class GL4bcImpl implements <a href="class128837.html#refclass128837"><b>GL3</b></a>, <a href="class128002.html#refclass128002"><b>GL3bc</b></a>, <a href="class128258.html#refclass128258"><b>GL4bc</b></a>, <a href="class128453.html#refclass128453"><b>GL2</b></a>, <a href="class128130.html#refclass128130"><b>GL4</b></a> </li></ul><p>Stereotype: entity</p>
-<div class="sub">
-</div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class130629.html b/doc/uml/html-svg/class130629.html
deleted file mode 100644
index 05dffed..0000000
--- a/doc/uml/html-svg/class130629.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GLES3Impl</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GLES3Impl</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_130629"></a>
-<p>Declaration :</p><ul>
-<li>Java : private class GLES3Impl extends <a href="class134914.html#refclass134914"><b>GLES3</b></a> implements <a href="class128965.html#refclass128965"><b>GLES2</b></a> </li></ul><p>Stereotype: entity</p>
-<div class="sub">
-</div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class130757.html b/doc/uml/html-svg/class130757.html
deleted file mode 100644
index f415b81..0000000
--- a/doc/uml/html-svg/class130757.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GLES1Impl</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GLES1Impl</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_130757"></a>
-<p>Declaration :</p><ul>
-<li>Java : private class GLES1Impl implements <a href="class128325.html#refclass128325"><b>GLES1</b></a> </li></ul><p>Stereotype: entity</p>
-<div class="sub">
-</div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class130885.html b/doc/uml/html-svg/class130885.html
deleted file mode 100644
index f0d7b7b..0000000
--- a/doc/uml/html-svg/class130885.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class NativeWindow</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class NativeWindow</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_130885"></a>
-<p>Declaration :</p><ul>
-<li>Java : package interface NativeWindow </li><li>Php : interface NativeWindow </li></ul><p>Stereotype: interface</p>
-<div class="sub">
-<a name="ref0_132165"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="class131013.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a></li><li>Java : private <a href="class131013.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a> </li></ul><a name="ref0_132293"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="class130245.html#refclass130245"><b>GLDrawable</b></a></li><li>Java : private <a href="class130245.html#refclass130245"><b>GLDrawable</b></a> </li></ul></div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class131013.html b/doc/uml/html-svg/class131013.html
deleted file mode 100644
index cb9cbcb..0000000
--- a/doc/uml/html-svg/class131013.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class AbstractGraphicsConfiguration</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class AbstractGraphicsConfiguration</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_131013"></a>
-<p>Declaration :</p><ul>
-<li>Java : package abstract class AbstractGraphicsConfiguration </li></ul><div class="sub">
-<a name="ref0_131525"></a>
-<table><tr><td><div class="element">Relation <b>chosen (<association>)</b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - chosen : <a href="class131269.html#refclass131269"><b>Capabilities</b></a>, multiplicity : 1</li><li>Java : private <a href="class131269.html#refclass131269"><b>Capabilities</b></a> chosen</li></ul><a name="ref0_131909"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - requested : <a href="class131269.html#refclass131269"><b>Capabilities</b></a>, multiplicity : 1</li><li>Java : private <a href="class131269.html#refclass131269"><b>Capabilities</b></a> requested</li></ul><a name="ref0_132037"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="class130885.html#refclass130885"><b>NativeWindow</b></a></li><li>Java : private <a href="class130885.html#refclass130885"><b>NativeWindow</b></a> </li></ul></div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class131141.html b/doc/uml/html-svg/class131141.html
deleted file mode 100644
index 8b3a8f2..0000000
--- a/doc/uml/html-svg/class131141.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GLCapabilities</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GLCapabilities</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_131141"></a>
-<p>Declaration :</p><ul>
-<li>Java : package class GLCapabilities extends <a href="class131269.html#refclass131269"><b>Capabilities</b></a> </li></ul><div class="sub">
-<a name="ref0_132677"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="class131397.html#refclass131397"><b>GLProfile</b></a></li><li>Java : private <a href="class131397.html#refclass131397"><b>GLProfile</b></a> </li></ul><a name="ref0_132933"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="class131397.html#refclass131397"><b>GLProfile</b></a></li><li>Java : private <a href="class131397.html#refclass131397"><b>GLProfile</b></a> </li></ul></div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class131269.html b/doc/uml/html-svg/class131269.html
deleted file mode 100644
index 9faf0f5..0000000
--- a/doc/uml/html-svg/class131269.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class Capabilities</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class Capabilities</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_131269"></a>
-<p>Declaration :</p><ul>
-<li>Java : package class Capabilities </li></ul><p>Directly inherited by : <a href="class131141.html#refclass131141"><b>GLCapabilities</b></a> </p>
-<div class="sub">
-<a name="ref0_131653"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="class131013.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a></li><li>Java : private <a href="class131013.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a> </li></ul><a name="ref0_131781"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="class131013.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a></li><li>Java : private <a href="class131013.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a> </li></ul></div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class131397.html b/doc/uml/html-svg/class131397.html
deleted file mode 100644
index b8568c2..0000000
--- a/doc/uml/html-svg/class131397.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GLProfile</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GLProfile</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_131397"></a>
-<p>Declaration :</p><ul>
-<li>Java : package class GLProfile </li></ul><div class="sub">
-<a name="ref0_132549"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="class131141.html#refclass131141"><b>GLCapabilities</b></a></li><li>Java : private <a href="class131141.html#refclass131141"><b>GLCapabilities</b></a> </li></ul><a name="ref0_132805"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="class131141.html#refclass131141"><b>GLCapabilities</b></a></li><li>Java : private <a href="class131141.html#refclass131141"><b>GLCapabilities</b></a> </li></ul></div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class132549.html b/doc/uml/html-svg/class132549.html
deleted file mode 100644
index 7662d1f..0000000
--- a/doc/uml/html-svg/class132549.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GLBase</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GLBase</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_132549"></a>
-<p>Declaration :</p><ul>
-<li>Java : public interface GLBase </li><li>Php : public interface GLBase </li></ul><p>Directly inherited by : <a href="class128069.html#refclass128069"><b>GL</b></a> </p>
-<p>Stereotype: interface</p>
-<div class="sub">
-<a name="ref0_134213"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="class130117.html#refclass130117"><b>GLContext</b></a>, multiplicity : 1</li><li>Java : private <a href="class130117.html#refclass130117"><b>GLContext</b></a> </li></ul></div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class134914.html b/doc/uml/html-svg/class134914.html
deleted file mode 100644
index f27f4e5..0000000
--- a/doc/uml/html-svg/class134914.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GLES3</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GLES3</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_134914"></a>
-<p>Declaration :</p><ul>
-<li>Java : public @interface GLES3 extends <a href="class135042.html#refclass135042"><b>GL4ES3</b></a> </li></ul><p>Directly inherited by : <a href="class130629.html#refclass130629"><b>GLES3Impl</b></a> </p>
-<p>Stereotype: @interface</p>
-<div class="sub">
-</div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class135042.html b/doc/uml/html-svg/class135042.html
deleted file mode 100644
index 9849be0..0000000
--- a/doc/uml/html-svg/class135042.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GL4ES3</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GL4ES3</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_135042"></a>
-<p>Declaration :</p><ul>
-<li>Java : public @interface GL4ES3 extends <a href="class135170.html#refclass135170"><b>GL3ES3</b></a> </li></ul><p>Directly inherited by : <a href="class128130.html#refclass128130"><b>GL4</b></a> <a href="class134914.html#refclass134914"><b>GLES3</b></a> </p>
-<p>Stereotype: @interface</p>
-<div class="sub">
-</div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/class135170.html b/doc/uml/html-svg/class135170.html
deleted file mode 100644
index e5a3ae2..0000000
--- a/doc/uml/html-svg/class135170.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Class GL3ES3</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Class GL3ES3</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_135170"></a>
-<p>Declaration :</p><ul>
-<li>Java : public @interface GL3ES3 extends <a href="metaclass135298.html#refmetaclass135298"><b>GL2ES3</b></a> </li></ul><p>Directly inherited by : <a href="class128837.html#refclass128837"><b>GL3</b></a> <a href="class135042.html#refclass135042"><b>GL4ES3</b></a> </p>
-<p>Stereotype: @interface</p>
-<div class="sub">
-</div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/classdiagrams.html b/doc/uml/html-svg/classdiagrams.html
index 5e0f421..3ba85a1 100644
--- a/doc/uml/html-svg/classdiagrams.html
+++ b/doc/uml/html-svg/classdiagrams.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
@@ -16,8 +16,8 @@
<!-- ============================================================= -->
<table>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#ref10_128069" target = "projectFrame"><b>OpenGL Interfaces - All</b></a></td><td></td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#ref10_134786" target = "projectFrame"><b>OpenGL Interfaces - Core Only</b></a></td><td></td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass diagram128069" target = "projectFrame"><b>OpenGL Interfaces - All</b></a></td><td></td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass diagram134786" target = "projectFrame"><b>OpenGL Interfaces - Core Only</b></a></td><td></td><td></td></tr>
</table>
</body>
</html>
diff --git a/doc/uml/html-svg/classes.html b/doc/uml/html-svg/classes.html
index 53e25ae..0e0ae36 100644
--- a/doc/uml/html-svg/classes.html
+++ b/doc/uml/html-svg/classes.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
@@ -16,33 +16,33 @@
<!-- ============================================================= -->
<table>
-<tr bgcolor="#f0f0f0"><td><a href="class131013.html#refclass131013" target = "projectFrame"><b>AbstractGraphicsConfiguration</b></a></td><td></td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class131269.html#refclass131269" target = "projectFrame"><b>Capabilities</b></a></td><td></td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128069.html#refclass128069" target = "projectFrame"><b>GL</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128453.html#refclass128453" target = "projectFrame"><b>GL2</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128197.html#refclass128197" target = "projectFrame"><b>GL2ES1</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128386.html#refclass128386" target = "projectFrame"><b>GL2ES12</b></a></td><td>entity</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128581.html#refclass128581" target = "projectFrame"><b>GL2ES2</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="metaclass135298.html#refmetaclass135298" target = "projectFrame"><b>GL2ES3</b></a></td><td>metaclass</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128709.html#refclass128709" target = "projectFrame"><b>GL2GL3</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128837.html#refclass128837" target = "projectFrame"><b>GL3</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128002.html#refclass128002" target = "projectFrame"><b>GL3bc</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class135170.html#refclass135170" target = "projectFrame"><b>GL3ES3</b></a></td><td>@interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128130.html#refclass128130" target = "projectFrame"><b>GL4</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128258.html#refclass128258" target = "projectFrame"><b>GL4bc</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class130501.html#refclass130501" target = "projectFrame"><b>GL4bcImpl</b></a></td><td>entity</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class135042.html#refclass135042" target = "projectFrame"><b>GL4ES3</b></a></td><td>@interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class132549.html#refclass132549" target = "projectFrame"><b>GLBase</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class131141.html#refclass131141" target = "projectFrame"><b>GLCapabilities</b></a></td><td></td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class130117.html#refclass130117" target = "projectFrame"><b>GLContext</b></a></td><td></td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class130245.html#refclass130245" target = "projectFrame"><b>GLDrawable</b></a></td><td></td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128325.html#refclass128325" target = "projectFrame"><b>GLES1</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class130757.html#refclass130757" target = "projectFrame"><b>GLES1Impl</b></a></td><td>entity</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128965.html#refclass128965" target = "projectFrame"><b>GLES2</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class134914.html#refclass134914" target = "projectFrame"><b>GLES3</b></a></td><td>@interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class130629.html#refclass130629" target = "projectFrame"><b>GLES3Impl</b></a></td><td>entity</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class131397.html#refclass131397" target = "projectFrame"><b>GLProfile</b></a></td><td></td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class130885.html#refclass130885" target = "projectFrame"><b>NativeWindow</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass131013" target = "projectFrame"><b>AbstractGraphicsConfiguration</b></a></td><td></td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass131269" target = "projectFrame"><b>Capabilities</b></a></td><td></td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128069" target = "projectFrame"><b>GL</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128453" target = "projectFrame"><b>GL2</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128197" target = "projectFrame"><b>GL2ES1</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128386" target = "projectFrame"><b>GL2ES12</b></a></td><td>entity</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128581" target = "projectFrame"><b>GL2ES2</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refmetaclass135298" target = "projectFrame"><b>GL2ES3</b></a></td><td>metaclass</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128709" target = "projectFrame"><b>GL2GL3</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128837" target = "projectFrame"><b>GL3</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128002" target = "projectFrame"><b>GL3bc</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass135170" target = "projectFrame"><b>GL3ES3</b></a></td><td>@interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128130" target = "projectFrame"><b>GL4</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128258" target = "projectFrame"><b>GL4bc</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130501" target = "projectFrame"><b>GL4bcImpl</b></a></td><td>entity</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass135042" target = "projectFrame"><b>GL4ES3</b></a></td><td>@interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass132549" target = "projectFrame"><b>GLBase</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass131141" target = "projectFrame"><b>GLCapabilities</b></a></td><td></td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130117" target = "projectFrame"><b>GLContext</b></a></td><td></td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130245" target = "projectFrame"><b>GLDrawable</b></a></td><td></td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128325" target = "projectFrame"><b>GLES1</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130757" target = "projectFrame"><b>GLES1Impl</b></a></td><td>entity</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128965" target = "projectFrame"><b>GLES2</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass134914" target = "projectFrame"><b>GLES3</b></a></td><td>@interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130629" target = "projectFrame"><b>GLES3Impl</b></a></td><td>entity</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass131397" target = "projectFrame"><b>GLProfile</b></a></td><td></td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130885" target = "projectFrame"><b>NativeWindow</b></a></td><td>interface</td><td></td></tr>
</table>
</body>
</html>
diff --git a/doc/uml/html-svg/classes_list.html b/doc/uml/html-svg/classes_list.html
index 7201623..4882e6a 100644
--- a/doc/uml/html-svg/classes_list.html
+++ b/doc/uml/html-svg/classes_list.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
@@ -17,33 +17,33 @@
<table border="0" width="100%">
<tr>
-<td nowrap="nowrap"><a href="class131013.html#refclass131013" target = "projectFrame"><b>AbstractGraphicsConfiguration</b></a><br />
-<a href="class131269.html#refclass131269" target = "projectFrame"><b>Capabilities</b></a><br />
-<a href="class128069.html#refclass128069" target = "projectFrame"><b>GL</b></a><br />
-<a href="class128453.html#refclass128453" target = "projectFrame"><b>GL2</b></a><br />
-<a href="class128197.html#refclass128197" target = "projectFrame"><b>GL2ES1</b></a><br />
-<a href="class128386.html#refclass128386" target = "projectFrame"><b>GL2ES12</b></a><br />
-<a href="class128581.html#refclass128581" target = "projectFrame"><b>GL2ES2</b></a><br />
-<a href="metaclass135298.html#refmetaclass135298" target = "projectFrame"><b>GL2ES3</b></a><br />
-<a href="class128709.html#refclass128709" target = "projectFrame"><b>GL2GL3</b></a><br />
-<a href="class128837.html#refclass128837" target = "projectFrame"><b>GL3</b></a><br />
-<a href="class128002.html#refclass128002" target = "projectFrame"><b>GL3bc</b></a><br />
-<a href="class135170.html#refclass135170" target = "projectFrame"><b>GL3ES3</b></a><br />
-<a href="class128130.html#refclass128130" target = "projectFrame"><b>GL4</b></a><br />
-<a href="class128258.html#refclass128258" target = "projectFrame"><b>GL4bc</b></a><br />
-<a href="class130501.html#refclass130501" target = "projectFrame"><b>GL4bcImpl</b></a><br />
-<a href="class135042.html#refclass135042" target = "projectFrame"><b>GL4ES3</b></a><br />
-<a href="class132549.html#refclass132549" target = "projectFrame"><b>GLBase</b></a><br />
-<a href="class131141.html#refclass131141" target = "projectFrame"><b>GLCapabilities</b></a><br />
-<a href="class130117.html#refclass130117" target = "projectFrame"><b>GLContext</b></a><br />
-<a href="class130245.html#refclass130245" target = "projectFrame"><b>GLDrawable</b></a><br />
-<a href="class128325.html#refclass128325" target = "projectFrame"><b>GLES1</b></a><br />
-<a href="class130757.html#refclass130757" target = "projectFrame"><b>GLES1Impl</b></a><br />
-<a href="class128965.html#refclass128965" target = "projectFrame"><b>GLES2</b></a><br />
-<a href="class134914.html#refclass134914" target = "projectFrame"><b>GLES3</b></a><br />
-<a href="class130629.html#refclass130629" target = "projectFrame"><b>GLES3Impl</b></a><br />
-<a href="class131397.html#refclass131397" target = "projectFrame"><b>GLProfile</b></a><br />
-<a href="class130885.html#refclass130885" target = "projectFrame"><b>NativeWindow</b></a><br />
+<td nowrap><a href="index.html#refclass131013" target = "projectFrame"><b>AbstractGraphicsConfiguration</b></a><br />
+<a href="index.html#refclass131269" target = "projectFrame"><b>Capabilities</b></a><br />
+<a href="index.html#refclass128069" target = "projectFrame"><b>GL</b></a><br />
+<a href="index.html#refclass128453" target = "projectFrame"><b>GL2</b></a><br />
+<a href="index.html#refclass128197" target = "projectFrame"><b>GL2ES1</b></a><br />
+<a href="index.html#refclass128386" target = "projectFrame"><b>GL2ES12</b></a><br />
+<a href="index.html#refclass128581" target = "projectFrame"><b>GL2ES2</b></a><br />
+<a href="index.html#refmetaclass135298" target = "projectFrame"><b>GL2ES3</b></a><br />
+<a href="index.html#refclass128709" target = "projectFrame"><b>GL2GL3</b></a><br />
+<a href="index.html#refclass128837" target = "projectFrame"><b>GL3</b></a><br />
+<a href="index.html#refclass128002" target = "projectFrame"><b>GL3bc</b></a><br />
+<a href="index.html#refclass135170" target = "projectFrame"><b>GL3ES3</b></a><br />
+<a href="index.html#refclass128130" target = "projectFrame"><b>GL4</b></a><br />
+<a href="index.html#refclass128258" target = "projectFrame"><b>GL4bc</b></a><br />
+<a href="index.html#refclass130501" target = "projectFrame"><b>GL4bcImpl</b></a><br />
+<a href="index.html#refclass135042" target = "projectFrame"><b>GL4ES3</b></a><br />
+<a href="index.html#refclass132549" target = "projectFrame"><b>GLBase</b></a><br />
+<a href="index.html#refclass131141" target = "projectFrame"><b>GLCapabilities</b></a><br />
+<a href="index.html#refclass130117" target = "projectFrame"><b>GLContext</b></a><br />
+<a href="index.html#refclass130245" target = "projectFrame"><b>GLDrawable</b></a><br />
+<a href="index.html#refclass128325" target = "projectFrame"><b>GLES1</b></a><br />
+<a href="index.html#refclass130757" target = "projectFrame"><b>GLES1Impl</b></a><br />
+<a href="index.html#refclass128965" target = "projectFrame"><b>GLES2</b></a><br />
+<a href="index.html#refclass134914" target = "projectFrame"><b>GLES3</b></a><br />
+<a href="index.html#refclass130629" target = "projectFrame"><b>GLES3Impl</b></a><br />
+<a href="index.html#refclass131397" target = "projectFrame"><b>GLProfile</b></a><br />
+<a href="index.html#refclass130885" target = "projectFrame"><b>NativeWindow</b></a><br />
</td>
</tr>
</table>
diff --git a/doc/uml/html-svg/fig128069.svg b/doc/uml/html-svg/fig128069.svg
index a3e12c5..3c3372b 100644
--- a/doc/uml/html-svg/fig128069.svg
+++ b/doc/uml/html-svg/fig128069.svg
@@ -1,494 +1,502 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Bouml (http://bouml.free.fr/) -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg width="1186" height="1178" version="1.1" xmlns="http://www.w3.org/2000/svg">
-<g>
- <rect fill="#ededed" stroke="black" stroke-width="1" stroke-opacity="1" x="2" y="195" width="235" height="971" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="49" y="213">Fixed Function</text>
- <line stroke="black" stroke-opacity="1" x1="2" y1="218" x2="95" y2="218" />
- <line stroke="black" stroke-opacity="1" x1="95" y1="218" x2="107" y2="206" />
- <line stroke="black" stroke-opacity="1" x1="107" y1="206" x2="107" y2="195" />
-</g>
-<g>
- <line stroke="black" stroke-dasharray="20,4" stroke-opacity="1" x1="2" y1="379" x2="237" y2="379" />
-</g>
-<g>
- <line stroke="black" stroke-dasharray="20,4" stroke-opacity="1" x1="2" y1="462" x2="237" y2="462" />
-</g>
-<g>
- <line stroke="black" stroke-dasharray="20,4" stroke-opacity="1" x1="2" y1="637" x2="237" y2="637" />
-</g>
-<g>
- <rect fill="#c0ffff" stroke="black" stroke-width="1" stroke-opacity="1" x="236" y="195" width="708" height="971" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="304" y="213">Programmable Shader</text>
- <line stroke="black" stroke-opacity="1" x1="236" y1="218" x2="372" y2="218" />
- <line stroke="black" stroke-opacity="1" x1="372" y1="218" x2="384" y2="206" />
- <line stroke="black" stroke-opacity="1" x1="384" y1="206" x2="384" y2="195" />
-</g>
-<g>
- <line stroke="black" stroke-dasharray="20,4" stroke-opacity="1" x1="236" y1="462" x2="944" y2="462" />
-</g>
-<g>
- <line stroke="black" stroke-dasharray="20,4" stroke-opacity="1" x1="236" y1="637" x2="944" y2="637" />
-</g>
-<g>
- <line stroke="black" stroke-dasharray="20,4" stroke-opacity="1" x1="236" y1="379" x2="944" y2="379" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="111" y1="225" x2="152" y2="176" />
- <line stroke="black" stroke-opacity="1" x1="156" y1="172" x2="147" y2="172" />
- <line stroke="black" stroke-opacity="1" x1="156" y1="172" x2="156" y2="180" />
- <line stroke="black" stroke-opacity="1" x1="147" y1="172" x2="156" y2="180" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="284" y1="226" x2="227" y2="175" />
- <line stroke="black" stroke-opacity="1" x1="223" y1="172" x2="223" y2="180" />
- <line stroke="black" stroke-opacity="1" x1="223" y1="172" x2="231" y2="171" />
- <line stroke="black" stroke-opacity="1" x1="223" y1="180" x2="231" y2="171" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="86" y1="479" x2="86" y2="292" />
- <line stroke="black" stroke-opacity="1" x1="86" y1="286" x2="80" y2="292" />
- <line stroke="black" stroke-opacity="1" x1="86" y1="286" x2="92" y2="292" />
- <line stroke="black" stroke-opacity="1" x1="80" y1="292" x2="92" y2="292" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="320" y1="479" x2="320" y2="293" />
- <line stroke="black" stroke-opacity="1" x1="320" y1="287" x2="314" y2="293" />
- <line stroke="black" stroke-opacity="1" x1="320" y1="287" x2="326" y2="293" />
- <line stroke="black" stroke-opacity="1" x1="314" y1="293" x2="326" y2="293" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="627" y1="799" x2="487" y2="454" />
- <line stroke="black" stroke-opacity="1" x1="485" y1="449" x2="481" y2="456" />
- <line stroke="black" stroke-opacity="1" x1="485" y1="449" x2="492" y2="452" />
- <line stroke="black" stroke-opacity="1" x1="481" y1="456" x2="492" y2="452" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="262" y1="690" x2="443" y2="453" />
- <line stroke="black" stroke-opacity="1" x1="447" y1="449" x2="438" y2="450" />
- <line stroke="black" stroke-opacity="1" x1="447" y1="449" x2="448" y2="457" />
- <line stroke="black" stroke-opacity="1" x1="438" y1="450" x2="448" y2="457" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="230" y1="690" x2="97" y2="291" />
- <line stroke="black" stroke-opacity="1" x1="96" y1="286" x2="92" y2="293" />
- <line stroke="black" stroke-opacity="1" x1="96" y1="286" x2="103" y2="289" />
- <line stroke="black" stroke-opacity="1" x1="92" y1="293" x2="103" y2="289" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="685" y1="110" x2="498" y2="54" />
-</g>
-<g>
- <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="85" y1="573" x2="85" y2="546" />
- <line stroke="black" stroke-opacity="1" x1="85" y1="540" x2="79" y2="546" />
- <line stroke="black" stroke-opacity="1" x1="85" y1="540" x2="91" y2="546" />
- <line stroke="black" stroke-opacity="1" x1="79" y1="546" x2="91" y2="546" />
-</g>
-<g>
- <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="491" y1="1047" x2="614" y2="864" />
- <line stroke="black" stroke-opacity="1" x1="618" y1="860" x2="609" y2="861" />
- <line stroke="black" stroke-opacity="1" x1="618" y1="860" x2="619" y2="868" />
- <line stroke="black" stroke-opacity="1" x1="609" y1="861" x2="619" y2="868" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="1071" y1="477" x2="1071" y2="441" />
- <line stroke="black" stroke-opacity="1" x1="1071" y1="435" x2="1065" y2="441" />
- <line stroke="black" stroke-opacity="1" x1="1071" y1="435" x2="1077" y2="441" />
- <line stroke="black" stroke-opacity="1" x1="1065" y1="441" x2="1077" y2="441" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="1038" y1="335" x2="1037" y2="394" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="1072" y1="294" x2="1072" y2="260" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="1020" y1="212" x2="772" y2="136" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="1071" y1="581" x2="1071" y2="518" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="1098" y1="394" x2="1098" y2="335" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="1071" y1="581" x2="1071" y2="518" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="188" y1="111" x2="188" y2="77" />
- <line stroke="black" stroke-opacity="1" x1="189" y1="72" x2="182" y2="77" />
- <line stroke="black" stroke-opacity="1" x1="189" y1="72" x2="194" y2="78" />
- <line stroke="black" stroke-opacity="1" x1="182" y1="77" x2="194" y2="78" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="236" y1="42" x2="421" y2="42" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="283" y="804" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="199" y="856" width="87" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="195" y="800" width="88" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="239" y="815"><<interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="239" y="835">GL3bc</text>
- <line stroke="black" stroke-opacity="1" x1="195" y1="840" x2="283" y2="840" />
- <line stroke="black" stroke-opacity="1" x1="195" y1="848" x2="283" y2="848" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="230" y="116" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="146" y="168" width="87" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="142" y="112" width="88" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="186" y="127"><<interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="186" y="147">GL</text>
- <line stroke="black" stroke-opacity="1" x1="142" y1="152" x2="230" y2="152" />
- <line stroke="black" stroke-opacity="1" x1="142" y1="160" x2="230" y2="160" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="852" y="932" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="768" y="984" width="87" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="764" y="928" width="88" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="808" y="943"><<interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="808" y="963">GL4</text>
- <line stroke="black" stroke-opacity="1" x1="764" y1="968" x2="852" y2="968" />
- <line stroke="black" stroke-opacity="1" x1="764" y1="976" x2="852" y2="976" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="128" y="230" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="44" y="282" width="87" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="40" y="226" width="88" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="84" y="241"><<interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="84" y="261">GL2ES1</text>
- <line stroke="black" stroke-opacity="1" x1="40" y1="266" x2="128" y2="266" />
- <line stroke="black" stroke-opacity="1" x1="40" y1="274" x2="128" y2="274" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="283" y="932" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="199" y="984" width="87" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="195" y="928" width="88" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="239" y="943"><<interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="239" y="963">GL4bc</text>
- <line stroke="black" stroke-opacity="1" x1="195" y1="968" x2="283" y2="968" />
- <line stroke="black" stroke-opacity="1" x1="195" y1="976" x2="283" y2="976" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="128" y="484" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="44" y="536" width="87" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="40" y="480" width="88" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="84" y="495"><<interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="84" y="515">GLES1</text>
- <line stroke="black" stroke-opacity="1" x1="40" y1="520" x2="128" y2="520" />
- <line stroke="black" stroke-opacity="1" x1="40" y1="528" x2="128" y2="528" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="283" y="695" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="199" y="747" width="87" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="195" y="691" width="88" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="239" y="706"><<interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="239" y="726">GL2</text>
- <line stroke="black" stroke-opacity="1" x1="195" y1="731" x2="283" y2="731" />
- <line stroke="black" stroke-opacity="1" x1="195" y1="739" x2="283" y2="739" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="362" y="231" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="278" y="283" width="87" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="274" y="227" width="88" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="318" y="242"><<interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="318" y="262">GL2ES2</text>
- <line stroke="black" stroke-opacity="1" x1="274" y1="267" x2="362" y2="267" />
- <line stroke="black" stroke-opacity="1" x1="274" y1="275" x2="362" y2="275" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="683" y="804" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="599" y="856" width="87" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="595" y="800" width="88" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="639" y="815"><<interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="639" y="835">GL3</text>
- <line stroke="black" stroke-opacity="1" x1="595" y1="840" x2="683" y2="840" />
- <line stroke="black" stroke-opacity="1" x1="595" y1="848" x2="683" y2="848" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="362" y="484" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="278" y="536" width="87" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="274" y="480" width="88" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="318" y="495"><<interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="318" y="515">GLES2</text>
- <line stroke="black" stroke-opacity="1" x1="274" y1="520" x2="362" y2="520" />
- <line stroke="black" stroke-opacity="1" x1="274" y1="528" x2="362" y2="528" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="859" y="309" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="761" y="361" width="101" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="757" y="305" width="102" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="808" y="320"><<@interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="808" y="340">GL4ES3</text>
- <line stroke="black" stroke-opacity="1" x1="757" y1="345" x2="859" y2="345" />
- <line stroke="black" stroke-opacity="1" x1="757" y1="353" x2="859" y2="353" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="494" y="27" width="3" height="35" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="426" y="59" width="71" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="422" y="23" width="72" height="36" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" font-style="italic" text-anchor="middle" x="458" y="38">GLContext</text>
- <line stroke="black" stroke-opacity="1" x1="422" y1="43" x2="494" y2="43" />
- <line stroke="black" stroke-opacity="1" x1="422" y1="51" x2="494" y2="51" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="768" y="109" width="3" height="35" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="690" y="141" width="81" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="686" y="105" width="82" height="36" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" font-style="italic" text-anchor="middle" x="727" y="120">GLDrawable</text>
- <line stroke="black" stroke-opacity="1" x1="686" y1="125" x2="768" y2="125" />
- <line stroke="black" stroke-opacity="1" x1="686" y1="133" x2="768" y2="133" />
-</g>
-<g>
- <rect fill="none" stroke="black" stroke-width="1" stroke-opacity="1" x="423" y="250" width="100" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="473" y="265"><<metaclass>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" font-style="italic" text-anchor="middle" x="473" y="285">GL2ES3</text>
- <line stroke="black" stroke-opacity="1" x1="423" y1="290" x2="523" y2="290" />
- <line stroke="black" stroke-opacity="1" x1="423" y1="298" x2="523" y2="298" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="464" y1="1068" x2="484" y2="1068" />
- <ellipse fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" cx="474" cy="1058" rx="10" ry="10" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="474" y="1083">GL4bcImpl</text>
- <line stroke="black" stroke-opacity="1" x1="436" y1="1088" x2="512" y2="1088" />
- <line stroke="black" stroke-opacity="1" x1="436" y1="1096" x2="512" y2="1096" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="711" y1="595" x2="731" y2="595" />
- <ellipse fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" cx="721" cy="585" rx="10" ry="10" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="721" y="610">GLES3Impl</text>
- <line stroke="black" stroke-opacity="1" x1="682" y1="615" x2="760" y2="615" />
- <line stroke="black" stroke-opacity="1" x1="682" y1="623" x2="760" y2="623" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="1121" y="204" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="1025" y="256" width="99" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="1021" y="200" width="100" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="1071" y="215"><<interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="1071" y="235">NativeWindow</text>
- <line stroke="black" stroke-opacity="1" x1="1021" y1="240" x2="1121" y2="240" />
- <line stroke="black" stroke-opacity="1" x1="1021" y1="248" x2="1121" y2="248" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="1170" y="299" width="3" height="35" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="976" y="331" width="197" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="972" y="295" width="198" height="36" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" font-style="italic" text-anchor="middle" x="1071" y="310">AbstractGraphicsConfiguration</text>
- <line stroke="black" stroke-opacity="1" x1="972" y1="315" x2="1170" y2="315" />
- <line stroke="black" stroke-opacity="1" x1="972" y1="323" x2="1170" y2="323" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="1119" y="482" width="3" height="35" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="1023" y="514" width="99" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="1019" y="478" width="100" height="36" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="1069" y="493">GLCapabilities</text>
- <line stroke="black" stroke-opacity="1" x1="1019" y1="498" x2="1119" y2="498" />
- <line stroke="black" stroke-opacity="1" x1="1019" y1="506" x2="1119" y2="506" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="1104" y="586" width="3" height="35" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="1040" y="618" width="67" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="1036" y="582" width="68" height="36" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="1070" y="597">GLProfile</text>
- <line stroke="black" stroke-opacity="1" x1="1036" y1="602" x2="1104" y2="602" />
- <line stroke="black" stroke-opacity="1" x1="1036" y1="610" x2="1104" y2="610" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="232" y="16" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="148" y="68" width="87" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="144" y="12" width="88" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="188" y="27"><<interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="188" y="47">GLBase</text>
- <line stroke="black" stroke-opacity="1" x1="144" y1="52" x2="232" y2="52" />
- <line stroke="black" stroke-opacity="1" x1="144" y1="60" x2="232" y2="60" />
-</g>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="820" y="680">Desktop final public</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="820" y="696">OpenGL Interfaces</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="820" y="538">Mobile final public</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="820" y="554">OpenGL Interfaces</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="17" y="1088">Private implementation (detail)</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="819" y="258">Desktop/Mobile</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="819" y="274">Common Interfaces</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="781" y="32">Lifecycle: From the lower right to</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="781" y="48">the top, left step where the</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="781" y="64">GLContext is created with a</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="781" y="80">suitable GL implementation</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="781" y="96">matching the GLProfile.</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="271" y="151">Common GL Stuff</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="820" y="418">Common Desktop</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="820" y="434">Profile</text>
-<g>
- <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="446" y1="1047" x2="273" y2="864" />
- <line stroke="black" stroke-opacity="1" x1="269" y1="860" x2="268" y2="868" />
- <line stroke="black" stroke-opacity="1" x1="269" y1="860" x2="277" y2="860" />
- <line stroke="black" stroke-opacity="1" x1="268" y1="868" x2="277" y2="860" />
-</g>
-<g>
- <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="435" y1="1056" x2="292" y2="983" />
- <line stroke="black" stroke-opacity="1" x1="287" y1="981" x2="289" y2="989" />
- <line stroke="black" stroke-opacity="1" x1="287" y1="981" x2="295" y2="978" />
- <line stroke="black" stroke-opacity="1" x1="289" y1="989" x2="295" y2="978" />
-</g>
-<g>
- <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="455" y1="1047" x2="263" y2="756" />
- <line stroke="black" stroke-opacity="1" x1="260" y1="751" x2="258" y2="759" />
- <line stroke="black" stroke-opacity="1" x1="260" y1="751" x2="268" y2="752" />
- <line stroke="black" stroke-opacity="1" x1="258" y1="759" x2="268" y2="752" />
-</g>
-<g>
- <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="512" y1="1061" x2="757" y2="974" />
- <line stroke="black" stroke-opacity="1" x1="763" y1="972" x2="755" y2="968" />
- <line stroke="black" stroke-opacity="1" x1="763" y1="972" x2="759" y2="979" />
- <line stroke="black" stroke-opacity="1" x1="755" y1="968" x2="759" y2="979" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="241" y1="799" x2="241" y2="757" />
- <line stroke="black" stroke-opacity="1" x1="241" y1="751" x2="235" y2="757" />
- <line stroke="black" stroke-opacity="1" x1="241" y1="751" x2="247" y2="757" />
- <line stroke="black" stroke-opacity="1" x1="235" y1="757" x2="247" y2="757" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="287" y1="830" x2="588" y2="830" />
- <line stroke="black" stroke-opacity="1" x1="594" y1="830" x2="588" y2="824" />
- <line stroke="black" stroke-opacity="1" x1="594" y1="830" x2="588" y2="836" />
- <line stroke="black" stroke-opacity="1" x1="588" y1="824" x2="588" y2="836" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="768" y1="927" x2="685" y2="863" />
- <line stroke="black" stroke-opacity="1" x1="681" y1="860" x2="682" y2="868" />
- <line stroke="black" stroke-opacity="1" x1="681" y1="860" x2="689" y2="858" />
- <line stroke="black" stroke-opacity="1" x1="682" y1="868" x2="689" y2="858" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="241" y1="927" x2="241" y2="866" />
- <line stroke="black" stroke-opacity="1" x1="241" y1="860" x2="235" y2="866" />
- <line stroke="black" stroke-opacity="1" x1="241" y1="860" x2="247" y2="866" />
- <line stroke="black" stroke-opacity="1" x1="235" y1="866" x2="247" y2="866" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="287" y1="958" x2="757" y2="958" />
- <line stroke="black" stroke-opacity="1" x1="763" y1="958" x2="757" y2="952" />
- <line stroke="black" stroke-opacity="1" x1="763" y1="958" x2="757" y2="964" />
- <line stroke="black" stroke-opacity="1" x1="757" y1="952" x2="757" y2="964" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="422" y1="269" x2="371" y2="262" />
- <line stroke="black" stroke-opacity="1" x1="366" y1="262" x2="371" y2="268" />
- <line stroke="black" stroke-opacity="1" x1="366" y1="262" x2="372" y2="256" />
- <line stroke="black" stroke-opacity="1" x1="371" y1="268" x2="372" y2="256" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="810" y1="927" x2="810" y2="371" />
- <line stroke="black" stroke-opacity="1" x1="810" y1="365" x2="804" y2="371" />
- <line stroke="black" stroke-opacity="1" x1="810" y1="365" x2="816" y2="371" />
- <line stroke="black" stroke-opacity="1" x1="804" y1="371" x2="816" y2="371" />
-</g>
-<g>
- <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="681" y1="593" x2="371" y2="521" />
- <line stroke="black" stroke-opacity="1" x1="366" y1="520" x2="370" y2="527" />
- <line stroke="black" stroke-opacity="1" x1="366" y1="520" x2="373" y2="515" />
- <line stroke="black" stroke-opacity="1" x1="370" y1="527" x2="373" y2="515" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="771" y="484" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="673" y="536" width="101" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="669" y="480" width="102" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="720" y="495"><<@interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="720" y="515">GLES3</text>
- <line stroke="black" stroke-opacity="1" x1="669" y1="520" x2="771" y2="520" />
- <line stroke="black" stroke-opacity="1" x1="669" y1="528" x2="771" y2="528" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="516" y="393" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="432" y="445" width="87" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="428" y="389" width="88" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="472" y="404"><<interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="472" y="424">GL2GL3</text>
- <line stroke="black" stroke-opacity="1" x1="428" y1="429" x2="516" y2="429" />
- <line stroke="black" stroke-opacity="1" x1="428" y1="437" x2="516" y2="437" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="75" y1="594" x2="95" y2="594" />
- <ellipse fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" cx="85" cy="584" rx="10" ry="10" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="85" y="609">GLES1Impl</text>
- <line stroke="black" stroke-opacity="1" x1="46" y1="614" x2="124" y2="614" />
- <line stroke="black" stroke-opacity="1" x1="46" y1="622" x2="124" y2="622" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="1110" y="399" width="3" height="35" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="1032" y="431" width="81" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="1028" y="395" width="82" height="36" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="1069" y="410">Capabilities</text>
- <line stroke="black" stroke-opacity="1" x1="1028" y1="415" x2="1110" y2="415" />
- <line stroke="black" stroke-opacity="1" x1="1028" y1="423" x2="1110" y2="423" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="735" y1="479" x2="790" y2="370" />
- <line stroke="black" stroke-opacity="1" x1="793" y1="365" x2="784" y2="367" />
- <line stroke="black" stroke-opacity="1" x1="793" y1="365" x2="795" y2="373" />
- <line stroke="black" stroke-opacity="1" x1="784" y1="367" x2="795" y2="373" />
-</g>
-<g>
- <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="721" y1="574" x2="721" y2="546" />
- <line stroke="black" stroke-opacity="1" x1="721" y1="540" x2="715" y2="546" />
- <line stroke="black" stroke-opacity="1" x1="721" y1="540" x2="727" y2="546" />
- <line stroke="black" stroke-opacity="1" x1="715" y1="546" x2="727" y2="546" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="473" y1="388" x2="473" y2="312" />
- <line stroke="black" stroke-opacity="1" x1="473" y1="306" x2="467" y2="312" />
- <line stroke="black" stroke-opacity="1" x1="473" y1="306" x2="479" y2="312" />
- <line stroke="black" stroke-opacity="1" x1="467" y1="312" x2="479" y2="312" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="690" y="277" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="592" y="329" width="101" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="588" y="273" width="102" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="639" y="288"><<@interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="639" y="308">GL3ES3</text>
- <line stroke="black" stroke-opacity="1" x1="588" y1="313" x2="690" y2="313" />
- <line stroke="black" stroke-opacity="1" x1="588" y1="321" x2="690" y2="321" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="756" y1="325" x2="699" y2="314" />
- <line stroke="black" stroke-opacity="1" x1="694" y1="313" x2="698" y2="320" />
- <line stroke="black" stroke-opacity="1" x1="694" y1="313" x2="701" y2="308" />
- <line stroke="black" stroke-opacity="1" x1="698" y1="320" x2="701" y2="308" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="587" y1="293" x2="528" y2="284" />
- <line stroke="black" stroke-opacity="1" x1="523" y1="284" x2="528" y2="290" />
- <line stroke="black" stroke-opacity="1" x1="523" y1="284" x2="529" y2="278" />
- <line stroke="black" stroke-opacity="1" x1="528" y1="290" x2="529" y2="278" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="641" y1="799" x2="641" y2="339" />
- <line stroke="black" stroke-opacity="1" x1="641" y1="333" x2="635" y2="339" />
- <line stroke="black" stroke-opacity="1" x1="641" y1="333" x2="647" y2="339" />
- <line stroke="black" stroke-opacity="1" x1="635" y1="339" x2="647" y2="339" />
-</g>
-<g>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="660" y="135">1</text>
-</g>
-<g>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="1043" y="386">chosen</text>
-</g>
-<g>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="514" y="80">0..1</text>
-</g>
-<g>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="1015" y="386">1</text>
-</g>
-<g>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="1115" y="386">requested</text>
-</g>
-<g>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="1080" y="386">1</text>
-</g>
-<g>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="397" y="64">1</text>
-</g>
-<g>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="248" y="64">1</text>
-</g>
-</svg>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Bouml (http://bouml.free.fr/) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="1232" height="1178" version="1.1" xmlns="http://www.w3.org/2000/svg">
+<g>
+ <rect fill="#ededed" stroke="black" stroke-width="1" stroke-opacity="1" x="2" y="195" width="235" height="971" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="53" y="212">Fixed Function</text>
+ <line stroke="black" stroke-opacity="1" x1="2" y1="221" x2="104" y2="221" />
+ <line stroke="black" stroke-opacity="1" x1="104" y1="221" x2="117" y2="208" />
+ <line stroke="black" stroke-opacity="1" x1="117" y1="208" x2="117" y2="195" />
+</g>
+<g>
+ <line stroke="black" stroke-dasharray="20,4" stroke-opacity="1" x1="2" y1="476" x2="237" y2="476" />
+</g>
+<g>
+ <line stroke="black" stroke-dasharray="20,4" stroke-opacity="1" x1="2" y1="707" x2="237" y2="707" />
+</g>
+<g>
+ <line stroke="black" stroke-dasharray="20,4" stroke-opacity="1" x1="2" y1="390" x2="237" y2="390" />
+</g>
+<g>
+ <rect fill="#c0ffff" stroke="black" stroke-width="1" stroke-opacity="1" x="237" y="195" width="743" height="971" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="313" y="212">Programmable Shader</text>
+ <line stroke="black" stroke-opacity="1" x1="237" y1="221" x2="389" y2="221" />
+ <line stroke="black" stroke-opacity="1" x1="389" y1="221" x2="402" y2="208" />
+ <line stroke="black" stroke-opacity="1" x1="402" y1="208" x2="402" y2="195" />
+</g>
+<g>
+ <line stroke="black" stroke-dasharray="20,4" stroke-opacity="1" x1="237" y1="476" x2="980" y2="476" />
+</g>
+<g>
+ <line stroke="black" stroke-dasharray="20,4" stroke-opacity="1" x1="237" y1="707" x2="980" y2="707" />
+</g>
+<g>
+ <line stroke="black" stroke-dasharray="20,4" stroke-opacity="1" x1="237" y1="390" x2="980" y2="390" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="136" y1="233" x2="175" y2="186" />
+ <line stroke="black" stroke-opacity="1" x1="179" y1="182" x2="170" y2="182" />
+ <line stroke="black" stroke-opacity="1" x1="179" y1="182" x2="179" y2="190" />
+ <line stroke="black" stroke-opacity="1" x1="170" y1="182" x2="179" y2="190" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="305" y1="234" x2="253" y2="186" />
+ <line stroke="black" stroke-opacity="1" x1="249" y1="182" x2="249" y2="190" />
+ <line stroke="black" stroke-opacity="1" x1="249" y1="182" x2="257" y2="181" />
+ <line stroke="black" stroke-opacity="1" x1="249" y1="190" x2="257" y2="181" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="108" y1="491" x2="108" y2="306" />
+ <line stroke="black" stroke-opacity="1" x1="108" y1="300" x2="102" y2="306" />
+ <line stroke="black" stroke-opacity="1" x1="108" y1="300" x2="114" y2="306" />
+ <line stroke="black" stroke-opacity="1" x1="102" y1="306" x2="114" y2="306" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="343" y1="488" x2="343" y2="307" />
+ <line stroke="black" stroke-opacity="1" x1="343" y1="301" x2="337" y2="307" />
+ <line stroke="black" stroke-opacity="1" x1="343" y1="301" x2="349" y2="307" />
+ <line stroke="black" stroke-opacity="1" x1="337" y1="307" x2="349" y2="307" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="650" y1="855" x2="509" y2="468" />
+ <line stroke="black" stroke-opacity="1" x1="507" y1="463" x2="503" y2="470" />
+ <line stroke="black" stroke-opacity="1" x1="507" y1="463" x2="514" y2="466" />
+ <line stroke="black" stroke-opacity="1" x1="503" y1="470" x2="514" y2="466" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="261" y1="745" x2="465" y2="467" />
+ <line stroke="black" stroke-opacity="1" x1="469" y1="463" x2="460" y2="464" />
+ <line stroke="black" stroke-opacity="1" x1="469" y1="463" x2="470" y2="471" />
+ <line stroke="black" stroke-opacity="1" x1="460" y1="464" x2="470" y2="471" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="227" y1="745" x2="116" y2="305" />
+ <line stroke="black" stroke-opacity="1" x1="115" y1="300" x2="110" y2="307" />
+ <line stroke="black" stroke-opacity="1" x1="115" y1="300" x2="122" y2="304" />
+ <line stroke="black" stroke-opacity="1" x1="110" y1="307" x2="122" y2="304" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="712" y1="99" x2="523" y2="50" />
+</g>
+<g>
+ <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="108" y1="577" x2="108" y2="564" />
+ <line stroke="black" stroke-opacity="1" x1="108" y1="558" x2="102" y2="564" />
+ <line stroke="black" stroke-opacity="1" x1="108" y1="558" x2="114" y2="564" />
+ <line stroke="black" stroke-opacity="1" x1="102" y1="564" x2="114" y2="564" />
+</g>
+<g>
+ <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="514" y1="1087" x2="632" y2="926" />
+ <line stroke="black" stroke-opacity="1" x1="636" y1="922" x2="627" y2="923" />
+ <line stroke="black" stroke-opacity="1" x1="636" y1="922" x2="637" y2="930" />
+ <line stroke="black" stroke-opacity="1" x1="627" y1="923" x2="637" y2="930" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="1107" y1="443" x2="1107" y2="409" />
+ <line stroke="black" stroke-opacity="1" x1="1107" y1="403" x2="1101" y2="409" />
+ <line stroke="black" stroke-opacity="1" x1="1107" y1="403" x2="1113" y2="409" />
+ <line stroke="black" stroke-opacity="1" x1="1101" y1="409" x2="1113" y2="409" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="1068" y1="303" x2="1070" y2="360" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="1105" y1="260" x2="1105" y2="236" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="1051" y1="187" x2="807" y2="123" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="1107" y1="547" x2="1107" y2="486" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="1136" y1="360" x2="1135" y2="303" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="1107" y1="547" x2="1107" y2="486" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="212" y1="115" x2="212" y2="79" />
+ <line stroke="black" stroke-opacity="1" x1="212" y1="73" x2="206" y2="79" />
+ <line stroke="black" stroke-opacity="1" x1="212" y1="73" x2="218" y2="79" />
+ <line stroke="black" stroke-opacity="1" x1="206" y1="79" x2="218" y2="79" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="262" y1="40" x2="436" y2="40" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="282" y="860" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="192" y="918" width="93" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="188" y="856" width="94" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="235" y="865"><<interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="235" y="888">GL3bc</text>
+ <line stroke="black" stroke-opacity="1" x1="188" y1="902" x2="282" y2="902" />
+ <line stroke="black" stroke-opacity="1" x1="188" y1="910" x2="282" y2="910" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="153" y="238" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="63" y="296" width="93" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="59" y="234" width="94" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="106" y="243"><<interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="106" y="266">GL2ES1</text>
+ <line stroke="black" stroke-opacity="1" x1="59" y1="280" x2="153" y2="280" />
+ <line stroke="black" stroke-opacity="1" x1="59" y1="288" x2="153" y2="288" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="257" y="120" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="167" y="178" width="93" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="163" y="116" width="94" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="210" y="125"><<interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="210" y="148">GL</text>
+ <line stroke="black" stroke-opacity="1" x1="163" y1="162" x2="257" y2="162" />
+ <line stroke="black" stroke-opacity="1" x1="163" y1="170" x2="257" y2="170" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="880" y="989" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="790" y="1047" width="93" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="786" y="985" width="94" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="833" y="994"><<interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="833" y="1017">GL4</text>
+ <line stroke="black" stroke-opacity="1" x1="786" y1="1031" x2="880" y2="1031" />
+ <line stroke="black" stroke-opacity="1" x1="786" y1="1039" x2="880" y2="1039" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="519" y="23" width="3" height="37" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="441" y="57" width="81" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="437" y="19" width="82" height="38" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" font-style="italic" text-anchor="middle" x="478" y="28">GLContext</text>
+ <line stroke="black" stroke-opacity="1" x1="437" y1="42" x2="519" y2="42" />
+ <line stroke="black" stroke-opacity="1" x1="437" y1="50" x2="519" y2="50" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="803" y="95" width="3" height="37" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="717" y="129" width="89" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="713" y="91" width="90" height="38" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" font-style="italic" text-anchor="middle" x="758" y="100">GLDrawable</text>
+ <line stroke="black" stroke-opacity="1" x1="713" y1="114" x2="803" y2="114" />
+ <line stroke="black" stroke-opacity="1" x1="713" y1="122" x2="803" y2="122" />
+</g>
+<g>
+ <rect fill="none" stroke="black" stroke-width="1" stroke-opacity="1" x="444" y="258" width="104" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="496" y="267"><<metaclass>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" font-style="italic" text-anchor="middle" x="496" y="290">GL2ES3</text>
+ <line stroke="black" stroke-opacity="1" x1="444" y1="304" x2="548" y2="304" />
+ <line stroke="black" stroke-opacity="1" x1="444" y1="312" x2="548" y2="312" />
+</g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="851" y="508">Mobile final public</text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="851" y="527">OpenGL Interfaces</text>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="483" y1="1108" x2="503" y2="1108" />
+ <ellipse fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" cx="493" cy="1098" rx="10" ry="10" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="493" y="1117">GL4bcImpl</text>
+ <line stroke="black" stroke-opacity="1" x1="452" y1="1131" x2="534" y2="1131" />
+ <line stroke="black" stroke-opacity="1" x1="452" y1="1139" x2="534" y2="1139" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="755" y1="676" x2="775" y2="676" />
+ <ellipse fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" cx="765" cy="666" rx="10" ry="10" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="765" y="685">GLES3Impl</text>
+ <line stroke="black" stroke-opacity="1" x1="724" y1="699" x2="806" y2="699" />
+ <line stroke="black" stroke-opacity="1" x1="724" y1="707" x2="806" y2="707" />
+</g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="17" y="1113">Private implementation</text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="17" y="1132">(detail)</text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="851" y="224">Desktop/Mobile</text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="851" y="243">Common Interfaces</text>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="1158" y="174" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="1056" y="232" width="105" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="1052" y="170" width="106" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="1105" y="179"><<interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="1105" y="202">NativeWindow</text>
+ <line stroke="black" stroke-opacity="1" x1="1052" y1="216" x2="1158" y2="216" />
+ <line stroke="black" stroke-opacity="1" x1="1052" y1="224" x2="1158" y2="224" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="1216" y="265" width="3" height="37" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="998" y="299" width="221" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="994" y="261" width="222" height="38" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" font-style="italic" text-anchor="middle" x="1105" y="270">AbstractGraphicsConfiguration</text>
+ <line stroke="black" stroke-opacity="1" x1="994" y1="284" x2="1216" y2="284" />
+ <line stroke="black" stroke-opacity="1" x1="994" y1="292" x2="1216" y2="292" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="1159" y="448" width="3" height="37" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="1055" y="482" width="107" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="1051" y="444" width="108" height="38" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="1105" y="453">GLCapabilities</text>
+ <line stroke="black" stroke-opacity="1" x1="1051" y1="467" x2="1159" y2="467" />
+ <line stroke="black" stroke-opacity="1" x1="1051" y1="475" x2="1159" y2="475" />
+</g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="845" y="28">Lifecycle: From the lower right to</text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="845" y="47">the top, left step where the</text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="845" y="66">GLContext is created with a</text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="845" y="85">suitable GL implementation</text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="845" y="104">matching the GLProfile.</text>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="1141" y="552" width="3" height="37" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="1073" y="586" width="71" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="1069" y="548" width="72" height="38" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="1105" y="557">GLProfile</text>
+ <line stroke="black" stroke-opacity="1" x1="1069" y1="571" x2="1141" y2="571" />
+ <line stroke="black" stroke-opacity="1" x1="1069" y1="579" x2="1141" y2="579" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="258" y="11" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="168" y="69" width="93" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="164" y="7" width="94" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="211" y="16"><<interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="211" y="39">GLBase</text>
+ <line stroke="black" stroke-opacity="1" x1="164" y1="53" x2="258" y2="53" />
+ <line stroke="black" stroke-opacity="1" x1="164" y1="61" x2="258" y2="61" />
+</g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="271" y="153">Common GL</text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="271" y="172">Stuff</text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="851" y="419">Common Desktop</text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="851" y="438">Profile</text>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="887" y="317" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="783" y="375" width="107" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="779" y="313" width="108" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="833" y="322"><<@interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="833" y="345">GL4ES3</text>
+ <line stroke="black" stroke-opacity="1" x1="779" y1="359" x2="887" y2="359" />
+ <line stroke="black" stroke-opacity="1" x1="779" y1="367" x2="887" y2="367" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="282" y="989" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="192" y="1047" width="93" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="188" y="985" width="94" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="235" y="994"><<interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="235" y="1017">GL4bc</text>
+ <line stroke="black" stroke-opacity="1" x1="188" y1="1031" x2="282" y2="1031" />
+ <line stroke="black" stroke-opacity="1" x1="188" y1="1039" x2="282" y2="1039" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="153" y="496" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="63" y="554" width="93" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="59" y="492" width="94" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="106" y="501"><<interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="106" y="524">GLES1</text>
+ <line stroke="black" stroke-opacity="1" x1="59" y1="538" x2="153" y2="538" />
+ <line stroke="black" stroke-opacity="1" x1="59" y1="546" x2="153" y2="546" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="282" y="750" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="192" y="808" width="93" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="188" y="746" width="94" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="235" y="755"><<interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="235" y="778">GL2</text>
+ <line stroke="black" stroke-opacity="1" x1="188" y1="792" x2="282" y2="792" />
+ <line stroke="black" stroke-opacity="1" x1="188" y1="800" x2="282" y2="800" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="388" y="239" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="298" y="297" width="93" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="294" y="235" width="94" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="341" y="244"><<interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="341" y="267">GL2ES2</text>
+ <line stroke="black" stroke-opacity="1" x1="294" y1="281" x2="388" y2="281" />
+ <line stroke="black" stroke-opacity="1" x1="294" y1="289" x2="388" y2="289" />
+</g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="851" y="736">Desktop final public</text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="851" y="755">OpenGL Interfaces</text>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="709" y="860" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="619" y="918" width="93" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="615" y="856" width="94" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="662" y="865"><<interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="662" y="888">GL3</text>
+ <line stroke="black" stroke-opacity="1" x1="615" y1="902" x2="709" y2="902" />
+ <line stroke="black" stroke-opacity="1" x1="615" y1="910" x2="709" y2="910" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="388" y="493" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="298" y="551" width="93" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="294" y="489" width="94" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="341" y="498"><<interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="341" y="521">GLES2</text>
+ <line stroke="black" stroke-opacity="1" x1="294" y1="535" x2="388" y2="535" />
+ <line stroke="black" stroke-opacity="1" x1="294" y1="543" x2="388" y2="543" />
+</g>
+<g>
+ <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="460" y1="1087" x2="279" y2="925" />
+ <line stroke="black" stroke-opacity="1" x1="275" y1="922" x2="275" y2="930" />
+ <line stroke="black" stroke-opacity="1" x1="275" y1="922" x2="283" y2="921" />
+ <line stroke="black" stroke-opacity="1" x1="275" y1="930" x2="283" y2="921" />
+</g>
+<g>
+ <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="451" y1="1100" x2="291" y2="1038" />
+ <line stroke="black" stroke-opacity="1" x1="286" y1="1036" x2="289" y2="1043" />
+ <line stroke="black" stroke-opacity="1" x1="286" y1="1036" x2="293" y2="1032" />
+ <line stroke="black" stroke-opacity="1" x1="289" y1="1043" x2="293" y2="1032" />
+</g>
+<g>
+ <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="472" y1="1087" x2="265" y2="816" />
+ <line stroke="black" stroke-opacity="1" x1="262" y1="812" x2="260" y2="820" />
+ <line stroke="black" stroke-opacity="1" x1="262" y1="812" x2="270" y2="813" />
+ <line stroke="black" stroke-opacity="1" x1="260" y1="820" x2="270" y2="813" />
+</g>
+<g>
+ <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="534" y1="1104" x2="779" y2="1031" />
+ <line stroke="black" stroke-opacity="1" x1="785" y1="1030" x2="777" y2="1025" />
+ <line stroke="black" stroke-opacity="1" x1="785" y1="1030" x2="780" y2="1037" />
+ <line stroke="black" stroke-opacity="1" x1="777" y1="1025" x2="780" y2="1037" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="237" y1="855" x2="237" y2="818" />
+ <line stroke="black" stroke-opacity="1" x1="237" y1="812" x2="231" y2="818" />
+ <line stroke="black" stroke-opacity="1" x1="237" y1="812" x2="243" y2="818" />
+ <line stroke="black" stroke-opacity="1" x1="231" y1="818" x2="243" y2="818" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="286" y1="889" x2="608" y2="889" />
+ <line stroke="black" stroke-opacity="1" x1="614" y1="889" x2="608" y2="883" />
+ <line stroke="black" stroke-opacity="1" x1="614" y1="889" x2="608" y2="895" />
+ <line stroke="black" stroke-opacity="1" x1="608" y1="883" x2="608" y2="895" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="791" y1="984" x2="713" y2="925" />
+ <line stroke="black" stroke-opacity="1" x1="709" y1="922" x2="710" y2="930" />
+ <line stroke="black" stroke-opacity="1" x1="709" y1="922" x2="717" y2="920" />
+ <line stroke="black" stroke-opacity="1" x1="710" y1="930" x2="717" y2="920" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="237" y1="984" x2="237" y2="928" />
+ <line stroke="black" stroke-opacity="1" x1="237" y1="922" x2="231" y2="928" />
+ <line stroke="black" stroke-opacity="1" x1="237" y1="922" x2="243" y2="928" />
+ <line stroke="black" stroke-opacity="1" x1="231" y1="928" x2="243" y2="928" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="286" y1="1018" x2="779" y2="1018" />
+ <line stroke="black" stroke-opacity="1" x1="785" y1="1018" x2="779" y2="1012" />
+ <line stroke="black" stroke-opacity="1" x1="785" y1="1018" x2="779" y2="1024" />
+ <line stroke="black" stroke-opacity="1" x1="779" y1="1012" x2="779" y2="1024" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="443" y1="280" x2="397" y2="273" />
+ <line stroke="black" stroke-opacity="1" x1="392" y1="273" x2="397" y2="279" />
+ <line stroke="black" stroke-opacity="1" x1="392" y1="273" x2="398" y2="267" />
+ <line stroke="black" stroke-opacity="1" x1="397" y1="279" x2="398" y2="267" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="835" y1="984" x2="835" y2="385" />
+ <line stroke="black" stroke-opacity="1" x1="835" y1="379" x2="829" y2="385" />
+ <line stroke="black" stroke-opacity="1" x1="835" y1="379" x2="841" y2="385" />
+ <line stroke="black" stroke-opacity="1" x1="829" y1="385" x2="841" y2="385" />
+</g>
+<g>
+ <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="723" y1="668" x2="397" y2="542" />
+ <line stroke="black" stroke-opacity="1" x1="392" y1="540" x2="395" y2="547" />
+ <line stroke="black" stroke-opacity="1" x1="392" y1="540" x2="399" y2="536" />
+ <line stroke="black" stroke-opacity="1" x1="395" y1="547" x2="399" y2="536" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="817" y="573" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="713" y="631" width="107" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="709" y="569" width="108" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="763" y="578"><<@interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="763" y="601">GLES3</text>
+ <line stroke="black" stroke-opacity="1" x1="709" y1="615" x2="817" y2="615" />
+ <line stroke="black" stroke-opacity="1" x1="709" y1="623" x2="817" y2="623" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="98" y1="598" x2="118" y2="598" />
+ <ellipse fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" cx="108" cy="588" rx="10" ry="10" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="108" y="607">GLES1Impl</text>
+ <line stroke="black" stroke-opacity="1" x1="67" y1="621" x2="149" y2="621" />
+ <line stroke="black" stroke-opacity="1" x1="67" y1="629" x2="149" y2="629" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="1149" y="365" width="3" height="37" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="1065" y="399" width="87" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="1061" y="361" width="88" height="38" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="1105" y="370">Capabilities</text>
+ <line stroke="black" stroke-opacity="1" x1="1061" y1="384" x2="1149" y2="384" />
+ <line stroke="black" stroke-opacity="1" x1="1061" y1="392" x2="1149" y2="392" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="541" y="401" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="451" y="459" width="93" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="447" y="397" width="94" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="494" y="406"><<interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="494" y="429">GL2GL3</text>
+ <line stroke="black" stroke-opacity="1" x1="447" y1="443" x2="541" y2="443" />
+ <line stroke="black" stroke-opacity="1" x1="447" y1="451" x2="541" y2="451" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="773" y1="568" x2="823" y2="384" />
+ <line stroke="black" stroke-opacity="1" x1="825" y1="379" x2="817" y2="383" />
+ <line stroke="black" stroke-opacity="1" x1="825" y1="379" x2="829" y2="386" />
+ <line stroke="black" stroke-opacity="1" x1="817" y1="383" x2="829" y2="386" />
+</g>
+<g>
+ <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="765" y1="655" x2="765" y2="641" />
+ <line stroke="black" stroke-opacity="1" x1="765" y1="635" x2="759" y2="641" />
+ <line stroke="black" stroke-opacity="1" x1="765" y1="635" x2="771" y2="641" />
+ <line stroke="black" stroke-opacity="1" x1="759" y1="641" x2="771" y2="641" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="708" y1="591" x2="397" y2="531" />
+ <line stroke="black" stroke-opacity="1" x1="392" y1="530" x2="396" y2="537" />
+ <line stroke="black" stroke-opacity="1" x1="392" y1="530" x2="399" y2="525" />
+ <line stroke="black" stroke-opacity="1" x1="396" y1="537" x2="399" y2="525" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="496" y1="396" x2="496" y2="326" />
+ <line stroke="black" stroke-opacity="1" x1="496" y1="320" x2="490" y2="326" />
+ <line stroke="black" stroke-opacity="1" x1="496" y1="320" x2="502" y2="326" />
+ <line stroke="black" stroke-opacity="1" x1="490" y1="326" x2="502" y2="326" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="718" y="286" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="614" y="344" width="107" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="610" y="282" width="108" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="664" y="291"><<@interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="664" y="314">GL3ES3</text>
+ <line stroke="black" stroke-opacity="1" x1="610" y1="328" x2="718" y2="328" />
+ <line stroke="black" stroke-opacity="1" x1="610" y1="336" x2="718" y2="336" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="778" y1="335" x2="727" y2="326" />
+ <line stroke="black" stroke-opacity="1" x1="722" y1="325" x2="726" y2="331" />
+ <line stroke="black" stroke-opacity="1" x1="722" y1="325" x2="728" y2="320" />
+ <line stroke="black" stroke-opacity="1" x1="726" y1="331" x2="728" y2="320" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="609" y1="305" x2="553" y2="296" />
+ <line stroke="black" stroke-opacity="1" x1="548" y1="296" x2="553" y2="302" />
+ <line stroke="black" stroke-opacity="1" x1="548" y1="296" x2="554" y2="290" />
+ <line stroke="black" stroke-opacity="1" x1="553" y1="302" x2="554" y2="290" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="664" y1="855" x2="664" y2="353" />
+ <line stroke="black" stroke-opacity="1" x1="665" y1="348" x2="658" y2="353" />
+ <line stroke="black" stroke-opacity="1" x1="665" y1="348" x2="670" y2="354" />
+ <line stroke="black" stroke-opacity="1" x1="658" y1="353" x2="670" y2="354" />
+</g>
+<g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="533" y="68">0..1</text>
+</g>
+<g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="694" y="117">1</text>
+</g>
+<g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="1080" y="343">chosen</text>
+</g>
+<g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="1052" y="343">1</text>
+</g>
+<g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="1146" y="343">requested</text>
+</g>
+<g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="1118" y="343">1</text>
+</g>
+<g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="418" y="56">1</text>
+</g>
+<g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="272" y="56">1</text>
+</g>
+</svg>
diff --git a/doc/uml/html-svg/fig134786.svg b/doc/uml/html-svg/fig134786.svg
index 9b52bd1..ef7e7e5 100644
--- a/doc/uml/html-svg/fig134786.svg
+++ b/doc/uml/html-svg/fig134786.svg
@@ -1,349 +1,356 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Bouml (http://bouml.free.fr/) -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg width="1186" height="1053" version="1.1" xmlns="http://www.w3.org/2000/svg">
-<g>
- <rect fill="#c0ffff" stroke="black" stroke-width="1" stroke-opacity="1" x="10" y="206" width="939" height="835" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="78" y="224">Programmable Shader</text>
- <line stroke="black" stroke-opacity="1" x1="10" y1="229" x2="146" y2="229" />
- <line stroke="black" stroke-opacity="1" x1="146" y1="229" x2="158" y2="217" />
- <line stroke="black" stroke-opacity="1" x1="158" y1="217" x2="158" y2="206" />
-</g>
-<g>
- <line stroke="black" stroke-dasharray="20,4" stroke-opacity="1" x1="10" y1="649" x2="949" y2="649" />
-</g>
-<g>
- <line stroke="black" stroke-dasharray="20,4" stroke-opacity="1" x1="10" y1="486" x2="949" y2="486" />
-</g>
-<g>
- <line stroke="black" stroke-dasharray="20,4" stroke-opacity="1" x1="10" y1="399" x2="949" y2="399" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="189" y1="237" x2="189" y2="178" />
- <line stroke="black" stroke-opacity="1" x1="189" y1="172" x2="183" y2="178" />
- <line stroke="black" stroke-opacity="1" x1="189" y1="172" x2="195" y2="178" />
- <line stroke="black" stroke-opacity="1" x1="183" y1="178" x2="195" y2="178" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="189" y1="505" x2="189" y2="304" />
- <line stroke="black" stroke-opacity="1" x1="189" y1="298" x2="183" y2="304" />
- <line stroke="black" stroke-opacity="1" x1="189" y1="298" x2="195" y2="304" />
- <line stroke="black" stroke-opacity="1" x1="183" y1="304" x2="195" y2="304" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="490" y1="707" x2="359" y2="475" />
- <line stroke="black" stroke-opacity="1" x1="357" y1="470" x2="354" y2="478" />
- <line stroke="black" stroke-opacity="1" x1="357" y1="470" x2="365" y2="472" />
- <line stroke="black" stroke-opacity="1" x1="354" y1="478" x2="365" y2="472" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="685" y1="110" x2="498" y2="54" />
-</g>
-<g>
- <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="668" y1="965" x2="532" y2="772" />
- <line stroke="black" stroke-opacity="1" x1="529" y1="768" x2="527" y2="776" />
- <line stroke="black" stroke-opacity="1" x1="529" y1="768" x2="537" y2="769" />
- <line stroke="black" stroke-opacity="1" x1="527" y1="776" x2="537" y2="769" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="1071" y1="477" x2="1071" y2="441" />
- <line stroke="black" stroke-opacity="1" x1="1071" y1="435" x2="1065" y2="441" />
- <line stroke="black" stroke-opacity="1" x1="1071" y1="435" x2="1077" y2="441" />
- <line stroke="black" stroke-opacity="1" x1="1065" y1="441" x2="1077" y2="441" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="1038" y1="335" x2="1037" y2="394" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="1072" y1="294" x2="1072" y2="260" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="1020" y1="212" x2="772" y2="136" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="1071" y1="580" x2="1071" y2="518" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="1098" y1="394" x2="1098" y2="335" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="1071" y1="580" x2="1071" y2="518" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="189" y1="111" x2="189" y2="78" />
- <line stroke="black" stroke-opacity="1" x1="189" y1="72" x2="183" y2="78" />
- <line stroke="black" stroke-opacity="1" x1="189" y1="72" x2="195" y2="78" />
- <line stroke="black" stroke-opacity="1" x1="183" y1="78" x2="195" y2="78" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="235" y1="42" x2="421" y2="42" />
-</g>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="817" y="546">Mobile final public</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="817" y="562">OpenGL Interfaces</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="817" y="273">Desktop/Mobile</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="817" y="289">Common Interfaces</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="817" y="697">Desktop final public</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="817" y="713">OpenGL Interfaces</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="782" y="32">Lifecycle: From the lower right to</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="782" y="48">the top, left step where the</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="782" y="64">GLContext is created with a</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="782" y="80">suitable GL implementation</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="782" y="96">matching the GLProfile.</text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="271" y="151">Common GL Stuff</text>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="231" y="116" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="147" y="168" width="87" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="143" y="112" width="88" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="187" y="127"><<interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="187" y="147">GL</text>
- <line stroke="black" stroke-opacity="1" x1="143" y1="152" x2="231" y2="152" />
- <line stroke="black" stroke-opacity="1" x1="143" y1="160" x2="231" y2="160" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="730" y="855" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="646" y="907" width="87" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="642" y="851" width="88" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="686" y="866"><<interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="686" y="886">GL4</text>
- <line stroke="black" stroke-opacity="1" x1="642" y1="891" x2="730" y2="891" />
- <line stroke="black" stroke-opacity="1" x1="642" y1="899" x2="730" y2="899" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="231" y="242" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="147" y="294" width="87" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="143" y="238" width="88" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="187" y="253"><<interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="187" y="273">GL2ES2</text>
- <line stroke="black" stroke-opacity="1" x1="143" y1="278" x2="231" y2="278" />
- <line stroke="black" stroke-opacity="1" x1="143" y1="286" x2="231" y2="286" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="550" y="712" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="466" y="764" width="87" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="462" y="708" width="88" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="506" y="723"><<interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="506" y="743">GL3</text>
- <line stroke="black" stroke-opacity="1" x1="462" y1="748" x2="550" y2="748" />
- <line stroke="black" stroke-opacity="1" x1="462" y1="756" x2="550" y2="756" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="231" y="510" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="147" y="562" width="87" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="143" y="506" width="88" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="187" y="521"><<interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="187" y="541">GLES2</text>
- <line stroke="black" stroke-opacity="1" x1="143" y1="546" x2="231" y2="546" />
- <line stroke="black" stroke-opacity="1" x1="143" y1="554" x2="231" y2="554" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="737" y="320" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="639" y="372" width="101" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="635" y="316" width="102" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="686" y="331"><<@interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="686" y="351">GL4ES3</text>
- <line stroke="black" stroke-opacity="1" x1="635" y1="356" x2="737" y2="356" />
- <line stroke="black" stroke-opacity="1" x1="635" y1="364" x2="737" y2="364" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="494" y="27" width="3" height="35" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="426" y="59" width="71" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="422" y="23" width="72" height="36" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" font-style="italic" text-anchor="middle" x="458" y="38">GLContext</text>
- <line stroke="black" stroke-opacity="1" x1="422" y1="43" x2="494" y2="43" />
- <line stroke="black" stroke-opacity="1" x1="422" y1="51" x2="494" y2="51" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="768" y="109" width="3" height="35" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="690" y="141" width="81" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="686" y="105" width="82" height="36" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" font-style="italic" text-anchor="middle" x="727" y="120">GLDrawable</text>
- <line stroke="black" stroke-opacity="1" x1="686" y1="125" x2="768" y2="125" />
- <line stroke="black" stroke-opacity="1" x1="686" y1="133" x2="768" y2="133" />
-</g>
-<g>
- <rect fill="none" stroke="black" stroke-width="1" stroke-opacity="1" x="292" y="261" width="100" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="342" y="276"><<metaclass>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" font-style="italic" text-anchor="middle" x="342" y="296">GL2ES3</text>
- <line stroke="black" stroke-opacity="1" x1="292" y1="301" x2="392" y2="301" />
- <line stroke="black" stroke-opacity="1" x1="292" y1="309" x2="392" y2="309" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="680" y1="986" x2="700" y2="986" />
- <ellipse fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" cx="690" cy="976" rx="10" ry="10" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="690" y="1001">GL4bcImpl</text>
- <line stroke="black" stroke-opacity="1" x1="652" y1="1006" x2="728" y2="1006" />
- <line stroke="black" stroke-opacity="1" x1="652" y1="1014" x2="728" y2="1014" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="581" y1="606" x2="601" y2="606" />
- <ellipse fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" cx="591" cy="596" rx="10" ry="10" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="591" y="621">GLES3Impl</text>
- <line stroke="black" stroke-opacity="1" x1="552" y1="626" x2="630" y2="626" />
- <line stroke="black" stroke-opacity="1" x1="552" y1="634" x2="630" y2="634" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="1121" y="204" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="1025" y="256" width="99" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="1021" y="200" width="100" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="1071" y="215"><<interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="1071" y="235">NativeWindow</text>
- <line stroke="black" stroke-opacity="1" x1="1021" y1="240" x2="1121" y2="240" />
- <line stroke="black" stroke-opacity="1" x1="1021" y1="248" x2="1121" y2="248" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="1170" y="299" width="3" height="35" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="976" y="331" width="197" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="972" y="295" width="198" height="36" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" font-style="italic" text-anchor="middle" x="1071" y="310">AbstractGraphicsConfiguration</text>
- <line stroke="black" stroke-opacity="1" x1="972" y1="315" x2="1170" y2="315" />
- <line stroke="black" stroke-opacity="1" x1="972" y1="323" x2="1170" y2="323" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="1119" y="482" width="3" height="35" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="1023" y="514" width="99" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="1019" y="478" width="100" height="36" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="1069" y="493">GLCapabilities</text>
- <line stroke="black" stroke-opacity="1" x1="1019" y1="498" x2="1119" y2="498" />
- <line stroke="black" stroke-opacity="1" x1="1019" y1="506" x2="1119" y2="506" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="1104" y="585" width="3" height="35" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="1040" y="617" width="67" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="1036" y="581" width="68" height="36" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="1070" y="596">GLProfile</text>
- <line stroke="black" stroke-opacity="1" x1="1036" y1="601" x2="1104" y2="601" />
- <line stroke="black" stroke-opacity="1" x1="1036" y1="609" x2="1104" y2="609" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="231" y="16" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="147" y="68" width="87" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="143" y="12" width="88" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="187" y="27"><<interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="187" y="47">GLBase</text>
- <line stroke="black" stroke-opacity="1" x1="143" y1="52" x2="231" y2="52" />
- <line stroke="black" stroke-opacity="1" x1="143" y1="60" x2="231" y2="60" />
-</g>
-<g>
- <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="688" y1="965" x2="688" y2="917" />
- <line stroke="black" stroke-opacity="1" x1="688" y1="911" x2="682" y2="917" />
- <line stroke="black" stroke-opacity="1" x1="688" y1="911" x2="694" y2="917" />
- <line stroke="black" stroke-opacity="1" x1="682" y1="917" x2="694" y2="917" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="650" y1="850" x2="550" y2="771" />
- <line stroke="black" stroke-opacity="1" x1="546" y1="768" x2="546" y2="776" />
- <line stroke="black" stroke-opacity="1" x1="546" y1="768" x2="554" y2="767" />
- <line stroke="black" stroke-opacity="1" x1="546" y1="776" x2="554" y2="767" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="291" y1="280" x2="240" y2="273" />
- <line stroke="black" stroke-opacity="1" x1="235" y1="273" x2="240" y2="279" />
- <line stroke="black" stroke-opacity="1" x1="235" y1="273" x2="241" y2="267" />
- <line stroke="black" stroke-opacity="1" x1="240" y1="279" x2="241" y2="267" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="688" y1="850" x2="688" y2="382" />
- <line stroke="black" stroke-opacity="1" x1="688" y1="376" x2="682" y2="382" />
- <line stroke="black" stroke-opacity="1" x1="688" y1="376" x2="694" y2="382" />
- <line stroke="black" stroke-opacity="1" x1="682" y1="382" x2="694" y2="382" />
-</g>
-<g>
- <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="551" y1="605" x2="240" y2="545" />
- <line stroke="black" stroke-opacity="1" x1="235" y1="544" x2="239" y2="551" />
- <line stroke="black" stroke-opacity="1" x1="235" y1="544" x2="242" y2="539" />
- <line stroke="black" stroke-opacity="1" x1="239" y1="551" x2="242" y2="539" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="639" y="512" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="541" y="564" width="101" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="537" y="508" width="102" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="588" y="523"><<@interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="588" y="543">GLES3</text>
- <line stroke="black" stroke-opacity="1" x1="537" y1="548" x2="639" y2="548" />
- <line stroke="black" stroke-opacity="1" x1="537" y1="556" x2="639" y2="556" />
-</g>
-<g>
- <rect fill="none" stroke="black" stroke-width="1" stroke-opacity="1" x="298" y="414" width="88" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="342" y="429"><<interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="342" y="449">GL2GL3</text>
- <line stroke="black" stroke-opacity="1" x1="298" y1="454" x2="386" y2="454" />
- <line stroke="black" stroke-opacity="1" x1="298" y1="462" x2="386" y2="462" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="605" y1="507" x2="668" y2="381" />
- <line stroke="black" stroke-opacity="1" x1="671" y1="376" x2="662" y2="378" />
- <line stroke="black" stroke-opacity="1" x1="671" y1="376" x2="673" y2="384" />
- <line stroke="black" stroke-opacity="1" x1="662" y1="378" x2="673" y2="384" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="1110" y="399" width="3" height="35" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="1032" y="431" width="81" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="1028" y="395" width="82" height="36" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="1069" y="410">Capabilities</text>
- <line stroke="black" stroke-opacity="1" x1="1028" y1="415" x2="1110" y2="415" />
- <line stroke="black" stroke-opacity="1" x1="1028" y1="423" x2="1110" y2="423" />
-</g>
-<g>
- <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="590" y1="585" x2="590" y2="574" />
- <line stroke="black" stroke-opacity="1" x1="590" y1="568" x2="584" y2="574" />
- <line stroke="black" stroke-opacity="1" x1="590" y1="568" x2="596" y2="574" />
- <line stroke="black" stroke-opacity="1" x1="584" y1="574" x2="596" y2="574" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="342" y1="413" x2="342" y2="323" />
- <line stroke="black" stroke-opacity="1" x1="342" y1="317" x2="336" y2="323" />
- <line stroke="black" stroke-opacity="1" x1="342" y1="317" x2="348" y2="323" />
- <line stroke="black" stroke-opacity="1" x1="336" y1="323" x2="348" y2="323" />
-</g>
-<g>
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="558" y="288" width="3" height="55" />
- <rect fill="#808080" stroke="none" stroke-opacity="1" x="460" y="340" width="101" height="3" />
- <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="456" y="284" width="102" height="56" />
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" text-anchor="middle" x="507" y="299"><<@interface>></text>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="507" y="319">GL3ES3</text>
- <line stroke="black" stroke-opacity="1" x1="456" y1="324" x2="558" y2="324" />
- <line stroke="black" stroke-opacity="1" x1="456" y1="332" x2="558" y2="332" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="634" y1="336" x2="567" y2="323" />
- <line stroke="black" stroke-opacity="1" x1="562" y1="322" x2="566" y2="329" />
- <line stroke="black" stroke-opacity="1" x1="562" y1="322" x2="569" y2="317" />
- <line stroke="black" stroke-opacity="1" x1="566" y1="329" x2="569" y2="317" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="455" y1="304" x2="397" y2="295" />
- <line stroke="black" stroke-opacity="1" x1="392" y1="295" x2="397" y2="301" />
- <line stroke="black" stroke-opacity="1" x1="392" y1="295" x2="398" y2="289" />
- <line stroke="black" stroke-opacity="1" x1="397" y1="301" x2="398" y2="289" />
-</g>
-<g>
- <line stroke="black" stroke-opacity="1" x1="508" y1="707" x2="508" y2="350" />
- <line stroke="black" stroke-opacity="1" x1="508" y1="344" x2="502" y2="350" />
- <line stroke="black" stroke-opacity="1" x1="508" y1="344" x2="514" y2="350" />
- <line stroke="black" stroke-opacity="1" x1="502" y1="350" x2="514" y2="350" />
-</g>
-<g>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="514" y="80">0..1</text>
-</g>
-<g>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="660" y="135">1</text>
-</g>
-<g>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="1043" y="386">chosen</text>
-</g>
-<g>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="1015" y="386">1</text>
-</g>
-<g>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="1115" y="386">requested</text>
-</g>
-<g>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="1080" y="386">1</text>
-</g>
-<g>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="397" y="64">1</text>
-</g>
-<g>
- <text font-family="Helvetica" font-size="12" fill="#000000" xml:space="preserve" x="248" y="64">1</text>
-</g>
-</svg>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Bouml (http://bouml.free.fr/) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="1220" height="1060" version="1.1" xmlns="http://www.w3.org/2000/svg">
+<g>
+ <rect fill="#c0ffff" stroke="black" stroke-width="1" stroke-opacity="1" x="9" y="206" width="939" height="835" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="85" y="223">Programmable Shader</text>
+ <line stroke="black" stroke-opacity="1" x1="9" y1="232" x2="161" y2="232" />
+ <line stroke="black" stroke-opacity="1" x1="161" y1="232" x2="174" y2="219" />
+ <line stroke="black" stroke-opacity="1" x1="174" y1="219" x2="174" y2="206" />
+</g>
+<g>
+ <line stroke="black" stroke-dasharray="20,4" stroke-opacity="1" x1="9" y1="740" x2="948" y2="740" />
+</g>
+<g>
+ <line stroke="black" stroke-dasharray="20,4" stroke-opacity="1" x1="9" y1="486" x2="948" y2="486" />
+</g>
+<g>
+ <line stroke="black" stroke-dasharray="20,4" stroke-opacity="1" x1="9" y1="404" x2="948" y2="404" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="211" y1="245" x2="211" y2="192" />
+ <line stroke="black" stroke-opacity="1" x1="211" y1="186" x2="205" y2="192" />
+ <line stroke="black" stroke-opacity="1" x1="211" y1="186" x2="217" y2="192" />
+ <line stroke="black" stroke-opacity="1" x1="205" y1="192" x2="217" y2="192" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="211" y1="499" x2="211" y2="318" />
+ <line stroke="black" stroke-opacity="1" x1="211" y1="312" x2="205" y2="318" />
+ <line stroke="black" stroke-opacity="1" x1="211" y1="312" x2="217" y2="318" />
+ <line stroke="black" stroke-opacity="1" x1="205" y1="318" x2="217" y2="318" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="514" y1="773" x2="379" y2="480" />
+ <line stroke="black" stroke-opacity="1" x1="377" y1="475" x2="374" y2="482" />
+ <line stroke="black" stroke-opacity="1" x1="377" y1="475" x2="384" y2="477" />
+ <line stroke="black" stroke-opacity="1" x1="374" y1="482" x2="384" y2="477" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="702" y1="114" x2="522" y2="60" />
+</g>
+<g>
+ <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="687" y1="989" x2="562" y2="844" />
+ <line stroke="black" stroke-opacity="1" x1="559" y1="840" x2="558" y2="848" />
+ <line stroke="black" stroke-opacity="1" x1="559" y1="840" x2="567" y2="840" />
+ <line stroke="black" stroke-opacity="1" x1="558" y1="848" x2="567" y2="840" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="1095" y1="481" x2="1095" y2="447" />
+ <line stroke="black" stroke-opacity="1" x1="1095" y1="441" x2="1089" y2="447" />
+ <line stroke="black" stroke-opacity="1" x1="1095" y1="441" x2="1101" y2="447" />
+ <line stroke="black" stroke-opacity="1" x1="1089" y1="447" x2="1101" y2="447" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="1056" y1="341" x2="1058" y2="398" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="1093" y1="298" x2="1093" y2="274" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="1039" y1="222" x2="797" y2="144" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="1095" y1="584" x2="1095" y2="524" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="1124" y1="398" x2="1123" y2="341" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="1095" y1="584" x2="1095" y2="524" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="211" y1="119" x2="211" y2="87" />
+ <line stroke="black" stroke-opacity="1" x1="211" y1="81" x2="205" y2="87" />
+ <line stroke="black" stroke-opacity="1" x1="211" y1="81" x2="217" y2="87" />
+ <line stroke="black" stroke-opacity="1" x1="205" y1="87" x2="217" y2="87" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="260" y1="48" x2="435" y2="48" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="256" y="124" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="166" y="182" width="93" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="162" y="120" width="94" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="209" y="129"><<interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="209" y="152">GL</text>
+ <line stroke="black" stroke-opacity="1" x1="162" y1="166" x2="256" y2="166" />
+ <line stroke="black" stroke-opacity="1" x1="162" y1="174" x2="256" y2="174" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="758" y="883" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="668" y="941" width="93" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="664" y="879" width="94" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="711" y="888"><<interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="711" y="911">GL4</text>
+ <line stroke="black" stroke-opacity="1" x1="664" y1="925" x2="758" y2="925" />
+ <line stroke="black" stroke-opacity="1" x1="664" y1="933" x2="758" y2="933" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="256" y="250" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="166" y="308" width="93" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="162" y="246" width="94" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="209" y="255"><<interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="209" y="278">GL2ES2</text>
+ <line stroke="black" stroke-opacity="1" x1="162" y1="292" x2="256" y2="292" />
+ <line stroke="black" stroke-opacity="1" x1="162" y1="300" x2="256" y2="300" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="575" y="778" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="485" y="836" width="93" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="481" y="774" width="94" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="528" y="783"><<interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="528" y="806">GL3</text>
+ <line stroke="black" stroke-opacity="1" x1="481" y1="820" x2="575" y2="820" />
+ <line stroke="black" stroke-opacity="1" x1="481" y1="828" x2="575" y2="828" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="256" y="504" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="166" y="562" width="93" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="162" y="500" width="94" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="209" y="509"><<interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="209" y="532">GLES2</text>
+ <line stroke="black" stroke-opacity="1" x1="162" y1="546" x2="256" y2="546" />
+ <line stroke="black" stroke-opacity="1" x1="162" y1="554" x2="256" y2="554" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="765" y="328" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="661" y="386" width="107" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="657" y="324" width="108" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="711" y="333"><<@interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="711" y="356">GL4ES3</text>
+ <line stroke="black" stroke-opacity="1" x1="657" y1="370" x2="765" y2="370" />
+ <line stroke="black" stroke-opacity="1" x1="657" y1="378" x2="765" y2="378" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="518" y="31" width="3" height="37" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="440" y="65" width="81" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="436" y="27" width="82" height="38" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" font-style="italic" text-anchor="middle" x="477" y="36">GLContext</text>
+ <line stroke="black" stroke-opacity="1" x1="436" y1="50" x2="518" y2="50" />
+ <line stroke="black" stroke-opacity="1" x1="436" y1="58" x2="518" y2="58" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="793" y="113" width="3" height="37" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="707" y="147" width="89" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="703" y="109" width="90" height="38" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" font-style="italic" text-anchor="middle" x="748" y="118">GLDrawable</text>
+ <line stroke="black" stroke-opacity="1" x1="703" y1="132" x2="793" y2="132" />
+ <line stroke="black" stroke-opacity="1" x1="703" y1="140" x2="793" y2="140" />
+</g>
+<g>
+ <rect fill="none" stroke="black" stroke-width="1" stroke-opacity="1" x="312" y="269" width="104" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="364" y="278"><<metaclass>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" font-style="italic" text-anchor="middle" x="364" y="301">GL2ES3</text>
+ <line stroke="black" stroke-opacity="1" x1="312" y1="315" x2="416" y2="315" />
+ <line stroke="black" stroke-opacity="1" x1="312" y1="323" x2="416" y2="323" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="703" y1="1010" x2="723" y2="1010" />
+ <ellipse fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" cx="713" cy="1000" rx="10" ry="10" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="713" y="1019">GL4bcImpl</text>
+ <line stroke="black" stroke-opacity="1" x1="672" y1="1033" x2="754" y2="1033" />
+ <line stroke="black" stroke-opacity="1" x1="672" y1="1041" x2="754" y2="1041" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="627" y1="709" x2="647" y2="709" />
+ <ellipse fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" cx="637" cy="699" rx="10" ry="10" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="637" y="718">GLES3Impl</text>
+ <line stroke="black" stroke-opacity="1" x1="596" y1="732" x2="678" y2="732" />
+ <line stroke="black" stroke-opacity="1" x1="596" y1="740" x2="678" y2="740" />
+</g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="817" y="514">Mobile final public</text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="817" y="533">OpenGL Interfaces</text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="817" y="233">Desktop/Mobile</text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="817" y="252">Common Interfaces</text>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="1146" y="212" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="1044" y="270" width="105" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="1040" y="208" width="106" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="1093" y="217"><<interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="1093" y="240">NativeWindow</text>
+ <line stroke="black" stroke-opacity="1" x1="1040" y1="254" x2="1146" y2="254" />
+ <line stroke="black" stroke-opacity="1" x1="1040" y1="262" x2="1146" y2="262" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="1204" y="303" width="3" height="37" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="986" y="337" width="221" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="982" y="299" width="222" height="38" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" font-style="italic" text-anchor="middle" x="1093" y="308">AbstractGraphicsConfiguration</text>
+ <line stroke="black" stroke-opacity="1" x1="982" y1="322" x2="1204" y2="322" />
+ <line stroke="black" stroke-opacity="1" x1="982" y1="330" x2="1204" y2="330" />
+</g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="817" y="767">Desktop final public</text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="817" y="786">OpenGL Interfaces</text>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="1147" y="486" width="3" height="37" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="1043" y="520" width="107" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="1039" y="482" width="108" height="38" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="1093" y="491">GLCapabilities</text>
+ <line stroke="black" stroke-opacity="1" x1="1039" y1="505" x2="1147" y2="505" />
+ <line stroke="black" stroke-opacity="1" x1="1039" y1="513" x2="1147" y2="513" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="1129" y="589" width="3" height="37" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="1061" y="623" width="71" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="1057" y="585" width="72" height="38" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="1093" y="594">GLProfile</text>
+ <line stroke="black" stroke-opacity="1" x1="1057" y1="608" x2="1129" y2="608" />
+ <line stroke="black" stroke-opacity="1" x1="1057" y1="616" x2="1129" y2="616" />
+</g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="853" y="34">Lifecycle: From the lower right to</text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="853" y="53">the top, left step where the</text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="853" y="72">GLContext is created with a</text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="853" y="91">suitable GL implementation</text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="853" y="110">matching the GLProfile.</text>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="256" y="19" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="166" y="77" width="93" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="162" y="15" width="94" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="209" y="24"><<interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="209" y="47">GLBase</text>
+ <line stroke="black" stroke-opacity="1" x1="162" y1="61" x2="256" y2="61" />
+ <line stroke="black" stroke-opacity="1" x1="162" y1="69" x2="256" y2="69" />
+</g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="271" y="153">Common GL</text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="271" y="172">Stuff</text>
+<g>
+ <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="711" y1="989" x2="711" y2="950" />
+ <line stroke="black" stroke-opacity="1" x1="712" y1="945" x2="705" y2="950" />
+ <line stroke="black" stroke-opacity="1" x1="712" y1="945" x2="717" y2="951" />
+ <line stroke="black" stroke-opacity="1" x1="705" y1="950" x2="717" y2="951" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="663" y1="882" x2="584" y2="836" />
+ <line stroke="black" stroke-opacity="1" x1="579" y1="834" x2="581" y2="842" />
+ <line stroke="black" stroke-opacity="1" x1="579" y1="834" x2="587" y2="831" />
+ <line stroke="black" stroke-opacity="1" x1="581" y1="842" x2="587" y2="831" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="311" y1="291" x2="265" y2="284" />
+ <line stroke="black" stroke-opacity="1" x1="260" y1="284" x2="265" y2="290" />
+ <line stroke="black" stroke-opacity="1" x1="260" y1="284" x2="266" y2="278" />
+ <line stroke="black" stroke-opacity="1" x1="265" y1="290" x2="266" y2="278" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="713" y1="878" x2="713" y2="396" />
+ <line stroke="black" stroke-opacity="1" x1="713" y1="390" x2="707" y2="396" />
+ <line stroke="black" stroke-opacity="1" x1="713" y1="390" x2="719" y2="396" />
+ <line stroke="black" stroke-opacity="1" x1="707" y1="396" x2="719" y2="396" />
+</g>
+<g>
+ <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="595" y1="699" x2="265" y2="555" />
+ <line stroke="black" stroke-opacity="1" x1="260" y1="553" x2="263" y2="560" />
+ <line stroke="black" stroke-opacity="1" x1="260" y1="553" x2="267" y2="549" />
+ <line stroke="black" stroke-opacity="1" x1="263" y1="560" x2="267" y2="549" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="689" y="590" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="585" y="648" width="107" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="581" y="586" width="108" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="635" y="595"><<@interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="635" y="618">GLES3</text>
+ <line stroke="black" stroke-opacity="1" x1="581" y1="632" x2="689" y2="632" />
+ <line stroke="black" stroke-opacity="1" x1="581" y1="640" x2="689" y2="640" />
+</g>
+<g>
+ <rect fill="none" stroke="black" stroke-width="1" stroke-opacity="1" x="317" y="413" width="94" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="364" y="422"><<interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="364" y="445">GL2GL3</text>
+ <line stroke="black" stroke-opacity="1" x1="317" y1="459" x2="411" y2="459" />
+ <line stroke="black" stroke-opacity="1" x1="317" y1="467" x2="411" y2="467" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="1137" y="403" width="3" height="37" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="1053" y="437" width="87" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="1049" y="399" width="88" height="38" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="1093" y="408">Capabilities</text>
+ <line stroke="black" stroke-opacity="1" x1="1049" y1="422" x2="1137" y2="422" />
+ <line stroke="black" stroke-opacity="1" x1="1049" y1="430" x2="1137" y2="430" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="646" y1="585" x2="700" y2="395" />
+ <line stroke="black" stroke-opacity="1" x1="702" y1="390" x2="694" y2="394" />
+ <line stroke="black" stroke-opacity="1" x1="702" y1="390" x2="706" y2="397" />
+ <line stroke="black" stroke-opacity="1" x1="694" y1="394" x2="706" y2="397" />
+</g>
+<g>
+ <line stroke-dasharray="4,4" stroke="black" stroke-opacity="1" x1="637" y1="688" x2="637" y2="658" />
+ <line stroke="black" stroke-opacity="1" x1="637" y1="652" x2="631" y2="658" />
+ <line stroke="black" stroke-opacity="1" x1="637" y1="652" x2="643" y2="658" />
+ <line stroke="black" stroke-opacity="1" x1="631" y1="658" x2="643" y2="658" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="580" y1="607" x2="265" y2="543" />
+ <line stroke="black" stroke-opacity="1" x1="260" y1="542" x2="264" y2="549" />
+ <line stroke="black" stroke-opacity="1" x1="260" y1="542" x2="267" y2="537" />
+ <line stroke="black" stroke-opacity="1" x1="264" y1="549" x2="267" y2="537" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="364" y1="412" x2="364" y2="337" />
+ <line stroke="black" stroke-opacity="1" x1="364" y1="331" x2="358" y2="337" />
+ <line stroke="black" stroke-opacity="1" x1="364" y1="331" x2="370" y2="337" />
+ <line stroke="black" stroke-opacity="1" x1="358" y1="337" x2="370" y2="337" />
+</g>
+<g>
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="586" y="296" width="3" height="61" />
+ <rect fill="#808080" stroke="none" stroke-opacity="1" x="482" y="354" width="107" height="3" />
+ <rect fill="#ffffc0" stroke="black" stroke-width="1" stroke-opacity="1" x="478" y="292" width="108" height="62" />
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" text-anchor="middle" x="532" y="301"><<@interface>></text>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" font-weight="bold" text-anchor="middle" x="532" y="324">GL3ES3</text>
+ <line stroke="black" stroke-opacity="1" x1="478" y1="338" x2="586" y2="338" />
+ <line stroke="black" stroke-opacity="1" x1="478" y1="346" x2="586" y2="346" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="656" y1="347" x2="595" y2="335" />
+ <line stroke="black" stroke-opacity="1" x1="590" y1="334" x2="594" y2="341" />
+ <line stroke="black" stroke-opacity="1" x1="590" y1="334" x2="597" y2="329" />
+ <line stroke="black" stroke-opacity="1" x1="594" y1="341" x2="597" y2="329" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="477" y1="315" x2="421" y2="306" />
+ <line stroke="black" stroke-opacity="1" x1="416" y1="306" x2="421" y2="312" />
+ <line stroke="black" stroke-opacity="1" x1="416" y1="306" x2="422" y2="300" />
+ <line stroke="black" stroke-opacity="1" x1="421" y1="312" x2="422" y2="300" />
+</g>
+<g>
+ <line stroke="black" stroke-opacity="1" x1="530" y1="773" x2="532" y2="363" />
+ <line stroke="black" stroke-opacity="1" x1="533" y1="358" x2="526" y2="363" />
+ <line stroke="black" stroke-opacity="1" x1="533" y1="358" x2="538" y2="364" />
+ <line stroke="black" stroke-opacity="1" x1="526" y1="363" x2="538" y2="364" />
+</g>
+<g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="532" y="79">0..1</text>
+</g>
+<g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="684" y="133">1</text>
+</g>
+<g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="1068" y="381">chosen</text>
+</g>
+<g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="1040" y="381">1</text>
+</g>
+<g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="1134" y="381">requested</text>
+</g>
+<g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="1106" y="381">1</text>
+</g>
+<g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="417" y="64">1</text>
+</g>
+<g>
+ <text font-family="Helvetica" font-size="7" fill="#000000" xml:space="preserve" x="270" y="64">1</text>
+</g>
+</svg>
diff --git a/doc/uml/html-svg/index-withframe.html b/doc/uml/html-svg/index-withframe.html
index 5d39089..a1a0a52 100644
--- a/doc/uml/html-svg/index-withframe.html
+++ b/doc/uml/html-svg/index-withframe.html
@@ -1,24 +1,19 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
<head>
-<title>C:/projects/JOGAMP/jogl/doc/uml/html-svg/index-withframe</title>
+<title>/usr/local/projects/JOGL/jogl/doc/uml/html-svg/index-withframe</title>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
-<frameset cols="20%,80%">
- <noframes>
- <body>
- <h2>Frame Alert</h2>
- <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.</p>
- <p>Link to <a href="index.html">Non-frame version.</a></p>
- </body>
- </noframes>
- <frame src="classes_list.html" name="classesListFrame" />
- <frameset rows="150,*">
- <frame src="navig.html" name="navigFrame" />
- <frame src="index.html" name="projectFrame" />
- </frameset>
-</frameset>
-</html>
\ No newline at end of file
+<FRAMESET cols="20%,80%">
+ <FRAME src="classes_list.html" name="classesListFrame">
+ <FRAMESET rows="150,*">
+ <FRAME src="navig.html" name="navigFrame">
+ <FRAME src="index.html" name="projectFrame">
+ </FRAMESET>
+</FRAMESET>
+<NOFRAMES>
+<H2>Frame Alert</H2><P>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.<BR>Link to <A HREF="index.html">Non-frame version.</A></NOFRAMES></body>
+</html>
diff --git a/doc/uml/html-svg/index.html b/doc/uml/html-svg/index.html
index 9338bd2..2cb031b 100644
--- a/doc/uml/html-svg/index.html
+++ b/doc/uml/html-svg/index.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
@@ -16,46 +16,262 @@ Documentation</title>
<!-- ============================================================= -->
-<a name="ref22_129"></a>
-<p>Properties:</p><ul>
-<li>html dir:<br /><div class="sub">C:/projects/JOGAMP/jogl/doc/uml/html-svg/</div></li>
-</ul>
-<a name="ref18_128069"></a>
+<a name="refpackage129"></a>
+<p>Properties:<ul>
+<li>html dir:<br /><div class="sub">/usr/local/projects/JOGL/jogl/doc/uml/html-svg/</div></p></li>
+</ul></p>
+<a name="refclass view128069"></a>
<h1 class ="view">1 Class View javax.media.opengl</h1>
<div class="sub">
-<a name="ref10_128069"></a>
-<p align="center"><embed src="fig128069.svg" width="1186" height="1178"/></p>
+<a name="refclass diagram128069"></a>
+<p align="center"><embed src="fig128069.svg" width="1232" height="1178"/></p>
<p align="center"><b>OpenGL Interfaces - All</b></p><p><br /></p><p><br /></p>
-<a name="ref10_134786"></a>
-<p align="center"><embed src="fig134786.svg" width="1186" height="1053"/></p>
+<a name="refclass diagram134786"></a>
+<p align="center"><embed src="fig134786.svg" width="1220" height="1060"/></p>
<p align="center"><b>OpenGL Interfaces - Core Only</b></p><p><br /></p><p><br /></p>
-<table><tr><td><div class="element">Class <b><a href="class128069.html#refclass128069"><b>GL</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class128197.html#refclass128197"><b>GL2ES1</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class128325.html#refclass128325"><b>GLES1</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class128453.html#refclass128453"><b>GL2</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class128581.html#refclass128581"><b>GL2ES2</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class128709.html#refclass128709"><b>GL2GL3</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class128837.html#refclass128837"><b>GL3</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class128965.html#refclass128965"><b>GLES2</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class130117.html#refclass130117"><b>GLContext</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class130245.html#refclass130245"><b>GLDrawable</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class130501.html#refclass130501"><b>GL4bcImpl</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class130629.html#refclass130629"><b>GLES3Impl</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class130757.html#refclass130757"><b>GLES1Impl</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class130885.html#refclass130885"><b>NativeWindow</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class131013.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class131141.html#refclass131141"><b>GLCapabilities</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class131269.html#refclass131269"><b>Capabilities</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class131397.html#refclass131397"><b>GLProfile</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class132549.html#refclass132549"><b>GLBase</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class128002.html#refclass128002"><b>GL3bc</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class128130.html#refclass128130"><b>GL4</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class128258.html#refclass128258"><b>GL4bc</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class128386.html#refclass128386"><b>GL2ES12</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class134914.html#refclass134914"><b>GLES3</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class135042.html#refclass135042"><b>GL4ES3</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Class <b><a href="class135170.html#refclass135170"><b>GL3ES3</b></a></b></div></td></tr></table>
-<table><tr><td><div class="element">Metaclass <b><a href="metaclass135298.html#refmetaclass135298"><b>GL2ES3</b></a></b></div></td></tr></table>
+<a name="refclass128069"></a>
+<h2 class ="class">1.1 Class GL</h2>
+<p>Declaration :</p><ul>
+<li>Java : public interface GL extends <a href="index.html#refclass132549"><b>GLBase</b></a> </li><li>Php : public interface GL </li></ul><p>Directly inherited by : <a href="index.html#refclass128197"><b>GL2ES1</b></a> <a href="index.html#refclass128581"><b>GL2ES2</b></a> </p>
+<p>Stereotype: interface</p>
+<div class="sub">
+<div class="sub">
+</div>
+</div>
+<a name="refclass128197"></a>
+<h2 class ="class">1.2 Class GL2ES1</h2>
+<p>Declaration :</p><ul>
+<li>Java : public interface GL2ES1 extends <a href="index.html#refclass128069"><b>GL</b></a> </li><li>Php : public interface GL2ES1 </li></ul><p>Directly inherited by : <a href="index.html#refclass128453"><b>GL2</b></a> <a href="index.html#refclass128386"><b>GL2ES12</b></a> <a href="index.html#refclass128325"><b>GLES1</b></a> </p>
+<p>Stereotype: interface</p>
+<div class="sub">
+<div class="sub">
+</div>
+</div>
+<a name="refclass128325"></a>
+<h2 class ="class">1.3 Class GLES1</h2>
+<p>Declaration :</p><ul>
+<li>Java : public interface GLES1 extends <a href="index.html#refclass128197"><b>GL2ES1</b></a> </li><li>Php : public interface GLES1 </li></ul><p>Directly inherited by : <a href="index.html#refclass130757"><b>GLES1Impl</b></a> </p>
+<p>Stereotype: interface</p>
+<div class="sub">
+<div class="sub">
+</div>
+</div>
+<a name="refclass128453"></a>
+<h2 class ="class">1.4 Class GL2</h2>
+<p>Declaration :</p><ul>
+<li>Java : public interface GL2 extends <a href="index.html#refclass128709"><b>GL2GL3</b></a> </li><li>Php : public interface GL2 </li></ul><p>Directly inherited by : <a href="index.html#refclass128002"><b>GL3bc</b></a> <a href="index.html#refclass130501"><b>GL4bcImpl</b></a> </p>
+<p>Stereotype: interface</p>
+<div class="sub">
+<div class="sub">
+</div>
+</div>
+<a name="refclass128581"></a>
+<h2 class ="class">1.5 Class GL2ES2</h2>
+<p>Declaration :</p><ul>
+<li>Java : public interface GL2ES2 extends <a href="index.html#refclass128069"><b>GL</b></a> </li><li>Php : public interface GL2ES2 </li></ul><p>Directly inherited by : <a href="index.html#refclass128386"><b>GL2ES12</b></a> <a href="index.html#refmetaclass135298"><b>GL2ES3</b></a> <a href="index.html#refclass128709"><b>GL2GL3</b></a> <a href="index.html#refclass128965"><b>GLES2</b></a> </p>
+<p>Stereotype: interface</p>
+<div class="sub">
+<div class="sub">
+</div>
+</div>
+<a name="refclass128709"></a>
+<h2 class ="class">1.6 Class GL2GL3</h2>
+<p>Declaration :</p><ul>
+<li>Java : public interface GL2GL3 extends <a href="index.html#refclass128581"><b>GL2ES2</b></a> </li><li>Php : public interface GL2GL3 </li></ul><p>Directly inherited by : <a href="index.html#refclass128453"><b>GL2</b></a> <a href="index.html#refclass128837"><b>GL3</b></a> </p>
+<p>Stereotype: interface</p>
+<div class="sub">
+<div class="sub">
+</div>
+</div>
+<a name="refclass128837"></a>
+<h2 class ="class">1.7 Class GL3</h2>
+<p>Declaration :</p><ul>
+<li>Java : public interface GL3 extends <a href="index.html#refclass128709"><b>GL2GL3</b></a> </li><li>Php : public interface GL3 </li></ul><p>Directly inherited by : <a href="index.html#refclass128002"><b>GL3bc</b></a> <a href="index.html#refclass128130"><b>GL4</b></a> <a href="index.html#refclass130501"><b>GL4bcImpl</b></a> </p>
+<p>Stereotype: interface</p>
+<div class="sub">
+<div class="sub">
+</div>
+</div>
+<a name="refclass128965"></a>
+<h2 class ="class">1.8 Class GLES2</h2>
+<p>Declaration :</p><ul>
+<li>Java : public interface GLES2 extends <a href="index.html#refclass128581"><b>GL2ES2</b></a> </li><li>Php : public interface GLES2 </li></ul><p>Directly inherited by : <a href="index.html#refclass134914"><b>GLES3</b></a> <a href="index.html#refclass130629"><b>GLES3Impl</b></a> </p>
+<p>Stereotype: interface</p>
+<div class="sub">
+<div class="sub">
+</div>
+</div>
+<a name="refclass130117"></a>
+<h2 class ="class">1.9 Class GLContext</h2>
+<p>Declaration :</p><ul>
+<li>Java : package abstract class GLContext </li></ul><div class="sub">
+<div class="sub">
+<a name="refrelation130757"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass130245"><b>GLDrawable</b></a>, multiplicity : 1</li><li>Java : private <a href="index.html#refclass130245"><b>GLDrawable</b></a> </li></ul><a name="refrelation134341"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass132549"><b>GLBase</b></a>, multiplicity : 1</li><li>Java : private <a href="index.html#refclass132549"><b>GLBase</b></a> </li></ul></div>
+</div>
+<a name="refclass130245"></a>
+<h2 class ="class">1.10 Class GLDrawable</h2>
+<p>Declaration :</p><ul>
+<li>Java : package abstract class GLDrawable </li></ul><div class="sub">
+<div class="sub">
+<a name="refrelation130629"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass130117"><b>GLContext</b></a>, multiplicity : 0..1</li><li>Java : private <a href="index.html#refclass130117"><b>GLContext</b></a> </li></ul><a name="refrelation132421"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass130885"><b>NativeWindow</b></a></li><li>Java : private <a href="index.html#refclass130885"><b>NativeWindow</b></a> </li></ul></div>
+</div>
+<a name="refclass130501"></a>
+<h2 class ="class">1.11 Class GL4bcImpl</h2>
+<p>Declaration :</p><ul>
+<li>Java : private class GL4bcImpl implements <a href="index.html#refclass128837"><b>GL3</b></a>, <a href="index.html#refclass128002"><b>GL3bc</b></a>, <a href="index.html#refclass128258"><b>GL4bc</b></a>, <a href="index.html#refclass128453"><b>GL2</b></a>, <a href="index.html#refclass128130"><b>GL4</b></a> </li></ul><p>Stereotype: entity</p>
+<div class="sub">
+<div class="sub">
+</div>
+</div>
+<a name="refclass130629"></a>
+<h2 class ="class">1.12 Class GLES3Impl</h2>
+<p>Declaration :</p><ul>
+<li>Java : private class GLES3Impl extends <a href="index.html#refclass134914"><b>GLES3</b></a> implements <a href="index.html#refclass128965"><b>GLES2</b></a> </li></ul><p>Stereotype: entity</p>
+<div class="sub">
+<div class="sub">
+</div>
+</div>
+<a name="refclass130757"></a>
+<h2 class ="class">1.13 Class GLES1Impl</h2>
+<p>Declaration :</p><ul>
+<li>Java : private class GLES1Impl implements <a href="index.html#refclass128325"><b>GLES1</b></a> </li></ul><p>Stereotype: entity</p>
+<div class="sub">
+<div class="sub">
+</div>
+</div>
+<a name="refclass130885"></a>
+<h2 class ="class">1.14 Class NativeWindow</h2>
+<p>Declaration :</p><ul>
+<li>Java : package interface NativeWindow </li><li>Php : interface NativeWindow </li></ul><p>Stereotype: interface</p>
+<div class="sub">
+<div class="sub">
+<a name="refrelation132165"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a></li><li>Java : private <a href="index.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a> </li></ul><a name="refrelation132293"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass130245"><b>GLDrawable</b></a></li><li>Java : private <a href="index.html#refclass130245"><b>GLDrawable</b></a> </li></ul></div>
+</div>
+<a name="refclass131013"></a>
+<h2 class ="class">1.15 Class AbstractGraphicsConfiguration</h2>
+<p>Declaration :</p><ul>
+<li>Java : package abstract class AbstractGraphicsConfiguration </li></ul><div class="sub">
+<div class="sub">
+<a name="refrelation131525"></a>
+<table><tr><td><div class="element">Relation <b>chosen (<association>)</b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - chosen : <a href="index.html#refclass131269"><b>Capabilities</b></a>, multiplicity : 1</li><li>Java : private <a href="index.html#refclass131269"><b>Capabilities</b></a> chosen</li></ul><a name="refrelation131909"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - requested : <a href="index.html#refclass131269"><b>Capabilities</b></a>, multiplicity : 1</li><li>Java : private <a href="index.html#refclass131269"><b>Capabilities</b></a> requested</li></ul><a name="refrelation132037"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass130885"><b>NativeWindow</b></a></li><li>Java : private <a href="index.html#refclass130885"><b>NativeWindow</b></a> </li></ul></div>
+</div>
+<a name="refclass131141"></a>
+<h2 class ="class">1.16 Class GLCapabilities</h2>
+<p>Declaration :</p><ul>
+<li>Java : package class GLCapabilities extends <a href="index.html#refclass131269"><b>Capabilities</b></a> </li></ul><div class="sub">
+<div class="sub">
+<a name="refrelation132677"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass131397"><b>GLProfile</b></a></li><li>Java : private <a href="index.html#refclass131397"><b>GLProfile</b></a> </li></ul><a name="refrelation132933"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass131397"><b>GLProfile</b></a></li><li>Java : private <a href="index.html#refclass131397"><b>GLProfile</b></a> </li></ul></div>
+</div>
+<a name="refclass131269"></a>
+<h2 class ="class">1.17 Class Capabilities</h2>
+<p>Declaration :</p><ul>
+<li>Java : package class Capabilities </li></ul><p>Directly inherited by : <a href="index.html#refclass131141"><b>GLCapabilities</b></a> </p>
+<div class="sub">
+<div class="sub">
+<a name="refrelation131653"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a></li><li>Java : private <a href="index.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a> </li></ul><a name="refrelation131781"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a></li><li>Java : private <a href="index.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a> </li></ul></div>
+</div>
+<a name="refclass131397"></a>
+<h2 class ="class">1.18 Class GLProfile</h2>
+<p>Declaration :</p><ul>
+<li>Java : package class GLProfile </li></ul><div class="sub">
+<div class="sub">
+<a name="refrelation132549"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass131141"><b>GLCapabilities</b></a></li><li>Java : private <a href="index.html#refclass131141"><b>GLCapabilities</b></a> </li></ul><a name="refrelation132805"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass131141"><b>GLCapabilities</b></a></li><li>Java : private <a href="index.html#refclass131141"><b>GLCapabilities</b></a> </li></ul></div>
+</div>
+<a name="refclass132549"></a>
+<h2 class ="class">1.19 Class GLBase</h2>
+<p>Declaration :</p><ul>
+<li>Java : public interface GLBase </li><li>Php : public interface GLBase </li></ul><p>Directly inherited by : <a href="index.html#refclass128069"><b>GL</b></a> </p>
+<p>Stereotype: interface</p>
+<div class="sub">
+<div class="sub">
+<a name="refrelation134213"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass130117"><b>GLContext</b></a>, multiplicity : 1</li><li>Java : private <a href="index.html#refclass130117"><b>GLContext</b></a> </li></ul></div>
+</div>
+<a name="refclass128002"></a>
+<h2 class ="class">1.20 Class GL3bc</h2>
+<p>Declaration :</p><ul>
+<li>Java : package interface GL3bc extends <a href="index.html#refclass128453"><b>GL2</b></a> </li><li>Php : interface GL3bc </li></ul><p>Directly inherited by : <a href="index.html#refclass128258"><b>GL4bc</b></a> <a href="index.html#refclass130501"><b>GL4bcImpl</b></a> </p>
+<p>Stereotype: interface</p>
+<div class="sub">
+<div class="sub">
+</div>
+</div>
+<a name="refclass128130"></a>
+<h2 class ="class">1.21 Class GL4</h2>
+<p>Declaration :</p><ul>
+<li>Java : package interface GL4 extends <a href="index.html#refclass128837"><b>GL3</b></a> </li><li>Php : interface GL4 </li></ul><p>Directly inherited by : <a href="index.html#refclass128258"><b>GL4bc</b></a> <a href="index.html#refclass130501"><b>GL4bcImpl</b></a> </p>
+<p>Stereotype: interface</p>
+<div class="sub">
+<div class="sub">
+</div>
+</div>
+<a name="refclass128258"></a>
+<h2 class ="class">1.22 Class GL4bc</h2>
+<p>Declaration :</p><ul>
+<li>Java : package interface GL4bc extends <a href="index.html#refclass128002"><b>GL3bc</b></a> </li><li>Php : interface GL4bc </li></ul><p>Directly inherited by : <a href="index.html#refclass130501"><b>GL4bcImpl</b></a> </p>
+<p>Stereotype: interface</p>
+<div class="sub">
+<div class="sub">
+</div>
+</div>
+<a name="refclass128386"></a>
+<h2 class ="class">1.23 Class GL2ES12</h2>
+<p>Declaration :</p><ul>
+<li>Java : package class GL2ES12 implements <a href="index.html#refclass128197"><b>GL2ES1</b></a>, <a href="index.html#refclass128581"><b>GL2ES2</b></a> </li></ul><p>Stereotype: entity</p>
+<div class="sub">
+<div class="sub">
+</div>
+</div>
+<a name="refclass134914"></a>
+<h2 class ="class">1.24 Class GLES3</h2>
+<p>Declaration :</p><ul>
+<li>Java : public @interface GLES3 extends <a href="index.html#refclass135042"><b>GL4ES3</b></a> </li></ul><p>Directly inherited by : <a href="index.html#refclass130629"><b>GLES3Impl</b></a> </p>
+<p>Stereotype: @interface</p>
+<div class="sub">
+<div class="sub">
+</div>
+</div>
+<a name="refclass135042"></a>
+<h2 class ="class">1.25 Class GL4ES3</h2>
+<p>Declaration :</p><ul>
+<li>Java : public @interface GL4ES3 extends <a href="index.html#refclass135170"><b>GL3ES3</b></a> </li></ul><p>Directly inherited by : <a href="index.html#refclass128130"><b>GL4</b></a> <a href="index.html#refclass134914"><b>GLES3</b></a> </p>
+<p>Stereotype: @interface</p>
+<div class="sub">
+<div class="sub">
+</div>
+</div>
+<a name="refclass135170"></a>
+<h2 class ="class">1.26 Class GL3ES3</h2>
+<p>Declaration :</p><ul>
+<li>Java : public @interface GL3ES3 extends <a href="index.html#refmetaclass135298"><b>GL2ES3</b></a> </li></ul><p>Directly inherited by : <a href="index.html#refclass128837"><b>GL3</b></a> <a href="index.html#refclass135042"><b>GL4ES3</b></a> </p>
+<p>Stereotype: @interface</p>
+<div class="sub">
+<div class="sub">
+</div>
+</div>
+<a name="refclass135298"></a>
+<h2 class ="metaclass">1.27 Metaclass GL2ES3</h2>
+<p>Declaration :</p><ul>
+<li>Java : package @interface GL2ES3 </li></ul><p>Directly inherited by : <a href="index.html#refclass128709"><b>GL2GL3</b></a> <a href="index.html#refclass135170"><b>GL3ES3</b></a> </p>
+<p>Stereotype: metaclass</p>
+<div class="sub">
+<div class="sub">
+</div>
+</div>
</div>
</body>
</html>
diff --git a/doc/uml/html-svg/index_65.html b/doc/uml/html-svg/index_65.html
index 3ab96c5..9a6dedc 100644
--- a/doc/uml/html-svg/index_65.html
+++ b/doc/uml/html-svg/index_65.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
@@ -16,8 +16,8 @@
<!-- ============================================================= -->
<table>
-<tr bgcolor="#f0f0f0"><td align="center"><b>Name</b></td><td align="center"><b>Kind</b></td><td align="center"><b>Description</b></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class131013.html#refclass131013" target = "projectFrame"><b>AbstractGraphicsConfiguration</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td align=center><b>Name</b></td><td align=center><b>Kind</b></td><td align=center><b>Description</b></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass131013" target = "projectFrame"><b>AbstractGraphicsConfiguration</b></a></td><td>class</td><td></td></tr>
</table>
</body>
</html>
diff --git a/doc/uml/html-svg/index_67.html b/doc/uml/html-svg/index_67.html
index 28b39e2..630cc49 100644
--- a/doc/uml/html-svg/index_67.html
+++ b/doc/uml/html-svg/index_67.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
@@ -16,9 +16,9 @@
<!-- ============================================================= -->
<table>
-<tr bgcolor="#f0f0f0"><td align="center"><b>Name</b></td><td align="center"><b>Kind</b></td><td align="center"><b>Description</b></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class131269.html#refclass131269" target = "projectFrame"><b>Capabilities</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#ref0_131525" target = "projectFrame"><b>chosen</b></a></td><td>relation</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td align=center><b>Name</b></td><td align=center><b>Kind</b></td><td align=center><b>Description</b></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass131269" target = "projectFrame"><b>Capabilities</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refrelation131525" target = "projectFrame"><b>chosen</b></a></td><td>relation</td><td></td></tr>
</table>
</body>
</html>
diff --git a/doc/uml/html-svg/index_71.html b/doc/uml/html-svg/index_71.html
index 79ae310..2f84ff7 100644
--- a/doc/uml/html-svg/index_71.html
+++ b/doc/uml/html-svg/index_71.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
@@ -16,31 +16,31 @@
<!-- ============================================================= -->
<table>
-<tr bgcolor="#f0f0f0"><td align="center"><b>Name</b></td><td align="center"><b>Kind</b></td><td align="center"><b>Description</b></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128069.html#refclass128069" target = "projectFrame"><b>GL</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128453.html#refclass128453" target = "projectFrame"><b>GL2</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128197.html#refclass128197" target = "projectFrame"><b>GL2ES1</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128386.html#refclass128386" target = "projectFrame"><b>GL2ES12</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128581.html#refclass128581" target = "projectFrame"><b>GL2ES2</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="metaclass135298.html#refmetaclass135298" target = "projectFrame"><b>GL2ES3</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128709.html#refclass128709" target = "projectFrame"><b>GL2GL3</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128837.html#refclass128837" target = "projectFrame"><b>GL3</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128002.html#refclass128002" target = "projectFrame"><b>GL3bc</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class135170.html#refclass135170" target = "projectFrame"><b>GL3ES3</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128130.html#refclass128130" target = "projectFrame"><b>GL4</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128258.html#refclass128258" target = "projectFrame"><b>GL4bc</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class130501.html#refclass130501" target = "projectFrame"><b>GL4bcImpl</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class135042.html#refclass135042" target = "projectFrame"><b>GL4ES3</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class132549.html#refclass132549" target = "projectFrame"><b>GLBase</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class131141.html#refclass131141" target = "projectFrame"><b>GLCapabilities</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class130117.html#refclass130117" target = "projectFrame"><b>GLContext</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class130245.html#refclass130245" target = "projectFrame"><b>GLDrawable</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128325.html#refclass128325" target = "projectFrame"><b>GLES1</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class130757.html#refclass130757" target = "projectFrame"><b>GLES1Impl</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class128965.html#refclass128965" target = "projectFrame"><b>GLES2</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class134914.html#refclass134914" target = "projectFrame"><b>GLES3</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class130629.html#refclass130629" target = "projectFrame"><b>GLES3Impl</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class131397.html#refclass131397" target = "projectFrame"><b>GLProfile</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td align=center><b>Name</b></td><td align=center><b>Kind</b></td><td align=center><b>Description</b></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128069" target = "projectFrame"><b>GL</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128453" target = "projectFrame"><b>GL2</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128197" target = "projectFrame"><b>GL2ES1</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128386" target = "projectFrame"><b>GL2ES12</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128581" target = "projectFrame"><b>GL2ES2</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refmetaclass135298" target = "projectFrame"><b>GL2ES3</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128709" target = "projectFrame"><b>GL2GL3</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128837" target = "projectFrame"><b>GL3</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128002" target = "projectFrame"><b>GL3bc</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass135170" target = "projectFrame"><b>GL3ES3</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128130" target = "projectFrame"><b>GL4</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128258" target = "projectFrame"><b>GL4bc</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130501" target = "projectFrame"><b>GL4bcImpl</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass135042" target = "projectFrame"><b>GL4ES3</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass132549" target = "projectFrame"><b>GLBase</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass131141" target = "projectFrame"><b>GLCapabilities</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130117" target = "projectFrame"><b>GLContext</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130245" target = "projectFrame"><b>GLDrawable</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128325" target = "projectFrame"><b>GLES1</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130757" target = "projectFrame"><b>GLES1Impl</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128965" target = "projectFrame"><b>GLES2</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass134914" target = "projectFrame"><b>GLES3</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130629" target = "projectFrame"><b>GLES3Impl</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass131397" target = "projectFrame"><b>GLProfile</b></a></td><td>class</td><td></td></tr>
</table>
</body>
</html>
diff --git a/doc/uml/html-svg/index_74.html b/doc/uml/html-svg/index_74.html
index fb85d4b..14ff3be 100644
--- a/doc/uml/html-svg/index_74.html
+++ b/doc/uml/html-svg/index_74.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
@@ -16,9 +16,9 @@
<!-- ============================================================= -->
<table>
-<tr bgcolor="#f0f0f0"><td align="center"><b>Name</b></td><td align="center"><b>Kind</b></td><td align="center"><b>Description</b></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#ref18_128069" target = "projectFrame"><b>javax.media.opengl</b></a></td><td>class view</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#ref22_129" target = "projectFrame"><b>jogl</b></a></td><td>package</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td align=center><b>Name</b></td><td align=center><b>Kind</b></td><td align=center><b>Description</b></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass view128069" target = "projectFrame"><b>javax.media.opengl</b></a></td><td>class view</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refpackage129" target = "projectFrame"><b>jogl</b></a></td><td>package</td><td></td></tr>
</table>
</body>
</html>
diff --git a/doc/uml/html-svg/index_78.html b/doc/uml/html-svg/index_78.html
index 3596885..3273a2e 100644
--- a/doc/uml/html-svg/index_78.html
+++ b/doc/uml/html-svg/index_78.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
@@ -16,8 +16,8 @@
<!-- ============================================================= -->
<table>
-<tr bgcolor="#f0f0f0"><td align="center"><b>Name</b></td><td align="center"><b>Kind</b></td><td align="center"><b>Description</b></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="class130885.html#refclass130885" target = "projectFrame"><b>NativeWindow</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td align=center><b>Name</b></td><td align=center><b>Kind</b></td><td align=center><b>Description</b></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130885" target = "projectFrame"><b>NativeWindow</b></a></td><td>class</td><td></td></tr>
</table>
</body>
</html>
diff --git a/doc/uml/html-svg/index_79.html b/doc/uml/html-svg/index_79.html
index 2ebee78..dc8c42a 100644
--- a/doc/uml/html-svg/index_79.html
+++ b/doc/uml/html-svg/index_79.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
@@ -16,9 +16,9 @@
<!-- ============================================================= -->
<table>
-<tr bgcolor="#f0f0f0"><td align="center"><b>Name</b></td><td align="center"><b>Kind</b></td><td align="center"><b>Description</b></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#ref10_128069" target = "projectFrame"><b>OpenGL Interfaces - All</b></a></td><td>class diagram</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#ref10_134786" target = "projectFrame"><b>OpenGL Interfaces - Core Only</b></a></td><td>class diagram</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td align=center><b>Name</b></td><td align=center><b>Kind</b></td><td align=center><b>Description</b></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass diagram128069" target = "projectFrame"><b>OpenGL Interfaces - All</b></a></td><td>class diagram</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass diagram134786" target = "projectFrame"><b>OpenGL Interfaces - Core Only</b></a></td><td>class diagram</td><td></td></tr>
</table>
</body>
</html>
diff --git a/doc/uml/html-svg/index_82.html b/doc/uml/html-svg/index_82.html
index a9a7994..c5dcd1d 100644
--- a/doc/uml/html-svg/index_82.html
+++ b/doc/uml/html-svg/index_82.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
@@ -16,8 +16,8 @@
<!-- ============================================================= -->
<table>
-<tr bgcolor="#f0f0f0"><td align="center"><b>Name</b></td><td align="center"><b>Kind</b></td><td align="center"><b>Description</b></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#ref0_131909" target = "projectFrame"><b>requested</b></a></td><td>relation</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td align=center><b>Name</b></td><td align=center><b>Kind</b></td><td align=center><b>Description</b></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refrelation131909" target = "projectFrame"><b>requested</b></a></td><td>relation</td><td></td></tr>
</table>
</body>
</html>
diff --git a/doc/uml/html-svg/metaclass135298.html b/doc/uml/html-svg/metaclass135298.html
deleted file mode 100644
index f669748..0000000
--- a/doc/uml/html-svg/metaclass135298.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
-
-<head>
-<title>Metaclass GL2ES3</title>
-<link rel="stylesheet" href="style.css" type="text/css" />
-</head>
-
-<body bgcolor="#ffffff">
-
-<div class = "title">Metaclass GL2ES3</div>
-<p></p>
-
-<!-- ============================================================= -->
-
-<a name="ref4_135298"></a>
-<p>Declaration :</p><ul>
-<li>Java : package @interface GL2ES3 </li></ul><p>Directly inherited by : <a href="class128709.html#refclass128709"><b>GL2GL3</b></a> <a href="class135170.html#refclass135170"><b>GL3ES3</b></a> </p>
-<p>Stereotype: metaclass</p>
-<div class="sub">
-</div>
-</body>
-</html>
diff --git a/doc/uml/html-svg/navig.html b/doc/uml/html-svg/navig.html
index b49965a..e4f1223 100644
--- a/doc/uml/html-svg/navig.html
+++ b/doc/uml/html-svg/navig.html
@@ -1,14 +1,14 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
<head>
-<title>C:/projects/JOGAMP/jogl/doc/uml/html-svg/navig</title>
+<title>/usr/local/projects/JOGL/jogl/doc/uml/html-svg/navig</title>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body bgcolor="#ffffff">
-<hr />
+<p><hr noshade></p>
<p><a href="index.html" target = "projectFrame"><b> -Top- </b></a><a href="classes.html" target = "projectFrame"><b> -Classes- </b></a><a href="packages.html" target = "projectFrame"><b> -Packages- </b></a><a href="classdiagrams.html" target = "projectFrame"><b> -Class Diagrams- </b></a></p>
<p>
</p>
diff --git a/doc/uml/html-svg/packages.html b/doc/uml/html-svg/packages.html
index e232104..61017a2 100644
--- a/doc/uml/html-svg/packages.html
+++ b/doc/uml/html-svg/packages.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
@@ -16,7 +16,7 @@
<!-- ============================================================= -->
<table>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#ref22_129" target = "projectFrame"><b>jogl</b></a></td><td></td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refpackage129" target = "projectFrame"><b>jogl</b></a></td><td></td><td></td></tr>
</table>
</body>
</html>
diff --git a/doc/uml/html/classdiagrams.html b/doc/uml/html/classdiagrams.html
index 23fc3fb..df3dd93 100644
--- a/doc/uml/html/classdiagrams.html
+++ b/doc/uml/html/classdiagrams.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@@ -16,8 +16,8 @@
<!-- ============================================================= -->
<table>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#ref10_128069" target = "projectFrame"><b>OpenGL Interfaces - All</b></a></td><td></td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#ref10_134786" target = "projectFrame"><b>OpenGL Interfaces - Core Only</b></a></td><td></td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass diagram128069" target = "projectFrame"><b>OpenGL Interfaces - All</b></a></td><td></td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass diagram134786" target = "projectFrame"><b>OpenGL Interfaces - Core Only</b></a></td><td></td><td></td></tr>
</table>
</body>
</html>
diff --git a/doc/uml/html/classes.html b/doc/uml/html/classes.html
index b48298a..7b4525b 100644
--- a/doc/uml/html/classes.html
+++ b/doc/uml/html/classes.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@@ -16,33 +16,33 @@
<!-- ============================================================= -->
<table>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass131013" target = "projectFrame"><b>AbstractGraphicsConfiguration</b></a></td><td></td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass131269" target = "projectFrame"><b>Capabilities</b></a></td><td></td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128069" target = "projectFrame"><b>GL</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128453" target = "projectFrame"><b>GL2</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128197" target = "projectFrame"><b>GL2ES1</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128386" target = "projectFrame"><b>GL2ES12</b></a></td><td>entity</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128581" target = "projectFrame"><b>GL2ES2</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refmetaclass135298" target = "projectFrame"><b>GL2ES3</b></a></td><td>metaclass</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128709" target = "projectFrame"><b>GL2GL3</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128837" target = "projectFrame"><b>GL3</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128002" target = "projectFrame"><b>GL3bc</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass135170" target = "projectFrame"><b>GL3ES3</b></a></td><td>@interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128130" target = "projectFrame"><b>GL4</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128258" target = "projectFrame"><b>GL4bc</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass130501" target = "projectFrame"><b>GL4bcImpl</b></a></td><td>entity</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass135042" target = "projectFrame"><b>GL4ES3</b></a></td><td>@interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass132549" target = "projectFrame"><b>GLBase</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass131141" target = "projectFrame"><b>GLCapabilities</b></a></td><td></td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass130117" target = "projectFrame"><b>GLContext</b></a></td><td></td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass130245" target = "projectFrame"><b>GLDrawable</b></a></td><td></td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128325" target = "projectFrame"><b>GLES1</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass130757" target = "projectFrame"><b>GLES1Impl</b></a></td><td>entity</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128965" target = "projectFrame"><b>GLES2</b></a></td><td>interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass134914" target = "projectFrame"><b>GLES3</b></a></td><td>@interface</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass130629" target = "projectFrame"><b>GLES3Impl</b></a></td><td>entity</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass131397" target = "projectFrame"><b>GLProfile</b></a></td><td></td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass130885" target = "projectFrame"><b>NativeWindow</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass131013" target = "projectFrame"><b>AbstractGraphicsConfiguration</b></a></td><td></td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass131269" target = "projectFrame"><b>Capabilities</b></a></td><td></td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128069" target = "projectFrame"><b>GL</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128453" target = "projectFrame"><b>GL2</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128197" target = "projectFrame"><b>GL2ES1</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128386" target = "projectFrame"><b>GL2ES12</b></a></td><td>entity</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128581" target = "projectFrame"><b>GL2ES2</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refmetaclass135298" target = "projectFrame"><b>GL2ES3</b></a></td><td>metaclass</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128709" target = "projectFrame"><b>GL2GL3</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128837" target = "projectFrame"><b>GL3</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128002" target = "projectFrame"><b>GL3bc</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass135170" target = "projectFrame"><b>GL3ES3</b></a></td><td>@interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128130" target = "projectFrame"><b>GL4</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128258" target = "projectFrame"><b>GL4bc</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130501" target = "projectFrame"><b>GL4bcImpl</b></a></td><td>entity</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass135042" target = "projectFrame"><b>GL4ES3</b></a></td><td>@interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass132549" target = "projectFrame"><b>GLBase</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass131141" target = "projectFrame"><b>GLCapabilities</b></a></td><td></td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130117" target = "projectFrame"><b>GLContext</b></a></td><td></td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130245" target = "projectFrame"><b>GLDrawable</b></a></td><td></td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128325" target = "projectFrame"><b>GLES1</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130757" target = "projectFrame"><b>GLES1Impl</b></a></td><td>entity</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128965" target = "projectFrame"><b>GLES2</b></a></td><td>interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass134914" target = "projectFrame"><b>GLES3</b></a></td><td>@interface</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130629" target = "projectFrame"><b>GLES3Impl</b></a></td><td>entity</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass131397" target = "projectFrame"><b>GLProfile</b></a></td><td></td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130885" target = "projectFrame"><b>NativeWindow</b></a></td><td>interface</td><td></td></tr>
</table>
</body>
</html>
diff --git a/doc/uml/html/classes_list.html b/doc/uml/html/classes_list.html
index b01081a..8d1e417 100644
--- a/doc/uml/html/classes_list.html
+++ b/doc/uml/html/classes_list.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@@ -17,7 +17,7 @@
<table border="0" width="100%">
<tr>
-<td nowrap="nowrap"><a href="index.html#refclass131013" target = "projectFrame"><b>AbstractGraphicsConfiguration</b></a><br />
+<td nowrap><a href="index.html#refclass131013" target = "projectFrame"><b>AbstractGraphicsConfiguration</b></a><br />
<a href="index.html#refclass131269" target = "projectFrame"><b>Capabilities</b></a><br />
<a href="index.html#refclass128069" target = "projectFrame"><b>GL</b></a><br />
<a href="index.html#refclass128453" target = "projectFrame"><b>GL2</b></a><br />
diff --git a/doc/uml/html/fig128069.png b/doc/uml/html/fig128069.png
index b653c71..08e08f4 100644
Binary files a/doc/uml/html/fig128069.png and b/doc/uml/html/fig128069.png differ
diff --git a/doc/uml/html/fig134786.png b/doc/uml/html/fig134786.png
index 78d00c2..70b0f50 100644
Binary files a/doc/uml/html/fig134786.png and b/doc/uml/html/fig134786.png differ
diff --git a/doc/uml/html/index-withframe.html b/doc/uml/html/index-withframe.html
index 7ea3a28..f3a6648 100644
--- a/doc/uml/html/index-withframe.html
+++ b/doc/uml/html/index-withframe.html
@@ -1,24 +1,19 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
-<title>C:/projects/JOGAMP/jogl/doc/uml/html/index-withframe</title>
+<title>/usr/local/projects/JOGL/jogl/doc/uml/html/index-withframe</title>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
-<frameset cols="20%,80%">
- <noframes>
- <body>
- <h2>Frame Alert</h2>
- <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.</p>
- <p>Link to <a href="index.html">Non-frame version.</a></p>
- </body>
- </noframes>
- <frame src="classes_list.html" name="classesListFrame" />
- <frameset rows="150,*">
- <frame src="navig.html" name="navigFrame" />
- <frame src="index.html" name="projectFrame" />
- </frameset>
-</frameset>
-</html>
\ No newline at end of file
+<FRAMESET cols="20%,80%">
+ <FRAME src="classes_list.html" name="classesListFrame">
+ <FRAMESET rows="150,*">
+ <FRAME src="navig.html" name="navigFrame">
+ <FRAME src="index.html" name="projectFrame">
+ </FRAMESET>
+</FRAMESET>
+<NOFRAMES>
+<H2>Frame Alert</H2><P>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.<BR>Link to <A HREF="index.html">Non-frame version.</A></NOFRAMES></body>
+</html>
diff --git a/doc/uml/html/index.html b/doc/uml/html/index.html
index f5988be..2b67bd3 100644
--- a/doc/uml/html/index.html
+++ b/doc/uml/html/index.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@@ -16,20 +16,20 @@ Documentation</title>
<!-- ============================================================= -->
-<a name="ref22_129"></a>
-<p>Properties:</p><ul>
-<li>html dir:<br /><div class="sub">C:/projects/JOGAMP/jogl/doc/uml/html/</div></li>
-</ul>
-<a name="ref18_128069"></a>
+<a name="refpackage129"></a>
+<p>Properties:<ul>
+<li>html dir:<br /><div class="sub">/usr/local/projects/JOGL/jogl/doc/uml/html/</div></p></li>
+</ul></p>
+<a name="refclass view128069"></a>
<h1 class ="view">1 Class View javax.media.opengl</h1>
<div class="sub">
-<a name="ref10_128069"></a>
+<a name="refclass diagram128069"></a>
<p align="center"><img src="fig128069.png" alt="" /></p>
<p align="center"><b>OpenGL Interfaces - All</b></p><p><br /></p><p><br /></p>
-<a name="ref10_134786"></a>
+<a name="refclass diagram134786"></a>
<p align="center"><img src="fig134786.png" alt="" /></p>
<p align="center"><b>OpenGL Interfaces - Core Only</b></p><p><br /></p><p><br /></p>
-<a name="ref4_128069"></a>
+<a name="refclass128069"></a>
<h2 class ="class">1.1 Class GL</h2>
<p>Declaration :</p><ul>
<li>Java : public interface GL extends <a href="index.html#refclass132549"><b>GLBase</b></a> </li><li>Php : public interface GL </li></ul><p>Directly inherited by : <a href="index.html#refclass128197"><b>GL2ES1</b></a> <a href="index.html#refclass128581"><b>GL2ES2</b></a> </p>
@@ -38,7 +38,7 @@ Documentation</title>
<div class="sub">
</div>
</div>
-<a name="ref4_128197"></a>
+<a name="refclass128197"></a>
<h2 class ="class">1.2 Class GL2ES1</h2>
<p>Declaration :</p><ul>
<li>Java : public interface GL2ES1 extends <a href="index.html#refclass128069"><b>GL</b></a> </li><li>Php : public interface GL2ES1 </li></ul><p>Directly inherited by : <a href="index.html#refclass128453"><b>GL2</b></a> <a href="index.html#refclass128386"><b>GL2ES12</b></a> <a href="index.html#refclass128325"><b>GLES1</b></a> </p>
@@ -47,7 +47,7 @@ Documentation</title>
<div class="sub">
</div>
</div>
-<a name="ref4_128325"></a>
+<a name="refclass128325"></a>
<h2 class ="class">1.3 Class GLES1</h2>
<p>Declaration :</p><ul>
<li>Java : public interface GLES1 extends <a href="index.html#refclass128197"><b>GL2ES1</b></a> </li><li>Php : public interface GLES1 </li></ul><p>Directly inherited by : <a href="index.html#refclass130757"><b>GLES1Impl</b></a> </p>
@@ -56,7 +56,7 @@ Documentation</title>
<div class="sub">
</div>
</div>
-<a name="ref4_128453"></a>
+<a name="refclass128453"></a>
<h2 class ="class">1.4 Class GL2</h2>
<p>Declaration :</p><ul>
<li>Java : public interface GL2 extends <a href="index.html#refclass128709"><b>GL2GL3</b></a> </li><li>Php : public interface GL2 </li></ul><p>Directly inherited by : <a href="index.html#refclass128002"><b>GL3bc</b></a> <a href="index.html#refclass130501"><b>GL4bcImpl</b></a> </p>
@@ -65,7 +65,7 @@ Documentation</title>
<div class="sub">
</div>
</div>
-<a name="ref4_128581"></a>
+<a name="refclass128581"></a>
<h2 class ="class">1.5 Class GL2ES2</h2>
<p>Declaration :</p><ul>
<li>Java : public interface GL2ES2 extends <a href="index.html#refclass128069"><b>GL</b></a> </li><li>Php : public interface GL2ES2 </li></ul><p>Directly inherited by : <a href="index.html#refclass128386"><b>GL2ES12</b></a> <a href="index.html#refmetaclass135298"><b>GL2ES3</b></a> <a href="index.html#refclass128709"><b>GL2GL3</b></a> <a href="index.html#refclass128965"><b>GLES2</b></a> </p>
@@ -74,7 +74,7 @@ Documentation</title>
<div class="sub">
</div>
</div>
-<a name="ref4_128709"></a>
+<a name="refclass128709"></a>
<h2 class ="class">1.6 Class GL2GL3</h2>
<p>Declaration :</p><ul>
<li>Java : public interface GL2GL3 extends <a href="index.html#refclass128581"><b>GL2ES2</b></a> </li><li>Php : public interface GL2GL3 </li></ul><p>Directly inherited by : <a href="index.html#refclass128453"><b>GL2</b></a> <a href="index.html#refclass128837"><b>GL3</b></a> </p>
@@ -83,7 +83,7 @@ Documentation</title>
<div class="sub">
</div>
</div>
-<a name="ref4_128837"></a>
+<a name="refclass128837"></a>
<h2 class ="class">1.7 Class GL3</h2>
<p>Declaration :</p><ul>
<li>Java : public interface GL3 extends <a href="index.html#refclass128709"><b>GL2GL3</b></a> </li><li>Php : public interface GL3 </li></ul><p>Directly inherited by : <a href="index.html#refclass128002"><b>GL3bc</b></a> <a href="index.html#refclass128130"><b>GL4</b></a> <a href="index.html#refclass130501"><b>GL4bcImpl</b></a> </p>
@@ -92,34 +92,34 @@ Documentation</title>
<div class="sub">
</div>
</div>
-<a name="ref4_128965"></a>
+<a name="refclass128965"></a>
<h2 class ="class">1.8 Class GLES2</h2>
<p>Declaration :</p><ul>
-<li>Java : public interface GLES2 extends <a href="index.html#refclass128581"><b>GL2ES2</b></a> </li><li>Php : public interface GLES2 </li></ul><p>Directly inherited by : <a href="index.html#refclass130629"><b>GLES3Impl</b></a> </p>
+<li>Java : public interface GLES2 extends <a href="index.html#refclass128581"><b>GL2ES2</b></a> </li><li>Php : public interface GLES2 </li></ul><p>Directly inherited by : <a href="index.html#refclass134914"><b>GLES3</b></a> <a href="index.html#refclass130629"><b>GLES3Impl</b></a> </p>
<p>Stereotype: interface</p>
<div class="sub">
<div class="sub">
</div>
</div>
-<a name="ref4_130117"></a>
+<a name="refclass130117"></a>
<h2 class ="class">1.9 Class GLContext</h2>
<p>Declaration :</p><ul>
<li>Java : package abstract class GLContext </li></ul><div class="sub">
<div class="sub">
-<a name="ref0_130757"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass130245"><b>GLDrawable</b></a>, multiplicity : 1</li><li>Java : private <a href="index.html#refclass130245"><b>GLDrawable</b></a> </li></ul><a name="ref0_134341"></a>
+<a name="refrelation130757"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass130245"><b>GLDrawable</b></a>, multiplicity : 1</li><li>Java : private <a href="index.html#refclass130245"><b>GLDrawable</b></a> </li></ul><a name="refrelation134341"></a>
<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass132549"><b>GLBase</b></a>, multiplicity : 1</li><li>Java : private <a href="index.html#refclass132549"><b>GLBase</b></a> </li></ul></div>
</div>
-<a name="ref4_130245"></a>
+<a name="refclass130245"></a>
<h2 class ="class">1.10 Class GLDrawable</h2>
<p>Declaration :</p><ul>
<li>Java : package abstract class GLDrawable </li></ul><div class="sub">
<div class="sub">
-<a name="ref0_130629"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass130117"><b>GLContext</b></a>, multiplicity : 0..1</li><li>Java : private <a href="index.html#refclass130117"><b>GLContext</b></a> </li></ul><a name="ref0_132421"></a>
+<a name="refrelation130629"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass130117"><b>GLContext</b></a>, multiplicity : 0..1</li><li>Java : private <a href="index.html#refclass130117"><b>GLContext</b></a> </li></ul><a name="refrelation132421"></a>
<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass130885"><b>NativeWindow</b></a></li><li>Java : private <a href="index.html#refclass130885"><b>NativeWindow</b></a> </li></ul></div>
</div>
-<a name="ref4_130501"></a>
+<a name="refclass130501"></a>
<h2 class ="class">1.11 Class GL4bcImpl</h2>
<p>Declaration :</p><ul>
<li>Java : private class GL4bcImpl implements <a href="index.html#refclass128837"><b>GL3</b></a>, <a href="index.html#refclass128002"><b>GL3bc</b></a>, <a href="index.html#refclass128258"><b>GL4bc</b></a>, <a href="index.html#refclass128453"><b>GL2</b></a>, <a href="index.html#refclass128130"><b>GL4</b></a> </li></ul><p>Stereotype: entity</p>
@@ -127,7 +127,7 @@ Documentation</title>
<div class="sub">
</div>
</div>
-<a name="ref4_130629"></a>
+<a name="refclass130629"></a>
<h2 class ="class">1.12 Class GLES3Impl</h2>
<p>Declaration :</p><ul>
<li>Java : private class GLES3Impl extends <a href="index.html#refclass134914"><b>GLES3</b></a> implements <a href="index.html#refclass128965"><b>GLES2</b></a> </li></ul><p>Stereotype: entity</p>
@@ -135,7 +135,7 @@ Documentation</title>
<div class="sub">
</div>
</div>
-<a name="ref4_130757"></a>
+<a name="refclass130757"></a>
<h2 class ="class">1.13 Class GLES1Impl</h2>
<p>Declaration :</p><ul>
<li>Java : private class GLES1Impl implements <a href="index.html#refclass128325"><b>GLES1</b></a> </li></ul><p>Stereotype: entity</p>
@@ -143,65 +143,65 @@ Documentation</title>
<div class="sub">
</div>
</div>
-<a name="ref4_130885"></a>
+<a name="refclass130885"></a>
<h2 class ="class">1.14 Class NativeWindow</h2>
<p>Declaration :</p><ul>
<li>Java : package interface NativeWindow </li><li>Php : interface NativeWindow </li></ul><p>Stereotype: interface</p>
<div class="sub">
<div class="sub">
-<a name="ref0_132165"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a></li><li>Java : private <a href="index.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a> </li></ul><a name="ref0_132293"></a>
+<a name="refrelation132165"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a></li><li>Java : private <a href="index.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a> </li></ul><a name="refrelation132293"></a>
<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass130245"><b>GLDrawable</b></a></li><li>Java : private <a href="index.html#refclass130245"><b>GLDrawable</b></a> </li></ul></div>
</div>
-<a name="ref4_131013"></a>
+<a name="refclass131013"></a>
<h2 class ="class">1.15 Class AbstractGraphicsConfiguration</h2>
<p>Declaration :</p><ul>
<li>Java : package abstract class AbstractGraphicsConfiguration </li></ul><div class="sub">
<div class="sub">
-<a name="ref0_131525"></a>
-<table><tr><td><div class="element">Relation <b>chosen (<association>)</b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - chosen : <a href="index.html#refclass131269"><b>Capabilities</b></a>, multiplicity : 1</li><li>Java : private <a href="index.html#refclass131269"><b>Capabilities</b></a> chosen</li></ul><a name="ref0_131909"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - requested : <a href="index.html#refclass131269"><b>Capabilities</b></a>, multiplicity : 1</li><li>Java : private <a href="index.html#refclass131269"><b>Capabilities</b></a> requested</li></ul><a name="ref0_132037"></a>
+<a name="refrelation131525"></a>
+<table><tr><td><div class="element">Relation <b>chosen (<association>)</b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - chosen : <a href="index.html#refclass131269"><b>Capabilities</b></a>, multiplicity : 1</li><li>Java : private <a href="index.html#refclass131269"><b>Capabilities</b></a> chosen</li></ul><a name="refrelation131909"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - requested : <a href="index.html#refclass131269"><b>Capabilities</b></a>, multiplicity : 1</li><li>Java : private <a href="index.html#refclass131269"><b>Capabilities</b></a> requested</li></ul><a name="refrelation132037"></a>
<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass130885"><b>NativeWindow</b></a></li><li>Java : private <a href="index.html#refclass130885"><b>NativeWindow</b></a> </li></ul></div>
</div>
-<a name="ref4_131141"></a>
+<a name="refclass131141"></a>
<h2 class ="class">1.16 Class GLCapabilities</h2>
<p>Declaration :</p><ul>
<li>Java : package class GLCapabilities extends <a href="index.html#refclass131269"><b>Capabilities</b></a> </li></ul><div class="sub">
<div class="sub">
-<a name="ref0_132677"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass131397"><b>GLProfile</b></a></li><li>Java : private <a href="index.html#refclass131397"><b>GLProfile</b></a> </li></ul><a name="ref0_132933"></a>
+<a name="refrelation132677"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass131397"><b>GLProfile</b></a></li><li>Java : private <a href="index.html#refclass131397"><b>GLProfile</b></a> </li></ul><a name="refrelation132933"></a>
<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass131397"><b>GLProfile</b></a></li><li>Java : private <a href="index.html#refclass131397"><b>GLProfile</b></a> </li></ul></div>
</div>
-<a name="ref4_131269"></a>
+<a name="refclass131269"></a>
<h2 class ="class">1.17 Class Capabilities</h2>
<p>Declaration :</p><ul>
<li>Java : package class Capabilities </li></ul><p>Directly inherited by : <a href="index.html#refclass131141"><b>GLCapabilities</b></a> </p>
<div class="sub">
<div class="sub">
-<a name="ref0_131653"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a></li><li>Java : private <a href="index.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a> </li></ul><a name="ref0_131781"></a>
+<a name="refrelation131653"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a></li><li>Java : private <a href="index.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a> </li></ul><a name="refrelation131781"></a>
<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a></li><li>Java : private <a href="index.html#refclass131013"><b>AbstractGraphicsConfiguration</b></a> </li></ul></div>
</div>
-<a name="ref4_131397"></a>
+<a name="refclass131397"></a>
<h2 class ="class">1.18 Class GLProfile</h2>
<p>Declaration :</p><ul>
<li>Java : package class GLProfile </li></ul><div class="sub">
<div class="sub">
-<a name="ref0_132549"></a>
-<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass131141"><b>GLCapabilities</b></a></li><li>Java : private <a href="index.html#refclass131141"><b>GLCapabilities</b></a> </li></ul><a name="ref0_132805"></a>
+<a name="refrelation132549"></a>
+<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass131141"><b>GLCapabilities</b></a></li><li>Java : private <a href="index.html#refclass131141"><b>GLCapabilities</b></a> </li></ul><a name="refrelation132805"></a>
<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass131141"><b>GLCapabilities</b></a></li><li>Java : private <a href="index.html#refclass131141"><b>GLCapabilities</b></a> </li></ul></div>
</div>
-<a name="ref4_132549"></a>
+<a name="refclass132549"></a>
<h2 class ="class">1.19 Class GLBase</h2>
<p>Declaration :</p><ul>
<li>Java : public interface GLBase </li><li>Php : public interface GLBase </li></ul><p>Directly inherited by : <a href="index.html#refclass128069"><b>GL</b></a> </p>
<p>Stereotype: interface</p>
<div class="sub">
<div class="sub">
-<a name="ref0_134213"></a>
+<a name="refrelation134213"></a>
<table><tr><td><div class="element">Relation <b><association></b></div></td></tr></table><p>Declaration :</p><ul><li>Uml : - : <a href="index.html#refclass130117"><b>GLContext</b></a>, multiplicity : 1</li><li>Java : private <a href="index.html#refclass130117"><b>GLContext</b></a> </li></ul></div>
</div>
-<a name="ref4_128002"></a>
+<a name="refclass128002"></a>
<h2 class ="class">1.20 Class GL3bc</h2>
<p>Declaration :</p><ul>
<li>Java : package interface GL3bc extends <a href="index.html#refclass128453"><b>GL2</b></a> </li><li>Php : interface GL3bc </li></ul><p>Directly inherited by : <a href="index.html#refclass128258"><b>GL4bc</b></a> <a href="index.html#refclass130501"><b>GL4bcImpl</b></a> </p>
@@ -210,7 +210,7 @@ Documentation</title>
<div class="sub">
</div>
</div>
-<a name="ref4_128130"></a>
+<a name="refclass128130"></a>
<h2 class ="class">1.21 Class GL4</h2>
<p>Declaration :</p><ul>
<li>Java : package interface GL4 extends <a href="index.html#refclass128837"><b>GL3</b></a> </li><li>Php : interface GL4 </li></ul><p>Directly inherited by : <a href="index.html#refclass128258"><b>GL4bc</b></a> <a href="index.html#refclass130501"><b>GL4bcImpl</b></a> </p>
@@ -219,7 +219,7 @@ Documentation</title>
<div class="sub">
</div>
</div>
-<a name="ref4_128258"></a>
+<a name="refclass128258"></a>
<h2 class ="class">1.22 Class GL4bc</h2>
<p>Declaration :</p><ul>
<li>Java : package interface GL4bc extends <a href="index.html#refclass128002"><b>GL3bc</b></a> </li><li>Php : interface GL4bc </li></ul><p>Directly inherited by : <a href="index.html#refclass130501"><b>GL4bcImpl</b></a> </p>
@@ -228,7 +228,7 @@ Documentation</title>
<div class="sub">
</div>
</div>
-<a name="ref4_128386"></a>
+<a name="refclass128386"></a>
<h2 class ="class">1.23 Class GL2ES12</h2>
<p>Declaration :</p><ul>
<li>Java : package class GL2ES12 implements <a href="index.html#refclass128197"><b>GL2ES1</b></a>, <a href="index.html#refclass128581"><b>GL2ES2</b></a> </li></ul><p>Stereotype: entity</p>
@@ -236,34 +236,34 @@ Documentation</title>
<div class="sub">
</div>
</div>
-<a name="ref4_134914"></a>
+<a name="refclass134914"></a>
<h2 class ="class">1.24 Class GLES3</h2>
<p>Declaration :</p><ul>
<li>Java : public @interface GLES3 extends <a href="index.html#refclass135042"><b>GL4ES3</b></a> </li></ul><p>Directly inherited by : <a href="index.html#refclass130629"><b>GLES3Impl</b></a> </p>
-<p>Stereotype: @interface</p>
+<p>Stereotype: @interface</p>
<div class="sub">
<div class="sub">
</div>
</div>
-<a name="ref4_135042"></a>
+<a name="refclass135042"></a>
<h2 class ="class">1.25 Class GL4ES3</h2>
<p>Declaration :</p><ul>
<li>Java : public @interface GL4ES3 extends <a href="index.html#refclass135170"><b>GL3ES3</b></a> </li></ul><p>Directly inherited by : <a href="index.html#refclass128130"><b>GL4</b></a> <a href="index.html#refclass134914"><b>GLES3</b></a> </p>
-<p>Stereotype: @interface</p>
+<p>Stereotype: @interface</p>
<div class="sub">
<div class="sub">
</div>
</div>
-<a name="ref4_135170"></a>
+<a name="refclass135170"></a>
<h2 class ="class">1.26 Class GL3ES3</h2>
<p>Declaration :</p><ul>
<li>Java : public @interface GL3ES3 extends <a href="index.html#refmetaclass135298"><b>GL2ES3</b></a> </li></ul><p>Directly inherited by : <a href="index.html#refclass128837"><b>GL3</b></a> <a href="index.html#refclass135042"><b>GL4ES3</b></a> </p>
-<p>Stereotype: @interface</p>
+<p>Stereotype: @interface</p>
<div class="sub">
<div class="sub">
</div>
</div>
-<a name="ref4_135298"></a>
+<a name="refclass135298"></a>
<h2 class ="metaclass">1.27 Metaclass GL2ES3</h2>
<p>Declaration :</p><ul>
<li>Java : package @interface GL2ES3 </li></ul><p>Directly inherited by : <a href="index.html#refclass128709"><b>GL2GL3</b></a> <a href="index.html#refclass135170"><b>GL3ES3</b></a> </p>
diff --git a/doc/uml/html/index_65.html b/doc/uml/html/index_65.html
index ea5554d..12cff3a 100644
--- a/doc/uml/html/index_65.html
+++ b/doc/uml/html/index_65.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@@ -16,8 +16,8 @@
<!-- ============================================================= -->
<table>
-<tr bgcolor="#f0f0f0"><td align="center"><b>Name</b></td><td align="center"><b>Kind</b></td><td align="center"><b>Description</b></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass131013" target = "projectFrame"><b>AbstractGraphicsConfiguration</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td align=center><b>Name</b></td><td align=center><b>Kind</b></td><td align=center><b>Description</b></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass131013" target = "projectFrame"><b>AbstractGraphicsConfiguration</b></a></td><td>class</td><td></td></tr>
</table>
</body>
</html>
diff --git a/doc/uml/html/index_67.html b/doc/uml/html/index_67.html
index 9e6c1ee..6c276a1 100644
--- a/doc/uml/html/index_67.html
+++ b/doc/uml/html/index_67.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@@ -16,9 +16,9 @@
<!-- ============================================================= -->
<table>
-<tr bgcolor="#f0f0f0"><td align="center"><b>Name</b></td><td align="center"><b>Kind</b></td><td align="center"><b>Description</b></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass131269" target = "projectFrame"><b>Capabilities</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#ref0_131525" target = "projectFrame"><b>chosen</b></a></td><td>relation</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td align=center><b>Name</b></td><td align=center><b>Kind</b></td><td align=center><b>Description</b></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass131269" target = "projectFrame"><b>Capabilities</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refrelation131525" target = "projectFrame"><b>chosen</b></a></td><td>relation</td><td></td></tr>
</table>
</body>
</html>
diff --git a/doc/uml/html/index_71.html b/doc/uml/html/index_71.html
index 0e03401..40ba063 100644
--- a/doc/uml/html/index_71.html
+++ b/doc/uml/html/index_71.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@@ -16,31 +16,31 @@
<!-- ============================================================= -->
<table>
-<tr bgcolor="#f0f0f0"><td align="center"><b>Name</b></td><td align="center"><b>Kind</b></td><td align="center"><b>Description</b></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128069" target = "projectFrame"><b>GL</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128453" target = "projectFrame"><b>GL2</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128197" target = "projectFrame"><b>GL2ES1</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128386" target = "projectFrame"><b>GL2ES12</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128581" target = "projectFrame"><b>GL2ES2</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refmetaclass135298" target = "projectFrame"><b>GL2ES3</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128709" target = "projectFrame"><b>GL2GL3</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128837" target = "projectFrame"><b>GL3</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128002" target = "projectFrame"><b>GL3bc</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass135170" target = "projectFrame"><b>GL3ES3</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128130" target = "projectFrame"><b>GL4</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128258" target = "projectFrame"><b>GL4bc</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass130501" target = "projectFrame"><b>GL4bcImpl</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass135042" target = "projectFrame"><b>GL4ES3</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass132549" target = "projectFrame"><b>GLBase</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass131141" target = "projectFrame"><b>GLCapabilities</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass130117" target = "projectFrame"><b>GLContext</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass130245" target = "projectFrame"><b>GLDrawable</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128325" target = "projectFrame"><b>GLES1</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass130757" target = "projectFrame"><b>GLES1Impl</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass128965" target = "projectFrame"><b>GLES2</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass134914" target = "projectFrame"><b>GLES3</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass130629" target = "projectFrame"><b>GLES3Impl</b></a></td><td>class</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass131397" target = "projectFrame"><b>GLProfile</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td align=center><b>Name</b></td><td align=center><b>Kind</b></td><td align=center><b>Description</b></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128069" target = "projectFrame"><b>GL</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128453" target = "projectFrame"><b>GL2</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128197" target = "projectFrame"><b>GL2ES1</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128386" target = "projectFrame"><b>GL2ES12</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128581" target = "projectFrame"><b>GL2ES2</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refmetaclass135298" target = "projectFrame"><b>GL2ES3</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128709" target = "projectFrame"><b>GL2GL3</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128837" target = "projectFrame"><b>GL3</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128002" target = "projectFrame"><b>GL3bc</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass135170" target = "projectFrame"><b>GL3ES3</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128130" target = "projectFrame"><b>GL4</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128258" target = "projectFrame"><b>GL4bc</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130501" target = "projectFrame"><b>GL4bcImpl</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass135042" target = "projectFrame"><b>GL4ES3</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass132549" target = "projectFrame"><b>GLBase</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass131141" target = "projectFrame"><b>GLCapabilities</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130117" target = "projectFrame"><b>GLContext</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130245" target = "projectFrame"><b>GLDrawable</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128325" target = "projectFrame"><b>GLES1</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130757" target = "projectFrame"><b>GLES1Impl</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass128965" target = "projectFrame"><b>GLES2</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass134914" target = "projectFrame"><b>GLES3</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130629" target = "projectFrame"><b>GLES3Impl</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass131397" target = "projectFrame"><b>GLProfile</b></a></td><td>class</td><td></td></tr>
</table>
</body>
</html>
diff --git a/doc/uml/html/index_74.html b/doc/uml/html/index_74.html
index fc3b5bd..9a97033 100644
--- a/doc/uml/html/index_74.html
+++ b/doc/uml/html/index_74.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@@ -16,9 +16,9 @@
<!-- ============================================================= -->
<table>
-<tr bgcolor="#f0f0f0"><td align="center"><b>Name</b></td><td align="center"><b>Kind</b></td><td align="center"><b>Description</b></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#ref18_128069" target = "projectFrame"><b>javax.media.opengl</b></a></td><td>class view</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#ref22_129" target = "projectFrame"><b>jogl</b></a></td><td>package</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td align=center><b>Name</b></td><td align=center><b>Kind</b></td><td align=center><b>Description</b></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass view128069" target = "projectFrame"><b>javax.media.opengl</b></a></td><td>class view</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refpackage129" target = "projectFrame"><b>jogl</b></a></td><td>package</td><td></td></tr>
</table>
</body>
</html>
diff --git a/doc/uml/html/index_78.html b/doc/uml/html/index_78.html
index f9ce21f..4165af5 100644
--- a/doc/uml/html/index_78.html
+++ b/doc/uml/html/index_78.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@@ -16,8 +16,8 @@
<!-- ============================================================= -->
<table>
-<tr bgcolor="#f0f0f0"><td align="center"><b>Name</b></td><td align="center"><b>Kind</b></td><td align="center"><b>Description</b></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#refclass130885" target = "projectFrame"><b>NativeWindow</b></a></td><td>class</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td align=center><b>Name</b></td><td align=center><b>Kind</b></td><td align=center><b>Description</b></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass130885" target = "projectFrame"><b>NativeWindow</b></a></td><td>class</td><td></td></tr>
</table>
</body>
</html>
diff --git a/doc/uml/html/index_79.html b/doc/uml/html/index_79.html
index 24a23e2..751a36a 100644
--- a/doc/uml/html/index_79.html
+++ b/doc/uml/html/index_79.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@@ -16,9 +16,9 @@
<!-- ============================================================= -->
<table>
-<tr bgcolor="#f0f0f0"><td align="center"><b>Name</b></td><td align="center"><b>Kind</b></td><td align="center"><b>Description</b></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#ref10_128069" target = "projectFrame"><b>OpenGL Interfaces - All</b></a></td><td>class diagram</td><td></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#ref10_134786" target = "projectFrame"><b>OpenGL Interfaces - Core Only</b></a></td><td>class diagram</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td align=center><b>Name</b></td><td align=center><b>Kind</b></td><td align=center><b>Description</b></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass diagram128069" target = "projectFrame"><b>OpenGL Interfaces - All</b></a></td><td>class diagram</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refclass diagram134786" target = "projectFrame"><b>OpenGL Interfaces - Core Only</b></a></td><td>class diagram</td><td></td></tr>
</table>
</body>
</html>
diff --git a/doc/uml/html/index_82.html b/doc/uml/html/index_82.html
index fbd61ac..984d8bf 100644
--- a/doc/uml/html/index_82.html
+++ b/doc/uml/html/index_82.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@@ -16,8 +16,8 @@
<!-- ============================================================= -->
<table>
-<tr bgcolor="#f0f0f0"><td align="center"><b>Name</b></td><td align="center"><b>Kind</b></td><td align="center"><b>Description</b></td></tr>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#ref0_131909" target = "projectFrame"><b>requested</b></a></td><td>relation</td><td></td></tr>
+<tr bgcolor=#f0f0f0><td align=center><b>Name</b></td><td align=center><b>Kind</b></td><td align=center><b>Description</b></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refrelation131909" target = "projectFrame"><b>requested</b></a></td><td>relation</td><td></td></tr>
</table>
</body>
</html>
diff --git a/doc/uml/html/navig.html b/doc/uml/html/navig.html
index 66c16e8..7416879 100644
--- a/doc/uml/html/navig.html
+++ b/doc/uml/html/navig.html
@@ -1,14 +1,14 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
-<title>C:/projects/JOGAMP/jogl/doc/uml/html/navig</title>
+<title>/usr/local/projects/JOGL/jogl/doc/uml/html/navig</title>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body bgcolor="#ffffff">
-<hr />
+<p><hr noshade></p>
<p><a href="index.html" target = "projectFrame"><b> -Top- </b></a><a href="classes.html" target = "projectFrame"><b> -Classes- </b></a><a href="packages.html" target = "projectFrame"><b> -Packages- </b></a><a href="classdiagrams.html" target = "projectFrame"><b> -Class Diagrams- </b></a></p>
<p>
</p>
diff --git a/doc/uml/html/packages.html b/doc/uml/html/packages.html
index c3f7af4..50e1a6d 100644
--- a/doc/uml/html/packages.html
+++ b/doc/uml/html/packages.html
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!-- Documentation produced by the Html generator of Bouml (http://bouml.free.fr) -->
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
@@ -16,7 +16,7 @@
<!-- ============================================================= -->
<table>
-<tr bgcolor="#f0f0f0"><td><a href="index.html#ref22_129" target = "projectFrame"><b>jogl</b></a></td><td></td><td></td></tr>
+<tr bgcolor=#f0f0f0><td><a href="index.html#refpackage129" target = "projectFrame"><b>jogl</b></a></td><td></td><td></td></tr>
</table>
</body>
</html>
diff --git a/doc/uml/jogl/128069.diagram b/doc/uml/jogl/128069.diagram
index 7575948..b0ab78b 100644
--- a/doc/uml/jogl/128069.diagram
+++ b/doc/uml/jogl/128069.diagram
@@ -1,137 +1,137 @@
-format 75
+format 74
classcanvas 128002 class_ref 128002 // GL3bc
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode class drawing_language default [...]
- xyz 195.8 800.5 2000
+ xyz 188.4 856.7 2000
end
classcanvas 128069 class_ref 128069 // GL
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode class drawing_language default [...]
- xyz 142.4 112.6 2000
+ xyz 163.4 116 2000
end
classcanvas 128130 class_ref 128130 // GL4
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode class drawing_language default [...]
- xyz 764.5 928.4 2000
+ xyz 786.7 985.3 2000
end
classcanvas 128197 class_ref 128197 // GL2ES1
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode class drawing_language default [...]
- xyz 40.6 226.8 2000
+ xyz 59 234.4 2000
end
classcanvas 128258 class_ref 128258 // GL4bc
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode class drawing_language default [...]
- xyz 195.8 928.9 2000
+ xyz 188.4 985.6 2000
end
classcanvas 128325 class_ref 128325 // GLES1
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode class drawing_language default [...]
- xyz 40 480.3 2000
+ xyz 59.4 492.3 2000
end
classcanvas 128453 class_ref 128453 // GL2
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode class drawing_language default [...]
- xyz 195.3 691.3 2000
+ xyz 188.9 746 2000
end
classcanvas 128581 class_ref 128581 // GL2ES2
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode class drawing_language default [...]
- xyz 274 227.1 2000
+ xyz 294.9 235.5 2000
end
classcanvas 128709 class_ref 128709 // GL2GL3
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode class drawing_language default [...]
- xyz 428.4 389.7 2005
+ xyz 447.2 397.7 2005
end
classcanvas 128837 class_ref 128837 // GL3
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode class drawing_language default [...]
- xyz 595.5 800 2000
+ xyz 615.2 856.2 2000
end
classcanvas 128965 class_ref 128965 // GLES2
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode class drawing_language default [...]
- xyz 274 480.5 2000
+ xyz 294.9 489.6 2000
end
classcanvas 130050 class_ref 134914 // GLES3
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 669.3 480.6 2004
+ xyz 709.2 569.5 2004
end
classcanvas 130178 class_ref 135042 // GL4ES3
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 757 305.5 2000
+ xyz 779 313.3 2000
end
classcanvas 130245 class_ref 130117 // GLContext
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 422.4 23.7 2000
+ xyz 437.1 19.1 2000
end
classcanvas 130434 class_ref 135170 // GL3ES3
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 588.5 273 2009
+ xyz 610.8 282.6 2009
end
classcanvas 130501 class_ref 130245 // GLDrawable
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 686.2 105.3 2000
+ xyz 713.9 91.2 2000
end
classcanvas 130690 class_ref 135298 // GL2ES3
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
color transparent
- xyz 423.5 250.8 2000
+ xyz 444.3 258 2000
end
classcanvas 130885 class_ref 130501 // GL4bcImpl
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 436.2 1048.8 2000
+ xyz 452.1 1088.4 2000
end
classcanvas 131141 class_ref 130757 // GLES1Impl
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 46 574.6 2005
+ xyz 67.4 578.2 2005
end
classcanvas 131202 class_ref 130629 // GLES3Impl
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 682.7 575.1 2000
+ xyz 724.9 656.8 2000
end
textcanvas 131781 "Desktop final public OpenGL Interfaces
"
- xyzwh 820.5 664 2000 135 37
+ xyzwh 851.5 718.6 2000 139 48
textcanvas 131909 "Mobile final public OpenGL Interfaces"
- xyzwh 820 522 2000 125 38
+ xyzwh 851.1 490.8 2000 125 38
textcanvas 132037 "Private implementation (detail)"
- xyzwh 17 1072 2000 178 18
+ xyzwh 17.5 1095.8 2000 178 18
textcanvas 132165 "Desktop/Mobile Common Interfaces"
- xyzwh 819.5 242 2000 129 42
+ xyzwh 851.5 206.6 2000 129 42
classcanvas 132293 class_ref 130885 // NativeWindow
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode class drawing_language default [...]
- xyz 1021.8 200.8 2000
+ xyz 1052.2 170 2000
end
classcanvas 132421 class_ref 131013 // AbstractGraphicsConfiguration
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 972.2 295.8 2000
+ xyz 994.6 261.2 2000
end
classcanvas 132549 class_ref 131141 // GLCapabilities
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 1019.6 478.9 2000
+ xyz 1051 444.7 2000
end
classcanvas 132677 class_ref 131269 // Capabilities
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 1028.1 395.5 2005
+ xyz 1061 361.9 2005
end
classcanvas 132805 class_ref 131397 // GLProfile
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 1036.8 582.6 2000
+ xyz 1069.2 548.6 2000
end
textcanvas 135749 "Lifecycle: From the lower right to the top, left step where the GLContext is created with a suitable GL implementation matching the GLProfile."
- xyzwh 781 16 2000 208 93
+ xyzwh 845.2 10.6 2000 208 93
classcanvas 135877 class_ref 132549 // GLBase
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode class drawing_language default [...]
- xyz 144 12.6 2000
+ xyz 164.9 7.5 2000
end
textcanvas 136261 "Common GL Stuff"
- xyzwh 271 135.5 2000 108 17
+ xyzwh 271.2 135.4 2000 108 17
fragment 136517 "Programmable Shader"
- color blue xyzwh 236.4 195.8 1994 709 972
- separator 2748
- separator 4543
- separator 1893
+ color blue xyzwh 237.5 195.6 1994 744 972
+ separator 2892
+ separator 5265
+ separator 2006
end
fragment 136645 "Fixed Function"
- color lightgray xyzwh 2 195.8 1989 236 972
- separator 2746
- separator 4546
- separator 1888
+ color lightgray xyzwh 2.7 195.6 1989 236 972
+ separator 2890
+ separator 5270
+ separator 2001
end
textcanvas 136773 "Common Desktop Profile"
- xyzwh 820.5 402.5 2000 115 39
+ xyzwh 851.1 401.6 2000 115 39
relationcanvas 128386 relation_ref 128002 // <realization>
from ref 130885 z 2001 to ref 128002
no_role_a no_role_b
@@ -225,7 +225,7 @@ end
relationcanvas 130629 relation_ref 130501 // <association>
from ref 130501 z 1999 to ref 130245
no_role_a no_role_b
- multiplicity_a_pos 514 67 3000 multiplicity_b_pos 660 122 3000
+ multiplicity_a_pos 533 61 3000 multiplicity_b_pos 694 110 3000
end
relationcanvas 130818 relation_ref 136066 // <generalisation>
from ref 130434 z 2010 to ref 130690
@@ -272,6 +272,11 @@ relationcanvas 132226 relation_ref 137218 // <realization>
no_role_a no_role_b
no_multiplicity_a no_multiplicity_b
end
+relationcanvas 132354 relation_ref 143746 // <generalisation>
+ from ref 130050 z 2005 to ref 128965
+ no_role_a no_role_b
+ no_multiplicity_a no_multiplicity_b
+end
relationcanvas 132933 relation_ref 131141 // <generalisation>
from ref 132549 z 1999 to ref 132677
no_role_a no_role_b
@@ -281,8 +286,8 @@ relationcanvas 133061 relation_ref 131269 // <association>
decenter_begin 326
decenter_end 104
from ref 132421 z 1999 to ref 132677
- role_a_pos 1043 373 3000 no_role_b
- multiplicity_a_pos 1015 373 3000 no_multiplicity_b
+ role_a_pos 1080 336 3000 no_role_b
+ multiplicity_a_pos 1052 336 3000 no_multiplicity_b
end
relationcanvas 133701 relation_ref 131525 // <association>
decenter_begin 493
@@ -304,8 +309,8 @@ relationcanvas 134213 relation_ref 131397 // <association>
decenter_begin 814
decenter_end 625
from ref 132677 z 1999 to ref 132421
- no_role_a role_b_pos 1115 373 3000
- no_multiplicity_a multiplicity_b_pos 1080 373 3000
+ no_role_a role_b_pos 1146 336 3000
+ no_multiplicity_a multiplicity_b_pos 1118 336 3000
end
relationcanvas 134725 relation_ref 131781 // <association>
from ref 132805 z 1999 to ref 132549
@@ -320,6 +325,6 @@ end
relationcanvas 136133 relation_ref 133189 // <association>
from ref 135877 z 1999 to ref 130245
no_role_a no_role_b
- multiplicity_a_pos 397 51 3000 multiplicity_b_pos 248 51 3000
+ multiplicity_a_pos 418 49 3000 multiplicity_b_pos 272 49 3000
end
end
diff --git a/doc/uml/jogl/134786.diagram b/doc/uml/jogl/134786.diagram
index eaac88d..ea3909c 100644
--- a/doc/uml/jogl/134786.diagram
+++ b/doc/uml/jogl/134786.diagram
@@ -1,104 +1,104 @@
-format 75
+format 74
classcanvas 128069 class_ref 128069 // GL
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode class drawing_language default [...]
- xyz 143.8 112.2 2000
+ xyz 162.3 120.7 2000
end
classcanvas 128130 class_ref 128130 // GL4
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode class drawing_language default [...]
- xyz 642.5 851.8 2000
+ xyz 664.1 879.8 2000
end
classcanvas 128581 class_ref 128581 // GL2ES2
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode class drawing_language default [...]
- xyz 143 238.2 2000
+ xyz 162.5 246.7 2000
end
classcanvas 128709 class_ref 128709 // GL2GL3
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode class drawing_language default [...]
color transparent
- xyz 298.6 414.4 2005
+ xyz 317.6 413.1 2005
end
classcanvas 128837 class_ref 128837 // GL3
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode class drawing_language default [...]
- xyz 462.8 708 2000
+ xyz 481.8 774.1 2000
end
classcanvas 128965 class_ref 128965 // GLES2
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode class drawing_language default [...]
- xyz 143 506.5 2000
+ xyz 162.5 500.2 2000
end
classcanvas 130050 class_ref 134914 // GLES3
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 537.9 508.6 2004
+ xyz 581.8 586.1 2004
end
classcanvas 130178 class_ref 135042 // GL4ES3
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 635 316 2000
+ xyz 657.5 324.5 2000
end
classcanvas 130245 class_ref 130117 // GLContext
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 422.4 23.6 2000
+ xyz 436.9 27.6 2000
end
classcanvas 130434 class_ref 135170 // GL3ES3
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 456.8 284.9 2009
+ xyz 474.8 292.4 2009
end
classcanvas 130501 class_ref 130245 // GLDrawable
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 686.9 105.8 2000
+ xyz 703.9 109.8 2000
end
classcanvas 130690 class_ref 135298 // GL2ES3
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
color transparent
- xyz 292 261.2 2000
+ xyz 312.3 269.2 2000
end
classcanvas 130885 class_ref 130501 // GL4bcImpl
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 652.3 966.6 2000
+ xyz 672.3 990.3 2000
end
classcanvas 131202 class_ref 130629 // GLES3Impl
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 552 586 2000
+ xyz 596.1 689.3 2000
end
textcanvas 131909 "Mobile final public OpenGL Interfaces"
- xyzwh 817 530 2000 153 42
+ xyzwh 817.8 496.2 2000 153 42
textcanvas 132165 "Desktop/Mobile Common Interfaces"
- xyzwh 817 257 2000 139 49
+ xyzwh 817.4 215.1 2000 139 49
classcanvas 132293 class_ref 130885 // NativeWindow
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode class drawing_language default [...]
- xyz 1021.7 200.8 2000
+ xyz 1040.2 208.3 2000
end
fragment 132354 "Programmable Shader"
- color blue xyzwh 10 206.8 1994 940 836
- separator 5296
+ color blue xyzwh 9.5 206.8 1994 940 836
+ separator 6384
separator 3351
- separator 2308
+ separator 2367
end
classcanvas 132421 class_ref 131013 // AbstractGraphicsConfiguration
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 972.1 295.3 2000
+ xyz 982.2 299.3 2000
end
textcanvas 132482 "Desktop final public OpenGL Interfaces
"
- xyzwh 817 681 2000 135 37
+ xyzwh 817 749.1 2000 135 37
classcanvas 132549 class_ref 131141 // GLCapabilities
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 1019.9 478.3 2000
+ xyz 1039.4 482.8 2000
end
classcanvas 132677 class_ref 131269 // Capabilities
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 1028.4 395 2005
+ xyz 1049.4 399 2005
end
classcanvas 132805 class_ref 131397 // GLProfile
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language defau [...]
- xyz 1036.4 581.1 2000
+ xyz 1057.5 585.1 2000
end
textcanvas 135749 "Lifecycle: From the lower right to the top, left step where the GLContext is created with a suitable GL implementation matching the GLProfile."
- xyzwh 782 16 2000 208 93
+ xyzwh 853.9 16 2000 208 93
classcanvas 135877 class_ref 132549 // GLBase
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode class drawing_language default [...]
- xyz 143.9 12.2 2000
+ xyz 162.4 15.7 2000
end
textcanvas 136261 "Common GL Stuff"
- xyzwh 271 135 2000 108 17
+ xyzwh 271 135.5 2000 108 17
relationcanvas 128770 relation_ref 128386 // <realization>
decenter_begin 479
from ref 130885 z 2001 to ref 128130
@@ -138,7 +138,7 @@ end
relationcanvas 130629 relation_ref 130501 // <association>
from ref 130501 z 1999 to ref 130245
no_role_a no_role_b
- multiplicity_a_pos 514 67 3000 multiplicity_b_pos 660 122 3000
+ multiplicity_a_pos 532 72 3000 multiplicity_b_pos 684 126 3000
end
relationcanvas 130818 relation_ref 136066 // <generalisation>
from ref 130434 z 2010 to ref 130690
@@ -180,6 +180,11 @@ relationcanvas 132226 relation_ref 137218 // <realization>
no_role_a no_role_b
no_multiplicity_a no_multiplicity_b
end
+relationcanvas 132610 relation_ref 143746 // <generalisation>
+ from ref 130050 z 2005 to ref 128965
+ no_role_a no_role_b
+ no_multiplicity_a no_multiplicity_b
+end
relationcanvas 132933 relation_ref 131141 // <generalisation>
from ref 132549 z 1999 to ref 132677
no_role_a no_role_b
@@ -189,8 +194,8 @@ relationcanvas 133061 relation_ref 131269 // <association>
decenter_begin 326
decenter_end 104
from ref 132421 z 1999 to ref 132677
- role_a_pos 1043 373 3000 no_role_b
- multiplicity_a_pos 1015 373 3000 no_multiplicity_b
+ role_a_pos 1068 374 3000 no_role_b
+ multiplicity_a_pos 1040 374 3000 no_multiplicity_b
end
relationcanvas 133701 relation_ref 131525 // <association>
decenter_begin 493
@@ -212,8 +217,8 @@ relationcanvas 134213 relation_ref 131397 // <association>
decenter_begin 814
decenter_end 625
from ref 132677 z 1999 to ref 132421
- no_role_a role_b_pos 1115 373 3000
- no_multiplicity_a multiplicity_b_pos 1080 373 3000
+ no_role_a role_b_pos 1134 374 3000
+ no_multiplicity_a multiplicity_b_pos 1106 374 3000
end
relationcanvas 134725 relation_ref 131781 // <association>
from ref 132805 z 1999 to ref 132549
@@ -228,6 +233,6 @@ end
relationcanvas 136133 relation_ref 133189 // <association>
from ref 135877 z 1999 to ref 130245
no_role_a no_role_b
- multiplicity_a_pos 397 51 3000 multiplicity_b_pos 248 51 3000
+ multiplicity_a_pos 417 57 3000 multiplicity_b_pos 270 57 3000
end
end
diff --git a/doc/uml/jogl/2.session b/doc/uml/jogl/2.session
index d8aaad5..f2e91bf 100644
--- a/doc/uml/jogl/2.session
+++ b/doc/uml/jogl/2.session
@@ -1,16 +1,15 @@
-window_sizes 1898 1332 450 1344 884 38
+window_sizes 1920 1060 450 1464 982 0
+windows_style
diagrams
- active classdiagram_ref 128069 // OpenGL Interfaces - All
- 1442 1217 100 17 0 0
- classdiagram_ref 134786 // OpenGL Interfaces - Core Only
- 1149 974 100 17 0 0
+ classdiagram_ref 128069 // OpenGL Interfaces - All
+ 1463 849 100 17 253 0
+ active classdiagram_ref 134786 // OpenGL Interfaces - Core Only
+ 1464 982 100 17 0 0
end
show_stereotypes
selected
package_ref 129 // jogl
open
- class_ref 128837 // GL3
- class_ref 130501 // GL4bcImpl
- class_ref 130629 // GLES3Impl
+ class_ref 134914 // GLES3
end
end
diff --git a/doc/uml/jogl/generation_settings b/doc/uml/jogl/generation_settings
index e66b845..6e7065d 100644
--- a/doc/uml/jogl/generation_settings
+++ b/doc/uml/jogl/generation_settings
@@ -110,7 +110,7 @@ ${items}
cpp_default_operation_definition "${comment}${inline}${type} ${class}::${name}${(}${)}${const}${volatile}${throw}${staticnl}{
${body}}
"
- cpp_indent_visibility " "java_default_src_content "${comment}
+ java_default_src_content "${comment}
${package}
${imports}
${definition}"
diff --git a/doc/uml/jogl/jogl.prj b/doc/uml/jogl/jogl.prj
index 8efc4be..3e64cb4 100644
--- a/doc/uml/jogl/jogl.prj
+++ b/doc/uml/jogl/jogl.prj
@@ -1,7 +1,7 @@
-format 75
+format 74
"jogl"
- revision 14
- modified_by 2 "sven"
+ revision 15
+ modified_by 2 "qun"
@@ -31,15 +31,13 @@ format 75
show_infonote yes drawing_language uml show_stereotype_properties no
class_color yellow duration_color transparent continuation_color gray note_color blue fragment_color transparent subject_color transparent usecase_color yellow package_color transparent component_color green artifact_color green deploymentnode_color gray state_color yellow stateaction_color transparent activity_color transparent activityregion_color transparent activitypartition_color transparent activityaction_color transparent parameterpin_color white
- font_size 10
+ font_size 7
diagram_format A4
- image_root_dir ""
-
mark_for_import
ncouples 1
- key "html dir" value "C:/projects/JOGAMP/jogl/doc/uml/html-svg/"
+ key "html dir" value "/usr/local/projects/JOGL/jogl/doc/uml/html/"
classview 128069 "javax.media.opengl"
//class diagram settings
draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language def [...]
@@ -764,6 +762,14 @@ ${members}}
classrelation_ref 135810 // <generalisation>
b parent class_ref 135042 // GL4ES3
end
+
+ classrelation 143746 // <generalisation>
+ relation 143746 ---|>
+ a public
+ java "${type}"
+ classrelation_ref 143746 // <generalisation>
+ b parent class_ref 128965 // GLES2
+ end
end
class 135042 "GL4ES3"
diff --git a/jnlp-files/jogl-applet-bug816_glcanvas01.html b/jnlp-files/jogl-applet-bug816_glcanvas01.html
new file mode 100644
index 0000000..c460ff1
--- /dev/null
+++ b/jnlp-files/jogl-applet-bug816_glcanvas01.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>Bug816 OSX CALayer Pos - Custom Bounds</title>
+</head>
+<body BGCOLOR="#ffffff">
+
+<P>
+Bug816 OSX CALayer Pos - Custom Bounds
+</P>
+
+<P>
+<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
+ width="800" height="600">
+ <param name="code" value="com.jogamp.opengl.test.junit.jogl.demos.es2.awt.Bug816AppletGLCanvas01">
+ <param name="archive" value="jar/lib/gluegen-rt.jar,
+ jar/lib/jogl-all.jar,
+ jar/jogl-test.jar">
+ <comment>
+ <embed code="com.jogamp.opengl.test.junit.jogl.demos.es2.awt.Bug816AppletGLCanvas01"
+ width="800" height="600"
+ type="application/x-java-applet;version=1.6"
+ archive="jar/gluegen-rt.jar,
+ jar/jogl-all.jar,
+ jar/jogl-test.jar">
+ <noembed>Sorry, no Java support detected.</noembed>
+ </embed>
+ </comment>
+</object>
+</P>
+</body>
+</html>
diff --git a/jnlp-files/jogl-applet-bug816_glcanvas02a.html b/jnlp-files/jogl-applet-bug816_glcanvas02a.html
new file mode 100644
index 0000000..79fb22d
--- /dev/null
+++ b/jnlp-files/jogl-applet-bug816_glcanvas02a.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>Bug816 OSX CALayer Pos - Box Layout</title>
+</head>
+<body BGCOLOR="#ffffff">
+
+<P>
+Bug816 OSX CALayer Pos - Box Layout
+</P>
+
+<P>
+<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
+ width="664" height="364">
+ <param name="code" value="com.jogamp.opengl.test.junit.jogl.demos.es2.awt.Bug816AppletGLCanvas02a">
+ <param name="archive" value="jar/lib/gluegen-rt.jar,
+ jar/lib/jogl-all.jar,
+ jar/jogl-test.jar">
+ <comment>
+ <embed code="com.jogamp.opengl.test.junit.jogl.demos.es2.awt.Bug816AppletGLCanvas02a"
+ width="664" height="364"
+ type="application/x-java-applet;version=1.6"
+ archive="jar/gluegen-rt.jar,
+ jar/jogl-all.jar,
+ jar/jogl-test.jar">
+ <noembed>Sorry, no Java support detected.</noembed>
+ </embed>
+ </comment>
+</object>
+</P>
+</body>
+</html>
diff --git a/jnlp-files/jogl-applet-bug816_glcanvas02b.html b/jnlp-files/jogl-applet-bug816_glcanvas02b.html
new file mode 100644
index 0000000..eb05e84
--- /dev/null
+++ b/jnlp-files/jogl-applet-bug816_glcanvas02b.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>Bug816 OSX CALayer Pos - Grid Layout</title>
+</head>
+<body BGCOLOR="#ffffff">
+
+<P>
+Bug816 OSX CALayer Pos - Grid Layout
+</P>
+
+<P>
+<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
+ width="664" height="364">
+ <param name="code" value="com.jogamp.opengl.test.junit.jogl.demos.es2.awt.Bug816AppletGLCanvas02b">
+ <param name="archive" value="jar/lib/gluegen-rt.jar,
+ jar/lib/jogl-all.jar,
+ jar/jogl-test.jar">
+ <comment>
+ <embed code="com.jogamp.opengl.test.junit.jogl.demos.es2.awt.Bug816AppletGLCanvas02b"
+ width="664" height="364"
+ type="application/x-java-applet;version=1.6"
+ archive="jar/gluegen-rt.jar,
+ jar/jogl-all.jar,
+ jar/jogl-test.jar">
+ <noembed>Sorry, no Java support detected.</noembed>
+ </embed>
+ </comment>
+</object>
+</P>
+</body>
+</html>
diff --git a/jnlp-files/jogl-applet-bug816_layerpos03a.html b/jnlp-files/jogl-applet-bug816_layerpos03a.html
new file mode 100644
index 0000000..432a2b3
--- /dev/null
+++ b/jnlp-files/jogl-applet-bug816_layerpos03a.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>Bug816 OSX CALayer Pos - Applet w/ 1 JRootPanes and 2 JSplitPanes</title>
+</head>
+<body BGCOLOR="#ffffff">
+
+<P>
+Bug816 OSX CALayer Pos - AWT Applet w/ 1 JRootPanes and 2 JSplitPanes
+</P>
+
+<P>
+<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
+ width="640" height="480">
+ <param name="code" value="com.jogamp.opengl.test.junit.jogl.demos.es2.awt.Bug816AppletOSXCALayerPos03a">
+ <param name="archive" value="jar/lib/gluegen-rt.jar,
+ jar/lib/jogl-all.jar,
+ jar/jogl-test.jar">
+ <comment>
+ <embed code="com.jogamp.opengl.test.junit.jogl.demos.es2.awt.Bug816AppletOSXCALayerPos03a"
+ width="640" height="480"
+ type="application/x-java-applet;version=1.6"
+ archive="jar/gluegen-rt.jar,
+ jar/jogl-all.jar,
+ jar/jogl-test.jar">
+ <noembed>Sorry, no Java support detected.</noembed>
+ </embed>
+ </comment>
+</object>
+</P>
+</body>
+</html>
diff --git a/jnlp-files/jogl-applet-bug816_layerpos03b.html b/jnlp-files/jogl-applet-bug816_layerpos03b.html
new file mode 100644
index 0000000..43b13a8
--- /dev/null
+++ b/jnlp-files/jogl-applet-bug816_layerpos03b.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>Bug816 OSX CALayer Pos - JApplet w/ 2 JRootPanes and 2 JSplitPanes</title>
+</head>
+<body BGCOLOR="#ffffff">
+
+<P>
+Bug816 OSX CALayer Pos - Swing JApplet w/ 2 JRootPanes and 2 JSplitPanes
+</P>
+
+<P>
+<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
+ width="640" height="480">
+ <param name="code" value="com.jogamp.opengl.test.junit.jogl.demos.es2.awt.Bug816AppletOSXCALayerPos03b">
+ <param name="archive" value="jar/lib/gluegen-rt.jar,
+ jar/lib/jogl-all.jar,
+ jar/jogl-test.jar">
+ <comment>
+ <embed code="com.jogamp.opengl.test.junit.jogl.demos.es2.awt.Bug816AppletOSXCALayerPos03b"
+ width="640" height="480"
+ type="application/x-java-applet;version=1.6"
+ archive="jar/gluegen-rt.jar,
+ jar/jogl-all.jar,
+ jar/jogl-test.jar">
+ <noembed>Sorry, no Java support detected.</noembed>
+ </embed>
+ </comment>
+</object>
+</P>
+</body>
+</html>
diff --git a/jnlp-files/jogl-applet-bug818_gljpanel01.html b/jnlp-files/jogl-applet-bug818_gljpanel01.html
new file mode 100644
index 0000000..84e612d
--- /dev/null
+++ b/jnlp-files/jogl-applet-bug818_gljpanel01.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>Bug818 OSX GLJPanel NV GT330 Crash</title>
+</head>
+<body BGCOLOR="#ffffff">
+
+<P>
+Bug818 OSX GLJPanel NV GT330 Crash
+</P>
+
+<P>
+<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
+ width="750" height="350">
+ <param name="code" value="com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.Bug818GLJPanelApplet">
+ <param name="archive" value="jar/lib/gluegen-rt.jar,
+ jar/lib/jogl-all.jar,
+ jar/jogl-test.jar">
+ <param name="java_arguments" value="-Xms128M -Xmx512M -Dsun.java2d.noddraw=true"/>
+ <comment>
+ <embed code="com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.Bug818GLJPanelApplet"
+ width="750" height="350"
+ type="application/x-java-applet;version=1.6"
+ archive="jar/gluegen-rt.jar,
+ jar/jogl-all.jar,
+ jar/jogl-test.jar"
+ java_arguments="-Xms128M -Xmx512M -Dsun.java2d.noddraw=true">
+ <noembed>Sorry, no Java support detected.</noembed>
+ </embed>
+ </comment>
+</object>
+</P>
+</body>
+</html>
diff --git a/jnlp-files/jogl-applet-bug848_glcanvas01.html b/jnlp-files/jogl-applet-bug848_glcanvas01.html
new file mode 100644
index 0000000..99fa6aa
--- /dev/null
+++ b/jnlp-files/jogl-applet-bug848_glcanvas01.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>Bug 848: Applet on OSX w/ CALayer and 2 or more GLCanvas may crash</title>
+</head>
+<body BGCOLOR="#ffffff">
+
+<P>
+Bug 848: Applet on OSX w/ CALayer and 2 or more GLCanvas may 'crash'.
+</P>
+
+<P>
+<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
+ width="1024" height="664">
+ <param name="code" value="com.jogamp.opengl.test.junit.jogl.demos.es2.awt.Bug848AppletGLCanvas01">
+ <param name="archive" value="jar/lib/gluegen-rt.jar,
+ jar/lib/jogl-all.jar,
+ jar/jogl-test.jar">
+ <comment>
+ <embed code="com.jogamp.opengl.test.junit.jogl.demos.es2.awt.Bug848AppletGLCanvas01"
+ width="1024" height="664"
+ type="application/x-java-applet;version=1.6"
+ archive="jar/gluegen-rt.jar,
+ jar/jogl-all.jar,
+ jar/jogl-test.jar">
+ <noembed>Sorry, no Java support detected.</noembed>
+ </embed>
+ </comment>
+</object>
+</P>
+</body>
+</html>
diff --git a/jnlp-files/jogl-applet-runner-newt-GraphTextDemo01b-napplet.html b/jnlp-files/jogl-applet-runner-newt-GraphTextDemo01b-napplet.html
new file mode 100644
index 0000000..c4c9494
--- /dev/null
+++ b/jnlp-files/jogl-applet-runner-newt-GraphTextDemo01b-napplet.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>JOGL Graph Text Demo 01b (NApplet)</title>
+</head>
+<body BGCOLOR="#ffffff">
+
+<P>
+JOGL Graph Text Demo 01b (w/ atomic/jogl-fonts-p0.jar in path)
+</P>
+
+<P>
+<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
+ width="800" height="400">
+ <param name="code" value="com.jogamp.newt.awt.applet.JOGLNewtApplet1Run">
+ <param name="archive" value="jar/gluegen-rt.jar,
+ jar/jogl-all.jar,
+ jar/atomic/jogl-fonts-p0.jar,
+ jar/jogl-test.jar">
+ <param name="java_arguments" value="-Dsun.java2d.noddraw=true">
+ <param name="gl_event_listener_class" value="com.jogamp.opengl.test.junit.graph.demos.GPUTextGLListener0A">
+ <param name="gl_profile" value="GL2ES2">
+ <param name="gl_swap_interval" value="1">
+ <param name="gl_alpha" value="4">
+ <param name="gl_multisamplebuffer" value="4">
+ <param name="gl_nodefaultkeyListener" value="true">
+ <param name="gl_debug" value="false">
+ <param name="gl_trace" value="false">
+ <comment>
+ <embed code="com.jogamp.newt.awt.applet.JOGLNewtApplet1Run"
+ width="800" height="400"
+ type="application/x-java-applet;version=1.6"
+ pluginspage="http://java.sun.com/javase/downloads/ea.jsp"
+ archive="jar/gluegen-rt.jar,
+ jar/jogl-all.jar,
+ jar/atomic/jogl-fonts-p0.jar,
+ jar/jogl-test.jar"
+ java_arguments="-Dsun.java2d.noddraw=true"
+ gl_event_listener_class="com.jogamp.opengl.test.junit.graph.demos.GPUTextGLListener0A"
+ gl_profile="GL2ES2"
+ gl_swap_interval="1"
+ gl_alpha="4"
+ gl_multisamplebuffer="4"
+ gl_nodefaultkeyListener="true"
+ gl_debug="false"
+ gl_trace="false">
+ <noembed>Sorry, no Java support detected.</noembed>
+ </embed>
+ </comment>
+</object>
+</P>
+
+<P>
+Graph Text Demo Keys:<br>
+<ul>
+ <li> 1/2 - zoom in/out red-text </li>
+ <li> 6/7 - edit texture size if using VBAA (nope) </li>
+ <li> 0/9 - rotate the red-text </li>
+ <li> v - toggle vsync </li>
+ <li> i - live text input (CR ends it, backspace supported)</li>
+ <li> f - toggle fps </li>
+ <li> h - change text</li>
+ <li> space - change font</li>
+</ul>
+</P>
+
+</body>
+</html>
diff --git a/jnlp-files/jogl-applet-runner-newt-MovieCube-napplet.html b/jnlp-files/jogl-applet-runner-newt-MovieCube-napplet.html
index 64806e5..5dc77f0 100644
--- a/jnlp-files/jogl-applet-runner-newt-MovieCube-napplet.html
+++ b/jnlp-files/jogl-applet-runner-newt-MovieCube-napplet.html
@@ -49,14 +49,20 @@ JogAmp's MovieCube - GLMediaPlayer Demo 01
<P>
MovieCube Keys:<br>
<ul>
- <li> Cursor-Left - bwd 1s</li>
- <li> Cursor-Up - fwd 10s</li>
- <li> Cursor-Right - fwd 1s</li>
- <li> Cursor-Down - bwd 10s</li>
- <li> Escape - Restart w/ normal speed</li>
- <li> Space - Toggle Pause</li>
- <li> S - Half Speed</li>
- <li> F - Double Speed</li>
+ <li> BWD / FWD:
+ <ul>
+ <li> 01s - Cursor left/right</li>
+ <li> 10s - Cursor down/up</li>
+ <li> 30s - Page down/up</li>
+ </ul></li>
+ <li> Speed:
+ <ul>
+ <li> Pause - Space bar</li>
+ <li> Half - Keypad minus</li>
+ <li> Double - Keypad plus</li>
+ <li> Reset - Keypad multiply</li>
+ </ul></li>
+ <li> Mute - M</li>
</ul>
</P>
<P>
diff --git a/jnlp-files/jogl-applet-runner-newt-MovieCube.html b/jnlp-files/jogl-applet-runner-newt-MovieCube.html
index caaeba3..a154eb8 100644
--- a/jnlp-files/jogl-applet-runner-newt-MovieCube.html
+++ b/jnlp-files/jogl-applet-runner-newt-MovieCube.html
@@ -66,14 +66,20 @@ JogAmp's MovieCube - GLMediaPlayer Demo 01
<P>
MovieCube Keys:<br>
<ul>
- <li> Cursor-Left - bwd 1s</li>
- <li> Cursor-Up - fwd 10s</li>
- <li> Cursor-Right - fwd 1s</li>
- <li> Cursor-Down - bwd 10s</li>
- <li> Escape - Restart w/ normal speed</li>
- <li> Space - Toggle Pause</li>
- <li> S - Half Speed</li>
- <li> F - Double Speed</li>
+ <li> BWD / FWD:
+ <ul>
+ <li> 01s - Cursor left/right</li>
+ <li> 10s - Cursor down/up</li>
+ <li> 30s - Page down/up</li>
+ </ul></li>
+ <li> Speed:
+ <ul>
+ <li> Pause - Space bar</li>
+ <li> Half - Keypad minus</li>
+ <li> Double - Keypad plus</li>
+ <li> Reset - Keypad multiply</li>
+ </ul></li>
+ <li> Mute - M</li>
</ul>
</P>
<P>
diff --git a/jnlp-files/jogl-applet-runner-newt.jnlp b/jnlp-files/jogl-applet-runner-newt.jnlp
index c33e1b7..d53febd 100644
--- a/jnlp-files/jogl-applet-runner-newt.jnlp
+++ b/jnlp-files/jogl-applet-runner-newt.jnlp
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<jnlp href="jogl-applet-runner-newt.jnlp">
+<jnlp codebase="JOGL_CODEBASE_TAG/"
+ href="jogl-applet-runner-newt.jnlp" version="JOGAMP_VERSION">
<information>
<title>JOGL JNLP Applet Runner NEWT</title>
<vendor>JogAmp Community</vendor>
diff --git a/jnlp-files/jogl-test-applets.html b/jnlp-files/jogl-test-applets.html
index 132945e..3ac2d59 100644
--- a/jnlp-files/jogl-test-applets.html
+++ b/jnlp-files/jogl-test-applets.html
@@ -127,10 +127,12 @@ See Legend below table
</td>
<td>
<a href="jogl-applet-runner-newt-GraphTextDemo01.html">Dual</a><br/>
- <a href="jogl-applet-runner-newt-GraphTextDemo01-napplet.html">NApplet</a><br/>
+ <a href="jogl-applet-runner-newt-GraphTextDemo01-napplet.html">NApplet</a>
+ (<a href="jogl-applet-runner-newt-GraphTextDemo01b-napplet.html">cp-fonts</a>)<br/>
</td>
<td>
- GPU accelerated Text Demo using JOGL's new Graph package.
+ GPU accelerated Text Demo using JOGL's new Graph package.<br/>
+ <small><i>cp-fonts</i> fonts via classpath, otherwise via URI</small>.
</td>
</tr>
<tr>
@@ -198,6 +200,27 @@ Click on the <i>Launch</i> link to actually launch the demo.<br/>
</tbody></table>
</div>
+<div style="font : 15px sans;">
+<p>
+Misc tests:
+<ul>
+ <li>Bug 816 - OSX CALayer Positioning Bug
+ <ul>
+ <li><a href="jogl-applet-bug816_glcanvas01.html">01: Custom bounds within applet</a></li>
+ <li><a href="jogl-applet-bug816_glcanvas02a.html">02a: Box layout within applet</a></li>
+ <li><a href="jogl-applet-bug816_glcanvas02b.html">02b: Grid layout within applet</a></li>
+ <li><a href="jogl-applet-bug816_layerpos03a.html">03a: Applet w/ 1 JRootPanes and 2 JSplitPanes</a></li>
+ <li><a href="jogl-applet-bug816_layerpos03b.html">03b: JApplet w/ 2 JRootPanes and 2 JSplitPanes</a></li>
+ </ul></li>
+ <li>Misc Issues
+ <ul>
+ <li><a href="jogl-applet-bug818_gljpanel01.html">Bug 818: OSX 10.6.8 NV GT 330M GLJPanel Crash</a></li>
+ <li><a href="jogl-applet-bug848_glcanvas01.html">Bug 848: Applet on OSX w/ CALayer and 2 or more GLCanvas may crash</a></li>
+ </ul></li>
+</ul>
+</p>
+</div>
+
</div> <!-- text -->
</div> <!-- main -->
diff --git a/make/build-common.xml b/make/build-common.xml
index 2061d55..6583593 100644
--- a/make/build-common.xml
+++ b/make/build-common.xml
@@ -36,6 +36,7 @@
-->
<target name="set.debug">
<property name="c.compiler.debug" value="true" />
+ <property name="c.compiler.optimise" value="none" />
<property name="javacdebug" value="true" />
<property name="javacdebuglevel" value="source,lines,vars" />
</target>
@@ -44,6 +45,9 @@
<target name="common.init" depends="jogamp.env.init, gluegen.cpptasks.detect.os" unless="common.init.done">
<property name="common.init.done" value="true" />
+ <property name="c.compiler.debug" value="false" />
+ <property name="c.compiler.optimise" value="none" />
+
<!-- Set the project root directory to be up one directory. -->
<property name="project.root" value=".." />
<property name="build" value="${project.root}/${rootrel.build}" />
@@ -216,6 +220,7 @@
<property name="jogl.build.xml" value="${jogl.make}/build-jogl.xml" />
<property name="build.jogl" value="${build}/jogl" />
<property name="obj.jogl" value="${build.jogl}/obj"/>
+ <property name="rootrel.obj.jogl" value="${rootrel.build}/jogl/obj"/>
<property name="newt.make" value="." />
<property name="newt.build.xml" value="${newt.make}/build-newt.xml" />
@@ -275,6 +280,7 @@
<property name="jogl-glmobile-dbg.jar" value="${build.jogl}/jogl-glmobile-dbg.jar" />
<property name="jogl-util.jar" value="${build.jogl}/jogl-util.jar" />
<property name="jogl-util-graph.jar" value="${build.jogl}/jogl-util-graph.jar" />
+ <property name="jogl-util-graph-fonts-p0.jar" value="${build.jogl}/jogl-fonts-p0.jar" />
<property name="jogl-util-fixedfuncemu.jar" value="${build.jogl}/jogl-util-fixedfuncemu.jar" />
<property name="jogl-awt.jar" value="${build.jogl}/jogl-awt.jar" />
<property name="jogl-swt.jar" value="${build.jogl}/jogl-swt.jar" />
diff --git a/make/build-jogl.xml b/make/build-jogl.xml
index 835e302..28b738b 100644
--- a/make/build-jogl.xml
+++ b/make/build-jogl.xml
@@ -243,6 +243,7 @@
<!-- The compiler output directories. -->
<property name="classes" value="${build.jogl}/classes" />
<property name="obj.joglsub" value="${obj.jogl}/jogl" />
+ <property name="rootrel.obj.joglsub" value="${rootrel.obj.jogl}/jogl"/>
<property name="obj.cgsub" value="${obj.jogl}/cg" />
<property name="javah.classpath" value="${gluegen-rt.jar}:${build.nativewindow}/classes:${classes}" />
@@ -601,11 +602,24 @@
</target>
<target name="java.generate.gles3">
- <echo message="Generating GLES3 interface and implementation" />
+ <echo message="Generating GLES3 interface" />
<antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${stub.includes.opengl}/gles3.c"
outputRootDir="${build.jogl}"
- config="${config.jogl}/gl-es3.cfg"
+ config="${config.jogl}/gl-if-es3.cfg"
+ includeRefid="stub.includes.fileset.all.gldesktop"
+ literalInclude="${stub.includes.gluegen.gg}"
+ emitter="com.jogamp.gluegen.opengl.GLEmitter">
+ <classpath refid="gluegen-gl.classpath" />
+ </gluegen>
+ </target>
+
+ <target name="java.generate.gles3impl">
+ <echo message="Generating GLES3 implementation" />
+ <antcall target="java.generate.copy2temp" inheritRefs="true" />
+ <gluegen src="${stub.includes.opengl}/gles3.c"
+ outputRootDir="${build.jogl}"
+ config="${config.jogl}/gl-es3-impl.cfg"
includeRefid="stub.includes.fileset.all.gldesktop"
literalInclude="${stub.includes.gluegen.gg}"
emitter="com.jogamp.gluegen.opengl.GLEmitter">
@@ -640,7 +654,7 @@
</gluegen>
</target>
- <target name="java.generate.gl.all" depends="build.gluegen-gl.jar, java.generate.gl_if, java.generate.gl2_es1_if, java.generate.gles1, java.generate.gl2_es2_if, java.generate.gles2, java.generate.gl2_es3_if, java.generate.gl3_es3_if, java.generate.gl2_gl3_if, java.generate.gl2, java.generate.gl3, java.generate.gl3bc, java.generate.gl4_es3_if, java.generate.gles3, java.generate.gl4, java.generate.gl4bc"/>
+ <target name="java.generate.gl.all" depends="build.gluegen-gl.jar, java.generate.gl_if, java.generate.gl2_es1_if, java.generate.gles1, java.generate.gl2_es2_if, java.generate.gles2, java.generate.gl2_es3_if, java.generate.gl3_es3_if, java.generate.gl2_gl3_if, java.generate.gl2, java.generate.gl3, java.generate.gl3bc, java.generate.gl4_es3_if, java.generate.gles3, java.generate.gles3impl, java.generate.gl4, java.generate.gl4bc"/>
<!-- target name="java.generate.gl.nsig" if="gluegen.nsig">
<echo message="Generating GL interface and implementation" />
@@ -795,9 +809,9 @@
includeAntRuntime="true"
memoryMaximumSize="${javac.memorymax}"
encoding="UTF-8"
- source="${host.sourcelevel}"
- target="${host.targetlevel}"
- bootclasspath="${host.rt.jar}"
+ source="${target.sourcelevel}"
+ target="${target.targetlevel}"
+ bootclasspath="${target.rt.jar}"
debug="${javacdebug}" debuglevel="${javacdebuglevel}">
<classpath refid="gluegen-gl.classpath"/>
<src path="${src.java}" />
@@ -1224,12 +1238,12 @@
<linker id="linker.cfg.win32.mingw.jogl" extends="linker.cfg.win32.mingw">
<linkerarg value="-Wl,--kill-at" /> <!-- remove @ from function names -->
- <syslibset libs="gdi32, kernel32"/>
+ <syslibset libs="gdi32, kernel32, strmiids, uuid, ole32, oleaut32"/> <!-- last 4 for dshow video input query! -->
</linker>
<linker id="linker.cfg.win64.mingw.jogl" extends="linker.cfg.win64.mingw">
<linkerarg value="-Wl,--kill-at" /> <!-- remove @ from function names -->
- <syslibset libs="gdi32, kernel32"/>
+ <syslibset libs="gdi32, kernel32, strmiids, uuid, ole32, oleaut32"/> <!-- last 4 for dshow video input query! -->
</linker>
<linker id="linker.cfg.win32.msvc.jogl" extends="linker.cfg.win32.msvc">
@@ -1407,8 +1421,81 @@
<move file="${src}" tofile="${dest}" />
</target>
+ <!-- Only compile the ffmpeg version depending source files
+ against their respective header files!
+ We do not use the resulting static libraries directly,
+ but inject their obj-files in build.c for the jogl_* library! -->
+ <macrodef name="c.build.ffmpeg">
+ <attribute name="version.lav" />
+ <attribute name="compiler.cfg.id" />
+ <attribute name="linker.cfg.id" />
+ <attribute name="output.lib.name" />
+ <attribute name="c.compiler.use-jawt" default="false"/>
+ <sequential>
+ <echo message="Output lib name = @{output.lib.name}" />
+
+ <condition property="c.compiler.use-debug"><istrue value="${c.compiler.debug}"/></condition>
+
+ <patternset id="c.src.files.@{version.lav}">
+ <include name="${rootrel.src.c}/JoglCommon.c"/>
+ <include name="${rootrel.src.c.libav}/ffmpeg_dshow.c"/>
+ <include name="${rootrel.src.c.libav}/ffmpeg_static.c"/>
+ <include name="${rootrel.src.c.libav}/ffmpeg_@{version.lav}.c"/>
+ </patternset>
+
+ <echo message="Compiling @{output.lib.name}" />
+
+ <!-- have to wrap cc task with outofdate, because otherwise cc links a new library
+ even when no files have been compiled -->
+ <outofdate>
+ <sourcefiles>
+ <fileset dir="${project.root}"><patternset refid="c.src.files.@{version.lav}"/></fileset>
+ <fileset dir="${project.root}" includes="${rootrel.src.c.libav}/*"/>
+ </sourcefiles>
+ <targetfiles>
+ <fileset dir="${obj.joglsub}" includes="lib@{output.lib.name}.so"/>
+ <fileset dir="${obj.joglsub}" includes="@{output.lib.name}.dll"/>
+ <fileset dir="${obj.joglsub}" includes="lib@{output.lib.name}.jnilib"/>
+ </targetfiles>
+ <sequential>
+ <cc outtype="shared"
+ objdir="${obj.joglsub}"
+ outfile="${obj.joglsub}/@{output.lib.name}"
+ optimize="${c.compiler.optimise}"
+ debug="${c.compiler.debug}"
+ multithreaded="true"
+ exceptions="false"
+ rtti="false">
+
+ <fileset dir="${project.root}"><patternset refid="c.src.files.@{version.lav}"/></fileset>
+
+ <compiler extends="@{compiler.cfg.id}" >
+ <sysincludepath path="${java.includes.dir}"/>
+ <sysincludepath path="${java.includes.dir.platform}"/>
+ <sysincludepath path="${stub.includes.gluegen.cc}"/>
+ <includepath path="stub_includes/khr"/>
+ <includepath path="stub_includes/opengl"/>
+ <includepath path="stub_includes/libav/@{version.lav}"/>
+
+ <!-- This is for the generated headers for handwritten C code -->
+ <includepath path="${src.c}"/>
+ <includepath path="${src.generated.c.libav}" />
+
+ <!-- This must come last to not override real include paths -->
+ <!-- includepath path="stub_includes/macosx" if="isOSX" / -->
+ </compiler>
+
+ <linker extends="@{linker.cfg.id}">
+ </linker>
+ </cc>
+ </sequential>
+ </outofdate>
+ </sequential>
+ </macrodef>
+
<macrodef name="c.build">
<attribute name="c.compiler.src.files" />
+ <attribute name="c.compiler.obj.files" />
<attribute name="compiler.cfg.id" />
<attribute name="linker.cfg.id" />
<attribute name="output.lib.name" />
@@ -1416,15 +1503,19 @@
<sequential>
<echo message="Output lib name = @{output.lib.name}" />
- <!-- NOTE: the value of the debug and optimise attributes will not be overridden if already set externally -->
- <property name="c.compiler.debug" value="false" />
- <!-- Optimise flags one of { none, size, speed, minimal, full, aggressive, extreme, unsafe } -->
- <property name="c.compiler.optimise" value="none" />
-
<condition property="c.compiler.use-debug"><istrue value="${c.compiler.debug}"/></condition>
+ <patternset id="c.obj.files.none">
+ </patternset>
+ <patternset id="c.obj.files.ffmpeg.inject">
+ <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_lavu52_lavr01.*"/>
+ </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}/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"/>
@@ -1434,7 +1525,8 @@
<include name="${rootrel.src.c}/GLXGetProcAddressARB.c" if="isX11"/>
<!-- FIXME: the Mixer should be moved to another library -->
<!--include name="${rootrel.src.c}/Mixer.cpp" if="isWindows"/-->
- <include name="${rootrel.src.c.libav}/jogamp_opengl_util_av_impl_FFMPEGMediaPlayer.c"/>
+ <include name="${rootrel.src.c.libav}/ffmpeg_static.c"/>
+ <include name="${rootrel.src.c.libav}/ffmpeg_dshow.c"/>
<include name="${rootrel.src.c.openmax}/omx_tool.c" if="setup.addNativeOpenMAX"/>
<include name="${rootrel.src.c.openmax}/jogamp_opengl_util_av_impl_OMXGLMediaPlayer.c" if="setup.addNativeOpenMAX"/>
@@ -1449,9 +1541,11 @@
<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}/GLDebugMessageHandler.c"/>
<include name="${rootrel.src.c}/GLXGetProcAddressARB.c" if="isX11"/>
- <include name="${rootrel.src.c.libav}/jogamp_opengl_util_av_impl_FFMPEGMediaPlayer.c"/>
+ <include name="${rootrel.src.c.libav}/ffmpeg_static.c"/>
+ <include name="${rootrel.src.c.libav}/ffmpeg_dshow.c"/>
<include name="${rootrel.src.c.openmax}/omx_tool.c" if="setup.addNativeOpenMAX"/>
<include name="${rootrel.src.c.openmax}/jogamp_opengl_util_av_impl_OMXGLMediaPlayer.c" if="setup.addNativeOpenMAX"/>
@@ -1475,6 +1569,7 @@
<outofdate>
<sourcefiles>
<fileset dir="${project.root}"><patternset refid="@{c.compiler.src.files}"/></fileset>
+ <fileset dir="${obj.joglsub}" includes="*jogl_ffmpegv08*, *jogl_ffmpegv09*, *jogl_ffmpegv10*"/> <!-- requires linkage -->
</sourcefiles>
<targetfiles>
<fileset dir="${obj.jogl}" includes="lib@{output.lib.name}.so"/>
@@ -1491,7 +1586,10 @@
exceptions="false"
rtti="false">
- <fileset dir="${project.root}"><patternset refid="@{c.compiler.src.files}"/></fileset>
+ <fileset dir="${project.root}">
+ <patternset refid="@{c.compiler.src.files}"/>
+ <patternset refid="@{c.compiler.obj.files}"/>
+ </fileset>
<compiler extends="@{compiler.cfg.id}" >
<sysincludepath path="${java.includes.dir}"/>
@@ -1500,7 +1598,6 @@
<includepath path="stub_includes/khr"/>
<includepath path="stub_includes/egl"/>
<includepath path="stub_includes/opengl"/>
- <includepath path="stub_includes/libav" /> <!-- headers required by our libav/ffmpeg MediaPlayer impl. -->
<includepath path="stub_includes/openmax" if="setup.addNativeOpenMAX"/>
<includepath path="stub_includes/cg" if="setup.addNativeNVidiaCG"/>
@@ -1551,17 +1648,32 @@
</macrodef>
<target name="c.build.jogl.prepare">
- <javah destdir="${build.jogl}/gensrc/native/jogl" classpath="${javah.classpath}" class="jogamp.opengl.GLDebugMessageHandler" />
- <javah destdir="${build.jogl}/gensrc/native/jogl" classpath="${javah.classpath}" class="jogamp.opengl.GLContextImpl" />
- <javah destdir="${src.generated.c.libav}" classpath="${javah.classpath}" class="jogamp.opengl.util.av.impl.FFMPEGMediaPlayer" />
+ <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.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 -->
<!--javah destdir="${build.jogl}/gensrc/native/jogl" classpath="${javah.classpath}" class="com.jogamp.audio.windows.waveout.Mixer" /-->
+
+ <c.build.ffmpeg version.lav="lavc53_lavf53_lavu51"
+ output.lib.name="jogl_ffmpegv08"
+ compiler.cfg.id="${compiler.cfg.id}"
+ linker.cfg.id="${linker.cfg.id.os}"/>
+
+ <c.build.ffmpeg version.lav="lavc54_lavf54_lavu52_lavr01"
+ output.lib.name="jogl_ffmpegv09"
+ compiler.cfg.id="${compiler.cfg.id}"
+ linker.cfg.id="${linker.cfg.id.os}"/>
+
+ <c.build.ffmpeg version.lav="lavc55_lavf55_lavu52_lavr01"
+ output.lib.name="jogl_ffmpegv10"
+ compiler.cfg.id="${compiler.cfg.id}"
+ linker.cfg.id="${linker.cfg.id.os}"/>
</target>
<target name="c.build.jogl.desktop" unless="setup.noNativeDesktop">
<c.build c.compiler.src.files="c.src.files.jogl.desktop"
+ c.compiler.obj.files="c.obj.files.ffmpeg.inject"
output.lib.name="jogl_desktop"
compiler.cfg.id="${compiler.cfg.id}"
linker.cfg.id="${linker.cfg.id.os}"/>
@@ -1569,6 +1681,7 @@
<target name="c.build.jogl.mobile">
<c.build c.compiler.src.files="c.src.files.jogl.mobile"
+ c.compiler.obj.files="c.obj.files.ffmpeg.inject"
output.lib.name="jogl_mobile"
compiler.cfg.id="${compiler.cfg.id}"
linker.cfg.id="${linker.cfg.id.os}"/>
@@ -1576,6 +1689,7 @@
<target name="c.build.jogl.cg" if="setup.addNativeNVidiaCG">
<c.build c.compiler.src.files="c.src.files.cg"
+ c.compiler.obj.files="c.obj.files.none"
output.lib.name="jogl_cg"
compiler.cfg.id="${compiler.cfg.id}"
linker.cfg.id="${linker.cfg.id.os}"/>
@@ -1723,7 +1837,12 @@
</jar>
<jar manifest="${build.jogl}/manifest.mf" destfile="${jogl-util-graph.jar}" filesonly="true">
<fileset dir="${classes}"
- includes="${java.part.util.graph}"/>
+ includes="${java.part.util.graph}"
+ excludes="${java.part.util.graph.fonts}"/>
+ </jar>
+ <jar manifest="${build.jogl}/manifest.mf" destfile="${jogl-util-graph-fonts-p0.jar}" filesonly="true">
+ <fileset dir="${classes}"
+ includes="${java.part.util.graph.fonts}"/>
</jar>
<jar manifest="${build.jogl}/manifest.mf" destfile="${jogl-util-fixedfuncemu.jar}" filesonly="true">
<fileset dir="${classes}"
diff --git a/make/build-nativewindow.xml b/make/build-nativewindow.xml
index 49ef78b..b0c49b0 100644
--- a/make/build-nativewindow.xml
+++ b/make/build-nativewindow.xml
@@ -741,8 +741,7 @@
</target>
<target name="c.build.nativewindow.windowlib.x11" if="isX11">
- <javah destdir="${src.generated.c}/X11" classpath="${javah.classpath}" class="jogamp.nativewindow.x11.X11Lib" />
- <javah destdir="${src.generated.c}/X11" classpath="${javah.classpath}" class="jogamp.nativewindow.x11.X11Util" />
+ <javah destdir="${src.generated.c}/X11" classpath="${javah.classpath}" class="jogamp.nativewindow.x11.X11Lib, jogamp.nativewindow.x11.X11Util" />
<c.build c.compiler.src.files="c.src.files.x11"
output.lib.name="nativewindow_x11"
@@ -751,8 +750,7 @@
</target>
<target name="c.build.nativewindow.windowlib.windows" if="isWindows">
- <javah destdir="${src.generated.c}/Windows" classpath="${javah.classpath}" class="jogamp.nativewindow.windows.GDI" />
- <javah destdir="${src.generated.c}/Windows" classpath="${javah.classpath}" class="jogamp.nativewindow.windows.GDIUtil" />
+ <javah destdir="${src.generated.c}/Windows" classpath="${javah.classpath}" class="jogamp.nativewindow.windows.GDI, jogamp.nativewindow.windows.GDIUtil" />
<c.build c.compiler.src.files="c.src.files.windows"
output.lib.name="nativewindow_win32"
@@ -761,8 +759,7 @@
</target>
<target name="c.build.nativewindow.windowlib.macosx" if="isOSX">
- <javah destdir="${src.generated.c}/MacOSX" classpath="${javah.classpath}" class="jogamp.nativewindow.macosx.OSXUtil" />
- <javah destdir="${src.generated.c}/MacOSX" classpath="${javah.classpath}" class="jogamp.nativewindow.jawt.macosx.MacOSXJAWTWindow" />
+ <javah destdir="${src.generated.c}/MacOSX" classpath="${javah.classpath}" class="jogamp.nativewindow.macosx.OSXUtil, jogamp.nativewindow.jawt.macosx.MacOSXJAWTWindow" />
<c.build c.compiler.src.files="c.src.files.macosx"
output.lib.name="nativewindow_macosx"
diff --git a/make/build-newt.xml b/make/build-newt.xml
index 94a448d..960c7b5 100644
--- a/make/build-newt.xml
+++ b/make/build-newt.xml
@@ -685,26 +685,14 @@
<target name="c.build.newt.prepare">
<javah destdir="${src.generated.c}/KD" classpath="${javah.classpath}" class="jogamp.newt.driver.kd.WindowDriver" />
- <javah destdir="${src.generated.c}/IntelGDL" classpath="${javah.classpath}" class="jogamp.newt.driver.intel.gdl.DisplayDriver" />
- <javah destdir="${src.generated.c}/IntelGDL" classpath="${javah.classpath}" class="jogamp.newt.driver.intel.gdl.ScreenDriver" />
- <javah destdir="${src.generated.c}/IntelGDL" classpath="${javah.classpath}" class="jogamp.newt.driver.intel.gdl.WindowDriver" />
+ <javah destdir="${src.generated.c}/IntelGDL" classpath="${javah.classpath}" class="jogamp.newt.driver.intel.gdl.DisplayDriver, jogamp.newt.driver.intel.gdl.ScreenDriver, jogamp.newt.driver.intel.gdl.WindowDriver" />
<javah destdir="${src.generated.c}/bcm/egl" classpath="${javah.classpath}" class="jogamp.newt.driver.bcm.egl.WindowDriver" />
- <javah destdir="${src.generated.c}/bcm/vc/iv" classpath="${javah.classpath}" class="jogamp.newt.driver.bcm.vc.iv.DisplayDriver" />
- <javah destdir="${src.generated.c}/bcm/vc/iv" classpath="${javah.classpath}" class="jogamp.newt.driver.bcm.vc.iv.ScreenDriver" />
- <javah destdir="${src.generated.c}/bcm/vc/iv" classpath="${javah.classpath}" class="jogamp.newt.driver.bcm.vc.iv.WindowDriver" />
-
- <javah destdir="${src.generated.c}/Windows" classpath="${javah.classpath}" class="jogamp.newt.driver.windows.WindowDriver" />
- <javah destdir="${src.generated.c}/Windows" classpath="${javah.classpath}" class="jogamp.newt.driver.windows.ScreenDriver" />
- <javah destdir="${src.generated.c}/Windows" classpath="${javah.classpath}" class="jogamp.newt.driver.windows.DisplayDriver" />
- <javah destdir="${src.generated.c}/MacOSX" classpath="${javah.classpath}" class="jogamp.newt.driver.macosx.WindowDriver" />
- <javah destdir="${src.generated.c}/MacOSX" classpath="${javah.classpath}" class="jogamp.newt.driver.macosx.ScreenDriver" />
- <javah destdir="${src.generated.c}/MacOSX" classpath="${javah.classpath}" class="jogamp.newt.driver.macosx.DisplayDriver" />
- <javah destdir="${src.generated.c}/X11" classpath="${javah.classpath}" class="jogamp.newt.driver.x11.WindowDriver" />
- <javah destdir="${src.generated.c}/X11" classpath="${javah.classpath}" class="jogamp.newt.driver.x11.ScreenDriver" />
- <javah destdir="${src.generated.c}/X11" classpath="${javah.classpath}" class="jogamp.newt.driver.x11.RandR11" />
- <javah destdir="${src.generated.c}/X11" classpath="${javah.classpath}" class="jogamp.newt.driver.x11.RandR13" />
- <javah destdir="${src.generated.c}/X11" classpath="${javah.classpath}" class="jogamp.newt.driver.x11.DisplayDriver" />
+ <javah destdir="${src.generated.c}/bcm/vc/iv" classpath="${javah.classpath}" class="jogamp.newt.driver.bcm.vc.iv.DisplayDriver, jogamp.newt.driver.bcm.vc.iv.ScreenDriver, jogamp.newt.driver.bcm.vc.iv.WindowDriver" />
+
+ <javah destdir="${src.generated.c}/Windows" classpath="${javah.classpath}" class="jogamp.newt.driver.windows.WindowDriver, jogamp.newt.driver.windows.ScreenDriver, jogamp.newt.driver.windows.DisplayDriver" />
+ <javah destdir="${src.generated.c}/MacOSX" classpath="${javah.classpath}" class="jogamp.newt.driver.macosx.WindowDriver, jogamp.newt.driver.macosx.ScreenDriver, jogamp.newt.driver.macosx.DisplayDriver" />
+ <javah destdir="${src.generated.c}/X11" classpath="${javah.classpath}" class="jogamp.newt.driver.x11.WindowDriver, jogamp.newt.driver.x11.ScreenDriver, jogamp.newt.driver.x11.RandR11, jogamp.newt.driver.x11.RandR13, jogamp.newt.driver.x11.DisplayDriver" />
</target>
<target name="c.build.newt.prepare.android" if="isAndroid">
diff --git a/make/build-staticglgen.xml b/make/build-staticglgen.xml
index 6d15110..8256fb0 100644
--- a/make/build-staticglgen.xml
+++ b/make/build-staticglgen.xml
@@ -59,7 +59,9 @@
includeAntRuntime="true"
memoryMaximumSize="${javac.memorymax}"
encoding="UTF-8"
- source="${host.sourcelevel}">
+ source="${target.sourcelevel}"
+ target="${target.targetlevel}"
+ bootclasspath="${target.rt.jar}">
<src path="${src.java}" />
<classpath refid="classpath" />
</javac>
diff --git a/make/build-test.xml b/make/build-test.xml
index 177b817..d4274cd 100644
--- a/make/build-test.xml
+++ b/make/build-test.xml
@@ -48,6 +48,8 @@
<target name="clean" description="Remove all build products" depends="declare.common">
<delete includeEmptyDirs="true" quiet="true">
<fileset dir="${build.test}" />
+ <fileset dir="." includes="*.ps" />
+ <fileset dir="." includes="*.pdf" />
<fileset dir="." includes="*.png" />
<fileset dir="." includes="*.pam" />
<fileset dir="." includes="*.tga" />
@@ -447,7 +449,45 @@
</junit>
</target>
- <target name="junit.run.newt.event" depends="test.compile">
+ <target name="junit.run.sharedctx" depends="test.compile, junit.run.settings">
+ <!-- Test*AWT* -->
+ <junit jvm="${jvmJava.exe}" forkmode="perTest" showoutput="true" fork="true" haltonerror="off" timeout="${batchtest.timeout}">
+ <env key="${system.env.library.path}" path="${obj.all.paths}"/>
+ <jvmarg value="${junit.run.arg0}"/>
+ <jvmarg value="${junit.run.arg1}"/>
+ <jvmarg value="${jvmDataModel.arg}"/>
+ <jvmarg value="-Djava.library.path=${obj.all.paths}"/>
+
+ <!--
+ <jvmarg value="-Dnewt.debug.EDT"/>
+ <jvmarg value="-Djogl.debug=all"/>
+ <jvmarg value="-Dgluegen.debug.NativeLibrary=true"/>
+ <jvmarg value="-Dgluegen.debug.ProcAddressHelper=true"/>
+ <jvmarg value="-Djogl.debug.GLSLState"/>
+ <jvmarg value="-Dnativewindow.debug=all"/>
+ <jvmarg value="-Dnewt.debug=all"/>
+ <jvmarg value="-verbose:jni"/>
+ <jvmarg value="-client"/>
+ <jvmarg value="-d32"/>
+ -->
+
+ <formatter usefile="false" type="plain"/>
+ <formatter usefile="true" type="xml"/>
+ <!--classpath refid="junit_jogl_awt.run.classpath"/-->
+ <classpath refid="junit_jogl_swt.run.classpath"/>
+
+ <batchtest todir="${results.test}">
+ <fileset dir="${classes}">
+ <include name="${java.dir.junit}/**/acore/TestSharedContext**"/>
+ <exclude name="**/*$$*"/>
+ </fileset>
+ <formatter usefile="false" type="brief"/>
+ <formatter usefile="true" type="xml"/>
+ </batchtest>
+ </junit>
+ </target>
+
+ <target name="junit.run.newt.event" depends="test.compile, junit.run.settings">
<!-- Test*AWT* -->
<junit jvm="${jvmJava.exe}" forkmode="perTest" showoutput="true" fork="true" haltonerror="off" timeout="${batchtest.timeout}">
<env key="${system.env.library.path}" path="${obj.all.paths}"/>
@@ -485,7 +525,7 @@
</junit>
</target>
- <target name="junit.run.newt.monitormode" depends="test.compile">
+ <target name="junit.run.newt.monitormode" depends="test.compile, junit.run.settings">
<!-- Test*AWT* -->
<junit jvm="${jvmJava.exe}" forkmode="perTest" showoutput="true" fork="true" haltonerror="off" timeout="${batchtest.timeout}">
<env key="${system.env.library.path}" path="${obj.all.paths}"/>
@@ -698,6 +738,8 @@
<mkdir dir="${build}/test/results-x32"/>
<move todir="${build}/test/results-x32">
+ <fileset dir="." includes="*.ps" />
+ <fileset dir="." includes="*.pdf" />
<fileset dir="." includes="*.png" />
<fileset dir="." includes="*.pam" />
<fileset dir="." includes="*.tga" />
@@ -722,6 +764,8 @@
<mkdir dir="${build}/test/results-java7"/>
<move todir="${build}/test/results-java7">
+ <fileset dir="." includes="*.ps" />
+ <fileset dir="." includes="*.pdf" />
<fileset dir="." includes="*.png" />
<fileset dir="." includes="*.pam" />
<fileset dir="." includes="*.tga" />
@@ -1055,6 +1099,8 @@ ${line.separator}
<fileset dir="${results.test}" includes="**"/>
<fileset dir="${build}/test/results-x32" includes="**"/>
<fileset file="${build}/${test.archive.name}.7z"/>
+ <fileset dir="." includes="*.ps" />
+ <fileset dir="." includes="*.pdf" />
<fileset dir="." includes="*.png" />
<fileset dir="." includes="*.pam" />
<fileset dir="." includes="*.tga" />
@@ -1072,6 +1118,8 @@ ${line.separator}
<target name="junit.run" depends="junit.run.settings, junit.run.if.enabled, junit.run.if.disabled">
<mkdir dir="${results.test}" />
<move todir="${results.test}">
+ <fileset dir="." includes="*.ps" />
+ <fileset dir="." includes="*.pdf" />
<fileset dir="." includes="*.png" />
<fileset dir="." includes="*.pam" />
<fileset dir="." includes="*.tga" />
@@ -1082,6 +1130,8 @@ ${line.separator}
<target name="junit.manual.run.remote.ssh.newt" depends="junit.run.settings, junit.run.remote.ssh.newt">
<mkdir dir="${results.test}" />
<move todir="${results.test}">
+ <fileset dir="." includes="*.ps" />
+ <fileset dir="." includes="*.pdf" />
<fileset dir="." includes="*.png" />
<fileset dir="." includes="*.pam" />
<fileset dir="." includes="*.tga" />
@@ -1092,6 +1142,8 @@ ${line.separator}
<target name="junit.manual.run.remote.ssh.awt" depends="junit.run.settings, junit.run.remote.ssh.awt">
<mkdir dir="${results.test}" />
<move todir="${results.test}">
+ <fileset dir="." includes="*.ps" />
+ <fileset dir="." includes="*.pdf" />
<fileset dir="." includes="*.png" />
<fileset dir="." includes="*.pam" />
<fileset dir="." includes="*.tga" />
@@ -1102,6 +1154,8 @@ ${line.separator}
<target name="junit.manual.run.remote.ssh.all" depends="junit.run.settings, junit.run.remote.ssh.all">
<mkdir dir="${results.test}" />
<move todir="${results.test}">
+ <fileset dir="." includes="*.ps" />
+ <fileset dir="." includes="*.pdf" />
<fileset dir="." includes="*.png" />
<fileset dir="." includes="*.pam" />
<fileset dir="." includes="*.tga" />
diff --git a/make/build.xml b/make/build.xml
index 4b09f25..a7ba217 100644
--- a/make/build.xml
+++ b/make/build.xml
@@ -292,6 +292,7 @@
<target name="tag.build" depends="init">
<copy file="${build.gluegen}/artifact.properties" todir="${build}" overwrite="true"/>
+ <echo message='jogl.build.version=${jogamp.version}${line.separator}' file="${build}/artifact.properties" append="true"/>
<echo message='jogl.build.number=${jogl.build.number}${line.separator}' file="${build}/artifact.properties" append="true"/>
<echo message='jogl.build.id=${jogl.build.id}${line.separator}' file="${build}/artifact.properties" append="true"/>
<echo message='jogl.build.branch=${jogl.build.branch}${line.separator}' file="${build}/artifact.properties" append="true"/>
diff --git a/make/config/jogl/cgl-macosx.cfg b/make/config/jogl/cgl-macosx.cfg
index edb5bfb..a67ee80 100644
--- a/make/config/jogl/cgl-macosx.cfg
+++ b/make/config/jogl/cgl-macosx.cfg
@@ -31,7 +31,7 @@ Opaque long NSOpenGLView *
Opaque long NSOpenGLPixelBuffer *
Opaque long NSOpenGLLayer *
-CustomCCode #include </usr/include/machine/types.h>
+CustomCCode #include <machine/types.h>
CustomCCode #include "macosx-window-system.h"
AccessControl createNSOpenGLLayerImpl PRIVATE
diff --git a/make/config/jogl/gl-common-gpubufferonly.cfg b/make/config/jogl/gl-common-gpubufferonly.cfg
new file mode 100644
index 0000000..14671f3
--- /dev/null
+++ b/make/config/jogl/gl-common-gpubufferonly.cfg
@@ -0,0 +1,50 @@
+
+#
+# For core GL spec >= 3.1 and ES >= 3.0
+# source can only be a buffer object!
+#
+# See Bug 852
+#
+# OpenGL 3.1 core spec 2.10 p41
+# Vertex Array Objects - *Pointer commands
+#
+# OpenGL 3.2 core spec 2.9.7 p45
+# Draw* commands -w/ "Array Indices in Buffer Objects"
+#
+# OpenGL 4.0 core spec 2.9.8 p51:
+# Draw* Indirect Commands ..
+#
+
+BufferObjectOnly glColorPointer
+BufferObjectOnly glEdgeFlagPointer
+BufferObjectOnly glElementPointerATI
+BufferObjectOnly glFogCoordPointer
+BufferObjectOnly glFogCoordPointerEXT
+BufferObjectOnly glInterleavedArrays
+BufferObjectOnly glMatrixIndexPointerARB
+BufferObjectOnly glNormalPointer
+BufferObjectOnly glSecondaryColorPointer
+BufferObjectOnly glSecondaryColorPointerEXT
+BufferObjectOnly glTexCoordPointer
+BufferObjectOnly glVariantPointerEXT
+BufferObjectOnly glVertexPointer
+BufferObjectOnly glVertexAttribPointer
+BufferObjectOnly glVertexAttribPointerARB
+BufferObjectOnly glVertexAttribPointerNV
+BufferObjectOnly glVertexAttribIPointer
+BufferObjectOnly glVertexAttribLPointer
+BufferObjectOnly glVertexWeightPointerEXT
+BufferObjectOnly glWeightPointerARB
+
+BufferObjectOnly glDrawElements
+BufferObjectOnly glDrawElementsBaseVertex
+BufferObjectOnly glDrawElementsInstanced
+BufferObjectOnly glDrawElementsInstancedBaseInstance
+BufferObjectOnly glDrawElementsInstancedBaseVertex
+BufferObjectOnly glDrawElementsInstancedBaseVertexBaseInstance
+BufferObjectOnly glDrawRangeElements
+BufferObjectOnly glDrawRangeElementsBaseVertex
+
+BufferObjectOnly glDrawArraysIndirect
+BufferObjectOnly glDrawElementsIndirect
+
diff --git a/make/config/jogl/gl-common.cfg b/make/config/jogl/gl-common.cfg
index a1b09c5..b841154 100644
--- a/make/config/jogl/gl-common.cfg
+++ b/make/config/jogl/gl-common.cfg
@@ -591,6 +591,9 @@ BufferObjectKind Element glDrawElementsInstancedBaseVertexBaseInstance
BufferObjectKind Element glDrawRangeElements
BufferObjectKind Element glDrawRangeElementsBaseVertex
+BufferObjectKind Indirect glDrawArraysIndirect
+BufferObjectKind Indirect glDrawElementsIndirect
+
# There are no PBOs in the embedded OpenGL variants right now
BufferObjectKind UnpackPixel glBitmap
BufferObjectKind UnpackPixel glColorTable
@@ -651,6 +654,9 @@ RangeCheck glDrawElementsInstancedBaseVertexBaseInstance 3 {1}
RangeCheck glDrawRangeElements 5 {3}
RangeCheck glDrawRangeElementsBaseVertex 5 {3}
+RangeCheck glDrawArraysIndirect 1 1
+RangeCheck glDrawElementsIndirect 2 1
+
RangeCheck glEdgeFlagPointer 1 1
RangeCheck glElementPointerATI 1 1
RangeCheck glFogCoordPointer 2 1
diff --git a/make/config/jogl/gl-es3-impl.cfg b/make/config/jogl/gl-es3-impl.cfg
new file mode 100644
index 0000000..2e5e36e
--- /dev/null
+++ b/make/config/jogl/gl-es3-impl.cfg
@@ -0,0 +1,91 @@
+# This .cfg file is used to generate the GL implementing class.
+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
+
+Style ImplOnly
+ImplPackage jogamp.opengl.es3
+ImplJavaClass GLES3Impl
+Implements GLES3Impl GLBase
+Implements GLES3Impl GL
+Implements GLES3Impl GL2ES2
+Implements GLES3Impl GLES2
+Implements GLES3Impl GL2ES3
+Implements GLES3Impl GL3ES3
+Implements GLES3Impl GL4ES3
+Implements GLES3Impl GLES3
+HierarchicalNativeOutput false
+Include gl-common.cfg
+Include gl-common-extensions.cfg
+Include gl2_es3-common.cfg
+Include gl2_es2-CustomJavaCode.cfg
+
+ForceExtension GL_ARB_ES3_compatibility
+
+EmitProcAddressTable true
+ProcAddressTableClassName GLES3ProcAddressTable
+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
+# depend on the presence of an import library for a particular device
+ForceProcAddressGen __ALL__
+
+# Also force the calling conventions of the locally generated function
+# pointer typedefs for these routines to GL_APIENTRY
+LocalProcAddressCallingConvention __ALL__ GL_APIENTRY
+
+# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums
+TagNativeBinding true
+
+# Add PixelStorei StateTracker
+#
+# Add input validation to glPixelStorei, just to be sure.
+CustomJavaCode GLES3Impl private static final int params_offset = 0; // just a helper for JavaPrologue ..
+
+JavaPrologue glPixelStorei if (pname != GL_PACK_ALIGNMENT && pname != GL_UNPACK_ALIGNMENT) {
+JavaPrologue glPixelStorei throw new GLException("Unsupported pixel store parameter name 0x" + Integer.toHexString(pname));
+JavaPrologue glPixelStorei }
+JavaPrologue glPixelStorei glStateTracker.setInt(pname, param);
+
+JavaPrologue glGetIntegerv if ( glStateTracker.getInt(pname, params, params_offset) ) { return; }
+
+CustomCCode #include <stdio.h> /* android */
+CustomCCode /* Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in
+CustomCCode "glext.h" are parsed. */
+CustomCCode #define GL_GLEXT_PROTOTYPES
+
+CustomCCode /* Include the OpenGL headers */
+CustomCCode /* #define GL_APICALL __declspec(dllimport) */
+CustomCCode #include <GLES3/gl3.h>
+CustomCCode #include <GLES3/gl3ext.h>
+CustomCCode #include <GLES2/gl2ext.h>
+CustomCCode #include <stdlib.h>
+
+IncludeAs CustomJavaCode GLES3Impl gl-impl-CustomJavaCode-common.java
+IncludeAs CustomJavaCode GLES3Impl gl-impl-CustomJavaCode-gles3.java
+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.common.nio.Buffers
+Import com.jogamp.opengl.util.GLBuffers
+Import java.io.PrintStream
+
diff --git a/make/config/jogl/gl-es3.cfg b/make/config/jogl/gl-es3.cfg
deleted file mode 100644
index 997723d..0000000
--- a/make/config/jogl/gl-es3.cfg
+++ /dev/null
@@ -1,98 +0,0 @@
-# This .cfg file is used to generate the GL interface and implementing class.
-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 ../src/jogl/classes/javax/media/opengl/GLBase.java
-
-Package javax.media.opengl
-Style InterfaceAndImpl
-JavaClass GLES3
-#Extends GLES3 GLBase
-#Extends GLES3 GL
-#Extends GLES3 GL2ES2
-#Extends GLES3 GL2ES3
-#Extends GLES3 GL3ES3
-Extends GLES3 GLES2
-Extends GLES3 GL4ES3
-ImplPackage jogamp.opengl.es3
-ImplJavaClass GLES3Impl
-Implements GLES3Impl GLBase
-Implements GLES3Impl GL
-Implements GLES3Impl GL2ES2
-Implements GLES3Impl GLES2
-Implements GLES3Impl GL2ES3
-Implements GLES3Impl GL3ES3
-Implements GLES3Impl GL4ES3
-HierarchicalNativeOutput false
-Include gl-common.cfg
-Include gl-common-extensions.cfg
-Include gl2_es3-common.cfg
-Include gl2_es2-CustomJavaCode.cfg
-
-ForceExtension GL_ARB_ES3_compatibility
-
-EmitProcAddressTable true
-ProcAddressTableClassName GLES3ProcAddressTable
-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
-# depend on the presence of an import library for a particular device
-ForceProcAddressGen __ALL__
-
-# Also force the calling conventions of the locally generated function
-# pointer typedefs for these routines to GL_APIENTRY
-LocalProcAddressCallingConvention __ALL__ GL_APIENTRY
-
-# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums
-TagNativeBinding true
-
-# Add PixelStorei StateTracker
-#
-# Add input validation to glPixelStorei, just to be sure.
-CustomJavaCode GLES3Impl private static final int params_offset = 0; // just a helper for JavaPrologue ..
-
-JavaPrologue glPixelStorei if (pname != GL_PACK_ALIGNMENT && pname != GL_UNPACK_ALIGNMENT) {
-JavaPrologue glPixelStorei throw new GLException("Unsupported pixel store parameter name 0x" + Integer.toHexString(pname));
-JavaPrologue glPixelStorei }
-JavaPrologue glPixelStorei glStateTracker.setInt(pname, param);
-
-JavaPrologue glGetIntegerv if ( glStateTracker.getInt(pname, params, params_offset) ) { return; }
-
-CustomCCode #include <stdio.h> /* android */
-CustomCCode /* Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in
-CustomCCode "glext.h" are parsed. */
-CustomCCode #define GL_GLEXT_PROTOTYPES
-
-CustomCCode /* Include the OpenGL headers */
-CustomCCode /* #define GL_APICALL __declspec(dllimport) */
-CustomCCode #include <GLES3/gl3.h>
-CustomCCode #include <GLES3/gl3ext.h>
-CustomCCode #include <GLES2/gl2ext.h>
-CustomCCode #include <stdlib.h>
-
-IncludeAs CustomJavaCode GLES3Impl gl-impl-CustomJavaCode-common.java
-IncludeAs CustomJavaCode GLES3Impl gl-impl-CustomJavaCode-gles3.java
-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.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 d1bd856..c3a392c 100644
--- a/make/config/jogl/gl-gl4bc.cfg
+++ b/make/config/jogl/gl-gl4bc.cfg
@@ -84,6 +84,8 @@ TagNativeBinding true
# Ignore extensions that are already picked up via the GL2ES1 interface
IgnoreExtension GL_EXT_point_parameters
+IncludeAs CustomJavaCode GL4bc gl4bc-common-cpubufferJavaCode.java
+
# Add PixelStorei StateTracker
CustomJavaCode GL4bcImpl private static final int params_offset = 0; // just a helper for JavaPrologue ..
@@ -117,6 +119,7 @@ Include gl3ext-headers.cfg
IncludeAs CustomJavaCode GL4bcImpl gl-impl-CustomJavaCode-common.java
IncludeAs CustomJavaCode GL4bcImpl gl-impl-CustomJavaCode-gl4bc.java
IncludeAs CustomJavaCode GL4bcImpl gl-impl-CustomJavaCode-gl2_es2.java
+
IncludeAs CustomCCode gl-impl-CustomCCode-gl4bc.c
Import javax.media.opengl.GLES1
diff --git a/make/config/jogl/gl-headers.cfg b/make/config/jogl/gl-headers.cfg
index 62f5e8d..0916fa3 100644
--- a/make/config/jogl/gl-headers.cfg
+++ b/make/config/jogl/gl-headers.cfg
@@ -15,12 +15,12 @@ CustomCCode #define WGL_GLEXT_PROTOTYPES
CustomCCode /* Include the OpenGL headers */
CustomCCode #include <GL/gl.h>
CustomCCode #include <GL/wglext.h>
-CustomCCode #elif defined(macosx)
+CustomCCode #elif defined(__APPLE__)
CustomCCode #include <inttypes.h>
CustomCCode #include <stdlib.h>
CustomCCode /* Include the OpenGL headers */
CustomCCode #include <GL/gl.h>
-CustomCCode #include </usr/include/machine/types.h>
+CustomCCode #include <machine/types.h>
CustomCCode /* Provide Windows typedefs */
CustomCCode typedef void* LPVOID;
CustomCCode typedef unsigned int* PUINT;
diff --git a/make/config/jogl/gl-if-CustomJavaCode-es3.java b/make/config/jogl/gl-if-CustomJavaCode-es3.java
index 0a1c430..b68b512 100644
--- a/make/config/jogl/gl-if-CustomJavaCode-es3.java
+++ b/make/config/jogl/gl-if-CustomJavaCode-es3.java
@@ -8,7 +8,7 @@ public static final long GL_TIMEOUT_IGNORED = 0xFFFFFFFFFFFFFFFFL ;
/** Part of <code>GL_ARB_shader_image_load_store</code> */
public static final int GL_ALL_BARRIER_BITS = 0xFFFFFFFF ;
-public boolean glIsPBOPackEnabled();
+public boolean glIsPBOPackBound();
-public boolean glIsPBOUnpackEnabled();
+public boolean glIsPBOUnpackBound();
diff --git a/make/config/jogl/gl-if-es2.cfg b/make/config/jogl/gl-if-es2.cfg
index aabd2d5..052722f 100644
--- a/make/config/jogl/gl-if-es2.cfg
+++ b/make/config/jogl/gl-if-es2.cfg
@@ -17,6 +17,9 @@ Include gl-common-extensions.cfg
Include gl2_es2-common.cfg
Include gl2_es2-CustomJavaCode.cfg
+IncludeAs CustomJavaCode GLES2 gl2_es1-common-cpubufferJavaCode.java
+IncludeAs CustomJavaCode GLES2 gl2_es2-common-cpubufferJavaCode.java
+
# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums
TagNativeBinding true
diff --git a/make/config/jogl/gl-if-es3.cfg b/make/config/jogl/gl-if-es3.cfg
new file mode 100644
index 0000000..33e4176
--- /dev/null
+++ b/make/config/jogl/gl-if-es3.cfg
@@ -0,0 +1,39 @@
+# 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
+
+Package javax.media.opengl
+Style InterfaceOnly
+JavaClass GLES3
+#Extends GLES3 GLBase
+#Extends GLES3 GL
+#Extends GLES3 GL2ES2
+#Extends GLES3 GL2ES3
+#Extends GLES3 GL3ES3
+Extends GLES3 GLES2
+Extends GLES3 GL4ES3
+HierarchicalNativeOutput false
+Include gl-common.cfg
+Include gl-common-gpubufferonly.cfg
+Include gl-common-extensions.cfg
+Include gl2_es3-common.cfg
+Include gl2_es2-CustomJavaCode.cfg
+
+ForceExtension GL_ARB_ES3_compatibility
+
+# dummy procaddress config / force procaddress for comments
+EmitProcAddressTable false
+ProcAddressTableClassName DontGenerateProcAddressTableStuff
+GetProcAddressTableExpr DontGenerateProcAddressTableStuff
+ForceProcAddressGen __ALL__
+
+# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums
+TagNativeBinding true
+
diff --git a/make/config/jogl/gl-if-gl.cfg b/make/config/jogl/gl-if-gl.cfg
index 4137cae..5c9e4ca 100644
--- a/make/config/jogl/gl-if-gl.cfg
+++ b/make/config/jogl/gl-if-gl.cfg
@@ -8,6 +8,7 @@ ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.jav
HierarchicalNativeOutput false
Include gl-common.cfg
+Include gl-common-gpubufferonly.cfg
Include gl-common-extensions.cfg
Include gl-if-gl-ignores.cfg
Include gl-if-gl2_es2-ignores.cfg
diff --git a/make/config/jogl/gl-if-gl2.cfg b/make/config/jogl/gl-if-gl2.cfg
index 60efd73..37f7b6f 100644
--- a/make/config/jogl/gl-if-gl2.cfg
+++ b/make/config/jogl/gl-if-gl2.cfg
@@ -5,6 +5,7 @@ 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
@@ -26,6 +27,8 @@ Include gl-if-gl3-ignores.cfg
Include gl-if-gl4-ignores.cfg
IncludeAs CustomJavaCode GL2 gl-if-CustomJavaCode-gl_compat.java
+IncludeAs CustomJavaCode GL2 gl2_es2-common-cpubufferJavaCode.java
+IncludeAs CustomJavaCode GL2 gl2-common-cpubufferJavaCode.java
# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums
TagNativeBinding true
diff --git a/make/config/jogl/gl-if-gl2_es1.cfg b/make/config/jogl/gl-if-gl2_es1.cfg
index 04d78f5..b533e83 100644
--- a/make/config/jogl/gl-if-gl2_es1.cfg
+++ b/make/config/jogl/gl-if-gl2_es1.cfg
@@ -110,6 +110,8 @@ Ignore GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES
CustomJavaCode GL2ES1 public void glOrtho(double left, double right, double bottom, double top, double near_val, double far_val);
CustomJavaCode GL2ES1 public void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar);
+IncludeAs CustomJavaCode GL2ES1 gl2_es1-common-cpubufferJavaCode.java
+
# dummy procaddress config / force procaddress for comments
EmitProcAddressTable false
ProcAddressTableClassName DontGenerateProcAddressTableStuff
diff --git a/make/config/jogl/gl-if-gl2_es2.cfg b/make/config/jogl/gl-if-gl2_es2.cfg
index 0ad140e..db5489d 100644
--- a/make/config/jogl/gl-if-gl2_es2.cfg
+++ b/make/config/jogl/gl-if-gl2_es2.cfg
@@ -13,6 +13,7 @@ Extends GL2ES2 GL
HierarchicalNativeOutput false
Include gl-common.cfg
+Include gl-common-gpubufferonly.cfg
Include gl-common-extensions.cfg
Include gl2_es2-common.cfg
Include gl-if-gl2_es2-ignores.cfg
diff --git a/make/config/jogl/gl-if-gl2_es3.cfg b/make/config/jogl/gl-if-gl2_es3.cfg
index f44c9b3..112bc54 100644
--- a/make/config/jogl/gl-if-gl2_es3.cfg
+++ b/make/config/jogl/gl-if-gl2_es3.cfg
@@ -17,6 +17,7 @@ ExtendedInterfaceSymbolsOnly ../build-temp/gluegen-set/javax/media/opengl/GL2ES3
HierarchicalNativeOutput false
Include gl-common.cfg
+Include gl-common-gpubufferonly.cfg
Include gl-common-extensions.cfg
Include gl2_es3-common.cfg
Include gl-if-gl2_es3-ignores.cfg
diff --git a/make/config/jogl/gl-if-gl2_gl3.cfg b/make/config/jogl/gl-if-gl2_gl3.cfg
index 4679193..532a670 100644
--- a/make/config/jogl/gl-if-gl2_gl3.cfg
+++ b/make/config/jogl/gl-if-gl2_gl3.cfg
@@ -16,6 +16,7 @@ ExtendedInterfaceSymbolsOnly ../build-temp/gluegen-set/javax/media/opengl/GL2GL3
HierarchicalNativeOutput false
Include gl-common.cfg
+Include gl-common-gpubufferonly.cfg
Include gl-common-extensions.cfg
Include gl-desktop.cfg
Include gl3-common.cfg
diff --git a/make/config/jogl/gl-if-gl3.cfg b/make/config/jogl/gl-if-gl3.cfg
index 09f51d6..d472fbc 100644
--- a/make/config/jogl/gl-if-gl3.cfg
+++ b/make/config/jogl/gl-if-gl3.cfg
@@ -20,6 +20,7 @@ Extends GL3 GL3ES3
Extends GL3 GL2GL3
ImplPackage jogamp.opengl.gl3
Include gl-common.cfg
+Include gl-common-gpubufferonly.cfg
Include gl-common-extensions.cfg
Include gl3-desktop.cfg
Include gl3-common.cfg
diff --git a/make/config/jogl/gl-if-gl3bc.cfg b/make/config/jogl/gl-if-gl3bc.cfg
index bca3d61..5172c72 100644
--- a/make/config/jogl/gl-if-gl3bc.cfg
+++ b/make/config/jogl/gl-if-gl3bc.cfg
@@ -34,7 +34,7 @@ Include gl-desktop.cfg
Include gl3-desktop.cfg
Include gl-if-gl4-ignores.cfg
-IncludeAs CustomJavaCode GL2 gl-if-CustomJavaCode-gl_compat.java
+IncludeAs CustomJavaCode GL3bc gl3bc-common-cpubufferJavaCode.java
# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums
TagNativeBinding true
diff --git a/make/config/jogl/gl-if-gl4.cfg b/make/config/jogl/gl-if-gl4.cfg
index 4b19b44..144c10a 100644
--- a/make/config/jogl/gl-if-gl4.cfg
+++ b/make/config/jogl/gl-if-gl4.cfg
@@ -23,6 +23,7 @@ JavaClass GL4
Extends GL4 GL4ES3
Extends GL4 GL3
Include gl-common.cfg
+Include gl-common-gpubufferonly.cfg
Include gl-common-extensions.cfg
Include gl3-desktop.cfg
Include gl3-common.cfg
diff --git a/make/config/jogl/gl-if-gl4_es3.cfg b/make/config/jogl/gl-if-gl4_es3.cfg
index cd9c17f..6233d53 100644
--- a/make/config/jogl/gl-if-gl4_es3.cfg
+++ b/make/config/jogl/gl-if-gl4_es3.cfg
@@ -20,6 +20,7 @@ ExtendedInterfaceSymbolsIgnore ../src/jogl/classes/javax/media/opengl/GLBase.jav
HierarchicalNativeOutput false
Include gl-common.cfg
+Include gl-common-gpubufferonly.cfg
Include gl-common-extensions.cfg
Include gl2_es3-common.cfg
Include gl-if-gl2_es3-ignores.cfg
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-common.java b/make/config/jogl/gl-impl-CustomJavaCode-common.java
index 2254e5f..b8da610 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-common.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-common.java
@@ -15,13 +15,13 @@
}
@Override
- public final boolean glIsVBOArrayEnabled() {
- return checkArrayVBOEnabled(false);
+ public final boolean glIsVBOArrayBound() {
+ return checkArrayVBOBound(false);
}
@Override
- public final boolean glIsVBOElementArrayEnabled() {
- return checkElementVBOEnabled(false);
+ public final boolean glIsVBOElementArrayBound() {
+ return checkElementVBOBound(false);
}
@Override
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java
index 6cec06d..e7389de 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java
@@ -90,6 +90,11 @@ public final boolean isGL2ES2() {
}
@Override
+public final boolean isGL2ES3() {
+ return _context.isGL2ES3();
+}
+
+ at Override
public final boolean isGL3ES3() {
return _context.isGL3ES3();
}
@@ -191,6 +196,14 @@ public final GL2ES2 getGL2ES2() throws GLException {
}
@Override
+public final GL2ES3 getGL2ES3() throws GLException {
+ if(!isGL2ES3()) {
+ throw new GLException("Not a GL2ES3 implementation");
+ }
+ return this;
+}
+
+ at Override
public final GL3ES3 getGL3ES3() throws GLException {
if(!isGL3ES3()) {
throw new GLException("Not a GL3ES3 implementation");
@@ -280,14 +293,14 @@ private boolean haveARBVertexArrayObject;
private final boolean checkBufferObject(boolean extensionAvail,
boolean allowVAO,
- boolean enabled,
+ boolean bound,
int state,
String kind, boolean throwException) {
if ( inBeginEndPair ) {
throw new GLException("May not call this between glBegin and glEnd");
}
if ( !extensionAvail ) {
- if ( !enabled ) {
+ if ( !bound ) {
return true;
}
if(throwException) {
@@ -296,18 +309,18 @@ private final boolean checkBufferObject(boolean extensionAvail,
return false;
}
int buffer = bufferStateTracker.getBoundBufferObject(state, this);
- if ( enabled ) {
+ if ( bound ) {
if ( 0 != buffer ) {
return true;
}
if ( allowVAO ) {
- buffer = bufferStateTracker.getBoundBufferObject(GL2GL3.GL_VERTEX_ARRAY_BINDING, this);
+ buffer = bufferStateTracker.getBoundBufferObject(GL2ES3.GL_VERTEX_ARRAY_BINDING, this);
if( 0 != buffer && _context.getDefaultVAO() != buffer ) {
return true;
}
}
if ( throwException ) {
- throw new GLException(kind + " must be enabled to call this method");
+ throw new GLException(kind + " must be bound to call this method");
}
return false;
} else {
@@ -315,84 +328,115 @@ private final boolean checkBufferObject(boolean extensionAvail,
return true;
}
if ( throwException ) {
- throw new GLException(kind + " must be disabled to call this method");
+ throw new GLException(kind + " must be unbound to call this method");
}
return false;
}
}
-private final boolean checkArrayVBODisabled(boolean throwException) {
+private final void validateCPUSourcedAvail() {
+ if(!_context.isCPUDataSourcingAvail()) {
+ throw new GLException("CPU data sourcing n/a w/ "+_context);
+ }
+}
+
+private final boolean checkArrayVBOUnbound(boolean throwException) {
+ if(throwException) {
+ validateCPUSourcedAvail();
+ }
return checkBufferObject(haveGL15 || haveARBVertexBufferObject,
haveARBVertexArrayObject, // allowVAO
- false, // enable
+ false, // bound
GL.GL_ARRAY_BUFFER,
"array vertex_buffer_object", throwException);
}
-private final boolean checkArrayVBOEnabled(boolean throwException) {
+private final boolean checkArrayVBOBound(boolean throwException) {
return checkBufferObject(haveGL15 || haveARBVertexBufferObject,
haveARBVertexArrayObject, // allowVAO
- true, // enable
+ true, // bound
GL.GL_ARRAY_BUFFER,
"array vertex_buffer_object", throwException);
}
-private final boolean checkElementVBODisabled(boolean throwException) {
+private final boolean checkElementVBOUnbound(boolean throwException) {
+ if(throwException) {
+ validateCPUSourcedAvail();
+ }
return checkBufferObject(haveGL15 || haveARBVertexBufferObject,
haveARBVertexArrayObject, // allowVAO
- false, // enable
+ false, // bound
GL.GL_ELEMENT_ARRAY_BUFFER,
"element vertex_buffer_object", throwException);
}
-private final boolean checkElementVBOEnabled(boolean throwException) {
+private final boolean checkElementVBOBound(boolean throwException) {
return checkBufferObject(haveGL15 || haveARBVertexBufferObject,
haveARBVertexArrayObject, // allowVAO
- true, // enable
+ true, // bound
GL.GL_ELEMENT_ARRAY_BUFFER,
"element vertex_buffer_object", throwException);
}
-private final boolean checkUnpackPBODisabled(boolean throwException) {
+private final boolean checkIndirectVBOUnbound(boolean throwException) {
+ if(throwException) {
+ validateCPUSourcedAvail();
+ }
+ return checkBufferObject(haveGL15 || haveARBVertexBufferObject,
+ haveARBVertexArrayObject, // allowVAO
+ false, // bound
+ GL4.GL_DRAW_INDIRECT_BUFFER,
+ "indirect vertex_buffer_object", throwException);
+}
+
+private final boolean checkIndirectVBOBound(boolean throwException) {
+ return checkBufferObject(haveGL15 || haveARBVertexBufferObject,
+ haveARBVertexArrayObject, // allowVAO
+ true, // bound
+ GL4.GL_DRAW_INDIRECT_BUFFER,
+ "indirect vertex_buffer_object", throwException);
+}
+
+private final boolean checkUnpackPBOUnbound(boolean throwException) {
return checkBufferObject(haveGL21 || haveARBPixelBufferObject || haveEXTPixelBufferObject,
false, // allowVAO
- false, // enable
+ false, // bound
GL2.GL_PIXEL_UNPACK_BUFFER,
"unpack pixel_buffer_object", throwException);
}
-private final boolean checkUnpackPBOEnabled(boolean throwException) {
+private final boolean checkUnpackPBOBound(boolean throwException) {
return checkBufferObject(haveGL21 || haveARBPixelBufferObject || haveEXTPixelBufferObject,
false, // allowVAO
- true, // enable
+ true, // bound
GL2.GL_PIXEL_UNPACK_BUFFER,
"unpack pixel_buffer_object", throwException);
}
-private final boolean checkPackPBODisabled(boolean throwException) {
+private final boolean checkPackPBOUnbound(boolean throwException) {
return checkBufferObject(haveGL21 || haveARBPixelBufferObject || haveEXTPixelBufferObject,
false, // allowVAO
- false, // enable
+ false, // bound
GL2.GL_PIXEL_PACK_BUFFER,
"pack pixel_buffer_object", throwException);
}
-private final boolean checkPackPBOEnabled(boolean throwException) {
+private final boolean checkPackPBOBound(boolean throwException) {
return checkBufferObject(haveGL21 || haveARBPixelBufferObject || haveEXTPixelBufferObject,
false, // allowVAO
- true, // enable
+ true, // bound
GL2.GL_PIXEL_PACK_BUFFER,
"pack pixel_buffer_object", throwException);
}
@Override
-public final boolean glIsPBOPackEnabled() {
- return checkPackPBOEnabled(false);
+public final boolean glIsPBOPackBound() {
+ return checkPackPBOBound(false);
}
@Override
-public final boolean glIsPBOUnpackEnabled() {
- return checkUnpackPBOEnabled(false);
+public final boolean glIsPBOUnpackBound() {
+ return checkUnpackPBOBound(false);
}
/** Entry point to C language function: <code> void * {@native glMapBuffer}(GLenum target, GLenum access); </code> <br>Part of <code>GL_VERSION_1_5</code>; <code>GL_OES_mapbuffer</code> */
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java
index 35e8b09..8d5dcc7 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java
@@ -12,6 +12,9 @@ public GLES1Impl(GLProfile glp, GLContextImpl context) {
this.glProfile = glp;
}
+public final void finalizeInit() {
+}
+
@Override
public final boolean isGL4bc() {
return false;
@@ -68,6 +71,11 @@ public final boolean isGL2ES2() {
}
@Override
+public final boolean isGL2ES3() {
+ return false;
+}
+
+ at Override
public final boolean isGL3ES3() {
return false;
}
@@ -163,6 +171,11 @@ public final GL2ES1 getGL2ES1() throws GLException {
}
@Override
+public final GL2ES3 getGL2ES3() throws GLException {
+ throw new GLException("Not a GL2ES3 implementation");
+}
+
+ at Override
public final GL2ES2 getGL2ES2() throws GLException {
throw new GLException("Not a GL2ES2 implementation");
}
@@ -190,21 +203,21 @@ private final GLBufferSizeTracker bufferSizeTracker;
private final GLBufferStateTracker bufferStateTracker;
private final GLStateTracker glStateTracker;
-private final boolean checkBufferObject(boolean enabled,
+private final boolean checkBufferObject(boolean bound,
int state,
String kind, boolean throwException) {
final int buffer = bufferStateTracker.getBoundBufferObject(state, this);
- if (enabled) {
+ if (bound) {
if (0 == buffer) {
if(throwException) {
- throw new GLException(kind + " must be enabled to call this method");
+ throw new GLException(kind + " must be bound to call this method");
}
return false;
}
} else {
if (0 != buffer) {
if(throwException) {
- throw new GLException(kind + " must be disabled to call this method");
+ throw new GLException(kind + " must be unbound to call this method");
}
return false;
}
@@ -212,46 +225,46 @@ private final boolean checkBufferObject(boolean enabled,
return true;
}
-private final boolean checkArrayVBODisabled(boolean throwException) {
- return checkBufferObject(false, // enabled
+private final boolean checkArrayVBOUnbound(boolean throwException) {
+ return checkBufferObject(false, // bound
GL.GL_ARRAY_BUFFER,
"array vertex_buffer_object", throwException);
}
-private final boolean checkArrayVBOEnabled(boolean throwException) {
- return checkBufferObject(true, // enabled
+private final boolean checkArrayVBOBound(boolean throwException) {
+ return checkBufferObject(true, // bound
GL.GL_ARRAY_BUFFER,
"array vertex_buffer_object", throwException);
}
-private final boolean checkElementVBODisabled(boolean throwException) {
- return checkBufferObject(false, // enabled
+private final boolean checkElementVBOUnbound(boolean throwException) {
+ return checkBufferObject(false, // bound
GL.GL_ELEMENT_ARRAY_BUFFER,
"element vertex_buffer_object", throwException);
}
-private final boolean checkElementVBOEnabled(boolean throwException) {
- return checkBufferObject(true, // enabled
+private final boolean checkElementVBOBound(boolean throwException) {
+ return checkBufferObject(true, // bound
GL.GL_ELEMENT_ARRAY_BUFFER,
"element vertex_buffer_object", throwException);
}
-private final boolean checkUnpackPBODisabled(boolean throwException) {
+private final boolean checkUnpackPBOUnbound(boolean throwException) {
// PBO n/a for ES 1.1 or ES 2.0
return true;
}
-private final boolean checkUnpackPBOEnabled(boolean throwException) {
+private final boolean checkUnpackPBOBound(boolean throwException) {
// PBO n/a for ES 1.1 or ES 2.0
return false;
}
-private final boolean checkPackPBODisabled(boolean throwException) {
+private final boolean checkPackPBOUnbound(boolean throwException) {
// PBO n/a for ES 1.1 or ES 2.0
return true;
}
-private final boolean checkPackPBOEnabled(boolean throwException) {
+private final boolean checkPackPBOBound(boolean throwException) {
// PBO n/a for ES 1.1 or ES 2.0
return false;
}
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles3.java b/make/config/jogl/gl-impl-CustomJavaCode-gles3.java
index a033524..1a1d7ab 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-gles3.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-gles3.java
@@ -14,6 +14,9 @@ public GLES3Impl(GLProfile glp, GLContextImpl context) {
this._isES3 = glp.getImplName() == GLProfile.GLES3;
}
+public final void finalizeInit() {
+}
+
@Override
public final boolean isGL4bc() {
return false;
@@ -45,7 +48,7 @@ public final boolean isGLES1() {
@Override
public final boolean isGLES2() {
- return true;
+ return !_isES3;
}
@Override
@@ -69,6 +72,11 @@ public final boolean isGL2ES2() {
}
@Override
+public final boolean isGL2ES3() {
+ return _isES3;
+}
+
+ at Override
public final boolean isGL3ES3() {
return _isES3;
}
@@ -170,6 +178,14 @@ public final GL2ES2 getGL2ES2() throws GLException {
}
@Override
+public final GL2ES3 getGL2ES3() throws GLException {
+ if(!_isES3) {
+ throw new GLException("Not a GL2ES3 implementation");
+ }
+ return this;
+}
+
+ at Override
public final GL3ES3 getGL3ES3() throws GLException {
if(!_isES3) {
throw new GLException("Not a GL3ES3 implementation");
@@ -201,11 +217,11 @@ private final GLStateTracker glStateTracker;
private final boolean checkBufferObject(boolean extensionAvail,
boolean allowVAO,
- boolean enabled,
+ boolean bound,
int state,
String kind, boolean throwException) {
if ( !extensionAvail ) {
- if ( !enabled ) {
+ if ( !bound ) {
return true;
}
if(throwException) {
@@ -214,18 +230,18 @@ private final boolean checkBufferObject(boolean extensionAvail,
return false;
}
int buffer = bufferStateTracker.getBoundBufferObject(state, this);
- if ( enabled ) {
+ if ( bound ) {
if ( 0 != buffer ) {
return true;
}
if ( allowVAO ) {
- buffer = bufferStateTracker.getBoundBufferObject(GLES3.GL_VERTEX_ARRAY_BINDING, this);
+ buffer = bufferStateTracker.getBoundBufferObject(GL2ES3.GL_VERTEX_ARRAY_BINDING, this);
if( 0 != buffer && _context.getDefaultVAO() != buffer ) {
return true;
}
}
if ( throwException ) {
- throw new GLException(kind + " must be enabled to call this method");
+ throw new GLException(kind + " must be bound to call this method");
}
return false;
} else {
@@ -233,84 +249,96 @@ private final boolean checkBufferObject(boolean extensionAvail,
return true;
}
if ( throwException ) {
- throw new GLException(kind + " must be disabled to call this method");
+ throw new GLException(kind + " must be unbound to call this method");
}
return false;
}
}
-private final boolean checkArrayVBODisabled(boolean throwException) {
+private final void validateCPUSourcedAvail() {
+ if(!_context.isCPUDataSourcingAvail()) {
+ throw new GLException("CPU data sourcing n/a w/ "+_context);
+ }
+}
+
+private final boolean checkArrayVBOUnbound(boolean throwException) {
+ if(throwException) {
+ validateCPUSourcedAvail();
+ }
return checkBufferObject(true,
_isES3, // allowVAO
- false, // enable
+ false, // bound
GL.GL_ARRAY_BUFFER,
"array vertex_buffer_object", throwException);
}
-private final boolean checkArrayVBOEnabled(boolean throwException) {
+private final boolean checkArrayVBOBound(boolean throwException) {
return checkBufferObject(true,
_isES3, // allowVAO
- true, // enable
+ true, // bound
GL.GL_ARRAY_BUFFER,
"array vertex_buffer_object", throwException);
}
-private final boolean checkElementVBODisabled(boolean throwException) {
+private final boolean checkElementVBOUnbound(boolean throwException) {
+ if(throwException) {
+ validateCPUSourcedAvail();
+ }
return checkBufferObject(true,
_isES3, // allowVAO
- false, // enable
+ false, // bound
GL.GL_ELEMENT_ARRAY_BUFFER,
"element vertex_buffer_object", throwException);
}
-private final boolean checkElementVBOEnabled(boolean throwException) {
+private final boolean checkElementVBOBound(boolean throwException) {
return checkBufferObject(true,
_isES3, // allowVAO
- true, // enable
+ true, // bound
GL.GL_ELEMENT_ARRAY_BUFFER,
"element vertex_buffer_object", throwException);
}
-private final boolean checkUnpackPBODisabled(boolean throwException) {
+private final boolean checkUnpackPBOUnbound(boolean throwException) {
return checkBufferObject(_isES3,
false, // allowVAO
- false, // enable
+ false, // bound
GL2.GL_PIXEL_UNPACK_BUFFER,
"unpack pixel_buffer_object", throwException);
}
-private final boolean checkUnpackPBOEnabled(boolean throwException) {
+private final boolean checkUnpackPBOBound(boolean throwException) {
return checkBufferObject(_isES3,
false, // allowVAO
- true, // enable
+ true, // bound
GL2.GL_PIXEL_UNPACK_BUFFER,
"unpack pixel_buffer_object", throwException);
}
-private final boolean checkPackPBODisabled(boolean throwException) {
+private final boolean checkPackPBOUnbound(boolean throwException) {
return checkBufferObject(_isES3,
false, // allowVAO
- false, // enable
+ false, // bound
GL2.GL_PIXEL_PACK_BUFFER,
"pack pixel_buffer_object", throwException);
}
-private final boolean checkPackPBOEnabled(boolean throwException) {
+private final boolean checkPackPBOBound(boolean throwException) {
return checkBufferObject(_isES3,
false, // allowVAO
- true, // enable
+ true, // bound
GL2.GL_PIXEL_PACK_BUFFER,
"pack pixel_buffer_object", throwException);
}
@Override
-public final boolean glIsPBOPackEnabled() {
- return checkPackPBOEnabled(false);
+public final boolean glIsPBOPackBound() {
+ return checkPackPBOBound(false);
}
@Override
-public final boolean glIsPBOUnpackEnabled() {
- return checkUnpackPBOEnabled(false);
+public final boolean glIsPBOUnpackBound() {
+ return checkUnpackPBOBound(false);
}
/** Entry point to C language function: <code> void * {@native glMapBuffer}(GLenum target, GLenum access); </code> <br>Part of <code>GL_VERSION_1_5</code>; <code>GL_OES_mapbuffer</code> */
diff --git a/make/config/jogl/gl2-common-cpubufferJavaCode.java b/make/config/jogl/gl2-common-cpubufferJavaCode.java
new file mode 100644
index 0000000..50a97b3
--- /dev/null
+++ b/make/config/jogl/gl2-common-cpubufferJavaCode.java
@@ -0,0 +1,13 @@
+
+ /** Entry point to C language function: <code> void {@native glDrawElementsInstanced}(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLsizei instancecount); </code> <br>Part of <code>GL_ES_VERSION_3_0</code>, <code>GL_VERSION_3_1</code>; <code>GL_ARB_draw_instanced</code>
+ @param indices a direct or array-backed {@link java.nio.Buffer} */
+ public void glDrawElementsInstanced(int mode, int count, int type, Buffer indices, int instancecount);
+
+ /** Entry point to C language function: <code> void {@native glDrawRangeElements}(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices); </code> <br>Part of <code>GL_VERSION_1_2</code>, <code>GL_ES_VERSION_3_0</code>
+ @param indices a direct or array-backed {@link java.nio.Buffer} */
+ public void glDrawRangeElements(int mode, int start, int end, int count, int type, Buffer indices);
+
+ /** Entry point to C language function: <code> void {@native glVertexAttribIPointer}(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); </code> <br>Part of <code>GL_ES_VERSION_3_0</code>, <code>GL_VERSION_3_0</code>
+ @param pointer a direct only {@link java.nio.Buffer} */
+ public void glVertexAttribIPointer(int index, int size, int type, int stride, Buffer pointer);
+
diff --git a/make/config/jogl/gl2_es1-common-cpubufferJavaCode.java b/make/config/jogl/gl2_es1-common-cpubufferJavaCode.java
new file mode 100644
index 0000000..39bc141
--- /dev/null
+++ b/make/config/jogl/gl2_es1-common-cpubufferJavaCode.java
@@ -0,0 +1,4 @@
+ /** Entry point to C language function: <code> void {@native glDrawElements}(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices); </code> <br>Part of <code>GL_VERSION_ES_CL_CM</code>, <code>GL_VERSION_1_1</code>, <code>GL_ES_VERSION_2_0</code>
+ @param indices a direct or array-backed {@link java.nio.Buffer} */
+ public void glDrawElements(int mode, int count, int type, Buffer indices);
+
diff --git a/make/config/jogl/gl2_es2-common-cpubufferJavaCode.java b/make/config/jogl/gl2_es2-common-cpubufferJavaCode.java
new file mode 100644
index 0000000..fe6820e
--- /dev/null
+++ b/make/config/jogl/gl2_es2-common-cpubufferJavaCode.java
@@ -0,0 +1,4 @@
+ /** Entry point to C language function: <code> void {@native glVertexAttribPointer}(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * ptr); </code> <br>Part of <code>GL_ES_VERSION_2_0</code>, <code>GL_VERSION_2_0</code>
+ @param ptr a direct only {@link java.nio.Buffer} */
+ public void glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride, Buffer ptr);
+
diff --git a/make/config/jogl/gl3-headers.cfg b/make/config/jogl/gl3-headers.cfg
index 7ab5099..d76d3ae 100644
--- a/make/config/jogl/gl3-headers.cfg
+++ b/make/config/jogl/gl3-headers.cfg
@@ -10,12 +10,12 @@ CustomCCode #include <stddef.h>
CustomCCode #include <malloc.h>
CustomCCode #include <GL/glcorearb.h>
CustomCCode #include <GL/glcorearbext.h>
-CustomCCode #elif defined(macosx)
+CustomCCode #elif defined(__APPLE__)
CustomCCode #include <inttypes.h>
CustomCCode #include <stdlib.h>
CustomCCode #include <GL/glcorearb.h>
CustomCCode #include <GL/glcorearbext.h>
-CustomCCode #include </usr/include/machine/types.h>
+CustomCCode #include <machine/types.h>
CustomCCode /* Provide Windows typedefs */
CustomCCode typedef void* LPVOID;
CustomCCode typedef unsigned int* PUINT;
diff --git a/make/config/jogl/gl3bc-common-cpubufferJavaCode.java b/make/config/jogl/gl3bc-common-cpubufferJavaCode.java
new file mode 100644
index 0000000..d5d2ec8
--- /dev/null
+++ b/make/config/jogl/gl3bc-common-cpubufferJavaCode.java
@@ -0,0 +1,13 @@
+
+ /** Entry point to C language function: <code> void {@native glDrawElementsBaseVertex}(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLint basevertex); </code> <br>Part of <code>GL_ARB_draw_elements_base_vertex</code>, <code>GL_VERSION_3_2</code>
+ @param indices a direct or array-backed {@link java.nio.Buffer} */
+ public void glDrawElementsBaseVertex(int mode, int count, int type, Buffer indices, int basevertex);
+
+ /** Entry point to C language function: <code> void {@native glDrawElementsInstancedBaseVertex}(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLsizei instancecount, GLint basevertex); </code> <br>Part of <code>GL_ARB_draw_elements_base_vertex</code>, <code>GL_VERSION_3_2</code>
+ @param indices a direct or array-backed {@link java.nio.Buffer} */
+ public void glDrawElementsInstancedBaseVertex(int mode, int count, int type, Buffer indices, int instancecount, int basevertex);
+
+ /** Entry point to C language function: <code> void {@native glDrawRangeElementsBaseVertex}(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices, GLint basevertex); </code> <br>Part of <code>GL_ARB_draw_elements_base_vertex</code>, <code>GL_VERSION_3_2</code>
+ @param indices a direct or array-backed {@link java.nio.Buffer} */
+ public void glDrawRangeElementsBaseVertex(int mode, int start, int end, int count, int type, Buffer indices, int basevertex);
+
diff --git a/make/config/jogl/gl4bc-common-cpubufferJavaCode.java b/make/config/jogl/gl4bc-common-cpubufferJavaCode.java
new file mode 100644
index 0000000..a29f540
--- /dev/null
+++ b/make/config/jogl/gl4bc-common-cpubufferJavaCode.java
@@ -0,0 +1,21 @@
+
+ /** Entry point to C language function: <code> void {@native glDrawArraysIndirect}(GLenum mode, const GLvoid * indirect); </code> <br>Part of <code>GL_VERSION_4_0</code>, <code>GL_ARB_draw_indirect</code>
+ @param indirect a direct or array-backed {@link java.nio.Buffer} */
+ public void glDrawArraysIndirect(int mode, Buffer indirect);
+
+ /** Entry point to C language function: <code> void {@native glDrawElementsIndirect}(GLenum mode, GLenum type, const GLvoid * indirect); </code> <br>Part of <code>GL_VERSION_4_0</code>, <code>GL_ARB_draw_indirect</code>
+ @param indirect a direct or array-backed {@link java.nio.Buffer} */
+ public void glDrawElementsIndirect(int mode, int type, Buffer indirect);
+
+ /** Entry point to C language function: <code> void {@native glDrawElementsInstancedBaseInstance}(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount, GLuint baseinstance); </code> <br>Part of <code>GL_VERSION_4_2</code>, <code>GL_ARB_base_instance</code>
+ @param indices a direct or array-backed {@link java.nio.Buffer} */
+ public void glDrawElementsInstancedBaseInstance(int mode, int count, int type, Buffer indices, int instancecount, int baseinstance);
+
+ /** Entry point to C language function: <code> void {@native glDrawElementsInstancedBaseVertexBaseInstance}(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); </code> <br>Part of <code>GL_VERSION_4_2</code>, <code>GL_ARB_base_instance</code>
+ @param indices a direct or array-backed {@link java.nio.Buffer} */
+ public void glDrawElementsInstancedBaseVertexBaseInstance(int mode, int count, int type, Buffer indices, int instancecount, int basevertex, int baseinstance);
+
+ /** Entry point to C language function: <code> void {@native glVertexAttribLPointer}(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); </code> <br>Part of <code>GL_VERSION_4_1</code>, <code>GL_ARB_vertex_attrib_64bit</code>
+ @param pointer a direct only {@link java.nio.Buffer} */
+ public void glVertexAttribLPointer(int index, int size, int type, int stride, Buffer pointer);
+
diff --git a/make/config/jogl/glu-gl2.cfg b/make/config/jogl/glu-gl2.cfg
index 2dcc15a..a634e31 100644
--- a/make/config/jogl/glu-gl2.cfg
+++ b/make/config/jogl/glu-gl2.cfg
@@ -15,10 +15,10 @@ CustomCCode #include <windows.h>
CustomCCode #undef WIN32_LEAN_AND_MEAN
CustomCCode
CustomCCode #include <stddef.h>
-CustomCCode #elif defined(macosx)
+CustomCCode #elif defined(__APPLE__)
CustomCCode #include <inttypes.h>
CustomCCode #include <jni.h>
-CustomCCode #include </usr/include/machine/types.h>
+CustomCCode #include <machine/types.h>
CustomCCode #elif defined(__unix__)
CustomCCode #include <inttypes.h>
CustomCCode #endif
diff --git a/make/config/nativewindow/jawt-macosx.cfg b/make/config/nativewindow/jawt-macosx.cfg
index 20260f6..5f6bbfd 100644
--- a/make/config/nativewindow/jawt-macosx.cfg
+++ b/make/config/nativewindow/jawt-macosx.cfg
@@ -8,7 +8,7 @@ Opaque long NSView *
Opaque long CALayer *
CustomCCode #include <inttypes.h>
-CustomCCode #include </usr/include/machine/types.h>
+CustomCCode #include <machine/types.h>
StructPackage JAWT_MacOSXDrawingSurfaceInfo jogamp.nativewindow.jawt.macosx
EmitStruct JAWT_MacOSXDrawingSurfaceInfo
diff --git a/make/doc/jogl/spec-overview.html b/make/doc/jogl/spec-overview.html
index 6284cde..1a63fb7 100644
--- a/make/doc/jogl/spec-overview.html
+++ b/make/doc/jogl/spec-overview.html
@@ -329,17 +329,13 @@ to the underlying native engine.</p>
<h3><a name="SHARING">Sharing of Server-Side OpenGL Objects between GLContexts</a></h3>
-Sharing of server-side OpenGL objects such as textures and display
-lists among OpenGL contexts is supported in this specification.
-However, the specification does not guarantee that a request to share
-objects between two contexts will succeed. Certain OpenGL
-implementations restrict sharing in certain ways. Applications should
-assume that sharing is a request more than an assertion.
-Implementations of this specification should, but are not required to,
-provide timely notification of a failure of a request to share objects
-between two GLContexts, perhaps in the form of a GLException. The
-situation in which sharing is most likely to work on all platforms is
-between two GLContexts associated with the same GLDrawable.
+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
+for details.
+</p>
<h3>Criteria Used for Inclusion of APIs into the Java Bindings</h3>
diff --git a/make/joglversion b/make/joglversion
index 84a9836..079f9de 100644
--- a/make/joglversion
+++ b/make/joglversion
@@ -1,4 +1,5 @@
Manifest-Version: 1.0
+Application-Name: Java Bindings for OpenGL
Specification-Title: Java Bindings for OpenGL API Specification
Specification-Version: @BASEVERSION@
Specification-Vendor: JogAmp Community
diff --git a/make/joglversion-all b/make/joglversion-all
index 84a9836..079f9de 100644
--- a/make/joglversion-all
+++ b/make/joglversion-all
@@ -1,4 +1,5 @@
Manifest-Version: 1.0
+Application-Name: Java Bindings for OpenGL
Specification-Title: Java Bindings for OpenGL API Specification
Specification-Version: @BASEVERSION@
Specification-Vendor: JogAmp Community
diff --git a/make/joglversion-test b/make/joglversion-test
index b130bb2..c449303 100644
--- a/make/joglversion-test
+++ b/make/joglversion-test
@@ -1,4 +1,5 @@
Manifest-Version: 1.0
+Application-Name: Java Bindings for OpenGL Test
Specification-Title: Test Java Bindings for OpenGL API Specification
Specification-Version: @BASEVERSION@
Specification-Vendor: JogAmp Community
diff --git a/make/joglversion-test-android b/make/joglversion-test-android
index 153b3c3..db757c3 100644
--- a/make/joglversion-test-android
+++ b/make/joglversion-test-android
@@ -1,4 +1,5 @@
Manifest-Version: 1.0
+Application-Name: Java Bindings for OpenGL Test
Specification-Title: Test Java Bindings for OpenGL API Specification
Specification-Version: @BASEVERSION@
Specification-Vendor: JogAmp Community
diff --git a/make/nativewindowversion b/make/nativewindowversion
index 3b3308a..9a26432 100644
--- a/make/nativewindowversion
+++ b/make/nativewindowversion
@@ -1,4 +1,5 @@
Manifest-Version: 1.0
+Application-Name: Native Window Interface
Specification-Title: Native Window Interface API Specification
Specification-Version: @BASEVERSION@
Specification-Vendor: JogAmp Community
diff --git a/make/newtversion b/make/newtversion
index 8444a49..6f7047a 100644
--- a/make/newtversion
+++ b/make/newtversion
@@ -1,4 +1,5 @@
Manifest-Version: 1.0
+Application-Name: NEWT
Specification-Title: NEWT API Specification
Specification-Version: @BASEVERSION@
Specification-Vendor: JogAmp Community
diff --git a/make/resources/android/AndroidManifest-jogl.xml b/make/resources/android/AndroidManifest-jogl.xml
index 1c08cc4..d88b48f 100644
--- a/make/resources/android/AndroidManifest-jogl.xml
+++ b/make/resources/android/AndroidManifest-jogl.xml
@@ -4,11 +4,12 @@
package="javax.media.opengl">
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
- <!-- uses-feature android:name="android.hardware.camera" android:required="false" / --> <!-- not yet -->
+ <uses-feature android:name="android.hardware.camera" android:required="false" />
+ <uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-library android:name="com.jogamp.common" android:required="true" />
- <uses-sdk android:minSdkVersion="9" />
+ <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="14"/>
<application android:icon="@drawable/icon"
android:label="@string/app_name"
diff --git a/make/resources/android/AndroidManifest-test.xml b/make/resources/android/AndroidManifest-test.xml
index 5357d0a..0251eb5 100644
--- a/make/resources/android/AndroidManifest-test.xml
+++ b/make/resources/android/AndroidManifest-test.xml
@@ -4,13 +4,14 @@
package="com.jogamp.opengl.test">
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
- <!-- uses-feature android:name="android.hardware.camera" android:required="false" / --> <!-- not yet -->
+ <uses-feature android:name="android.hardware.camera" android:required="false" />
+ <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="jogamp.android.launcher" android:required="true" />
- <uses-sdk android:minSdkVersion="9" />
+ <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="14"/>
<application android:icon="@drawable/icon"
android:label="@string/app_name"
@@ -120,8 +121,8 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
- <activity android:name="com.jogamp.opengl.test.android.MovieSimpleActivityLauncher00a"
- android:label="@string/activity_moviesimple0a_name"
+ <activity android:name="com.jogamp.opengl.test.android.MovieSimpleActivityLauncher00b"
+ android:label="@string/activity_moviesimple0b_name"
android:description="@string/activity_moviesimple_descr"
android:theme="@android:style/Theme.NoDisplay"
>
@@ -130,8 +131,8 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
- <activity android:name="com.jogamp.opengl.test.android.MovieSimpleActivityLauncher00b"
- android:label="@string/activity_moviesimple0b_name"
+ <activity android:name="com.jogamp.opengl.test.android.MovieSimpleActivityLauncher00c"
+ android:label="@string/activity_moviesimple0c_name"
android:description="@string/activity_moviesimple_descr"
android:theme="@android:style/Theme.NoDisplay"
>
@@ -180,6 +181,26 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
+ <activity android:name="com.jogamp.opengl.test.android.MovieCubeActivityLauncher1a"
+ android:label="@string/activity_moviecube1a_name"
+ android:description="@string/activity_moviecube_descr"
+ android:theme="@android:style/Theme.NoDisplay"
+ >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity android:name="com.jogamp.opengl.test.android.MovieCubeActivityLauncher1b"
+ android:label="@string/activity_moviecube1b_name"
+ android:description="@string/activity_moviecube_descr"
+ android:theme="@android:style/Theme.NoDisplay"
+ >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
</application>
</manifest>
diff --git a/make/resources/android/res-test/values/strings.xml b/make/resources/android/res-test/values/strings.xml
index 0b7bd2d..072cf47 100644
--- a/make/resources/android/res-test/values/strings.xml
+++ b/make/resources/android/res-test/values/strings.xml
@@ -23,12 +23,14 @@
<string name="activity_graphui2p_descr">GraphUI 2-pass</string>
<string name="activity_elektro_name">Elektro</string>
<string name="activity_elektro_descr">Elektro</string>
- <string name="activity_moviesimple0a_name">MovieSimple0a</string>
<string name="activity_moviesimple0b_name">MovieSimple0b</string>
+ <string name="activity_moviesimple0c_name">CamSimple0</string>
<string name="activity_moviesimple1a_name">MovieSimple1a</string>
<string name="activity_moviesimple1b_name">MovieSimple1b</string>
<string name="activity_moviesimple2_name">MovieSimple2</string>
<string name="activity_moviesimple_descr">MovieSimple</string>
<string name="activity_moviecube0_name">MovieCube0</string>
+ <string name="activity_moviecube1a_name">CamCube0</string>
+ <string name="activity_moviecube1b_name">CamCube1</string>
<string name="activity_moviecube_descr">MovieCube</string>
</resources>
diff --git a/make/scripts/adb-launch-activity.sh b/make/scripts/adb-launch-activity.sh
index 8439952..401bd51 100644
--- a/make/scripts/adb-launch-activity.sh
+++ b/make/scripts/adb-launch-activity.sh
@@ -2,7 +2,8 @@
#ANAME="com.jogamp.opengl.test/com.jogamp.opengl.test.android.NEWTGenericActivity"
#ANAME="com.jogamp.android.launcher/com.jogamp.android.launcher.NEWTLauncherActivity2"
-ANAME="com.jogamp.opengl.test/com.jogamp.opengl.test.android.NEWTGearsES2ActivityLauncher"
+#ANAME="com.jogamp.opengl.test/com.jogamp.opengl.test.android.NEWTGearsES2ActivityLauncher"
+ANAME="com.jogamp.opengl.test/com.jogamp.opengl.test.android.MovieCubeActivityLauncher0"
adb $* shell "setprop log.redirect-stdio true ; setprop log.redirect-stderr true ; \
am start -a android.intent.action.MAIN -n $ANAME"
diff --git a/make/scripts/check-java-major-version.sh b/make/scripts/check-java-major-version.sh
index 08e3bc7..86a2c28 100755
--- a/make/scripts/check-java-major-version.sh
+++ b/make/scripts/check-java-major-version.sh
@@ -24,4 +24,8 @@ function do_it() {
}
do_it $1 2>&1 | tee check-java-major-version.log
+echo
+echo VERSIONS found:
+echo
+grep 'major version' check-java-major-version.log | sort -u
diff --git a/make/scripts/make.jogl.all.linux-x86_64.sh b/make/scripts/make.jogl.all.linux-x86_64.sh
index f59d6ea..2488a7d 100755
--- a/make/scripts/make.jogl.all.linux-x86_64.sh
+++ b/make/scripts/make.jogl.all.linux-x86_64.sh
@@ -54,7 +54,6 @@ export JOGAMP_JAR_CODEBASE="Codebase: *.goethel.localnet"
# BUILD_ARCHIVE=true \
ant \
- -Dc.compiler.debug=true \
$CUSTOMLIBDIR \
-Drootrel.build=build-x86_64 \
$* 2>&1 | tee -a $LOGF
diff --git a/make/scripts/make.jogl.all.macosx-clang.sh b/make/scripts/make.jogl.all.macosx-clang.sh
new file mode 100755
index 0000000..eb633f5
--- /dev/null
+++ b/make/scripts/make.jogl.all.macosx-clang.sh
@@ -0,0 +1,29 @@
+#! /bin/sh
+
+if [ -e /opt-share/etc/profile.ant ] ; then
+ . /opt-share/etc/profile.ant
+fi
+
+JAVA_HOME=`/usr/libexec/java_home -version 1.7`
+#JAVA_HOME=`/usr/libexec/java_home -version 1.6`
+PATH=$JAVA_HOME/bin:$PATH
+export JAVA_HOME PATH
+
+# -Dc.compiler.debug=true \
+# -Djavacdebug="true" \
+# -Djavacdebuglevel="source,lines,vars" \
+#
+
+export SOURCE_LEVEL=1.6
+export TARGET_LEVEL=1.6
+export TARGET_RT_JAR=/opt-share/jre1.6.0_30/lib/rt.jar
+
+export GLUEGEN_PROPERTIES_FILE="../../gluegen/make/lib/gluegen-clang.properties"
+# or -Dgcc.compat.compiler=clang
+
+#export JOGAMP_JAR_CODEBASE="Codebase: *.jogamp.org"
+export JOGAMP_JAR_CODEBASE="Codebase: *.goethel.localnet"
+
+ant \
+ -Drootrel.build=build-macosx \
+ $* 2>&1 | tee make.jogl.all.macosx.log
diff --git a/make/scripts/make.jogl.all.macosx-java7.sh b/make/scripts/make.jogl.all.macosx-java7.sh
deleted file mode 100755
index ee82bbc..0000000
--- a/make/scripts/make.jogl.all.macosx-java7.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#! /bin/sh
-
-if [ -e /opt-share/etc/profile.ant ] ; then
- . /opt-share/etc/profile.ant
-fi
-
-
-# -Dc.compiler.debug=true \
-# -Djavacdebug="true" \
-# -Djavacdebuglevel="source,lines,vars" \
-#
-
-JAVA_HOME=`/usr/libexec/java_home -version 1.7`
-PATH=$JAVA_HOME/bin:$PATH
-export JAVA_HOME PATH
-
-#export JOGAMP_JAR_CODEBASE="Codebase: *.jogamp.org"
-export JOGAMP_JAR_CODEBASE="Codebase: *.goethel.localnet"
-
-ant \
- -Drootrel.build=build-macosx-java7 \
- $* 2>&1 | tee make.jogl.all.macosx-java7.log
diff --git a/make/scripts/make.jogl.all.macosx.sh b/make/scripts/make.jogl.all.macosx.sh
index c80b41d..0c7fd78 100755
--- a/make/scripts/make.jogl.all.macosx.sh
+++ b/make/scripts/make.jogl.all.macosx.sh
@@ -5,6 +5,7 @@ if [ -e /opt-share/etc/profile.ant ] ; then
fi
JAVA_HOME=`/usr/libexec/java_home -version 1.7`
+#JAVA_HOME=`/usr/libexec/java_home -version 1.6`
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME PATH
diff --git a/make/scripts/make.jogl.all.win32.bat b/make/scripts/make.jogl.all.win32.bat
index 7b0243f..3e84d01 100755
--- a/make/scripts/make.jogl.all.win32.bat
+++ b/make/scripts/make.jogl.all.win32.bat
@@ -1,7 +1,7 @@
set THISDIR="C:\JOGL"
-set J2RE_HOME=c:\jre1.7.0_25_x32
-set JAVA_HOME=c:\jdk1.7.0_25_x32
+set J2RE_HOME=c:\jre1.7.0_45_x32
+set JAVA_HOME=c:\jdk1.7.0_45_x32
set ANT_PATH=C:\apache-ant-1.8.2
set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;c:\mingw\bin;%PATH%
diff --git a/make/scripts/make.jogl.all.win64.bat b/make/scripts/make.jogl.all.win64.bat
index c08c526..5e36c26 100755
--- a/make/scripts/make.jogl.all.win64.bat
+++ b/make/scripts/make.jogl.all.win64.bat
@@ -1,7 +1,7 @@
set THISDIR="C:\JOGL"
-set J2RE_HOME=c:\jre1.7.0_25_x64
-set JAVA_HOME=c:\jdk1.7.0_25_x64
+set J2RE_HOME=c:\jre1.7.0_45_x64
+set JAVA_HOME=c:\jdk1.7.0_45_x64
set ANT_PATH=C:\apache-ant-1.8.2
set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;c:\mingw64\bin;%PATH%
diff --git a/make/scripts/setenv-jogl.sh b/make/scripts/setenv-jogl.sh
index 5e4bb57..186da55 100755
--- a/make/scripts/setenv-jogl.sh
+++ b/make/scripts/setenv-jogl.sh
@@ -113,8 +113,8 @@ CLASSPATH=.:"$GLUEGEN_JAR":"$JOAL_JAR":"$JOGL_CLASSPATH":"$SWT_CLASSPATH":"$JUNI
export 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 LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$GLUEGEN_OS":"$JOGL_LIB_DIR"
+#export 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"
diff --git a/make/scripts/tests-javaws-x64.bat b/make/scripts/tests-javaws-x64.bat
index c14ea5f..6186bc5 100755
--- a/make/scripts/tests-javaws-x64.bat
+++ b/make/scripts/tests-javaws-x64.bat
@@ -1,4 +1,4 @@
-set JRE_PATH=C:\jre1.7.0_25_x64\bin
+set JRE_PATH=C:\jre1.7.0_45_x64\bin
set LOG_PATH=%USERPROFILE%\AppData\LocalLow\Sun\Java\Deployment\log
%JRE_PATH%\javaws -uninstall
diff --git a/make/scripts/tests-osx-x64.sh b/make/scripts/tests-osx-x64.sh
index e1b0720..1204b8a 100755
--- a/make/scripts/tests-osx-x64.sh
+++ b/make/scripts/tests-osx-x64.sh
@@ -3,6 +3,8 @@
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
JAVA_HOME=`/usr/libexec/java_home -version 1.7`
+#JAVA_HOME=`/usr/libexec/java_home -version 1.7.0_25`
+#JAVA_HOME=`/usr/libexec/java_home -version 1.6.0`
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME PATH
diff --git a/make/scripts/tests-win.bat b/make/scripts/tests-win.bat
index 872ba37..0632c24 100755
--- a/make/scripts/tests-win.bat
+++ b/make/scripts/tests-win.bat
@@ -6,10 +6,35 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCom
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteAWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen01GLPBufferNEWT -time 5000
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListAWT -time 5000
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT -time 5000
+
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT2 %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES1NEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT0 %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT1 %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT2 %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT3 %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2AWT3 %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2AWT3b %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextWithJTabbedPaneAWT %*
+scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3 %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextNewtAWTBug523 %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListAWT %*
+
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOOffThreadSharedContextMix2DemosES2NEWT $*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOOnThreadSharedContext1DemoES2NEWT $*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableFactoryNEWT $*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOMix2DemosES2NEWT $*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOMRTNEWT01 $*
+
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateOnOffscrnCapsNEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryGLnBitmapCapsNEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryES2OffscrnCapsNEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableDeadlockAWT %*
+
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile01NEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile02NEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitch01NEWT %*
@@ -29,18 +54,6 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusi
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext11VSyncAnimNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext12FPSAnimNEWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateOnOffscrnCapsNEWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryGLnBitmapCapsNEWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryES2OffscrnCapsNEWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableFactoryNEWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableOffThreadSharedContextES2NEWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOMix2DemosES2NEWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOMRTNEWT01 %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableDeadlockAWT %*
-
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.TestSwingAWT01GLn
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasAWTActionDeadlock00AWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasAWTActionDeadlock02AWT %*
@@ -52,10 +65,20 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.TestJScrollPaneMi
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.TestBug642JSplitPaneMixHwLw01AWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.awt.TestIsRealizedConcurrency01AWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledRendering1GL2NEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledRendering2NEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestRandomTiledRendering2GL2NEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestRandomTiledRendering3GL2AWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsAWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsSwingAWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsSwingAWT2 %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsNewtAWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingNIOImageSwingAWT %*
+
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNewtAWTWrapper %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNEWT -time 30000
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestGearsES1NEWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT %*
+scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT -vsync -time 4000 -x 10 -y 10 -width 100 -height 100 -screen 0
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 -time 5000
@@ -115,7 +138,7 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.nativewindow.TestRecursive
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode00aNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode00bNEWT %*
-scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode00cNEWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode00cNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01aNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01bNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01cNEWT %*
diff --git a/make/scripts/tests-x32-dbg.bat b/make/scripts/tests-x32-dbg.bat
index e5e6451..93069c0 100755
--- a/make/scripts/tests-x32-dbg.bat
+++ b/make/scripts/tests-x32-dbg.bat
@@ -1,20 +1,23 @@
set BLD_SUB=build-win32
-set J2RE_HOME=c:\jre1.7.0_25_x32
-set JAVA_HOME=c:\jdk1.7.0_25_x32
+set J2RE_HOME=c:\jre1.7.0_45_x32
+set JAVA_HOME=c:\jdk1.7.0_45_x32
set ANT_PATH=C:\apache-ant-1.8.2
set PROJECT_ROOT=D:\projects\jogamp\jogl
set BLD_DIR=..\%BLD_SUB%
+REM set FFMPEG_LIB=C:\ffmpeg_libav\lavc53_lavf53_lavu51-ffmpeg\x32
+set FFMPEG_LIB=C:\ffmpeg_libav\lavc55_lavf55_lavu52-ffmpeg\x32
+REM set FFMPEG_LIB=C:\ffmpeg_libav\lavc54_lavf54_lavu52_lavr01-libav\x32
+
REM set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;%PATH%
REM set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;%PROJECT_ROOT%\make\lib\external\angle\win32\20120127;%PATH%
-set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;%PROJECT_ROOT%\make\lib\external\angle\win32\20121010-chrome;%PATH%
+REM set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;%PROJECT_ROOT%\make\lib\external\angle\win32\20121010-chrome;%PATH%
REM set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;%PROJECT_ROOT%\make\lib\external\PVRVFrame\OGLES-2.0\Windows_x86_32;%PATH%
+set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;%FFMPEG_LIB%;%PATH%
REM set LIB_DIR=%BLD_DIR%\lib;..\..\gluegen\%BLD_SUB%\obj
-REM set FFMPEG_LIB=%PROJECT_ROOT%\make\lib\ffmpeg\x32
-REM set LIB_DIR=%FFMPEG_LIB%
set LIB_DIR=
set CP_ALL=.;%BLD_DIR%\jar\jogl-all.jar;%BLD_DIR%\jar\jogl-test.jar;..\..\gluegen\%BLD_SUB%\gluegen-rt.jar;..\..\gluegen\make\lib\junit.jar;%ANT_PATH%\lib\ant.jar;%ANT_PATH%\lib\ant-junit.jar;%BLD_DIR%\..\make\lib\swt\win32-win32-x86\swt-debug.jar
@@ -37,7 +40,8 @@ REM set D_ARGS="-Djogl.debug.DebugGL" "-Djogl.debug.TraceGL"
REM set D_ARGS="-Djogl.debug.DebugGL" "-Djogl.debug.TraceGL" "-Djogl.debug=all"
REM set D_ARGS="-Dnewt.debug.Window" "-Dnewt.debug.Display" "-Dnewt.test.Window.reparent.incompatible=true"
REM set D_ARGS="-Dnewt.debug.Window.MouseEvent"
-set D_ARGS="-Dnewt.debug.Window.KeyEvent"
+REM set D_ARGS="-Dnewt.debug.Window.KeyEvent"
+set D_ARGS="-Djogl.debug.GLMediaPlayer" "-Djogl.debug.GLMediaPlayer.Native"
REM set D_ARGS="-Xcheck:jni" "-Xint" "-verbose:jni"
set X_ARGS="-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true"
diff --git a/make/scripts/tests-x32.bat b/make/scripts/tests-x32.bat
index 6f262eb..c8ead0a 100755
--- a/make/scripts/tests-x32.bat
+++ b/make/scripts/tests-x32.bat
@@ -1,21 +1,24 @@
set BLD_SUB=build-win32
-set J2RE_HOME=c:\jre1.7.0_25_x32
-set JAVA_HOME=c:\jdk1.7.0_25_x32
+set J2RE_HOME=c:\jre1.7.0_45_x32
+set JAVA_HOME=c:\jdk1.7.0_45_x32
set ANT_PATH=C:\apache-ant-1.8.2
set PROJECT_ROOT=D:\projects\jogamp\jogl
set BLD_DIR=..\%BLD_SUB%
+REM set FFMPEG_LIB=C:\ffmpeg_libav\lavc53_lavf53_lavu51-ffmpeg\x32
+set FFMPEG_LIB=C:\ffmpeg_libav\lavc55_lavf55_lavu52-ffmpeg\x32
+REM set FFMPEG_LIB=C:\ffmpeg_libav\lavc54_lavf54_lavu52_lavr01-libav\x32
+
REM set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;%PATH%
REM set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;%PROJECT_ROOT%\make\lib\external\angle\win32\20120127;%PATH%
-set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;%PROJECT_ROOT%\make\lib\external\angle\win32\20121010-chrome;%PATH%
+REM set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;%PROJECT_ROOT%\make\lib\external\angle\win32\20121010-chrome;%PATH%
REM set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;%PROJECT_ROOT%\make\lib\external\PVRVFrame\OGLES-2.0\Windows_x86_32;%PATH%
+set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;%FFMPEG_LIB%;%PATH%
set BLD_DIR=..\%BLD_SUB%
REM set LIB_DIR=..\..\gluegen\%BLD_SUB%\obj;%BLD_DIR%\lib
-REM set FFMPEG_LIB=%PROJECT_ROOT%\make\lib\ffmpeg\x32
-REM set LIB_DIR=%FFMPEG_LIB%
set LIB_DIR=
set CP_ALL=.;%BLD_DIR%\jar\jogl-all.jar;%BLD_DIR%\jar\jogl-test.jar;..\..\gluegen\%BLD_SUB%\gluegen-rt.jar;..\..\gluegen\make\lib\junit.jar;%ANT_PATH%\lib\ant.jar;%ANT_PATH%\lib\ant-junit.jar;%BLD_DIR%\..\make\lib\swt\win32-win32-x86\swt-debug.jar
diff --git a/make/scripts/tests-x64-dbg.bat b/make/scripts/tests-x64-dbg.bat
index c8b1ef5..726be54 100755
--- a/make/scripts/tests-x64-dbg.bat
+++ b/make/scripts/tests-x64-dbg.bat
@@ -1,23 +1,26 @@
set BLD_SUB=build-win64
-set J2RE_HOME=c:\jre1.7.0_25_x64
-set JAVA_HOME=c:\jdk1.7.0_25_x64
+set J2RE_HOME=c:\jre1.7.0_45_x64
+set JAVA_HOME=c:\jdk1.7.0_45_x64
set ANT_PATH=C:\apache-ant-1.8.2
set PROJECT_ROOT=D:\projects\jogamp\jogl
set BLD_DIR=..\%BLD_SUB%
-set FFMPEG_LIB=%PROJECT_ROOT%\make\lib\ffmpeg\x64
+REM set FFMPEG_LIB=C:\ffmpeg_libav\lavc53_lavf53_lavu51-ffmpeg\x64
+REM set FFMPEG_LIB=C:\ffmpeg_libav\lavc55_lavf55_lavu52-ffmpeg\x64
+set FFMPEG_LIB=C:\ffmpeg_libav\lavc55_lavf55_lavu52-ffmpeg-2013-10-09\x64
+REM set FFMPEG_LIB=C:\ffmpeg_libav\lavc54_lavf54_lavu52_lavr01-libav\x64
-set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;c:\mingw\bin;%PATH%
+REM set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;c:\mingw\bin;%PATH%
REM set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;%PROJECT_ROOT%\make\lib\external\PVRVFrame\OGLES-2.0\Windows_x86_64;%PATH%
-REM set LIB_DIR=%BLD_DIR%\lib;..\..\gluegen\%BLD_SUB%\obj
-set LIB_DIR=%FFMPEG_LIB%
+set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;%FFMPEG_LIB%;%PATH%
-set CP_ALL=.;%BLD_DIR%\jar\jogl-all.jar;%BLD_DIR%\jar\jogl-test.jar;..\..\gluegen\%BLD_SUB%\gluegen-rt.jar;..\..\gluegen\make\lib\junit.jar;%ANT_PATH%\lib\ant.jar;%ANT_PATH%\lib\ant-junit.jar;%BLD_DIR%\..\make\lib\swt\win32-win32-x86_64\swt-debug.jar
+set CP_ALL=.;%BLD_DIR%\jar\jogl-all.jar;%BLD_DIR%\jar\jogl-test.jar;..\..\joal\%BLD_SUB%\joal.jar;..\..\gluegen\%BLD_SUB%\gluegen-rt.jar;..\..\gluegen\make\lib\junit.jar;%ANT_PATH%\lib\ant.jar;%ANT_PATH%\lib\ant-junit.jar;%BLD_DIR%\..\make\lib\swt\win32-win32-x86_64\swt-debug.jar
echo CP_ALL %CP_ALL%
+REM set D_ARGS="-Djogamp.debug=all"
REM set D_ARGS="-Djogl.debug.GLContext" "-Djogl.debug.FBObject"
REM set D_ARGS="-Djogl.debug.GLDrawable" "-Djogl.debug.EGLDrawableFactory.DontQuery"
REM set D_ARGS="-Djogl.debug.GLDrawable" "-Djogl.debug.EGLDrawableFactory.QueryNativeTK"
@@ -25,7 +28,13 @@ REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all"
REM set D_ARGS="-Djogl.debug.GLDrawable" "-Djogl.debug.GLContext" "-Djogl.debug.GLCanvas"
REM set D_ARGS="-Djogl.debug=all" "-Dnewt.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug=all" "-Djogl.debug.EGLDrawableFactory.DontQuery"
REM set D_ARGS="-Dnativewindow.debug.GraphicsConfiguration -Djogl.debug.CapabilitiesChooser -Djogl.debug.GLProfile"
-REM set D_ARGS="-Djogamp.debug.IOUtil" "-Djogl.debug.GLSLCode" "-Djogl.debug.GLMediaPlayer"
+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"
+REM set D_ARGS="-Djogl.debug.GLMediaPlayer" "-Djogl.debug.GLMediaPlayer.Native"
+REM set D_ARGS="-Djogl.debug.GLMediaPlayer.StreamWorker.delay=25" "-Djogl.debug.GLMediaPlayer"
+REM set D_ARGS="-Djogl.debug.GLMediaPlayer.Native"
+REM set D_ARGS="-Djogl.debug.AudioSink"
REM set D_ARGS="-Djogamp.debug.NativeLibrary=true" "-Djogamp.debug.NativeLibrary.Lookup=true" "-Djogl.debug.GLSLCode"
REM set D_ARGS="-Djogl.debug=all" "-Dnativewindow.debug=all" "-Djogamp.debug.ProcAddressHelper" "-Djogamp.debug.NativeLibrary" "-Djogamp.debug.NativeLibrary.Lookup" "-Djogamp.debug.JNILibLoader" "-Djogamp.debug.TempJarCache" "-Djogamp.debug.JarUtil"
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"
@@ -40,9 +49,11 @@ REM set D_ARGS="-Djogl.debug=all"
REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.Animator" "-Djogl.debug.GLContext" "-Djogl.debug.GLContext.TraceSwitch" "-Djogl.debug.DebugGL" "-Djogl.debug.TraceGL"
REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.Animator" "-Djogl.debug.GLContext" "-Djogl.debug.GLContext.TraceSwitch" "-Djogl.windows.useWGLVersionOf5WGLGDIFuncSet"
REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.Animator" "-Djogl.debug.GLContext" "-Djogl.debug.GLContext.TraceSwitch"
-set D_ARGS="-Dnewt.debug.Window"
+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"
+REM set D_ARGS="-Dnewt.debug.Window"
REM set D_ARGS="-Dnewt.debug.Window.KeyEvent"
-REM set D_ARGS="-Dnewt.debug.Window.MouseEvent"
+set D_ARGS="-Dnewt.debug.Window.MouseEvent"
REM set D_ARGS="-Dnewt.debug.Window.MouseEvent" "-Dnewt.debug.Window.KeyEvent"
REM set D_ARGS="-Dnewt.debug.Window" "-Dnewt.debug.Display"
REM set D_ARGS="-Djogl.debug.GLDebugMessageHandler" "-Djogl.debug.DebugGL" "-Djogl.debug.TraceGL"
diff --git a/make/scripts/tests-x64.bat b/make/scripts/tests-x64.bat
index 899c694..ac74f4c 100755
--- a/make/scripts/tests-x64.bat
+++ b/make/scripts/tests-x64.bat
@@ -1,17 +1,22 @@
set BLD_SUB=build-win64
-set J2RE_HOME=c:\jre1.7.0_25_x64
-set JAVA_HOME=c:\jdk1.7.0_25_x64
+set J2RE_HOME=c:\jre1.7.0_45_x64
+set JAVA_HOME=c:\jdk1.7.0_45_x64
set ANT_PATH=C:\apache-ant-1.8.2
-REM set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;c:\mingw\bin;%PATH%
-set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;%PROJECT_ROOT%\make\lib\external\PVRVFrame\OGLES-2.0\Windows_x86_64;%PATH%
+REM set FFMPEG_LIB=C:\ffmpeg_libav\lavc53_lavf53_lavu51-ffmpeg\x64
+REM set FFMPEG_LIB=C:\ffmpeg_libav\lavc55_lavf55_lavu52-ffmpeg\x64
+set FFMPEG_LIB=C:\ffmpeg_libav\lavc55_lavf55_lavu52-ffmpeg-2013-10-09\x64
+REM set FFMPEG_LIB=C:\ffmpeg_libav\lavc54_lavf54_lavu52_lavr01-libav\x64
+
+REM set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;%PROJECT_ROOT%\make\lib\external\PVRVFrame\OGLES-2.0\Windows_x86_64;%PATH%
+set PATH=%JAVA_HOME%\bin;%ANT_PATH%\bin;%FFMPEG_LIB%;%PATH%
set BLD_DIR=..\%BLD_SUB%
REM set LIB_DIR=%BLD_DIR%\lib;..\..\gluegen\%BLD_SUB%\obj
set LIB_DIR=
-set CP_ALL=.;%BLD_DIR%\jar\jogl-all.jar;%BLD_DIR%\jar\jogl-test.jar;..\..\gluegen\%BLD_SUB%\gluegen-rt.jar;..\..\gluegen\make\lib\junit.jar;%ANT_PATH%\lib\ant.jar;%ANT_PATH%\lib\ant-junit.jar;%BLD_DIR%\..\make\lib\swt\win32-win32-x86_64\swt-debug.jar
+set CP_ALL=.;%BLD_DIR%\jar\jogl-all.jar;%BLD_DIR%\jar\jogl-test.jar;..\..\joal\%BLD_SUB%\joal.jar;..\..\gluegen\%BLD_SUB%\gluegen-rt.jar;..\..\gluegen\make\lib\junit.jar;%ANT_PATH%\lib\ant.jar;%ANT_PATH%\lib\ant-junit.jar;%BLD_DIR%\..\make\lib\swt\win32-win32-x86_64\swt-debug.jar
echo CP_ALL %CP_ALL%
set X_ARGS="-Dsun.java2d.noddraw=true" "-Dsun.awt.noerasebackground=true"
diff --git a/make/scripts/tests-x64.sh b/make/scripts/tests-x64.sh
index c3c6762..fe2fc49 100755
--- a/make/scripts/tests-x64.sh
+++ b/make/scripts/tests-x64.sh
@@ -2,7 +2,14 @@
SDIR=`dirname $0`
-#export LD_LIBRARY_PATH=/home/sven/libav/lib:$LD_LIBRARY_PATH
+#export LD_LIBRARY_PATH=/home/sven/libav-0.8/lib:$LD_LIBRARY_PATH
+#export LD_LIBRARY_PATH=/home/sven/ffmpeg-0.10/lib:$LD_LIBRARY_PATH
+
+#export LD_LIBRARY_PATH=/home/sven/libav-9.x/lib:$LD_LIBRARY_PATH
+export LD_LIBRARY_PATH=/home/sven/ffmpeg-1.2/lib:$LD_LIBRARY_PATH
+
+#export LD_LIBRARY_PATH=/home/sven/libav-10.x/lib:$LD_LIBRARY_PATH
+#export LD_LIBRARY_PATH=/home/sven/ffmpeg-2.x/lib:$LD_LIBRARY_PATH
if [ -e $SDIR/../../../gluegen/make/scripts/setenv-build-jogl-x86_64.sh ] ; then
. $SDIR/../../../gluegen/make/scripts/setenv-build-jogl-x86_64.sh
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 454bf21..a93c2ed 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -81,9 +81,13 @@ function jrun() {
swton=$1
shift
+ #D_ARGS="-Djogl.debug.DebugGL"
+ #D_ARGS="-Djogl.debug.TraceGL"
+ #D_ARGS="-Djogl.debug.DebugGL -Djogl.debug.TraceGL"
#D_ARGS="-Dnativewindow.debug.X11Util.ATI_HAS_NO_XCLOSEDISPLAY_BUG"
#D_ARGS="-Dnativewindow.debug.X11Util.ATI_HAS_NO_MULTITHREADING_BUG"
#D_ARGS="-Djogl.disable.opengles"
+ #D_ARGS="-Djogl.debug.DebugGL -Dnewt.debug.Window"
#D_ARGS="-Djogl.debug.DebugGL -Djogl.debug.FBObject"
#D_ARGS="-Djogl.debug.FBObject -Djogl.debug.TraceGL -Djogl.debug.GLBufferStateTracker"
#D_ARGS="-Djogl.debug.FBObject"
@@ -111,7 +115,7 @@ function jrun() {
#D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all"
#D_ARGS="-Dnativewindow.debug.X11Util -Dnativewindow.debug.X11Util.TraceDisplayLifecycle -Djogl.debug.EGLDisplayUtil -Djogl.debug.GLDrawable"
#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"
+ #D_ARGS="-Djogl.debug.Animator -Djogl.debug.GLDrawable -Dnativewindow.debug.NativeWindow"
#D_ARGS="-Djogl.debug=all -Dnewt.debug=all"
#D_ARGS="-Djogl.debug.EGLDisplayUtil -Djogl.debug.GLDrawable"
#D_ARGS="-Djogl.debug.GLDrawable -Djogl.debug.GLContext -Djogl.debug.GLCanvas"
@@ -131,7 +135,12 @@ function jrun() {
#D_ARGS="-Djogl.1thread=true -Djogl.debug.Threading"
#D_ARGS="-Djogl.debug.DebugGL -Djogl.debug.TraceGL -Djogl.debug.GLContext.TraceSwitch -Djogl.debug=all"
#D_ARGS="-Djogamp.debug.IOUtil -Djogl.debug.GLSLCode -Djogl.debug.GLMediaPlayer"
- D_ARGS="-Djogl.debug.GLMediaPlayer -Djogl.debug.AudioSink"
+ #D_ARGS="-Djogl.debug.GLMediaPlayer -Djogl.debug.AudioSink"
+ D_ARGS="-Djogl.debug.GLMediaPlayer -Djogl.debug.GLMediaPlayer.Native"
+ #D_ARGS="-Djogl.debug.GLMediaPlayer"
+ #D_ARGS="-Djogl.debug.GLMediaPlayer.StreamWorker.delay=25 -Djogl.debug.GLMediaPlayer"
+ #D_ARGS="-Djogl.debug.GLMediaPlayer.Native"
+ #D_ARGS="-Djogl.debug.AudioSink"
#D_ARGS="-Djogl.debug.GLArrayData"
#D_ARGS="-Djogl.debug.GLDrawable"
#D_ARGS="-Djogl.debug.EGLDisplayUtil -Dnativewindow.debug.GraphicsConfiguration -Djogl.debug.GLDrawable"
@@ -139,7 +148,6 @@ function jrun() {
#D_ARGS="-Djogl.debug.GLDrawable"
#D_ARGS="-Dnewt.debug.Screen -Dnewt.debug.Window"
#D_ARGS="-Dnewt.debug.Screen"
- #D_ARGS="-Dnewt.debug.Window"
#D_ARGS="-Dnewt.test.Screen.disableRandR13"
#D_ARGS="-Dnewt.test.Screen.disableScreenMode -Dnewt.debug.Screen"
#D_ARGS="-Dnewt.debug.Screen -Djogl.debug.Animator"
@@ -149,8 +157,7 @@ function jrun() {
#D_ARGS="-Dnativewindow.debug.GraphicsConfiguration -Dnativewindow.debug.NativeWindow"
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Animator -Djogl.debug.GLDrawable -Djogl.debug.GLContext -Djogl.debug.GLContext.TraceSwitch"
#D_ARGS="-Djogl.debug.GLContext -Djogl.debug.ExtensionAvailabilityCache"
- ##D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLProfile -Djogl.debug.GLDrawable -Djogl.debug.EGLDisplayUtil"
- ##D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLProfile"
+ #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLProfile -Djogl.debug.GLDrawable -Djogl.debug.EGLDisplayUtil"
#D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLProfile -Djogl.debug.GLDrawable"
#D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLProfile"
#D_ARGS="-Djogl.debug.GLProfile"
@@ -174,6 +181,7 @@ function jrun() {
#D_ARGS="-Dnewt.debug=all -Djogamp.common.utils.locks.Lock.timeout=600000"
#D_ARGS="-Djogl.debug.Animator -Dnewt.debug=all"
#D_ARGS="-Dnewt.debug.EDT -Dnewt.debug.Display -Dnativewindow.debug.X11Util -Djogl.debug.GLDrawable -Djogl.debug.GLCanvas"
+ #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLContext.TraceSwitch"
#D_ARGS="-Djogl.debug.GLContext"
#D_ARGS="-Dnativewindow.debug.GraphicsConfiguration -Djogl.debug.CapabilitiesChooser -Djogl.debug.GLDrawable -Djogl.debug.GLProfile"
#D_ARGS="-Dnewt.debug.Screen -Dnewt.debug.EDT -Djogamp.debug.Lock"
@@ -189,6 +197,8 @@ function jrun() {
#D_ARGS="-Dnewt.debug.Window -Dnativewindow.debug.JAWT -Djogl.debug.Animator"
#D_ARGS="-Dnewt.debug.Window -Djogl.debug.GLDrawable"
#D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Window.KeyEvent"
+ #D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Window.MouseEvent -Dnewt.debug.Window.KeyEvent"
+ #D_ARGS="-Dnewt.debug.Window"
#D_ARGS="-Xprof"
#D_ARGS="-Dnativewindow.debug=all"
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel"
@@ -197,10 +207,12 @@ function jrun() {
#D_ARGS="-Djogl.debug.GLContext -Dnativewindow.debug.X11Util.XSync"
#D_ARGS="-Dnativewindow.debug.X11Util.XSync -Dnativewindow.debug.ToolkitLock.TraceLock"
#D_ARGS="-Dnativewindow.debug.NativeWindow"
+ #D_ARGS="-Dnativewindow.osx.calayer.bugfree"
#D_ARGS="-Dnativewindow.debug.ToolkitLock"
#D_ARGS="-Djogl.debug.graph.curve -Djogl.debug.GLSLCode -Djogl.debug.TraceGL"
#D_ARGS="-Djogl.debug.graph.curve -Djogl.debug.GLSLState"
- #D_ARGS="-Djogamp.debug.JNILibLoader -Djogamp.debug.TempJarCache -Djogamp.debug.JarUtil"
+ #D_ARGS="-Djogamp.debug.TempJarCache -Djogamp.debug.JarUtil -Djogamp.debug.IOUtil"
+ #D_ARGS="-Djogamp.debug.JNILibLoader -Djogamp.debug.TempJarCache -Djogamp.debug.JarUtil -Djogamp.debug.IOUtil"
#D_ARGS="-Djogamp.debug.JNILibLoader -Djogamp.debug.TempFileCache -Djogamp.debug.TempJarCache -Djogamp.debug.JarUtil"
#D_ARGS="-Djogamp.debug.JNILibLoader -Djogamp.debug.TempFileCache -Djogamp.debug.TempJarCache -Djogamp.debug.JarUtil -Djogamp.gluegen.UseTempJarCache=false"
#D_ARGS="-Dnewt.test.EDTMainThread -Dnewt.debug.MainThread"
@@ -211,7 +223,8 @@ function jrun() {
#D_ARGS="-Djogl.debug.GLContext -Dnewt.debug=all -Djogamp.debug.Lock -Djogamp.common.utils.locks.Lock.timeout=10000"
#D_ARGS="-Djogl.debug.GLContext -Dnewt.debug=all"
#D_ARGS="-Dnewt.debug=all"
- #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.GLJPanel"
+ #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.GLJPanel -Djogl.debug.TileRenderer -Djogl.debug.TileRenderer.PNG"
+ #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.GLJPanel -Djogl.debug.TileRenderer"
#D_ARGS="-Djogl.debug.PNGImage"
#D_ARGS="-Djogl.debug.JPEGImage"
#D_ARGS="-Djogl.debug.GLDrawable -Dnativewindow.debug.GraphicsConfiguration -Djogl.debug.CapabilitiesChooser"
@@ -294,6 +307,7 @@ function testawtswt() {
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NewtCanvasAWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile00NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NEWT $*
#testawtswt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestElektronenMultipliziererNEWT $*
@@ -314,8 +328,21 @@ function testawtswt() {
# av demos
#
#testnoawt jogamp.opengl.openal.av.ALDummyUsage $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
-testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $*
+testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $*
+
+#
+# tile rendring / printing w/ & w/o AWT
+#
+#testnoawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledRendering1GL2NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledRendering2NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.tile.TestRandomTiledRendering2GL2NEWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.tile.TestRandomTiledRendering3GL2AWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsSwingAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsSwingAWT2 $*
+#testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingGearsNewtAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.tile.TestTiledPrintingNIOImageSwingAWT $*
#
# core/newt (testnoawt and testawt)
@@ -331,9 +358,9 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $*
#testnoawt com.jogamp.opengl.test.junit.jogl.math.TestGluUnprojectFloatNOUI $*
#testnoawt com.jogamp.opengl.test.junit.jogl.math.TestGluUnprojectDoubleNOUI $*
#testnoawt com.jogamp.opengl.test.junit.jogl.math.TestFloatUtil01MatrixMatrixMultNOUI $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.math.TestBinary16NOUI $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLVersionParsing00NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestNEWTCloseX11DisplayBug565 $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile00NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile01NEWT $*
@@ -347,11 +374,30 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMapBufferRead01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestBug669RecursiveGLContext01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestBug669RecursiveGLContext02NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestBug692GL3VAO $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestBug692GL3VAONEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestCPUSourcingAPINEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLExtensionQueryOffscreen $*
+
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT2 $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES1NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT0 $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT1 $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT2 $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT3 $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2AWT3 $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2AWT3b $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2SWT3 $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextWithJTabbedPaneAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextNewtAWTBug523 $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListAWT $*
+
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOffThreadSharedContextMix2DemosES2NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOnThreadSharedContext1DemoES2NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableFactoryNEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOMix2DemosES2NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOMRTNEWT01 $*
+
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLPointsNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLMesaBug651NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLMesaBug658NEWT $*
@@ -371,12 +417,6 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableFactoryNEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOffThreadSharedContextMix2DemosES2NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOnThreadSharedContext1DemoES2NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOMix2DemosES2NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOMRTNEWT01 $*
-
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext01VSyncAnimNEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext01VSyncAnimAWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext02FPSAnimNEWT $*
@@ -384,6 +424,7 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext11VSyncAnimNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext12FPSAnimNEWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.glels.TestGLContextDrawableSwitch02AWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.glels.TestGLContextDrawableSwitch01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.glels.TestGLContextDrawableSwitch10NEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.glels.TestGLContextDrawableSwitch11NewtAWT $*
@@ -397,6 +438,9 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableDeadlockAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug461FBOSupersamplingSwingAWT
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestNEWTCloseX11DisplayBug565 $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.TestAWTCloseX11DisplayBug565 $*
+
#testnoawt com.jogamp.opengl.test.junit.newt.TestRemoteWindow01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestRemoteGLWindows01NEWT $*
@@ -426,13 +470,18 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $*
#testawt jogamp.newt.awt.opengl.VersionApplet $*
#testawt javax.media.opengl.awt.GLCanvas $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLCanvasAWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.acore.TestAWTCloseX11DisplayBug565 $*
-#testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListAWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextNewtAWTBug523 $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableDeadlockAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestPBufferDeadlockAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.x11.TestGLXCallsOnAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos01AWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos02AWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03aB729AWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03bB849AWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03cB849AWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816JTabbedPanelVisibilityB849B878AWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos04aAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos04bAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug675BeansInDesignTimeAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug551AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug572AWT $*
@@ -450,10 +499,12 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug461PBufferSupersamplingSwingAWT
#testawt com.jogamp.opengl.test.junit.jogl.glu.TestBug463ScaleImageMemoryAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.glu.TestBug694ScaleImageUnpackBufferSizeAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.glu.TestBug365TextureGenerateMipMaps $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestAWTCardLayoutAnimatorStartStopBug532 $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasAWTActionDeadlock00AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasAWTActionDeadlock01AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasAWTActionDeadlock02AWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLJPanelTextureStateAWT $*
#testawt com.jogamp.opengl.test.bugs.Bug735Inv0AppletAWT $*
#testawt com.jogamp.opengl.test.bugs.Bug735Inv1AppletAWT $*
@@ -508,6 +559,8 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $*
#testnoawt com.jogamp.opengl.test.junit.jogl.caps.TestBug605FlippedImageAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.glsl.TestShaderCompilationBug459AWT
+#testnoawt com.jogamp.opengl.test.junit.newt.DemoCreateAndDisposeOnCloseNEWT $*
+#testawt com.jogamp.opengl.test.junit.newt.DemoCreateAndDisposeOnCloseNEWT $*
#testawt com.jogamp.opengl.test.junit.newt.TestCloseNewtAWT
#testawt com.jogamp.opengl.test.junit.newt.TestWindowClosingProtocol01AWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestWindowClosingProtocol02NEWT $*
@@ -562,6 +615,7 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $*
#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestGLReadBufferUtilTextureIOWrite02NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestTextureSequence01NEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.util.texture.TestTextureSequence01AWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestBug817GLReadBufferUtilGLCTXDefFormatTypeES2NEWT $*
#
@@ -613,7 +667,8 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $*
# ATI/Linux XCB Unknown request in queue while dequeuing
# Most likely this is a multi-threaded client and XInitThreads has not been called
# ../../src/xcb_io.c:178: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
-#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting04AWT $*
+#testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode02aNEWT $*
+#testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode02bNEWT $*
# NEW
diff --git a/make/stub_includes/libav/libavcodec/avcodec.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavcodec/avcodec.h
similarity index 100%
rename from make/stub_includes/libav/libavcodec/avcodec.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavcodec/avcodec.h
diff --git a/make/stub_includes/libav/libavcodec/avfft.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavcodec/avfft.h
similarity index 100%
rename from make/stub_includes/libav/libavcodec/avfft.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavcodec/avfft.h
diff --git a/make/stub_includes/libav/libavcodec/dxva2.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavcodec/dxva2.h
similarity index 100%
rename from make/stub_includes/libav/libavcodec/dxva2.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavcodec/dxva2.h
diff --git a/make/stub_includes/libav/libavcodec/opt.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavcodec/opt.h
similarity index 100%
rename from make/stub_includes/libav/libavcodec/opt.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavcodec/opt.h
diff --git a/make/stub_includes/libav/libavcodec/vaapi.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavcodec/vaapi.h
similarity index 100%
rename from make/stub_includes/libav/libavcodec/vaapi.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavcodec/vaapi.h
diff --git a/make/stub_includes/libav/libavcodec/vda.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavcodec/vda.h
similarity index 100%
rename from make/stub_includes/libav/libavcodec/vda.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavcodec/vda.h
diff --git a/make/stub_includes/libav/libavcodec/vdpau.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavcodec/vdpau.h
similarity index 100%
rename from make/stub_includes/libav/libavcodec/vdpau.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavcodec/vdpau.h
diff --git a/make/stub_includes/libav/libavcodec/version.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavcodec/version.h
similarity index 100%
rename from make/stub_includes/libav/libavcodec/version.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavcodec/version.h
diff --git a/make/stub_includes/libav/libavcodec/xvmc.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavcodec/xvmc.h
similarity index 100%
rename from make/stub_includes/libav/libavcodec/xvmc.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavcodec/xvmc.h
diff --git a/make/stub_includes/libav/libavformat/avformat.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavformat/avformat.h
similarity index 100%
rename from make/stub_includes/libav/libavformat/avformat.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavformat/avformat.h
diff --git a/make/stub_includes/libav/libavformat/avio.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavformat/avio.h
similarity index 100%
rename from make/stub_includes/libav/libavformat/avio.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavformat/avio.h
diff --git a/make/stub_includes/libav/libavformat/version.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavformat/version.h
similarity index 100%
rename from make/stub_includes/libav/libavformat/version.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavformat/version.h
diff --git a/make/stub_includes/libav/libavutil/adler32.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/adler32.h
similarity index 100%
copy from make/stub_includes/libav/libavutil/adler32.h
copy to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/adler32.h
diff --git a/make/stub_includes/libav/libavutil/aes.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/aes.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/aes.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/aes.h
diff --git a/make/stub_includes/libav/libavutil/attributes.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/attributes.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/attributes.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/attributes.h
diff --git a/make/stub_includes/libav/libavutil/audioconvert.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/audioconvert.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/audioconvert.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/audioconvert.h
diff --git a/make/stub_includes/libav/libavutil/avassert.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/avassert.h
similarity index 100%
copy from make/stub_includes/libav/libavutil/avassert.h
copy to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/avassert.h
diff --git a/make/stub_includes/libav/libavutil/avconfig.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/avconfig.h
similarity index 100%
copy from make/stub_includes/libav/libavutil/avconfig.h
copy to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/avconfig.h
diff --git a/make/stub_includes/libav/libavutil/avstring.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/avstring.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/avstring.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/avstring.h
diff --git a/make/stub_includes/libav/libavutil/avutil.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/avutil.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/avutil.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/avutil.h
diff --git a/make/stub_includes/libav/libavutil/base64.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/base64.h
similarity index 100%
copy from make/stub_includes/libav/libavutil/base64.h
copy to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/base64.h
diff --git a/make/stub_includes/libav/libavutil/bswap.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/bswap.h
similarity index 100%
copy from make/stub_includes/libav/libavutil/bswap.h
copy to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/bswap.h
diff --git a/make/stub_includes/libav/libavutil/common.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/common.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/common.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/common.h
diff --git a/make/stub_includes/libav/libavutil/cpu.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/cpu.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/cpu.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/cpu.h
diff --git a/make/stub_includes/libav/libavutil/crc.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/crc.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/crc.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/crc.h
diff --git a/make/stub_includes/libav/libavutil/dict.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/dict.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/dict.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/dict.h
diff --git a/make/stub_includes/libav/libavutil/error.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/error.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/error.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/error.h
diff --git a/make/stub_includes/libav/libavutil/eval.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/eval.h
similarity index 100%
copy from make/stub_includes/libav/libavutil/eval.h
copy to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/eval.h
diff --git a/make/stub_includes/libav/libavutil/fifo.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/fifo.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/fifo.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/fifo.h
diff --git a/make/stub_includes/libav/libavutil/file.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/file.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/file.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/file.h
diff --git a/make/stub_includes/libav/libavutil/imgutils.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/imgutils.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/imgutils.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/imgutils.h
diff --git a/make/stub_includes/libav/libavutil/intfloat.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/intfloat.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/intfloat.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/intfloat.h
diff --git a/make/stub_includes/libav/libavutil/intfloat_readwrite.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/intfloat_readwrite.h
similarity index 100%
copy from make/stub_includes/libav/libavutil/intfloat_readwrite.h
copy to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/intfloat_readwrite.h
diff --git a/make/stub_includes/libav/libavutil/intreadwrite.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/intreadwrite.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/intreadwrite.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/intreadwrite.h
diff --git a/make/stub_includes/libav/libavutil/lfg.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/lfg.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/lfg.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/lfg.h
diff --git a/make/stub_includes/libav/libavutil/log.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/log.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/log.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/log.h
diff --git a/make/stub_includes/libav/libavutil/lzo.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/lzo.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/lzo.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/lzo.h
diff --git a/make/stub_includes/libav/libavutil/mathematics.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/mathematics.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/mathematics.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/mathematics.h
diff --git a/make/stub_includes/libav/libavutil/md5.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/md5.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/md5.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/md5.h
diff --git a/make/stub_includes/libav/libavutil/mem.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/mem.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/mem.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/mem.h
diff --git a/make/stub_includes/libav/libavutil/opt.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/opt.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/opt.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/opt.h
diff --git a/make/stub_includes/libav/libavutil/parseutils.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/parseutils.h
similarity index 100%
copy from make/stub_includes/libav/libavutil/parseutils.h
copy to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/parseutils.h
diff --git a/make/stub_includes/libav/libavutil/pixdesc.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/pixdesc.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/pixdesc.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/pixdesc.h
diff --git a/make/stub_includes/libav/libavutil/pixfmt.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/pixfmt.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/pixfmt.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/pixfmt.h
diff --git a/make/stub_includes/libav/libavutil/random_seed.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/random_seed.h
similarity index 100%
copy from make/stub_includes/libav/libavutil/random_seed.h
copy to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/random_seed.h
diff --git a/make/stub_includes/libav/libavutil/rational.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/rational.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/rational.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/rational.h
diff --git a/make/stub_includes/libav/libavutil/samplefmt.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/samplefmt.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/samplefmt.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/samplefmt.h
diff --git a/make/stub_includes/libav/libavutil/sha.h b/make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/sha.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/sha.h
rename to make/stub_includes/libav/lavc53_lavf53_lavu51/libavutil/sha.h
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/avcodec.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/avcodec.h
new file mode 100644
index 0000000..e6b8ec6
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/avcodec.h
@@ -0,0 +1,4658 @@
+/*
+ * 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
+ * external API header
+ */
+
+#include <errno.h>
+#include "libavutil/samplefmt.h"
+#include "libavutil/avutil.h"
+#include "libavutil/cpu.h"
+#include "libavutil/dict.h"
+#include "libavutil/log.h"
+#include "libavutil/pixfmt.h"
+#include "libavutil/rational.h"
+
+#include "libavcodec/version.h"
+/**
+ * @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
+ AV_CODEC_ID_MPEG2VIDEO_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_SNOW,
+ 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,
+
+ /* 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,
+
+ /* 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,
+
+ /* 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,
+ AV_CODEC_ID_VOXWARE,
+ 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,
+
+ /* 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.
+
+#if FF_API_CODEC_ID
+#include "old_codec_ids.h"
+#endif
+};
+
+#if FF_API_CODEC_ID
+#define CodecID AVCodecID
+#endif
+
+/**
+ * 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)
+
+#if FF_API_OLD_DECODE_AUDIO
+/* in bytes */
+#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
+#endif
+
+/**
+ * @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_ITER, ///< iterative 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 AVColorPrimaries{
+ AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
+ AVCOL_PRI_UNSPECIFIED = 2,
+ 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_NB , ///< Not part of ABI
+};
+
+enum AVColorTransferCharacteristic{
+ AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361
+ AVCOL_TRC_UNSPECIFIED = 2,
+ AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
+ AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG
+ AVCOL_TRC_SMPTE240M = 7,
+ AVCOL_TRC_NB , ///< Not part of ABI
+};
+
+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_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_NB , ///< Not part of ABI
+};
+
+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
+};
+
+/**
+ * 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
+};
+
+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;
+
+#define FF_MAX_B_FRAMES 16
+
+/* encoding support
+ These flags can be passed in AVCodecContext.flags before initialization.
+ Note: Not everything is supported yet.
+*/
+
+#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_QPEL 0x0010 ///< Use qpel MC.
+#define CODEC_FLAG_GMC 0x0020 ///< Use GMC.
+#define CODEC_FLAG_MV0 0x0040 ///< Always try a MB with MV=<0,0>.
+/**
+ * The parent program guarantees that the input for B-frames containing
+ * streams is not written to for at least s->max_b_frames+1 frames, if
+ * this is not set the input will be copied.
+ */
+#define CODEC_FLAG_INPUT_PRESERVED 0x0100
+#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.
+#define CODEC_FLAG_EMU_EDGE 0x4000 ///< Don't draw edges.
+#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. */
+#define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< Normalize adaptive quantization.
+#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.
+#if FF_API_MPV_GLOBAL_OPTS
+#define CODEC_FLAG_CBP_RD 0x04000000 ///< Use rate distortion optimization for cbp.
+#define CODEC_FLAG_QP_RD 0x08000000 ///< Use rate distortion optimization for qp selectioon.
+#define CODEC_FLAG2_STRICT_GOP 0x00000002 ///< Strictly enforce GOP size.
+#define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skipping
+#endif
+#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
+/* Codec can export data for HW decoding (XvMC). */
+#define CODEC_CAP_HWACCEL 0x0010
+/**
+ * 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
+/**
+ * Codec can export data for HW decoding (VDPAU).
+ */
+#define CODEC_CAP_HWACCEL_VDPAU 0x0080
+/**
+ * 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
+/**
+ * Codec is able to deal with negative linesizes
+ */
+#define CODEC_CAP_NEG_LINESIZES 0x0800
+/**
+ * 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
+
+//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, ...)
+
+/**
+ * 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;
+
+#define FF_QSCALE_TYPE_MPEG1 0
+#define FF_QSCALE_TYPE_MPEG2 1
+#define FF_QSCALE_TYPE_H264 2
+#define FF_QSCALE_TYPE_VP56 3
+
+#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).
+
+/**
+ * @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 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 destruct field.
+ * If it is set, the packet data is dynamically allocated and is valid
+ * indefinitely until av_free_packet() is called (which in turn calls the
+ * destruct callback to free the data). If destruct is not 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 {
+ /**
+ * 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.
+ */
+ struct {
+ uint8_t *data;
+ int size;
+ enum AVPacketSideDataType type;
+ } *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;
+ void (*destruct)(struct AVPacket *);
+ void *priv;
+ 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,
+};
+/**
+ * @}
+ */
+
+/**
+ * This structure describes decoded (raw) audio or video data.
+ *
+ * AVFrame must be allocated using avcodec_alloc_frame() and freed with
+ * avcodec_free_frame(). Note that this allocates only the AVFrame itself. The
+ * buffers for the data must be managed through other means.
+ *
+ * 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, avcodec_get_frame_defaults() should be used to
+ * reset the frame to its original clean state before it is reused again.
+ *
+ * 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
+ * - encoding: Set by user
+ * - decoding: set by AVCodecContext.get_buffer()
+ */
+ uint8_t *data[AV_NUM_DATA_POINTERS];
+
+ /**
+ * Size, in bytes, of the data for each picture/channel plane.
+ *
+ * For audio, only linesize[0] may be set. For planar audio, each channel
+ * plane must be the same size.
+ *
+ * - encoding: Set by user
+ * - decoding: set by AVCodecContext.get_buffer()
+ */
+ 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 will always be set by get_buffer(),
+ * but for planar audio with more channels that can fit in data,
+ * extended_data must be used by the decoder in order to access all
+ * channels.
+ *
+ * encoding: set by user
+ * decoding: set by AVCodecContext.get_buffer()
+ */
+ uint8_t **extended_data;
+
+ /**
+ * width and height of the video frame
+ * - encoding: unused
+ * - decoding: Read by user.
+ */
+ int width, height;
+
+ /**
+ * number of audio samples (per channel) described by this frame
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
+ */
+ int nb_samples;
+
+ /**
+ * format of the frame, -1 if unknown or unset
+ * Values correspond to enum AVPixelFormat for video frames,
+ * enum AVSampleFormat for audio)
+ * - encoding: unused
+ * - decoding: Read by user.
+ */
+ int format;
+
+ /**
+ * 1 -> keyframe, 0-> not
+ * - encoding: Set by libavcodec.
+ * - decoding: Set by libavcodec.
+ */
+ int key_frame;
+
+ /**
+ * Picture type of the frame, see ?_TYPE below.
+ * - encoding: Set by libavcodec. for coded_picture (and set by user for input).
+ * - decoding: Set by libavcodec.
+ */
+ enum AVPictureType pict_type;
+
+ /**
+ * pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer.
+ * This isn't used by libavcodec unless the default get/release_buffer() is used.
+ * - encoding:
+ * - decoding:
+ */
+ uint8_t *base[AV_NUM_DATA_POINTERS];
+
+ /**
+ * sample aspect ratio for the video frame, 0/1 if unknown/unspecified
+ * - encoding: unused
+ * - decoding: Read by user.
+ */
+ AVRational sample_aspect_ratio;
+
+ /**
+ * presentation timestamp in time_base units (time when frame should be shown to user)
+ * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed.
+ * - encoding: MUST be set by user.
+ * - decoding: Set by libavcodec.
+ */
+ int64_t pts;
+
+ /**
+ * pts copied from the AVPacket that was decoded to produce this frame
+ * - encoding: unused
+ * - decoding: Read by user.
+ */
+ int64_t pkt_pts;
+
+ /**
+ * dts copied from the AVPacket that triggered returning this frame
+ * - encoding: unused
+ * - decoding: Read by user.
+ */
+ int64_t pkt_dts;
+
+ /**
+ * picture number in bitstream order
+ * - encoding: set by
+ * - decoding: Set by libavcodec.
+ */
+ int coded_picture_number;
+ /**
+ * picture number in display order
+ * - encoding: set by
+ * - decoding: Set by libavcodec.
+ */
+ int display_picture_number;
+
+ /**
+ * quality (between 1 (good) and FF_LAMBDA_MAX (bad))
+ * - encoding: Set by libavcodec. for coded_picture (and set by user for input).
+ * - decoding: Set by libavcodec.
+ */
+ int quality;
+
+ /**
+ * is this picture used as reference
+ * The values for this are the same as the MpegEncContext.picture_structure
+ * variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
+ * Set to 4 for delayed, non-reference frames.
+ * - encoding: unused
+ * - decoding: Set by libavcodec. (before get_buffer() call)).
+ */
+ int reference;
+
+ /**
+ * QP table
+ * - encoding: unused
+ * - decoding: Set by libavcodec.
+ */
+ int8_t *qscale_table;
+ /**
+ * QP store stride
+ * - encoding: unused
+ * - decoding: Set by libavcodec.
+ */
+ int qstride;
+
+ /**
+ *
+ */
+ int qscale_type;
+
+ /**
+ * mbskip_table[mb]>=1 if MB didn't change
+ * stride= mb_width = (width+15)>>4
+ * - encoding: unused
+ * - decoding: Set by libavcodec.
+ */
+ 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
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec.
+ */
+ int16_t (*motion_val[2])[2];
+
+ /**
+ * macroblock type table
+ * mb_type_base + mb_width + 2
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec.
+ */
+ uint32_t *mb_type;
+
+ /**
+ * DCT coefficients
+ * - encoding: unused
+ * - decoding: Set by libavcodec.
+ */
+ short *dct_coeff;
+
+ /**
+ * motion reference frame index
+ * the order in which these are stored can depend on the codec.
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec.
+ */
+ int8_t *ref_index[2];
+
+ /**
+ * for some private data of the user
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ void *opaque;
+
+ /**
+ * error
+ * - encoding: Set by libavcodec. if flags&CODEC_FLAG_PSNR.
+ * - decoding: unused
+ */
+ uint64_t error[AV_NUM_DATA_POINTERS];
+
+ /**
+ * type of the buffer (to keep track of who has to deallocate data[*])
+ * - encoding: Set by the one who allocates it.
+ * - decoding: Set by the one who allocates it.
+ * Note: User allocated (direct rendering) & internal buffers cannot coexist currently.
+ */
+ int type;
+
+ /**
+ * When decoding, this signals how much the picture must be delayed.
+ * extra_delay = repeat_pict / (2*fps)
+ * - encoding: unused
+ * - decoding: Set by libavcodec.
+ */
+ int repeat_pict;
+
+ /**
+ * The content of the picture is interlaced.
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec. (default 0)
+ */
+ int interlaced_frame;
+
+ /**
+ * If the content is interlaced, is top field displayed first.
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec.
+ */
+ int top_field_first;
+
+ /**
+ * Tell user application that palette has changed from previous frame.
+ * - encoding: ??? (no palette-enabled encoder yet)
+ * - decoding: Set by libavcodec. (default 0).
+ */
+ int palette_has_changed;
+
+ /**
+ * codec suggestion on buffer type if != 0
+ * - encoding: unused
+ * - decoding: Set by libavcodec. (before get_buffer() call)).
+ */
+ int buffer_hints;
+
+ /**
+ * Pan scan.
+ * - encoding: Set by user.
+ * - decoding: Set by libavcodec.
+ */
+ AVPanScan *pan_scan;
+
+ /**
+ * 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
+ * - encoding: unused
+ * - decoding: Read by user.
+ */
+ int64_t reordered_opaque;
+
+ /**
+ * hardware accelerator private data (Libav-allocated)
+ * - encoding: unused
+ * - decoding: Set by libavcodec
+ */
+ void *hwaccel_picture_private;
+
+ /**
+ * the AVCodecContext which ff_thread_get_buffer() was last called on
+ * - encoding: Set by libavcodec.
+ * - decoding: Set by libavcodec.
+ */
+ struct AVCodecContext *owner;
+
+ /**
+ * used by multithreading to store frame-specific info
+ * - encoding: Set by libavcodec.
+ * - decoding: Set by libavcodec.
+ */
+ 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)
+ * - encoding: unused
+ * - decoding: Set by libavcodec.
+ */
+ uint8_t motion_subsample_log2;
+
+ /**
+ * Sample rate of the audio data.
+ *
+ * - encoding: unused
+ * - decoding: set by get_buffer()
+ */
+ int sample_rate;
+
+ /**
+ * Channel layout of the audio data.
+ *
+ * - encoding: unused
+ * - decoding: set by get_buffer()
+ */
+ uint64_t channel_layout;
+} AVFrame;
+
+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;
+ char codec_name[32];
+ 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;
+
+#if FF_API_SUB_ID
+ /**
+ * @deprecated this field is unused
+ */
+ attribute_deprecated int sub_id;
+#endif
+
+ 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 to the
+ * beginning of the stream. The decoded output will be delayed by this
+ * many samples relative to the input to the encoder. Note that this
+ * field is purely informational and does not directly affect the pts
+ * output by the encoder, which should always be based on the actual
+ * presentation time, including any 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: Set by libavcodec.
+ * Note: For compatibility it is possible to set this instead of
+ * coded_width/height before decoding.
+ */
+ int width, height;
+
+ /**
+ * Bitstream width / height, may be different from width/height.
+ * - encoding: unused
+ * - decoding: Set by user before init if known. Codec should override / dynamically change if needed.
+ */
+ int coded_width, coded_height;
+
+#define FF_ASPECT_EXTENDED 15
+
+ /**
+ * 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), 9 (iter), 10 (tesa) [7, 8, 10 are x264 specific, 9 is snow 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;
+
+#if FF_API_MPV_GLOBAL_OPTS
+ /**
+ * luma single coefficient elimination threshold
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ attribute_deprecated int luma_elim_threshold;
+
+ /**
+ * chroma single coeff elimination threshold
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ attribute_deprecated int chroma_elim_threshold;
+#endif
+
+ /**
+ * 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_W53 11
+#define FF_CMP_W97 12
+#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;
+
+ /**
+ * 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.
+ */
+ 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
+
+ /**
+ * 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;
+
+#if FF_API_COLOR_TABLE_ID
+ /**
+ * color table ID
+ * - encoding: unused
+ * - decoding: Which clrtable should be used for 8bit RGB images.
+ * Tables have to be stored somewhere. FIXME
+ */
+ attribute_deprecated int color_table_id;
+#endif
+
+ /**
+ * 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)
+
+ /**
+ * XVideo Motion Acceleration
+ * - encoding: forbidden
+ * - decoding: set by decoder
+ */
+ int xvmc_acceleration;
+
+ /**
+ * 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;
+
+#if FF_API_INTER_THRESHOLD
+ /**
+ * @deprecated this field is unused
+ */
+ attribute_deprecated int inter_threshold;
+#endif
+
+#if FF_API_MPV_GLOBAL_OPTS
+ /**
+ * @deprecated use mpegvideo private options instead
+ */
+ attribute_deprecated int quantizer_noise_shaping;
+#endif
+
+ /**
+ * 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;
+
+ /**
+ * Multiplied by qscale for each frame and added to scene_change_score.
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int scenechange_factor;
+
+ /**
+ *
+ * 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.
+ */
+ 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;
+
+ /**
+ * 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.
+ */
+ 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.
+ */
+ 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.
+ */
+ int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic);
+
+
+ /* - 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
+#define FF_CODER_TYPE_DEFLATE 4
+ /**
+ * 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
+#define FF_BUG_OLD_MSMPEG4 2
+#define FF_BUG_XVID_ILACE 4
+#define FF_BUG_UMP4 8
+#define FF_BUG_NO_PADDING 16
+#define FF_BUG_AMV 32
+#define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default.
+#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
+#define FF_DEBUG_MV 32
+#define FF_DEBUG_DCT_COEFF 0x00000040
+#define FF_DEBUG_SKIP 0x00000080
+#define FF_DEBUG_STARTCODE 0x00000100
+#define FF_DEBUG_PTS 0x00000200
+#define FF_DEBUG_ER 0x00000400
+#define FF_DEBUG_MMCO 0x00000800
+#define FF_DEBUG_BUGS 0x00001000
+#define FF_DEBUG_VIS_QP 0x00002000
+#define FF_DEBUG_VIS_MB_TYPE 0x00004000
+#define FF_DEBUG_BUFFERS 0x00008000
+#define FF_DEBUG_THREADS 0x00010000
+
+ /**
+ * debug
+ * - encoding: Set by user.
+ * - decoding: Set by user.
+ */
+ 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
+
+ /**
+ * Error recognition; may misdetect some more or less valid parts as errors.
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ int err_recognition;
+#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
+ * @deprecated in favor of pkt_pts
+ * - 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
+#define FF_DCT_INT 2
+#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
+#if FF_API_LIBMPEG2
+#define FF_IDCT_LIBMPEG2MMX 4
+#endif
+#if FF_API_MMI
+#define FF_IDCT_MMI 5
+#endif
+#define FF_IDCT_ARM 7
+#define FF_IDCT_ALTIVEC 8
+#define FF_IDCT_SH4 9
+#define FF_IDCT_SIMPLEARM 10
+#define FF_IDCT_H264 11
+#define FF_IDCT_VP3 12
+#define FF_IDCT_IPP 13
+#define FF_IDCT_XVIDMMX 14
+#define FF_IDCT_CAVS 15
+#define FF_IDCT_SIMPLEARMV5TE 16
+#define FF_IDCT_SIMPLEARMV6 17
+#define FF_IDCT_SIMPLEVIS 18
+#define FF_IDCT_WMV2 19
+#define FF_IDCT_FAAN 20
+#define FF_IDCT_EA 21
+#define FF_IDCT_SIMPLENEON 22
+#define FF_IDCT_SIMPLEALPHA 23
+#define FF_IDCT_BINK 24
+
+#if FF_API_DSP_MASK
+ /**
+ * Unused.
+ * @deprecated use av_set_cpu_flags_mask() instead.
+ */
+ attribute_deprecated unsigned dsp_mask;
+#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;
+
+ /**
+ * low resolution decoding, 1-> 1/2 size, 2->1/4 size
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ attribute_deprecated int lowres;
+
+ /**
+ * the picture in the bitstream
+ * - encoding: Set by libavcodec.
+ * - decoding: Set by libavcodec.
+ */
+ 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);
+
+ /**
+ * thread opaque
+ * Can be used by execute() to store some per AVCodecContext stuff.
+ * - encoding: set by execute()
+ * - decoding: set by execute()
+ */
+ void *thread_opaque;
+
+ /**
+ * 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_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
+
+ /**
+ * 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;
+
+ /**
+ * Simulates errors in the bitstream to test error concealment.
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int error_rate;
+
+ /**
+ * Current packet as passed into the decoder, to avoid having
+ * to pass the packet into every function. Currently only valid
+ * inside lavc and get/release_buffer callbacks.
+ * - decoding: set by avcodec_decode_*, read by get_buffer() for setting pkt_pts
+ * - encoding: unused
+ */
+ AVPacket *pkt;
+
+ /**
+ * 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;
+} 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
+ attribute_deprecated uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
+ 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;
+
+ struct AVHWAccel *next;
+
+ /**
+ * 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 HW accelerator private data.
+ *
+ * Private data is allocated with av_mallocz() before
+ * AVCodecContext.get_buffer() and deallocated after
+ * AVCodecContext.release_buffer().
+ */
+ 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 can be deallocated by calling avcodec_close() on it followed
+ * by av_free().
+ *
+ * @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);
+
+/**
+ * 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);
+
+/**
+ * Allocate an AVFrame and set its fields to default values. The resulting
+ * struct must be freed using avcodec_free_frame().
+ *
+ * @return An AVFrame filled with default values or NULL on failure.
+ * @see avcodec_get_frame_defaults
+ */
+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.
+ */
+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()).
+ */
+void avcodec_free_frame(AVFrame **frame);
+
+/**
+ * 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
+ * @{
+ */
+
+/**
+ * Default packet destructor.
+ */
+void av_destruct_packet(AVPacket *pkt);
+
+/**
+ * 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);
+
+/**
+ * @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);
+
+/**
+ * @}
+ */
+
+/**
+ * @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);
+
+int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
+void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
+int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic);
+
+/**
+ * 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.
+ */
+unsigned avcodec_get_edge_width(void);
+
+/**
+ * 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.
+ * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased
+ * according to avcodec_get_edge_width() before.
+ */
+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.
+ * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased
+ * according to avcodec_get_edge_width() before.
+ */
+void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
+ int linesize_align[AV_NUM_DATA_POINTERS]);
+
+#if FF_API_OLD_DECODE_AUDIO
+/**
+ * Wrapper function which calls avcodec_decode_audio4.
+ *
+ * @deprecated Use avcodec_decode_audio4 instead.
+ *
+ * Decode the audio frame of size avpkt->size from avpkt->data into samples.
+ * Some decoders may support multiple frames in a single AVPacket, such
+ * decoders would then just decode the first frame. In this case,
+ * avcodec_decode_audio3 has to be called again with an AVPacket that contains
+ * the remaining data in order to decode the second frame etc.
+ * If no frame
+ * could be outputted, frame_size_ptr is zero. Otherwise, it is the
+ * decompressed frame size in bytes.
+ *
+ * @warning You must set frame_size_ptr to the allocated size of the
+ * output buffer before calling avcodec_decode_audio3().
+ *
+ * @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 avpkt->data should be set to 0 to ensure that
+ * no overreading happens for damaged MPEG streams.
+ *
+ * @warning You must not provide a custom get_buffer() when using
+ * avcodec_decode_audio3(). Doing so will override it with
+ * avcodec_default_get_buffer. Use avcodec_decode_audio4() instead,
+ * which does allow the application to provide a custom get_buffer().
+ *
+ * @note You might have to align the input buffer avpkt->data and output buffer
+ * samples. The alignment requirements depend on the CPU: On some CPUs it isn't
+ * necessary at all, on others it won't work at all if not aligned and on others
+ * it will work but it will have an impact on performance.
+ *
+ * In practice, avpkt->data should have 4 byte alignment at minimum and
+ * samples should be 16 byte aligned unless the CPU doesn't need it
+ * (AltiVec and SSE do).
+ *
+ * @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] samples the output buffer, sample type in avctx->sample_fmt
+ * If the sample format is planar, each channel plane will
+ * be the same size, with no padding between channels.
+ * @param[in,out] frame_size_ptr the output buffer size in bytes
+ * @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.
+ * All decoders are designed to use the least fields possible though.
+ * @return On error a negative value is returned, otherwise the number of bytes
+ * used or zero if no frame data was decompressed (used) from the input AVPacket.
+ */
+attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples,
+ int *frame_size_ptr,
+ AVPacket *avpkt);
+#endif
+
+/**
+ * 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. 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.
+ *
+ * @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.
+ *
+ * @note You might have to align the input buffer. The alignment requirements
+ * depend on the CPU and the decoder.
+ *
+ * @param avctx the codec context
+ * @param[out] frame The AVFrame in which to store decoded audio samples.
+ * Decoders request a buffer of a particular size by setting
+ * AVFrame.nb_samples prior to calling get_buffer(). The
+ * decoder may, however, only utilize part of the buffer by
+ * setting AVFrame.nb_samples to a smaller value in the
+ * output frame.
+ * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is
+ * non-zero.
+ * @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 You might have to align the input buffer avpkt->data.
+ * The alignment requirements depend on the CPU: on some CPUs it isn't
+ * necessary at all, on others it won't work at all if not aligned and on others
+ * it will work but it will have an impact on performance.
+ *
+ * In practice, avpkt->data should have 4 byte alignment at minimum.
+ *
+ * @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 avcodec_alloc_frame to get an AVFrame, the codec will
+ * allocate memory for the actual bitmap.
+ * with default get/release_buffer(), the decoder frees/reuses the bitmap as it sees fit.
+ * with overridden get/release_buffer() (needs CODEC_CAP_DR1) the user decides into what buffer the decoder
+ * decodes and the decoder tells the user once it does not need the data anymore,
+ * the user app can at this point free/reuse/keep the memory as it sees fit.
+ *
+ * @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
+ * @{
+ */
+
+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;
+} 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(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);
+
+#if FF_API_OLD_ENCODE_AUDIO
+/**
+ * Encode an audio frame from samples into buf.
+ *
+ * @deprecated Use avcodec_encode_audio2 instead.
+ *
+ * @note The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large.
+ * However, for codecs with avctx->frame_size equal to 0 (e.g. PCM) the user
+ * will know how much space is needed because it depends on the value passed
+ * in buf_size as described below. In that case a lower value can be used.
+ *
+ * @param avctx the codec context
+ * @param[out] buf the output buffer
+ * @param[in] buf_size the output buffer size
+ * @param[in] samples the input buffer containing the samples
+ * The number of samples read from this buffer is frame_size*channels,
+ * both of which are defined in avctx.
+ * For codecs which have avctx->frame_size equal to 0 (e.g. PCM) the number of
+ * samples read from samples is equal to:
+ * buf_size * 8 / (avctx->channels * av_get_bits_per_sample(avctx->codec_id))
+ * This also implies that av_get_bits_per_sample() must not return 0 for these
+ * codecs.
+ * @return On error a negative value is returned, on success zero or the number
+ * of bytes used to encode the data read from the input buffer.
+ */
+int attribute_deprecated avcodec_encode_audio(AVCodecContext *avctx,
+ uint8_t *buf, int buf_size,
+ const short *samples);
+#endif
+
+/**
+ * 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);
+
+#if FF_API_OLD_ENCODE_VIDEO
+/**
+ * @deprecated use avcodec_encode_video2() instead.
+ *
+ * Encode a video frame from pict into buf.
+ * The input picture should be
+ * stored using a specific format, namely avctx.pix_fmt.
+ *
+ * @param avctx the codec context
+ * @param[out] buf the output buffer for the bitstream of encoded frame
+ * @param[in] buf_size the size of the output buffer in bytes
+ * @param[in] pict the input picture to encode
+ * @return On error a negative value is returned, on success zero or the number
+ * of bytes used from the output buffer.
+ */
+attribute_deprecated
+int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
+ const AVFrame *pict);
+#endif
+
+/**
+ * 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);
+
+
+/**
+ * @}
+ */
+
+#if FF_API_AVCODEC_RESAMPLE
+/**
+ * @defgroup lavc_resample Audio resampling
+ * @ingroup libavc
+ * @deprecated use libavresample instead
+ *
+ * @{
+ */
+struct ReSampleContext;
+struct AVResampleContext;
+
+typedef struct ReSampleContext ReSampleContext;
+
+/**
+ * Initialize audio resampling context.
+ *
+ * @param output_channels number of output channels
+ * @param input_channels number of input channels
+ * @param output_rate output sample rate
+ * @param input_rate input sample rate
+ * @param sample_fmt_out requested output sample format
+ * @param sample_fmt_in input sample format
+ * @param filter_length length of each FIR filter in the filterbank relative to the cutoff frequency
+ * @param log2_phase_count log2 of the number of entries in the polyphase filterbank
+ * @param linear if 1 then the used FIR filter will be linearly interpolated
+ between the 2 closest, if 0 the closest will be used
+ * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate
+ * @return allocated ReSampleContext, NULL if error occurred
+ */
+attribute_deprecated
+ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
+ int output_rate, int input_rate,
+ enum AVSampleFormat sample_fmt_out,
+ enum AVSampleFormat sample_fmt_in,
+ int filter_length, int log2_phase_count,
+ int linear, double cutoff);
+
+attribute_deprecated
+int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
+
+/**
+ * Free resample context.
+ *
+ * @param s a non-NULL pointer to a resample context previously
+ * created with av_audio_resample_init()
+ */
+attribute_deprecated
+void audio_resample_close(ReSampleContext *s);
+
+
+/**
+ * Initialize an audio resampler.
+ * Note, if either rate is not an integer then simply scale both rates up so they are.
+ * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq
+ * @param log2_phase_count log2 of the number of entries in the polyphase filterbank
+ * @param linear If 1 then the used FIR filter will be linearly interpolated
+ between the 2 closest, if 0 the closest will be used
+ * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate
+ */
+attribute_deprecated
+struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff);
+
+/**
+ * Resample an array of samples using a previously configured context.
+ * @param src an array of unconsumed samples
+ * @param consumed the number of samples of src which have been consumed are returned here
+ * @param src_size the number of unconsumed samples available
+ * @param dst_size the amount of space in samples available in dst
+ * @param update_ctx If this is 0 then the context will not be modified, that way several channels can be resampled with the same context.
+ * @return the number of samples written in dst or -1 if an error occurred
+ */
+attribute_deprecated
+int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx);
+
+
+/**
+ * Compensate samplerate/timestamp drift. The compensation is done by changing
+ * the resampler parameters, so no audible clicks or similar distortions occur
+ * @param compensation_distance distance in output samples over which the compensation should be performed
+ * @param sample_delta number of output samples which should be output less
+ *
+ * example: av_resample_compensate(c, 10, 500)
+ * here instead of 510 samples only 500 samples would be output
+ *
+ * note, due to rounding the actual compensation might be slightly different,
+ * especially if the compensation_distance is large and the in_rate used during init is small
+ */
+attribute_deprecated
+void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance);
+attribute_deprecated
+void av_resample_close(struct AVResampleContext *c);
+
+/**
+ * @}
+ */
+#endif
+
+/**
+ * @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);
+
+/**
+ * deinterlace - if not supported return -1
+ */
+int avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
+ enum AVPixelFormat pix_fmt, int width, int height);
+/**
+ * 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);
+
+#if FF_API_FIND_BEST_PIX_FMT
+/**
+ * @deprecated use avcodec_find_best_pix_fmt2() instead.
+ *
+ * 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_fmt() 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_mask parameter.
+ *
+ * @code
+ * src_pix_fmt = AV_PIX_FMT_YUV420P;
+ * pix_fmt_mask = (1 << AV_PIX_FMT_YUV422P) || (1 << AV_PIX_FMT_RGB24);
+ * dst_pix_fmt = avcodec_find_best_pix_fmt(pix_fmt_mask, src_pix_fmt, alpha, &loss);
+ * @endcode
+ *
+ * @param[in] pix_fmt_mask bitmask determining which pixel format 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.
+ */
+attribute_deprecated
+enum AVPixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum AVPixelFormat src_pix_fmt,
+ int has_alpha, int *loss_ptr);
+#endif /* FF_API_FIND_BEST_PIX_FMT */
+
+/**
+ * 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);
+
+/**
+ * @}
+ */
+
+void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
+
+/**
+ * Put a string representing the codec tag codec_tag in buf.
+ *
+ * @param buf_size size in bytes of buf
+ * @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);
+
+/**
+ * Flush buffers, should be called when seeking or when switching to a different stream.
+ */
+void avcodec_flush_buffers(AVCodecContext *avctx);
+
+void avcodec_default_free_buffers(AVCodecContext *s);
+
+/**
+ * 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(AVBitStreamFilter *f);
+
+/* memory */
+
+/**
+ * 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);
+
+/**
+ * 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);
+
+/**
+ * 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.
+ */
+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
+ */
+void av_log_ask_for_sample(void *avc, const char *msg, ...) av_printf_format(2, 3);
+
+/**
+ * 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(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/lavc54_lavf54_lavu52_lavr01/libavcodec/avfft.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/avfft.h
new file mode 100644
index 0000000..b896182
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/avfft.h
@@ -0,0 +1,116 @@
+/*
+ * 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
+ *
+ * @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/lavc54_lavf54_lavu52_lavr01/libavcodec/dxva2.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/dxva2.h
new file mode 100644
index 0000000..c06f1f3
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/dxva2.h
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+#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
+
+/**
+ * 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/lavc54_lavf54_lavu52_lavr01/libavcodec/old_codec_ids.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/old_codec_ids.h
new file mode 100644
index 0000000..2b72e38
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/old_codec_ids.h
@@ -0,0 +1,366 @@
+/*
+ * 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_OLD_CODEC_IDS_H
+#define AVCODEC_OLD_CODEC_IDS_H
+
+/*
+ * This header exists to prevent new codec IDs 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 AVCodecID enum instead.
+ */
+
+ CODEC_ID_NONE = AV_CODEC_ID_NONE,
+
+ /* video codecs */
+ CODEC_ID_MPEG1VIDEO,
+ CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
+ CODEC_ID_MPEG2VIDEO_XVMC,
+ CODEC_ID_H261,
+ CODEC_ID_H263,
+ CODEC_ID_RV10,
+ CODEC_ID_RV20,
+ CODEC_ID_MJPEG,
+ CODEC_ID_MJPEGB,
+ CODEC_ID_LJPEG,
+ CODEC_ID_SP5X,
+ CODEC_ID_JPEGLS,
+ CODEC_ID_MPEG4,
+ CODEC_ID_RAWVIDEO,
+ CODEC_ID_MSMPEG4V1,
+ CODEC_ID_MSMPEG4V2,
+ CODEC_ID_MSMPEG4V3,
+ CODEC_ID_WMV1,
+ CODEC_ID_WMV2,
+ CODEC_ID_H263P,
+ CODEC_ID_H263I,
+ CODEC_ID_FLV1,
+ CODEC_ID_SVQ1,
+ CODEC_ID_SVQ3,
+ CODEC_ID_DVVIDEO,
+ CODEC_ID_HUFFYUV,
+ CODEC_ID_CYUV,
+ CODEC_ID_H264,
+ CODEC_ID_INDEO3,
+ CODEC_ID_VP3,
+ CODEC_ID_THEORA,
+ CODEC_ID_ASV1,
+ CODEC_ID_ASV2,
+ CODEC_ID_FFV1,
+ CODEC_ID_4XM,
+ CODEC_ID_VCR1,
+ CODEC_ID_CLJR,
+ CODEC_ID_MDEC,
+ CODEC_ID_ROQ,
+ CODEC_ID_INTERPLAY_VIDEO,
+ CODEC_ID_XAN_WC3,
+ CODEC_ID_XAN_WC4,
+ CODEC_ID_RPZA,
+ CODEC_ID_CINEPAK,
+ CODEC_ID_WS_VQA,
+ CODEC_ID_MSRLE,
+ CODEC_ID_MSVIDEO1,
+ CODEC_ID_IDCIN,
+ CODEC_ID_8BPS,
+ CODEC_ID_SMC,
+ CODEC_ID_FLIC,
+ CODEC_ID_TRUEMOTION1,
+ CODEC_ID_VMDVIDEO,
+ CODEC_ID_MSZH,
+ CODEC_ID_ZLIB,
+ CODEC_ID_QTRLE,
+ CODEC_ID_SNOW,
+ CODEC_ID_TSCC,
+ CODEC_ID_ULTI,
+ CODEC_ID_QDRAW,
+ CODEC_ID_VIXL,
+ CODEC_ID_QPEG,
+ CODEC_ID_PNG,
+ CODEC_ID_PPM,
+ CODEC_ID_PBM,
+ CODEC_ID_PGM,
+ CODEC_ID_PGMYUV,
+ CODEC_ID_PAM,
+ CODEC_ID_FFVHUFF,
+ CODEC_ID_RV30,
+ CODEC_ID_RV40,
+ CODEC_ID_VC1,
+ CODEC_ID_WMV3,
+ CODEC_ID_LOCO,
+ CODEC_ID_WNV1,
+ CODEC_ID_AASC,
+ CODEC_ID_INDEO2,
+ CODEC_ID_FRAPS,
+ CODEC_ID_TRUEMOTION2,
+ CODEC_ID_BMP,
+ CODEC_ID_CSCD,
+ CODEC_ID_MMVIDEO,
+ CODEC_ID_ZMBV,
+ CODEC_ID_AVS,
+ CODEC_ID_SMACKVIDEO,
+ CODEC_ID_NUV,
+ CODEC_ID_KMVC,
+ CODEC_ID_FLASHSV,
+ CODEC_ID_CAVS,
+ CODEC_ID_JPEG2000,
+ CODEC_ID_VMNC,
+ CODEC_ID_VP5,
+ CODEC_ID_VP6,
+ CODEC_ID_VP6F,
+ CODEC_ID_TARGA,
+ CODEC_ID_DSICINVIDEO,
+ CODEC_ID_TIERTEXSEQVIDEO,
+ CODEC_ID_TIFF,
+ CODEC_ID_GIF,
+ CODEC_ID_DXA,
+ CODEC_ID_DNXHD,
+ CODEC_ID_THP,
+ CODEC_ID_SGI,
+ CODEC_ID_C93,
+ CODEC_ID_BETHSOFTVID,
+ CODEC_ID_PTX,
+ CODEC_ID_TXD,
+ CODEC_ID_VP6A,
+ CODEC_ID_AMV,
+ CODEC_ID_VB,
+ CODEC_ID_PCX,
+ CODEC_ID_SUNRAST,
+ CODEC_ID_INDEO4,
+ CODEC_ID_INDEO5,
+ CODEC_ID_MIMIC,
+ CODEC_ID_RL2,
+ CODEC_ID_ESCAPE124,
+ CODEC_ID_DIRAC,
+ CODEC_ID_BFI,
+ CODEC_ID_CMV,
+ CODEC_ID_MOTIONPIXELS,
+ CODEC_ID_TGV,
+ CODEC_ID_TGQ,
+ CODEC_ID_TQI,
+ CODEC_ID_AURA,
+ CODEC_ID_AURA2,
+ CODEC_ID_V210X,
+ CODEC_ID_TMV,
+ CODEC_ID_V210,
+ CODEC_ID_DPX,
+ CODEC_ID_MAD,
+ CODEC_ID_FRWU,
+ CODEC_ID_FLASHSV2,
+ CODEC_ID_CDGRAPHICS,
+ CODEC_ID_R210,
+ CODEC_ID_ANM,
+ CODEC_ID_BINKVIDEO,
+ CODEC_ID_IFF_ILBM,
+ CODEC_ID_IFF_BYTERUN1,
+ CODEC_ID_KGV1,
+ CODEC_ID_YOP,
+ CODEC_ID_VP8,
+ CODEC_ID_PICTOR,
+ CODEC_ID_ANSI,
+ CODEC_ID_A64_MULTI,
+ CODEC_ID_A64_MULTI5,
+ CODEC_ID_R10K,
+ CODEC_ID_MXPEG,
+ CODEC_ID_LAGARITH,
+ CODEC_ID_PRORES,
+ CODEC_ID_JV,
+ CODEC_ID_DFA,
+ CODEC_ID_WMV3IMAGE,
+ CODEC_ID_VC1IMAGE,
+ CODEC_ID_UTVIDEO,
+ CODEC_ID_BMV_VIDEO,
+ CODEC_ID_VBLE,
+ CODEC_ID_DXTORY,
+ CODEC_ID_V410,
+ CODEC_ID_XWD,
+ CODEC_ID_CDXL,
+ CODEC_ID_XBM,
+ CODEC_ID_ZEROCODEC,
+ CODEC_ID_MSS1,
+ CODEC_ID_MSA1,
+ CODEC_ID_TSCC2,
+ CODEC_ID_MTS2,
+ CODEC_ID_CLLC,
+
+ /* various PCM "codecs" */
+ CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
+ CODEC_ID_PCM_S16LE = 0x10000,
+ CODEC_ID_PCM_S16BE,
+ CODEC_ID_PCM_U16LE,
+ CODEC_ID_PCM_U16BE,
+ CODEC_ID_PCM_S8,
+ CODEC_ID_PCM_U8,
+ CODEC_ID_PCM_MULAW,
+ CODEC_ID_PCM_ALAW,
+ CODEC_ID_PCM_S32LE,
+ CODEC_ID_PCM_S32BE,
+ CODEC_ID_PCM_U32LE,
+ CODEC_ID_PCM_U32BE,
+ CODEC_ID_PCM_S24LE,
+ CODEC_ID_PCM_S24BE,
+ CODEC_ID_PCM_U24LE,
+ CODEC_ID_PCM_U24BE,
+ CODEC_ID_PCM_S24DAUD,
+ CODEC_ID_PCM_ZORK,
+ CODEC_ID_PCM_S16LE_PLANAR,
+ CODEC_ID_PCM_DVD,
+ CODEC_ID_PCM_F32BE,
+ CODEC_ID_PCM_F32LE,
+ CODEC_ID_PCM_F64BE,
+ CODEC_ID_PCM_F64LE,
+ CODEC_ID_PCM_BLURAY,
+ CODEC_ID_PCM_LXF,
+ CODEC_ID_S302M,
+ CODEC_ID_PCM_S8_PLANAR,
+
+ /* various ADPCM codecs */
+ CODEC_ID_ADPCM_IMA_QT = 0x11000,
+ CODEC_ID_ADPCM_IMA_WAV,
+ CODEC_ID_ADPCM_IMA_DK3,
+ CODEC_ID_ADPCM_IMA_DK4,
+ CODEC_ID_ADPCM_IMA_WS,
+ CODEC_ID_ADPCM_IMA_SMJPEG,
+ CODEC_ID_ADPCM_MS,
+ CODEC_ID_ADPCM_4XM,
+ CODEC_ID_ADPCM_XA,
+ CODEC_ID_ADPCM_ADX,
+ CODEC_ID_ADPCM_EA,
+ CODEC_ID_ADPCM_G726,
+ CODEC_ID_ADPCM_CT,
+ CODEC_ID_ADPCM_SWF,
+ CODEC_ID_ADPCM_YAMAHA,
+ CODEC_ID_ADPCM_SBPRO_4,
+ CODEC_ID_ADPCM_SBPRO_3,
+ CODEC_ID_ADPCM_SBPRO_2,
+ CODEC_ID_ADPCM_THP,
+ CODEC_ID_ADPCM_IMA_AMV,
+ CODEC_ID_ADPCM_EA_R1,
+ CODEC_ID_ADPCM_EA_R3,
+ CODEC_ID_ADPCM_EA_R2,
+ CODEC_ID_ADPCM_IMA_EA_SEAD,
+ CODEC_ID_ADPCM_IMA_EA_EACS,
+ CODEC_ID_ADPCM_EA_XAS,
+ CODEC_ID_ADPCM_EA_MAXIS_XA,
+ CODEC_ID_ADPCM_IMA_ISS,
+ CODEC_ID_ADPCM_G722,
+ CODEC_ID_ADPCM_IMA_APC,
+
+ /* AMR */
+ CODEC_ID_AMR_NB = 0x12000,
+ CODEC_ID_AMR_WB,
+
+ /* RealAudio codecs*/
+ CODEC_ID_RA_144 = 0x13000,
+ CODEC_ID_RA_288,
+
+ /* various DPCM codecs */
+ CODEC_ID_ROQ_DPCM = 0x14000,
+ CODEC_ID_INTERPLAY_DPCM,
+ CODEC_ID_XAN_DPCM,
+ CODEC_ID_SOL_DPCM,
+
+ /* audio codecs */
+ CODEC_ID_MP2 = 0x15000,
+ CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
+ CODEC_ID_AAC,
+ CODEC_ID_AC3,
+ CODEC_ID_DTS,
+ CODEC_ID_VORBIS,
+ CODEC_ID_DVAUDIO,
+ CODEC_ID_WMAV1,
+ CODEC_ID_WMAV2,
+ CODEC_ID_MACE3,
+ CODEC_ID_MACE6,
+ CODEC_ID_VMDAUDIO,
+ CODEC_ID_FLAC,
+ CODEC_ID_MP3ADU,
+ CODEC_ID_MP3ON4,
+ CODEC_ID_SHORTEN,
+ CODEC_ID_ALAC,
+ CODEC_ID_WESTWOOD_SND1,
+ CODEC_ID_GSM, ///< as in Berlin toast format
+ CODEC_ID_QDM2,
+ CODEC_ID_COOK,
+ CODEC_ID_TRUESPEECH,
+ CODEC_ID_TTA,
+ CODEC_ID_SMACKAUDIO,
+ CODEC_ID_QCELP,
+ CODEC_ID_WAVPACK,
+ CODEC_ID_DSICINAUDIO,
+ CODEC_ID_IMC,
+ CODEC_ID_MUSEPACK7,
+ CODEC_ID_MLP,
+ CODEC_ID_GSM_MS, /* as found in WAV */
+ CODEC_ID_ATRAC3,
+ CODEC_ID_VOXWARE,
+ CODEC_ID_APE,
+ CODEC_ID_NELLYMOSER,
+ CODEC_ID_MUSEPACK8,
+ CODEC_ID_SPEEX,
+ CODEC_ID_WMAVOICE,
+ CODEC_ID_WMAPRO,
+ CODEC_ID_WMALOSSLESS,
+ CODEC_ID_ATRAC3P,
+ CODEC_ID_EAC3,
+ CODEC_ID_SIPR,
+ CODEC_ID_MP1,
+ CODEC_ID_TWINVQ,
+ CODEC_ID_TRUEHD,
+ CODEC_ID_MP4ALS,
+ CODEC_ID_ATRAC1,
+ CODEC_ID_BINKAUDIO_RDFT,
+ CODEC_ID_BINKAUDIO_DCT,
+ CODEC_ID_AAC_LATM,
+ CODEC_ID_QDMC,
+ CODEC_ID_CELT,
+ CODEC_ID_G723_1,
+ CODEC_ID_G729,
+ CODEC_ID_8SVX_EXP,
+ CODEC_ID_8SVX_FIB,
+ CODEC_ID_BMV_AUDIO,
+ CODEC_ID_RALF,
+ CODEC_ID_IAC,
+ CODEC_ID_ILBC,
+
+ /* subtitle codecs */
+ CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
+ CODEC_ID_DVD_SUBTITLE = 0x17000,
+ CODEC_ID_DVB_SUBTITLE,
+ CODEC_ID_TEXT, ///< raw UTF-8 text
+ CODEC_ID_XSUB,
+ CODEC_ID_SSA,
+ CODEC_ID_MOV_TEXT,
+ CODEC_ID_HDMV_PGS_SUBTITLE,
+ CODEC_ID_DVB_TELETEXT,
+ CODEC_ID_SRT,
+
+ /* other specific kind of codecs (generally used for attachments) */
+ CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
+ CODEC_ID_TTF = 0x18000,
+
+ CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like CODEC_ID_NONE) but lavf should attempt to identify it
+
+ CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
+ * stream (only used by libavformat) */
+ CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
+ * stream (only used by libavformat) */
+ CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information.
+
+#endif /* AVCODEC_OLD_CODEC_IDS_H */
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/vaapi.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/vaapi.h
new file mode 100644
index 0000000..39e8825
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/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/lavc54_lavf54_lavu52_lavr01/libavcodec/vda.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/vda.h
new file mode 100644
index 0000000..f0ec2bf
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/vda.h
@@ -0,0 +1,217 @@
+/*
+ * 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/version.h"
+
+#if FF_API_VDA_ASYNC
+#include <pthread.h>
+#endif
+
+#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
+ *
+ * @{
+ */
+
+#if FF_API_VDA_ASYNC
+/**
+ * This structure is used to store decoded frame information and data.
+ *
+ * @deprecated Use synchronous decoding mode.
+ */
+typedef struct vda_frame {
+ /**
+ * The PTS of the frame.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by libavcodec.
+ */
+ int64_t pts;
+
+ /**
+ * The CoreVideo buffer that contains the decoded data.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by libavcodec.
+ */
+ CVPixelBufferRef cv_buffer;
+
+ /**
+ * A pointer to the next frame.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by libavcodec.
+ */
+ struct vda_frame *next_frame;
+} vda_frame;
+#endif
+
+/**
+ * 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;
+
+#if FF_API_VDA_ASYNC
+ /**
+ * VDA frames queue ordered by presentation timestamp.
+ *
+ * @deprecated Use synchronous decoding mode.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by libavcodec.
+ */
+ vda_frame *queue;
+
+ /**
+ * Mutex for locking queue operations.
+ *
+ * @deprecated Use synchronous decoding mode.
+ *
+ * - encoding: unused
+ * - decoding: Set/Unset by libavcodec.
+ */
+ pthread_mutex_t queue_mutex;
+#endif
+
+ /**
+ * 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;
+
+ /**
+ * The current bitstream buffer.
+ */
+ uint8_t *priv_bitstream;
+
+ /**
+ * The current size of the bitstream.
+ */
+ int priv_bitstream_size;
+
+ /**
+ * The reference size used for fast reallocation.
+ */
+ 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);
+
+#if FF_API_VDA_ASYNC
+/**
+ * Return the top frame of the queue.
+ *
+ * @deprecated Use synchronous decoding mode.
+ */
+vda_frame *ff_vda_queue_pop(struct vda_context *vda_ctx);
+
+/**
+ * Release the given frame.
+ *
+ * @deprecated Use synchronous decoding mode.
+ */
+void ff_vda_release_vda_frame(vda_frame *frame);
+#endif
+
+/**
+ * @}
+ */
+
+#endif /* AVCODEC_VDA_H */
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/vdpau.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/vdpau.h
new file mode 100644
index 0000000..241ff19
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/vdpau.h
@@ -0,0 +1,94 @@
+/*
+ * 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>
+
+/** @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 VdpPictureInfo {
+ VdpPictureInfoH264 h264;
+ VdpPictureInfoMPEG1Or2 mpeg;
+ VdpPictureInfoVC1 vc1;
+ VdpPictureInfoMPEG4Part2 mpeg4;
+ } 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 /* AVCODEC_VDPAU_H */
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/version.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/version.h
new file mode 100644
index 0000000..348ce99
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/version.h
@@ -0,0 +1,95 @@
+/*
+ *
+ * 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.
+ */
+
+#define LIBAVCODEC_VERSION_MAJOR 54
+#define LIBAVCODEC_VERSION_MINOR 35
+#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 < 55)
+#endif
+#ifndef FF_API_OLD_DECODE_AUDIO
+#define FF_API_OLD_DECODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_OLD_ENCODE_AUDIO
+#define FF_API_OLD_ENCODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_OLD_ENCODE_VIDEO
+#define FF_API_OLD_ENCODE_VIDEO (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_MPV_GLOBAL_OPTS
+#define FF_API_MPV_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_COLOR_TABLE_ID
+#define FF_API_COLOR_TABLE_ID (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_INTER_THRESHOLD
+#define FF_API_INTER_THRESHOLD (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_SUB_ID
+#define FF_API_SUB_ID (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_DSP_MASK
+#define FF_API_DSP_MASK (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_FIND_BEST_PIX_FMT
+#define FF_API_FIND_BEST_PIX_FMT (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_CODEC_ID
+#define FF_API_CODEC_ID (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_VDA_ASYNC
+#define FF_API_VDA_ASYNC (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_AVCODEC_RESAMPLE
+#define FF_API_AVCODEC_RESAMPLE (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_LIBMPEG2
+#define FF_API_LIBMPEG2 (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_MMI
+#define FF_API_MMI (LIBAVCODEC_VERSION_MAJOR < 55)
+#endif
+
+#endif /* AVCODEC_VERSION_H */
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/xvmc.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/xvmc.h
new file mode 100644
index 0000000..1f77e4e
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavcodec/xvmc.h
@@ -0,0 +1,168 @@
+/*
+ * 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 "avcodec.h"
+
+/**
+ * @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) */
+
+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 /* AVCODEC_XVMC_H */
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavformat/avformat.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavformat/avformat.h
new file mode 100644
index 0000000..149b66f
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavformat/avformat.h
@@ -0,0 +1,1749 @@
+/*
+ * 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.destruct is set on the returned packet, then the packet is
+ * allocated dynamically and the user may keep it indefinitely.
+ * Otherwise, if AVPacket.destruct 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
+ * @{
+ * @}
+ *
+ * @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"
+
+#if FF_API_AV_GETTIME
+#include "libavutil/time.h"
+#endif
+
+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".
+ *
+ * - 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 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 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);
+
+/*************************************************/
+/* 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;
+
+/*************************************************/
+/* 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 */
+} AVProbeData;
+
+#define AVPROBE_SCORE_MAX 100 ///< maximum score, half of that is used for file-extension-based detection
+#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 fallback to binary search via read_timestamp */
+#define AVFMT_NOGENSEARCH 0x4000 /**< Format does not allow to fallback to 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 */
+
+/**
+ * @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
+
+ /*****************************************************************
+ * 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;
+#if FF_API_R_FRAME_RATE
+ /**
+ * Real base framerate of the stream.
+ * This is the lowest framerate with which all timestamps can be
+ * represented accurately (it is the least common multiple of all
+ * framerates in the stream). Note, this value is just a guess!
+ * For example, if the time base is 1/90000 and all frames have either
+ * approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1.
+ */
+ AVRational r_frame_rate;
+#endif
+ void *priv_data;
+
+ /**
+ * encoding: pts generation when outputting stream
+ */
+ struct AVFrac pts;
+
+ /**
+ * This is the fundamental unit of time (in seconds) in terms
+ * of which frame timestamps are represented.
+ *
+ * decoding: set by libavformat
+ * encoding: set by libavformat in avformat_write_header. The muxer may use the
+ * user-provided value of @ref AVCodecContext.time_base "codec->time_base"
+ * as a hint.
+ */
+ 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
+ */
+ 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;
+
+ /*****************************************************************
+ * 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 {
+#if FF_API_R_FRAME_RATE
+ int64_t last_dts;
+ int64_t duration_gcd;
+ int duration_count;
+ double duration_error[MAX_STD_TIMEBASES];
+#endif
+ 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:
+ /**
+ * Timestamp corresponding to the last dts sync point.
+ *
+ * Initialized when AVCodecParserContext.dts_sync_point >= 0 and
+ * a DTS is received from the underlying container. Otherwise set to
+ * AV_NOPTS_VALUE by default.
+ */
+ int64_t reference_dts;
+ 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;
+
+/**
+ * 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 AVOptions. Set by avformat_alloc_context().
+ * Exports (de)muxer private options if they exist.
+ */
+ const AVClass *av_class;
+
+ /**
+ * Can only be iformat or oformat, not both at the same time.
+ *
+ * decoding: set by avformat_open_input().
+ * encoding: set by the user.
+ */
+ struct AVInputFormat *iformat;
+ struct AVOutputFormat *oformat;
+
+ /**
+ * Format private data. This is an AVOptions-enabled struct
+ * if and only if iformat/oformat.priv_class is not NULL.
+ */
+ void *priv_data;
+
+ /**
+ * I/O context.
+ *
+ * decoding: either set by the user before avformat_open_input() (then
+ * the user must close it manually) or set by avformat_open_input().
+ * encoding: set by the user.
+ *
+ * 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 */
+ int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */
+
+ /**
+ * A list of all streams in the file. New streams are created with
+ * avformat_new_stream().
+ *
+ * decoding: 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().
+ * encoding: streams are created by the user before avformat_write_header().
+ */
+ unsigned int nb_streams;
+ AVStream **streams;
+
+ char filename[1024]; /**< input or output filename */
+
+ /**
+ * Decoding: 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.
+ */
+ int64_t start_time;
+
+ /**
+ * Decoding: 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.
+ */
+ int64_t duration;
+
+ /**
+ * Decoding: 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;
+
+ 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
+
+ /**
+ * decoding: size of data to probe; encoding: unused.
+ */
+ unsigned int probesize;
+
+ /**
+ * decoding: maximum time (in AV_TIME_BASE units) during which the input should
+ * be analyzed in 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;
+
+ unsigned int nb_chapters;
+ AVChapter **chapters;
+
+ 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.
+ * - encoding: Set by user.
+ * - decoding: Unused.
+ */
+ int64_t start_time_realtime;
+
+ /**
+ * decoding: number of frames used to probe fps
+ */
+ int fps_probe_size;
+
+ /**
+ * Error recognition; higher values will detect more errors but may
+ * misdetect some more or less valid parts as errors.
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ int error_recognition;
+
+ /**
+ * Custom interrupt callbacks for the I/O layer.
+ *
+ * decoding: set by the user before avformat_open_input().
+ * encoding: 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
+ /*****************************************************************
+ * 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;
+} 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(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(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 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, AVCodec *c);
+
+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 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 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 av_close_input_file().
+ *
+ * @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);
+
+#if FF_API_READ_PACKET
+/**
+ * @deprecated use AVFMT_FLAG_NOFILLIN | AVFMT_FLAG_NOPARSE to read raw
+ * unprocessed packets
+ *
+ * Read a transport packet from a media file.
+ *
+ * This function is obsolete and should never be used.
+ * Use av_read_frame() instead.
+ *
+ * @param s media file handle
+ * @param pkt is filled
+ * @return 0 if OK, AVERROR_xxx on error
+ */
+attribute_deprecated
+int av_read_packet(AVFormatContext *s, AVPacket *pkt);
+#endif
+
+/**
+ * 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->destruct is NULL, then the packet is valid until the next
+ * av_read_frame() or until av_close_input_file(). 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 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 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);
+
+#if FF_API_CLOSE_INPUT_FILE
+/**
+ * @deprecated use avformat_close_input()
+ * Close a media file (but not its codecs).
+ *
+ * @param s media file handle
+ */
+attribute_deprecated
+void av_close_input_file(AVFormatContext *s);
+#endif
+
+/**
+ * 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 openened 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.
+ *
+ * The packet shall contain one audio or video frame.
+ * The packet must be correctly interleaved according to the container
+ * specification, if not then av_interleaved_write_frame must be used.
+ *
+ * @param s media file handle
+ * @param pkt The packet, which contains the stream_index, buf/buf_size,
+ * dts/pts, ...
+ * This 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.
+ * @return < 0 on error, = 0 if OK, 1 if flushed and there is no more data to flush
+ */
+int av_write_frame(AVFormatContext *s, AVPacket *pkt);
+
+/**
+ * Write a packet to an output media file ensuring correct interleaving.
+ *
+ * The packet must contain one audio or video frame.
+ * If the packets are already correctly interleaved, the application should
+ * call av_write_frame() instead as it is slightly faster. It is also important
+ * to keep in mind that completely non-interleaved input will need huge amounts
+ * of memory to interleave with this, so it is preferable to interleave at the
+ * demuxer level.
+ *
+ * @param s media file handle
+ * @param pkt The packet containing the data to be written. Libavformat takes
+ * ownership of the data and will free it when it sees fit using the packet's
+ * @ref AVPacket.destruct "destruct" field. The caller must not access the data
+ * after this function returns, as it may already be freed.
+ * This can be NULL (at any time, not just at the end), to flush the
+ * interleaving queues.
+ * 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.
+ */
+int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt);
+
+#if FF_API_INTERLEAVE_PACKET
+/**
+ * @deprecated this function was never meant to be called by the user
+ * programs.
+ */
+attribute_deprecated
+int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
+ AVPacket *pkt, int flush);
+#endif
+
+/**
+ * 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
+ */
+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
+ */
+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 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);
+
+
+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 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 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(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/lavc54_lavf54_lavu52_lavr01/libavformat/avio.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavformat/avio.h
new file mode 100644
index 0000000..b6d3cb3
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavformat/avio.h
@@ -0,0 +1,433 @@
+/*
+ * 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 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 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 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 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/lavc54_lavf54_lavu52_lavr01/libavformat/version.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavformat/version.h
new file mode 100644
index 0000000..c2c1e3a
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavformat/version.h
@@ -0,0 +1,71 @@
+/*
+ * 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/avutil.h"
+
+#define LIBAVFORMAT_VERSION_MAJOR 54
+#define LIBAVFORMAT_VERSION_MINOR 20
+#define LIBAVFORMAT_VERSION_MICRO 3
+
+#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_CLOSE_INPUT_FILE
+#define FF_API_CLOSE_INPUT_FILE (LIBAVFORMAT_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_APPLEHTTP_PROTO
+#define FF_API_APPLEHTTP_PROTO (LIBAVFORMAT_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_READ_PACKET
+#define FF_API_READ_PACKET (LIBAVFORMAT_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_INTERLEAVE_PACKET
+#define FF_API_INTERLEAVE_PACKET (LIBAVFORMAT_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_AV_GETTIME
+#define FF_API_AV_GETTIME (LIBAVFORMAT_VERSION_MAJOR < 55)
+#endif
+#ifndef FF_API_R_FRAME_RATE
+#define FF_API_R_FRAME_RATE (LIBAVFORMAT_VERSION_MAJOR < 55)
+#endif
+
+#endif /* AVFORMAT_VERSION_H */
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavresample/avresample.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavresample/avresample.h
new file mode 100644
index 0000000..0012787
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavresample/avresample.h
@@ -0,0 +1,379 @@
+/*
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles at gmail.com>
+ *
+ * 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_available(avr) +
+ * av_rescale_rnd(avresample_get_delay(avr) +
+ * in_samples, 44100, 48000, AV_ROUND_UP);
+ * 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/log.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.
+ *
+ * @param avr audio resample context
+ * @return 0 on success, negative AVERROR code on failure
+ */
+int avresample_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 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);
+
+/**
+ * Convert input samples and write them to the output FIFO.
+ *
+ * The upper bound on the number of output samples is given by
+ * avresample_available() + (avresample_get_delay() + number of input samples) *
+ * output sample rate / input sample rate.
+ *
+ * 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_available()
+ * @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);
+
+/**
+ * @}
+ */
+
+#endif /* AVRESAMPLE_AVRESAMPLE_H */
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavresample/version.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavresample/version.h
new file mode 100644
index 0000000..ebcd07f
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavresample/version.h
@@ -0,0 +1,46 @@
+/*
+ * 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
+
+#define LIBAVRESAMPLE_VERSION_MAJOR 1
+#define LIBAVRESAMPLE_VERSION_MINOR 0
+#define LIBAVRESAMPLE_VERSION_MICRO 1
+
+#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 < 2)
+#endif
+
+#endif /* AVRESAMPLE_VERSION_H */
diff --git a/make/stub_includes/libav/libavutil/adler32.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/adler32.h
similarity index 100%
copy from make/stub_includes/libav/libavutil/adler32.h
copy to make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/adler32.h
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/aes.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/aes.h
new file mode 100644
index 0000000..edff275
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/aes.h
@@ -0,0 +1,67 @@
+/*
+ * copyright (c) 2007 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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/lavc54_lavf54_lavu52_lavr01/libavutil/attributes.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/attributes.h
new file mode 100644
index 0000000..292a0a1
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/attributes.h
@@ -0,0 +1,122 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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))
+#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)
+# define av_flatten __attribute__((flatten))
+#else
+# define av_flatten
+#endif
+
+#if AV_GCC_VERSION_AT_LEAST(3,1)
+# define attribute_deprecated __attribute__((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/lavc54_lavf54_lavu52_lavr01/libavutil/audio_fifo.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/audio_fifo.h
new file mode 100644
index 0000000..8c76388
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/audio_fifo.h
@@ -0,0 +1,146 @@
+/*
+ * Audio FIFO
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles at gmail.com>
+ *
+ * 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
+ * @{
+ */
+
+/**
+ * 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/lavc54_lavf54_lavu52_lavr01/libavutil/audioconvert.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/audioconvert.h
new file mode 100644
index 0000000..300a67c
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/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/libavutil/avassert.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/avassert.h
similarity index 100%
copy from make/stub_includes/libav/libavutil/avassert.h
copy to make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/avassert.h
diff --git a/make/stub_includes/libav/libavutil/avconfig.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/avconfig.h
similarity index 100%
copy from make/stub_includes/libav/libavutil/avconfig.h
copy to make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/avconfig.h
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/avstring.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/avstring.h
new file mode 100644
index 0000000..acd6610
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/avstring.h
@@ -0,0 +1,191 @@
+/*
+ * 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);
+
+/**
+ * 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 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 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);
+
+/**
+ * @}
+ */
+
+#endif /* AVUTIL_AVSTRING_H */
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/avutil.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/avutil.h
new file mode 100644
index 0000000..33f9bea
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/avutil.h
@@ -0,0 +1,275 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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 @subpage 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 @subpage libswscale color conversion and scaling library
+ */
+
+/**
+ * @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_misc Other
+ *
+ * @{
+ *
+ * @defgroup lavu_internal Internal
+ *
+ * Not exported functions, for internal usage only
+ *
+ * @{
+ *
+ * @}
+ */
+
+
+/**
+ * @defgroup 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)
+
+/**
+ * @}
+ */
+
+/**
+ * @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)
+
+/**
+ * @}
+ */
+
+/**
+ * @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 "version.h"
+
+/**
+ * @}
+ * @}
+ */
+
+#endif /* AVUTIL_AVUTIL_H */
diff --git a/make/stub_includes/libav/libavutil/base64.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/base64.h
similarity index 100%
copy from make/stub_includes/libav/libavutil/base64.h
copy to make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/base64.h
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/blowfish.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/blowfish.h
new file mode 100644
index 0000000..8c29536
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/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/libavutil/bswap.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/bswap.h
similarity index 100%
copy from make/stub_includes/libav/libavutil/bswap.h
copy to make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/bswap.h
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/channel_layout.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/channel_layout.h
new file mode 100644
index 0000000..15b6887
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/channel_layout.h
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
+ * 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_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/lavc54_lavf54_lavu52_lavr01/libavutil/common.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/common.h
new file mode 100644
index 0000000..cc4df16
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/common.h
@@ -0,0 +1,406 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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 <ctype.h>
+#include <errno.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <math.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/lavc54_lavf54_lavu52_lavr01/libavutil/cpu.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/cpu.h
new file mode 100644
index 0000000..4929512
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/cpu.h
@@ -0,0 +1,84 @@
+/*
+ * 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
+#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
+#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_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)
+
+/**
+ * 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);
+
+/* The following CPU-specific functions shall not be called directly. */
+int ff_get_cpu_flags_arm(void);
+int ff_get_cpu_flags_ppc(void);
+int ff_get_cpu_flags_x86(void);
+
+#endif /* AVUTIL_CPU_H */
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/crc.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/crc.h
new file mode 100644
index 0000000..0540619
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/crc.h
@@ -0,0 +1,74 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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_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/lavc54_lavf54_lavu52_lavr01/libavutil/dict.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/dict.h
new file mode 100644
index 0000000..492da9a
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/dict.h
@@ -0,0 +1,129 @@
+/*
+ *
+ * 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
+ * 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);
+ *
+ * AVDictionaryEntry *t = NULL;
+ * 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(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);
+
+/**
+ * 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, 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/lavc54_lavf54_lavu52_lavr01/libavutil/error.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/error.h
new file mode 100644
index 0000000..3dfd880
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/error.h
@@ -0,0 +1,83 @@
+/*
+ * 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>
+#include "avutil.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.
+
+/**
+ * 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/libavutil/eval.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/eval.h
similarity index 100%
copy from make/stub_includes/libav/libavutil/eval.h
copy to make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/eval.h
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/fifo.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/fifo.h
new file mode 100644
index 0000000..ea30f5d
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/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/lavc54_lavf54_lavu52_lavr01/libavutil/file.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/file.h
new file mode 100644
index 0000000..e3f02a8
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/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/lavc54_lavf54_lavu52_lavr01/libavutil/imgutils.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/imgutils.h
new file mode 100644
index 0000000..7151013
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/imgutils.h
@@ -0,0 +1,138 @@
+/*
+ * 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"
+
+/**
+ * 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);
+
+int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt);
+
+/**
+ * @}
+ */
+
+
+#endif /* AVUTIL_IMGUTILS_H */
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/intfloat.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/intfloat.h
new file mode 100644
index 0000000..38d26ad
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/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/libavutil/intfloat_readwrite.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/intfloat_readwrite.h
similarity index 100%
copy from make/stub_includes/libav/libavutil/intfloat_readwrite.h
copy to make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/intfloat_readwrite.h
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/intreadwrite.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/intreadwrite.h
new file mode 100644
index 0000000..f77fd60
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/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/lavc54_lavf54_lavu52_lavr01/libavutil/lfg.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/lfg.h
new file mode 100644
index 0000000..5e526c1
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/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/lavc54_lavf54_lavu52_lavr01/libavutil/log.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/log.h
new file mode 100644
index 0000000..7b17330
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/log.h
@@ -0,0 +1,173 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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;
+
+/* av_log API */
+
+#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
+
+#define AV_LOG_INFO 32
+#define AV_LOG_VERBOSE 40
+
+/**
+ * Stuff which is only useful for libav* developers.
+ */
+#define AV_LOG_DEBUG 48
+
+/**
+ * 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 av_vlog callback
+ * function.
+ *
+ * @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 fmt The format string (printf-compatible) that specifies how
+ * subsequent arguments are converted to output.
+ * @see av_vlog
+ */
+void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4);
+
+void av_vlog(void *avcl, int level, const char *fmt, va_list);
+int av_log_get_level(void);
+void av_log_set_level(int);
+void av_log_set_callback(void (*)(void*, int, const char*, va_list));
+void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl);
+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/lavc54_lavf54_lavu52_lavr01/libavutil/lzo.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/lzo.h
new file mode 100644
index 0000000..9d7e8f1
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/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/lavc54_lavf54_lavu52_lavr01/libavutil/mathematics.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/mathematics.h
new file mode 100644
index 0000000..043dd0f
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/mathematics.h
@@ -0,0 +1,111 @@
+/*
+ * copyright (c) 2005 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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/lavc54_lavf54_lavu52_lavr01/libavutil/md5.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/md5.h
new file mode 100644
index 0000000..29e4e7c
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/md5.h
@@ -0,0 +1,51 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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/lavc54_lavf54_lavu52_lavr01/libavutil/mem.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/mem.h
new file mode 100644
index 0000000..8f47224
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/mem.h
@@ -0,0 +1,183 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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);
+
+/**
+ * Helper function to allocate a block of size * nmemb bytes with
+ * using 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 <= 0 || 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_malloc(z)() or av_realloc() or NULL.
+ * @param size Size in bytes for 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.
+ * @see av_fast_realloc()
+ */
+void *av_realloc(void *ptr, size_t size) av_alloc_size(2);
+
+/**
+ * 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);
+
+/**
+ * Helper function to allocate a block of size * nmemb bytes with
+ * using 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 <= 0 || 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;
+
+/**
+ * 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);
+
+/**
+ * @brief 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);
+
+/**
+ * @}
+ */
+
+#endif /* AVUTIL_MEM_H */
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/old_pix_fmts.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/old_pix_fmts.h
new file mode 100644
index 0000000..31765ae
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/old_pix_fmts.h
@@ -0,0 +1,128 @@
+/*
+ * 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
+ PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
+ PIX_FMT_XVMC_MPEG2_IDCT,
+ 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)
+ 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
+ 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
+ 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
+ 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/lavc54_lavf54_lavu52_lavr01/libavutil/opt.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/opt.h
new file mode 100644
index 0000000..2d3cc73
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/opt.h
@@ -0,0 +1,516 @@
+/*
+ * AVOptions
+ * copyright (c) 2005 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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 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 = 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_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
+#define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ...
+#define AV_OPT_FLAG_AUDIO_PARAM 8
+#define AV_OPT_FLAG_VIDEO_PARAM 16
+#define AV_OPT_FLAG_SUBTITLE_PARAM 32
+//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 string and binary options 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);
+/**
+ * @}
+ */
+
+/**
+ * @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);
+/**
+ * @}
+ * @}
+ */
+
+#endif /* AVUTIL_OPT_H */
diff --git a/make/stub_includes/libav/libavutil/parseutils.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/parseutils.h
similarity index 100%
copy from make/stub_includes/libav/libavutil/parseutils.h
copy to make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/parseutils.h
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/pixdesc.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/pixdesc.h
new file mode 100644
index 0000000..47e6bb8
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/pixdesc.h
@@ -0,0 +1,223 @@
+/*
+ * pixel format descriptor
+ * Copyright (c) 2009 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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 "pixfmt.h"
+
+typedef struct AVComponentDescriptor{
+ uint16_t plane :2; ///< which of the 4 planes contains the component
+
+ /**
+ * 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;
+ uint16_t shift :3; ///< number of least significant bits that must be shifted away to get the value
+ uint16_t depth_minus1 :4; ///< number of bits in the component minus 1
+}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];
+}AVPixFmtDescriptor;
+
+#define PIX_FMT_BE 1 ///< Pixel format is big-endian.
+#define PIX_FMT_PAL 2 ///< Pixel format has a palette in data[1], values are indexes in this palette.
+#define PIX_FMT_BITSTREAM 4 ///< All values of a component are bit-wise packed end to end.
+#define PIX_FMT_HWACCEL 8 ///< Pixel format is an HW accelerated format.
+#define PIX_FMT_PLANAR 16 ///< At least one pixel component is not in the first data plane
+#define PIX_FMT_RGB 32 ///< The pixel format contains RGB-like data (as opposed to YUV/grayscale)
+/**
+ * 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 PIX_FMT_PSEUDOPAL 64
+
+#define PIX_FMT_ALPHA 128 ///< The pixel format has an alpha channel
+
+
+#if FF_API_PIX_FMT_DESC
+/**
+ * The array of all the pixel format descriptors.
+ */
+extern 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.
+ *
+ * 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);
+
+
+#endif /* AVUTIL_PIXDESC_H */
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/pixfmt.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/pixfmt.h
new file mode 100644
index 0000000..1072f00
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/pixfmt.h
@@ -0,0 +1,268 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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 "libavutil/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
+ AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
+ AV_PIX_FMT_XVMC_MPEG2_IDCT,
+ 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)
+ 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
+ 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
+ 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
+ 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_Y400A, ///< 8bit gray, 8bit alpha
+ 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_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_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_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_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)
+
+#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
+
+#endif /* AVUTIL_PIXFMT_H */
diff --git a/make/stub_includes/libav/libavutil/random_seed.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/random_seed.h
similarity index 100%
copy from make/stub_includes/libav/libavutil/random_seed.h
copy to make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/random_seed.h
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/rational.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/rational.h
new file mode 100644
index 0000000..5d7dab7
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/rational.h
@@ -0,0 +1,155 @@
+/*
+ * rational numbers
+ * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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 <michaelni at gmx.at>
+ */
+
+#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/lavc54_lavf54_lavu52_lavr01/libavutil/samplefmt.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/samplefmt.h
new file mode 100644
index 0000000..33cbded
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/samplefmt.h
@@ -0,0 +1,220 @@
+/*
+ * 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"
+
+/**
+ * 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:
+ *
+ * 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);
+
+/**
+ * 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/lavc54_lavf54_lavu52_lavr01/libavutil/sha.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/sha.h
new file mode 100644
index 0000000..4c9a0c9
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/sha.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2007 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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/lavc54_lavf54_lavu52_lavr01/libavutil/time.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/time.h
new file mode 100644
index 0000000..b01a97d
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/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/lavc54_lavf54_lavu52_lavr01/libavutil/version.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/version.h
new file mode 100644
index 0000000..1dbb11c
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/version.h
@@ -0,0 +1,87 @@
+/*
+ * 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 "avutil.h"
+
+/**
+ * @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 52
+#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 < 53)
+#endif
+#ifndef FF_API_CONTEXT_SIZE
+#define FF_API_CONTEXT_SIZE (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_PIX_FMT_DESC
+#define FF_API_PIX_FMT_DESC (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_AV_REVERSE
+#define FF_API_AV_REVERSE (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_AUDIOCONVERT
+#define FF_API_AUDIOCONVERT (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_CPU_FLAG_MMX2
+#define FF_API_CPU_FLAG_MMX2 (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
+
+/**
+ * @}
+ */
+
+#endif /* AVUTIL_VERSION_H */
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/xtea.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/xtea.h
new file mode 100644
index 0000000..7d2b07b
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libavutil/xtea.h
@@ -0,0 +1,61 @@
+/*
+ * 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>
+
+/**
+ * @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/lavc54_lavf54_lavu52_lavr01/libswresample/swresample.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libswresample/swresample.h
new file mode 100644
index 0000000..95e8a5a
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libswresample/swresample.h
@@ -0,0 +1,311 @@
+/*
+ * Copyright (C) 2011-2013 Michael Niedermayer (michaelni at gmx.at)
+ *
+ * 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.
+ *
+ * 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
+ * SwrContext *swr = swr_alloc();
+ * av_opt_set_int(swr, "in_channel_layout", AV_CH_LAYOUT_5POINT1, 0);
+ * av_opt_set_int(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
+ *
+ * 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
+ * as described above, or by using swr_alloc_set_opts(), 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 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().
+ * There will be no memory leak if the data is not completely flushed before
+ * swr_free().
+ */
+
+#include <stdint.h>
+#include "libavutil/samplefmt.h"
+
+#include "libswresample/version.h"
+
+#if LIBSWRESAMPLE_VERSION_MAJOR < 1
+#define SWR_CH_MAX 32 ///< Maximum number of channels
+#endif
+
+#define SWR_FLAG_RESAMPLE 1 ///< Force resampling even if equal sample rate
+//TODO use int resample ?
+//long term TODO can we enable this dynamically?
+
+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 */
+};
+
+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().
+ */
+const AVClass *swr_get_class(void);
+
+/**
+ * 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.
+ *
+ * @return AVERROR error code in case of failure.
+ */
+int swr_init(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 Swr context, can be NULL
+ * @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);
+
+/**
+ * Free the given SwrContext and set the pointer to NULL.
+ */
+void swr_free(struct SwrContext **s);
+
+/**
+ * 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.
+ * Convertion 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.
+ * First is when automatic timestamp compensation is not used, (min_compensation >= FLT_MAX)
+ * in this case timestamps will be passed through with delays compensated
+ * Second is when automatic timestamp compensation is used, (min_compensation < FLT_MAX)
+ * in this case the output timestamps will match output sample numbers
+ *
+ * @param pts timestamp for the next input sample, INT64_MIN if unknown
+ * @return the output timestamp for the next output sample
+ */
+int64_t swr_next_pts(struct SwrContext *s, int64_t pts);
+
+/**
+ * Activate resampling compensation.
+ */
+int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensation_distance);
+
+/**
+ * Set a customized input channel mapping.
+ *
+ * @param s allocated Swr context, not yet initialized
+ * @param channel_map customized input channel mapping (array of channel
+ * indexes, -1 for a muted channel)
+ * @return 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 AVERROR error code in case of failure.
+ */
+int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride);
+
+/**
+ * Drops the specified number of output samples.
+ */
+int swr_drop_output(struct SwrContext *s, int count);
+
+/**
+ * Injects the specified number of silence samples.
+ */
+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
+ * if its set to 1 the returned delay is in seconds
+ * if its set to 1000 the returned delay is in milli seconds
+ * if its set to the input sample rate then the returned delay is in input samples
+ * if its set to the output sample rate then the returned delay is in output samples
+ * an exact rounding free delay can be found by using LCM(in_sample_rate, out_sample_rate)
+ * @returns the delay in 1/base units.
+ */
+int64_t swr_get_delay(struct SwrContext *s, int64_t base);
+
+/**
+ * Return the LIBSWRESAMPLE_VERSION_INT constant.
+ */
+unsigned swresample_version(void);
+
+/**
+ * Return the swr build-time configuration.
+ */
+const char *swresample_configuration(void);
+
+/**
+ * Return the swr license.
+ */
+const char *swresample_license(void);
+
+/**
+ * @}
+ */
+
+#endif /* SWRESAMPLE_SWRESAMPLE_H */
diff --git a/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libswresample/version.h b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/libswresample/version.h
new file mode 100644
index 0000000..df9df48
--- /dev/null
+++ b/make/stub_includes/libav/lavc54_lavf54_lavu52_lavr01/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 0
+#define LIBSWRESAMPLE_VERSION_MINOR 17
+#define LIBSWRESAMPLE_VERSION_MICRO 102
+
+#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/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavcodec/avcodec.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavcodec/avcodec.h
new file mode 100644
index 0000000..caf8284
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavcodec/avcodec.h
@@ -0,0 +1,4277 @@
+/*
+ * 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 "libavcodec/version.h"
+/**
+ * @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
+ AV_CODEC_ID_MPEG2VIDEO_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,
+
+ /* 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,
+
+ /* 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,
+
+ /* 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,
+
+ /* 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)
+
+/**
+ * @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 AVColorPrimaries{
+ AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
+ AVCOL_PRI_UNSPECIFIED = 2,
+ 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_NB , ///< Not part of ABI
+};
+
+enum AVColorTransferCharacteristic{
+ AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361
+ AVCOL_TRC_UNSPECIFIED = 2,
+ AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
+ AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG
+ AVCOL_TRC_SMPTE240M = 7,
+ AVCOL_TRC_NB , ///< Not part of ABI
+};
+
+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_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_NB , ///< Not part of ABI
+};
+
+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
+};
+
+/**
+ * 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
+};
+
+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;
+
+#define FF_MAX_B_FRAMES 16
+
+/* 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_QPEL 0x0010 ///< Use qpel MC.
+#define CODEC_FLAG_GMC 0x0020 ///< Use GMC.
+#define CODEC_FLAG_MV0 0x0040 ///< Always try a MB with MV=<0,0>.
+/**
+ * The parent program guarantees that the input for B-frames containing
+ * streams is not written to for at least s->max_b_frames+1 frames, if
+ * this is not set the input will be copied.
+ */
+#define CODEC_FLAG_INPUT_PRESERVED 0x0100
+#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.
+#define CODEC_FLAG_EMU_EDGE 0x4000 ///< Don't draw edges.
+#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. */
+#define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< Normalize adaptive quantization.
+#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
+/* Codec can export data for HW decoding (XvMC). */
+#define CODEC_CAP_HWACCEL 0x0010
+/**
+ * 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
+/**
+ * Codec is able to deal with negative linesizes
+ */
+#define CODEC_CAP_NEG_LINESIZES 0x0800
+/**
+ * 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
+
+//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, ...)
+
+/**
+ * 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;
+
+#define FF_QSCALE_TYPE_MPEG1 0
+#define FF_QSCALE_TYPE_MPEG2 1
+#define FF_QSCALE_TYPE_H264 2
+#define FF_QSCALE_TYPE_VP56 3
+
+#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 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.
+ */
+ struct {
+ uint8_t *data;
+ int size;
+ enum AVPacketSideDataType type;
+ } *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;
+ char codec_name[32];
+ 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 to the
+ * beginning of the stream. The decoded output will be delayed by this
+ * many samples relative to the input to the encoder. Note that this
+ * field is purely informational and does not directly affect the pts
+ * output by the encoder, which should always be based on the actual
+ * presentation time, including any 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;
+
+#define FF_ASPECT_EXTENDED 15
+
+ /**
+ * 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;
+
+ /**
+ * 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.
+ */
+ 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
+
+ /**
+ * 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)
+
+ /**
+ * XVideo Motion Acceleration
+ * - encoding: forbidden
+ * - decoding: set by decoder
+ */
+ int xvmc_acceleration;
+
+ /**
+ * 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;
+
+ /**
+ * Multiplied by qscale for each frame and added to scene_change_score.
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int scenechange_factor;
+
+ /**
+ *
+ * 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.
+ *
+ * If CODEC_FLAG_EMU_EDGE is not set in s->flags, the buffer must contain an
+ * edge of the size returned by avcodec_get_edge_width() on all sides.
+ *
+ * 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
+#define FF_CODER_TYPE_DEFLATE 4
+ /**
+ * 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
+#define FF_BUG_OLD_MSMPEG4 2
+#define FF_BUG_XVID_ILACE 4
+#define FF_BUG_UMP4 8
+#define FF_BUG_NO_PADDING 16
+#define FF_BUG_AMV 32
+#define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default.
+#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
+#define FF_DEBUG_MV 32
+#define FF_DEBUG_DCT_COEFF 0x00000040
+#define FF_DEBUG_SKIP 0x00000080
+#define FF_DEBUG_STARTCODE 0x00000100
+#define FF_DEBUG_PTS 0x00000200
+#define FF_DEBUG_ER 0x00000400
+#define FF_DEBUG_MMCO 0x00000800
+#define FF_DEBUG_BUGS 0x00001000
+#define FF_DEBUG_VIS_QP 0x00002000
+#define FF_DEBUG_VIS_MB_TYPE 0x00004000
+#define FF_DEBUG_BUFFERS 0x00008000
+#define FF_DEBUG_THREADS 0x00010000
+
+ /**
+ * debug
+ * - encoding: Set by user.
+ * - decoding: Set by user.
+ */
+ 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
+
+ /**
+ * Error recognition; may misdetect some more or less valid parts as errors.
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ int err_recognition;
+#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
+ * @deprecated in favor of pkt_pts
+ * - 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
+#define FF_DCT_INT 2
+#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
+#define FF_IDCT_SH4 9
+#define FF_IDCT_SIMPLEARM 10
+#define FF_IDCT_IPP 13
+#define FF_IDCT_XVIDMMX 14
+#define FF_IDCT_SIMPLEARMV5TE 16
+#define FF_IDCT_SIMPLEARMV6 17
+#define FF_IDCT_SIMPLEVIS 18
+#define FF_IDCT_FAAN 20
+#define FF_IDCT_SIMPLENEON 22
+#define FF_IDCT_SIMPLEALPHA 23
+
+ /**
+ * 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: Set by libavcodec.
+ */
+ 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);
+
+ /**
+ * thread opaque
+ * Can be used by execute() to store some per AVCodecContext stuff.
+ * - encoding: set by execute()
+ * - decoding: set by execute()
+ */
+ void *thread_opaque;
+
+ /**
+ * 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
+
+ /**
+ * 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;
+
+ /**
+ * Simulates errors in the bitstream to test error concealment.
+ * - encoding: Set by user.
+ * - decoding: unused
+ */
+ int error_rate;
+
+ /**
+ * Current packet as passed into the decoder, to avoid having
+ * to pass the packet into every function. Currently only valid
+ * inside lavc and get/release_buffer callbacks.
+ * - decoding: set by avcodec_decode_*, read by get_buffer() for setting pkt_pts
+ * - encoding: unused
+ */
+ AVPacket *pkt;
+
+ /**
+ * 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;
+} 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
+ attribute_deprecated uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
+ 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;
+
+ struct AVHWAccel *next;
+
+ /**
+ * 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 HW accelerator private data.
+ *
+ * Private data is allocated with av_mallocz() before
+ * AVCodecContext.get_buffer() and deallocated after
+ * AVCodecContext.release_buffer().
+ */
+ 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 can be deallocated by calling avcodec_close() on it followed
+ * by av_free().
+ *
+ * @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);
+
+/**
+ * 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);
+
+/**
+ * Allocate an AVFrame and set its fields to default values. The resulting
+ * struct must be freed using avcodec_free_frame().
+ *
+ * @return An AVFrame filled with default values or NULL on failure.
+ * @see avcodec_get_frame_defaults
+ */
+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.
+ */
+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()).
+ */
+void avcodec_free_frame(AVFrame **frame);
+
+/**
+ * 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);
+
+/**
+ * @}
+ */
+
+/**
+ * @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);
+
+/**
+ * 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.
+ */
+unsigned avcodec_get_edge_width(void);
+
+/**
+ * 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.
+ * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased
+ * according to avcodec_get_edge_width() before.
+ */
+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.
+ * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased
+ * according to avcodec_get_edge_width() before.
+ */
+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. 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.
+ *
+ * @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.
+ *
+ * @note You might have to align the input buffer. The alignment requirements
+ * depend on the CPU and the decoder.
+ *
+ * @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 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.
+ * @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 You might have to align the input buffer avpkt->data.
+ * The alignment requirements depend on the CPU: on some CPUs it isn't
+ * necessary at all, on others it won't work at all if not aligned and on others
+ * it will work but it will have an impact on performance.
+ *
+ * In practice, avpkt->data should have 4 byte alignment at minimum.
+ *
+ * @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 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(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);
+
+/**
+ * @}
+ */
+
+void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
+
+/**
+ * Put a string representing the codec tag codec_tag in buf.
+ *
+ * @param buf_size size in bytes of buf
+ * @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);
+
+/**
+ * Flush buffers, should be called when seeking or when switching to a different stream.
+ */
+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(AVBitStreamFilter *f);
+
+/* memory */
+
+/**
+ * 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);
+
+/**
+ * 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(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/lavc55_lavf55_lavu52_lavr01/libavcodec/avfft.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavcodec/avfft.h
new file mode 100644
index 0000000..b896182
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavcodec/avfft.h
@@ -0,0 +1,116 @@
+/*
+ * 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
+ *
+ * @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/lavc55_lavf55_lavu52_lavr01/libavcodec/dxva2.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavcodec/dxva2.h
new file mode 100644
index 0000000..d161eb9
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavcodec/dxva2.h
@@ -0,0 +1,88 @@
+/*
+ * 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
+
+/**
+ * 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/lavc55_lavf55_lavu52_lavr01/libavcodec/vaapi.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavcodec/vaapi.h
new file mode 100644
index 0000000..39e8825
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/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/lavc55_lavf55_lavu52_lavr01/libavcodec/vda.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavcodec/vda.h
new file mode 100644
index 0000000..987b94f
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavcodec/vda.h
@@ -0,0 +1,142 @@
+/*
+ * 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/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;
+
+ /**
+ * The current bitstream buffer.
+ */
+ uint8_t *priv_bitstream;
+
+ /**
+ * The current size of the bitstream.
+ */
+ int priv_bitstream_size;
+
+ /**
+ * The reference size used for fast reallocation.
+ */
+ 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);
+
+/**
+ * @}
+ */
+
+#endif /* AVCODEC_VDA_H */
diff --git a/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavcodec/vdpau.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavcodec/vdpau.h
new file mode 100644
index 0000000..8bedea5
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavcodec/vdpau.h
@@ -0,0 +1,160 @@
+/*
+ * 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>
+
+#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.
+ */
+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;
+
+#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/lavc55_lavf55_lavu52_lavr01/libavcodec/version.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavcodec/version.h
new file mode 100644
index 0000000..1c6efe6
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavcodec/version.h
@@ -0,0 +1,77 @@
+/*
+ *
+ * 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.
+ */
+
+#define LIBAVCODEC_VERSION_MAJOR 55
+#define LIBAVCODEC_VERSION_MINOR 17
+#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 < 56)
+#endif
+#ifndef FF_API_DEINTERLACE
+#define FF_API_DEINTERLACE (LIBAVCODEC_VERSION_MAJOR < 56)
+#endif
+#ifndef FF_API_DESTRUCT_PACKET
+#define FF_API_DESTRUCT_PACKET (LIBAVCODEC_VERSION_MAJOR < 56)
+#endif
+#ifndef FF_API_GET_BUFFER
+#define FF_API_GET_BUFFER (LIBAVCODEC_VERSION_MAJOR < 56)
+#endif
+#ifndef FF_API_MISSING_SAMPLE
+#define FF_API_MISSING_SAMPLE (LIBAVCODEC_VERSION_MAJOR < 56)
+#endif
+#ifndef FF_API_LOWRES
+#define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 56)
+#endif
+#ifndef FF_API_CAP_VDPAU
+#define FF_API_CAP_VDPAU (LIBAVCODEC_VERSION_MAJOR < 56)
+#endif
+#ifndef FF_API_BUFS_VDPAU
+#define FF_API_BUFS_VDPAU (LIBAVCODEC_VERSION_MAJOR < 56)
+#endif
+#ifndef FF_API_VOXWARE
+#define FF_API_VOXWARE (LIBAVCODEC_VERSION_MAJOR < 56)
+#endif
+
+#endif /* AVCODEC_VERSION_H */
diff --git a/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavcodec/xvmc.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavcodec/xvmc.h
new file mode 100644
index 0000000..1f77e4e
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavcodec/xvmc.h
@@ -0,0 +1,168 @@
+/*
+ * 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 "avcodec.h"
+
+/**
+ * @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) */
+
+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 /* AVCODEC_XVMC_H */
diff --git a/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavformat/avformat.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavformat/avformat.h
new file mode 100644
index 0000000..1399de0
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavformat/avformat.h
@@ -0,0 +1,1708 @@
+/*
+ * 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
+ * @{
+ * @}
+ *
+ * @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".
+ *
+ * - 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 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 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);
+
+/*************************************************/
+/* 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;
+
+/*************************************************/
+/* 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 */
+} AVProbeData;
+
+#define AVPROBE_SCORE_EXTENSION 50 ///< score for file extension
+#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
+
+ /*****************************************************************
+ * 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;
+
+ /**
+ * encoding: pts generation when outputting stream
+ */
+ struct AVFrac pts;
+
+ /**
+ * This is the fundamental unit of time (in seconds) in terms
+ * of which frame timestamps are represented.
+ *
+ * decoding: set by libavformat
+ * encoding: set by libavformat in avformat_write_header. The muxer may use the
+ * user-provided value of @ref AVCodecContext.time_base "codec->time_base"
+ * as a hint.
+ */
+ 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
+ */
+ 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;
+
+ /*****************************************************************
+ * 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:
+ /**
+ * Timestamp corresponding to the last dts sync point.
+ *
+ * Initialized when AVCodecParserContext.dts_sync_point >= 0 and
+ * a DTS is received from the underlying container. Otherwise set to
+ * AV_NOPTS_VALUE by default.
+ */
+ int64_t reference_dts;
+ 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;
+
+/**
+ * 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 AVOptions. Set by avformat_alloc_context().
+ * Exports (de)muxer private options if they exist.
+ */
+ const AVClass *av_class;
+
+ /**
+ * Can only be iformat or oformat, not both at the same time.
+ *
+ * decoding: set by avformat_open_input().
+ * encoding: set by the user.
+ */
+ struct AVInputFormat *iformat;
+ struct AVOutputFormat *oformat;
+
+ /**
+ * Format private data. This is an AVOptions-enabled struct
+ * if and only if iformat/oformat.priv_class is not NULL.
+ */
+ void *priv_data;
+
+ /**
+ * I/O context.
+ *
+ * decoding: either set by the user before avformat_open_input() (then
+ * the user must close it manually) or set by avformat_open_input().
+ * encoding: set by the user.
+ *
+ * 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 */
+ int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */
+
+ /**
+ * A list of all streams in the file. New streams are created with
+ * avformat_new_stream().
+ *
+ * decoding: 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().
+ * encoding: streams are created by the user before avformat_write_header().
+ */
+ unsigned int nb_streams;
+ AVStream **streams;
+
+ char filename[1024]; /**< input or output filename */
+
+ /**
+ * Decoding: 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.
+ */
+ int64_t start_time;
+
+ /**
+ * Decoding: 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.
+ */
+ int64_t duration;
+
+ /**
+ * Decoding: 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;
+
+ 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
+
+ /**
+ * decoding: size of data to probe; encoding: unused.
+ */
+ unsigned int probesize;
+
+ /**
+ * decoding: maximum time (in AV_TIME_BASE units) during which the input should
+ * be analyzed in 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;
+
+ unsigned int nb_chapters;
+ AVChapter **chapters;
+
+ 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.
+ * - encoding: Set by user.
+ * - decoding: Unused.
+ */
+ int64_t start_time_realtime;
+
+ /**
+ * decoding: number of frames used to probe fps
+ */
+ int fps_probe_size;
+
+ /**
+ * Error recognition; higher values will detect more errors but may
+ * misdetect some more or less valid parts as errors.
+ * - encoding: unused
+ * - decoding: Set by user.
+ */
+ int error_recognition;
+
+ /**
+ * Custom interrupt callbacks for the I/O layer.
+ *
+ * decoding: set by the user before avformat_open_input().
+ * encoding: 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
+ /*****************************************************************
+ * 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;
+
+} 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(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(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 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, AVCodec *c);
+
+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 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 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 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 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.
+ *
+ * The packet shall contain one audio or video frame.
+ * The packet must be correctly interleaved according to the container
+ * specification, if not then av_interleaved_write_frame must be used.
+ *
+ * @param s media file handle
+ * @param pkt The packet, which contains the stream_index, buf/buf_size,
+ * dts/pts, ...
+ * This 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.
+ * @return < 0 on error, = 0 if OK, 1 if flushed and there is no more data to flush
+ */
+int av_write_frame(AVFormatContext *s, AVPacket *pkt);
+
+/**
+ * Write a packet to an output media file ensuring correct interleaving.
+ *
+ * The packet must contain one audio or video frame.
+ * If the packets are already correctly interleaved, the application should
+ * call av_write_frame() instead as it is slightly faster. It is also important
+ * to keep in mind that completely non-interleaved input will need huge amounts
+ * of memory to interleave with this, so it is preferable to interleave at the
+ * demuxer level.
+ *
+ * @param s media file handle
+ * @param pkt The packet containing the data to be written. pkt->buf must be set
+ * to a valid AVBufferRef describing the packet data. Libavformat takes
+ * ownership of this reference and will unref it when it sees fit. The caller
+ * must not access the data through this reference after this function returns.
+ * This can be NULL (at any time, not just at the end), to flush the
+ * interleaving queues.
+ * 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.
+ */
+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
+ */
+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
+ */
+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 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);
+
+
+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 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 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(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/lavc55_lavf55_lavu52_lavr01/libavformat/avio.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavformat/avio.h
new file mode 100644
index 0000000..b6d3cb3
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavformat/avio.h
@@ -0,0 +1,433 @@
+/*
+ * 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 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 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 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 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/lavc55_lavf55_lavu52_lavr01/libavformat/version.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavformat/version.h
new file mode 100644
index 0000000..ac675ce
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavformat/version.h
@@ -0,0 +1,52 @@
+/*
+ * 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/avutil.h"
+
+#define LIBAVFORMAT_VERSION_MAJOR 55
+#define LIBAVFORMAT_VERSION_MINOR 3
+#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.
+ */
+
+#endif /* AVFORMAT_VERSION_H */
diff --git a/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavresample/avresample.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavresample/avresample.h
new file mode 100644
index 0000000..d26f2ca
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavresample/avresample.h
@@ -0,0 +1,409 @@
+/*
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles at gmail.com>
+ *
+ * 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_available(avr) +
+ * av_rescale_rnd(avresample_get_delay(avr) +
+ * in_samples, 44100, 48000, AV_ROUND_UP);
+ * 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/log.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.
+ *
+ * @param avr audio resample context
+ * @return 0 on success, negative AVERROR code on failure
+ */
+int avresample_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);
+
+/**
+ * Convert input samples and write them to the output FIFO.
+ *
+ * The upper bound on the number of output samples is given by
+ * avresample_available() + (avresample_get_delay() + number of input samples) *
+ * output sample rate / input sample rate.
+ *
+ * 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_available()
+ * @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);
+
+/**
+ * @}
+ */
+
+#endif /* AVRESAMPLE_AVRESAMPLE_H */
diff --git a/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavresample/version.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavresample/version.h
new file mode 100644
index 0000000..3cc4441
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavresample/version.h
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+#define LIBAVRESAMPLE_VERSION_MAJOR 1
+#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 < 2)
+#endif
+
+#endif /* AVRESAMPLE_VERSION_H */
diff --git a/make/stub_includes/libav/libavutil/adler32.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/adler32.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/adler32.h
rename to make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/adler32.h
diff --git a/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/aes.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/aes.h
new file mode 100644
index 0000000..edff275
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/aes.h
@@ -0,0 +1,67 @@
+/*
+ * copyright (c) 2007 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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/lavc55_lavf55_lavu52_lavr01/libavutil/attributes.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/attributes.h
new file mode 100644
index 0000000..292a0a1
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/attributes.h
@@ -0,0 +1,122 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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))
+#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)
+# define av_flatten __attribute__((flatten))
+#else
+# define av_flatten
+#endif
+
+#if AV_GCC_VERSION_AT_LEAST(3,1)
+# define attribute_deprecated __attribute__((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/lavc55_lavf55_lavu52_lavr01/libavutil/audio_fifo.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/audio_fifo.h
new file mode 100644
index 0000000..8c76388
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/audio_fifo.h
@@ -0,0 +1,146 @@
+/*
+ * Audio FIFO
+ * Copyright (c) 2012 Justin Ruggles <justin.ruggles at gmail.com>
+ *
+ * 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
+ * @{
+ */
+
+/**
+ * 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/lavc55_lavf55_lavu52_lavr01/libavutil/audioconvert.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/audioconvert.h
new file mode 100644
index 0000000..300a67c
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/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/libavutil/avassert.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/avassert.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/avassert.h
rename to make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/avassert.h
diff --git a/make/stub_includes/libav/libavutil/avconfig.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/avconfig.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/avconfig.h
rename to make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/avconfig.h
diff --git a/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/avstring.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/avstring.h
new file mode 100644
index 0000000..b7d1098
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/avstring.h
@@ -0,0 +1,226 @@
+/*
+ * 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);
+
+/**
+ * @}
+ */
+
+#endif /* AVUTIL_AVSTRING_H */
diff --git a/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/avutil.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/avutil.h
new file mode 100644
index 0000000..ddb34a1
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/avutil.h
@@ -0,0 +1,308 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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 @subpage 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_misc Other
+ *
+ * @{
+ *
+ * @defgroup lavu_internal Internal
+ *
+ * Not exported functions, for internal usage only
+ *
+ * @{
+ *
+ * @}
+ */
+
+
+/**
+ * @defgroup 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)
+
+/**
+ * @}
+ */
+
+/**
+ * @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)
+
+/**
+ * @}
+ */
+
+/**
+ * @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 "version.h"
+
+/**
+ * @}
+ * @}
+ */
+
+#endif /* AVUTIL_AVUTIL_H */
diff --git a/make/stub_includes/libav/libavutil/base64.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/base64.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/base64.h
rename to make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/base64.h
diff --git a/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/blowfish.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/blowfish.h
new file mode 100644
index 0000000..8c29536
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/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/libavutil/bswap.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/bswap.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/bswap.h
rename to make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/bswap.h
diff --git a/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/buffer.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/buffer.h
new file mode 100644
index 0000000..56b4d02
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/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/lavc55_lavf55_lavu52_lavr01/libavutil/channel_layout.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/channel_layout.h
new file mode 100644
index 0000000..15b6887
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/channel_layout.h
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
+ * 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_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/lavc55_lavf55_lavu52_lavr01/libavutil/common.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/common.h
new file mode 100644
index 0000000..caa6b19
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/common.h
@@ -0,0 +1,405 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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 <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/lavc55_lavf55_lavu52_lavr01/libavutil/cpu.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/cpu.h
new file mode 100644
index 0000000..8f2af28
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/cpu.h
@@ -0,0 +1,84 @@
+/*
+ * 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
+#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
+#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_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)
+
+/**
+ * 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/lavc55_lavf55_lavu52_lavr01/libavutil/crc.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/crc.h
new file mode 100644
index 0000000..0540619
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/crc.h
@@ -0,0 +1,74 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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_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/lavc55_lavf55_lavu52_lavr01/libavutil/dict.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/dict.h
new file mode 100644
index 0000000..ab23f26
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/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
+ * 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);
+ *
+ * AVDictionaryEntry *t = NULL;
+ * 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(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, 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/lavc55_lavf55_lavu52_lavr01/libavutil/error.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/error.h
new file mode 100644
index 0000000..3dfd880
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/error.h
@@ -0,0 +1,83 @@
+/*
+ * 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>
+#include "avutil.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.
+
+/**
+ * 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/libavutil/eval.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/eval.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/eval.h
rename to make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/eval.h
diff --git a/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/fifo.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/fifo.h
new file mode 100644
index 0000000..ea30f5d
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/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/lavc55_lavf55_lavu52_lavr01/libavutil/file.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/file.h
new file mode 100644
index 0000000..e3f02a8
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/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/lavc55_lavf55_lavu52_lavr01/libavutil/frame.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/frame.h
new file mode 100644
index 0000000..d71948d
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/frame.h
@@ -0,0 +1,491 @@
+/*
+ *
+ * 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_FRAME_H
+#define AVUTIL_FRAME_H
+
+#include <stdint.h>
+
+#include "libavcodec/version.h"
+
+#include "avutil.h"
+#include "buffer.h"
+#include "dict.h"
+#include "rational.h"
+#include "samplefmt.h"
+
+enum AVFrameSideDataType {
+ /**
+ * The data is the AVPanScan struct defined in libavcodec.
+ */
+ AV_FRAME_DATA_PANSCAN,
+};
+
+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(). Not 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.
+ */
+ 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;
+} 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);
+
+/**
+ * Setup a new reference to the data described by an given 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, 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(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 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);
+
+#endif /* AVUTIL_FRAME_H */
diff --git a/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/hmac.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/hmac.h
new file mode 100644
index 0000000..28c2062
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/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/lavc55_lavf55_lavu52_lavr01/libavutil/imgutils.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/imgutils.h
new file mode 100644
index 0000000..7151013
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/imgutils.h
@@ -0,0 +1,138 @@
+/*
+ * 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"
+
+/**
+ * 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);
+
+int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt);
+
+/**
+ * @}
+ */
+
+
+#endif /* AVUTIL_IMGUTILS_H */
diff --git a/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/intfloat.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/intfloat.h
new file mode 100644
index 0000000..38d26ad
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/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/libavutil/intfloat_readwrite.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/intfloat_readwrite.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/intfloat_readwrite.h
rename to make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/intfloat_readwrite.h
diff --git a/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/intreadwrite.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/intreadwrite.h
new file mode 100644
index 0000000..f77fd60
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/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/lavc55_lavf55_lavu52_lavr01/libavutil/lfg.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/lfg.h
new file mode 100644
index 0000000..5e526c1
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/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/lavc55_lavf55_lavu52_lavr01/libavutil/log.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/log.h
new file mode 100644
index 0000000..7b17330
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/log.h
@@ -0,0 +1,173 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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;
+
+/* av_log API */
+
+#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
+
+#define AV_LOG_INFO 32
+#define AV_LOG_VERBOSE 40
+
+/**
+ * Stuff which is only useful for libav* developers.
+ */
+#define AV_LOG_DEBUG 48
+
+/**
+ * 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 av_vlog callback
+ * function.
+ *
+ * @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 fmt The format string (printf-compatible) that specifies how
+ * subsequent arguments are converted to output.
+ * @see av_vlog
+ */
+void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4);
+
+void av_vlog(void *avcl, int level, const char *fmt, va_list);
+int av_log_get_level(void);
+void av_log_set_level(int);
+void av_log_set_callback(void (*)(void*, int, const char*, va_list));
+void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl);
+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/lavc55_lavf55_lavu52_lavr01/libavutil/lzo.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/lzo.h
new file mode 100644
index 0000000..9d7e8f1
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/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/lavc55_lavf55_lavu52_lavr01/libavutil/mathematics.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/mathematics.h
new file mode 100644
index 0000000..043dd0f
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/mathematics.h
@@ -0,0 +1,111 @@
+/*
+ * copyright (c) 2005 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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/lavc55_lavf55_lavu52_lavr01/libavutil/md5.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/md5.h
new file mode 100644
index 0000000..29e4e7c
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/md5.h
@@ -0,0 +1,51 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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/lavc55_lavf55_lavu52_lavr01/libavutil/mem.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/mem.h
new file mode 100644
index 0000000..8a4fcd9
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/mem.h
@@ -0,0 +1,209 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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);
+
+/**
+ * Helper function to allocate a block of size * nmemb bytes with
+ * using 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 <= 0 || 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_malloc(z)() or av_realloc() or NULL.
+ * @param size Size in bytes for 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.
+ * @see av_fast_realloc()
+ */
+void *av_realloc(void *ptr, size_t size) av_alloc_size(2);
+
+/**
+ * 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_malloc(z)() or 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.
+ */
+av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, 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 pointer to a memory block already allocated
+ * with av_malloc(z)() or 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.
+ */
+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);
+
+/**
+ * Helper function to allocate a block of size * nmemb bytes with
+ * using 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 <= 0 || 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;
+
+/**
+ * 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);
+
+/**
+ * @brief 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);
+
+/**
+ * @}
+ */
+
+#endif /* AVUTIL_MEM_H */
diff --git a/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/old_pix_fmts.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/old_pix_fmts.h
new file mode 100644
index 0000000..a0ae06b
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/old_pix_fmts.h
@@ -0,0 +1,132 @@
+/*
+ * 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
+ PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
+ PIX_FMT_XVMC_MPEG2_IDCT,
+ 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/lavc55_lavf55_lavu52_lavr01/libavutil/opt.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/opt.h
new file mode 100644
index 0000000..0181379
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/opt.h
@@ -0,0 +1,516 @@
+/*
+ * AVOptions
+ * copyright (c) 2005 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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_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
+#define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ...
+#define AV_OPT_FLAG_AUDIO_PARAM 8
+#define AV_OPT_FLAG_VIDEO_PARAM 16
+#define AV_OPT_FLAG_SUBTITLE_PARAM 32
+//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 string and binary options 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);
+/**
+ * @}
+ */
+
+/**
+ * @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);
+/**
+ * @}
+ * @}
+ */
+
+#endif /* AVUTIL_OPT_H */
diff --git a/make/stub_includes/libav/libavutil/parseutils.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/parseutils.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/parseutils.h
rename to make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/parseutils.h
diff --git a/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/pixdesc.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/pixdesc.h
new file mode 100644
index 0000000..b1ba03f
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/pixdesc.h
@@ -0,0 +1,276 @@
+/*
+ * pixel format descriptor
+ * Copyright (c) 2009 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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{
+ uint16_t plane :2; ///< which of the 4 planes contains the component
+
+ /**
+ * 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;
+ uint16_t shift :3; ///< number of least significant bits that must be shifted away to get the value
+ uint16_t depth_minus1 :4; ///< number of bits in the component minus 1
+}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];
+}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
+/**
+ * @deprecate 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/lavc55_lavf55_lavu52_lavr01/libavutil/pixfmt.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/pixfmt.h
new file mode 100644
index 0000000..77305ca
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/pixfmt.h
@@ -0,0 +1,277 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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 "libavutil/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
+ AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
+ AV_PIX_FMT_XVMC_MPEG2_IDCT,
+ 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_Y400A, ///< 8bit gray, 8bit alpha
+ 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_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_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_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_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)
+
+#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
+
+#endif /* AVUTIL_PIXFMT_H */
diff --git a/make/stub_includes/libav/libavutil/random_seed.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/random_seed.h
similarity index 100%
rename from make/stub_includes/libav/libavutil/random_seed.h
rename to make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/random_seed.h
diff --git a/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/rational.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/rational.h
new file mode 100644
index 0000000..5d7dab7
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/rational.h
@@ -0,0 +1,155 @@
+/*
+ * rational numbers
+ * Copyright (c) 2003 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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 <michaelni at gmx.at>
+ */
+
+#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/lavc55_lavf55_lavu52_lavr01/libavutil/samplefmt.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/samplefmt.h
new file mode 100644
index 0000000..33cbded
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/samplefmt.h
@@ -0,0 +1,220 @@
+/*
+ * 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"
+
+/**
+ * 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:
+ *
+ * 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);
+
+/**
+ * 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/lavc55_lavf55_lavu52_lavr01/libavutil/sha.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/sha.h
new file mode 100644
index 0000000..4c9a0c9
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/sha.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2007 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * 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/lavc55_lavf55_lavu52_lavr01/libavutil/time.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/time.h
new file mode 100644
index 0000000..b01a97d
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/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/lavc55_lavf55_lavu52_lavr01/libavutil/version.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/version.h
new file mode 100644
index 0000000..c760d8d
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/version.h
@@ -0,0 +1,96 @@
+/*
+ * 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 "avutil.h"
+
+/**
+ * @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 52
+#define LIBAVUTIL_VERSION_MINOR 14
+#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 < 53)
+#endif
+#ifndef FF_API_CONTEXT_SIZE
+#define FF_API_CONTEXT_SIZE (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_PIX_FMT_DESC
+#define FF_API_PIX_FMT_DESC (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_AV_REVERSE
+#define FF_API_AV_REVERSE (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_AUDIOCONVERT
+#define FF_API_AUDIOCONVERT (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_CPU_FLAG_MMX2
+#define FF_API_CPU_FLAG_MMX2 (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_LLS_PRIVATE
+#define FF_API_LLS_PRIVATE (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_AVFRAME_LAVC
+#define FF_API_AVFRAME_LAVC (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
+#ifndef FF_API_VDPAU
+#define FF_API_VDPAU (LIBAVUTIL_VERSION_MAJOR < 53)
+#endif
+
+/**
+ * @}
+ */
+
+#endif /* AVUTIL_VERSION_H */
diff --git a/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/xtea.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/xtea.h
new file mode 100644
index 0000000..7d2b07b
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libavutil/xtea.h
@@ -0,0 +1,61 @@
+/*
+ * 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>
+
+/**
+ * @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/lavc55_lavf55_lavu52_lavr01/libswresample/swresample.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libswresample/swresample.h
new file mode 100644
index 0000000..95e8a5a
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libswresample/swresample.h
@@ -0,0 +1,311 @@
+/*
+ * Copyright (C) 2011-2013 Michael Niedermayer (michaelni at gmx.at)
+ *
+ * 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.
+ *
+ * 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
+ * SwrContext *swr = swr_alloc();
+ * av_opt_set_int(swr, "in_channel_layout", AV_CH_LAYOUT_5POINT1, 0);
+ * av_opt_set_int(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
+ *
+ * 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
+ * as described above, or by using swr_alloc_set_opts(), 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 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().
+ * There will be no memory leak if the data is not completely flushed before
+ * swr_free().
+ */
+
+#include <stdint.h>
+#include "libavutil/samplefmt.h"
+
+#include "libswresample/version.h"
+
+#if LIBSWRESAMPLE_VERSION_MAJOR < 1
+#define SWR_CH_MAX 32 ///< Maximum number of channels
+#endif
+
+#define SWR_FLAG_RESAMPLE 1 ///< Force resampling even if equal sample rate
+//TODO use int resample ?
+//long term TODO can we enable this dynamically?
+
+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 */
+};
+
+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().
+ */
+const AVClass *swr_get_class(void);
+
+/**
+ * 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.
+ *
+ * @return AVERROR error code in case of failure.
+ */
+int swr_init(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 Swr context, can be NULL
+ * @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);
+
+/**
+ * Free the given SwrContext and set the pointer to NULL.
+ */
+void swr_free(struct SwrContext **s);
+
+/**
+ * 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.
+ * Convertion 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.
+ * First is when automatic timestamp compensation is not used, (min_compensation >= FLT_MAX)
+ * in this case timestamps will be passed through with delays compensated
+ * Second is when automatic timestamp compensation is used, (min_compensation < FLT_MAX)
+ * in this case the output timestamps will match output sample numbers
+ *
+ * @param pts timestamp for the next input sample, INT64_MIN if unknown
+ * @return the output timestamp for the next output sample
+ */
+int64_t swr_next_pts(struct SwrContext *s, int64_t pts);
+
+/**
+ * Activate resampling compensation.
+ */
+int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensation_distance);
+
+/**
+ * Set a customized input channel mapping.
+ *
+ * @param s allocated Swr context, not yet initialized
+ * @param channel_map customized input channel mapping (array of channel
+ * indexes, -1 for a muted channel)
+ * @return 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 AVERROR error code in case of failure.
+ */
+int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride);
+
+/**
+ * Drops the specified number of output samples.
+ */
+int swr_drop_output(struct SwrContext *s, int count);
+
+/**
+ * Injects the specified number of silence samples.
+ */
+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
+ * if its set to 1 the returned delay is in seconds
+ * if its set to 1000 the returned delay is in milli seconds
+ * if its set to the input sample rate then the returned delay is in input samples
+ * if its set to the output sample rate then the returned delay is in output samples
+ * an exact rounding free delay can be found by using LCM(in_sample_rate, out_sample_rate)
+ * @returns the delay in 1/base units.
+ */
+int64_t swr_get_delay(struct SwrContext *s, int64_t base);
+
+/**
+ * Return the LIBSWRESAMPLE_VERSION_INT constant.
+ */
+unsigned swresample_version(void);
+
+/**
+ * Return the swr build-time configuration.
+ */
+const char *swresample_configuration(void);
+
+/**
+ * Return the swr license.
+ */
+const char *swresample_license(void);
+
+/**
+ * @}
+ */
+
+#endif /* SWRESAMPLE_SWRESAMPLE_H */
diff --git a/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libswresample/version.h b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/libswresample/version.h
new file mode 100644
index 0000000..df9df48
--- /dev/null
+++ b/make/stub_includes/libav/lavc55_lavf55_lavu52_lavr01/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 0
+#define LIBSWRESAMPLE_VERSION_MINOR 17
+#define LIBSWRESAMPLE_VERSION_MICRO 102
+
+#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/stub_includes/macosx/OpenGL/OpenGL.h b/make/stub_includes/macosx/OpenGL/OpenGL.h
index 3347209..86d8311 100644
--- a/make/stub_includes/macosx/OpenGL/OpenGL.h
+++ b/make/stub_includes/macosx/OpenGL/OpenGL.h
@@ -59,7 +59,8 @@ typedef enum _CGLPixelFormatAttribute {
*/
typedef enum _CGLOpenGLProfile {
kCGLOGLPVersion_Legacy = 0x1000, /* Legacy/Pre-OpenGL 3.0 */
- kCGLOGLPVersion_3_2_Core = 0x3200 /* OpenGL 3.2 Core */
+ kCGLOGLPVersion_GL3_Core = 0x3200, /* OpenGL 3 Core */
+ kCGLOGLPVersion_GL4_Core = 0x4100 /* OpenGL 4 Core */
} CGLOpenGLProfile;
/*
diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/Audio.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/Audio.java
index 2b51be1..83f5e4e 100644
--- a/src/jogl/classes/com/jogamp/audio/windows/waveout/Audio.java
+++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/Audio.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. 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
diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java
index 6097287..b36fd26 100644
--- a/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java
+++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. 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
@@ -50,7 +50,7 @@ public class Mixer {
// Windows Event object
private long event;
- private volatile ArrayList/*<Track>*/ tracks = new ArrayList();
+ private volatile ArrayList<Track> tracks = new ArrayList<Track>();
private Vec3f leftSpeakerPosition = new Vec3f(-1, 0, 0);
private Vec3f rightSpeakerPosition = new Vec3f( 1, 0, 0);
@@ -74,13 +74,13 @@ public class Mixer {
}
synchronized void add(Track track) {
- ArrayList/*<Track>*/ newTracks = (ArrayList) tracks.clone();
+ ArrayList<Track> newTracks = new ArrayList<Track>(tracks);
newTracks.add(track);
tracks = newTracks;
}
synchronized void remove(Track track) {
- ArrayList/*<Track>*/ newTracks = (ArrayList) tracks.clone();
+ ArrayList<Track> newTracks = new ArrayList<Track>(tracks);
newTracks.remove(track);
tracks = newTracks;
}
@@ -129,12 +129,13 @@ public class Mixer {
super("Mixer Thread");
}
+ @Override
public void run() {
while (!shutdown) {
- List/*<Track>*/ curTracks = tracks;
+ List<Track> curTracks = tracks;
- for (Iterator iter = curTracks.iterator(); iter.hasNext(); ) {
- Track track = (Track) iter.next();
+ for (Iterator<Track> iter = curTracks.iterator(); iter.hasNext(); ) {
+ Track track = iter.next();
try {
track.fill();
} catch (IOException e) {
@@ -166,6 +167,7 @@ public class Mixer {
}
}
+ @Override
public void run() {
while (!shutdown) {
// Get the next buffer
@@ -207,10 +209,10 @@ public class Mixer {
}
// Run down all of the registered tracks mixing them in
- List/*<Track>*/ curTracks = tracks;
+ List<Track> curTracks = tracks;
- for (Iterator iter = curTracks.iterator(); iter.hasNext(); ) {
- Track track = (Track) iter.next();
+ for (Iterator<Track> iter = curTracks.iterator(); iter.hasNext(); ) {
+ Track track = iter.next();
// Consider only playing tracks
if (track.isPlaying()) {
// First recompute its gain
@@ -344,7 +346,7 @@ public class Mixer {
e.printStackTrace();
}
}
-
+
if (directByteBufferConstructor != null) {
try {
return (ByteBuffer)
diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/SoundBuffer.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/SoundBuffer.java
index c45430d..0134655 100644
--- a/src/jogl/classes/com/jogamp/audio/windows/waveout/SoundBuffer.java
+++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/SoundBuffer.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. 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
diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/Track.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/Track.java
index b57bf1d..98a7874 100644
--- a/src/jogl/classes/com/jogamp/audio/windows/waveout/Track.java
+++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/Track.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. 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
@@ -151,7 +151,7 @@ public class Track {
// These are only for use by the Mixer
private float leftGain;
private float rightGain;
-
+
void setLeftGain(float leftGain) {
this.leftGain = leftGain;
}
diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/Vec3f.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/Vec3f.java
index 1afdaf0..79fb801 100644
--- a/src/jogl/classes/com/jogamp/audio/windows/waveout/Vec3f.java
+++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/Vec3f.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. 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
@@ -206,6 +206,7 @@ class Vec3f {
z *= arg.z;
}
+ @Override
public String toString() {
return "(" + x + ", " + y + ", " + z + ")";
}
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java
index 262fed9..b7a9c27 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -67,7 +67,7 @@ public class BuildComposablePipeline {
* By extra command-line argument: <code>prolog_xor_downstream</code>.
* <p>
* If true, either prolog (if exist) is called or downstream's method, but not both.
- * By default, both methods would be called.
+ * By default, both methods would be called.
* </p>
* <p>Default: false</p>
*/
@@ -81,14 +81,14 @@ public class BuildComposablePipeline {
* <p>Default: false</p>
*/
public static final int GEN_GL_IDENTITY_BY_ASSIGNABLE_CLASS = 1 << 4;
-
+
int mode;
- private String outputDir;
- private String outputPackage;
- private String outputName;
- private Class<?> classToComposeAround;
- private Class<?> classPrologOpt;
- private Class<?> classDownstream;
+ private final String outputDir;
+ private final String outputPackage;
+ private final String outputName;
+ private final Class<?> classToComposeAround;
+ private final Class<?> classPrologOpt;
+ private final Class<?> classDownstream;
// Only desktop OpenGL has immediate mode glBegin / glEnd
private boolean hasImmediateMode;
// Desktop OpenGL and GLES1 have GL_STACK_OVERFLOW and GL_STACK_UNDERFLOW errors
@@ -402,6 +402,7 @@ public class BuildComposablePipeline {
ifNames,
null,
new CodeGenUtils.EmissionCallback() {
+ @Override
public void emit(PrintWriter w) {
emitClassDocComment(w);
}
@@ -455,19 +456,14 @@ public class BuildComposablePipeline {
}
protected void emitSignature(PrintWriter output, Method m) {
- output.print(" public ");
- output.print(' ');
- output.print(JavaType.createForClass(m.getReturnType()).getName());
- output.print(' ');
- output.print(m.getName());
- output.print('(');
- output.print(getArgListAsString(m, true, true));
- output.println(")");
+ output.format(" @Override%n public %s %s(%s)%n",
+ JavaType.createForClass(m.getReturnType()).getName(),
+ m.getName(),
+ getArgListAsString(m, true, true));
}
protected void emitBody(PrintWriter output, Method m, boolean runHooks) {
output.println(" {");
- output.print(" ");
Class<?> retType = m.getReturnType();
boolean callPreDownstreamHook = runHooks && hasPreDownstreamCallHook(m);
@@ -513,6 +509,9 @@ public class BuildComposablePipeline {
output.print(" return ");
}
}
+ else {
+ output.print(" ");
+ }
output.print(getDownstreamObjectName());
output.print('.');
output.print(m.getName());
@@ -588,9 +587,10 @@ public class BuildComposablePipeline {
* closing parenthesis of the class is emitted.
*/
protected void postMethodEmissionHook(PrintWriter output) {
+ output.println(" @Override");
output.println(" public String toString() {");
output.println(" StringBuilder sb = new StringBuilder();");
- output.println(" sb.append(\"" + getOutputName() + " [ implementing " + baseInterfaceClass.getName() + ",\\n\\t\");");
+ output.println(" sb.append(\"" + getOutputName() + " [this 0x\"+Integer.toHexString(hashCode())+\" implementing " + baseInterfaceClass.getName() + ",\\n\\t\");");
if (null != prologClassOpt) {
output.println(" sb.append(\" prolog: \"+" + getPrologObjectNameOpt() + ".toString()+\",\\n\\t\");");
}
@@ -646,7 +646,10 @@ public class BuildComposablePipeline {
* Emits all of the isGL* methods.
*/
protected void emitGLIsMethods(PrintWriter output) {
- emitGLIsMethod(output, "GL");
+ output.println(" @Override");
+ output.println(" public final boolean isGL() {");
+ output.println(" return true;");
+ output.println(" }");
emitGLIsMethod(output, "GL4bc");
emitGLIsMethod(output, "GL4");
emitGLIsMethod(output, "GL3bc");
@@ -657,6 +660,7 @@ public class BuildComposablePipeline {
emitGLIsMethod(output, "GLES3");
emitGLIsMethod(output, "GL2ES1");
emitGLIsMethod(output, "GL2ES2");
+ emitGLIsMethod(output, "GL2ES3");
emitGLIsMethod(output, "GL3ES3");
emitGLIsMethod(output, "GL4ES3");
emitGLIsMethod(output, "GL2GL3");
@@ -696,15 +700,16 @@ public class BuildComposablePipeline {
protected void emitGLGetMethod(PrintWriter output, String type) {
output.println(" @Override");
output.println(" public final javax.media.opengl." + type + " get" + type + "() {");
- if( 0 != (GEN_GL_IDENTITY_BY_ASSIGNABLE_CLASS & getMode() ) ) {
- final Class<?> clazz = BuildComposablePipeline.getClass("javax.media.opengl." + type);
- if (clazz.isAssignableFrom(baseInterfaceClass)) {
+ final Class<?> clazz = BuildComposablePipeline.getClass("javax.media.opengl." + type);
+ if (clazz.isAssignableFrom(baseInterfaceClass)) {
+ if( 0 != (GEN_GL_IDENTITY_BY_ASSIGNABLE_CLASS & getMode() ) ) {
output.println(" return this;");
} else {
+ output.println(" if( is" + type + "() ) { return this; }");
output.println(" throw new GLException(\"Not a " + type + " implementation\");");
}
} else {
- output.println(" return " + getDownstreamObjectName() + ".get" + type + "();");
+ output.println(" throw new GLException(\"Not a " + type + " implementation\");");
}
output.println(" }");
}
@@ -713,7 +718,10 @@ public class BuildComposablePipeline {
* Emits all of the getGL* methods.
*/
protected void emitGLGetMethods(PrintWriter output) {
- emitGLGetMethod(output, "GL");
+ output.println(" @Override");
+ output.println(" public final javax.media.opengl.GL getGL() {");
+ output.println(" return this;");
+ output.println(" }");
emitGLGetMethod(output, "GL4bc");
emitGLGetMethod(output, "GL4");
emitGLGetMethod(output, "GL3bc");
@@ -724,6 +732,7 @@ public class BuildComposablePipeline {
emitGLGetMethod(output, "GLES3");
emitGLGetMethod(output, "GL2ES1");
emitGLGetMethod(output, "GL2ES2");
+ emitGLGetMethod(output, "GL2ES3");
emitGLGetMethod(output, "GL3ES3");
emitGLGetMethod(output, "GL4ES3");
emitGLGetMethod(output, "GL2GL3");
@@ -750,18 +759,22 @@ public class BuildComposablePipeline {
this.mode = mode;
}
+ @Override
protected String getOutputName() {
return className;
}
+ @Override
protected int getMode() {
return mode;
}
+ @Override
protected boolean emptyMethodAllowed() {
return true;
}
+ @Override
protected boolean emptyDownstreamAllowed() {
return true;
}
@@ -771,6 +784,7 @@ public class BuildComposablePipeline {
super.preMethodEmissionHook(output);
}
+ @Override
protected void constructorHook(PrintWriter output) {
output.print(" public " + getOutputName() + "(");
output.print(downstreamName + " " + getDownstreamObjectName());
@@ -801,6 +815,7 @@ public class BuildComposablePipeline {
}
}
+ @Override
protected void emitClassDocComment(PrintWriter output) {
output.println("/**");
output.println(" * Composable pipeline {@link " + outputPackage + "." + outputName + "}, implementing the interface");
@@ -835,10 +850,12 @@ public class BuildComposablePipeline {
output.println("*/");
}
+ @Override
protected boolean hasPreDownstreamCallHook(Method m) {
return null != getMethod(prologClassOpt, m);
}
+ @Override
protected void preDownstreamCallHook(PrintWriter output, Method m) {
if (null != prologNameOpt) {
output.print(getPrologObjectNameOpt());
@@ -850,10 +867,12 @@ public class BuildComposablePipeline {
}
}
+ @Override
protected boolean hasPostDownstreamCallHook(Method m) {
return false;
}
+ @Override
protected void postDownstreamCallHook(PrintWriter output, Method m) {
}
} // end class CustomPipeline
@@ -867,18 +886,22 @@ public class BuildComposablePipeline {
className = "Debug" + getBaseInterfaceName();
}
+ @Override
protected String getOutputName() {
return className;
}
+ @Override
protected int getMode() {
return 0;
}
+ @Override
protected boolean emptyMethodAllowed() {
return false;
}
+ @Override
protected boolean emptyDownstreamAllowed() {
return false;
}
@@ -888,6 +911,7 @@ public class BuildComposablePipeline {
super.preMethodEmissionHook(output);
}
+ @Override
protected void constructorHook(PrintWriter output) {
output.print(" public " + getOutputName() + "(");
output.println(downstreamName + " " + getDownstreamObjectName() + ")");
@@ -910,25 +934,21 @@ public class BuildComposablePipeline {
@Override
protected void postMethodEmissionHook(PrintWriter output) {
super.postMethodEmissionHook(output);
- output.println(" private void checkGLGetError(String caller)");
- output.println(" {");
+ output.println(" private int checkGLError() {");
if (hasImmediateMode) {
- output.println(" if (insideBeginEndPair) {");
- output.println(" return;");
- output.println(" }");
+ output.println(" if (insideBeginEndPair) return GL_NO_ERROR;");
output.println();
}
- output.println(" // Debug code to make sure the pipeline is working; leave commented out unless testing this class");
- output.println(" //System.err.println(\"Checking for GL errors "
- + "after call to \" + caller);");
- output.println();
- output.println(" int err = "
- + getDownstreamObjectName()
- + ".glGetError();");
- output.println(" if (err == GL_NO_ERROR) { return; }");
- output.println();
- output.println(" StringBuilder buf = new StringBuilder(Thread.currentThread()+");
- output.println(" \" glGetError() returned the following error codes after a call to \" + caller + \": \");");
+ output.format(" return %s.glGetError();%n", getDownstreamObjectName());
+ output.println(" }");
+
+ output.println(" private void writeGLError(int err, String fmt, Object... args)");
+ output.println(" {");
+ output.println(" StringBuilder buf = new StringBuilder();");
+ output.println(" buf.append(Thread.currentThread().toString());");
+ output.println(" buf.append(\" glGetError() returned the following error codes after a call to \");");
+ output.println(" buf.append(String.format(fmt, args));");
+ output.println(" buf.append(\": \");");
output.println();
output.println(" // Loop repeatedly to allow for distributed GL implementations,");
output.println(" // as detailed in the glGetError() specification");
@@ -969,6 +989,7 @@ public class BuildComposablePipeline {
output.println(" private GLContext _context;");
}
+ @Override
protected void emitClassDocComment(PrintWriter output) {
output.println("/**");
output.println(" * <p>");
@@ -986,18 +1007,22 @@ public class BuildComposablePipeline {
output.println(" */");
}
+ @Override
protected boolean hasPreDownstreamCallHook(Method m) {
return true;
}
+ @Override
protected void preDownstreamCallHook(PrintWriter output, Method m) {
output.println(" checkContext();");
}
+ @Override
protected boolean hasPostDownstreamCallHook(Method m) {
return true;
}
+ @Override
protected void postDownstreamCallHook(PrintWriter output, Method m) {
if (m.getName().equals("glBegin")) {
output.println(" insideBeginEndPair = true;");
@@ -1007,24 +1032,39 @@ public class BuildComposablePipeline {
output.println(" insideBeginEndPair = false;");
}
- output.println(" String txt = new String(\"" + m.getName() + "(\" +");
+ output.println(" final int err = checkGLError();");
+ output.println(" if (err != GL_NO_ERROR) {");
+
+ StringBuilder fmtsb = new StringBuilder();
+ StringBuilder argsb = new StringBuilder();
+
+ fmtsb.append("\"%s(");
+ argsb.append("\"").append(m.getName()).append("\"");
Class<?>[] params = m.getParameterTypes();
- for (int i = 0; params != null && i < params.length; i++) {
- output.print(" \"<" + params[i].getName() + ">");
+ for (int i = 0; i < params.length; i++) {
+ if (i > 0) {
+ fmtsb.append(", ");
+ }
+ fmtsb.append("<").append(params[i].getName()).append(">");
if (params[i].isArray()) {
- output.print("\" +");
+ //nothing
} else if (params[i].equals(int.class)) {
- output.print(" 0x\"+Integer.toHexString(arg" + i + ").toUpperCase() +");
+ fmtsb.append(" 0x%X");
+ argsb.append(", arg").append(i);
} else {
- output.print(" \"+arg" + i + " +");
- }
- if (i < params.length - 1) {
- output.println(" \", \" +");
+ fmtsb.append(" %s");
+ argsb.append(", arg").append(i);
}
}
- output.println(" \")\");");
+ fmtsb.append(")\",");
+ argsb.append(");");
+
// calls to glGetError() are only allowed outside of glBegin/glEnd pairs
- output.println(" checkGLGetError( txt );");
+ output.print(" writeGLError(err, ");
+ output.println(fmtsb.toString());
+ output.print(" ");
+ output.println(argsb.toString());
+ output.println(" }");
}
}
} // end class DebugPipeline
@@ -1039,18 +1079,22 @@ public class BuildComposablePipeline {
className = "Trace" + getBaseInterfaceName();
}
+ @Override
protected String getOutputName() {
return className;
}
+ @Override
protected int getMode() {
return 0;
}
+ @Override
protected boolean emptyMethodAllowed() {
return false;
}
+ @Override
protected boolean emptyDownstreamAllowed() {
return false;
}
@@ -1060,6 +1104,7 @@ public class BuildComposablePipeline {
super.preMethodEmissionHook(output);
}
+ @Override
protected void constructorHook(PrintWriter output) {
output.print(" public " + getOutputName() + "(");
output.println(downstreamName + " " + getDownstreamObjectName() + ", PrintStream " + getOutputStreamName() + ")");
@@ -1110,6 +1155,7 @@ public class BuildComposablePipeline {
output.println("}");
}
+ @Override
protected void emitClassDocComment(PrintWriter output) {
output.println("/**");
output.println(" * <p>");
@@ -1127,16 +1173,18 @@ public class BuildComposablePipeline {
output.println(" */");
}
+ @Override
protected boolean hasPreDownstreamCallHook(Method m) {
return true;
}
+ @Override
protected void preDownstreamCallHook(PrintWriter output, Method m) {
if (m.getName().equals("glEnd") || m.getName().equals("glEndList")) {
- output.println("indent-=2;");
+ output.println(" indent-=2;");
output.println(" printIndent();");
} else {
- output.println("printIndent();");
+ output.println(" printIndent();");
}
output.print(" print(");
@@ -1144,10 +1192,12 @@ public class BuildComposablePipeline {
output.println(");");
}
+ @Override
protected boolean hasPostDownstreamCallHook(Method m) {
return true;
}
+ @Override
protected void postDownstreamCallHook(PrintWriter output, Method m) {
Class<?> ret = m.getReturnType();
if (ret != Void.TYPE) {
@@ -1155,6 +1205,9 @@ public class BuildComposablePipeline {
} else {
output.println(" println(\"\");");
}
+
+ if (m.getName().equals("glBegin"))
+ output.println(" indent+=2;");
}
private String getOutputStreamName() {
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java
index 5298cc3..a5a26d1 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -68,7 +68,7 @@ import java.util.regex.Pattern;
* <br>
*
* <pre>
- *
+ *
* #ifndef GL_XXXX
* GLAPI <returnType> <APIENTRY|GLAPIENTRY> glFuncName(<params>)
* #endif GL_XXXX
@@ -78,7 +78,7 @@ import java.util.regex.Pattern;
* For example, if it parses the following data:
*
* <pre>
- *
+ *
* #ifndef GL_VERSION_1_3
* GLAPI void APIENTRY glActiveTexture (GLenum);
* GLAPI void APIENTRY glMultiTexCoord1dv (GLenum, const GLdouble *);
@@ -89,7 +89,7 @@ import java.util.regex.Pattern;
* GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
* GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
* #endif
- *
+ *
* </pre>
*
* It will associate
@@ -105,7 +105,7 @@ import java.util.regex.Pattern;
* */
public class BuildStaticGLInfo {
- // Handles function pointer
+ // Handles function pointer
protected static final int funcIdentifierGroup = 9;
protected static Pattern funcPattern =
Pattern.compile("^(GLAPI|GL_API|GL_APICALL|EGLAPI|extern)?(\\s*)((unsigned|const)\\s+)?(\\w+)(\\s+\\*\\s*|\\s*\\*\\s+|\\s+)?(GLAPIENTRY|GL_APIENTRY|APIENTRY|EGLAPIENTRY|WINAPI)?(\\s*)([ew]?gl\\w+)\\s?(\\(.*)");
@@ -119,7 +119,7 @@ public class BuildStaticGLInfo {
Pattern.compile("\\#(elif|else)(.*)");
protected static Pattern endifPattern =
Pattern.compile("\\#endif(.*)");
-
+
protected static final int defineIdentifierGroup = 1;
protected static Pattern definePattern =
Pattern.compile("\\#define ([CEW]?GL[XU]?_[A-Za-z0-9_]+)\\s*([A-Za-z0-9_]+)(.*)");
@@ -203,7 +203,7 @@ public class BuildStaticGLInfo {
Matcher m = null;
int block = 0;
while ((line = reader.readLine()) != null) {
- int type = 0; // 1-define, 2-function
+ int type = 0; // 1-define, 2-function
if ( 0 < block ) { // inside a #ifndef GL_XXX block and matching a function, if block > 0
String identifier = null;
if( 2 >= block ) { // not within sub-blocks > 2, i.e. further typedefs
@@ -216,9 +216,9 @@ public class BuildStaticGLInfo {
}
}
if ( identifier != null &&
- activeAssociation != null &&
- !identifier.equals(activeAssociation) // Handles #ifndef GL_... #define GL_...
- )
+ activeAssociation != null &&
+ !identifier.equals(activeAssociation) // Handles #ifndef GL_... #define GL_...
+ )
{
addAssociation(identifier, activeAssociation);
if (DEBUG) {
@@ -243,7 +243,7 @@ public class BuildStaticGLInfo {
if (DEBUG) {
System.err.println("<"+block+"> END ASSOCIATION BLOCK: <" + activeAssociation + " <-> " + comment + ">");
}
- activeAssociation = null;
+ activeAssociation = null;
} else {
if (DEBUG) {
System.err.println("<"+block+"> END IF BLOCK: <" + comment + ">");
@@ -251,7 +251,7 @@ public class BuildStaticGLInfo {
}
}
}
- } else if ((m = associationPattern.matcher(line)).matches()) {
+ } else if ((m = associationPattern.matcher(line)).matches()) {
// found a new #ifndef GL_XXX block
activeAssociation = m.group(1).trim();
block++;
@@ -387,7 +387,7 @@ public class BuildStaticGLInfo {
declarationToExtensionMap.put(identifier, extensions);
}
extensions.add(association);
-
+
Set<String> identifiers = extensionToDeclarationMap.get(association);
if (identifiers == null) {
identifiers = new HashSet<String>();
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java
index d4dca71..f1a32fa 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003-2005 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -67,6 +67,7 @@ public class GLConfiguration extends ProcAddressConfiguration {
// Maps function names to the kind of buffer object it deals with
private Map<String, GLEmitter.BufferObjectKind> bufferObjectKinds = new HashMap<String, GLEmitter.BufferObjectKind>();
+ private Set<String> bufferObjectOnly = new HashSet<String>();
private GLEmitter emitter;
private Set<String> dropUniqVendorExtensions = new HashSet<String>();
@@ -106,6 +107,9 @@ public class GLConfiguration extends ProcAddressConfiguration {
glHeaders.add(sym);
} else if (cmd.equalsIgnoreCase("BufferObjectKind")) {
readBufferObjectKind(tok, filename, lineNo);
+ } else if (cmd.equalsIgnoreCase("BufferObjectOnly")) {
+ String sym = readString("BufferObjectOnly", tok, filename, lineNo);
+ bufferObjectOnly.add(sym);
} else if (cmd.equalsIgnoreCase("DropUniqVendorExtensions")) {
String sym = readString("DropUniqVendorExtensions", tok, filename, lineNo);
dropUniqVendorExtensions.add(sym);
@@ -127,10 +131,12 @@ public class GLConfiguration extends ProcAddressConfiguration {
kind = GLEmitter.BufferObjectKind.ARRAY;
} else if (kindString.equalsIgnoreCase("Element")) {
kind = GLEmitter.BufferObjectKind.ELEMENT;
+ } else if (kindString.equalsIgnoreCase("Indirect")) {
+ kind = GLEmitter.BufferObjectKind.INDIRECT;
} else {
throw new RuntimeException("Error parsing \"BufferObjectKind\" command at line " + lineNo
+ " in file \"" + filename + "\": illegal BufferObjectKind \""
- + kindString + "\", expected one of UnpackPixel, PackPixel, Array, or Element");
+ + kindString + "\", expected one of UnpackPixel, PackPixel, Array, Element or Indirect");
}
bufferObjectKinds.put(target, kind);
@@ -171,14 +177,16 @@ public class GLConfiguration extends ProcAddressConfiguration {
prologue = prologue + "ArrayVBO";
} else if (kind == GLEmitter.BufferObjectKind.ELEMENT) {
prologue = prologue + "ElementVBO";
+ } else if (kind == GLEmitter.BufferObjectKind.INDIRECT) {
+ prologue = prologue + "IndirectVBO";
} else {
throw new RuntimeException("Unknown BufferObjectKind " + kind);
}
if (emitter.isBufferObjectMethodBinding(binding)) {
- prologue = prologue + "Enabled";
+ prologue = prologue + "Bound";
} else {
- prologue = prologue + "Disabled";
+ prologue = prologue + "Unbound";
}
prologue = prologue + "(true);";
@@ -233,7 +241,7 @@ public class GLConfiguration extends ProcAddressConfiguration {
}
}
if( ignoredExtension ) {
- ignoredExtension = !shouldForceExtension( symbol, true, symbol );
+ ignoredExtension = !shouldForceExtension( symbol, true, symbol );
if( ignoredExtension ) {
final Set<String> origSymbols = getRenamedJavaSymbols( symbol );
if(null != origSymbols) {
@@ -243,7 +251,7 @@ public class GLConfiguration extends ProcAddressConfiguration {
break;
}
}
- }
+ }
}
}
if( ignoredExtension ) {
@@ -266,7 +274,7 @@ public class GLConfiguration extends ProcAddressConfiguration {
}
return false;
}
-
+
public boolean shouldForceExtension(final String symbol, final boolean criteria, final String renamedSymbol) {
if (criteria && glInfo != null) {
final Set<String> extensionNames = glInfo.getExtension(symbol);
@@ -284,7 +292,7 @@ public class GLConfiguration extends ProcAddressConfiguration {
}
return true;
}
- }
+ }
}
}
return false;
@@ -336,6 +344,10 @@ public class GLConfiguration extends ProcAddressConfiguration {
return (getBufferObjectKind(name) != null);
}
+ public boolean isBufferObjectOnly(String name) {
+ return bufferObjectOnly.contains(name);
+ }
+
/** Parses any GL headers specified in the configuration file for
the purpose of being able to ignore an extension at a time. */
public void parseGLHeaders(GlueEmitterControls controls) throws IOException {
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java
index 075c8bf..547382e 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003-2005 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -74,7 +74,7 @@ public class GLEmitter extends ProcAddressEmitter {
// Buffer Object variants. Used as a Set rather than a Map.
private Map<MethodBinding, MethodBinding> bufferObjectMethodBindings = new IdentityHashMap<MethodBinding, MethodBinding>();
- enum BufferObjectKind { UNPACK_PIXEL, PACK_PIXEL, ARRAY, ELEMENT}
+ enum BufferObjectKind { UNPACK_PIXEL, PACK_PIXEL, ARRAY, ELEMENT, INDIRECT}
@Override
public void beginEmission(GlueEmitterControls controls) throws IOException {
@@ -125,7 +125,7 @@ public class GLEmitter extends ProcAddressEmitter {
}
if(JavaConfiguration.DEBUG_RENAMES) {
System.err.println("RenameExtensionIntoCore: "+extension+" END>");
- }
+ }
}
}
@@ -134,6 +134,7 @@ public class GLEmitter extends ProcAddressEmitter {
private List<ConstantDefinition> constants;
private List<FunctionSymbol> functions;
+ @Override
public void filterSymbols(List<ConstantDefinition> constants,
List<FunctionSymbol> functions) {
this.constants = constants;
@@ -141,10 +142,12 @@ public class GLEmitter extends ProcAddressEmitter {
doWork();
}
+ @Override
public List<ConstantDefinition> getConstants() {
return constants;
}
+ @Override
public List<FunctionSymbol> getFunctions() {
return functions;
}
@@ -262,18 +265,23 @@ public class GLEmitter extends ProcAddressEmitter {
case (though we default to true currently). */
@Override
protected List<MethodBinding> expandMethodBinding(MethodBinding binding) {
- List<MethodBinding> bindings = super.expandMethodBinding(binding);
+ final GLConfiguration glConfig = getGLConfig();
+ final List<MethodBinding> bindings = super.expandMethodBinding(binding);
- if (!getGLConfig().isBufferObjectFunction(binding.getName())) {
+ if ( !glConfig.isBufferObjectFunction(binding.getName()) ) {
return bindings;
}
+ final boolean bufferObjectOnly = glConfig.isBufferObjectOnly(binding.getName());
- List<MethodBinding> newBindings = new ArrayList<MethodBinding>(bindings);
+ final List<MethodBinding> newBindings = new ArrayList<MethodBinding>();
// Need to expand each one of the generated bindings to take a
// Java long instead of a Buffer for each void* argument
- for (MethodBinding cur : bindings) {
+ // for (MethodBinding cur : bindings) {
+ int j=0;
+ while( j < bindings.size() ) {
+ final MethodBinding cur = bindings.get(j);
// Some of these routines (glBitmap) take strongly-typed
// primitive pointers as arguments which are expanded into
@@ -281,6 +289,7 @@ public class GLEmitter extends ProcAddressEmitter {
// This test (rather than !signatureUsesNIO) is used to catch
// more unexpected situations
if (cur.signatureUsesJavaPrimitiveArrays()) {
+ j++;
continue;
}
@@ -300,9 +309,16 @@ public class GLEmitter extends ProcAddressEmitter {
// Now need to flag this MethodBinding so that we generate the
// correct flags in the emitters later
bufferObjectMethodBindings.put(result, result);
+
+ if( bufferObjectOnly ) {
+ bindings.remove(j);
+ } else {
+ j++;
+ }
}
+ bindings.addAll(newBindings);
- return newBindings;
+ return bindings;
}
@Override
@@ -384,7 +400,7 @@ public class GLEmitter extends ProcAddressEmitter {
}
private int addExtensionListOfAliasedSymbols2Buffer(BuildStaticGLInfo glInfo, StringBuilder buf, String sep1, String sep2, String name, Collection<String> exclude) {
int num = 0;
- if(null != name) {
+ if(null != name) {
num += addExtensionListOfSymbol2Buffer(glInfo, buf, sep1, name); // extensions of given name
boolean needsSep2 = 0<num;
Set<String> origNames = cfg.getRenamedJavaSymbols(name);
@@ -393,7 +409,7 @@ public class GLEmitter extends ProcAddressEmitter {
if(!exclude.contains(origName)) {
if (needsSep2) {
buf.append(sep2); // diff-name seperator
- }
+ }
int num2 = addExtensionListOfSymbol2Buffer(glInfo, buf, sep1, origName); // extensions of orig-name
needsSep2 = num<num2;
num += num2;
@@ -403,7 +419,7 @@ public class GLEmitter extends ProcAddressEmitter {
}
return num;
}
-
+
public int addExtensionsOfSymbols2Buffer(StringBuilder buf, String sep1, String sep2, String first, Collection<String> col) {
BuildStaticGLInfo glInfo = getGLConfig().getGLInfo();
if (null == glInfo) {
@@ -456,16 +472,16 @@ public class GLEmitter extends ProcAddressEmitter {
/**
* {@inheritDoc}
- */
+ */
@Override
protected void endProcAddressTable() throws Exception {
PrintWriter w = tableWriter;
-
+
w.println(" @Override");
w.println(" protected boolean isFunctionAvailableImpl(String functionNameUsr) throws IllegalArgumentException {");
w.println(" final String functionNameBase = "+GLNameResolver.class.getName()+".normalizeVEN(com.jogamp.gluegen.runtime.opengl.GLNameResolver.normalizeARB(functionNameUsr, true), true);");
w.println(" final String addressFieldNameBase = \"" + PROCADDRESS_VAR_PREFIX + "\" + functionNameBase;");
- w.println(" final int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);");
+ w.println(" final int funcNamePermNum = "+GLNameResolver.class.getName()+".getFuncNamePermutationNumber(functionNameBase);");
w.println(" final java.lang.reflect.Field addressField = java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<java.lang.reflect.Field>() {");
w.println(" public final java.lang.reflect.Field run() {");
w.println(" java.lang.reflect.Field addressField = null;");
@@ -497,7 +513,7 @@ public class GLEmitter extends ProcAddressEmitter {
w.println(" \"function\", e);");
w.println(" }");
w.println(" }");
-
+
w.println(" @Override");
w.println(" public long getAddressFor(String functionNameUsr) throws SecurityException, IllegalArgumentException {");
w.println(" SecurityUtil.checkAllLinkPermission();");
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java
index fdfaee8..389d35f 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003-2005 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -111,7 +111,7 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit
writer.print("<code> ");
writer.print(funcSym.getType().toString(symbolRenamed, tagNativeBinding));
writer.print(" </code> ");
-
+
newComment.append("<br>Part of ");
if (0 == glEmitter.addExtensionsOfSymbols2Buffer(newComment, ", ", "; ", symbolRenamed, binding.getAliasedNames())) {
if (glEmitter.getGLConfig().getAllowNonGLExtensions()) {
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/ant/StaticGLGenTask.java b/src/jogl/classes/com/jogamp/gluegen/opengl/ant/StaticGLGenTask.java
index e3e7cb9..21946ea 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/ant/StaticGLGenTask.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/ant/StaticGLGenTask.java
@@ -55,13 +55,13 @@ import org.apache.tools.ant.util.JavaEnvUtils;
/**
* <p>An <a href="http://ant.apache.org">ANT</a> {@link org.apache.tools.ant.Task}
* for using {@link com.jogamp.gluegen.opengl.BuildStaticGLInfo}.</p>
- *
+ *
* <p>Usage:</p>
* <pre>
- <staticglgen package="[generated files package]"
+ <staticglgen package="[generated files package]"
headers="[file pattern of GL headers]"
outputdir="[directory to output the generated files]" />
- * </pre>
+ * </pre>
*
* @author Rob Grzywinski <a href="mailto:rgrzywinski at realityinteractive.com">rgrzywinski at yahoo.com</a>
*/
@@ -72,7 +72,7 @@ public class StaticGLGenTask extends Task
* <p>The {@link com.jogamp.gluegen.opengl.BuildStaticGLInfo} classname.</p>
*/
private static final String GL_GEN = "com.jogamp.gluegen.opengl.BuildStaticGLInfo";
-
+
// =========================================================================
/**
* <p>The {@link org.apache.tools.ant.types.CommandlineJava} that is used
@@ -90,12 +90,12 @@ public class StaticGLGenTask extends Task
* <p>The output directory.</p>
*/
private String outputDirectory;
-
+
/**
* <p>The {@link org.apache.tools.ant.types.FileSet} of GL headers.</p>
*/
private FileSet headerSet = new FileSet();
-
+
// =========================================================================
/**
* <p>Create and add the VM and classname to {@link org.apache.tools.ant.types.CommandlineJava}.</p>
@@ -104,7 +104,7 @@ public class StaticGLGenTask extends Task
{
// create the CommandlineJava that will be used to call BuildStaticGLInfo
glgenCommandline = new CommandlineJava();
-
+
// set the VM and classname in the commandline
glgenCommandline.setVm(JavaEnvUtils.getJreExecutable("java"));
glgenCommandline.setClassname(GL_GEN);
@@ -114,7 +114,7 @@ public class StaticGLGenTask extends Task
// ANT getters and setters
/**
* <p>Set the package name for the generated files. This is called by ANT.</p>
- *
+ *
* @param packageName the name of the package for the generated files
*/
public void setPackage(String packageName)
@@ -125,12 +125,12 @@ public class StaticGLGenTask extends Task
/**
* <p>Set the output directory. This is called by ANT.</p>
- *
+ *
* @param directory the output directory
*/
public void setOutputDir(String directory)
{
- log( ("Setting output directory to: " + directory),
+ log( ("Setting output directory to: " + directory),
Project.MSG_VERBOSE);
this.outputDirectory = directory;
}
@@ -138,7 +138,7 @@ public class StaticGLGenTask extends Task
/**
* <p>Add a header file to the list. This is called by ANT for a nested
* element.</p>
- *
+ *
* @return {@link org.apache.tools.ant.types.PatternSet.NameEntry}
*/
public PatternSet.NameEntry createHeader()
@@ -149,7 +149,7 @@ public class StaticGLGenTask extends Task
/**
* <p>Add a header file to the list. This is called by ANT for a nested
* element.</p>
- *
+ *
* @return {@link org.apache.tools.ant.types.PatternSet.NameEntry}
*/
public PatternSet.NameEntry createHeadersFile()
@@ -171,7 +171,7 @@ public class StaticGLGenTask extends Task
/**
* <p>Add an optional classpath that defines the location of {@link com.jogamp.gluegen.opengl.BuildStaticGLInfo}
* and <code>BuildStaticGLInfo</code>'s dependencies.</p>
- *
+ *
* @returns {@link org.apache.tools.ant.types.Path}
*/
public Path createClasspath()
@@ -183,23 +183,24 @@ public class StaticGLGenTask extends Task
/**
* <p>Run the task. This involves validating the set attributes, creating
* the command line to be executed and finally executing the command.</p>
- *
+ *
* @see org.apache.tools.ant.Task#execute()
*/
- public void execute()
- throws BuildException
+ @Override
+ public void execute()
+ throws BuildException
{
// validate that all of the required attributes have been set
validateAttributes();
-
+
// TODO: add logic to determine if the generated file needs to be
// regenerated
-
+
// add the attributes to the CommandlineJava
addAttributes();
log(glgenCommandline.describeCommand(), Project.MSG_VERBOSE);
-
+
// execute the command and throw on error
final int error = execute(glgenCommandline.getCommandline());
if(error == 1)
@@ -208,11 +209,11 @@ public class StaticGLGenTask extends Task
/**
* <p>Ensure that the user specified all required arguments.</p>
- *
- * @throws BuildException if there are required arguments that are not
+ *
+ * @throws BuildException if there are required arguments that are not
* present or not valid
*/
- private void validateAttributes()
+ private void validateAttributes()
throws BuildException
{
// validate that the package name is set
@@ -223,29 +224,29 @@ public class StaticGLGenTask extends Task
// TODO: switch to file and ensure that it exists
if(!isValid(outputDirectory))
throw new BuildException("Invalid output directory name: " + outputDirectory);
-
+
// TODO: validate that there are headers set
}
/**
* <p>Is the specified string valid? A valid string is non-<code>null</code>
* and has a non-zero length.</p>
- *
+ *
* @param string the string to be tested for validity
* @return <code>true</code> if the string is valid. <code>false</code>
- * otherwise.
+ * otherwise.
*/
private boolean isValid(String string)
{
// check for null
if(string == null)
return false;
-
+
// ensure that the string has a non-zero length
// NOTE: must trim() to remove leading and trailing whitespace
if(string.trim().length() < 1)
return false;
-
+
// the string is valid
return true;
}
@@ -258,10 +259,10 @@ public class StaticGLGenTask extends Task
{
// add the package name
glgenCommandline.createArgument().setValue(packageName);
-
+
// add the output directory name
glgenCommandline.createArgument().setValue(outputDirectory);
-
+
// add the header -files- from the FileSet
headerSet.setDir(getProject().getBaseDir());
DirectoryScanner directoryScanner = headerSet.getDirectoryScanner(getProject());
@@ -272,25 +273,25 @@ public class StaticGLGenTask extends Task
}
}
- /**
- * <p>Execute {@link com.jogamp.gluegen.opengl.BuildStaticGLInfo} in a
+ /**
+ * <p>Execute {@link com.jogamp.gluegen.opengl.BuildStaticGLInfo} in a
* forked JVM.</p>
- *
+ *
* @throws BuildException
*/
- private int execute(String[] command)
+ private int execute(String[] command)
throws BuildException
{
// create the object that will perform the command execution
Execute execute = new Execute(new LogStreamHandler(this, Project.MSG_INFO,
- Project.MSG_WARN),
+ Project.MSG_WARN),
null);
-
+
// set the project and command line
execute.setAntRun(project);
execute.setCommandline(command);
execute.setWorkingDirectory( project.getBaseDir() );
-
+
// execute the command
try
{
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java
index adb1c2a..4ac9ae3 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureEmitter.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2006 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -55,8 +55,8 @@ import java.util.Set;
/**
* Emitter producing NativeSignature attributes.
- *
- * Review: This Package/Class is not used and subject to be deleted.
+ *
+ * Review: This Package/Class is not used and subject to be deleted.
*/
public class NativeSignatureEmitter extends GLEmitter {
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java
index e98478b..6d9d6f2 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2006 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -131,6 +131,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding
}
}
+ @Override
protected String getReturnTypeString(boolean skipArray) {
if (isForImplementingMethodCall()) {
JavaType returnType = getBinding().getJavaReturnType();
@@ -142,6 +143,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding
return super.getReturnTypeString(skipArray);
}
+ @Override
protected void emitPreCallSetup(MethodBinding binding, PrintWriter writer) {
super.emitPreCallSetup(binding, writer);
for (int i = 0; i < binding.getNumArguments(); i++) {
@@ -162,6 +164,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding
return "__buffer_array_" + argNumber;
}
+ @Override
protected int emitArguments(PrintWriter writer)
{
boolean needComma = false;
@@ -182,14 +185,14 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding
// Always emit outgoing "this" argument
writer.print("long ");
- writer.print(javaThisArgumentName());
+ writer.print(javaThisArgumentName());
++numEmitted;
needComma = true;
}
for (int i = 0; i < binding.getNumArguments(); i++) {
JavaType type = binding.getJavaArgumentType(i);
- if (type.isVoid()) {
+ if (type.isVoid()) {
// Make sure this is the only param to the method; if it isn't,
// there's something wrong with our parsing of the headers.
if (binding.getNumArguments() != 1) {
@@ -198,7 +201,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding
"multi-argument function \"" + binding + "\"");
}
continue;
- }
+ }
if (type.isJNIEnv() || binding.isArgumentThisPointer(i)) {
// Don't need to expose these at the Java level
@@ -229,7 +232,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding
if (type.isNIOBuffer()) {
writer.print(", int " + byteOffsetArgName(i));
} else if (type.isNIOBufferArray()) {
- writer.print(", int[] " +
+ writer.print(", int[] " +
byteOffsetArrayArgName(i));
}
}
@@ -242,11 +245,12 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding
return numEmitted;
}
+ @Override
protected void emitReturnVariableSetupAndCall(MethodBinding binding, PrintWriter writer) {
writer.print(" ");
JavaType returnType = binding.getJavaReturnType();
boolean needsResultAssignment = false;
-
+
if (!returnType.isVoid()) {
if (returnType.isCompoundTypeWrapper() ||
returnType.isNIOByteBuffer()) {
@@ -375,7 +379,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding
// there's something wrong with our parsing of the headers.
assert(binding.getNumArguments() == 1);
continue;
- }
+ }
if (needComma) {
writer.print(", ");
@@ -455,6 +459,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding
return numArgsEmitted;
}
+ @Override
protected void emitCallResultReturn(MethodBinding binding, PrintWriter writer) {
for (int i = 0; i < binding.getNumArguments(); i++) {
JavaType type = binding.getJavaArgumentType(i);
@@ -468,6 +473,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding
super.emitCallResultReturn(binding, writer);
}
+ @Override
public String getName() {
String res = super.getName();
if (forImplementingMethodCall && bufferObjectVariant) {
diff --git a/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLNameResolver.java b/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLNameResolver.java
index 9255477..9b57a2f 100644
--- a/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLNameResolver.java
+++ b/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLNameResolver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003-2005 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
@@ -29,11 +29,11 @@
* 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.
- *
+ *
*/
package com.jogamp.gluegen.runtime.opengl;
@@ -43,12 +43,12 @@ public class GLNameResolver {
//GL_XYZ : GL_XYZ, GL_GL2_XYZ, GL_ARB_XYZ, GL_OES_XYZ, GL_OML_XYZ
//
// Pass-1 Unify ARB extensions with the same value
- // Pass-2 Unify vendor extensions,
+ // Pass-2 Unify vendor extensions,
// if exist as an ARB extension with the same value.
// Pass-3 Emit
public static final String[] extensionsARB = { "ARB", "GL2", "OES", "KHR", "OML" };
- public static final String[] extensionsVEN = { "3DFX",
+ public static final String[] extensionsVEN = { "3DFX",
"AMD",
"ANGLE",
"ARM",
@@ -158,7 +158,7 @@ public class GLNameResolver {
return str;
}
public static final boolean isExtension(String str, boolean isGLFunc) {
- return isExtension(extensionsARB, str, isGLFunc) ||
+ return isExtension(extensionsARB, str, isGLFunc) ||
isExtension(extensionsVEN, str, isGLFunc);
}
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 9775de4..3fb315c 100644
--- a/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java
+++ b/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.
*/
-
+
/*
* Created on Saturday, April 24 2010 16:44
*/
@@ -42,6 +42,7 @@ public class GLProcAddressResolver implements FunctionAddressResolver {
public static final boolean DEBUG = false;
+ @Override
public long resolve(String name, DynamicLookupHelper lookup) {
long newProcAddress = 0;
diff --git a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
index a374978..226e57f 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java
@@ -42,13 +42,13 @@ import com.jogamp.opengl.math.geom.AABBox;
/** A Generic shape objects which is defined by a list of Outlines.
* This Shape can be transformed to Triangulations.
* The list of triangles generated are render-able by a Region object.
- * The triangulation produced by this Shape will define the
+ * The triangulation produced by this Shape will define the
* closed region defined by the outlines.
- *
+ *
* One or more OutlineShape Object can be associated to a region
* this is left as a high-level representation of the Objects. For
* optimizations, flexibility requirements for future features.
- *
+ *
* <br><br>
* Example to creating an Outline Shape:
* <pre>
@@ -60,18 +60,18 @@ import com.jogamp.opengl.math.geom.AABBox;
addVertex(...)
addVertex(...)
* </pre>
- *
- * The above will create two outlines each with three vertices. By adding these two outlines to
+ *
+ * The above will create two outlines each with three vertices. By adding these two outlines to
* the OutlineShape, we are stating that the combination of the two outlines represent the shape.
* <br>
- *
- * To specify that the shape is curved at a region, the on-curve flag should be set to false
+ *
+ * To specify that the shape is curved at a region, the on-curve flag should be set to false
* for the vertex that is in the middle of the curved region (if the curved region is defined by 3
* vertices (quadratic curve).
* <br>
- * In case the curved region is defined by 4 or more vertices the middle vertices should both have
+ * In case the curved region is defined by 4 or more vertices the middle vertices should both have
* the on-curve flag set to false.
- *
+ *
* <br>Example: <br>
* <pre>
addVertex(0,0, true);
@@ -79,16 +79,16 @@ import com.jogamp.opengl.math.geom.AABBox;
addVertex(1,1, false);
addVertex(1,0, true);
* </pre>
- *
- * The above snippet defines a cubic nurbs curve where (0,1 and 1,1)
+ *
+ * The above snippet defines a cubic nurbs curve where (0,1 and 1,1)
* do not belong to the final rendered shape.
- *
+ *
* <i>Implementation Notes:</i><br>
* <ul>
* <li> The first vertex of any outline belonging to the shape should be on-curve</li>
* <li> Intersections between off-curved parts of the outline is not handled</li>
* </ul>
- *
+ *
* @see Outline
* @see Region
*/
@@ -104,21 +104,21 @@ public class OutlineShape implements Comparable<OutlineShape> {
VerticesState(int state){
this.state = state;
}
- }
+ }
public static final int DIRTY_BOUNDS = 1 << 0;
private final Vertex.Factory<? extends Vertex> vertexFactory;
private VerticesState outlineState;
- /** The list of {@link Outline}s that are part of this
+ /** The list of {@link Outline}s that are part of this
* outline shape.
*/
private ArrayList<Outline> outlines;
private AABBox bbox;
/** dirty bits DIRTY_BOUNDS */
- private int dirtyBits;
+ private int dirtyBits;
/** Create a new Outline based Shape
*/
@@ -128,7 +128,7 @@ public class OutlineShape implements Comparable<OutlineShape> {
this.outlines.add(new Outline());
this.outlineState = VerticesState.UNDEFINED;
this.bbox = new AABBox();
- this.dirtyBits = 0;
+ this.dirtyBits = 0;
}
/** Clears all data and reset all states as if this instance was newly created */
@@ -137,7 +137,7 @@ public class OutlineShape implements Comparable<OutlineShape> {
outlines.add(new Outline());
outlineState = VerticesState.UNDEFINED;
bbox.reset();
- dirtyBits = 0;
+ dirtyBits = 0;
}
/** Returns the associated vertex factory of this outline shape
@@ -149,10 +149,10 @@ public class OutlineShape implements Comparable<OutlineShape> {
return outlines.size();
}
- /** Add a new empty {@link Outline}
+ /** Add a new empty {@link Outline}
* to the end of this shape's outline list.
* <p>If the {@link #getLastOutline()} is empty already, no new one will be added.</p>
- *
+ *
* After a call to this function all new vertices added
* will belong to the new outline
*/
@@ -164,26 +164,26 @@ public class OutlineShape implements Comparable<OutlineShape> {
/** Appends the {@link Outline} element to the end,
* ensuring a clean tail.
- *
+ *
* <p>A clean tail is ensured, no double empty Outlines are produced
* and a pre-existing empty outline will be replaced with the given one. </p>
- *
+ *
* @param outline Outline object to be added
- * @throws NullPointerException if the {@link Outline} element is null
+ * @throws NullPointerException if the {@link Outline} element is null
*/
public void addOutline(Outline outline) throws NullPointerException {
addOutline(outlines.size(), outline);
}
/** Insert the {@link Outline} element at the given {@code position}.
- *
+ *
* <p>If the {@code position} indicates the end of this list,
* a clean tail is ensured, no double empty Outlines are produced
* and a pre-existing empty outline will be replaced with the given one. </p>
- *
+ *
* @param position of the added Outline
* @param outline Outline object to be added
- * @throws NullPointerException if the {@link Outline} element is null
+ * @throws NullPointerException if the {@link Outline} element is null
* @throws IndexOutOfBoundsException if position is out of range (position < 0 || position > getOutlineNumber())
*/
public void addOutline(int position, Outline outline) throws NullPointerException, IndexOutOfBoundsException {
@@ -213,7 +213,7 @@ public class OutlineShape implements Comparable<OutlineShape> {
* using {@link #addOutline(Outline)} for each element.
* <p>Closes the current last outline via {@link #closeLastOutline()} before adding the new ones.</p>
* @param outlineShape OutlineShape elements to be added.
- * @throws NullPointerException if the {@link OutlineShape} is null
+ * @throws NullPointerException if the {@link OutlineShape} is null
* @throws IndexOutOfBoundsException if position is out of range (position < 0 || position > getOutlineNumber())
*/
public void addOutlineShape(OutlineShape outlineShape) throws NullPointerException {
@@ -228,10 +228,10 @@ public class OutlineShape implements Comparable<OutlineShape> {
/** Replaces the {@link Outline} element at the given {@code position}.
* <p>Sets the bounding box dirty, hence a next call to {@link #getBounds()} will validate it.</p>
- *
+ *
* @param position of the replaced Outline
- * @param outline replacement Outline object
- * @throws NullPointerException if the {@link Outline} element is null
+ * @param outline replacement Outline object
+ * @throws NullPointerException if the {@link Outline} element is null
* @throws IndexOutOfBoundsException if position is out of range (position < 0 || position >= getOutlineNumber())
*/
public void setOutline(int position, Outline outline) throws NullPointerException, IndexOutOfBoundsException {
@@ -244,7 +244,7 @@ public class OutlineShape implements Comparable<OutlineShape> {
/** Removes the {@link Outline} element at the given {@code position}.
* <p>Sets the bounding box dirty, hence a next call to {@link #getBounds()} will validate it.</p>
- *
+ *
* @param position of the to be removed Outline
* @throws IndexOutOfBoundsException if position is out of range (position < 0 || position >= getOutlineNumber())
*/
@@ -261,15 +261,15 @@ public class OutlineShape implements Comparable<OutlineShape> {
return outlines.get(outlines.size()-1);
}
- /** @return the {@code Outline} at {@code position}
+ /** @return the {@code Outline} at {@code position}
* @throws IndexOutOfBoundsException if position is out of range (position < 0 || position >= getOutlineNumber())
*/
public Outline getOutline(int position) throws IndexOutOfBoundsException {
return outlines.get(position);
- }
+ }
/** Adds a vertex to the last open outline in the
- * shape.
+ * shape.
* @param v the vertex to be added to the OutlineShape
*/
public final void addVertex(Vertex v) {
@@ -280,9 +280,9 @@ public class OutlineShape implements Comparable<OutlineShape> {
}
}
- /** Adds a vertex to the last open outline in the shape.
- * at {@code position}
- * @param position indx at which the vertex will be added
+ /** Adds a vertex to the last open outline in the shape.
+ * at {@code position}
+ * @param position indx at which the vertex will be added
* @param v the vertex to be added to the OutlineShape
*/
public final void addVertex(int position, Vertex v) {
@@ -295,7 +295,7 @@ public class OutlineShape implements Comparable<OutlineShape> {
/** Add a 2D {@link Vertex} to the last outline by defining the coordniate attribute
* of the vertex. The 2D vertex will be represented as Z=0.
- *
+ *
* @param x the x coordinate
* @param y the y coordniate
* @param onCurve flag if this vertex is on the final curve or defines a curved region
@@ -317,10 +317,10 @@ public class OutlineShape implements Comparable<OutlineShape> {
addVertex(vertexFactory.create(x, y, z, onCurve));
}
- /** Add a vertex to the last outline by passing a float array and specifying the
- * offset and length in which. The attributes of the vertex are located.
+ /** Add a vertex to the last outline by passing a float array and specifying the
+ * offset and length in which. The attributes of the vertex are located.
* The attributes should be continuous (stride = 0).
- * Attributes which value are not set (when length less than 3)
+ * Attributes which value are not set (when length less than 3)
* are set implicitly to zero.
* @param coordsBuffer the coordinate array where the vertex attributes are to be picked from
* @param offset the offset in the buffer to the x coordinate
@@ -330,11 +330,11 @@ public class OutlineShape implements Comparable<OutlineShape> {
*/
public final void addVertex(float[] coordsBuffer, int offset, int length, boolean onCurve) {
addVertex(vertexFactory.create(coordsBuffer, offset, length, onCurve));
- }
+ }
/** Closes the last outline in the shape.
* <p>If last vertex is not equal to first vertex.
- * A new temp vertex is added at the end which
+ * A new temp vertex is added at the end which
* is equal to the first.</p>
*/
public void closeLastOutline() {
@@ -351,7 +351,7 @@ public class OutlineShape implements Comparable<OutlineShape> {
/** Ensure the outlines represent
* the specified destinationType.
* and removes all overlaps in boundary triangles
- * @param destinationType the target outline's vertices state. Currently only
+ * @param destinationType the target outline's vertices state. Currently only
* {@link OutlineShape.VerticesState#QUADRATIC_NURBS} are supported.
*/
public void transformOutlines(VerticesState destinationType) {
@@ -371,7 +371,7 @@ public class OutlineShape implements Comparable<OutlineShape> {
float[] v2 = VectorUtil.mid(v1, v3);
//drop off-curve vertex to image on the curve
- b.setCoord(v2, 0, 3);
+ b.setCoord(v2, 0, 3);
b.setOnCurve(true);
outline.addVertex(index, vertexFactory.create(v1, 0, 3, false));
@@ -379,19 +379,19 @@ public class OutlineShape implements Comparable<OutlineShape> {
}
/** Check overlaps between curved triangles
- * first check if any vertex in triangle a is in triangle b
+ * first check if any vertex in triangle a is in triangle b
* second check if edges of triangle a intersect segments of triangle b
* if any of the two tests is true we divide current triangle
* and add the other to the list of overlaps
- *
+ *
* Loop until overlap array is empty. (check only in first pass)
*/
- private void checkOverlaps() {
+ private void checkOverlaps() {
ArrayList<Vertex> overlaps = new ArrayList<Vertex>(3);
int count = getOutlineNumber();
boolean firstpass = true;
do {
- for (int cc = 0; cc < count; cc++) {
+ for (int cc = 0; cc < count; cc++) {
final Outline outline = getOutline(cc);
int vertexCount = outline.getVertexCount();
for(int i=0; i < outline.getVertexCount(); i++) {
@@ -429,7 +429,7 @@ public class OutlineShape implements Comparable<OutlineShape> {
private Vertex checkTriOverlaps(Vertex a, Vertex b, Vertex c) {
int count = getOutlineNumber();
- for (int cc = 0; cc < count; cc++) {
+ for (int cc = 0; cc < count; cc++) {
final Outline outline = getOutline(cc);
int vertexCount = outline.getVertexCount();
for(int i=0; i < vertexCount; i++) {
@@ -451,7 +451,7 @@ public class OutlineShape implements Comparable<OutlineShape> {
return current;
}
- if(VectorUtil.tri2SegIntersection(a, b, c, prevV, current)
+ if(VectorUtil.tri2SegIntersection(a, b, c, prevV, current)
|| VectorUtil.tri2SegIntersection(a, b, c, current, nextV)
|| VectorUtil.tri2SegIntersection(a, b, c, prevV, nextV)) {
return current;
@@ -463,7 +463,7 @@ public class OutlineShape implements Comparable<OutlineShape> {
private void transformOutlines2Quadratic() {
int count = getOutlineNumber();
- for (int cc = 0; cc < count; cc++) {
+ for (int cc = 0; cc < count; cc++) {
final Outline outline = getOutline(cc);
int vertexCount = outline.getVertexCount();
@@ -471,13 +471,13 @@ public class OutlineShape implements Comparable<OutlineShape> {
final Vertex currentVertex = outline.getVertex(i);
final Vertex nextVertex = outline.getVertex((i+1)%vertexCount);
if ( !currentVertex.isOnCurve() && !nextVertex.isOnCurve() ) {
- final float[] newCoords = VectorUtil.mid(currentVertex.getCoord(),
+ final float[] newCoords = VectorUtil.mid(currentVertex.getCoord(),
nextVertex.getCoord());
final Vertex v = vertexFactory.create(newCoords, 0, 3, true);
i++;
vertexCount++;
outline.addVertex(i, v);
- }
+ }
}
if(vertexCount <= 0) {
outlines.remove(outline);
@@ -487,7 +487,7 @@ public class OutlineShape implements Comparable<OutlineShape> {
}
if( vertexCount > 0 ) {
- if(VectorUtil.checkEquality(outline.getVertex(0).getCoord(),
+ if(VectorUtil.checkEquality(outline.getVertex(0).getCoord(),
outline.getLastVertex().getCoord())) {
outline.removeVertex(vertexCount-1);
}
@@ -508,7 +508,7 @@ public class OutlineShape implements Comparable<OutlineShape> {
}
}
- /** @return the list of concatenated vertices associated with all
+ /** @return the list of concatenated vertices associated with all
* {@code Outline}s of this object
*/
public ArrayList<Vertex> getVertices() {
@@ -551,9 +551,10 @@ public class OutlineShape implements Comparable<OutlineShape> {
}
/** Compare two outline shapes with Bounding Box area
- * as criteria.
+ * as criteria.
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
+ @Override
public final int compareTo(OutlineShape outline) {
float size = getBounds().getSize();
float newSize = outline.getBounds().getSize();
@@ -579,20 +580,21 @@ public class OutlineShape implements Comparable<OutlineShape> {
validateBoundingBox();
}
return bbox;
- }
+ }
/**
* @param obj the Object to compare this OutlineShape with
- * @return true if {@code obj} is an OutlineShape, not null,
- * same outlineState, equal bounds and equal outlines in the same order
+ * @return true if {@code obj} is an OutlineShape, not null,
+ * same outlineState, equal bounds and equal outlines in the same order
*/
+ @Override
public boolean equals(Object obj) {
if( obj == this) {
return true;
}
if( null == obj || !(obj instanceof OutlineShape) ) {
return false;
- }
+ }
final OutlineShape o = (OutlineShape) obj;
if(getOutlineState() != o.getOutlineState()) {
return false;
@@ -610,20 +612,4 @@ public class OutlineShape implements Comparable<OutlineShape> {
}
return true;
}
-
- /**
- * @return deep clone of this OutlineShape w/o Region
- */
- public OutlineShape clone() {
- OutlineShape o;
- try {
- o = (OutlineShape) super.clone();
- } catch (CloneNotSupportedException e) { throw new InternalError(); }
- o.bbox = bbox.clone();
- o.outlines = new ArrayList<Outline>(outlines.size());
- for(int i=0; i<outlines.size(); i++) {
- o.outlines.add(outlines.get(i).clone());
- }
- return o;
- }
}
diff --git a/src/jogl/classes/com/jogamp/graph/curve/Region.java b/src/jogl/classes/com/jogamp/graph/curve/Region.java
index 8b6d000..a977952 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/Region.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/Region.java
@@ -38,48 +38,48 @@ import com.jogamp.opengl.math.geom.AABBox;
/** Abstract Outline shape GL representation
* define the method an OutlineShape(s) is
* binded rendered.
- *
+ *
* @see GLRegion
*/
public abstract class Region {
-
+
/** Debug flag for region impl (graph.curve)
*/
public static final boolean DEBUG = Debug.debug("graph.curve");
-
+
public static final boolean DEBUG_INSTANCE = false;
- /** View based Anti-Aliasing, A Two pass region rendering, slower
- * and more resource hungry (FBO), but AA is perfect.
- * Otherwise the default fast one pass MSAA region rendering is being used.
+ /** View based Anti-Aliasing, A Two pass region rendering, slower
+ * and more resource hungry (FBO), but AA is perfect.
+ * Otherwise the default fast one pass MSAA region rendering is being used.
*/
public static final int VBAA_RENDERING_BIT = 1 << 0;
/** Use non uniform weights [0.0 .. 1.9] for curve region rendering.
- * Otherwise the default weight 1.0 for uniform curve region rendering is being applied.
+ * Otherwise the default weight 1.0 for uniform curve region rendering is being applied.
*/
public static final int VARIABLE_CURVE_WEIGHT_BIT = 1 << 1;
public static final int TWO_PASS_DEFAULT_TEXTURE_UNIT = 0;
private final int renderModes;
- private boolean dirty = true;
- protected int numVertices = 0;
+ private boolean dirty = true;
+ protected int numVertices = 0;
protected final AABBox box = new AABBox();
protected ArrayList<Triangle> triangles = new ArrayList<Triangle>();
protected ArrayList<Vertex> vertices = new ArrayList<Vertex>();
- public static boolean isVBAA(int renderModes) {
- return 0 != ( renderModes & Region.VBAA_RENDERING_BIT );
+ public static boolean isVBAA(int renderModes) {
+ return 0 != ( renderModes & Region.VBAA_RENDERING_BIT );
}
/** Check if render mode capable of non uniform weights
- * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT},
- * {@link Region#VBAA_RENDERING_BIT}
+ * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT},
+ * {@link Region#VBAA_RENDERING_BIT}
* @return true of capable of non uniform weights
*/
- public static boolean isNonUniformWeight(int renderModes) {
- return 0 != ( renderModes & Region.VARIABLE_CURVE_WEIGHT_BIT );
+ public static boolean isNonUniformWeight(int renderModes) {
+ return 0 != ( renderModes & Region.VARIABLE_CURVE_WEIGHT_BIT );
}
protected Region(int regionRenderModes) {
@@ -87,28 +87,28 @@ public abstract class Region {
}
/** Get current Models
- * @return bit-field of render modes
+ * @return bit-field of render modes
*/
- public final int getRenderModes() {
- return renderModes;
+ public final int getRenderModes() {
+ return renderModes;
}
/** Check if current Region is using VBAA
* @return true if capable of two pass rendering - VBAA
*/
- public boolean isVBAA() {
- return Region.isVBAA(renderModes);
+ public boolean isVBAA() {
+ return Region.isVBAA(renderModes);
}
- /** Check if current instance uses non uniform weights
+ /** Check if current instance uses non uniform weights
* @return true if capable of nonuniform weights
*/
- public boolean isNonUniformWeight() {
- return Region.isNonUniformWeight(renderModes);
+ public boolean isNonUniformWeight() {
+ return Region.isNonUniformWeight(renderModes);
}
/** Get the current number of vertices associated
- * with this region. This number is not necessary equal to
+ * with this region. This number is not necessary equal to
* the OGL bound number of vertices.
* @return vertices count
*/
@@ -117,10 +117,10 @@ public abstract class Region {
}
/** Adds a {@link Triangle} object to the Region
- * This triangle will be bound to OGL objects
+ * This triangle will be bound to OGL objects
* on the next call to {@code update}
* @param tri a triangle object
- *
+ *
* @see update(GL2ES2)
*/
public void addTriangle(Triangle tri) {
@@ -129,10 +129,10 @@ public abstract class Region {
}
/** Adds a list of {@link Triangle} objects to the Region
- * These triangles are to be binded to OGL objects
+ * These triangles are to be binded to OGL objects
* on the next call to {@code update}
* @param tris an arraylist of triangle objects
- *
+ *
* @see update(GL2ES2)
*/
public void addTriangles(ArrayList<Triangle> tris) {
@@ -141,10 +141,10 @@ public abstract class Region {
}
/** Adds a {@link Vertex} object to the Region
- * This vertex will be bound to OGL objects
+ * This vertex will be bound to OGL objects
* on the next call to {@code update}
* @param vert a vertex objects
- *
+ *
* @see update(GL2ES2)
*/
public void addVertex(Vertex vert) {
@@ -154,10 +154,10 @@ public abstract class Region {
}
/** Adds a list of {@link Vertex} objects to the Region
- * These vertices are to be binded to OGL objects
+ * These vertices are to be binded to OGL objects
* on the next call to {@code update}
* @param verts an arraylist of vertex objects
- *
+ *
* @see update(GL2ES2)
*/
public void addVertices(ArrayList<Vertex> verts) {
@@ -175,10 +175,10 @@ public abstract class Region {
}
/** Check if this region is dirty. A region is marked dirty
- * when new Vertices, Triangles, and or Lines are added after a
+ * when new Vertices, Triangles, and or Lines are added after a
* call to update()
* @return true if region is Dirty, false otherwise
- *
+ *
* @see update(GL2ES2)
*/
public final boolean isDirty() {
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 6371388..dfb7a95 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
@@ -41,32 +41,32 @@ import jogamp.graph.curve.opengl.RegionFactory;
/** A GLRegion is the OGL binding of one or more OutlineShapes
* Defined by its vertices and generated triangles. The Region
- * defines the final shape of the OutlineShape(s), which shall produced a shaded
+ * defines the final shape of the OutlineShape(s), which shall produced a shaded
* region on the screen.
- *
- * Implementations of the GLRegion shall take care of the OGL
+ *
+ * Implementations of the GLRegion shall take care of the OGL
* binding of the depending on its context, profile.
- *
+ *
* @see Region, RegionFactory, OutlineShape
*/
-public abstract class GLRegion extends Region {
-
+public abstract class GLRegion extends Region {
+
/** Create an ogl {@link GLRegion} defining the list of {@link OutlineShape}.
* Combining the Shapes into single buffers.
* @return the resulting Region inclusive the generated region
*/
public static GLRegion create(OutlineShape[] outlineShapes, int renderModes) {
final GLRegion region = RegionFactory.create(renderModes);
-
+
int numVertices = region.getNumVertices();
-
+
for(int index=0; index<outlineShapes.length; index++) {
OutlineShape outlineShape = outlineShapes[index];
outlineShape.transformOutlines(OutlineShape.VerticesState.QUADRATIC_NURBS);
-
+
ArrayList<Triangle> triangles = outlineShape.triangulate();
region.addTriangles(triangles);
-
+
ArrayList<Vertex> vertices = outlineShape.getVertices();
for(int pos=0; pos < vertices.size(); pos++){
Vertex vert = vertices.get(pos);
@@ -74,42 +74,42 @@ public abstract class GLRegion extends Region {
}
region.addVertices(vertices);
}
-
+
return region;
}
- /**
+ /**
* Create an ogl {@link GLRegion} defining this {@link OutlineShape}
* @return the resulting Region.
*/
public static GLRegion create(OutlineShape outlineShape, int renderModes) {
final GLRegion region = RegionFactory.create(renderModes);
-
+
outlineShape.transformOutlines(OutlineShape.VerticesState.QUADRATIC_NURBS);
ArrayList<Triangle> triangles = (ArrayList<Triangle>) outlineShape.triangulate();
ArrayList<Vertex> vertices = (ArrayList<Vertex>) outlineShape.getVertices();
region.addVertices(vertices);
region.addTriangles(triangles);
return region;
- }
-
+ }
+
protected GLRegion(int renderModes) {
super(renderModes);
}
-
+
/** Updates a graph region by updating the ogl related
* objects for use in rendering if {@link #isDirty()}.
- * <p>Allocates the ogl related data and initializes it the 1st time.<p>
+ * <p>Allocates the ogl related data and initializes it the 1st time.<p>
* <p>Called by {@link #draw(GL2ES2, RenderState, int, int, int)}.</p>
* @param rs TODO
*/
protected abstract void update(GL2ES2 gl, RenderState rs);
-
+
/** Delete and clean the associated OGL
* objects
*/
public abstract void destroy(GL2ES2 gl, RenderState rs);
-
+
/** Renders the associated OGL objects specifying
* current width/hight of window for multi pass rendering
* of the region.
@@ -117,13 +117,13 @@ public abstract class GLRegion extends Region {
* @param rs the RenderState to be used
* @param vp_width current screen width
* @param vp_height current screen height
- * @param texWidth desired texture width for multipass-rendering.
+ * @param texWidth desired texture width for multipass-rendering.
* The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched.
*/
public final void draw(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth) {
update(gl, rs);
drawImpl(gl, rs, vp_width, vp_height, texWidth);
}
-
+
protected abstract void drawImpl(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth);
}
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 2f078d7..f7d4bfd 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
@@ -35,26 +35,26 @@ import com.jogamp.graph.curve.Region;
public abstract class RegionRenderer extends Renderer {
- /**
+ /**
* Create a Hardware accelerated Region Renderer.
- * @param rs the used {@link RenderState}
- * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, {@link Region#VBAA_RENDERING_BIT}
+ * @param rs the used {@link RenderState}
+ * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, {@link Region#VBAA_RENDERING_BIT}
* @return an instance of Region Renderer
*/
public static RegionRenderer create(RenderState rs, int renderModes) {
return new jogamp.graph.curve.opengl.RegionRendererImpl01(rs, renderModes);
}
-
+
protected RegionRenderer(RenderState rs, int renderModes) {
super(rs, renderModes);
}
-
-
+
+
/** Render an {@link OutlineShape} in 3D space at the position provided
* the triangles of the shapes will be generated, if not yet generated
* @param region the OutlineShape to Render.
- * @param position the initial translation of the outlineShape.
- * @param texWidth desired texture width for multipass-rendering.
+ * @param position the initial translation of the outlineShape.
+ * @param texWidth desired texture width for multipass-rendering.
* The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched.
* @throws Exception if HwRegionRenderer not initialized
*/
@@ -65,10 +65,10 @@ public abstract class RegionRenderer extends Renderer {
if( !areRenderModesCompatible(region) ) {
throw new GLException("Incompatible render modes, : region modes "+region.getRenderModes()+
" doesn't contain renderer modes "+this.getRenderModes());
- }
+ }
drawImpl(gl, region, position, texWidth);
}
-
+
/**
* Usually just dispatched the draw call to the Region's draw implementation,
* e.g. {@link com.jogamp.graph.curve.opengl.GLRegion#draw(GL2ES2, RenderState, int, int, int[]) GLRegion#draw(GL2ES2, RenderState, int, int, int[])}.
@@ -79,6 +79,6 @@ public abstract class RegionRenderer extends Renderer {
protected void destroyImpl(GL2ES2 gl) {
// nop
}
-
-
+
+
}
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 5e305d6..6a8fb6a 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
@@ -40,7 +40,7 @@ import com.jogamp.opengl.util.glsl.ShaderState;
public abstract class RenderState {
private static final String thisKey = "jogamp.graph.curve.RenderState" ;
-
+
public static RenderState createRenderState(ShaderState st, Vertex.Factory<? extends Vertex> pointFactory) {
return new RenderStateImpl(st, pointFactory);
}
@@ -48,42 +48,42 @@ public abstract class RenderState {
public static RenderState createRenderState(ShaderState st, Vertex.Factory<? extends Vertex> pointFactory, PMVMatrix pmvMatrix) {
return new RenderStateImpl(st, pointFactory, pmvMatrix);
}
-
+
public static final RenderState getRenderState(GL2ES2 gl) {
return (RenderState) gl.getContext().getAttachedObject(thisKey);
}
-
+
protected final ShaderState st;
protected final Vertex.Factory<? extends Vertex> vertexFactory;
protected final PMVMatrix pmvMatrix;
- protected final GLUniformData gcu_PMVMatrix;
-
+ protected final GLUniformData gcu_PMVMatrix;
+
protected RenderState(ShaderState st, Vertex.Factory<? extends Vertex> vertexFactory, PMVMatrix pmvMatrix) {
this.st = st;
this.vertexFactory = vertexFactory;
- this.pmvMatrix = pmvMatrix;
+ this.pmvMatrix = pmvMatrix;
this.gcu_PMVMatrix = new GLUniformData(UniformNames.gcu_PMVMatrix, 4, 4, pmvMatrix.glGetPMvMatrixf());
- st.ownUniform(gcu_PMVMatrix);
+ st.ownUniform(gcu_PMVMatrix);
}
-
+
public final ShaderState getShaderState() { return st; }
public final Vertex.Factory<? extends Vertex> getVertexFactory() { return vertexFactory; }
public final PMVMatrix pmvMatrix() { return pmvMatrix; }
public final GLUniformData getPMVMatrix() { return gcu_PMVMatrix; }
-
+
public void destroy(GL2ES2 gl) {
st.destroy(gl);
}
-
+
public abstract GLUniformData getWeight();
public abstract GLUniformData getAlpha();
public abstract GLUniformData getColorStatic();
// public abstract GLUniformData getStrength();
-
+
public final RenderState attachTo(GL2ES2 gl) {
return (RenderState) gl.getContext().attachObject(thisKey, this);
}
-
+
public final boolean detachFrom(GL2ES2 gl) {
RenderState _rs = (RenderState) gl.getContext().getAttachedObject(thisKey);
if(_rs == this) {
@@ -91,8 +91,8 @@ public abstract class RenderState {
return true;
}
return false;
- }
-
+ }
+
public StringBuilder toString(StringBuilder sb, boolean alsoUnlocated) {
if(null==sb) {
sb = new StringBuilder();
@@ -104,8 +104,9 @@ public abstract class RenderState {
return sb;
}
-
+
+ @Override
public String toString() {
return toString(null, false).toString();
- }
+ }
}
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java
index 9981295..c642fb6 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/Renderer.java
@@ -52,8 +52,8 @@ public abstract class Renderer {
protected int vp_height;
protected boolean initialized;
protected final RenderState rs;
- private boolean vboSupported = false;
-
+ private boolean vboSupported = false;
+
public final boolean isInitialized() { return initialized; }
public final int getWidth() { return vp_width; }
@@ -62,29 +62,29 @@ public abstract class Renderer {
public float getWeight() { return rs.getWeight().floatValue(); }
public float getAlpha() { return rs.getAlpha().floatValue(); }
public final PMVMatrix getMatrix() { return rs.pmvMatrix(); }
-
+
/**
* Implementation shall load, compile and link the shader program and leave it active.
* @param gl referencing the current GLContext to which the ShaderState is bound to
* @return
*/
protected abstract boolean initShaderProgram(GL2ES2 gl);
-
+
protected abstract void destroyImpl(GL2ES2 gl);
-
+
/**
- * @param rs the used {@link RenderState}
+ * @param rs the used {@link RenderState}
* @param renderModes bit-field of modes
*/
protected Renderer(RenderState rs, int renderModes) {
this.rs = rs;
this.renderModes = renderModes;
}
-
+
public final int getRenderModes() {
return renderModes;
}
-
+
public boolean usesVariableCurveWeight() { return Region.isNonUniformWeight(renderModes); }
/**
@@ -93,17 +93,17 @@ public abstract class Renderer {
*/
public final boolean areRenderModesCompatible(Region region) {
final int cleanRenderModes = getRenderModes() & ( Region.VARIABLE_CURVE_WEIGHT_BIT );
- return cleanRenderModes == ( region.getRenderModes() & cleanRenderModes );
+ return cleanRenderModes == ( region.getRenderModes() & cleanRenderModes );
}
-
+
public final boolean isVBOSupported() { return vboSupported; }
-
- /**
+
+ /**
* Initialize shader and bindings for GPU based rendering bound to the given GL object's GLContext
* if not initialized yet.
* <p>Leaves the renderer enabled, ie ShaderState.</p>
* <p>Shall be called by a {@code draw()} method, e.g. {@link RegionRenderer#draw(GL2ES2, Region, float[], int)}</p>
- *
+ *
* @param gl referencing the current GLContext to which the ShaderState is bound to
* @throws GLException if initialization failed
*/
@@ -117,48 +117,48 @@ public abstract class Renderer {
gl.isFunctionAvailable("glDrawElements") &&
gl.isFunctionAvailable("glVertexAttribPointer") &&
gl.isFunctionAvailable("glDeleteBuffers");
-
+
if(DEBUG) {
System.err.println("TextRendererImpl01: VBO Supported = " + isVBOSupported());
}
-
+
if(!vboSupported){
throw new GLException("VBO not supported");
}
-
+
rs.attachTo(gl);
-
+
gl.glEnable(GL2ES2.GL_BLEND);
gl.glBlendFunc(GL2ES2.GL_SRC_ALPHA, GL2ES2.GL_ONE_MINUS_SRC_ALPHA); // FIXME: alpha blending stage ?
-
+
initialized = initShaderProgram(gl);
if(!initialized) {
throw new GLException("Shader initialization failed");
}
-
+
if(!rs.getShaderState().uniform(gl, rs.getPMVMatrix())) {
throw new GLException("Error setting PMVMatrix in shader: "+rs.getShaderState());
}
-
+
if( Region.isNonUniformWeight( getRenderModes() ) ) {
if(!rs.getShaderState().uniform(gl, rs.getWeight())) {
throw new GLException("Error setting weight in shader: "+rs.getShaderState());
}
}
-
+
if(!rs.getShaderState().uniform(gl, rs.getAlpha())) {
throw new GLException("Error setting global alpha in shader: "+rs.getShaderState());
- }
-
+ }
+
if(!rs.getShaderState().uniform(gl, rs.getColorStatic())) {
throw new GLException("Error setting global color in shader: "+rs.getShaderState());
- }
+ }
}
- public final void flushCache(GL2ES2 gl) {
+ public final void flushCache(GL2ES2 gl) {
// FIXME: REMOVE !
}
-
+
public void destroy(GL2ES2 gl) {
if(!initialized){
if(DEBUG_INSTANCE) {
@@ -169,13 +169,13 @@ public abstract class Renderer {
rs.getShaderState().useProgram(gl, false);
destroyImpl(gl);
rs.destroy(gl);
- initialized = false;
+ initialized = false;
}
-
+
public final RenderState getRenderState() { return rs; }
public final ShaderState getShaderState() { return rs.getShaderState(); }
-
- public final void enable(GL2ES2 gl, boolean enable) {
+
+ public final void enable(GL2ES2 gl, boolean enable) {
rs.getShaderState().useProgram(gl, enable);
}
@@ -188,7 +188,7 @@ public abstract class Renderer {
rs.getShaderState().uniform(gl, rs.getWeight());
}
}
-
+
public void setAlpha(GL2ES2 gl, float alpha_t) {
rs.getAlpha().setData(alpha_t);
if(null != gl && rs.getShaderState().inUse()) {
@@ -199,11 +199,11 @@ public abstract class Renderer {
public void getColorStatic(GL2ES2 gl, float[] rgb) {
FloatBuffer fb = (FloatBuffer) rs.getColorStatic().getBuffer();
- rgb[0] = fb.get(0);
- rgb[1] = fb.get(1);
- rgb[2] = fb.get(2);
+ rgb[0] = fb.get(0);
+ rgb[1] = fb.get(1);
+ rgb[2] = fb.get(2);
}
-
+
public void setColorStatic(GL2ES2 gl, float r, float g, float b){
FloatBuffer fb = (FloatBuffer) rs.getColorStatic().getBuffer();
fb.put(0, r);
@@ -213,7 +213,7 @@ public abstract class Renderer {
rs.getShaderState().uniform(gl, rs.getColorStatic());
}
}
-
+
public void rotate(GL2ES2 gl, float angle, float x, float y, float z) {
rs.pmvMatrix().glRotatef(angle, x, y, z);
updateMatrix(gl);
@@ -223,7 +223,7 @@ public abstract class Renderer {
rs.pmvMatrix().glTranslatef(x, y, z);
updateMatrix(gl);
}
-
+
public void scale(GL2ES2 gl, float x, float y, float z) {
rs.pmvMatrix().glScalef(x, y, z);
updateMatrix(gl);
@@ -261,15 +261,15 @@ public abstract class Renderer {
p.glLoadIdentity();
p.glOrthof(0, width, 0, height, near, far);
updateMatrix(gl);
- return true;
+ return true;
}
protected String getVertexShaderName() {
return "curverenderer" + getImplVersion();
}
-
+
protected String getFragmentShaderName() {
- final String version = getImplVersion();
+ final String version = getImplVersion();
final String pass = Region.isVBAA(renderModes) ? "-2pass" : "-1pass" ;
final String weight = Region.isNonUniformWeight(renderModes) ? "-weight" : "" ;
return "curverenderer" + version + pass + weight;
@@ -277,7 +277,7 @@ public abstract class Renderer {
// FIXME: Really required to have sampler2D def. precision ? If not, we can drop getFragmentShaderPrecision(..) and use default ShaderCode ..
public static final String es2_precision_fp = "\nprecision mediump float;\nprecision mediump int;\nprecision mediump sampler2D;\n";
-
+
protected String getFragmentShaderPrecision(GL2ES2 gl) {
if( gl.isGLES2() ) {
return es2_precision_fp;
@@ -287,7 +287,7 @@ public abstract class Renderer {
}
return null;
}
-
+
protected String getImplVersion() {
return "01";
}
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java
index 8dc41b0..f6ce852 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRenderer.java
@@ -38,28 +38,28 @@ import jogamp.graph.curve.text.GlyphString;
import com.jogamp.graph.font.Font;
public abstract class TextRenderer extends Renderer {
- /**
+ /**
* Create a Hardware accelerated Text Renderer.
- * @param rs the used {@link RenderState}
+ * @param rs the used {@link RenderState}
* @param renderModes either {@link com.jogamp.graph.curve.opengl.GLRegion#SINGLE_PASS} or {@link com.jogamp.graph.curve.Region#VBAA_RENDERING_BIT}
*/
public static TextRenderer create(RenderState rs, int renderModes) {
return new jogamp.graph.curve.opengl.TextRendererImpl01(rs, renderModes);
}
-
+
protected TextRenderer(RenderState rs, int type) {
super(rs, type);
}
-
+
/** Render the String in 3D space wrt to the font provided at the position provided
* the outlines will be generated, if not yet generated
* @param gl the current GL state
* @param font {@link Font} to be used
- * @param str text to be rendered
- * @param position the lower left corner of the string
+ * @param str text to be rendered
+ * @param position the lower left corner of the string
* @param fontSize font size
- * @param texWidth desired texture width for multipass-rendering.
+ * @param texWidth desired texture width for multipass-rendering.
* The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched.
* @throws Exception if TextRenderer not initialized
*/
@@ -77,11 +77,11 @@ public abstract class TextRenderer extends Renderer {
if(DEBUG_INSTANCE) {
System.err.println("createString: "+getCacheSize()+"/"+getCacheLimit()+" - "+Font.NAME_UNIQUNAME + " - " + str + " - " + size);
}
- final GlyphString glyphString = GlyphString.createString(null, rs.getVertexFactory(), font, size, str);
- glyphString.createRegion(gl, renderModes);
+ final GlyphString glyphString = GlyphString.createString(null, rs.getVertexFactory(), font, size, str);
+ glyphString.createRegion(gl, renderModes);
return glyphString;
}
-
+
/** FIXME
public void flushCache(GL2ES2 gl) {
Iterator<GlyphString> iterator = stringCacheMap.values().iterator();
@@ -89,10 +89,10 @@ public abstract class TextRenderer extends Renderer {
GlyphString glyphString = iterator.next();
glyphString.destroy(gl, rs);
}
- stringCacheMap.clear();
+ stringCacheMap.clear();
stringCacheArray.clear();
} */
-
+
@Override
protected void destroyImpl(GL2ES2 gl) {
// fluchCache(gl) already called
@@ -101,42 +101,42 @@ public abstract class TextRenderer extends Renderer {
GlyphString glyphString = iterator.next();
glyphString.destroy(gl, rs);
}
- stringCacheMap.clear();
+ stringCacheMap.clear();
stringCacheArray.clear();
}
-
+
/**
* <p>Sets the cache limit for reusing GlyphString's and their Region.
* Default is {@link #DEFAULT_CACHE_LIMIT}, -1 unlimited, 0 turns cache off, >0 limited </p>
- *
+ *
* <p>The cache will be validate when the next string rendering happens.</p>
- *
+ *
* @param newLimit new cache size
- *
+ *
* @see #DEFAULT_CACHE_LIMIT
*/
public final void setCacheLimit(int newLimit ) { stringCacheLimit = newLimit; }
-
+
/**
* Sets the cache limit, see {@link #setCacheLimit(int)} and validates the cache.
- *
+ *
* @see #setCacheLimit(int)
- *
+ *
* @param gl current GL used to remove cached objects if required
* @param newLimit new cache size
*/
public final void setCacheLimit(GL2ES2 gl, int newLimit ) { stringCacheLimit = newLimit; validateCache(gl, 0); }
-
+
/**
* @return the current cache limit
*/
public final int getCacheLimit() { return stringCacheLimit; }
-
- /**
+
+ /**
* @return the current utilized cache size, <= {@link #getCacheLimit()}
*/
public final int getCacheSize() { return stringCacheArray.size(); }
-
+
protected final void validateCache(GL2ES2 gl, int space) {
if ( getCacheLimit() > 0 ) {
while ( getCacheSize() + space > getCacheLimit() ) {
@@ -144,7 +144,7 @@ public abstract class TextRenderer extends Renderer {
}
}
}
-
+
protected final GlyphString getCachedGlyphString(Font font, String str, int fontSize) {
return stringCacheMap.get(getKey(font, str, fontSize));
}
@@ -160,13 +160,13 @@ public abstract class TextRenderer extends Renderer {
} /// else overwrite is nop ..
}
}
-
+
protected final void removeCachedGlyphString(GL2ES2 gl, Font font, String str, int fontSize) {
final String key = getKey(font, str, fontSize);
GlyphString glyphString = stringCacheMap.remove(key);
if(null != glyphString) {
glyphString.destroy(gl, rs);
- }
+ }
stringCacheArray.remove(key);
}
@@ -177,7 +177,7 @@ public abstract class TextRenderer extends Renderer {
glyphString.destroy(gl, rs);
}
}
-
+
protected final String getKey(Font font, String str, int fontSize) {
final StringBuilder sb = new StringBuilder();
return font.getName(sb, Font.NAME_UNIQUNAME)
@@ -186,8 +186,8 @@ public abstract class TextRenderer extends Renderer {
/** Default cache limit, see {@link #setCacheLimit(int)} */
public static final int DEFAULT_CACHE_LIMIT = 256;
-
+
private HashMap<String, GlyphString> stringCacheMap = new HashMap<String, GlyphString>(DEFAULT_CACHE_LIMIT);
private ArrayList<String> stringCacheArray = new ArrayList<String>(DEFAULT_CACHE_LIMIT);
- private int stringCacheLimit = DEFAULT_CACHE_LIMIT;
+ private int stringCacheLimit = DEFAULT_CACHE_LIMIT;
}
\ No newline at end of file
diff --git a/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulation.java b/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulation.java
index 7728efc..ae28495 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulation.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulation.java
@@ -33,7 +33,7 @@ import jogamp.graph.curve.tess.CDTriangulator2D;
public class Triangulation {
/** Create a new instance of a triangulation.
- * Currently only a modified version of Constraint Delaunay
+ * Currently only a modified version of Constraint Delaunay
* is implemented.
* @return instance of a triangulator
* @see Triangulator
diff --git a/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulator.java b/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulator.java
index 1ffacce..4e8c400 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulator.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/tess/Triangulator.java
@@ -36,32 +36,32 @@ import com.jogamp.graph.geom.Triangle;
/** Interface to the triangulation algorithms provided
* A triangulation of 2D outlines where you can
* provides an easy one or more outlines to be triangulated
- *
+ *
* example usage:
* addCurve(o1);
* addCurve(o2);
* addCurve(o3);
* generate();
* reset();
- *
+ *
* @see Outline
* @see Triangulation
*/
public interface Triangulator {
-
+
/** Add a curve to the list of Outlines
* describing the shape
* @param outline a bounding {@link Outline}
*/
public void addCurve(Outline outline);
-
- /** Generate the triangulation of the provided
+
+ /** Generate the triangulation of the provided
* List of {@link Outline}s
* @return an arraylist of {@link Triangle}s resembling the
* final shape.
*/
public ArrayList<Triangle> generate();
-
+
/** Reset the triangulation to initial state
* Clearing cached data
*/
diff --git a/src/jogl/classes/com/jogamp/graph/font/Font.java b/src/jogl/classes/com/jogamp/graph/font/Font.java
index 64a3a3e..a4a8fd5 100644
--- a/src/jogl/classes/com/jogamp/graph/font/Font.java
+++ b/src/jogl/classes/com/jogamp/graph/font/Font.java
@@ -31,10 +31,10 @@ import com.jogamp.opengl.math.geom.AABBox;
/**
* Interface wrapper for font implementation.
- *
+ *
* TrueType Font Specification:
* http://developer.apple.com/fonts/ttrefman/rm06/Chap6.html
- *
+ *
* TrueType Font Table Introduction:
* http://scripts.sil.org/cms/scripts/page.php?item_id=IWS-Chapter08
*/
@@ -50,22 +50,22 @@ public interface Font {
public static final int NAME_VERSION = 5;
public static final int NAME_MANUFACTURER = 8;
public static final int NAME_DESIGNER = 9;
-
-
+
+
/**
* Metrics for font
- *
+ *
* Depending on the font's direction, horizontal or vertical,
* the following tables shall be used:
- *
+ *
* Vertical http://developer.apple.com/fonts/TTRefMan/RM06/Chap6vhea.html
* Horizontal http://developer.apple.com/fonts/TTRefMan/RM06/Chap6hhea.html
*/
- public interface Metrics {
+ public interface Metrics {
float getAscent(float pixelSize);
float getDescent(float pixelSize);
float getLineGap(float pixelSize);
- float getMaxExtend(float pixelSize);
+ float getMaxExtend(float pixelSize);
float getScale(float pixelSize);
AABBox getBBox(float pixelSize);
}
@@ -74,12 +74,12 @@ public interface Font {
* Glyph for font
*/
public interface Glyph {
- // reserved special glyph IDs
+ // reserved special glyph IDs
// http://scripts.sil.org/cms/scripts/page.php?item_id=IWS-Chapter08#ba57949e
public static final int ID_UNKNOWN = 0;
public static final int ID_CR = 2;
public static final int ID_SPACE = 3;
-
+
public Font getFont();
public char getSymbol();
public AABBox getBBox(float pixelSize);
@@ -89,25 +89,26 @@ public interface Font {
public String getName(int nameIndex);
public StringBuilder getName(StringBuilder string, int nameIndex);
-
+
/** Shall return the family and subfamily name, separated a dash.
* <p>{@link #getName(StringBuilder, int)} w/ {@link #NAME_FAMILY} and {@link #NAME_SUBFAMILY}</p>
* <p>Example: "{@code Ubuntu-Regular}"</p> */
public StringBuilder getFullFamilyName(StringBuilder buffer);
-
+
public StringBuilder getAllNames(StringBuilder string, String separator);
-
+
public float getAdvanceWidth(int i, float pixelSize);
public Metrics getMetrics();
public Glyph getGlyph(char symbol);
public int getNumGlyphs();
-
+
public float getStringWidth(CharSequence string, float pixelSize);
public float getStringHeight(CharSequence string, float pixelSize);
public AABBox getStringBounds(CharSequence string, float pixelSize);
-
- public boolean isPrintableChar( char c );
-
+
+ public boolean isPrintableChar( char c );
+
/** Shall return {@link #getFullFamilyName()} */
+ @Override
public String toString();
}
\ No newline at end of file
diff --git a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java
index d2824b9..884662e 100644
--- a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java
+++ b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java
@@ -49,13 +49,13 @@ import jogamp.graph.font.UbuntuFontLoader;
public class FontFactory {
private static final String FontConstructorPropKey = "jogamp.graph.font.ctor";
private static final String DefaultFontConstructor = "jogamp.graph.font.typecast.TypecastFontConstructor";
-
+
/** Ubuntu is the default font family */
public static final int UBUNTU = 0;
-
+
/** Java fonts are optional */
public static final int JAVA = 1;
-
+
private static final FontConstructor fontConstr;
static {
@@ -63,18 +63,18 @@ public class FontFactory {
* For example:
* "jogamp.graph.font.typecast.TypecastFontFactory" (default)
* "jogamp.graph.font.ttf.TTFFontImpl"
- */
+ */
String fontImplName = PropertyAccess.getProperty(FontConstructorPropKey, true);
if(null == fontImplName) {
fontImplName = DefaultFontConstructor;
}
fontConstr = (FontConstructor) ReflectionUtil.createInstance(fontImplName, FontFactory.class.getClassLoader());
}
-
+
public static final FontSet getDefault() {
return get(UBUNTU);
}
-
+
public static final FontSet get(int font) {
switch (font) {
case JAVA:
@@ -83,15 +83,15 @@ public class FontFactory {
return UbuntuFontLoader.get();
}
}
-
+
public static final Font get(File file) throws IOException {
return fontConstr.create(file);
}
public static final Font get(final URLConnection conn) throws IOException {
return fontConstr.create(conn);
- }
-
+ }
+
public static boolean isPrintableChar( char c ) {
if( Character.isWhitespace(c) ) {
return true;
@@ -101,5 +101,5 @@ public class FontFactory {
}
final Character.UnicodeBlock block = Character.UnicodeBlock.of( c );
return block != null && block != Character.UnicodeBlock.SPECIALS;
- }
+ }
}
diff --git a/src/jogl/classes/com/jogamp/graph/font/FontSet.java b/src/jogl/classes/com/jogamp/graph/font/FontSet.java
index d376922..17b8b21 100644
--- a/src/jogl/classes/com/jogamp/graph/font/FontSet.java
+++ b/src/jogl/classes/com/jogamp/graph/font/FontSet.java
@@ -34,29 +34,29 @@ public interface FontSet {
/** Font family REGULAR **/
public static final int FAMILY_REGULAR = 0;
-
+
/** Font family LIGHT **/
public static final int FAMILY_LIGHT = 1;
-
+
/** Font family MEDIUM **/
public static final int FAMILY_MEDIUM = 2;
-
+
/** Font family CONDENSED **/
public static final int FAMILY_CONDENSED = 3;
-
+
/** Font family MONO **/
public static final int FAMILY_MONOSPACED = 4;
-
+
/** SERIF style/family bit flag. Fallback to Sans Serif. */
public static final int STYLE_SERIF = 1 << 1;
-
+
/** BOLD style bit flag */
public static final int STYLE_BOLD = 1 << 2;
-
+
/** ITALIC style bit flag */
public static final int STYLE_ITALIC = 1 << 3;
Font getDefault() throws IOException ;
-
+
Font get(int family, int stylebits) throws IOException ;
}
diff --git a/src/jogl/classes/com/jogamp/graph/geom/Outline.java b/src/jogl/classes/com/jogamp/graph/geom/Outline.java
index 12c4586..77a3180 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/Outline.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/Outline.java
@@ -36,12 +36,12 @@ import com.jogamp.opengl.math.geom.AABBox;
/** Define a single continuous stroke by control vertices.
- * The vertices define the shape of the region defined by this
+ * The vertices define the shape of the region defined by this
* outline. The Outline can contain a list of off-curve and on-curve
* vertices which define curved regions.
- *
+ *
* Note: An outline should be closed to be rendered as a region.
- *
+ *
* @see OutlineShape, Region
*/
public class Outline implements Cloneable, Comparable<Outline> {
@@ -55,7 +55,7 @@ public class Outline implements Cloneable, Comparable<Outline> {
* An outline can contain off Curve vertices which define curved
* regions in the outline.
*/
- public Outline() {
+ public Outline() {
}
public final int getVertexCount() {
@@ -64,7 +64,7 @@ public class Outline implements Cloneable, Comparable<Outline> {
/** Appends a vertex to the outline loop/strip.
* @param vertex Vertex to be added
- * @throws NullPointerException if the {@link Vertex} element is null
+ * @throws NullPointerException if the {@link Vertex} element is null
*/
public final void addVertex(Vertex vertex) throws NullPointerException {
addVertex(vertices.size(), vertex);
@@ -73,7 +73,7 @@ public class Outline implements Cloneable, Comparable<Outline> {
/** Insert the {@link Vertex} element at the given {@code position} to the outline loop/strip.
* @param position of the added Vertex
* @param vertex Vertex object to be added
- * @throws NullPointerException if the {@link Vertex} element is null
+ * @throws NullPointerException if the {@link Vertex} element is null
* @throws IndexOutOfBoundsException if position is out of range (position < 0 || position > getVertexNumber())
*/
public final void addVertex(int position, Vertex vertex) throws NullPointerException, IndexOutOfBoundsException {
@@ -88,10 +88,10 @@ public class Outline implements Cloneable, Comparable<Outline> {
/** Replaces the {@link Vertex} element at the given {@code position}.
* <p>Sets the bounding box dirty, hence a next call to {@link #getBounds()} will validate it.</p>
- *
+ *
* @param position of the replaced Vertex
- * @param vertex replacement Vertex object
- * @throws NullPointerException if the {@link Outline} element is null
+ * @param vertex replacement Vertex object
+ * @throws NullPointerException if the {@link Outline} element is null
* @throws IndexOutOfBoundsException if position is out of range (position < 0 || position >= getVertexNumber())
*/
public final void setVertex(int position, Vertex vertex) throws NullPointerException, IndexOutOfBoundsException {
@@ -112,12 +112,12 @@ public class Outline implements Cloneable, Comparable<Outline> {
/** Removes the {@link Vertex} element at the given {@code position}.
* <p>Sets the bounding box dirty, hence a next call to {@link #getBounds()} will validate it.</p>
- *
+ *
* @param position of the to be removed Vertex
* @throws IndexOutOfBoundsException if position is out of range (position < 0 || position >= getVertexNumber())
*/
public final Vertex removeVertex(int position) throws IndexOutOfBoundsException {
- dirtyBBox = true;
+ dirtyBBox = true;
return vertices.remove(position);
}
@@ -139,7 +139,7 @@ public class Outline implements Cloneable, Comparable<Outline> {
/**
* Use the given outline loop/strip.
* <p>Validates the bounding box.</p>
- *
+ *
* @param vertices the new outline loop/strip
*/
public final void setVertices(ArrayList<Vertex> vertices) {
@@ -152,7 +152,7 @@ public class Outline implements Cloneable, Comparable<Outline> {
}
/** define if this outline is closed or not.
- * if set to closed, checks if the last vertex is
+ * if set to closed, checks if the last vertex is
* equal to the first vertex. If not Equal adds a
* vertex at the end to the list.
* @param closed
@@ -170,9 +170,10 @@ public class Outline implements Cloneable, Comparable<Outline> {
}
/** Compare two outlines with Bounding Box area
- * as criteria.
+ * as criteria.
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
+ @Override
public final int compareTo(Outline outline) {
float size = getBounds().getSize();
float newSize = outline.getBounds().getSize();
@@ -198,19 +199,20 @@ public class Outline implements Cloneable, Comparable<Outline> {
validateBoundingBox();
}
return bbox;
- }
+ }
/**
* @param obj the Object to compare this Outline with
- * @return true if {@code obj} is an Outline, not null, equals bounds and equal vertices in the same order
+ * @return true if {@code obj} is an Outline, not null, equals bounds and equal vertices in the same order
*/
+ @Override
public boolean equals(Object obj) {
if( obj == this) {
return true;
}
if( null == obj || !(obj instanceof Outline) ) {
return false;
- }
+ }
final Outline o = (Outline) obj;
if(getVertexCount() != o.getVertexCount()) {
return false;
@@ -229,6 +231,7 @@ public class Outline implements Cloneable, Comparable<Outline> {
/**
* @return deep clone of this Outline
*/
+ @Override
public Outline clone() {
Outline o;
try {
@@ -240,5 +243,5 @@ public class Outline implements Cloneable, Comparable<Outline> {
o.vertices.add(vertices.get(i).clone());
}
return o;
- }
+ }
}
diff --git a/src/jogl/classes/com/jogamp/graph/geom/Triangle.java b/src/jogl/classes/com/jogamp/graph/geom/Triangle.java
index fb34de2..a01cd83 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/Triangle.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/Triangle.java
@@ -48,11 +48,11 @@ public class Triangle {
public Vertex[] getVertices() {
return vertices;
}
-
+
public boolean isEdgesBoundary() {
return boundaryEdges[0] || boundaryEdges[1] || boundaryEdges[2];
}
-
+
public boolean isVerticesBoundary() {
return boundaryVertices[0] || boundaryVertices[1] || boundaryVertices[2];
}
@@ -60,11 +60,11 @@ public class Triangle {
public void setEdgesBoundary(boolean[] boundary) {
this.boundaryEdges = boundary;
}
-
+
public boolean[] getEdgeBoundary() {
return boundaryEdges;
}
-
+
public boolean[] getVerticesBoundary() {
return boundaryVertices;
}
@@ -72,7 +72,8 @@ public class Triangle {
public void setVerticesBoundary(boolean[] boundaryVertices) {
this.boundaryVertices = boundaryVertices;
}
-
+
+ @Override
public String toString() {
return "Tri ID: " + id + "\n" + vertices[0] + "\n" + vertices[1] + "\n" + vertices[2];
}
diff --git a/src/jogl/classes/com/jogamp/graph/geom/Vertex.java b/src/jogl/classes/com/jogamp/graph/geom/Vertex.java
index e3df86d..994253f 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/Vertex.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/Vertex.java
@@ -30,7 +30,7 @@ package com.jogamp.graph.geom;
import com.jogamp.opengl.math.Vert3fImmutable;
/**
- * A Vertex with custom memory layout using custom factory.
+ * A Vertex with custom memory layout using custom factory.
*/
public interface Vertex extends Vert3fImmutable, Cloneable {
@@ -39,16 +39,16 @@ public interface Vertex extends Vert3fImmutable, Cloneable {
T create(float x, float y, float z, boolean onCurve);
- T create(float[] coordsBuffer, int offset, int length, boolean onCurve);
+ T create(float[] coordsBuffer, int offset, int length, boolean onCurve);
}
-
+
void setCoord(float x, float y, float z);
/**
* @see System#arraycopy(Object, int, Object, int, int) for thrown IndexOutOfBoundsException
*/
void setCoord(float[] coordsBuffer, int offset, int length);
-
+
void setX(float x);
void setY(float y);
@@ -60,24 +60,25 @@ public interface Vertex extends Vert3fImmutable, Cloneable {
void setOnCurve(boolean onCurve);
int getId();
-
+
void setId(int id);
-
+
float[] getTexCoord();
-
+
void setTexCoord(float s, float t);
-
+
/**
* @see System#arraycopy(Object, int, Object, int, int) for thrown IndexOutOfBoundsException
*/
void setTexCoord(float[] texCoordsBuffer, int offset, int length);
-
+
/**
* @param obj the Object to compare this Vertex with
- * @return true if {@code obj} is a Vertex and not null, on-curve flag is equal and has same vertex- and tex-coords.
+ * @return true if {@code obj} is a Vertex and not null, on-curve flag is equal and has same vertex- and tex-coords.
*/
+ @Override
boolean equals(Object obj);
-
+
/**
* @return deep clone of this Vertex
*/
diff --git a/src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java b/src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java
index 97e438b..b27604a 100644
--- a/src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java
+++ b/src/jogl/classes/com/jogamp/graph/geom/opengl/SVertex.java
@@ -39,25 +39,28 @@ public class SVertex implements Vertex {
protected float[] coord = new float[3];
protected boolean onCurve;
private float[] texCoord = new float[2];
-
+
static final Factory factory = new Factory();
-
- public static Factory factory() { return factory; }
-
+
+ public static Factory factory() { return factory; }
+
public static class Factory implements Vertex.Factory<SVertex> {
+ @Override
public SVertex create() {
return new SVertex();
}
+ @Override
public SVertex create(float x, float y, float z, boolean onCurve) {
return new SVertex(x, y, z, onCurve);
}
+ @Override
public SVertex create(float[] coordsBuffer, int offset, int length, boolean onCurve) {
return new SVertex(coordsBuffer, offset, length, onCurve);
- }
+ }
}
-
+
public SVertex() {
}
@@ -65,79 +68,92 @@ public class SVertex implements Vertex {
setCoord(x, y, z);
setOnCurve(onCurve);
}
-
+
public SVertex(float[] coordsBuffer, int offset, int length, boolean onCurve) {
setCoord(coordsBuffer, offset, length);
setOnCurve(onCurve);
}
-
- public SVertex(float[] coordsBuffer, int offset, int length,
+
+ public SVertex(float[] coordsBuffer, int offset, int length,
float[] texCoordsBuffer, int offsetTC, int lengthTC, boolean onCurve) {
setCoord(coordsBuffer, offset, length);
setTexCoord(texCoordsBuffer, offsetTC, lengthTC);
setOnCurve(onCurve);
}
-
+
+ @Override
public final void setCoord(float x, float y, float z) {
this.coord[0] = x;
this.coord[1] = y;
this.coord[2] = z;
}
+ @Override
public final void setCoord(float[] coordsBuffer, int offset, int length) {
System.arraycopy(coordsBuffer, offset, coord, 0, length);
}
-
+
@Override
public int getCoordCount() {
return 3;
}
-
+
@Override
public final float[] getCoord() {
return coord;
}
+ @Override
public final void setX(float x) {
this.coord[0] = x;
}
+ @Override
public final void setY(float y) {
this.coord[1] = y;
}
+ @Override
public final void setZ(float z) {
this.coord[2] = z;
}
+ @Override
public final float getX() {
return this.coord[0];
}
+ @Override
public final float getY() {
return this.coord[1];
}
+ @Override
public final float getZ() {
return this.coord[2];
}
+ @Override
public final boolean isOnCurve() {
return onCurve;
}
+ @Override
public final void setOnCurve(boolean onCurve) {
this.onCurve = onCurve;
}
+ @Override
public final int getId(){
return id;
}
-
+
+ @Override
public final void setId(int id){
this.id = id;
}
-
+
+ @Override
public boolean equals(Object obj) {
if( obj == this) {
return true;
@@ -146,34 +162,39 @@ public class SVertex implements Vertex {
return false;
}
final Vertex v = (Vertex) obj;
- return this == v ||
- isOnCurve() == v.isOnCurve() &&
+ return this == v ||
+ isOnCurve() == v.isOnCurve() &&
VectorUtil.checkEqualityVec2(getTexCoord(), v.getTexCoord()) &&
VectorUtil.checkEquality(getCoord(), v.getCoord()) ;
}
-
+
+ @Override
public final float[] getTexCoord() {
return texCoord;
}
+ @Override
public final void setTexCoord(float s, float t) {
this.texCoord[0] = s;
this.texCoord[1] = t;
}
+ @Override
public final void setTexCoord(float[] texCoordsBuffer, int offset, int length) {
System.arraycopy(texCoordsBuffer, offset, texCoord, 0, length);
}
-
+
/**
* @return deep clone of this Vertex, but keeping the id blank
*/
+ @Override
public SVertex clone(){
return new SVertex(this.coord, 0, 3, this.texCoord, 0, 2, this.onCurve);
}
-
+
+ @Override
public String toString() {
- return "[ID: " + id + ", onCurve: " + onCurve +
+ return "[ID: " + id + ", onCurve: " + onCurve +
": p " + coord[0] + ", " + coord[1] + ", " + coord[2] +
", t " + texCoord[0] + ", " + texCoord[1] + "]";
}
diff --git a/src/jogl/classes/com/jogamp/opengl/FBObject.java b/src/jogl/classes/com/jogamp/opengl/FBObject.java
index 7060bb7..72041a3 100644
--- a/src/jogl/classes/com/jogamp/opengl/FBObject.java
+++ b/src/jogl/classes/com/jogamp/opengl/FBObject.java
@@ -46,7 +46,7 @@ import com.jogamp.opengl.FBObject.Attachment.Type;
/**
* Core utility class simplifying usage of framebuffer objects (FBO)
- * with all {@link GLProfile}s.
+ * with all {@link GLProfile}s.
* <p>
* Supports on-the-fly reconfiguration of dimension and multisample buffers via {@link #reset(GL, int, int, int, boolean)}
* while preserving the {@link Attachment} references.
@@ -55,50 +55,50 @@ import com.jogamp.opengl.FBObject.Attachment.Type;
* Integrates default read/write framebuffers via {@link GLContext#getDefaultReadFramebuffer()} and {@link GLContext#getDefaultReadFramebuffer()},
* which is being hooked at {@link GL#glBindFramebuffer(int, int)} when the default (<code>zero</code>) framebuffer is selected.
* </p>
- *
+ *
* <p>FIXME: Implement support for {@link Type#DEPTH_TEXTURE}, {@link Type#STENCIL_TEXTURE} .</p>
*/
public class FBObject {
protected static final boolean DEBUG = Debug.debug("FBObject");
private static final boolean FBOResizeQuirk = false;
-
+
private static enum DetachAction { NONE, DISPOSE, RECREATE };
-
- /**
+
+ /**
* Marker interface, denotes a color buffer attachment.
* <p>Always an instance of {@link Attachment}.</p>
- * <p>Either an instance of {@link ColorAttachment} or {@link TextureAttachment}.</b>
+ * <p>Either an instance of {@link ColorAttachment} or {@link TextureAttachment}.</b>
*/
- public static interface Colorbuffer {
- /**
+ public static interface Colorbuffer {
+ /**
* Initializes the color buffer and set it's parameter, if uninitialized, i.e. name is <code>zero</code>.
* @return <code>true</code> if newly initialized, otherwise <code>false</code>.
- * @throws GLException if buffer generation or setup fails. The just created buffer name will be deleted in this case.
+ * @throws GLException if buffer generation or setup fails. The just created buffer name will be deleted in this case.
*/
public boolean initialize(GL gl) throws GLException;
-
- /**
+
+ /**
* Releases the color buffer if initialized, i.e. name is not <code>zero</code>.
- * @throws GLException if buffer release fails.
+ * @throws GLException if buffer release fails.
*/
public void free(GL gl) throws GLException;
-
+
/**
* Writes the internal format to the given GLCapabilities object.
* @param caps the destination for format bits
* @param rgba8Avail whether rgba8 is available
*/
- public void formatToGLCapabilities(GLCapabilities caps, boolean rgba8Avail);
+ public void formatToGLCapabilities(GLCapabilities caps, boolean rgba8Avail);
}
-
+
/** Common super class of all attachments */
public static abstract class Attachment {
- public enum Type {
+ public enum Type {
NONE, DEPTH, STENCIL, DEPTH_STENCIL, COLOR, COLOR_TEXTURE, DEPTH_TEXTURE, STENCIL_TEXTURE;
-
- /**
+
+ /**
* Returns {@link #COLOR}, {@link #DEPTH}, {@link #STENCIL} or {@link #DEPTH_STENCIL}
- * @throws IllegalArgumentException if <code>format</code> cannot be handled.
+ * @throws IllegalArgumentException if <code>format</code> cannot be handled.
*/
public static Type determine(int format) throws IllegalArgumentException {
switch(format) {
@@ -120,20 +120,20 @@ public class FBObject {
return Type.DEPTH_STENCIL;
default:
throw new IllegalArgumentException("format invalid: "+toHexString(format));
- }
+ }
}
};
-
+
/** immutable type [{@link #COLOR}, {@link #DEPTH}, {@link #STENCIL}, {@link #COLOR_TEXTURE}, {@link #DEPTH_TEXTURE}, {@link #STENCIL_TEXTURE} ] */
public final Type type;
-
+
/** immutable the internal format */
public final int format;
-
+
private int width, height;
-
+
private int name;
-
+
protected Attachment(Type type, int iFormat, int width, int height, int name) {
this.type = type;
this.format = iFormat;
@@ -141,18 +141,18 @@ public class FBObject {
this.height = height;
this.name = name;
}
-
+
/**
* Writes the internal format to the given GLCapabilities object.
* @param caps the destination for format bits
* @param rgba8Avail whether rgba8 is available
*/
- public final void formatToGLCapabilities(GLCapabilities caps, boolean rgba8Avail) {
+ public final void formatToGLCapabilities(GLCapabilities caps, boolean rgba8Avail) {
final int _format;
switch(format) {
case GL.GL_RGBA:
case 4:
- _format = rgba8Avail ? GL.GL_RGBA8 : GL.GL_RGBA4;
+ _format = rgba8Avail ? GL.GL_RGBA8 : GL.GL_RGBA4;
break;
case GL.GL_RGB:
case 3:
@@ -191,7 +191,7 @@ public class FBObject {
caps.setGreenBits(8);
caps.setBlueBits(8);
caps.setAlphaBits(8);
- break;
+ break;
case GL.GL_DEPTH_COMPONENT16:
caps.setDepthBits(16);
break;
@@ -218,18 +218,18 @@ public class FBObject {
throw new IllegalArgumentException("format invalid: "+toHexString(format));
}
}
-
+
/** width of attachment */
public final int getWidth() { return width; }
/** height of attachment */
public final int getHeight() { return height; }
/* pp */ final void setSize(int w, int h) { width = w; height = h; }
-
+
/** buffer name [1..max], maybe a texture or renderbuffer name, depending on type. */
- public final int getName() { return name; }
+ public final int getName() { return name; }
/* pp */ final void setName(int n) { name = n; }
-
- /**
+
+ /**
* Initializes the attachment and set it's parameter, if uninitialized, i.e. name is <code>zero</code>.
* <pre>
final boolean init = 0 == name;
@@ -239,11 +239,11 @@ public class FBObject {
return init;
* </pre>
* @return <code>true</code> if newly initialized, otherwise <code>false</code>.
- * @throws GLException if buffer generation or setup fails. The just created buffer name will be deleted in this case.
+ * @throws GLException if buffer generation or setup fails. The just created buffer name will be deleted in this case.
*/
public abstract boolean initialize(GL gl) throws GLException;
-
- /**
+
+ /**
* Releases the attachment if initialized, i.e. name is not <code>zero</code>.
* <pre>
if(0 != name) {
@@ -251,10 +251,10 @@ public class FBObject {
name = 0;
}
* </pre>
- * @throws GLException if buffer release fails.
+ * @throws GLException if buffer release fails.
*/
public abstract void free(GL gl) throws GLException;
-
+
/**
* <p>
* Comparison by {@link #type}, {@link #format}, {@link #width}, {@link #height} and {@link #name}.
@@ -272,7 +272,7 @@ public class FBObject {
height== a.height &&
name == a.name ;
}
-
+
/**
* <p>
* Hashed by {@link #type}, {@link #format}, {@link #width}, {@link #height} and {@link #name}.
@@ -289,14 +289,15 @@ public class FBObject {
hash = ((hash << 5) - hash) + name;
return hash;
}
-
+
int objectHashCode() { return super.hashCode(); }
-
+
+ @Override
public String toString() {
return getClass().getSimpleName()+"[type "+type+", format "+toHexString(format)+", "+width+"x"+height+
"; name "+toHexString(name)+", obj "+toHexString(objectHashCode())+"]";
}
-
+
public static Type getType(int attachmentPoint, int maxColorAttachments) {
if( GL.GL_COLOR_ATTACHMENT0 <= attachmentPoint && attachmentPoint < GL.GL_COLOR_ATTACHMENT0+maxColorAttachments ) {
return Type.COLOR;
@@ -304,9 +305,9 @@ public class FBObject {
switch(attachmentPoint) {
case GL.GL_DEPTH_ATTACHMENT:
return Type.DEPTH;
- case GL.GL_STENCIL_ATTACHMENT:
+ case GL.GL_STENCIL_ATTACHMENT:
return Type.STENCIL;
- default:
+ default:
throw new IllegalArgumentException("Invalid attachment point "+toHexString(attachmentPoint));
}
}
@@ -315,7 +316,7 @@ public class FBObject {
/** Other renderbuffer attachment which maybe a colorbuffer, depth or stencil. */
public static class RenderAttachment extends Attachment {
private int samples;
-
+
/**
* @param type allowed types are {@link Type#DEPTH_STENCIL} {@link Type#DEPTH}, {@link Type#STENCIL} or {@link Type#COLOR}
* @param iFormat
@@ -328,11 +329,11 @@ public class FBObject {
super(validateType(type), iFormat, width, height, name);
this.samples = samples;
}
-
+
/** number of samples, or zero for no multisampling */
public final int getSamples() { return samples; }
/* pp */ final void setSamples(int s) { samples = s; }
-
+
private static Type validateType(Type type) {
switch(type) {
case DEPTH_STENCIL:
@@ -340,11 +341,11 @@ public class FBObject {
case STENCIL:
case COLOR:
return type;
- default:
+ default:
throw new IllegalArgumentException("Invalid type: "+type);
}
}
-
+
/**
* <p>
* Comparison by {@link #type}, {@link #format}, {@link #samples}, {@link #width}, {@link #height} and {@link #name}.
@@ -358,7 +359,7 @@ public class FBObject {
return super.equals(o) &&
samples == ((RenderAttachment)o).samples;
}
-
+
/**
* <p>
* Hashed by {@link #type}, {@link #format}, {@link #samples}, {@link #width}, {@link #height} and {@link #name}.
@@ -378,14 +379,14 @@ public class FBObject {
final boolean init = 0 == getName();
if( init ) {
checkPreGLError(gl);
-
+
final int[] name = new int[] { -1 };
gl.glGenRenderbuffers(1, name, 0);
setName(name[0]);
-
+
gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, getName());
if( samples > 0 ) {
- ((GL2GL3)gl).glRenderbufferStorageMultisample(GL.GL_RENDERBUFFER, samples, format, getWidth(), getHeight());
+ ((GL2GL3)gl).glRenderbufferStorageMultisample(GL.GL_RENDERBUFFER, samples, format, getWidth(), getHeight());
} else {
gl.glRenderbufferStorage(GL.GL_RENDERBUFFER, format, getWidth(), getHeight());
}
@@ -401,7 +402,7 @@ public class FBObject {
}
return init;
}
-
+
@Override
public void free(GL gl) {
final int[] name = new int[] { getName() };
@@ -413,20 +414,21 @@ public class FBObject {
setName(0);
}
}
-
+
+ @Override
public String toString() {
return getClass().getSimpleName()+"[type "+type+", format "+toHexString(format)+", samples "+samples+", "+getWidth()+"x"+getHeight()+
", name "+toHexString(getName())+", obj "+toHexString(objectHashCode())+"]";
}
}
-
+
/** Color render buffer attachment */
public static class ColorAttachment extends RenderAttachment implements Colorbuffer {
public ColorAttachment(int iFormat, int samples, int width, int height, int name) {
super(Type.COLOR, iFormat, samples, width, height, name);
- }
+ }
}
-
+
/** Texture attachment */
public static class TextureAttachment extends Attachment implements Colorbuffer {
/** details of the texture setup */
@@ -445,7 +447,7 @@ public class FBObject {
* @param wrapT
* @param name
*/
- public TextureAttachment(Type type, int iFormat, int width, int height, int dataFormat, int dataType,
+ public TextureAttachment(Type type, int iFormat, int width, int height, int dataFormat, int dataType,
int magFilter, int minFilter, int wrapS, int wrapT, int name) {
super(validateType(type), iFormat, width, height, name);
this.dataFormat = dataFormat;
@@ -455,35 +457,35 @@ public class FBObject {
this.wrapS = wrapS;
this.wrapT = wrapT;
}
-
+
private static Type validateType(Type type) {
switch(type) {
case COLOR_TEXTURE:
case DEPTH_TEXTURE:
case STENCIL_TEXTURE:
return type;
- default:
+ default:
throw new IllegalArgumentException("Invalid type: "+type);
}
}
-
- /**
+
+ /**
* Initializes the texture and set it's parameter, if uninitialized, i.e. name is <code>zero</code>.
- * @throws GLException if texture generation and setup fails. The just created texture name will be deleted in this case.
+ * @throws GLException if texture generation and setup fails. The just created texture name will be deleted in this case.
*/
@Override
public boolean initialize(GL gl) throws GLException {
final boolean init = 0 == getName();
if( init ) {
checkPreGLError(gl);
-
- final int[] name = new int[] { -1 };
+
+ final int[] name = new int[] { -1 };
gl.glGenTextures(1, name, 0);
if(0 == name[0]) {
throw new GLException("null texture, "+this);
}
setName(name[0]);
-
+
gl.glBindTexture(GL.GL_TEXTURE_2D, name[0]);
if( 0 < magFilter ) {
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, magFilter);
@@ -495,7 +497,7 @@ public class FBObject {
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, wrapS);
}
if( 0 < wrapT ) {
- gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, wrapT);
+ gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, wrapT);
}
boolean preTexImage2D = true;
int glerr = gl.glGetError();
@@ -527,6 +529,7 @@ public class FBObject {
setName(0);
}
}
+ @Override
public String toString() {
return getClass().getSimpleName()+"[type "+type+", target GL_TEXTURE_2D, level 0, format "+toHexString(format)+
", "+getWidth()+"x"+getHeight()+", border 0, dataFormat "+toHexString(dataFormat)+
@@ -534,50 +537,50 @@ public class FBObject {
"; min/mag "+toHexString(minFilter)+"/"+toHexString(magFilter)+
", wrap S/T "+toHexString(wrapS)+"/"+toHexString(wrapT)+
"; name "+toHexString(getName())+", obj "+toHexString(objectHashCode())+"]";
- }
+ }
}
static String toHexString(int v) {
return "0x"+Integer.toHexString(v);
}
-
+
/**
- * Creates a color {@link TextureAttachment}, i.e. type {@link Type#COLOR_TEXTURE},
+ * Creates a color {@link TextureAttachment}, i.e. type {@link Type#COLOR_TEXTURE},
* selecting the texture data type and format automatically.
- *
+ *
* <p>Using default min/mag filter {@link GL#GL_NEAREST} and default wrapS/wrapT {@link GL#GL_CLAMP_TO_EDGE}.</p>
- *
+ *
* @param glp the chosen {@link GLProfile}
* @param alpha set to <code>true</code> if you request alpha channel, otherwise <code>false</code>;
- * @param width texture width
+ * @param width texture width
* @param height texture height
* @return the created and uninitialized color {@link TextureAttachment}
*/
public static final TextureAttachment createColorTextureAttachment(GLProfile glp, boolean alpha, int width, int height) {
return createColorTextureAttachment(glp, alpha, width, height, GL.GL_NEAREST, GL.GL_NEAREST, GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE);
}
-
+
/**
- * Creates a color {@link TextureAttachment}, i.e. type {@link Type#COLOR_TEXTURE},
+ * Creates a color {@link TextureAttachment}, i.e. type {@link Type#COLOR_TEXTURE},
* selecting the texture data type and format automatically.
- *
+ *
* @param glp the chosen {@link GLProfile}
* @param alpha set to <code>true</code> if you request alpha channel, otherwise <code>false</code>;
- * @param width texture width
+ * @param width texture width
* @param height texture height
* @param magFilter if > 0 value for {@link GL#GL_TEXTURE_MAG_FILTER}
- * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER}
+ * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER}
* @param wrapS if > 0 value for {@link GL#GL_TEXTURE_WRAP_S}
* @param wrapT if > 0 value for {@link GL#GL_TEXTURE_WRAP_T}
* @return the created and uninitialized color {@link TextureAttachment}
*/
- public static final TextureAttachment createColorTextureAttachment(GLProfile glp, boolean alpha, int width, int height,
+ public static final TextureAttachment createColorTextureAttachment(GLProfile glp, boolean alpha, int width, int height,
int magFilter, int minFilter, int wrapS, int wrapT) {
final int textureInternalFormat, textureDataFormat, textureDataType;
- if(glp.isGLES()) {
+ if(glp.isGLES()) {
textureInternalFormat = alpha ? GL.GL_RGBA : GL.GL_RGB;
textureDataFormat = alpha ? GL.GL_RGBA : GL.GL_RGB;
textureDataType = GL.GL_UNSIGNED_BYTE;
- } else {
+ } else {
textureInternalFormat = alpha ? GL.GL_RGBA8 : GL.GL_RGB8;
// textureInternalFormat = alpha ? GL.GL_RGBA : GL.GL_RGB;
// textureInternalFormat = alpha ? 4 : 3;
@@ -586,27 +589,27 @@ public class FBObject {
}
return createColorTextureAttachment(textureInternalFormat, width, height, textureDataFormat, textureDataType, magFilter, minFilter, wrapS, wrapT);
}
-
+
/**
- * Creates a color {@link TextureAttachment}, i.e. type {@link Type#COLOR_TEXTURE}.
+ * Creates a color {@link TextureAttachment}, i.e. type {@link Type#COLOR_TEXTURE}.
*
* @param internalFormat internalFormat parameter to {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, long)}
- * @param width texture width
+ * @param width texture width
* @param height texture height
* @param dataFormat format parameter to {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, long)}
* @param dataType type parameter to {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, long)}
* @param magFilter if > 0 value for {@link GL#GL_TEXTURE_MAG_FILTER}
- * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER}
+ * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER}
* @param wrapS if > 0 value for {@link GL#GL_TEXTURE_WRAP_S}
* @param wrapT if > 0 value for {@link GL#GL_TEXTURE_WRAP_T}
* @return the created and uninitialized color {@link TextureAttachment}
*/
public static final TextureAttachment createColorTextureAttachment(int internalFormat, int width, int height, int dataFormat, int dataType,
int magFilter, int minFilter, int wrapS, int wrapT) {
- return new TextureAttachment(Type.COLOR_TEXTURE, internalFormat, width, height, dataFormat, dataType,
+ return new TextureAttachment(Type.COLOR_TEXTURE, internalFormat, width, height, dataFormat, dataType,
magFilter, minFilter, wrapS, wrapT, 0 /* name */);
}
-
+
private static boolean hasAlpha(int format) {
switch(format) {
case GL.GL_RGBA8:
@@ -619,7 +622,7 @@ public class FBObject {
return false;
}
}
-
+
private boolean initialized;
private boolean fullFBOSupport;
private boolean rgba8Avail;
@@ -629,7 +632,7 @@ public class FBObject {
private boolean stencil04Avail;
private boolean stencil08Avail;
private boolean stencil16Avail;
- private boolean packedDepthStencilAvail;
+ private boolean packedDepthStencilAvail;
private int maxColorAttachments, maxSamples, maxTextureSize, maxRenderbufferSize;
private int width, height, samples;
@@ -639,21 +642,21 @@ public class FBObject {
private boolean bound;
private int colorAttachmentCount;
- private Colorbuffer[] colorAttachmentPoints; // colorbuffer attachment points
+ private Colorbuffer[] colorAttachmentPoints; // colorbuffer attachment points
private RenderAttachment depth, stencil; // depth and stencil maybe equal in case of packed-depth-stencil
private FBObject samplingSink; // MSAA sink
- private TextureAttachment samplingSinkTexture;
+ private TextureAttachment samplingSinkTexture;
private boolean samplingSinkDirty;
//
// ColorAttachment helper ..
//
-
+
private final void validateColorAttachmentPointRange(int point) {
if(!initialized) {
throw new GLException("FBO not initialized");
- }
+ }
if(maxColorAttachments != colorAttachmentPoints.length) {
throw new InternalError("maxColorAttachments "+maxColorAttachments+", array.lenght "+colorAttachmentPoints);
}
@@ -661,14 +664,14 @@ public class FBObject {
throw new IllegalArgumentException("attachment point out of range: "+point+", should be within [0.."+(maxColorAttachments-1)+"], "+this);
}
}
-
+
private final void validateAddColorAttachment(int point, Colorbuffer ca) {
validateColorAttachmentPointRange(point);
if( null != colorAttachmentPoints[point] ) {
throw new IllegalArgumentException("Cannot attach "+ca+", attachment point already in use by "+colorAttachmentPoints[point]+", "+this);
- }
+ }
}
-
+
private final void addColorAttachment(int point, Colorbuffer ca) {
validateColorAttachmentPointRange(point);
final Colorbuffer c = colorAttachmentPoints[point];
@@ -678,7 +681,7 @@ public class FBObject {
colorAttachmentPoints[point] = ca;
colorAttachmentCount++;
}
-
+
private final void removeColorAttachment(int point, Colorbuffer ca) {
validateColorAttachmentPointRange(point);
final Colorbuffer c = colorAttachmentPoints[point];
@@ -688,20 +691,20 @@ public class FBObject {
colorAttachmentPoints[point] = null;
colorAttachmentCount--;
}
-
+
/**
* Return the {@link Colorbuffer} attachment at <code>attachmentPoint</code> if it is attached to this FBO, otherwise null.
- *
+ *
* @see #attachColorbuffer(GL, boolean)
* @see #attachColorbuffer(GL, boolean)
* @see #attachTexture2D(GL, int, boolean, int, int, int, int)
- * @see #attachTexture2D(GL, int, int, int, int, int, int, int, int)
+ * @see #attachTexture2D(GL, int, int, int, int, int, int, int, int)
*/
public final Colorbuffer getColorbuffer(int attachmentPoint) {
- validateColorAttachmentPointRange(attachmentPoint);
+ validateColorAttachmentPointRange(attachmentPoint);
return colorAttachmentPoints[attachmentPoint];
}
-
+
/**
* Finds the passed {@link Colorbuffer} within the valid range of attachment points
* using <i>reference</i> comparison only.
@@ -709,36 +712,36 @@ public class FBObject {
* Note: Slow. Implementation uses a logN array search to save resources, i.e. not using a HashMap.
* </p>
* @param ca the {@link Colorbuffer} to look for.
- * @return -1 if the {@link Colorbuffer} could not be found, otherwise [0..{@link #getMaxColorAttachments()}-1]
+ * @return -1 if the {@link Colorbuffer} could not be found, otherwise [0..{@link #getMaxColorAttachments()}-1]
*/
public final int getColorbufferAttachmentPoint(Colorbuffer ca) {
for(int i=0; i<colorAttachmentPoints.length; i++) {
if( colorAttachmentPoints[i] == ca ) {
- return i;
+ return i;
}
}
return -1;
}
-
+
/**
* Returns the passed {@link Colorbuffer} if it is attached to this FBO, otherwise null.
* Implementation compares the <i>reference</i> only.
- *
+ *
* <p>
* Note: Slow. Uses {@link #getColorbufferAttachmentPoint(Colorbuffer)} to determine it's attachment point
* to be used for {@link #getColorbuffer(int)}
* </p>
- *
+ *
* @see #attachColorbuffer(GL, boolean)
* @see #attachColorbuffer(GL, boolean)
* @see #attachTexture2D(GL, int, boolean, int, int, int, int)
- * @see #attachTexture2D(GL, int, int, int, int, int, int, int, int)
+ * @see #attachTexture2D(GL, int, int, int, int, int, int, int, int)
*/
public final Colorbuffer getColorbuffer(Colorbuffer ca) {
final int p = getColorbufferAttachmentPoint(ca);
return p>=0 ? getColorbuffer(p) : null;
}
-
+
/**
* Creates an uninitialized FBObject instance.
* <p>
@@ -747,7 +750,7 @@ public class FBObject {
*/
public FBObject() {
this.initialized = false;
-
+
// TBD @ init
this.fullFBOSupport = false;
this.rgba8Avail = false;
@@ -762,7 +765,7 @@ public class FBObject {
this.maxSamples=-1;
this.maxTextureSize = 0;
this.maxRenderbufferSize = 0;
-
+
this.width = 0;
this.height = 0;
this.samples = 0;
@@ -770,17 +773,17 @@ public class FBObject {
this.ignoreStatus = false;
this.fbName = 0;
this.bound = false;
-
+
this.colorAttachmentPoints = null; // at init ..
this.colorAttachmentCount = 0;
this.depth = null;
- this.stencil = null;
-
+ this.stencil = null;
+
this.samplingSink = null;
this.samplingSinkTexture = null;
this.samplingSinkDirty = true;
}
-
+
private void init(GL gl, int width, int height, int samples) throws GLException {
if(initialized) {
throw new GLException("FBO already initialized");
@@ -788,8 +791,8 @@ public class FBObject {
if( !gl.hasBasicFBOSupport() ) {
throw new GLException("FBO not supported w/ context: "+gl.getContext()+", "+this);
}
- fullFBOSupport = gl.hasFullFBOSupport();
-
+ fullFBOSupport = gl.hasFullFBOSupport();
+
rgba8Avail = gl.isGL2GL3() || gl.isExtensionAvailable(GLExtensions.OES_rgb8_rgba8);
depth24Avail = fullFBOSupport || gl.isExtensionAvailable(GLExtensions.OES_depth24);
depth32Avail = fullFBOSupport || gl.isExtensionAvailable(GLExtensions.OES_depth32);
@@ -797,15 +800,15 @@ public class FBObject {
stencil04Avail = fullFBOSupport || gl.isExtensionAvailable(GLExtensions.OES_stencil4);
stencil08Avail = fullFBOSupport || gl.isExtensionAvailable(GLExtensions.OES_stencil8);
stencil16Avail = fullFBOSupport;
-
+
packedDepthStencilAvail = fullFBOSupport ||
gl.isExtensionAvailable(GLExtensions.OES_packed_depth_stencil) ||
gl.isExtensionAvailable(GLExtensions.EXT_packed_depth_stencil) ;
-
+
final boolean NV_fbo_color_attachments = gl.isExtensionAvailable(GLExtensions.NV_fbo_color_attachments);
-
+
int val[] = new int[1];
-
+
checkPreGLError(gl);
int realMaxColorAttachments = 1;
@@ -818,24 +821,24 @@ public class FBObject {
} catch (GLException gle) { gle.printStackTrace(); }
}
maxColorAttachments = realMaxColorAttachments <= 8 ? realMaxColorAttachments : 8; // cap to limit array size
-
+
colorAttachmentPoints = new Colorbuffer[maxColorAttachments];
colorAttachmentCount = 0;
-
+
maxSamples = gl.getMaxRenderbufferSamples();
gl.glGetIntegerv(GL.GL_MAX_TEXTURE_SIZE, val, 0);
maxTextureSize = val[0];
gl.glGetIntegerv(GL.GL_MAX_RENDERBUFFER_SIZE, val, 0);
maxRenderbufferSize = val[0];
-
+
checkPreGLError(gl);
-
+
if( 0 >= width ) { width = 1; }
if( 0 >= height ) { height = 1; }
this.width = width;
this.height = height;
this.samples = samples <= maxSamples ? samples : maxSamples;
-
+
if(DEBUG) {
System.err.println("FBObject "+width+"x"+height+", "+samples+" -> "+this.samples+" samples");
System.err.println("fullFBOSupport: "+fullFBOSupport);
@@ -856,16 +859,16 @@ public class FBObject {
System.err.println(JoglVersion.getGLStrings(gl, null).toString());
System.err.println(gl.getContext());
}
-
+
checkNoError(null, gl.glGetError(), "FBObject Init.pre"); // throws GLException if error
-
+
if(width > 2 + maxTextureSize || height> 2 + maxTextureSize ||
width > maxRenderbufferSize || height> maxRenderbufferSize ) {
throw new GLException("size "+width+"x"+height+" exceeds on of the maxima [texture "+maxTextureSize+", renderbuffer "+maxRenderbufferSize+"]");
}
resetSamplingSink(gl);
-
+
// generate fbo ..
gl.glGenFramebuffers(1, val, 0);
fbName = val[0];
@@ -874,15 +877,15 @@ public class FBObject {
}
// bind fbo ..
- gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, fbName);
- checkNoError(gl, gl.glGetError(), "FBObject Init.bindFB"); // throws GLException if error
+ gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, fbName);
+ checkNoError(gl, gl.glGetError(), "FBObject Init.bindFB"); // throws GLException if error
if(!gl.glIsFramebuffer(fbName)) {
checkNoError(gl, GL.GL_INVALID_VALUE, "FBObject Init.isFB"); // throws GLException
}
bound = true;
samplingSinkDirty = true;
initialized = true;
-
+
vStatus = GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT; // always incomplete w/o attachments!
if(DEBUG) {
System.err.println("FBObject.init(): "+this);
@@ -900,9 +903,9 @@ public class FBObject {
* Incompatibility and hence recreation is forced if
* the size or sample count doesn't match for subsequent calls.
* </p>
- *
+ *
* <p>Leaves the FBO bound state untouched</p>
- *
+ *
* @param gl the current GL context
* @param newWidth
* @param newHeight
@@ -911,7 +914,7 @@ public class FBObject {
public final void reset(GL gl, int newWidth, int newHeight) {
reset(gl, newWidth, newHeight, 0, false);
}
-
+
/**
* Initializes or resets this FBO's instance.
* <p>
@@ -920,21 +923,21 @@ public class FBObject {
* to match the new given parameters.
* </p>
* <p>
- * Currently incompatibility and hence recreation of the attachments will be performed
+ * Currently incompatibility and hence recreation of the attachments will be performed
* if the size or sample count doesn't match for subsequent calls.
* </p>
- *
+ *
* <p>Leaves the FBO bound state untouched</p>
- *
+ *
* @param gl the current GL context
* @param newWidth the new width, it's minimum is capped to 1
* @param newHeight the new height, it's minimum is capped to 1
* @param newSamples if > 0, MSAA will be used, otherwise no multisampling. Will be capped to {@link #getMaxSamples()}.
- * @param resetSamplingSink <code>true</code> calls {@link #resetSamplingSink(GL)} immediatly.
+ * @param resetSamplingSink <code>true</code> calls {@link #resetSamplingSink(GL)} immediatly.
* <code>false</code> postpones resetting the sampling sink until {@link #use(GL, TextureAttachment)} or {@link #syncSamplingSink(GL)},
- * allowing to use the samples sink's FBO and texture until then. The latter is useful to benefit
- * from implicit double buffering while resetting the sink just before it's being used, eg. at swap-buffer.
- *
+ * allowing to use the samples sink's FBO and texture until then. The latter is useful to benefit
+ * from implicit double buffering while resetting the sink just before it's being used, eg. at swap-buffer.
+ *
* @throws GLException in case of an error, i.e. size too big, etc ..
*/
public final void reset(GL gl, int newWidth, int newHeight, int newSamples, boolean resetSamplingSink) {
@@ -942,9 +945,9 @@ public class FBObject {
init(gl, newWidth, newHeight, newSamples);
return;
}
-
+
newSamples = newSamples <= maxSamples ? newSamples : maxSamples; // clamp
-
+
if( newWidth != width || newHeight != height || newSamples != samples ) {
if( 0 >= newWidth ) { newWidth = 1; }
if( 0 >= newHeight ) { newHeight = 1; }
@@ -952,39 +955,39 @@ public class FBObject {
newWidth > maxRenderbufferSize || newHeight > maxRenderbufferSize ) {
throw new GLException("size "+width+"x"+height+" exceeds on of the maxima [texture "+maxTextureSize+", renderbuffer "+maxRenderbufferSize+"]");
}
-
+
if(DEBUG) {
System.err.println("FBObject.reset - START - "+width+"x"+height+", "+samples+" -> "+newWidth+"x"+newHeight+", "+newSamples+"; "+this);
- }
-
+ }
+
final boolean wasBound = isBound();
-
+
width = newWidth;
height = newHeight;
samples = newSamples;
-
+
if(0 < samples && null == samplingSink ) {
// needs valid samplingSink for detach*() -> bind()
samplingSink = new FBObject();
samplingSink.init(gl, width, height, 0);
}
- detachAllImpl(gl, true , true);
+ detachAllImpl(gl, true , true);
if(resetSamplingSink) {
resetSamplingSink(gl);
}
-
+
samplingSinkDirty = true;
if(!wasBound) {
unbind(gl);
}
-
+
if(DEBUG) {
System.err.println("FBObject.reset - END - "+this);
}
- }
+ }
}
-
+
/**
* Writes the internal format of the attachments to the given GLCapabilities object.
* @param caps the destination for format bits
@@ -994,11 +997,11 @@ public class FBObject {
caps.setNumSamples(samples);
caps.setDepthBits(0);
caps.setStencilBits(0);
-
+
final Colorbuffer cb = samples > 0 ? getSamplingSink() : getColorbuffer(0);
if(null != cb) {
cb.formatToGLCapabilities(caps, rgba8Avail);
- }
+ }
if(null != depth) {
depth.formatToGLCapabilities(caps, rgba8Avail);
}
@@ -1006,11 +1009,11 @@ public class FBObject {
stencil.formatToGLCapabilities(caps, rgba8Avail);
}
}
-
- /**
+
+ /**
* Note that the status may reflect an incomplete state during transition of attachments.
* @return The FB status. {@link GL.GL_FRAMEBUFFER_COMPLETE} if ok, otherwise return GL FBO error state or -1
- * @see #validateStatus()
+ * @see #validateStatus()
*/
public final int getStatus() {
return vStatus;
@@ -1020,15 +1023,15 @@ public class FBObject {
public final String getStatusString() {
return getStatusString(vStatus);
}
-
+
public static final String getStatusString(int fbStatus) {
switch(fbStatus) {
case -1:
return "NOT A FBO";
-
+
case GL.GL_FRAMEBUFFER_COMPLETE:
return "OK";
-
+
case GL.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
return("FBO incomplete attachment\n");
case GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
@@ -1043,21 +1046,21 @@ public class FBObject {
return("FBO missing read buffer");
case GL2GL3.GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
return("FBO missing multisample buffer");
- case GL3.GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS:
+ case GL3.GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS:
return("FBO missing layer targets");
-
+
case GL.GL_FRAMEBUFFER_UNSUPPORTED:
return("Unsupported FBO format");
case GL2GL3.GL_FRAMEBUFFER_UNDEFINED:
return("FBO undefined");
-
+
case 0:
return("FBO implementation fault");
default:
return("FBO incomplete, implementation ERROR "+toHexString(fbStatus));
}
}
-
+
/**
* The status may even be valid if incomplete during transition of attachments.
* @see #getStatus()
@@ -1066,7 +1069,7 @@ public class FBObject {
switch(vStatus) {
case GL.GL_FRAMEBUFFER_COMPLETE:
return true;
-
+
case GL.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
case GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
case GL.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
@@ -1079,29 +1082,29 @@ public class FBObject {
// we are in transition
return true;
}
-
+
case GL.GL_FRAMEBUFFER_UNSUPPORTED:
case GL2GL3.GL_FRAMEBUFFER_UNDEFINED:
-
- case 0:
+
+ case 0:
default:
if(DEBUG) {
- System.err.println("Framebuffer " + fbName + " is incomplete, status = " + toHexString(vStatus) +
+ System.err.println("Framebuffer " + fbName + " is incomplete, status = " + toHexString(vStatus) +
" : " + getStatusString(vStatus));
}
return false;
}
}
-
+
private static int checkPreGLError(GL gl) {
int glerr = gl.glGetError();
if(DEBUG && GL.GL_NO_ERROR != glerr) {
System.err.println("Pre-existing GL error: "+toHexString(glerr));
Thread.dumpStack();
}
- return glerr;
+ return glerr;
}
-
+
private final boolean checkNoError(GL gl, int err, String exceptionMessage) throws GLException {
if(GL.GL_NO_ERROR != err) {
if(null != gl) {
@@ -1118,17 +1121,17 @@ public class FBObject {
private final void checkInitialized() throws GLException {
if(!initialized) {
throw new GLException("FBO not initialized, call init(GL) first.");
- }
+ }
}
-
+
/**
* Attaches a {@link Colorbuffer}, i.e. {@link TextureAttachment}, to this FBO's instance at the given attachment point,
* selecting the texture data type and format automatically.
- *
+ *
* <p>Using default min/mag filter {@link GL#GL_NEAREST} and default wrapS/wrapT {@link GL#GL_CLAMP_TO_EDGE}.</p>
- *
+ *
* <p>Leaves the FBO bound.</p>
- *
+ *
* @param gl the current GL context
* @param attachmentPoint the color attachment point ranging from [0..{@link #getMaxColorAttachments()}-1]
* @param alpha set to <code>true</code> if you request alpha channel, otherwise <code>false</code>;
@@ -1140,18 +1143,18 @@ public class FBObject {
return (TextureAttachment)attachColorbuffer(gl, attachmentPoint,
createColorTextureAttachment(gl.getGLProfile(), alpha, width, height));
}
-
+
/**
* Attaches a {@link Colorbuffer}, i.e. {@link TextureAttachment}, to this FBO's instance at the given attachment point,
* selecting the texture data type and format automatically.
- *
+ *
* <p>Leaves the FBO bound.</p>
- *
+ *
* @param gl the current GL context
* @param attachmentPoint the color attachment point ranging from [0..{@link #getMaxColorAttachments()}-1]
* @param alpha set to <code>true</code> if you request alpha channel, otherwise <code>false</code>;
* @param magFilter if > 0 value for {@link GL#GL_TEXTURE_MAG_FILTER}
- * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER}
+ * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER}
* @param wrapS if > 0 value for {@link GL#GL_TEXTURE_WRAP_S}
* @param wrapT if > 0 value for {@link GL#GL_TEXTURE_WRAP_T}
* @return TextureAttachment instance describing the new attached texture colorbuffer if bound and configured successfully, otherwise GLException is thrown
@@ -1162,19 +1165,19 @@ public class FBObject {
return (TextureAttachment)attachColorbuffer(gl, attachmentPoint,
createColorTextureAttachment(gl.getGLProfile(), alpha, width, height, magFilter, minFilter, wrapS, wrapT));
}
-
+
/**
* Attaches a {@link Colorbuffer}, i.e. {@link TextureAttachment}, to this FBO's instance at the given attachment point.
- *
+ *
* <p>Leaves the FBO bound.</p>
- *
+ *
* @param gl the current GL context
* @param attachmentPoint the color attachment point ranging from [0..{@link #getMaxColorAttachments()}-1]
* @param internalFormat internalFormat parameter to {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, long)}
* @param dataFormat format parameter to {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, long)}
* @param dataType type parameter to {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, long)}
* @param magFilter if > 0 value for {@link GL#GL_TEXTURE_MAG_FILTER}
- * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER}
+ * @param minFilter if > 0 value for {@link GL#GL_TEXTURE_MIN_FILTER}
* @param wrapS if > 0 value for {@link GL#GL_TEXTURE_WRAP_S}
* @param wrapT if > 0 value for {@link GL#GL_TEXTURE_WRAP_T}
* @return TextureAttachment instance describing the new attached texture colorbuffer if bound and configured successfully, otherwise GLException is thrown
@@ -1187,10 +1190,10 @@ public class FBObject {
return (TextureAttachment)attachColorbuffer(gl, attachmentPoint,
createColorTextureAttachment(internalFormat, width, height, dataFormat, dataType, magFilter, minFilter, wrapS, wrapT));
}
-
+
/**
* Creates a {@link ColorAttachment}, selecting the format automatically.
- *
+ *
* @param alpha set to <code>true</code> if you request alpha channel, otherwise <code>false</code>;
* @return uninitialized ColorAttachment instance describing the new attached colorbuffer
*/
@@ -1203,13 +1206,13 @@ public class FBObject {
}
return new ColorAttachment(internalFormat, samples, width, height, 0);
}
-
+
/**
* Attaches a {@link Colorbuffer}, i.e. {@link ColorAttachment}, to this FBO's instance at the given attachment point,
* selecting the format automatically.
- *
+ *
* <p>Leaves the FBO bound.</p>
- *
+ *
* @param gl the current GL context
* @param attachmentPoint the color attachment point ranging from [0..{@link #getMaxColorAttachments()}-1]
* @param alpha set to <code>true</code> if you request alpha channel, otherwise <code>false</code>;
@@ -1220,15 +1223,15 @@ public class FBObject {
public final ColorAttachment attachColorbuffer(GL gl, int attachmentPoint, boolean alpha) throws GLException {
return (ColorAttachment) attachColorbuffer(gl, attachmentPoint, createColorAttachment(alpha));
}
-
+
/**
* Attaches a {@link Colorbuffer}, i.e. {@link ColorAttachment}, to this FBO's instance at the given attachment point.
- *
+ *
* <p>Leaves the FBO bound.</p>
- *
+ *
* @param gl the current GL context
* @param attachmentPoint the color attachment point ranging from [0..{@link #getMaxColorAttachments()}-1]
- * @param internalFormat usually {@link GL#GL_RGBA4}, {@link GL#GL_RGB5_A1}, {@link GL#GL_RGB565}, {@link GL#GL_RGB8} or {@link GL#GL_RGBA8}
+ * @param internalFormat usually {@link GL#GL_RGBA4}, {@link GL#GL_RGB5_A1}, {@link GL#GL_RGB565}, {@link GL#GL_RGB8} or {@link GL#GL_RGBA8}
* @return ColorAttachment instance describing the new attached colorbuffer if bound and configured successfully, otherwise GLException is thrown
* @throws GLException in case the colorbuffer couldn't be allocated
* @throws IllegalArgumentException if <code>internalFormat</code> doesn't reflect a colorbuffer
@@ -1238,28 +1241,28 @@ public class FBObject {
if( Attachment.Type.COLOR != atype ) {
throw new IllegalArgumentException("colorformat invalid: "+toHexString(internalFormat)+", "+this);
}
-
+
return (ColorAttachment) attachColorbuffer(gl, attachmentPoint, new ColorAttachment(internalFormat, samples, width, height, 0));
}
-
+
/**
- * Attaches a {@link Colorbuffer}, i.e. {@link ColorAttachment} or {@link TextureAttachment},
+ * Attaches a {@link Colorbuffer}, i.e. {@link ColorAttachment} or {@link TextureAttachment},
* to this FBO's instance at the given attachment point.
- *
+ *
* <p>
* If {@link Colorbuffer} is a {@link TextureAttachment} and is uninitialized, i.e. it's texture name is <code>zero</code>,
* a new texture name is generated and setup w/ the texture parameter.<br/>
* Otherwise, i.e. texture name is not <code>zero</code>, the passed TextureAttachment <code>texA</code> is
- * considered complete and assumed matching this FBO requirement. A GL error may occur is the latter is untrue.
+ * considered complete and assumed matching this FBO requirement. A GL error may occur is the latter is untrue.
* </p>
- *
+ *
* <p>Leaves the FBO bound.</p>
- *
+ *
* @param gl
* @param attachmentPoint the color attachment point ranging from [0..{@link #getMaxColorAttachments()}-1]
- * @param colbuf the to be attached {@link Colorbuffer}
+ * @param colbuf the to be attached {@link Colorbuffer}
* @return newly attached {@link Colorbuffer} instance if bound and configured successfully, otherwise GLException is thrown
- * @throws GLException in case the colorbuffer couldn't be allocated or MSAA has been chosen in case of a {@link TextureAttachment}
+ * @throws GLException in case the colorbuffer couldn't be allocated or MSAA has been chosen in case of a {@link TextureAttachment}
*/
public final Colorbuffer attachColorbuffer(GL gl, int attachmentPoint, Colorbuffer colbuf) throws GLException {
bind(gl);
@@ -1268,13 +1271,13 @@ public class FBObject {
private final Colorbuffer attachColorbufferImpl(GL gl, int attachmentPoint, Colorbuffer colbuf) throws GLException {
validateAddColorAttachment(attachmentPoint, colbuf);
-
+
final boolean initializedColorbuf = colbuf.initialize(gl);
addColorAttachment(attachmentPoint, colbuf);
-
+
if(colbuf instanceof TextureAttachment) {
final TextureAttachment texA = (TextureAttachment) colbuf;
-
+
if(samples>0) {
removeColorAttachment(attachmentPoint, texA);
if(initializedColorbuf) {
@@ -1282,14 +1285,14 @@ public class FBObject {
}
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).");
}
-
+
// Set up the color buffer for use as a renderable texture:
gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER,
GL.GL_COLOR_ATTACHMENT0 + attachmentPoint,
GL.GL_TEXTURE_2D, texA.getName(), 0);
-
+
if(!ignoreStatus) {
- updateStatus(gl);
+ updateStatus(gl);
if(!isStatusValid()) {
detachColorbuffer(gl, attachmentPoint, true);
throw new GLException("attachTexture2D "+texA+" at "+attachmentPoint+" failed "+getStatusString()+", "+this);
@@ -1297,12 +1300,12 @@ public class FBObject {
}
} else if(colbuf instanceof ColorAttachment) {
final ColorAttachment colA = (ColorAttachment) colbuf;
-
+
// Attach the color buffer
- gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER,
- GL.GL_COLOR_ATTACHMENT0 + attachmentPoint,
+ gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER,
+ GL.GL_COLOR_ATTACHMENT0 + attachmentPoint,
GL.GL_RENDERBUFFER, colA.getName());
-
+
if(!ignoreStatus) {
updateStatus(gl);
if(!isStatusValid()) {
@@ -1316,7 +1319,7 @@ public class FBObject {
}
return colbuf;
}
-
+
/**
* Attaches one depth, stencil or packed-depth-stencil buffer to this FBO's instance,
* selecting the internalFormat automatically.
@@ -1325,30 +1328,30 @@ public class FBObject {
* </p>
* <p>
* In case the desired type or bit-number is not supported, the next available one is chosen.
- * </p>
+ * </p>
* <p>
* Use {@link #getDepthAttachment()} and/or {@link #getStencilAttachment()} to retrieve details
* about the attached buffer. The details cannot be returned, since it's possible 2 buffers
* are being created, depth and stencil.
* </p>
- *
+ *
* <p>Leaves the FBO bound.</p>
- *
+ *
* @param gl
- * @param atype either {@link Type#DEPTH}, {@link Type#STENCIL} or {@link Type#DEPTH_STENCIL}
+ * @param atype either {@link Type#DEPTH}, {@link Type#STENCIL} or {@link Type#DEPTH_STENCIL}
* @param reqBits desired bits for depth or -1 for default (24 bits)
* @throws GLException in case the renderbuffer couldn't be allocated or one is already attached.
* @throws IllegalArgumentException
* @see #getDepthAttachment()
* @see #getStencilAttachment()
*/
- public final void attachRenderbuffer(GL gl, Attachment.Type atype, int reqBits) throws GLException, IllegalArgumentException {
+ public final void attachRenderbuffer(GL gl, Attachment.Type atype, int reqBits) throws GLException, IllegalArgumentException {
if( 0 > reqBits ) {
reqBits = 24;
- }
+ }
final int internalFormat;
int internalStencilFormat = -1;
-
+
switch ( atype ) {
case DEPTH:
if( 32 <= reqBits && depth32Avail ) {
@@ -1356,10 +1359,10 @@ public class FBObject {
} else if( 24 <= reqBits && depth24Avail ) {
internalFormat = GL.GL_DEPTH_COMPONENT24;
} else {
- internalFormat = GL.GL_DEPTH_COMPONENT16;
+ internalFormat = GL.GL_DEPTH_COMPONENT16;
}
break;
-
+
case STENCIL:
if( 16 <= reqBits && stencil16Avail ) {
internalFormat = GL2GL3.GL_STENCIL_INDEX16;
@@ -1370,10 +1373,10 @@ public class FBObject {
} else if( 1 <= reqBits && stencil01Avail ) {
internalFormat = GL.GL_STENCIL_INDEX1;
} else {
- throw new GLException("stencil buffer n/a");
+ throw new GLException("stencil buffer n/a");
}
break;
-
+
case DEPTH_STENCIL:
if( packedDepthStencilAvail ) {
internalFormat = GL.GL_DEPTH24_STENCIL8;
@@ -1381,7 +1384,7 @@ public class FBObject {
if( 24 <= reqBits && depth24Avail ) {
internalFormat = GL.GL_DEPTH_COMPONENT24;
} else {
- internalFormat = GL.GL_DEPTH_COMPONENT16;
+ internalFormat = GL.GL_DEPTH_COMPONENT16;
}
if( stencil08Avail ) {
internalStencilFormat = GL.GL_STENCIL_INDEX8;
@@ -1397,17 +1400,17 @@ public class FBObject {
default:
throw new IllegalArgumentException("only depth/stencil types allowed, was "+atype+", "+this);
}
-
+
attachRenderbufferImpl(gl, atype, internalFormat);
-
+
if(0<=internalStencilFormat) {
attachRenderbufferImpl(gl, Attachment.Type.STENCIL, internalStencilFormat);
}
}
-
+
/**
* Attaches one depth, stencil or packed-depth-stencil buffer to this FBO's instance,
- * depending on the <code>internalFormat</code>.
+ * depending on the <code>internalFormat</code>.
* <p>
* Stencil and depth buffer can be attached only once.
* </p>
@@ -1416,9 +1419,9 @@ public class FBObject {
* about the attached buffer. The details cannot be returned, since it's possible 2 buffers
* are being created, depth and stencil.
* </p>
- *
+ *
* <p>Leaves the FBO bound.</p>
- *
+ *
* @param gl the current GL context
* @param internalFormat {@link GL#GL_DEPTH_COMPONENT16}, {@link GL#GL_DEPTH_COMPONENT24}, {@link GL#GL_DEPTH_COMPONENT32},
* {@link GL#GL_STENCIL_INDEX1}, {@link GL#GL_STENCIL_INDEX4}, {@link GL#GL_STENCIL_INDEX8}
@@ -1435,19 +1438,19 @@ public class FBObject {
}
attachRenderbufferImpl(gl, atype, internalFormat);
}
-
+
protected final void attachRenderbufferImpl(GL gl, Attachment.Type atype, int internalFormat) throws GLException {
if( null != depth && ( Attachment.Type.DEPTH == atype || Attachment.Type.DEPTH_STENCIL == atype ) ) {
throw new GLException("FBO depth buffer already attached (rb "+depth+"), type is "+atype+", "+toHexString(internalFormat)+", "+this);
- }
+ }
if( null != stencil && ( Attachment.Type.STENCIL== atype || Attachment.Type.DEPTH_STENCIL == atype ) ) {
throw new GLException("FBO stencil buffer already attached (rb "+stencil+"), type is "+atype+", "+toHexString(internalFormat)+", "+this);
}
bind(gl);
-
+
attachRenderbufferImpl2(gl, atype, internalFormat);
}
-
+
private final void attachRenderbufferImpl2(GL gl, Attachment.Type atype, int internalFormat) throws GLException {
if( Attachment.Type.DEPTH == atype ) {
if(null == depth) {
@@ -1486,10 +1489,10 @@ public class FBObject {
} else if( Attachment.Type.STENCIL == atype ) {
gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_STENCIL_ATTACHMENT, GL.GL_RENDERBUFFER, stencil.getName());
} else if( Attachment.Type.DEPTH_STENCIL == atype ) {
- gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_RENDERBUFFER, depth.getName());
+ gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_RENDERBUFFER, depth.getName());
gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_STENCIL_ATTACHMENT, GL.GL_RENDERBUFFER, stencil.getName());
}
-
+
if(!ignoreStatus) {
updateStatus(gl);
if( !isStatusValid() ) {
@@ -1500,13 +1503,13 @@ public class FBObject {
if(DEBUG) {
System.err.println("FBObject.attachRenderbuffer.X: [attachmentType "+atype+", iformat "+toHexString(internalFormat)+"]: "+this);
- }
+ }
}
-
+
/**
- * Detaches a {@link Colorbuffer}, i.e. {@link ColorAttachment} or {@link TextureAttachment}.
+ * Detaches a {@link Colorbuffer}, i.e. {@link ColorAttachment} or {@link TextureAttachment}.
* <p>Leaves the FBO bound!</p>
- *
+ *
* @param gl
* @param attachmentPoint
* @param dispose true if the Colorbuffer shall be disposed
@@ -1515,26 +1518,26 @@ public class FBObject {
*/
public final Colorbuffer detachColorbuffer(GL gl, int attachmentPoint, boolean dispose) throws IllegalArgumentException {
bind(gl);
-
+
final Colorbuffer res = detachColorbufferImpl(gl, attachmentPoint, dispose ? DetachAction.DISPOSE : DetachAction.NONE);
if(null == res) {
- throw new IllegalArgumentException("ColorAttachment at "+attachmentPoint+", not attached, "+this);
+ throw new IllegalArgumentException("ColorAttachment at "+attachmentPoint+", not attached, "+this);
}
if(DEBUG) {
System.err.println("FBObject.detachColorbuffer.X: [attachmentPoint "+attachmentPoint+", dispose "+dispose+"]: "+res+", "+this);
}
return res;
}
-
+
private final Colorbuffer detachColorbufferImpl(GL gl, int attachmentPoint, DetachAction detachAction) {
Colorbuffer colbuf = colorAttachmentPoints[attachmentPoint]; // shortcut, don't validate here
-
+
if(null == colbuf) {
return null;
}
-
+
removeColorAttachment(attachmentPoint, colbuf);
-
+
if(colbuf instanceof TextureAttachment) {
final TextureAttachment texA = (TextureAttachment) colbuf;
if( 0 != texA.getName() ) {
@@ -1553,7 +1556,7 @@ public class FBObject {
if(DetachAction.RECREATE == detachAction) {
if(samples == 0) {
// stay non MSAA
- texA.setSize(width, height);
+ texA.setSize(width, height);
} else {
// switch to MSAA
colbuf = createColorAttachment(hasAlpha(texA.format));
@@ -1563,8 +1566,8 @@ public class FBObject {
} else if(colbuf instanceof ColorAttachment) {
final ColorAttachment colA = (ColorAttachment) colbuf;
if( 0 != colA.getName() ) {
- gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER,
- GL.GL_COLOR_ATTACHMENT0+attachmentPoint,
+ gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER,
+ GL.GL_COLOR_ATTACHMENT0+attachmentPoint,
GL.GL_RENDERBUFFER, 0);
switch(detachAction) {
case DISPOSE:
@@ -1582,9 +1585,9 @@ public class FBObject {
} else {
// switch to non MSAA
if(null != samplingSinkTexture) {
- colbuf = createColorTextureAttachment(samplingSinkTexture.format, width, height,
- samplingSinkTexture.dataFormat, samplingSinkTexture.dataType,
- samplingSinkTexture.magFilter, samplingSinkTexture.minFilter,
+ colbuf = createColorTextureAttachment(samplingSinkTexture.format, width, height,
+ samplingSinkTexture.dataFormat, samplingSinkTexture.dataType,
+ samplingSinkTexture.magFilter, samplingSinkTexture.minFilter,
samplingSinkTexture.wrapS, samplingSinkTexture.wrapT);
} else {
colbuf = createColorTextureAttachment(gl.getGLProfile(), true, width, height);
@@ -1595,15 +1598,15 @@ public class FBObject {
}
return colbuf;
}
-
+
private final void freeAllColorbufferImpl(GL gl) {
for(int i=0; i<maxColorAttachments; i++) {
final Colorbuffer colbuf = colorAttachmentPoints[i]; // shortcut, don't validate here
-
+
if(null == colbuf) {
return;
}
-
+
if(colbuf instanceof TextureAttachment) {
final TextureAttachment texA = (TextureAttachment) colbuf;
if( 0 != texA.getName() ) {
@@ -1616,29 +1619,29 @@ public class FBObject {
} else if(colbuf instanceof ColorAttachment) {
final ColorAttachment colA = (ColorAttachment) colbuf;
if( 0 != colA.getName() ) {
- gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER,
- GL.GL_COLOR_ATTACHMENT0 + i,
+ gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER,
+ GL.GL_COLOR_ATTACHMENT0 + i,
GL.GL_RENDERBUFFER, 0);
}
colA.free(gl);
}
}
}
-
+
/**
- *
+ *
* @param gl
* @param dispose true if the Colorbuffer shall be disposed
- * @param reqAType {@link Type#DEPTH}, {@link Type#DEPTH} or {@link Type#DEPTH_STENCIL}
+ * @param reqAType {@link Type#DEPTH}, {@link Type#DEPTH} or {@link Type#DEPTH_STENCIL}
*/
public final void detachRenderbuffer(GL gl, Attachment.Type atype, boolean dispose) throws IllegalArgumentException {
- bind(gl);
+ bind(gl);
detachRenderbufferImpl(gl, atype, dispose ? DetachAction.DISPOSE : DetachAction.NONE);
if(DEBUG) {
System.err.println("FBObject.detachRenderbuffer.X: [attachmentType "+atype+", dispose "+dispose+"]: "+this);
- }
+ }
}
-
+
public final boolean isDepthStencilPackedFormat() {
final boolean res = null != depth && null != stencil &&
depth.format == stencil.format ;
@@ -1652,19 +1655,19 @@ public class FBObject {
}
return res;
}
-
+
private final void detachRenderbufferImpl(GL gl, Attachment.Type atype, DetachAction detachAction) throws IllegalArgumentException {
switch ( atype ) {
case DEPTH:
case STENCIL:
- case DEPTH_STENCIL:
+ case DEPTH_STENCIL:
break;
default:
throw new IllegalArgumentException("only depth/stencil types allowed, was "+atype+", "+this);
- }
+ }
if( null == depth && null == stencil ) {
return ; // nop
- }
+ }
final boolean packed = isDepthStencilPackedFormat();
if( packed ) {
// Note: DEPTH_STENCIL shares buffer w/ depth and stencil
@@ -1734,7 +1737,7 @@ public class FBObject {
if(packed) {
stencil = null;
}
- }
+ }
}
if( !packed && null != stencil ) {
final int format = stencil.format;
@@ -1756,17 +1759,17 @@ public class FBObject {
}
break;
default: // handled
- }
+ }
}
-
+
private final void freeAllRenderbufferImpl(GL gl) throws IllegalArgumentException {
// Note: DEPTH_STENCIL shares buffer w/ depth and stencil
final boolean packed = isDepthStencilPackedFormat();
- if( null != depth ) {
+ if( null != depth ) {
if(0 != depth.getName()) {
gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_RENDERBUFFER, 0);
if(packed) {
- gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_STENCIL_ATTACHMENT, GL.GL_RENDERBUFFER, 0);
+ gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_STENCIL_ATTACHMENT, GL.GL_RENDERBUFFER, 0);
}
depth.free(gl);
}
@@ -1774,49 +1777,49 @@ public class FBObject {
if( !packed && null != stencil ) {
if(0 != stencil.getName()) {
gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_STENCIL_ATTACHMENT, GL.GL_RENDERBUFFER, 0);
- stencil.free(gl);
+ stencil.free(gl);
}
}
}
-
- /**
+
+ /**
* Detaches all {@link ColorAttachment}s, {@link TextureAttachment}s and {@link RenderAttachment}s
* and disposes them.
* <p>Leaves the FBO bound, if initialized!</p>
* <p>
* An attached sampling sink texture will be detached as well, see {@link #getSamplingSink()}.
- * </p>
+ * </p>
* @param gl the current GL context
*/
public final void detachAll(GL gl) {
if(null != samplingSink) {
samplingSink.detachAll(gl);
- }
+ }
detachAllImpl(gl, true/* detachNonColorbuffer */, false /* recreate */);
}
-
- /**
- * Detaches all {@link ColorAttachment}s and {@link TextureAttachment}s
+
+ /**
+ * Detaches all {@link ColorAttachment}s and {@link TextureAttachment}s
* and disposes them.
* <p>Leaves the FBO bound, if initialized!</p>
* <p>
* An attached sampling sink texture will be detached as well, see {@link #getSamplingSink()}.
- * </p>
+ * </p>
* @param gl the current GL context
*/
public final void detachAllColorbuffer(GL gl) {
if(null != samplingSink) {
samplingSink.detachAllColorbuffer(gl);
- }
+ }
detachAllImpl(gl, false/* detachNonColorbuffer */, false /* recreate */);
}
-
- /**
+
+ /**
* Detaches all {@link TextureAttachment}s and disposes them.
* <p>Leaves the FBO bound, if initialized!</p>
* <p>
* An attached sampling sink texture will be detached as well, see {@link #getSamplingSink()}.
- * </p>
+ * </p>
* @param gl the current GL context
*/
public final void detachAllTexturebuffer(GL gl) {
@@ -1826,7 +1829,7 @@ public class FBObject {
if(null != samplingSink) {
samplingSink.detachAllTexturebuffer(gl);
}
- bind(gl);
+ bind(gl);
for(int i=0; i<maxColorAttachments; i++) {
if(colorAttachmentPoints[i] instanceof TextureAttachment) {
detachColorbufferImpl(gl, i, DetachAction.DISPOSE);
@@ -1836,7 +1839,7 @@ public class FBObject {
System.err.println("FBObject.detachAllTexturebuffer.X: "+this);
}
}
-
+
public final void detachAllRenderbuffer(GL gl) {
if( !isInitialized() ) {
return;
@@ -1844,10 +1847,10 @@ public class FBObject {
if(null != samplingSink) {
samplingSink.detachAllRenderbuffer(gl);
}
- bind(gl);
+ bind(gl);
detachRenderbufferImpl(gl, Attachment.Type.DEPTH_STENCIL, DetachAction.DISPOSE);
}
-
+
private final void detachAllImpl(GL gl, boolean detachNonColorbuffer, boolean recreate) {
if( !isInitialized() ) {
return;
@@ -1868,7 +1871,7 @@ public class FBObject {
if( !recreate && colorAttachmentCount>0 ) {
throw new InternalError("Non zero ColorAttachments "+this);
}
-
+
if(detachNonColorbuffer) {
detachRenderbufferImpl(gl, Attachment.Type.DEPTH_STENCIL, recreate ? DetachAction.RECREATE : DetachAction.DISPOSE);
}
@@ -1888,7 +1891,7 @@ public class FBObject {
System.err.println("FBObject.detachAll.X: [resetNonColorbuffer "+detachNonColorbuffer+", recreate "+recreate+"]: "+this);
}
}
-
+
/**
* @param gl the current GL context
*/
@@ -1903,9 +1906,9 @@ public class FBObject {
if( null != samplingSink && samplingSink.isInitialized() ) {
samplingSink.destroy(gl);
}
-
+
detachAllImpl(gl, true /* detachNonColorbuffer */, false /* recreate */);
-
+
// cache FB names, preset exposed to zero,
// braking ties w/ GL/GLContext link to getReadFramebuffer()/getWriteFramebuffer()
final int fb_cache = fbName;
@@ -1915,7 +1918,7 @@ public class FBObject {
if(0!=fb_cache) {
name[0] = fb_cache;
gl.glDeleteFramebuffers(1, name, 0);
- }
+ }
initialized = false;
bound = false;
if(DEBUG) {
@@ -1933,14 +1936,14 @@ public class FBObject {
final boolean depthMismatch = ( null != depth && null == samplingSink.depth ) ||
( null != depth && null != samplingSink.depth &&
depth.format != samplingSink.depth.format );
-
+
final boolean stencilMismatch = ( null != stencil && null == samplingSink.stencil ) ||
( null != stencil && null != samplingSink.stencil &&
- stencil.format != samplingSink.stencil.format );
-
- return depthMismatch || stencilMismatch;
+ stencil.format != samplingSink.stencil.format );
+
+ return depthMismatch || stencilMismatch;
}
-
+
/**
* Manually reset the MSAA sampling sink, if used.
* <p>
@@ -1948,7 +1951,7 @@ public class FBObject {
* a new sampling sink is being created.
* </p>
* <p>
- * Automatically called by {@link #reset(GL, int, int, int, boolean)}
+ * Automatically called by {@link #reset(GL, int, int, int, boolean)}
* and {@link #syncSamplingSink(GL)}.
* </p>
* <p>
@@ -1967,58 +1970,58 @@ public class FBObject {
}
return;
}
-
+
if(null == samplingSink ) {
samplingSink = new FBObject();
}
-
+
if(!samplingSink.initialized) {
samplingSink.init(gl, width, height, 0);
}
-
+
boolean sampleSinkSizeMismatch = sampleSinkSizeMismatch();
boolean sampleSinkTexMismatch = sampleSinkTexMismatch();
boolean sampleSinkDepthStencilMismatch = sampleSinkDepthStencilMismatch();
-
+
/** if(DEBUG) {
System.err.println("FBObject.resetSamplingSink.0: \n\tTHIS "+this+",\n\tSINK "+samplesSink+
"\n\t size "+sampleSinkSizeMismatch +", tex "+sampleSinkTexMismatch +", depthStencil "+sampleSinkDepthStencilMismatch);
} */
-
+
if(!sampleSinkSizeMismatch && !sampleSinkTexMismatch && !sampleSinkDepthStencilMismatch) {
- // all properties match ..
- return;
+ // all properties match ..
+ return;
}
-
+
unbind(gl);
-
+
if(DEBUG) {
System.err.println("FBObject.resetSamplingSink: BEGIN\n\tTHIS "+this+",\n\tSINK "+samplingSink+
"\n\t size "+sampleSinkSizeMismatch +", tex "+sampleSinkTexMismatch +", depthStencil "+sampleSinkDepthStencilMismatch);
}
-
+
if( sampleSinkDepthStencilMismatch ) {
samplingSink.detachAllRenderbuffer(gl);
}
-
+
if( sampleSinkSizeMismatch ) {
samplingSink.reset(gl, width, height);
}
-
+
if(null == samplingSinkTexture) {
samplingSinkTexture = samplingSink.attachTexture2D(gl, 0, true);
} else if( 0 == samplingSinkTexture.getName() ) {
samplingSinkTexture.setSize(width, height);
samplingSink.attachColorbuffer(gl, 0, samplingSinkTexture);
}
-
+
if( sampleSinkDepthStencilMismatch ) {
samplingSink.attachRenderbuffer(gl, depth.format);
if( null != stencil && !isDepthStencilPackedFormat() ) {
samplingSink.attachRenderbuffer(gl, stencil.format);
}
- }
-
+ }
+
sampleSinkSizeMismatch = sampleSinkSizeMismatch();
sampleSinkTexMismatch = sampleSinkTexMismatch();
sampleSinkDepthStencilMismatch = sampleSinkDepthStencilMismatch();
@@ -2026,21 +2029,21 @@ public class FBObject {
throw new InternalError("Samples sink mismatch after reset: \n\tTHIS "+this+",\n\t SINK "+samplingSink+
"\n\t size "+sampleSinkSizeMismatch +", tex "+sampleSinkTexMismatch +", depthStencil "+sampleSinkDepthStencilMismatch);
}
-
+
if(DEBUG) {
System.err.println("FBObject.resetSamplingSink: END\n\tTHIS "+this+",\n\tSINK "+samplingSink+
"\n\t size "+sampleSinkSizeMismatch +", tex "+sampleSinkTexMismatch +", depthStencil "+sampleSinkDepthStencilMismatch);
}
}
-
+
/**
* Setting this FBO sampling sink.
* @param newSamplingSink the new FBO sampling sink to use, or null to remove current sampling sink
- * @return the previous sampling sink or null if none was attached
+ * @return the previous sampling sink or null if none was attached
* @throws GLException if this FBO doesn't use MSAA or the given sink uses MSAA itself
*/
public FBObject setSamplingSink(FBObject newSamplingSink) throws GLException {
- final FBObject prev = samplingSink;
+ final FBObject prev = samplingSink;
if( null == newSamplingSink) {
samplingSink = null;
samplingSinkTexture = null;
@@ -2056,14 +2059,14 @@ public class FBObject {
samplingSinkDirty = true;
return prev;
}
-
- /**
+
+ /**
* Bind this FBO, i.e. bind write framebuffer to {@link #getWriteFramebuffer()}.
- *
- * <p>If multisampling is used, it sets the read framebuffer to the sampling sink {@link #getWriteFramebuffer()},
+ *
+ * <p>If multisampling is used, it sets the read framebuffer to the sampling sink {@link #getWriteFramebuffer()},
* if full FBO is supported.</p>
- *
- * <p>
+ *
+ * <p>
* In case you have attached more than one color buffer,
* you may want to setup {@link GL2GL3#glDrawBuffers(int, int[], int)}.
* </p>
@@ -2079,7 +2082,7 @@ public class FBObject {
gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, getReadFramebuffer());
} else {
// one for all
- gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, getWriteFramebuffer());
+ gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, getWriteFramebuffer());
}
bound = true;
@@ -2087,29 +2090,29 @@ public class FBObject {
}
}
- /**
+ /**
* Unbind this FBO, i.e. bind read and write framebuffer to default, see {@link GLBase#getDefaultDrawFramebuffer()}.
- *
- * <p>If full FBO is supported, sets the read and write framebuffer individually to default, hence not disturbing
+ *
+ * <p>If full FBO is supported, sets the read and write framebuffer individually to default, hence not disturbing
* an optional operating MSAA FBO, see {@link GLBase#getDefaultReadFramebuffer()} and {@link GLBase#getDefaultDrawFramebuffer()}</p>
- *
+ *
* @param gl the current GL context
* @throws GLException
*/
public final void unbind(GL gl) throws GLException {
if(bound) {
if(fullFBOSupport) {
- // default read/draw buffers, may utilize GLContext/GLDrawable override of
+ // default read/draw buffers, may utilize GLContext/GLDrawable override of
// GLContext.getDefaultDrawFramebuffer() and GLContext.getDefaultReadFramebuffer()
gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, 0);
gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, 0);
} else {
- gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); // default draw buffer
+ gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); // default draw buffer
}
bound = false;
}
}
-
+
/**
* Method simply marks this FBO unbound w/o interfering w/ the bound framebuffer as perfomed by {@link #unbind(GL)}.
* <p>
@@ -2121,22 +2124,22 @@ public class FBObject {
bound = false;
}
- /**
+ /**
* Returns <code>true</code> if framebuffer object is bound via {@link #bind(GL)}, otherwise <code>false</code>.
* <p>
* Method verifies the bound state via {@link GL#getBoundFramebuffer(int)}.
* </p>
* @param gl the current GL context
*/
- public final boolean isBound(GL gl) {
+ public final boolean isBound(GL gl) {
bound = bound && fbName != gl.getBoundFramebuffer(GL.GL_FRAMEBUFFER) ;
return bound;
}
-
+
/** Returns <code>true</code> if framebuffer object is bound via {@link #bind(GL)}, otherwise <code>false</code>. */
public final boolean isBound() { return bound; }
-
- /**
+
+ /**
* If multisampling is being used and flagged dirty by a previous call of {@link #bind(GL)} or after initialization,
* the msaa-buffers are sampled to it's sink {@link #getSamplingSink()}.
* <p>
@@ -2147,7 +2150,7 @@ public class FBObject {
* </p>
* <p>
* Method always resets the framebuffer binding to default in the end.
- * If full FBO is supported, sets the read and write framebuffer individually to default after sampling, hence not disturbing
+ * If full FBO is supported, sets the read and write framebuffer individually to default after sampling, hence not disturbing
* an optional operating MSAA FBO, see {@link GLBase#getDefaultReadFramebuffer()} and {@link GLBase#getDefaultDrawFramebuffer()}
* </p>
* <p>
@@ -2155,10 +2158,10 @@ public class FBObject {
* you may want to call {@link GL#glBindFramebuffer(int, int) glBindFramebuffer}({@link GL2GL3#GL_READ_FRAMEBUFFER}, {@link #getReadFramebuffer()});
* </p>
* <p>Leaves the FBO unbound.</p>
- *
+ *
* @param gl the current GL context
* @param ta {@link TextureAttachment} to use, prev. attached w/ {@link #attachTexture2D(GL, int, boolean, int, int, int, int) attachTexture2D(..)}
- * @throws IllegalArgumentException
+ * @throws IllegalArgumentException
*/
public final void syncSamplingSink(GL gl) {
markUnbound();
@@ -2170,30 +2173,30 @@ public class FBObject {
gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, samplingSink.getWriteFramebuffer());
((GL2GL3)gl).glBlitFramebuffer(0, 0, width, height, 0, 0, width, height, // since MSAA is supported, casting to GL2GL3 is OK
GL.GL_COLOR_BUFFER_BIT, GL.GL_NEAREST);
- checkNoError(null, gl.glGetError(), "FBObject syncSampleSink"); // throws GLException if error
+ checkNoError(null, gl.glGetError(), "FBObject syncSampleSink"); // throws GLException if error
}
if(fullFBOSupport) {
- // default read/draw buffers, may utilize GLContext/GLDrawable override of
+ // default read/draw buffers, may utilize GLContext/GLDrawable override of
// GLContext.getDefaultDrawFramebuffer() and GLContext.getDefaultReadFramebuffer()
gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, 0);
gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, 0);
} else {
- gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); // default draw buffer
+ gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0); // default draw buffer
}
}
-
- /**
+
+ /**
* Bind the given texture colorbuffer.
- *
+ *
* <p>If using multiple texture units, ensure you call {@link GL#glActiveTexture(int)} first!</p>
- *
+ *
* <p>{@link #syncSamplingSink(GL)} is being called</p>
- *
+ *
* <p>Leaves the FBO unbound!</p>
- *
+ *
* @param gl the current GL context
* @param ta {@link TextureAttachment} to use, prev. attached w/ {@link #attachTexture2D(GL, int, boolean, int, int, int, int) attachTexture2D(..)}
- * @throws IllegalArgumentException
+ * @throws IllegalArgumentException
*/
public final void use(GL gl, TextureAttachment ta) throws IllegalArgumentException {
if(null == ta) { throw new IllegalArgumentException("Null TextureAttachment, this: "+toString()); }
@@ -2201,26 +2204,26 @@ public class FBObject {
gl.glBindTexture(GL.GL_TEXTURE_2D, ta.getName()); // use it ..
}
- /**
+ /**
* Unbind texture, ie bind 'non' texture 0
- *
+ *
* <p>Leaves the FBO unbound.</p>
- */
+ */
public final void unuse(GL gl) {
unbind(gl);
gl.glBindTexture(GL.GL_TEXTURE_2D, 0); // don't use it
}
- /** @see GL#hasFullFBOSupport() */
+ /** @see GL#hasFullFBOSupport() */
public final boolean hasFullFBOSupport() throws GLException { checkInitialized(); return this.fullFBOSupport; }
-
- /**
+
+ /**
* Returns <code>true</code> if renderbuffer accepts internal format {@link GL#GL_RGB8} and {@link GL#GL_RGBA8}, otherwise <code>false</code>.
* @throws GLException if {@link #init(GL)} hasn't been called.
*/
public final boolean supportsRGBA8() throws GLException { checkInitialized(); return rgba8Avail; }
-
- /**
+
+ /**
* Returns <code>true</code> if {@link GL#GL_DEPTH_COMPONENT16}, {@link GL#GL_DEPTH_COMPONENT24} or {@link GL#GL_DEPTH_COMPONENT32} is supported, otherwise <code>false</code>.
* @param bits 16, 24 or 32 bits
* @throws GLException if {@link #init(GL)} hasn't been called.
@@ -2228,14 +2231,14 @@ public class FBObject {
public final boolean supportsDepth(int bits) throws GLException {
checkInitialized();
switch(bits) {
- case 16: return true;
+ case 16: return true;
case 24: return depth24Avail;
case 32: return depth32Avail;
- default: return false;
+ default: return false;
}
}
-
- /**
+
+ /**
* Returns <code>true</code> if {@link GL#GL_STENCIL_INDEX1}, {@link GL#GL_STENCIL_INDEX4}, {@link GL#GL_STENCIL_INDEX8} or {@link GL2GL3#GL_STENCIL_INDEX16} is supported, otherwise <code>false</code>.
* @param bits 1, 4, 8 or 16 bits
* @throws GLException if {@link #init(GL)} hasn't been called.
@@ -2243,34 +2246,34 @@ public class FBObject {
public final boolean supportsStencil(int bits) throws GLException {
checkInitialized();
switch(bits) {
- case 1: return stencil01Avail;
+ case 1: return stencil01Avail;
case 4: return stencil04Avail;
case 8: return stencil08Avail;
case 16: return stencil16Avail;
- default: return false;
+ default: return false;
}
}
-
- /**
+
+ /**
* Returns <code>true</code> if {@link GL#GL_DEPTH24_STENCIL8} is supported, otherwise <code>false</code>.
* @throws GLException if {@link #init(GL)} hasn't been called.
*/
public final boolean supportsPackedDepthStencil() throws GLException { checkInitialized(); return packedDepthStencilAvail; }
-
+
/**
* Returns the maximum number of colorbuffer attachments.
* @throws GLException if {@link #init(GL)} hasn't been called.
*/
public final int getMaxColorAttachments() throws GLException { checkInitialized(); return maxColorAttachments; }
-
+
public final int getMaxTextureSize() throws GLException { checkInitialized(); return this.maxTextureSize; }
public final int getMaxRenderbufferSize() throws GLException { checkInitialized(); return this.maxRenderbufferSize; }
-
+
/** @see GL#getMaxRenderbufferSamples() */
public final int getMaxSamples() throws GLException { checkInitialized(); return this.maxSamples; }
-
+
/**
- * Returns <code>true</code> if this instance has been initialized with {@link #reset(GL, int, int)}
+ * Returns <code>true</code> if this instance has been initialized with {@link #reset(GL, int, int)}
* or {@link #reset(GL, int, int, int, boolean)}, otherwise <code>false</code>
*/
public final boolean isInitialized() { return initialized; }
@@ -2283,43 +2286,44 @@ public class FBObject {
/** Returns the framebuffer name to render to. */
public final int getWriteFramebuffer() { return fbName; }
/** Returns the framebuffer name to read from. Depending on multisampling, this may be a different framebuffer. */
- public final int getReadFramebuffer() { return ( samples > 0 ) ? samplingSink.getReadFramebuffer() : fbName; }
- public final int getDefaultReadBuffer() { return GL.GL_COLOR_ATTACHMENT0; }
+ public final int getReadFramebuffer() { return ( samples > 0 ) ? samplingSink.getReadFramebuffer() : fbName; }
+ public final int getDefaultReadBuffer() { return GL.GL_COLOR_ATTACHMENT0; }
/** Return the number of color/texture attachments */
public final int getColorAttachmentCount() { return colorAttachmentCount; }
- /** Return the stencil {@link RenderAttachment} attachment, if exist. Maybe share the same {@link Attachment#getName()} as {@link #getDepthAttachment()}, if packed depth-stencil is being used. */
+ /** Return the stencil {@link RenderAttachment} attachment, if exist. Maybe share the same {@link Attachment#getName()} as {@link #getDepthAttachment()}, if packed depth-stencil is being used. */
public final RenderAttachment getStencilAttachment() { return stencil; }
- /** Return the depth {@link RenderAttachment} attachment. Maybe share the same {@link Attachment#getName()} as {@link #getStencilAttachment()}, if packed depth-stencil is being used. */
+ /** Return the depth {@link RenderAttachment} attachment. Maybe share the same {@link Attachment#getName()} as {@link #getStencilAttachment()}, if packed depth-stencil is being used. */
public final RenderAttachment getDepthAttachment() { return depth; }
-
- /** Return the complete multisampling {@link FBObject} sink, if using multisampling. */
+
+ /** Return the complete multisampling {@link FBObject} sink, if using multisampling. */
public final FBObject getSamplingSinkFBO() { return samplingSink; }
-
- /** Return the multisampling {@link TextureAttachment} sink, if using multisampling. */
+
+ /** Return the multisampling {@link TextureAttachment} sink, if using multisampling. */
public final TextureAttachment getSamplingSink() { return samplingSinkTexture; }
- /**
- * Returns <code>true</code> if the multisampling colorbuffer (msaa-buffer)
+ /**
+ * Returns <code>true</code> if the multisampling colorbuffer (msaa-buffer)
* has been flagged dirty by a previous call of {@link #bind(GL)},
* otherwise <code>false</code>.
*/
public final boolean isSamplingBufferDirty() { return samplingSinkDirty; }
-
+
int objectHashCode() { return super.hashCode(); }
-
+
+ @Override
public final String toString() {
- final String caps = null != colorAttachmentPoints ? Arrays.asList(colorAttachmentPoints).toString() : null ;
+ final String caps = null != colorAttachmentPoints ? Arrays.asList(colorAttachmentPoints).toString() : null ;
return "FBO[name r/w "+fbName+"/"+getReadFramebuffer()+", init "+initialized+", bound "+bound+", size "+width+"x"+height+
", samples "+samples+"/"+maxSamples+", depth "+depth+", stencil "+stencil+
", color attachments: "+colorAttachmentCount+"/"+maxColorAttachments+
": "+caps+", msaa-sink "+samplingSinkTexture+", hasSamplesSink "+(null != samplingSink)+
", state "+getStatusString()+", obj "+toHexString(objectHashCode())+"]";
}
-
+
private final void updateStatus(GL gl) {
if( 0 == fbName ) {
vStatus = -1;
} else {
vStatus = gl.glCheckFramebufferStatus(GL.GL_FRAMEBUFFER);
}
- }
+ }
}
diff --git a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
index bec05a0..6b1bb0e 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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;
import javax.media.nativewindow.AbstractGraphicsDevice;
@@ -58,17 +58,24 @@ import jogamp.opengl.GLDrawableImpl;
* </ul>
* and setup a {@link com.jogamp.newt.Window#setWindowDestroyNotifyAction(Runnable) custom toolkit destruction} issuing {@link #windowDestroyNotifyOp()}.
* </p>
- * <p>
+ * <p>
* See example {@link com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateNEWT TestGLAutoDrawableDelegateNEWT}.
* </p>
*/
public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAutoDrawable {
/**
+ * <p>
+ * The {@link GLContext} can be assigned later manually via {@link GLAutoDrawable#setContext(GLContext, boolean) setContext(ctx)}
+ * <i>or</i> it will be created <i>lazily</i> at the 1st {@link GLAutoDrawable#display() display()} method call.<br>
+ * <i>Lazy</i> {@link GLContext} creation will take a shared {@link GLContext} into account
+ * which has been set {@link #setSharedContext(GLContext) directly}
+ * or {@link #setSharedAutoDrawable(GLAutoDrawable) via another GLAutoDrawable}.
+ * </p>
* @param drawable a valid {@link GLDrawable}, may not be {@link GLDrawable#isRealized() realized} yet.
- * @param context a valid {@link GLContext},
+ * @param context a valid {@link GLContext},
* may not have been made current (created) yet,
* may not be associated w/ <code>drawable<code> yet,
- * may be <code>null</code> for lazy initialization
+ * may be <code>null</code> for lazy initialization at 1st {@link #display()}.
* @param upstreamWidget optional UI element holding this instance, see {@link #getUpstreamWidget()}.
* @param ownDevice pass <code>true</code> if {@link AbstractGraphicsDevice#close()} shall be issued,
* otherwise pass <code>false</code>. Closing the device is required in case
@@ -84,7 +91,7 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto
this.upstreamWidget = upstreamWidget;
this.lock = ( null != lock ) ? lock : LockFactory.createRecursiveLock() ;
}
-
+
//
// expose default methods
//
@@ -93,40 +100,40 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto
public final void windowRepaintOp() {
super.defaultWindowRepaintOp();
}
-
+
/** Implementation to handle resize events from the windowing system. All required locks are being claimed. */
public final void windowResizedOp(int newWidth, int newHeight) {
super.defaultWindowResizedOp(newWidth, newHeight);
}
-
- /**
+
+ /**
* Implementation to handle destroy notifications from the windowing system.
- *
+ *
* <p>
- * If the {@link NativeSurface} does not implement {@link WindowClosingProtocol}
+ * If the {@link NativeSurface} does not implement {@link WindowClosingProtocol}
* or {@link WindowClosingMode#DISPOSE_ON_CLOSE} is enabled (default),
* a thread safe destruction is being induced.
- * </p>
+ * </p>
*/
public final void windowDestroyNotifyOp() {
super.defaultWindowDestroyNotifyOp();
}
-
+
//
// Complete GLAutoDrawable
//
-
+
private Object upstreamWidget;
private final RecursiveLock lock;
-
+
@Override
protected final RecursiveLock getLock() { return lock; }
-
+
@Override
public final Object getUpstreamWidget() {
return upstreamWidget;
}
-
+
/**
* Set the upstream UI toolkit object.
* @see #getUpstreamWidget()
@@ -134,7 +141,7 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto
public final void setUpstreamWidget(Object newUpstreamWidget) {
upstreamWidget = newUpstreamWidget;
}
-
+
/**
* {@inheritDoc}
* <p>
@@ -142,7 +149,7 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto
* </p>
* <p>
* User still needs to destroy the upstream window, which details are hidden from this aspect.
- * This can be performed by overriding {@link #destroyImplInLock()}.
+ * This can be performed by overriding {@link #destroyImplInLock()}.
* </p>
*/
@Override
@@ -154,29 +161,29 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto
protected void destroyImplInLock() {
super.destroyImplInLock();
}
-
+
@Override
- public void display() {
+ public void display() {
defaultDisplay();
}
-
+
//
// GLDrawable delegation
//
-
+
@Override
public final GLDrawableFactory getFactory() {
return drawable.getFactory();
}
-
+
@Override
public final void swapBuffers() throws GLException {
defaultSwapBuffers();
}
-
+
@Override
public String toString() {
return getClass().getSimpleName()+"[ \n\tHelper: " + helper + ", \n\tDrawable: " + drawable +
", \n\tContext: " + context + ", \n\tUpstreamWidget: "+upstreamWidget+ /** ", \n\tFactory: "+factory+ */ "]";
- }
+ }
}
diff --git a/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java b/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java
index 21dafec..1b41876 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -48,7 +48,7 @@ import jogamp.opengl.Debug;
import com.jogamp.nativewindow.MutableGraphicsConfiguration;
/**
- * GLEventListenerState is holding {@link GLAutoDrawable} components crucial
+ * GLEventListenerState is holding {@link GLAutoDrawable} components crucial
* to relocating all its {@link GLEventListener} w/ their operating {@link GLContext}, etc.
* The components are:
* <ul>
@@ -69,8 +69,8 @@ import com.jogamp.nativewindow.MutableGraphicsConfiguration;
*/
public class GLEventListenerState {
private static final boolean DEBUG = Debug.debug("GLDrawable") || Debug.debug("GLEventListenerState");
-
- private GLEventListenerState(AbstractGraphicsDevice upstreamDevice, boolean proxyOwnsUpstreamDevice, AbstractGraphicsDevice device,
+
+ private GLEventListenerState(AbstractGraphicsDevice upstreamDevice, boolean proxyOwnsUpstreamDevice, AbstractGraphicsDevice device,
GLCapabilitiesImmutable caps,
GLContext context, int count, GLAnimatorControl anim, boolean animStarted) {
this.upstreamDevice = upstreamDevice;
@@ -82,19 +82,19 @@ public class GLEventListenerState {
this.listenersInit = new boolean[count];
this.anim = anim;
this.animStarted = animStarted;
-
+
this.owner = true;
}
/**
- * Returns <code>true</code>, if this instance is the current owner of the components,
+ * Returns <code>true</code>, if this instance is the current owner of the components,
* otherwise <code>false</code>.
* <p>
* Ownership is lost if {@link #moveTo(GLAutoDrawable)} is being called successfully
- * and all components are transferred to the new {@link GLAutoDrawable}.
+ * and all components are transferred to the new {@link GLAutoDrawable}.
* </p>
*/
public final boolean isOwner() { return owner; }
-
+
public final int listenerCount() { return listeners.length; }
public final AbstractGraphicsDevice upstreamDevice;
@@ -103,10 +103,10 @@ public class GLEventListenerState {
public final GLCapabilitiesImmutable caps;
public final GLContext context;
public final GLEventListener[] listeners;
- public final boolean[] listenersInit;
+ public final boolean[] listenersInit;
public final GLAnimatorControl anim;
public final boolean animStarted;
-
+
private boolean owner;
/**
@@ -127,25 +127,25 @@ public class GLEventListenerState {
private static AbstractGraphicsDevice cloneDevice(AbstractGraphicsDevice aDevice) {
return (AbstractGraphicsDevice) aDevice.clone();
}
-
+
/**
- * Moves all GLEventListenerState components from the given {@link GLAutoDrawable}
+ * Moves all GLEventListenerState components from the given {@link GLAutoDrawable}
* to a newly created instance.
* <p>
* Note that all components are removed from the {@link GLAutoDrawable},
* i.e. the {@link GLContext}, all {@link GLEventListener}.
* </p>
- * <p>
+ * <p>
* If the {@link GLAutoDrawable} was added to a {@link GLAnimatorControl}, it is removed
* and the {@link GLAnimatorControl} added to the GLEventListenerState.
* </p>
* <p>
- * The returned GLEventListenerState instance is the {@link #isOwner() owner of the components}.
+ * The returned GLEventListenerState instance is the {@link #isOwner() owner of the components}.
* </p>
- *
+ *
* @param a {@link GLAutoDrawable} source to move components from
* @return new GLEventListenerState instance {@link #isOwner() owning} moved components.
- *
+ *
* @see #moveTo(GLAutoDrawable)
*/
public static GLEventListenerState moveFrom(GLAutoDrawable a) {
@@ -154,16 +154,16 @@ public class GLEventListenerState {
if( null != aAnim ) {
aAnimStarted = aAnim.isStarted();
aAnim.remove(a); // also handles ECT
- } else {
+ } else {
aAnimStarted = false;
}
-
+
final GLEventListenerState glls;
final NativeSurface aSurface = a.getNativeSurface();
final boolean surfaceLocked = false; // NativeSurface.LOCK_SURFACE_NOT_READY < aSurface.lockSurface();
try {
final int aSz = a.getGLEventListenerCount();
-
+
// Create new AbstractGraphicsScreen w/ cloned AbstractGraphicsDevice for future GLAutoDrawable
// allowing this AbstractGraphicsDevice to loose ownership -> not closing display/device!
final AbstractGraphicsConfiguration aCfg = aSurface.getGraphicsConfiguration();
@@ -171,7 +171,7 @@ public class GLEventListenerState {
final AbstractGraphicsDevice aDevice1 = aCfg.getScreen().getDevice();
final AbstractGraphicsDevice aDevice2 = cloneDevice(aDevice1);
aDevice1.clearHandleOwner(); // don't close device handle
- if( DEBUG ) {
+ if( DEBUG ) {
System.err.println("GLEventListenerState.moveFrom.0a: orig 0x"+Integer.toHexString(aDevice1.hashCode())+", "+aDevice1);
System.err.println("GLEventListenerState.moveFrom.0b: pres 0x"+Integer.toHexString(aDevice2.hashCode())+", "+aDevice2);
System.err.println("GLEventListenerState.moveFrom.1: "+aSurface.getClass().getName()/*+", "+aSurface*/);
@@ -203,9 +203,9 @@ public class GLEventListenerState {
}
aUpDevice2 = _aUpDevice2;
}
-
- glls = new GLEventListenerState(aUpDevice2, proxyOwnsUpstreamDevice, aDevice2, caps, a.getContext(), aSz, aAnim, aAnimStarted);
-
+
+ glls = new GLEventListenerState(aUpDevice2, proxyOwnsUpstreamDevice, aDevice2, caps, a.getContext(), aSz, aAnim, aAnimStarted);
+
//
// remove and cache all GLEventListener and their init-state
//
@@ -213,41 +213,41 @@ public class GLEventListenerState {
final GLEventListener l = a.getGLEventListener(0);
glls.listenersInit[i] = a.getGLEventListenerInitState(l);
glls.listeners[i] = a.removeGLEventListener( l );
- }
-
+ }
+
//
// trigger glFinish to sync GL ctx
//
a.invoke(true, glFinish);
-
+
a.setContext( null, false );
-
+
} finally {
if( surfaceLocked ) {
aSurface.unlockSurface();
}
- }
-
+ }
+
return glls;
}
/**
- * Moves all GLEventListenerState components to the given {@link GLAutoDrawable}
+ * Moves all GLEventListenerState components to the given {@link GLAutoDrawable}
* from this instance, while loosing {@link #isOwner() ownership}.
- * <p>
+ * <p>
* If the previous {@link GLAutoDrawable} was removed from a {@link GLAnimatorControl} by previous {@link #moveFrom(GLAutoDrawable)},
* the given {@link GLAutoDrawable} is added to the cached {@link GLAnimatorControl}.
- * This operation is skipped, if the given {@link GLAutoDrawable} is already added to a {@link GLAnimatorControl} instance.
+ * This operation is skipped, if the given {@link GLAutoDrawable} is already added to a {@link GLAnimatorControl} instance.
* </p>
* <p>
- * Note: After this operation, the GLEventListenerState reference should be released.
+ * Note: After this operation, the GLEventListenerState reference should be released.
* </p>
- *
+ *
* @param a {@link GLAutoDrawable} destination to move GLEventListenerState components to
- *
+ *
* <!-- @throws GLException if the {@link GLAutoDrawable}'s configuration is incompatible, i.e. different {@link GLCapabilitiesImmutable}. -->
* @throws GLException if this preserved {@link AbstractGraphicsDevice} is incompatible w/ the given destination one.
- *
+ *
* @see #moveFrom(GLAutoDrawable)
* @see #isOwner()
*/
@@ -261,22 +261,22 @@ public class GLEventListenerState {
if( aPaused ) {
aAnim.resume();
}
- } else {
+ } else {
aPaused = false;
}
-
+
final List<GLRunnable> aGLCmds = new ArrayList<GLRunnable>();
final int aSz = listenerCount();
-
+
final NativeSurface aSurface = a.getNativeSurface();
final boolean surfaceLocked = false; // NativeSurface.LOCK_SURFACE_NOT_READY < aSurface.lockSurface();
final boolean aRealized;
try {
-
+
final MutableGraphicsConfiguration aCfg = (MutableGraphicsConfiguration) aSurface.getGraphicsConfiguration();
/**
final GLCapabilitiesImmutable aCaps = (GLCapabilitiesImmutable) aCfg.getChosenCapabilities();
- if( caps.getVisualID(VisualIDHolder.VIDType.INTRINSIC) != aCaps.getVisualID(VisualIDHolder.VIDType.INTRINSIC) ||
+ if( caps.getVisualID(VisualIDHolder.VIDType.INTRINSIC) != aCaps.getVisualID(VisualIDHolder.VIDType.INTRINSIC) ||
caps.getVisualID(VisualIDHolder.VIDType.NATIVE) != aCaps.getVisualID(VisualIDHolder.VIDType.NATIVE) ) {
throw new GLException("Incompatible Capabilities - Prev-Holder: "+caps+", New-Holder "+caps);
} */
@@ -285,8 +285,8 @@ public class GLEventListenerState {
if( !aDevice1.getUniqueID().equals( aDevice2.getUniqueID() ) ) {
throw new GLException("Incompatible devices: Preserved <"+aDevice2.getUniqueID()+">, target <"+aDevice1.getUniqueID()+">");
}
-
- // collect optional upstream surface info
+
+ // collect optional upstream surface info
final ProxySurface aProxy;
final NativeSurface aUpSurface;
if(aSurface instanceof ProxySurface) {
@@ -302,8 +302,8 @@ public class GLEventListenerState {
}
if( null==aUpSurface && null != upstreamDevice ) {
throw new GLException("Incompatible Surface config - Has Upstream-Surface: Prev-Holder = true, New-Holder = false");
- }
-
+ }
+
// Destroy and remove currently associated GLContext, if any (will be replaced)
a.setContext( null, true );
aRealized = a.isRealized();
@@ -311,7 +311,7 @@ public class GLEventListenerState {
// Unrealize due to device dependencies of an upstream surface, e.g. EGLUpstreamSurfaceHook
a.getDelegatedDrawable().setRealized(false);
}
-
+
// Set new Screen and close previous one
{
if( DEBUG ) {
@@ -319,13 +319,13 @@ public class GLEventListenerState {
System.err.println("GLEventListenerState.moveTo.0b: pres 0x"+Integer.toHexString(aDevice2.hashCode())+", "+aDevice2);
}
DefaultGraphicsDevice.swapDeviceHandleAndOwnership(aDevice1, aDevice2);
- aDevice2.close();
+ aDevice2.close();
if( DEBUG ) {
System.err.println("GLEventListenerState.moveTo.1a: orig 0x"+Integer.toHexString(aDevice1.hashCode())+", "+aDevice1);
System.err.println("GLEventListenerState.moveTo.1b: pres 0x"+Integer.toHexString(aDevice2.hashCode())+", "+aDevice2);
}
}
-
+
// If using a ProxySurface w/ an upstream surface, set new Screen and close previous one on it
if( null != aUpSurface ) {
final MutableGraphicsConfiguration aUpCfg = (MutableGraphicsConfiguration) aUpSurface.getGraphicsConfiguration();
@@ -339,9 +339,9 @@ public class GLEventListenerState {
System.err.println("GLEventListenerState.moveTo.2a: up-orig 0x"+Integer.toHexString(aUpDevice1.hashCode())+", "+aUpDevice1);
System.err.println("GLEventListenerState.moveTo.2b: up-pres 0x"+Integer.toHexString(aUpDevice2.hashCode())+", "+aUpDevice2);
System.err.println("GLEventListenerState.moveTo.2c: "+aUpSurface.getClass().getName()/*+", "+aUpSurface+", "*/+aProxy.getUpstreamOptionBits(null).toString());
- }
+ }
DefaultGraphicsDevice.swapDeviceHandleAndOwnership(aUpDevice1, aUpDevice2);
- aUpDevice2.close();
+ aUpDevice2.close();
if( proxyOwnsUpstreamDevice ) {
aProxy.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_DEVICE );
}
@@ -354,7 +354,7 @@ public class GLEventListenerState {
throw new GLException("Incompatible Surface config - Has Upstream-Surface: Prev-Holder = false, New-Holder = true");
}
}
-
+
if( aRealized && null != aUpSurface ) {
a.getDelegatedDrawable().setRealized(true);
}
@@ -369,7 +369,7 @@ public class GLEventListenerState {
}
}
owner = false;
-
+
//
// Trigger GL-Viewport reset and reshape of all initialized GLEventListeners
//
@@ -389,7 +389,7 @@ public class GLEventListenerState {
a.setGLEventListenerInitState(l, listenersInit[i]);
listeners[i] = null;
}
-
+
if( hasAnimator ) {
// prefer already bound animator
aAnim.add(a);
@@ -410,7 +410,7 @@ public class GLEventListenerState {
public boolean run(GLAutoDrawable drawable) {
drawable.getGL().glViewport(0, 0, drawable.getWidth(), drawable.getHeight());
return true;
- }
+ }
};
public static GLRunnable glFinish = new GLRunnable() {
@@ -418,7 +418,7 @@ public class GLEventListenerState {
public boolean run(GLAutoDrawable drawable) {
drawable.getGL().glFinish();
return true;
- }
+ }
};
public static class ReshapeGLEventListener implements GLRunnable {
@@ -430,6 +430,6 @@ public class GLEventListenerState {
public boolean run(GLAutoDrawable drawable) {
listener.reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight());
return true;
- }
+ }
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/GLExtensions.java b/src/jogl/classes/com/jogamp/opengl/GLExtensions.java
index 14f4be9..c7aadcd 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLExtensions.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLExtensions.java
@@ -28,17 +28,17 @@
package com.jogamp.opengl;
/**
- * Class holding OpenGL extension strings, commonly used by JOGL's implementation.
+ * Class holding OpenGL extension strings, commonly used by JOGL's implementation.
*/
public class GLExtensions {
public static final String VERSION_1_2 = "GL_VERSION_1_2";
public static final String VERSION_1_4 = "GL_VERSION_1_4";
public static final String VERSION_1_5 = "GL_VERSION_1_5";
public static final String VERSION_2_0 = "GL_VERSION_2_0";
-
+
public static final String ARB_debug_output = "GL_ARB_debug_output";
public static final String AMD_debug_output = "GL_AMD_debug_output";
-
+
public static final String ARB_framebuffer_object = "GL_ARB_framebuffer_object";
public static final String OES_framebuffer_object = "GL_OES_framebuffer_object";
public static final String EXT_framebuffer_object = "GL_EXT_framebuffer_object";
@@ -49,17 +49,17 @@ public class GLExtensions {
public static final String OES_depth32 = "GL_OES_depth32";
public static final String OES_packed_depth_stencil = "GL_OES_packed_depth_stencil";
public static final String NV_fbo_color_attachments = "GL_NV_fbo_color_attachments";
-
+
public static final String ARB_ES2_compatibility = "GL_ARB_ES2_compatibility";
public static final String ARB_ES3_compatibility = "GL_ARB_ES3_compatibility";
-
+
public static final String EXT_abgr = "GL_EXT_abgr";
public static final String OES_rgb8_rgba8 = "GL_OES_rgb8_rgba8";
public static final String OES_stencil1 = "GL_OES_stencil1";
public static final String OES_stencil4 = "GL_OES_stencil4";
public static final String OES_stencil8 = "GL_OES_stencil8";
public static final String APPLE_float_pixels = "GL_APPLE_float_pixels";
-
+
public static final String ARB_texture_non_power_of_two = "GL_ARB_texture_non_power_of_two";
public static final String ARB_texture_rectangle = "GL_ARB_texture_rectangle";
public static final String EXT_texture_rectangle = "GL_EXT_texture_rectangle";
@@ -72,15 +72,15 @@ public class GLExtensions {
public static final String OES_read_format = "GL_OES_read_format";
public static final String OES_single_precision = "GL_OES_single_precision";
public static final String OES_EGL_image_external = "GL_OES_EGL_image_external";
-
+
public static final String ARB_gpu_shader_fp64 = "GL_ARB_gpu_shader_fp64";
- public static final String ARB_shader_objects = "GL_ARB_shader_objects";
+ public static final String ARB_shader_objects = "GL_ARB_shader_objects";
public static final String ARB_geometry_shader4 = "GL_ARB_geometry_shader4";
-
+
//
// Aliased GLX/WGL/.. extensions
//
-
- public static final String ARB_pixel_format = "GL_ARB_pixel_format";
+
+ public static final String ARB_pixel_format = "GL_ARB_pixel_format";
public static final String ARB_pbuffer = "GL_ARB_pbuffer";
}
diff --git a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
index 023a8a1..95f87be 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
@@ -27,22 +27,24 @@
*/
package com.jogamp.opengl;
-import java.util.List;
+import java.util.IdentityHashMap;
-/**
- * GLRendererQuirks contains information of known bugs of various GL renderer.
+import javax.media.nativewindow.AbstractGraphicsDevice;
+
+/**
+ * GLRendererQuirks contains information of known bugs of various GL renderer.
* This information allows us to workaround them.
* <p>
* Using centralized quirk identifier enables us to
- * locate code dealing w/ it and hence eases it's maintenance.
+ * locate code dealing w/ it and hence eases it's maintenance.
* </p>
* <p>
* <i>Some</i> <code>GL_VENDOR</code> and <code>GL_RENDERER</code> strings are
- * listed here <http://feedback.wildfiregames.com/report/opengl/feature/GL_VENDOR>.
+ * listed here <http://feedback.wildfiregames.com/report/opengl/feature/GL_VENDOR>.
* </p>
*/
public class GLRendererQuirks {
- /**
+ /**
* Crashes XServer when using double buffered PBuffer with GL_RENDERER:
* <ul>
* <li>Mesa DRI Intel(R) Sandybridge Desktop</li>
@@ -52,23 +54,23 @@ public class GLRendererQuirks {
* For now, it is safe to disable it w/ hw-acceleration.
*/
public static final int NoDoubleBufferedPBuffer = 0;
-
+
/** On Windows no double buffered bitmaps are guaranteed to be available. */
public static final int NoDoubleBufferedBitmap = 1;
/** Crashes application when trying to set EGL swap interval on Android 4.0.3 / Pandaboard ES / PowerVR SGX 540 */
public static final int NoSetSwapInterval = 2;
-
+
/** No offscreen bitmap available, currently true for JOGL's OSX implementation. */
public static final int NoOffscreenBitmap = 3;
-
+
/** SIGSEGV on setSwapInterval() after changing the context's drawable w/ 'Mesa 8.0.4' dri2SetSwapInterval/DRI2 (soft & intel) */
public static final int NoSetSwapIntervalPostRetarget = 4;
/** GLSL <code>discard</code> command leads to undefined behavior or won't get compiled if being used. Appears to <i>have</i> happened on Nvidia Tegra2, but seems to be fine now. FIXME: Constrain version. */
public static final int GLSLBuggyDiscard = 5;
-
- /**
+
+ /**
* Non compliant GL context due to a buggy implementation not suitable for use.
* <p>
* Currently, Mesa >= 9.1.3 (may extend back as far as 9.0) OpenGL 3.1 compatibility
@@ -82,19 +84,19 @@ public class GLRendererQuirks {
* </ul>
* </p>
* <p>
- * It still has to be verified whether the AMD OpenGL 3.1 core driver is compliant enought.
+ * It still has to be verified whether the AMD OpenGL 3.1 core driver is compliant enought.
*/
public static final int GLNonCompliant = 6;
-
+
/**
* The OpenGL Context needs a <code>glFlush()</code> before releasing it, otherwise driver may freeze:
* <ul>
* <li>OSX < 10.7.3 - NVidia Driver. Bug 533 and Bug 548 @ https://jogamp.org/bugzilla/.</li>
- * </ul>
+ * </ul>
*/
public static final int GLFlushBeforeRelease = 7;
-
- /**
+
+ /**
* Closing X11 displays may cause JVM crashes or X11 errors with some buggy drivers
* while being used in concert w/ OpenGL.
* <p>
@@ -123,14 +125,14 @@ public class GLRendererQuirks {
* </p>
*/
public static final int DontCloseX11Display = 8;
-
+
/**
- * Need current GL Context when calling new ARB <i>pixel format query</i> functions,
+ * Need current GL Context when calling new ARB <i>pixel format query</i> functions,
* otherwise driver crashes the VM.
* <p>
* Drivers known exposing such bug:
* <ul>
- * <li>ATI proprietary Catalyst driver on Windows version ≤ XP.
+ * <li>ATI proprietary Catalyst driver on Windows version ≤ XP.
* TODO: Validate if bug actually relates to 'old' ATI Windows drivers for old GPU's like X300
* regardless of the Windows version.</li>
* </ul>
@@ -139,7 +141,7 @@ public class GLRendererQuirks {
* </p>
*/
public static final int NeedCurrCtx4ARBPixFmtQueries = 9;
-
+
/**
* Need current GL Context when calling new ARB <i>CreateContext</i> function,
* otherwise driver crashes the VM.
@@ -159,14 +161,14 @@ public class GLRendererQuirks {
* </p>
*/
public static final int NeedCurrCtx4ARBCreateContext = 10;
-
+
/**
* No full FBO support, i.e. not compliant w/
- * <ul>
+ * <ul>
* <li>GL_ARB_framebuffer_object</li>
- * <li>EXT_framebuffer_object</li>
- * <li>EXT_framebuffer_multisample</li>
- * <li>EXT_framebuffer_blit</li>
+ * <li>EXT_framebuffer_object</li>
+ * <li>EXT_framebuffer_multisample</li>
+ * <li>EXT_framebuffer_blit</li>
* <li>EXT_packed_depth_stencil</li>
* </ul>.
* Drivers known exposing such bug:
@@ -180,19 +182,126 @@ public class GLRendererQuirks {
* Quirk can also be enabled via property: <code>jogl.fbo.force.min</code>.
*/
public static final int NoFullFBOSupport = 11;
-
-
+
+ /**
+ * GLSL is not compliant or even not stable (crash)
+ * <ul>
+ * <li>OSX < 10.7.0 (?) - NVidia Driver. Bug 818 @ https://jogamp.org/bugzilla/.</li>
+ * </ul>
+ */
+ public static final int GLSLNonCompliant = 12;
+
+ /**
+ * GL4 context needs to be requested via GL3 profile attribute
+ * <ul>
+ * <li>OSX >= 10.9.0 - kCGLOGLPVersion_GL4_Core may not produce hw-accel context. Bug 867 @ https://jogamp.org/bugzilla/.</li>
+ * </ul>
+ */
+ public static final int GL4NeedsGL3Request = 13;
+
+ /**
+ * Buggy shared OpenGL context support within a multithreaded use-case, not suitable for stable usage.
+ * <p>
+ * <i>X11 Mesa DRI Intel(R) driver >= 9.2.1</i> cannot handle multithreaded shared GLContext usage
+ * with non-blocking exclusive X11 display connections.
+ * References:
+ * <ul>
+ * <li>Bug 873: https://jogamp.org/bugzilla/show_bug.cgi?id=873</li>
+ * <li>https://bugs.freedesktop.org/show_bug.cgi?id=41736#c8</li>
+ * </ul>
+ * <p>
+ * However, not all multithreaded use-cases are broken, e.g. our GLMediaPlayer does work.
+ * </p>
+ * The above has been confirmed for the following Mesa 9.* strings:
+ * <ul>
+ * <li>GL_VENDOR Intel Open Source Technology Center</li>
+ * <li>GL_RENDERER Mesa DRI Intel(R) Sandybridge Desktop</li>
+ * <li>GL_RENDERER Mesa DRI Intel(R) Ivybridge Mobile</li>
+ * <li>GL_VERSION 3.1 (Core Profile) Mesa 9.2.1</li>
+ * </ul>
+ * </p>
+ * <p>
+ * On Android 4.*, <i>Huawei's Ascend G615 w/ Immersion.16</i> could not make a shared context
+ * current, which uses a pbuffer drawable:
+ * <ul>
+ * <li>Android 4.*</li>
+ * <li>GL_VENDOR Hisilicon Technologies</li>
+ * <li>GL_RENDERER Immersion.16</li>
+ * <li>GL_VERSION OpenGL ES 2.0</li>
+ * </ul>
+ * </p>
+ * <p>
+ * </p>
+ */
+ public static final int GLSharedContextBuggy = 14;
+
/** Number of quirks known. */
- public static final int COUNT = 12;
-
+ public static final int COUNT = 15;
+
private static final String[] _names = new String[] { "NoDoubleBufferedPBuffer", "NoDoubleBufferedBitmap", "NoSetSwapInterval",
"NoOffscreenBitmap", "NoSetSwapIntervalPostRetarget", "GLSLBuggyDiscard",
"GLNonCompliant", "GLFlushBeforeRelease", "DontCloseX11Display",
"NeedCurrCtx4ARBPixFmtQueries", "NeedCurrCtx4ARBCreateContext",
- "NoFullFBOSupport"
+ "NoFullFBOSupport", "GLSLNonCompliant", "GL4NeedsGL3Request",
+ "GLSharedContextBuggy"
};
- private final int _bitmask;
+ private static final IdentityHashMap<String, GLRendererQuirks> stickyDeviceQuirks = new IdentityHashMap<String, GLRendererQuirks>();
+
+ /**
+ * Retrieval of sticky {@link AbstractGraphicsDevice}'s {@link GLRendererQuirks}.
+ * <p>
+ * Not thread safe.
+ * </p>
+ */
+ public static GLRendererQuirks getStickyDeviceQuirks(AbstractGraphicsDevice device) {
+ final String key = device.getUniqueID();
+ final GLRendererQuirks has = stickyDeviceQuirks.get(key);
+ final GLRendererQuirks res;
+ if( null == has ) {
+ res = new GLRendererQuirks();
+ stickyDeviceQuirks.put(key, res);
+ } else {
+ res = has;
+ }
+ return res;
+ }
+
+ /**
+ * {@link #addQuirks(int[], int, int) Adding given quirks} of sticky {@link AbstractGraphicsDevice}'s {@link GLRendererQuirks}.
+ * <p>
+ * Not thread safe.
+ * </p>
+ */
+ public static void addStickyDeviceQuirks(AbstractGraphicsDevice device, int[] quirks, int offset, int len) throws IllegalArgumentException {
+ final GLRendererQuirks sq = getStickyDeviceQuirks(device);
+ sq.addQuirks(quirks, offset, len);
+ }
+ /**
+ * {@link #exist(int) Query} of sticky {@link AbstractGraphicsDevice}'s {@link GLRendererQuirks}.
+ * <p>
+ * Not thread safe. However, use after changing the sticky quirks is safe.
+ * </p>
+ */
+ public static boolean existStickyDeviceQuirk(AbstractGraphicsDevice device, int quirk) {
+ return getStickyDeviceQuirks(device).exist(quirk);
+ }
+ /**
+ * {@link #addQuirks(GLRendererQuirks) Pushing} the sticky {@link AbstractGraphicsDevice}'s {@link GLRendererQuirks}
+ * to the given {@link GLRendererQuirks destination}.
+ * <p>
+ * Not thread safe. However, use after changing the sticky quirks is safe.
+ * </p>
+ */
+ public static void pushStickyDeviceQuirks(AbstractGraphicsDevice device, GLRendererQuirks dest) {
+ dest.addQuirks(getStickyDeviceQuirks(device));
+ }
+
+ private int _bitmask;
+
+ public GLRendererQuirks() {
+ _bitmask = 0;
+ }
/**
* @param quirks an array of valid quirks
@@ -201,6 +310,17 @@ public class GLRendererQuirks {
* @throws IllegalArgumentException if one of the quirks is out of range
*/
public GLRendererQuirks(int[] quirks, int offset, int len) throws IllegalArgumentException {
+ this();
+ addQuirks(quirks, offset, len);
+ }
+
+ /**
+ * @param quirks an array of valid quirks to be added
+ * @param offset offset in quirks array to start reading
+ * @param len number of quirks to read from offset within quirks array
+ * @throws IllegalArgumentException if one of the quirks is out of range
+ */
+ public final void addQuirks(int[] quirks, int offset, int len) throws IllegalArgumentException {
int bitmask = 0;
if( !( 0 <= offset + len && offset + len < quirks.length ) ) {
throw new IllegalArgumentException("offset and len out of bounds: offset "+offset+", len "+len+", array-len "+quirks.length);
@@ -210,23 +330,16 @@ public class GLRendererQuirks {
validateQuirk(quirk);
bitmask |= 1 << quirk;
}
- _bitmask = bitmask;
- }
+ _bitmask |= bitmask;
+ }
/**
- * @param quirks a list of valid quirks
- * @throws IllegalArgumentException if one of the quirks is out of range
+ * @param quirks valid GLRendererQuirks to be added
*/
- public GLRendererQuirks(List<Integer> quirks) throws IllegalArgumentException {
- int bitmask = 0;
- for(int i=0; i<quirks.size(); i++) {
- final int quirk = quirks.get(i);
- validateQuirk(quirk);
- bitmask |= 1 << quirk;
- }
- _bitmask = bitmask;
+ public final void addQuirks(GLRendererQuirks quirks) {
+ _bitmask |= quirks._bitmask;
}
-
+
/**
* @param quirk the quirk to be tested
* @return true if quirk exist, otherwise false
@@ -254,7 +367,8 @@ public class GLRendererQuirks {
sb.append("]");
return sb;
}
-
+
+ @Override
public final String toString() {
return toString(null).toString();
}
@@ -266,7 +380,7 @@ public class GLRendererQuirks {
public static void validateQuirk(int quirk) throws IllegalArgumentException {
if( !( 0 <= quirk && quirk < COUNT ) ) {
throw new IllegalArgumentException("Quirks must be in range [0.."+COUNT+"[, but quirk: "+quirk);
- }
+ }
}
/**
diff --git a/src/jogl/classes/com/jogamp/opengl/GLStateKeeper.java b/src/jogl/classes/com/jogamp/opengl/GLStateKeeper.java
index 321d4ee..2b452e1 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLStateKeeper.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLStateKeeper.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -31,12 +31,12 @@ package com.jogamp.opengl;
* Interface adding a {@link GLEventListenerState} protocol to {@link GLAutoDrawable}s
* or other self-contained compound types combining {@link GLDrawable}, {@link GLContext} and {@link GLEventListener}.
* <p>
- * Implementing classes {@link #isGLStatePreservationSupported() may support} preservation
- * of the {@link GLContext} state and it's associated {@link GLEventListener}.
- * </p>
+ * Implementing classes {@link #isGLStatePreservationSupported() may support} preservation
+ * of the {@link GLContext} state and it's associated {@link GLEventListener}.
+ * </p>
*/
public interface GLStateKeeper {
-
+
/** Listener for preserve and restore notifications. */
public static interface Listener {
/** Invoked before preservation. */
@@ -44,14 +44,14 @@ public interface GLStateKeeper {
/** Invoked after restoration. */
void glStateRestored(GLStateKeeper glsk);
}
-
- /**
+
+ /**
* Sets a {@link Listener}, overriding the old one.
* @param l the new {@link Listener}.
* @return the previous {@link Listener}.
*/
public Listener setGLStateKeeperListener(Listener l);
-
+
/**
* @return <code>true</code> if GL state preservation is supported in implementation and on current platform, <code>false</code> otherwise.
* @see #preserveGLStateAtDestroy(boolean)
@@ -59,17 +59,17 @@ public interface GLStateKeeper {
* @see #clearPreservedGLState()
*/
public boolean isGLStatePreservationSupported();
-
+
/**
* If set to <code>true</code>, the next {@link GLAutoDrawable#destroy()} operation will
- * {@link #pullGLEventListenerState() pull} to preserve the {@link GLEventListenerState}.
+ * {@link #preserveGLEventListenerState() preserve} the {@link GLEventListenerState}.
* <p>
* This is a one-shot flag, i.e. after preserving the {@link GLEventListenerState},
* the flag is cleared.
* </p>
* <p>
- * A preserved {@link GLEventListenerState} will be {@link #pushGLEventListenerState() pushed}
- * if realized again.
+ * A preserved {@link GLEventListenerState} will be
+ * {@link #restoreGLEventListenerState() restored} again.
* </p>
* @return <code>true</code> if supported and successful, <code>false</code> otherwise.
* @see #isGLStatePreservationSupported()
@@ -77,21 +77,21 @@ public interface GLStateKeeper {
* @see #clearPreservedGLState()
*/
public boolean preserveGLStateAtDestroy(boolean value);
-
+
/**
* Returns the preserved {@link GLEventListenerState} if preservation was performed,
- * otherwise <code>null</code>.
+ * otherwise <code>null</code>.
* @see #isGLStatePreservationSupported()
* @see #preserveGLStateAtDestroy(boolean)
* @see #clearPreservedGLState()
*/
public GLEventListenerState getPreservedGLState();
-
+
/**
* Clears the preserved {@link GLEventListenerState} from this {@link GLStateKeeper}, without destroying it.
- *
+ *
* @return the preserved and cleared {@link GLEventListenerState} if preservation was performed,
- * otherwise <code>null</code>.
+ * otherwise <code>null</code>.
* @see #isGLStatePreservationSupported()
* @see #preserveGLStateAtDestroy(boolean)
* @see #getPreservedGLState()
diff --git a/src/jogl/classes/com/jogamp/opengl/GenericGLCapabilitiesChooser.java b/src/jogl/classes/com/jogamp/opengl/GenericGLCapabilitiesChooser.java
index 73ec108..3693f64 100644
--- a/src/jogl/classes/com/jogamp/opengl/GenericGLCapabilitiesChooser.java
+++ b/src/jogl/classes/com/jogamp/opengl/GenericGLCapabilitiesChooser.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -37,7 +37,7 @@ import javax.media.opengl.DefaultGLCapabilitiesChooser;
* otherwise uses {@link DefaultGLCapabilitiesChooser} implementation.
*/
public class GenericGLCapabilitiesChooser extends DefaultGLCapabilitiesChooser {
-
+
@Override
public int chooseCapabilities(final CapabilitiesImmutable desired,
final List<? extends CapabilitiesImmutable> available,
diff --git a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java
index 1f0189a..40f0d18 100644
--- a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java
+++ b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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;
import com.jogamp.common.GlueGenVersion;
@@ -90,16 +90,16 @@ public class JoglVersion extends JogampVersion {
sb.append("\tnone").append(Platform.getNewline());
}
sb.append(Platform.getNewline());
- return sb;
+ return sb;
}
-
+
public static StringBuilder getAllAvailableCapabilitiesInfo(AbstractGraphicsDevice device, StringBuilder sb) {
if(null==sb) {
sb = new StringBuilder();
}
if(null == device) {
device = GLProfile.getDefaultDevice();
- }
+ }
sb.append(Platform.getNewline()).append(Platform.getNewline());
sb.append("Desktop Capabilities: ").append(Platform.getNewline());
getAvailableCapabilitiesInfo(GLDrawableFactory.getDesktopFactory(), device, sb);
@@ -107,7 +107,7 @@ public class JoglVersion extends JogampVersion {
getAvailableCapabilitiesInfo(GLDrawableFactory.getEGLFactory(), device, sb);
return sb;
}
-
+
public static StringBuilder getDefaultOpenGLInfo(AbstractGraphicsDevice device, StringBuilder sb, boolean withCapabilitiesInfo) {
if(null==sb) {
sb = new StringBuilder();
@@ -115,7 +115,7 @@ public class JoglVersion extends JogampVersion {
if(null == device) {
device = GLProfile.getDefaultDevice();
}
- sb.append("Default Profiles on device ").append(device).append(Platform.getNewline());
+ sb.append("GLProfiles on device ").append(device).append(Platform.getNewline());
if(null!=device) {
GLProfile.glAvailabilityToString(device, sb, "\t", 1);
} else {
@@ -126,7 +126,7 @@ public class JoglVersion extends JogampVersion {
}
return sb;
}
-
+
public static StringBuilder getGLInfo(GL gl, StringBuilder sb) {
return getGLInfo(gl, sb, false);
}
@@ -136,26 +136,26 @@ public class JoglVersion extends JogampVersion {
if(null==sb) {
sb = new StringBuilder();
}
-
+
sb.append(VersionUtil.SEPERATOR).append(Platform.getNewline());
sb.append(device.getClass().getSimpleName()).append("[type ")
.append(device.getType()).append(", connection ").append(device.getConnection()).append("]: ").append(Platform.getNewline());
- GLProfile.glAvailabilityToString(device, sb, "\t", 1);
+ GLProfile.glAvailabilityToString(device, sb, "\t", 1);
sb.append(Platform.getNewline());
sb = getGLStrings(gl, sb, withCapabilitiesAndExtensionInfo);
-
+
if( withCapabilitiesAndExtensionInfo ) {
- sb = getAllAvailableCapabilitiesInfo(device, sb);
+ sb = getAllAvailableCapabilitiesInfo(device, sb);
}
return sb;
}
-
+
public static StringBuilder getGLStrings(GL gl, StringBuilder sb) {
return getGLStrings(gl, sb, true);
}
-
- public static StringBuilder getGLStrings(GL gl, StringBuilder sb, boolean withExtensions) {
+
+ public static StringBuilder getGLStrings(GL gl, StringBuilder sb, boolean withExtensions) {
if(null==sb) {
sb = new StringBuilder();
}
@@ -175,7 +175,7 @@ public class JoglVersion extends JogampVersion {
sb.append("GL_RENDERER ").append(gl.glGetString(GL.GL_RENDERER));
sb.append(Platform.getNewline());
sb.append("GL_VERSION ").append(gl.glGetString(GL.GL_VERSION));
- sb.append(Platform.getNewline());
+ sb.append(Platform.getNewline());
sb.append("GLSL ").append(gl.hasGLSL()).append(", has-compiler-func: ").append(gl.isFunctionAvailable("glCompileShader"));
if(gl.hasGLSL()) {
sb.append(", version: ").append(gl.glGetString(GL2ES2.GL_SHADING_LANGUAGE_VERSION)).append(" / ").append(ctx.getGLSLVersionNumber());
@@ -200,7 +200,7 @@ public class JoglVersion extends JogampVersion {
return sb;
}
- public StringBuilder getBriefOSGLBuildInfo(GL gl, StringBuilder sb) {
+ public StringBuilder getBriefOSGLBuildInfo(GL gl, StringBuilder sb) {
if(null==sb) {
sb = new StringBuilder();
}
@@ -216,7 +216,7 @@ public class JoglVersion extends JogampVersion {
sb.append(Platform.getNewline());
return sb;
}
-
+
public static void main(String args[]) {
System.err.println(VersionUtil.getPlatformInfo());
System.err.println(GlueGenVersion.getInstance());
diff --git a/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java b/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java
index ca48469..4270607 100644
--- a/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.cg;
import com.jogamp.common.jvm.JNILibLoaderBase;
@@ -43,17 +43,18 @@ public final class CgDynamicLibraryBundleInfo implements DynamicLibraryBundleInf
private static final List<String> glueLibNames;
static {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
Platform.initSingleton();
-
+
if(TempJarCache.isInitialized()) {
// only: jogl-cg.jar -> jogl-cg-natives-<os.and.arch>.jar [atomic JAR files only]
- JNILibLoaderBase.addNativeJarLibs(new Class<?>[] { CgDynamicLibraryBundleInfo.class }, null, null );
+ JNILibLoaderBase.addNativeJarLibs(new Class<?>[] { CgDynamicLibraryBundleInfo.class }, null, null );
}
return null;
}
});
-
+
glueLibNames = new ArrayList<String>();
// glueLibNames.addAll(getGlueLibNamesPreload());
glueLibNames.add("jogl_cg");
@@ -76,7 +77,7 @@ public final class CgDynamicLibraryBundleInfo implements DynamicLibraryBundleInf
* <p>
* Returns <code>false</code>.
* </p>
- */
+ */
@Override
public final boolean shallLookupGlobal() { return false; }
@@ -91,7 +92,7 @@ public final class CgDynamicLibraryBundleInfo implements DynamicLibraryBundleInf
public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) {
return 0;
}
-
+
@Override
public final boolean useToolGetProcAdressFirst(String funcName) {
return false;
@@ -103,7 +104,7 @@ public final class CgDynamicLibraryBundleInfo implements DynamicLibraryBundleInf
final List<String> libsCg = new ArrayList<String>();
libsCg.add("Cg");
libsList.add(libsCg);
-
+
final List<String> libsCgGL = new ArrayList<String>();
libsCgGL.add("CgGL");
libsList.add(libsCgGL);
@@ -119,7 +120,7 @@ public final class CgDynamicLibraryBundleInfo implements DynamicLibraryBundleInf
@Override
public final RunnableExecutor getLibLoaderExecutor() {
return DynamicLibraryBundle.getDefaultRunnableExecutor();
- }
+ }
}
diff --git a/src/jogl/classes/com/jogamp/opengl/cg/CgException.java b/src/jogl/classes/com/jogamp/opengl/cg/CgException.java
index 8bfd9e2..3e42f4d 100644
--- a/src/jogl/classes/com/jogamp/opengl/cg/CgException.java
+++ b/src/jogl/classes/com/jogamp/opengl/cg/CgException.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/math/Binary16.java b/src/jogl/classes/com/jogamp/opengl/math/Binary16.java
new file mode 100644
index 0000000..33add46
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/math/Binary16.java
@@ -0,0 +1,569 @@
+/**
+ * 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.
+ */
+
+package com.jogamp.opengl.math;
+
+/**
+ * <p>
+ * Functions to convert values to/from the <code>binary16</code> format
+ * specified in <code>IEEE 754 2008</code>.
+ * </p>
+ */
+
+public final class Binary16
+{
+ /**
+ * The encoded form of negative infinity <code>-∞</code>.
+ */
+
+ public static final char NEGATIVE_INFINITY;
+
+ /**
+ * The encoded form of positive infinity <code>∞</code>.
+ */
+
+ public static final char POSITIVE_INFINITY;
+
+ /**
+ * The encoded form of positive zero <code>0</code>.
+ */
+
+ public static final char POSITIVE_ZERO;
+
+ /**
+ * The encoded form of negative zero <code>-0</code>.
+ */
+
+ public static final char NEGATIVE_ZERO;
+
+ /**
+ * The <i>bias</i> value used to offset the encoded exponent. A given
+ * exponent <code>e</code> is encoded as <code>{@link #BIAS} + e</code>.
+ */
+
+ public static final int BIAS;
+
+ static {
+ NEGATIVE_INFINITY = 0xFC00;
+ POSITIVE_INFINITY = 0x7C00;
+ POSITIVE_ZERO = 0x0000;
+ NEGATIVE_ZERO = 0x8000;
+ BIAS = 15;
+ }
+
+ private static final int MASK_SIGN;
+ private static final int MASK_EXPONENT;
+ private static final int MASK_SIGNIFICAND;
+
+ static {
+ MASK_SIGN = 0x8000;
+ MASK_EXPONENT = 0x7C00;
+ MASK_SIGNIFICAND = 0x03FF;
+ }
+
+ /**
+ * One possible not-a-number value.
+ */
+
+ public static char exampleNaN()
+ {
+ final int n =
+ Binary16.packSetExponentUnbiasedUnchecked(16)
+ | Binary16.packSetSignificandUnchecked(1);
+ final char c = (char) n;
+ return c;
+ }
+
+ /**
+ * Return <code>true</code> if the given packed <code>binary16</code> value
+ * is infinite.
+ */
+
+ public static boolean isInfinite(
+ final char k)
+ {
+ if (Binary16.unpackGetExponentUnbiased(k) == 16) {
+ if (Binary16.unpackGetSignificand(k) == 0) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Return <code>true</code> if the given packed <code>binary16</code> value
+ * is not a number (<code>NaN</code>).
+ */
+
+ public static boolean isNaN(
+ final char k)
+ {
+ final int e = Binary16.unpackGetExponentUnbiased(k);
+ final int s = Binary16.unpackGetSignificand(k);
+ return (e == 16) && (s > 0);
+ }
+
+ /**
+ * <p>
+ * Convert a double precision floating point value to a packed
+ * <code>binary16</code> value.
+ * </p>
+ * <p>
+ * For the following specific cases, the function returns:
+ * </p>
+ * <ul>
+ * <li><code>NaN</code> iff <code>isNaN(k)</code></li>
+ * <li>{@link #POSITIVE_INFINITY} iff
+ * <code>k == {@link Double#POSITIVE_INFINITY}</code></li>
+ * <li>{@link #NEGATIVE_INFINITY} iff
+ * <code>k == {@link Double#NEGATIVE_INFINITY}</code></li>
+ * <li>{@link #NEGATIVE_ZERO} iff <code>k == -0.0</code></li>
+ * <li>{@link #POSITIVE_ZERO} iff <code>k == 0.0</code></li>
+ * </ul>
+ * <p>
+ * Otherwise, the <code>binary16</code> value that most closely represents
+ * <code>k</code> is returned. This may obviously be an infinite value as
+ * the interval of double precision values is far larger than that of the
+ * <code>binary16</code> type.
+ * </p>
+ *
+ * @see #unpackDouble(char)
+ */
+
+ public static char packDouble(
+ final double k)
+ {
+ if (Double.isNaN(k)) {
+ return Binary16.exampleNaN();
+ }
+ if (k == Double.POSITIVE_INFINITY) {
+ return Binary16.POSITIVE_INFINITY;
+ }
+ if (k == Double.NEGATIVE_INFINITY) {
+ return Binary16.NEGATIVE_INFINITY;
+ }
+ if (Double.doubleToLongBits(k) == Binary64.NEGATIVE_ZERO_BITS) {
+ return Binary16.NEGATIVE_ZERO;
+ }
+ if (k == 0.0) {
+ return Binary16.POSITIVE_ZERO;
+ }
+
+ final long de = Binary64.unpackGetExponentUnbiased(k);
+ final long ds = Binary64.unpackGetSign(k);
+ final long dn = Binary64.unpackGetSignificand(k);
+ final char rsr = Binary16.packSetSignUnchecked((int) ds);
+
+ /**
+ * Extract the 5 least-significant bits of the exponent.
+ */
+
+ final int rem = (int) (de & 0x001F);
+ final char rer = Binary16.packSetExponentUnbiasedUnchecked(rem);
+
+ /**
+ * Extract the 10 most-significant bits of the significand.
+ */
+
+ final long rnm = dn & 0xFFC0000000000L;
+ final long rns = rnm >> 42;
+ final char rnr = Binary16.packSetSignificandUnchecked((int) rns);
+
+ /**
+ * Combine the results.
+ */
+
+ return (char) (rsr | rer | rnr);
+ }
+
+ /**
+ * <p>
+ * Convert a single precision floating point value to a packed
+ * <code>binary16</code> value.
+ * </p>
+ * <p>
+ * For the following specific cases, the function returns:
+ * </p>
+ * <ul>
+ * <li><code>NaN</code> iff <code>isNaN(k)</code></li>
+ * <li>{@link #POSITIVE_INFINITY} iff
+ * <code>k == {@link Float#POSITIVE_INFINITY}</code></li>
+ * <li>{@link #NEGATIVE_INFINITY} iff
+ * <code>k == {@link Float#NEGATIVE_INFINITY}</code></li>
+ * <li>{@link #NEGATIVE_ZERO} iff <code>k == -0.0</code></li>
+ * <li>{@link #POSITIVE_ZERO} iff <code>k == 0.0</code></li>
+ * </ul>
+ * <p>
+ * Otherwise, the <code>binary16</code> value that most closely represents
+ * <code>k</code> is returned. This may obviously be an infinite value as
+ * the interval of single precision values is far larger than that of the
+ * <code>binary16</code> type.
+ * </p>
+ *
+ * @see #unpackFloat(char)
+ */
+
+ public static char packFloat(
+ final float k)
+ {
+ if (Float.isNaN(k)) {
+ return Binary16.exampleNaN();
+ }
+ if (k == Float.POSITIVE_INFINITY) {
+ return Binary16.POSITIVE_INFINITY;
+ }
+ if (k == Float.NEGATIVE_INFINITY) {
+ return Binary16.NEGATIVE_INFINITY;
+ }
+ if (Float.floatToIntBits(k) == Binary32.NEGATIVE_ZERO_BITS) {
+ return Binary16.NEGATIVE_ZERO;
+ }
+ if (k == 0.0) {
+ return Binary16.POSITIVE_ZERO;
+ }
+
+ final long de = Binary32.unpackGetExponentUnbiased(k);
+ final long ds = Binary32.unpackGetSign(k);
+ final long dn = Binary32.unpackGetSignificand(k);
+ final char rsr = Binary16.packSetSignUnchecked((int) ds);
+
+ /**
+ * Extract the 5 least-significant bits of the exponent.
+ */
+
+ final int rem = (int) (de & 0x001F);
+ final char rer = Binary16.packSetExponentUnbiasedUnchecked(rem);
+
+ /**
+ * Extract the 10 most-significant bits of the significand.
+ */
+
+ final long rnm = dn & 0x7FE000L;
+ final long rns = rnm >> 13;
+ final char rnr = Binary16.packSetSignificandUnchecked((int) rns);
+
+ /**
+ * Combine the results.
+ */
+
+ return (char) (rsr | rer | rnr);
+ }
+
+ /**
+ * <p>
+ * Encode the unbiased exponent <code>e</code>. Values should be in the
+ * range <code>[-15, 16]</code> - values outside of this range will be
+ * truncated.
+ * </p>
+ *
+ * @see #unpackGetExponentUnbiased(char)
+ */
+
+ public static char packSetExponentUnbiasedUnchecked(
+ final int e)
+ {
+ final int eb = e + Binary16.BIAS;
+ final int es = eb << 10;
+ final int em = es & Binary16.MASK_EXPONENT;
+ return (char) em;
+ }
+
+ /**
+ * <p>
+ * Encode the significand <code>s</code>. Values should be in the range
+ * <code>[0, 1023]</code>. Values outside of this range will be truncated.
+ * </p>
+ *
+ * @see #unpackGetSignificand(char)
+ */
+
+ public static char packSetSignificandUnchecked(
+ final int s)
+ {
+ final int sm = s & Binary16.MASK_SIGNIFICAND;
+ return (char) sm;
+ }
+
+ /**
+ * <p>
+ * Encode the sign bit <code>s</code>. Values should be in the range
+ * <code>[0, 1]</code>, with <code>0</code> ironically denoting a positive
+ * value. Values outside of this range will be truncated.
+ * </p>
+ *
+ * @see #unpackGetSign(char)
+ */
+
+ public static char packSetSignUnchecked(
+ final int s)
+ {
+ final int ss = s << 15;
+ final int sm = ss & Binary16.MASK_SIGN;
+ return (char) sm;
+ }
+
+ /**
+ * Show the given raw packed <code>binary16</code> value as a string of
+ * binary digits.
+ */
+
+ public static String toRawBinaryString(
+ final char k)
+ {
+ final StringBuilder b = new StringBuilder();
+ int z = k;
+ for (int i = 0; i < 16; ++i) {
+ if ((z & 1) == 1) {
+ b.insert(0, "1");
+ } else {
+ b.insert(0, "0");
+ }
+ z >>= 1;
+ }
+ return b.toString();
+ }
+
+ /**
+ * <p>
+ * Convert a packed <code>binary16</code> value <code>k</code> to a
+ * double-precision floating point value.
+ * </p>
+ * <p>
+ * The function returns:
+ * </p>
+ * <ul>
+ * <li><code>NaN</code> iff <code>isNaN(k)</code></li>
+ * <li>{@link Double#POSITIVE_INFINITY} iff
+ * <code>k == {@link #POSITIVE_INFINITY}</code></li>
+ * <li>{@link Double#NEGATIVE_INFINITY} iff
+ * <code>k == {@link #NEGATIVE_INFINITY}</code></li>
+ * <li><code>-0.0</code> iff <code>k == {@link #NEGATIVE_ZERO}</code></li>
+ * <li><code>0.0</code> iff <code>k == {@link #POSITIVE_ZERO}</code></li>
+ * <li><code>(-1.0 * n) * (2 ^ e) * 1.s</code>, for the decoded sign
+ * <code>n</code> of <code>k</code>, the decoded exponent <code>e</code> of
+ * <code>k</code>, and the decoded significand <code>s</code> of
+ * <code>k</code>.</li>
+ * </ul>
+ *
+ * @see #packDouble(double)
+ */
+
+ public static double unpackDouble(
+ final char k)
+ {
+ if (Binary16.isNaN(k)) {
+ return Double.NaN;
+ }
+ if (k == Binary16.POSITIVE_INFINITY) {
+ return Double.POSITIVE_INFINITY;
+ }
+ if (k == Binary16.NEGATIVE_INFINITY) {
+ return Double.NEGATIVE_INFINITY;
+ }
+ if (k == Binary16.NEGATIVE_ZERO) {
+ return -0.0;
+ }
+ if (k == Binary16.POSITIVE_ZERO) {
+ return 0.0;
+ }
+
+ final long e = Binary16.unpackGetExponentUnbiased(k);
+ final long s = Binary16.unpackGetSign(k);
+ final long n = Binary16.unpackGetSignificand(k);
+
+ /**
+ * Shift the sign bit to the position at which it will appear in the
+ * resulting value.
+ */
+
+ final long rsr = s << 63;
+
+ /**
+ * 1. Bias the exponent.
+ *
+ * 2. Shift the result left to the position at which it will appear in the
+ * resulting value.
+ */
+
+ final long reb = (e + Binary64.BIAS);
+ final long rer = reb << 52;
+
+ /**
+ * Shift the significand left to the position at which it will appear in
+ * the resulting value.
+ */
+
+ final long rnr = n << 42;
+ return Double.longBitsToDouble(rsr | rer | rnr);
+ }
+
+ /**
+ * <p>
+ * Convert a packed <code>binary16</code> value <code>k</code> to a
+ * single-precision floating point value.
+ * </p>
+ * <p>
+ * The function returns:
+ * </p>
+ * <ul>
+ * <li><code>NaN</code> iff <code>isNaN(k)</code></li>
+ * <li>{@link Float#POSITIVE_INFINITY} iff
+ * <code>k == {@link #POSITIVE_INFINITY}</code></li>
+ * <li>{@link Float#NEGATIVE_INFINITY} iff
+ * <code>k == {@link #NEGATIVE_INFINITY}</code></li>
+ * <li><code>-0.0</code> iff <code>k == {@link #NEGATIVE_ZERO}</code></li>
+ * <li><code>0.0</code> iff <code>k == {@link #POSITIVE_ZERO}</code></li>
+ * <li><code>(-1.0 * n) * (2 ^ e) * 1.s</code>, for the decoded sign
+ * <code>n</code> of <code>k</code>, the decoded exponent <code>e</code> of
+ * <code>k</code>, and the decoded significand <code>s</code> of
+ * <code>k</code>.</li>
+ * </ul>
+ *
+ * @see #packFloat(float)
+ */
+
+ public static float unpackFloat(
+ final char k)
+ {
+ if (Binary16.isNaN(k)) {
+ return Float.NaN;
+ }
+ if (k == Binary16.POSITIVE_INFINITY) {
+ return Float.POSITIVE_INFINITY;
+ }
+ if (k == Binary16.NEGATIVE_INFINITY) {
+ return Float.NEGATIVE_INFINITY;
+ }
+ if (k == Binary16.NEGATIVE_ZERO) {
+ return -0.0f;
+ }
+ if (k == Binary16.POSITIVE_ZERO) {
+ return 0.0f;
+ }
+
+ final int e = Binary16.unpackGetExponentUnbiased(k);
+ final int s = Binary16.unpackGetSign(k);
+ final int n = Binary16.unpackGetSignificand(k);
+
+ /**
+ * Shift the sign bit to the position at which it will appear in the
+ * resulting value.
+ */
+
+ final int rsr = s << 31;
+
+ /**
+ * 1. Bias the exponent.
+ *
+ * 2. Shift the result left to the position at which it will appear in the
+ * resulting value.
+ */
+
+ final int reb = (e + Binary32.BIAS);
+ final int rer = reb << 23;
+
+ /**
+ * Shift the significand left to the position at which it will appear in
+ * the resulting value.
+ */
+
+ final int rnr = n << 13;
+ return Float.intBitsToFloat(rsr | rer | rnr);
+ }
+
+ /**
+ * <p>
+ * Extract and unbias the exponent of the given packed <code>binary16</code>
+ * value.
+ * </p>
+ * <p>
+ * The exponent is encoded <i>biased</i> as a number in the range
+ * <code>[0, 31]</code>, with <code>0</code> indicating that the number is
+ * <i>subnormal</i> and <code>[1, 30]</code> denoting the actual exponent
+ * plus {@link #BIAS}. Infinite and <code>NaN</code> values always have an
+ * exponent of <code>31</code>.
+ * </p>
+ * <p>
+ * This function will therefore return:
+ * </p>
+ * <ul>
+ * <li>
+ * <code>0 - {@link #BIAS} = -15</code> iff the input is a <i>subnormal</i>
+ * number.</li>
+ * <li>An integer in the range
+ * <code>[1 - {@link #BIAS}, 30 - {@link #BIAS}] = [-14, 15]</code> iff the
+ * input is a <i>normal</i> number.</li>
+ * <li>
+ * <code>16</code> iff the input is {@link #POSITIVE_INFINITY},
+ * {@link #NEGATIVE_INFINITY}, or <code>NaN</code>.</li>
+ * </ul>
+ *
+ * @see #packSetExponentUnbiasedUnchecked(int)
+ */
+
+ public static int unpackGetExponentUnbiased(
+ final char k)
+ {
+ final int em = k & Binary16.MASK_EXPONENT;
+ final int es = em >> 10;
+ return es - Binary16.BIAS;
+ }
+
+ /**
+ * Retrieve the sign bit of the given packed <code>binary16</code> value, as
+ * an integer in the range <code>[0, 1]</code>.
+ *
+ * @see Binary16#packSetSignUnchecked(int)
+ */
+
+ public static int unpackGetSign(
+ final char k)
+ {
+ return (k & Binary16.MASK_SIGN) >> 15;
+ }
+
+ /**
+ * <p>
+ * Return the significand of the given packed <code>binary16</code> value as
+ * an integer in the range <code>[0, 1023]</code>.
+ * </p>
+ *
+ * @see Binary16#packSetSignificandUnchecked(int)
+ */
+
+ public static int unpackGetSignificand(
+ final char k)
+ {
+ return k & Binary16.MASK_SIGNIFICAND;
+ }
+
+ private Binary16()
+ {
+ throw new AssertionError("Unreachable code, report this bug!");
+ }
+}
diff --git a/src/jogl/classes/com/jogamp/opengl/math/Binary32.java b/src/jogl/classes/com/jogamp/opengl/math/Binary32.java
new file mode 100644
index 0000000..d98815d
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/math/Binary32.java
@@ -0,0 +1,116 @@
+/**
+ * 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.
+ */
+
+package com.jogamp.opengl.math;
+
+/**
+ * Functions for interrogating <code>binary32</code> (float) values.
+ */
+
+public final class Binary32
+{
+ static final int NEGATIVE_ZERO_BITS;
+ static final int MASK_SIGN;
+ static final int MASK_EXPONENT;
+ static final int MASK_SIGNIFICAND;
+ static final int BIAS;
+
+ static {
+ NEGATIVE_ZERO_BITS = 0x80000000;
+ MASK_SIGN = 0x80000000;
+ MASK_EXPONENT = 0x7ff00000;
+ MASK_SIGNIFICAND = 0x7fffff;
+ BIAS = 127;
+ }
+
+ /**
+ * <p>
+ * Extract and unbias the exponent of the given packed <code>float</code>
+ * value.
+ * </p>
+ * <p>
+ * The exponent is encoded <i>biased</i> as a number in the range
+ * <code>[0, 255]</code>, with <code>0</code> indicating that the number is
+ * <i>subnormal</i> and <code>[1, 254]</code> denoting the actual exponent
+ * plus {@link #BIAS}. Infinite and <code>NaN</code> values always have a
+ * biased exponent of <code>255</code>.
+ * </p>
+ * <p>
+ * This function will therefore return:
+ * </p>
+ * <ul>
+ * <li>
+ * <code>0 - {@link #BIAS} = -127</code> iff the input is a <i>subnormal</i>
+ * number.</li>
+ * <li>An integer in the range
+ * <code>[1 - {@link #BIAS}, 254 - {@link #BIAS}] = [-126, 127]</code> iff
+ * the input is a <i>normal</i> number.</li>
+ * <li>
+ * <code>255 - {@link #BIAS} = 128</code> iff the input is
+ * {@link #POSITIVE_INFINITY}, {@link #NEGATIVE_INFINITY}, or
+ * <code>NaN</code>.</li>
+ * </ul>
+ *
+ * @see #packSetExponentUnbiasedUnchecked(int)
+ */
+
+ public static int unpackGetExponentUnbiased(
+ final float d)
+ {
+ final int b = Float.floatToRawIntBits(d);
+ final int em = b & Binary32.MASK_EXPONENT;
+ final int es = em >> 23;
+ return es - Binary32.BIAS;
+ }
+
+ /**
+ * <p>
+ * Return the sign of the given float value.
+ * </p>
+ */
+
+ public static int unpackGetSign(
+ final float d)
+ {
+ final int b = Float.floatToRawIntBits(d);
+ return ((b & Binary32.MASK_SIGN) >> 31) & 1;
+ }
+
+ /**
+ * <p>
+ * Return the significand of the given float value.
+ * </p>
+ */
+
+ public static int unpackGetSignificand(
+ final float d)
+ {
+ final int b = Float.floatToRawIntBits(d);
+ return b & Binary32.MASK_SIGNIFICAND;
+ }
+}
diff --git a/src/jogl/classes/com/jogamp/opengl/math/Binary64.java b/src/jogl/classes/com/jogamp/opengl/math/Binary64.java
new file mode 100644
index 0000000..5efad43
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/math/Binary64.java
@@ -0,0 +1,116 @@
+/**
+ * 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.
+ */
+
+package com.jogamp.opengl.math;
+
+/**
+ * Functions for interrogating <code>binary64</code> (double) values.
+ */
+
+public final class Binary64
+{
+ static final long NEGATIVE_ZERO_BITS;
+ static final long MASK_SIGN;
+ static final long MASK_EXPONENT;
+ static final long MASK_SIGNIFICAND;
+ static final long BIAS;
+
+ static {
+ NEGATIVE_ZERO_BITS = 0x8000000000000000L;
+ MASK_SIGN = 0x8000000000000000L;
+ MASK_EXPONENT = 0x7ff0000000000000L;
+ MASK_SIGNIFICAND = 0x000fffffffffffffL;
+ BIAS = 1023;
+ }
+
+ /**
+ * <p>
+ * Extract and unbias the exponent of the given packed <code>double</code>
+ * value.
+ * </p>
+ * <p>
+ * The exponent is encoded <i>biased</i> as a number in the range
+ * <code>[0, 2047]</code>, with <code>0</code> indicating that the number is
+ * <i>subnormal</i> and <code>[1, 2046]</code> denoting the actual exponent
+ * plus {@link #BIAS}. Infinite and <code>NaN</code> values always have a
+ * biased exponent of <code>2047</code>.
+ * </p>
+ * <p>
+ * This function will therefore return:
+ * </p>
+ * <ul>
+ * <li>
+ * <code>0 - {@link #BIAS} = -1023</code> iff the input is a
+ * <i>subnormal</i> number.</li>
+ * <li>An integer in the range
+ * <code>[1 - {@link #BIAS}, 2046 - {@link #BIAS}] = [-1022, 1023]</code>
+ * iff the input is a <i>normal</i> number.</li>
+ * <li>
+ * <code>2047 - {@link #BIAS} = 1024</code> iff the input is
+ * {@link #POSITIVE_INFINITY}, {@link #NEGATIVE_INFINITY}, or
+ * <code>NaN</code>.</li>
+ * </ul>
+ *
+ * @see #packSetExponentUnbiasedUnchecked(int)
+ */
+
+ public static long unpackGetExponentUnbiased(
+ final double d)
+ {
+ final long b = Double.doubleToRawLongBits(d);
+ final long em = b & Binary64.MASK_EXPONENT;
+ final long es = em >> 52;
+ return es - Binary64.BIAS;
+ }
+
+ /**
+ * <p>
+ * Return the significand of the given double value.
+ * </p>
+ */
+
+ public static long unpackGetSignificand(
+ final double d)
+ {
+ final long b = Double.doubleToRawLongBits(d);
+ return b & Binary64.MASK_SIGNIFICAND;
+ }
+
+ /**
+ * <p>
+ * Return the sign of the given double value.
+ * </p>
+ */
+
+ public static long unpackGetSign(
+ final double d)
+ {
+ final long b = Double.doubleToRawLongBits(d);
+ return ((b & Binary64.MASK_SIGN) >> 63) & 1;
+ }
+}
diff --git a/src/jogl/classes/com/jogamp/opengl/math/FixedPoint.java b/src/jogl/classes/com/jogamp/opengl/math/FixedPoint.java
index e0acfec..b7dbf18 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/FixedPoint.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/FixedPoint.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2009 Sun Microsystems, Inc. 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
@@ -28,7 +28,7 @@
* 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.
- *
+ *
*/
package com.jogamp.opengl.math;
diff --git a/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java b/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java
index f3f44f1..191a832 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java
@@ -40,7 +40,7 @@ import com.jogamp.common.os.Platform;
* <p>
* Derived from ProjectFloat.java - Created 11-jan-2004
* </p>
- *
+ *
* @author Erik Duijs
* @author Kenneth Russell
* @author Sven Gothel
@@ -95,7 +95,7 @@ public class FloatUtil {
m.put(ZERO_MATRIX);
m.position(oldPos);
}
-
+
/**
* @param a 4x4 matrix in column-major order
* @param b 4x4 matrix in column-major order
@@ -111,7 +111,7 @@ public class FloatUtil {
d[d_off+i+3*4] = ai0 * b[b_off+0+3*4] + ai1 * b[b_off+1+3*4] + ai2 * b[b_off+2+3*4] + ai3 * b[b_off+3+3*4] ;
}
}
-
+
/**
* @param a 4x4 matrix in column-major order (also result)
* @param b 4x4 matrix in column-major order
@@ -127,7 +127,7 @@ public class FloatUtil {
a[a_off_i+3*4] = ai0 * b[b_off+0+3*4] + ai1 * b[b_off+1+3*4] + ai2 * b[b_off+2+3*4] + ai3 * b[b_off+3+3*4] ;
}
}
-
+
/**
* @param a 4x4 matrix in column-major order
* @param b 4x4 matrix in column-major order
@@ -151,7 +151,7 @@ public class FloatUtil {
* @param d result a*b in column-major order
*/
public static final void multMatrixf(final FloatBuffer a, final float[] b, int b_off, FloatBuffer d) {
- final int aP = a.position();
+ final int aP = a.position();
final int dP = d.position();
for (int i = 0; i < 4; i++) {
// one row in column-major order
@@ -162,13 +162,13 @@ public class FloatUtil {
d.put(dP+i+3*4 , ai0 * b[b_off+0+3*4] + ai1 * b[b_off+1+3*4] + ai2 * b[b_off+2+3*4] + ai3 * b[b_off+3+3*4] );
}
}
-
+
/**
* @param a 4x4 matrix in column-major order (also result)
* @param b 4x4 matrix in column-major order
*/
public static final void multMatrixf(final FloatBuffer a, final float[] b, int b_off) {
- final int aP = a.position();
+ final int aP = a.position();
for (int i = 0; i < 4; i++) {
// one row in column-major order
final int aP_i = aP+i;
@@ -186,7 +186,7 @@ public class FloatUtil {
* @param d result a*b in column-major order
*/
public static final void multMatrixf(final FloatBuffer a, final FloatBuffer b, FloatBuffer d) {
- final int aP = a.position();
+ final int aP = a.position();
final int bP = b.position();
final int dP = d.position();
for (int i = 0; i < 4; i++) {
@@ -198,13 +198,13 @@ public class FloatUtil {
d.put(dP+i+3*4 , ai0 * b.get(bP+0+3*4) + ai1 * b.get(bP+1+3*4) + ai2 * b.get(bP+2+3*4) + ai3 * b.get(bP+3+3*4) );
}
}
-
+
/**
* @param a 4x4 matrix in column-major order (also result)
* @param b 4x4 matrix in column-major order
*/
public static final void multMatrixf(final FloatBuffer a, final FloatBuffer b) {
- final int aP = a.position();
+ final int aP = a.position();
final int bP = b.position();
for (int i = 0; i < 4; i++) {
// one row in column-major order
@@ -216,14 +216,14 @@ public class FloatUtil {
a.put(aP_i+3*4 , ai0 * b.get(bP+0+3*4) + ai1 * b.get(bP+1+3*4) + ai2 * b.get(bP+2+3*4) + ai3 * b.get(bP+3+3*4) );
}
}
-
+
/**
* @param a 4x4 matrix in column-major order
* @param b 4x4 matrix in column-major order
* @param d result a*b in column-major order
*/
public static final void multMatrixf(final FloatBuffer a, final FloatBuffer b, float[] d, int d_off) {
- final int aP = a.position();
+ final int aP = a.position();
final int bP = b.position();
for (int i = 0; i < 4; i++) {
// one row in column-major order
@@ -234,7 +234,7 @@ public class FloatUtil {
d[d_off+i+3*4] = ai0 * b.get(bP+0+3*4) + ai1 * b.get(bP+1+3*4) + ai2 * b.get(bP+2+3*4) + ai3 * b.get(bP+3+3*4) ;
}
}
-
+
/**
* Normalize vector
*
@@ -242,7 +242,7 @@ public class FloatUtil {
*/
public static final void normalize(float[] v) {
float r = (float) Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
-
+
if ( r == 0.0 || r == 1.0) {
return;
}
@@ -265,7 +265,7 @@ public class FloatUtil {
float r = (float) Math.sqrt(v.get(0+vPos) * v.get(0+vPos) +
v.get(1+vPos) * v.get(1+vPos) +
v.get(2+vPos) * v.get(2+vPos));
-
+
if ( r == 0.0 || r == 1.0) {
return;
}
@@ -341,7 +341,7 @@ public class FloatUtil {
v_in[3] * m_in[3*4+i];
}
}
-
+
/**
* @param m_in 4x4 matrix in column-major order
* @param v_in 4-component column-vector
@@ -355,10 +355,10 @@ public class FloatUtil {
v_in[0+v_in_off] * m_in.get(0*4+i+matrixPos) +
v_in[1+v_in_off] * m_in.get(1*4+i+matrixPos) +
v_in[2+v_in_off] * m_in.get(2*4+i+matrixPos) +
- v_in[3+v_in_off] * m_in.get(3*4+i+matrixPos);
+ v_in[3+v_in_off] * m_in.get(3*4+i+matrixPos);
}
}
-
+
/**
* @param m_in 4x4 matrix in column-major order
* @param v_in 4-component column-vector
@@ -372,10 +372,10 @@ public class FloatUtil {
v_in[0] * m_in.get(0*4+i+matrixPos) +
v_in[1] * m_in.get(1*4+i+matrixPos) +
v_in[2] * m_in.get(2*4+i+matrixPos) +
- v_in[3] * m_in.get(3*4+i+matrixPos);
+ v_in[3] * m_in.get(3*4+i+matrixPos);
}
}
-
+
/**
* @param m_in 4x4 matrix in column-major order
* @param v_in 4-component column-vector
@@ -395,7 +395,7 @@ public class FloatUtil {
}
}
- /**
+ /**
* @param sb optional passed StringBuilder instance to be used
* @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter}
* @param a mxn matrix (rows x columns)
@@ -403,7 +403,7 @@ public class FloatUtil {
* @param rows
* @param columns
* @param rowMajorOrder if true floats are layed out in row-major-order, otherwise column-major-order (OpenGL)
- * @param row row number to print
+ * @param row row number to print
* @return matrix row string representation
*/
public static StringBuilder matrixRowToString(StringBuilder sb, String f, FloatBuffer a, int aOffset, int rows, int columns, boolean rowMajorOrder, int row) {
@@ -413,17 +413,17 @@ public class FloatUtil {
final int a0 = aOffset + a.position();
if(rowMajorOrder) {
for(int c=0; c<columns; c++) {
- sb.append( String.format( f+" ", a.get( a0 + row*columns + c ) ) );
+ sb.append( String.format( f+" ", a.get( a0 + row*columns + c ) ) );
}
} else {
for(int r=0; r<columns; r++) {
- sb.append( String.format( f+" ", a.get( a0 + row + r*rows ) ) );
+ sb.append( String.format( f+" ", a.get( a0 + row + r*rows ) ) );
}
}
return sb;
}
- /**
+ /**
* @param sb optional passed StringBuilder instance to be used
* @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter}
* @param a mxn matrix (rows x columns)
@@ -431,7 +431,7 @@ public class FloatUtil {
* @param rows
* @param columns
* @param rowMajorOrder if true floats are layed out in row-major-order, otherwise column-major-order (OpenGL)
- * @param row row number to print
+ * @param row row number to print
* @return matrix row string representation
*/
public static StringBuilder matrixRowToString(StringBuilder sb, String f, float[] a, int aOffset, int rows, int columns, boolean rowMajorOrder, int row) {
@@ -440,19 +440,19 @@ public class FloatUtil {
}
if(rowMajorOrder) {
for(int c=0; c<columns; c++) {
- sb.append( String.format( f+" ", a[ aOffset + row*columns + c ] ) );
+ sb.append( String.format( f+" ", a[ aOffset + row*columns + c ] ) );
}
} else {
for(int r=0; r<columns; r++) {
- sb.append( String.format( f+" ", a[ aOffset + row + r*rows ] ) );
+ sb.append( String.format( f+" ", a[ aOffset + row + r*rows ] ) );
}
}
return sb;
}
-
- /**
+
+ /**
* @param sb optional passed StringBuilder instance to be used
- * @param rowPrefix optional prefix for each row
+ * @param rowPrefix optional prefix for each row
* @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter}
* @param a mxn matrix (rows x columns)
* @param aOffset offset to <code>a</code>'s current position
@@ -469,14 +469,14 @@ public class FloatUtil {
for(int i=0; i<rows; i++) {
sb.append(prefix).append("[ ");
matrixRowToString(sb, f, a, aOffset, rows, columns, rowMajorOrder, i);
- sb.append("]").append(Platform.getNewline());
+ sb.append("]").append(Platform.getNewline());
}
return sb;
}
- /**
+ /**
* @param sb optional passed StringBuilder instance to be used
- * @param rowPrefix optional prefix for each row
+ * @param rowPrefix optional prefix for each row
* @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter}
* @param a mxn matrix (rows x columns)
* @param aOffset offset to <code>a</code>'s current position
@@ -493,14 +493,14 @@ public class FloatUtil {
for(int i=0; i<rows; i++) {
sb.append(prefix).append("[ ");
matrixRowToString(sb, f, a, aOffset, rows, columns, rowMajorOrder, i);
- sb.append("]").append(Platform.getNewline());
+ sb.append("]").append(Platform.getNewline());
}
return sb;
}
-
- /**
+
+ /**
* @param sb optional passed StringBuilder instance to be used
- * @param rowPrefix optional prefix for each row
+ * @param rowPrefix optional prefix for each row
* @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter}
* @param a 4x4 matrix in column major order (OpenGL)
* @param aOffset offset to <code>a</code>'s current position
@@ -521,14 +521,14 @@ public class FloatUtil {
matrixRowToString(sb, f, a, aOffset, rows, columns, rowMajorOrder, i);
sb.append("=?= ");
matrixRowToString(sb, f, b, bOffset, rows, columns, rowMajorOrder, i);
- sb.append("]").append(Platform.getNewline());
+ sb.append("]").append(Platform.getNewline());
}
return sb;
}
- /**
+ /**
* @param sb optional passed StringBuilder instance to be used
- * @param rowPrefix optional prefix for each row
+ * @param rowPrefix optional prefix for each row
* @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter}
* @param a 4x4 matrix in column major order (OpenGL)
* @param aOffset offset to <code>a</code>'s current position
@@ -549,11 +549,11 @@ public class FloatUtil {
matrixRowToString(sb, f, a, aOffset, rows, columns, rowMajorOrder, i);
sb.append("=?= ");
matrixRowToString(sb, f, b, bOffset, rows, columns, rowMajorOrder, i);
- sb.append("]").append(Platform.getNewline());
+ sb.append("]").append(Platform.getNewline());
}
return sb;
}
-
+
public static final float E = 2.7182818284590452354f;
public static final float PI = 3.14159265358979323846f;
@@ -569,5 +569,5 @@ public class FloatUtil {
public static float acos(float a) { return (float) java.lang.Math.acos(a); }
public static float sqrt(float a) { return (float) java.lang.Math.sqrt(a); }
-
+
}
\ No newline at end of file
diff --git a/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java b/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java
index c6bf44f..52a59c5 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java
@@ -33,7 +33,7 @@ public class Quaternion {
public Quaternion() {
setIdentity();
}
-
+
public Quaternion(Quaternion q) {
x = q.x;
y = q.y;
@@ -50,7 +50,7 @@ public class Quaternion {
/**
* Constructor to create a rotation based quaternion from two vectors
- *
+ *
* @param vector1
* @param vector2
*/
@@ -59,7 +59,7 @@ public class Quaternion {
final float[] cross = VectorUtil.cross(vector1, vector2);
fromAxis(cross, theta);
}
-
+
/***
* Constructor to create a rotation based quaternion from axis vector and angle
* @param vector axis vector
@@ -69,10 +69,10 @@ public class Quaternion {
public Quaternion(float[] vector, float angle) {
fromAxis(vector, angle);
}
-
+
/***
* Initialize this quaternion with given axis vector and rotation angle
- *
+ *
* @param vector axis vector
* @param angle rotation angle (rads)
*/
@@ -88,7 +88,7 @@ public class Quaternion {
/**
* Transform the rotational quaternion to axis based rotation angles
- *
+ *
* @return new float[4] with ,theta,Rx,Ry,Rz
*/
public float[] toAxis() {
@@ -135,7 +135,7 @@ public class Quaternion {
/**
* Add a quaternion
- *
+ *
* @param q quaternion
*/
public void add(Quaternion q) {
@@ -146,7 +146,7 @@ public class Quaternion {
/**
* Subtract a quaternion
- *
+ *
* @param q quaternion
*/
public void subtract(Quaternion q) {
@@ -157,7 +157,7 @@ public class Quaternion {
/**
* Divide a quaternion by a constant
- *
+ *
* @param n a float to divide by
*/
public void divide(float n) {
@@ -168,7 +168,7 @@ public class Quaternion {
/**
* Multiply this quaternion by the param quaternion
- *
+ *
* @param q a quaternion to multiply with
*/
public void mult(Quaternion q) {
@@ -186,7 +186,7 @@ public class Quaternion {
/**
* Multiply a quaternion by a constant
- *
+ *
* @param n a float constant
*/
public void mult(float n) {
@@ -194,10 +194,10 @@ public class Quaternion {
y *= n;
z *= n;
}
-
+
/***
* Rotate given vector by this quaternion
- *
+ *
* @param vector input vector
* @return rotated vector
*/
@@ -250,7 +250,7 @@ public class Quaternion {
/**
* Transform this quaternion to a 4x4 column matrix representing the
* rotation
- *
+ *
* @return new float[16] column matrix 4x4
*/
public float[] toMatrix() {
@@ -287,7 +287,7 @@ public class Quaternion {
* See http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/
* quaternions/slerp/
* </p>
- *
+ *
* @param a initial quaternion
* @param b target quaternion
* @param t float between 0 and 1 representing interp.
@@ -332,13 +332,13 @@ public class Quaternion {
/**
* Check if this quaternion represents an identity matrix for rotation,
* , ie (0,0,0,1).
- *
+ *
* @return true if it is an identity rep., false otherwise
*/
public boolean isIdentity() {
return w == 1 && x == 0 && y == 0 && z == 0;
}
-
+
/***
* Set this quaternion to identity (x=0,y=0,z=0,w=1)
*/
@@ -349,7 +349,7 @@ public class Quaternion {
/**
* compute the quaternion from a 3x3 column matrix
- *
+ *
* @param m 3x3 column matrix
*/
public void setFromMatrix(float[] m) {
@@ -361,7 +361,7 @@ public class Quaternion {
y = (m[6] - m[2]) * S;
z = (m[1] - m[3]) * S;
} else {
- if ((m[0] > m[4]) & (m[0] > m[8])) {
+ if ((m[0] > m[4]) && (m[0] > m[8])) {
final float S = FloatUtil.sqrt(1.0f + m[0] - m[4] - m[8]) * 2f; // S=4*qx
w = (m[7] - m[5]) / S;
x = 0.25f * S;
@@ -386,7 +386,7 @@ public class Quaternion {
/**
* Check if the the 3x3 matrix (param) is in fact an affine rotational
* matrix
- *
+ *
* @param m 3x3 column matrix
* @return true if representing a rotational matrix, false otherwise
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java b/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
index 0033afe..508f1aa 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/VectorUtil.java
@@ -39,7 +39,7 @@ public class VectorUtil {
Winding(int dir) {
this.dir = dir;
}
- }
+ }
public static final int COLLINEAR = 0;
@@ -119,15 +119,15 @@ public class VectorUtil {
/** Column Matrix Vector multiplication
* @param colMatrix column matrix (4x4)
* @param vec vector(x,y,z)
- * @return result new float[3]
+ * @return result new float[3]
*/
public static float[] colMatrixVectorMult(float[] colMatrix, float[] vec)
{
final float[] out = new float[3];
- out[0] = vec[0]*colMatrix[0] + vec[1]*colMatrix[4] + vec[2]*colMatrix[8] + colMatrix[12];
- out[1] = vec[0]*colMatrix[1] + vec[1]*colMatrix[5] + vec[2]*colMatrix[9] + colMatrix[13];
- out[2] = vec[0]*colMatrix[2] + vec[1]*colMatrix[6] + vec[2]*colMatrix[10] + colMatrix[14];
+ out[0] = vec[0]*colMatrix[0] + vec[1]*colMatrix[4] + vec[2]*colMatrix[8] + colMatrix[12];
+ out[1] = vec[0]*colMatrix[1] + vec[1]*colMatrix[5] + vec[2]*colMatrix[9] + colMatrix[13];
+ out[2] = vec[0]*colMatrix[2] + vec[1]*colMatrix[6] + vec[2]*colMatrix[10] + colMatrix[14];
return out;
}
@@ -135,15 +135,15 @@ public class VectorUtil {
/** Matrix Vector multiplication
* @param rawMatrix column matrix (4x4)
* @param vec vector(x,y,z)
- * @return result new float[3]
+ * @return result new float[3]
*/
public static float[] rowMatrixVectorMult(float[] rawMatrix, float[] vec)
{
final float[] out = new float[3];
- out[0] = vec[0]*rawMatrix[0] + vec[1]*rawMatrix[1] + vec[2]*rawMatrix[2] + rawMatrix[3];
- out[1] = vec[0]*rawMatrix[4] + vec[1]*rawMatrix[5] + vec[2]*rawMatrix[6] + rawMatrix[7];
- out[2] = vec[0]*rawMatrix[8] + vec[1]*rawMatrix[9] + vec[2]*rawMatrix[10] + rawMatrix[11];
+ out[0] = vec[0]*rawMatrix[0] + vec[1]*rawMatrix[1] + vec[2]*rawMatrix[2] + rawMatrix[3];
+ out[1] = vec[0]*rawMatrix[4] + vec[1]*rawMatrix[5] + vec[2]*rawMatrix[6] + rawMatrix[7];
+ out[2] = vec[0]*rawMatrix[8] + vec[1]*rawMatrix[9] + vec[2]*rawMatrix[10] + rawMatrix[11];
return out;
}
@@ -157,7 +157,7 @@ public class VectorUtil {
{
return (p1+p2)/2.0f;
}
-
+
/** Calculate the midpoint of two points
* @param p1 first point
* @param p2 second point
@@ -172,7 +172,7 @@ public class VectorUtil {
return midPoint;
}
-
+
/** Compute the norm of a vector
* @param vec vector
* @return vorm
@@ -181,7 +181,7 @@ public class VectorUtil {
{
return FloatUtil.sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]);
}
-
+
/** Compute distance between 2 points
* @param p0 a ref point on the line
* @param vec vector representing the direction of the line
@@ -216,7 +216,7 @@ public class VectorUtil {
*/
public static boolean checkEqualityVec2(float[] v1, float[] v2)
{
- return Float.compare(v1[0], v2[0]) == 0 &&
+ return Float.compare(v1[0], v2[0]) == 0 &&
Float.compare(v1[1], v2[1]) == 0 ;
}
@@ -261,7 +261,7 @@ public class VectorUtil {
* @param b triangle vertex 2
* @param c triangle vertex 3
* @param d vertex in question
- * @return true if the vertex d is inside the circle defined by the
+ * @return true if the vertex d is inside the circle defined by the
* vertices a, b, c. from paper by Guibas and Stolfi (1985).
*/
public static boolean inCircle(Vert2fImmutable a, Vert2fImmutable b, Vert2fImmutable c, Vert2fImmutable d){
@@ -282,8 +282,8 @@ public class VectorUtil {
return (b.getX() - a.getX()) * (c.getY() - a.getY()) - (b.getY() - a.getY())*(c.getX() - a.getX());
}
- /** Check if a vertex is in triangle using
- * barycentric coordinates computation.
+ /** Check if a vertex is in triangle using
+ * barycentric coordinates computation.
* @param a first triangle vertex
* @param b second triangle vertex
* @param c third triangle vertex
@@ -291,7 +291,7 @@ public class VectorUtil {
* @return true if p is in triangle (a, b, c), false otherwise.
*/
public static boolean vertexInTriangle(float[] a, float[] b, float[] c, float[] p){
- // Compute vectors
+ // Compute vectors
final float[] ac = computeVector(a, c); //v0
final float[] ab = computeVector(a, b); //v1
final float[] ap = computeVector(a, p); //v2
@@ -362,13 +362,13 @@ public class VectorUtil {
* @param b vertex 2 of first segment
* @param c vertex 1 of second segment
* @param d vertex 2 of second segment
- * @return the intersection coordinates if the segments intersect, otherwise
- * returns null
+ * @return the intersection coordinates if the segments intersect, otherwise
+ * returns null
*/
public static float[] seg2SegIntersection(Vert2fImmutable a, Vert2fImmutable b, Vert2fImmutable c, Vert2fImmutable d) {
final float determinant = (a.getX()-b.getX())*(c.getY()-d.getY()) - (a.getY()-b.getY())*(c.getX()-d.getX());
- if (determinant == 0)
+ if (determinant == 0)
return null;
final float alpha = (a.getX()*b.getY()-a.getY()*b.getX());
@@ -389,13 +389,13 @@ public class VectorUtil {
* @param b vertex 2 of first line
* @param c vertex 1 of second line
* @param d vertex 2 of second line
- * @return the intersection coordinates if the lines intersect, otherwise
- * returns null
+ * @return the intersection coordinates if the lines intersect, otherwise
+ * returns null
*/
public static float[] line2lineIntersection(Vert2fImmutable a, Vert2fImmutable b, Vert2fImmutable c, Vert2fImmutable d) {
final float determinant = (a.getX()-b.getX())*(c.getY()-d.getY()) - (a.getY()-b.getY())*(c.getX()-d.getX());
- if (determinant == 0)
+ if (determinant == 0)
return null;
final float alpha = (a.getX()*b.getY()-a.getY()*b.getX());
diff --git a/src/jogl/classes/com/jogamp/opengl/math/Vert2fImmutable.java b/src/jogl/classes/com/jogamp/opengl/math/Vert2fImmutable.java
index 1334988..ec90b40 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/Vert2fImmutable.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/Vert2fImmutable.java
@@ -33,7 +33,7 @@ public interface Vert2fImmutable {
float getY();
int getCoordCount();
-
+
float[] getCoord();
-
+
}
diff --git a/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java b/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
index b6e8ede..d48677d 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java
@@ -32,23 +32,23 @@ import com.jogamp.opengl.math.VectorUtil;
/**
* Axis Aligned Bounding Box. Defined by two 3D coordinates (low and high)
- * The low being the the lower left corner of the box, and the high being the upper
+ * The low being the the lower left corner of the box, and the high being the upper
* right corner of the box.
- *
+ *
*/
public class AABBox implements Cloneable {
private float[] low = new float[3];
private float[] high = new float[3];
private float[] center = new float[3];
- /** Create a Axis Aligned bounding box (AABBox)
+ /** Create a Axis Aligned bounding box (AABBox)
* where the low and and high MAX float Values.
*/
public AABBox() {
reset();
}
- /** Create an AABBox specifying the coordinates
+ /** Create an AABBox specifying the coordinates
* of the low and high
* @param lx min x-coordinate
* @param ly min y-coordnate
@@ -61,7 +61,7 @@ public class AABBox implements Cloneable {
float hx, float hy, float hz) {
setSize(lx, ly, lz, hx, hy, hz);
}
-
+
/** Create a AABBox defining the low and high
* @param low min xyz-coordinates
* @param high max xyz-coordinates
@@ -78,27 +78,27 @@ public class AABBox implements Cloneable {
center[1] = 0f;
center[2] = 0f;
}
-
+
/** Get the max xyz-coordinates
* @return a float array containing the max xyz coordinates
*/
public final float[] getHigh() {
return high;
}
-
+
private final void setHigh(float hx, float hy, float hz) {
this.high[0] = hx;
this.high[1] = hy;
this.high[2] = hz;
}
-
+
/** Get the min xyz-coordinates
* @return a float array containing the min xyz coordinates
*/
public final float[] getLow() {
return low;
}
-
+
private final void setLow(float lx, float ly, float lz) {
this.low[0] = lx;
this.low[1] = ly;
@@ -111,10 +111,10 @@ public class AABBox implements Cloneable {
center[2] = (high[2] + low[2])/2;
}
- /**
- * Set size of the AABBox specifying the coordinates
+ /**
+ * Set size of the AABBox specifying the coordinates
* of the low and high.
- *
+ *
* @param lx min x-coordinate
* @param ly min y-coordnate
* @param lz min z-coordinate
@@ -123,7 +123,7 @@ public class AABBox implements Cloneable {
* @param hz max z-coordinate
*/
public final void setSize(float lx, float ly, float lz,
- float hx, float hy, float hz) {
+ float hx, float hy, float hz) {
this.low[0] = lx;
this.low[1] = ly;
this.low[2] = lz;
@@ -132,7 +132,7 @@ public class AABBox implements Cloneable {
this.high[2] = hz;
computeCenter();
}
-
+
/** Resize the AABBox to encapsulate another AABox
* @param newBox AABBox to be encapsulated in
*/
@@ -160,12 +160,12 @@ public class AABBox implements Cloneable {
}
/** Resize the AABBox to encapsulate the passed
- * xyz-coordinates.
+ * xyz-coordinates.
* @param x x-axis coordinate value
* @param y y-axis coordinate value
* @param z z-axis coordinate value
*/
- public final void resize(float x, float y, float z) {
+ public final void resize(float x, float y, float z) {
/** test low */
if (x < low[0])
low[0] = x;
@@ -181,12 +181,12 @@ public class AABBox implements Cloneable {
high[1] = y;
if (z > high[2])
high[2] = z;
-
+
computeCenter();
}
/** Resize the AABBox to encapsulate the passed
- * xyz-coordinates.
+ * xyz-coordinates.
* @param xyz xyz-axis coordinate values
* @param offset of the array
*/
@@ -210,7 +210,7 @@ public class AABBox implements Cloneable {
}
return true;
}
-
+
/** Check if the xyz coordinates are bounded/contained
* by this AABBox.
* @param x x-axis coordinate value
@@ -231,7 +231,7 @@ public class AABBox implements Cloneable {
}
return true;
}
-
+
/** Check if there is a common region between this AABBox and the passed
* 2D region irrespective of z range
* @param x lower left x-coord
@@ -244,13 +244,13 @@ public class AABBox implements Cloneable {
if (w <= 0 || h <= 0) {
return false;
}
-
+
final float _w = getWidth();
- final float _h = getHeight();
+ final float _h = getHeight();
if (_w <= 0 || _h <= 0) {
return false;
}
-
+
final float x0 = getMinX();
final float y0 = getMinY();
return (x + w > x0 &&
@@ -259,8 +259,8 @@ public class AABBox implements Cloneable {
y < y0 + _h);
}
-
- /** Get the size of the Box where the size is represented by the
+
+ /** Get the size of the Box where the size is represented by the
* length of the vector between low and high.
* @return a float representing the size of the AABBox
*/
@@ -283,16 +283,16 @@ public class AABBox implements Cloneable {
diffH[0] = high[0] - center[0];
diffH[1] = high[1] - center[1];
diffH[2] = high[2] - center[2];
-
+
diffH = VectorUtil.scale(diffH, size);
-
+
float[] diffL = new float[3];
diffL[0] = low[0] - center[0];
diffL[1] = low[1] - center[1];
diffL[2] = low[2] - center[2];
-
+
diffL = VectorUtil.scale(diffL, size);
-
+
high = VectorUtil.vectorAdd(center, diffH);
low = VectorUtil.vectorAdd(center, diffL);
}
@@ -300,43 +300,45 @@ public class AABBox implements Cloneable {
public final float getMinX() {
return low[0];
}
-
+
public final float getMinY() {
return low[1];
}
-
+
public final float getMinZ() {
return low[2];
}
-
+
public final float getMaxX() {
return high[0];
}
-
+
public final float getMaxY() {
return high[1];
}
-
+
public final float getMaxZ() {
return high[2];
}
-
+
public final float getWidth(){
return high[0] - low[0];
}
-
+
public final float getHeight() {
return high[1] - low[1];
}
-
+
public final float getDepth() {
return high[2] - low[2];
}
-
+
+ @Override
public final AABBox clone() {
return new AABBox(this.low, this.high);
}
-
+
+ @Override
public final boolean equals(Object obj) {
if( obj == this ) {
return true;
@@ -344,11 +346,12 @@ public class AABBox implements Cloneable {
if( null == obj || !(obj instanceof AABBox) ) {
return false;
}
- final AABBox other = (AABBox) obj;
- return VectorUtil.checkEquality(low, other.low) &&
+ final AABBox other = (AABBox) obj;
+ return VectorUtil.checkEquality(low, other.low) &&
VectorUtil.checkEquality(high, other.high) ;
}
-
+
+ @Override
public final String toString() {
return "[ "+low[0]+"/"+low[1]+"/"+low[1]+" .. "+high[0]+"/"+high[0]+"/"+high[0]+", ctr "+
center[0]+"/"+center[1]+"/"+center[1]+" ]";
diff --git a/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java b/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java
index 93e68a1..fb31108 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java
@@ -30,11 +30,11 @@ package com.jogamp.opengl.math.geom;
import com.jogamp.common.os.Platform;
/**
- * Providing frustum {@link #getPlanes() planes} derived by different inputs
+ * Providing frustum {@link #getPlanes() planes} derived by different inputs
* ({@link #updateByPMV(float[], int) P*MV}, ..)
- * used to {@link #classifySphere(float[], float) classify objects} and to test
+ * used to {@link #classifySphere(float[], float) classify objects} and to test
* whether they are {@link #isOutside(AABBox) outside}.
- *
+ *
* <p>
* Extracting the world-frustum planes from the P*Mv:
* <pre>
@@ -54,7 +54,7 @@ import com.jogamp.common.os.Platform;
* Lighthouse3d.com
* http://www.lighthouse3d.com/tutorials/view-frustum-culling/
* </pre>
- *
+ *
* Fundamentals about Planes, Half-Spaces and Frustum-Culling:<br/>
* <pre>
* Planes and Half-Spaces, Max Wagner <mwagner at digipen.edu>
@@ -69,7 +69,7 @@ import com.jogamp.common.os.Platform;
public class Frustum {
/** Normalized planes[l, r, b, t, n, f] */
protected Plane[] planes = new Plane[6];
-
+
/**
* Creates an undefined instance w/o calculating the frustum.
* <p>
@@ -83,35 +83,35 @@ public class Frustum {
planes[i] = new Plane();
}
}
-
- /**
+
+ /**
* Plane equation := dot(n, x - p) = 0 -> ax + bc + cx + d == 0
* <p>
* In order to work w/ {@link Frustum#isOutside(AABBox) isOutside(..)} methods,
* the normals have to point to the inside of the frustum.
- * </p>
+ * </p>
*/
public static class Plane {
/** Normal of the plane */
public final float[] n = new float[3];
-
+
/** Distance to origin */
public float d;
- /**
+ /**
* Return signed distance of plane to given point.
* <ul>
* <li>If dist < 0 , then the point p lies in the negative halfspace.</li>
* <li>If dist = 0 , then the point p lies in the plane.</li>
* <li>If dist > 0 , then the point p lies in the positive halfspace.</li>
- * </ul>
+ * </ul>
* A plane cuts 3D space into 2 half spaces.
* <p>
* Positive halfspace is where the plane’s normals vector points into.
- * </p>
+ * </p>
* <p>
* Negative halfspace is the <i>other side</i> of the plane, i.e. *-1
- * </p>
+ * </p>
**/
public final float distanceTo(float x, float y, float z) {
return n[0] * x + n[1] * y + n[2] * z + d;
@@ -121,13 +121,13 @@ public class Frustum {
public final float distanceTo(float[] p) {
return n[0] * p[0] + n[1] * p[1] + n[2] * p[2] + d;
}
-
+
@Override
public String toString() {
return "Plane[ [ " + n[0] + ", " + n[1] + ", " + n[2] + " ], " + d + "]";
}
}
-
+
/** Index for left plane: {@value} */
public static final int LEFT = 0;
/** Index for right plane: {@value} */
@@ -140,7 +140,7 @@ public class Frustum {
public static final int NEAR = 4;
/** Index for far plane: {@value} */
public static final int FAR = 5;
-
+
/**
* {@link Plane}s are ordered in the returned array as follows:
* <ul>
@@ -154,17 +154,17 @@ public class Frustum {
* <p>
* {@link Plane}'s normals are pointing to the inside of the frustum
* in order to work w/ {@link #isOutside(AABBox) isOutside(..)} methods.
- * </p>
- *
- * @return array of normalized {@link Plane}s, order see above.
+ * </p>
+ *
+ * @return array of normalized {@link Plane}s, order see above.
*/
public final Plane[] getPlanes() { return planes; }
-
+
/**
* Copy the given <code>src</code> planes into this this instance's planes.
* @param src the 6 source planes
*/
- public final void updateByPlanes(Plane[] src) {
+ public final void updateByPlanes(Plane[] src) {
for (int i = 0; i < 6; ++i) {
final Plane p0 = planes[i];
final float[] p0_n = p0.n;
@@ -176,7 +176,7 @@ public class Frustum {
p0.d = p1.d;
}
}
-
+
/**
* Calculate the frustum planes in world coordinates
* using the passed float[16] as premultiplied P*MV (column major order).
@@ -185,7 +185,7 @@ public class Frustum {
* as required by this class.
* </p>
*/
- public void updateByPMV(float[] pmv, int pmv_off) {
+ public void updateByPMV(float[] pmv, int pmv_off) {
// Left: a = m41 + m11, b = m42 + m12, c = m43 + m13, d = m44 + m14 - [1..4] row-major
// Left: a = m30 + m00, b = m31 + m01, c = m32 + m02, d = m33 + m03 - [0..3] row-major
{
@@ -264,11 +264,11 @@ public class Frustum {
p.d /= invl;
}
}
-
+
private static final boolean isOutsideImpl(Plane p, AABBox box) {
final float[] low = box.getLow();
final float[] high = box.getHigh();
-
+
if ( p.distanceTo(low[0], low[1], low[2]) > 0.0f ||
p.distanceTo(high[0], low[1], low[2]) > 0.0f ||
p.distanceTo(low[0], high[1], low[2]) > 0.0f ||
@@ -298,19 +298,19 @@ public class Frustum {
// We make no attempt to determine whether it's fully inside or not.
return false;
}
-
-
+
+
public static enum Location { OUTSIDE, INSIDE, INTERSECT };
-
+
/**
* Check to see if a point is outside, inside or on a plane of the frustum.
- *
+ *
* @param p the point
* @return {@link Location} of point related to frustum planes
*/
public final Location classifyPoint(float[] p) {
Location res = Location.INSIDE;
-
+
for (int i = 0; i < 6; ++i) {
final float d = planes[i].distanceTo(p);
if ( d < 0.0f ) {
@@ -321,43 +321,43 @@ public class Frustum {
}
return res;
}
-
+
/**
* Check to see if a point is outside of the frustum.
- *
+ *
* @param p the point
* @return true if outside of the frustum, otherwise inside or on a plane
*/
public final boolean isPointOutside(float[] p) {
return Location.OUTSIDE == classifyPoint(p);
}
-
+
/**
* Check to see if a sphere is outside, intersecting or inside of the frustum.
- *
+ *
* @param p center of the sphere
* @param radius radius of the sphere
* @return {@link Location} of point related to frustum planes
*/
public final Location classifySphere(float[] p, float radius) {
Location res = Location.INSIDE; // fully inside
-
+
for (int i = 0; i < 6; ++i) {
final float d = planes[i].distanceTo(p);
- if ( d < -radius ) {
+ if ( d < -radius ) {
// fully outside
return Location.OUTSIDE;
} else if (d < radius ) {
// intersecting
res = Location.INTERSECT;
}
- }
+ }
return res;
}
-
+
/**
* Check to see if a sphere is outside of the frustum.
- *
+ *
* @param p center of the sphere
* @param radius radius of the sphere
* @return true if outside of the frustum, otherwise inside or intersecting
@@ -365,7 +365,7 @@ public class Frustum {
public final boolean isSphereOutside(float[] p, float radius) {
return Location.OUTSIDE == classifySphere(p, radius);
}
-
+
public StringBuilder toString(StringBuilder sb) {
if( null == sb ) {
sb = new StringBuilder();
@@ -380,7 +380,7 @@ public class Frustum {
.append("]");
return sb;
}
-
+
@Override
public String toString() {
return toString(null).toString();
diff --git a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
index ff764d8..cad780a 100644
--- a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
+++ b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
@@ -52,6 +52,7 @@ 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 jogamp.nativewindow.x11.X11Util;
@@ -85,7 +86,7 @@ import com.jogamp.opengl.JoglVersion;
* Implementation allows use of custom {@link GLCapabilities}.
* </p>
*/
-public class GLCanvas extends Canvas implements GLAutoDrawable {
+public class GLCanvas extends Canvas implements GLAutoDrawable, GLSharedContextSetter {
private static final boolean DEBUG = Debug.debug("GLCanvas");
/*
@@ -102,14 +103,13 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
/* GL Stuff */
private final RecursiveLock lock = LockFactory.createRecursiveLock();
private final GLDrawableHelper helper = new GLDrawableHelper();
-
- private final GLContext shareWith;
+
private final GLCapabilitiesImmutable capsRequested;
- private final GLCapabilitiesChooser capsChooser;
-
+ private final GLCapabilitiesChooser capsChooser;
+
private volatile Rectangle clientArea;
private volatile GLDrawableImpl drawable; // volatile: avoid locking for read-only access
- private volatile GLContextImpl context;
+ private volatile GLContextImpl context; // volatile: avoid locking for read-only access
/* Native window surface */
private final boolean useX11GTK;
@@ -124,6 +124,10 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
/* Flag indicating whether an unprocessed reshape is pending. */
private volatile boolean sendReshape; // volatile: maybe written by WindowManager thread w/o locking
+ private static String getThreadName() { return Thread.currentThread().getName(); }
+ private static String toHexString(int v) { return "0x"+Integer.toHexString(v); }
+ private static String toHexString(long v) { return "0x"+Long.toHexString(v); }
+
/*
* Invokes init(...) on all GLEventListeners. Assumes context is current when run.
*/
@@ -156,7 +160,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
public void run() {
final RecursiveLock _lock = lock;
_lock.lock();
- try {
+ try {
if( !GLCanvas.this.isDisposed() ) {
helper.invokeGL(drawable, context, displayAction, initAction);
}
@@ -215,7 +219,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
gle.printStackTrace();
}
}
- context = null;
+ context = null;
}
if ( null != drawable ) {
drawable.setRealized(false);
@@ -242,7 +246,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
private class DisposeGLEventListenerAction implements Runnable {
private GLEventListener listener;
- private boolean remove;
+ private final boolean remove;
private DisposeGLEventListenerAction(GLEventListener listener, boolean remove) {
this.listener = listener;
this.remove = remove;
@@ -261,11 +265,41 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
}
}
};
-
- /**
- * Creates an instance using {@link #GLCanvas(Composite, int, GLCapabilitiesImmutable, GLCapabilitiesChooser, GLContext)}
+
+ /**
+ * Creates an instance using {@link #GLCanvas(Composite, int, GLCapabilitiesImmutable, GLCapabilitiesChooser)}
+ * on the SWT thread.
+ *
+ * @param parent
+ * Required (non-null) parent Composite.
+ * @param style
+ * Optional SWT style bit-field. The {@link SWT#NO_BACKGROUND} bit is set before passing this up to the
+ * Canvas constructor, so OpenGL handles the background.
+ * @param caps
+ * Optional GLCapabilities. If not provided, the default capabilities for the default GLProfile for the
+ * graphics device determined by the parent Composite are used. Note that the GLCapabilities that are
+ * actually used may differ based on the capabilities of the graphics device.
+ * @param chooser
+ * Optional GLCapabilitiesChooser to customize the selection of the used GLCapabilities based on the
+ * requested GLCapabilities, and the available capabilities of the graphics device.
+ * @return a new instance
+ */
+ public static GLCanvas create(final Composite parent, final int style, final GLCapabilitiesImmutable caps,
+ final GLCapabilitiesChooser chooser) {
+ final GLCanvas[] res = new GLCanvas[] { null };
+ parent.getDisplay().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ res[0] = new GLCanvas( parent, style, caps, chooser );
+ }
+ });
+ return res[0];
+ }
+
+ /**
+ * Creates an instance using {@link #GLCanvas(Composite, int, GLCapabilitiesImmutable, GLCapabilitiesChooser, GLContext)}
* on the SWT thread.
- *
+ *
* @param parent
* Required (non-null) parent Composite.
* @param style
@@ -281,11 +315,14 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
* @param shareWith
* Optional GLContext to share state (textures, vbos, shaders, etc.) with.
* @return a new instance
+ * @deprecated Use {@link #create(Composite, int, GLCapabilitiesImmutable, GLCapabilitiesChooser)}
+ * and set shared GLContext via {@link #setSharedContext(GLContext)} or {@link #setSharedAutoDrawable(GLAutoDrawable)}.
*/
public static GLCanvas create(final Composite parent, final int style, final GLCapabilitiesImmutable caps,
final GLCapabilitiesChooser chooser, final GLContext shareWith) {
- final GLCanvas[] res = new GLCanvas[] { null };
+ final GLCanvas[] res = new GLCanvas[] { null };
parent.getDisplay().syncExec(new Runnable() {
+ @Override
public void run() {
res[0] = new GLCanvas( parent, style, caps, chooser, shareWith );
}
@@ -308,8 +345,31 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
* @param capsChooser
* Optional GLCapabilitiesChooser to customize the selection of the used GLCapabilities based on the
* requested GLCapabilities, and the available capabilities of the graphics device.
+ */
+ public GLCanvas(final Composite parent, final int style, GLCapabilitiesImmutable capsReqUser,
+ final GLCapabilitiesChooser capsChooser) {
+ this(parent, style, capsReqUser, capsChooser, null);
+ }
+
+ /**
+ * Creates a new SWT GLCanvas.
+ *
+ * @param parent
+ * Required (non-null) parent Composite.
+ * @param style
+ * Optional SWT style bit-field. The {@link SWT#NO_BACKGROUND} bit is set before passing this up to the
+ * Canvas constructor, so OpenGL handles the background.
+ * @param capsReqUser
+ * Optional GLCapabilities. If not provided, the default capabilities for the default GLProfile for the
+ * graphics device determined by the parent Composite are used. Note that the GLCapabilities that are
+ * actually used may differ based on the capabilities of the graphics device.
+ * @param capsChooser
+ * Optional GLCapabilitiesChooser to customize the selection of the used GLCapabilities based on the
+ * requested GLCapabilities, and the available capabilities of the graphics device.
* @param shareWith
* Optional GLContext to share state (textures, vbos, shaders, etc.) with.
+ * @deprecated Use {@link #GLCanvas(Composite, int, GLCapabilitiesImmutable, GLCapabilitiesChooser)}
+ * and set shared GLContext via {@link #setSharedContext(GLContext)} or {@link #setSharedAutoDrawable(GLAutoDrawable)}.
*/
public GLCanvas(final Composite parent, final int style, GLCapabilitiesImmutable capsReqUser,
final GLCapabilitiesChooser capsChooser, final GLContext shareWith) {
@@ -319,22 +379,22 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
GLProfile.initSingleton(); // ensure JOGL is completly initialized
SWTAccessor.setRealized(this, true);
-
+
clientArea = GLCanvas.this.getClientArea();
- /* Get the nativewindow-Graphics Device associated with this control (which is determined by the parent Composite).
+ /* Get the nativewindow-Graphics Device associated with this control (which is determined by the parent Composite).
* Note: SWT is owner of the native handle, hence closing operation will be a NOP. */
final AbstractGraphicsDevice swtDevice = SWTAccessor.getDevice(this);
-
+
useX11GTK = SWTAccessor.useX11GTK();
if(useX11GTK) {
- // Decoupled X11 Device/Screen allowing X11 display lock-free off-thread rendering
+ // Decoupled X11 Device/Screen allowing X11 display lock-free off-thread rendering
final long x11DeviceHandle = X11Util.openDisplay(swtDevice.getConnection());
if( 0 == x11DeviceHandle ) {
throw new RuntimeException("Error creating display(EDT): "+swtDevice.getConnection());
}
final AbstractGraphicsDevice x11Device = new X11GraphicsDevice(x11DeviceHandle, AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */);
- screen = SWTAccessor.getScreen(x11Device, -1 /* default */);
+ screen = SWTAccessor.getScreen(x11Device, -1 /* default */);
} else {
screen = SWTAccessor.getScreen(swtDevice, -1 /* default */);
}
@@ -343,17 +403,19 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
if(null == capsReqUser) {
capsReqUser = new GLCapabilities(GLProfile.getDefault(screen.getDevice()));
}
-
+
this.capsRequested = capsReqUser;
this.capsChooser = capsChooser;
- this.shareWith = shareWith;
+ if( null != shareWith ) {
+ helper.setSharedContext(null, shareWith);
+ }
// post create .. when ready
gdkWindow = 0;
x11Window = 0;
drawable = null;
context = null;
-
+
final Listener listener = new Listener () {
@Override
public void handleEvent (Event event) {
@@ -374,7 +436,17 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
addListener (SWT.Paint, listener);
addListener (SWT.Dispose, listener);
}
-
+
+ @Override
+ public final void setSharedContext(GLContext sharedContext) throws IllegalStateException {
+ helper.setSharedContext(this.context, sharedContext);
+ }
+
+ @Override
+ public final void setSharedAutoDrawable(GLAutoDrawable sharedAutoDrawable) throws IllegalStateException {
+ helper.setSharedAutoDrawable(this, sharedAutoDrawable);
+ }
+
private final UpstreamSurfaceHook swtCanvasUpStreamHook = new UpstreamSurfaceHook() {
@Override
public final void create(ProxySurface s) { /* nop */ }
@@ -401,16 +473,16 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
protected final void updateSizeCheck() {
final Rectangle oClientArea = clientArea;
final Rectangle nClientArea = GLCanvas.this.getClientArea();
- if ( nClientArea != null &&
+ if ( nClientArea != null &&
( nClientArea.width != oClientArea.width || nClientArea.height != oClientArea.height )
) {
clientArea = nClientArea; // write back new value
-
+
final GLDrawableImpl _drawable = drawable;
final boolean drawableOK = null != _drawable && _drawable.isRealized();
if(DEBUG) {
final long dh = drawableOK ? _drawable.getHandle() : 0;
- System.err.println("GLCanvas.sizeChanged: ("+Thread.currentThread().getName()+"): "+nClientArea.x+"/"+nClientArea.y+" "+nClientArea.width+"x"+nClientArea.height+" - drawableHandle 0x"+Long.toHexString(dh));
+ System.err.println(getThreadName()+": GLCanvas.sizeChanged: ("+Thread.currentThread().getName()+"): "+nClientArea.x+"/"+nClientArea.y+" "+nClientArea.width+"x"+nClientArea.height+" - drawableHandle "+toHexString(dh));
}
if( drawableOK ) {
if( ! _drawable.getChosenGLCapabilities().isOnscreen() ) {
@@ -419,14 +491,14 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
try {
final GLDrawableImpl _drawableNew = GLDrawableHelper.resizeOffscreenDrawable(_drawable, context, nClientArea.width, nClientArea.height);
if(_drawable != _drawableNew) {
- // write back
+ // write back
drawable = _drawableNew;
}
} finally {
_lock.unlock();
}
- }
- }
+ }
+ }
if(0 != x11Window) {
SWTAccessor.resizeX11Window(screen.getDevice(), clientArea, x11Window);
} else if(0 != gdkWindow) {
@@ -435,64 +507,78 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
sendReshape = true; // async if display() doesn't get called below, but avoiding deadlock
}
}
-
+
private boolean isValidAndVisibleOnEDTActionResult;
private final Runnable isValidAndVisibleOnEDTAction = new Runnable() {
@Override
- public void run() {
+ public void run() {
isValidAndVisibleOnEDTActionResult = !GLCanvas.this.isDisposed() && GLCanvas.this.isVisible();
} };
-
+
private final boolean isValidAndVisibleOnEDT() {
synchronized(isValidAndVisibleOnEDTAction) {
runOnEDTIfAvail(true, isValidAndVisibleOnEDTAction);
return isValidAndVisibleOnEDTActionResult;
}
}
-
- /** assumes drawable == null || !drawable.isRealized() ! Checks of !isDispose() and isVisible() */
+
+ /** assumes drawable == null (implying !drawable.isRealized()) ! Checks of !isDispose() and isVisible() */
protected final boolean validateDrawableAndContextWithCheck() {
if( !isValidAndVisibleOnEDT() ) {
return false;
}
- return validateDrawableAndContextPostCheck();
+ return validateDrawableAndContextPostCheck();
}
-
- /** assumes drawable == null || !drawable.isRealized() ! No check of !isDispose() and isVisible() */
- protected final boolean validateDrawableAndContextPostCheck() {
- final Rectangle nClientArea = clientArea;
- if(0 >= nClientArea.width || 0 >= nClientArea.height) {
- return false;
- }
-
- final boolean res;
+
+ private final boolean isDrawableAndContextValid() {
+ // drawable != null implies drawable.isRealized()==true
+ return null != drawable && null != context;
+ }
+
+ /** assumes drawable == null (implying !drawable.isRealized()) || context == null ! No check of !isDispose() and isVisible() */
+ private final boolean validateDrawableAndContextPostCheck() {
+ boolean res;
final RecursiveLock _lock = lock;
_lock.lock();
try {
if(null == drawable) {
- createDrawableAndContext();
+ // 'displayable' (isValidAndVisibleOnEDT()) must have been checked upfront if appropriate!
+ createDrawableImpl(); // checks clientArea size (i.e. drawable size) and perf. realization
}
- if(null != drawable) {
- drawable.setRealized(true);
- res = drawable.isRealized();
+ final GLDrawable _drawable = drawable;
+ if ( null != _drawable ) {
+ // drawable realization goes in-hand w/ it's construction
+ if( null == context ) {
+ // re-try context creation
+ res = createContextImpl(_drawable); // pending creation.
+ } else {
+ res = true;
+ }
+ if(res) {
+ sendReshape = true;
+ }
} else {
+ if(DEBUG) {
+ System.err.println(getThreadName()+": SWT.GLCanvas.validate "+toHexString(hashCode())+": null drawable");
+ }
res = false;
}
+ if(DEBUG) {
+ System.err.println(getThreadName()+": SWT.GLCanvas.validate.X "+toHexString(hashCode())+": "+res+", drawable-realized "+drawable.isRealized()+", has context "+(null!=context));
+ }
} finally {
_lock.unlock();
- }
-
- if(res) {
- sendReshape = true;
- if(DEBUG) {
- System.err.println("SWT GLCanvas realized! "+this+", "+drawable);
- // Thread.dumpStack();
- }
}
- return res;
+ return res;
}
-
- private final void createDrawableAndContext() {
+ private final void createDrawableImpl() {
+ final Rectangle nClientArea = clientArea;
+ if(0 >= nClientArea.width || 0 >= nClientArea.height) {
+ if(DEBUG) {
+ System.err.println(getThreadName()+": SWT.GLCanvas.validate.X "+toHexString(hashCode())+": drawable could not be created: size < 0x0");
+ }
+ return; // early out
+ }
final AbstractGraphicsDevice device = screen.getDevice();
device.open();
@@ -502,34 +588,60 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
final AbstractGraphicsConfiguration cfg = factory.chooseGraphicsConfiguration(
capsRequested, capsRequested, capsChooser, screen, VisualIDHolder.VID_UNDEFINED);
if(DEBUG) {
- System.err.println("SWT.GLCanvas.X11 factory: "+factory+", chosen config: "+cfg);
- }
+ System.err.println(getThreadName()+": SWT.GLCanvas.X11 "+toHexString(hashCode())+": factory: "+factory+", chosen config: "+cfg);
+ }
if (null == cfg) {
throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this);
}
final int visualID = cfg.getVisualID(VIDType.NATIVE);
if( VisualIDHolder.VID_UNDEFINED != visualID ) {
// gdkWindow = SWTAccessor.createCompatibleGDKChildWindow(this, visualID, clientArea.width, clientArea.height);
- // nativeWindowHandle = SWTAccessor.gdk_window_get_xwindow(gdkWindow);
+ // nativeWindowHandle = SWTAccessor.gdk_window_get_xwindow(gdkWindow);
x11Window = SWTAccessor.createCompatibleX11ChildWindow(screen, this, visualID, clientArea.width, clientArea.height);
nativeWindowHandle = x11Window;
} else {
- throw new GLException("Could not choose valid visualID: 0x"+Integer.toHexString(visualID)+", "+this);
+ throw new GLException("Could not choose valid visualID: "+toHexString(visualID)+", "+this);
}
} else {
nativeWindowHandle = SWTAccessor.getWindowHandle(this);
}
final GLDrawableFactory glFactory = GLDrawableFactory.getFactory(capsRequested.getGLProfile());
-
+
// Create a NativeWindow proxy for the SWT canvas
- ProxySurface proxySurface = glFactory.createProxySurface(device, screen.getIndex(), nativeWindowHandle,
+ ProxySurface proxySurface = glFactory.createProxySurface(device, screen.getIndex(), nativeWindowHandle,
capsRequested, capsChooser, swtCanvasUpStreamHook);
// Associate a GL surface with the proxy
- drawable = (GLDrawableImpl) glFactory.createGLDrawable(proxySurface);
- context = (GLContextImpl) drawable.createContext(shareWith);
- context.setContextCreationFlags(additionalCtxCreationFlags);
+ final GLDrawableImpl _drawable = (GLDrawableImpl) glFactory.createGLDrawable(proxySurface);
+ _drawable.setRealized(true);
+ if(!_drawable.isRealized()) {
+ // oops
+ if(DEBUG) {
+ System.err.println(getThreadName()+": SWT.GLCanvas.validate.X "+toHexString(hashCode())+": Drawable could not be realized: "+_drawable);
+ }
+ } else {
+ if(DEBUG) {
+ System.err.println(getThreadName()+": SWT.GLCanvas.validate "+toHexString(hashCode())+": Drawable created and realized");
+ }
+ drawable = _drawable;
+ }
+ }
+ private boolean createContextImpl(final GLDrawable drawable) {
+ final GLContext[] shareWith = { null };
+ if( !helper.isSharedGLContextPending(shareWith) ) {
+ context = (GLContextImpl) drawable.createContext(shareWith[0]);
+ context.setContextCreationFlags(additionalCtxCreationFlags);
+ if(DEBUG) {
+ System.err.println(getThreadName()+": SWT.GLCanvas.validate "+toHexString(hashCode())+": Context created: has shared "+(null != shareWith[0]));
+ }
+ return true;
+ } else {
+ if(DEBUG) {
+ System.err.println(getThreadName()+": SWT.GLCanvas.validate "+toHexString(hashCode())+": Context !created: pending share");
+ }
+ return false;
+ }
}
-
+
@Override
public void update() {
// don't paint background etc .. nop avoids flickering
@@ -543,32 +655,30 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
if(r && 0 != gdkWindow) {
SWTGTKUtil.focusGDKWindow(gdkWindow);
}
- return r;
+ return r;
} */
-
+
@Override
public void dispose() {
runInGLThread(disposeOnEDTGLAction);
- super.dispose();
+ super.dispose();
}
private final void displayIfNoAnimatorNoCheck() {
if ( !helper.isAnimatorAnimatingOnOtherThread() ) {
- final boolean drawableOK = null != drawable && drawable.isRealized();
- if( drawableOK || validateDrawableAndContextPostCheck() ) {
+ if( isDrawableAndContextValid() || validateDrawableAndContextPostCheck() ) {
runInGLThread(makeCurrentAndDisplayOnGLAction);
- }
+ }
}
}
-
+
//
// GL[Auto]Drawable
//
-
+
@Override
public void display() {
- final boolean drawableOK = null != drawable && drawable.isRealized();
- if( drawableOK || validateDrawableAndContextWithCheck() ) {
+ if( isDrawableAndContextValid() || validateDrawableAndContextWithCheck() ) {
runInGLThread(makeCurrentAndDisplayOnGLAction);
}
}
@@ -577,7 +687,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
public final Object getUpstreamWidget() {
return this;
}
-
+
@Override
public int getWidth() {
return clientArea.width;
@@ -593,7 +703,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
final GLDrawable _drawable = drawable;
return null != _drawable ? _drawable.isGLOriented() : true;
}
-
+
@Override
public void addGLEventListener(final GLEventListener listener) {
helper.addGLEventListener(listener);
@@ -608,29 +718,29 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
public int getGLEventListenerCount() {
return helper.getGLEventListenerCount();
}
-
+
@Override
public GLEventListener getGLEventListener(int index) throws IndexOutOfBoundsException {
return helper.getGLEventListener(index);
}
-
+
@Override
public boolean getGLEventListenerInitState(GLEventListener listener) {
return helper.getGLEventListenerInitState(listener);
}
-
+
@Override
public void setGLEventListenerInitState(GLEventListener listener, boolean initialized) {
helper.setGLEventListenerInitState(listener, initialized);
}
-
+
@Override
public GLEventListener disposeGLEventListener(GLEventListener listener, boolean remove) {
final DisposeGLEventListenerAction r = new DisposeGLEventListenerAction(listener, remove);
runInGLThread(r);
return r.listener;
}
-
+
@Override
public GLEventListener removeGLEventListener(final GLEventListener listener) {
return helper.removeGLEventListener(listener);
@@ -673,10 +783,10 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
public final GLDrawable getDelegatedDrawable() {
return drawable;
}
-
+
@Override
public GLContext getContext() {
- return null != drawable ? context : null;
+ return context;
}
@Override
@@ -694,12 +804,12 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
public boolean invoke(final boolean wait, final GLRunnable runnable) {
return helper.invoke(this, wait, runnable);
}
-
+
@Override
public boolean invoke(final boolean wait, final List<GLRunnable> runnables) {
return helper.invoke(this, wait, runnables);
}
-
+
@Override
public void setAnimator(final GLAnimatorControl arg0) throws GLException {
helper.setAnimator(arg0);
@@ -714,7 +824,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
public GLContext setContext(GLContext newCtx, boolean destroyPrevCtx) {
final RecursiveLock _lock = lock;
_lock.lock();
- try {
+ try {
final GLContext oldCtx = context;
GLDrawableHelper.switchContext(drawable, oldCtx, destroyPrevCtx, newCtx, additionalCtxCreationFlags);
context=(GLContextImpl)newCtx;
@@ -761,7 +871,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
@Override
public GLCapabilitiesImmutable getChosenGLCapabilities() {
- final GLDrawable _drawable = drawable;
+ final GLDrawable _drawable = drawable;
return null != _drawable ? (GLCapabilitiesImmutable)_drawable.getChosenGLCapabilities() : null;
}
@@ -771,7 +881,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
* @return Non-null GLCapabilities.
*/
public GLCapabilitiesImmutable getRequestedGLCapabilities() {
- final GLDrawable _drawable = drawable;
+ final GLDrawable _drawable = drawable;
return null != _drawable ? (GLCapabilitiesImmutable)_drawable.getNativeSurface().getGraphicsConfiguration().getRequestedCapabilities() : null;
}
@@ -788,7 +898,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
@Override
public long getHandle() {
- final GLDrawable _drawable = drawable;
+ final GLDrawable _drawable = drawable;
return (_drawable != null) ? _drawable.getHandle() : 0;
}
@@ -827,12 +937,12 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
* <ul>
* <!--li>Use {@link Threading#invokeOnOpenGLThread(boolean, Runnable)}</li-->
* <li>Current thread</li>
- * </ul></li>
+ * </ul></li>
* </ul>
- * The current thread seems to be valid for all platforms,
+ * The current thread seems to be valid for all platforms,
* since no SWT lifecycle tasks are being performed w/ this call.
* Only GL task, which are independent from the SWT threading model.
- *
+ *
* @see Platform#AWT_AVAILABLE
* @see Platform#getOSType()
*/
@@ -854,8 +964,8 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
} */
action.run();
}
-
- private void runOnEDTIfAvail(boolean wait, final Runnable action) {
+
+ private void runOnEDTIfAvail(boolean wait, final Runnable action) {
final Display d = isDisposed() ? null : getDisplay();
if( null == d || d.isDisposed() || d.getThread() == Thread.currentThread() ) {
action.run();
@@ -875,11 +985,11 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
return "SWT-GLCanvas[Realized "+isRealized()+
",\n\t"+((null!=_drawable)?_drawable.getClass().getName():"null-drawable")+
",\n\tFactory "+getFactory()+
- ",\n\thandle 0x"+Long.toHexString(getHandle())+
+ ",\n\thandle "+toHexString(getHandle())+
",\n\tDrawable size "+dw+"x"+dh+
",\n\tSWT size "+getWidth()+"x"+getHeight()+"]";
}
-
+
public static void main(final String[] args) {
System.err.println(VersionUtil.getPlatformInfo());
System.err.println(GlueGenVersion.getInstance());
@@ -894,7 +1004,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable {
shell.setSize(128,128);
shell.setLayout(new FillLayout());
- final GLCanvas canvas = new GLCanvas(shell, 0, caps, null, null);
+ final GLCanvas canvas = new GLCanvas(shell, 0, caps, null);
canvas.addGLEventListener(new GLEventListener() {
@Override
diff --git a/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java b/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java
index 8de178e..d0de3b3 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -58,6 +58,7 @@ class AWTAnimatorImpl implements AnimatorBase.AnimatorImpl {
private Map<RepaintManager,RepaintManager> repaintManagers = new IdentityHashMap<RepaintManager,RepaintManager>();
private Map<JComponent,Rectangle> dirtyRegions = new IdentityHashMap<JComponent,Rectangle>();
+ @Override
public void display(ArrayList<GLAutoDrawable> drawables,
boolean ignoreExceptions,
boolean printExceptions) {
@@ -97,6 +98,7 @@ class AWTAnimatorImpl implements AnimatorBase.AnimatorImpl {
// Uses RepaintManager APIs to implement more efficient redrawing of
// the Swing widgets we're animating
private Runnable drawWithRepaintManagerRunnable = new Runnable() {
+ @Override
public void run() {
for (Iterator<JComponent> iter = lightweights.iterator(); iter.hasNext(); ) {
JComponent comp = iter.next();
@@ -164,6 +166,7 @@ class AWTAnimatorImpl implements AnimatorBase.AnimatorImpl {
}
};
+ @Override
public boolean blockUntilDone(Thread thread) {
return Thread.currentThread() != thread && !EventQueue.isDispatchThread();
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
index ac2b241..27b9427 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -57,7 +57,7 @@ import javax.media.opengl.GLException;
* Call {@link #stop() } to terminate the animation and it's execution thread.
* </p>
*/
-public class Animator extends AnimatorBase {
+public class Animator extends AnimatorBase {
protected ThreadGroup threadGroup;
private Runnable runnable;
private boolean runAsFastAsPossible;
@@ -75,7 +75,7 @@ public class Animator extends AnimatorBase {
}
}
- /**
+ /**
* Creates a new Animator w/ an associated ThreadGroup.
*/
public Animator(ThreadGroup tg) {
@@ -86,7 +86,7 @@ public class Animator extends AnimatorBase {
}
}
- /**
+ /**
* Creates a new Animator for a particular drawable.
*/
public Animator(GLAutoDrawable drawable) {
@@ -97,7 +97,7 @@ public class Animator extends AnimatorBase {
}
}
- /**
+ /**
* Creates a new Animator w/ an associated ThreadGroup for a particular drawable.
*/
public Animator(ThreadGroup tg, GLAutoDrawable drawable) {
@@ -109,6 +109,7 @@ public class Animator extends AnimatorBase {
}
}
+ @Override
protected String getBaseName(String prefix) {
return prefix + "Animator" ;
}
@@ -127,7 +128,7 @@ public class Animator extends AnimatorBase {
stateSync.unlock();
}
}
-
+
private final void setIsAnimatingSynced(boolean v) {
stateSync.lock();
try {
@@ -138,10 +139,12 @@ public class Animator extends AnimatorBase {
}
class MainLoop implements Runnable {
+ @Override
public String toString() {
return "[started "+isStartedImpl()+", animating "+isAnimatingImpl()+", paused "+isPausedImpl()+", drawable "+drawables.size()+", drawablesEmpty "+drawablesEmpty+"]";
}
+ @Override
public void run() {
try {
if(DEBUG) {
@@ -185,7 +188,7 @@ public class Animator extends AnimatorBase {
}
if (!stopIssued && !isAnimating) {
// Wakes up 'waitForStartedCondition' sync
- // - and -
+ // - and -
// Resume from pause or drawablesEmpty,
// implies !pauseIssued and !drawablesEmpty
setIsAnimatingSynced(true); // barrier
@@ -201,6 +204,11 @@ public class Animator extends AnimatorBase {
Thread.yield();
}
}
+ } catch( ThreadDeath td) {
+ if(DEBUG) {
+ System.err.println("Animator Catched: "+td.getClass().getName()+": "+td.getMessage());
+ td.printStackTrace();
+ }
} finally {
if( exclusiveContext && !drawablesEmpty ) {
setDrawablesExclCtxState(false);
@@ -223,6 +231,7 @@ public class Animator extends AnimatorBase {
private final boolean isAnimatingImpl() {
return animThread != null && isAnimating ;
}
+ @Override
public final boolean isAnimating() {
stateSync.lock();
try {
@@ -235,6 +244,7 @@ public class Animator extends AnimatorBase {
private final boolean isPausedImpl() {
return animThread != null && pauseIssued ;
}
+ @Override
public final boolean isPaused() {
stateSync.lock();
try {
@@ -246,7 +256,7 @@ public class Animator extends AnimatorBase {
/**
* Set a {@link ThreadGroup} for the {@link #getThread() animation thread}.
- *
+ *
* @param tg the {@link ThreadGroup}
* @throws GLException if the animator has already been started
*/
@@ -256,7 +266,8 @@ public class Animator extends AnimatorBase {
}
threadGroup = tg;
}
-
+
+ @Override
public synchronized boolean start() {
if ( isStartedImpl() ) {
return false;
@@ -272,7 +283,7 @@ public class Animator extends AnimatorBase {
} else {
thread = new Thread(threadGroup, runnable, threadName);
}
- thread.setDaemon(false); // force to be non daemon, regardless of parent thread
+ thread.setDaemon(false); // force to be non daemon, regardless of parent thread
if(DEBUG) {
final Thread ct = Thread.currentThread();
System.err.println("Animator "+ct.getName()+"[daemon "+ct.isDaemon()+"]: starting "+thread.getName()+"[daemon "+thread.isDaemon()+"]");
@@ -281,10 +292,12 @@ public class Animator extends AnimatorBase {
return finishLifecycleAction(waitForStartedCondition, 0);
}
private final Condition waitForStartedCondition = new Condition() {
+ @Override
public boolean eval() {
return !isStartedImpl() || (!drawablesEmpty && !isAnimating) ;
- } };
+ } };
+ @Override
public synchronized boolean stop() {
if ( !isStartedImpl() ) {
return false;
@@ -293,10 +306,12 @@ public class Animator extends AnimatorBase {
return finishLifecycleAction(waitForStoppedCondition, 0);
}
private final Condition waitForStoppedCondition = new Condition() {
+ @Override
public boolean eval() {
return isStartedImpl();
} };
+ @Override
public synchronized boolean pause() {
if ( !isStartedImpl() || pauseIssued ) {
return false;
@@ -305,11 +320,13 @@ public class Animator extends AnimatorBase {
return finishLifecycleAction(waitForPausedCondition, 0);
}
private final Condition waitForPausedCondition = new Condition() {
+ @Override
public boolean eval() {
// end waiting if stopped as well
return isStartedImpl() && isAnimating;
} };
+ @Override
public synchronized boolean resume() {
if ( !isStartedImpl() || !pauseIssued ) {
return false;
@@ -318,6 +335,7 @@ public class Animator extends AnimatorBase {
return finishLifecycleAction(waitForResumeCondition, 0);
}
private final Condition waitForResumeCondition = new Condition() {
+ @Override
public boolean eval() {
// end waiting if stopped as well
return isStartedImpl() && ( !drawablesEmpty && !isAnimating || drawablesEmpty && !pauseIssued ) ;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
index ef92100..f6ee337 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
@@ -52,14 +52,14 @@ import javax.media.opengl.GLProfile;
*/
public abstract class AnimatorBase implements GLAnimatorControl {
protected static final boolean DEBUG = Debug.debug("Animator");
-
+
/** A 1s timeout while waiting for a native action response, limiting {@link #finishLifecycleAction(Condition, long)} */
protected static final long TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION = 1000;
-
+
protected static final long POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION = 32; // 2 frames @ 60Hz
-
+
/**
- * If present in <code>modeBits</code> field and
+ * If present in <code>modeBits</code> field and
* {@link GLProfile#isAWTAvailable() AWT is available},
* implementation is aware of the AWT EDT, otherwise not.
* <p>
@@ -67,8 +67,8 @@ public abstract class AnimatorBase implements GLAnimatorControl {
* </p>
* @see #setModeBits(boolean, int)
*/
- public static final int MODE_EXPECT_AWT_RENDERING_THREAD = 1 << 0;
-
+ public static final int MODE_EXPECT_AWT_RENDERING_THREAD = 1 << 0;
+
public interface AnimatorImpl {
void display(ArrayList<GLAutoDrawable> drawables, boolean ignoreExceptions, boolean printExceptions);
boolean blockUntilDone(Thread thread);
@@ -77,7 +77,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
protected int modeBits;
protected AnimatorImpl impl;
protected String baseName;
-
+
protected ArrayList<GLAutoDrawable> drawables = new ArrayList<GLAutoDrawable>();
protected boolean drawablesEmpty;
protected Thread animThread;
@@ -85,10 +85,10 @@ public abstract class AnimatorBase implements GLAnimatorControl {
protected boolean printExceptions;
protected boolean exclusiveContext;
protected Thread userExclusiveContextThread;
- protected FPSCounterImpl fpsCounter = new FPSCounterImpl();
+ protected FPSCounterImpl fpsCounter = new FPSCounterImpl();
protected RecursiveLock stateSync = LockFactory.createRecursiveLock();
-
- private final static Class<?> awtAnimatorImplClazz;
+
+ private final static Class<?> awtAnimatorImplClazz;
static {
GLProfile.initSingleton();
if( GLProfile.isAWTAvailable() ) {
@@ -96,7 +96,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
try {
clazz = Class.forName("com.jogamp.opengl.util.AWTAnimatorImpl");
} catch (Exception e) {
- clazz = null;
+ clazz = null;
}
awtAnimatorImplClazz = clazz;
} else {
@@ -105,29 +105,29 @@ public abstract class AnimatorBase implements GLAnimatorControl {
}
/**
- * Creates a new, empty Animator instance
+ * Creates a new, empty Animator instance
* while expecting an AWT rendering thread if AWT is available.
- *
+ *
* @see GLProfile#isAWTAvailable()
*/
public AnimatorBase() {
- modeBits = MODE_EXPECT_AWT_RENDERING_THREAD; // default!
+ modeBits = MODE_EXPECT_AWT_RENDERING_THREAD; // default!
drawablesEmpty = true;
}
-
+
private static final boolean useAWTAnimatorImpl(int modeBits) {
return 0 != ( MODE_EXPECT_AWT_RENDERING_THREAD & modeBits ) && null != awtAnimatorImplClazz;
}
-
+
/**
* Initializes implementation details post setup,
* invoked at {@link #add(GLAutoDrawable)}, {@link #start()}, ..
* <p>
- * Operation is a NOP if <code>force</code> is <code>false</code>
+ * Operation is a NOP if <code>force</code> is <code>false</code>
* and this instance is already initialized.
- * </p>
- *
- * @throws GLException if Animator is {@link #isStarted()}
+ * </p>
+ *
+ * @throws GLException if Animator is {@link #isStarted()}
*/
protected synchronized void initImpl(boolean force) {
if( force || null == impl ) {
@@ -153,8 +153,8 @@ public abstract class AnimatorBase implements GLAnimatorControl {
* in this Animators <code>modeBits</code>.
* @param enable
* @param bitValues
- *
- * @throws GLException if Animator is {@link #isStarted()} and {@link #MODE_EXPECT_AWT_RENDERING_THREAD} about to change
+ *
+ * @throws GLException if Animator is {@link #isStarted()} and {@link #MODE_EXPECT_AWT_RENDERING_THREAD} about to change
* @see AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD
*/
public synchronized void setModeBits(boolean enable, int bitValues) throws GLException {
@@ -172,8 +172,8 @@ public abstract class AnimatorBase implements GLAnimatorControl {
}
}
public synchronized int getModeBits() { return modeBits; }
-
-
+
+
@Override
public synchronized void add(final GLAutoDrawable drawable) {
if(DEBUG) {
@@ -190,10 +190,11 @@ public abstract class AnimatorBase implements GLAnimatorControl {
drawables.add(drawable);
drawablesEmpty = drawables.size() == 0;
drawable.setAnimator(this);
- if( isPaused() ) { // either paused by pause() above, or if previously drawablesEmpty==true
+ if( isPaused() ) { // either paused by pause() above, or if previously drawablesEmpty==true
resume();
}
final Condition waitForAnimatingAndECTCondition = new Condition() {
+ @Override
public boolean eval() {
final Thread dect = drawable.getExclusiveContextThread();
return isStarted() && !isPaused() && !isAnimating() && ( exclusiveContext && null == dect || !exclusiveContext && null != dect );
@@ -213,10 +214,11 @@ public abstract class AnimatorBase implements GLAnimatorControl {
if( !drawables.contains(drawable) ) {
throw new IllegalArgumentException("Drawable not added to animator: "+this+", "+drawable);
}
-
+
if( exclusiveContext && isAnimating() ) {
drawable.setExclusiveContextThread( null );
final Condition waitForNullECTCondition = new Condition() {
+ @Override
public boolean eval() {
return null != drawable.getExclusiveContextThread();
} };
@@ -240,11 +242,12 @@ public abstract class AnimatorBase implements GLAnimatorControl {
notifyAll();
}
private final Condition waitForNotAnimatingIfEmptyCondition = new Condition() {
+ @Override
public boolean eval() {
return isStarted() && drawablesEmpty && isAnimating();
} };
-
+
/**
* Dedicate all {@link GLAutoDrawable}'s context to the given exclusive context thread.
* <p>
@@ -252,14 +255,14 @@ public abstract class AnimatorBase implements GLAnimatorControl {
* </p>
* <p>
* If already started and disabling, method waits
- * until change is propagated to all {@link GLAutoDrawable} if not
+ * until change is propagated to all {@link GLAutoDrawable} if not
* called from the animator thread or {@link #getExclusiveContextThread() exclusive context thread}.
* </p>
* <p>
* Note: Utilizing this feature w/ AWT could lead to an AWT-EDT deadlock, depending on the AWT implementation.
* Hence it is advised not to use it with native AWT GLAutoDrawable like GLCanvas.
* </p>
- *
+ *
* @param enable
* @return previous value
* @see #setExclusiveContext(boolean)
@@ -272,7 +275,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
final boolean enable = null != t;
stateSync.lock();
try {
- old = userExclusiveContextThread;
+ old = userExclusiveContextThread;
if( enable && t != animThread ) { // disable: will be cleared at end after propagation && filter out own animThread usae
userExclusiveContextThread=t;
}
@@ -282,7 +285,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
setExclusiveContext(enable);
return old;
}
-
+
/**
* Dedicate all {@link GLAutoDrawable}'s context to this animator thread.
* <p>
@@ -290,14 +293,14 @@ public abstract class AnimatorBase implements GLAnimatorControl {
* </p>
* <p>
* If already started and disabling, method waits
- * until change is propagated to all {@link GLAutoDrawable} if not
+ * until change is propagated to all {@link GLAutoDrawable} if not
* called from the animator thread or {@link #getExclusiveContextThread() exclusive context thread}.
* </p>
* <p>
* Note: Utilizing this feature w/ AWT could lead to an AWT-EDT deadlock, depending on the AWT implementation.
* Hence it is advised not to use it with native AWT GLAutoDrawable like GLCanvas.
* </p>
- *
+ *
* @param enable
* @return previous value
* @see #setExclusiveContext(Thread)
@@ -349,24 +352,24 @@ public abstract class AnimatorBase implements GLAnimatorControl {
System.err.println("AnimatorBase.setExclusiveContextThread: all-GLAD Ok: "+validateDrawablesExclCtxState(dECT)+", "+this);
}
return oldExclusiveContext;
- }
-
+ }
+
/**
* Returns <code>true</code>, if the exclusive context thread is enabled, otherwise <code>false</code>.
- *
+ *
* @see #setExclusiveContext(boolean)
* @see #setExclusiveContext(Thread)
*/
// @Override
- public final boolean isExclusiveContextEnabled() {
+ public final boolean isExclusiveContextEnabled() {
stateSync.lock();
try {
- return exclusiveContext;
+ return exclusiveContext;
} finally {
stateSync.unlock();
}
}
-
+
/**
* Returns the exclusive context thread if {@link #isExclusiveContextEnabled()} and {@link #isStarted()}, otherwise <code>null</code>.
* <p>
@@ -381,7 +384,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
* @see #setExclusiveContext(Thread)
*/
// @Override
- public final Thread getExclusiveContextThread() {
+ public final Thread getExclusiveContextThread() {
stateSync.lock();
try {
return ( isStartedImpl() && exclusiveContext ) ? ( null != userExclusiveContextThread ? userExclusiveContextThread : animThread ) : null ;
@@ -389,7 +392,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
stateSync.unlock();
}
}
-
+
/**
* Should be called at {@link #start()} and {@link #stop()}
* from within the animator thread.
@@ -407,7 +410,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
for (int i=0; i<drawables.size(); i++) {
try {
drawables.get(i).setExclusiveContextThread( enable ? ect : null );
- } catch (RuntimeException e) {
+ } catch (RuntimeException e) {
e.printStackTrace();
}
}
@@ -420,7 +423,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
}
return true;
}
-
+
@Override
public final Thread getThread() {
stateSync.lock();
@@ -445,7 +448,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
public final void setUpdateFPSFrames(int frames, PrintStream out) {
fpsCounter.setUpdateFPSFrames(frames, out);
}
-
+
@Override
public final void resetFPSCounter() {
fpsCounter.resetFPSCounter();
@@ -455,7 +458,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
public final int getUpdateFPSFrames() {
return fpsCounter.getUpdateFPSFrames();
}
-
+
@Override
public final long getFPSStartTime() {
return fpsCounter.getFPSStartTime();
@@ -470,12 +473,12 @@ public abstract class AnimatorBase implements GLAnimatorControl {
public final long getLastFPSPeriod() {
return fpsCounter.getLastFPSPeriod();
}
-
+
@Override
public final float getLastFPS() {
return fpsCounter.getLastFPS();
}
-
+
@Override
public final int getTotalFPSFrames() {
return fpsCounter.getTotalFPSFrames();
@@ -485,11 +488,11 @@ public abstract class AnimatorBase implements GLAnimatorControl {
public final long getTotalFPSDuration() {
return fpsCounter.getTotalFPSDuration();
}
-
+
@Override
public final float getTotalFPS() {
return fpsCounter.getTotalFPS();
- }
+ }
/** Sets a flag causing this Animator to ignore exceptions produced
while redrawing the drawables. By default this flag is set to
@@ -512,10 +515,10 @@ public abstract class AnimatorBase implements GLAnimatorControl {
*/
boolean eval();
}
-
+
/**
* @param waitCondition method will wait until TO is reached or {@link Condition#eval() waitCondition.eval()} returns <code>false</code>.
- * @param pollPeriod if <code>0</code>, method will wait until TO is reached or being notified.
+ * @param pollPeriod if <code>0</code>, method will wait until TO is reached or being notified.
* if > <code>0</code>, method will wait for the given <code>pollPeriod</code> in milliseconds.
* @return <code>true</code> if {@link Condition#eval() waitCondition.eval()} returned <code>false</code>, otherwise <code>false</code>.
*/
@@ -545,11 +548,11 @@ public abstract class AnimatorBase implements GLAnimatorControl {
if( remaining<=0 && nok ) {
System.err.println("finishLifecycleAction(" + waitCondition.getClass().getName() + "): ++++++ timeout reached ++++++ " + getThreadName());
}
- stateSync.lock(); // avoid too many lock/unlock ops
+ stateSync.lock(); // avoid too many lock/unlock ops
try {
System.err.println("finishLifecycleAction(" + waitCondition.getClass().getName() + "): OK "+(!nok)+
"- pollPeriod "+pollPeriod+", blocking "+blocking+
- ", waited " + (blocking ? ( TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION - remaining ) : 0 ) + "/" + TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION +
+ ", waited " + (blocking ? ( TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION - remaining ) : 0 ) + "/" + TO_WAIT_FOR_FINISH_LIFECYCLE_ACTION +
" - " + getThreadName());
System.err.println(" - "+toString());
} finally {
@@ -577,6 +580,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
protected static String getThreadName() { return Thread.currentThread().getName(); }
+ @Override
public String toString() {
return getClass().getName()+"[started "+isStarted()+", animating "+isAnimating()+", paused "+isPaused()+", drawable "+drawables.size()+
", totals[dt "+getTotalFPSDuration()+", frames "+getTotalFPSFrames()+", fps "+getTotalFPS()+
diff --git a/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java b/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java
index bbd2951..a9c6e64 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -41,6 +41,7 @@ import javax.media.opengl.GLAutoDrawable;
up this behavior if desired. */
class DefaultAnimatorImpl implements AnimatorBase.AnimatorImpl {
+ @Override
public void display(ArrayList<GLAutoDrawable> drawables,
boolean ignoreExceptions,
boolean printExceptions) {
@@ -60,6 +61,7 @@ class DefaultAnimatorImpl implements AnimatorBase.AnimatorImpl {
}
}
+ @Override
public boolean blockUntilDone(Thread thread) {
return Thread.currentThread() != thread;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
index 7613efe..351c47e 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -45,10 +45,10 @@ import java.util.TimerTask;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLException;
-/**
+/**
* An Animator subclass which attempts to achieve a target
* frames-per-second rate to avoid using all CPU time. The target FPS
- * is only an estimate and is not guaranteed.
+ * is only an estimate and is not guaranteed.
* <p>
* The Animator execution thread does not run as a daemon thread,
* so it is able to keep an application from terminating.<br>
@@ -64,6 +64,7 @@ public class FPSAnimator extends AnimatorBase {
private volatile boolean shouldRun; // MainTask trigger
private volatile boolean shouldStop; // MainTask trigger
+ @Override
protected String getBaseName(String prefix) {
return "FPS" + prefix + "Animator" ;
}
@@ -105,45 +106,47 @@ public class FPSAnimator extends AnimatorBase {
* @param fps
* @throws GLException if the animator has already been started
*/
- public final synchronized void setFPS(int fps) throws GLException {
+ public final synchronized void setFPS(int fps) throws GLException {
if ( isStartedImpl() ) {
throw new GLException("Animator already started.");
}
- this.fps = fps;
+ this.fps = fps;
}
public final int getFPS() { return fps; }
-
+
class MainTask extends TimerTask {
private boolean justStarted;
private boolean alreadyStopped;
private boolean alreadyPaused;
-
+
public MainTask() {
}
-
+
public void start(Timer timer) {
fpsCounter.resetFPSCounter();
shouldRun = true;
shouldStop = false;
-
+
justStarted = true;
alreadyStopped = false;
alreadyPaused = false;
- final long period = 0 < fps ? (long) (1000.0f / (float) fps) : 1; // 0 -> 1: IllegalArgumentException: Non-positive period
+ final long period = 0 < fps ? (long) (1000.0f / (float) fps) : 1; // 0 -> 1: IllegalArgumentException: Non-positive period
if (scheduleAtFixedRate) {
timer.scheduleAtFixedRate(this, 0, period);
} else {
timer.schedule(this, 0, period);
}
}
-
+
public boolean isActive() { return !alreadyStopped && !alreadyPaused; }
-
+
+ @Override
public String toString() {
return "Task[thread "+animThread+", stopped "+alreadyStopped+", paused "+alreadyPaused+" shouldRun "+shouldRun+", shouldStop "+shouldStop+" -- started "+isStartedImpl()+", animating "+isAnimatingImpl()+", paused "+isPausedImpl()+", drawable "+drawables.size()+", drawablesEmpty "+drawablesEmpty+"]";
}
-
+
+ @Override
public void run() {
if( justStarted ) {
justStarted = false;
@@ -167,8 +170,8 @@ public class FPSAnimator extends AnimatorBase {
display();
} else if( shouldStop ) { // STOP
System.err.println("FPSAnimator P4: "+alreadyStopped+", "+ Thread.currentThread() + ": " + toString());
- this.cancel();
-
+ this.cancel();
+
if( !alreadyStopped ) {
alreadyStopped = true;
if( exclusiveContext && !drawablesEmpty ) {
@@ -184,23 +187,23 @@ public class FPSAnimator extends AnimatorBase {
FPSAnimator.this.notifyAll();
}
}
- } else {
+ } else {
System.err.println("FPSAnimator P5: "+alreadyPaused+", "+ Thread.currentThread() + ": " + toString());
this.cancel();
-
+
if( !alreadyPaused ) { // PAUSE
alreadyPaused = true;
if( exclusiveContext && !drawablesEmpty ) {
setDrawablesExclCtxState(false);
display(); // propagate exclusive change!
}
- synchronized (FPSAnimator.this) {
+ synchronized (FPSAnimator.this) {
if(DEBUG) {
System.err.println("FPSAnimator pause " + Thread.currentThread() + ": " + toString());
}
isAnimating = false;
FPSAnimator.this.notifyAll();
- }
+ }
}
}
}
@@ -208,6 +211,7 @@ public class FPSAnimator extends AnimatorBase {
private final boolean isAnimatingImpl() {
return animThread != null && isAnimating ;
}
+ @Override
public final boolean isAnimating() {
stateSync.lock();
try {
@@ -220,6 +224,7 @@ public class FPSAnimator extends AnimatorBase {
private final boolean isPausedImpl() {
return animThread != null && ( !shouldRun && !shouldStop ) ;
}
+ @Override
public final boolean isPaused() {
stateSync.lock();
try {
@@ -230,7 +235,8 @@ public class FPSAnimator extends AnimatorBase {
}
static int timerNo = 0;
-
+
+ @Override
public synchronized boolean start() {
if ( null != timer || null != task || isStartedImpl() ) {
return false;
@@ -241,8 +247,8 @@ public class FPSAnimator extends AnimatorBase {
System.err.println("FPSAnimator.start() START: "+task+", "+ Thread.currentThread() + ": " + toString());
}
task.start(timer);
-
- final boolean res = finishLifecycleAction( drawablesEmpty ? waitForStartedEmptyCondition : waitForStartedAddedCondition,
+
+ final boolean res = finishLifecycleAction( drawablesEmpty ? waitForStartedEmptyCondition : waitForStartedAddedCondition,
POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION);
if(DEBUG) {
System.err.println("FPSAnimator.start() END: "+task+", "+ Thread.currentThread() + ": " + toString());
@@ -254,21 +260,24 @@ public class FPSAnimator extends AnimatorBase {
return res;
}
private final Condition waitForStartedAddedCondition = new Condition() {
+ @Override
public boolean eval() {
return !isStartedImpl() || !isAnimating ;
- } };
+ } };
private final Condition waitForStartedEmptyCondition = new Condition() {
+ @Override
public boolean eval() {
return !isStartedImpl() || isAnimating ;
- } };
+ } };
/** Stops this FPSAnimator. Due to the implementation of the
FPSAnimator it is not guaranteed that the FPSAnimator will be
completely stopped by the time this method returns. */
+ @Override
public synchronized boolean stop() {
if ( null == timer || !isStartedImpl() ) {
return false;
- }
+ }
if(DEBUG) {
System.err.println("FPSAnimator.stop() START: "+task+", "+ Thread.currentThread() + ": " + toString());
}
@@ -281,7 +290,7 @@ public class FPSAnimator extends AnimatorBase {
shouldStop = true;
res = finishLifecycleAction(waitForStoppedCondition, POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION);
}
-
+
if(DEBUG) {
System.err.println("FPSAnimator.stop() END: "+task+", "+ Thread.currentThread() + ": " + toString());
}
@@ -297,10 +306,12 @@ public class FPSAnimator extends AnimatorBase {
return res;
}
private final Condition waitForStoppedCondition = new Condition() {
+ @Override
public boolean eval() {
return isStartedImpl();
} };
+ @Override
public synchronized boolean pause() {
if ( !isStartedImpl() || ( null != task && isPausedImpl() ) ) {
return false;
@@ -316,7 +327,7 @@ public class FPSAnimator extends AnimatorBase {
shouldRun = false;
res = finishLifecycleAction(waitForPausedCondition, POLLP_WAIT_FOR_FINISH_LIFECYCLE_ACTION);
}
-
+
if(DEBUG) {
System.err.println("FPSAnimator.pause() END: "+task+", "+ Thread.currentThread() + ": " + toString());
}
@@ -327,11 +338,13 @@ public class FPSAnimator extends AnimatorBase {
return res;
}
private final Condition waitForPausedCondition = new Condition() {
+ @Override
public boolean eval() {
// end waiting if stopped as well
return isAnimating && isStartedImpl();
} };
+ @Override
public synchronized boolean resume() {
if ( null != task || !isStartedImpl() || !isPausedImpl() ) {
return false;
@@ -353,6 +366,7 @@ public class FPSAnimator extends AnimatorBase {
return res;
}
private final Condition waitForResumeCondition = new Condition() {
+ @Override
public boolean eval() {
// end waiting if stopped as well
return !drawablesEmpty && !isAnimating && isStartedImpl();
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
index e0bbbc3..f84342e 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
@@ -28,6 +28,7 @@
package com.jogamp.opengl.util;
+import java.lang.reflect.Constructor;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
@@ -53,13 +54,13 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
* and starting with a new created Buffer object with initialElementCount size
*
* On profiles GL2 and ES1 the fixed function pipeline behavior is as expected.
- * On profile ES2 the fixed function emulation will transform these calls to
+ * On profile ES2 the fixed function emulation will transform these calls to
* EnableVertexAttribArray and VertexAttribPointer calls,
* and a predefined vertex attribute variable name will be chosen.
- *
- * The default name mapping will be used,
+ *
+ * The default name mapping will be used,
* see {@link GLPointerFuncUtil#getPredefinedArrayIndexName(int)}.
- *
+ *
* @param index The GL array index
* @param comps The array component number
* @param dataType The array index GL data type
@@ -67,7 +68,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
* @param initialElementCount
*
* @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int)
- */
+ */
public static GLArrayDataClient createFixed(int index, int comps, int dataType, boolean normalized, int initialElementCount)
throws GLException
{
@@ -82,13 +83,13 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
* and starting with a given Buffer object incl it's stride
*
* On profiles GL2 and ES1 the fixed function pipeline behavior is as expected.
- * On profile ES2 the fixed function emulation will transform these calls to
+ * On profile ES2 the fixed function emulation will transform these calls to
* EnableVertexAttribArray and VertexAttribPointer calls,
* and a predefined vertex attribute variable name will be chosen.
- *
- * The default name mapping will be used,
+ *
+ * The default name mapping will be used,
* see {@link GLPointerFuncUtil#getPredefinedArrayIndexName(int)}.
- *
+ *
* @param index The GL array index
* @param comps The array component number
* @param dataType The array index GL data type
@@ -97,8 +98,8 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
* @param buffer the user define data
*
* @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int)
- */
- public static GLArrayDataClient createFixed(int index, int comps, int dataType, boolean normalized, int stride,
+ */
+ public static GLArrayDataClient createFixed(int index, int comps, int dataType, boolean normalized, int stride,
Buffer buffer)
throws GLException
{
@@ -111,13 +112,13 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
/**
* Create a client side buffer object, using a custom GLSL array attribute name
* and starting with a new created Buffer object with initialElementCount size
- * @param name The custom name for the GL attribute.
+ * @param name The custom name for the GL attribute.
* @param comps The array component number
* @param dataType The array index GL data type
* @param normalized Whether the data shall be normalized
* @param initialElementCount
*/
- public static GLArrayDataClient createGLSL(String name, int comps,
+ public static GLArrayDataClient createGLSL(String name, int comps,
int dataType, boolean normalized, int initialElementCount)
throws GLException
{
@@ -130,7 +131,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
/**
* Create a client side buffer object, using a custom GLSL array attribute name
* and starting with a given Buffer object incl it's stride
- * @param name The custom name for the GL attribute.
+ * @param name The custom name for the GL attribute.
* @param comps The array component number
* @param dataType The array index GL data type
* @param normalized Whether the data shall be normalized
@@ -157,8 +158,8 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
}
}
}
-
- //
+
+ //
// Data read access
//
@@ -167,7 +168,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
@Override
public final boolean sealed() { return sealed; }
-
+
@Override
public final boolean enabled() { return bufferEnabled; }
@@ -195,10 +196,10 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
seal(seal);
enableBuffer(gl, seal);
}
-
+
@Override
public void enableBuffer(GL gl, boolean enable) {
- if( enableBufferAlways || bufferEnabled != enable ) {
+ if( enableBufferAlways || bufferEnabled != enable ) {
if(enable) {
checkSeal(true);
// init/generate VBO name if not done yet
@@ -208,7 +209,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
bufferEnabled = enable;
}
}
-
+
@Override
public boolean bindBuffer(GL gl, boolean bind) {
if(bind) {
@@ -218,7 +219,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
}
return glArrayHandler.bindBuffer(gl, bind);
}
-
+
@Override
public void setEnableAlways(boolean always) {
enableBufferAlways = always;
@@ -321,6 +322,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
Buffers.putf(buffer, v);
}
+ @Override
public String toString() {
return "GLArrayDataClient["+name+
", index "+index+
@@ -328,15 +330,15 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
", isVertexAttribute "+isVertexAttribute+
", usesGLSL "+usesGLSL+
", usesShaderState "+(null!=shaderState)+
- ", dataType 0x"+Integer.toHexString(componentType)+
- ", bufferClazz "+componentClazz+
+ ", dataType 0x"+Integer.toHexString(componentType)+
+ ", bufferClazz "+componentClazz+
", elements "+getElementCount()+
- ", components "+components+
+ ", components "+components+
", stride "+strideB+"b "+strideL+"c"+
- ", initialElementCount "+initialElementCount+
- ", sealed "+sealed+
- ", bufferEnabled "+bufferEnabled+
- ", bufferWritten "+bufferWritten+
+ ", initialElementCount "+initialElementCount+
+ ", sealed "+sealed+
+ ", bufferEnabled "+bufferEnabled+
+ ", bufferWritten "+bufferWritten+
", buffer "+buffer+
", alive "+alive+
"]";
@@ -345,16 +347,16 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
// non public matters
protected final boolean growBufferIfNecessary(int spare) {
- if(buffer==null || buffer.remaining()<spare) {
+ if(buffer==null || buffer.remaining()<spare) {
growBuffer(Math.max(initialElementCount, spare));
return true;
}
return false;
}
- protected final void growBuffer(int additionalElements) {
+ protected final void growBuffer(int additionalElements) {
if(!alive || sealed) {
- throw new GLException("Invalid state: "+this);
+ throw new GLException("Invalid state: "+this);
}
// add the stride delta
@@ -362,7 +364,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
final int osize = (buffer!=null) ? buffer.capacity() : 0;
final int nsize = osize + ( additionalElements * components );
-
+
if(componentClazz==ByteBuffer.class) {
ByteBuffer newBBuffer = Buffers.newDirectByteBuffer( nsize );
if(buffer!=null) {
@@ -401,18 +403,18 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
protected final void checkSeal(boolean test) throws GLException {
if(!alive) {
- throw new GLException("Invalid state: "+this);
- }
+ throw new GLException("Invalid state: "+this);
+ }
if(sealed!=test) {
if(test) {
- throw new GLException("Not Sealed yet, seal first:\n\t"+this);
+ throw new GLException("Not Sealed yet, seal first:\n\t"+this);
} else {
- throw new GLException("Already Sealed, can't modify VBO:\n\t"+this);
+ throw new GLException("Already Sealed, can't modify VBO:\n\t"+this);
}
}
}
- protected void init(String name, int index, int comps, int dataType, boolean normalized, int stride, Buffer data,
+ protected void init(String name, int index, int comps, int dataType, boolean normalized, int stride, Buffer data,
int initialElementCount, boolean isVertexAttribute, GLArrayHandler handler,
int vboName, long vboOffset, int vboUsage, int vboTarget, boolean usesGLSL)
throws GLException
@@ -433,16 +435,48 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
}
private boolean isValidated = false;
-
+
protected void init_vbo(GL gl) {
if(!isValidated ) {
isValidated = true;
validate(gl.getGLProfile(), true);
- }
+ }
}
protected GLArrayDataClient() { }
+ /**
+ * Copy Constructor
+ * <p>
+ * Buffer is {@link Buffers#slice(Buffer) sliced}, i.e. sharing content but using own state.
+ * </p>
+ * <p>
+ * All other values are simply copied.
+ * </p>
+ */
+ public GLArrayDataClient(GLArrayDataClient src) {
+ super(src);
+ this.isValidated = src.isValidated;
+ this.sealed = src.sealed;
+ this.bufferEnabled = src.bufferEnabled;
+ this.bufferWritten = src.bufferWritten;
+ this.enableBufferAlways = src.enableBufferAlways;
+ this.initialElementCount = src.initialElementCount;
+ if( null != src.glArrayHandler ) {
+ final Class<? extends GLArrayHandler> clazz = src.glArrayHandler.getClass();
+ try {
+ final Constructor<? extends GLArrayHandler> ctor = clazz.getConstructor(GLArrayDataEditable.class);
+ this.glArrayHandler = ctor.newInstance(this);
+ } catch (Exception e) {
+ throw new RuntimeException("Could not ctor "+clazz.getName()+"("+this.getClass().getName()+")", e);
+ }
+ } else {
+ this.glArrayHandler = null;
+ }
+ this.usesGLSL = src.usesGLSL;
+ this.shaderState = src.shaderState;
+ }
+
protected boolean sealed;
protected boolean bufferEnabled;
protected boolean bufferWritten;
@@ -453,6 +487,6 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
protected GLArrayHandler glArrayHandler;
protected boolean usesGLSL;
protected ShaderState shaderState;
-
+
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java
index 9b04a48..9a0f1cb 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java
@@ -31,6 +31,7 @@ public interface GLArrayDataEditable extends GLArrayData {
// Data and GL state modification ..
//
+ @Override
public void destroy(GL gl);
public void reset(GL gl);
@@ -40,24 +41,24 @@ public interface GLArrayDataEditable extends GLArrayData {
*
* @see #seal(boolean)
* @see #enableBuffer(GL, boolean)
- *
+ *
*/
public void seal(GL gl, boolean seal);
/**
- * Enables the buffer if <code>enable</code> is <code>true</code>,
+ * Enables the buffer if <code>enable</code> is <code>true</code>,
* and transfers the data if required.
* In case {@link #isVBO() VBO is used}, it is bound accordingly for the data transfer and association,
* i.e. it issued {@link #bindBuffer(GL, boolean)}.
- * The VBO buffer is unbound when the method returns.
+ * The VBO buffer is unbound when the method returns.
* <p>
- * Disables the buffer if <code>enable</code> is <code>false</code>.
+ * Disables the buffer if <code>enable</code> is <code>false</code>.
* </p>
- *
+ *
* <p>The action will only be executed,
- * if the internal enable state differs,
+ * if the internal enable state differs,
* or 'setEnableAlways' was called with 'true'.</b>
- *
+ *
* <p>It is up to the user to enable/disable the array properly,
* ie in case of multiple data sets for the same vertex attribute (VA).
* Meaning in such case usage of one set while expecting another one
@@ -68,7 +69,7 @@ public interface GLArrayDataEditable extends GLArrayData {
public void enableBuffer(GL gl, boolean enable);
/**
- * if <code>bind</code> is true and the data uses {@link #isVBO() VBO},
+ * if <code>bind</code> is true and the data uses {@link #isVBO() VBO},
* the latter will be bound and data written to the GPU if required.
* <p>
* If <code>bind</code> is false and the data uses {@link #isVBO() VBO},
@@ -79,11 +80,11 @@ public interface GLArrayDataEditable extends GLArrayData {
* to be bounded and written while keeping the VBO bound. The latter is in contrast to {@link #enableBuffer(GL, boolean)},
* which leaves the VBO unbound, since it's not required for vertex attributes or pointers.
* </p>
- *
+ *
* @param gl current GL object
- * @param bind true if VBO shall be bound and data written,
- * otherwise clear VBO binding.
- * @return true if data uses VBO and action was performed, otherwise false
+ * @param bind true if VBO shall be bound and data written,
+ * otherwise clear VBO binding.
+ * @return true if data uses VBO and action was performed, otherwise false
*/
public boolean bindBuffer(GL gl, boolean bind);
@@ -92,7 +93,7 @@ public interface GLArrayDataEditable extends GLArrayData {
*
* The default is 'false'
*
- * This is useful when you mix up
+ * This is useful when you mix up
* GLArrayData usage with conventional GL array calls
* or in case of a buggy GL VBO implementation.
*
@@ -117,7 +118,7 @@ public interface GLArrayDataEditable extends GLArrayData {
* ie position:=limit and limit:=capacity.</p>
*
* @see #seal(boolean)
- */
+ */
public void seal(boolean seal);
public void rewind();
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java
index 7e7d27b..4a12ff1 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java
@@ -29,6 +29,7 @@
package com.jogamp.opengl.util;
import java.nio.Buffer;
+import java.nio.FloatBuffer;
import javax.media.opengl.GL;
import javax.media.opengl.GL2ES2;
@@ -36,6 +37,8 @@ import javax.media.opengl.GLArrayData;
import javax.media.opengl.GLException;
import javax.media.opengl.fixedfunc.GLPointerFuncUtil;
+import com.jogamp.common.nio.Buffers;
+
import jogamp.opengl.util.GLArrayHandler;
import jogamp.opengl.util.GLArrayHandlerInterleaved;
import jogamp.opengl.util.GLDataArrayHandler;
@@ -57,13 +60,13 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
* and starting with a given Buffer object incl it's stride
*
* On profiles GL2 and ES1 the fixed function pipeline behavior is as expected.
- * On profile ES2 the fixed function emulation will transform these calls to
+ * On profile ES2 the fixed function emulation will transform these calls to
* EnableVertexAttribArray and VertexAttribPointer calls,
* and a predefined vertex attribute variable name will be chosen.
- *
- * The default name mapping will be used,
+ *
+ * The default name mapping will be used,
* see {@link GLPointerFuncUtil#getPredefinedArrayIndexName(int)}.
- *
+ *
* @param index The GL array index
* @param comps The array component number
* @param dataType The array index GL data type
@@ -90,13 +93,13 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
* and starting with a new created Buffer object with initialElementCount size
*
* On profiles GL2 and ES1 the fixed function pipeline behavior is as expected.
- * On profile ES2 the fixed function emulation will transform these calls to
+ * On profile ES2 the fixed function emulation will transform these calls to
* EnableVertexAttribArray and VertexAttribPointer calls,
* and a predefined vertex attribute variable name will be chosen.
- *
- * The default name mapping will be used,
+ *
+ * The default name mapping will be used,
* see {@link GLPointerFuncUtil#getPredefinedArrayIndexName(int)}.
- *
+ *
* @param index The GL array index
* @param comps The array component number
* @param dataType The array index GL data type
@@ -106,7 +109,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
*
* @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int)
*/
- public static GLArrayDataServer createFixed(int index, int comps, int dataType, boolean normalized, int initialElementCount,
+ public static GLArrayDataServer createFixed(int index, int comps, int dataType, boolean normalized, int initialElementCount,
int vboUsage)
throws GLException
{
@@ -120,7 +123,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
/**
* Create a VBO, using a custom GLSL array attribute name
* and starting with a new created Buffer object with initialElementCount size
- * @param name The custom name for the GL attribute
+ * @param name The custom name for the GL attribute
* @param comps The array component number
* @param dataType The array index GL data type
* @param normalized Whether the data shall be normalized
@@ -128,20 +131,20 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
* @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW}
*/
public static GLArrayDataServer createGLSL(String name, int comps,
- int dataType, boolean normalized, int initialElementCount, int vboUsage)
- throws GLException
+ int dataType, boolean normalized, int initialElementCount, int vboUsage)
+ throws GLException
{
GLArrayDataServer ads = new GLArrayDataServer();
GLArrayHandler glArrayHandler = new GLSLArrayHandler(ads);
ads.init(name, -1, comps, dataType, normalized, 0, null, initialElementCount,
true, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true);
return ads;
- }
-
+ }
+
/**
* Create a VBO, using a custom GLSL array attribute name
* and starting with a given Buffer object incl it's stride
- * @param name The custom name for the GL attribute
+ * @param name The custom name for the GL attribute
* @param comps The array component number
* @param dataType The array index GL data type
* @param normalized Whether the data shall be normalized
@@ -151,7 +154,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
*/
public static GLArrayDataServer createGLSL(String name, int comps,
int dataType, boolean normalized, int stride, Buffer buffer,
- int vboUsage)
+ int vboUsage)
throws GLException
{
GLArrayDataServer ads = new GLArrayDataServer();
@@ -160,12 +163,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true);
return ads;
}
-
+
/**
* Create a VBO data object for any target w/o render pipeline association, ie {@link GL#GL_ELEMENT_ARRAY_BUFFER}.
- *
+ *
* Hence no index, name for a fixed function pipeline nor vertex attribute is given.
- *
+ *
* @param comps The array component number
* @param dataType The array index GL data type
* @param stride
@@ -187,16 +190,16 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
/**
* Create a VBO data object for any target w/o render pipeline association, ie {@link GL#GL_ELEMENT_ARRAY_BUFFER}.
- *
+ *
* Hence no index, name for a fixed function pipeline nor vertex attribute is given.
- *
+ *
* @param comps The array component number
* @param dataType The array index GL data type
* @param initialElementCount
* @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW}
* @param vboTarget {@link GL#GL_ELEMENT_ARRAY_BUFFER}, ..
*/
- public static GLArrayDataServer createData(int comps, int dataType, int initialElementCount,
+ public static GLArrayDataServer createData(int comps, int dataType, int initialElementCount,
int vboUsage, int vboTarget)
throws GLException
{
@@ -207,19 +210,19 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
return ads;
}
-
+
/**
* Create a VBO for fixed function interleaved array data
* starting with a new created Buffer object with initialElementCount size.
* <p>User needs to <i>configure</i> the interleaved segments via {@link #addFixedSubArray(int, int, int)}.</p>
- *
+ *
* @param comps The total number of all interleaved components.
* @param dataType The array index GL data type
* @param normalized Whether the data shall be normalized
- * @param initialElementCount
+ * @param initialElementCount
* @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW}
*/
- public static GLArrayDataServer createFixedInterleaved(int comps, int dataType, boolean normalized, int initialElementCount,
+ public static GLArrayDataServer createFixedInterleaved(int comps, int dataType, boolean normalized, int initialElementCount,
int vboUsage)
throws GLException
{
@@ -231,6 +234,28 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
}
/**
+ * Create a VBO for fixed function interleaved array data
+ * starting with a given Buffer object incl it's stride
+ * <p>User needs to <i>configure</i> the interleaved segments via {@link #addFixedSubArray(int, int, int)}.</p>
+ *
+ * @param comps The total number of all interleaved components.
+ * @param dataType The array index GL data type
+ * @param normalized Whether the data shall be normalized
+ * @param initialElementCount
+ * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW}
+ */
+ public static GLArrayDataServer createFixedInterleaved(int comps, int dataType, boolean normalized, int stride, Buffer buffer,
+ int vboUsage)
+ throws GLException
+ {
+ GLArrayDataServer ads = new GLArrayDataServer();
+ GLArrayHandler glArrayHandler = new GLArrayHandlerInterleaved(ads);
+ ads.init(GLPointerFuncUtil.mgl_InterleaveArray, -1, comps, dataType, normalized, stride, buffer, buffer.limit(), false, glArrayHandler,
+ 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, false);
+ return ads;
+ }
+
+ /**
* Configure a segment of this fixed function interleaved array (see {@link #createFixedInterleaved(int, int, boolean, int, int)}).
* <p>
* This method may be called several times as long the sum of interleaved components does not
@@ -239,7 +264,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
* The memory of the the interleaved array is being used.</p>
* <p>
* Must be called before using the array, eg: {@link #seal(boolean)}, {@link #putf(float)}, .. </p>
- *
+ *
* @param index The GL array index, maybe -1 if vboTarget is {@link GL#GL_ELEMENT_ARRAY_BUFFER}
* @param comps This interleaved array segment's component number
* @param vboTarget {@link GL#GL_ARRAY_BUFFER} or {@link GL#GL_ELEMENT_ARRAY_BUFFER}
@@ -250,32 +275,32 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
throw new GLException("Interleaved offset > total components ("+iOffC+" > "+getComponentCount()+")");
}
if(usesGLSL) {
- throw new GLException("buffer uses GLSL");
+ throw new GLException("buffer uses GLSL");
}
final GLArrayDataWrapper ad = GLArrayDataWrapper.createFixed(
- index, comps, getComponentType(),
- getNormalized(), getStride(), getBuffer(),
+ index, comps, getComponentType(),
+ getNormalized(), getStride(), getBuffer(),
getVBOName(), interleavedOffset, getVBOUsage(), vboTarget);
ad.setVBOEnabled(isVBO());
interleavedOffset += comps * getComponentSizeInBytes();
- if(GL.GL_ARRAY_BUFFER == vboTarget) {
+ if(GL.GL_ARRAY_BUFFER == vboTarget) {
glArrayHandler.addSubHandler(new GLFixedArrayHandlerFlat(ad));
}
return ad;
}
-
+
/**
* Create a VBO for GLSL interleaved array data
* starting with a new created Buffer object with initialElementCount size.
* <p>User needs to <i>configure</i> the interleaved segments via {@link #addGLSLSubArray(int, int, int)}.</p>
- *
+ *
* @param comps The total number of all interleaved components.
* @param dataType The array index GL data type
* @param normalized Whether the data shall be normalized
- * @param initialElementCount
+ * @param initialElementCount
* @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW}
*/
- public static GLArrayDataServer createGLSLInterleaved(int comps, int dataType, boolean normalized, int initialElementCount,
+ public static GLArrayDataServer createGLSLInterleaved(int comps, int dataType, boolean normalized, int initialElementCount,
int vboUsage)
throws GLException
{
@@ -285,7 +310,30 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true);
return ads;
}
-
+
+ /**
+ * Create a VBO for GLSL interleaved array data
+ * starting with a given Buffer object incl it's stride
+ * <p>User needs to <i>configure</i> the interleaved segments via {@link #addGLSLSubArray(int, int, int)}.</p>
+ *
+ * @param comps The total number of all interleaved components.
+ * @param dataType The array index GL data type
+ * @param normalized Whether the data shall be normalized
+ * @param stride
+ * @param buffer the user define data
+ * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW}
+ */
+ public static GLArrayDataServer createGLSLInterleaved(int comps, int dataType, boolean normalized, int stride, Buffer buffer,
+ int vboUsage)
+ throws GLException
+ {
+ GLArrayDataServer ads = new GLArrayDataServer();
+ GLArrayHandler glArrayHandler = new GLSLArrayHandlerInterleaved(ads);
+ ads.init(GLPointerFuncUtil.mgl_InterleaveArray, -1, comps, dataType, normalized, stride, buffer, buffer.limit(), false, glArrayHandler,
+ 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true);
+ return ads;
+ }
+
/**
* Configure a segment of this GLSL interleaved array (see {@link #createGLSLInterleaved(int, int, boolean, int, int)}).
* <p>
@@ -305,20 +353,28 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
throw new GLException("Interleaved offset > total components ("+iOffC+" > "+getComponentCount()+")");
}
if(!usesGLSL) {
- throw new GLException("buffer uses fixed function");
+ throw new GLException("buffer uses fixed function");
}
final GLArrayDataWrapper ad = GLArrayDataWrapper.createGLSL(
- name, comps, getComponentType(),
- getNormalized(), getStride(), getBuffer(),
- getVBOName(), interleavedOffset, getVBOUsage(), vboTarget);
+ name, comps, getComponentType(),
+ getNormalized(), getStride(), getBuffer(),
+ getVBOName(), interleavedOffset, getVBOUsage(), vboTarget);
ad.setVBOEnabled(isVBO());
interleavedOffset += comps * getComponentSizeInBytes();
- if(GL.GL_ARRAY_BUFFER == vboTarget) {
+ if(GL.GL_ARRAY_BUFFER == vboTarget) {
glArrayHandler.addSubHandler(new GLSLArrayHandlerFlat(ad));
}
return ad;
}
-
+
+ public final void setInterleavedOffset(int interleavedOffset) {
+ this.interleavedOffset = interleavedOffset;
+ }
+
+ public final int getInterleavedOffset() {
+ return interleavedOffset;
+ }
+
//
// Data matters GLArrayData
//
@@ -327,6 +383,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
// Data and GL state modification ..
//
+ @Override
public void destroy(GL gl) {
// super.destroy(gl):
// - GLArrayDataClient.destroy(gl): disables & clears client-side buffer
@@ -341,19 +398,21 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
}
//
- // data matters
+ // data matters
//
/**
- * Convenient way do disable the VBO behavior and
+ * Convenient way do disable the VBO behavior and
* switch to client side data one
* Only possible if buffer is defined.
*/
- public void setVBOEnabled(boolean vboUsage) {
+ @Override
+ public void setVBOEnabled(boolean vboUsage) {
checkSeal(false);
super.setVBOEnabled(vboUsage);
}
+ @Override
public String toString() {
return "GLArrayDataServer["+name+
", index "+index+
@@ -361,22 +420,22 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
", isVertexAttribute "+isVertexAttribute+
", usesGLSL "+usesGLSL+
", usesShaderState "+(null!=shaderState)+
- ", dataType 0x"+Integer.toHexString(componentType)+
- ", bufferClazz "+componentClazz+
+ ", dataType 0x"+Integer.toHexString(componentType)+
+ ", bufferClazz "+componentClazz+
", elements "+getElementCount()+
- ", components "+components+
+ ", components "+components+
", stride "+strideB+"b "+strideL+"c"+
", initialElementCount "+initialElementCount+
- ", vboEnabled "+vboEnabled+
- ", vboName "+vboName+
- ", vboUsage 0x"+Integer.toHexString(vboUsage)+
- ", vboTarget 0x"+Integer.toHexString(vboTarget)+
- ", vboOffset "+vboOffset+
- ", sealed "+sealed+
- ", bufferEnabled "+bufferEnabled+
- ", bufferWritten "+bufferWritten+
- ", buffer "+buffer+
- ", alive "+alive+
+ ", vboEnabled "+vboEnabled+
+ ", vboName "+vboName+
+ ", vboUsage 0x"+Integer.toHexString(vboUsage)+
+ ", vboTarget 0x"+Integer.toHexString(vboTarget)+
+ ", vboOffset "+vboOffset+
+ ", sealed "+sealed+
+ ", bufferEnabled "+bufferEnabled+
+ ", bufferWritten "+bufferWritten+
+ ", buffer "+buffer+
+ ", alive "+alive+
"]";
}
@@ -384,7 +443,8 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
// non public matters ..
//
- protected void init(String name, int index, int comps, int dataType, boolean normalized,
+ @Override
+ protected void init(String name, int index, int comps, int dataType, boolean normalized,
int stride, Buffer data, int initialElementCount, boolean isVertexAttribute,
GLArrayHandler glArrayHandler,
int vboName, long vboOffset, int vboUsage, int vboTarget, boolean usesGLSL)
@@ -396,6 +456,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
vboEnabled=true;
}
+ @Override
protected void init_vbo(GL gl) {
super.init_vbo(gl);
if(vboEnabled && vboName==0) {
@@ -407,7 +468,23 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
}
}
}
-
- private int interleavedOffset = 0;
+
+ protected GLArrayDataServer() { }
+
+ /**
+ * Copy Constructor
+ * <p>
+ * Buffer is {@link Buffers#slice(Buffer) sliced}, i.e. sharing content but using own state.
+ * </p>
+ * <p>
+ * All other values are simply copied.
+ * </p>
+ */
+ public GLArrayDataServer(GLArrayDataServer src) {
+ super(src);
+ this.interleavedOffset = src.interleavedOffset;
+ }
+
+ private int interleavedOffset = 0;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java
index f8b1750..068ab52 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java
@@ -42,6 +42,8 @@ import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
import javax.media.opengl.fixedfunc.GLPointerFuncUtil;
+import com.jogamp.common.nio.Buffers;
+
import jogamp.opengl.Debug;
public class GLArrayDataWrapper implements GLArrayData {
@@ -49,7 +51,7 @@ public class GLArrayDataWrapper implements GLArrayData {
/**
* Create a VBO, using a predefined fixed function array index, wrapping the given data.
- *
+ *
* @param index The GL array index
* @param comps The array component number
* @param dataType The array index GL data type
@@ -61,23 +63,23 @@ public class GLArrayDataWrapper implements GLArrayData {
* @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW}
* @param vboTarget {@link GL#GL_ARRAY_BUFFER} or {@link GL#GL_ELEMENT_ARRAY_BUFFER}
* @return the new create instance
- *
+ *
* @throws GLException
*/
- public static GLArrayDataWrapper createFixed(int index, int comps, int dataType, boolean normalized, int stride,
+ public static GLArrayDataWrapper createFixed(int index, int comps, int dataType, boolean normalized, int stride,
Buffer buffer, int vboName, long vboOffset, int vboUsage, int vboTarget)
throws GLException
{
GLArrayDataWrapper adc = new GLArrayDataWrapper();
- adc.init(null, index, comps, dataType, normalized, stride, buffer, false,
+ adc.init(null, index, comps, dataType, normalized, stride, buffer, false,
vboName, vboOffset, vboUsage, vboTarget);
return adc;
}
/**
* Create a VBO, using a custom GLSL array attribute name, wrapping the given data.
- *
- * @param name The custom name for the GL attribute, maybe null if gpuBufferTarget is {@link GL#GL_ELEMENT_ARRAY_BUFFER}
+ *
+ * @param name The custom name for the GL attribute, maybe null if gpuBufferTarget is {@link GL#GL_ELEMENT_ARRAY_BUFFER}
* @param comps The array component number
* @param dataType The array index GL data type
* @param normalized Whether the data shall be normalized
@@ -90,7 +92,7 @@ public class GLArrayDataWrapper implements GLArrayData {
* @return the new create instance
* @throws GLException
*/
- public static GLArrayDataWrapper createGLSL(String name, int comps, int dataType, boolean normalized, int stride,
+ public static GLArrayDataWrapper createGLSL(String name, int comps, int dataType, boolean normalized, int stride,
Buffer buffer, int vboName, long vboOffset, int vboUsage, int vboTarget)
throws GLException
{
@@ -102,8 +104,8 @@ public class GLArrayDataWrapper implements GLArrayData {
/**
* Validates this instance's parameter. Called automatically by {@link GLArrayDataClient} and {@link GLArrayDataServer}.
- * {@link GLArrayDataWrapper} does not validate it's instance by itself.
- *
+ * {@link GLArrayDataWrapper} does not validate it's instance by itself.
+ *
* @param glp the GLProfile to use
* @param throwException whether to throw an exception if this instance has invalid parameter or not
* @return true if this instance has invalid parameter, otherwise false
@@ -113,7 +115,7 @@ public class GLArrayDataWrapper implements GLArrayData {
if(throwException) {
throw new GLException("Instance !alive "+this);
}
- return false;
+ return false;
}
if(this.isVertexAttribute() && !glp.hasGLSL()) {
if(throwException) {
@@ -123,13 +125,13 @@ public class GLArrayDataWrapper implements GLArrayData {
}
return glp.isValidArrayDataType(getIndex(), getComponentCount(), getComponentType(), isVertexAttribute(), throwException);
}
-
+
@Override
public void associate(Object obj, boolean enable) {
// nop
}
-
- //
+
+ //
// Data read access
//
@@ -150,14 +152,14 @@ public class GLArrayDataWrapper implements GLArrayData {
location = gl.glGetAttribLocation(program, name);
return location;
}
-
+
@Override
public final int setLocation(GL2ES2 gl, int program, int location) {
this.location = location;
gl.glBindAttribLocation(program, location, name);
return location;
}
-
+
@Override
public final String getName() { return name; }
@@ -172,10 +174,10 @@ public class GLArrayDataWrapper implements GLArrayData {
@Override
public final int getVBOUsage() { return vboEnabled?vboUsage:0; }
-
+
@Override
public final int getVBOTarget() { return vboEnabled?vboTarget:0; }
-
+
@Override
public final Buffer getBuffer() { return buffer; }
@@ -187,19 +189,19 @@ public class GLArrayDataWrapper implements GLArrayData {
@Override
public final int getComponentSizeInBytes() { return componentByteSize; }
-
+
@Override
public final int getElementCount() {
if(null==buffer) return 0;
return ( buffer.position()==0 ) ? ( buffer.limit() / components ) : ( buffer.position() / components ) ;
}
-
+
@Override
public final int getSizeInBytes() {
if(null==buffer) return 0;
- return ( buffer.position()==0 ) ? ( buffer.limit() * componentByteSize ) : ( buffer.position() * componentByteSize ) ;
+ return ( buffer.position()==0 ) ? ( buffer.limit() * componentByteSize ) : ( buffer.position() * componentByteSize ) ;
}
-
+
@Override
public final boolean getNormalized() { return normalized; }
@@ -223,18 +225,18 @@ public class GLArrayDataWrapper implements GLArrayData {
", index "+index+
", location "+location+
", isVertexAttribute "+isVertexAttribute+
- ", dataType 0x"+Integer.toHexString(componentType)+
- ", bufferClazz "+componentClazz+
+ ", dataType 0x"+Integer.toHexString(componentType)+
+ ", bufferClazz "+componentClazz+
", elements "+getElementCount()+
- ", components "+components+
+ ", components "+components+
", stride "+strideB+"b "+strideL+"c"+
- ", buffer "+buffer+
- ", vboEnabled "+vboEnabled+
- ", vboName "+vboName+
- ", vboUsage 0x"+Integer.toHexString(vboUsage)+
- ", vboTarget 0x"+Integer.toHexString(vboTarget)+
- ", vboOffset "+vboOffset+
- ", alive "+alive+
+ ", buffer "+buffer+
+ ", vboEnabled "+vboEnabled+
+ ", vboName "+vboName+
+ ", vboUsage 0x"+Integer.toHexString(vboUsage)+
+ ", vboTarget 0x"+Integer.toHexString(vboTarget)+
+ ", vboOffset "+vboOffset+
+ ", alive "+alive+
"]";
}
@@ -252,12 +254,12 @@ public class GLArrayDataWrapper implements GLArrayData {
return IntBuffer.class;
case GL.GL_FLOAT:
return FloatBuffer.class;
- default:
+ default:
throw new GLException("Given OpenGL data type not supported: "+dataType);
}
}
- @Override
+ @Override
public void setName(String newName) {
location = -1;
name = newName;
@@ -267,7 +269,7 @@ public class GLArrayDataWrapper implements GLArrayData {
* Enable or disable use of VBO.
* Only possible if a VBO buffer name is defined.
* @see #setVBOName(int)
- */
+ */
public void setVBOEnabled(boolean vboEnabled) {
this.vboEnabled=vboEnabled;
}
@@ -275,31 +277,31 @@ public class GLArrayDataWrapper implements GLArrayData {
/**
* Set the VBO buffer name, if valid (!= 0) enable use of VBO,
* otherwise (==0) disable VBO usage.
- *
+ *
* @see #setVBOEnabled(boolean)
- */
+ */
public void setVBOName(int vboName) {
this.vboName=vboName;
setVBOEnabled(0!=vboName);
}
- /**
+ /**
* @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW}
- */
- public void setVBOUsage(int vboUsage) {
- this.vboUsage = vboUsage;
+ */
+ public void setVBOUsage(int vboUsage) {
+ this.vboUsage = vboUsage;
}
-
- /**
+
+ /**
* @param vboTarget either {@link GL#GL_ARRAY_BUFFER} or {@link GL#GL_ELEMENT_ARRAY_BUFFER}
- */
+ */
public void setVBOTarget(int vboTarget) {
this.vboTarget = vboTarget;
- }
+ }
- protected void init(String name, int index, int components, int componentType,
- boolean normalized, int stride, Buffer data,
- boolean isVertexAttribute,
+ protected void init(String name, int index, int components, int componentType,
+ boolean normalized, int stride, Buffer data,
+ boolean isVertexAttribute,
int vboName, long vboOffset, int vboUsage, int vboTarget)
throws GLException
{
@@ -307,19 +309,19 @@ public class GLArrayDataWrapper implements GLArrayData {
this.index = index;
this.location = -1;
// We can't have any dependence on the FixedFuncUtil class here for build bootstrapping reasons
-
+
if( GL.GL_ELEMENT_ARRAY_BUFFER == vboTarget ) {
// OK ..
} else if( ( 0 == vboUsage && 0 == vboTarget ) || GL.GL_ARRAY_BUFFER == vboTarget ) {
- // Set/Check name .. - Required for GLSL case. Validation and debug-name for FFP.
+ // Set/Check name .. - Required for GLSL case. Validation and debug-name for FFP.
this.name = ( null == name ) ? GLPointerFuncUtil.getPredefinedArrayIndexName(index) : name ;
if(null == this.name ) {
throw new GLException("Not a valid array buffer index: "+index);
- }
+ }
} else if( 0 < vboTarget ) {
throw new GLException("Invalid GPUBuffer target: 0x"+Integer.toHexString(vboTarget));
}
-
+
this.componentType = componentType;
componentClazz = getBufferClass(componentType);
if( GLBuffers.isGLTypeFixedPoint(componentType) ) {
@@ -329,7 +331,7 @@ public class GLArrayDataWrapper implements GLArrayData {
}
componentByteSize = GLBuffers.sizeOfGLType(componentType);
if(0 > componentByteSize) {
- throw new GLException("Given componentType not supported: "+componentType+":\n\t"+this);
+ throw new GLException("Given componentType not supported: "+componentType+":\n\t"+this);
}
if(0 >= components) {
throw new GLException("Invalid number of components: " + components);
@@ -348,7 +350,7 @@ public class GLArrayDataWrapper implements GLArrayData {
this.vboName= vboName;
this.vboEnabled= 0 != vboName ;
this.vboOffset=vboOffset;
-
+
switch(vboUsage) {
case 0: // nop
case GL.GL_STATIC_DRAW:
@@ -356,7 +358,7 @@ public class GLArrayDataWrapper implements GLArrayData {
case GL2ES2.GL_STREAM_DRAW:
break;
default:
- throw new GLException("invalid gpuBufferUsage: "+vboUsage+":\n\t"+this);
+ throw new GLException("invalid gpuBufferUsage: "+vboUsage+":\n\t"+this);
}
switch(vboTarget) {
case 0: // nop
@@ -367,12 +369,50 @@ public class GLArrayDataWrapper implements GLArrayData {
throw new GLException("invalid gpuBufferTarget: "+vboTarget+":\n\t"+this);
}
this.vboUsage=vboUsage;
- this.vboTarget=vboTarget;
+ this.vboTarget=vboTarget;
this.alive=true;
}
protected GLArrayDataWrapper() { }
+ /**
+ * Copy Constructor
+ * <p>
+ * Buffer is {@link Buffers#slice(Buffer) sliced}, i.e. sharing content but using own state.
+ * </p>
+ * <p>
+ * All other values are simply copied.
+ * </p>
+ */
+ public GLArrayDataWrapper(GLArrayDataWrapper src) {
+ this.alive = src.alive;
+ this.index = src.index;
+ this.location = src.location;
+ this.name = src.name;
+ this.components = src.components;
+ this.componentType = src.componentType;
+ this.componentClazz = src.componentClazz;
+ this.componentByteSize = src.componentByteSize;
+ this.normalized = src.normalized;
+ this.strideB = src.strideB;
+ this.strideL = src.strideL;
+ if( null != src.buffer ) {
+ if( src.buffer.position() == 0 ) {
+ this.buffer = Buffers.slice(src.buffer);
+ } else {
+ this.buffer = Buffers.slice(src.buffer, 0, src.buffer.limit());
+ }
+ } else {
+ this.buffer = null;
+ }
+ this.isVertexAttribute = src.isVertexAttribute;
+ this.vboOffset = src.vboOffset;
+ this.vboName = src.vboName;
+ this.vboEnabled = src.vboEnabled;
+ this.vboUsage = src.vboUsage;
+ this.vboTarget = src.vboTarget;
+ }
+
protected boolean alive;
protected int index;
protected int location;
@@ -390,6 +430,6 @@ public class GLArrayDataWrapper implements GLArrayData {
protected int vboName;
protected boolean vboEnabled;
protected int vboUsage;
- protected int vboTarget;
+ protected int vboTarget;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java
index 033e4a5..b9903ac 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -52,7 +52,7 @@ import com.jogamp.common.nio.Buffers;
/**
* Utility routines for dealing with direct buffers.
- *
+ *
* @author Kenneth Russel, et.al.
*/
public class GLBuffers extends Buffers {
@@ -72,11 +72,11 @@ public class GLBuffers extends Buffers {
case GL.GL_UNSIGNED_INT:
case GL2.GL_HILO16_NV:
return false;
-
+
}
return true;
}
-
+
/**
* @param glType GL primitive type
* @return false if one of GL primitive floating point types, otherwise true
@@ -92,35 +92,36 @@ public class GLBuffers extends Buffers {
case GLES2.GL_HALF_FLOAT_OES:
case GL2GL3.GL_DOUBLE:
return false;
-
+
default:
return true;
- }
+ }
}
-
+
/**
- * @param glType shall be one of (29) <br/>
+ * @param glType shall be one of (31) <br/>
* GL_BYTE, GL_UNSIGNED_BYTE, <br/>
* GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV, <br/>
* <br/>
* GL_SHORT, GL_UNSIGNED_SHORT, <br/>
- * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, <br/>
+ * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, <br/>
* GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV, <br/>
* GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV, <br/>
+ * GL_UNSIGNED_SHORT_8_8_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE, <br/>
* GL.GL_HALF_FLOAT, GLES2.GL_HALF_FLOAT_OES: <br/>
* <br/>
* GL_FIXED, GL_INT <br/>
* GL_UNSIGNED_INT, GL_UNSIGNED_INT_8_8_8_8, <br/>
- * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, <br/>
+ * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, <br/>
* GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_24_8, <br/>
- * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV <br/>
+ * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV <br/>
* GL_HILO16_NV, GL_SIGNED_HILO16_NV <br/>
* <br/>
* GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV <br/>
* <br/>
- * GL_FLOAT, GL_DOUBLE <br/>
- *
- * @return -1 if glType is unhandled, otherwise the actual value > 0
+ * GL_FLOAT, GL_DOUBLE <br/>
+ *
+ * @return -1 if glType is unhandled, otherwise the actual value > 0
*/
public static final int sizeOfGLType(int glType) {
switch (glType) { // 29
@@ -130,7 +131,7 @@ public class GLBuffers extends Buffers {
case GL2GL3.GL_UNSIGNED_BYTE_3_3_2:
case GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV:
return SIZEOF_BYTE;
-
+
case GL.GL_SHORT:
case GL.GL_UNSIGNED_SHORT:
case GL.GL_UNSIGNED_SHORT_5_6_5:
@@ -139,59 +140,62 @@ public class GLBuffers extends Buffers {
case GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV:
case GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1:
case GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ case GL2.GL_UNSIGNED_SHORT_8_8_APPLE:
+ case GL2.GL_UNSIGNED_SHORT_8_8_REV_APPLE:
case GL.GL_HALF_FLOAT:
case GLES2.GL_HALF_FLOAT_OES:
return SIZEOF_SHORT;
-
+
case GL.GL_FIXED:
case GL2ES2.GL_INT:
case GL.GL_UNSIGNED_INT:
case GL2GL3.GL_UNSIGNED_INT_8_8_8_8:
case GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:
case GL2GL3.GL_UNSIGNED_INT_10_10_10_2:
- case GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV:
+ case GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV:
case GL2GL3.GL_UNSIGNED_INT_24_8:
case GL2GL3.GL_UNSIGNED_INT_10F_11F_11F_REV:
case GL2GL3.GL_UNSIGNED_INT_5_9_9_9_REV:
case GL2.GL_HILO16_NV:
case GL2.GL_SIGNED_HILO16_NV:
return SIZEOF_INT;
-
+
case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
return SIZEOF_LONG;
-
+
case GL.GL_FLOAT:
return SIZEOF_FLOAT;
-
+
case GL2GL3.GL_DOUBLE:
return SIZEOF_DOUBLE;
}
return -1;
}
-
+
/**
- * @param glType shall be one of (29) <br/>
+ * @param glType shall be one of (31) <br/>
* GL_BYTE, GL_UNSIGNED_BYTE, <br/>
* GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV, <br/>
* <br/>
* GL_SHORT, GL_UNSIGNED_SHORT, <br/>
- * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, <br/>
+ * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, <br/>
* GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV, <br/>
* GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV, <br/>
+ * GL_UNSIGNED_SHORT_8_8_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE, <br/>
* GL_HALF_FLOAT, GL_HALF_FLOAT_OES <br/>
* <br/>
* GL_FIXED, GL_INT <br/>
* GL_UNSIGNED_INT, GL_UNSIGNED_INT_8_8_8_8, <br/>
- * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, <br/>
+ * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, <br/>
* GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_24_8, <br/>
- * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV <br/>
+ * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV <br/>
* GL_HILO16_NV, GL_SIGNED_HILO16_NV <br/>
* <br/>
* GL_FLOAT_32_UNSIGNED_INT_24_8_REV <br/>
* <br/>
- * GL_FLOAT, GL_DOUBLE <br/>
- *
- * @return null if glType is unhandled, otherwise the new Buffer object
+ * GL_FLOAT, GL_DOUBLE <br/>
+ *
+ * @return null if glType is unhandled, otherwise the new Buffer object
*/
public static final Buffer newDirectGLBuffer(int glType, int numElements) {
switch (glType) { // 29
@@ -200,7 +204,7 @@ public class GLBuffers extends Buffers {
case GL2GL3.GL_UNSIGNED_BYTE_3_3_2:
case GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV:
return newDirectByteBuffer(numElements);
-
+
case GL.GL_SHORT:
case GL.GL_UNSIGNED_SHORT:
case GL.GL_UNSIGNED_SHORT_5_6_5:
@@ -209,10 +213,12 @@ public class GLBuffers extends Buffers {
case GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV:
case GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1:
case GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ case GL2.GL_UNSIGNED_SHORT_8_8_APPLE:
+ case GL2.GL_UNSIGNED_SHORT_8_8_REV_APPLE:
case GL.GL_HALF_FLOAT:
case GLES2.GL_HALF_FLOAT_OES:
return newDirectShortBuffer(numElements);
-
+
case GL.GL_FIXED:
case GL2ES2.GL_INT:
case GL.GL_UNSIGNED_INT:
@@ -226,13 +232,13 @@ public class GLBuffers extends Buffers {
case GL2.GL_HILO16_NV:
case GL2.GL_SIGNED_HILO16_NV:
return newDirectIntBuffer(numElements);
-
+
case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
return newDirectLongBuffer(numElements);
-
+
case GL.GL_FLOAT:
return newDirectFloatBuffer(numElements);
-
+
case GL2.GL_DOUBLE:
return newDirectDoubleBuffer(numElements);
}
@@ -240,27 +246,28 @@ public class GLBuffers extends Buffers {
}
/**
- * @param glType shall be one of (29) <br/>
+ * @param glType shall be one of (31) <br/>
* GL_BYTE, GL_UNSIGNED_BYTE, <br/>
* GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV, <br/>
* <br/>
* GL_SHORT, GL_UNSIGNED_SHORT, <br/>
- * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, <br/>
+ * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, <br/>
* GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV, <br/>
* GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV, <br/>
+ * GL_UNSIGNED_SHORT_8_8_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE, <br/>
* GL_HALF_FLOAT, GL_HALF_FLOAT_OES <br/>
* <br/>
* GL_FIXED, GL_INT <br/>
* GL_UNSIGNED_INT, GL_UNSIGNED_INT_8_8_8_8, <br/>
- * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, <br/>
+ * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, <br/>
* GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_24_8, <br/>
- * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV <br/>
+ * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV <br/>
* GL_HILO16_NV, GL_SIGNED_HILO16_NV <br/>
* <br/>
* GL_FLOAT_32_UNSIGNED_INT_24_8_REV <br/>
* <br/>
- * GL_FLOAT, GL_DOUBLE <br/>
- * @return null if glType is unhandled or parent is null or bufLen is 0, otherwise the new Buffer object
+ * GL_FLOAT, GL_DOUBLE <br/>
+ * @return null if glType is unhandled or parent is null or bufLen is 0, otherwise the new Buffer object
*/
public static final Buffer sliceGLBuffer(ByteBuffer parent, int bytePos, int byteLen, int glType) {
if (parent == null || byteLen == 0) {
@@ -268,11 +275,11 @@ public class GLBuffers extends Buffers {
}
final int parentPos = parent.position();
final int parentLimit = parent.limit();
-
+
parent.position(bytePos);
parent.limit(bytePos + byteLen);
Buffer res = null;
-
+
switch (glType) { // 29
case GL.GL_BYTE:
case GL.GL_UNSIGNED_BYTE:
@@ -280,7 +287,7 @@ public class GLBuffers extends Buffers {
case GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV:
res = parent.slice().order(parent.order()); // slice and duplicate may change byte order
break;
-
+
case GL.GL_SHORT:
case GL.GL_UNSIGNED_SHORT:
case GL.GL_UNSIGNED_SHORT_5_6_5:
@@ -289,11 +296,13 @@ public class GLBuffers extends Buffers {
case GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV:
case GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1:
case GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ case GL2.GL_UNSIGNED_SHORT_8_8_APPLE:
+ case GL2.GL_UNSIGNED_SHORT_8_8_REV_APPLE:
case GL.GL_HALF_FLOAT:
case GLES2.GL_HALF_FLOAT_OES:
res = parent.slice().order(parent.order()).asShortBuffer(); // slice and duplicate may change byte order
break;
-
+
case GL.GL_FIXED:
case GL2GL3.GL_INT:
case GL2ES2.GL_UNSIGNED_INT:
@@ -308,15 +317,15 @@ public class GLBuffers extends Buffers {
case GL2.GL_SIGNED_HILO16_NV:
res = parent.slice().order(parent.order()).asIntBuffer(); // slice and duplicate may change byte order
break;
-
+
case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
res = parent.slice().order(parent.order()).asLongBuffer(); // slice and duplicate may change byte order
break;
-
+
case GL.GL_FLOAT:
res = parent.slice().order(parent.order()).asFloatBuffer(); // slice and duplicate may change byte order
break;
-
+
case GL2.GL_DOUBLE:
res = parent.slice().order(parent.order()).asDoubleBuffer(); // slice and duplicate may change byte order
break;
@@ -329,29 +338,29 @@ public class GLBuffers extends Buffers {
gl.glGetIntegerv(pname, tmp, 0);
return tmp[0];
}
-
- /**
+
+ /**
* Returns the number of bytes required to read/write a memory buffer via OpenGL
* using the current GL pixel storage state and the given parameters.
- *
+ *
* <p>This method is security critical, hence it throws an exception (fail-fast)
- * in case of an invalid alignment. In case we forgot to handle
- * proper values, please contact the maintainer.</p>
- *
+ * in case of an invalid alignment. In case we forgot to handle
+ * proper values, please contact the maintainer.</p>
+ *
* @param gl the current GL object
- *
+ *
* @param tmp a pass through integer array of size >= 1 used to store temp data (performance)
- *
+ *
* @param bytesPerPixel bytes per pixel, i.e. via {@link #bytesPerPixel(int, int)}.
* @param width in pixels
* @param height in pixels
* @param depth in pixels
- * @param pack true for read mode GPU -> CPU (pack), otherwise false for write mode CPU -> GPU (unpack)
+ * @param pack true for read mode GPU -> CPU (pack), otherwise false for write mode CPU -> GPU (unpack)
* @return required minimum size of the buffer in bytes
* @throws GLException if alignment is invalid. Please contact the maintainer if this is our bug.
*/
- public static final int sizeof(GL gl, int tmp[],
- int bytesPerPixel, int width, int height, int depth,
+ public static final int sizeof(GL gl, int tmp[],
+ int bytesPerPixel, int width, int height, int depth,
boolean pack) {
int rowLength = 0;
int skipRows = 0;
@@ -359,31 +368,31 @@ public class GLBuffers extends Buffers {
int alignment = 1;
int imageHeight = 0;
int skipImages = 0;
-
- if (pack) {
+
+ if (pack) {
alignment = glGetInteger(gl, GL.GL_PACK_ALIGNMENT, tmp);
if(gl.isGL2GL3()) {
rowLength = glGetInteger(gl, GL2GL3.GL_PACK_ROW_LENGTH, tmp);
- skipRows = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_ROWS, tmp);
+ skipRows = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_ROWS, tmp);
skipPixels = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_PIXELS, tmp);
- if (depth > 1) {
- imageHeight = glGetInteger(gl, GL2GL3.GL_PACK_IMAGE_HEIGHT, tmp);
+ if (depth > 1) {
+ imageHeight = glGetInteger(gl, GL2GL3.GL_PACK_IMAGE_HEIGHT, tmp);
skipImages = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_IMAGES, tmp);
}
}
- } else {
+ } else {
alignment = glGetInteger(gl, GL.GL_UNPACK_ALIGNMENT, tmp);
- if(gl.isGL2GL3 ()) {
- rowLength = glGetInteger(gl, GL2GL3.GL_UNPACK_ROW_LENGTH, tmp);
- skipRows = glGetInteger(gl, GL2GL3.GL_UNPACK_SKIP_ROWS, tmp);
+ if(gl.isGL2GL3 ()) {
+ rowLength = glGetInteger(gl, GL2GL3.GL_UNPACK_ROW_LENGTH, tmp);
+ skipRows = glGetInteger(gl, GL2GL3.GL_UNPACK_SKIP_ROWS, tmp);
skipPixels = glGetInteger(gl, GL2GL3.GL_UNPACK_SKIP_PIXELS, tmp);
- if (depth > 1) {
- imageHeight = glGetInteger(gl, GL2GL3.GL_UNPACK_IMAGE_HEIGHT, tmp);
+ if (depth > 1) {
+ imageHeight = glGetInteger(gl, GL2GL3.GL_UNPACK_IMAGE_HEIGHT, tmp);
skipImages = glGetInteger(gl, GL2GL3.GL_UNPACK_SKIP_IMAGES, tmp);
}
}
}
-
+
// Try to deal somewhat correctly with potentially invalid values
width = Math.max(0, width );
height = Math.max(1, height); // min 1D
@@ -392,13 +401,13 @@ public class GLBuffers extends Buffers {
skipPixels = Math.max(0, skipPixels);
alignment = Math.max(1, alignment);
skipImages = Math.max(0, skipImages);
-
+
imageHeight = ( imageHeight > 0 ) ? imageHeight : height;
rowLength = ( rowLength > 0 ) ? rowLength : width;
-
+
int rowLengthInBytes = rowLength * bytesPerPixel;
int skipBytes = skipPixels * bytesPerPixel;
-
+
switch(alignment) {
case 1:
break;
@@ -414,152 +423,158 @@ public class GLBuffers extends Buffers {
if (remainder > 0) {
skipBytes += alignment - remainder;
}
- }
+ }
break;
default:
- throw new GLException("Invalid alignment "+alignment+", must be 2**n (1,2,4,8). Pls notify the maintainer in case this is our bug.");
+ throw new GLException("Invalid alignment "+alignment+", must be 2**n (1,2,4,8). Pls notify the maintainer in case this is our bug.");
}
-
+
/**
* skipImages, depth, skipPixels and skipRows are static offsets.
*
* skipImages and depth are in multiples of image size.
*
* skipBytes and rowLengthInBytes are aligned
- *
- * rowLengthInBytes is the aligned byte offset
+ *
+ * rowLengthInBytes is the aligned byte offset
* from line n to line n+1 at the same x-axis position.
*/
return
skipBytes + // aligned skipPixels * bpp
- ( skipImages + depth - 1 ) * imageHeight * rowLengthInBytes + // aligned whole images
+ ( skipImages + depth - 1 ) * imageHeight * rowLengthInBytes + // aligned whole images
( skipRows + height - 1 ) * rowLengthInBytes + // aligned lines
- width * bytesPerPixel; // last line
+ width * bytesPerPixel; // last line
}
-
- /**
+
+ /**
* Returns the number of bytes required to read/write a memory buffer via OpenGL
* using the current GL pixel storage state and the given parameters.
- *
+ *
* <p>This method is security critical, hence it throws an exception (fail-fast)
- * in case either the format, type or alignment is unhandled. In case we forgot to handle
- * proper values, please contact the maintainer.</p>
- *
+ * in case either the format, type or alignment is unhandled. In case we forgot to handle
+ * proper values, please contact the maintainer.</p>
+ *
* <p> See {@link #bytesPerPixel(int, int)}. </p>
- *
+ *
* @param gl the current GL object
- *
+ *
* @param tmp a pass through integer array of size >= 1 used to store temp data (performance)
- *
- * @param format must be one of (26) <br/>
- * GL_COLOR_INDEX GL_STENCIL_INDEX <br/>
- * GL_DEPTH_COMPONENT GL_DEPTH_STENCIL <br/>
- * GL_RED GL_RED_INTEGER <br/>
- * GL_GREEN GL_GREEN_INTEGER <br/>
- * GL_BLUE GL_BLUE_INTEGER <br/>
- * GL_ALPHA GL_LUMINANCE (12) <br/>
- * <br/>
+ *
+ * @param format must be one of (27) <br/>
+ * GL_COLOR_INDEX GL_STENCIL_INDEX <br/>
+ * GL_DEPTH_COMPONENT GL_DEPTH_STENCIL <br/>
+ * GL_RED GL_RED_INTEGER <br/>
+ * GL_GREEN GL_GREEN_INTEGER <br/>
+ * GL_BLUE GL_BLUE_INTEGER <br/>
+ * GL_ALPHA GL_LUMINANCE (12) <br/>
+ * <br/>
* GL_LUMINANCE_ALPHA GL_RG <br/>
- * GL_RG_INTEGER GL_HILO_NV <br/>
- * GL_SIGNED_HILO_NV (5) <br/>
- * <br/>
- * GL_RGB GL_RGB_INTEGER <br/>
- * GL_BGR GL_BGR_INTEGER (4)<br/>
- * <br/>
- * GL_RGBA GL_RGBA_INTEGER <br/>
+ * GL_RG_INTEGER GL_HILO_NV <br/>
+ * GL_SIGNED_HILO_NV (5) <br/>
+ * <br/>
+ * GL_YCBCR_422_APPLE <br/>
+ * <br/>
+ * GL_RGB GL_RGB_INTEGER <br/>
+ * GL_BGR GL_BGR_INTEGER (4)<br/>
+ * <br/>
+ * GL_RGBA GL_RGBA_INTEGER <br/>
* GL_BGRA GL_BGRA_INTEGER <br/>
- * GL_ABGR_EXT (5)<br/>
- *
- * @param type must be one of (30) <br/>
- * GL_BITMAP, <br/>
+ * GL_ABGR_EXT (5)<br/>
+ *
+ * @param type must be one of (32) <br/>
+ * GL_BITMAP, <br/>
* GL_BYTE, GL_UNSIGNED_BYTE, <br/>
* GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV, <br/>
* <br/>
* GL_SHORT, GL_UNSIGNED_SHORT, <br/>
- * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, <br/>
+ * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, <br/>
* GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV, <br/>
* GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV, <br/>
+ * GL_UNSIGNED_SHORT_8_8_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE, <br/>
* GL_HALF_FLOAT, GL_HALF_FLOAT_OES <br/>
* <br/>
* GL_FIXED, GL_INT <br/>
* GL_UNSIGNED_INT, GL_UNSIGNED_INT_8_8_8_8, <br/>
- * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, <br/>
+ * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, <br/>
* GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_24_8, <br/>
- * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV <br/>
+ * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV <br/>
* GL_HILO16_NV, GL_SIGNED_HILO16_NV <br/>
* <br/>
* GL_FLOAT_32_UNSIGNED_INT_24_8_REV <br/>
* <br/>
- * GL_FLOAT, GL_DOUBLE <br/>
- *
+ * GL_FLOAT, GL_DOUBLE <br/>
+ *
* @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 pack true for read mode GPU -> CPU, otherwise false for write mode CPU -> GPU
* @return required minimum size of the buffer in bytes
* @throws GLException if format, type or alignment is not handled. Please contact the maintainer if this is our bug.
*/
- public static final int sizeof(GL gl, int tmp[],
+ public static final int sizeof(GL gl, int tmp[],
int format, int type, int width, int height, int depth,
boolean pack) throws GLException {
if (width < 0) return 0;
if (height < 0) return 0;
if (depth < 0) return 0;
-
+
final int bytesPerPixel = bytesPerPixel(format, type);
return sizeof(gl, tmp, bytesPerPixel, width, height, depth, pack);
}
-
- /**
+
+ /**
* Returns the number of bytes required for one pixel with the the given OpenGL format and type.
- *
+ *
* <p>This method is security critical, hence it throws an exception (fail-fast)
- * in case either the format, type or alignment is unhandled. In case we forgot to handle
- * proper values, please contact the maintainer.</p>
- *
+ * in case either the format, type or alignment is unhandled. In case we forgot to handle
+ * proper values, please contact the maintainer.</p>
+ *
* <p> See {@link #componentCount(int)}. </p>
- *
- * @param format must be one of (26) <br/>
- * GL_COLOR_INDEX GL_STENCIL_INDEX <br/>
- * GL_DEPTH_COMPONENT GL_DEPTH_STENCIL <br/>
- * GL_RED GL_RED_INTEGER <br/>
- * GL_GREEN GL_GREEN_INTEGER <br/>
- * GL_BLUE GL_BLUE_INTEGER <br/>
- * GL_ALPHA GL_LUMINANCE (12) <br/>
- * <br/>
+ *
+ * @param format must be one of (27) <br/>
+ * GL_COLOR_INDEX GL_STENCIL_INDEX <br/>
+ * GL_DEPTH_COMPONENT GL_DEPTH_STENCIL <br/>
+ * GL_RED GL_RED_INTEGER <br/>
+ * GL_GREEN GL_GREEN_INTEGER <br/>
+ * GL_BLUE GL_BLUE_INTEGER <br/>
+ * GL_ALPHA GL_LUMINANCE (12) <br/>
+ * <br/>
* GL_LUMINANCE_ALPHA GL_RG <br/>
- * GL_RG_INTEGER GL_HILO_NV <br/>
- * GL_SIGNED_HILO_NV (5) <br/>
- * <br/>
- * GL_RGB GL_RGB_INTEGER <br/>
- * GL_BGR GL_BGR_INTEGER (4)<br/>
- * <br/>
- * GL_RGBA GL_RGBA_INTEGER <br/>
+ * GL_RG_INTEGER GL_HILO_NV <br/>
+ * GL_SIGNED_HILO_NV (5) <br/>
+ * <br/>
+ * GL_YCBCR_422_APPLE <br/>
+ * <br/>
+ * GL_RGB GL_RGB_INTEGER <br/>
+ * GL_BGR GL_BGR_INTEGER (4)<br/>
+ * <br/>
+ * GL_RGBA GL_RGBA_INTEGER <br/>
* GL_BGRA GL_BGRA_INTEGER <br/>
- * GL_ABGR_EXT (5)<br/>
- *
- * @param type must be one of (30) <br/>
- * GL_BITMAP, <br/>
+ * GL_ABGR_EXT (5)<br/>
+ *
+ * @param type must be one of (32) <br/>
+ * GL_BITMAP, <br/>
* GL_BYTE, GL_UNSIGNED_BYTE, <br/>
* GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV, <br/>
* <br/>
* GL_SHORT, GL_UNSIGNED_SHORT, <br/>
- * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, <br/>
+ * GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, <br/>
* GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV, <br/>
* GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV, <br/>
+ * GL_UNSIGNED_SHORT_8_8_APPLE, GL_UNSIGNED_SHORT_8_8_REV_APPLE, <br/>
* GL_HALF_FLOAT, GL_HALF_FLOAT_OES <br/>
* <br/>
* GL_FIXED, GL_INT <br/>
* GL_UNSIGNED_INT, GL_UNSIGNED_INT_8_8_8_8, <br/>
- * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, <br/>
+ * GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, <br/>
* GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT_24_8, <br/>
- * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV <br/>
+ * GL_UNSIGNED_INT_10F_11F_11F_REV, GL_UNSIGNED_INT_5_9_9_9_REV <br/>
* GL_HILO16_NV, GL_SIGNED_HILO16_NV <br/>
* <br/>
* GL_FLOAT_32_UNSIGNED_INT_24_8_REV <br/>
* <br/>
- * GL_FLOAT, GL_DOUBLE <br/>
- *
+ * GL_FLOAT, GL_DOUBLE <br/>
+ *
* @return required size of one pixel in bytes
* @throws GLException if format or type alignment is not handled. Please contact the maintainer if this is our bug.
*/
@@ -567,14 +582,14 @@ public class GLBuffers extends Buffers {
int compSize = 0;
int compCount = componentCount(format);
-
+
switch (type) /* 30 */ {
case GL2.GL_BITMAP:
if (GL2.GL_COLOR_INDEX == format || GL2GL3.GL_STENCIL_INDEX == format) {
compSize = 1;
}
case GL.GL_BYTE:
- case GL.GL_UNSIGNED_BYTE:
+ case GL.GL_UNSIGNED_BYTE:
compSize = 1;
break;
case GL.GL_SHORT:
@@ -592,7 +607,7 @@ public class GLBuffers extends Buffers {
case GL2GL3.GL_DOUBLE:
compSize = 8;
break;
-
+
case GL2GL3.GL_UNSIGNED_BYTE_3_3_2:
case GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV:
compSize = 1;
@@ -604,6 +619,8 @@ public class GLBuffers extends Buffers {
case GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV:
case GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1:
case GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ case GL2.GL_UNSIGNED_SHORT_8_8_APPLE:
+ case GL2.GL_UNSIGNED_SHORT_8_8_REV_APPLE:
compSize = 2;
compCount = 1;
break;
@@ -611,7 +628,7 @@ public class GLBuffers extends Buffers {
case GL2.GL_SIGNED_HILO16_NV:
compSize = 2;
compCount = 2;
- break;
+ break;
case GL2GL3.GL_UNSIGNED_INT_8_8_8_8:
case GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:
case GL2GL3.GL_UNSIGNED_INT_10_10_10_2:
@@ -621,50 +638,52 @@ public class GLBuffers extends Buffers {
case GL2GL3.GL_UNSIGNED_INT_5_9_9_9_REV:
compSize = 4;
compCount = 1;
- break;
+ break;
case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
compSize = 8;
compCount = 1;
- break;
-
+ break;
+
default:
throw new GLException("type 0x"+Integer.toHexString(type)+"/"+"format 0x"+Integer.toHexString(format)+" not supported [yet], pls notify the maintainer in case this is our bug.");
- }
+ }
return compCount * compSize;
}
-
- /**
+
+ /**
* Returns the number of components required for the given OpenGL format.
- *
+ *
* <p>This method is security critical, hence it throws an exception (fail-fast)
- * in case either the format, type or alignment is unhandled. In case we forgot to handle
- * proper values, please contact the maintainer.</p>
- *
- * @param format must be one of (26) <br/>
- * GL_COLOR_INDEX GL_STENCIL_INDEX <br/>
- * GL_DEPTH_COMPONENT GL_DEPTH_STENCIL <br/>
- * GL_RED GL_RED_INTEGER <br/>
- * GL_GREEN GL_GREEN_INTEGER <br/>
- * GL_BLUE GL_BLUE_INTEGER <br/>
- * GL_ALPHA GL_LUMINANCE (12) <br/>
- * <br/>
+ * in case either the format, type or alignment is unhandled. In case we forgot to handle
+ * proper values, please contact the maintainer.</p>
+ *
+ * @param format must be one of (27) <br/>
+ * GL_COLOR_INDEX GL_STENCIL_INDEX <br/>
+ * GL_DEPTH_COMPONENT GL_DEPTH_STENCIL <br/>
+ * GL_RED GL_RED_INTEGER <br/>
+ * GL_GREEN GL_GREEN_INTEGER <br/>
+ * GL_BLUE GL_BLUE_INTEGER <br/>
+ * GL_ALPHA GL_LUMINANCE (12) <br/>
+ * <br/>
* GL_LUMINANCE_ALPHA GL_RG <br/>
- * GL_RG_INTEGER GL_HILO_NV <br/>
- * GL_SIGNED_HILO_NV (5) <br/>
- * <br/>
- * GL_RGB GL_RGB_INTEGER <br/>
- * GL_BGR GL_BGR_INTEGER (4)<br/>
- * <br/>
- * GL_RGBA GL_RGBA_INTEGER <br/>
+ * GL_RG_INTEGER GL_HILO_NV <br/>
+ * GL_SIGNED_HILO_NV (5) <br/>
+ * <br/>
+ * GL_YCBCR_422_APPLE <br/>
+ * <br/>
+ * GL_RGB GL_RGB_INTEGER <br/>
+ * GL_BGR GL_BGR_INTEGER (4)<br/>
+ * <br/>
+ * GL_RGBA GL_RGBA_INTEGER <br/>
* GL_BGRA GL_BGRA_INTEGER <br/>
- * GL_ABGR_EXT (5)<br/>
- *
+ * GL_ABGR_EXT (5)<br/>
+ *
* @return number of components required for the given OpenGL format
* @throws GLException if format is not handled. Please contact the maintainer if this is our bug.
*/
public static final int componentCount(int format) throws GLException {
final int compCount;
-
+
switch (format) /* 26 */ {
case GL2.GL_COLOR_INDEX:
case GL2GL3.GL_STENCIL_INDEX:
@@ -690,7 +709,10 @@ public class GLBuffers extends Buffers {
case GL.GL_RGB:
case GL2GL3.GL_RGB_INTEGER:
case GL2GL3.GL_BGR:
- case GL2GL3.GL_BGR_INTEGER:
+ case GL2GL3.GL_BGR_INTEGER:
+ compCount = 3;
+ break;
+ case GL2.GL_YCBCR_422_APPLE:
compCount = 3;
break;
case GL.GL_RGBA:
@@ -700,16 +722,16 @@ public class GLBuffers extends Buffers {
case GL2.GL_ABGR_EXT:
compCount = 4;
break;
- /* FIXME ??
+ /* FIXME ??
case GL.GL_HILO_NV:
elements = 2;
- break; */
+ break; */
default:
throw new GLException("format 0x"+Integer.toHexString(format)+" not supported [yet], pls notify the maintainer in case this is our bug.");
}
return compCount;
}
-
+
public static final int getNextPowerOf2(int number) {
if (((number-1) & number) == 0) {
//ex: 8 -> 0b1000; 8-1=7 -> 0b0111; 0b1000&0b0111 == 0
@@ -721,8 +743,8 @@ public class GLBuffers extends Buffers {
power++;
}
return (1<<power);
- }
-
+ }
+
//----------------------------------------------------------------------
// Conversion routines
//
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java
index 28349b2..ec6d54d 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -44,7 +44,7 @@ import jogamp.opengl.Debug;
*/
public class GLDrawableUtil {
protected static final boolean DEBUG = Debug.debug("GLDrawable");
-
+
public static final boolean isAnimatorStartedOnOtherThread(GLAnimatorControl animatorCtrl) {
return ( null != animatorCtrl ) ? animatorCtrl.isStarted() && animatorCtrl.getThread() != Thread.currentThread() : false ;
}
@@ -56,11 +56,11 @@ public class GLDrawableUtil {
public static final boolean isAnimatorAnimatingOnOtherThread(GLAnimatorControl animatorCtrl) {
return ( null != animatorCtrl ) ? animatorCtrl.isAnimating() && animatorCtrl.getThread() != Thread.currentThread() : false ;
}
-
+
public static final boolean isAnimatorAnimating(GLAnimatorControl animatorCtrl) {
return ( null != animatorCtrl ) ? animatorCtrl.isAnimating() : false ;
}
-
+
/**
* Moves the designated {@link GLEventListener} from {@link GLAutoDrawable} <code>src</code> to <code>dest</code>.
* If <code>preserveInitState</code> is <code>true</code>, it's initialized state is preserved
@@ -86,7 +86,7 @@ public class GLDrawableUtil {
dest.invoke(false, new GLEventListenerState.ReshapeGLEventListener(listener));
} // else .. !init state is default
}
-
+
/**
* Moves all {@link GLEventListener} from {@link GLAutoDrawable} <code>src</code> to <code>dest</code>.
* If <code>preserveInitState</code> is <code>true</code>, it's initialized state is preserved
@@ -114,7 +114,11 @@ public class GLDrawableUtil {
* Swaps the {@link GLContext} and all {@link GLEventListener} between {@link GLAutoDrawable} <code>a</code> and <code>b</code>,
* while preserving it's initialized state, resets the GL-Viewport and issuing {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape(..)}.
* <p>
- * If an {@link GLAnimatorControl} is being attached to {@link GLAutoDrawable} <code>a</code> or <code>b</code>
+ * The {@link GLAutoDrawable} to {@link GLAnimatorControl} association
+ * is also swapped.
+ * </p>
+ * <p>
+ * If an {@link GLAnimatorControl} is being attached to {@link GLAutoDrawable} <code>a</code> or <code>b</code>
* and the current thread is different than {@link GLAnimatorControl#getThread() the animator's thread}, it is paused during the operation.
* </p>
* @param a
@@ -124,31 +128,31 @@ public class GLDrawableUtil {
public static final void swapGLContextAndAllGLEventListener(GLAutoDrawable a, GLAutoDrawable b) {
final GLEventListenerState gllsA = GLEventListenerState.moveFrom(a);
final GLEventListenerState gllsB = GLEventListenerState.moveFrom(b);
-
+
gllsA.moveTo(b);
gllsB.moveTo(a);
}
-
- /**
- * Swaps the {@link GLContext} of given {@link GLAutoDrawable}
- * and {@link GLAutoDrawable#disposeGLEventListener(GLEventListener, boolean) disposes}
+
+ /**
+ * Swaps the {@link GLContext} of given {@link GLAutoDrawable}
+ * and {@link GLAutoDrawable#disposeGLEventListener(GLEventListener, boolean) disposes}
* each {@link GLEventListener} w/o removing it.
* <p>
* The GL-Viewport is reset and {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape(..)} issued implicit.
- * </p>
+ * </p>
* <p>
- * If an {@link GLAnimatorControl} is being attached to GLAutoDrawable src or dest and the current thread is different
+ * If an {@link GLAnimatorControl} is being attached to GLAutoDrawable src or dest and the current thread is different
* than {@link GLAnimatorControl#getThread() the animator's thread}, it is paused during the operation.
* </p>
* @param src
* @param dest
*/
- public static final void swapGLContext(GLAutoDrawable src, GLAutoDrawable dest) {
+ public static final void swapGLContext(GLAutoDrawable src, GLAutoDrawable dest) {
final GLAnimatorControl aAnim = src.getAnimator();
- final GLAnimatorControl bAnim = dest.getAnimator();
+ final GLAnimatorControl bAnim = dest.getAnimator();
final boolean aIsPaused = isAnimatorAnimatingOnOtherThread(aAnim) && aAnim.pause();
final boolean bIsPaused = isAnimatorAnimatingOnOtherThread(bAnim) && bAnim.pause();
-
+
for(int i = src.getGLEventListenerCount() - 1; 0 <= i; i--) {
src.disposeGLEventListener(src.getGLEventListener(i), false);
}
@@ -156,12 +160,12 @@ public class GLDrawableUtil {
dest.disposeGLEventListener(dest.getGLEventListener(i), false);
}
dest.setContext( src.setContext( dest.getContext(), false ), false );
-
+
src.invoke(true, GLEventListenerState.setViewport);
dest.invoke(true, GLEventListenerState.setViewport);
-
+
if(aIsPaused) { aAnim.resume(); }
if(bIsPaused) { bAnim.resume(); }
}
-
+
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java
index 2bd45e3..50124c3 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -31,82 +31,114 @@ import java.nio.Buffer;
import java.nio.ByteBuffer;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES2;
+import javax.media.opengl.GL2ES3;
import javax.media.opengl.GLContext;
+import javax.media.opengl.GLException;
import com.jogamp.common.nio.Buffers;
import com.jogamp.opengl.util.texture.TextureData;
-/**
+/**
* OpenGL pixel data buffer, allowing user to provide buffers via their {@link GLPixelBufferProvider} implementation.
* <p>
* {@link GLPixelBufferProvider} produces a {@link GLPixelBuffer}.
- * </p>
+ * </p>
* <p>
- * You may use {@link #defaultProvider}.
+ * You may use {@link #defaultProviderNoRowStride}.
* </p>
*/
public class GLPixelBuffer {
-
- /** Allows user to interface with another toolkit to define {@link GLPixelAttributes} and memory buffer to produce {@link TextureData}. */
+
+ /** Allows user to interface with another toolkit to define {@link GLPixelAttributes} and memory buffer to produce {@link TextureData}. */
public static interface GLPixelBufferProvider {
+ /** 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);
-
- /**
+
+ /**
* 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,
+ * 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 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.
+ * @param minByteSize if > 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore.
*/
GLPixelBuffer allocate(GL gl, GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize);
}
- /** Single {@link GLPixelBuffer} provider. */
+ /** 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}. */
+ /** 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}.
* @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(int componentCount, int width, int height, int depth, boolean pack);
}
- /**
- * Default {@link GLPixelBufferProvider} utilizing best match for {@link GLPixelAttributes}
- * and {@link GLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocating} a {@link ByteBuffer}.
- */
- public static GLPixelBufferProvider defaultProvider = new GLPixelBufferProvider() {
-
+ public static class DefaultGLPixelBufferProvider implements GLPixelBufferProvider {
+ private final boolean allowRowStride;
+
+ /**
+ * @param allowRowStride If <code>true</code>, allow row-stride, otherwise not.
+ * See {@link #getAllowRowStride()} and {@link GLPixelBuffer#requiresNewBuffer(GL, int, int, int)}.
+ */
+ public DefaultGLPixelBufferProvider(boolean allowRowStride) {
+ this.allowRowStride = allowRowStride;
+ }
+
+ @Override
+ public boolean getAllowRowStride() { return allowRowStride; }
+
@Override
public GLPixelAttributes getAttributes(GL gl, int componentCount) {
final GLContext ctx = gl.getContext();
final int dFormat, dType;
-
- if(gl.isGL2GL3() && 3 == componentCount) {
+
+ 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 = GL2ES2.GL_ALPHA;
+ }
+ dType = GL.GL_UNSIGNED_BYTE;
+ } else if( 3 == componentCount ) {
dFormat = GL.GL_RGB;
- dType = GL.GL_UNSIGNED_BYTE;
+ dType = GL.GL_UNSIGNED_BYTE;
+ } else if( 4 == componentCount ) {
+ 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 {
- dFormat = ctx.getDefaultPixelDataFormat();
- dType = ctx.getDefaultPixelDataType();
+ throw new GLException("Unsupported componentCount "+componentCount+", contact maintainer to enhance");
}
return new GLPixelAttributes(componentCount, dFormat, dType);
}
-
+
/**
* {@inheritDoc}
* <p>
@@ -116,20 +148,34 @@ public class GLPixelBuffer {
@Override
public GLPixelBuffer allocate(GL gl, GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize) {
if( minByteSize > 0 ) {
- return new GLPixelBuffer(pixelAttributes, width, height, depth, pack, Buffers.newDirectByteBuffer(minByteSize));
+ return new GLPixelBuffer(pixelAttributes, width, height, depth, pack, Buffers.newDirectByteBuffer(minByteSize), getAllowRowStride());
} else {
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));
+ return new GLPixelBuffer(pixelAttributes, width, height, depth, pack, Buffers.newDirectByteBuffer(byteSize), getAllowRowStride());
}
}
- };
-
- /** Pixel attributes. */
+ }
+
+ /**
+ * 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}.
+ */
+ public static 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}.
+ */
+ public static 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);
-
+ /** 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 */
@@ -138,7 +184,7 @@ public class GLPixelBuffer {
public final int type;
/** The OpenGL pixel size in bytes */
public final int bytesPerPixel;
-
+
/**
* Deriving {@link #componentCount} via GL <code>dataFormat</code>, i.e. {@link GLBuffers#componentCount(int)} if > 0.
* @param dataFormat GL data format
@@ -148,22 +194,34 @@ public class GLPixelBuffer {
this(0 < dataFormat ? GLBuffers.componentCount(dataFormat) : 0, dataFormat, dataType);
}
/**
- * Using user specified source {@link #componentCount}.
+ * Using user specified source {@link #componentCount}.
* @param componentCount source component count
* @param dataFormat GL data format
* @param dataType GL data type
*/
public GLPixelAttributes(int componentCount, int dataFormat, int dataType) {
+ this(componentCount, dataFormat, dataType, true);
+ }
+ private GLPixelAttributes(int componentCount, int dataFormat, int dataType, 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);
+ }
+ }
}
+ @Override
public String toString() {
return "PixelAttributes[comp "+componentCount+", fmt 0x"+Integer.toHexString(format)+", type 0x"+Integer.toHexString(type)+", bytesPerPixel "+bytesPerPixel+"]";
}
}
-
+
/** The {@link GLPixelAttributes}. */
public final GLPixelAttributes pixelAttributes;
/** Width in pixels. */
@@ -176,33 +234,47 @@ public class GLPixelBuffer {
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.
+ /**
+ * 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)}.
* However, other {@link GLPixelBufferProvider} may utilize different {@link Buffer} types.
* </p>
- */
+ */
public final Buffer buffer;
/** Buffer element size in bytes. */
public final int bufferElemSize;
-
+
+ /** Allow {@link GL2ES3#GL_PACK_ROW_LENGTH}, or {@link GL2ES2#GL_UNPACK_ROW_LENGTH}. See {@link #requiresNewBuffer(GL, int, int, int)}. */
+ public final boolean allowRowStride;
+
private boolean disposed = false;
-
+
public StringBuilder toString(StringBuilder sb) {
if(null == sb) {
sb = new StringBuilder();
}
sb.append(pixelAttributes).append(", dim ").append(width).append("x").append(height).append("x").append(depth).append(", pack ").append(pack)
- .append(", disposed ").append(disposed).append(", valid ").append(isValid()).append(", buffer[sz [bytes ").append(byteSize).append(", elemSize ").append(bufferElemSize).append(", ").append(buffer).append("]");
+ .append(", disposed ").append(disposed).append(", valid ").append(isValid())
+ .append(", buffer[bytes ").append(byteSize).append(", elemSize ").append(bufferElemSize).append(", ").append(buffer).append("]");
return sb;
}
+ @Override
public String toString() {
return "GLPixelBuffer["+toString(null).toString()+"]";
}
-
- public GLPixelBuffer(GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, Buffer buffer) {
- this.pixelAttributes = pixelAttributes;
+
+ /**
+ * @param pixelAttributes the desired {@link GLPixelAttributes}
+ * @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)}.
+ */
+ public GLPixelBuffer(GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, Buffer buffer, boolean allowRowStride) {
+ this.pixelAttributes = pixelAttributes;
this.width = width;
this.height = height;
this.depth = depth;
@@ -210,13 +282,18 @@ public class GLPixelBuffer {
this.buffer = buffer;
this.byteSize = Buffers.remainingBytes(buffer);
this.bufferElemSize = Buffers.sizeOfBufferElem(buffer);
+ this.allowRowStride = allowRowStride;
}
-
+
+ /** Allow {@link GL2ES3#GL_PACK_ROW_LENGTH}, or {@link GL2ES2#GL_UNPACK_ROW_LENGTH}. */
+ public final boolean getAllowRowStride() { return allowRowStride; }
+
/** Is not {@link #dispose() disposed} and has {@link #byteSize} > 0. */
public boolean isValid() {
return !disposed && 0 < byteSize;
}
-
+
+ /** See {@link Buffer#rewind()}. */
public Buffer rewind() {
return buffer.rewind();
}
@@ -225,41 +302,73 @@ public class GLPixelBuffer {
public int position() {
return buffer.position() * bufferElemSize;
}
-
+
/** Sets the byte position of the {@link #buffer}. */
public Buffer position(int bytePos) {
return buffer.position( bytePos / bufferElemSize );
}
-
+
+ /** Returns the byte capacity of the {@link #buffer}. */
+ public int capacity() {
+ return buffer.capacity() * bufferElemSize;
+ }
+
+ /** Returns the byte limit of the {@link #buffer}. */
+ public int limit() {
+ return buffer.limit() * bufferElemSize;
+ }
+
+ /** See {@link Buffer#flip()}. */
public Buffer flip() {
- return buffer.flip();
+ return buffer.flip();
}
-
+
+ /** See {@link Buffer#clear()}. */
public Buffer clear() {
- return buffer.clear();
+ return buffer.clear();
}
-
- /**
+
+ /**
* Returns true, if {@link #isValid() invalid} or implementation requires a new buffer based on the new size
* due to pixel alignment or byte size, otherwise false.
* <p>
* It is assumed that <code>pixelAttributes</code>, <code>depth</code> and <code>pack</code> stays the same!
* </p>
* <p>
- * The minimum required byte size equals to <code>minByteSize</code>, if > 0,
- * otherwise utilize {@link GLBuffers#sizeof(GL, int[], int, int, int, int, int, boolean) GLBuffers.sizeof(..)}
- * to calculate it.
+ * The minimum required byte size equals to <code>minByteSize</code>, if > 0,
+ * otherwise {@link GLBuffers#sizeof(GL, int[], int, int, int, int, int, boolean) GLBuffers.sizeof(..)}
+ * is being used to calculate it. This value is referred to <i>newByteSize</i>.
+ * </p>
+ * <p>
+ * If <code>{@link #allowRowStride} = false</code>,
+ * method returns <code>true</code> if the <i>newByteSize</i> > <i>currentByteSize</i>
+ * or the <code>newWidth</code> != <code>currentWidth</code>.
+ * </p>
+ * <p>
+ * If <code>{@link #allowRowStride} = true</code>, see {@link GLPixelBufferProvider#getAllowRowStride()},
+ * method returns <code>true</code> only if the <i>newByteSize</i> > <i>currentByteSize</i>.
+ * Assuming user utilizes the row-stride when dealing w/ the data, i.e. {@link GL2ES3#GL_PACK_ROW_LENGTH}.
* </p>
* @param gl the corresponding current GL context object
* @param newWidth new width in pixels
* @param newHeight new height in pixels
- * @param minByteSize if > 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore.
+ * @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)
*/
- public boolean requiresNewBuffer(GL gl, int newWidth, int newHeight, int minByteSize) {
- return !isValid() || byteSize < minByteSize;
+ public boolean requiresNewBuffer(GL gl, int newWidth, int newHeight, int newByteSize) {
+ if( !isValid() ) {
+ return true;
+ }
+ if( 0 >= newByteSize ) {
+ final int[] tmp = { 0 };
+ newByteSize = GLBuffers.sizeof(gl, tmp, pixelAttributes.bytesPerPixel, newWidth, newHeight, 1, true);
+ }
+ if( allowRowStride ) {
+ return byteSize < newByteSize;
+ }
+ return byteSize < newByteSize || width != newWidth;
}
-
+
/** Dispose resources. See {@link #isValid()}. */
public void dispose() {
disposed = true;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java b/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java
index fab80b1..1c6e974 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java
@@ -31,6 +31,7 @@ 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.GLException;
@@ -45,35 +46,35 @@ public class GLPixelStorageModes {
/** Create instance w/o {@link #save(GL)} */
public GLPixelStorageModes() {}
-
+
/** Create instance w/ {@link #save(GL)} */
public GLPixelStorageModes(GL gl) { save(gl); }
-
+
/**
- * Sets the {@link GL2ES2.GL_PACK_ALIGNMENT}.
- * <p>
+ * Sets the {@link GL#GL_PACK_ALIGNMENT}.
+ * <p>
* Saves the pixel storage modes if not saved yet.
* </p>
*/
public final void setPackAlignment(GL gl, int packAlignment) {
save(gl);
- gl.glPixelStorei(GL2ES2.GL_PACK_ALIGNMENT, packAlignment);
+ gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, packAlignment);
}
/**
- * Sets the {@link GL2ES2.GL_UNPACK_ALIGNMENT}.
- * <p>
+ * Sets the {@link GL#GL_UNPACK_ALIGNMENT}.
+ * <p>
* Saves the pixel storage modes if not saved yet.
* </p>
*/
public final void setUnpackAlignment(GL gl, int unpackAlignment) {
save(gl);
- gl.glPixelStorei(GL2ES2.GL_UNPACK_ALIGNMENT, unpackAlignment);
+ gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, unpackAlignment);
}
-
+
/**
- * Sets the {@link GL2ES2.GL_PACK_ALIGNMENT} and {@link GL2ES2.GL_UNPACK_ALIGNMENT}.
- * <p>
+ * Sets the {@link GL#GL_PACK_ALIGNMENT} and {@link GL#GL_UNPACK_ALIGNMENT}.
+ * <p>
* Saves the pixel storage modes if not saved yet.
* </p>
*/
@@ -81,7 +82,40 @@ public class GLPixelStorageModes {
setPackAlignment(gl, packAlignment);
setUnpackAlignment(gl, unpackAlignment);
}
-
+
+ /**
+ * Sets the {@link GL2ES3#GL_PACK_ROW_LENGTH}.
+ * <p>
+ * Saves the pixel storage modes if not saved yet.
+ * </p>
+ */
+ public final void setPackRowLength(GL2ES3 gl, int packRowLength) {
+ save(gl);
+ gl.glPixelStorei(GL2ES3.GL_PACK_ROW_LENGTH, packRowLength);
+ }
+
+ /**
+ * Sets the {@link GL2ES2#GL_UNPACK_ROW_LENGTH}.
+ * <p>
+ * Saves the pixel storage modes if not saved yet.
+ * </p>
+ */
+ public final void setUnpackRowLength(GL2ES2 gl, int unpackRowLength) {
+ save(gl);
+ gl.glPixelStorei(GL2ES2.GL_UNPACK_ROW_LENGTH, unpackRowLength);
+ }
+
+ /**
+ * Sets the {@link GL2ES3#GL_PACK_ROW_LENGTH} and {@link GL2ES2#GL_UNPACK_ROW_LENGTH}.
+ * <p>
+ * Saves the pixel storage modes if not saved yet.
+ * </p>
+ */
+ public final void setRowLength(GL2ES3 gl, int packRowLength, int unpackRowLength) {
+ setPackRowLength(gl, packRowLength);
+ setUnpackRowLength(gl, unpackRowLength);
+ }
+
/**
* Save the pixel storage mode, if not saved yet.
* <p>
@@ -92,8 +126,8 @@ public class GLPixelStorageModes {
if(saved) {
return;
}
-
- if(gl.isGL2GL3()) {
+
+ if(gl.isGL2GL3()) {
if(gl.isGL2()) {
gl.getGL2().glPushClientAttrib(GL2.GL_CLIENT_PIXEL_STORE_BIT);
} else {
@@ -120,7 +154,7 @@ public class GLPixelStorageModes {
// embedded deals with pack/unpack alignment only
gl.glGetIntegerv(GL2ES2.GL_PACK_ALIGNMENT, savedAlignment, 0);
gl.glGetIntegerv(GL2ES2.GL_UNPACK_ALIGNMENT, savedAlignment, 1);
- }
+ }
saved = true;
}
@@ -132,8 +166,8 @@ public class GLPixelStorageModes {
if(!saved) {
throw new GLException("pixel storage modes not saved");
}
-
- if(gl.isGL2GL3()) {
+
+ if(gl.isGL2GL3()) {
if(gl.isGL2()) {
gl.getGL2().glPopClientAttrib();
} else {
@@ -152,9 +186,9 @@ public class GLPixelStorageModes {
// embedded deals with pack/unpack alignment only
gl.glPixelStorei(GL2ES2.GL_PACK_ALIGNMENT, savedAlignment[0]);
gl.glPixelStorei(GL2ES2.GL_UNPACK_ALIGNMENT, savedAlignment[1]);
- }
+ }
saved = false;
- }
+ }
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java
index ae1b459..b942c9a 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.util;
import java.io.File;
@@ -51,45 +51,45 @@ import com.jogamp.opengl.util.texture.TextureIO;
*/
public class GLReadBufferUtil {
protected final GLPixelBufferProvider pixelBufferProvider;
- protected final int componentCount, alignment;
+ protected final int componentCount, alignment;
protected final Texture readTexture;
- protected final GLPixelStorageModes psm;
-
+ protected final GLPixelStorageModes psm;
+
protected GLPixelBuffer readPixelBuffer = null;
protected TextureData readTextureData = null;
/**
- * @param alpha true for RGBA readPixels, otherwise RGB readPixels. Disclaimer: Alpha maybe forced on ES platforms!
+ * @param alpha true for RGBA readPixels, otherwise RGB readPixels. Disclaimer: Alpha maybe forced on ES platforms!
* @param write2Texture true if readPixel's TextureData shall be written to a 2d Texture
*/
public GLReadBufferUtil(boolean alpha, boolean write2Texture) {
- this(GLPixelBuffer.defaultProvider, alpha, write2Texture);
+ this(GLPixelBuffer.defaultProviderNoRowStride, alpha, write2Texture);
}
-
+
public GLReadBufferUtil(GLPixelBufferProvider pixelBufferProvider, boolean alpha, boolean write2Texture) {
this.pixelBufferProvider = pixelBufferProvider;
this.componentCount = alpha ? 4 : 3 ;
- this.alignment = alpha ? 4 : 1 ;
+ this.alignment = alpha ? 4 : 1 ;
this.readTexture = write2Texture ? new Texture(GL.GL_TEXTURE_2D) : null ;
this.psm = new GLPixelStorageModes();
}
-
+
/** Returns the {@link GLPixelBufferProvider} used by this instance. */
public GLPixelBufferProvider getPixelBufferProvider() { return pixelBufferProvider; }
-
+
public boolean isValid() {
return null!=readTextureData && null!=readPixelBuffer && readPixelBuffer.isValid();
}
-
+
public boolean hasAlpha() { return 4 == componentCount ? true : false ; }
-
+
public GLPixelStorageModes getGLPixelStorageModes() { return psm; }
-
+
/**
* Returns the {@link GLPixelBuffer}, created and filled by {@link #readPixels(GLAutoDrawable, boolean)}.
*/
public GLPixelBuffer getPixelBuffer() { return readPixelBuffer; }
-
+
/**
* rewind the raw pixel ByteBuffer
*/
@@ -99,7 +99,7 @@ public class GLReadBufferUtil {
* @return the resulting TextureData, filled by {@link #readPixels(GLAutoDrawable, boolean)}
*/
public TextureData getTextureData() { return readTextureData; }
-
+
/**
* @return the Texture object filled by {@link #readPixels(GLAutoDrawable, boolean)},
* if this instance writes to a 2d Texture, otherwise null.
@@ -121,37 +121,36 @@ public class GLReadBufferUtil {
/**
* Read the drawable's pixels to TextureData and Texture, if requested at construction.
- *
+ *
* @param gl the current GL context object. It's read drawable is being used as the pixel source.
* @param mustFlipVertically indicates whether to flip the data vertically or not.
* The context's drawable {@link GLDrawable#isGLOriented()} state
* is taken into account.
* Vertical flipping is propagated to TextureData
* and handled in a efficient manner there (TextureCoordinates and TextureIO writer).
- *
+ *
* @see #GLReadBufferUtil(boolean, boolean)
*/
public boolean readPixels(GL gl, boolean mustFlipVertically) {
- return readPixels(gl, 0, 0, null, null, mustFlipVertically);
+ return readPixels(gl, 0, 0, 0, 0, mustFlipVertically);
}
-
+
/**
* Read the drawable's pixels to TextureData and Texture, if requested at construction.
- *
+ *
* @param gl the current GL context object. It's read drawable is being used as the pixel source.
* @param inX readPixel x offset
* @param inY readPixel y offset
- * @param ioWidth readPixel width
- * @param ioHeight readPixel height
+ * @param inWidth optional readPixel width value, used if [1 .. drawable.width], otherwise using drawable.width
+ * @param inHeight optional readPixel height, used if [1 .. drawable.height], otherwise using drawable.height
* @param mustFlipVertically indicates whether to flip the data vertically or not.
* The context's drawable {@link GLDrawable#isGLOriented()} state
* is taken into account.
* Vertical flipping is propagated to TextureData
* and handled in a efficient manner there (TextureCoordinates and TextureIO writer).
- *
* @see #GLReadBufferUtil(boolean, boolean)
*/
- public boolean readPixels(GL gl, int inX, int inY, int ioWidth[], int ioHeight[], boolean mustFlipVertically) {
+ public boolean readPixels(GL gl, int inX, int inY, int inWidth, int inHeight, boolean mustFlipVertically) {
final int glerr0 = gl.glGetError();
if(GL.GL_NO_ERROR != glerr0) {
System.err.println("Info: GLReadBufferUtil.readPixels: pre-exisiting GL error 0x"+Integer.toHexString(glerr0));
@@ -165,27 +164,27 @@ public class GLReadBufferUtil {
}
final GLDrawable drawable = gl.getContext().getGLReadDrawable();
final int width, height;
- if( null == ioWidth || drawable.getWidth() < ioWidth[0] ) {
+ if( 0 >= inWidth || drawable.getWidth() < inWidth ) {
width = drawable.getWidth();
} else {
- width = ioWidth[0];
+ width = inWidth;
}
- if( null == ioHeight || drawable.getHeight() < ioHeight[0] ) {
+ if( 0 >= inHeight || drawable.getHeight() < inHeight ) {
height = drawable.getHeight();
} else {
- height= ioHeight[0];
+ height= inHeight;
}
-
+
final boolean flipVertically;
if( drawable.isGLOriented() ) {
flipVertically = mustFlipVertically;
} else {
flipVertically = !mustFlipVertically;
}
-
+
final int tmp[] = new int[1];
final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.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);
@@ -195,9 +194,9 @@ public class GLReadBufferUtil {
gl.getGLProfile(),
internalFormat,
width, height,
- 0,
+ 0,
pixelAttribs,
- false, false,
+ false, false,
flipVertically,
readPixelBuffer.buffer,
null /* Flusher */);
@@ -231,13 +230,13 @@ public class GLReadBufferUtil {
" "+width+"x"+height+
", "+pixelAttribs+
", "+readPixelBuffer+", sz "+readPixelSize);
- res = false;
+ res = false;
}
if(res && null != readTexture) {
if(newData) {
readTexture.updateImage(gl, readTextureData);
} else {
- readTexture.updateSubImage(gl, readTextureData, 0,
+ readTexture.updateSubImage(gl, readTextureData, 0,
0, 0, // src offset
0, 0, // dst offset
width, height);
@@ -249,7 +248,7 @@ public class GLReadBufferUtil {
return res;
}
- public void dispose(GL gl) {
+ public void dispose(GL gl) {
if(null != readTexture) {
readTexture.destroy(gl);
readTextureData = null;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/Gamma.java b/src/jogl/classes/com/jogamp/opengl/util/Gamma.java
index c649d1c..9667819 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/Gamma.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/Gamma.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java
index dc96cb5..986f6d8 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java
@@ -34,28 +34,28 @@ import com.jogamp.opengl.util.glsl.ShaderState;
* to be either rendered directly via {@link #glEnd(GL)} or to be added to an internal display list
* via {@link #glEnd(GL, boolean) glEnd(gl, false)} for deferred rendering via {@link #draw(GL, boolean)}.
* </p>
- * <a name="storageDetails"><h5>Buffer storage and it's creation via {@link #createFixed(int, int, int, int, int, int, int, int, int, int) createFixed(..)}
- * and {@link #createGLSL(int, int, int, int, int, int, int, int, int, int, ShaderState) createGLSL(..)}</h5></a>
+ * <a name="storageDetails"><h5>Buffer storage and it's creation via {@link #createFixed(int, int, int, int, int, int, int, int, int, int) createFixed(..)}
+ * and {@link #createGLSL(int, int, int, int, int, int, int, int, int, int, ShaderState) createGLSL(..)}</h5></a>
* <p>
- * If unsure whether <i>colors</i>, <i>normals</i> and <i>textures</i> will be used,
+ * If unsure whether <i>colors</i>, <i>normals</i> and <i>textures</i> will be used,
* simply add them with an expected component count.
* This implementation will only render buffers which are being filled.<br/>
* The buffer growing implementation will only grow the exceeded buffers, unused buffers are not resized.
* </p>
* <p>
- * Note: Optional types, i.e. color, must be either not used or used w/ the same element count as vertex, etc.
+ * Note: Optional types, i.e. color, must be either not used or used w/ the same element count as vertex, etc.
* This is a semantic constraint, same as in the original OpenGL spec.
* </p>
*/
public class ImmModeSink {
protected static final boolean DEBUG_BEGIN_END;
- protected static final boolean DEBUG_DRAW;
+ protected static final boolean DEBUG_DRAW;
protected static final boolean DEBUG_BUFFER;
-
+
static {
Debug.initSingleton();
DEBUG_BEGIN_END = Debug.isPropertyDefined("jogl.debug.ImmModeSink.BeginEnd", true);
- DEBUG_DRAW = Debug.isPropertyDefined("jogl.debug.ImmModeSink.Draw", true);
+ DEBUG_DRAW = Debug.isPropertyDefined("jogl.debug.ImmModeSink.Draw", true);
DEBUG_BUFFER = Debug.isPropertyDefined("jogl.debug.ImmModeSink.Buffer", true);
}
@@ -68,7 +68,7 @@ public class ImmModeSink {
* <p>
* See <a href="#storageDetails"> buffer storage details</a>.
* </p>
- *
+ *
* @param initialElementCount initial buffer size, if subsequent mutable operations are about to exceed the buffer size, the buffer will grow about the initial size.
* @param vComps mandatory vertex component count, should be 2, 3 or 4.
* @param vDataType mandatory vertex data type, e.g. {@link GL#GL_FLOAT}
@@ -78,17 +78,17 @@ public class ImmModeSink {
* @param nDataType optional normal data type, e.g. {@link GL#GL_FLOAT}
* @param tComps optional texture-coordinate component count, may be 0, 2 or 3
* @param tDataType optional texture-coordinate data type, e.g. {@link GL#GL_FLOAT}
- * @param glBufferUsage VBO <code>usage</code> parameter for {@link GL#glBufferData(int, long, Buffer, int)}, e.g. {@link GL#GL_STATIC_DRAW},
+ * @param glBufferUsage VBO <code>usage</code> parameter for {@link GL#glBufferData(int, long, Buffer, int)}, e.g. {@link GL#GL_STATIC_DRAW},
* set to <code>0</code> for no VBO usage
*/
- public static ImmModeSink createFixed(int initialElementCount,
+ public static ImmModeSink createFixed(int initialElementCount,
int vComps, int vDataType,
int cComps, int cDataType,
- int nComps, int nDataType,
- int tComps, int tDataType,
+ int nComps, int nDataType,
+ int tComps, int tDataType,
int glBufferUsage) {
- return new ImmModeSink(initialElementCount,
- vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType,
+ return new ImmModeSink(initialElementCount,
+ vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType,
false, glBufferUsage, null, 0);
}
@@ -97,7 +97,7 @@ public class ImmModeSink {
* <p>
* See <a href="#storageDetails"> buffer storage details</a>.
* </p>
- *
+ *
* @param initialElementCount initial buffer size, if subsequent mutable operations are about to exceed the buffer size, the buffer will grow about the initial size.
* @param vComps mandatory vertex component count, should be 2, 3 or 4.
* @param vDataType mandatory vertex data type, e.g. {@link GL#GL_FLOAT}
@@ -107,21 +107,21 @@ public class ImmModeSink {
* @param nDataType optional normal data type, e.g. {@link GL#GL_FLOAT}
* @param tComps optional texture-coordinate component count, may be 0, 2 or 3
* @param tDataType optional texture-coordinate data type, e.g. {@link GL#GL_FLOAT}
- * @param glBufferUsage VBO <code>usage</code> parameter for {@link GL#glBufferData(int, long, Buffer, int)}, e.g. {@link GL#GL_STATIC_DRAW},
+ * @param glBufferUsage VBO <code>usage</code> parameter for {@link GL#glBufferData(int, long, Buffer, int)}, e.g. {@link GL#GL_STATIC_DRAW},
* set to <code>0</code> for no VBO usage
* @param st ShaderState to locate the vertex attributes
* @see #draw(GL, boolean)
* @see com.jogamp.opengl.util.glsl.ShaderState#useProgram(GL2ES2, boolean)
* @see com.jogamp.opengl.util.glsl.ShaderState#getCurrentShaderState()
*/
- public static ImmModeSink createGLSL(int initialElementCount,
+ public static ImmModeSink createGLSL(int initialElementCount,
int vComps, int vDataType,
int cComps, int cDataType,
- int nComps, int nDataType,
- int tComps, int tDataType,
+ int nComps, int nDataType,
+ int tComps, int tDataType,
int glBufferUsage, ShaderState st) {
- return new ImmModeSink(initialElementCount,
- vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType,
+ return new ImmModeSink(initialElementCount,
+ vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType,
true, glBufferUsage, st, 0);
}
@@ -130,7 +130,7 @@ public class ImmModeSink {
* <p>
* See <a href="#storageDetails"> buffer storage details</a>.
* </p>
- *
+ *
* @param initialElementCount initial buffer size, if subsequent mutable operations are about to exceed the buffer size, the buffer will grow about the initial size.
* @param vComps mandatory vertex component count, should be 2, 3 or 4.
* @param vDataType mandatory vertex data type, e.g. {@link GL#GL_FLOAT}
@@ -140,24 +140,24 @@ public class ImmModeSink {
* @param nDataType optional normal data type, e.g. {@link GL#GL_FLOAT}
* @param tComps optional texture-coordinate component count, may be 0, 2 or 3
* @param tDataType optional texture-coordinate data type, e.g. {@link GL#GL_FLOAT}
- * @param glBufferUsage VBO <code>usage</code> parameter for {@link GL#glBufferData(int, long, Buffer, int)}, e.g. {@link GL#GL_STATIC_DRAW},
+ * @param glBufferUsage VBO <code>usage</code> parameter for {@link GL#glBufferData(int, long, Buffer, int)}, e.g. {@link GL#GL_STATIC_DRAW},
* set to <code>0</code> for no VBO usage
* @param shaderProgram shader-program name to locate the vertex attributes
* @see #draw(GL, boolean)
* @see com.jogamp.opengl.util.glsl.ShaderState#useProgram(GL2ES2, boolean)
* @see com.jogamp.opengl.util.glsl.ShaderState#getCurrentShaderState()
*/
- public static ImmModeSink createGLSL(int initialElementCount,
+ public static ImmModeSink createGLSL(int initialElementCount,
int vComps, int vDataType,
int cComps, int cDataType,
- int nComps, int nDataType,
- int tComps, int tDataType,
+ int nComps, int nDataType,
+ int tComps, int tDataType,
int glBufferUsage, int shaderProgram) {
- return new ImmModeSink(initialElementCount,
- vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType,
+ return new ImmModeSink(initialElementCount,
+ vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType,
true, glBufferUsage, null, shaderProgram);
}
-
+
public void destroy(GL gl) {
destroyList(gl);
@@ -173,6 +173,7 @@ public class ImmModeSink {
vboSet.reset(gl);
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder("ImmModeSink[");
sb.append(",\n\tVBO list: "+vboSetList.size()+" [");
@@ -346,7 +347,7 @@ public class ImmModeSink {
public final void glColor3ub(byte x, byte y, byte z) {
vboSet.glColor3ub(x,y,z);
}
-
+
public final void glColor4b(byte x, byte y, byte z, byte a) {
vboSet.glColor4b(x,y,z,a);
}
@@ -354,7 +355,7 @@ public class ImmModeSink {
public final void glColor4ub(byte x, byte y, byte z, byte a) {
vboSet.glColor4ub(x,y,z,a);
}
-
+
public final void glTexCoord2b(byte x, byte y) {
vboSet.glTexCoord2b(x,y);
}
@@ -363,26 +364,26 @@ public class ImmModeSink {
vboSet.glTexCoord3b(x,y,z);
}
- protected ImmModeSink(int initialElementCount,
- int vComps, int vDataType,
- int cComps, int cDataType,
- int nComps, int nDataType,
- int tComps, int tDataType,
+ protected ImmModeSink(int initialElementCount,
+ int vComps, int vDataType,
+ int cComps, int cDataType,
+ int nComps, int nDataType,
+ int tComps, int tDataType,
boolean useGLSL, int glBufferUsage, ShaderState st, int shaderProgram) {
- vboSet = new VBOSet(initialElementCount,
- vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType,
+ vboSet = new VBOSet(initialElementCount,
+ vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType,
useGLSL, glBufferUsage, st, shaderProgram);
this.vboSetList = new ArrayList<VBOSet>();
}
-
+
public boolean getUseVBO() { return vboSet.getUseVBO(); }
-
+
/**
* Returns the additional element count if buffer resize is required.
* @see #setResizeElementCount(int)
*/
public int getResizeElementCount() { return vboSet.getResizeElementCount(); }
-
+
/**
* Sets the additional element count if buffer resize is required,
* defaults to <code>initialElementCount</code> of factory method.
@@ -390,7 +391,7 @@ public class ImmModeSink {
* @see #createGLSL(int, int, int, int, int, int, int, int, int, int, ShaderState)
*/
public void setResizeElementCount(int v) { vboSet.setResizeElementCount(v); }
-
+
private void destroyList(GL gl) {
for(int i=0; i<vboSetList.size(); i++) {
vboSetList.get(i).destroy(gl);
@@ -402,11 +403,11 @@ public class ImmModeSink {
private final ArrayList<VBOSet> vboSetList;
protected static class VBOSet {
- protected VBOSet (int initialElementCount,
- int vComps, int vDataType,
- int cComps, int cDataType,
- int nComps, int nDataType,
- int tComps, int tDataType,
+ protected VBOSet (int initialElementCount,
+ int vComps, int vDataType,
+ int cComps, int cDataType,
+ int nComps, int nDataType,
+ int tComps, int tDataType,
boolean useGLSL, int glBufferUsage, ShaderState st, int shaderProgram) {
// final ..
this.glBufferUsage=glBufferUsage;
@@ -415,7 +416,7 @@ public class ImmModeSink {
this.useGLSL=useGLSL;
this.shaderState = st;
this.shaderProgram = shaderProgram;
-
+
if(useGLSL && null == shaderState && 0 == shaderProgram) {
throw new IllegalArgumentException("Using GLSL but neither a valid shader-program nor ShaderState has been passed!");
}
@@ -436,9 +437,9 @@ public class ImmModeSink {
this.tDataType=tDataType;
this.tDataTypeSigned=GLBuffers.isSignedGLType(tDataType);
this.tComps=tComps;
- this.tCompsBytes=tComps * GLBuffers.sizeOfGLType(tDataType);
+ this.tCompsBytes=tComps * GLBuffers.sizeOfGLType(tDataType);
this.vboName = 0;
-
+
this.vCount=0;
this.cCount=0;
this.nCount=0;
@@ -447,9 +448,9 @@ public class ImmModeSink {
this.cElems=0;
this.nElems=0;
this.tElems=0;
-
+
this.pageSize = Platform.getMachineDescription().pageSizeInBytes();
-
+
reallocateBuffer(initialElementCount);
rewind();
@@ -465,30 +466,30 @@ public class ImmModeSink {
protected int getResizeElementCount() { return resizeElementCount; }
protected void setResizeElementCount(int v) { resizeElementCount=v; }
-
+
protected boolean getUseVBO() { return useVBO; }
-
+
protected final VBOSet regenerate(GL gl) {
- return new VBOSet(initialElementCount, vComps,
- vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType,
+ return new VBOSet(initialElementCount, vComps,
+ vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType,
useGLSL, glBufferUsage, shaderState, shaderProgram);
}
protected void checkSeal(boolean test) throws GLException {
if(0==mode) {
- throw new GLException("No mode set yet, call glBegin(mode) first:\n\t"+this);
+ throw new GLException("No mode set yet, call glBegin(mode) first:\n\t"+this);
}
if(sealed!=test) {
if(test) {
- throw new GLException("Not Sealed yet, call glEnd() first:\n\t"+this);
+ throw new GLException("Not Sealed yet, call glEnd() first:\n\t"+this);
} else {
- throw new GLException("Already Sealed, can't modify VBO after glEnd():\n\t"+this);
+ throw new GLException("Already Sealed, can't modify VBO after glEnd():\n\t"+this);
}
}
}
private boolean usingShaderProgram = false;
-
+
protected void useShaderProgram(GL2ES2 gl, boolean force) {
if( force || !usingShaderProgram ) {
if(null != shaderState) {
@@ -499,19 +500,19 @@ public class ImmModeSink {
usingShaderProgram = true;
}
}
-
+
protected void draw(GL gl, Buffer indices, boolean disableBufferAfterDraw, int i)
{
enableBuffer(gl, true);
-
+
if(null != shaderState || 0 != shaderProgram) {
useShaderProgram(gl.getGL2ES2(), false);
}
-
+
if(DEBUG_DRAW) {
System.err.println("ImmModeSink.draw["+i+"].0 (disableBufferAfterDraw: "+disableBufferAfterDraw+"):\n\t"+this);
}
-
+
if (buffer!=null) {
if(null==indices) {
if ( GL_QUADS == mode && !gl.isGL2() ) {
@@ -522,6 +523,10 @@ public class ImmModeSink {
gl.glDrawArrays(mode, 0, vElems);
}
} else {
+ // FIXME: Impl. VBO usage .. or unroll.
+ if( !gl.getContext().isCPUDataSourcingAvail() ) {
+ throw new GLException("CPU data sourcing n/a w/ "+gl.getContext());
+ }
final int type;
if(indices instanceof ByteBuffer) {
type = GL.GL_UNSIGNED_BYTE;
@@ -534,26 +539,26 @@ public class ImmModeSink {
}
final int idxLen = indices.remaining();
final int idx0 = indices.position();
-
+
if ( GL_QUADS == mode && !gl.isGL2() ) {
if( GL.GL_UNSIGNED_BYTE == type ) {
final ByteBuffer b = (ByteBuffer) indices;
for (int j = 0; j < idxLen; j++) {
gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0x000000ff & b.get(idx0+j)), 4);
- }
+ }
} else if( GL.GL_UNSIGNED_SHORT == type ){
final ShortBuffer b = (ShortBuffer) indices;
for (int j = 0; j < idxLen; j++) {
gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0x0000ffff & b.get(idx0+j)), 4);
- }
+ }
} else {
final IntBuffer b = (IntBuffer) indices;
for (int j = 0; j < idxLen; j++) {
gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0xffffffff & b.get(idx0+j)), 4);
- }
+ }
}
} else {
- gl.glDrawElements(mode, idxLen, type, indices);
+ ((GL2ES1)gl).glDrawElements(mode, idxLen, type, indices);
// GL2: gl.glDrawRangeElements(mode, 0, idxLen-1, idxLen, type, indices);
}
}
@@ -562,7 +567,7 @@ public class ImmModeSink {
if(disableBufferAfterDraw) {
enableBuffer(gl, false);
}
-
+
if(DEBUG_DRAW) {
System.err.println("ImmModeSink.draw["+i+"].X (disableBufferAfterDraw: "+disableBufferAfterDraw+")");
}
@@ -588,7 +593,7 @@ public class ImmModeSink {
public void glVertex2b(byte x, byte y) {
checkSeal(false);
growBuffer(VERTEX);
- if(vComps>0)
+ if(vComps>0)
Buffers.putNb(vertexArray, vDataTypeSigned, x, true);
if(vComps>1)
Buffers.putNb(vertexArray, vDataTypeSigned, y, true);
@@ -610,7 +615,7 @@ public class ImmModeSink {
growBuffer(VERTEX);
if(vComps>0)
Buffers.putNs(vertexArray, vDataTypeSigned, x, true);
- if(vComps>1)
+ if(vComps>1)
Buffers.putNs(vertexArray, vDataTypeSigned, y, true);
countAndPadding(VERTEX, vComps-2);
}
@@ -619,16 +624,16 @@ public class ImmModeSink {
growBuffer(VERTEX);
if(vComps>0)
Buffers.putNs(vertexArray, vDataTypeSigned, x, true);
- if(vComps>1)
+ if(vComps>1)
Buffers.putNs(vertexArray, vDataTypeSigned, y, true);
- if(vComps>2)
+ if(vComps>2)
Buffers.putNs(vertexArray, vDataTypeSigned, z, true);
countAndPadding(VERTEX, vComps-3);
}
public void glVertex2f(float x, float y) {
checkSeal(false);
growBuffer(VERTEX);
- if(vComps>0)
+ if(vComps>0)
Buffers.putNf(vertexArray, vDataTypeSigned, x);
if(vComps>1)
Buffers.putNf(vertexArray, vDataTypeSigned, y);
@@ -637,11 +642,11 @@ public class ImmModeSink {
public void glVertex3f(float x, float y, float z) {
checkSeal(false);
growBuffer(VERTEX);
- if(vComps>0)
+ if(vComps>0)
Buffers.putNf(vertexArray, vDataTypeSigned, x);
if(vComps>1)
Buffers.putNf(vertexArray, vDataTypeSigned, y);
- if(vComps>2)
+ if(vComps>2)
Buffers.putNf(vertexArray, vDataTypeSigned, z);
countAndPadding(VERTEX, vComps-3);
}
@@ -649,33 +654,33 @@ public class ImmModeSink {
public void glNormal3b(byte x, byte y, byte z) {
checkSeal(false);
growBuffer(NORMAL);
- if(nComps>0)
+ if(nComps>0)
Buffers.putNb(normalArray, nDataTypeSigned, x, true);
- if(nComps>1)
+ if(nComps>1)
Buffers.putNb(normalArray, nDataTypeSigned, y, true);
- if(nComps>2)
+ if(nComps>2)
Buffers.putNb(normalArray, nDataTypeSigned, z, true);
countAndPadding(NORMAL, nComps-3);
}
public void glNormal3s(short x, short y, short z) {
checkSeal(false);
growBuffer(NORMAL);
- if(nComps>0)
+ if(nComps>0)
Buffers.putNs(normalArray, nDataTypeSigned, x, true);
- if(nComps>1)
+ if(nComps>1)
Buffers.putNs(normalArray, nDataTypeSigned, y, true);
- if(nComps>2)
+ if(nComps>2)
Buffers.putNs(normalArray, nDataTypeSigned, z, true);
countAndPadding(NORMAL, nComps-3);
}
public void glNormal3f(float x, float y, float z) {
checkSeal(false);
growBuffer(NORMAL);
- if(nComps>0)
+ if(nComps>0)
Buffers.putNf(normalArray, nDataTypeSigned, x);
if(nComps>1)
Buffers.putNf(normalArray, nDataTypeSigned, y);
- if(nComps>2)
+ if(nComps>2)
Buffers.putNf(normalArray, nDataTypeSigned, z);
countAndPadding(NORMAL, nComps-3);
}
@@ -683,96 +688,96 @@ public class ImmModeSink {
public void glColor3b(byte r, byte g, byte b) {
checkSeal(false);
growBuffer(COLOR);
- if(cComps>0)
+ if(cComps>0)
Buffers.putNb(colorArray, cDataTypeSigned, r, true);
- if(cComps>1)
+ if(cComps>1)
Buffers.putNb(colorArray, cDataTypeSigned, g, true);
- if(cComps>2)
+ if(cComps>2)
Buffers.putNb(colorArray, cDataTypeSigned, b, true);
countAndPadding(COLOR, cComps-3);
}
public void glColor3ub(byte r, byte g, byte b) {
checkSeal(false);
growBuffer(COLOR);
- if(cComps>0)
+ if(cComps>0)
Buffers.putNb(colorArray, cDataTypeSigned, r, false);
- if(cComps>1)
+ if(cComps>1)
Buffers.putNb(colorArray, cDataTypeSigned, g, false);
- if(cComps>2)
+ if(cComps>2)
Buffers.putNb(colorArray, cDataTypeSigned, b, false);
countAndPadding(COLOR, cComps-3);
}
public void glColor4b(byte r, byte g, byte b, byte a) {
checkSeal(false);
growBuffer(COLOR);
- if(cComps>0)
+ if(cComps>0)
Buffers.putNb(colorArray, cDataTypeSigned, r, true);
- if(cComps>1)
+ if(cComps>1)
Buffers.putNb(colorArray, cDataTypeSigned, g, true);
- if(cComps>2)
+ if(cComps>2)
Buffers.putNb(colorArray, cDataTypeSigned, b, true);
- if(cComps>3)
+ if(cComps>3)
Buffers.putNb(colorArray, cDataTypeSigned, a, true);
countAndPadding(COLOR, cComps-4);
}
public void glColor4ub(byte r, byte g, byte b, byte a) {
checkSeal(false);
growBuffer(COLOR);
- if(cComps>0)
+ if(cComps>0)
Buffers.putNb(colorArray, cDataTypeSigned, r, false);
- if(cComps>1)
+ if(cComps>1)
Buffers.putNb(colorArray, cDataTypeSigned, g, false);
- if(cComps>2)
+ if(cComps>2)
Buffers.putNb(colorArray, cDataTypeSigned, b, false);
- if(cComps>3)
+ if(cComps>3)
Buffers.putNb(colorArray, cDataTypeSigned, a, false);
countAndPadding(COLOR, cComps-4);
}
public void glColor3s(short r, short g, short b) {
checkSeal(false);
growBuffer(COLOR);
- if(cComps>0)
+ if(cComps>0)
Buffers.putNs(colorArray, cDataTypeSigned, r, true);
- if(cComps>1)
+ if(cComps>1)
Buffers.putNs(colorArray, cDataTypeSigned, g, true);
- if(cComps>2)
+ if(cComps>2)
Buffers.putNs(colorArray, cDataTypeSigned, b, true);
countAndPadding(COLOR, cComps-3);
}
public void glColor4s(short r, short g, short b, short a) {
checkSeal(false);
growBuffer(COLOR);
- if(cComps>0)
+ if(cComps>0)
Buffers.putNs(colorArray, cDataTypeSigned, r, true);
- if(cComps>1)
+ if(cComps>1)
Buffers.putNs(colorArray, cDataTypeSigned, g, true);
- if(cComps>2)
+ if(cComps>2)
Buffers.putNs(colorArray, cDataTypeSigned, b, true);
- if(cComps>3)
+ if(cComps>3)
Buffers.putNs(colorArray, cDataTypeSigned, a, true);
countAndPadding(COLOR, cComps-4);
}
public void glColor3f(float r, float g, float b) {
checkSeal(false);
growBuffer(COLOR);
- if(cComps>0)
+ if(cComps>0)
Buffers.putNf(colorArray, cDataTypeSigned, r);
- if(cComps>1)
+ if(cComps>1)
Buffers.putNf(colorArray, cDataTypeSigned, g);
- if(cComps>2)
+ if(cComps>2)
Buffers.putNf(colorArray, cDataTypeSigned, b);
countAndPadding(COLOR, cComps-3);
}
public void glColor4f(float r, float g, float b, float a) {
checkSeal(false);
growBuffer(COLOR);
- if(cComps>0)
+ if(cComps>0)
Buffers.putNf(colorArray, cDataTypeSigned, r);
- if(cComps>1)
+ if(cComps>1)
Buffers.putNf(colorArray, cDataTypeSigned, g);
- if(cComps>2)
+ if(cComps>2)
Buffers.putNf(colorArray, cDataTypeSigned, b);
- if(cComps>3)
+ if(cComps>3)
Buffers.putNf(colorArray, cDataTypeSigned, a);
countAndPadding(COLOR, cComps-4);
}
@@ -780,60 +785,60 @@ public class ImmModeSink {
public void glTexCoord2b(byte x, byte y) {
checkSeal(false);
growBuffer(TEXTCOORD);
- if(tComps>0)
+ if(tComps>0)
Buffers.putNb(textCoordArray, tDataTypeSigned, x, true);
- if(tComps>1)
+ if(tComps>1)
Buffers.putNb(textCoordArray, tDataTypeSigned, y, true);
countAndPadding(TEXTCOORD, tComps-2);
}
public void glTexCoord3b(byte x, byte y, byte z) {
checkSeal(false);
growBuffer(TEXTCOORD);
- if(tComps>0)
+ if(tComps>0)
Buffers.putNb(textCoordArray, tDataTypeSigned, x, true);
- if(tComps>1)
+ if(tComps>1)
Buffers.putNb(textCoordArray, tDataTypeSigned, y, true);
- if(tComps>2)
+ if(tComps>2)
Buffers.putNb(textCoordArray, tDataTypeSigned, z, true);
countAndPadding(TEXTCOORD, tComps-3);
}
public void glTexCoord2s(short x, short y) {
checkSeal(false);
growBuffer(TEXTCOORD);
- if(tComps>0)
+ if(tComps>0)
Buffers.putNs(textCoordArray, tDataTypeSigned, x, true);
- if(tComps>1)
+ if(tComps>1)
Buffers.putNs(textCoordArray, tDataTypeSigned, y, true);
countAndPadding(TEXTCOORD, tComps-2);
}
public void glTexCoord3s(short x, short y, short z) {
checkSeal(false);
growBuffer(TEXTCOORD);
- if(tComps>0)
+ if(tComps>0)
Buffers.putNs(textCoordArray, tDataTypeSigned, x, true);
- if(tComps>1)
+ if(tComps>1)
Buffers.putNs(textCoordArray, tDataTypeSigned, y, true);
- if(tComps>2)
+ if(tComps>2)
Buffers.putNs(textCoordArray, tDataTypeSigned, z, true);
countAndPadding(TEXTCOORD, tComps-3);
}
public void glTexCoord2f(float x, float y) {
checkSeal(false);
growBuffer(TEXTCOORD);
- if(tComps>0)
+ if(tComps>0)
Buffers.putNf(textCoordArray, tDataTypeSigned, x);
- if(tComps>1)
+ if(tComps>1)
Buffers.putNf(textCoordArray, tDataTypeSigned, y);
countAndPadding(TEXTCOORD, tComps-2);
}
public void glTexCoord3f(float x, float y, float z) {
checkSeal(false);
growBuffer(TEXTCOORD);
- if(tComps>0)
+ if(tComps>0)
Buffers.putNf(textCoordArray, tDataTypeSigned, x);
- if(tComps>1)
+ if(tComps>1)
Buffers.putNf(textCoordArray, tDataTypeSigned, y);
- if(tComps>2)
+ if(tComps>2)
Buffers.putNf(textCoordArray, tDataTypeSigned, z);
countAndPadding(TEXTCOORD, tComps-3);
}
@@ -860,20 +865,20 @@ public class ImmModeSink {
shaderProgram = program;
glslLocationSet = false; // enforce location reset!
}
-
+
/**
* @param gl
* @return true if all locations for all used arrays are found (min 1 array), otherwise false.
- * Also sets 'glslLocationSet' to the return value!
+ * Also sets 'glslLocationSet' to the return value!
*/
private boolean resetGLSLArrayLocation(GL2ES2 gl) {
int iA = 0;
int iL = 0;
-
+
if(null != vArrayData) {
iA++;
if( vArrayData.setLocation(gl, shaderProgram) >= 0 ) {
- iL++;
+ iL++;
}
}
if(null != cArrayData) {
@@ -897,7 +902,7 @@ public class ImmModeSink {
glslLocationSet = iA == iL;
return glslLocationSet;
}
-
+
public void destroy(GL gl) {
reset(gl);
@@ -927,7 +932,7 @@ public class ImmModeSink {
this.vElems=0;
this.cElems=0;
this.nElems=0;
- this.tElems=0;
+ this.tElems=0;
}
public void seal(GL glObj, boolean seal)
@@ -1012,20 +1017,20 @@ public class ImmModeSink {
}
} else {
gl.glBufferData(GL.GL_ARRAY_BUFFER, buffer.limit(), buffer, glBufferUsage);
- bufferWrittenOnce = true;
- }
+ bufferWrittenOnce = true;
+ }
}
-
+
private void enableBufferFixed(GL gl, boolean enable) {
GL2ES1 glf = gl.getGL2ES1();
-
+
final boolean useV = vComps>0 && vElems>0 ;
final boolean useC = cComps>0 && cElems>0 ;
final boolean useN = nComps>0 && nElems>0 ;
final boolean useT = tComps>0 && tElems>0 ;
-
+
if(DEBUG_DRAW) {
- System.err.println("ImmModeSink.enableFixed.0 "+enable+": use [ v "+useV+", c "+useC+", n "+useN+", t "+useT+"], "+getElemUseCountStr()+", "+buffer);
+ System.err.println("ImmModeSink.enableFixed.0 "+enable+": use [ v "+useV+", c "+useC+", n "+useN+", t "+useT+"], "+getElemUseCountStr()+", "+buffer);
}
if(enable) {
@@ -1034,7 +1039,7 @@ public class ImmModeSink {
throw new InternalError("Using VBO but no vboName");
}
glf.glBindBuffer(GL.GL_ARRAY_BUFFER, vboName);
-
+
if(!bufferWritten) {
writeBuffer(gl);
}
@@ -1047,7 +1052,7 @@ public class ImmModeSink {
glf.glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
glf.glVertexPointer(vArrayData);
} else {
- glf.glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
+ glf.glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
}
}
if(useC) {
@@ -1078,24 +1083,24 @@ public class ImmModeSink {
if(enable && useVBO) {
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
}
-
+
if(DEBUG_DRAW) {
- System.err.println("ImmModeSink.enableFixed.X ");
+ System.err.println("ImmModeSink.enableFixed.X ");
}
}
private void enableBufferGLSLShaderState(GL gl, boolean enable) {
GL2ES2 glsl = gl.getGL2ES2();
-
+
final boolean useV = vComps>0 && vElems>0 ;
final boolean useC = cComps>0 && cElems>0 ;
final boolean useN = nComps>0 && nElems>0 ;
final boolean useT = tComps>0 && tElems>0 ;
-
+
if(DEBUG_DRAW) {
- System.err.println("ImmModeSink.enableGLSL.A.0 "+enable+": use [ v "+useV+", c "+useC+", n "+useN+", t "+useT+"], "+getElemUseCountStr()+", "+buffer);
+ System.err.println("ImmModeSink.enableGLSL.A.0 "+enable+": use [ v "+useV+", c "+useC+", n "+useN+", t "+useT+"], "+getElemUseCountStr()+", "+buffer);
}
-
+
if(enable) {
if(useVBO) {
if(0 == vboName) {
@@ -1106,9 +1111,9 @@ public class ImmModeSink {
writeBuffer(gl);
}
}
- bufferWritten=true;
+ bufferWritten=true;
}
-
+
if(useV) {
if(enable) {
shaderState.enableVertexAttribArray(glsl, vArrayData);
@@ -1140,30 +1145,30 @@ public class ImmModeSink {
} else {
shaderState.disableVertexAttribArray(glsl, tArrayData);
}
- }
+ }
glslLocationSet = true; // ShaderState does set the location implicit
-
+
if(enable && useVBO) {
glsl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
}
-
+
if(DEBUG_DRAW) {
- System.err.println("ImmModeSink.enableGLSL.A.X ");
+ System.err.println("ImmModeSink.enableGLSL.A.X ");
}
}
private void enableBufferGLSLSimple(GL gl, boolean enable) {
GL2ES2 glsl = gl.getGL2ES2();
-
+
final boolean useV = vComps>0 && vElems>0 ;
final boolean useC = cComps>0 && cElems>0 ;
final boolean useN = nComps>0 && nElems>0 ;
final boolean useT = tComps>0 && tElems>0 ;
-
+
if(DEBUG_DRAW) {
- System.err.println("ImmModeSink.enableGLSL.B.0 "+enable+": use [ v "+useV+", c "+useC+", n "+useN+", t "+useT+"], "+getElemUseCountStr()+", "+buffer);
+ System.err.println("ImmModeSink.enableGLSL.B.0 "+enable+": use [ v "+useV+", c "+useC+", n "+useN+", t "+useT+"], "+getElemUseCountStr()+", "+buffer);
}
-
+
if(!glslLocationSet) {
if( !resetGLSLArrayLocation(glsl) ) {
if(DEBUG_DRAW) {
@@ -1176,7 +1181,7 @@ public class ImmModeSink {
return;
}
}
-
+
if(enable) {
if(useVBO) {
if(0 == vboName) {
@@ -1222,28 +1227,29 @@ public class ImmModeSink {
glsl.glDisableVertexAttribArray(tArrayData.getLocation());
}
}
-
+
if(enable && useVBO) {
glsl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
}
-
+
if(DEBUG_DRAW) {
- System.err.println("ImmModeSink.enableGLSL.B.X ");
+ System.err.println("ImmModeSink.enableGLSL.B.X ");
}
}
-
+
+ @Override
public String toString() {
- final String glslS = useGLSL ?
+ final String glslS = useGLSL ?
", useShaderState "+(null!=shaderState)+
", shaderProgram "+shaderProgram+
", glslLocationSet "+glslLocationSet : "";
-
- return "VBOSet[mode "+mode+
- ", modeOrig "+modeOrig+
+
+ return "VBOSet[mode "+mode+
+ ", modeOrig "+modeOrig+
", use/count "+getElemUseCountStr()+
- ", sealed "+sealed+
+ ", sealed "+sealed+
", sealedGL "+sealedGL+
- ", bufferEnabled "+bufferEnabled+
+ ", bufferEnabled "+bufferEnabled+
", bufferWritten "+bufferWritten+" (once "+bufferWrittenOnce+")"+
", useVBO "+useVBO+", vboName "+vboName+
", useGLSL "+useGLSL+
@@ -1260,7 +1266,7 @@ public class ImmModeSink {
protected String getElemUseCountStr() {
return "[v "+vElems+"/"+vCount+", c "+cElems+"/"+cCount+", n "+nElems+"/"+nCount+", t "+tElems+"/"+tCount+"]";
}
-
+
protected boolean fitElementInBuffer(int type) {
final int addElems = 1;
switch (type) {
@@ -1276,20 +1282,20 @@ public class ImmModeSink {
throw new InternalError("XXX");
}
}
-
+
protected boolean reallocateBuffer(int addElems) {
final int vAdd = addElems - ( vCount - vElems );
final int cAdd = addElems - ( cCount - cElems );
final int nAdd = addElems - ( nCount - nElems );
final int tAdd = addElems - ( tCount - tElems );
-
+
if( 0>=vAdd && 0>=cAdd && 0>=nAdd && 0>=tAdd) {
if(DEBUG_BUFFER) {
System.err.println("ImmModeSink.realloc: "+getElemUseCountStr()+" + "+addElems+" -> NOP");
}
return false;
}
-
+
if(DEBUG_BUFFER) {
System.err.println("ImmModeSink.realloc: "+getElemUseCountStr()+" + "+addElems);
}
@@ -1297,20 +1303,20 @@ public class ImmModeSink {
cCount += cAdd;
nCount += nAdd;
tCount += tAdd;
-
+
final int vBytes = vCount * vCompsBytes;
final int cBytes = cCount * cCompsBytes;
final int nBytes = nCount * nCompsBytes;
final int tBytes = tCount * tCompsBytes;
-
+
buffer = Buffers.newDirectByteBuffer( vBytes + cBytes + nBytes + tBytes );
vOffset = 0;
-
+
if(vBytes>0) {
vertexArray = GLBuffers.sliceGLBuffer(buffer, vOffset, vBytes, vDataType);
} else {
vertexArray = null;
- }
+ }
cOffset=vOffset+vBytes;
if(cBytes>0) {
@@ -1337,36 +1343,36 @@ public class ImmModeSink {
buffer.flip();
if(vComps>0) {
- vArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_VERTEX_ARRAY, vComps,
+ vArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_VERTEX_ARRAY, vComps,
vDataType, GLBuffers.isGLTypeFixedPoint(vDataType), 0,
vertexArray, 0, vOffset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER);
} else {
vArrayData = null;
}
if(cComps>0) {
- cArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_COLOR_ARRAY, cComps,
+ cArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_COLOR_ARRAY, cComps,
cDataType, GLBuffers.isGLTypeFixedPoint(cDataType), 0,
colorArray, 0, cOffset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER);
} else {
cArrayData = null;
}
if(nComps>0) {
- nArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_NORMAL_ARRAY, nComps,
+ nArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_NORMAL_ARRAY, nComps,
nDataType, GLBuffers.isGLTypeFixedPoint(nDataType), 0,
normalArray, 0, nOffset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER);
} else {
nArrayData = null;
}
if(tComps>0) {
- tArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_TEXTURE_COORD_ARRAY, tComps,
+ tArrayData = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_TEXTURE_COORD_ARRAY, tComps,
tDataType, GLBuffers.isGLTypeFixedPoint(tDataType), 0,
textCoordArray, 0, tOffset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER);
} else {
tArrayData = null;
}
-
+
bufferWrittenOnce = false; // new buffer data storage size!
-
+
if(DEBUG_BUFFER) {
System.err.println("ImmModeSink.realloc.X: "+this.toString());
Thread.dumpStack();
@@ -1380,7 +1386,7 @@ public class ImmModeSink {
if( !fitElementInBuffer(type) ) {
// save olde values ..
final Buffer _vertexArray=vertexArray, _colorArray=colorArray, _normalArray=normalArray, _textCoordArray=textCoordArray;
-
+
if ( reallocateBuffer(resizeElementCount) ) {
if(null!=_vertexArray) {
_vertexArray.flip();
@@ -1412,7 +1418,7 @@ public class ImmModeSink {
* vec4 v = vec4(0, 0, 0, 1);
* vec4 c = vec4(0, 0, 0, 1);
* </p>
- *
+ *
* @param type
* @param fill
*/
@@ -1422,7 +1428,7 @@ public class ImmModeSink {
final Buffer dest;
final boolean dSigned;
final int e; // either 0 or 1
-
+
switch (type) {
case VERTEX:
dest = vertexArray;
@@ -1455,7 +1461,7 @@ public class ImmModeSink {
while( fill > e ) {
fill--;
- Buffers.putNf(dest, dSigned, 0f);
+ Buffers.putNf(dest, dSigned, 0f);
}
if( fill > 0 ) { // e == 1, add missing '1f end component'
Buffers.putNf(dest, dSigned, 1f);
@@ -1476,18 +1482,18 @@ public class ImmModeSink {
private static final int NORMAL = 2;
private static final int TEXTCOORD = 3;
- private int vCount, cCount, nCount, tCount; // number of elements fit in each buffer
+ private int vCount, cCount, nCount, tCount; // number of elements fit in each buffer
private int vOffset, cOffset, nOffset, tOffset; // offset of specific array in common buffer
private int vElems, cElems, nElems, tElems; // number of used elements in each buffer
- private final int vComps, cComps, nComps, tComps; // number of components for each elements [2, 3, 4]
- private final int vCompsBytes, cCompsBytes, nCompsBytes, tCompsBytes; // byte size of all components
+ private final int vComps, cComps, nComps, tComps; // number of components for each elements [2, 3, 4]
+ private final int vCompsBytes, cCompsBytes, nCompsBytes, tCompsBytes; // byte size of all components
private final int vDataType, cDataType, nDataType, tDataType;
private final boolean vDataTypeSigned, cDataTypeSigned, nDataTypeSigned, tDataTypeSigned;
private final int pageSize;
private Buffer vertexArray, colorArray, normalArray, textCoordArray;
private GLArrayDataWrapper vArrayData, cArrayData, nArrayData, tArrayData;
- private boolean sealed, sealedGL;
+ private boolean sealed, sealedGL;
private boolean bufferEnabled, bufferWritten, bufferWrittenOnce;
private boolean glslLocationSet;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
index 5815185..218897f 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2011 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package com.jogamp.opengl.util;
@@ -55,22 +55,22 @@ import com.jogamp.opengl.math.geom.Frustum;
* regarding the projection (P), modelview (Mv) matrix operation
* which is specified in {@link GLMatrixFunc}.
* <p>
- * Further more, PMVMatrix provides the {@link #glGetMviMatrixf() inverse modelview matrix (Mvi)} and
+ * Further more, PMVMatrix provides the {@link #glGetMviMatrixf() inverse modelview matrix (Mvi)} and
* {@link #glGetMvitMatrixf() inverse transposed modelview matrix (Mvit)}.
* {@link Frustum} is also provided by {@link #glGetFrustum()}.
* To keep these derived values synchronized after mutable Mv operations like {@link #glRotatef(float, float, float, float) glRotatef(..)}
- * in {@link #glMatrixMode(int) glMatrixMode}({@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}),
- * users have to call {@link #update()} before using Mvi and Mvit.
+ * in {@link #glMatrixMode(int) glMatrixMode}({@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}),
+ * users have to call {@link #update()} before using Mvi and Mvit.
* </p>
* <p>
- * All matrices are provided in column-major order,
- * as specified in the OpenGL fixed function pipeline, i.e. compatibility profile.
+ * All matrices are provided in column-major order,
+ * as specified in the OpenGL fixed function pipeline, i.e. compatibility profile.
* </p>
* <p>
- * PMVMatrix can supplement {@link GL2ES2} applications w/ the
+ * PMVMatrix can supplement {@link GL2ES2} applications w/ the
* lack of the described matrix functionality.
* </p>
- * <a name="storageDetails"><h5>Matrix storage details</h5></a>
+ * <a name="storageDetails"><h5>Matrix storage details</h5></a>
* <p>
* All matrices use a common FloatBuffer storage
* and are a {@link Buffers#slice2Float(Buffer, float[], int, int) sliced} representation of it.
@@ -78,11 +78,11 @@ import com.jogamp.opengl.math.geom.Frustum;
* depending how the instance if {@link #PMVMatrix(boolean) being constructed}.
* </p>
* <p>
- * <b>Note:</b>
- * <ul>
+ * <b>Note:</b>
+ * <ul>
* <li>The matrix is a {@link Buffers#slice2Float(Buffer, float[], int, int) sliced part } of a host matrix and it's start position has been {@link FloatBuffer#mark() marked}.</li>
* <li>Use {@link FloatBuffer#reset() reset()} to rewind it to it's start position after relative operations, like {@link FloatBuffer#get() get()}.</li>
- * <li>If using absolute operations like {@link FloatBuffer#get(int) get(int)}, use it's {@link FloatBuffer#reset() reset} {@link FloatBuffer#position() position} as it's offset.</li>
+ * <li>If using absolute operations like {@link FloatBuffer#get(int) get(int)}, use it's {@link FloatBuffer#reset() reset} {@link FloatBuffer#position() position} as it's offset.</li>
* </ul>
* </p>
*/
@@ -96,20 +96,20 @@ public class PMVMatrix implements GLMatrixFunc {
public static final int MODIFIED_TEXTURE = 1 << 2;
/** Bit value stating all is modified */
public static final int MODIFIED_ALL = MODIFIED_PROJECTION | MODIFIED_MODELVIEW | MODIFIED_TEXTURE ;
-
+
/** Bit value stating a dirty {@link #glGetMviMatrixf() inverse modelview matrix (Mvi)}. */
public static final int DIRTY_INVERSE_MODELVIEW = 1 << 0;
/** Bit value stating a dirty {@link #glGetMvitMatrixf() inverse transposed modelview matrix (Mvit)}. */
- public static final int DIRTY_INVERSE_TRANSPOSED_MODELVIEW = 1 << 1;
+ public static final int DIRTY_INVERSE_TRANSPOSED_MODELVIEW = 1 << 1;
/** Bit value stating a dirty {@link #glGetFrustum() frustum}. */
- public static final int DIRTY_FRUSTUM = 1 << 2;
+ public static final int DIRTY_FRUSTUM = 1 << 2;
/** Bit value stating all is dirty */
public static final int DIRTY_ALL = DIRTY_INVERSE_MODELVIEW | DIRTY_INVERSE_TRANSPOSED_MODELVIEW | DIRTY_FRUSTUM;
-
+
/**
- * @param matrixModeName One of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE}
+ * @param matrixModeName One of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE}
* @return true if the given matrix-mode name is valid, otherwise false.
- */
+ */
public static final boolean isMatrixModeName(final int matrixModeName) {
switch(matrixModeName) {
case GL_MODELVIEW_MATRIX:
@@ -121,9 +121,9 @@ public class PMVMatrix implements GLMatrixFunc {
}
/**
- * @param matrixModeName One of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE}
+ * @param matrixModeName One of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE}
* @return The corresponding matrix-get name, one of {@link GLMatrixFunc#GL_MODELVIEW_MATRIX GL_MODELVIEW_MATRIX}, {@link GLMatrixFunc#GL_PROJECTION_MATRIX GL_PROJECTION_MATRIX} or {@link GLMatrixFunc#GL_TEXTURE_MATRIX GL_TEXTURE_MATRIX}
- */
+ */
public static final int matrixModeName2MatrixGetName(final int matrixModeName) {
switch(matrixModeName) {
case GL_MODELVIEW:
@@ -138,9 +138,9 @@ public class PMVMatrix implements GLMatrixFunc {
}
/**
- * @param matrixGetName One of {@link GLMatrixFunc#GL_MODELVIEW_MATRIX GL_MODELVIEW_MATRIX}, {@link GLMatrixFunc#GL_PROJECTION_MATRIX GL_PROJECTION_MATRIX} or {@link GLMatrixFunc#GL_TEXTURE_MATRIX GL_TEXTURE_MATRIX}
+ * @param matrixGetName One of {@link GLMatrixFunc#GL_MODELVIEW_MATRIX GL_MODELVIEW_MATRIX}, {@link GLMatrixFunc#GL_PROJECTION_MATRIX GL_PROJECTION_MATRIX} or {@link GLMatrixFunc#GL_TEXTURE_MATRIX GL_TEXTURE_MATRIX}
* @return true if the given matrix-get name is valid, otherwise false.
- */
+ */
public static final boolean isMatrixGetName(final int matrixGetName) {
switch(matrixGetName) {
case GL_MATRIX_MODE:
@@ -155,7 +155,7 @@ public class PMVMatrix implements GLMatrixFunc {
/**
* @param matrixGetName One of {@link GLMatrixFunc#GL_MODELVIEW_MATRIX GL_MODELVIEW_MATRIX}, {@link GLMatrixFunc#GL_PROJECTION_MATRIX GL_PROJECTION_MATRIX} or {@link GLMatrixFunc#GL_TEXTURE_MATRIX GL_TEXTURE_MATRIX}
* @return The corresponding matrix-mode name, one of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE}
- */
+ */
public static final int matrixGetName2MatrixModeName(final int matrixGetName) {
switch(matrixGetName) {
case GL_MODELVIEW_MATRIX:
@@ -168,18 +168,18 @@ public class PMVMatrix implements GLMatrixFunc {
throw new GLException("unsupported matrixGetName: "+matrixGetName);
}
}
-
- /**
+
+ /**
* @param sb optional passed StringBuilder instance to be used
* @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter}
* @param a 4x4 matrix in column major order (OpenGL)
* @return matrix string representation
*/
public static StringBuilder matrixToString(StringBuilder sb, String f, FloatBuffer a) {
- return FloatUtil.matrixToString(sb, null, f, a, 0, 4, 4, false);
+ return FloatUtil.matrixToString(sb, null, f, a, 0, 4, 4, false);
}
-
- /**
+
+ /**
* @param sb optional passed StringBuilder instance to be used
* @param f the format string of one floating point, i.e. "%10.5f", see {@link java.util.Formatter}
* @param a 4x4 matrix in column major order (OpenGL)
@@ -187,33 +187,33 @@ public class PMVMatrix implements GLMatrixFunc {
* @return side by side representation
*/
public static StringBuilder matrixToString(StringBuilder sb, String f, FloatBuffer a, FloatBuffer b) {
- return FloatUtil.matrixToString(sb, null, f, a, 0, b, 0, 4, 4, false);
+ return FloatUtil.matrixToString(sb, null, f, a, 0, b, 0, 4, 4, false);
}
-
+
/**
* Creates an instance of PMVMatrix {@link #PMVMatrix(boolean) PMVMatrix(boolean useBackingArray)},
- * with <code>useBackingArray = true</code>.
+ * with <code>useBackingArray = true</code>.
*/
public PMVMatrix() {
this(true);
}
-
+
/**
* Creates an instance of PMVMatrix.
- *
+ *
* @param useBackingArray <code>true</code> for non direct NIO Buffers with guaranteed backing array,
* which allows faster access in Java computation.
* <p><code>false</code> for direct NIO buffers w/o a guaranteed backing array.
* In most Java implementations, direct NIO buffers have no backing array
- * and hence the Java computation will be throttled down by direct IO get/put
- * operations.</p>
+ * and hence the Java computation will be throttled down by direct IO get/put
+ * operations.</p>
* <p>Depending on the application, ie. whether the Java computation or
- * JNI invocation and hence native data transfer part is heavier,
+ * JNI invocation and hence native data transfer part is heavier,
* this flag shall be set to <code>true</code> or <code>false</code></p>.
*/
public PMVMatrix(boolean useBackingArray) {
this.usesBackingArray = useBackingArray;
-
+
// I Identity
// T Texture
// P Projection
@@ -228,24 +228,24 @@ public class PMVMatrix implements GLMatrixFunc {
matrixBuffer = Buffers.newDirectByteBuffer( ( 6*16 + ProjectFloat.getRequiredFloatBufferSize() ) * Buffers.SIZEOF_FLOAT );
matrixBuffer.mark();
}
-
+
matrixIdent = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 0*16, 1*16); // I
matrixTex = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 1*16, 1*16); // T
- matrixPMvMvit = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 2*16, 4*16); // P + Mv + Mvi + Mvit
+ matrixPMvMvit = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 2*16, 4*16); // P + Mv + Mvi + Mvit
matrixPMvMvi = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 2*16, 3*16); // P + Mv + Mvi
matrixPMv = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 2*16, 2*16); // P + Mv
matrixP = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 2*16, 1*16); // P
matrixMv = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 3*16, 1*16); // Mv
matrixMvi = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 4*16, 1*16); // Mvi
matrixMvit = Buffers.slice2Float(matrixBuffer, matrixBufferArray, 5*16, 1*16); // Mvit
-
+
projectFloat = new ProjectFloat(matrixBuffer, matrixBufferArray, 6*16);
-
+
if(null != matrixBuffer) {
matrixBuffer.reset();
- }
+ }
FloatUtil.makeIdentityf(matrixIdent);
-
+
vec3f = new float[3];
matrixMult = new float[16];
matrixTrans = new float[16];
@@ -263,7 +263,7 @@ public class PMVMatrix implements GLMatrixFunc {
matrixTStack = new FloatStack( 0, 2*16); // growSize: GL-min size (2)
matrixPStack = new FloatStack( 0, 2*16); // growSize: GL-min size (2)
matrixMvStack= new FloatStack( 0, 16*16); // growSize: half GL-min size (32)
-
+
// default values and mode
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -275,22 +275,22 @@ public class PMVMatrix implements GLMatrixFunc {
dirtyBits = DIRTY_ALL;
requestMask = 0;
matrixMode = GL_MODELVIEW;
-
+
mulPMV = null;
frustum = null;
}
/** @see #PMVMatrix(boolean) */
- public final boolean usesBackingArray() { return usesBackingArray; }
-
+ public final boolean usesBackingArray() { return usesBackingArray; }
+
public final void destroy() {
if(null!=projectFloat) {
projectFloat.destroy(); projectFloat=null;
}
matrixBuffer=null;
- matrixBuffer=null; matrixPMvMvit=null; matrixPMvMvi=null; matrixPMv=null;
- matrixP=null; matrixTex=null; matrixMv=null; matrixMvi=null; matrixMvit=null;
+ matrixBuffer=null; matrixPMvMvit=null; matrixPMvMvi=null; matrixPMv=null;
+ matrixP=null; matrixTex=null; matrixMv=null; matrixMvi=null; matrixMvit=null;
vec3f = null;
matrixMult = null;
@@ -299,7 +299,7 @@ public class PMVMatrix implements GLMatrixFunc {
matrixScale = null;
matrixOrtho = null;
matrixFrustum = null;
-
+
if(null!=matrixPStack) {
matrixPStack=null;
}
@@ -314,13 +314,13 @@ public class PMVMatrix implements GLMatrixFunc {
}
}
-
+
/** Returns the current matrix-mode, one of {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE}. */
public final int glGetMatrixMode() {
return matrixMode;
}
- /**
+ /**
* Returns the {@link GLMatrixFunc#GL_TEXTURE_MATRIX texture matrix} (T).
* <p>
* See <a href="#storageDetails"> matrix storage details</a>.
@@ -330,7 +330,7 @@ public class PMVMatrix implements GLMatrixFunc {
return matrixTex;
}
- /**
+ /**
* Returns the {@link GLMatrixFunc#GL_PROJECTION_MATRIX projection matrix} (P).
* <p>
* See <a href="#storageDetails"> matrix storage details</a>.
@@ -340,7 +340,7 @@ public class PMVMatrix implements GLMatrixFunc {
return matrixP;
}
- /**
+ /**
* Returns the {@link GLMatrixFunc#GL_MODELVIEW_MATRIX modelview matrix} (Mv).
* <p>
* See <a href="#storageDetails"> matrix storage details</a>.
@@ -350,7 +350,7 @@ public class PMVMatrix implements GLMatrixFunc {
return matrixMv;
}
- /**
+ /**
* Returns the inverse {@link GLMatrixFunc#GL_MODELVIEW_MATRIX modelview matrix} (Mvi).
* <p>
* Method enables the Mvi matrix update, and performs it's update w/o clearing the modified bits.
@@ -367,7 +367,7 @@ public class PMVMatrix implements GLMatrixFunc {
return matrixMvi;
}
- /**
+ /**
* Returns the inverse transposed {@link GLMatrixFunc#GL_MODELVIEW_MATRIX modelview matrix} (Mvit).
* <p>
* Method enables the Mvit matrix update, and performs it's update w/o clearing the modified bits.
@@ -383,9 +383,9 @@ public class PMVMatrix implements GLMatrixFunc {
updateImpl(false);
return matrixMvit;
}
-
- /**
- * Returns 2 matrices within one FloatBuffer: {@link #glGetPMatrixf() P} and {@link #glGetMvMatrixf() Mv}.
+
+ /**
+ * Returns 2 matrices within one FloatBuffer: {@link #glGetPMatrixf() P} and {@link #glGetMvMatrixf() Mv}.
* <p>
* See <a href="#storageDetails"> matrix storage details</a>.
* </p>
@@ -393,9 +393,9 @@ public class PMVMatrix implements GLMatrixFunc {
public final FloatBuffer glGetPMvMatrixf() {
return matrixPMv;
}
-
- /**
- * Returns 3 matrices within one FloatBuffer: {@link #glGetPMatrixf() P}, {@link #glGetMvMatrixf() Mv} and {@link #glGetMviMatrixf() Mvi}.
+
+ /**
+ * Returns 3 matrices within one FloatBuffer: {@link #glGetPMatrixf() P}, {@link #glGetMvMatrixf() Mv} and {@link #glGetMviMatrixf() Mvi}.
* <p>
* Method enables the Mvi matrix update, and performs it's update w/o clearing the modified bits.
* </p>
@@ -410,9 +410,9 @@ public class PMVMatrix implements GLMatrixFunc {
updateImpl(false);
return matrixPMvMvi;
}
-
- /**
- * Returns 4 matrices within one FloatBuffer: {@link #glGetPMatrixf() P}, {@link #glGetMvMatrixf() Mv}, {@link #glGetMviMatrixf() Mvi} and {@link #glGetMvitMatrixf() Mvit}.
+
+ /**
+ * Returns 4 matrices within one FloatBuffer: {@link #glGetPMatrixf() P}, {@link #glGetMvMatrixf() Mv}, {@link #glGetMviMatrixf() Mvi} and {@link #glGetMvitMatrixf() Mvit}.
* <p>
* Method enables the Mvi and Mvit matrix update, and performs it's update w/o clearing the modified bits.
* </p>
@@ -427,14 +427,14 @@ public class PMVMatrix implements GLMatrixFunc {
updateImpl(false);
return matrixPMvMvit;
}
-
+
/** Returns the frustum, derived from projection * modelview */
public Frustum glGetFrustum() {
requestMask |= DIRTY_FRUSTUM;
updateImpl(false);
return frustum;
}
-
+
/*
* @return the matrix of the current matrix-mode
*/
@@ -443,7 +443,7 @@ public class PMVMatrix implements GLMatrixFunc {
}
/**
- * @param matrixName Either a matrix-get-name, i.e.
+ * @param matrixName Either a matrix-get-name, i.e.
* {@link GLMatrixFunc#GL_MODELVIEW_MATRIX GL_MODELVIEW_MATRIX}, {@link GLMatrixFunc#GL_PROJECTION_MATRIX GL_PROJECTION_MATRIX} or {@link GLMatrixFunc#GL_TEXTURE_MATRIX GL_TEXTURE_MATRIX},
* or a matrix-mode-name, i.e.
* {@link GLMatrixFunc#GL_MODELVIEW GL_MODELVIEW}, {@link GLMatrixFunc#GL_PROJECTION GL_PROJECTION} or {@link GL#GL_TEXTURE GL_TEXTURE}
@@ -462,10 +462,10 @@ public class PMVMatrix implements GLMatrixFunc {
return matrixTex;
default:
throw new GLException("unsupported matrixName: "+matrixName);
- }
+ }
}
- //
+ //
// GLMatrixFunc implementation
//
@@ -494,7 +494,7 @@ public class PMVMatrix implements GLMatrixFunc {
}
params.position(pos);
}
-
+
@Override
public final void glGetFloatv(int matrixGetName, float[] params, int params_offset) {
if(matrixGetName==GL_MATRIX_MODE) {
@@ -505,7 +505,7 @@ public class PMVMatrix implements GLMatrixFunc {
matrix.reset();
}
}
-
+
@Override
public final void glGetIntegerv(int pname, IntBuffer params) {
int pos = params.position();
@@ -516,7 +516,7 @@ public class PMVMatrix implements GLMatrixFunc {
}
params.position(pos);
}
-
+
@Override
public final void glGetIntegerv(int pname, int[] params, int params_offset) {
if(pname==GL_MATRIX_MODE) {
@@ -537,12 +537,12 @@ public class PMVMatrix implements GLMatrixFunc {
matrixP.put(values, offset, 16);
matrixP.reset();
dirtyBits |= DIRTY_FRUSTUM ;
- modifiedBits |= MODIFIED_PROJECTION;
+ modifiedBits |= MODIFIED_PROJECTION;
} else if(matrixMode==GL.GL_TEXTURE) {
matrixTex.put(values, offset, 16);
matrixTex.reset();
modifiedBits |= MODIFIED_TEXTURE;
- }
+ }
}
@Override
@@ -557,12 +557,12 @@ public class PMVMatrix implements GLMatrixFunc {
matrixP.put(m);
matrixP.reset();
dirtyBits |= DIRTY_FRUSTUM ;
- modifiedBits |= MODIFIED_PROJECTION;
+ modifiedBits |= MODIFIED_PROJECTION;
} else if(matrixMode==GL.GL_TEXTURE) {
matrixTex.put(m);
matrixTex.reset();
modifiedBits |= MODIFIED_TEXTURE;
- }
+ }
m.position(spos);
}
@@ -584,9 +584,9 @@ public class PMVMatrix implements GLMatrixFunc {
@Override
public final void glPushMatrix() {
- if(matrixMode==GL_MODELVIEW) {
+ if(matrixMode==GL_MODELVIEW) {
matrixMvStack.putOnTop(matrixMv, 16);
- matrixMv.reset();
+ matrixMv.reset();
} else if(matrixMode==GL_PROJECTION) {
matrixPStack.putOnTop(matrixP, 16);
matrixP.reset();
@@ -612,8 +612,8 @@ public class PMVMatrix implements GLMatrixFunc {
matrixTex.put(matrixIdent);
matrixTex.reset();
modifiedBits |= MODIFIED_TEXTURE;
- }
- matrixIdent.reset();
+ }
+ matrixIdent.reset();
}
@Override
@@ -629,7 +629,7 @@ public class PMVMatrix implements GLMatrixFunc {
} else if(matrixMode==GL.GL_TEXTURE) {
FloatUtil.multMatrixf(matrixTex, m);
modifiedBits |= MODIFIED_TEXTURE;
- }
+ }
}
@Override
@@ -645,12 +645,12 @@ public class PMVMatrix implements GLMatrixFunc {
} else if(matrixMode==GL.GL_TEXTURE) {
FloatUtil.multMatrixf(matrixTex, m, m_offset);
modifiedBits |= MODIFIED_TEXTURE;
- }
+ }
}
@Override
public final void glTranslatef(final float x, final float y, final float z) {
- // Translation matrix:
+ // Translation matrix:
// 1 0 0 x
// 0 1 0 y
// 0 0 1 z
@@ -665,7 +665,7 @@ public class PMVMatrix implements GLMatrixFunc {
public final void glRotatef(final float angdeg, float x, float y, float z) {
final float angrad = angdeg * (float) Math.PI / 180.0f;
final float c = (float)Math.cos(angrad);
- final float ic= 1.0f - c;
+ final float ic= 1.0f - c;
final float s = (float)Math.sin(angrad);
vec3f[0]=x; vec3f[1]=y; vec3f[2]=z;
@@ -700,7 +700,7 @@ public class PMVMatrix implements GLMatrixFunc {
@Override
public final void glScalef(final float x, final float y, final float z) {
- // Scale matrix:
+ // Scale matrix:
// x 0 0 0
// 0 y 0 0
// 0 0 z 0
@@ -714,7 +714,7 @@ public class PMVMatrix implements GLMatrixFunc {
@Override
public final void glOrthof(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) {
- // Ortho matrix:
+ // Ortho matrix:
// 2/dx 0 0 tx
// 0 2/dy 0 ty
// 0 0 2/dz tz
@@ -744,7 +744,7 @@ public class PMVMatrix implements GLMatrixFunc {
if(left==right || top==bottom) {
throw new GLException("GL_INVALID_VALUE: top,bottom and left,right must not be equal");
}
- // Frustum matrix:
+ // Frustum matrix:
// 2*zNear/dx 0 A 0
// 0 2*zNear/dy B 0
// 0 0 C D
@@ -774,7 +774,7 @@ public class PMVMatrix implements GLMatrixFunc {
//
// Extra functionality
//
-
+
/**
* {@link #glMultMatrixf(FloatBuffer) Multiply} the {@link #glGetMatrixMode() current matrix} with the perspective/frustum matrix.
*/
@@ -787,7 +787,7 @@ public class PMVMatrix implements GLMatrixFunc {
}
/**
- * {@link #glMultMatrixf(FloatBuffer) Multiply} and {@link #glTranslatef(float, float, float) translate} the {@link #glGetMatrixMode() current matrix}
+ * {@link #glMultMatrixf(FloatBuffer) Multiply} and {@link #glTranslatef(float, float, float) translate} the {@link #glGetMatrixMode() current matrix}
* with the eye, object and orientation.
*/
public final void gluLookAt(float eyex, float eyey, float eyez,
@@ -798,7 +798,7 @@ public class PMVMatrix implements GLMatrixFunc {
/**
* Map object coordinates to window coordinates.
- *
+ *
* @param objx
* @param objy
* @param objz
@@ -815,20 +815,20 @@ public class PMVMatrix implements GLMatrixFunc {
return projectFloat.gluProject(objx, objy, objz,
matrixMv.array(), matrixMv.position(),
matrixP.array(), matrixP.position(),
- viewport, viewport_offset,
+ viewport, viewport_offset,
win_pos, win_pos_offset);
} else {
return projectFloat.gluProject(objx, objy, objz,
matrixMv,
matrixP,
- viewport, viewport_offset,
+ viewport, viewport_offset,
win_pos, win_pos_offset);
}
}
/**
* Map window coordinates to object coordinates.
- *
+ *
* @param winx
* @param winy
* @param winz
@@ -845,23 +845,23 @@ public class PMVMatrix implements GLMatrixFunc {
return projectFloat.gluUnProject(winx, winy, winz,
matrixMv.array(), matrixMv.position(),
matrixP.array(), matrixP.position(),
- viewport, viewport_offset,
+ viewport, viewport_offset,
obj_pos, obj_pos_offset);
} else {
return projectFloat.gluUnProject(winx, winy, winz,
matrixMv,
matrixP,
- viewport, viewport_offset,
+ viewport, viewport_offset,
obj_pos, obj_pos_offset);
- }
+ }
}
-
+
public final void gluPickMatrix(float x, float y,
float deltaX, float deltaY,
int[] viewport, int viewport_offset) {
projectFloat.gluPickMatrix(this, x, y, deltaX, deltaY, viewport, viewport_offset);
}
-
+
public StringBuilder toString(StringBuilder sb, String f) {
if(null == sb) {
sb = new StringBuilder();
@@ -874,8 +874,8 @@ public class PMVMatrix implements GLMatrixFunc {
final boolean frustumReq = 0 != (DIRTY_FRUSTUM & requestMask);
final boolean modP = 0 != ( MODIFIED_PROJECTION & modifiedBits );
final boolean modMv = 0 != ( MODIFIED_MODELVIEW & modifiedBits );
- final boolean modT = 0 != ( MODIFIED_TEXTURE & modifiedBits );
-
+ final boolean modT = 0 != ( MODIFIED_TEXTURE & modifiedBits );
+
sb.append("PMVMatrix[backingArray ").append(this.usesBackingArray());
sb.append(", modified[P ").append(modP).append(", Mv ").append(modMv).append(", T ").append(modT);
sb.append("], dirty/req[Mvi ").append(mviDirty).append("/").append(mviReq).append(", Mvit ").append(mvitDirty).append("/").append(mvitReq).append(", Frustum ").append(frustumDirty).append("/").append(frustumReq);
@@ -887,28 +887,29 @@ public class PMVMatrix implements GLMatrixFunc {
matrixToString(sb, f, matrixTex);
if( 0 != ( requestMask & DIRTY_INVERSE_MODELVIEW ) ) {
sb.append(", Inverse Modelview").append(Platform.NEWLINE);
- matrixToString(sb, f, matrixMvi);
+ matrixToString(sb, f, matrixMvi);
}
if( 0 != ( requestMask & DIRTY_INVERSE_TRANSPOSED_MODELVIEW ) ) {
sb.append(", Inverse Transposed Modelview").append(Platform.NEWLINE);
- matrixToString(sb, f, matrixMvit);
+ matrixToString(sb, f, matrixMvit);
}
sb.append("]");
return sb;
}
-
+
+ @Override
public String toString() {
return toString(null, "%10.5f").toString();
}
- /**
+ /**
* Returns the modified bits due to mutable operations..
* <p>
* A modified bit is set, if the corresponding matrix had been modified by a mutable operation
* since last {@link #update()} or {@link #getModifiedBits(boolean) getModifiedBits(true)} call.
* </p>
* @param clear if true, clears the modified bits, otherwise leaves them untouched.
- *
+ *
* @see #MODIFIED_PROJECTION
* @see #MODIFIED_MODELVIEW
* @see #MODIFIED_TEXTURE
@@ -920,16 +921,16 @@ public class PMVMatrix implements GLMatrixFunc {
}
return r;
}
-
- /**
+
+ /**
* Returns the dirty bits due to mutable operations.
* <p>
* A dirty bit is set , if the corresponding matrix had been modified by a mutable operation
* since last {@link #update()} call. The latter clears the dirty state only if the dirty matrix (Mvi or Mvit) or {@link Frustum}
- * has been requested by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get}
+ * has been requested by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get}
* or {@link #glGetFrustum() Frustum get} methods.
* </p>
- *
+ *
* @deprecated Function is exposed for debugging purposes only.
* @see #DIRTY_INVERSE_MODELVIEW
* @see #DIRTY_INVERSE_TRANSPOSED_MODELVIEW
@@ -944,12 +945,12 @@ public class PMVMatrix implements GLMatrixFunc {
return dirtyBits;
}
- /**
+ /**
* Returns the request bit mask, which uses bit values equal to the dirty mask.
* <p>
- * The request bit mask is set by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get}
+ * The request bit mask is set by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get}
* or {@link #glGetFrustum() Frustum get} methods.
- * </p>
+ * </p>
*
* @deprecated Function is exposed for debugging purposes only.
* @see #clearAllUpdateRequests()
@@ -965,16 +966,16 @@ public class PMVMatrix implements GLMatrixFunc {
public final int getRequestMask() {
return requestMask;
}
-
-
+
+
/**
* Clears all {@link #update()} requests of the Mvi and Mvit matrix and Frustum
- * after it has been enabled by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get}
+ * after it has been enabled by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get}
* or {@link #glGetFrustum() Frustum get} methods.
* <p>
* Allows user to disable subsequent Mvi, Mvit and {@link Frustum} updates if no more required.
- * </p>
- *
+ * </p>
+ *
* @see #glGetMviMatrixf()
* @see #glGetMvitMatrixf()
* @see #glGetPMvMviMatrixf()
@@ -983,14 +984,14 @@ public class PMVMatrix implements GLMatrixFunc {
* @see #getRequestMask()
*/
public final void clearAllUpdateRequests() {
- requestMask &= ~DIRTY_ALL;
+ requestMask &= ~DIRTY_ALL;
}
-
+
/**
* Update the derived {@link #glGetMviMatrixf() inverse modelview (Mvi)},
- * {@link #glGetMvitMatrixf() inverse transposed modelview (Mvit)} matrices and {@link Frustum}
- * <b>if</b> they are dirty <b>and</b> they were requested
- * by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get}
+ * {@link #glGetMvitMatrixf() inverse transposed modelview (Mvit)} matrices and {@link Frustum}
+ * <b>if</b> they are dirty <b>and</b> they were requested
+ * by one of the {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get}
* or {@link #glGetFrustum() Frustum get} methods.
* <p>
* The Mvi and Mvit matrices and {@link Frustum} are considered dirty, if their corresponding
@@ -999,7 +1000,7 @@ public class PMVMatrix implements GLMatrixFunc {
* <p>
* Method should be called manually in case mutable operations has been called
* and caller operates on already fetched references, i.e. not calling
- * {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get}
+ * {@link #glGetMviMatrixf() Mvi get}, {@link #glGetMvitMatrixf() Mvit get}
* or {@link #glGetFrustum() Frustum get} etc anymore.
* </p>
* <p>
@@ -1007,12 +1008,12 @@ public class PMVMatrix implements GLMatrixFunc {
* which are set by any mutable operation. The modified bits have no impact
* on this method, but the return value.
* </p>
- *
- * @return true if any matrix has been modified since last update call or
+ *
+ * @return true if any matrix has been modified since last update call or
* if the derived matrices Mvi and Mvit or {@link Frustum} were updated, otherwise false.
* In other words, method returns true if any matrix used by the caller must be updated,
* e.g. uniforms in a shader program.
- *
+ *
* @see #getModifiedBits(boolean)
* @see #MODIFIED_PROJECTION
* @see #MODIFIED_MODELVIEW
@@ -1035,7 +1036,7 @@ public class PMVMatrix implements GLMatrixFunc {
if(clearModBits) {
modifiedBits = 0;
}
-
+
if( 0 != ( dirtyBits & ( DIRTY_FRUSTUM & requestMask ) ) ) {
if( null == frustum ) {
frustum = new Frustum();
@@ -1046,7 +1047,7 @@ public class PMVMatrix implements GLMatrixFunc {
dirtyBits &= ~DIRTY_FRUSTUM;
mod = true;
}
-
+
if( 0 == ( dirtyBits & requestMask ) ) {
return mod; // nothing more requested which may have been dirty
}
@@ -1061,9 +1062,9 @@ public class PMVMatrix implements GLMatrixFunc {
}
return setMviMvitNIODirectAccess() || mod;
}
-
+
//
- // private
+ // private
//
private int nioBackupArraySupported = 0; // -1 not supported, 0 - TBD, 1 - supported
private final String msgCantComputeInverse = "Invalid source Mv matrix, can't compute inverse";
@@ -1080,7 +1081,7 @@ public class PMVMatrix implements GLMatrixFunc {
res = true;
}
if( 0 != ( requestMask & ( dirtyBits & DIRTY_INVERSE_TRANSPOSED_MODELVIEW ) ) ) { // only if requested & dirty
- // transpose matrix
+ // transpose matrix
final float[] _matrixMvit = matrixMvit.array();
final int _matrixMvitOffset = matrixMvit.position();
for (int i = 0; i < 4; i++) {
@@ -1093,7 +1094,7 @@ public class PMVMatrix implements GLMatrixFunc {
}
return res;
}
-
+
private final boolean setMviMvitNIODirectAccess() {
boolean res = false;
if( 0 != ( dirtyBits & DIRTY_INVERSE_MODELVIEW ) ) { // only if dirt; always requested at this point, see update()
@@ -1104,7 +1105,7 @@ public class PMVMatrix implements GLMatrixFunc {
res = true;
}
if( 0 != ( requestMask & ( dirtyBits & DIRTY_INVERSE_TRANSPOSED_MODELVIEW ) ) ) { // only if requested & dirty
- // transpose matrix
+ // transpose matrix
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
matrixMvit.put(j+i*4, matrixMvi.get(i+j*4));
diff --git a/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java
new file mode 100644
index 0000000..1c87dad
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java
@@ -0,0 +1,237 @@
+/**
+ * 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.
+ */
+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.util.GLPixelBuffer.GLPixelAttributes;
+
+/**
+ * Variation of {@link TileRenderer} w/o using fixed tiles but arbitrary rectangular regions.
+ * <p>
+ * See {@link TileRendererBase} for details.
+ * </p>
+ */
+public class RandomTileRenderer extends TileRendererBase {
+ private boolean tileRectSet = false;
+
+ /**
+ * Creates a new TileRenderer object
+ */
+ public RandomTileRenderer() {
+ super();
+ }
+
+ @Override
+ public final int getParam(int pname) {
+ switch (pname) {
+ case TR_IMAGE_WIDTH:
+ return imageSize.getWidth();
+ case TR_IMAGE_HEIGHT:
+ return imageSize.getHeight();
+ case TR_CURRENT_TILE_X_POS:
+ return currentTileXPos;
+ case TR_CURRENT_TILE_Y_POS:
+ return currentTileYPos;
+ case TR_CURRENT_TILE_WIDTH:
+ return currentTileWidth;
+ case TR_CURRENT_TILE_HEIGHT:
+ return currentTileHeight;
+ default:
+ throw new IllegalArgumentException("Invalid pname: "+pname);
+ }
+ }
+
+ /**
+ * Set the tile rectangle for the subsequent rendering calls.
+ *
+ * @throws IllegalArgumentException is tile x/y are < 0 or tile size is <= 0x0
+ */
+ public void setTileRect(int tX, int tY, int tWidth, int tHeight) throws IllegalStateException, IllegalArgumentException {
+ if( 0 > tX || 0 > tY ) {
+ throw new IllegalArgumentException("Tile pos must be >= 0/0");
+ }
+ if( 0 >= tWidth || 0 >= tHeight ) {
+ throw new IllegalArgumentException("Tile size must be > 0x0");
+ }
+ this.currentTileXPos = tX;
+ this.currentTileYPos = tY;
+ this.currentTileWidth = tWidth;
+ this.currentTileHeight = tHeight;
+ tileRectSet = true;
+ }
+
+ @Override
+ public final boolean isSetup() {
+ return 0 < imageSize.getWidth() && 0 < imageSize.getHeight() && tileRectSet;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>
+ * <i>end of tiling</i> is never reached w/ {@link RandomRileRenderer},
+ * i.e. method always returns false.
+ * </p>
+ */
+ @Override
+ public final boolean eot() { return false; }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Reset internal states of {@link RandomTileRenderer} are: <i>none</i>.
+ */
+ @Override
+ public final void reset() { }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @throws IllegalStateException if {@link #setImageSize(int, int) image-size} has not been set or
+ * {@link #setTileRect(int, int, int, int) tile-rect} has not been set.
+ */
+ @Override
+ public final void beginTile(GL gl) throws IllegalStateException, GLException {
+ if( 0 >= imageSize.getWidth() || 0 >= imageSize.getHeight() ) {
+ throw new IllegalStateException("Image size has not been set");
+ }
+ if( !tileRectSet ) {
+ throw new IllegalStateException("tileRect has not been set");
+ }
+ validateGL(gl);
+
+ gl.glViewport( 0, 0, currentTileWidth, currentTileHeight );
+
+ if( DEBUG ) {
+ System.err.println("TileRenderer.begin.X: "+this.toString());
+ }
+
+ // Do not forget to issue:
+ // reshape( 0, 0, tW, tH );
+ // which shall reflect tile renderer fileds: currentTileXPos, currentTileYPos and imageSize
+
+ beginCalled = true;
+ }
+
+ @Override
+ public void endTile( GL gl ) throws IllegalStateException, GLException {
+ if( !beginCalled ) {
+ throw new IllegalStateException("beginTile(..) has not been called");
+ }
+ validateGL(gl);
+
+ // be sure OpenGL rendering is finished
+ gl.glFlush();
+
+ // save current glPixelStore values
+ psm.save(gl);
+ psm.setPackAlignment(gl, 1);
+ final GL2ES3 gl2es3;
+ final int readBuffer;
+ if( gl.isGL2ES3() ) {
+ gl2es3 = gl.getGL2ES3();
+ readBuffer = gl2es3.getDefaultReadBuffer();
+ gl2es3.glReadBuffer(readBuffer);
+ } else {
+ gl2es3 = null;
+ readBuffer = 0; // undef. probably default: GL_FRONT (single buffering) GL_BACK (double buffering)
+ }
+ if( DEBUG ) {
+ System.err.println("TileRenderer.end.0: readBuffer 0x"+Integer.toHexString(readBuffer)+", "+this.toString());
+ }
+
+ final int tmp[] = new int[1];
+
+ if( tileBuffer != null ) {
+ final GLPixelAttributes pixelAttribs = tileBuffer.pixelAttributes;
+ final int srcX = 0;
+ 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);
+ tileBuffer.clear();
+ if( tileBuffer.requiresNewBuffer(gl, srcWidth, srcHeight, readPixelSize) ) {
+ throw new IndexOutOfBoundsException("Required " + readPixelSize + " bytes of buffer, only had " + tileBuffer);
+ }
+ gl.glReadPixels( srcX, srcY, srcWidth, srcHeight, pixelAttribs.format, pixelAttribs.type, tileBuffer.buffer);
+ // be sure OpenGL rendering is finished
+ gl.glFlush();
+ tileBuffer.position( readPixelSize );
+ tileBuffer.flip();
+ }
+
+ if( imageBuffer != null ) {
+ final GLPixelAttributes pixelAttribs = imageBuffer.pixelAttributes;
+ final int srcX = 0;
+ final int srcY = 0;
+ final int srcWidth = currentTileWidth;
+ final int srcHeight = currentTileHeight;
+
+ /* setup pixel store for glReadPixels */
+ final int rowLength = imageSize.getWidth();
+ 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 ibPos = ( currentTileXPos + ( currentTileYPos * rowLength ) ) * pixelAttribs.bytesPerPixel; // skipPixels + skipRows
+ final int ibLim = ibPos + readPixelSize;
+ imageBuffer.clear();
+ if( imageBuffer.requiresNewBuffer(gl, srcWidth, srcHeight, readPixelSize) ) {
+ throw new IndexOutOfBoundsException("Required " + ibLim + " bytes of buffer, only had " + imageBuffer);
+ }
+ imageBuffer.position(ibPos);
+
+ gl.glReadPixels( srcX, srcY, srcWidth, srcHeight, pixelAttribs.format, pixelAttribs.type, imageBuffer.buffer);
+ // be sure OpenGL rendering is finished
+ gl.glFlush();
+ imageBuffer.position( ibLim );
+ imageBuffer.flip();
+ }
+
+ /* restore previous glPixelStore values */
+ psm.restore(gl);
+
+ beginCalled = false;
+ }
+
+ /**
+ * Rendering one tile, by simply calling {@link GLAutoDrawable#display()}.
+ *
+ * @throws IllegalStateException if no {@link GLAutoDrawable} is {@link #attachAutoDrawable(GLAutoDrawable) attached}
+ * or imageSize is not set
+ */
+ public void display(int tX, int tY, int tWidth, int tHeight) throws IllegalStateException {
+ setTileRect(tX, tY, tWidth, tHeight);
+ display();
+ }
+}
\ No newline at end of file
diff --git a/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java b/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java
index b949f0e..47d56bc 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. 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
@@ -28,7 +28,7 @@
* 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.
@@ -46,7 +46,7 @@ import java.nio.channels.*;
* class; can also be used in conjunction with the {@link com.jogamp.opengl.util.gl2.TileRenderer} class.
*/
public class TGAWriter {
-
+
private static final int TARGA_HEADER_SIZE = 18;
private FileChannel ch;
@@ -91,7 +91,7 @@ public class TGAWriter {
image.put(14, (byte) (height & 0xFF)); // height
image.put(15, (byte) (height >> 8)); // height
image.put(16, (byte) pixelSize); // pixel size
-
+
// go to image data position
image.position(TARGA_HEADER_SIZE);
// jogl needs a sliced buffer
diff --git a/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java
new file mode 100644
index 0000000..7f86b14
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java
@@ -0,0 +1,537 @@
+/**
+ * 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.
+ *
+ * ---------------------
+ *
+ * Based on Brian Paul's tile rendering library, found
+ * at <a href = "http://www.mesa3d.org/brianp/TR.html">http://www.mesa3d.org/brianp/TR.html</a>.
+ *
+ * Copyright (C) 1997-2005 Brian Paul.
+ * Licensed under BSD-compatible terms with permission of the author.
+ * See LICENSE.txt for license information.
+ */
+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.opengl.util.GLPixelBuffer.GLPixelAttributes;
+
+/**
+ * A fairly direct port of Brian Paul's tile rendering library, found
+ * at <a href = "http://www.mesa3d.org/brianp/TR.html">
+ * http://www.mesa3d.org/brianp/TR.html </a> . I've java-fied it, but
+ * the functionality is the same.
+ * <p>
+ * Original code Copyright (C) 1997-2005 Brian Paul. Licensed under
+ * BSD-compatible terms with permission of the author. See LICENSE.txt
+ * for license information.
+ * </p>
+ * <p>
+ * Enhanced for {@link GL2ES3}.
+ * </p>
+ * <p>
+ * See {@link TileRendererBase} for details.
+ * </p>
+ *
+ * @author ryanm, sgothel
+ */
+public class TileRenderer extends TileRendererBase {
+ /**
+ * The width of the final clipped image. See {@link #getParam(int)}.
+ */
+ public static final int TR_IMAGE_CLIPPING_WIDTH = 7;
+ /**
+ * The height of the final clipped image. See {@link #getParam(int)}.
+ */
+ public static final int TR_IMAGE_CLIPPING_HEIGHT = 8;
+ /**
+ * The width of the tiles. See {@link #getParam(int)}.
+ */
+ public static final int TR_TILE_WIDTH = 9;
+ /**
+ * The height of the tiles. See {@link #getParam(int)}.
+ */
+ public static final int TR_TILE_HEIGHT = 10;
+ /**
+ * The width of the border around the tiles. See {@link #getParam(int)}.
+ */
+ public static final int TR_TILE_BORDER = 11;
+ /**
+ * The tiles x-offset. See {@link #getParam(int)}.
+ */
+ public static final int TR_TILE_X_OFFSET = 12;
+ /**
+ * The tiles y-offset. See {@link #getParam(int)}.
+ */
+ public static final int TR_TILE_Y_OFFSET = 13;
+ /**
+ * The number of rows of tiles. See {@link #getParam(int)}.
+ */
+ public static final int TR_ROWS = 14;
+ /**
+ * The number of columns of tiles. See {@link #getParam(int)}.
+ */
+ public static final int TR_COLUMNS = 15;
+ /**
+ * The current tile number. Has value -1 if {@link #eot()}. See {@link #getParam(int)}.
+ */
+ public static final int TR_CURRENT_TILE_NUM = 16;
+ /**
+ * The current row number. See {@link #getParam(int)}.
+ */
+ public static final int TR_CURRENT_ROW = 17;
+ /**
+ * The current column number. See {@link #getParam(int)}.
+ */
+ public static final int TR_CURRENT_COLUMN = 18;
+ /**
+ * The order that the rows are traversed. See {@link #getParam(int)}.
+ */
+ public static final int TR_ROW_ORDER = 19;
+ /**
+ * Indicates we are traversing rows from the top to the bottom. See {@link #getParam(int)}.
+ */
+ public static final int TR_TOP_TO_BOTTOM = 20;
+ /**
+ * Indicates we are traversing rows from the bottom to the top (default). See {@link #getParam(int)}.
+ */
+ public static final int TR_BOTTOM_TO_TOP = 21;
+
+ private static final int DEFAULT_TILE_WIDTH = 256;
+ private static final int DEFAULT_TILE_HEIGHT = 256;
+ private static final int DEFAULT_TILE_BORDER = 0;
+
+ private final Dimension tileSize = new Dimension(DEFAULT_TILE_WIDTH, DEFAULT_TILE_HEIGHT);
+ private final Dimension tileSizeNB = new Dimension(DEFAULT_TILE_WIDTH - 2 * DEFAULT_TILE_BORDER, DEFAULT_TILE_HEIGHT - 2 * DEFAULT_TILE_BORDER);
+
+ private boolean isInit = false;
+ private Dimension imageClippingDim = null; // not set - default
+ private int tileBorder = DEFAULT_TILE_BORDER;
+ private int rowOrder = TR_BOTTOM_TO_TOP;
+ private int rows;
+ private int columns;
+ private int currentTile = 0;
+ private int currentRow;
+ private int currentColumn;
+ private int offsetX;
+ private int offsetY;
+
+ @Override
+ protected StringBuilder tileDetails(StringBuilder sb) {
+ sb.append("# "+currentTile+": ["+currentColumn+"]["+currentRow+"] / "+columns+"x"+rows+", ")
+ .append("rowOrder "+rowOrder+", offset/size "+offsetX+"/"+offsetY+" "+tileSize.getWidth()+"x"+tileSize.getHeight()+" brd "+tileBorder+", ");
+ return super.tileDetails(sb);
+ }
+
+ /**
+ * Creates a new TileRenderer object
+ */
+ public TileRenderer() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Implementation {@link #reset()} internal states.
+ * </p>
+ */
+ @Override
+ public final void setImageSize(int width, int height) {
+ super.setImageSize(width, height);
+ reset();
+ }
+
+ /**
+ * Clips the image-size this tile-renderer iterates through,
+ * which can be retrieved via {@link #getClippedImageSize()}.
+ * <p>
+ * Original image-size stored in this tile-renderer is unmodified.
+ * </p>
+ * <p>
+ * Implementation {@link #reset()} internal states.
+ * </p>
+ *
+ * @param width The image-clipping.width
+ * @param height The image-clipping.height
+ * @see #getClippedImageSize()
+ */
+ public final void clipImageSize(int width, int height) {
+ if( null == imageClippingDim ) {
+ imageClippingDim = new Dimension(width, height);
+ } else {
+ imageClippingDim.set(width, height);
+ }
+ reset();
+ }
+
+ /**
+ * Returns the clipped image-size.
+ * <p>
+ * If a image-size is clipped via {@link #clipImageSize(int, int)},
+ * method returns:
+ * <ul>
+ * <li><code>min( image-clipping, image-size )</code>, otherwise</li>
+ * <li><code> image-size </code></li>
+ * </ul>
+ * </p>
+ * <p>
+ * The clipping width and height can be retrieved via {@link #TR_IMAGE_CLIPPING_WIDTH}
+ * {@link #TR_IMAGE_CLIPPING_HEIGHT}.
+ * </p>
+ */
+ public final DimensionImmutable getClippedImageSize() {
+ if( null != imageClippingDim ) {
+ return new Dimension(Math.min(imageClippingDim.getWidth(), imageSize.getWidth()),
+ Math.min(imageClippingDim.getHeight(), imageSize.getHeight()) );
+ } else {
+ return imageSize;
+ }
+ }
+
+ /**
+ * Sets the size of the tiles to use in rendering. The actual
+ * effective size of the tile depends on the border size, ie (
+ * width - 2*border ) * ( height - 2 * border )
+ * <p>
+ * Implementation {@link #reset()} internal states.
+ * </p>
+ *
+ * @param width
+ * The width of the tiles. Must not be larger than the GL
+ * context
+ * @param height
+ * The height of the tiles. Must not be larger than the
+ * GL context
+ * @param border
+ * The width of the borders on each tile. This is needed
+ * to avoid artifacts when rendering lines or points with
+ * thickness > 1.
+ */
+ public final void setTileSize(int width, int height, int border) {
+ if( 0 > border ) {
+ throw new IllegalArgumentException("Tile border must be >= 0");
+ }
+ if( 2 * border >= width || 2 * border >= height ) {
+ throw new IllegalArgumentException("Tile size must be > 0x0 minus 2*border");
+ }
+ tileBorder = border;
+ tileSize.set( width, height );
+ tileSizeNB.set( width - 2 * border, height - 2 * border );
+ reset();
+ }
+
+ /**
+ * Sets an xy offset for the resulting tiles
+ * {@link TileRendererBase#TR_CURRENT_TILE_X_POS x-pos} and {@link TileRendererBase#TR_CURRENT_TILE_Y_POS y-pos}.
+ * @see #TR_TILE_X_OFFSET
+ * @see #TR_TILE_Y_OFFSET
+ **/
+ public void setTileOffset(int xoff, int yoff) {
+ offsetX = xoff;
+ offsetY = yoff;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Reset internal states of {@link TileRenderer} are:
+ * <ul>
+ * <li>{@link #TR_ROWS}</li>
+ * <li>{@link #TR_COLUMNS}</li>
+ * <li>{@link #TR_CURRENT_COLUMN}</li>
+ * <li>{@link #TR_CURRENT_ROW}</li>
+ * <li>{@link #TR_CURRENT_TILE_NUM}</li>
+ * <li>{@link #TR_CURRENT_TILE_X_POS}</li>
+ * <li>{@link #TR_CURRENT_TILE_Y_POS}</li>
+ * <li>{@link #TR_CURRENT_TILE_WIDTH}</li>
+ * <li>{@link #TR_CURRENT_TILE_HEIGHT}</li>
+ *</ul>
+ */
+ @Override
+ public final void reset() {
+ final DimensionImmutable clippedImageSize = getClippedImageSize();
+ columns = ( clippedImageSize.getWidth() + tileSizeNB.getWidth() - 1 ) / tileSizeNB.getWidth();
+ rows = ( clippedImageSize.getHeight() + tileSizeNB.getHeight() - 1 ) / tileSizeNB.getHeight();
+ currentRow = 0;
+ currentColumn = 0;
+ currentTile = 0;
+ currentTileXPos = 0;
+ currentTileYPos = 0;
+ currentTileWidth = 0;
+ currentTileHeight = 0;
+
+ assert columns >= 0;
+ assert rows >= 0;
+
+ beginCalled = false;
+ isInit = true;
+ }
+
+ /* pp */ final int getCurrentTile() { return currentTile; }
+
+ @Override
+ public final int getParam(int pname) {
+ switch (pname) {
+ case TR_IMAGE_WIDTH:
+ return imageSize.getWidth();
+ case TR_IMAGE_HEIGHT:
+ return imageSize.getHeight();
+ case TR_CURRENT_TILE_X_POS:
+ return currentTileXPos;
+ case TR_CURRENT_TILE_Y_POS:
+ return currentTileYPos;
+ case TR_CURRENT_TILE_WIDTH:
+ return currentTileWidth;
+ case TR_CURRENT_TILE_HEIGHT:
+ return currentTileHeight;
+ case TR_IMAGE_CLIPPING_WIDTH:
+ return null != imageClippingDim ? imageClippingDim.getWidth() : 0;
+ case TR_IMAGE_CLIPPING_HEIGHT:
+ return null != imageClippingDim ? imageClippingDim.getHeight() : 0;
+ case TR_TILE_WIDTH:
+ return tileSize.getWidth();
+ case TR_TILE_HEIGHT:
+ return tileSize.getHeight();
+ case TR_TILE_BORDER:
+ return tileBorder;
+ case TR_TILE_X_OFFSET:
+ return offsetX;
+ case TR_TILE_Y_OFFSET:
+ return offsetY;
+ case TR_ROWS:
+ return rows;
+ case TR_COLUMNS:
+ return columns;
+ case TR_CURRENT_TILE_NUM:
+ return currentTile;
+ case TR_CURRENT_ROW:
+ return currentRow;
+ case TR_CURRENT_COLUMN:
+ return currentColumn;
+ case TR_ROW_ORDER:
+ return rowOrder;
+ default:
+ throw new IllegalArgumentException("Invalid pname: "+pname);
+ }
+ }
+
+ /**
+ * Sets the order of row traversal, default is {@link #TR_BOTTOM_TO_TOP}.
+ *
+ * @param order The row traversal order, must be either {@link #TR_TOP_TO_BOTTOM} or {@link #TR_BOTTOM_TO_TOP}.
+ */
+ public final void setRowOrder(int order) {
+ if (order == TR_TOP_TO_BOTTOM || order == TR_BOTTOM_TO_TOP) {
+ rowOrder = order;
+ } else {
+ throw new IllegalArgumentException("Must pass TR_TOP_TO_BOTTOM or TR_BOTTOM_TO_TOP");
+ }
+ }
+
+ @Override
+ public final boolean isSetup() {
+ return 0 < imageSize.getWidth() && 0 < imageSize.getHeight();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>
+ * <i>end of tiling</i> is reached w/ {@link TileRenderer}, if at least one of the following is true:
+ * <ul>
+ * <li>all tiles have been rendered, i.e. {@link #TR_CURRENT_TILE_NUM} is -1</li>
+ * <li>no tiles to render, i.e. {@link #TR_COLUMNS} or {@link #TR_ROWS} is 0</li>
+ * </ul>
+ * </p>
+ */
+ @Override
+ public final boolean eot() {
+ if ( !isInit ) { // ensure at least one reset-call
+ reset();
+ }
+ return 0 > currentTile || 0 >= columns*rows;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @throws IllegalStateException if {@link #setImageSize(int, int) image-size} has not been set or
+ * {@link #eot() end-of-tiling} has been reached.
+ */
+ @Override
+ public final void beginTile( GL gl ) throws IllegalStateException, GLException {
+ if( !isSetup() ) {
+ throw new IllegalStateException("Image size has not been set: "+this);
+ }
+ if ( eot() ) {
+ throw new IllegalStateException("EOT reached: "+this);
+ }
+ validateGL(gl);
+
+ /* which tile (by row and column) we're about to render */
+ if (rowOrder == TR_BOTTOM_TO_TOP) {
+ currentRow = currentTile / columns;
+ currentColumn = currentTile % columns;
+ } else {
+ currentRow = rows - ( currentTile / columns ) - 1;
+ currentColumn = currentTile % columns;
+ }
+ assert ( currentRow < rows );
+ assert ( currentColumn < columns );
+
+ int border = tileBorder;
+
+ final DimensionImmutable clippedImageSize = getClippedImageSize();
+ int tH, tW;
+
+ /* Compute actual size of this tile with border */
+ if (currentRow < rows - 1) {
+ tH = tileSize.getHeight();
+ } else {
+ tH = clippedImageSize.getHeight() - ( rows - 1 ) * ( tileSizeNB.getHeight() ) + 2 * border;
+ }
+
+ if (currentColumn < columns - 1) {
+ tW = tileSize.getWidth();
+ } else {
+ tW = clippedImageSize.getWidth() - ( columns - 1 ) * ( tileSizeNB.getWidth() ) + 2 * border;
+ }
+
+ currentTileXPos = currentColumn * tileSizeNB.getWidth() + offsetX;
+ currentTileYPos = currentRow * tileSizeNB.getHeight() + offsetY;
+
+ /* Save tile size, with border */
+ currentTileWidth = tW;
+ currentTileHeight = tH;
+
+ gl.glViewport( 0, 0, tW, tH );
+
+ if( DEBUG ) {
+ System.err.println("TileRenderer.begin: "+this.toString());
+ }
+
+ // Do not forget to issue:
+ // reshape( 0, 0, tW, tH );
+ // which shall reflect tile renderer tiles: currentTileXPos, currentTileYPos and imageSize
+ beginCalled = true;
+ }
+
+ @Override
+ public void endTile( GL gl ) throws IllegalStateException, GLException {
+ if( !beginCalled ) {
+ throw new IllegalStateException("beginTile(..) has not been called");
+ }
+ validateGL(gl);
+
+ // be sure OpenGL rendering is finished
+ gl.glFlush();
+
+ // save current glPixelStore values
+ psm.save(gl);
+ psm.setPackAlignment(gl, 1);
+ final GL2ES3 gl2es3;
+ final int readBuffer;
+ if( gl.isGL2ES3() ) {
+ gl2es3 = gl.getGL2ES3();
+ readBuffer = gl2es3.getDefaultReadBuffer();
+ gl2es3.glReadBuffer(readBuffer);
+ } else {
+ gl2es3 = null;
+ readBuffer = 0; // undef. probably default: GL_FRONT (single buffering) GL_BACK (double buffering)
+ }
+ if( DEBUG ) {
+ System.err.println("TileRenderer.end.0: readBuffer 0x"+Integer.toHexString(readBuffer)+", "+this.toString());
+ }
+
+ final int tmp[] = new int[1];
+
+ if( tileBuffer != null ) {
+ final GLPixelAttributes pixelAttribs = tileBuffer.pixelAttributes;
+ final int srcX = tileBorder;
+ 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);
+ tileBuffer.clear();
+ if( tileBuffer.requiresNewBuffer(gl, srcWidth, srcHeight, readPixelSize) ) {
+ throw new IndexOutOfBoundsException("Required " + readPixelSize + " bytes of buffer, only had " + tileBuffer);
+ }
+ gl.glReadPixels( srcX, srcY, srcWidth, srcHeight, pixelAttribs.format, pixelAttribs.type, tileBuffer.buffer);
+ // be sure OpenGL rendering is finished
+ gl.glFlush();
+ tileBuffer.position( readPixelSize );
+ tileBuffer.flip();
+ }
+
+ if( imageBuffer != null ) {
+ final GLPixelAttributes pixelAttribs = imageBuffer.pixelAttributes;
+ final int srcX = tileBorder;
+ final int srcY = tileBorder;
+ final int srcWidth = currentTileWidth - 2 * tileBorder;
+ final int srcHeight = currentTileHeight - 2 * tileBorder;
+
+ /* setup pixel store for glReadPixels */
+ final int rowLength = imageSize.getWidth();
+ 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 skipPixels = currentColumn * tileSizeNB.getWidth();
+ final int skipRows = currentRow * tileSizeNB.getHeight();
+ final int ibPos = ( skipPixels + ( skipRows * rowLength ) ) * pixelAttribs.bytesPerPixel;
+ final int ibLim = ibPos + readPixelSize;
+ imageBuffer.clear();
+ if( imageBuffer.requiresNewBuffer(gl, srcWidth, srcHeight, readPixelSize) ) {
+ throw new IndexOutOfBoundsException("Required " + ibLim + " bytes of buffer, only had " + imageBuffer);
+ }
+ imageBuffer.position(ibPos);
+
+ gl.glReadPixels( srcX, srcY, srcWidth, srcHeight, pixelAttribs.format, pixelAttribs.type, imageBuffer.buffer);
+ // be sure OpenGL rendering is finished
+ gl.glFlush();
+ imageBuffer.position( ibLim );
+ imageBuffer.flip();
+ }
+
+ /* restore previous glPixelStore values */
+ psm.restore(gl);
+
+ beginCalled = false;
+
+ /* increment tile counter, return 1 if more tiles left to render */
+ currentTile++;
+ if( currentTile >= rows * columns ) {
+ currentTile = -1; /* all done */
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java b/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java
new file mode 100644
index 0000000..2ac4b1f
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java
@@ -0,0 +1,676 @@
+/**
+ * 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.
+ *
+ * ---------------------
+ *
+ * Based on Brian Paul's tile rendering library, found
+ * at <a href = "http://www.mesa3d.org/brianp/TR.html">http://www.mesa3d.org/brianp/TR.html</a>.
+ *
+ * Copyright (C) 1997-2005 Brian Paul.
+ * Licensed under BSD-compatible terms with permission of the author.
+ * See LICENSE.txt for license information.
+ */
+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 javax.media.opengl.GLFBODrawable;
+import jogamp.opengl.Debug;
+
+/**
+ * A fairly direct port of Brian Paul's tile rendering library, found
+ * at <a href = "http://www.mesa3d.org/brianp/TR.html">
+ * http://www.mesa3d.org/brianp/TR.html </a> . I've java-fied it, but
+ * the functionality is the same.
+ * <p>
+ * Original code Copyright (C) 1997-2005 Brian Paul. Licensed under
+ * BSD-compatible terms with permission of the author. See LICENSE.txt
+ * for license information.
+ * </p>
+ * <p>
+ * Enhanced for {@link GL} and {@link GL2ES3}, abstracted to suit {@link TileRenderer} and {@link RandomTileRenderer}.
+ * </p>
+ * <a name="pmvmatrix"><h5>PMV Matrix Considerations</h5></a>
+ * <p>
+ * The PMV matrix needs to be reshaped in user code
+ * after calling {@link #beginTile(GL)}, See {@link #beginTile(GL)}.
+ * </p>
+ * <p>
+ * If {@link #attachAutoDrawable(GLAutoDrawable) attaching to} an {@link GLAutoDrawable},
+ * the {@link TileRendererListener#reshapeTile(TileRendererBase, int, int, int, int, int, int)} method
+ * is being called after {@link #beginTile(GL)} for each rendered tile.
+ * It's implementation shall reshape the PMV matrix according to {@link #beginTile(GL)}.
+ * </p>
+ * <a name="glprequirement"><h5>GL Profile Requirement</h5></a>
+ * <p>
+ * Note that {@link #setImageBuffer(GLPixelBuffer) image buffer} can only be used
+ * in conjunction w/ a {@link GL} instance ≥ {@link GL2ES3} passed to {@link #beginTile(GL)} and {@link #endTile(GL)}.<br>
+ * This is due to setting up the {@link GL2ES3#GL_PACK_ROW_LENGTH pack row length}
+ * for an {@link #setImageSize(int, int) image width} != tile-width, which usually is the case.<br>
+ * Hence a {@link GLException} is thrown in both methods,
+ * if using an {@link #setImageBuffer(GLPixelBuffer) image buffer}
+ * and passing a {@link GL} instance < {@link GL2ES3}.
+ * </p>
+ * <p>
+ * Further more, reading back of MSAA buffers is only supported since {@link GL2ES3}
+ * since it requires to set the {@link GL2ES3#glReadBuffer(int) read-buffer}.
+ * </p>
+ *
+ * @author ryanm, sgothel
+ */
+public abstract class TileRendererBase {
+ /**
+ * The width of the final image. See {@link #getParam(int)}.
+ */
+ public static final int TR_IMAGE_WIDTH = 1;
+ /**
+ * The height of the final image. See {@link #getParam(int)}.
+ */
+ public static final int TR_IMAGE_HEIGHT = 2;
+ /**
+ * The x-pos of the current tile. See {@link #getParam(int)}.
+ */
+ public static final int TR_CURRENT_TILE_X_POS = 3;
+ /**
+ * The y-pos of the current tile. See {@link #getParam(int)}.
+ */
+ public static final int TR_CURRENT_TILE_Y_POS = 4;
+ /**
+ * The width of the current tile. See {@link #getParam(int)}.
+ */
+ public static final int TR_CURRENT_TILE_WIDTH = 5;
+ /**
+ * The height of the current tile. See {@link #getParam(int)}.
+ */
+ public static final int TR_CURRENT_TILE_HEIGHT = 6;
+
+ /* pp */ static final boolean DEBUG = Debug.debug("TileRenderer");
+
+ /**
+ * Listener for tile renderer events, intended to extend {@link GLEventListener} implementations,
+ * enabling tile rendering via {@link TileRendererBase#attachAutoDrawable(GLAutoDrawable)}.
+ */
+ public static interface TileRendererListener {
+ /**
+ * The owning {@link GLAutoDrawable} is {@link TileRendererBase#attachAutoDrawable(GLAutoDrawable) attached}
+ * to the given {@link TileRendererBase} instance.
+ * <p>
+ * The {@link GLContext} of the {@link TileRendererBase}'s {@link TileRendererBase#getAttachedDrawable() attached} {@link GLAutoDrawable}
+ * <i>is not</i> current.
+ * </p>
+ * @param tr the associated {@link TileRendererBase}
+ * @see TileRendererBase#getAttachedDrawable()
+ */
+ public void addTileRendererNotify(TileRendererBase tr);
+
+ /**
+ * The owning {@link GLAutoDrawable} is {@link TileRendererBase#detachAutoDrawable() detached}
+ * from the given {@link TileRendererBase} instance.
+ * <p>
+ * The {@link GLContext} of the {@link TileRendererBase}'s {@link TileRendererBase#getAttachedDrawable() attached} {@link GLAutoDrawable}
+ * <i>is not</i> current.
+ * </p>
+ * @param tr the disassociated {@link TileRendererBase}
+ * @see TileRendererBase#getAttachedDrawable()
+ */
+ public void removeTileRendererNotify(TileRendererBase tr);
+
+ /**
+ * Called by the {@link TileRendererBase} during tile-rendering via an
+ * {@link TileRendererBase#getAttachedDrawable() attached} {@link GLAutoDrawable}'s
+ * {@link GLAutoDrawable#display()} call for each tile before {@link #display(GLAutoDrawable)}.
+ * <p>
+ * The <a href="#pmvmatrix">PMV Matrix</a> shall be reshaped
+ * according to the given
+ * <ul>
+ * <li>current tile-position</li>
+ * <li>current tile-size</li>
+ * <li>final image-size</li>
+ * </ul>
+ * The GL viewport is already set to origin 0/0 and the current tile-size.<br>
+ * See details in {@link TileRendererBase#beginTile(GL)}.<br>
+ * </p>
+ * <p>
+ * The {@link GLContext} of the {@link TileRendererBase}'s {@link TileRendererBase#getAttachedDrawable() attached} {@link GLAutoDrawable}
+ * <i>is</i> current.
+ * </p>
+ * @param tr the issuing {@link TileRendererBase}
+ * @param tileX the {@link TileRendererBase#TR_CURRENT_TILE_X_POS current tile's x-pos}
+ * @param tileY the {@link TileRendererBase#TR_CURRENT_TILE_Y_POS current tile's y-pos}
+ * @param tileWidth the {@link TileRendererBase#TR_CURRENT_TILE_WIDTH current tile's width}
+ * @param tileHeight the {@link TileRendererBase#TR_CURRENT_TILE_HEIGHT current tile's height}
+ * @param imageWidth the {@link TileRendererBase#TR_IMAGE_WIDTH final image width}
+ * @param imageHeight the {@link TileRendererBase#TR_IMAGE_HEIGHT final image height}
+ * @see TileRendererBase#getAttachedDrawable()
+ */
+ public void reshapeTile(TileRendererBase tr,
+ int tileX, int tileY, int tileWidth, int tileHeight,
+ int imageWidth, int imageHeight);
+
+ /**
+ * Called by the {@link TileRendererBase} during tile-rendering
+ * after {@link TileRendererBase#beginTile(GL)} and before {@link #reshapeTile(TileRendererBase, int, int, int, int, int, int) reshapeTile(..)}.
+ * <p>
+ * If {@link TileRendererBase} is of type {@link TileRenderer},
+ * method is called for the first tile of all tiles.<br>
+ * Otherwise, i.e. {@link RandomTileRenderer}, method is called for each particular tile.
+ * </p>
+ * <p>
+ * The {@link GLContext} of the {@link TileRenderer}'s {@link TileRenderer#getAttachedDrawable() attached} {@link GLAutoDrawable}
+ * <i>is</i> current.
+ * </p>
+ * @param tr the issuing {@link TileRendererBase}
+ */
+ public void startTileRendering(TileRendererBase tr);
+
+ /**
+ * Called by the {@link TileRenderer} during tile-rendering
+ * after {@link TileRendererBase#endTile(GL)} and {@link GLAutoDrawable#swapBuffers()}.
+ * <p>
+ * If {@link TileRendererBase} is of type {@link TileRenderer},
+ * method is called for the last tile of all tiles.<br>
+ * Otherwise, i.e. {@link RandomTileRenderer}, method is called for each particular tile.
+ * </p>
+ * <p>
+ * The {@link GLContext} of the {@link TileRenderer}'s {@link TileRenderer#getAttachedDrawable() attached} {@link GLAutoDrawable}
+ * <i>is</i> current.
+ * </p>
+ * @param tr the issuing {@link TileRendererBase}
+ */
+ public void endTileRendering(TileRendererBase tr);
+ }
+
+ protected final Dimension imageSize = new Dimension(0, 0);
+ protected final GLPixelStorageModes psm = new GLPixelStorageModes();
+ protected GLPixelBuffer imageBuffer;
+ protected GLPixelBuffer tileBuffer;
+ protected boolean beginCalled = false;
+ protected int currentTileXPos;
+ protected int currentTileYPos;
+ protected int currentTileWidth;
+ protected int currentTileHeight;
+ protected GLAutoDrawable glad;
+ protected boolean gladRequiresPreSwap;
+ protected boolean gladAutoSwapBufferMode = true;
+ protected GLEventListener[] listeners;
+ protected boolean[] listenersInit;
+ protected GLEventListener glEventListenerPre = null;
+ protected GLEventListener glEventListenerPost = null;
+
+ private final String hashStr(Object o) {
+ final int h = null != o ? o.hashCode() : 0;
+ return "0x"+Integer.toHexString(h);
+ }
+ protected StringBuilder tileDetails(StringBuilder sb) {
+ return sb.append("cur "+currentTileXPos+"/"+currentTileYPos+" "+currentTileWidth+"x"+currentTileHeight+", buffer "+hashStr(tileBuffer));
+ }
+ public StringBuilder toString(StringBuilder sb) {
+ final int gladListenerCount = null != listeners ? listeners.length : 0;
+ sb.append("tile[");
+ tileDetails(sb);
+ sb.append("], image[size "+imageSize+", buffer "+hashStr(imageBuffer)+"], glad["+
+ gladListenerCount+" listener, pre "+(null!=glEventListenerPre)+", post "+(null!=glEventListenerPost)+", preSwap "+gladRequiresPreSwap+"]");
+ sb.append(", isSetup "+isSetup());
+ return sb;
+ }
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ return getClass().getSimpleName()+
+ "["+toString(sb).toString()+"]";
+ }
+
+ protected TileRendererBase() {
+ }
+
+ /**
+ * Gets the parameters of this TileRenderer object
+ *
+ * @param pname The parameter name that is to be retrieved
+ * @return the value of the parameter
+ * @throws IllegalArgumentException if <code>pname</code> is not handled
+ */
+ public abstract int getParam(int pname) throws IllegalArgumentException;
+
+ /**
+ * Specify a buffer the tiles to be copied to. This is not
+ * necessary for the creation of the final image, but useful if you
+ * want to inspect each tile in turn.
+ *
+ * @param buffer The buffer itself. Must be large enough to contain a random tile
+ */
+ public final void setTileBuffer(GLPixelBuffer buffer) {
+ tileBuffer = buffer;
+ if( DEBUG ) {
+ System.err.println("TileRenderer: tile-buffer "+tileBuffer);
+ }
+ }
+
+ /** @see #setTileBuffer(GLPixelBuffer) */
+ public final GLPixelBuffer getTileBuffer() { return tileBuffer; }
+
+ /**
+ * Sets the desired size of the final image
+ *
+ * @param width The width of the final image
+ * @param height The height of the final image
+ */
+ public void setImageSize(int width, int height) {
+ imageSize.set(width, height);
+ }
+
+ /** @see #setImageSize(int, int) */
+ public final DimensionImmutable getImageSize() { return imageSize; }
+
+ /**
+ * Sets the buffer in which to store the final image
+ *
+ * @param buffer the buffer itself, must be large enough to hold the final image
+ */
+ public final void setImageBuffer(GLPixelBuffer buffer) {
+ imageBuffer = buffer;
+ if( DEBUG ) {
+ System.err.println("TileRenderer: image-buffer "+imageBuffer);
+ }
+ }
+
+ /** @see #setImageBuffer(GLPixelBuffer) */
+ public final GLPixelBuffer getImageBuffer() { return imageBuffer; }
+
+ /* pp */ final void validateGL(GL gl) throws GLException {
+ if( imageBuffer != null && !gl.isGL2ES3()) {
+ throw new GLException("Using image-buffer w/ inssufficient GL context: "+gl.getContext().getGLVersion()+", "+gl.getGLProfile());
+ }
+ }
+
+ /**
+ * Returns true if this instance is setup properly, i.e. {@link #setImageSize(int, int)} ..,
+ * and ready for {@link #beginTile(GL)}.
+ * Otherwise returns false.
+ */
+ public abstract boolean isSetup();
+
+ /**
+ * Returns true if <i>end of tiling</i> has been reached, otherwise false.
+ * <p>
+ * <i>end of tiling</i> criteria is implementation specific and may never be reached.
+ * </p>
+ * <p>
+ * User needs to {@link #reset()} tiling after reaching <i>end of tiling</i>
+ * before calling {@link #beginTile(GL)} again.
+ * </p>
+ */
+ public abstract boolean eot();
+
+ /**
+ * Method resets implementation's internal state to <i>start of tiling</i>
+ * as required for {@link #beginTile(GL)} if {@link #eot() end of tiling} has been reached.
+ * <p>
+ * Implementation is a <i>nop</i> where {@link #eot() end of tiling} is never reached.
+ * </p>
+ */
+ public abstract void reset();
+
+ /**
+ * Begins rendering a tile.
+ * <p>
+ * This method modifies the viewport, see below.
+ * User shall reset the viewport when finishing all tile rendering,
+ * i.e. after very last call of {@link #endTile(GL)}!
+ * </p>
+ * <p>
+ * The <a href="#pmvmatrix">PMV Matrix</a>
+ * must be reshaped after this call using:
+ * <ul>
+ * <li>Current Viewport
+ * <ul>
+ * <li>x 0</li>
+ * <li>y 0</li>
+ * <li>{@link #TR_CURRENT_TILE_WIDTH current tile's width}</li>
+ * <li>{@link #TR_CURRENT_TILE_HEIGHT current tile's height}</li>
+ * </ul></li>
+ * <li>{@link #TR_CURRENT_TILE_X_POS current tile's x-pos}</li>
+ * <li>{@link #TR_CURRENT_TILE_Y_POS current tile's y-pos}</li>
+ * <li>{@link #TR_IMAGE_WIDTH final image width}</li>
+ * <li>{@link #TR_IMAGE_HEIGHT final image height}</li>
+ * </ul>
+ * </p>
+ * <p>
+ * Use shall render the scene afterwards, concluded with a call to
+ * this renderer {@link #endTile(GL)}.
+ * </p>
+ * <p>
+ * User has to comply with the <a href="#glprequirement">GL profile requirement</a>.
+ * </p>
+ * <p>
+ * If {@link #eot() end of tiling} has been reached,
+ * user needs to {@link #reset()} tiling before calling this method.
+ * </p>
+ *
+ * @param gl The gl context
+ * @throws IllegalStateException if {@link #setImageSize(int, int) image-size} is undefined,
+ * an {@link #isSetup() implementation related setup} has not be performed
+ * or {@ link #eot()} has been reached. See implementing classes.
+ * @throws GLException if {@link #setImageBuffer(GLPixelBuffer) image buffer} is used but <code>gl</code> instance is < {@link GL2ES3}
+ * @see #isSetup()
+ * @see #eot()
+ * @see #reset()
+ */
+ public abstract void beginTile(GL gl) throws IllegalStateException, GLException;
+
+ /**
+ * Must be called after rendering the scene,
+ * see {@link #beginTile(GL)}.
+ * <p>
+ * Please consider {@link #reqPreSwapBuffers(GLCapabilitiesImmutable)} to determine
+ * whether you need to perform {@link GLDrawable#swapBuffers() swap-buffers} before or after
+ * calling this method!
+ * </p>
+ * <p>
+ * User has to comply with the <a href="#glprequirement">GL profile requirement</a>.
+ * </p>
+ *
+ * @param gl the gl context
+ * @throws IllegalStateException if beginTile(gl) has not been called
+ * @throws GLException if {@link #setImageBuffer(GLPixelBuffer) image buffer} is used but <code>gl</code> instance is < {@link GL2ES3}
+ */
+ public abstract void endTile( GL gl ) throws IllegalStateException, GLException;
+
+ /**
+ * Determines whether the chosen {@link GLCapabilitiesImmutable}
+ * requires a <i>pre-{@link GLDrawable#swapBuffers() swap-buffers}</i>
+ * before accessing the results, i.e. before {@link #endTile(GL)}.
+ * <p>
+ * Usually one uses the {@link GL#getDefaultReadBuffer() default-read-buffer}, i.e.
+ * {@link GL#GL_FRONT} for single-buffer and {@link GL#GL_BACK} for double-buffer {@link GLDrawable}s
+ * and {@link GL#GL_COLOR_ATTACHMENT0} for offscreen framebuffer objects.<br>
+ * Here {@link GLDrawable#swapBuffers() swap-buffers} shall happen <b>after</b> calling {@link #endTile(GL)}, the default.
+ * </p>
+ * <p>
+ * However, <i>multisampling</i> offscreen {@link GLFBODrawable}s
+ * utilize {@link GLDrawable#swapBuffers() swap-buffers} to <i>downsample</i>
+ * the multisamples into the readable sampling sink.
+ * In this case, we require a {@link GLDrawable#swapBuffers() swap-buffers} <b>before</b> calling {@link #endTile(GL)}.
+ * </p>
+ * @param chosenCaps the chosen {@link GLCapabilitiesImmutable}
+ * @return chosenCaps.isFBO() && chosenCaps.getSampleBuffers()
+ */
+ public final boolean reqPreSwapBuffers(GLCapabilitiesImmutable chosenCaps) {
+ return chosenCaps.isFBO() && chosenCaps.getSampleBuffers();
+ }
+
+ /**
+ * Attaches the given {@link GLAutoDrawable} to this tile renderer.
+ * <p>
+ * The {@link GLAutoDrawable}'s original {@link GLEventListener} are moved to this tile renderer.
+ * </p>
+ * <p>
+ * {@link GLEventListeners} not implementing {@link TileRendererListener} are ignored while tile rendering.
+ * </p>
+ * <p>
+ * The {@link GLAutoDrawable}'s {@link GLAutoDrawable#getAutoSwapBufferMode() auto-swap mode} is cached
+ * and set to <code>false</code>, since {@link GLAutoDrawable#swapBuffers() swapBuffers()} maybe issued before {@link #endTile(GL)},
+ * see {@link #reqPreSwapBuffers(GLCapabilitiesImmutable)}.
+ * </p>
+ * <p>
+ * This tile renderer's internal {@link GLEventListener} is then added to the attached {@link GLAutoDrawable}
+ * to handle the tile rendering, replacing the original {@link GLEventListener}.<br>
+ * It's {@link GLEventListener#display(GLAutoDrawable) display} implementations issues:
+ * <ul>
+ * <li>Optional {@link #setGLEventListener(GLEventListener, GLEventListener) pre-glel}.{@link GLEventListener#display(GLAutoDrawable) display(..)}</li>
+ * <li>{@link #beginTile(GL)}</li>
+ * <li>for all original {@link TileRendererListener}:
+ * <ul>
+ * <li>{@link TileRendererListener#reshapeTile(TileRendererBase, int, int, int, int, int, int) reshapeTile(tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight)}</li>
+ * <li>{@link GLEventListener#display(GLAutoDrawable) display(autoDrawable)}</li>
+ * </ul></li>
+ * <li>if ( {@link #reqPreSwapBuffers(GLCapabilitiesImmutable) pre-swap} ) { {@link GLAutoDrawable#swapBuffers() swapBuffers()} }</li>
+ * <li>{@link #endTile(GL)}</li>
+ * <li>if ( !{@link #reqPreSwapBuffers(GLCapabilitiesImmutable) pre-swap} ) { {@link GLAutoDrawable#swapBuffers() swapBuffers()} }</li>
+ * <li>Optional {@link #setGLEventListener(GLEventListener, GLEventListener) post-glel}.{@link GLEventListener#display(GLAutoDrawable) display(..)}</li>
+ * </ul>
+ * </p>
+ * <p>
+ * Consider using {@link #setGLEventListener(GLEventListener, GLEventListener)} to add pre- and post
+ * hooks to be performed on this renderer {@link GLEventListener}.<br>
+ * The pre-hook is able to allocate memory and setup parameters, since it's called before {@link #beginTile(GL)}.<br>
+ * The post-hook is able to use the rendering result and can even shutdown tile-rendering,
+ * since it's called after {@link #endTile(GL)}.
+ * </p>
+ * <p>
+ * Call {@link #detachAutoDrawable()} to remove the attached {@link GLAutoDrawable} from this tile renderer
+ * and to restore it's original {@link GLEventListener}.
+ * </p>
+ * @param glad the {@link GLAutoDrawable} to attach.
+ * @throws IllegalStateException if an {@link GLAutoDrawable} is already attached
+ * @see #getAttachedDrawable()
+ * @see #detachAutoDrawable()
+ */
+ public final void attachAutoDrawable(GLAutoDrawable glad) throws IllegalStateException {
+ if( null != this.glad ) {
+ throw new IllegalStateException("GLAutoDrawable already attached");
+ }
+ this.glad = glad;
+
+ final int aSz = glad.getGLEventListenerCount();
+ listeners = new GLEventListener[aSz];
+ listenersInit = new boolean[aSz];
+ for(int i=0; i<aSz; i++) {
+ final GLEventListener l = glad.getGLEventListener(0);
+ listenersInit[i] = glad.getGLEventListenerInitState(l);
+ listeners[i] = glad.removeGLEventListener( l );
+ final boolean trn;
+ if( listeners[i] instanceof TileRendererListener ) {
+ trn = true;
+ ((TileRendererListener)listeners[i]).addTileRendererNotify(this);
+ } else {
+ trn = false;
+ }
+ if( DEBUG ) {
+ System.err.println("TileRenderer.attach["+i+"]: isInit "+listenersInit[i]+", isTRN "+trn+", "+listeners[i].getClass().getName());
+ }
+ }
+ glad.addGLEventListener(tiledGLEL);
+ gladAutoSwapBufferMode = glad.getAutoSwapBufferMode();
+ gladRequiresPreSwap = this.reqPreSwapBuffers(glad.getChosenGLCapabilities());
+ glad.setAutoSwapBufferMode(false);
+ if( DEBUG ) {
+ System.err.println("TileRenderer: attached: "+glad);
+ System.err.println("TileRenderer: preSwap "+gladRequiresPreSwap+", "+glad.getChosenGLCapabilities()+", cached "+listeners.length+" listener");
+ }
+ }
+
+ /**
+ * Returns a previously {@link #attachAutoDrawable(GLAutoDrawable) attached} {@link GLAutoDrawable},
+ * <code>null</code> if none is attached.
+ * <p>
+ * If called from {@link TileRendererListener#addTileRendererNotify(TileRendererBase)}
+ * or {@link TileRendererListener#removeTileRendererNotify(TileRendererBase)}, method returns the
+ * just attached or soon to be detached {@link GLAutoDrawable}.
+ * </p>
+ * @see #attachAutoDrawable(GLAutoDrawable)
+ * @see #detachAutoDrawable()
+ */
+ public final GLAutoDrawable getAttachedDrawable() {
+ return glad;
+ }
+
+ /**
+ * Detaches the given {@link GLAutoDrawable} from this tile renderer.
+ * @see #attachAutoDrawable(GLAutoDrawable)
+ * @see #getAttachedDrawable()
+ */
+ public final void detachAutoDrawable() {
+ if( null != glad ) {
+ glad.removeGLEventListener(tiledGLEL);
+ final int aSz = listenersInit.length;
+ for(int i=0; i<aSz; i++) {
+ final GLEventListener l = listeners[i];
+ if( l instanceof TileRendererListener ) {
+ ((TileRendererListener)l).removeTileRendererNotify(this);
+ }
+ glad.addGLEventListener(l);
+ glad.setGLEventListenerInitState(l, listenersInit[i]);
+ }
+ glad.setAutoSwapBufferMode(gladAutoSwapBufferMode);
+ if( DEBUG ) {
+ System.err.println("TileRenderer: detached: "+glad);
+ System.err.println("TileRenderer: "+glad.getChosenGLCapabilities());
+ }
+
+ listeners = null;
+ listenersInit = null;
+ glad = null;
+ }
+ }
+
+ /**
+ * Set {@link GLEventListener} for pre- and post operations when used w/
+ * {@link #attachAutoDrawable(GLAutoDrawable)}
+ * for each {@link GLEventListener} callback.
+ * @param preTile the pre operations
+ * @param postTile the post operations
+ */
+ public final void setGLEventListener(GLEventListener preTile, GLEventListener postTile) {
+ glEventListenerPre = preTile;
+ glEventListenerPost = postTile;
+ }
+
+ /**
+ * Rendering one tile, by simply calling {@link GLAutoDrawable#display()}.
+ *
+ * @throws IllegalStateException if no {@link GLAutoDrawable} is {@link #attachAutoDrawable(GLAutoDrawable) attached}
+ * or imageSize is not set
+ */
+ public final void display() throws IllegalStateException {
+ if( null == glad ) {
+ throw new IllegalStateException("No GLAutoDrawable attached");
+ }
+ glad.display();
+ }
+
+ private final GLEventListener tiledGLEL = new GLEventListener() {
+ final TileRenderer tileRenderer = TileRendererBase.this instanceof TileRenderer ? (TileRenderer) TileRendererBase.this : null;
+
+ @Override
+ public void init(GLAutoDrawable drawable) {
+ if( null != glEventListenerPre ) {
+ glEventListenerPre.init(drawable);
+ }
+ final int aSz = listenersInit.length;
+ for(int i=0; i<aSz; i++) {
+ final GLEventListener l = listeners[i];
+ if( !listenersInit[i] && l instanceof TileRendererListener ) {
+ l.init(drawable);
+ listenersInit[i] = true;
+ }
+ }
+ if( null != glEventListenerPost ) {
+ glEventListenerPost.init(drawable);
+ }
+ }
+ @Override
+ public void dispose(GLAutoDrawable drawable) {
+ if( null != glEventListenerPre ) {
+ glEventListenerPre.dispose(drawable);
+ }
+ final int aSz = listenersInit.length;
+ for(int i=0; i<aSz; i++) { // dispose all GLEventListener, last chance!
+ listeners[i].dispose(drawable);
+ }
+ if( null != glEventListenerPost ) {
+ glEventListenerPost.dispose(drawable);
+ }
+ }
+ @Override
+ public void display(GLAutoDrawable drawable) {
+ if( null != glEventListenerPre ) {
+ glEventListenerPre.reshape(drawable, 0, 0, currentTileWidth, currentTileHeight);
+ glEventListenerPre.display(drawable);
+ }
+ if( !isSetup() ) {
+ if( DEBUG ) {
+ System.err.println("TileRenderer.glel.display: !setup: "+TileRendererBase.this);
+ }
+ return;
+ }
+ if( eot() ) {
+ if( DEBUG ) {
+ System.err.println("TileRenderer.glel.display: EOT: "+TileRendererBase.this);
+ }
+ return;
+ }
+ final GL gl = drawable.getGL();
+
+ beginTile(gl);
+
+ final int aSz = listenersInit.length;
+ for(int i=0; i<aSz; i++) {
+ final GLEventListener l = listeners[i];
+ if( l instanceof TileRendererListener ) {
+ final TileRendererListener tl = (TileRendererListener)l;
+ if( null == tileRenderer || 0 == tileRenderer.getCurrentTile() ) {
+ tl.startTileRendering(TileRendererBase.this);
+ }
+ tl.reshapeTile(TileRendererBase.this,
+ currentTileXPos, currentTileYPos, currentTileWidth, currentTileHeight,
+ imageSize.getWidth(), imageSize.getHeight());
+ l.display(drawable);
+ }
+ }
+
+ if( gladRequiresPreSwap ) {
+ glad.swapBuffers();
+ endTile(gl);
+ } else {
+ endTile(gl);
+ glad.swapBuffers();
+ }
+ if( null == tileRenderer || tileRenderer.eot() ) {
+ for(int i=0; i<aSz; i++) {
+ final GLEventListener l = listeners[i];
+ if( l instanceof TileRendererListener ) {
+ ((TileRendererListener)l).endTileRendering(TileRendererBase.this);
+ }
+ }
+ }
+ if( null != glEventListenerPost ) {
+ glEventListenerPost.reshape(drawable, 0, 0, currentTileWidth, currentTileHeight);
+ glEventListenerPost.display(drawable);
+ }
+ }
+ @Override
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { }
+ };
+}
\ No newline at end of file
diff --git a/src/jogl/classes/com/jogamp/opengl/util/TimeFrameI.java b/src/jogl/classes/com/jogamp/opengl/util/TimeFrameI.java
new file mode 100644
index 0000000..b29846d
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/util/TimeFrameI.java
@@ -0,0 +1,81 @@
+/**
+ * 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.
+ */
+package com.jogamp.opengl.util;
+
+/**
+ * Integer time frame in milliseconds, maybe specialized for texture/video, audio, .. animated content.
+ * <p>
+ * Type and value range has been chosen to suit embedded CPUs
+ * and characteristics of audio / video streaming and animations.
+ * Milliseconds of type integer with a maximum value of {@link Integer#MAX_VALUE}
+ * will allow tracking time up 2,147,483.647 seconds or
+ * 24 days 20 hours 31 minutes and 23 seconds.
+ * </p>
+ * <p>
+ * Milliseconds granularity is also more than enough to deal with A-V synchronization,
+ * where the threshold usually lies within 22ms.
+ * </p>
+ * <p>
+ * Milliseconds granularity for displaying video frames might seem inaccurate
+ * for each single frame, i.e. 60Hz != 16ms, however, accumulated values diminish
+ * this error and vertical sync is achieved by build-in V-Sync of the video drivers.
+ * </p>
+ */
+public class TimeFrameI {
+ /** Constant marking an invalid PTS, i.e. Integer.MIN_VALUE == 0x80000000 == {@value}. Sync w/ native code. */
+ public static final int INVALID_PTS = 0x80000000;
+
+ /** Constant marking the end of the stream PTS, i.e. Integer.MIN_VALUE - 1 == 0x7FFFFFFF == {@value}. Sync w/ native code. */
+ public static final int END_OF_STREAM_PTS = 0x7FFFFFFF;
+
+ protected int pts;
+ protected int duration;
+
+ public TimeFrameI() {
+ pts = INVALID_PTS;
+ duration = 0;
+ }
+ public TimeFrameI(int pts, int duration) {
+ this.pts = pts;
+ this.duration = duration;
+ }
+
+ /** Get this frame's presentation timestamp (PTS) in milliseconds. */
+ public final int getPTS() { return pts; }
+ /** Set this frame's presentation timestamp (PTS) in milliseconds. */
+ public final void setPTS(int pts) { this.pts = pts; }
+ /** Get this frame's duration in milliseconds. */
+ public final int getDuration() { return duration; }
+ /** Set this frame's duration in milliseconds. */
+ public final void setDuration(int duration) { this.duration = duration; }
+
+ @Override
+ public String toString() {
+ return "TimeFrame[pts " + pts + " ms, l " + duration + " ms]";
+ }
+}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java
index 5caeb96..b964245 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -29,28 +29,56 @@ package com.jogamp.opengl.util.av;
import java.nio.ByteBuffer;
+import com.jogamp.opengl.util.TimeFrameI;
+
import jogamp.opengl.Debug;
public interface AudioSink {
public static final boolean DEBUG = Debug.debug("AudioSink");
-
- /** Specifies the audio data type. Currently only PCM is supported. */
- public static enum AudioDataType { PCM };
-
+
+ /** Default frame duration in millisecond, i.e. 1 frame per {@value} ms. */
+ public static final int DefaultFrameDuration = 32;
+
+ /** Initial audio queue size in milliseconds. {@value} ms, i.e. 16 frames per 32 ms. See {@link #init(AudioFormat, float, int, int, int)}.*/
+ public static final int DefaultInitialQueueSize = 16 * 32; // 512 ms
+ /** Audio queue grow size in milliseconds. {@value} ms, i.e. 16 frames per 32 ms. See {@link #init(AudioFormat, float, int, int, int)}.*/
+ public static final int DefaultQueueGrowAmount = 16 * 32; // 512 ms
+ /** Audio queue limit w/ video in milliseconds. {@value} ms, i.e. 96 frames per 32 ms. See {@link #init(AudioFormat, float, int, int, int)}.*/
+ public static final int DefaultQueueLimitWithVideo = 96 * 32; // 3072 ms
+ /** Audio queue limit w/o video in milliseconds. {@value} ms, i.e. 32 frames per 32 ms. See {@link #init(AudioFormat, float, int, int, int)}.*/
+ public static final int DefaultQueueLimitAudioOnly = 32 * 32; // 1024 ms
+
/**
- * Specifies the audio data format.
+ * Specifies the linear audio PCM format.
*/
- public static class AudioDataFormat {
- public AudioDataFormat(AudioDataType dataType, int sampleRate, int sampleSize, int channelCount, boolean signed, boolean littleEndian) {
- this.dataType = dataType;
+ public static class AudioFormat {
+ /**
+ * @param sampleRate sample rate in Hz (1/s)
+ * @param sampleSize sample size in bits
+ * @param channelCount number of channels
+ * @param signed true if signed number, false for unsigned
+ * @param fixedP true for fixed point value, false for unsigned floating point value with a sampleSize of 32 (float) or 64 (double)
+ * @param planar true for planar data package (each channel in own data buffer), false for packed data channels interleaved in one buffer.
+ * @param littleEndian true for little-endian, false for big endian
+ */
+ public AudioFormat(int sampleRate, int sampleSize, int channelCount, boolean signed, boolean fixedP, boolean planar, boolean littleEndian) {
this.sampleRate = sampleRate;
this.sampleSize = sampleSize;
this.channelCount = channelCount;
this.signed = signed;
+ this.fixedP = fixedP;
+ this.planar = planar;
this.littleEndian = littleEndian;
+ if( !fixedP ) {
+ if( sampleSize != 32 && sampleSize != 64 ) {
+ throw new IllegalArgumentException("Floating point: sampleSize "+sampleSize+" bits");
+ }
+ if( !signed ) {
+ throw new IllegalArgumentException("Floating point: unsigned");
+ }
+ }
}
- /** Audio data type. */
- public final AudioDataType dataType;
+
/** Sample rate in Hz (1/s). */
public final int sampleRate;
/** Sample size in bits. */
@@ -58,111 +86,359 @@ public interface AudioSink {
/** Number of channels. */
public final int channelCount;
public final boolean signed;
+ /** Fixed or floating point values. Floating point 'float' has {@link #sampleSize} 32, 'double' has {@link #sampleSize} 64. */
+ public final boolean fixedP;
+ /** Planar or packed samples. If planar, each channel has their own data buffer. If packed, channel data is interleaved in one buffer. */
+ public final boolean planar;
public final boolean littleEndian;
-
- public String toString() {
- return "AudioDataFormat[type "+dataType+", sampleRate "+sampleRate+", sampleSize "+sampleSize+", channelCount "+channelCount+
- ", signed "+signed+", "+(littleEndian?"little":"big")+"endian]"; }
+
+
+ //
+ // Time <-> Bytes
+ //
+
+ /**
+ * Returns the byte size of the given milliseconds
+ * according to {@link #sampleSize}, {@link #channelCount} and {@link #sampleRate}.
+ * <p>
+ * Time -> Byte Count
+ * </p>
+ */
+ public final int getDurationsByteSize(int millisecs) {
+ final int bytesPerSample = sampleSize >>> 3; // /8
+ return millisecs * ( channelCount * bytesPerSample * ( sampleRate / 1000 ) );
+ }
+
+ /**
+ * Returns the duration in milliseconds of the given byte count
+ * according to {@link #sampleSize}, {@link #channelCount} and {@link #sampleRate}.
+ * <p>
+ * Byte Count -> Time
+ * </p>
+ */
+ public final int getBytesDuration(int byteCount) {
+ final int bytesPerSample = sampleSize >>> 3; // /8
+ return byteCount / ( channelCount * bytesPerSample * ( sampleRate / 1000 ) );
+ }
+
+ /**
+ * Returns the duration in milliseconds of the given sample count per frame and channel
+ * according to the {@link #sampleRate}, i.e.
+ * <pre>
+ * ( 1000f * sampleCount ) / sampleRate
+ * </pre>
+ * <p>
+ * Sample Count -> Time
+ * </p>
+ * @param sampleCount sample count per frame and channel
+ */
+ public final float getSamplesDuration(int sampleCount) {
+ return ( 1000f * (float) sampleCount ) / (float)sampleRate;
+ }
+
+ /**
+ * Returns the rounded frame count of the given milliseconds and frame duration.
+ * <pre>
+ * Math.max( 1, millisecs / frameDuration + 0.5f )
+ * </pre>
+ * <p>
+ * Note: <code>frameDuration</code> can be derived by <i>sample count per frame and channel</i>
+ * via {@link #getSamplesDuration(int)}.
+ * </p>
+ * <p>
+ * Frame Time -> Frame Count
+ * </p>
+ * @param millisecs time in milliseconds
+ * @param frameDuration duration per frame in milliseconds.
+ */
+ public final int getFrameCount(int millisecs, float frameDuration) {
+ return Math.max(1, (int) ( (float)millisecs / frameDuration + 0.5f ));
+ }
+
+ /**
+ * Returns the byte size of given sample count
+ * according to the {@link #sampleSize}, i.e.:
+ * <pre>
+ * sampleCount * ( sampleSize / 8 )
+ * </pre>
+ * <p>
+ * Note: To retrieve the byte size for all channels,
+ * you need to pre-multiply <code>sampleCount</code> with {@link #channelCount}.
+ * </p>
+ * <p>
+ * Sample Count -> Byte Count
+ * </p>
+ * @param sampleCount sample count
+ */
+ public final int getSamplesByteCount(int sampleCount) {
+ return sampleCount * ( sampleSize >>> 3 );
+ }
+
+ /**
+ * Returns the sample count of given byte count
+ * according to the {@link #sampleSize}, i.e.:
+ * <pre>
+ * ( byteCount * 8 ) / sampleSize
+ * </pre>
+ * <p>
+ * Note: If <code>byteCount</code> covers all channels and you request the sample size per channel,
+ * you need to divide the result by <code>sampleCount</code> by {@link #channelCount}.
+ * </p>
+ * <p>
+ * Byte Count -> Sample Count
+ * </p>
+ * @param sampleCount sample count
+ */
+ public final int getBytesSampleCount(int byteCount) {
+ return ( byteCount << 3 ) / sampleSize;
+ }
+
+ @Override
+ public String toString() {
+ return "AudioDataFormat[sampleRate "+sampleRate+", sampleSize "+sampleSize+", channelCount "+channelCount+
+ ", signed "+signed+", fixedP "+fixedP+", "+(planar?"planar":"packed")+", "+(littleEndian?"little":"big")+"-endian]"; }
}
- /** Default {@link AudioDataFormat}, [type PCM, sampleRate 44100, sampleSize 16, channelCount 2, signed, littleEndian]. */
- public static final AudioDataFormat DefaultFormat = new AudioDataFormat(AudioDataType.PCM, 44100, 16, 2, true /* signed */, true /* littleEndian */);
-
- public static class AudioFrame {
- public final ByteBuffer data;
- public final int dataSize;
- public final int audioPTS;
-
- public AudioFrame(ByteBuffer data, int dataSize, int audioPTS) {
- if( dataSize > data.remaining() ) {
- throw new IllegalArgumentException("Give size "+dataSize+" exceeds remaining bytes in ls "+data+". "+this);
+ /** Default {@link AudioFormat}, [type PCM, sampleRate 44100, sampleSize 16, channelCount 2, signed, fixedP, !planar, littleEndian]. */
+ public static final AudioFormat DefaultFormat = new AudioFormat(44100, 16, 2, true /* signed */,
+ true /* fixed point */, false /* planar */, true /* littleEndian */);
+
+ public static abstract class AudioFrame extends TimeFrameI {
+ protected int byteSize;
+
+ public AudioFrame() {
+ this.byteSize = 0;
+ }
+ public AudioFrame(int pts, int duration, int byteCount) {
+ super(pts, duration);
+ this.byteSize=byteCount;
+ }
+
+ /** Get this frame's size in bytes. */
+ public final int getByteSize() { return byteSize; }
+ /** Set this frame's size in bytes. */
+ public final void setByteSize(int size) { this.byteSize=size; }
+
+ @Override
+ public String toString() {
+ return "AudioFrame[pts " + pts + " ms, l " + duration + " ms, "+byteSize + " bytes]";
+ }
+ }
+ public static class AudioDataFrame extends AudioFrame {
+ protected final ByteBuffer data;
+
+ public AudioDataFrame(int pts, int duration, ByteBuffer bytes, int byteCount) {
+ super(pts, duration, byteCount);
+ if( byteCount > bytes.remaining() ) {
+ throw new IllegalArgumentException("Give size "+byteCount+" exceeds remaining bytes in ls "+bytes+". "+this);
}
- this.data=data;
- this.dataSize=dataSize;
- this.audioPTS=audioPTS;
+ this.data=bytes;
+ }
+
+ /** Get this frame's data. */
+ public final ByteBuffer getData() { return data; }
+
+ @Override
+ public String toString() {
+ return "AudioDataFrame[pts " + pts + " ms, l " + duration + " ms, "+byteSize + " bytes, " + data + "]";
}
-
- public String toString() { return "AudioFrame[apts "+audioPTS+", data "+data+", payloadSize "+dataSize+"]"; }
}
-
- /**
+
+ /**
* Returns the <code>initialized state</code> of this instance.
* <p>
* The <code>initialized state</code> is affected by this instance
* overall availability, i.e. after instantiation,
* as well as by {@link #destroy()}.
- * </p>
+ * </p>
*/
public boolean isInitialized();
- /**
- * Returns the preferred {@link AudioDataFormat} by this sink.
+ /** Returns the playback speed. */
+ public float getPlaySpeed();
+
+ /**
+ * Sets the playback speed.
+ * <p>
+ * To simplify test, play speed is <i>normalized</i>, i.e.
+ * <ul>
+ * <li><code>1.0f</code>: if <code> Math.abs(1.0f - rate) < 0.01f </code></li>
+ * </ul>
+ * </p>
+ * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation.
+ */
+ public boolean setPlaySpeed(float s);
+
+ /** Returns the volume. */
+ public float getVolume();
+
+ /**
+ * Sets the volume [0f..1f].
* <p>
- * The preferred format shall reflect this sinks most native format,
- * i.e. best performance w/o data conversion.
+ * To simplify test, volume is <i>normalized</i>, i.e.
+ * <ul>
+ * <li><code>0.0f</code>: if <code> Math.abs(v) < 0.01f </code></li>
+ * <li><code>1.0f</code>: if <code> Math.abs(1.0f - v) < 0.01f </code></li>
+ * </ul>
* </p>
- * @see #initSink(AudioDataFormat)
+ * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation.
*/
- public AudioDataFormat getPreferredFormat();
-
+ public boolean setVolume(float v);
+
+ /**
+ * Returns the preferred {@link AudioFormat} by this sink.
+ * <p>
+ * The preferred format is guaranteed to be supported
+ * and shall reflect this sinks most native format,
+ * i.e. best performance w/o data conversion.
+ * </p>
+ * <p>
+ * Known {@link #AudioFormat} attributes considered by implementations:
+ * <ul>
+ * <li>ALAudioSink: {@link AudioFormat#sampleRate}.
+ * </ul>
+ * </p>
+ * @see #initSink(AudioFormat)
+ * @see #isSupported(AudioFormat)
+ */
+ public AudioFormat getPreferredFormat();
+
+ /** Return the maximum number of supported channels. */
+ public int getMaxSupportedChannels();
+
+ /**
+ * Returns true if the given format is supported by the sink, otherwise false.
+ * @see #initSink(AudioFormat)
+ * @see #getPreferredFormat()
+ */
+ public boolean isSupported(AudioFormat format);
+
/**
* Initializes the sink.
* <p>
- * Implementation shall try to match the given <code>requestedFormat</code> {@link AudioDataFormat}
- * as close as possible, regarding it's capabilities.
+ * Implementation must match the given <code>requestedFormat</code> {@link AudioFormat}.
* </p>
* <p>
- * A user may consider {@link #getPreferredFormat()} and pass this value
- * to utilize best performance and <i>behavior</i>.
+ * Caller shall validate <code>requestedFormat</code> via {@link #isSupported(AudioFormat)}
+ * beforehand and try to find a suitable supported one.
+ * {@link #getPreferredFormat()} and {@link #getMaxSupportedChannels()} may help.
* </p>
- * The {@link #DefaultFormat} <i>should be</i> supported by all implementations.
+ * @param requestedFormat the requested {@link AudioFormat}.
+ * @param frameDuration average or fixed frame duration in milliseconds
+ * helping a caching {@link AudioFrame} based implementation to determine the frame count in the queue.
+ * See {@link #DefaultFrameDuration}.
+ * @param initialQueueSize initial time in milliseconds to queue in this sink, see {@link #DefaultInitialQueueSize}.
+ * @param queueGrowAmount time in milliseconds to grow queue if full, see {@link #DefaultQueueGrowAmount}.
+ * @param queueLimit maximum time in milliseconds the queue can hold (and grow), see {@link #DefaultQueueLimitWithVideo} and {@link #DefaultQueueLimitAudioOnly}.
+ * @return true if successful, otherwise false
+ */
+ public boolean init(AudioFormat requestedFormat, float frameDuration,
+ int initialQueueSize, int queueGrowAmount, int queueLimit);
+
+ /**
+ * Returns true, if {@link #play()} has been requested <i>and</i> the sink is still playing,
+ * otherwise false.
+ */
+ public boolean isPlaying();
+
+ /**
+ * Play buffers queued via {@link #enqueueData(AudioFrame)} from current internal position.
+ * If no buffers are yet queued or the queue runs empty, playback is being continued when buffers are enqueued later on.
+ * @see #enqueueData(AudioFrame)
+ * @see #pause()
+ */
+ public void play();
+
+ /**
+ * Pause playing buffers while keeping enqueued data incl. it's internal position.
+ * @see #play()
+ * @see #flush()
+ * @see #enqueueData(AudioFrame)
+ */
+ public void pause();
+
+ /**
+ * Flush all queued buffers, implies {@link #pause()}.
+ * <p>
+ * {@link #init(AudioFormat, float, int, int, int)} must be called first.
* </p>
- * @param requestedFormat the requested {@link AudioDataFormat}.
- * @param bufferCount number of buffers for sink
- * @return if successful the chosen AudioDataFormat based on the <code>requestedFormat</code> and this sinks capabilities, otherwise <code>null</code>.
+ * @see #play()
+ * @see #pause()
+ * @see #enqueueData(AudioFrame)
*/
- public AudioDataFormat initSink(AudioDataFormat requestedFormat, int bufferCount);
+ public void flush();
-
/** Destroys this instance, i.e. closes all streams and devices allocated. */
public void destroy();
-
- /**
- * Returns the number of bytes queued for playing.
+
+ /**
+ * Returns the number of allocated buffers as requested by
+ * {@link #init(AudioFormat, float, int, int, int)}.
+ */
+ public int getFrameCount();
+
+ /** @return the current enqueued frames count since {@link #init(AudioFormat, float, int, int, int)}. */
+ public int getEnqueuedFrameCount();
+
+ /**
+ * Returns the current number of frames queued for playing.
* <p>
- * {@link #initSink(AudioDataFormat)} must be called first.
+ * {@link #init(AudioFormat, float, int, int, int)} must be called first.
+ * </p>
+ */
+ public int getQueuedFrameCount();
+
+ /**
+ * Returns the current number of bytes queued for playing.
+ * <p>
+ * {@link #init(AudioFormat, float, int, int, int)} must be called first.
* </p>
*/
public int getQueuedByteCount();
- /**
- * Returns the queued buffer time in milliseconds for playing.
+ /**
+ * Returns the current queued frame time in milliseconds for playing.
* <p>
- * {@link #initSink(AudioDataFormat)} must be called first.
+ * {@link #init(AudioFormat, float, int, int, int)} must be called first.
* </p>
*/
public int getQueuedTime();
-
- /**
- * Returns the number of buffers in the sink available for writing.
+
+ /**
+ * Return the current audio presentation timestamp (PTS) in milliseconds.
+ */
+ public int getPTS();
+
+ /**
+ * Returns the current number of frames in the sink available for writing.
* <p>
- * {@link #initSink(AudioDataFormat)} must be called first.
+ * {@link #init(AudioFormat, float, int, int, int)} must be called first.
* </p>
*/
- public int getWritableBufferCount();
-
- /**
- * Returns true if data is available to be written in the sink.
+ public int getFreeFrameCount();
+
+ /**
+ * Enqueue the remaining bytes of the given {@link AudioDataFrame}'s direct ByteBuffer to this sink.
+ * <p>
+ * The data must comply with the chosen {@link AudioFormat} as returned by {@link #initSink(AudioFormat)}.
+ * </p>
* <p>
- * {@link #initSink(AudioDataFormat)} must be called first.
+ * {@link #init(AudioFormat, float, int, int, int)} must be called first.
* </p>
+ * @returns the enqueued internal {@link AudioFrame}, which may differ from the input <code>audioDataFrame</code>.
+ * @deprecated User shall use {@link #enqueueData(int, ByteBuffer, int)}, which allows implementation
+ * to reuse specialized {@link AudioFrame} instances.
*/
- public boolean isDataAvailable(int data_size);
+ public AudioFrame enqueueData(AudioDataFrame audioDataFrame);
- /**
- * Writes the remaining bytes of the given direct ByteBuffer to this sink.
+ /**
+ * Enqueue <code>byteCount</code> bytes of the remaining bytes of the given NIO {@link ByteBuffer} to this sink.
+ * <p>
+ * The data must comply with the chosen {@link AudioFormat} as returned by {@link #initSink(AudioFormat)}.
+ * </p>
* <p>
- * The data must comply with the chosen {@link AudioDataFormat} as returned by {@link #initSink(AudioDataFormat)}.
+ * {@link #init(AudioFormat, float, int, int, int)} must be called first.
* </p>
+ * @returns the enqueued internal {@link AudioFrame}.
*/
- public void writeData(AudioFrame audioFrame);
+ public AudioFrame enqueueData(int pts, ByteBuffer bytes, int byteCount);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSinkFactory.java b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSinkFactory.java
index 40321fb..2cfd40d 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSinkFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSinkFactory.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -42,10 +42,13 @@ public class AudioSinkFactory {
sink = create(cl, JavaAudioSinkClazzName);
}
if( null == sink ) {
- sink = new NullAudioSink();
+ sink = createNull();
}
return sink;
}
+ public static AudioSink createNull() {
+ return new NullAudioSink();
+ }
public static AudioSink create(final ClassLoader cl, String implName) {
final AudioSink audioSink;
@@ -55,7 +58,7 @@ public class AudioSinkFactory {
if( audioSink.isInitialized() ) {
return audioSink;
}
- } catch (Throwable t) {
+ } catch (Throwable t) {
if(AudioSink.DEBUG) { System.err.println("Catched "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); }
}
}
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 1825dbd..f0864f9 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,40 +20,97 @@
* 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.util.av;
-import java.io.IOException;
-import java.net.URLConnection;
+import java.net.URI;
import javax.media.opengl.GL;
import javax.media.opengl.GLException;
import jogamp.opengl.Debug;
+import com.jogamp.opengl.util.texture.Texture;
import com.jogamp.opengl.util.texture.TextureSequence;
+import com.jogamp.opengl.util.TimeFrameI;
/**
- * Lifecycle of an GLMediaPlayer:
+ * GLMediaPlayer interface specifies a {@link TextureSequence} state machine
+ * using a multiplexed audio/video stream as it's source.
+ * <p>
+ * Audio maybe supported and played back internally or via an {@link AudioSink} implementation.
+ * </p>
+ * <p>
+ * Audio and video streams can be selected or muted via {@link #initStream(URI, int, int, int)}
+ * using the appropriate <a href="#streamIDs">stream id</a>'s.
+ * </p>
+ * <p>
+ * Camera input can be selected using the {@link #CameraInputScheme} URI.
+ * </p>
+ *
+ * <a name="streamworker"><h5><i>StreamWorker</i> Decoding Thread</h5></a>
+ * <p>
+ * Most of the stream processing is performed on the decoding thread, a.k.a. <i>StreamWorker</i>:
+ * <ul>
+ * <li>Stream initialization triggered by {@link #initStream(URI, int, int, int) initStream(..)} - User gets notified whether the stream has been initialized or not via {@link GLMediaEventListener#attributesChanged(GLMediaPlayer, int, long) attributesChanges(..)}.</li>
+ * <li>Stream decoding - User gets notified of a new frame via {@link GLMediaEventListener#newFrameAvailable(GLMediaPlayer, com.jogamp.opengl.util.texture.TextureSequence.TextureFrame, long) newFrameAvailable(...)}.</li>
+ * <li>Caught <a href="#streamerror">exceptions on the decoding thread</a> are delivered as {@link StreamException}s.</li>
+ * </ul>
+ * <i>StreamWorker</i> generates it's own {@link GLContext}, shared with the one passed to {@link #initGL(GL)}.
+ * The shared {@link GLContext} allows the decoding thread to push the video frame data directly into
+ * the designated {@link TextureFrame}, later returned via {@link #getNextTexture(GL)} and used by the user.
+ * </p>
+ * <a name="streamerror"><h7><i>StreamWorker</i> Error Handling</h7></a>
+ * <p>
+ * Caught exceptions on <a href="#streamworker">StreamWorker</a> are delivered as {@link StreamException}s,
+ * which either degrades the {@link State} to {@link State#Uninitialized} or {@link State#Paused}.
+ * </p>
+ * <p>
+ * An occurring {@link StreamException} triggers a {@link GLMediaEventListener#EVENT_CHANGE_ERR EVENT_CHANGE_ERR} event,
+ * which can be listened to via {@link GLMediaEventListener#attributesChanged(GLMediaPlayer, int, long)}.
+ * </p>
+ * <p>
+ * An occurred {@link StreamException} can be read via {@link #getStreamException()}.
+ * </p>
+ *
+ * </p>
+ * <a name="lifecycle"><h5>GLMediaPlayer Lifecycle</h5></a>
+ * <p>
* <table border="1">
- * <tr><th>action</th> <th>state before</th> <th>state after</th></tr>
- * <tr><td>{@link #initGLStream(GL, URLConnection)}</td> <td>Uninitialized</td> <td>Stopped</td></tr>
- * <tr><td>{@link #start()}</td> <td>Stopped, Paused</td> <td>Playing</td></tr>
- * <tr><td>{@link #stop()}</td> <td>Playing, Paused</td> <td>Stopped</td></tr>
- * <tr><td>{@link #pause()}</td> <td>Playing</td> <td>Paused</td></tr>
- * <tr><td>{@link #destroy(GL)}</td> <td>ANY</td> <td>Uninitialized</td></tr>
+ * <tr><th>Action</th> <th>{@link State} Before</th> <th>{@link State} After</th> <th>{@link GLMediaEventListener Event}</th></tr>
+ * <tr><td>{@link #initStream(URI, int, int, int)}</td> <td>{@link State#Uninitialized Uninitialized}</td> <td>{@link State#Initialized Initialized}<sup><a href="#streamworker">1</a></sup>, {@link State#Uninitialized Uninitialized}</td> <td>{@link GLMediaEventListener#EVENT_CHANGE_INIT EVENT_CHANGE_INIT} or ( {@link GLMediaEventListener#EVENT_CHANGE_ERR EVENT_CHANGE_ERR} + {@link GLMediaEventListener#EVENT_CHANGE_UNINIT EVENT_CHANGE_UNINIT} )</td></tr>
+ * <tr><td>{@link #initGL(GL)}</td> <td>{@link State#Initialized Initialized}</td> <td>{@link State#Paused Paused}, , {@link State#Uninitialized Uninitialized}</td> <td>{@link GLMediaEventListener#EVENT_CHANGE_PAUSE EVENT_CHANGE_PAUSE} or ( {@link GLMediaEventListener#EVENT_CHANGE_ERR EVENT_CHANGE_ERR} + {@link GLMediaEventListener#EVENT_CHANGE_UNINIT EVENT_CHANGE_UNINIT} )</td></tr>
+ * <tr><td>{@link #play()}</td> <td>{@link State#Paused Paused}</td> <td>{@link State#Playing Playing}</td> <td>{@link GLMediaEventListener#EVENT_CHANGE_PLAY EVENT_CHANGE_PLAY}</td></tr>
+ * <tr><td>{@link #pause(boolean)}</td> <td>{@link State#Playing Playing}</td> <td>{@link State#Paused Paused}</td> <td>{@link GLMediaEventListener#EVENT_CHANGE_PAUSE EVENT_CHANGE_PAUSE}</td></tr>
+ * <tr><td>{@link #seek(int)}</td> <td>{@link State#Paused Paused}, {@link State#Playing Playing}</td> <td>{@link State#Paused Paused}, {@link State#Playing Playing}</td> <td>none</td></tr>
+ * <tr><td>{@link #getNextTexture(GL)}</td> <td>{@link State#Paused Paused}, {@link State#Playing Playing}</td> <td>{@link State#Paused Paused}, {@link State#Playing Playing}</td> <td>none</td></tr>
+ * <tr><td>{@link #getLastTexture()}</td> <td>{@link State#Paused Paused}, {@link State#Playing Playing}</td> <td>{@link State#Paused Paused}, {@link State#Playing Playing}</td> <td>none</td></tr>
+ * <tr><td>{@link TextureFrame#END_OF_STREAM_PTS END_OF_STREAM}</td> <td>{@link State#Playing Playing}</td> <td>{@link State#Paused Paused}</td> <td>{@link GLMediaEventListener#EVENT_CHANGE_EOS EVENT_CHANGE_EOS} + {@link GLMediaEventListener#EVENT_CHANGE_PAUSE EVENT_CHANGE_PAUSE}</td></tr>
+ * <tr><td>{@link StreamException}</td> <td>ANY</td> <td>{@link State#Paused Paused}, {@link State#Uninitialized Uninitialized}</td> <td>{@link GLMediaEventListener#EVENT_CHANGE_ERR EVENT_CHANGE_ERR} + ( {@link GLMediaEventListener#EVENT_CHANGE_PAUSE EVENT_CHANGE_PAUSE} or {@link GLMediaEventListener#EVENT_CHANGE_UNINIT EVENT_CHANGE_UNINIT} )</td></tr>
+ * <tr><td>{@link #destroy(GL)}</td> <td>ANY</td> <td>{@link State#Uninitialized Uninitialized}</td> <td>{@link GLMediaEventListener#EVENT_CHANGE_UNINIT EVENT_CHANGE_UNINIT}</td></tr>
* </table>
+ * </p>
+ *
+ * <a name="streamIDs"><h5>Audio and video Stream IDs</h5></a>
+ * <p>
+ * <table border="1">
+ * <tr><th>value</th> <th>request</th> <th>get</th></tr>
+ * <tr><td>{@link #STREAM_ID_NONE}</td> <td>mute</td> <td>not available</td></tr>
+ * <tr><td>{@link #STREAM_ID_AUTO}</td> <td>auto</td> <td>unspecified</td></tr>
+ * <tr><td>≥0</td> <td>specific stream</td> <td>specific stream</td></tr>
+ * </table>
+ * </p>
* <p>
* Current implementations (check each API doc link for details):
* <ul>
* <li>{@link jogamp.opengl.util.av.NullGLMediaPlayer}</li>
* <li>{@link jogamp.opengl.util.av.impl.OMXGLMediaPlayer}</li>
* <li>{@link jogamp.opengl.util.av.impl.FFMPEGMediaPlayer}</li>
- * <li>{@link jogamp.opengl.android.av.AndroidGLMediaPlayerAPI14}</li>
+ * <li>{@link jogamp.opengl.android.av.AndroidGLMediaPlayerAPI14}</li>
* </ul>
* </p>
* <p>
@@ -64,145 +121,426 @@ import com.jogamp.opengl.util.texture.TextureSequence;
* to be properly considered by {@link GLMediaPlayerFactory#create(ClassLoader, String)}
* and {@link GLMediaPlayerFactory#createDefault()}.
* </p>
+ * <a name="timestampaccuracy"><h5>Timestamp Accuracy</h5></a>
+ * <p>
* <p>
- * Variable type, value range and dimension has been chosen to suit embedded CPUs
- * and characteristics of audio and video streaming.
- * Milliseconds of type integer with a maximum value of {@link Integer#MAX_VALUE}
- * will allow tracking time up 2,147,483.647 seconds or
- * 24 days 20 hours 31 minutes and 23 seconds.
- * Milliseconds granularity is also more than enough to deal with A-V synchronization,
- * where the threshold usually lies within 100ms.
+ * Timestamp type and value range has been chosen to suit embedded CPUs
+ * and characteristics of audio and video streaming. See {@link TimeFrameI}.
+ * </p>
+ *
+ * <a name="synchronization"><h5>Audio and video synchronization</h5></a>
+ * <p>
+ * The class follows a passive A/V synchronization pattern.
+ * Audio is being untouched, while {@link #getNextTexture(GL)} delivers a new video frame
+ * only, if its timestamp is less than {@link #MAXIMUM_VIDEO_ASYNC} ahead of <i>time</i>.
+ * If its timestamp is more than {@link #MAXIMUM_VIDEO_ASYNC} ahead of <i>time</i>,
+ * the previous frame is returned.
+ * If its timestamp is more than {@link #MAXIMUM_VIDEO_ASYNC} after <i>time</i>,
+ * the frame is dropped and the next frame is being fetched.
+ * </p>
+ * <p>
+ * https://en.wikipedia.org/wiki/Audio_to_video_synchronization
+ * <pre>
+ * d_av = v_pts - a_pts;
+ * </pre>
+ * </p>
+ * <p>
+ * Recommendation of audio/video pts time lead/lag at production:
+ * <ul>
+ * <li>Overall: +40ms and -60ms audio ahead video / audio after video</li>
+ * <li>Each stage: +5ms and -15ms. audio ahead video / audio after video</li>
+ * </ul>
+ * </p>
+ * <p>
+ * Recommendation of av pts time lead/lag at presentation:
+ * <ul>
+ * <li>TV: +15ms and -45ms. audio ahead video / audio after video.</li>
+ * <li>Film: +22ms and -22ms. audio ahead video / audio after video.</li>
+ * </ul>
+ * </p>
+ *
+ * <a name="teststreams"><h5>Test Streams</h5></a>
+ * <p>
+ * <table border="1">
+ * <tr><th colspan=5>Big Buck Bunny 24f 16:9</th></tr>
+ * <tr><td>Big Buck Bunny</td><td>320p</td><td>h264<td>aac 48000Hz 2 chan</td><td>http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4</td></tr>
+ * <tr><td>Big Buck Bunny</td><td>720p</td><td>mpeg4<td>ac3 48000Hz 5.1 chan</td><td>http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_surround.avi</td></tr>
+ * <tr><td>Big Buck Bunny</td><td>720p</td><td>msmpeg4v2<td>mp3 48000Hz 2 chan</td><td>http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_stereo.avi</td></tr>
+ * <tr><td>Big Buck Bunny</td><td>720p</td><td>theora<td>vorbis 48000Hz 2 chan</td><td>http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_stereo.ogg</td></tr>
+ * <tr><td>Big Buck Bunny</td><td>1080p</td><td>mpeg4<td>ac3 48000Hz 5.1 chan</td><td>http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_1080p_surround.avi</td></tr>
+ * <tr><th colspan=5>WebM/Matroska (vp8/vorbis)</th></tr>
+ * <tr><td>Big Buck Bunny Trailer</td><td>640p</td><td>vp8<td>vorbis 44100Hz 1 chan</td><td>http://video.webmfiles.org/big-buck-bunny_trailer.webm</td></tr>
+ * <tr><td>Elephants Dream</td><td>540p</td><td>vp8<td>vorbis 44100Hz 1 chan</td><td>http://video.webmfiles.org/elephants-dream.webm</td></tr>
+ * <tr><th colspan=5>You Tube http/rtsp</th></tr>
+ * <tr><td>Sintel</td><td colspan=3>http://www.youtube.com/watch?v=eRsGyueVLvQ</td><td>rtsp://v3.cache1.c.youtube.com/CiILENy73wIaGQn0LpXnygYbeRMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp</td></tr>
+ * <tr><th colspan=5>Audio/Video Sync</th></tr>
+ * <tr><td>Five-minute-sync-test1080p</td><td colspan=3>https://www.youtube.com/watch?v=szoOsG9137U</td><td>rtsp://v7.cache8.c.youtube.com/CiILENy73wIaGQm133VvsA46sxMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp</td></tr>
+ * <tr><td>Audio-Video-Sync-Test-Calibration-23.98fps-24fps</td><td colspan=4>https://www.youtube.com/watch?v=cGgf_dbDMsw</td></tr>
+ * <tr><td>sound_in_sync_test</td><td colspan=4>https://www.youtube.com/watch?v=O-zIZkhXNLE</td></tr>
+ * <!-- <tr><td> title </td><td>1080p</td><td>mpeg4<td>ac3 48000Hz 5.1 chan</td><td> url </td></tr> -->
+ * <!-- <tr><td> title </td><td colspan=3> url1 </td><td> url2 </td></tr>
+ * </table>
* </p>
*/
public interface GLMediaPlayer extends TextureSequence {
public static final boolean DEBUG = Debug.debug("GLMediaPlayer");
-
+ public static final boolean DEBUG_NATIVE = Debug.debug("GLMediaPlayer.Native");
+
+ /** Default texture count, value {@value}. */
+ public static final int TEXTURE_COUNT_DEFAULT = 4;
+
+ /** Minimum texture count, value {@value}. Using the minimum texture count disables multi-threaded decoding. */
+ public static final int TEXTURE_COUNT_MIN = 1;
+
+ /** Constant {@value} for <i>mute</i> or <i>not available</i>. See <a href="#streamIDs">Audio and video Stream IDs</a>. */
+ public static final int STREAM_ID_NONE = -2;
+ /** Constant {@value} for <i>auto</i> or <i>unspecified</i>. See <a href="#streamIDs">Audio and video Stream IDs</a>. */
+ public static final int STREAM_ID_AUTO = -1;
+
+ /**
+ * {@link URI#getScheme() URI scheme} name {@value} for camera input. E.g. <code>camera:/0</code>
+ * for the 1st camera device.
+ * <p>
+ * The {@link URI#getRawPath() URI path} is being used to identify the camera (<i>ID</i>),
+ * where the root fwd-slash is being cut-off.
+ * </p>
+ * <p>
+ * The <i>ID</i> is usually an integer value indexing the camera
+ * ranging from [0..<i>max-number</i>].
+ * </p>
+ * <p>
+ * The {@link URI#getRawQuery() URI query} is used to pass options to the camera
+ * using <i>;</i> as the separator. The latter avoids trouble w/ escaping.
+ * </p>
+ * <pre>
+ * camera:/<id>
+ * camera://somewhere/<id>
+ * camera://somewhere/<id>?width=640;height=480;rate=15
+ * camera://somewhere/<id>?size=640x480;rate=15
+ * </pre>
+ * <pre>
+ * URI: [scheme:][//authority][path][?query][#fragment]
+ * w/ authority: [user-info@]host[:port]
+ * Note: 'path' starts w/ fwd slash
+ * </pre>
+ * </p>
+ */
+ public static final String CameraInputScheme = "camera";
+ /** Camera property {@value}, size as string, e.g. <code>1280x720</code>, <code>hd720</code>. May not be supported on all platforms. See {@link #CameraInputScheme}. */
+ public static final String CameraPropSizeS = "size";
+ /** Camera property {@value}. See {@link #CameraInputScheme}. */
+ public static final String CameraPropWidth = "width";
+ /** Camera property {@value}. See {@link #CameraInputScheme}. */
+ public static final String CameraPropHeight = "height";
+ /** Camera property {@value}. See {@link #CameraInputScheme}. */
+ public static final String CameraPropRate = "rate";
+
+ /** Maximum video frame async of {@value} milliseconds. */
+ public static final int MAXIMUM_VIDEO_ASYNC = 22;
+
+ /**
+ * A StreamException encapsulates a caught exception in the decoder thread, a.k.a <i>StreamWorker</i>,
+ * see See <a href="#streamerror"><i>StreamWorker</i> Error Handling</a>.
+ */
+ @SuppressWarnings("serial")
+ public static class StreamException extends Exception {
+ public StreamException(Throwable cause) {
+ super(cause);
+ }
+ public StreamException(String message, Throwable cause) {
+ super(message, cause);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * See {@link TexSeqEventListener} for semantics and usage.
+ * </p>
+ */
public interface GLMediaEventListener extends TexSeqEventListener<GLMediaPlayer> {
-
- static final int EVENT_CHANGE_SIZE = 1<<0;
- static final int EVENT_CHANGE_FPS = 1<<1;
- static final int EVENT_CHANGE_BPS = 1<<2;
- static final int EVENT_CHANGE_LENGTH = 1<<3;
- static final int EVENT_CHANGE_CODEC = 1<<3;
-
+
+ /** State changed to {@link State#Initialized}. See <a href="#lifecycle">Lifecycle</a>.*/
+ static final int EVENT_CHANGE_INIT = 1<<0;
+ /** State changed to {@link State#Uninitialized}. See <a href="#lifecycle">Lifecycle</a>.*/
+ static final int EVENT_CHANGE_UNINIT = 1<<1;
+ /** State changed to {@link State#Playing}. See <a href="#lifecycle">Lifecycle</a>.*/
+ static final int EVENT_CHANGE_PLAY = 1<<2;
+ /** State changed to {@link State#Paused}. See <a href="#lifecycle">Lifecycle</a>.*/
+ static final int EVENT_CHANGE_PAUSE = 1<<3;
+ /** End of stream reached. See <a href="#lifecycle">Lifecycle</a>.*/
+ static final int EVENT_CHANGE_EOS = 1<<4;
+ /** An error occurred, e.g. during off-thread initialization. See {@link StreamException} and <a href="#lifecycle">Lifecycle</a>. */
+ static final int EVENT_CHANGE_ERR = 1<<5;
+
+ /** Stream video id change. */
+ static final int EVENT_CHANGE_VID = 1<<16;
+ /** Stream audio id change. */
+ static final int EVENT_CHANGE_AID = 1<<17;
+ /** TextureFrame size or vertical flip change. */
+ static final int EVENT_CHANGE_SIZE = 1<<18;
+ /** Stream fps change. */
+ static final int EVENT_CHANGE_FPS = 1<<19;
+ /** Stream bps change. */
+ static final int EVENT_CHANGE_BPS = 1<<20;
+ /** Stream length change. */
+ static final int EVENT_CHANGE_LENGTH = 1<<21;
+ /** Stream codec change. */
+ static final int EVENT_CHANGE_CODEC = 1<<22;
+
/**
- * @param mp the event source
+ * @param mp the event source
* @param event_mask the changes attributes
- * @param when system time in msec.
+ * @param when system time in msec.
*/
- public void attributesChanges(GLMediaPlayer mp, int event_mask, long when);
+ public void attributesChanged(GLMediaPlayer mp, int event_mask, long when);
}
-
+
+ /**
+ * See <a href="#lifecycle">Lifecycle</a>.
+ */
public enum State {
- Uninitialized(0), Stopped(1), Playing(2), Paused(3);
-
+ /** Uninitialized player, no resources shall be hold. */
+ Uninitialized(0),
+ /** Stream has been initialized, user may play or call {@link #initGL(GL)}. */
+ Initialized(1),
+ /** Stream is playing. */
+ Playing(2),
+ /** Stream is pausing. */
+ Paused(3);
+
public final int id;
State(int id){
this.id = id;
}
}
-
+
public int getTextureCount();
-
- /** Defaults to 0 */
+
+ /** Returns the texture target used by implementation. */
+ public int getTextureTarget();
+
+ /** Sets the texture unit. Defaults to 0. */
public void setTextureUnit(int u);
+
/** Sets the texture min-mag filter, defaults to {@link GL#GL_NEAREST}. */
public void setTextureMinMagFilter(int[] minMagFilter);
/** Sets the texture min-mag filter, defaults to {@link GL#GL_CLAMP_TO_EDGE}. */
public void setTextureWrapST(int[] wrapST);
-
- /**
- * Sets the stream to be used. Initializes all stream related states inclusive OpenGL ones,
- * if <code>gl</code> is not null.
+
+ /**
+ * Issues asynchronous stream initialization.
+ * <p>
+ * <a href="#lifecycle">Lifecycle</a>: {@link State#Uninitialized} -> {@link State#Initialized}<sup><a href="#streamworker">1</a></sup> or {@link State#Uninitialized}
+ * </p>
+ * <p>
+ * {@link State#Initialized} is reached asynchronous,
+ * i.e. user gets notified via {@link GLMediaEventListener#attributesChanged(GLMediaPlayer, int, long) attributesChanges(..)}.
+ * </p>
+ * <p>
+ * A possible caught asynchronous {@link StreamException} while initializing the stream off-thread
+ * will be thrown at {@link #initGL(GL)}.
+ * </p>
* <p>
- * Uninitialized -> Stopped
+ * Muted audio can be achieved by passing {@link #STREAM_ID_NONE} to <code>aid</code>.
* </p>
- * @param gl current GL object. If null, no video output and textures will be available.
- * @param urlConn the stream connection
- * @return the new state
- *
- * @throws IllegalStateException if not invoked in state Uninitialized
- * @throws IOException in case of difficulties to open or process the stream
+ * <p>
+ * Muted video can be achieved by passing {@link #STREAM_ID_NONE} to <code>vid</code>,
+ * in which case <code>textureCount</code> is ignored as well as the passed GL object of the subsequent {@link #initGL(GL)} call.
+ * </p>
+ * @param streamLoc the stream location
+ * @param vid video stream id, see <a href="#streamIDs">audio and video Stream IDs</a>
+ * @param aid video stream id, see <a href="#streamIDs">audio and video Stream IDs</a>
+ * @param textureCount desired number of buffered textures to be decoded off-thread, will be validated by implementation.
+ * The minimum value is {@link #TEXTURE_COUNT_DEFAULT}.
+ * Ignored if video is muted.
+ * @throws IllegalStateException if not invoked in {@link State#Uninitialized}
+ * @throws IllegalArgumentException if arguments are invalid
+ */
+ public void initStream(URI streamLoc, int vid, int aid, int textureCount) throws IllegalStateException, IllegalArgumentException;
+
+ /**
+ * Returns the {@link StreamException} caught in the decoder thread, or <code>null</code>.
+ * @see GLMediaEventListener#EVENT_CHANGE_ERR
+ * @see StreamException
+ */
+ public StreamException getStreamException();
+
+ /**
+ * Initializes OpenGL related resources.
+ * <p>
+ * <a href="#lifecycle">Lifecycle</a>: {@link State#Initialized} -> {@link State#Paused} or {@link State#Initialized}
+ * </p>
+ * Argument <code>gl</code> is ignored if video is muted, see {@link #initStream(URI, int, int, int)}.
+ *
+ * @param gl current GL object. Maybe <code>null</code>, for audio only.
+ * @throws IllegalStateException if not invoked in {@link State#Initialized}.
+ * @throws StreamException forwarded from the off-thread stream initialization
* @throws GLException in case of difficulties to initialize the GL resources
*/
- public State initGLStream(GL gl, URLConnection urlConn) throws IllegalStateException, GLException, IOException;
-
+ public void initGL(GL gl) throws IllegalStateException, StreamException, GLException;
+
+ /**
+ * If implementation uses a {@link AudioSink}, it's instance will be returned.
+ * <p>
+ * The {@link AudioSink} instance is available after {@link #initStream(URI, int, int, int)},
+ * if used by implementation.
+ * </p>
+ */
+ public AudioSink getAudioSink();
+
/**
* Releases the GL and stream resources.
* <p>
- * <code>ANY</code> -> Uninitialized
+ * <a href="#lifecycle">Lifecycle</a>: <code>ANY</code> -> {@link State#Uninitialized}
* </p>
*/
public State destroy(GL gl);
- public void setPlaySpeed(float rate);
+ /**
+ * Sets the playback speed.
+ * <p>
+ * To simplify test, play speed is <i>normalized</i>, i.e.
+ * <ul>
+ * <li><code>1.0f</code>: if <code> Math.abs(1.0f - rate) < 0.01f </code></li>
+ * </ul>
+ * </p>
+ * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation.
+ */
+ public boolean setPlaySpeed(float rate);
+ /** Returns the playback speed. */
public float getPlaySpeed();
/**
- * Stopped/Paused -> Playing
+ * Sets the audio volume, [0f..1f].
+ * <p>
+ * To simplify test, volume is <i>normalized</i>, i.e.
+ * <ul>
+ * <li><code>0.0f</code>: if <code> Math.abs(v) < 0.01f </code></li>
+ * <li><code>1.0f</code>: if <code> Math.abs(1.0f - v) < 0.01f </code></li>
+ * </ul>
+ * </p>
+ * @return true if successful, otherwise false, i.e. due to unsupported value range of implementation.
*/
- public State start();
+ public boolean setAudioVolume(float v);
+
+ /** Returns the audio volume. */
+ public float getAudioVolume();
/**
- * Playing -> Paused
+ * Starts or resumes the <i>StreamWorker</i> decoding thread.
+ * <p>
+ * <a href="#lifecycle">Lifecycle</a>: {@link State#Paused} -> {@link State#Playing}
+ * </p>
*/
- public State pause();
+ public State play();
/**
- * Playing/Paused -> Stopped
+ * Pauses the <i>StreamWorker</i> decoding thread.
+ * <p>
+ * <a href="#lifecycle">Lifecycle</a>: {@link State#Playing} -> {@link State#Paused}
+ * </p>
+ * <p>
+ * If a <i>new</i> frame is desired after the next {@link #play()} call,
+ * e.g. to make a snapshot of a camera input stream,
+ * <code>flush</code> shall be set to <code>true</code>.
+ * </p>
+ * @param flush if <code>true</code> flushes the video and audio buffers, otherwise keep them intact.
*/
- public State stop();
-
+ public State pause(boolean flush);
+
/**
- * @return the current state, either Uninitialized, Stopped, Playing, Paused
+ * Seeks to the new absolute position. The <i>StreamWorker</i> decoding thread
+ * is paused while doing so and the A/V buffers are flushed.
+ * <p>
+ * Allowed in state {@link State#Playing} and {@link State#Paused}, otherwise ignored,
+ * see <a href="#lifecycle">Lifecycle</a>.
+ * </p>
+ *
+ * @param msec absolute desired time position in milliseconds
+ * @return time current position in milliseconds, after seeking to the desired position
+ **/
+ public int seek(int msec);
+
+ /**
+ * See <a href="#lifecycle">Lifecycle</a>.
+ * @return the current state, either {@link State#Uninitialized}, {@link State#Initialized}, {@link State#Playing} or {@link State#Paused}
*/
public State getState();
-
+
+ /**
+ * Return the video stream id, see <a href="#streamIDs">audio and video Stream IDs</a>.
+ */
+ public int getVID();
+
+ /**
+ * Return the audio stream id, see <a href="#streamIDs">audio and video Stream IDs</a>.
+ */
+ public int getAID();
+
/**
- * @return time current position in milliseconds
+ * @return the current decoded frame count since {@link #play()} and {@link #seek(int)}
+ * as increased by {@link #getNextTexture(GL)} or the decoding thread.
+ */
+ public int getDecodedFrameCount();
+
+ /**
+ * @return the current presented frame count since {@link #play()} and {@link #seek(int)}
+ * as increased by {@link #getNextTexture(GL)} for new frames.
+ */
+ public int getPresentedFrameCount();
+
+ /**
+ * @return current video presentation timestamp (PTS) in milliseconds of {@link #getLastTexture()}
**/
- public int getCurrentPosition();
+ public int getVideoPTS();
/**
- * Allowed in state Stopped, Playing and Paused, otherwise ignored.
- *
- * @param msec absolute desired time position in milliseconds
- * @return time current position in milliseconds, after seeking to the desired position
+ * @return current audio presentation timestamp (PTS) in milliseconds.
**/
- public int seek(int msec);
+ public int getAudioPTS();
/**
* {@inheritDoc}
+ * <p>
+ * See <a href="#synchronization">audio and video synchronization</a>.
+ * </p>
+ * @throws IllegalStateException if not invoked in {@link State#Paused} or {@link State#Playing}
*/
@Override
public TextureSequence.TextureFrame getLastTexture() throws IllegalStateException;
/**
* {@inheritDoc}
- *
+ *
* <p>
* In case the current state is not {@link State#Playing}, {@link #getLastTexture()} is returned.
* </p>
- *
+ * <p>
+ * See <a href="#synchronization">audio and video synchronization</a>.
+ * </p>
+ * @throws IllegalStateException if not invoked in {@link State#Paused} or {@link State#Playing}
+ *
* @see #addEventListener(GLMediaEventListener)
- * @see GLMediaEventListener#newFrameAvailable(GLMediaPlayer, long)
+ * @see GLMediaEventListener#newFrameAvailable(GLMediaPlayer, TextureFrame, long)
*/
@Override
- public TextureSequence.TextureFrame getNextTexture(GL gl, boolean blocking) throws IllegalStateException;
-
- public URLConnection getURLConnection();
+ public TextureSequence.TextureFrame getNextTexture(GL gl) throws IllegalStateException;
+
+ /** Return the stream location, as set by {@link #initStream(URI, int, int, int)}. */
+ public URI getURI();
/**
* <i>Warning:</i> Optional information, may not be supported by implementation.
- * @return the code of the video stream, if available
+ * @return the code of the video stream, if available
*/
public String getVideoCodec();
/**
* <i>Warning:</i> Optional information, may not be supported by implementation.
- * @return the code of the audio stream, if available
+ * @return the code of the audio stream, if available
*/
public String getAudioCodec();
@@ -210,47 +548,82 @@ public interface GLMediaPlayer extends TextureSequence {
* <i>Warning:</i> Optional information, may not be supported by implementation.
* @return the total number of video frames
*/
- public long getTotalFrames();
+ public int getVideoFrames();
+
+ /**
+ * <i>Warning:</i> Optional information, may not be supported by implementation.
+ * @return the total number of audio frames
+ */
+ public int getAudioFrames();
/**
* @return total duration of stream in msec.
*/
public int getDuration();
-
+
/**
* <i>Warning:</i> Optional information, may not be supported by implementation.
- * @return the overall bitrate of the stream.
+ * @return the overall bitrate of the stream.
*/
public long getStreamBitrate();
/**
* <i>Warning:</i> Optional information, may not be supported by implementation.
- * @return video bitrate
+ * @return video bitrate
*/
public int getVideoBitrate();
-
+
/**
* <i>Warning:</i> Optional information, may not be supported by implementation.
- * @return the audio bitrate
+ * @return the audio bitrate
*/
public int getAudioBitrate();
-
+
/**
* <i>Warning:</i> Optional information, may not be supported by implementation.
* @return the framerate of the video
*/
public float getFramerate();
+ /**
+ * Returns <code>true</code> if the video frame is oriented in
+ * OpenGL's coordinate system, <i>origin at bottom left</i>.
+ * <p>
+ * Otherwise returns <code>false</code>, i.e.
+ * video frame is oriented <i>origin at top left</i>.
+ * </p>
+ * <p>
+ * <code>false</code> is the default assumption for videos,
+ * but user shall not rely on.
+ * </p>
+ * <p>
+ * <code>false</code> GL orientation leads to
+ * {@link Texture#getMustFlipVertically()} == <code>true</code>,
+ * as reflected by all {@link TextureFrame}'s {@link Texture}s
+ * retrieved via {@link #getLastTexture()} or {@link #getNextTexture(GL)}.
+ * </p>
+ */
+ public boolean isGLOriented();
+
+ /** Returns the width of the video. */
public int getWidth();
+ /** Returns the height of the video. */
public int getHeight();
+ /** Returns a string represantation of this player, incl. state and audio/video details. */
+ @Override
public String toString();
+ /** Returns a string represantation of this player's performance values. */
+ public String getPerfString();
+
+ /** Adds a {@link GLMediaEventListener} to this player. */
public void addEventListener(GLMediaEventListener l);
+ /** Removes a {@link GLMediaEventListener} to this player. */
public void removeEventListener(GLMediaEventListener l);
- public GLMediaEventListener[] getEventListeners();
-
+ /** Return all {@link GLMediaEventListener} of this player. */
+ public GLMediaEventListener[] getEventListeners();
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java
index f09531f..248e265 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -29,27 +29,32 @@ package com.jogamp.opengl.util.av;
import jogamp.opengl.util.av.NullGLMediaPlayer;
-import com.jogamp.common.os.AndroidVersion;
-import com.jogamp.common.os.Platform;
import com.jogamp.common.util.ReflectionUtil;
public class GLMediaPlayerFactory {
private static final String AndroidGLMediaPlayerAPI14ClazzName = "jogamp.opengl.android.av.AndroidGLMediaPlayerAPI14";
private static final String FFMPEGMediaPlayerClazzName = "jogamp.opengl.util.av.impl.FFMPEGMediaPlayer";
+ private static final String OMXGLMediaPlayerClazzName = "jogamp.opengl.util.av.impl.OMXGLMediaPlayer";
private static final String isAvailableMethodName = "isAvailable";
-
+
public static GLMediaPlayer createDefault() {
final ClassLoader cl = GLMediaPlayerFactory.class.getClassLoader();
- GLMediaPlayer sink = create(cl, AndroidGLMediaPlayerAPI14ClazzName);
+ GLMediaPlayer sink = create(cl, OMXGLMediaPlayerClazzName);
+ if( null == sink ) {
+ sink = create(cl, AndroidGLMediaPlayerAPI14ClazzName);
+ }
if( null == sink ) {
sink = create(cl, FFMPEGMediaPlayerClazzName);
}
if( null == sink ) {
- sink = new NullGLMediaPlayer();
+ sink = createNull();
}
return sink;
}
-
+ public static GLMediaPlayer createNull() {
+ return new NullGLMediaPlayer();
+ }
+
public static GLMediaPlayer create(final ClassLoader cl, String implName) {
try {
if(((Boolean)ReflectionUtil.callStaticMethod(implName, isAvailableMethodName, null, null, cl)).booleanValue()) {
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 df1bbdf..77b14b4 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -28,41 +28,46 @@
package com.jogamp.opengl.util.awt;
import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.DataBuffer;
import java.awt.image.DataBufferInt;
+import java.awt.image.SinglePixelPackedSampleModel;
+import java.awt.image.WritableRaster;
import java.nio.Buffer;
import java.nio.IntBuffer;
import javax.media.opengl.GL;
-import javax.media.opengl.GL2GL3;
import com.jogamp.common.nio.Buffers;
import com.jogamp.opengl.util.GLPixelBuffer;
-import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes;
-/**
- * AWT {@link GLPixelBuffer} backed by an {@link BufferedImage} of type
+/**
+ * AWT {@link GLPixelBuffer} backed by an {@link BufferedImage} of type
* {@link BufferedImage#TYPE_INT_ARGB} or {@link BufferedImage#TYPE_INT_RGB}.
* <p>
* Implementation uses an array backed {@link IntBuffer}.
* </p>
* <p>
- * {@link AWTGLPixelBuffer} can be produced via {@link AWTGLPixelBufferProvider}'s
- * {@link AWTGLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocate(..)}.
+ * {@link AWTGLPixelBuffer} can be produced via {@link AWTGLPixelBufferProvider}'s
+ * {@link AWTGLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocate(..)}.
* </p>
* <p>
* See {@link AWTGLPixelBuffer#requiresNewBuffer(GL, int, int, int)} for {@link #allowRowStride} details.
* </p>
+ * <p>
+ * If using <code>allowRowStride == true</code>, user may needs to get the {@link #getAlignedImage(int, int) aligned image}
+ * since {@link #requiresNewBuffer(GL, int, int, int)} will allow different width in this case.
+ * </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);
- /** Allow {@link GL2GL3#GL_PACK_ROW_LENGTH}, or {@link GL2GL3#GL_UNPACK_ROW_LENGTH}. See {@link #requiresNewBuffer(GL, int, int, int)}. */
- public final boolean allowRowStride;
/** The underlying {@link BufferedImage}. */
public final BufferedImage image;
-
+
/**
+ *
* @param pixelAttributes the desired {@link GLPixelAttributes}
* @param width in pixels
* @param height in pixels
@@ -71,71 +76,80 @@ public class AWTGLPixelBuffer extends GLPixelBuffer {
* @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(GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, BufferedImage image,
+ public AWTGLPixelBuffer(GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, BufferedImage image,
Buffer buffer, boolean allowRowStride) {
- super(pixelAttributes, width, height, depth, pack, buffer);
- this.allowRowStride = allowRowStride;
+ super(pixelAttributes, width, height, depth, pack, buffer, allowRowStride);
this.image = image;
}
-
+
+ @Override
+ public void dispose() {
+ image.flush();
+ super.dispose();
+ }
+
/**
- * {@inheritDoc}
- * <p>
- * If <code>{@link #allowRowStride} = false</code>,
- * method returns <code>true</code> if the new size ≠ current size.
- * </p>
- * <p>
- * If <code>{@link #allowRowStride} = true</code>, see {@link AWTGLPixelBufferProvider#AWTGLPixelBufferProvider(boolean)},
- * method returns <code>true</code> only if the new size > current size. Assuming user utilizes the row-stride
- * when dealing w/ the data, i.e. {@link GL2GL3#GL_PACK_ROW_LENGTH}.
- * </p>
+ * Returns a width- and height-aligned image representation sharing data w/ {@link #image}.
+ * @param width
+ * @param height
+ * @return
+ * @throws IllegalArgumentException if requested size exceeds image size
*/
- @Override
- public boolean requiresNewBuffer(GL gl, int newWidth, int newHeight, int minByteSize) {
- if( !isValid() ) {
- return true;
+ public BufferedImage getAlignedImage(int width, int height) throws IllegalArgumentException {
+ if( width * height > image.getWidth() * image.getHeight() ) {
+ throw new IllegalArgumentException("Requested size exceeds image size: "+width+"x"+height+" > "+image.getWidth()+"x"+image.getHeight());
}
- if( allowRowStride && gl.isGL2GL3() ) {
- return width < newWidth || height < newHeight;
- } else {
- return width != newWidth || height != newHeight;
+ if( width == image.getWidth() ) {
+ if( height == image.getHeight() ) {
+ return image;
+ }
+ return image.getSubimage(0, 0, width, height);
}
+ final ColorModel cm = image.getColorModel();
+ final WritableRaster raster = image.getRaster();
+ final DataBuffer dataBuffer = raster.getDataBuffer();
+ final SinglePixelPackedSampleModel sppsm0 = (SinglePixelPackedSampleModel) raster.getSampleModel();
+ final SinglePixelPackedSampleModel sppsm1 = new SinglePixelPackedSampleModel(dataBuffer.getDataType(),
+ width, height, width /* scanLineStride */, sppsm0.getBitMasks());
+ final WritableRaster raster1 = WritableRaster.createWritableRaster(sppsm1, dataBuffer, null);
+ return new BufferedImage (cm, raster1, cm.isAlphaPremultiplied(), null);
}
-
+
@Override
- public void dispose() {
- image.flush();
- super.dispose();
- }
-
public StringBuilder toString(StringBuilder sb) {
sb = super.toString(sb);
sb.append(", allowRowStride ").append(allowRowStride).append(", image [").append(image.getWidth()).append("x").append(image.getHeight()).append(", ").append(image.toString()).append("]");
return sb;
}
+ @Override
public String toString() {
return "AWTGLPixelBuffer["+toString(null).toString()+"]";
}
-
+
/**
* Provider for {@link AWTGLPixelBuffer} instances.
*/
- public static class AWTGLPixelBufferProvider implements GLPixelBufferProvider {
- /** Allow {@link GL2GL3#GL_PACK_ROW_LENGTH}, or {@link GL2GL3#GL_UNPACK_ROW_LENGTH}. */
- public final boolean allowRowStride;
-
+ public static class AWTGLPixelBufferProvider implements GLPixelBufferProvider {
+ private final boolean allowRowStride;
+
/**
- * @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. See {@link AWTGLPixelBuffer#requiresNewBuffer(GL, int, int, int)}.
+ * @param allowRowStride If <code>true</code>, allow row-stride, otherwise not.
+ * See {@link #getAllowRowStride()} and {@link AWTGLPixelBuffer#requiresNewBuffer(GL, int, int, int)}.
+ * If <code>true</code>, user shall decide whether to use a {@link AWTGLPixelBuffer#getAlignedImage(int, int) width-aligned image}.
*/
public AWTGLPixelBufferProvider(boolean allowRowStride) {
this.allowRowStride = allowRowStride;
}
@Override
+ public boolean getAllowRowStride() { return allowRowStride; }
+
+ @Override
public GLPixelAttributes getAttributes(GL gl, int componentCount) {
return 4 == componentCount ? awtPixelAttributesIntRGBA4 : awtPixelAttributesIntRGB3;
}
-
+
/**
* {@inheritDoc}
* <p>
@@ -150,28 +164,28 @@ public class AWTGLPixelBuffer extends GLPixelBuffer {
return new AWTGLPixelBuffer(pixelAttributes, width, height, depth, pack, image, ibuffer, allowRowStride);
}
}
-
+
/**
* 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}
+ * A new {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, 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.
+ * 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;
-
+
/**
* @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. See {@link AWTGLPixelBuffer#requiresNewBuffer(GL, int, int, int)}.
*/
public SingleAWTGLPixelBufferProvider(boolean allowRowStride) {
super(allowRowStride);
}
-
+
/**
* {@inheritDoc}
* <p>
@@ -182,7 +196,7 @@ public class AWTGLPixelBuffer extends GLPixelBuffer {
public AWTGLPixelBuffer allocate(GL gl, GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize) {
if( 4 == pixelAttributes.componentCount ) {
if( null == singleRGBA4 || singleRGBA4.requiresNewBuffer(gl, width, height, minByteSize) ) {
- singleRGBA4 = allocateImpl(pixelAttributes, width, height, depth, pack, minByteSize);
+ singleRGBA4 = allocateImpl(pixelAttributes, width, height, depth, pack, minByteSize);
}
return singleRGBA4;
} else {
@@ -192,33 +206,35 @@ public class AWTGLPixelBuffer extends GLPixelBuffer {
return singleRGB3;
}
}
-
+
private AWTGLPixelBuffer allocateImpl(GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize) {
final BufferedImage image = new BufferedImage(width, height, 4 == pixelAttributes.componentCount ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB);
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(pixelAttributes, width, height, depth, pack, 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, GLPixelAttributes, int, int, int, boolean, int) allocated} {@link AWTGLPixelBuffer} w/ {@link GLPixelAttributes#componentCount}. */
+ @Override
public AWTGLPixelBuffer getSingleBuffer(GLPixelAttributes pixelAttributes) {
return 4 == pixelAttributes.componentCount ? singleRGBA4 : singleRGB3;
}
-
- /**
+
+ /**
* Initializes the single {@link AWTGLPixelBuffer} w/ a given size, if not yet {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated}.
* @return the newly initialized single {@link AWTGLPixelBuffer}, or null if already allocated.
*/
+ @Override
public AWTGLPixelBuffer initSingleton(int componentCount, int width, int height, int depth, boolean pack) {
if( 4 == componentCount ) {
if( null != singleRGBA4 ) {
- return null;
+ return null;
}
singleRGBA4 = allocateImpl(AWTGLPixelBuffer.awtPixelAttributesIntRGBA4, width, height, depth, pack, 0);
return singleRGBA4;
} else {
if( null != singleRGB3 ) {
- return null;
+ return null;
}
singleRGB3 = allocateImpl(AWTGLPixelBuffer.awtPixelAttributesIntRGB3, width, height, depth, pack, 0);
return singleRGB3;
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 0edd53c..f5d31a1 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -42,29 +42,20 @@ import com.jogamp.opengl.util.GLReadBufferUtil;
public class AWTGLReadBufferUtil extends GLReadBufferUtil {
/**
* {@inheritDoc}
- *
+ *
* @param alpha
*/
public AWTGLReadBufferUtil(GLProfile glp, boolean alpha) {
- super(new AWTGLPixelBuffer.AWTGLPixelBufferProvider( glp.isGL2GL3() /* allowRowStride */ ), alpha, false);
+ super(new AWTGLPixelBuffer.AWTGLPixelBufferProvider( glp.isGL2ES3() /* allowRowStride */ ), alpha, false);
}
public AWTGLPixelBuffer getAWTGLPixelBuffer() { return (AWTGLPixelBuffer)this.getPixelBuffer(); }
-
+
public BufferedImage readPixelsToBufferedImage(GL gl, boolean awtOrientation) {
- if( readPixels(gl, awtOrientation) ) {
- final BufferedImage image = getAWTGLPixelBuffer().image;
- if( getTextureData().getMustFlipVertically() ) {
- ImageUtil.flipImageVertically(image);
- }
- return image;
- }
- return null;
+ return readPixelsToBufferedImage(gl, 0, 0, 0, 0, awtOrientation);
}
public BufferedImage readPixelsToBufferedImage(GL gl, int inX, int inY, int inWidth, int inHeight, boolean awtOrientation) {
- final int[] ioWidth = new int[] { inWidth };
- final int[] ioHeight= new int[] { inHeight };
- if( readPixels(gl, inX, inY, ioWidth, ioHeight, awtOrientation) ) {
+ if( readPixels(gl, inX, inY, inWidth, inHeight, awtOrientation) ) {
final BufferedImage image = getAWTGLPixelBuffer().image;
if( getTextureData().getMustFlipVertically() ) {
ImageUtil.flipImageVertically(image);
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java b/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java
index a3139b1..df3cc4a 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -54,7 +54,7 @@ public class ImageUtil {
WritableRaster raster = image.getRaster();
Object scanline1 = null;
Object scanline2 = null;
-
+
for (int i = 0; i < image.getHeight() / 2; i++) {
scanline1 = raster.getDataElements(0, i, image.getWidth(), 1, scanline1);
scanline2 = raster.getDataElements(0, image.getHeight() - i - 1, image.getWidth(), 1, scanline2);
@@ -97,21 +97,21 @@ public class ImageUtil {
if (thumbWidth > image.getWidth()) {
throw new IllegalArgumentException("Thumbnail width must be greater than image width");
}
-
+
if (thumbWidth == image.getWidth()) {
return image;
}
-
+
float ratio = (float) image.getWidth() / (float) image.getHeight();
int width = image.getWidth();
BufferedImage thumb = image;
-
+
do {
width /= 2;
if (width < thumbWidth) {
width = thumbWidth;
}
-
+
BufferedImage temp = createCompatibleImage(width, (int) (width / ratio));
Graphics2D g2 = temp.createGraphics();
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
@@ -120,7 +120,7 @@ public class ImageUtil {
g2.dispose();
thumb = temp;
} while (width != thumbWidth);
-
+
return thumb;
}
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 73d694c..931f598 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2006 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java b/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java
index 2ffc272..f686b67 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 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:
- *
+ *
* - 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
@@ -29,7 +29,7 @@
* 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.
@@ -56,18 +56,18 @@ import com.jogamp.opengl.GLExtensions;
import com.jogamp.opengl.util.GLPixelStorageModes;
import com.jogamp.opengl.util.TGAWriter;
-/**
+/**
* Utilities for taking screenshots of OpenGL applications.
- * @deprecated Please consider using {@link com.jogamp.opengl.util.GLReadBufferUtil},
- * which is AWT independent and does not require a CPU based vertical image flip
+ * @deprecated Please consider using {@link com.jogamp.opengl.util.GLReadBufferUtil},
+ * which is AWT independent and does not require a CPU based vertical image flip
* in case drawable {@link GLDrawable#isGLOriented() is in OpenGL orientation}.
- * Further more you may use {@link AWTGLReadBufferUtil} to read out
+ * Further more you may use {@link AWTGLReadBufferUtil} to read out
* the framebuffer into a BufferedImage for further AWT processing.
*/
public class Screenshot {
private Screenshot() {}
- /**
+ /**
* Takes a fast screenshot of the current OpenGL drawable to a Targa
* file. Requires the OpenGL context for the desired drawable to be
* current. Takes the screenshot from the last assigned read buffer,
@@ -94,7 +94,7 @@ public class Screenshot {
writeToTargaFile(file, width, height, false);
}
- /**
+ /**
* Takes a fast screenshot of the current OpenGL drawable to a Targa
* file. Requires the OpenGL context for the desired drawable to be
* current. Takes the screenshot from the last assigned read buffer,
@@ -122,7 +122,7 @@ public class Screenshot {
writeToTargaFile(file, 0, 0, width, height, alpha);
}
- /**
+ /**
* Takes a fast screenshot of the current OpenGL drawable to a Targa
* file. Requires the OpenGL context for the desired drawable to be
* current. Takes the screenshot from the last assigned read buffer,
@@ -410,5 +410,5 @@ public class Screenshot {
if (!gl.isExtensionAvailable(GLExtensions.EXT_abgr)) {
throw new IllegalArgumentException("Saving alpha channel requires GL_EXT_abgr");
}
- }
+ }
}
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 c671415..46dc730 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
@@ -129,7 +129,7 @@ import jogamp.opengl.Debug;
*/
public class TextRenderer {
private static final boolean DEBUG;
-
+
static {
Debug.initSingleton();
DEBUG = Debug.isPropertyDefined("jogl.debug.TextRenderer", true);
@@ -159,20 +159,20 @@ public class TextRenderer {
static final int kTotalBufferSizeBytesTex = kTotalBufferSizeCoordsTex * 4;
static final int kSizeInBytes_OneVertices_VertexData = kCoordsPerVertVerts * 4;
static final int kSizeInBytes_OneVertices_TexData = kCoordsPerVertTex * 4;
- private Font font;
- private boolean antialiased;
- private boolean useFractionalMetrics;
+ private final Font font;
+ private final boolean antialiased;
+ private final boolean useFractionalMetrics;
// Whether we're attempting to use automatic mipmap generation support
private boolean mipmap;
private RectanglePacker packer;
private boolean haveMaxSize;
- private RenderDelegate renderDelegate;
+ private final RenderDelegate renderDelegate;
private TextureRenderer cachedBackingStore;
private Graphics2D cachedGraphics;
private FontRenderContext cachedFontRenderContext;
- private Map /*<String,Rect>*/ stringLocations = new HashMap /*<String,Rect>*/();
- private GlyphProducer mGlyphProducer;
+ private final Map<String, Rect> stringLocations = new HashMap<String, Rect>();
+ private final GlyphProducer mGlyphProducer;
private int numRenderCycles;
@@ -200,10 +200,10 @@ public class TextRenderer {
// Debugging purposes only
private boolean debugged;
Pipelined_QuadRenderer mPipelinedQuadRenderer;
-
+
//emzic: added boolean flag
private boolean useVertexArrays = true;
-
+
//emzic: added boolean flag
private boolean isExtensionAvailable_GL_VERSION_1_5;
private boolean checkFor_isExtensionAvailable_GL_VERSION_1_5;
@@ -335,9 +335,9 @@ public class TextRenderer {
is made to ensure an accurate bound. */
public Rectangle2D getBounds(CharSequence str) {
// FIXME: this should be more optimized and use the glyph cache
- Rect r = null;
+ Rect r = stringLocations.get(str);
- if ((r = (Rect) stringLocations.get(str)) != null) {
+ if (r != null) {
TextData data = (TextData) r.getUserData();
// Reconstitute the Java 2D results based on the cached values
@@ -707,7 +707,7 @@ public class TextRenderer {
/**
* emzic: here the call to glBindBuffer crashes on certain graphicscard/driver combinations
* this is why the ugly try-catch block has been added, which falls back to the old textrenderer
- *
+ *
* @param ortho
* @throws GLException
*/
@@ -750,11 +750,12 @@ public class TextRenderer {
}
private void clearUnusedEntries() {
- final java.util.List deadRects = new ArrayList /*<Rect>*/();
+ final java.util.List<Rect> deadRects = new ArrayList<Rect>();
// Iterate through the contents of the backing store, removing
// text strings that haven't been used recently
packer.visit(new RectVisitor() {
+ @Override
public void visit(Rect rect) {
TextData data = (TextData) rect.getUserData();
@@ -766,8 +767,7 @@ public class TextRenderer {
}
});
- for (Iterator iter = deadRects.iterator(); iter.hasNext();) {
- Rect r = (Rect) iter.next();
+ for (Rect r : deadRects) {
packer.remove(r);
stringLocations.remove(((TextData) r.getUserData()).string());
@@ -806,9 +806,7 @@ public class TextRenderer {
private void internal_draw3D(CharSequence str, float x, float y, float z,
float scaleFactor) {
- List/*<Glyph>*/ glyphs = mGlyphProducer.getGlyphs(str);
- for (Iterator iter = glyphs.iterator(); iter.hasNext(); ) {
- Glyph glyph = (Glyph) iter.next();
+ for (Glyph glyph : mGlyphProducer.getGlyphs(str)) {
float advance = glyph.draw3D(x, y, z, scaleFactor);
x += advance * scaleFactor;
}
@@ -830,7 +828,7 @@ public class TextRenderer {
}
// Look up the string on the backing store
- Rect rect = (Rect) stringLocations.get(curStr);
+ Rect rect = stringLocations.get(curStr);
if (rect == null) {
// Rasterize this string and place it on the backing store
@@ -891,7 +889,7 @@ public class TextRenderer {
data.markUsed();
Rectangle2D origRect = data.origRect();
-
+
// Align the leftmost point of the baseline to the (x, y, z) coordinate requested
renderer.draw3DRect(x - (scaleFactor * data.origOriginX()),
y - (scaleFactor * ((float) origRect.getHeight() - data.origOriginY())), z,
@@ -907,18 +905,20 @@ public class TextRenderer {
private void debug(GL gl) {
dbgFrame = new Frame("TextRenderer Debug Output");
- GLCanvas dbgCanvas = new GLCanvas(new GLCapabilities(gl.getGLProfile()), null,
- GLContext.getCurrent(), null);
+ GLCanvas dbgCanvas = new GLCanvas(new GLCapabilities(gl.getGLProfile()));
+ dbgCanvas.setSharedContext(GLContext.getCurrent());
dbgCanvas.addGLEventListener(new DebugListener(gl, dbgFrame));
dbgFrame.add(dbgCanvas);
final FPSAnimator anim = new FPSAnimator(dbgCanvas, 10);
dbgFrame.addWindowListener(new WindowAdapter() {
+ @Override
public void windowClosing(WindowEvent e) {
// Run this on another thread than the AWT event queue to
// make sure the call to Animator.stop() completes before
// exiting
new Thread(new Runnable() {
+ @Override
public void run() {
anim.stop();
}
@@ -1009,12 +1009,14 @@ public class TextRenderer {
mCurrentIndex = 0;
}
+ @Override
public char last() {
mCurrentIndex = Math.max(0, mLength - 1);
return current();
}
+ @Override
public char current() {
if ((mLength == 0) || (mCurrentIndex >= mLength)) {
return CharacterIterator.DONE;
@@ -1023,36 +1025,43 @@ public class TextRenderer {
return mSequence.charAt(mCurrentIndex);
}
+ @Override
public char next() {
mCurrentIndex++;
return current();
}
+ @Override
public char previous() {
mCurrentIndex = Math.max(mCurrentIndex - 1, 0);
return current();
}
+ @Override
public char setIndex(int position) {
mCurrentIndex = position;
return current();
}
+ @Override
public int getBeginIndex() {
return 0;
}
+ @Override
public int getEndIndex() {
return mLength;
}
+ @Override
public int getIndex() {
return mCurrentIndex;
}
+ @Override
public Object clone() {
CharSequenceIterator iter = new CharSequenceIterator(mSequence);
iter.mCurrentIndex = mCurrentIndex;
@@ -1060,6 +1069,7 @@ public class TextRenderer {
return iter;
}
+ @Override
public char first() {
if (mLength == 0) {
return CharacterIterator.DONE;
@@ -1075,7 +1085,7 @@ public class TextRenderer {
static class TextData {
// Back-pointer to String this TextData describes, if it
// represents a String rather than a single glyph
- private String str;
+ private final String str;
// If this TextData represents a single glyph, this is its
// unicode ID
@@ -1086,7 +1096,7 @@ public class TextRenderer {
// 2D coordinate system) at which the string must be rasterized in
// order to fit within the rectangle -- the leftmost point of the
// baseline.
- private Point origin;
+ private final Point origin;
// This represents the pre-normalized rectangle, which fits
// within the rectangle on the backing store. We keep a
@@ -1094,7 +1104,7 @@ public class TextRenderer {
// prevent bleeding of adjacent letters when using GL_LINEAR
// filtering for rendering. The origin of this rectangle is
// equivalent to the origin above.
- private Rectangle2D origRect;
+ private final Rectangle2D origRect;
private boolean used; // Whether this text was used recently
@@ -1143,6 +1153,7 @@ public class TextRenderer {
class Manager implements BackingStoreManager {
private Graphics2D g;
+ @Override
public Object allocateBackingStore(int w, int h) {
// FIXME: should consider checking Font's attributes to see
// whether we're likely to need to support a full RGBA backing
@@ -1165,10 +1176,12 @@ public class TextRenderer {
return renderer;
}
+ @Override
public void deleteBackingStore(Object backingStore) {
((TextureRenderer) backingStore).dispose();
}
+ @Override
public boolean preExpand(Rect cause, int attemptNumber) {
// Only try this one time; clear out potentially obsolete entries
// NOTE: this heuristic and the fact that it clears the used bit
@@ -1204,6 +1217,7 @@ public class TextRenderer {
return false;
}
+ @Override
public boolean additionFailed(Rect cause, int attemptNumber) {
// Heavy hammer -- might consider doing something different
packer.clear();
@@ -1222,10 +1236,12 @@ public class TextRenderer {
return false;
}
+ @Override
public boolean canCompact() {
return true;
}
+ @Override
public void beginMovement(Object oldBackingStore, Object newBackingStore) {
// Exit the begin / end pair if necessary
if (inBeginEndPair) {
@@ -1259,6 +1275,7 @@ public class TextRenderer {
g = newRenderer.createGraphics();
}
+ @Override
public void move(Object oldBackingStore, Rect oldLocation,
Object newBackingStore, Rect newLocation) {
TextureRenderer oldRenderer = (TextureRenderer) oldBackingStore;
@@ -1280,6 +1297,7 @@ public class TextRenderer {
}
}
+ @Override
public void endMovement(Object oldBackingStore, Object newBackingStore) {
g.dispose();
@@ -1316,10 +1334,12 @@ public class TextRenderer {
}
public static class DefaultRenderDelegate implements RenderDelegate {
+ @Override
public boolean intensityOnly() {
return true;
}
+ @Override
public Rectangle2D getBounds(CharSequence str, Font font,
FontRenderContext frc) {
return getBounds(font.createGlyphVector(frc,
@@ -1327,20 +1347,24 @@ public class TextRenderer {
frc);
}
+ @Override
public Rectangle2D getBounds(String str, Font font,
FontRenderContext frc) {
return getBounds(font.createGlyphVector(frc, str), frc);
}
+ @Override
public Rectangle2D getBounds(GlyphVector gv, FontRenderContext frc) {
return gv.getVisualBounds();
}
+ @Override
public void drawGlyphVector(Graphics2D graphics, GlyphVector str,
int x, int y) {
graphics.drawGlyphVector(str, x, y);
}
+ @Override
public void draw(Graphics2D graphics, String str, int x, int y) {
graphics.drawString(str, x, y);
}
@@ -1351,7 +1375,7 @@ public class TextRenderer {
//
// A temporary to prevent excessive garbage creation
- private char[] singleUnicode = new char[1];
+ private final char[] singleUnicode = new char[1];
/** A Glyph represents either a single unicode glyph or a
substring of characters to be drawn. The reason for the dual
@@ -1473,10 +1497,10 @@ public class TextRenderer {
int width = (int) origRect.getWidth();
int height = (int) origRect.getHeight();
- float tx1 = xScale * (float) texturex / (float) renderer.getWidth();
+ float tx1 = xScale * texturex / renderer.getWidth();
float ty1 = yScale * (1.0f -
((float) texturey / (float) renderer.getHeight()));
- float tx2 = xScale * (float) (texturex + width) / (float) renderer.getWidth();
+ float tx2 = xScale * (texturex + width) / renderer.getWidth();
float ty2 = yScale * (1.0f -
((float) (texturey + height) / (float) renderer.getHeight()));
@@ -1561,9 +1585,9 @@ public class TextRenderer {
class GlyphProducer {
final int undefined = -2;
FontRenderContext fontRenderContext;
- List/*<Glyph>*/ glyphsOutput = new ArrayList/*<Glyph>*/();
- HashMap/*<String, GlyphVector>*/fullGlyphVectorCache = new HashMap/*<String, GlyphVector>*/();
- HashMap/*<Character, GlyphMetrics>*/glyphMetricsCache = new HashMap/*<Character, GlyphMetrics>*/();
+ List<Glyph> glyphsOutput = new ArrayList<Glyph>();
+ HashMap<String, GlyphVector> fullGlyphVectorCache = new HashMap<String, GlyphVector>();
+ HashMap<Character, GlyphMetrics> glyphMetricsCache = new HashMap<Character, GlyphMetrics>();
// The mapping from unicode character to font-specific glyph ID
int[] unicodes2Glyphs;
// The mapping from glyph ID to Glyph
@@ -1577,10 +1601,10 @@ public class TextRenderer {
clearAllCacheEntries();
}
- public List/*<Glyph>*/ getGlyphs(CharSequence inString) {
+ public List<Glyph> getGlyphs(CharSequence inString) {
glyphsOutput.clear();
GlyphVector fullRunGlyphVector;
- fullRunGlyphVector = (GlyphVector) fullGlyphVectorCache.get(inString.toString());
+ fullRunGlyphVector = fullGlyphVectorCache.get(inString.toString());
if (fullRunGlyphVector == null) {
iter.initFromCharSequence(inString);
fullRunGlyphVector = font.createGlyphVector(getFontRenderContext(), iter);
@@ -1597,7 +1621,7 @@ public class TextRenderer {
int i = 0;
while (i < lengthInGlyphs) {
Character letter = CharacterCache.valueOf(inString.charAt(i));
- GlyphMetrics metrics = (GlyphMetrics) glyphMetricsCache.get(letter);
+ GlyphMetrics metrics = glyphMetricsCache.get(letter);
if (metrics == null) {
metrics = fullRunGlyphVector.getGlyphMetrics(i);
glyphMetricsCache.put(letter, metrics);
@@ -1715,7 +1739,7 @@ public class TextRenderer {
return glyph;
}
}
-
+
private static class CharacterCache {
private CharacterCache() {
}
@@ -1805,7 +1829,7 @@ public class TextRenderer {
GL2 gl = GLContext.getCurrentGL().getGL2();
TextureRenderer renderer = getBackingStore();
- Texture texture = renderer.getTexture(); // triggers texture uploads. Maybe this should be more obvious?
+ renderer.getTexture(); // triggers texture uploads. Maybe this should be more obvious?
mVertCoords.rewind();
mTexCoords.rewind();
@@ -1848,7 +1872,7 @@ public class TextRenderer {
private void drawIMMEDIATE() {
if (mOutstandingGlyphsVerticesPipeline > 0) {
TextureRenderer renderer = getBackingStore();
- Texture texture = renderer.getTexture(); // triggers texture uploads. Maybe this should be more obvious?
+ renderer.getTexture(); // triggers texture uploads. Maybe this should be more obvious?
GL2 gl = GLContext.getCurrentGL().getGL2();
gl.glBegin(GL2.GL_QUADS);
@@ -1896,6 +1920,7 @@ public class TextRenderer {
this.frame = frame;
}
+ @Override
public void display(GLAutoDrawable drawable) {
GL2 gl = GLContext.getCurrentGL().getGL2();
gl.glClear(GL2.GL_DEPTH_BUFFER_BIT | GL2.GL_COLOR_BUFFER_BIT);
@@ -1913,6 +1938,7 @@ public class TextRenderer {
if ((frame.getWidth() != w) || (frame.getHeight() != h)) {
EventQueue.invokeLater(new Runnable() {
+ @Override
public void run() {
frame.setSize(w, h);
}
@@ -1920,6 +1946,7 @@ public class TextRenderer {
}
}
+ @Override
public void dispose(GLAutoDrawable drawable) {
glu.destroy();
glu=null;
@@ -1927,9 +1954,11 @@ public class TextRenderer {
}
// Unused methods
+ @Override
public void init(GLAutoDrawable drawable) {
}
+ @Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width,
int height) {
}
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 922fc69..26e1eb0 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2006 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -407,7 +407,7 @@ public class TextureRenderer {
this.a = a;
gl.glColor4f(this.r, this.g, this.b, this.a);
- }
+ }
private float[] compArray;
/** Changes the current color of this TextureRenderer to the
@@ -437,7 +437,7 @@ public class TextureRenderer {
@param screenx the on-screen x coordinate at which to draw the rectangle
@param screeny the on-screen y coordinate (relative to lower left) at
which to draw the rectangle
-
+
@throws GLException If an OpenGL context is not current when this method is called
*/
public void drawOrthoRect(int screenx, int screeny) throws GLException {
@@ -459,7 +459,7 @@ public class TextureRenderer {
rectangle to draw
@param width the width of the rectangle to draw
@param height the height of the rectangle to draw
-
+
@throws GLException If an OpenGL context is not current when this method is called
*/
public void drawOrthoRect(int screenx, int screeny,
@@ -490,7 +490,7 @@ public class TextureRenderer {
@param height the height in texels of the rectangle to draw
@param scaleFactor the scale factor to apply (multiplicatively)
to the size of the drawn rectangle
-
+
@throws GLException If an OpenGL context is not current when this method is called
*/
public void draw3DRect(float x, float y, float z,
@@ -518,7 +518,7 @@ public class TextureRenderer {
OpenGL texture to the screen, if the application intends to draw
them as a flat overlay on to the screen. Must be used if {@link
#beginOrthoRendering} is used to set up the rendering stage for
- this overlay.
+ this overlay.
@throws GLException If an OpenGL context is not current when this method is called
*/
@@ -552,7 +552,7 @@ public class TextureRenderer {
private void beginRendering(boolean ortho, int width, int height, boolean disableDepthTestForOrtho) {
GL2 gl = GLContext.getCurrentGL().getGL2();
- int attribBits =
+ int attribBits =
GL2.GL_ENABLE_BIT | GL2.GL_TEXTURE_BIT | GL2.GL_COLOR_BUFFER_BIT |
(ortho ? (GL2.GL_DEPTH_BUFFER_BIT | GL2.GL_TRANSFORM_BIT) : 0);
gl.glPushAttrib(attribBits);
@@ -622,7 +622,7 @@ public class TextureRenderer {
// Infer the internal format if not an intensity texture
int internalFormat = (intensity ? GL2.GL_INTENSITY : 0);
- int imageType =
+ int imageType =
(intensity ? BufferedImage.TYPE_BYTE_GRAY :
(alpha ? BufferedImage.TYPE_INT_ARGB_PRE : BufferedImage.TYPE_INT_RGB));
image = new BufferedImage(width, height, imageType);
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java
index 34685e1..e8df6aa 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -41,8 +41,8 @@ package com.jogamp.opengl.util.gl2;
/* Copyright (c) Mark J. Kilgard, 1994, 1998. */
-/* This program is freely distributable without licensing fees
- and is provided without guarantee or warrantee expressed or
+/* This program is freely distributable without licensing fees
+ and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
class BitmapCharRec {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java
index 18f7d3b..d4ee12b 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -41,8 +41,8 @@ package com.jogamp.opengl.util.gl2;
/* Copyright (c) Mark J. Kilgard, 1994, 1998. */
-/* This program is freely distributable without licensing fees
- and is provided without guarantee or warrantee expressed or
+/* This program is freely distributable without licensing fees
+ and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
class BitmapFontRec {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java
index 9ad95ec..5e26e0d 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -41,8 +41,8 @@ package com.jogamp.opengl.util.gl2;
/* Copyright (c) Mark J. Kilgard, 1994, 1998. */
-/* This program is freely distributable without licensing fees
- and is provided without guarantee or warrantee expressed or
+/* This program is freely distributable without licensing fees
+ and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
class CoordRec {
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 010ce66..42529f3 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -163,7 +163,7 @@ public class GLUT {
public void glutSolidCylinder(double radius, double height, int slices, int stacks) {
GL2 gl = GLUgl2.getCurrentGL2();
-
+
// Prepare table of points for drawing end caps
double [] x = new double[slices];
double [] y = new double[slices];
@@ -174,7 +174,7 @@ public class GLUT {
x[i] = Math.cos(angle) * radius;
y[i] = Math.sin(angle) * radius;
}
-
+
// Draw bottom cap
gl.glBegin(GL2.GL_TRIANGLE_FAN);
gl.glNormal3d(0,0,-1);
@@ -184,7 +184,7 @@ public class GLUT {
}
gl.glVertex3d(x[0], y[0], 0);
gl.glEnd();
-
+
// Draw top cap
gl.glBegin(GL2.GL_TRIANGLE_FAN);
gl.glNormal3d(0,0,1);
@@ -194,7 +194,7 @@ public class GLUT {
}
gl.glVertex3d(x[0], y[0], height);
gl.glEnd();
-
+
// Draw walls
quadObjInit(glu);
glu.gluQuadricDrawStyle(quadObj, GLU.GLU_FILL);
@@ -262,7 +262,7 @@ public class GLUT {
/**
* Renders the teapot as a solid shape of the specified size. The teapot is
* created in a way that replicates the C GLUT implementation.
- *
+ *
* @param scale
* the factor by which to scale the teapot
*/
@@ -278,7 +278,7 @@ public class GLUT {
* instead of the y=-1 plane). Both surface normals and texture coordinates
* for the teapot are generated. The teapot is generated with OpenGL
* evaluators.
- *
+ *
* @param scale
* the factor by which to scale the teapot
* @param cStyle
@@ -292,14 +292,14 @@ public class GLUT {
/**
* Renders the teapot as a wireframe shape of the specified size. The teapot
* is created in a way that replicates the C GLUT implementation.
- *
+ *
* @param scale
* the factor by which to scale the teapot
*/
public void glutWireTeapot(double scale) {
glutWireTeapot(scale, true);
}
-
+
/**
* Renders the teapot as a wireframe shape of the specified size. The teapot
* can either be created in a way that is backward-compatible with the
@@ -308,7 +308,7 @@ public class GLUT {
* plane, instead of the y=-1 plane). Both surface normals and texture
* coordinates for the teapot are generated. The teapot is generated with
* OpenGL evaluators.
- *
+ *
* @param scale
* the factor by which to scale the teapot
* @param cStyle
@@ -356,7 +356,7 @@ public class GLUT {
int[] skiprows = new int[1];
int[] skippixels = new int[1];
int[] alignment = new int[1];
- beginBitmap(gl,
+ beginBitmap(gl,
swapbytes,
lsbfirst,
rowlength,
@@ -367,7 +367,7 @@ public class GLUT {
for (int i = 0; i < len; i++) {
bitmapCharacterImpl(gl, font, string.charAt(i));
}
- endBitmap(gl,
+ endBitmap(gl,
swapbytes,
lsbfirst,
rowlength,
@@ -502,7 +502,7 @@ public class GLUT {
gl.glEnd( );
}
}
-
+
/**
This function draws a solid-shaded dodecahedron
whose facets are rhombic and
@@ -522,7 +522,7 @@ public class GLUT {
}
gl.glEnd( );
}
-
+
//----------------------------------------------------------------------
// Internals only below this point
//
@@ -879,7 +879,7 @@ public class GLUT {
}
/* rhombic dodecahedron data: */
-
+
private static final double rdod_r[][] =
{
{ 0.0, 0.0, 1.0 },
@@ -897,7 +897,7 @@ public class GLUT {
{ 0.000000000000, -0.707106781187, -0.5 },
{ 0.0, 0.0, -1.0 }
};
-
+
private static final int rdod_v[][] =
{
{ 0, 1, 5, 2 },
@@ -913,7 +913,7 @@ public class GLUT {
{ 7, 11, 13, 12 },
{ 8, 12, 13, 9 }
};
-
+
private static final double rdod_n[][] =
{
{ 0.353553390594, 0.353553390594, 0.5 },
@@ -929,7 +929,7 @@ public class GLUT {
{ -0.353553390594, -0.353553390594, -0.5 },
{ 0.353553390594, -0.353553390594, -0.5 }
};
-
+
/* tetrahedron data: */
private static final float T = 1.73205080756887729f;
@@ -1124,7 +1124,7 @@ public class GLUT {
float[] r = new float[4*4*3];
float[] s = new float[4*4*3];
int i, j, k, l;
-
+
gl.glPushAttrib(GL2.GL_ENABLE_BIT | GL2.GL_EVAL_BIT | GL2.GL_POLYGON_BIT);
gl.glEnable(GL2.GL_AUTO_NORMAL);
gl.glEnable(GL2.GL_NORMALIZE);
@@ -1183,7 +1183,7 @@ public class GLUT {
gl.glPopMatrix();
gl.glPopAttrib();
}
-
+
private static void evaluateTeapotMesh(GL2 gl,
int grid,
int type,
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap8x13.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap8x13.java
index 07ded65..c244837 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap8x13.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap8x13.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap9x15.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap9x15.java
index 5d357f3..62af3b6 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap9x15.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap9x15.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica10.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica10.java
index b9c7e6e..5f06d69 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica10.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica10.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica12.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica12.java
index bc86f62..8326d64 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica12.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica12.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica18.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica18.java
index 1b2e69b..cb11f6b 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica18.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica18.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman10.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman10.java
index f753b56..17cbd07 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman10.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman10.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman24.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman24.java
index 073e6e6..9cc2bdc 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman24.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman24.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java
index b829692..3587ca9 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java
index 94fa1c4..cf51ddd 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java
index af3d538..515212f 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -41,8 +41,8 @@ package com.jogamp.opengl.util.gl2;
/* Copyright (c) Mark J. Kilgard, 1994, 1998. */
-/* This program is freely distributable without licensing fees
- and is provided without guarantee or warrantee expressed or
+/* This program is freely distributable without licensing fees
+ and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
class StrokeCharRec {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java
index d3195f2..5335c85 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -41,8 +41,8 @@ package com.jogamp.opengl.util.gl2;
/* Copyright (c) Mark J. Kilgard, 1994, 1998. */
-/* This program is freely distributable without licensing fees
- and is provided without guarantee or warrantee expressed or
+/* This program is freely distributable without licensing fees
+ and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
class StrokeFontRec {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java
index 8796e8b..b0c91c6 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -41,14 +41,14 @@ package com.jogamp.opengl.util.gl2;
/* Copyright (c) Mark J. Kilgard, 1994, 1998. */
-/* This program is freely distributable without licensing fees
- and is provided without guarantee or warrantee expressed or
+/* This program is freely distributable without licensing fees
+ and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
class StrokeRec {
public int num_coords;
public CoordRec[] coord;
-
+
public StrokeRec(int num_coords,
CoordRec[] coord) {
this.num_coords = num_coords;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/TileRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/TileRenderer.java
deleted file mode 100644
index 714c134..0000000
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/TileRenderer.java
+++ /dev/null
@@ -1,601 +0,0 @@
-package com.jogamp.opengl.util.gl2;
-
-import java.awt.Dimension;
-import java.nio.Buffer;
-
-import javax.media.opengl.*;
-import javax.media.opengl.glu.*;
-import javax.media.opengl.glu.gl2.*;
-
-/**
- * A fairly direct port of Brian Paul's tile rendering library, found
- * at <a href = "http://www.mesa3d.org/brianp/TR.html">
- * http://www.mesa3d.org/brianp/TR.html </a> . I've java-fied it, but
- * the functionality is the same.
- *
- * Original code Copyright (C) 1997-2005 Brian Paul. Licensed under
- * BSD-compatible terms with permission of the author. See LICENSE.txt
- * for license information.
- *
- * @author ryanm
- */
-public class TileRenderer
-{
- private static final int DEFAULT_TILE_WIDTH = 256;
-
- private static final int DEFAULT_TILE_HEIGHT = 256;
-
- private static final int DEFAULT_TILE_BORDER = 0;
-
- //
- // Enumeration flags for accessing variables
- //
- // @author ryanm
- //
-
- /**
- * The width of a tile
- */
- public static final int TR_TILE_WIDTH = 0;
- /**
- * The height of a tile
- */
- public static final int TR_TILE_HEIGHT = 1;
- /**
- * The width of the border around the tiles
- */
- public static final int TR_TILE_BORDER = 2;
- /**
- * The width of the final image
- */
- public static final int TR_IMAGE_WIDTH = 3;
- /**
- * The height of the final image
- */
- public static final int TR_IMAGE_HEIGHT = 4;
- /**
- * The number of rows of tiles
- */
- public static final int TR_ROWS = 5;
- /**
- * The number of columns of tiles
- */
- public static final int TR_COLUMNS = 6;
- /**
- * The current row number
- */
- public static final int TR_CURRENT_ROW = 7;
- /**
- * The current column number
- */
- public static final int TR_CURRENT_COLUMN = 8;
- /**
- * The width of the current tile
- */
- public static final int TR_CURRENT_TILE_WIDTH = 9;
- /**
- * The height of the current tile
- */
- public static final int TR_CURRENT_TILE_HEIGHT = 10;
- /**
- * The order that the rows are traversed
- */
- public static final int TR_ROW_ORDER = 11;
-
-
- /**
- * Indicates we are traversing rows from the top to the bottom
- */
- public static final int TR_TOP_TO_BOTTOM = 1;
-
- /**
- * Indicates we are traversing rows from the bottom to the top
- */
- public static final int TR_BOTTOM_TO_TOP = 2;
-
- /* Final image parameters */
- private Dimension imageSize = new Dimension();
-
- private int imageFormat, imageType;
-
- private Buffer imageBuffer;
-
- /* Tile parameters */
- private Dimension tileSize = new Dimension();
-
- private Dimension tileSizeNB = new Dimension();
-
- private int tileBorder;
-
- private int tileFormat, tileType;
-
- private Buffer tileBuffer;
-
- /* Projection parameters */
- private boolean perspective;
-
- private double left;
-
- private double right;
-
- private double bottom;
-
- private double top;
-
- private double near;
-
- private double far;
-
- /* Misc */
- private int rowOrder;
-
- private int rows, columns;
-
- private int currentTile;
-
- private int currentTileWidth, currentTileHeight;
-
- private int currentRow, currentColumn;
-
- private int[] viewportSave = new int[ 4 ];
-
- /**
- * Creates a new TileRenderer object
- */
- public TileRenderer()
- {
- tileSize.width = DEFAULT_TILE_WIDTH;
- tileSize.height = DEFAULT_TILE_HEIGHT;
- tileBorder = DEFAULT_TILE_BORDER;
- rowOrder = TR_BOTTOM_TO_TOP;
- currentTile = -1;
- }
-
- /**
- * Sets up the number of rows and columns needed
- */
- private void setup()
- {
- columns = ( imageSize.width + tileSizeNB.width - 1 ) / tileSizeNB.width;
- rows = ( imageSize.height + tileSizeNB.height - 1 ) / tileSizeNB.height;
- currentTile = 0;
-
- assert columns >= 0;
- assert rows >= 0;
- }
-
- /**
- * Sets the size of the tiles to use in rendering. The actual
- * effective size of the tile depends on the border size, ie (
- * width - 2*border ) * ( height - 2 * border )
- *
- * @param width
- * The width of the tiles. Must not be larger than the GL
- * context
- * @param height
- * The height of the tiles. Must not be larger than the
- * GL context
- * @param border
- * The width of the borders on each tile. This is needed
- * to avoid artifacts when rendering lines or points with
- * thickness > 1.
- */
- public void setTileSize( int width, int height, int border )
- {
- assert ( border >= 0 );
- assert ( width >= 1 );
- assert ( height >= 1 );
- assert ( width >= 2 * border );
- assert ( height >= 2 * border );
-
- tileBorder = border;
- tileSize.width = width;
- tileSize.height = height;
- tileSizeNB.width = width - 2 * border;
- tileSizeNB.height = height - 2 * border;
- setup();
- }
-
- /**
- * Specify a buffer the tiles to be copied to. This is not
- * necessary for the creation of the final image, but useful if you
- * want to inspect each tile in turn.
- *
- * @param format
- * Interpreted as in glReadPixels
- * @param type
- * Interpreted as in glReadPixels
- * @param image
- * The buffer itself. Must be large enough to contain a
- * tile, minus any borders
- */
- public void setTileBuffer( int format, int type, Buffer image )
- {
- tileFormat = format;
- tileType = type;
- tileBuffer = image;
- }
-
- /**
- * Sets the desired size of the final image
- *
- * @param width
- * The width of the final image
- * @param height
- * The height of the final image
- */
- public void setImageSize( int width, int height )
- {
- imageSize.width = width;
- imageSize.height = height;
- setup();
- }
-
- /**
- * Sets the buffer in which to store the final image
- *
- * @param format
- * Interpreted as in glReadPixels
- * @param type
- * Interpreted as in glReadPixels
- * @param image
- * the buffer itself, must be large enough to hold the
- * final image
- */
- public void setImageBuffer( int format, int type, Buffer image )
- {
- imageFormat = format;
- imageType = type;
- imageBuffer = image;
- }
-
- /**
- * Gets the parameters of this TileRenderer object
- *
- * @param param
- * The parameter that is to be retrieved
- * @return the value of the parameter
- */
- public int getParam( int param )
- {
- switch (param) {
- case TR_TILE_WIDTH:
- return tileSize.width;
- case TR_TILE_HEIGHT:
- return tileSize.height;
- case TR_TILE_BORDER:
- return tileBorder;
- case TR_IMAGE_WIDTH:
- return imageSize.width;
- case TR_IMAGE_HEIGHT:
- return imageSize.height;
- case TR_ROWS:
- return rows;
- case TR_COLUMNS:
- return columns;
- case TR_CURRENT_ROW:
- if( currentTile < 0 )
- return -1;
- else
- return currentRow;
- case TR_CURRENT_COLUMN:
- if( currentTile < 0 )
- return -1;
- else
- return currentColumn;
- case TR_CURRENT_TILE_WIDTH:
- return currentTileWidth;
- case TR_CURRENT_TILE_HEIGHT:
- return currentTileHeight;
- case TR_ROW_ORDER:
- return rowOrder;
- default:
- throw new IllegalArgumentException("Invalid enumerant as argument");
- }
- }
-
- /**
- * Sets the order of row traversal
- *
- * @param order
- * The row traversal order, must be
- * eitherTR_TOP_TO_BOTTOM or TR_BOTTOM_TO_TOP
- */
- public void setRowOrder( int order )
- {
- if (order == TR_TOP_TO_BOTTOM || order == TR_BOTTOM_TO_TOP) {
- rowOrder = order;
- } else {
- throw new IllegalArgumentException("Must pass TR_TOP_TO_BOTTOM or TR_BOTTOM_TO_TOP");
- }
- }
-
- /**
- * Sets the context to use an orthographic projection. Must be
- * called before rendering the first tile
- *
- * @param left
- * As in glOrtho
- * @param right
- * As in glOrtho
- * @param bottom
- * As in glOrtho
- * @param top
- * As in glOrtho
- * @param zNear
- * As in glOrtho
- * @param zFar
- * As in glOrtho
- */
- public void trOrtho( double left, double right, double bottom, double top, double zNear,
- double zFar )
- {
- this.perspective = false;
- this.left = left;
- this.right = right;
- this.bottom = bottom;
- this.top = top;
- this.near = zNear;
- this.far = zFar;
- }
-
- /**
- * Sets the perspective projection frustrum. Must be called before
- * rendering the first tile
- *
- * @param left
- * As in glFrustrum
- * @param right
- * As in glFrustrum
- * @param bottom
- * As in glFrustrum
- * @param top
- * As in glFrustrum
- * @param zNear
- * As in glFrustrum
- * @param zFar
- * As in glFrustrum
- */
- public void trFrustum( double left, double right, double bottom, double top, double zNear,
- double zFar )
- {
- this.perspective = true;
- this.left = left;
- this.right = right;
- this.bottom = bottom;
- this.top = top;
- this.near = zNear;
- this.far = zFar;
- }
-
- /**
- * Convenient way to specify a perspective projection
- *
- * @param fovy
- * As in gluPerspective
- * @param aspect
- * As in gluPerspective
- * @param zNear
- * As in gluPerspective
- * @param zFar
- * As in gluPerspective
- */
- public void trPerspective( double fovy, double aspect, double zNear, double zFar )
- {
- double xmin, xmax, ymin, ymax;
- ymax = zNear * Math.tan( fovy * 3.14159265 / 360.0 );
- ymin = -ymax;
- xmin = ymin * aspect;
- xmax = ymax * aspect;
- trFrustum( xmin, xmax, ymin, ymax, zNear, zFar );
- }
-
- /**
- * Begins rendering a tile. The projection matrix stack should be
- * left alone after calling this
- *
- * @param gl
- * The gl context
- */
- public void beginTile( GL2 gl )
- {
- if (currentTile <= 0) {
- setup();
- /*
- * Save user's viewport, will be restored after last tile
- * rendered
- */
- gl.glGetIntegerv( GL2.GL_VIEWPORT, viewportSave, 0 );
- }
-
- /* which tile (by row and column) we're about to render */
- if (rowOrder == TR_BOTTOM_TO_TOP) {
- currentRow = currentTile / columns;
- currentColumn = currentTile % columns;
- } else {
- currentRow = rows - ( currentTile / columns ) - 1;
- currentColumn = currentTile % columns;
- }
- assert ( currentRow < rows );
- assert ( currentColumn < columns );
-
- int border = tileBorder;
-
- int th, tw;
-
- /* Compute actual size of this tile with border */
- if (currentRow < rows - 1) {
- th = tileSize.height;
- } else {
- th = imageSize.height - ( rows - 1 ) * ( tileSizeNB.height ) + 2 * border;
- }
-
- if (currentColumn < columns - 1) {
- tw = tileSize.width;
- } else {
- tw = imageSize.width - ( columns - 1 ) * ( tileSizeNB.width ) + 2 * border;
- }
-
- /* Save tile size, with border */
- currentTileWidth = tw;
- currentTileHeight = th;
-
- gl.glViewport( 0, 0, tw, th );
-
- /* save current matrix mode */
- int[] matrixMode = new int[ 1 ];
- gl.glGetIntegerv( GL2.GL_MATRIX_MODE, matrixMode, 0 );
- gl.glMatrixMode( GL2.GL_PROJECTION );
- gl.glLoadIdentity();
-
- /* compute projection parameters */
- double l =
- left + ( right - left ) * ( currentColumn * tileSizeNB.width - border )
- / imageSize.width;
- double r = l + ( right - left ) * tw / imageSize.width;
- double b =
- bottom + ( top - bottom ) * ( currentRow * tileSizeNB.height - border )
- / imageSize.height;
- double t = b + ( top - bottom ) * th / imageSize.height;
-
- if( perspective ) {
- gl.glFrustum( l, r, b, t, near, far );
- } else {
- gl.glOrtho( l, r, b, t, near, far );
- }
-
- /* restore user's matrix mode */
- gl.glMatrixMode( matrixMode[ 0 ] );
- }
-
- /**
- * Must be called after rendering the scene
- *
- * @param gl
- * the gl context
- * @return true if there are more tiles to be rendered, false if
- * the final image is complete
- */
- public boolean endTile( GL2 gl )
- {
- int[] prevRowLength = new int[ 1 ], prevSkipRows = new int[ 1 ], prevSkipPixels = new int[ 1 ], prevAlignment =
- new int[ 1 ];
-
- assert ( currentTile >= 0 );
-
- // be sure OpenGL rendering is finished
- gl.glFlush();
-
- // save current glPixelStore values
- gl.glGetIntegerv( GL2.GL_PACK_ROW_LENGTH, prevRowLength, 0 );
- gl.glGetIntegerv( GL2.GL_PACK_SKIP_ROWS, prevSkipRows, 0 );
- gl.glGetIntegerv( GL2.GL_PACK_SKIP_PIXELS, prevSkipPixels, 0 );
- gl.glGetIntegerv( GL2.GL_PACK_ALIGNMENT, prevAlignment, 0 );
-
- if( tileBuffer != null ) {
- int srcX = tileBorder;
- int srcY = tileBorder;
- int srcWidth = tileSizeNB.width;
- int srcHeight = tileSizeNB.height;
- gl.glReadPixels( srcX, srcY, srcWidth, srcHeight, tileFormat, tileType, tileBuffer );
- }
-
- if( imageBuffer != null ) {
- int srcX = tileBorder;
- int srcY = tileBorder;
- int srcWidth = currentTileWidth - 2 * tileBorder;
- int srcHeight = currentTileHeight - 2 * tileBorder;
- int destX = tileSizeNB.width * currentColumn;
- int destY = tileSizeNB.height * currentRow;
-
- /* setup pixel store for glReadPixels */
- gl.glPixelStorei( GL2.GL_PACK_ROW_LENGTH, imageSize.width );
- gl.glPixelStorei( GL2.GL_PACK_SKIP_ROWS, destY );
- gl.glPixelStorei( GL2.GL_PACK_SKIP_PIXELS, destX );
- gl.glPixelStorei( GL2.GL_PACK_ALIGNMENT, 1 );
-
- /* read the tile into the final image */
- gl.glReadPixels( srcX, srcY, srcWidth, srcHeight, imageFormat, imageType, imageBuffer );
- }
-
- /* restore previous glPixelStore values */
- gl.glPixelStorei( GL2.GL_PACK_ROW_LENGTH, prevRowLength[ 0 ] );
- gl.glPixelStorei( GL2.GL_PACK_SKIP_ROWS, prevSkipRows[ 0 ] );
- gl.glPixelStorei( GL2.GL_PACK_SKIP_PIXELS, prevSkipPixels[ 0 ] );
- gl.glPixelStorei( GL2.GL_PACK_ALIGNMENT, prevAlignment[ 0 ] );
-
- /* increment tile counter, return 1 if more tiles left to render */
- currentTile++;
- if( currentTile >= rows * columns ) {
- /* restore user's viewport */
- gl.glViewport( viewportSave[ 0 ], viewportSave[ 1 ], viewportSave[ 2 ], viewportSave[ 3 ] );
- currentTile = -1; /* all done */
- return false;
- } else {
- return true;
- }
- }
-
- /**
- * Tile rendering causes problems with using glRasterPos3f, so you
- * should use this replacement instead
- *
- * @param x
- * As in glRasterPos3f
- * @param y
- * As in glRasterPos3f
- * @param z
- * As in glRasterPos3f
- * @param gl
- * The gl context
- * @param glu
- * A GLUgl2 object
- */
- public void trRasterPos3f( float x, float y, float z, GL2 gl, GLUgl2 glu )
- {
- if (currentTile < 0) {
- /* not doing tile rendering right now. Let OpenGL do this. */
- gl.glRasterPos3f( x, y, z );
- } else {
- double[] modelview = new double[ 16 ], proj = new double[ 16 ];
- int[] viewport = new int[ 4 ];
- double[] win = new double[3];
-
- /* Get modelview, projection and viewport */
- gl.glGetDoublev( GL2.GL_MODELVIEW_MATRIX, modelview, 0 );
- gl.glGetDoublev( GL2.GL_PROJECTION_MATRIX, proj, 0 );
- viewport[ 0 ] = 0;
- viewport[ 1 ] = 0;
- viewport[ 2 ] = currentTileWidth;
- viewport[ 3 ] = currentTileHeight;
-
- /* Project object coord to window coordinate */
- if( glu.gluProject( x, y, z, modelview, 0, proj, 0, viewport, 0, win, 0 ) ) {
-
- /* set raster pos to window coord (0,0) */
- gl.glMatrixMode( GL2.GL_MODELVIEW );
- gl.glPushMatrix();
- gl.glLoadIdentity();
- gl.glMatrixMode( GL2.GL_PROJECTION );
- gl.glPushMatrix();
- gl.glLoadIdentity();
- gl.glOrtho( 0.0, currentTileWidth, 0.0, currentTileHeight, 0.0, 1.0 );
- gl.glRasterPos3d( 0.0, 0.0, -win[ 2 ] );
-
- /*
- * Now use empty bitmap to adjust raster position to
- * (winX,winY)
- */
- {
- byte[] bitmap = { 0 };
- gl.glBitmap( 1, 1, 0.0f, 0.0f, ( float ) win[ 0 ], ( float ) win[ 1 ], bitmap , 0 );
- }
-
- /* restore original matrices */
- gl.glPopMatrix(); /* proj */
- gl.glMatrixMode( GL2.GL_MODELVIEW );
- gl.glPopMatrix();
- }
- }
- }
-}
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 edc3d26..206aa0f 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java
@@ -62,30 +62,29 @@ import com.jogamp.common.util.VersionNumber;
* A documented example of how to use this code is available
* {@link #create(GL2ES2, int, Class, String, String, String, boolean) here} and
* {@link #create(GL2ES2, int, int, Class, String, String[], String, String) here}.
- * </p>
+ * </p>
*/
public class ShaderCode {
- public static final boolean DEBUG = Debug.debug("GLSLCode");
public static final boolean DEBUG_CODE = Debug.isPropertyDefined("jogl.debug.GLSLCode", true);
/** Unique resource suffix for {@link GL2ES2#GL_VERTEX_SHADER} in source code: <code>vp</code> */
public static final String SUFFIX_VERTEX_SOURCE = "vp" ;
-
+
/** Unique resource suffix for {@link GL2ES2#GL_VERTEX_SHADER} in binary: <code>bvp</code> */
public static final String SUFFIX_VERTEX_BINARY = "bvp" ;
-
+
/** Unique resource suffix for {@link GL3#GL_GEOMETRY_SHADER} in source code: <code>gp</code> */
public static final String SUFFIX_GEOMETRY_SOURCE = "gp" ;
-
+
/** Unique resource suffix for {@link GL3#GL_GEOMETRY_SHADER} in binary: <code>bgp</code> */
public static final String SUFFIX_GEOMETRY_BINARY = "bgp" ;
-
+
/** Unique resource suffix for {@link GL2ES2#GL_FRAGMENT_SHADER} in source code: <code>fp</code> */
public static final String SUFFIX_FRAGMENT_SOURCE = "fp" ;
-
+
/** Unique resource suffix for {@link GL2ES2#GL_FRAGMENT_SHADER} in binary: <code>bfp</code> */
public static final String SUFFIX_FRAGMENT_BINARY = "bfp" ;
-
+
/** Unique relative path for binary shader resources for {@link GLES2#GL_NVIDIA_PLATFORM_BINARY_NV NVIDIA}: <code>nvidia</code> */
public static final String SUB_PATH_NVIDIA = "nvidia" ;
@@ -94,7 +93,7 @@ public class ShaderCode {
* @param count number of shaders
* @param source CharSequence array containing the shader sources, organized as <code>source[count][strings-per-shader]</code>.
* May be either an immutable <code>String</code> - or mutable <code>StringBuilder</code> array.
- *
+ *
* @throws IllegalArgumentException if <code>count</count> and <code>source.length</code> do not match
*/
public ShaderCode(int type, int count, CharSequence[][] source) {
@@ -125,7 +124,7 @@ public class ShaderCode {
/**
* @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER} or {@link GL3#GL_GEOMETRY_SHADER}
* @param count number of shaders
- * @param binary binary buffer containing the shader binaries,
+ * @param binary binary buffer containing the shader binaries,
*/
public ShaderCode(int type, int count, int binFormat, Buffer binary) {
switch (type) {
@@ -147,19 +146,19 @@ public class ShaderCode {
/**
* Creates a complete {@link ShaderCode} object while reading all shader source of <code>sourceFiles</code>,
* which location is resolved using the <code>context</code> class, see {@link #readShaderSource(Class, String)}.
- *
+ *
* @param gl current GL object to determine whether a shader compiler is available. If null, no validation is performed.
* @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER} or {@link GL3#GL_GEOMETRY_SHADER}
* @param count number of shaders
* @param context class used to help resolving the source location
* @param sourceFiles array of source locations, organized as <code>sourceFiles[count]</code>
* @param mutableStringBuilder if <code>true</code> method returns a mutable <code>StringBuilder</code> instance
- * which can be edited later on at the costs of a String conversion when passing to
+ * which can be edited later on at the costs of a String conversion when passing to
* {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}.
* If <code>false</code> method returns an immutable <code>String</code> instance,
* which can be passed to {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}
* at no additional costs.
- *
+ *
* @throws IllegalArgumentException if <code>count</count> and <code>sourceFiles.length</code> do not match
* @see #readShaderSource(Class, String)
*/
@@ -192,16 +191,16 @@ public class ShaderCode {
/**
* Creates a complete {@link ShaderCode} object while reading the shader binary of <code>binaryFile</code>,
* which location is resolved using the <code>context</code> class, see {@link #readShaderBinary(Class, String)}.
- *
+ *
* @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER} or {@link GL3#GL_GEOMETRY_SHADER}
* @param count number of shaders
* @param context class used to help resolving the source location
* @param binFormat a valid native binary format as they can be queried by {@link ShaderUtil#getShaderBinaryFormats(GL)}.
* @param sourceFiles array of source locations, organized as <code>sourceFiles[count]</code>
- *
+ *
* @see #readShaderBinary(Class, String)
* @see ShaderUtil#getShaderBinaryFormats(GL)
- */
+ */
public static ShaderCode create(int type, int count, Class<?> context, int binFormat, String binaryFile) {
ByteBuffer shaderBinary = null;
if(null!=binaryFile && 0<=binFormat) {
@@ -231,12 +230,12 @@ public class ShaderCode {
* <li>{@link GL2ES2#GL_VERTEX_SHADER vertex}: {@link #SUFFIX_VERTEX_BINARY}</li>
* <li>{@link GL2ES2#GL_FRAGMENT_SHADER fragment}: {@link #SUFFIX_FRAGMENT_BINARY}</li>
* <li>{@link GL3#GL_GEOMETRY_SHADER geometry}: {@link #SUFFIX_GEOMETRY_BINARY}</li></ul></li>
- * </ul>
- * @param binary true for a binary resource, false for a source resource
+ * </ul>
+ * @param binary true for a binary resource, false for a source resource
* @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER} or {@link GL3#GL_GEOMETRY_SHADER}
- *
+ *
* @throws GLException if <code>type</code> is not supported
- *
+ *
* @see #create(GL2ES2, int, Class, String, String, String, boolean)
*/
public static String getFileSuffix(boolean binary, int type) {
@@ -252,16 +251,16 @@ public class ShaderCode {
}
}
- /**
+ /**
* Returns a unique relative path for binary shader resources as follows:
* <ul>
* <li>{@link GLES2#GL_NVIDIA_PLATFORM_BINARY_NV NVIDIA}: {@link #SUB_PATH_NVIDIA}</li>
* </ul>
- *
+ *
* @throws GLException if <code>binFormat</code> is not supported
- *
+ *
* @see #create(GL2ES2, int, Class, String, String, String, boolean)
- */
+ */
public static String getBinarySubPath(int binFormat) {
switch (binFormat) {
case GLES2.GL_NVIDIA_PLATFORM_BINARY_NV:
@@ -272,42 +271,42 @@ public class ShaderCode {
}
/**
- * Convenient creation method for instantiating a complete {@link ShaderCode} object
- * either from source code using {@link #create(GL2ES2, int, int, Class, String[])},
+ * Convenient creation method for instantiating a complete {@link ShaderCode} object
+ * either from source code using {@link #create(GL2ES2, int, int, Class, String[])},
* or from a binary code using {@link #create(int, int, Class, int, String)},
* whatever is available first.
* <p>
- * The source and binary location names are expected w/o suffixes which are
+ * The source and binary location names are expected w/o suffixes which are
* resolved and appended using {@link #getFileSuffix(boolean, int)}.
* </p>
* <p>
* Additionally, the binary resource is expected within a subfolder of <code>binRoot</code>
* which reflects the vendor specific binary format, see {@link #getBinarySubPath(int)}.
* All {@link ShaderUtil#getShaderBinaryFormats(GL)} are being iterated
- * using the binary subfolder, the first existing resource is being used.
+ * using the binary subfolder, the first existing resource is being used.
* </p>
- *
+ *
* Example:
* <pre>
* Your std JVM layout (plain or within a JAR):
- *
+ *
* org/test/glsl/MyShaderTest.class
* org/test/glsl/shader/vertex.vp
* org/test/glsl/shader/fragment.fp
* org/test/glsl/shader/bin/nvidia/vertex.bvp
* org/test/glsl/shader/bin/nvidia/fragment.bfp
- *
+ *
* Your Android APK layout:
- *
+ *
* classes.dex
* assets/org/test/glsl/shader/vertex.vp
* assets/org/test/glsl/shader/fragment.fp
* assets/org/test/glsl/shader/bin/nvidia/vertex.bvp
* assets/org/test/glsl/shader/bin/nvidia/fragment.bfp
* ...
- *
+ *
* Your invocation in org/test/glsl/MyShaderTest.java:
- *
+ *
* ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, 1, this.getClass(),
* "shader", new String[] { "vertex" }, "shader/bin", "vertex");
* ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, 1, this.getClass(),
@@ -318,11 +317,11 @@ public class ShaderCode {
* st.attachShaderProgram(gl, sp0, true);
* </pre>
* A simplified entry point is {@link #create(GL2ES2, int, Class, String, String, String, boolean)}.
- *
+ *
* <p>
* The location is finally being resolved using the <code>context</code> class, see {@link #readShaderBinary(Class, String)}.
* </p>
- *
+ *
* @param gl current GL object to determine whether a shader compiler is available (if <code>source</code> is used),
* or to determine the shader binary format (if <code>binary</code> is used).
* @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER} or {@link GL3#GL_GEOMETRY_SHADER}
@@ -333,22 +332,22 @@ public class ShaderCode {
* @param binRoot relative <i>root</i> path for <code>binBasenames</code>
* @param binBasename basename w/o path or suffix relative to <code>binRoot</code> for the shader's binary code
* @param mutableStringBuilder if <code>true</code> method returns a mutable <code>StringBuilder</code> instance
- * which can be edited later on at the costs of a String conversion when passing to
+ * which can be edited later on at the costs of a String conversion when passing to
* {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}.
* If <code>false</code> method returns an immutable <code>String</code> instance,
* which can be passed to {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}
* at no additional costs.
- *
+ *
* @throws IllegalArgumentException if <code>count</count> and <code>srcBasenames.length</code> do not match
- *
+ *
* @see #create(GL2ES2, int, int, Class, String[])
* @see #create(int, int, Class, int, String)
* @see #readShaderSource(Class, String)
* @see #getFileSuffix(boolean, int)
* @see ShaderUtil#getShaderBinaryFormats(GL)
* @see #getBinarySubPath(int)
- */
- public static ShaderCode create(GL2ES2 gl, int type, int count, Class<?> context,
+ */
+ public static ShaderCode create(GL2ES2 gl, int type, int count, Class<?> context,
String srcRoot, String[] srcBasenames, String binRoot, String binBasename,
boolean mutableStringBuilder) {
ShaderCode res = null;
@@ -391,28 +390,28 @@ public class ShaderCode {
/**
* Simplified variation of {@link #create(GL2ES2, int, int, Class, String, String[], String, String)}.
* <br>
- *
+ *
* Example:
* <pre>
* Your std JVM layout (plain or within a JAR):
- *
+ *
* org/test/glsl/MyShaderTest.class
* org/test/glsl/shader/vertex.vp
* org/test/glsl/shader/fragment.fp
* org/test/glsl/shader/bin/nvidia/vertex.bvp
* org/test/glsl/shader/bin/nvidia/fragment.bfp
- *
+ *
* Your Android APK layout:
- *
+ *
* classes.dex
* assets/org/test/glsl/shader/vertex.vp
* assets/org/test/glsl/shader/fragment.fp
* assets/org/test/glsl/shader/bin/nvidia/vertex.bvp
* assets/org/test/glsl/shader/bin/nvidia/fragment.bfp
* ...
- *
+ *
* Your invocation in org/test/glsl/MyShaderTest.java:
- *
+ *
* ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(),
* "shader", "shader/bin", "vertex");
* ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(),
@@ -422,7 +421,7 @@ public class ShaderCode {
* sp0.add(gl, fp0, System.err);
* st.attachShaderProgram(gl, sp0, true);
* </pre>
- *
+ *
* @param gl current GL object to determine whether a shader compiler is available (if <code>source</code> is used),
* or to determine the shader binary format (if <code>binary</code> is used).
* @param type either {@link GL2ES2#GL_VERTEX_SHADER}, {@link GL2ES2#GL_FRAGMENT_SHADER} or {@link GL3#GL_GEOMETRY_SHADER}
@@ -433,20 +432,20 @@ public class ShaderCode {
* @param basenames basename w/o path or suffix relative to <code>srcRoot</code> and <code>binRoot</code>
* for the shader's source and binary code.
* @param mutableStringBuilder if <code>true</code> method returns a mutable <code>StringBuilder</code> instance
- * which can be edited later on at the costs of a String conversion when passing to
+ * which can be edited later on at the costs of a String conversion when passing to
* {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}.
* If <code>false</code> method returns an immutable <code>String</code> instance,
* which can be passed to {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}
* at no additional costs.
* @throws IllegalArgumentException if <code>count</count> is not 1
- *
+ *
* @see #create(GL2ES2, int, int, Class, String, String[], String, String)
- */
- public static ShaderCode create(GL2ES2 gl, int type, Class<?> context,
+ */
+ public static ShaderCode create(GL2ES2 gl, int type, Class<?> context,
String srcRoot, String binRoot, String basename, boolean mutableStringBuilder) {
- return create(gl, type, 1, context, srcRoot, new String[] { basename }, binRoot, basename, mutableStringBuilder );
+ return create(gl, type, 1, context, srcRoot, new String[] { basename }, binRoot, basename, mutableStringBuilder );
}
-
+
/**
* returns the uniq shader id as an integer
*/
@@ -455,7 +454,7 @@ public class ShaderCode {
public int shaderType() { return shaderType; }
public String shaderTypeStr() { return shaderTypeStr(shaderType); }
- public static String shaderTypeStr(int type) {
+ public static String shaderTypeStr(int type) {
switch (type) {
case GL2ES2.GL_VERTEX_SHADER:
return "VERTEX_SHADER";
@@ -484,6 +483,7 @@ public class ShaderCode {
// Create & Compile the vertex/fragment shader objects
if(null!=shaderSource) {
if(DEBUG_CODE) {
+ System.err.println("ShaderCode.compile:");
dumpShaderSource(System.err);
}
valid=ShaderUtil.createAndCompileShader(gl, shader, shaderType,
@@ -514,6 +514,7 @@ public class ShaderCode {
id=-1;
}
+ @Override
public boolean equals(Object obj) {
if(this==obj) { return true; }
if(obj instanceof ShaderCode) {
@@ -521,9 +522,11 @@ public class ShaderCode {
}
return false;
}
+ @Override
public int hashCode() {
return id;
}
+ @Override
public String toString() {
StringBuilder buf = new StringBuilder("ShaderCode[id="+id+", type="+shaderTypeStr()+", valid="+valid+", shader: ");
for(int i=0; i<shader.remaining(); i++) {
@@ -553,7 +556,7 @@ public class ShaderCode {
} else {
CharSequence[] src = shaderSource[i];
int lineno=0;
-
+
for(int j=0; j<src.length; j++) {
out.printf("%4d: // Segment %d/%d: \n", lineno, j, src.length);
final BufferedReader reader = new BufferedReader(new StringReader(src[j].toString()));
@@ -569,19 +572,19 @@ public class ShaderCode {
out.println("--------------------------------------------------------------");
}
}
-
+
/**
* Adds <code>data</code> after the line containing <code>tag</code>.
* <p>
* Note: The shader source to be edit must be created using a mutable StringBuilder.
* </p>
- *
+ *
* @param shaderIdx the shader index to be used.
* @param tag search string
* @param fromIndex start search <code>tag</code> begininig with this index
* @param data the text to be inserted. Shall end with an EOL '\n' character.
* @return index after the inserted <code>data</code>
- *
+ *
* @throws IllegalStateException if the shader source's CharSequence is immutable, i.e. not of type <code>StringBuilder</code>
*/
public int insertShaderSource(int shaderIdx, String tag, int fromIndex, CharSequence data) {
@@ -595,7 +598,7 @@ public class ShaderCode {
final int sourceCount = (null!=shaderSource)?shaderSource.length:0;
if(shaderIdx>=sourceCount) {
throw new IndexOutOfBoundsException("shaderIdx not within source bounds [0.."+(sourceCount-1)+"]: "+shaderIdx);
- }
+ }
final CharSequence[] src = shaderSource[shaderIdx];
int curEndIndex = 0;
for(int j=0; j<src.length; j++) {
@@ -603,8 +606,8 @@ public class ShaderCode {
throw new IllegalStateException("shader source not a mutable StringBuilder, but CharSequence of type: "+src[j].getClass().getName());
}
final StringBuilder sb = (StringBuilder)src[j];
- curEndIndex += sb.length();
- if(fromIndex < curEndIndex) {
+ curEndIndex += sb.length();
+ if(fromIndex < curEndIndex) {
int insertIdx = sb.indexOf(tag, fromIndex);
if(0<=insertIdx) {
insertIdx += tag.length();
@@ -630,15 +633,15 @@ public class ShaderCode {
* Replaces <code>oldName</code> with <code>newName</code> in all shader sources.
* <p>
* In case <code>oldName</code> and <code>newName</code> are equal, no action is performed.
- * </p>
+ * </p>
* <p>
* Note: The shader source to be edit must be created using a mutable StringBuilder.
* </p>
- *
+ *
* @param oldName the to be replace string
* @param newName the replacement string
* @return the number of replacements
- *
+ *
* @throws IllegalStateException if the shader source's CharSequence is immutable, i.e. not of type <code>StringBuilder</code>
*/
public int replaceInShaderSource(String oldName, String newName) {
@@ -675,18 +678,18 @@ public class ShaderCode {
}
return num;
}
-
+
/**
* Adds <code>data</code> at <code>offset</code> in shader source for shader <code>shaderIdx</code>.
* <p>
* Note: The shader source to be edit must be created using a mutable StringBuilder.
* </p>
- *
+ *
* @param shaderIdx the shader index to be used.
* @param position in shader source segments of shader <code>shaderIdx</code>
* @param data the text to be inserted. Shall end with an EOL '\n' character
* @return index after the inserted <code>data</code>
- *
+ *
* @throws IllegalStateException if the shader source's CharSequence is immutable, i.e. not of type <code>StringBuilder</code>
*/
public int insertShaderSource(int shaderIdx, int position, CharSequence data) {
@@ -700,7 +703,7 @@ public class ShaderCode {
final int sourceCount = (null!=shaderSource)?shaderSource.length:0;
if(shaderIdx>=sourceCount) {
throw new IndexOutOfBoundsException("shaderIdx not within source bounds [0.."+(sourceCount-1)+"]: "+shaderIdx);
- }
+ }
final CharSequence[] src = shaderSource[shaderIdx];
int curEndIndex = 0;
for(int j=0; j<src.length; j++) {
@@ -708,8 +711,8 @@ public class ShaderCode {
throw new IllegalStateException("shader source not a mutable StringBuilder, but CharSequence of type: "+src[j].getClass().getName());
}
final StringBuilder sb = (StringBuilder)src[j];
- curEndIndex += sb.length();
- if(position < curEndIndex) {
+ curEndIndex += sb.length();
+ if(position < curEndIndex) {
sb.insert(position, data);
return position+data.length();
}
@@ -734,12 +737,12 @@ public class ShaderCode {
if (line.startsWith("#include ")) {
String includeFile = line.substring(9).trim();
URLConnection nextConn = null;
-
+
// Try relative of current shader location
nextConn = IOUtil.openURL(IOUtil.getRelativeOf(conn.getURL(), includeFile), "ShaderCode.relativeOf ");
if (nextConn == null) {
// Try relative of class and absolute
- nextConn = IOUtil.getResource(context, includeFile);
+ nextConn = IOUtil.getResource(context, includeFile);
}
if (nextConn == null) {
// Fail
@@ -757,7 +760,7 @@ public class ShaderCode {
}
/**
- *
+ *
* @param context
* @param conn
* @param result
@@ -766,7 +769,7 @@ public class ShaderCode {
public static void readShaderSource(Class<?> context, URLConnection conn, StringBuilder result) throws IOException {
readShaderSource(context, conn, result, 0);
}
-
+
/**
* Reads shader source located in <code>path</code>,
* either relative to the <code>context</code> class or absolute <i>as-is</i>.
@@ -774,21 +777,21 @@ public class ShaderCode {
* Final location lookup is performed via {@link ClassLoader#getResource(String)} and {@link ClassLoader#getSystemResource(String)},
* see {@link IOUtil#getResource(Class, String)}.
* </p>
- *
+ *
* @param context class used to help resolve the source location
* @param path location of shader source
* @param mutableStringBuilder if <code>true</code> method returns a mutable <code>StringBuilder</code> instance
- * which can be edited later on at the costs of a String conversion when passing to
+ * which can be edited later on at the costs of a String conversion when passing to
* {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}.
* If <code>false</code> method returns an immutable <code>String</code> instance,
* which can be passed to {@link GL2ES2#glShaderSource(int, int, String[], IntBuffer)}
* at no additional costs.
- * @throws IOException
- *
+ * @throws IOException
+ *
* @see IOUtil#getResource(Class, String)
- */
+ */
public static CharSequence readShaderSource(Class<?> context, String path, boolean mutableStringBuilder) throws IOException {
- URLConnection conn = IOUtil.getResource(context, path);
+ URLConnection conn = IOUtil.getResource(context, path);
if (conn == null) {
return null;
}
@@ -798,17 +801,17 @@ public class ShaderCode {
}
/**
- * Reads shader binary located in <code>path</code>,
+ * Reads shader binary located in <code>path</code>,
* either relative to the <code>context</code> class or absolute <i>as-is</i>.
* <p>
* Final location lookup is perfomed via {@link ClassLoader#getResource(String)} and {@link ClassLoader#getSystemResource(String)},
* see {@link IOUtil#getResource(Class, String)}.
* </p>
- *
+ *
* @param context class used to help resolve the source location
* @param path location of shader binary
- * @throws IOException
- *
+ * @throws IOException
+ *
* @see IOUtil#getResource(Class, String)
*/
public static ByteBuffer readShaderBinary(Class<?> context, String path) throws IOException {
@@ -824,41 +827,46 @@ public class ShaderCode {
}
}
- // Shall we use: #ifdef GL_FRAGMENT_PRECISION_HIGH .. #endif for using highp in fragment shader if avail ?
+ // Shall we use: #ifdef GL_FRAGMENT_PRECISION_HIGH .. #endif for using highp in fragment shader if avail ?
/** Default precision of {@link GL#isGLES2() ES2} for {@link GL2ES2#GL_VERTEX_SHADER vertex-shader}: {@value #es2_default_precision_vp} */
- public static final String es2_default_precision_vp = "\nprecision highp float;\nprecision highp int;\n";
+ public static final String es2_default_precision_vp = "\nprecision highp float;\nprecision highp int;\n/*precision lowp sampler2D;*/\n/*precision lowp samplerCube;*/\n";
/** Default precision of {@link GL#isGLES2() ES2} for {@link GL2ES2#GL_FRAGMENT_SHADER fragment-shader}: {@value #es2_default_precision_fp} */
- public static final String es2_default_precision_fp = "\nprecision mediump float;\nprecision mediump int;\n/*precision lowp sampler2D;*/\n";
-
+ public static final String es2_default_precision_fp = "\nprecision mediump float;\nprecision mediump int;\n/*precision lowp sampler2D;*/\n/*precision lowp samplerCube;*/\n";
+
+ /** Default precision of {@link GL#isGLES3() ES3} for {@link GL2ES2#GL_VERTEX_SHADER vertex-shader}: {@value #es3_default_precision_vp} */
+ public static final String es3_default_precision_vp = es2_default_precision_vp;
+ /** Default precision of {@link GL#isGLES3() ES3} for {@link GL2ES2#GL_FRAGMENT_SHADER fragment-shader}: {@value #es3_default_precision_fp} */
+ public static final String es3_default_precision_fp = es2_default_precision_fp;
+
/** Default precision of GLSL ≥ 1.30 as required until < 1.50 for {@link GL2ES2#GL_VERTEX_SHADER vertex-shader} or {@link GL3#GL_GEOMETRY_SHADER geometry-shader}: {@value #gl3_default_precision_vp_gp}. See GLSL Spec 1.30-1.50 Section 4.5.3. */
public static final String gl3_default_precision_vp_gp = "\nprecision highp float;\nprecision highp int;\n";
/** Default precision of GLSL ≥ 1.30 as required until < 1.50 for {@link GL2ES2#GL_FRAGMENT_SHADER fragment-shader}: {@value #gl3_default_precision_fp}. See GLSL Spec 1.30-1.50 Section 4.5.3. */
public static final String gl3_default_precision_fp = "\nprecision highp float;\nprecision mediump int;\n/*precision mediump sampler2D;*/\n";
-
+
/** Prefer <code>enable</code> over <code>require</code>, since it won't force a failure. */
public static final String extOESDerivativesEnable = "#extension GL_OES_standard_derivatives : enable\n";
-
+
/**
* Add GLSL version at the head of this shader source code.
* <p>
* Note: The shader source to be edit must be created using a mutable StringBuilder.
* </p>
- * @param gl a GL context, which must have been made current once
+ * @param gl a GL context, which must have been made current once
* @return the index after the inserted data, maybe 0 if nothing has be inserted.
*/
public final int addGLSLVersion(GL2ES2 gl) {
return insertShaderSource(0, 0, gl.getContext().getGLSLVersionString());
}
-
+
/**
* Adds default precision to source code at given position if required, i.e.
- * {@link #es2_default_precision_vp}, {@link #es2_default_precision_fp},
+ * {@link #es2_default_precision_vp}, {@link #es2_default_precision_fp},
* {@link #gl3_default_precision_vp_gp}, {@link #gl3_default_precision_fp} or none,
* depending on the {@link GLContext#getGLSLVersionNumber() GLSL version} being used.
* <p>
* Note: The shader source to be edit must be created using a mutable StringBuilder.
* </p>
- * @param gl a GL context, which must have been made current once
+ * @param gl a GL context, which must have been made current once
* @param pos position within this mutable shader source.
* @return the index after the inserted data, maybe 0 if nothing has be inserted.
*/
@@ -869,9 +877,19 @@ public class ShaderCode {
case GL2ES2.GL_VERTEX_SHADER:
defaultPrecision = es2_default_precision_vp; break;
case GL2ES2.GL_FRAGMENT_SHADER:
- defaultPrecision = es2_default_precision_vp; break;
+ defaultPrecision = es2_default_precision_fp; break;
default:
- defaultPrecision = null;
+ defaultPrecision = null;
+ break;
+ }
+ } else if( gl.isGLES3() ) {
+ switch ( shaderType ) {
+ case GL2ES2.GL_VERTEX_SHADER:
+ defaultPrecision = es3_default_precision_vp; break;
+ case GL2ES2.GL_FRAGMENT_SHADER:
+ defaultPrecision = es3_default_precision_fp; break;
+ default:
+ defaultPrecision = null;
break;
}
} else if( requiresGL3DefaultPrecision(gl) ) {
@@ -883,7 +901,7 @@ public class ShaderCode {
case GL2ES2.GL_FRAGMENT_SHADER:
defaultPrecision = gl3_default_precision_fp; break;
default:
- defaultPrecision = null;
+ defaultPrecision = null;
break;
}
} else {
@@ -894,15 +912,15 @@ public class ShaderCode {
}
return pos;
}
-
+
/** Returns true, if GLSL version requires default precision, i.e. ES2 or GLSL [1.30 .. 1.50[. */
public static final boolean requiresDefaultPrecision(GL2ES2 gl) {
- if( gl.isGLES2() ) {
+ if( gl.isGLES2() || gl.isGLES3() ) {
return true;
}
return requiresGL3DefaultPrecision(gl);
}
-
+
/** Returns true, if GL3 GLSL version requires default precision, i.e. GLSL [1.30 .. 1.50[. */
public static final boolean requiresGL3DefaultPrecision(GL2ES2 gl) {
if( gl.isGL3() ) {
@@ -912,16 +930,16 @@ public class ShaderCode {
return false;
}
}
-
+
/**
* Default customization of this shader source code.
* <p>
* Note: The shader source to be edit must be created using a mutable StringBuilder.
* </p>
- * @param gl a GL context, which must have been made current once
+ * @param gl a GL context, which must have been made current once
* @param preludeVersion if true {@link GLContext#getGLSLVersionString()} is preluded, otherwise not.
- * @param addDefaultPrecision if <code>true</code> default precision source code line(s) are added, i.e.
- * {@link #es2_default_precision_vp}, {@link #es2_default_precision_fp},
+ * @param addDefaultPrecision if <code>true</code> default precision source code line(s) are added, i.e.
+ * {@link #es2_default_precision_vp}, {@link #es2_default_precision_fp},
* {@link #gl3_default_precision_vp_gp}, {@link #gl3_default_precision_fp} or none,
* depending on the {@link GLContext#getGLSLVersionNumber() GLSL version} being used.
* @return the index after the inserted data, maybe 0 if nothing has be inserted.
@@ -940,13 +958,13 @@ public class ShaderCode {
}
return pos;
}
-
+
/**
* Default customization of this shader source code.
* <p>
* Note: The shader source to be edit must be created using a mutable StringBuilder.
* </p>
- * @param gl a GL context, which must have been made current once
+ * @param gl a GL context, which must have been made current once
* @param preludeVersion if true {@link GLContext#getGLSLVersionString()} is preluded, otherwise not.
* @param esDefaultPrecision optional default precision source code line(s) preluded if not null and if {@link GL#isGLES()}.
* You may use {@link #es2_default_precision_fp} for fragment shader and {@link #es2_default_precision_vp} for vertex shader.
@@ -967,8 +985,8 @@ public class ShaderCode {
pos = addDefaultShaderPrecision(gl, pos);
}
return pos;
- }
-
+ }
+
//----------------------------------------------------------------------
// Internals only below this point
//
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 1337a7e..b289b41 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
@@ -37,7 +37,7 @@ import java.util.Iterator;
import java.io.PrintStream;
public class ShaderProgram {
-
+
public ShaderProgram() {
id = getNextID();
}
@@ -111,7 +111,7 @@ public class ShaderProgram {
/**
* Adds a new shader to this program.
- *
+ *
* <p>This command does not compile and attach the shader,
* use {@link #add(GL2ES2, ShaderCode)} for this purpose.</p>
*/
@@ -122,7 +122,7 @@ public class ShaderProgram {
public synchronized boolean contains(ShaderCode shaderCode) {
return allShaderCode.contains(shaderCode);
}
-
+
/**
* Warning slow O(n) operation ..
* @param id
@@ -145,9 +145,9 @@ public class ShaderProgram {
/**
* Creates the empty GL program object using {@link GL2ES2#glCreateProgram()},
* if not already created.
- *
+ *
* @param gl
- * @return true if shader program is valid, i.e. not zero
+ * @return true if shader program is valid, i.e. not zero
*/
public synchronized final boolean init(GL2ES2 gl) {
if( 0 == shaderProgram ) {
@@ -155,12 +155,12 @@ public class ShaderProgram {
}
return 0 != shaderProgram;
}
-
+
/**
* Adds a new shader to a this non running program.
*
* <p>Compiles and attaches the shader, if not done yet.</p>
- *
+ *
* @return true if the shader was successfully added, false if compilation failed.
*/
public synchronized boolean add(GL2ES2 gl, ShaderCode shaderCode, PrintStream verboseOut) {
@@ -179,11 +179,11 @@ public class ShaderProgram {
/**
* Replace a shader in a program and re-links the program.
*
- * @param gl
+ * @param gl
* @param oldShader the to be replace Shader
* @param newShader the new ShaderCode
* @param verboseOut the optional verbose output stream
- *
+ *
* @return true if all steps are valid, shader compilation, attachment and linking; otherwise false.
*
* @see ShaderState#glEnableVertexAttribArray
@@ -199,26 +199,26 @@ public class ShaderProgram {
if(!init(gl) || !newShader.compile(gl, verboseOut)) {
return false;
}
-
+
boolean shaderWasInUse = inUse();
if(shaderWasInUse) {
useProgram(gl, false);
}
-
+
if(null != oldShader && allShaderCode.remove(oldShader)) {
if(attachedShaderCode.remove(oldShader)) {
ShaderUtil.detachShader(gl, shaderProgram, oldShader.shader());
}
}
-
+
add(newShader);
if(attachedShaderCode.add(newShader)) {
ShaderUtil.attachShader(gl, shaderProgram, newShader.shader());
}
-
+
gl.glLinkProgram(shaderProgram);
-
- programLinked = ShaderUtil.isProgramLinkStatusValid(gl, shaderProgram, System.err);
+
+ programLinked = ShaderUtil.isProgramLinkStatusValid(gl, shaderProgram, verboseOut);
if ( programLinked && shaderWasInUse ) {
useProgram(gl, true);
}
@@ -227,19 +227,19 @@ public class ShaderProgram {
/**
* Links the shader code to the program.
- *
+ *
* <p>Compiles and attaches the shader code to the program if not done by yet</p>
- *
+ *
* <p>Within this process, all GL resources (shader and program objects) are created if necessary.</p>
- *
+ *
* @param gl
* @param verboseOut
* @return true if program was successfully linked and is valid, otherwise false
- *
+ *
* @see #init(GL2ES2)
*/
public synchronized boolean link(GL2ES2 gl, PrintStream verboseOut) {
- if( !init(gl) ) {
+ if( !init(gl) ) {
programLinked = false; // mark unlinked due to user attempt to [re]link
return false;
}
@@ -258,11 +258,12 @@ public class ShaderProgram {
// Link the program
gl.glLinkProgram(shaderProgram);
- programLinked = ShaderUtil.isProgramLinkStatusValid(gl, shaderProgram, System.err);
+ programLinked = ShaderUtil.isProgramLinkStatusValid(gl, shaderProgram, verboseOut);
return programLinked;
}
+ @Override
public boolean equals(Object obj) {
if(this == obj) { return true; }
if(obj instanceof ShaderProgram) {
@@ -271,6 +272,7 @@ public class ShaderProgram {
return false;
}
+ @Override
public int hashCode() {
return id;
}
@@ -287,7 +289,8 @@ public class ShaderProgram {
sb.append("]");
return sb;
}
-
+
+ @Override
public String toString() {
return toString(null).toString();
}
@@ -299,7 +302,7 @@ public class ShaderProgram {
public synchronized boolean validateProgram(GL2ES2 gl, PrintStream verboseOut) {
return ShaderUtil.isProgramExecStatusValid(gl, shaderProgram, verboseOut);
}
-
+
public synchronized void useProgram(GL2ES2 gl, boolean on) {
if(!programLinked) { throw new GLException("Program is not linked"); }
if(programInUse==on) { return; }
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 8e7781f..f60cb60 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java
@@ -48,21 +48,21 @@ import com.jogamp.opengl.util.GLArrayDataEditable;
* while updating the attribute and uniform locations when switching.
* <p>
* This allows seamless switching of programs using <i>almost</i> same data
- * but performing different artifacts.
+ * but performing different artifacts.
* </p>
* <p>
* A {@link #useProgram(GL2ES2, boolean) used} ShaderState is attached to the current GL context
* and can be retrieved via {@link #getShaderState(GL)}.
* </p>
*/
-public class ShaderState {
+public class ShaderState {
public static final boolean DEBUG;
-
+
static {
Debug.initSingleton();
DEBUG = Debug.isPropertyDefined("jogl.debug.GLSLState", true);
}
-
+
public ShaderState() {
}
@@ -80,7 +80,7 @@ public class ShaderState {
/**
* Attach user object for the given name to this ShaderState.
* Returns the previously set object or null.
- *
+ *
* @return the previous mapped object or null if none
*/
public final Object attachObject(String name, Object obj) {
@@ -89,13 +89,13 @@ public class ShaderState {
/**
* @param name name of the mapped object to detach
- *
+ *
* @return the previous mapped object or null if none
*/
public final Object detachObject(String name) {
return attachedObjectsByString.remove(name);
- }
-
+ }
+
/**
* Turns the shader program on or off.<br>
*
@@ -104,7 +104,7 @@ public class ShaderState {
* @see com.jogamp.opengl.util.glsl.ShaderState#useProgram(GL2ES2, boolean)
*/
public synchronized void useProgram(GL2ES2 gl, boolean on) throws GLException {
- if(null==shaderProgram) { throw new GLException("No program is attached"); }
+ if(null==shaderProgram) { throw new GLException("No program is attached"); }
if(on) {
if(shaderProgram.linked()) {
shaderProgram.useProgram(gl, true);
@@ -112,7 +112,7 @@ public class ShaderState {
resetAllAttributes(gl);
resetAllUniforms(gl);
}
- } else {
+ } else {
if(resetAllShaderData) {
setAllAttributes(gl);
}
@@ -124,7 +124,7 @@ public class ShaderState {
resetAllUniforms(gl);
}
}
- resetAllShaderData = false;
+ resetAllShaderData = false;
} else {
shaderProgram.useProgram(gl, false);
}
@@ -141,17 +141,17 @@ public class ShaderState {
/**
* Attach or switch a shader program
*
- * <p>Attaching a shader program the first time,
+ * <p>Attaching a shader program the first time,
* as well as switching to another program on the fly,
* while managing all attribute and uniform data.</p>
- *
+ *
* <p>[Re]sets all data and use program in case of a program switch.</p>
- *
+ *
* <p>Use program, {@link #useProgram(GL2ES2, boolean)},
* if <code>enable</code> is <code>true</code>.</p>
- *
+ *
* @return true if shader program was attached, otherwise false (already attached)
- *
+ *
* @throws GLException if program was not linked and linking fails
*/
public synchronized boolean attachShaderProgram(GL2ES2 gl, ShaderProgram prog, boolean enable) throws GLException {
@@ -161,7 +161,7 @@ public class ShaderState {
System.err.println("ShaderState: attachShaderProgram: "+curId+" -> "+newId+" (enable: "+enable+")\n\t"+shaderProgram+"\n\t"+prog);
if(DEBUG) {
Thread.dumpStack();
- }
+ }
}
if(null!=shaderProgram) {
if(shaderProgram.equals(prog)) {
@@ -190,7 +190,7 @@ public class ShaderState {
shaderProgram = prog;
if(null!=shaderProgram) {
- // [re]set all data and use program if switching program,
+ // [re]set all data and use program if switching program,
// or use program if program is linked
if(resetAllShaderData || enable) {
useProgram(gl, true); // may reset all data
@@ -216,7 +216,7 @@ public class ShaderState {
*/
public synchronized void destroy(GL2ES2 gl) {
release(gl, true, true, true);
- attachedObjectsByString.clear();
+ attachedObjectsByString.clear();
}
/**
@@ -242,7 +242,7 @@ public class ShaderState {
if(destroyBoundAttributes) {
for(Iterator<GLArrayData> iter = managedAttributes.iterator(); iter.hasNext(); ) {
iter.next().destroy(gl);
- }
+ }
}
releaseAllAttributes(gl);
releaseAllUniforms(gl);
@@ -258,7 +258,7 @@ public class ShaderState {
/**
* Gets the cached location of a shader attribute.
*
- * @return -1 if there is no such attribute available,
+ * @return -1 if there is no such attribute available,
* otherwise >= 0
*
* @see #bindAttribLocation(GL2ES2, int, String)
@@ -270,7 +270,7 @@ public class ShaderState {
Integer idx = activeAttribLocationMap.get(name);
return (null!=idx)?idx.intValue():-1;
}
-
+
/**
* Get the previous cached vertex attribute data.
*
@@ -289,27 +289,27 @@ public class ShaderState {
public GLArrayData getAttribute(String name) {
return activeAttribDataMap.get(name);
}
-
+
public boolean isActiveAttribute(GLArrayData attribute) {
return attribute == activeAttribDataMap.get(attribute.getName());
}
-
+
/**
* Binds or unbinds the {@link GLArrayData} lifecycle to this ShaderState.
- *
+ *
* <p>If an attribute location is cached (ie {@link #bindAttribLocation(GL2ES2, int, String)})
* it is promoted to the {@link GLArrayData} instance.</p>
- *
- * <p>The attribute will be destroyed with {@link #destroy(GL2ES2)}
+ *
+ * <p>The attribute will be destroyed with {@link #destroy(GL2ES2)}
* and it's location will be reset when switching shader with {@link #attachShaderProgram(GL2ES2, ShaderProgram)}.</p>
- *
+ *
* <p>The data will not be transfered to the GPU, use {@link #vertexAttribPointer(GL2ES2, GLArrayData)} additionally.</p>
- *
+ *
* <p>The data will also be {@link GLArrayData#associate(Object, boolean) associated} with this ShaderState.</p>
- *
+ *
* @param attribute the {@link GLArrayData} which lifecycle shall be managed
* @param own true if <i>owning</i> shall be performs, false if <i>disowning</i>.
- *
+ *
* @see #bindAttribLocation(GL2ES2, int, String)
* @see #getAttribute(String)
* @see GLArrayData#associate(Object, boolean)
@@ -326,11 +326,11 @@ public class ShaderState {
}
attribute.associate(this, own);
}
-
+
public boolean ownsAttribute(GLArrayData attribute) {
return managedAttributes.contains(attribute);
}
-
+
/**
* Binds a shader attribute to a location.
* Multiple names can be bound to one location.
@@ -339,14 +339,14 @@ 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 #getAttribLocation(GL2ES2, String)
* @see #getCachedAttribLocation(String)
*/
public void bindAttribLocation(GL2ES2 gl, int location, String name) {
if(null==shaderProgram) throw new GLException("No program is attached");
- if(shaderProgram.linked()) throw new GLException("Program is already linked");
+ if(shaderProgram.linked()) throw new GLException("Program is already linked");
final Integer loc = new Integer(location);
activeAttribLocationMap.put(name, loc);
gl.glBindAttribLocation(shaderProgram.program(), location, name);
@@ -361,7 +361,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 #getAttribLocation(GL2ES2, String)
* @see #getCachedAttribLocation(String)
@@ -382,7 +382,7 @@ public class ShaderState {
* or the GLSL queried via {@link GL2ES2#glGetAttribLocation(int, String)}.<br>
* The location will be cached.
*
- * @return -1 if there is no such attribute available,
+ * @return -1 if there is no such attribute available,
* otherwise >= 0
* @throws GLException if no program is attached
* @throws GLException if the program is not linked and no location was cached.
@@ -407,22 +407,22 @@ public class ShaderState {
System.err.println("ShaderState: glGetAttribLocation failed, no location for: "+name+", loc: "+location);
if(DEBUG) {
Thread.dumpStack();
- }
+ }
}
}
return location;
}
-
+
/**
* Validates and returns the location of a shader attribute.<br>
- * Uses either the cached value {@link #getCachedAttribLocation(String)} if valid,
+ * Uses either the cached value {@link #getCachedAttribLocation(String)} if valid,
* or the GLSL queried via {@link GL2ES2#glGetAttribLocation(int, String)}.<br>
- * The location will be cached and set in the
+ * The location will be cached and set in the
* {@link GLArrayData} object.
*
- * @return -1 if there is no such attribute available,
+ * @return -1 if there is no such attribute available,
* otherwise >= 0
- *
+ *
* @throws GLException if no program is attached
* @throws GLException if the program is not linked and no location was cached.
*
@@ -451,13 +451,13 @@ public class ShaderState {
System.err.println("ShaderState: glGetAttribLocation failed, no location for: "+name+", loc: "+location);
if(DEBUG) {
Thread.dumpStack();
- }
+ }
}
- }
+ }
activeAttribDataMap.put(data.getName(), data);
return location;
}
-
+
//
// Enabled Vertex Arrays and its data
//
@@ -469,14 +469,14 @@ public class ShaderState {
final Boolean v = activedAttribEnabledMap.get(name);
return null != v && v.booleanValue();
}
-
+
/**
* @return true if the {@link GLArrayData} attribute is enable
*/
public final boolean isVertexAttribArrayEnabled(GLArrayData data) {
return isVertexAttribArrayEnabled(data.getName());
}
-
+
private boolean enableVertexAttribArray(GL2ES2 gl, String name, int location) {
activedAttribEnabledMap.put(name, Boolean.TRUE);
if(0>location) {
@@ -486,7 +486,7 @@ public class ShaderState {
System.err.println("ShaderState: glEnableVertexAttribArray failed, no index for: "+name);
if(DEBUG) {
Thread.dumpStack();
- }
+ }
}
return false;
}
@@ -497,12 +497,12 @@ public class ShaderState {
gl.glEnableVertexAttribArray(location);
return true;
}
-
+
/**
* Enables a vertex attribute array.
- *
+ *
* This method retrieves the the location via {@link #getAttribLocation(GL2ES2, GLArrayData)}
- * hence {@link #enableVertexAttribArray(GL2ES2, GLArrayData)} shall be preferred.
+ * hence {@link #enableVertexAttribArray(GL2ES2, GLArrayData)} shall be preferred.
*
* Even if the attribute is not found in the current shader,
* it is marked enabled in this state.
@@ -510,7 +510,7 @@ public class ShaderState {
* @return false, if the name is not found, otherwise true
*
* @throws GLException if the program is not linked and no location was cached.
- *
+ *
* @see #glEnableVertexAttribArray
* @see #glDisableVertexAttribArray
* @see #glVertexAttribPointer
@@ -519,7 +519,7 @@ public class ShaderState {
public boolean enableVertexAttribArray(GL2ES2 gl, String name) {
return enableVertexAttribArray(gl, name, -1);
}
-
+
/**
* Enables a vertex attribute array, usually invoked by {@link GLArrayDataEditable#enableBuffer(GL, boolean)}.
@@ -528,7 +528,7 @@ public class ShaderState {
* and is the preferred alternative to {@link #enableVertexAttribArray(GL2ES2, String)}.
* If data location is unset it will be retrieved via {@link #getAttribLocation(GL2ES2, GLArrayData)} set
* and cached in this state.
- *
+ *
* Even if the attribute is not found in the current shader,
* it is marked enabled in this state.
*
@@ -547,11 +547,11 @@ public class ShaderState {
getAttribLocation(gl, data);
} else {
// ensure data is the current bound one
- activeAttribDataMap.put(data.getName(), data);
+ activeAttribDataMap.put(data.getName(), data);
}
return enableVertexAttribArray(gl, data.getName(), data.getLocation());
}
-
+
private boolean disableVertexAttribArray(GL2ES2 gl, String name, int location) {
activedAttribEnabledMap.put(name, Boolean.FALSE);
if(0>location) {
@@ -572,13 +572,13 @@ public class ShaderState {
gl.glDisableVertexAttribArray(location);
return true;
}
-
+
/**
* Disables a vertex attribute array
*
* This method retrieves the the location via {@link #getAttribLocation(GL2ES2, GLArrayData)}
* hence {@link #disableVertexAttribArray(GL2ES2, GLArrayData)} shall be preferred.
- *
+ *
* Even if the attribute is not found in the current shader,
* it is removed from this state enabled list.
*
@@ -603,7 +603,7 @@ public class ShaderState {
* and is the preferred alternative to {@link #disableVertexAttribArray(GL2ES2, String)}.
* If data location is unset it will be retrieved via {@link #getAttribLocation(GL2ES2, GLArrayData)} set
* and cached in this state.
- *
+ *
* Even if the attribute is not found in the current shader,
* it is removed from this state enabled list.
*
@@ -623,20 +623,20 @@ public class ShaderState {
}
return disableVertexAttribArray(gl, data.getName(), data.getLocation());
}
-
+
/**
* Set the {@link GLArrayData} vertex attribute data, if it's location is valid, i.e. ≥ 0.
* <p>
* This method uses the {@link GLArrayData}'s location if valid, i.e. ≥ 0.<br/>
- * If data's location is invalid, it will be retrieved via {@link #getAttribLocation(GL2ES2, GLArrayData)},
+ * If data's location is invalid, it will be retrieved via {@link #getAttribLocation(GL2ES2, GLArrayData)},
* set and cached in this state.
* </p>
- *
+ *
* @return false, if the location could not be determined, otherwise true
*
* @throws GLException if no program is attached
* @throws GLException if the program is not linked and no location was cached.
- *
+ *
* @see #glEnableVertexAttribArray
* @see #glDisableVertexAttribArray
* @see #glVertexAttribPointer
@@ -646,7 +646,7 @@ public class ShaderState {
int location = data.getLocation();
if(0 > location) {
location = getAttribLocation(gl, data);
- }
+ }
if(0 <= location) {
// only pass the data, if the attribute exists in the current shader
if(DEBUG) {
@@ -683,16 +683,16 @@ public class ShaderState {
activeAttribDataMap.clear();
activedAttribEnabledMap.clear();
activeAttribLocationMap.clear();
- managedAttributes.clear();
+ managedAttributes.clear();
}
-
+
/**
* Disables all vertex attribute arrays.
*
* Their enabled stated will be removed from this state only
* if 'removeFromState' is true.
*
- * This method purpose is more for debugging.
+ * This method purpose is more for debugging.
*
* @see #glEnableVertexAttribArray
* @see #glDisableVertexAttribArray
@@ -717,7 +717,7 @@ public class ShaderState {
}
private final void relocateAttribute(GL2ES2 gl, GLArrayData attribute) {
- // get new location .. note: 'activeAttribLocationMap' is cleared before
+ // get new location .. note: 'activeAttribLocationMap' is cleared before
final String name = attribute.getName();
final int loc = attribute.setLocation(gl, shaderProgram.program());
if(0<=loc) {
@@ -729,34 +729,34 @@ public class ShaderState {
// enable attrib, VBO and pass location/data
gl.glEnableVertexAttribArray(loc);
}
-
+
if( attribute.isVBO() ) {
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, attribute.getVBOName());
gl.glVertexAttribPointer(attribute);
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
- } else {
+ } else {
gl.glVertexAttribPointer(attribute);
}
}
}
-
+
/**
* Reset all previously enabled mapped vertex attribute data.
- *
+ *
* <p>
* Attribute data is bound to the GL state, i.e. VBO data itself will not be updated.
* </p>
- *
+ *
* <p>
* Attribute location and it's data assignment is bound to the program,
* hence both are updated.
* </p>
- *
+ *
* <p>
- * Note: Such update could only be prevented,
+ * Note: Such update could only be prevented,
* if tracking am attribute/program dirty flag.
* </p>
- *
+ *
* @throws GLException is the program is not linked
*
* @see #attachShaderProgram(GL2ES2, ShaderProgram)
@@ -764,7 +764,7 @@ public class ShaderState {
private final void resetAllAttributes(GL2ES2 gl) {
if(!shaderProgram.linked()) throw new GLException("Program is not linked");
activeAttribLocationMap.clear();
-
+
for(int i=0; i<managedAttributes.size(); i++) {
((GLArrayData)managedAttributes.get(i)).setLocation(-1);
}
@@ -780,22 +780,22 @@ public class ShaderState {
if(0<=loc) {
bindAttribLocation(gl, loc, name);
-
+
if(isVertexAttribArrayEnabled(name)) {
// enable attrib, VBO and pass location/data
gl.glEnableVertexAttribArray(loc);
}
-
+
if( attribute.isVBO() ) {
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, attribute.getVBOName());
gl.glVertexAttribPointer(attribute);
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
- } else {
+ } else {
gl.glVertexAttribPointer(attribute);
}
}
}
-
+
/**
* preserves the attribute location .. (program not linked)
*/
@@ -812,7 +812,7 @@ public class ShaderState {
/**
* Gets the cached location of the shader uniform.
*
- * @return -1 if there is no such uniform available,
+ * @return -1 if there is no such uniform available,
* otherwise >= 0
*/
public final int getCachedUniformLocation(String name) {
@@ -822,38 +822,38 @@ public class ShaderState {
/**
* Bind the {@link GLUniform} lifecycle to this ShaderState.
- *
+ *
* <p>If a uniform location is cached it is promoted to the {@link GLUniformData} instance.</p>
- *
- * <p>The attribute will be destroyed with {@link #destroy(GL2ES2)}
+ *
+ * <p>The attribute will be destroyed with {@link #destroy(GL2ES2)}
* and it's location will be reset when switching shader with {@link #attachShaderProgram(GL2ES2, ShaderProgram)}.</p>
- *
+ *
* <p>The data will not be transfered to the GPU, use {@link #uniform(GL2ES2, GLUniformData)} additionally.</p>
- *
+ *
* @param uniform the {@link GLUniformData} which lifecycle shall be managed
- *
+ *
* @see #getUniform(String)
*/
public void ownUniform(GLUniformData uniform) {
final int location = getCachedUniformLocation(uniform.getName());
if(0<=location) {
uniform.setLocation(location);
- }
+ }
activeUniformDataMap.put(uniform.getName(), uniform);
- managedUniforms.add(uniform);
+ managedUniforms.add(uniform);
}
-
+
public boolean ownsUniform(GLUniformData uniform) {
return managedUniforms.contains(uniform);
}
-
+
/**
* Gets the location of a shader uniform with given <code>name</code>.<br>
* Uses either the cached value {@link #getCachedUniformLocation(String)} if valid,
* or the GLSL queried via {@link GL2ES2#glGetUniformLocation(int, String)}.<br>
* The location will be cached.
* <p>
- * The current shader program ({@link #attachShaderProgram(GL2ES2, ShaderProgram)})
+ * The current shader program ({@link #attachShaderProgram(GL2ES2, ShaderProgram)})
* must be in use ({@link #useProgram(GL2ES2, boolean) }) !</p>
*
* @return -1 if there is no such attribute available,
@@ -884,15 +884,15 @@ public class ShaderState {
}
return location;
}
-
+
/**
* Validates and returns the location of a shader uniform.<br>
* Uses either the cached value {@link #getCachedUniformLocation(String)} if valid,
* or the GLSL queried via {@link GL2ES2#glGetUniformLocation(int, String)}.<br>
- * The location will be cached and set in the
+ * The location will be cached and set in the
* {@link GLUniformData} object.
* <p>
- * The current shader program ({@link #attachShaderProgram(GL2ES2, ShaderProgram)})
+ * The current shader program ({@link #attachShaderProgram(GL2ES2, ShaderProgram)})
* must be in use ({@link #useProgram(GL2ES2, boolean) }) !</p>
*
* @return -1 if there is no such attribute available,
@@ -922,16 +922,16 @@ public class ShaderState {
Thread.dumpStack();
}
}
- }
- activeUniformDataMap.put(name, data);
+ }
+ activeUniformDataMap.put(name, data);
return location;
}
-
+
/**
* Set the uniform data, if it's location is valid, i.e. ≥ 0.
* <p>
* This method uses the {@link GLUniformData}'s location if valid, i.e. ≥ 0.<br/>
- * If data's location is invalid, it will be retrieved via {@link #getUniformLocation(GL2ES2, GLUniformData)},
+ * If data's location is invalid, it will be retrieved via {@link #getUniformLocation(GL2ES2, GLUniformData)},
* set and cached in this state.
* </p>
*
@@ -959,7 +959,7 @@ public class ShaderState {
}
return false;
}
-
+
/**
* Get the uniform data, previously set.
*
@@ -978,7 +978,7 @@ public class ShaderState {
activeUniformLocationMap.clear();
managedUniforms.clear();
}
-
+
/**
* Reset all previously mapped uniform data
* <p>
@@ -986,20 +986,20 @@ public class ShaderState {
* hence both are updated.
* </p>
* <p>
- * Note: Such update could only be prevented,
+ * Note: Such update could only be prevented,
* if tracking a uniform/program dirty flag.
* </p>
- *
+ *
* @throws GLException is the program is not in use
- *
+ *
* @see #attachShaderProgram(GL2ES2, ShaderProgram)
*/
private final void resetAllUniforms(GL2ES2 gl) {
- if(!shaderProgram.inUse()) throw new GLException("Program is not in use");
+ if(!shaderProgram.inUse()) throw new GLException("Program is not in use");
activeUniformLocationMap.clear();
for(Iterator<GLUniformData> iter = managedUniforms.iterator(); iter.hasNext(); ) {
iter.next().setLocation(-1);
- }
+ }
for(Iterator<GLUniformData> iter = activeUniformDataMap.values().iterator(); iter.hasNext(); ) {
final GLUniformData data = iter.next();
final int loc = data.setLocation(gl, shaderProgram.program());
@@ -1018,9 +1018,9 @@ public class ShaderState {
if(null==sb) {
sb = new StringBuilder();
}
-
+
sb.append("ShaderState[ ");
-
+
sb.append(Platform.getNewline()).append(" ");
if(null != shaderProgram) {
shaderProgram.toString(sb);
@@ -1066,25 +1066,25 @@ public class ShaderState {
sb.append(Platform.getNewline()).append(" ]").append(Platform.getNewline()).append("]");
return sb;
}
-
+
@Override
public String toString() {
return toString(null, DEBUG).toString();
}
-
+
private boolean verbose = DEBUG;
private ShaderProgram shaderProgram=null;
-
+
private HashMap<String, Boolean> activedAttribEnabledMap = new HashMap<String, Boolean>();
private HashMap<String, Integer> activeAttribLocationMap = new HashMap<String, Integer>();
private HashMap<String, GLArrayData> activeAttribDataMap = new HashMap<String, GLArrayData>();
private ArrayList<GLArrayData> managedAttributes = new ArrayList<GLArrayData>();
-
+
private HashMap<String, Integer> activeUniformLocationMap = new HashMap<String, Integer>();
private HashMap<String, GLUniformData> activeUniformDataMap = new HashMap<String, GLUniformData>();
private ArrayList<GLUniformData> managedUniforms = new ArrayList<GLUniformData>();
-
- private HashMap<String, Object> attachedObjectsByString = new HashMap<String, Object>();
+
+ private HashMap<String, Object> attachedObjectsByString = new HashMap<String, Object>();
private boolean resetAllShaderData = false;
}
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 d18fd4b..5cd384c 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2009 Sun Microsystems, Inc. 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
@@ -28,7 +28,7 @@
* 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.
- *
+ *
*/
package com.jogamp.opengl.util.glsl;
@@ -117,11 +117,11 @@ public class ShaderUtil {
}
return true;
}
-
+
/**
* Performs {@link GL2ES2#glValidateProgram(int)}
* <p>
- * One shall only call this method while debugging and only if all required
+ * One shall only call this method while debugging and only if all required
* resources by the shader are set.
* </p>
* <p>
@@ -150,7 +150,7 @@ public class ShaderUtil {
}
/**
- * If supported, queries the natively supported shader binary formats using
+ * If supported, queries the natively supported shader binary formats using
* {@link GL2ES2#GL_NUM_SHADER_BINARY_FORMATS} and {@link GL2ES2#GL_SHADER_BINARY_FORMATS}
* via {@link GL2ES2#glGetIntegerv(int, int[], int)}.
*/
@@ -172,9 +172,9 @@ public class ShaderUtil {
info.shaderBinaryFormats.add(new Integer(formats[i]));
}
}
- } catch (GLException gle) {
- System.err.println("Catched Exception on thread "+Thread.currentThread().getName());
- gle.printStackTrace();
+ } catch (GLException gle) {
+ System.err.println("Catched Exception on thread "+Thread.currentThread().getName());
+ gle.printStackTrace();
}
}
}
@@ -202,13 +202,13 @@ public class ShaderUtil {
}
info.shaderCompilerAvailable = new Boolean(v);
queryOK = true;
- } catch (GLException gle) {
- System.err.println("Catched Exception on thread "+Thread.currentThread().getName());
- gle.printStackTrace();
+ } catch (GLException gle) {
+ System.err.println("Catched Exception on thread "+Thread.currentThread().getName());
+ gle.printStackTrace();
}
if(!queryOK) {
info.shaderCompilerAvailable = new Boolean(true);
- }
+ }
} else if( gl.isGL2ES2() ) {
info.shaderCompilerAvailable = new Boolean(true);
} else {
@@ -217,8 +217,8 @@ public class ShaderUtil {
}
return info.shaderCompilerAvailable.booleanValue();
}
-
- /** Returns true if GeometryShader is supported, i.e. whether GLContext is ≥ 3.2 or ARB_geometry_shader4 extension is available. */
+
+ /** Returns true if GeometryShader is supported, i.e. whether GLContext is ≥ 3.2 or ARB_geometry_shader4 extension is available. */
public static boolean isGeometryShaderSupported(GL _gl) {
final GLContext ctx = _gl.getContext();
return ctx.getGLVersionNumber().compareTo(GLContext.Version320) >= 0 ||
@@ -240,7 +240,7 @@ public class ShaderUtil {
IntBuffer lengths = Buffers.newDirectIntBuffer(count);
for(int i=0; i<count; i++) {
lengths.put(i, source[i].length());
- }
+ }
if(source instanceof String[]) {
// rare case ..
gl.glShaderSource(shader, count, (String[])source, lengths);
@@ -338,7 +338,7 @@ public class ShaderUtil {
}
createShader(gl, shaderType, shader);
- err = gl.glGetError();
+ err = gl.glGetError();
if(err!=GL.GL_NO_ERROR) {
throw new GLException("createAndLoadShader: CreateShader failed, GL Error: 0x"+Integer.toHexString(err));
}
@@ -353,7 +353,7 @@ public class ShaderUtil {
}
public static boolean createAndCompileShader(GL _gl, IntBuffer shader, int shaderType,
- CharSequence[][] sources,
+ CharSequence[][] sources,
PrintStream verboseOut)
{
final GL2ES2 gl = _gl.getGL2ES2();
@@ -363,32 +363,32 @@ public class ShaderUtil {
}
createShader(gl, shaderType, shader);
- err = gl.glGetError();
+ err = gl.glGetError();
if(err!=GL.GL_NO_ERROR) {
throw new GLException("createAndCompileShader: CreateShader failed, GL Error: 0x"+Integer.toHexString(err));
}
shaderSource(gl, shader, sources);
- err = gl.glGetError();
+ err = gl.glGetError();
if(err!=GL.GL_NO_ERROR) {
throw new GLException("createAndCompileShader: ShaderSource failed, GL Error: 0x"+Integer.toHexString(err));
}
compileShader(gl, shader);
- err = gl.glGetError();
+ err = gl.glGetError();
if(err!=GL.GL_NO_ERROR && null!=verboseOut) {
verboseOut.println("createAndCompileShader: CompileShader failed, GL Error: 0x"+Integer.toHexString(err));
}
return isShaderStatusValid(gl, shader, GL2ES2.GL_COMPILE_STATUS, verboseOut) && err == GL.GL_NO_ERROR;
}
-
+
private static final String implObjectKey = "com.jogamp.opengl.util.glsl.ShaderUtil" ;
-
+
private static class ProfileInformation {
Boolean shaderCompilerAvailable = null;
Set<Integer> shaderBinaryFormats = null;
- }
+ }
private static ProfileInformation getProfileInformation(GL gl) {
final GLContext context = gl.getContext();
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 a653bd4..2f8884a 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
@@ -24,13 +24,13 @@ import com.jogamp.opengl.util.PMVMatrix;
public class FixedFuncUtil {
/**
* @param gl
- * @param mode one of the {@link ShaderSelectionMode}s
+ * @param mode one of the {@link ShaderSelectionMode}s
* @param pmvMatrix optional pass through PMVMatrix for the {@link FixedFuncHook} and {@link FixedFuncPipeline}
* @return If gl is a GL2ES1 and force is false, return the type cast object,
* otherwise create a fixed function emulation pipeline using the given GL2ES2 impl
* and hook it to the GLContext via {@link GLContext#setGL(GL)}.
* @throws GLException if the GL object is neither GL2ES1 nor GL2ES2
- *
+ *
* @see ShaderSelectionMode#AUTO
* @see ShaderSelectionMode#COLOR
* @see ShaderSelectionMode#COLOR_LIGHT_PER_VERTEX
@@ -53,13 +53,13 @@ public class FixedFuncUtil {
/**
* @param gl
- * @param mode one of the {@link ShaderSelectionMode}s
+ * @param mode one of the {@link ShaderSelectionMode}s
* @param pmvMatrix optional pass through PMVMatrix for the {@link FixedFuncHook} and {@link FixedFuncPipeline}
* @return If gl is a GL2ES1, return the type cast object,
* otherwise create a fixed function emulation pipeline using the GL2ES2 impl.
* and hook it to the GLContext via {@link GLContext#setGL(GL)}.
* @throws GLException if the GL object is neither GL2ES1 nor GL2ES2
- *
+ *
* @see ShaderSelectionMode#AUTO
* @see ShaderSelectionMode#COLOR
* @see ShaderSelectionMode#COLOR_LIGHT_PER_VERTEX
@@ -71,11 +71,11 @@ public class FixedFuncUtil {
}
/**
- * Mapping fixed function (client) array indices to
+ * Mapping fixed function (client) array indices to
* GLSL array attribute names.
*
* Useful for uniq mapping of canonical array index names as listed.
- *
+ *
* @see #mgl_Vertex
* @see javax.media.opengl.fixedfunc.GLPointerFunc#GL_VERTEX_ARRAY
* @see #mgl_Normal
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/ShaderSelectionMode.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/ShaderSelectionMode.java
index e6bdf70..426fb0d 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/ShaderSelectionMode.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/ShaderSelectionMode.java
@@ -1,8 +1,8 @@
package com.jogamp.opengl.util.glsl.fixedfunc;
-/**
+/**
* Shader selection mode
- *
+ *
* @see ShaderSelectionMode#AUTO
* @see ShaderSelectionMode#COLOR
* @see ShaderSelectionMode#COLOR_LIGHT_PER_VERTEX
@@ -11,17 +11,17 @@ package com.jogamp.opengl.util.glsl.fixedfunc;
*/
public enum ShaderSelectionMode {
/** Auto shader selection, based upon FFP states. */
- AUTO,
+ AUTO,
/** Fixed shader selection: Simple color. */
- COLOR,
+ COLOR,
/** Fixed shader selection: Multi-Textured color. 2 texture units. */
- COLOR_TEXTURE2,
+ COLOR_TEXTURE2,
/** Fixed shader selection: Multi-Textured color. 4 texture units. */
- COLOR_TEXTURE4,
+ COLOR_TEXTURE4,
/** Fixed shader selection: Multi-Textured color. 8 texture units. */
- COLOR_TEXTURE8,
+ COLOR_TEXTURE8,
/** Fixed shader selection: Color with vertex-lighting. */
- COLOR_LIGHT_PER_VERTEX,
+ COLOR_LIGHT_PER_VERTEX,
/** Fixed shader selection: Multi-Textured color with vertex-lighting. 8 texture units.*/
- COLOR_TEXTURE8_LIGHT_PER_VERTEX
+ COLOR_TEXTURE8_LIGHT_PER_VERTEX
}
\ No newline at end of file
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 a5b1c66..44fbf1c 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
@@ -55,8 +55,8 @@ public abstract class CompileShader {
URL resourceURL = IOUtil.getResource(null, resourceName).getURL();
String dirName = dirname(resourceURL.getPath());
- outName = dirName + File.separator + "bin" + File.separator +
- ShaderCode.getBinarySubPath(getBinaryFormat()) + File.separator +
+ outName = dirName + File.separator + "bin" + File.separator +
+ ShaderCode.getBinarySubPath(getBinaryFormat()) + File.separator +
outName;
processOneShader(resourceName, outName, type);
}
@@ -137,7 +137,7 @@ public abstract class CompileShader {
}
String dirname;
if (lastSlash < 0) {
- dirname = new String();
+ dirname = "";
} else {
dirname = path.substring(0, lastSlash + 1);
}
@@ -161,6 +161,7 @@ public abstract class CompileShader {
new Thread(this, "Output Reader Thread").start();
}
+ @Override
public void run()
{
byte[] buffer = new byte[4096];
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 8eb9ef5..215cf59 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
@@ -21,10 +21,12 @@ public class CompileShaderNVidia extends CompileShader {
}
}
+ @Override
public int getBinaryFormat() {
return GLES2.GL_NVIDIA_PLATFORM_BINARY_NV;
}
+ @Override
public File getSDKCompilerDir() {
File compilerDir = new File( NVAPSDK + File.separator + "tools" + File.separator );
File compilerFile = new File( compilerDir, getVertexShaderCompiler());
@@ -39,10 +41,12 @@ public class CompileShaderNVidia extends CompileShader {
return compilerDir;
}
+ @Override
public String getVertexShaderCompiler() {
return "glslv.bat";
}
+ @Override
public String getFragmentShaderCompiler() {
return "glslf.bat";
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/BackingStoreManager.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/BackingStoreManager.java
index 7b6a1b4..c1b5025 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/packrect/BackingStoreManager.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/BackingStoreManager.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2006 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.java
index 5ba3f73..9aadfba 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2006 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -47,22 +47,22 @@ public class Level {
private int yPos;
private LevelSet holder;
- private List/*<Rect>*/ rects = new ArrayList/*<Rect>*/();
- private List/*<Rect>*/ freeList;
+ private List<Rect> rects = new ArrayList<Rect>();
+ private List<Rect> freeList;
private int nextAddX;
- static class RectXComparator implements Comparator {
- public int compare(Object o1, Object o2) {
- Rect r1 = (Rect) o1;
- Rect r2 = (Rect) o2;
+ static class RectXComparator implements Comparator<Rect> {
+ @Override
+ public int compare(Rect r1, Rect r2) {
return r1.x() - r2.x();
}
+ @Override
public boolean equals(Object obj) {
return this == obj;
}
}
- private static final Comparator rectXComparator = new RectXComparator();
+ private static final Comparator<Rect> rectXComparator = new RectXComparator();
public Level(int width, int height, int yPos, LevelSet holder) {
this.width = width;
@@ -108,8 +108,8 @@ public class Level {
// See whether we can add from the free list
if (freeList != null) {
Rect candidate = null;
- for (Iterator iter = freeList.iterator(); iter.hasNext(); ) {
- Rect cur = (Rect) iter.next();
+ for (Iterator<Rect> iter = freeList.iterator(); iter.hasNext(); ) {
+ Rect cur = iter.next();
if (cur.canContain(rect)) {
candidate = cur;
break;
@@ -128,7 +128,7 @@ public class Level {
candidate.setSize(candidate.w() - rect.w(), height);
freeList.add(candidate);
}
-
+
coalesceFreeList();
return true;
@@ -149,7 +149,7 @@ public class Level {
nextAddX -= rect.w();
} else {
if (freeList == null) {
- freeList = new ArrayList/*<Rect>*/();
+ freeList = new ArrayList<Rect>();
}
freeList.add(new Rect(rect.x(), rect.y(), rect.w(), height, null));
coalesceFreeList();
@@ -171,8 +171,8 @@ public class Level {
if (freeList == null)
return false;
int freeListWidth = 0;
- for (Iterator iter = freeList.iterator(); iter.hasNext(); ) {
- Rect cur = (Rect) iter.next();
+ for (Iterator<Rect> iter = freeList.iterator(); iter.hasNext(); ) {
+ Rect cur = iter.next();
freeListWidth += cur.w();
}
// Add on the remaining space at the end
@@ -184,8 +184,8 @@ public class Level {
Collections.sort(rects, rectXComparator);
int nextCompactionDest = 0;
manager.beginMovement(backingStore, backingStore);
- for (Iterator iter = rects.iterator(); iter.hasNext(); ) {
- Rect cur = (Rect) iter.next();
+ for (Iterator<Rect> iter = rects.iterator(); iter.hasNext(); ) {
+ Rect cur = iter.next();
if (cur.x() != nextCompactionDest) {
manager.move(backingStore, cur,
backingStore, new Rect(nextCompactionDest, cur.y(), cur.w(), cur.h(), null));
@@ -198,14 +198,14 @@ public class Level {
manager.endMovement(backingStore, backingStore);
}
- public Iterator iterator() {
+ public Iterator<Rect> iterator() {
return rects.iterator();
}
/** Visits all Rects contained in this Level. */
public void visit(RectVisitor visitor) {
- for (Iterator iter = rects.iterator(); iter.hasNext(); ) {
- Rect rect = (Rect) iter.next();
+ for (Iterator<Rect> iter = rects.iterator(); iter.hasNext(); ) {
+ Rect rect = iter.next();
visitor.visit(rect);
}
}
@@ -216,7 +216,7 @@ public class Level {
original Rects. */
public void updateRectangleReferences() {
for (int i = 0; i < rects.size(); i++) {
- Rect cur = (Rect) rects.get(i);
+ Rect cur = rects.get(i);
Rect next = cur.getNextLocation();
next.setPosition(cur.x(), cur.y());
if (cur.w() != next.w() || cur.h() != next.h())
@@ -235,8 +235,8 @@ public class Level {
Collections.sort(freeList, rectXComparator);
int i = 0;
while (i < freeList.size() - 1) {
- Rect r1 = (Rect) freeList.get(i);
- Rect r2 = (Rect) freeList.get(i+1);
+ Rect r1 = freeList.get(i);
+ Rect r2 = freeList.get(i+1);
if (r1.maxX() + 1 == r2.x()) {
// Coalesce r1 and r2 into one block
freeList.remove(i+1);
@@ -246,7 +246,7 @@ public class Level {
}
}
// See whether the last block bumps up against the addition point
- Rect last = (Rect) freeList.get(freeList.size() - 1);
+ Rect last = freeList.get(freeList.size() - 1);
if (last.maxX() + 1 == nextAddX) {
nextAddX -= last.w();
freeList.remove(freeList.size() - 1);
@@ -262,8 +262,8 @@ public class Level {
public void dumpFreeSpace() {
int freeListWidth = 0;
- for (Iterator iter = freeList.iterator(); iter.hasNext(); ) {
- Rect cur = (Rect) iter.next();
+ for (Iterator<Rect> iter = freeList.iterator(); iter.hasNext(); ) {
+ Rect cur = iter.next();
System.err.println(" Free rectangle at " + cur);
freeListWidth += cur.w();
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java
index 6783aec..433421f 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2006 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -47,7 +47,7 @@ import java.util.*;
public class LevelSet {
// Maintained in sorted order by increasing Y coordinate
- private List/*<Level>*/ levels = new ArrayList/*<Level>*/();
+ private List<Level> levels = new ArrayList<Level>();
private int nextAddY;
private int w;
private int h;
@@ -73,7 +73,7 @@ public class LevelSet {
// Go in reverse order through the levels seeing whether we can
// trivially satisfy the allocation request
for (int i = levels.size() - 1; i >= 0; --i) {
- Level level = (Level) levels.get(i);
+ Level level = levels.get(i);
if (level.add(rect))
return true;
}
@@ -82,7 +82,7 @@ public class LevelSet {
// increases the computational complexity of the addition process,
// but prevents us from expanding unnecessarily.
for (int i = levels.size() - 1; i >= 0; --i) {
- Level level = (Level) levels.get(i);
+ Level level = levels.get(i);
if (level.couldAllocateIfCompacted(rect))
return false;
}
@@ -104,11 +104,11 @@ public class LevelSet {
/** Removes the given Rect from this LevelSet. */
public boolean remove(Rect rect) {
for (int i = levels.size() - 1; i >= 0; --i) {
- Level level = (Level) levels.get(i);
+ Level level = levels.get(i);
if (level.remove(rect))
return true;
}
-
+
return false;
}
@@ -120,7 +120,7 @@ public class LevelSet {
Object backingStore,
BackingStoreManager manager) {
for (int i = levels.size() - 1; i >= 0; --i) {
- Level level = (Level) levels.get(i);
+ Level level = levels.get(i);
if (level.couldAllocateIfCompacted(rect)) {
level.compact(backingStore, manager);
boolean res = level.add(rect);
@@ -173,8 +173,8 @@ public class LevelSet {
int usedHeight = getUsedHeight();
if (usedHeight == 0)
return 0.0f;
- for (Iterator iter = iterator(); iter.hasNext(); ) {
- Level level = (Level) iter.next();
+ for (Iterator<Level> iter = iterator(); iter.hasNext(); ) {
+ Level level = iter.next();
if (level.isEmpty()) {
freeHeight += level.h();
}
@@ -182,14 +182,14 @@ public class LevelSet {
return (float) freeHeight / (float) usedHeight;
}
- public Iterator iterator() {
+ public Iterator<Level> iterator() {
return levels.iterator();
}
/** Visits all Rects contained in this LevelSet. */
public void visit(RectVisitor visitor) {
- for (Iterator iter = levels.iterator(); iter.hasNext(); ) {
- Level level = (Level) iter.next();
+ for (Iterator<Level> iter = levels.iterator(); iter.hasNext(); ) {
+ Level level = iter.next();
level.visit(visitor);
}
}
@@ -199,8 +199,8 @@ public class LevelSet {
update the new Rects in a newly laid-out LevelSet with the
original Rects. */
public void updateRectangleReferences() {
- for (Iterator iter = levels.iterator(); iter.hasNext(); ) {
- Level level = (Level) iter.next();
+ for (Iterator<Level> iter = levels.iterator(); iter.hasNext(); ) {
+ Level level = iter.next();
level.updateRectangleReferences();
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java
index 6206c4a..89f5942 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2006 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -72,7 +72,7 @@ public class Rect {
// there is no room left due either to fragmentation or just being
// out of space)
private Rect nextLocation;
-
+
public Rect() {
this(null);
}
@@ -144,6 +144,7 @@ public class Rect {
h() >= other.h());
}
+ @Override
public String toString() {
return "[Rect x: " + x() + " y: " + y() + " w: " + w() + " h: " + h() + "]";
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/RectVisitor.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/RectVisitor.java
index 49cfc82..5db2167 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/packrect/RectVisitor.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/RectVisitor.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2006 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java
index 1496a04..44faa44 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2006 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -60,18 +60,18 @@ public class RectanglePacker {
private int maxWidth = -1;
private int maxHeight = -1;
- static class RectHComparator implements Comparator {
- public int compare(Object o1, Object o2) {
- Rect r1 = (Rect) o1;
- Rect r2 = (Rect) o2;
+ static class RectHComparator implements Comparator<Rect> {
+ @Override
+ public int compare(Rect r1, Rect r2) {
return r2.h() - r1.h();
}
+ @Override
public boolean equals(Object obj) {
return this == obj;
}
}
- private static final Comparator rectHComparator = new RectHComparator();
+ private static final Comparator<Rect> rectHComparator = new RectHComparator();
public RectanglePacker(BackingStoreManager manager,
int initialWidth,
@@ -203,13 +203,13 @@ public class RectanglePacker {
}
nextLevelSet = new LevelSet(newWidth, newHeight);
-
+
// Make copies of all existing rectangles
- List/*<Rect>*/ newRects = new ArrayList/*<Rect>*/();
- for (Iterator i1 = levels.iterator(); i1.hasNext(); ) {
- Level level = (Level) i1.next();
- for (Iterator i2 = level.iterator(); i2.hasNext(); ) {
- Rect cur = (Rect) i2.next();
+ List<Rect> newRects = new ArrayList<Rect>();
+ for (Iterator<Level> i1 = levels.iterator(); i1.hasNext(); ) {
+ Level level = i1.next();
+ for (Iterator<Rect> i2 = level.iterator(); i2.hasNext(); ) {
+ Rect cur = i2.next();
Rect newRect = new Rect(0, 0, cur.w(), cur.h(), null);
cur.setNextLocation(newRect);
// Hook up the reverse mapping too for easier replacement
@@ -222,8 +222,8 @@ public class RectanglePacker {
Collections.sort(newRects, rectHComparator);
// Try putting all of these rectangles into the new level set
done = true;
- for (Iterator iter = newRects.iterator(); iter.hasNext(); ) {
- if (!nextLevelSet.add((Rect) iter.next())) {
+ for (Iterator<Rect> iter = newRects.iterator(); iter.hasNext(); ) {
+ if (!nextLevelSet.add(iter.next())) {
done = false;
break;
}
@@ -271,10 +271,10 @@ public class RectanglePacker {
Object newBackingStore = manager.allocateBackingStore(nextLevelSet.w(),
nextLevelSet.h());
manager.beginMovement(backingStore, newBackingStore);
- for (Iterator i1 = levels.iterator(); i1.hasNext(); ) {
- Level level = (Level) i1.next();
- for (Iterator i2 = level.iterator(); i2.hasNext(); ) {
- Rect cur = (Rect) i2.next();
+ for (Iterator<Level> i1 = levels.iterator(); i1.hasNext(); ) {
+ Level level = i1.next();
+ for (Iterator<Rect> i2 = level.iterator(); i2.hasNext(); ) {
+ Rect cur = i2.next();
manager.move(backingStore, cur,
newBackingStore, cur.getNextLocation());
}
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 f2ef3ac..584cacf 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 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
@@ -29,7 +29,7 @@
* 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.
@@ -53,8 +53,8 @@ import com.jogamp.opengl.util.texture.spi.*;
* for enabling/disabling OpenGL texture state, binding this texture,
* and computing texture coordinates for both the entire image as well
* as a sub-image.
- *
- * <a name="textureCallOrder"><h5>Order of Texture Commands</h5></a>
+ *
+ * <a name="textureCallOrder"><h5>Order of Texture Commands</h5></a>
* <p>
* Due to many confusions w/ texture usage, following list described the order
* and semantics of texture unit selection, binding and enabling.
@@ -67,16 +67,16 @@ import com.jogamp.opengl.util.texture.spi.*;
* <li>Issue draw commands</li>
* </ul>
* </p>
- *
+ *
* <p><a name="nonpow2"><b>Non-power-of-two restrictions</b></a>
* <br> When creating an OpenGL texture object, the Texture class will
* attempt to use <i>non-power-of-two textures</i> (NPOT) if available, see {@link GL#isNPOTTextureAvailable()}.
- * Further more,
+ * Further more,
* <a href="http://www.opengl.org/registry/specs/ARB/texture_rectangle.txt">GL_ARB_texture_rectangle</a>
* (RECT) will be attempted on OSX w/ ATI drivers.
* If NPOT is not available or RECT not chosen, the Texture class will simply upload a non-pow2-sized
* image into a standard pow2-sized texture (without any special
- * scaling).
+ * scaling).
* Since the choice of extension (or whether one is used at
* all) depends on the user's machine configuration, developers are
* recommended to use {@link #getImageTexCoords} and {@link
@@ -106,7 +106,7 @@ import com.jogamp.opengl.util.texture.spi.*;
* #bind}, but when drawing many triangles all using the same texture,
* for best performance only one call to {@link #bind} should be made.
* User may also utilize multiple texture units,
- * see <a href="#textureCallOrder"> order of texture commands above</a>.
+ * see <a href="#textureCallOrder"> order of texture commands above</a>.
*
* <p><a name="premult"><b>Alpha premultiplication and blending</b></a>
* <p>
@@ -119,7 +119,7 @@ import com.jogamp.opengl.util.texture.spi.*;
* <p>
* The mathematically correct way to perform blending in OpenGL
* with the SrcOver "source over destination" mode, or any other
- * Porter-Duff rule, is to use <i>premultiplied color components</i>,
+ * Porter-Duff rule, is to use <i>premultiplied color components</i>,
* which means the R/G/ B color components must have been multiplied by
* the alpha value. If using <i>premultiplied color components</i>
* it is important to use the correct blending function; for
@@ -137,7 +137,7 @@ import com.jogamp.opengl.util.texture.spi.*;
float g = g * a;
float b = b * a;
gl.glColor4f(r, g, b, a);
-</pre>
+</pre>
*
* For reference, here is a list of the Porter-Duff compositing rules
* and the associated OpenGL blend functions (source and destination
@@ -188,6 +188,13 @@ public class Texture {
/** The texture coordinates corresponding to the entire image. */
private TextureCoords coords;
+ @Override
+ public String toString() {
+ return "Texture[target 0x"+Integer.toHexString(target)+", name "+texID+", "+
+ imgWidth+"/"+texWidth+" x "+imgHeight+"/"+texHeight+", y-flip "+mustFlipVertically+
+ ", "+estimatedMemorySize+" bytes]";
+ }
+
/** An estimate of the amount of texture memory this texture consumes. */
private int estimatedMemorySize;
@@ -231,7 +238,7 @@ public class Texture {
* gl.glEnable(texture.getTarget());
* </pre>
* <p>
- * Call is ignored if the {@link GL} object's context
+ * Call is ignored if the {@link GL} object's context
* is using a core profile, see {@link GL#isGLcore()},
* or if {@link #getTarget()} is {@link GLES2#GL_TEXTURE_EXTERNAL_OES}.
* </p>
@@ -249,7 +256,7 @@ public class Texture {
gl.glEnable(target);
}
}
-
+
/**
* Disables this texture's target (e.g., GL_TEXTURE_2D) in the
* given GL state. This method is a shorthand equivalent
@@ -258,7 +265,7 @@ public class Texture {
* gl.glDisable(texture.getTarget());
* </pre>
* <p>
- * Call is ignored if the {@link GL} object's context
+ * Call is ignored if the {@link GL} object's context
* is using a core profile, see {@link GL#isGLcore()},
* or if {@link #getTarget()} is {@link GLES2#GL_TEXTURE_EXTERNAL_OES}.
* </p>
@@ -276,7 +283,7 @@ public class Texture {
gl.glDisable(target);
}
}
-
+
/**
* Binds this texture to the given GL context. This method is a
* shorthand equivalent of the following OpenGL code:
@@ -286,16 +293,16 @@ public class Texture {
*
* See the <a href="#perftips">performance tips</a> above for hints
* on how to maximize performance when using many Texture objects.
- *
+ *
* @param gl the current GL context
* @throws GLException if no OpenGL context was current or if any
* OpenGL-related errors occurred
*/
public void bind(GL gl) throws GLException {
validateTexID(gl, true);
- gl.glBindTexture(target, texID);
+ gl.glBindTexture(target, texID);
}
-
+
/**
* Destroys the native resources used by this texture object.
*
@@ -329,7 +336,7 @@ public class Texture {
public int getWidth() {
return texWidth;
}
-
+
/**
* Returns the height of the allocated OpenGL texture in pixels.
* Note that the texture height will be greater than or equal to the
@@ -339,9 +346,9 @@ public class Texture {
*/
public int getHeight() {
return texHeight;
- }
-
- /**
+ }
+
+ /**
* Returns the width of the image contained within this texture.
* Note that for non-power-of-two textures in particular this may
* not be equal to the result of {@link #getWidth}. It is
@@ -383,7 +390,7 @@ public class Texture {
* entire image. If the TextureData indicated that the texture
* coordinates must be flipped vertically, the returned
* TextureCoords will take that into account.
- *
+ *
* @return the texture coordinates corresponding to the entire image
*/
public TextureCoords getImageTexCoords() {
@@ -400,7 +407,7 @@ public class Texture {
* flipped vertically, the returned TextureCoords will take that
* into account; this should not be handled by the end user in the
* specification of the y1 and y2 coordinates.
- *
+ *
* @return the texture coordinates corresponding to the specified sub-image
*/
public TextureCoords getSubImageTexCoords(int x1, int y1, int x2, int y2) {
@@ -425,9 +432,9 @@ public class Texture {
}
/**
- * Updates the entire content area of this texture using the data in
- * the given image.
- *
+ * Updates the entire content area incl. {@link TextureCoords}
+ * of this texture using the data in the given image.
+ *
* @throws GLException if any OpenGL-related errors occurred
*/
public void updateImage(GL gl, TextureData data) throws GLException {
@@ -447,10 +454,24 @@ public class Texture {
}
/**
- * Updates the content area of the specified target of this texture
+ * Change whether the TextureData requires a vertical flip of
+ * the texture coords.
+ * <p>
+ * No-op if no change, otherwise generates new {@link TextureCoords}.
+ * </p>
+ */
+ public void setMustFlipVertically(boolean v) {
+ if( v != mustFlipVertically ) {
+ mustFlipVertically = v;
+ updateTexCoords();
+ }
+ }
+
+ /**
+ * Updates the content area incl. {@link TextureCoords} of the specified target of this texture
* using the data in the given image. In general this is intended
* for construction of cube maps.
- *
+ *
* @throws GLException if any OpenGL-related errors occurred
*/
public void updateImage(GL gl, TextureData data, int targetOverride) throws GLException {
@@ -771,7 +792,7 @@ public class Texture {
* texture's target. This gives control over parameters such as
* GL_TEXTURE_MAX_ANISOTROPY_EXT. Causes this texture to be bound to
* the current texture state.
- *
+ *
* @throws GLException if no OpenGL context was current or if any
* OpenGL-related errors occurred
*/
@@ -785,7 +806,7 @@ public class Texture {
* Sets the OpenGL multi-floating-point texture parameter for the
* texture's target. Causes this texture to be bound to the current
* texture state.
- *
+ *
* @throws GLException if any OpenGL-related errors occurred
*/
public void setTexParameterfv(GL gl, int parameterName,
@@ -798,7 +819,7 @@ public class Texture {
* Sets the OpenGL multi-floating-point texture parameter for the
* texture's target. Causes this texture to be bound to the current
* texture state.
- *
+ *
* @throws GLException if any OpenGL-related errors occurred
*/
public void setTexParameterfv(GL gl, int parameterName,
@@ -814,7 +835,7 @@ public class Texture {
* to GL_CLAMP_TO_EDGE if OpenGL 1.2 is supported on the current
* platform and GL_CLAMP if not. Causes this texture to be bound to
* the current texture state.
- *
+ *
* @throws GLException if any OpenGL-related errors occurred
*/
public void setTexParameteri(GL gl, int parameterName,
@@ -827,7 +848,7 @@ public class Texture {
* Sets the OpenGL multi-integer texture parameter for the texture's
* target. Causes this texture to be bound to the current texture
* state.
- *
+ *
* @throws GLException if any OpenGL-related errors occurred
*/
public void setTexParameteriv(GL gl, int parameterName,
@@ -840,7 +861,7 @@ public class Texture {
* Sets the OpenGL multi-integer texture parameter for the texture's
* target. Causes this texture to be bound to the current texture
* state.
- *
+ *
* @throws GLException if any OpenGL-related errors occurred
*/
public void setTexParameteriv(GL gl, int parameterName,
@@ -858,12 +879,26 @@ public class Texture {
* </p>
* @param gl required to be valid and current in case the texture object has not been generated yet,
* otherwise it may be <code>null</code>.
+ * @see #getTextureObject()
*/
public int getTextureObject(GL gl) {
validateTexID(gl, false);
return texID;
}
+ /**
+ * Returns the underlying OpenGL texture object for this texture,
+ * maybe <code>0</code> if not yet generated.
+ * <p>
+ * Most applications will not need to access this, since it is
+ * handled automatically by the bind(GL) and destroy(GL) APIs.
+ * </p>
+ * @see #getTextureObject(GL)
+ */
+ public int getTextureObject() {
+ return texID;
+ }
+
/** Returns an estimate of the amount of texture memory in bytes
this Texture consumes. It should only be treated as an estimate;
most applications should not need to query this but instead let
@@ -922,6 +957,9 @@ public class Texture {
private void setImageSize(int width, int height, int target) {
imgWidth = width;
imgHeight = height;
+ updateTexCoords();
+ }
+ private void updateTexCoords() {
if (target == GL2.GL_TEXTURE_RECTANGLE_ARB) {
if (mustFlipVertically) {
coords = new TextureCoords(0, imgHeight, imgWidth, 0);
@@ -930,13 +968,13 @@ public class Texture {
}
} else {
if (mustFlipVertically) {
- coords = new TextureCoords(0, // l
+ coords = new TextureCoords(0, // l
(float) imgHeight / (float) texHeight, // b
(float) imgWidth / (float) texWidth, // r
0 // t
);
} else {
- coords = new TextureCoords(0, // l
+ coords = new TextureCoords(0, // l
0, // b
(float) imgWidth / (float) texWidth, // r
(float) imgHeight / (float) texHeight // t
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java
index 3931b72..ba59f89 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 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
@@ -29,7 +29,7 @@
* 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.
@@ -77,7 +77,7 @@ public class TextureCoords {
d[6+d_off] = right *ss; d[7+d_off] = top *ts;
return d;
}
-
+
/** Returns the leftmost (x) texture coordinate of this
rectangle. */
public float left() { return left; }
@@ -93,6 +93,7 @@ public class TextureCoords {
/** Returns the topmost (y) texture coordinate of this
rectangle. */
public float top() { return top; }
-
+
+ @Override
public String toString() { return "TexCoord[h: "+left+" - "+right+", v: "+bottom+" - "+top+"]"; }
}
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 dec1b43..5d88a76 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 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
@@ -29,7 +29,7 @@
* 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.
@@ -57,8 +57,8 @@ import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes;
public class TextureData {
/** ColorSpace of pixel data. */
- public static enum ColorSpace { RGB, YCbCr, YCCK, CMYK };
-
+ public static enum ColorSpace { RGB, YCbCr, YCCK, CMYK };
+
protected int width;
protected int height;
private int border;
@@ -83,7 +83,7 @@ public class TextureData {
protected GLProfile glProfile;
protected ColorSpace pixelCS = ColorSpace.RGB;
- /**
+ /**
* Constructs a new TextureData object with the specified parameters
* and data contained in the given Buffer. The optional Flusher can
* be used to clean up native resources associated with this
@@ -123,7 +123,7 @@ public class TextureData {
* data were invalid, such as requesting mipmap generation for a
* compressed texture
*/
- public TextureData(GLProfile glp,
+ public TextureData(GLProfile glp,
int internalFormat,
int width,
int height,
@@ -135,11 +135,11 @@ public class TextureData {
boolean mustFlipVertically,
Buffer buffer,
Flusher flusher) throws IllegalArgumentException {
- this(glp, internalFormat, width, height, border, new GLPixelAttributes(pixelFormat, pixelType),
+ this(glp, internalFormat, width, height, border, new GLPixelAttributes(pixelFormat, pixelType),
mipmap, dataIsCompressed, mustFlipVertically, buffer, flusher);
}
- /**
+ /**
* Constructs a new TextureData object with the specified parameters
* and data contained in the given Buffer. The optional Flusher can
* be used to clean up native resources associated with this
@@ -178,7 +178,7 @@ public class TextureData {
* data were invalid, such as requesting mipmap generation for a
* compressed texture
*/
- public TextureData(GLProfile glp,
+ public TextureData(GLProfile glp,
int internalFormat,
int width,
int height,
@@ -207,8 +207,8 @@ public class TextureData {
alignment = 1; // FIXME: is this correct enough in all situations?
estimatedMemorySize = estimatedMemorySize(buffer);
}
-
- /**
+
+ /**
* Constructs a new TextureData object with the specified parameters
* and data for multiple mipmap levels contained in the given array
* of Buffers. The optional Flusher can be used to clean up native
@@ -258,11 +258,11 @@ public class TextureData {
boolean mustFlipVertically,
Buffer[] mipmapData,
Flusher flusher) throws IllegalArgumentException {
- this(glp, internalFormat, width, height, border, new GLPixelAttributes(pixelFormat, pixelType),
+ this(glp, internalFormat, width, height, border, new GLPixelAttributes(pixelFormat, pixelType),
dataIsCompressed, mustFlipVertically, mipmapData, flusher);
}
- /**
+ /**
* Constructs a new TextureData object with the specified parameters
* and data for multiple mipmap levels contained in the given array
* of Buffers. The optional Flusher can be used to clean up native
@@ -325,19 +325,19 @@ public class TextureData {
estimatedMemorySize += estimatedMemorySize(mipmapData[i]);
}
}
-
- /**
+
+ /**
* Returns the color space of the pixel data.
- * @see #setColorSpace(ColorSpace)
+ * @see #setColorSpace(ColorSpace)
*/
public ColorSpace getColorSpace() { return pixelCS; }
- /**
+ /**
* Set the color space of the pixel data, which defaults to {@link ColorSpace#RGB}.
- * @see #getColorSpace()
+ * @see #getColorSpace()
*/
public void setColorSpace(ColorSpace cs) { pixelCS = cs; }
-
+
/** Used only by subclasses */
protected TextureData(GLProfile glp) { this.glProfile = glp; this.pixelAttributes = GLPixelAttributes.UNDEF; }
@@ -346,37 +346,37 @@ public class TextureData {
/** Returns the height in pixels of the texture data. */
public int getHeight() { return height; }
/** Returns the border in pixels of the texture data. */
- public int getBorder() {
- return border;
+ public int getBorder() {
+ return border;
}
/** Returns the intended OpenGL {@link GLPixelAttributes} of the texture data, i.e. format and type. */
public GLPixelAttributes getPixelAttributes() {
return pixelAttributes;
}
- /** Returns the intended OpenGL pixel format of the texture data. */
+ /** Returns the intended OpenGL pixel format of the texture data using {@link #getPixelAttributes()}. */
public int getPixelFormat() {
return pixelAttributes.format;
}
- /** Returns the intended OpenGL pixel type of the texture data. */
+ /** Returns the intended OpenGL pixel type of the texture data using {@link #getPixelAttributes()}. */
public int getPixelType() {
return pixelAttributes.type;
}
/** Returns the intended OpenGL internal format of the texture data. */
- public int getInternalFormat() {
- return internalFormat;
+ public int getInternalFormat() {
+ return internalFormat;
}
/** Returns whether mipmaps should be generated for the texture data. */
- public boolean getMipmap() {
- return mipmap;
+ public boolean getMipmap() {
+ return mipmap;
}
/** Indicates whether the texture data is in compressed form. */
- public boolean isDataCompressed() {
- return dataIsCompressed;
+ public boolean isDataCompressed() {
+ return dataIsCompressed;
}
/** Indicates whether the texture coordinates must be flipped
vertically for proper display. */
- public boolean getMustFlipVertically() {
- return mustFlipVertically;
+ public boolean getMustFlipVertically() {
+ return mustFlipVertically;
}
/** Returns the texture data, or null if it is specified as a set of mipmaps. */
public Buffer getBuffer() {
@@ -384,18 +384,18 @@ public class TextureData {
}
/** Returns all mipmap levels for the texture data, or null if it is
specified as a single image. */
- public Buffer[] getMipmapData() {
- return mipmapData;
+ public Buffer[] getMipmapData() {
+ return mipmapData;
}
/** Returns the required byte alignment for the texture data. */
- public int getAlignment() {
- return alignment;
+ public int getAlignment() {
+ return alignment;
}
/** Returns the row length needed for correct GL_UNPACK_ROW_LENGTH
specification. This is currently only supported for
non-mipmapped, non-compressed textures. */
- public int getRowLength() {
- return rowLength;
+ public int getRowLength() {
+ return rowLength;
}
/** Sets the width in pixels of the texture data. */
@@ -405,25 +405,25 @@ public class TextureData {
/** Sets the border in pixels of the texture data. */
public void setBorder(int border) { this.border = border; }
/** Sets the intended OpenGL pixel format of the texture data. */
- public void setPixelAttributes(GLPixelAttributes pixelAttributes) { this.pixelAttributes = pixelAttributes; }
- /**
+ public void setPixelAttributes(GLPixelAttributes pixelAttributes) { this.pixelAttributes = pixelAttributes; }
+ /**
* Sets the intended OpenGL pixel format component of {@link GLPixelAttributes} of the texture data.
* <p>
- * Use {@link #setPixelAttributes(GLPixelAttributes)}, if setting format and type.
- * </p>
+ * Use {@link #setPixelAttributes(GLPixelAttributes)}, if setting format and type.
+ * </p>
*/
public void setPixelFormat(int pixelFormat) {
if( pixelAttributes.format != pixelFormat ) {
pixelAttributes = new GLPixelAttributes(pixelFormat, pixelAttributes.type);
}
}
- /**
+ /**
* Sets the intended OpenGL pixel type component of {@link GLPixelAttributes} of the texture data.
* <p>
- * Use {@link #setPixelAttributes(GLPixelAttributes)}, if setting format and type.
- * </p>
+ * Use {@link #setPixelAttributes(GLPixelAttributes)}, if setting format and type.
+ * </p>
*/
- public void setPixelType(int pixelType) {
+ public void setPixelType(int pixelType) {
if( pixelAttributes.type != pixelType) {
pixelAttributes = new GLPixelAttributes(pixelAttributes.format, pixelType);
}
@@ -499,6 +499,7 @@ public class TextureData {
public void flush();
}
+ @Override
public String toString() {
return "TextureData["+width+"x"+height+", y-flip "+mustFlipVertically+", internFormat 0x"+Integer.toHexString(internalFormat)+", "+
pixelAttributes+", border "+border+", estSize "+estimatedMemorySize+", alignment "+alignment+", rowlen "+rowLength;
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 14ceb64..67ab517 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2011 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -54,6 +54,7 @@ import java.util.List;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
+import javax.media.opengl.GL2ES2;
import javax.media.opengl.GL2GL3;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLException;
@@ -62,6 +63,7 @@ import javax.media.opengl.GLProfile;
import jogamp.opengl.Debug;
import com.jogamp.common.util.IOUtil;
+import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes;
import com.jogamp.opengl.util.texture.spi.DDSImage;
import com.jogamp.opengl.util.texture.spi.JPEGImage;
import com.jogamp.opengl.util.texture.spi.NetPbmTextureWriter;
@@ -159,11 +161,11 @@ public class TextureIO {
/** Constant which can be used as a file suffix to indicate a PAM
file, NetPbm magic 7 - binary RGB and RGBA. Write support only. */
public static final String PAM = "pam";
-
+
/** Constant which can be used as a file suffix to indicate a PAM
file, NetPbm magic 6 - binary RGB. Write support only. */
public static final String PPM = "ppm";
-
+
private static final boolean DEBUG = Debug.debug("TextureIO");
// For manually disabling the use of the texture rectangle
@@ -419,7 +421,7 @@ public class TextureIO {
// methods that *do* require a current context
//
- /**
+ /**
* Creates an OpenGL texture object from the specified TextureData
* using the current OpenGL context.
*
@@ -432,7 +434,7 @@ public class TextureIO {
return newTexture(GLContext.getCurrentGL(), data);
}
- /**
+ /**
* Creates an OpenGL texture object from the specified TextureData
* using the given OpenGL context.
*
@@ -447,8 +449,8 @@ public class TextureIO {
}
return new Texture(gl, data);
}
-
- /**
+
+ /**
* Creates an OpenGL texture object from the specified file using
* the current OpenGL context.
*
@@ -472,7 +474,7 @@ public class TextureIO {
return texture;
}
- /**
+ /**
* Creates an OpenGL texture object from the specified stream using
* the current OpenGL context.
*
@@ -501,7 +503,7 @@ public class TextureIO {
return texture;
}
- /**
+ /**
* Creates an OpenGL texture object from the specified URL using the
* current OpenGL context.
*
@@ -533,13 +535,13 @@ public class TextureIO {
return texture;
}
- /**
+ /**
* Creates an OpenGL texture object associated with the given OpenGL
* texture target. The texture has
* no initial data. This is used, for example, to construct cube
* maps out of multiple TextureData objects.
*
- * @param target the OpenGL target type, eg GL.GL_TEXTURE_2D,
+ * @param target the OpenGL target type, eg GL.GL_TEXTURE_2D,
* GL.GL_TEXTURE_RECTANGLE_ARB
*/
public static Texture newTexture(int target) {
@@ -554,7 +556,7 @@ public class TextureIO {
* undefined results.
*
* @param textureID the OpenGL texture object to wrap
- * @param target the OpenGL texture target, eg GL.GL_TEXTURE_2D,
+ * @param target the OpenGL texture target, eg GL.GL_TEXTURE_2D,
* GL2.GL_TEXTURE_RECTANGLE
* @param texWidth the width of the texture in pixels
* @param texHeight the height of the texture in pixels
@@ -687,7 +689,7 @@ public class TextureIO {
gl.glPixelStorei(GL2.GL_PACK_SKIP_ROWS, packSkipRows);
gl.glPixelStorei(GL2.GL_PACK_SKIP_PIXELS, packSkipPixels);
gl.glPixelStorei(GL2.GL_PACK_SWAP_BYTES, packSwapBytes);
-
+
data = new TextureData(gl.getGLProfile(), internalFormat, width, height, border, fetchedFormat, GL.GL_UNSIGNED_BYTE,
false, false, false, res, null);
@@ -699,7 +701,7 @@ public class TextureIO {
write(data, file);
}
-
+
public static void write(TextureData data, File file) throws IOException, GLException {
for (Iterator<TextureWriter> iter = textureWriters.iterator(); iter.hasNext(); ) {
TextureWriter writer = iter.next();
@@ -710,12 +712,12 @@ public class TextureIO {
throw new IOException("No suitable texture writer found for "+file.getAbsolutePath());
}
-
+
//----------------------------------------------------------------------
// SPI support
//
- /**
+ /**
* Adds a TextureProvider to support reading of a new file format.
* <p>
* The last provider added, will be the first provider to be tested.
@@ -728,7 +730,7 @@ public class TextureIO {
textureProviders.add(0, provider);
}
- /**
+ /**
* Adds a TextureWriter to support writing of a new file format.
* <p>
* The last provider added, will be the first provider to be tested.
@@ -777,7 +779,7 @@ public class TextureIO {
private static List<TextureProvider> textureProviders = new ArrayList<TextureProvider>();
private static List<TextureWriter> textureWriters = new ArrayList<TextureWriter>();
- static {
+ static {
// ImageIO provider, the fall-back, must be the first one added
if(GLProfile.isAWTAvailable()) {
try {
@@ -912,6 +914,7 @@ public class TextureIO {
//----------------------------------------------------------------------
// DDS provider -- supports files only for now
static class DDSTextureProvider implements TextureProvider {
+ @Override
public TextureData newTextureData(GLProfile glp, File file,
int internalFormat,
int pixelFormat,
@@ -926,6 +929,7 @@ public class TextureIO {
return null;
}
+ @Override
public TextureData newTextureData(GLProfile glp, InputStream stream,
int internalFormat,
int pixelFormat,
@@ -942,6 +946,7 @@ public class TextureIO {
return null;
}
+ @Override
public TextureData newTextureData(GLProfile glp, URL url,
int internalFormat,
int pixelFormat,
@@ -997,6 +1002,7 @@ public class TextureIO {
}
}
TextureData.Flusher flusher = new TextureData.Flusher() {
+ @Override
public void flush() {
image.close();
}
@@ -1040,6 +1046,7 @@ public class TextureIO {
//----------------------------------------------------------------------
// Base class for SGI RGB and TGA image providers
static abstract class StreamBasedTextureProvider implements TextureProvider {
+ @Override
public TextureData newTextureData(GLProfile glp, File file,
int internalFormat,
int pixelFormat,
@@ -1060,6 +1067,7 @@ public class TextureIO {
}
}
+ @Override
public TextureData newTextureData(GLProfile glp, URL url,
int internalFormat,
int pixelFormat,
@@ -1077,6 +1085,7 @@ public class TextureIO {
//----------------------------------------------------------------------
// SGI RGB image provider
static class SGITextureProvider extends StreamBasedTextureProvider {
+ @Override
public TextureData newTextureData(GLProfile glp, InputStream stream,
int internalFormat,
int pixelFormat,
@@ -1112,6 +1121,7 @@ public class TextureIO {
//----------------------------------------------------------------------
// TGA (Targa) image provider
static class TGATextureProvider extends StreamBasedTextureProvider {
+ @Override
public TextureData newTextureData(GLProfile glp, InputStream stream,
int internalFormat,
int pixelFormat,
@@ -1123,7 +1133,7 @@ public class TextureIO {
pixelFormat = image.getGLFormat();
}
if (internalFormat == 0) {
- if(glp.isGL2GL3()) {
+ if(glp.isGL2ES3()) {
internalFormat = (image.getBytesPerPixel()==4)?GL.GL_RGBA8:GL.GL_RGB8;
} else {
internalFormat = (image.getBytesPerPixel()==4)?GL.GL_RGBA:GL.GL_RGB;
@@ -1149,6 +1159,7 @@ public class TextureIO {
//----------------------------------------------------------------------
// PNG image provider
static class PNGTextureProvider extends StreamBasedTextureProvider {
+ @Override
public TextureData newTextureData(GLProfile glp, InputStream stream,
int internalFormat,
int pixelFormat,
@@ -1160,7 +1171,7 @@ public class TextureIO {
pixelFormat = image.getGLFormat();
}
if (internalFormat == 0) {
- if(glp.isGL2GL3()) {
+ if(glp.isGL2ES3()) {
internalFormat = (image.getBytesPerPixel()==4)?GL.GL_RGBA8:GL.GL_RGB8;
} else {
internalFormat = (image.getBytesPerPixel()==4)?GL.GL_RGBA:GL.GL_RGB;
@@ -1186,6 +1197,7 @@ public class TextureIO {
//----------------------------------------------------------------------
// JPEG image provider
static class JPGTextureProvider extends StreamBasedTextureProvider {
+ @Override
public TextureData newTextureData(GLProfile glp, InputStream stream,
int internalFormat,
int pixelFormat,
@@ -1197,7 +1209,7 @@ public class TextureIO {
pixelFormat = image.getGLFormat();
}
if (internalFormat == 0) {
- if(glp.isGL2GL3()) {
+ if(glp.isGL2ES3()) {
internalFormat = (image.getBytesPerPixel()==4)?GL.GL_RGBA8:GL.GL_RGB8;
} else {
internalFormat = (image.getBytesPerPixel()==4)?GL.GL_RGBA:GL.GL_RGB;
@@ -1219,17 +1231,19 @@ public class TextureIO {
return null;
}
}
-
+
//----------------------------------------------------------------------
// DDS texture writer
//
static class DDSTextureWriter implements TextureWriter {
+ @Override
public boolean write(File file,
TextureData data) throws IOException {
if (DDS.equals(IOUtil.getFileSuffix(file))) {
// See whether the DDS writer can handle this TextureData
- int pixelFormat = data.getPixelFormat();
- int pixelType = data.getPixelType();
+ final GLPixelAttributes pixelAttribs = data.getPixelAttributes();
+ final int pixelFormat = pixelAttribs.format;
+ final int pixelType = pixelAttribs.type;
if (pixelType != GL.GL_BYTE &&
pixelType != GL.GL_UNSIGNED_BYTE) {
throw new IOException("DDS writer only supports byte / unsigned byte textures");
@@ -1246,7 +1260,7 @@ public class TextureIO {
case GL.GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: d3dFormat = DDSImage.D3DFMT_DXT5; break;
default: throw new IOException("Unsupported pixel format 0x" + Integer.toHexString(pixelFormat) + " by DDS writer");
}
-
+
ByteBuffer[] mipmaps = null;
if (data.getMipmapData() != null) {
mipmaps = new ByteBuffer[data.getMipmapData().length];
@@ -1273,14 +1287,16 @@ public class TextureIO {
// SGI (rgb) texture writer
//
static class SGITextureWriter implements TextureWriter {
+ @Override
public boolean write(File file,
TextureData data) throws IOException {
String fileSuffix = IOUtil.getFileSuffix(file);
if (SGI.equals(fileSuffix) ||
SGI_RGB.equals(fileSuffix)) {
// See whether the SGI writer can handle this TextureData
- int pixelFormat = data.getPixelFormat();
- int pixelType = data.getPixelType();
+ final GLPixelAttributes pixelAttribs = data.getPixelAttributes();
+ final int pixelFormat = pixelAttribs.format;
+ final int pixelType = pixelAttribs.type;
if ((pixelFormat == GL.GL_RGB ||
pixelFormat == GL.GL_RGBA) &&
(pixelType == GL.GL_BYTE ||
@@ -1315,28 +1331,30 @@ public class TextureIO {
//----------------------------------------------------------------------
// TGA (Targa) texture writer
-
+
static class TGATextureWriter implements TextureWriter {
+ @Override
public boolean write(File file,
TextureData data) throws IOException {
if (TGA.equals(IOUtil.getFileSuffix(file))) {
// See whether the TGA writer can handle this TextureData
- int pixelFormat = data.getPixelFormat();
- int pixelType = data.getPixelType();
+ final GLPixelAttributes pixelAttribs = data.getPixelAttributes();
+ final int pixelFormat = pixelAttribs.format;
+ final int pixelType = pixelAttribs.type;
if ((pixelFormat == GL.GL_RGB ||
- pixelFormat == GL.GL_RGBA ||
+ pixelFormat == GL.GL_RGBA ||
pixelFormat == GL2.GL_BGR ||
pixelFormat == GL.GL_BGRA ) &&
(pixelType == GL.GL_BYTE ||
pixelType == GL.GL_UNSIGNED_BYTE)) {
-
+
ByteBuffer buf = (ByteBuffer) data.getBuffer();
if (null == buf) {
buf = (ByteBuffer) data.getMipmapData()[0];
}
buf.rewind();
-
- if( pixelFormat == GL.GL_RGB || pixelFormat == GL.GL_RGBA ) {
+
+ if( pixelFormat == GL.GL_RGB || pixelFormat == GL.GL_RGBA ) {
// Must reverse order of red and blue channels to get correct results
int skip = ((pixelFormat == GL.GL_RGB) ? 3 : 4);
for (int i = 0; i < buf.remaining(); i += skip) {
@@ -1359,54 +1377,52 @@ public class TextureIO {
}
return false;
- }
+ }
}
//----------------------------------------------------------------------
// PNG texture writer
-
+
static class PNGTextureWriter implements TextureWriter {
+ @Override
public boolean write(File file, TextureData data) throws IOException {
if (PNG.equals(IOUtil.getFileSuffix(file))) {
// See whether the PNG writer can handle this TextureData
- int pixelFormat = data.getPixelFormat();
- int pixelType = data.getPixelType();
- boolean reversedChannels;
- int bytesPerPixel;
+ final GLPixelAttributes pixelAttribs = data.getPixelAttributes();
+ final int pixelFormat = pixelAttribs.format;
+ final int pixelType = pixelAttribs.type;
+ final int bytesPerPixel = pixelAttribs.bytesPerPixel;
+ final boolean reversedChannels;
switch(pixelFormat) {
+ case GL.GL_ALPHA:
case GL.GL_LUMINANCE:
+ case GL2ES2.GL_RED:
reversedChannels=false;
- bytesPerPixel=1;
break;
case GL.GL_RGB:
reversedChannels=false;
- bytesPerPixel=3;
break;
case GL.GL_RGBA:
reversedChannels=false;
- bytesPerPixel=4;
break;
case GL2.GL_BGR:
reversedChannels=true;
- bytesPerPixel=3;
break;
case GL.GL_BGRA:
reversedChannels=true;
- bytesPerPixel=4;
break;
default:
reversedChannels=false;
- bytesPerPixel=-1;
break;
}
if ( ( 1 == bytesPerPixel || 3 == bytesPerPixel || 4 == bytesPerPixel) &&
- ( pixelType == GL.GL_BYTE || pixelType == GL.GL_UNSIGNED_BYTE)) {
+ ( pixelType == GL.GL_BYTE || pixelType == GL.GL_UNSIGNED_BYTE)) {
ByteBuffer buf = (ByteBuffer) data.getBuffer();
if (null == buf) {
buf = (ByteBuffer) data.getMipmapData()[0];
}
buf.rewind();
-
+
PNGImage image = PNGImage.createFromData(data.getWidth(), data.getHeight(), -1f, -1f,
bytesPerPixel, reversedChannels, !data.getMustFlipVertically(), buf);
image.write(file, true);
@@ -1416,9 +1432,9 @@ public class TextureIO {
" / type 0x"+Integer.toHexString(pixelFormat)+" (only GL_RGB/A, GL_BGR/A + bytes)");
}
return false;
- }
+ }
}
-
+
//----------------------------------------------------------------------
// Helper routines
//
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 9f951d5..c34e019 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -28,30 +28,34 @@
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.util.TimeFrameI;
/**
* Protocol for texture sequences, like animations, movies, etc.
* <p>
- * Ensure to respect the texture coordinates provided by
+ * Ensure to respect the texture coordinates provided by
* {@link TextureFrame}.{@link TextureFrame#getTexture() getTexture()}.{@link Texture#getImageTexCoords() getImageTexCoords()}.
* </p>
- * The user's shader shall be fitted for this implementation.
+ * The user's shader shall be fitted for this implementation.
* Assuming we use a base shader code w/o headers using </code>ShaderCode</code>.
* (Code copied from unit test / demo <code>TexCubeES2</code>)
* <pre>
- *
+ *
static final String[] es2_prelude = { "#version 100\n", "precision mediump float;\n" };
static final String gl2_prelude = "#version 110\n";
static final String shaderBasename = "texsequence_xxx"; // the base shader code w/o headers
- static final String myTextureLookupName = "myTexture2D"; // the desired texture lookup function
-
+ static final String myTextureLookupName = "myTexture2D"; // the desired texture lookup function
+
private void initShader(GL2ES2 gl, TextureSequence texSeq) {
// Create & Compile the shader objects
- ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, TexCubeES2.class,
+ ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, TexCubeES2.class,
"shader", "shader/bin", shaderBasename, true);
- ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, TexCubeES2.class,
+ ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, TexCubeES2.class,
"shader", "shader/bin", shaderBasename, true);
-
+
// Prelude shader code w/ GLSL profile specifics [ 1. pre-proc, 2. other ]
int rsFpPos;
if(gl.isGLES2()) {
@@ -68,25 +72,25 @@ import javax.media.opengl.GL;
if(gl.isGLES2()) {
// insert ES2 default precision declaration
rsFpPos = rsFp.insertShaderSource(0, rsFpPos, es2_prelude[1]);
- }
+ }
// negotiate the texture lookup function name
final String texLookupFuncName = texSeq.getTextureLookupFunctionName(myTextureLookupName);
-
- // in case a fixed lookup function is being chosen, replace the name in our code
+
+ // in case a fixed lookup function is being chosen, replace the name in our code
rsFp.replaceInShaderSource(myTextureLookupName, texLookupFuncName);
-
+
// Cache the TextureSequence shader details in StringBuilder:
final StringBuilder sFpIns = new StringBuilder();
-
+
// .. declaration of the texture sampler using the implementation specific type
sFpIns.append("uniform ").append(texSeq.getTextureSampler2DType()).append(" mgl_ActiveTexture;\n");
-
+
// .. the actual texture lookup function, maybe null in case a built-in function is being used
sFpIns.append(texSeq.getTextureLookupFragmentShaderImpl());
-
+
// Now insert the TextureShader details in our shader after the given tag:
rsFp.insertShaderSource(0, "TEXTURE-SEQUENCE-CODE-BEGIN", 0, sFpIns);
-
+
// Create & Link the shader program
ShaderProgram sp = new ShaderProgram();
sp.add(rsVp);
@@ -98,40 +102,69 @@ import javax.media.opengl.GL;
* </pre>
* The above procedure might look complicated, however, it allows most flexibility and
* workarounds to also deal with GLSL bugs.
- *
+ *
*/
public interface TextureSequence {
public static final String GL_OES_EGL_image_external_Required_Prelude = "#extension GL_OES_EGL_image_external : enable\n";
public static final String samplerExternalOES = "samplerExternalOES";
public static final String sampler2D = "sampler2D";
-
- /**
+
+ /**
* Texture holder interface, maybe specialized by implementation
- * to associated related data.
+ * to associated related data.
*/
- public static class TextureFrame {
+ public static class TextureFrame extends TimeFrameI {
+ public TextureFrame(Texture t, int pts, int duration) {
+ super(pts, duration);
+ texture = t;
+ }
public TextureFrame(Texture t) {
texture = t;
}
-
+
public final Texture getTexture() { return texture; }
-
+
+ @Override
public String toString() {
- return "TextureFrame[" + texture + "]";
+ return "TextureFrame[pts " + pts + " ms, l " + duration + " ms, texID "+ (null != texture ? texture.getTextureObject() : 0) + "]";
}
protected final Texture texture;
}
+ /**
+ * Event listener to notify users of updates regarding the {@link TextureSequence}.
+ * <p>
+ * The implementation sending the events, and hence calling down to all listeners,
+ * does not necessarily make the user's OpenGL context current.
+ * </p>
+ * <p>
+ * Further more, the call may happen off-thread, possibly holding another, possibly shared, OpenGL context current.
+ * </p>
+ * Hence a user shall not issue <i>any</i> OpenGL, time consuming
+ * or {@link TextureSequence} lifecycle operations directly.<br>
+ * Instead, the user shall:
+ * <ul>
+ * <li>issue commands off-thread via spawning off another thread, or</li>
+ * <li>injecting {@link GLRunnable} objects via {@link GLAutoDrawable#invoke(boolean, GLRunnable)}, or</li>
+ * <li>simply changing a volatile state of their {@link GLEventListener} implementation.</li>
+ * </ul>
+ * </p>
+ * */
public interface TexSeqEventListener<T extends TextureSequence> {
- /**
- * Signaling listeners that {@link TextureSequence#getNextTexture(GL, boolean)} is able to deliver a new frame.
- * @param ts the event source
- * @param when system time in msec.
+ /**
+ * Signaling listeners that a new {@link TextureFrame} is available.
+ * <p>
+ * User shall utilize {@link TextureSequence#getNextTexture(GL)} to dequeue it to maintain
+ * a consistent queue.
+ * </p>
+ * @param ts the event source
+ * @param newFrame the newly enqueued frame
+ * @param when system time in msec.
**/
- public void newFrameAvailable(T ts, long when);
+ public void newFrameAvailable(T ts, TextureFrame newFrame, long when);
}
-
- /** Return the texture unit to be used with this frame. */
+
+ /** Return the texture unit used to render the current frame. */
public int getTextureUnit();
public int[] getTextureMinMagFilter();
@@ -142,59 +175,59 @@ public interface TextureSequence {
* Returns the last updated texture.
* <p>
* In case the instance is just initialized, it shall return a <code>TextureFrame</code>
- * object with valid attributes. The texture content may be undefined
- * until the first call of {@link #getNextTexture(GL, boolean)}.<br>
- * </p>
+ * object with valid attributes. The texture content may be undefined
+ * until the first call of {@link #getNextTexture(GL)}.<br>
+ * </p>
* Not blocking.
- *
- * @throws IllegalStateException if instance is not initialized
+ *
+ * @throws IllegalStateException if instance is not initialized
*/
public TextureFrame getLastTexture() throws IllegalStateException ;
/**
- * Returns the next texture to be rendered.
+ * Returns the next texture to be rendered.
* <p>
- * Implementation shall block until next frame is available if <code>blocking</code> is <code>true</code>,
- * otherwise it shall return the last frame in case a new frame is not available.
+ * Implementation shall return the next frame if available, may block if a next frame may arrive <i>soon</i>.
+ * Otherwise implementation shall return the last frame.
* </p>
* <p>
- * Shall return <code>null</code> in case <i>no</i> frame is available.
+ * Shall return <code>null</code> in case <i>no</i> next or last frame is available.
* </p>
- *
- * @throws IllegalStateException if instance is not initialized
+ *
+ * @throws IllegalStateException if instance is not initialized
*/
- public TextureFrame getNextTexture(GL gl, boolean blocking) throws IllegalStateException ;
-
+ public TextureFrame getNextTexture(GL gl) throws IllegalStateException ;
+
/**
- * In case a shader extension is required, based on the implementation
+ * In case a shader extension is required, based on the implementation
* and the runtime GL profile, this method returns the preprocessor macros, e.g.:
* <pre>
* #extension GL_OES_EGL_image_external : enable
- * </pre>
- *
- * @throws IllegalStateException if instance is not initialized
+ * </pre>
+ *
+ * @throws IllegalStateException if instance is not initialized
*/
public String getRequiredExtensionsShaderStub() throws IllegalStateException ;
-
- /**
+
+ /**
* Returns either <code>sampler2D</code> or <code>samplerExternalOES</code>
- * depending on {@link #getLastTexture()}.{@link TextureFrame#getTexture() getTexture()}.{@link Texture#getTarget() getTarget()}.
- *
- * @throws IllegalStateException if instance is not initialized
+ * depending on {@link #getLastTexture()}.{@link TextureFrame#getTexture() getTexture()}.{@link Texture#getTarget() getTarget()}.
+ *
+ * @throws IllegalStateException if instance is not initialized
**/
public String getTextureSampler2DType() throws IllegalStateException ;
-
+
/**
* @param desiredFuncName desired lookup function name. If <code>null</code> or ignored by the implementation,
- * a build-in name is returned.
+ * a build-in name is returned.
* @return the final lookup function name
- *
+ *
* @see {@link #getTextureLookupFragmentShaderImpl()}
- *
+ *
* @throws IllegalStateException if instance is not initialized
*/
public String getTextureLookupFunctionName(String desiredFuncName) throws IllegalStateException ;
-
+
/**
* Returns the complete texture2D lookup function code of type
* <pre>
@@ -207,14 +240,14 @@ public interface TextureSequence {
* <i>funcName</i> can be negotiated and queried via {@link #getTextureLookupFunctionName(String)}.
* </p>
* Note: This function may return an empty string in case a build-in lookup
- * function is being chosen. If the implementation desires so,
+ * function is being chosen. If the implementation desires so,
* {@link #getTextureLookupFunctionName(String)} will ignore the desired function name
* and returns the build-in lookup function name.
* </p>
* @see #getTextureLookupFunctionName(String)
* @see #getTextureSampler2DType()
- *
- * @throws IllegalStateException if instance is not initialized
+ *
+ * @throws IllegalStateException if instance is not initialized
*/
- public String getTextureLookupFragmentShaderImpl() throws IllegalStateException ;
+ public String getTextureLookupFragmentShaderImpl() throws IllegalStateException ;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java
new file mode 100644
index 0000000..d8320c6
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java
@@ -0,0 +1,168 @@
+/**
+ * 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.
+ */
+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;
+
+/**
+ * Preserves a [ texture-unit, texture-target ] state.
+ * <p>
+ * The states keys are the retrieved active texture-unit and the given texture-target
+ * for which the following states are being queried:
+ * <pre>
+ * - texture-object
+ * - GL.GL_TEXTURE_MAG_FILTER
+ * - GL.GL_TEXTURE_MIN_FILTER
+ * - GL.GL_TEXTURE_WRAP_S
+ * - GL.GL_TEXTURE_WRAP_T
+ * </pre>
+ */
+public class TextureState {
+ /**
+ * Returns the <code>pname</code> to query the <code>textureTarget</code> currently bound to the active texture-unit.
+ * <p>
+ * Returns <code>0</code> is <code>textureTarget</code> is not supported.
+ * </p>
+ */
+ public static final int getTextureTargetQueryName(int textureTarget) {
+ final int texBindQName;
+ switch(textureTarget) {
+ case GL.GL_TEXTURE_2D: texBindQName = GL.GL_TEXTURE_BINDING_2D; break;
+ case GL.GL_TEXTURE_CUBE_MAP: texBindQName = GL.GL_TEXTURE_BINDING_CUBE_MAP; break;
+ case GL2ES2.GL_TEXTURE_3D: texBindQName = GL2ES2.GL_TEXTURE_BINDING_3D; break;
+ case GL2GL3.GL_TEXTURE_1D: texBindQName = GL2GL3.GL_TEXTURE_BINDING_1D; break;
+ case GL2GL3.GL_TEXTURE_1D_ARRAY: texBindQName = GL2GL3.GL_TEXTURE_BINDING_1D_ARRAY; break;
+ case GL2GL3.GL_TEXTURE_2D_ARRAY: texBindQName = GL2GL3.GL_TEXTURE_BINDING_2D_ARRAY; break;
+ case GL2GL3.GL_TEXTURE_RECTANGLE: texBindQName = GL2GL3.GL_TEXTURE_BINDING_RECTANGLE; break;
+ case GL2GL3.GL_TEXTURE_BUFFER: texBindQName = GL2GL3.GL_TEXTURE_BINDING_BUFFER; break;
+ case GL3.GL_TEXTURE_2D_MULTISAMPLE: texBindQName = GL3.GL_TEXTURE_BINDING_2D_MULTISAMPLE; break;
+ case GL3.GL_TEXTURE_2D_MULTISAMPLE_ARRAY: texBindQName = GL3.GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY; break;
+ default: texBindQName = 0;
+ }
+ return texBindQName;
+ }
+
+ private final int target;
+ /**
+ * <pre>
+ * 0 - unit
+ * 1 - texture object
+ * 2 - GL.GL_TEXTURE_MAG_FILTER
+ * 3 - GL.GL_TEXTURE_MIN_FILTER
+ * 4 - GL.GL_TEXTURE_WRAP_S
+ * 5 - GL.GL_TEXTURE_WRAP_T
+ * </pre>
+ */
+ private final int[] state = new int[] { 0, 0, 0, 0, 0, 0 };
+
+ private static final String toHexString(int i) { return "0x"+Integer.toHexString(i); }
+
+ private static final int activeTexture(GL gl) {
+ final int[] vi = { 0 };
+ gl.glGetIntegerv(GL.GL_ACTIVE_TEXTURE, vi, 0);
+ return vi[0];
+ }
+
+ /**
+ * Creates a texture state for the retrieved active texture-unit and the given texture-target.
+ * See {@link TextureState}.
+ * @param gl current GL context's GL object
+ * @param textureTarget
+ * @throws GLException if textureTarget is not supported
+ */
+ public TextureState(GL gl, int textureTarget) throws GLException {
+ this(gl, activeTexture(gl), textureTarget);
+ }
+
+ /**
+ * Creates a texture state for the given active texture-unit and the given texture-target.
+ * See {@link TextureState}.
+ * @param gl current GL context's GL object
+ * @param textureUnit of range [ {@link GL#GL_TEXTURE0}.. ]
+ * @param textureTarget
+ * @throws GLException if textureTarget is not supported
+ */
+ public TextureState(GL gl, int textureUnit, int textureTarget) throws GLException {
+ target = textureTarget;
+ state[0] = textureUnit;
+ final int texBindQName = getTextureTargetQueryName(textureTarget);
+ if( 0 == texBindQName ) {
+ throw new GLException("Unsupported textureTarget "+toHexString(textureTarget));
+ }
+ gl.glGetIntegerv(texBindQName, state, 1);
+ gl.glGetTexParameteriv(target, GL.GL_TEXTURE_MAG_FILTER, state, 2);
+ gl.glGetTexParameteriv(target, GL.GL_TEXTURE_MIN_FILTER, state, 3);
+ gl.glGetTexParameteriv(target, GL.GL_TEXTURE_WRAP_S, state, 4);
+ gl.glGetTexParameteriv(target, GL.GL_TEXTURE_WRAP_T, state, 5);
+ }
+
+ /**
+ * Restores the texture-unit's texture-target state.
+ * <p>
+ * First the texture-unit is activated, then all states are restored.
+ * </p>
+ * @param gl current GL context's GL object
+ */
+ public final void restore(GL gl) {
+ gl.glActiveTexture(state[0]);
+ gl.glBindTexture(target, state[1]);
+ gl.glTexParameteri(target, GL.GL_TEXTURE_MAG_FILTER, state[2]);
+ gl.glTexParameteri(target, GL.GL_TEXTURE_MIN_FILTER, state[3]);
+ gl.glTexParameteri(target, GL.GL_TEXTURE_WRAP_S, state[4]);
+ gl.glTexParameteri(target, GL.GL_TEXTURE_WRAP_T, state[5]);
+ }
+
+ /** Returns the texture-unit of this state, key value. Unit is of range [ {@link GL#GL_TEXTURE0}.. ]. */
+ public final int getUnit() { return state[0]; }
+ /** Returns the texture-target of this state, key value. */
+ public final int getTarget() { return target; }
+
+ /** Returns the state's texture-object. */
+ public final int getObject() { return state[1]; }
+ /** Returns the state's mag-filter param. */
+ public final int getMagFilter() { return state[2]; }
+ /** Returns the state's min-filter param. */
+ public final int getMinFilter() { return state[3]; }
+ /** Returns the state's wrap-s param. */
+ public final int getWrapS() { return state[4]; }
+ /** Returns the state's wrap-t param. */
+ public final int getWrapT() { return state[5]; }
+
+
+ @Override
+ public final String toString() {
+ return "TextureState[unit "+(state[0] - GL.GL_TEXTURE0)+", target "+toHexString(target)+
+ ": obj "+toHexString(state[1])+
+ ", filter[mag "+toHexString(state[2])+", min "+toHexString(state[3])+"], "+
+ ": wrap[s "+toHexString(state[4])+", t "+toHexString(state[5])+"]]";
+ }
+}
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 d7e825c..202c08e 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
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 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
@@ -29,7 +29,7 @@
* 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.
@@ -80,7 +80,7 @@ public class AWTTextureData extends TextureData {
private static final java.awt.image.ColorModel rgbaColorModel =
new ComponentColorModel(java.awt.color.ColorSpace.getInstance(java.awt.color.ColorSpace.CS_sRGB),
- new int[] {8, 8, 8, 8}, true, true,
+ new int[] {8, 8, 8, 8}, true, true,
Transparency.TRANSLUCENT,
DataBuffer.TYPE_BYTE);
private static final java.awt.image.ColorModel rgbColorModel =
@@ -90,7 +90,7 @@ public class AWTTextureData extends TextureData {
DataBuffer.TYPE_BYTE);
- /**
+ /**
* Constructs a new TextureData object with the specified parameters
* and data contained in the given BufferedImage. The resulting
* TextureData "wraps" the contents of the BufferedImage, so if a
@@ -113,7 +113,7 @@ public class AWTTextureData extends TextureData {
* texture
* @param image the image containing the texture data
*/
- public AWTTextureData(GLProfile glp,
+ public AWTTextureData(GLProfile glp,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -142,15 +142,15 @@ public class AWTTextureData extends TextureData {
(expectingGL12 && haveGL12))) {
revertPixelAttributes();
}
- }
+ }
}
-
+
@Override
public GLPixelAttributes getPixelAttributes() {
validatePixelAttributes();
return super.getPixelAttributes();
}
-
+
@Override
public int getPixelFormat() {
validatePixelAttributes();
@@ -246,7 +246,7 @@ public class AWTTextureData extends TextureData {
// we can pass the image data directly to OpenGL only if
// we have an integral number of pixels in each scanline
// and only if the GL_EXT_abgr extension is present
-
+
// NOTE: disabling this code path for now as it appears it's
// buggy at least on some NVidia drivers and doesn't perform
// the necessary byte swapping (FIXME: needs more
@@ -255,7 +255,7 @@ public class AWTTextureData extends TextureData {
pixelAttributes = new GLPixelAttributes(GL2.GL_ABGR_EXT, GL.GL_UNSIGNED_BYTE);
rowLength = scanlineStride / 4;
alignment = 4;
-
+
// Store a reference to the original image for later in
// case it turns out that we don't have GL_EXT_abgr at the
// time we're going to do the texture upload to OpenGL
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 fdd1365..c70f5d0 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
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -100,7 +100,7 @@ public class AWTTextureIO extends TextureIO {
return newTextureDataImpl(glp, image, internalFormat, pixelFormat, mipmap);
}
- /**
+ /**
* Creates an OpenGL texture object from the specified BufferedImage
* using the current OpenGL context.
*
@@ -119,7 +119,7 @@ public class AWTTextureIO extends TextureIO {
return texture;
}
- private static TextureData newTextureDataImpl(GLProfile glp,
+ private static TextureData newTextureDataImpl(GLProfile glp,
BufferedImage image,
int internalFormat,
int pixelFormat,
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 3f91ae9..d75bb37 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
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -166,7 +166,7 @@ public class DDSImage {
public static DDSImage read(String filename) throws IOException {
return read(new File(filename));
}
-
+
/** Reads a DirectDraw surface from the specified file, returning
the resulting DDSImage.
@@ -212,7 +212,7 @@ public class DDSImage {
}
}
- /**
+ /**
* Creates a new DDSImage from data supplied by the user. The
* resulting DDSImage can be written to disk using the write()
* method.
@@ -763,7 +763,7 @@ public class DDSImage {
default:
throw new IllegalArgumentException("d3dFormat must be one of the known formats");
}
-
+
// Now check the mipmaps against this size
int curSize = topmostMipmapSize;
int totalSize = 0;
@@ -785,7 +785,7 @@ public class DDSImage {
buf.put(mipmapData[i]);
}
this.buf = buf;
-
+
// Allocate and initialize a Header
header = new Header();
header.size = Header.size();
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 4d3d088..2081788 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -40,12 +40,12 @@ import com.jogamp.common.nio.Buffers;
import com.jogamp.opengl.util.texture.TextureData.ColorSpace;
public class JPEGImage {
- private static final boolean DEBUG = Debug.debug("JPEGImage");
-
-
+ private static final boolean DEBUG = Debug.debug("JPEGImage");
+
+
/**
* Reads a JPEG image from the specified InputStream, using the given color space for storage.
- *
+ *
* @param in
* @param cs Storage color space, either {@link ColorSpace#RGB} or {@link ColorSpace#YCbCr}. {@link ColorSpace#YCCK} and {@link ColorSpace#CMYK} will throw an exception!
* @return
@@ -54,12 +54,12 @@ public class JPEGImage {
public static JPEGImage read(InputStream in, ColorSpace cs) throws IOException {
return new JPEGImage(in, cs);
}
-
+
/** Reads a JPEG image from the specified InputStream, using the {@link ColorSpace#RGB}. */
public static JPEGImage read(InputStream in) throws IOException {
return new JPEGImage(in, ColorSpace.RGB);
}
-
+
private static class JPEGColorSink implements JPEGDecoder.ColorSink {
int width=0, height=0;
int sourceComponents=0;
@@ -67,7 +67,7 @@ public class JPEGImage {
int storageComponents;
final ColorSpace storageCS;
ByteBuffer data = null;
-
+
JPEGColorSink(ColorSpace storageCM) {
this.storageCS = storageCM;
switch(storageCS) {
@@ -79,7 +79,7 @@ public class JPEGImage {
throw new IllegalArgumentException("Unsupported storage color-space: "+storageCS);
}
}
-
+
@Override
public final ColorSpace allocate(int width, int height, ColorSpace sourceCM, int sourceComponents) throws RuntimeException {
this.width = width;
@@ -96,7 +96,7 @@ public class JPEGImage {
data.put(i++, r);
data.put(i++, g);
data.put(i++, b);
- // data.put(i++, (byte)0xff);
+ // data.put(i++, (byte)0xff);
}
@Override
@@ -111,12 +111,13 @@ public class JPEGImage {
data.put(i++, Cb);
data.put(i++, Cr);
}
-
+
+ @Override
public String toString() {
return "JPEGPixels["+width+"x"+height+", sourceComp "+sourceComponents+", sourceCS "+sourceCS+", storageCS "+storageCS+", storageComp "+storageComponents+"]";
}
};
-
+
private JPEGImage(InputStream in, ColorSpace cs) throws IOException {
pixelStorage = new JPEGColorSink(cs);
final JPEGDecoder decoder = new JPEGDecoder();
@@ -126,7 +127,7 @@ public class JPEGImage {
decoder.getPixel(pixelStorage, pixelWidth, pixelHeight);
data = pixelStorage.data;
final boolean hasAlpha = false;
-
+
bytesPerPixel = 3;
glFormat = GL.GL_RGB;
reversedChannels = false; // RGB[A]
@@ -142,7 +143,7 @@ public class JPEGImage {
private final int pixelWidth, pixelHeight, glFormat, bytesPerPixel;
private boolean reversedChannels;
private final ByteBuffer data;
-
+
/** Returns the color space of the pixel data */
public ColorSpace getColorSpace() { return pixelStorage.storageCS; }
@@ -157,10 +158,10 @@ public class JPEGImage {
/** Returns true if data has the channels reversed to BGR or BGRA, otherwise RGB or RGBA is expected. */
public boolean getHasReversedChannels() { return reversedChannels; }
-
+
/** Returns the OpenGL format for this texture; e.g. GL.GL_LUMINANCE, GL.GL_RGB or GL.GL_RGBA. */
public int getGLFormat() { return glFormat; }
-
+
/** Returns the OpenGL data type: GL.GL_UNSIGNED_BYTE. */
public int getGLType() { return GL.GL_UNSIGNED_BYTE; }
@@ -170,6 +171,7 @@ public class JPEGImage {
/** Returns the raw data for this texture in the correct
(bottom-to-top) order for calls to glTexImage2D. */
public ByteBuffer getData() { return data; }
-
+
+ @Override
public String toString() { return "JPEGImage["+pixelWidth+"x"+pixelHeight+", bytesPerPixel "+bytesPerPixel+", reversedChannels "+reversedChannels+", "+pixelStorage+", "+data+"]"; }
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java
index b7262aa..3c90d96 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -82,38 +82,45 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
dataIn = new DataInputStream(in);
}
+ @Override
public void close() throws IOException
{
dataIn.close(); // better close as we create it.
// this will close underlying as well.
}
+ @Override
public synchronized final int read(byte b[]) throws IOException
{
return dataIn.read(b, 0, b.length);
}
+ @Override
public synchronized final int read(byte b[], int off, int len) throws IOException
{
int rl = dataIn.read(b, off, len);
return rl;
}
+ @Override
public final void readFully(byte b[]) throws IOException
{
dataIn.readFully(b, 0, b.length);
}
+ @Override
public final void readFully(byte b[], int off, int len) throws IOException
{
dataIn.readFully(b, off, len);
}
+ @Override
public final int skipBytes(int n) throws IOException
{
return dataIn.skipBytes(n);
}
+ @Override
public final boolean readBoolean() throws IOException
{
int ch = dataIn.read();
@@ -122,6 +129,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
return (ch != 0);
}
+ @Override
public final byte readByte() throws IOException
{
int ch = dataIn.read();
@@ -130,6 +138,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
return (byte)(ch);
}
+ @Override
public final int readUnsignedByte() throws IOException
{
int ch = dataIn.read();
@@ -138,6 +147,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
return ch;
}
+ @Override
public final short readShort() throws IOException
{
int ch1 = dataIn.read();
@@ -147,8 +157,9 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
return (short)((ch1 << 0) + (ch2 << 8));
}
+ @Override
public final int readUnsignedShort() throws IOException
- {
+ {
int ch1 = dataIn.read();
int ch2 = dataIn.read();
if ((ch1 | ch2) < 0)
@@ -156,6 +167,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
return (ch1 << 0) + (ch2 << 8);
}
+ @Override
public final char readChar() throws IOException
{
int ch1 = dataIn.read();
@@ -165,6 +177,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
return (char)((ch1 << 0) + (ch2 << 8));
}
+ @Override
public final int readInt() throws IOException
{
int ch1 = dataIn.read();
@@ -176,6 +189,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
return ((ch1 << 0) + (ch2 << 8) + (ch3 << 16) + (ch4 << 24));
}
+ @Override
public final long readLong() throws IOException
{
int i1 = readInt();
@@ -183,11 +197,13 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
return ((long)i1 & 0xFFFFFFFFL) + ((long)i2 << 32);
}
+ @Override
public final float readFloat() throws IOException
{
return Float.intBitsToFloat(readInt());
}
+ @Override
public final double readDouble() throws IOException
{
return Double.longBitsToDouble(readLong());
@@ -195,8 +211,9 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
/**
* dont call this it is not implemented.
- * @return empty new string
+ * @return empty new string
**/
+ @Override
public final String readLine() throws IOException
{
return new String();
@@ -204,8 +221,9 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
/**
* dont call this it is not implemented
- * @return empty new string
+ * @return empty new string
**/
+ @Override
public final String readUTF() throws IOException
{
return new String();
@@ -213,7 +231,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput
/**
* dont call this it is not implemented
- * @return empty new string
+ * @return empty new string
**/
public final static String readUTF(DataInput in) throws IOException
{
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java
index e1e1ca9..93b0975 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -78,43 +78,51 @@ public class LEDataOutputStream extends FilterOutputStream implements DataOutput
dataOut = new DataOutputStream(out);
}
+ @Override
public void close() throws IOException
{
dataOut.close(); // better close as we create it.
// this will close underlying as well.
}
+ @Override
public synchronized final void write(byte b[]) throws IOException
{
dataOut.write(b, 0, b.length);
}
+ @Override
public synchronized final void write(byte b[], int off, int len) throws IOException
{
dataOut.write(b, off, len);
}
+ @Override
public final void write(int b) throws IOException
{
dataOut.write(b);
}
+ @Override
public final void writeBoolean(boolean v) throws IOException
{
dataOut.writeBoolean(v);
}
+ @Override
public final void writeByte(int v) throws IOException
{
dataOut.writeByte(v);
}
/** Don't call this -- not implemented */
+ @Override
public final void writeBytes(String s) throws IOException
{
throw new UnsupportedOperationException();
}
+ @Override
public final void writeChar(int v) throws IOException
{
dataOut.writeChar(((v >> 8) & 0xff) |
@@ -122,21 +130,25 @@ public class LEDataOutputStream extends FilterOutputStream implements DataOutput
}
/** Don't call this -- not implemented */
+ @Override
public final void writeChars(String s) throws IOException
{
throw new UnsupportedOperationException();
}
+ @Override
public final void writeDouble(double v) throws IOException
{
writeLong(Double.doubleToRawLongBits(v));
}
+ @Override
public final void writeFloat(float v) throws IOException
{
writeInt(Float.floatToRawIntBits(v));
}
+ @Override
public final void writeInt(int v) throws IOException
{
dataOut.writeInt((v >>> 24) |
@@ -145,12 +157,14 @@ public class LEDataOutputStream extends FilterOutputStream implements DataOutput
(v << 24));
}
+ @Override
public final void writeLong(long v) throws IOException
{
writeInt((int) v);
writeInt((int) (v >>> 32));
}
+ @Override
public final void writeShort(int v) throws IOException
{
dataOut.writeShort(((v >> 8) & 0xff) |
@@ -158,6 +172,7 @@ public class LEDataOutputStream extends FilterOutputStream implements DataOutput
}
/** Don't call this -- not implemented */
+ @Override
public final void writeUTF(String s) throws IOException
{
throw new UnsupportedOperationException();
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 cd42a11..cabf4eb 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
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -84,11 +84,12 @@ public class NetPbmTextureWriter implements TextureWriter {
public String getSuffix() { return (magic==6)?PPM:PAM; }
+ @Override
public boolean write(File file, TextureData data) throws IOException {
boolean res;
final int magic_old = magic;
-
- // file suffix selection
+
+ // file suffix selection
if (0==magic) {
if (PPM.equals(IOUtil.getFileSuffix(file))) {
magic = 6;
@@ -97,7 +98,7 @@ public class NetPbmTextureWriter implements TextureWriter {
} else {
return false;
}
- }
+ }
try {
res = writeImpl(file, data);
} finally {
@@ -105,7 +106,7 @@ public class NetPbmTextureWriter implements TextureWriter {
}
return res;
}
-
+
private boolean writeImpl(File file, TextureData data) throws IOException {
int pixelFormat = data.getPixelFormat();
final int pixelType = data.getPixelType();
@@ -115,16 +116,16 @@ public class NetPbmTextureWriter implements TextureWriter {
pixelFormat == GL.GL_BGRA ) &&
(pixelType == GL.GL_BYTE ||
pixelType == GL.GL_UNSIGNED_BYTE)) {
-
+
ByteBuffer buf = (ByteBuffer) data.getBuffer();
if (null == buf ) {
buf = (ByteBuffer) data.getMipmapData()[0];
}
buf.rewind();
-
+
int comps = ( pixelFormat == GL.GL_RGBA || pixelFormat == GL.GL_BGRA ) ? 4 : 3 ;
-
- if( pixelFormat == GL2.GL_BGR || pixelFormat == GL.GL_BGRA ) {
+
+ if( pixelFormat == GL2.GL_BGR || pixelFormat == GL.GL_BGRA ) {
// Must reverse order of red and blue channels to get correct results
for (int i = 0; i < buf.remaining(); i += comps) {
byte red = buf.get(i + 0);
@@ -141,7 +142,7 @@ public class NetPbmTextureWriter implements TextureWriter {
}
FileOutputStream fos = IOUtil.getFileOutputStream(file, true);
-
+
StringBuilder header = new StringBuilder();
header.append("P");
header.append(magic);
@@ -171,7 +172,7 @@ public class NetPbmTextureWriter implements TextureWriter {
}
fos.write(header.toString().getBytes());
-
+
FileChannel fosc = fos.getChannel();
fosc.write(buf);
fosc.force(true);
@@ -180,7 +181,7 @@ public class NetPbmTextureWriter implements TextureWriter {
buf.rewind();
return true;
- }
+ }
throw new IOException("NetPbmTextureWriter writer doesn't support this pixel format / type (only GL_RGB/A + bytes)");
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/PNGImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/PNGImage.java
index 93d3702..71cbbf9 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/PNGImage.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/PNGImage.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -51,15 +51,15 @@ import com.jogamp.common.nio.Buffers;
import com.jogamp.common.util.IOUtil;
public class PNGImage {
- private static final boolean DEBUG = Debug.debug("PNGImage");
-
+ private static final boolean DEBUG = Debug.debug("PNGImage");
+
/**
* Creates a PNGImage from data supplied by the end user. Shares
* data with the passed ByteBuffer. Assumes the data is already in
* the correct byte order for writing to disk, i.e., LUMINANCE, RGB or RGBA.
* Orientation is <i>bottom-to-top</i> (OpenGL coord. default)
* or <i>top-to-bottom</i> depending on <code>isGLOriented</code>.
- *
+ *
* @param width
* @param height
* @param dpiX
@@ -74,30 +74,38 @@ public class PNGImage {
int bytesPerPixel, boolean reversedChannels, boolean isGLOriented, ByteBuffer data) {
return new PNGImage(width, height, dpiX, dpiY, bytesPerPixel, reversedChannels, isGLOriented, data);
}
-
- /**
+
+ /**
* Reads a PNG image from the specified InputStream.
* <p>
* Implicitly flip image to GL orientation, see {@link #isGLOriented()}.
- * </p>
+ * </p>
*/
public static PNGImage read(InputStream in) throws IOException {
return new PNGImage(in);
}
-
+
/** Reverse read and store, implicitly flip image to GL orientation, see {@link #isGLOriented()}. */
private static final int getPixelRGBA8(ByteBuffer d, int dOff, int[] scanline, int lineOff, boolean hasAlpha) {
+ final int b = hasAlpha ? 4-1 : 3-1;
+ if( d.limit() <= dOff || dOff - b < 0 ) {
+ throw new IndexOutOfBoundsException("Buffer has unsufficient bytes left, needs ["+(dOff-b)+".."+dOff+"]: "+d);
+ }
if(hasAlpha) {
d.put(dOff--, (byte)scanline[lineOff + 3]); // A
}
d.put(dOff--, (byte)scanline[lineOff + 2]); // B
- d.put(dOff--, (byte)scanline[lineOff + 1]); // G
+ d.put(dOff--, (byte)scanline[lineOff + 1]); // G
d.put(dOff--, (byte)scanline[lineOff ]); // R
return dOff;
}
-
+
/** Reverse write and store, implicitly flip image from current orientation, see {@link #isGLOriented()}. Handle reversed channels (BGR[A]). */
private int setPixelRGBA8(ImageLine line, int lineOff, ByteBuffer d, int dOff, boolean hasAlpha) {
+ final int b = hasAlpha ? 4-1 : 3-1;
+ if( d.limit() <= dOff + b ) {
+ throw new IndexOutOfBoundsException("Buffer has unsufficient bytes left, needs ["+dOff+".."+(dOff+b)+"]: "+d);
+ }
if( reversedChannels ) {
if(hasAlpha) {
line.scanline[lineOff + 3] = d.get(dOff++); // A
@@ -130,9 +138,9 @@ public class PNGImage {
this.bytesPerPixel = bytesPerPixel;
this.reversedChannels = reversedChannels;
this.isGLOriented = isGLOriented;
- this.data = data;
+ this.data = data;
}
-
+
private PNGImage(InputStream in) {
final PngReader pngr = new PngReader(new BufferedInputStream(in), null);
final ImageInfo imgInfo = pngr.imgInfo;
@@ -140,12 +148,12 @@ public class PNGImage {
final PngChunkTRNS trns = pngr.getMetadata().getTRNS();
final boolean indexed = imgInfo.indexed;
final boolean hasAlpha = indexed ? ( trns != null ) : imgInfo.alpha ;
-
+
final int channels = indexed ? ( hasAlpha ? 4 : 3 ) : imgInfo.channels ;
if ( ! ( 1 == channels || 3 == channels || 4 == channels ) ) {
throw new RuntimeException("PNGImage can only handle Lum/RGB/RGBA [1/3/4 channels] images for now. Channels "+channels + " Paletted: " + indexed);
}
-
+
bytesPerPixel = indexed ? channels : imgInfo.bytesPixel ;
if ( ! ( 1 == bytesPerPixel || 3 == bytesPerPixel || 4 == bytesPerPixel ) ) {
throw new RuntimeException("PNGImage can only handle Lum/RGB/RGBA [1/3/4 bpp] images for now. BytesPerPixel "+bytesPerPixel);
@@ -181,14 +189,14 @@ public class PNGImage {
", bytesPerPixel "+bytesPerPixel+"/"+imgInfo.bytesPixel+
", pixels "+pixelWidth+"x"+pixelHeight+", dpi "+dpi[0]+"x"+dpi[1]+", glFormat 0x"+Integer.toHexString(glFormat));
}
-
+
data = Buffers.newDirectByteBuffer(bytesPerPixel * pixelWidth * pixelHeight);
reversedChannels = false; // RGB[A]
isGLOriented = true;
int dataOff = bytesPerPixel * pixelWidth * pixelHeight - 1; // start at end-of-buffer, reverse store
int[] rgbaScanline = indexed ? new int[imgInfo.cols * channels] : null;
-
+
for (int row = 0; row < pixelHeight; row++) {
final ImageLine l1 = pngr.readRow(row);
int lineOff = ( pixelWidth - 1 ) * bytesPerPixel ; // start w/ last pixel in line, reverse read (PNG top-left -> OpenGL bottom-left origin)
@@ -216,7 +224,7 @@ public class PNGImage {
private final boolean isGLOriented;
private final double[] dpi;
private final ByteBuffer data;
-
+
/** Returns the width of the image. */
public int getWidth() { return pixelWidth; }
@@ -225,23 +233,23 @@ public class PNGImage {
/** Returns true if data has the channels reversed to BGR or BGRA, otherwise RGB or RGBA is expected. */
public boolean getHasReversedChannels() { return reversedChannels; }
-
+
/**
- * Returns <code>true</code> if the drawable is rendered in
+ * Returns <code>true</code> if the drawable is rendered in
* OpenGL's coordinate system, <i>origin at bottom left</i>.
* Otherwise returns <code>false</code>, i.e. <i>origin at top left</i>.
* <p>
* Default impl. is <code>true</code>, i.e. OpenGL coordinate system.
- * </p>
+ * </p>
*/
public boolean isGLOriented() { return isGLOriented; }
-
+
/** Returns the dpi of the image. */
public double[] getDpi() { return dpi; }
-
+
/** Returns the OpenGL format for this texture; e.g. GL.GL_LUMINANCE, GL.GL_RGB or GL.GL_RGBA. */
public int getGLFormat() { return glFormat; }
-
+
/** Returns the OpenGL data type: GL.GL_UNSIGNED_BYTE. */
public int getGLType() { return GL.GL_UNSIGNED_BYTE; }
@@ -252,12 +260,12 @@ public class PNGImage {
(bottom-to-top) order for calls to glTexImage2D. */
public ByteBuffer getData() { return data; }
- public void write(File out, boolean allowOverwrite) throws IOException {
- final ImageInfo imi = new ImageInfo(pixelWidth, pixelHeight, 8, (4 == bytesPerPixel) ? true : false); // 8 bits per channel, no alpha
+ public void write(File out, boolean allowOverwrite) throws IOException {
+ final ImageInfo imi = new ImageInfo(pixelWidth, pixelHeight, 8, (4 == bytesPerPixel) ? true : false); // 8 bits per channel, no alpha
// open image for writing to a output stream
final OutputStream outs = new BufferedOutputStream(IOUtil.getFileOutputStream(out, allowOverwrite));
try {
- final PngWriter png = new PngWriter(outs, imi);
+ final PngWriter png = new PngWriter(outs, imi);
// add some optional metadata (chunks)
png.getMetadata().setDpi(dpi[0], dpi[1]);
png.getMetadata().setTimeNow(0); // 0 seconds fron now = now
@@ -267,7 +275,7 @@ public class PNGImage {
final ImageLine l1 = new ImageLine(imi);
if( isGLOriented ) {
// start at last pixel at end-of-buffer, reverse read (OpenGL bottom-left -> PNG top-left origin)
- int dataOff = ( pixelWidth * bytesPerPixel * ( pixelHeight - 1 ) ) + // full lines - 1 line
+ int dataOff = ( pixelWidth * bytesPerPixel * ( pixelHeight - 1 ) ) + // full lines - 1 line
( ( pixelWidth - 1 ) * bytesPerPixel ); // one line - 1 pixel
for (int row = 0; row < pixelHeight; row++) {
int lineOff = ( pixelWidth - 1 ) * bytesPerPixel ; // start w/ last pixel in line, reverse store (OpenGL bottom-left -> PNG top-left origin)
@@ -298,13 +306,14 @@ public class PNGImage {
}
}
png.writeRow(l1, row);
- }
+ }
}
png.end();
} finally {
IOUtil.close(outs, false);
}
}
-
- public String toString() { return "PNGImage["+pixelWidth+"x"+pixelHeight+", dpi "+dpi[0]+" x "+dpi[1]+", bytesPerPixel "+bytesPerPixel+", reversedChannels "+reversedChannels+", "+data+"]"; }
+
+ @Override
+ public String toString() { return "PNGImage["+pixelWidth+"x"+pixelHeight+", dpi "+dpi[0]+" x "+dpi[1]+", bytesPerPixel "+bytesPerPixel+", reversedChannels "+reversedChannels+", "+data+"]"; }
}
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 d35330f..cbc8e65 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
@@ -1,21 +1,21 @@
/*
* Portions Copyright (c) 2005 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -72,15 +72,15 @@ public class SGIImage {
byte storage; // Storage format
// 0 for uncompressed
// 1 for RLE compression
- byte bpc; // Number of bytes per pixel channel
+ byte bpc; // Number of bytes per pixel channel
// Legally 1 or 2
short dimension; // Number of dimensions
// Legally 1, 2, or 3
// 1 means a single row, XSIZE long
// 2 means a single 2D image
// 3 means multiple 2D images
- short xsize; // X size in pixels
- short ysize; // Y size in pixels
+ short xsize; // X size in pixels
+ short ysize; // Y size in pixels
short zsize; // Number of channels
// 1 indicates greyscale
// 3 indicates RGB
@@ -126,6 +126,7 @@ public class SGIImage {
in.read(tmp);
}
+ @Override
public String toString() {
return ("magic: " + magic +
" storage: " + (int) storage +
@@ -226,6 +227,7 @@ public class SGIImage {
(bottom-to-top) order for calls to glTexImage2D. */
public byte[] getData() { return data; }
+ @Override
public String toString() {
return header.toString();
}
@@ -233,7 +235,7 @@ public class SGIImage {
//----------------------------------------------------------------------
// Internals only below this point
//
-
+
private void decodeImage(DataInputStream in) throws IOException {
if (header.storage == 1) {
// Read RLE compression data; row starts and sizes
@@ -478,7 +480,7 @@ public class SGIImage {
for (int z = 0; z < zsize; z++) {
for (int y = ystart; y != yend; y += yincr) {
// RLE-compress each row.
-
+
int x = 0;
byte count = 0;
boolean repeat_mode = false;
@@ -486,7 +488,7 @@ public class SGIImage {
int start_ptr = ptr;
int num_ptr = ptr++;
byte repeat_val = 0;
-
+
while (x < xsize) {
// see if we should switch modes
should_switch = false;
@@ -503,7 +505,7 @@ public class SGIImage {
if (DEBUG)
System.err.println("left side was " + ((int) imgref(data, x, y, z, xsize, ysize, zsize)) +
", right side was " + (int)imgref(data, x+i, y, z, xsize, ysize, zsize));
-
+
if (imgref(data, x, y, z, xsize, ysize, zsize) !=
imgref(data, x+i, y, z, xsize, ysize, zsize))
should_switch = false;
@@ -531,7 +533,7 @@ public class SGIImage {
repeat_mode = true;
repeat_val = imgref(data, x, y, z, xsize, ysize, zsize);
}
-
+
if (x > 0) {
// reset the number pointer
num_ptr = ptr++;
@@ -539,7 +541,7 @@ public class SGIImage {
count = 0;
}
}
-
+
// if not in repeat mode, copy element to ptr
if (!repeat_mode) {
rlebuf[ptr++] = imgref(data, x, y, z, xsize, ysize, zsize);
@@ -581,8 +583,8 @@ public class SGIImage {
// Now we have the offset tables computed, as well as the RLE data.
// Output this information to the file.
total_size = ptr;
-
- if (DEBUG)
+
+ if (DEBUG)
System.err.println("total_size was " + total_size);
DataOutputStream stream = new DataOutputStream(new BufferedOutputStream(IOUtil.getFileOutputStream(file, true)));
@@ -604,7 +606,7 @@ public class SGIImage {
byte[] dest = new byte[16384];
int pos = 0;
int numRead = 0;
-
+
boolean done = false;
do {
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 2ff3b9c..15cd63e 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
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003-2005 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -146,9 +146,9 @@ public class TGAImage {
tgaType = TYPE_OLD; // dont try and get footer.
// initial header fields
- idLength = in.readUnsignedByte();
+ idLength = in.readUnsignedByte();
colorMapType = in.readUnsignedByte();
- imageType = in.readUnsignedByte();
+ imageType = in.readUnsignedByte();
// color map header fields
firstEntryIndex = in.readUnsignedShort();
@@ -199,6 +199,7 @@ public class TGAImage {
public byte[] imageIDbuf() { return imageIDbuf; }
public String imageID() { return imageID; }
+ @Override
public String toString() {
return "TGA Header " +
" id length: " + idLength +
@@ -288,14 +289,14 @@ public class TGAImage {
throw new IOException("TGADecoder Compressed Grayscale images not supported");
}
}
-
+
/**
* This assumes that the body is for a 24 bit or 32 bit for a
* RGB or ARGB image respectively.
*/
private void decodeRGBImageU24_32(GLProfile glp, LEDataInputStream dIn) throws IOException {
setupImage24_32(glp);
-
+
int i; // row index
int y; // output row index
int rawWidth = header.width() * bpp;
@@ -317,14 +318,14 @@ public class TGAImage {
swapBGR(tmpData, rawWidth, header.height(), bpp);
data = ByteBuffer.wrap(tmpData);
}
-
+
/**
* This assumes that the body is for a 24 bit or 32 bit for a
* RGB or ARGB image respectively.
*/
private void decodeRGBImageRLE24_32(GLProfile glp, LEDataInputStream dIn) throws IOException {
setupImage24_32(glp);
-
+
byte[] pixel = new byte[bpp];
int rawWidth = header.width() * bpp;
byte[] tmpData = new byte[rawWidth * header.height()];
@@ -341,17 +342,17 @@ public class TGAImage {
dIn.read(tmpData, i, len * bpp);
i += bpp * len;
}
-
+
if(format == GL.GL_RGB || format == GL.GL_RGBA)
swapBGR(tmpData, rawWidth, header.height(), bpp);
data = ByteBuffer.wrap(tmpData);
}
-
+
private void setupImage24_32(GLProfile glp) {
bpp = header.pixelDepth / 8;
switch (header.pixelDepth) {
- case 24:
- format = glp.isGL2GL3() ? GL2GL3.GL_BGR : GL.GL_RGB;
+ case 24:
+ format = glp.isGL2GL3() ? GL2GL3.GL_BGR : GL.GL_RGB;
break;
case 32:
boolean useBGRA = glp.isGL2GL3();
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 88018ed..0299531 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
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureWriter.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureWriter.java
index 55527ce..35b8efa 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureWriter.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureWriter.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
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 6e2f1b9..18ad429 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
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -54,6 +54,7 @@ import com.jogamp.opengl.util.texture.spi.*;
public class IIOTextureProvider implements TextureProvider {
private static final boolean DEBUG = Debug.debug("TextureIO");
+ @Override
public TextureData newTextureData(GLProfile glp, File file,
int internalFormat,
int pixelFormat,
@@ -70,6 +71,7 @@ public class IIOTextureProvider implements TextureProvider {
return new AWTTextureData(glp, internalFormat, pixelFormat, mipmap, img);
}
+ @Override
public TextureData newTextureData(GLProfile glp, InputStream stream,
int internalFormat,
int pixelFormat,
@@ -86,6 +88,7 @@ public class IIOTextureProvider implements TextureProvider {
return new AWTTextureData(glp, internalFormat, pixelFormat, mipmap, img);
}
+ @Override
public TextureData newTextureData(GLProfile glp, URL url,
int internalFormat,
int pixelFormat,
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 89d0d20..be82e4f 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
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -53,6 +53,7 @@ import com.jogamp.opengl.util.texture.*;
import com.jogamp.opengl.util.texture.spi.*;
public class IIOTextureWriter implements TextureWriter {
+ @Override
public boolean write(File file,
TextureData data) throws IOException {
int pixelFormat = data.getPixelFormat();
@@ -113,7 +114,7 @@ public class IIOTextureWriter implements TextureWriter {
return ImageIO.write(image, IOUtil.getFileSuffix(file), file);
}
-
+
throw new IOException("ImageIO writer doesn't support this pixel format / type (only GL_RGB/A + bytes)");
}
}
diff --git a/src/jogl/classes/javax/media/opengl/DebugGL2.java b/src/jogl/classes/javax/media/opengl/DebugGL2.java
index 05bcf3d..3c064a1 100644
--- a/src/jogl/classes/javax/media/opengl/DebugGL2.java
+++ b/src/jogl/classes/javax/media/opengl/DebugGL2.java
@@ -10,7 +10,7 @@ package javax.media.opengl;
* Sample code which installs this pipeline, manual:
* <pre>
* gl = drawable.setGL(new DebugGL(drawable.getGL()));
- * </pre>
+ * </pre>
* For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}.
* </p>
*/
diff --git a/src/jogl/classes/javax/media/opengl/DebugGL3.java b/src/jogl/classes/javax/media/opengl/DebugGL3.java
index c17f906..b490a63 100644
--- a/src/jogl/classes/javax/media/opengl/DebugGL3.java
+++ b/src/jogl/classes/javax/media/opengl/DebugGL3.java
@@ -10,7 +10,7 @@ package javax.media.opengl;
* Sample code which installs this pipeline, manual:
* <pre>
* gl = drawable.setGL(new DebugGL(drawable.getGL()));
- * </pre>
+ * </pre>
* For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}.
* </p>
*/
diff --git a/src/jogl/classes/javax/media/opengl/DebugGL3bc.java b/src/jogl/classes/javax/media/opengl/DebugGL3bc.java
index 6e294d4..1d42afb 100644
--- a/src/jogl/classes/javax/media/opengl/DebugGL3bc.java
+++ b/src/jogl/classes/javax/media/opengl/DebugGL3bc.java
@@ -10,7 +10,7 @@ package javax.media.opengl;
* Sample code which installs this pipeline, manual:
* <pre>
* gl = drawable.setGL(new DebugGL(drawable.getGL()));
- * </pre>
+ * </pre>
* For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}.
* </p>
*/
diff --git a/src/jogl/classes/javax/media/opengl/DebugGL4.java b/src/jogl/classes/javax/media/opengl/DebugGL4.java
index d21d393..249d850 100644
--- a/src/jogl/classes/javax/media/opengl/DebugGL4.java
+++ b/src/jogl/classes/javax/media/opengl/DebugGL4.java
@@ -10,7 +10,7 @@ package javax.media.opengl;
* Sample code which installs this pipeline, manual:
* <pre>
* gl = drawable.setGL(new DebugGL(drawable.getGL()));
- * </pre>
+ * </pre>
* For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}.
* </p>
*/
diff --git a/src/jogl/classes/javax/media/opengl/DebugGLES2.java b/src/jogl/classes/javax/media/opengl/DebugGLES2.java
index dee363c..6d666d8 100644
--- a/src/jogl/classes/javax/media/opengl/DebugGLES2.java
+++ b/src/jogl/classes/javax/media/opengl/DebugGLES2.java
@@ -10,7 +10,7 @@ package javax.media.opengl;
* Sample code which installs this pipeline, manual:
* <pre>
* gl = drawable.setGL(new DebugGL(drawable.getGL()));
- * </pre>
+ * </pre>
* For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}.
* </p>
*/
diff --git a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
index b0f3da8..7e24347 100644
--- a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
+++ b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003-2009 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -91,7 +91,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
Debug.initSingleton();
DEBUG = Debug.isPropertyDefined("jogl.debug.CapabilitiesChooser", true);
}
-
+
private final static int NO_SCORE = -9999999;
private final static int DOUBLE_BUFFER_MISMATCH_PENALTY = 1000;
private final static int OPAQUE_MISMATCH_PENALTY = 750;
@@ -106,7 +106,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
private final static int ACCUM_MISMATCH_PENALTY_SCALE = 1;
private final static int STENCIL_MISMATCH_PENALTY_SCALE = 3;
private final static int MULTISAMPLE_MISMATCH_PENALTY_SCALE = 3;
-
+
@Override
public int chooseCapabilities(final CapabilitiesImmutable desired,
final List<? extends CapabilitiesImmutable> available,
@@ -143,12 +143,12 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
// Create score array
int[] scores = new int[availnum];
-
+
for (int i = 0; i < scores.length; i++) {
scores[i] = NO_SCORE;
}
final int gldes_samples = gldes.getNumSamples();
-
+
// Compute score for each
for (int i = 0; i < availnum; i++) {
final GLCapabilitiesImmutable cur = (GLCapabilitiesImmutable) available.get(i);
@@ -165,24 +165,24 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
} */
if (gldes.isPBuffer() && !cur.isPBuffer()) {
continue; // requested pBuffer, but n/a
- }
+ }
if (gldes.isBitmap() && !cur.isBitmap()) {
continue; // requested pBuffer, but n/a
- }
+ }
}
if (gldes.getStereo() != cur.getStereo()) {
continue;
}
final int cur_samples = cur.getNumSamples() ;
int score = 0;
-
+
// Compute difference in color depth
// (Note that this decides the direction of all other penalties)
score += (COLOR_MISMATCH_PENALTY_SCALE *
((cur.getRedBits() + cur.getGreenBits() + cur.getBlueBits() + cur.getAlphaBits()) -
(gldes.getRedBits() + gldes.getGreenBits() + gldes.getBlueBits() + gldes.getAlphaBits())));
// Compute difference in depth buffer depth
- score += (DEPTH_MISMATCH_PENALTY_SCALE * sign(score) *
+ score += (DEPTH_MISMATCH_PENALTY_SCALE * sign(score) *
Math.abs(cur.getDepthBits() - gldes.getDepthBits()));
// Compute difference in accumulation buffer depth
score += (ACCUM_MISMATCH_PENALTY_SCALE * sign(score) *
@@ -261,7 +261,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
System.err.println(" ]");
}
- // Ready to select. Choose score closest to 0.
+ // Ready to select. Choose score closest to 0.
int scoreClosestToZero = NO_SCORE;
int chosenIndex = -1;
for (int i = 0; i < availnum; i++) {
diff --git a/src/jogl/classes/javax/media/opengl/FPSCounter.java b/src/jogl/classes/javax/media/opengl/FPSCounter.java
index 9c07b58..4997258 100644
--- a/src/jogl/classes/javax/media/opengl/FPSCounter.java
+++ b/src/jogl/classes/javax/media/opengl/FPSCounter.java
@@ -36,28 +36,28 @@ import java.io.PrintStream;
*/
public interface FPSCounter {
public static final int DEFAULT_FRAMES_PER_INTERVAL = 5*60;
-
+
/**
- * @param frames Update interval in frames.<br> At every rendered <i>frames</i> interval the currentTime and fps values are updated.
+ * @param frames Update interval in frames.<br> At every rendered <i>frames</i> interval the currentTime and fps values are updated.
* If the <i>frames</i> interval is <= 0, no update will be issued, ie the FPSCounter feature is turned off. You may choose {@link #DEFAULT_FRAMES_PER_INTERVAL}.
- * @param out optional print stream where the fps values gets printed if not null at every <i>frames</i> interval
+ * @param out optional print stream where the fps values gets printed if not null at every <i>frames</i> interval
*/
void setUpdateFPSFrames(int frames, PrintStream out);
-
+
/**
* Reset all performance counter (startTime, currentTime, frame number)
*/
void resetFPSCounter();
-
+
/**
* @return update interval in frames
- *
+ *
* @see #setUpdateFPSFrames(int, PrintStream)
*/
int getUpdateFPSFrames();
-
+
/**
- * Returns the time of the first display call in milliseconds after enabling this feature via {@link #setUpdateFPSFrames(int, PrintStream)}.<br>
+ * Returns the time of the first display call in milliseconds after enabling this feature via {@link #setUpdateFPSFrames(int, PrintStream)}.<br>
* This value is reset via {@link #resetFPSCounter()}.
*
* @see #setUpdateFPSFrames(int, PrintStream)
@@ -81,18 +81,18 @@ public interface FPSCounter {
* @see #resetFPSCounter()
*/
long getLastFPSPeriod();
-
+
/**
* @return Last update interval's frames per seconds, {@link #getUpdateFPSFrames()} / {@link #getLastFPSPeriod()}
- *
+ *
* @see #setUpdateFPSFrames(int, PrintStream)
* @see #resetFPSCounter()
*/
- float getLastFPS();
-
+ float getLastFPS();
+
/**
* @return Number of frame rendered since {@link #getFPSStartTime()} up to {@link #getLastFPSUpdateTime()}
- *
+ *
* @see #setUpdateFPSFrames(int, PrintStream)
* @see #resetFPSCounter()
*/
@@ -108,10 +108,10 @@ public interface FPSCounter {
/**
- * @return Total frames per seconds, {@link #getTotalFPSFrames()} / {@link #getTotalFPSDuration()}
- *
+ * @return Total frames per seconds, {@link #getTotalFPSFrames()} / {@link #getTotalFPSDuration()}
+ *
* @see #setUpdateFPSFrames(int, PrintStream)
* @see #resetFPSCounter()
*/
- float getTotalFPS();
+ float getTotalFPS();
}
diff --git a/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java b/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java
index a72403e..8271456 100644
--- a/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java
+++ b/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java
@@ -29,7 +29,7 @@
package javax.media.opengl;
/**
- * An animator control interface,
+ * An animator control interface,
* which implementation may drive a {@link javax.media.opengl.GLAutoDrawable} animation.
*/
public interface GLAnimatorControl extends FPSCounter {
@@ -56,8 +56,8 @@ public interface GLAnimatorControl extends FPSCounter {
boolean isAnimating();
/**
- * Indicates whether this animator {@link #isStarted() is started}
- * and either {@link #pause() manually paused} or paused
+ * Indicates whether this animator {@link #isStarted() is started}
+ * and either {@link #pause() manually paused} or paused
* automatically due to no {@link #add(GLAutoDrawable) added} {@link GLAutoDrawable}s.
*
* @see #start()
@@ -157,15 +157,15 @@ public interface GLAnimatorControl extends FPSCounter {
/**
* Adds a drawable to this animator's list of rendering drawables.
* <p>
- * This allows the animator thread to become {@link #isAnimating() animating},
+ * This allows the animator thread to become {@link #isAnimating() animating},
* in case the first drawable is added and the animator {@link #isStarted() is started}.
* </p>
- *
+ *
* @param drawable the drawable to be added
* @throws IllegalArgumentException if drawable was already added to this animator
*/
void add(GLAutoDrawable drawable);
-
+
/**
* Removes a drawable from the animator's list of rendering drawables.
* <p>
@@ -173,10 +173,10 @@ public interface GLAnimatorControl extends FPSCounter {
* and will not be recovered.
* </p>
* <p>
- * This allows the animator thread to become {@link #isAnimating() not animating},
+ * This allows the animator thread to become {@link #isAnimating() not animating},
* in case the last drawable has been removed.
* </p>
- *
+ *
* @param drawable the drawable to be removed
* @throws IllegalArgumentException if drawable was not added to this animator
*/
diff --git a/src/jogl/classes/javax/media/opengl/GLArrayData.java b/src/jogl/classes/javax/media/opengl/GLArrayData.java
index 8e13830..97f58a9 100644
--- a/src/jogl/classes/javax/media/opengl/GLArrayData.java
+++ b/src/jogl/classes/javax/media/opengl/GLArrayData.java
@@ -43,7 +43,7 @@ public interface GLArrayData {
* Implementation and type dependent object association.
* <p>
* One currently known use case is to associate a {@link com.jogamp.opengl.util.glsl.ShaderState ShaderState}
- * to an GLSL aware vertex attribute object, allowing to use the ShaderState to handle it's
+ * to an GLSL aware vertex attribute object, allowing to use the ShaderState to handle it's
* data persistence, location and state change.<br/>
* This is implicitly done via {@link com.jogamp.opengl.util.glsl.ShaderState#ownAttribute(GLArrayData, boolean) shaderState.ownAttribute(GLArrayData, boolean)}.
* </p>
@@ -51,7 +51,7 @@ public interface GLArrayData {
* @param enable pass true to enable the association and false to disable it.
*/
public void associate(Object obj, boolean enable);
-
+
/**
* Returns true if this data set is intended for a GLSL vertex shader attribute,
* otherwise false, ie intended for fixed function vertex pointer
@@ -110,7 +110,7 @@ public interface GLArrayData {
* <0 denotes an invalid location, i.e. not found or used in the given shader program.
*/
public int setLocation(GL2ES2 gl, int program);
-
+
/**
* Binds the location of the shader attribute to the given location for the unlinked shader program.
* <p>
@@ -121,7 +121,7 @@ public interface GLArrayData {
* @return the given location
*/
public int setLocation(GL2ES2 gl, int program, int location);
-
+
/**
* Determines whether the data is server side (VBO) and enabled,
* or a client side array (false).
@@ -150,7 +150,7 @@ public interface GLArrayData {
*/
public int getVBOTarget();
-
+
/**
* The Buffer holding the data, may be null if a GPU buffer without client bound data
*/
@@ -179,7 +179,7 @@ public interface GLArrayData {
* In case the buffer's position is 0 (sealed, flipped), it's based on it's limit instead of it's position.
*/
public int getElementCount();
-
+
/**
* The currently used size in bytes.<br>
* In case the buffer's position is 0 (sealed, flipped), it's based on it's limit instead of it's position.
@@ -187,20 +187,21 @@ public interface GLArrayData {
public int getSizeInBytes();
/**
- * True, if GL shall normalize fixed point data while converting
+ * True, if GL shall normalize fixed point data while converting
* them into float.
- * <p>
+ * <p>
* Default behavior (of the fixed function pipeline) is <code>true</code>
* for fixed point data type and <code>false</code> for floating point data types.
* </p>
*/
public boolean getNormalized();
- /**
+ /**
* @return the byte offset between consecutive components
- */
+ */
public int getStride();
+ @Override
public String toString();
public void destroy(GL gl);
diff --git a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
index bdbbd96..bf8fe65 100644
--- a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
@@ -48,27 +48,34 @@ import jogamp.opengl.Debug;
an event based mechanism ({@link GLEventListener}) for performing
OpenGL rendering. A GLAutoDrawable automatically creates a primary
rendering context which is associated with the GLAutoDrawable for
- the lifetime of the object. This context has the {@link
- GLContext#setSynchronized synchronized} property enabled so that
- calls to {@link GLContext#makeCurrent makeCurrent} will block if
- the context is current on another thread. This allows the internal
- GLContext for the GLAutoDrawable to be used both by the event
- based rendering mechanism as well by end users directly.
+ the lifetime of the object.
+ <p>
+ Since the {@link GLContext} {@link GLContext#makeCurrent makeCurrent}
+ implementation is synchronized, i.e. blocks if the context
+ is current on another thread, the internal
+ {@link GLContext} for the GLAutoDrawable can be used for the event
+ based rendering mechanism and by end users directly.
+ </p>
+ <h5><a name="initialization">GLAutoDrawable Initialization</a></h5>
<p>
The implementation shall initialize itself as soon as possible,
- ie if the attached {@link javax.media.nativewindow.NativeSurface NativeSurface} becomes visible/realized.
- The following protocol shall be satisfied:
+ which is only possible <i>after</i> the attached {@link javax.media.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>
<li> Notify {@link GLDrawable} to validate the {@link GLCapabilities} by calling {@link GLDrawable#setRealized setRealized(true)}.</li>
<li> Create the new {@link GLContext}.</li>
<li> Initialize all OpenGL resources by calling {@link GLEventListener#init init(..)} for all
- registered {@link GLEventListener}s. This can be done immediatly, or with the followup {@link #display display(..)} call.</li>
+ registered {@link GLEventListener}s. This can be done immediately, or with the followup {@link #display display(..)} call.</li>
<li> Send a reshape event by calling {@link GLEventListener#reshape reshape(..)} for all
registered {@link GLEventListener}s. This shall be done after the {@link GLEventListener#init init(..)} calls.</li>
- </ul></P>
+ </ul>
+ Note: The last to {@link GLEventListener} actions shall be also performed, when {@link #addGLEventListener(GLEventListener) adding}
+ a new one to an already initialized {@link GLAutoDrawable}.
+ </p>
+ <h5><a name="reconfiguration">GLAutoDrawable Reconfiguration</a></h5>
<p>
- Another implementation detail is the drawable reconfiguration. One use case is where a window is being
+ 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/>
For example, AWT's {@link java.awt.Canvas} 's {@link java.awt.Canvas#getGraphicsConfiguration getGraphicsConfiguration()}
@@ -105,14 +112,14 @@ import jogamp.opengl.Debug;
mentioned above, the <code>boolean</code> system property <code>jogl.screenchange.action</code> will control the
screen change action as follows:<br/>
<PRE>
- -Djogl.screenchange.action=false Disable the drawable reconfiguration (the default)
- -Djogl.screenchange.action=true Enable the drawable reconfiguration
+ -Djogl.screenchange.action=false Disable the {@link GLDrawable} reconfiguration (the default)
+ -Djogl.screenchange.action=true Enable the {@link GLDrawable} reconfiguration
</PRE>
</p>
*/
public interface GLAutoDrawable extends GLDrawable {
- /** Flag reflecting wheather the drawable reconfiguration will be issued in
- * case a screen device change occured, e.g. in a multihead environment,
+ /** Flag reflecting whether the {@link GLDrawable} reconfiguration will be issued in
+ * case a screen device change occurred, e.g. in a multihead environment,
* where you drag the window to another monitor. */
public static final boolean SCREEN_CHANGE_ACTION_ENABLED = Debug.getBooleanProperty("jogl.screenchange.action", true);
@@ -121,7 +128,7 @@ public interface GLAutoDrawable extends GLDrawable {
* otherwise return <code>this</code> instance.
*/
public GLDrawable getDelegatedDrawable();
-
+
/**
* Returns the context associated with this drawable. The returned
* context will be synchronized.
@@ -133,38 +140,38 @@ public interface GLAutoDrawable extends GLDrawable {
* Associate the new context, <code>newtCtx</code>, to this auto-drawable.
* <p>
* The current context will be destroyed if <code>destroyPrevCtx</code> is <code>true</code>,
- * otherwise it will be dis-associated from this auto-drawable
+ * otherwise it will be dis-associated from this auto-drawable
* via {@link GLContext#setGLDrawable(GLDrawable, boolean) setGLDrawable(null, true);} first.
* </p>
* <p>
- * The new context will be associated with this auto-drawable
+ * The new context will be associated with this auto-drawable
* via {@link GLContext#setGLDrawable(GLDrawable, boolean) newCtx.setGLDrawable(drawable, true);}.
- * </p>
+ * </p>
* <p>
* If the old or new context was current on this thread, it is being released before switching the association.
- * The new context will be made current afterwards, if it was current before.
+ * The new context will be made current afterwards, if it was current before.
* However the user shall take extra care that no other thread
* attempts to make this context current.
* </p>
- *
+ *
* @param newCtx the new context, maybe <code>null</code> for dis-association.
- * @param destroyPrevCtx if <code>true</code>, destroy the previous context if exists
+ * @param destroyPrevCtx if <code>true</code>, destroy the previous context if exists
* @return the previous GLContext, maybe <code>null</code>
- *
+ *
* @see GLContext#setGLDrawable(GLDrawable, boolean)
* @see GLContext#setGLReadDrawable(GLDrawable)
* @see jogamp.opengl.GLDrawableHelper#switchContext(GLDrawable, GLContext, boolean, GLContext, int)
*/
public GLContext setContext(GLContext newCtx, boolean destroyPrevCtx);
-
+
/**
* Adds the given {@link GLEventListener listener} to the end of this drawable queue.
* The {@link GLEventListener listeners} are notified of events in the order of the queue.
* <p>
- * The newly added listener's {@link GLEventListener#init(GLAutoDrawable) init(..)}
+ * The newly added listener's {@link GLEventListener#init(GLAutoDrawable) init(..)}
* method will be called once before any other of it's callback methods.
* See {@link #getGLEventListenerInitState(GLEventListener)} for details.
- * </p>
+ * </p>
* @param listener The GLEventListener object to be inserted
*/
public void addGLEventListener(GLEventListener listener);
@@ -173,10 +180,10 @@ public interface GLAutoDrawable extends GLDrawable {
* Adds the given {@link GLEventListener listener} at the given index of this drawable queue.
* The {@link GLEventListener listeners} are notified of events in the order of the queue.
* <p>
- * The newly added listener's {@link GLEventListener#init(GLAutoDrawable) init(..)}
+ * The newly added listener's {@link GLEventListener#init(GLAutoDrawable) init(..)}
* method will be called once before any other of it's callback methods.
* See {@link #getGLEventListenerInitState(GLEventListener)} for details.
- * </p>
+ * </p>
* @param index Position where the listener will be inserted.
* Should be within (0 <= index && index <= size()).
* An index value of -1 is interpreted as the end of the list, size().
@@ -190,7 +197,7 @@ public interface GLAutoDrawable extends GLDrawable {
* @return The number of GLEventListener objects of this drawable queue.
*/
public int getGLEventListenerCount();
-
+
/**
* Returns the {@link GLEventListener} at the given index of this drawable queue.
* @param index Position of the listener to be returned.
@@ -200,18 +207,18 @@ public interface GLAutoDrawable extends GLDrawable {
* @throws IndexOutOfBoundsException If the index is not within (0 <= index && index < size()), or -1
*/
public GLEventListener getGLEventListener(int index) throws IndexOutOfBoundsException;
-
+
/**
* Retrieves whether the given {@link GLEventListener listener} is initialized or not.
* <p>
- * After {@link #addGLEventListener(GLEventListener) adding} a {@link GLEventListener} it is
+ * After {@link #addGLEventListener(GLEventListener) adding} a {@link GLEventListener} it is
* marked <i>uninitialized</i> and added to a list of to be initialized {@link GLEventListener}.
- * If such <i>uninitialized</i> {@link GLEventListener}'s handler methods (reshape, display)
+ * If such <i>uninitialized</i> {@link GLEventListener}'s handler methods (reshape, display)
* are about to be invoked, it's {@link GLEventListener#init(GLAutoDrawable) init(..)} method is invoked first.
* Afterwards the {@link GLEventListener} is marked <i>initialized</i>
* and removed from the list of to be initialized {@link GLEventListener}.
* </p>
- * <p>
+ * <p>
* This methods returns the {@link GLEventListener} initialized state,
* i.e. returns <code>false</code> if it is included in the list of to be initialized {@link GLEventListener},
* otherwise <code>true</code>.
@@ -219,17 +226,17 @@ public interface GLAutoDrawable extends GLDrawable {
* @param listener the GLEventListener object to query it's initialized state.
*/
public boolean getGLEventListenerInitState(GLEventListener listener);
-
+
/**
* Sets the given {@link GLEventListener listener's} initialized state.
- * <p>
+ * <p>
* This methods allows manually setting the {@link GLEventListener} initialized state,
* i.e. adding it to, or removing it from the list of to be initialized {@link GLEventListener}.
* See {@link #getGLEventListenerInitState(GLEventListener)} for details.
* </p>
* <p>
* <b>Warning:</b> This method does not validate whether the given {@link GLEventListener listener's}
- * is member of this drawable queue, i.e. {@link #addGLEventListener(GLEventListener) added}.
+ * is member of this drawable queue, i.e. {@link #addGLEventListener(GLEventListener) added}.
* </p>
* <p>
* This method is only exposed to allow users full control over the {@link GLEventListener}'s state
@@ -237,16 +244,16 @@ public interface GLAutoDrawable extends GLDrawable {
* </p>
* <p>
* One use case is moving a {@link GLContext} and their initialized {@link GLEventListener}
- * from one {@link GLAutoDrawable} to another,
+ * from one {@link GLAutoDrawable} to another,
* where a subsequent {@link GLEventListener#init(GLAutoDrawable) init(..)} call after adding it
- * to the new owner is neither required nor desired.
+ * to the new owner is neither required nor desired.
* See {@link com.jogamp.opengl.util.GLDrawableUtil#swapGLContextAndAllGLEventListener(GLAutoDrawable, GLAutoDrawable) swapGLContextAndAllGLEventListener(..)}.
* </p>
* @param listener the GLEventListener object to perform a state change.
- * @param initialized if <code>true</code>, mark the listener initialized, otherwise uninitialized.
+ * @param initialized if <code>true</code>, mark the listener initialized, otherwise uninitialized.
*/
public void setGLEventListenerInitState(GLEventListener listener, boolean initialized);
-
+
/**
* Disposes the given {@link GLEventListener listener} via {@link GLEventListener#dispose(GLAutoDrawable) dispose(..)}
* if it has been initialized and added to this queue.
@@ -255,7 +262,7 @@ public interface GLAutoDrawable extends GLDrawable {
* otherwise marked uninitialized.
* </p>
* <p>
- * If an {@link GLAnimatorControl} is being attached and the current thread is different
+ * If an {@link GLAnimatorControl} is being attached and the current thread is different
* than {@link GLAnimatorControl#getThread() the animator's thread}, it is paused during the operation.
* </p>
* <p>
@@ -266,8 +273,8 @@ public interface GLAutoDrawable extends GLDrawable {
* Use {@link #removeGLEventListener(GLEventListener) removeGLEventListener(listener)} instead
* if you just want to remove the {@link GLEventListener listener} and <i>don't care</i> about the disposal of the it's (OpenGL) resources.
* </p>
- * <p>
- * Also note that this is done from within a particular drawable's
+ * <p>
+ * Also note that this is done from within a particular drawable's
* {@link GLEventListener} handler (reshape, display, etc.), that it is not
* guaranteed that all other listeners will be evaluated properly
* during this update cycle.
@@ -275,30 +282,30 @@ public interface GLAutoDrawable extends GLDrawable {
* @param listener The GLEventListener object to be disposed and removed if <code>remove</code> is <code>true</code>
* @param remove pass <code>true</code> to have the <code>listener</code> removed from this drawable queue, otherwise pass <code>false</code>
* @return the disposed and/or removed GLEventListener, or null if no action was performed, i.e. listener was not added
- */
+ */
public GLEventListener disposeGLEventListener(GLEventListener listener, boolean remove);
-
- /**
+
+ /**
* Removes the given {@link GLEventListener listener} from this drawable queue.
* <p>
- * This is an inexpensive operation, since the removed listener's
+ * This is an inexpensive operation, since the removed listener's
* {@link GLEventListener#dispose(GLAutoDrawable) dispose(..)} method will <i>not</i> be called.
* </p>
* <p>
- * Use {@link #disposeGLEventListener(GLEventListener, boolean) disposeGLEventListener(listener, true)}
+ * Use {@link #disposeGLEventListener(GLEventListener, boolean) disposeGLEventListener(listener, true)}
* instead to ensure disposal of the {@link GLEventListener listener}'s (OpenGL) resources.
- * </p>
- * <p>
- * Note that if this is done from within a particular drawable's
+ * </p>
+ * <p>
+ * Note that if this is done from within a particular drawable's
* {@link GLEventListener} handler (reshape, display, etc.), that it is not
* guaranteed that all other listeners will be evaluated properly
* during this update cycle.
* </p>
* @param listener The GLEventListener object to be removed
* @return the removed GLEventListener, or null if listener was not added
- */
+ */
public GLEventListener removeGLEventListener(GLEventListener listener);
-
+
/**
* Registers the usage of an animator, an {@link javax.media.opengl.GLAnimatorControl} implementation.
* The animator will be queried whether it's animating, ie periodically issuing {@link #display()} calls or not.
@@ -310,9 +317,9 @@ public interface GLAutoDrawable extends GLDrawable {
* <p>
* Impacts {@link #display()} and {@link #invoke(boolean, GLRunnable)} semantics.</p><br>
*
- * @param animator <code>null</code> reference indicates no animator is using
- * this <code>GLAutoDrawable</code>,<br>
- * a valid reference indicates an animator is using this <code>GLAutoDrawable</code>.
+ * @param animatorControl <code>null</code> reference indicates no animator is using
+ * this <code>GLAutoDrawable</code>,<br>
+ * a valid reference indicates an animator is using this <code>GLAutoDrawable</code>.
*
* @throws GLException if an animator is already registered.
* @see #display()
@@ -332,17 +339,17 @@ public interface GLAutoDrawable extends GLDrawable {
/**
* Dedicates this instance's {@link GLContext} to the given thread.<br/>
* The thread will exclusively claim the {@link GLContext} via {@link #display()} and not release it
- * until {@link #destroy()} or <code>setExclusiveContextThread(null)</code> has been called.
+ * until {@link #destroy()} or <code>setExclusiveContextThread(null)</code> has been called.
* <p>
* Default non-exclusive behavior is <i>requested</i> via <code>setExclusiveContextThread(null)</code>,
- * which will cause the next call of {@link #display()} on the exclusive thread to
- * release the {@link GLContext}. Only after it's async release, {@link #getExclusiveContextThread()}
+ * which will cause the next call of {@link #display()} on the exclusive thread to
+ * release the {@link GLContext}. Only after it's async release, {@link #getExclusiveContextThread()}
* will return <code>null</code>.
* </p>
* <p>
* To release a previous made exclusive thread, a user issues <code>setExclusiveContextThread(null)</code>
- * and may poll {@link #getExclusiveContextThread()} until it returns <code>null</code>,
- * <i>while</i> the exclusive thread is still running.
+ * and may poll {@link #getExclusiveContextThread()} until it returns <code>null</code>,
+ * <i>while</i> the exclusive thread is still running.
* </p>
* <p>
* Note: Setting a new exclusive thread without properly releasing a previous one
@@ -357,17 +364,17 @@ public interface GLAutoDrawable extends GLDrawable {
* and spare redundant context switches, see {@link com.jogamp.opengl.util.AnimatorBase#setExclusiveContext(boolean)}.
* </p>
* @param t the exclusive thread to claim the context, or <code>null</code> for default operation.
- * @return previous exclusive context thread
+ * @return previous exclusive context thread
* @throws GLException If an exclusive thread is still active but a new one is attempted to be set
* @see com.jogamp.opengl.util.AnimatorBase#setExclusiveContext(boolean)
*/
public Thread setExclusiveContextThread(Thread t) throws GLException;
-
+
/**
- * @see #setExclusiveContextThread(Thread)
+ * @see #setExclusiveContextThread(Thread)
*/
public Thread getExclusiveContextThread();
-
+
/**
* Enqueues a one-shot {@link GLRunnable},
* which will be executed within the next {@link #display()} call
@@ -389,7 +396,7 @@ public interface GLAutoDrawable extends GLDrawable {
* has been executed by the {@link GLAnimatorControl animator}, otherwise the method returns immediately.
* </p>
* <p>
- * If <code>wait</code> is <code>true</code> <b>and</b>
+ * If <code>wait</code> is <code>true</code> <b>and</b>
* {@link #isRealized()} returns <code>false</code> <i>or</i> {@link #getContext()} returns <code>null</code>,
* the call is ignored and returns <code>false</code>.<br>
* This helps avoiding deadlocking the caller.
@@ -402,20 +409,21 @@ public interface GLAutoDrawable extends GLDrawable {
* @param wait if <code>true</code> block until execution of <code>glRunnable</code> is finished, otherwise return immediately w/o waiting
* @param glRunnable the {@link GLRunnable} to execute within {@link #display()}
* @return <code>true</code> if the {@link GLRunnable} has been processed or queued, otherwise <code>false</code>.
- *
+ *
* @see #setAnimator(GLAnimatorControl)
* @see #display()
* @see GLRunnable
- * @see #enqueue(GLRunnable)
+ * @see #invoke(boolean, List)
*/
public boolean invoke(boolean wait, GLRunnable glRunnable);
-
+
/**
- * Extends {@link #invoke(boolean, GLRunnable)} functionality
+ * Extends {@link #invoke(boolean, GLRunnable)} functionality
* allowing to inject a list of {@link GLRunnable}s.
* @param wait if <code>true</code> block until execution of the last <code>glRunnable</code> is finished, otherwise return immediately w/o waiting
* @param glRunnables the {@link GLRunnable}s to execute within {@link #display()}
* @return <code>true</code> if the {@link GLRunnable}s has been processed or queued, otherwise <code>false</code>.
+ * @see #invoke(boolean, GLRunnable)
*/
public boolean invoke(boolean wait, List<GLRunnable> glRunnables);
@@ -491,16 +499,16 @@ public interface GLAutoDrawable extends GLDrawable {
* <p>
* This GLAutoDrawable implementation holds it's own GLContext reference,
* thus created a GLContext using this methods won't replace it implicitly.
- * To replace or set this GLAutoDrawable's GLContext you need to call {@link #setContext(GLContext, boolean)}.
+ * To replace or set this GLAutoDrawable's GLContext you need to call {@link #setContext(GLContext, boolean)}.
* </p>
* <p>
- * The GLAutoDrawable implementation shall also set the
- * context creation flags as customized w/ {@link #setContextCreationFlags(int)}.
+ * The GLAutoDrawable implementation shall also set the
+ * context creation flags as customized w/ {@link #setContextCreationFlags(int)}.
* </p>
*/
@Override
public GLContext createContext(GLContext shareWith);
-
+
/** Returns the {@link GL} pipeline object this GLAutoDrawable uses.
If this method is called outside of the {@link
GLEventListener}'s callback methods (init, display, etc.) it may
@@ -519,13 +527,13 @@ public interface GLAutoDrawable extends GLDrawable {
demos for examples.
@return the set GL pipeline or null if not successful */
public GL setGL(GL gl);
-
+
/**
* Method <i>may</i> return the upstream UI toolkit object
* holding this {@link GLAutoDrawable} instance, if exist.
* <p>
* Currently known Java UI toolkits and it's known return types are:
- *
+ *
* <table border="1">
* <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>
@@ -533,14 +541,13 @@ public interface GLAutoDrawable extends GLDrawable {
* <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>
* </table>
- * However, the result may be other object types than the listed above
+ * However, the result may be other object types than the listed above
* due to new supported toolkits.
* </p>
* <p>
* This method may also return <code>null</code> if no UI toolkit is being used,
* as common for offscreen rendering.
* </p>
- * @return
*/
public Object getUpstreamWidget();
diff --git a/src/jogl/classes/javax/media/opengl/GLBase.java b/src/jogl/classes/javax/media/opengl/GLBase.java
index f185335..e84dd7b 100644
--- a/src/jogl/classes/javax/media/opengl/GLBase.java
+++ b/src/jogl/classes/javax/media/opengl/GLBase.java
@@ -32,7 +32,7 @@ package javax.media.opengl;
/**
* <P>The base interface from which all GL profiles derive, providing
* checked conversion down to concrete profiles, access to the
- * OpenGL context associated with the GL and extension/function
+ * OpenGL context associated with the GL and extension/function
* availability queries as described below.</P>
*
* <P> While the APIs for vendor extensions are unconditionally
@@ -79,7 +79,7 @@ package javax.media.opengl;
*
*/
public interface GLBase {
-
+
/**
* Indicates whether this GL object conforms to any of the OpenGL profiles.
*/
@@ -131,7 +131,7 @@ public interface GLBase {
* <p>
* Remark: ES2 compatible desktop profiles are not included.
* To query whether core ES2 functionality is provided, use {@link #isGLES2Compatible()}.
- * </p>
+ * </p>
* @see #isGLES2Compatible()
* @see GLContext#isGLES2()
*/
@@ -142,12 +142,12 @@ public interface GLBase {
* <p>
* Remark: ES3 compatible desktop profiles are not included.
* To query whether core ES3 functionality is provided, use {@link #isGLES3Compatible()}.
- * </p>
+ * </p>
* @see #isGLES3Compatible()
* @see GLContext#isGLES3()
*/
public boolean isGLES3();
-
+
/**
* Indicates whether this GL object conforms to one of the OpenGL ES profiles,
* see {@link #isGLES1()} and {@link #isGLES2()}.
@@ -168,13 +168,19 @@ public interface GLBase {
public boolean isGL2ES2();
/**
+ * Indicates whether this GL object conforms to a either a GL2GL3 or GL3ES3 compatible profile.
+ * @see GLContext#isGL2ES3()
+ */
+ public boolean isGL2ES3();
+
+ /**
* Indicates whether this GL object conforms to a GL3ES3 compatible profile.
* @see GLContext#isGL3ES3()
*/
public boolean isGL3ES3();
/**
- * Returns true if this GL object conforms to a GL4ES3 compatible profile, i.e. if {@link #isGLES3Compatible()} returns true.
+ * Returns true if this GL object conforms to a GL4ES3 compatible profile, i.e. if {@link #isGLES3Compatible()} returns true.
* <p>Includes [ GL ≥ 4.3, GL ≥ 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ]</p>
* @see GLContext#isGL4ES3()
*/
@@ -186,29 +192,29 @@ public interface GLBase {
*/
public boolean isGL2GL3();
- /**
+ /**
* Indicates whether this GL object uses a GL4 core profile. <p>Includes [ GL4 ].</p>
* @see GLContext#isGL4core()
*/
public boolean isGL4core();
-
- /**
+
+ /**
* Indicates whether this GL object uses a GL3 core profile. <p>Includes [ GL4, GL3 ].</p>
* @see GLContext#isGL3core()
*/
public boolean isGL3core();
-
- /**
+
+ /**
* Indicates whether this GL object uses a GL core profile. <p>Includes [ GL4, GL3, GLES3, GL2ES2 ].</p>
* @see GLContext#isGLcore()
*/
public boolean isGLcore();
-
+
/**
* Indicates whether this GL object is compatible with the core OpenGL ES2 functionality.
- * @return true if this context is an ES2 context or implements
+ * @return true if this context is an ES2 context or implements
* the extension <code>GL_ARB_ES2_compatibility</code>, otherwise false
- * @see GLContext#isGLES2Compatible()
+ * @see GLContext#isGLES2Compatible()
*/
public boolean isGLES2Compatible();
@@ -221,26 +227,26 @@ public interface GLBase {
* <p>
* Includes [ GL ≥ 4.3, GL ≥ 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ]
* </p>
- * @see GLContext#isGLES3Compatible()
+ * @see GLContext#isGLES3Compatible()
*/
public boolean isGLES3Compatible();
- /**
- * Indicates whether this GL object supports GLSL.
- * @see GLContext#hasGLSL()
+ /**
+ * Indicates whether this GL object supports GLSL.
+ * @see GLContext#hasGLSL()
*/
public boolean hasGLSL();
/**
* Returns the downstream GL instance in case this is a wrapping pipeline, otherwise <code>null</code>.
* <p>
- * See {@link #getRootGL()} for retrieving the implementing root instance.
+ * See {@link #getRootGL()} for retrieving the implementing root instance.
* </p>
* @throws GLException if the downstream instance is not null and not a GL implementation
* @see #getRootGL()
*/
public GL getDownstreamGL() throws GLException;
-
+
/**
* Returns the implementing root instance, considering a wrapped pipelined hierarchy, see {@link #getDownstreamGL()}.
* <p>
@@ -250,7 +256,7 @@ public interface GLBase {
* @throws GLException if the root instance is not a GL implementation
*/
public GL getRootGL() throws GLException;
-
+
/**
* Casts this object to the GL interface.
* @throws GLException if this object is not a GL implementation
@@ -318,6 +324,12 @@ public interface GLBase {
public GL2ES2 getGL2ES2() throws GLException;
/**
+ * Casts this object to the GL2ES3 interface.
+ * @throws GLException if this object is not a GL2ES3 implementation
+ */
+ public GL2ES3 getGL2ES3() throws GLException;
+
+ /**
* Casts this object to the GL3ES3 interface.
* @throws GLException if this object is not a GL3ES3 implementation
*/
@@ -348,14 +360,14 @@ public interface GLBase {
/**
* Returns true if the specified OpenGL core- or extension-function can be
* used successfully through this GL instance given the current host (OpenGL
- * <i>client</i>) and display (OpenGL <i>server</i>) configuration.<P>
- * By "successfully" we mean that the function is both <i>callable</i>
- * on the machine running the program and <i>available</i> on the current
- * display.<P>
+ * <i>client</i>) and display (OpenGL <i>server</i>) configuration.<P>
+ * By "successfully" we mean that the function is both <i>callable</i>
+ * on the machine running the program and <i>available</i> on the current
+ * display.<P>
*
* In order to call a function successfully, the function must be both
- * <i>callable</i> on the machine running the program and <i>available</i> on
- * the display device that is rendering the output (note: on non-networked,
+ * <i>callable</i> on the machine running the program and <i>available</i> on
+ * the display device that is rendering the output (note: on non-networked,
* single-display machines these two conditions are identical; on networked and/or
* multi-display machines this becomes more complicated). These conditions are
* met if the function is either part of the core OpenGL version supported by
@@ -364,7 +376,7 @@ public interface GLBase {
*
* A GL function is <i>callable</i> if it is successfully linked at runtime,
* hence the GLContext must be made current at least once.
- *
+ *
* @param glFunctionName the name of the OpenGL function (e.g., use
* "glBindRenderbufferEXT" or "glBindRenderbuffer" to check if {@link
* GL#glBindRenderbuffer(int,int)} is available).
@@ -374,14 +386,14 @@ public interface GLBase {
/**
* Returns true if the specified OpenGL extension can be
* used successfully through this GL instance given the current host (OpenGL
- * <i>client</i>) and display (OpenGL <i>server</i>) configuration.<P>
+ * <i>client</i>) and display (OpenGL <i>server</i>) configuration.<P>
*
* @param glExtensionName the name of the OpenGL extension (e.g.,
* "GL_ARB_vertex_program").
*/
public boolean isExtensionAvailable(String glExtensionName);
- /**
+ /**
* Returns <code>true</code> if basic FBO support is available, otherwise <code>false</code>.
* <p>
* Basic FBO is supported if the context is either GL-ES >= 2.0, GL >= core 3.0 or implements the extensions
@@ -395,12 +407,12 @@ public interface GLBase {
*/
public boolean hasBasicFBOSupport();
- /**
+ /**
* Returns <code>true</code> if full FBO support is available, otherwise <code>false</code>.
* <p>
* Full FBO is supported if the context is either GL >= core 3.0 or implements the extensions
* <code>ARB_framebuffer_object</code>, or all of
- * <code>EXT_framebuffer_object</code>, <code>EXT_framebuffer_multisample</code>,
+ * <code>EXT_framebuffer_object</code>, <code>EXT_framebuffer_multisample</code>,
* <code>EXT_framebuffer_blit</code>, <code>GL_EXT_packed_depth_stencil</code>.
* </p>
* <p>
@@ -412,7 +424,7 @@ public interface GLBase {
/**
* Returns the maximum number of FBO RENDERBUFFER samples
- * if {@link #hasFullFBOSupport() full FBO is supported}, otherwise false.
+ * if {@link #hasFullFBOSupport() full FBO is supported}, otherwise false.
* @see GLContext#getMaxRenderbufferSamples()
*/
public int getMaxRenderbufferSamples();
@@ -424,12 +436,11 @@ public interface GLBase {
* NPOT textures are supported in OpenGL >= 3, GLES2 or if the
* 'GL_ARB_texture_non_power_of_two' extension is available.
* </p>
- * @return
*/
public boolean isNPOTTextureAvailable();
public boolean isTextureFormatBGRA8888Available();
-
+
/** Provides a platform-independent way to specify the minimum swap
interval for buffer swaps. An argument of 0 disables
sync-to-vertical-refresh completely, while an argument of 1
@@ -438,7 +449,7 @@ public interface GLBase {
is usually either 0 or 1. This function is not guaranteed to
have an effect, and in particular only affects heavyweight
onscreen components.
-
+
@see #getSwapInterval
@throws GLException if this context is not the current
*/
@@ -447,8 +458,8 @@ public interface GLBase {
/** Provides a platform-independent way to get the swap
interval set by {@link #setSwapInterval}. <br>
- If the interval is not set by {@link #setSwapInterval} yet,
- -1 is returned, indicating that the platforms default
+ If the interval is not set by {@link #setSwapInterval} yet,
+ -1 is returned, indicating that the platforms default
is being used.
@see #setSwapInterval
@@ -487,10 +498,10 @@ public interface GLBase {
*/
public Object getExtension(String extensionName);
- /** Aliased entrypoint of <code> void {@native glClearDepth}(GLclampd depth); </code> and <code> void {@native glClearDepthf}(GLclampf depth); </code>. */
+ /** Aliased entrypoint of <code> void {@native glClearDepth}(GLclampd depth); </code> and <code> void {@native glClearDepthf}(GLclampf depth); </code>. */
public void glClearDepth( double depth );
- /** Aliased entrypoint of <code> void {@native glDepthRange}(GLclampd depth); </code> and <code> void {@native glDepthRangef}(GLclampf depth); </code>. */
+ /** Aliased entrypoint of <code> void {@native glDepthRange}(GLclampd depth); </code> and <code> void {@native glDepthRangef}(GLclampf depth); </code>. */
public void glDepthRange(double zNear, double zFar);
/**
@@ -506,53 +517,53 @@ public interface GLBase {
public long glGetBufferSize(int buffer);
/**
- * @return true if a VBO is bound to {@link GL.GL_ARRAY_BUFFER} via {@link GL#glBindBuffer(int, int)}, otherwise false
+ * @return true if a VBO is bound to {@link GL#GL_ARRAY_BUFFER} via {@link GL#glBindBuffer(int, int)}, otherwise false
*/
- public boolean glIsVBOArrayEnabled();
+ public boolean glIsVBOArrayBound();
/**
- * @return true if a VBO is bound to {@link GL.GL_ELEMENT_ARRAY_BUFFER} via {@link GL#glBindBuffer(int, int)}, otherwise false
+ * @return true if a VBO is bound to {@link GL#GL_ELEMENT_ARRAY_BUFFER} via {@link GL#glBindBuffer(int, int)}, otherwise false
*/
- public boolean glIsVBOElementArrayEnabled();
+ public boolean glIsVBOElementArrayBound();
- /**
- * Return the framebuffer name bound to this context,
+ /**
+ * Return the framebuffer name bound to this context,
* see {@link GL#glBindFramebuffer(int, int)}.
*/
public int getBoundFramebuffer(int target);
- /**
+ /**
* Return the default draw framebuffer name.
- * <p>
+ * <p>
* May differ from it's default <code>zero</code>
- * in case an framebuffer object ({@link FBObject}) based drawable
+ * in case an framebuffer object ({@link com.jogamp.opengl.FBObject}) based drawable
* is being used.
- * </p>
+ * </p>
*/
public int getDefaultDrawFramebuffer();
- /**
+ /**
* Return the default read framebuffer name.
- * <p>
+ * <p>
* May differ from it's default <code>zero</code>
- * in case an framebuffer object ({@link FBObject}) based drawable
+ * in case an framebuffer object ({@link com.jogamp.opengl.FBObject}) based drawable
* is being used.
- * </p>
+ * </p>
*/
public int getDefaultReadFramebuffer();
-
- /**
- * Returns the default color buffer within the current bound
+
+ /**
+ * Returns the default color buffer within the current bound
* {@link #getDefaultReadFramebuffer()}, i.e. GL_READ_FRAMEBUFFER,
- * which will be used as the source for pixel reading commands,
+ * which will be used as the source for pixel reading commands,
* like {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer)} etc.
* <p>
* For offscreen framebuffer objects this is {@link GL#GL_COLOR_ATTACHMENT0},
- * otherwise this is {@link GL#GL_FRONT} for single buffer configurations
+ * otherwise this is {@link GL#GL_FRONT} for single buffer configurations
* and {@link GL#GL_BACK} for double buffer configurations.
- * </p>
+ * </p>
*/
public int getDefaultReadBuffer();
-
+
}
diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilities.java b/src/jogl/classes/javax/media/opengl/GLCapabilities.java
index 5b3eb91..b825d63 100644
--- a/src/jogl/classes/javax/media/opengl/GLCapabilities.java
+++ b/src/jogl/classes/javax/media/opengl/GLCapabilities.java
@@ -50,7 +50,8 @@ import javax.media.nativewindow.CapabilitiesImmutable;
must support, such as the OpenGL profile, color depth and whether stereo is enabled.<br>
The actual capabilites of created {@link GLDrawable}s are then reflected by their own
- GLCapabilites instance, which can be queried with {@link GLDrawable#getGLCapabilities()}.<br>
+ GLCapabilites instance, which can be queried with {@link GLDrawable#getChosenGLCapabilities()}.
+ <br>
It currently contains the minimal number of routines which allow
configuration on all supported window systems. */
@@ -98,7 +99,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
}
/**
- * Copies all {@link GLCapabilities} and {@link Capabilities} values
+ * Copies all {@link GLCapabilities} and {@link Capabilities} values
* from <code>source</code> into this instance.
* @return this instance
*/
@@ -121,11 +122,11 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
sampleExtension = source.getSampleExtension();
return this;
}
-
+
@Override
public int hashCode() {
// 31 * x == (x << 5) - x
- int hash = super.hashCode();
+ int hash = super.hashCode();
hash = ((hash << 5) - hash) + this.glProfile.hashCode() ;
hash = ((hash << 5) - hash) + ( this.hardwareAccelerated ? 1 : 0 );
hash = ((hash << 5) - hash) + ( this.stereo ? 1 : 0 );
@@ -237,7 +238,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
public void setGLProfile(GLProfile profile) {
glProfile=profile;
}
-
+
@Override
public final boolean isPBuffer() {
return isPBuffer;
@@ -246,7 +247,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
/**
* Requesting offscreen pbuffer mode.
* <p>
- * If enabled this method also invokes {@link #setOnscreen(int) setOnscreen(false)}.
+ * If enabled this method also invokes {@link #setOnscreen(boolean) setOnscreen(false)}.
* </p>
* <p>
* Defaults to false.
@@ -254,7 +255,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
* <p>
* Requesting offscreen pbuffer mode disables the offscreen auto selection.
* </p>
- */
+ */
public void setPBuffer(boolean enable) {
if(enable) {
setOnscreen(false);
@@ -266,11 +267,11 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
public final boolean isFBO() {
return isFBO;
}
-
+
/**
* Requesting offscreen FBO mode.
* <p>
- * If enabled this method also invokes {@link #setOnscreen(int) setOnscreen(false)}.
+ * If enabled this method also invokes {@link #setOnscreen(boolean) setOnscreen(false)}.
* </p>
* <p>
* Defaults to false.
@@ -421,7 +422,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
return sampleBuffers;
}
- /**
+ /**
* If sample buffers are enabled, indicates the number of buffers
* to be allocated. Defaults to 2.
* @see #getNumSamples()
@@ -490,7 +491,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil
if(isOnscreen()) {
sink.append("."); // no additional off-screen modes besides on-screen
} else {
- sink.append("auto-cfg"); // auto-config off-screen mode
+ sink.append("auto-cfg"); // auto-config off-screen mode
}
}
sink.append("]");
diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java b/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java
index 5d575c2..2e0bec1 100644
--- a/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java
+++ b/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003-2009 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -53,7 +53,7 @@ import javax.media.opengl.GLCapabilitiesImmutable;
the appropriate method of {@link GLDrawableFactory}; the chooser
will be called during the OpenGL context creation process. Note
that this is only a marker interface; its signature is the same as
- {@link CapabilitiesChooser} and the {@link List} of
+ {@link CapabilitiesChooser} and the {@link List} of
objects extending {@link CapabilitiesImmutable}
passed to {@link #chooseCapabilities chooseCapabilities}
is actually a {@link List} of type {@link GLCapabilitiesImmutable}. */
diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java b/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java
index 6af3502..dc28539 100644
--- a/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java
+++ b/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java
@@ -37,13 +37,13 @@ import javax.media.nativewindow.CapabilitiesImmutable;
* @see javax.media.nativewindow.CapabilitiesImmutable
*/
public interface GLCapabilitiesImmutable extends CapabilitiesImmutable {
- /**
- * One of the platform's default sample extension
+ /**
+ * One of the platform's default sample extension
* <code>EGL.EGL_SAMPLES, GLX.GLX_SAMPLES, WGLExt.WGL_SAMPLES_ARB</code>
* if available, or any other <i>known</i> fallback one, ie <code>EGLExt.EGL_COVERAGE_SAMPLES_NV</code>
*/
public static final String DEFAULT_SAMPLE_EXTENSION = "default" ;
-
+
/**
* Returns the GL profile you desire or used by the drawable.
*/
@@ -110,10 +110,10 @@ public interface GLCapabilitiesImmutable extends CapabilitiesImmutable {
* </p>
*/
String getSampleExtension();
-
+
/**
* Returns whether sample buffers for full-scene antialiasing
- * (FSAA) should be allocated for this drawable.
+ * (FSAA) should be allocated for this drawable.
* <p>
* Default is false.
* </p>
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index aa5fca2..deb1d75 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -44,12 +44,14 @@ import java.nio.IntBuffer;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Iterator;
+import java.util.List;
import java.util.Set;
import javax.media.nativewindow.AbstractGraphicsDevice;
import jogamp.opengl.Debug;
import jogamp.opengl.GLContextImpl;
+import jogamp.opengl.GLContextShareSet;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.VersionNumber;
@@ -72,14 +74,14 @@ import com.jogamp.opengl.GLRendererQuirks;
abstraction provides a stable object which clients can use to
refer to a given context. */
public abstract class GLContext {
-
+
public static final boolean DEBUG = Debug.debug("GLContext");
public static final boolean TRACE_SWITCH = Debug.isPropertyDefined("jogl.debug.GLContext.TraceSwitch", true);
- public static final boolean DEBUG_TRACE_SWITCH = DEBUG || TRACE_SWITCH;
+ public static final boolean DEBUG_TRACE_SWITCH = DEBUG || TRACE_SWITCH;
- /**
- * If <code>true</code> (default), bootstrapping the available GL profiles
- * will use the highest compatible GL context for each profile,
+ /**
+ * If <code>true</code> (default), bootstrapping the available GL profiles
+ * will use the highest compatible GL context for each profile,
* hence skipping querying lower profiles if a compatible higher one is found:
* <ul>
* <li>4.2-core -> 4.2-core, 3.3-core</li>
@@ -95,66 +97,66 @@ public abstract class GLContext {
* </ul>
* Using aliasing speeds up initialization about:
* <ul>
- * <li>Linux x86_64 - Nvidia: 28%, 700ms down to 500ms</li>
- * <li>Linux x86_64 - AMD : 40%, 1500ms down to 900ms</li>
+ * <li>Linux x86_64 - Nvidia: 28%, 700ms down to 500ms</li>
+ * <li>Linux x86_64 - AMD : 40%, 1500ms down to 900ms</li>
* <p>
* Can be turned off with property <code>jogl.debug.GLContext.NoProfileAliasing</code>.
* </p>
*/
public static final boolean PROFILE_ALIASING = !Debug.isPropertyDefined("jogl.debug.GLContext.NoProfileAliasing", true);
-
+
protected static final boolean FORCE_NO_FBO_SUPPORT = Debug.isPropertyDefined("jogl.fbo.force.none", true);
protected static final boolean FORCE_MIN_FBO_SUPPORT = Debug.isPropertyDefined("jogl.fbo.force.min", true);
-
+
/** Reflects property jogl.debug.DebugGL. If true, the debug pipeline is enabled at context creation. */
public static final boolean DEBUG_GL = Debug.isPropertyDefined("jogl.debug.DebugGL", true);
/** Reflects property jogl.debug.TraceGL. If true, the trace pipeline is enabled at context creation. */
public static final boolean TRACE_GL = Debug.isPropertyDefined("jogl.debug.TraceGL", true);
- /** Indicates that the context was not made current during the last call to {@link #makeCurrent makeCurrent}. */
+ /** Indicates that the context was not made current during the last call to {@link #makeCurrent makeCurrent}, value {@value}. */
public static final int CONTEXT_NOT_CURRENT = 0;
- /** Indicates that the context was made current during the last call to {@link #makeCurrent makeCurrent}. */
+ /** Indicates that the context was made current during the last call to {@link #makeCurrent makeCurrent}, value {@value}. */
public static final int CONTEXT_CURRENT = 1;
- /** Indicates that a newly-created context was made current during the last call to {@link #makeCurrent makeCurrent}. */
+ /** Indicates that a newly-created context was made current during the last call to {@link #makeCurrent makeCurrent}, value {@value}. */
public static final int CONTEXT_CURRENT_NEW = 2;
- /* Version 1.00, i.e. GLSL 1.00 for ES 2.0. */
+ /** Version 1.00, i.e. GLSL 1.00 for ES 2.0. */
public static final VersionNumber Version100 = new VersionNumber(1, 0, 0);
- /* Version 1.10, i.e. GLSL 1.10 for GL 2.0. */
+ /** Version 1.10, i.e. GLSL 1.10 for GL 2.0. */
public static final VersionNumber Version110 = new VersionNumber(1, 10, 0);
- /* Version 1.20, i.e. GLSL 1.20 for GL 2.1. */
+ /** Version 1.20, i.e. GLSL 1.20 for GL 2.1. */
public static final VersionNumber Version120 = new VersionNumber(1, 20, 0);
- /* Version 1.30, i.e. GLSL 1.30 for GL 3.0. */
+ /** Version 1.30, i.e. GLSL 1.30 for GL 3.0. */
public static final VersionNumber Version130 = new VersionNumber(1, 30, 0);
- /* Version 1.40, i.e. GLSL 1.40 for GL 3.1. */
+ /** Version 1.40, i.e. GLSL 1.40 for GL 3.1. */
public static final VersionNumber Version140 = new VersionNumber(1, 40, 0);
- /* Version 1.50, i.e. GLSL 1.50 for GL 3.2. */
+ /** Version 1.50, i.e. GLSL 1.50 for GL 3.2. */
public static final VersionNumber Version150 = new VersionNumber(1, 50, 0);
-
- /** Version 3.0. As an OpenGL version, it qualifies for desktop {@link #isGL2()} only, or ES 3.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);
-
+
/** 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);
-
+
/** Version 3.2. As an OpenGL version, it qualifies for geometry shader */
public static final VersionNumber Version320 = 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);
-
+
protected static final VersionNumber Version800 = new VersionNumber(8, 0, 0);
//
// Cached keys, bits [0..15]
//
-
- /** Context option bits, full bit mask covering bits [0..15], i.e. <code>0x0000FFFF</code>, {@value}. */
+
+ /** Context option bits, full bit mask covering 16 bits [0..15], i.e. <code>0x0000FFFF</code>, {@value}. */
protected static final int CTX_IMPL_FULL_MASK = 0x0000FFFF;
-
- /** Context option bits, cached bit mask covering 9 bits [0..8], i.e. <code>0x000001FF</code>, {@value}. Leaving 7 bits for non cached options, i.e. 9:7. */
- protected static final int CTX_IMPL_CACHE_MASK = 0x000001FF;
-
+
+ /** Context option bits, cached bit mask covering 10 bits [0..9], i.e. <code>0x000003FF</code>, {@value}. Leaving 6 bits for non cached options, i.e. 10:6. */
+ protected static final int CTX_IMPL_CACHE_MASK = 0x000003FF;
+
/** <code>ARB_create_context</code> related: created via ARB_create_context. Cache key value. See {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */
protected static final int CTX_IS_ARB_CREATED = 1 << 0;
/** <code>ARB_create_context</code> related: desktop compatibility profile. Cache key value. See {@link #isGLCompatibilityProfile()}, {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */
@@ -171,32 +173,32 @@ public abstract class GLContext {
protected static final int CTX_IMPL_ACCEL_SOFT = 1 << 6;
//
- // Non cached keys, bits [9..15]
+ // Non cached keys, 6 bits [10..15]
//
-
+
/** <code>GL_ARB_ES2_compatibility</code> implementation related: Context is compatible w/ ES2. Not a cache key. See {@link #isGLES2Compatible()}, {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */
- protected static final int CTX_IMPL_ES2_COMPAT = 1 << 9;
+ protected static final int CTX_IMPL_ES2_COMPAT = 1 << 10;
/** <code>GL_ARB_ES3_compatibility</code> implementation related: Context is compatible w/ ES3. Not a cache key. See {@link #isGLES3Compatible()}, {@link #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)}. */
- protected static final int CTX_IMPL_ES3_COMPAT = 1 << 10;
-
- /**
+ protected static final int CTX_IMPL_ES3_COMPAT = 1 << 11;
+
+ /**
* Context supports basic FBO, details see {@link #hasBasicFBOSupport()}.
* Not a cache key.
* @see #hasBasicFBOSupport()
* @see #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)
*/
- protected static final int CTX_IMPL_FBO = 1 << 11;
+ protected static final int CTX_IMPL_FBO = 1 << 12;
- /**
- * Context supports <code>OES_single_precision</code>, fp32, fixed function point (FFP) compatibility entry points,
+ /**
+ * Context supports <code>OES_single_precision</code>, fp32, fixed function point (FFP) compatibility entry points,
* see {@link #hasFP32CompatAPI()}.
* Not a cache key.
* @see #hasFP32CompatAPI()
* @see #getAvailableContextProperties(AbstractGraphicsDevice, GLProfile)
*/
- protected static final int CTX_IMPL_FP32_COMPAT_API = 1 << 12;
-
+ protected static final int CTX_IMPL_FP32_COMPAT_API = 1 << 13;
+
private static final ThreadLocal<GLContext> currentContext = new ThreadLocal<GLContext>();
private final HashMap<String, Object> attachedObjects = new HashMap<String, Object>();
@@ -205,10 +207,10 @@ public abstract class GLContext {
protected final RecursiveLock lock = LockFactory.createRecursiveLock();
/** The underlying native OpenGL context */
- protected long contextHandle;
+ protected volatile long contextHandle; // volatile: avoid locking for read-only access
protected GLContext() {
- resetStates();
+ resetStates(true);
}
protected VersionNumber ctxVersion;
@@ -219,12 +221,15 @@ public abstract class GLContext {
private int currentSwapInterval;
protected GLRendererQuirks glRendererQuirks;
- /** Did the drawable association changed ? see {@link GLRendererQuirks#NoSetSwapIntervalPostRetarget} */
- protected boolean drawableRetargeted;
-
- protected void resetStates() {
+ /** Did the drawable association changed ? see {@link GLRendererQuirks#NoSetSwapIntervalPostRetarget} */
+ protected boolean drawableRetargeted;
+
+ /**
+ * @param isInit true if called for class initialization, otherwise false (re-init or destruction).
+ */
+ protected void resetStates(boolean isInit) {
if (DEBUG) {
- System.err.println(getThreadName() + ": GLContext.resetStates()");
+ System.err.println(getThreadName() + ": GLContext.resetStates(isInit "+isInit+")");
// Thread.dumpStack();
}
ctxVersion = VersionNumberString.zeroVersion;
@@ -239,12 +244,27 @@ public abstract class GLContext {
drawableRetargeted = false;
}
- /**
+ /** Returns true if this GLContext is shared, otherwise false. */
+ public final boolean isShared() {
+ return GLContextShareSet.isShared(this);
+ }
+
+ /** Returns a new list of created GLContext shared with this GLContext. */
+ public final List<GLContext> getCreatedShares() {
+ return GLContextShareSet.getCreatedShares(this);
+ }
+
+ /** Returns a new list of destroyed GLContext shared with this GLContext. */
+ public final List<GLContext> getDestroyedShares() {
+ return GLContextShareSet.getDestroyedShares(this);
+ }
+
+ /**
* Returns the instance of {@link GLRendererQuirks}, allowing one to determine workarounds.
* @return instance of {@link GLRendererQuirks} if context was made current once, otherwise <code>null</code>.
*/
public final GLRendererQuirks getRendererQuirks() { return glRendererQuirks; }
-
+
/**
* Returns true if the <code>quirk</code> exist in {@link #getRendererQuirks()}, otherwise false.
* <p>
@@ -257,10 +277,10 @@ public abstract class GLContext {
* @param quirk the quirk to be tested, e.g. {@link GLRendererQuirks#NoDoubleBufferedPBuffer}.
* @throws IllegalArgumentException if the quirk is out of range
*/
- public final boolean hasRendererQuirk(int quirk) throws IllegalArgumentException {
- return null != glRendererQuirks ? glRendererQuirks.exist(quirk) : false ;
+ public final boolean hasRendererQuirk(int quirk) throws IllegalArgumentException {
+ return null != glRendererQuirks ? glRendererQuirks.exist(quirk) : false ;
}
-
+
/**
* Sets the read/write drawable for framebuffer operations.
* <p>
@@ -273,28 +293,29 @@ public abstract class GLContext {
* attempts to make this context current. Otherwise a race condition may happen.
* </p>
* @param readWrite The read/write drawable for framebuffer operations, maybe <code>null</code> to remove association.
- * @param setWriteOnly Only change the write-drawable, if <code>setWriteOnly</code> is <code>true</code> and
- * if the {@link #getGLReadDrawable() read-drawable} differs
- * from the {@link #getGLDrawable() write-drawable}.
+ * @param setWriteOnly Only change the write-drawable, if <code>setWriteOnly</code> is <code>true</code> and
+ * 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
*
- * @throws GLException in case <code>null</code> is being passed or
+ * @throws GLException in case <code>null</code> is being passed or
* this context is made current on another thread.
*
* @see #isGLReadDrawableAvailable()
+ * @see #setGLReadDrawable(GLDrawable)
* @see #getGLReadDrawable()
- * @see #setGLReadDrawable()
+ * @see #setGLDrawable(GLDrawable, boolean)
* @see #getGLDrawable()
*/
public abstract GLDrawable setGLDrawable(GLDrawable readWrite, boolean setWriteOnly);
-
+
/**
* Returns the write-drawable this context uses for framebuffer operations.
* <p>
* If the read-drawable has not been changed manually via {@link #setGLReadDrawable(GLDrawable)},
* it equals to the write-drawable (default).
- * </p>
+ * </p>
* @see #setGLDrawable(GLDrawable, boolean)
* @see #setGLReadDrawable(GLDrawable)
*/
@@ -332,10 +353,10 @@ public abstract class GLContext {
* <p>
* If the read-drawable has not been changed manually via {@link #setGLReadDrawable(GLDrawable)},
* it equals to the write-drawable (default).
- * </p>
+ * </p>
* @see #isGLReadDrawableAvailable()
- * @see #setGLReadDrawable(javax.media.opengl.GLDrawable)
- * @see #getGLDrawable()
+ * @see #setGLReadDrawable(GLDrawable)
+ * @see #getGLReadDrawable()
*/
public abstract GLDrawable getGLReadDrawable();
@@ -350,9 +371,9 @@ public abstract class GLContext {
* </p>
* <p>
* A return value of {@link #CONTEXT_CURRENT_NEW}
- * indicates that that context has been made current for the 1st time,
+ * indicates that that context has been made current for the 1st time,
* or that the state of the underlying context or drawable has
- * changed since the last time this context was current.
+ * changed since the last time this context was current.
* In this case, the application may wish to initialize the render state.
* </p>
* <p>
@@ -374,7 +395,7 @@ public abstract class GLContext {
* </p>
*
* @return <ul>
- * <li>{@link #CONTEXT_CURRENT_NEW} if the context was successfully made current the 1st time,</li>
+ * <li>{@link #CONTEXT_CURRENT_NEW} if the context was successfully made current the 1st time,</li>
* <li>{@link #CONTEXT_CURRENT} if the context was successfully made current,</li>
* <li>{@link #CONTEXT_NOT_CURRENT} if the context could not be made current.</li>
* </ul>
@@ -407,7 +428,7 @@ public abstract class GLContext {
* parameter indicates which groups of state variables are to be
* copied. <code>mask</code> contains the bitwise OR of the same
* symbolic names that are passed to the GL command {@link
- * GL#glPushAttrib glPushAttrib}. The single symbolic constant
+ * GL2#glPushAttrib glPushAttrib}. The single symbolic constant
* {@link GL2#GL_ALL_ATTRIB_BITS GL_ALL_ATTRIB_BITS} can be used to
* copy the maximum possible portion of rendering state. <P>
*
@@ -510,7 +531,7 @@ public abstract class GLContext {
public abstract void destroy();
/**
- * Returns the implementing root GL instance of this GLContext's GL object,
+ * Returns the implementing root GL instance of this GLContext's GL object,
* considering a wrapped pipelined hierarchy, see {@link GLBase#getDownstreamGL()}.
* @throws GLException if the root instance is not a GL implementation
* @see GLBase#getRootGL()
@@ -519,7 +540,7 @@ public abstract class GLContext {
* @see #setGL(GL)
*/
public abstract GL getRootGL();
-
+
/**
* Returns the GL pipeline object for this GLContext.
*
@@ -586,7 +607,7 @@ public abstract class GLContext {
sb.append(toHexString(hashCode()));
sb.append(", handle ");
sb.append(toHexString(contextHandle));
- sb.append(", ");
+ sb.append(", isShared "+isShared()+", ");
sb.append(getGL());
sb.append(",\n\t quirks: ");
if(null != glRendererQuirks) {
@@ -712,16 +733,16 @@ public abstract class GLContext {
}
/**
- * Returns this context OpenGL version.
- * @see #getGLSLVersionNumber()
+ * Returns this context OpenGL version.
+ * @see #getGLSLVersionNumber()
**/
public final VersionNumber getGLVersionNumber() { return ctxVersion; }
- /**
+ /**
* Returns the vendor's version, i.e. version number at the end of <code>GL_VERSION</code> not being the GL version.
* <p>
- * In case no such version exists within <code>GL_VERSION</code>,
+ * In case no such version exists within <code>GL_VERSION</code>,
* the {@link VersionNumberString#zeroVersion zero version} instance is returned.
- * </p>
+ * </p>
* <p>
* The vendor's version is usually the vendor's OpenGL driver version.
* </p>
@@ -729,6 +750,7 @@ public abstract class GLContext {
public final VersionNumberString getGLVendorVersionNumber() { return ctxVendorVersion; }
public final boolean isGLCompatibilityProfile() { return ( 0 != ( CTX_PROFILE_COMPAT & ctxOptions ) ); }
public final boolean isGLCoreProfile() { return ( 0 != ( CTX_PROFILE_CORE & ctxOptions ) ); }
+ public final boolean isGLESProfile() { return ( 0 != ( CTX_PROFILE_ES & ctxOptions ) ); }
public final boolean isGLForwardCompatible() { return ( 0 != ( CTX_OPTION_FORWARD & ctxOptions ) ); }
public final boolean isGLDebugEnabled() { return ( 0 != ( CTX_OPTION_DEBUG & ctxOptions ) ); }
public final boolean isCreatedWithARBMethod() { return ( 0 != ( CTX_IS_ARB_CREATED & ctxOptions ) ); }
@@ -738,31 +760,32 @@ public abstract class GLContext {
* via {@link GL2ES2#GL_SHADING_LANGUAGE_VERSION} if ≥ ES2.0 or GL2.0,
* otherwise a static match is being utilized.
* <p>
- * The context must have been current once,
- * otherwise the {@link VersionNumberString#zeroVersion zero version} instance is returned.
+ * The context must have been current once,
+ * otherwise the {@link VersionNumberString#zeroVersion zero version} instance is returned.
* </p>
* <p>
- * Examples w/ <code>major.minor</code>:
+ * Examples w/ <code>major.minor</code>:
* <pre>
- * 1.00 (ES 2.0), 1.10 (GL 2.0), 1.20 (GL 2.1), 1.50 (GL 3.2),
+ * 1.00 (ES 2.0), 3.00 (ES 3.0)
+ * 1.10 (GL 2.0), 1.20 (GL 2.1), 1.50 (GL 3.2),
* 3.30 (GL 3.3), 4.00 (GL 4.0), 4.10 (GL 4.1), 4.20 (GL 4.2)
* </pre >
* </p>
* <p>
* <i>Matching</i> could also refer to the maximum GLSL version usable by this context
* since <i>normal</i> GL implementations are capable of using a lower GLSL version as well.
- * The latter is not true on OSX w/ a GL3 context.
+ * The latter is not true on OSX w/ a GL3 context.
* </p>
- *
- * @return GLSL version number if context has been made current at least once,
+ *
+ * @return GLSL version number if context has been made current at least once,
* otherwise the {@link VersionNumberString#zeroVersion zero version} instance is returned.
- *
+ *
* @see #getGLVersionNumber()
*/
public final VersionNumber getGLSLVersionNumber() {
return ctxGLSLVersion;
}
-
+
/**
* Returns the GLSL version string as to be used in a shader program, including a terminating newline '\n',
* i.e. for desktop
@@ -789,13 +812,15 @@ public abstract class GLContext {
return "";
}
final int minor = ctxGLSLVersion.getMinor();
- final String esSuffix = isGLES() && ctxGLSLVersion.compareTo(Version300) >= 0 ? " es" : "";
+ final String esSuffix = isGLES() && ctxGLSLVersion.compareTo(Version300) >= 0 ? " es" : "";
return "#version " + ctxGLSLVersion.getMajor() + ( minor < 10 ? "0"+minor : minor ) + esSuffix + "\n" ;
}
-
+
protected static final VersionNumber getStaticGLSLVersionNumber(int glMajorVersion, int glMinorVersion, int ctxOptions) {
if( 0 != ( CTX_PROFILE_ES & ctxOptions ) ) {
- if( 3 > glMajorVersion ) {
+ if( 3 == glMajorVersion ) {
+ return Version300; // ES 3.0 -> GLSL 3.00
+ } else if( 2 == glMajorVersion ) {
return Version100; // ES 2.0 -> GLSL 1.00
}
} else if( 1 == glMajorVersion ) {
@@ -809,13 +834,13 @@ public abstract class GLContext {
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
+ default: return Version150; // GL 3.2 -> GLSL 1.50
}
}
// The new default: GL >= 3.3, ES >= 3.0
return new VersionNumber(glMajorVersion, glMinorVersion * 10, 0); // GL M.N -> GLSL M.N
}
-
+
/**
* @return true if this context is an ES2 context or implements
* the extension <code>GL_ARB_ES3_compatibility</code> or <code>GL_ARB_ES2_compatibility</code>, otherwise false
@@ -835,26 +860,27 @@ public abstract class GLContext {
return 0 != ( ctxOptions & CTX_IMPL_ES3_COMPAT ) ;
}
- /**
+ /**
* @return true if impl. is a hardware rasterizer, otherwise false.
* @see #isHardwareRasterizer(AbstractGraphicsDevice, GLProfile)
- * @see GLProfile#isHardwareRasterizer()
+ * @see GLProfile#isHardwareRasterizer()
*/
public final boolean isHardwareRasterizer() {
return 0 == ( ctxOptions & CTX_IMPL_ACCEL_SOFT ) ;
}
-
+
/**
- * @return true if context supports GLSL, i.e. is either {@link #isGLES2()}, {@link #isGL3()} or {@link #isGL2()} <i>and</i> major-version > 1.
- * @see GLProfile#hasGLSL()
+ * @return true if context supports GLSL, i.e. is either {@link #isGLES3()}, {@link #isGLES2()}, {@link #isGL3()} or {@link #isGL2()} <i>and</i> major-version > 1.
+ * @see GLProfile#hasGLSL()
*/
public final boolean hasGLSL() {
- return isGLES2() ||
+ return isGLES3() ||
+ isGLES2() ||
isGL3() ||
isGL2() && ctxVersion.getMajor()>1 ;
}
- /**
+ /**
* Returns <code>true</code> if basic FBO support is available, otherwise <code>false</code>.
* <p>
* Basic FBO is supported if the context is either GL-ES >= 2.0, GL >= core 3.0 or implements the extensions
@@ -870,30 +896,30 @@ public abstract class GLContext {
return 0 != ( ctxOptions & CTX_IMPL_FBO ) ;
}
- /**
- * Returns <code>true</code> if <code>OES_single_precision</code>, fp32, fixed function point (FFP) compatibility entry points available,
+ /**
+ * Returns <code>true</code> if <code>OES_single_precision</code>, fp32, fixed function point (FFP) compatibility entry points available,
* otherwise <code>false</code>.
* @see #CTX_IMPL_FP32_COMPAT_API
*/
public final boolean hasFP32CompatAPI() {
return 0 != ( ctxOptions & CTX_IMPL_FP32_COMPAT_API ) ;
}
-
- /**
+
+ /**
* Returns <code>true</code> if full FBO support is available, otherwise <code>false</code>.
* <p>
* Full FBO is supported if the context is either GL >= core 3.0 or implements the extensions
* <code>ARB_framebuffer_object</code>, or all of
- * <code>EXT_framebuffer_object</code>, <code>EXT_framebuffer_multisample</code>,
+ * <code>EXT_framebuffer_object</code>, <code>EXT_framebuffer_multisample</code>,
* <code>EXT_framebuffer_blit</code>, <code>GL_EXT_packed_depth_stencil</code>.
* </p>
* <p>
* Full FBO support includes multiple color attachments and multisampling.
* </p>
*/
- public final boolean hasFullFBOSupport() {
+ public final boolean hasFullFBOSupport() {
return hasBasicFBOSupport() && !hasRendererQuirk(GLRendererQuirks.NoFullFBOSupport) &&
- ( isGL3() || // GL >= 3.0
+ ( isGL3() || // GL >= 3.0
isExtensionAvailable(GLExtensions.ARB_framebuffer_object) || // ARB_framebuffer_object
( isExtensionAvailable(GLExtensions.EXT_framebuffer_object) && // All EXT_framebuffer_object*
isExtensionAvailable(GLExtensions.EXT_framebuffer_multisample) &&
@@ -902,10 +928,10 @@ public abstract class GLContext {
)
) ;
}
-
+
/**
* Returns the maximum number of FBO RENDERBUFFER samples
- * if {@link #hasFullFBOSupport() full FBO is supported}, otherwise false.
+ * if {@link #hasFullFBOSupport() full FBO is supported}, otherwise false.
*/
public final int getMaxRenderbufferSamples() {
if( hasFullFBOSupport() ) {
@@ -923,7 +949,7 @@ public abstract class GLContext {
}
return 0;
}
-
+
/** Note: The GL impl. may return a const value, ie {@link GLES2#isNPOTTextureAvailable()} always returns <code>true</code>. */
public boolean isNPOTTextureAvailable() {
return isGL3() || isGLES2Compatible() || isExtensionAvailable(GLExtensions.ARB_texture_non_power_of_two);
@@ -935,9 +961,9 @@ public abstract class GLContext {
isExtensionAvailable(GLExtensions.IMG_texture_format_BGRA8888) ;
}
- /**
+ /**
* Indicates whether this GLContext is capable of GL4bc. <p>Includes [ GL4bc ].</p>
- * @see GLProfile#isGL4bc()
+ * @see GLProfile#isGL4bc()
*/
public final boolean isGL4bc() {
return 0 != (ctxOptions & CTX_IS_ARB_CREATED) &&
@@ -945,9 +971,9 @@ public abstract class GLContext {
ctxVersion.getMajor() >= 4;
}
- /**
+ /**
* Indicates whether this GLContext is capable of GL4. <p>Includes [ GL4bc, GL4 ].</p>
- * @see GLProfile#isGL4()
+ * @see GLProfile#isGL4()
*/
public final boolean isGL4() {
return 0 != (ctxOptions & CTX_IS_ARB_CREATED) &&
@@ -955,7 +981,7 @@ public abstract class GLContext {
ctxVersion.getMajor() >= 4;
}
- /**
+ /**
* Indicates whether this GLContext uses a GL4 core profile. <p>Includes [ GL4 ].</p>
*/
public final boolean isGL4core() {
@@ -963,10 +989,10 @@ public abstract class GLContext {
0 != ( ctxOptions & CTX_PROFILE_CORE ) &&
ctxVersion.getMajor() >= 4;
}
-
- /**
+
+ /**
* Indicates whether this GLContext is capable of GL3bc. <p>Includes [ GL4bc, GL3bc ].</p>
- * @see GLProfile#isGL3bc()
+ * @see GLProfile#isGL3bc()
*/
public final boolean isGL3bc() {
return 0 != (ctxOptions & CTX_IS_ARB_CREATED) &&
@@ -974,17 +1000,17 @@ public abstract class GLContext {
ctxVersion.compareTo(Version310) >= 0 ;
}
- /**
+ /**
* Indicates whether this GLContext is capable of GL3. <p>Includes [ GL4bc, GL4, GL3bc, GL3 ].</p>
- * @see GLProfile#isGL3()
+ * @see GLProfile#isGL3()
*/
public final boolean isGL3() {
return 0 != (ctxOptions & CTX_IS_ARB_CREATED) &&
0 != (ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_CORE)) &&
ctxVersion.compareTo(Version310) >= 0 ;
- }
-
- /**
+ }
+
+ /**
* Indicates whether this GLContext uses a GL3 core profile. <p>Includes [ GL4, GL3 ].</p>
*/
public final boolean isGL3core() {
@@ -992,9 +1018,9 @@ public abstract class GLContext {
0 != ( ctxOptions & CTX_PROFILE_CORE ) &&
ctxVersion.compareTo(Version310) >= 0;
}
-
- /**
- * Indicates whether this GLContext uses a GL core profile. <p>Includes [ GL4, GL3, GLES3, GL2ES2 ].</p>
+
+ /**
+ * Indicates whether this GLContext uses a GL core profile. <p>Includes [ GL4, GL3, GLES3, GLES2 ].</p>
*/
public final boolean isGLcore() {
return ( 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() >= 2 ) ||
@@ -1003,16 +1029,26 @@ public abstract class GLContext {
ctxVersion.compareTo(Version310) >= 0
) ;
}
-
- /**
- * Indicates whether this GLContext's native profile does not implement a default <i>vertex array object</i> (VAO),
+
+ /**
+ * Indicates whether this GLContext allows CPU data sourcing (indices, vertices ..) as opposed to using a GPU buffer source (VBO),
+ * e.g. {@link GL2#glDrawElements(int, int, int, java.nio.Buffer)}.
+ * <p>Includes [GL2ES1, GLES2] == [ GL4bc, GL3bc, GL2, GLES1, GL2ES1, GLES2 ].</p>
+ * <p>See Bug 852 - https://jogamp.org/bugzilla/show_bug.cgi?id=852 </p>
+ */
+ public final boolean isCPUDataSourcingAvail() {
+ return isGL2ES1() || isGLES2();
+ }
+
+ /**
+ * Indicates whether this GLContext's native profile does not implement a default <i>vertex array object</i> (VAO),
* starting w/ OpenGL 3.1 core and GLES3.
* <p>Includes [ GL4, GL3, GLES3 ].</p>
* <pre>
Due to GL 3.1 core spec: E.1. DEPRECATED AND REMOVED FEATURES (p 296),
GL 3.2 core spec: E.2. DEPRECATED AND REMOVED FEATURES (p 331)
there is no more default VAO buffer 0 bound, hence generating and binding one
- to avoid INVALID_OPERATION at VertexAttribPointer.
+ to avoid INVALID_OPERATION at VertexAttribPointer.
More clear is GL 4.3 core spec: 10.4 (p 307).
* </pre>
* <pre>
@@ -1032,96 +1068,106 @@ public abstract class GLContext {
ctxVersion.compareTo(Version310) >= 0
) ;
}
-
+
/**
* If this GLContext does not implement a default VAO, see {@link #hasNoDefaultVAO()},
* an <i>own default VAO</i> will be created and bound at context creation.
* <p>
* If this GLContext does implement a default VAO, i.e. {@link #hasNoDefaultVAO()}
* returns <code>false</code>, this method returns <code>0</code>.
- * </p>
+ * </p>
* <p>
* Otherwise this method returns the VAO object name
- * representing this GLContext's <i>own default VAO</i>.
- * </p>
+ * representing this GLContext's <i>own default VAO</i>.
+ * </p>
* @see #hasNoDefaultVAO()
*/
public abstract int getDefaultVAO();
- /**
+ /**
* Indicates whether this GLContext is capable of GL2. <p>Includes [ GL4bc, GL3bc, GL2 ].</p>
- * @see GLProfile#isGL2()
+ * @see GLProfile#isGL2()
*/
public final boolean isGL2() {
return 0 != ( ctxOptions & CTX_PROFILE_COMPAT ) && ctxVersion.getMajor()>=1 ;
}
- /**
+ /**
* Indicates whether this GLContext is capable of GL2GL3. <p>Includes [ GL4bc, GL4, GL3bc, GL3, GL2, GL2GL3 ].</p>
- * @see GLProfile#isGL2GL3()
- */
+ * @see GLProfile#isGL2GL3()
+ */
public final boolean isGL2GL3() {
return isGL2() || isGL3();
}
- /**
+ /**
* Indicates whether this GLContext is capable of GLES1. <p>Includes [ GLES1 ].</p>
- * @see GLProfile#isGLES1()
+ * @see GLProfile#isGLES1()
*/
public final boolean isGLES1() {
return 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() == 1 ;
}
/**
- * Indicates whether this GLContext is capable of GLES2. <p>Includes [ GLES3, GLES2 ].</p>
- * @see GLProfile#isGLES2()
+ * Indicates whether this GLContext is capable of GLES2. <p>Includes [ GLES2 ].</p>
+ * @see GLProfile#isGLES2()
*/
public final boolean isGLES2() {
- return 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() >= 2 ;
+ return 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() == 2 ;
}
- /**
+ /**
* Indicates whether this GLContext is capable of GLES3. <p>Includes [ GLES3 ].</p>
- * @see GLProfile#isGLES3()
+ * @see GLProfile#isGLES3()
*/
public final boolean isGLES3() {
return 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() >= 3 ;
}
- /**
+ /**
* Indicates whether this GLContext is capable of GLES. <p>Includes [ GLES3, GLES1, GLES2 ].</p>
- * @see GLProfile#isGLES()
+ * @see GLProfile#isGLES()
*/
public final boolean isGLES() {
return 0 != ( CTX_PROFILE_ES & ctxOptions ) ;
}
- /**
+ /**
* Indicates whether this GLContext is capable of GL2ES1. <p>Includes [ GL4bc, GL3bc, GL2, GLES1, GL2ES1 ].</p>
- * @see GLProfile#isGL2ES1()
+ * @see GLProfile#isGL2ES1()
*/
public final boolean isGL2ES1() {
return isGLES1() || isGL2();
}
- /**
+ /**
* Indicates whether this GLContext is capable of GL2ES2. <p>Includes [ GL4bc, GL4, GL3bc, GL3, GLES3, GL2, GL2GL3, GL2ES2, GLES2 ].</p>
- * @see GLProfile#isGL2ES2()
+ * @see GLProfile#isGL2ES2()
*/
public final boolean isGL2ES2() {
return isGLES2() || isGL2GL3();
}
- /**
+ /**
+ * Indicates whether this GLContext is capable of GL2ES3. <p>Includes [ GL4bc, GL4, GL3bc, GL3, GLES3, GL3ES3, GL2, GL2GL3 ].</p>
+ * @see GLProfile#isGL2ES3()
+ * @see #isGL3ES3()
+ * @see #isGL2GL3()
+ */
+ public final boolean isGL2ES3() {
+ return isGL3ES3() || isGL2GL3();
+ }
+
+ /**
* Indicates whether this GLContext is capable of GL3ES3. <p>Includes [ GL4bc, GL4, GL3bc, GL3, GLES3 ].</p>
- * @see GLProfile#isGL3ES3()
+ * @see GLProfile#isGL3ES3()
*/
public final boolean isGL3ES3() {
return isGL4ES3() || isGL3();
}
- /**
- * Returns true if this profile is capable of GL4ES3, i.e. if {@link #isGLES3Compatible()} returns true.
+ /**
+ * Returns true if this profile is capable of GL4ES3, i.e. if {@link #isGLES3Compatible()} returns true.
* <p>Includes [ GL ≥ 4.3, GL ≥ 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ]</p>
* @see GLProfile#isGL4ES3()
*/
@@ -1160,7 +1206,7 @@ public abstract class GLContext {
* </p>
* <p>
* For a valid context the default value is <code>1</code>
- * in case of an EGL based profile (ES1 or ES2) and <code>-1</code>
+ * in case of an EGL based profile (ES1 or ES2) and <code>-1</code>
* (undefined) for desktop.
* </p>
*/
@@ -1197,70 +1243,70 @@ public abstract class GLContext {
}
protected boolean bindSwapBarrierImpl(int group, int barrier) { /** nop per default .. **/ return false; }
- /**
- * Return the framebuffer name bound to this context,
+ /**
+ * Return the framebuffer name bound to this context,
* see {@link GL#glBindFramebuffer(int, int)}.
*/
public abstract int getBoundFramebuffer(int target);
-
- /**
+
+ /**
* Return the default draw framebuffer name.
- * <p>
+ * <p>
* May differ from it's default <code>zero</code>
- * in case an framebuffer object ({@link FBObject}) based drawable
+ * in case an framebuffer object ({@link com.jogamp.opengl.FBObject}) based drawable
* is being used.
- * </p>
+ * </p>
*/
public abstract int getDefaultDrawFramebuffer();
-
- /**
+
+ /**
* Return the default read framebuffer name.
- * <p>
+ * <p>
* May differ from it's default <code>zero</code>
- * in case an framebuffer object ({@link FBObject}) based drawable
+ * in case an framebuffer object ({@link com.jogamp.opengl.FBObject}) based drawable
* is being used.
- * </p>
+ * </p>
*/
public abstract int getDefaultReadFramebuffer();
-
- /**
- * Returns the default color buffer within the current bound
- * {@link #getDefaultReadFramebuffer()}, i.e. GL_READ_FRAMEBUFFER,
- * which will be used as the source for pixel reading commands,
+
+ /**
+ * Returns the default color buffer within the current bound
+ * {@link #getDefaultReadFramebuffer()}, i.e. GL_READ_FRAMEBUFFER,
+ * which will be used as the source for pixel reading commands,
* like {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer)} etc.
* <p>
* For offscreen framebuffer objects this is {@link GL#GL_COLOR_ATTACHMENT0},
- * otherwise this is {@link GL#GL_FRONT} for single buffer configurations
+ * otherwise this is {@link GL#GL_FRONT} for single buffer configurations
* and {@link GL#GL_BACK} for double buffer configurations.
- * </p>
+ * </p>
*/
public abstract int getDefaultReadBuffer();
-
+
/** Get the default pixel data type, as required by e.g. {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer)}. */
public abstract int getDefaultPixelDataType();
-
+
/** Get the default pixel data format, as required by e.g. {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer)}. */
public abstract int getDefaultPixelDataFormat();
-
+
/**
* @return The extension implementing the GLDebugOutput feature,
- * either <i>GL_ARB_debug_output</i> or <i>GL_AMD_debug_output</i>.
+ * either {@link GLExtensions#ARB_debug_output} or {@link GLExtensions#AMD_debug_output}.
* If unavailable or called before initialized via {@link #makeCurrent()}, <i>null</i> is returned.
*/
public abstract String getGLDebugMessageExtension();
/**
- * @return the current synchronous debug behavior via
- * @see #setSynchronous(boolean)
+ * @return the current synchronous debug behavior, set via {@link #setGLDebugSynchronous(boolean)}.
*/
public abstract boolean isGLDebugSynchronous();
/**
* Enables or disables the synchronous debug behavior via
- * {@link GL2GL3#GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB glEnable/glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB)},
- * if extension is {@link #GL_ARB_debug_output}.
- * There is no equivalent for {@link #GL_AMD_debug_output}.
- * <p> The default is <code>true</code>, ie {@link GL2GL3#GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB}.</p>
+ * {@link GL2GL3#GL_DEBUG_OUTPUT_SYNCHRONOUS glEnable/glDisable(GL_DEBUG_OUTPUT_SYNCHRONOUS)},
+ * if extension is {@link GLExtensions#ARB_debug_output}.
+ * There is no equivalent for {@link GLExtensions#AMD_debug_output}.
+ * <p> The default is <code>true</code>, ie {@link GL2GL3#GL_DEBUG_OUTPUT_SYNCHRONOUS}.</p>
+ * @link {@link #isGLDebugSynchronous()}
*/
public abstract void setGLDebugSynchronous(boolean synchronous);
@@ -1270,8 +1316,8 @@ public abstract class GLContext {
public abstract boolean isGLDebugMessageEnabled();
/**
- * Enables or disables the GLDebugOutput feature of extension <i>GL_ARB_debug_output</i>
- * or <i>GL_AMD_debug_output</i>, if available.
+ * Enables or disables the GLDebugOutput feature of extension {@link GLExtensions#ARB_debug_output}
+ * or {@link GLExtensions#AMD_debug_output}, if available.
*
* <p>To enable the GLDebugOutput feature {@link #enableGLDebugMessage(boolean) enableGLDebugMessage(true)}
* or {@link #setContextCreationFlags(int) setContextCreationFlags}({@link GLContext#CTX_OPTION_DEBUG})
@@ -1296,7 +1342,7 @@ public abstract class GLContext {
/**
* Add {@link GLDebugListener}.<br>
*
- * @param listener {@link GLDebugListener} handling {@GLDebugMessage}s
+ * @param listener {@link GLDebugListener} handling {@link GLDebugMessage}s
* @see #enableGLDebugMessage(boolean)
* @see #removeGLDebugListener(GLDebugListener)
*/
@@ -1305,28 +1351,28 @@ public abstract class GLContext {
/**
* Remove {@link GLDebugListener}.<br>
*
- * @param listener {@link GLDebugListener} handling {@GLDebugMessage}s
+ * @param listener {@link GLDebugListener} handling {@link GLDebugMessage}s
* @see #enableGLDebugMessage(boolean)
* @see #addGLDebugListener(GLDebugListener)
*/
public abstract void removeGLDebugListener(GLDebugListener listener);
/**
- * Generic entry for {@link GL2GL3#glDebugMessageControlARB(int, int, int, int, IntBuffer, boolean)}
+ * Generic entry for {@link GL2GL3#glDebugMessageControl(int, int, int, int, IntBuffer, boolean)}
* and {@link GL2GL3#glDebugMessageEnableAMD(int, int, int, IntBuffer, boolean)} of the GLDebugOutput feature.
* @see #enableGLDebugMessage(boolean)
*/
public abstract void glDebugMessageControl(int source, int type, int severity, int count, IntBuffer ids, boolean enabled);
/**
- * Generic entry for {@link GL2GL3#glDebugMessageControlARB(int, int, int, int, int[], int, boolean)}
+ * Generic entry for {@link GL2GL3#glDebugMessageControl(int, int, int, int, int[], int, boolean)}
* and {@link GL2GL3#glDebugMessageEnableAMD(int, int, int, int[], int, boolean)} of the GLDebugOutput feature.
* @see #enableGLDebugMessage(boolean)
*/
public abstract void glDebugMessageControl(int source, int type, int severity, int count, int[] ids, int ids_offset, boolean enabled);
/**
- * Generic entry for {@link GL2GL3#glDebugMessageInsertARB(int, int, int, int, int, String)}
+ * Generic entry for {@link GL2GL3#glDebugMessageInsert(int, int, int, int, int, String)}
* and {@link GL2GL3#glDebugMessageInsertAMD(int, int, int, int, String)} of the GLDebugOutput feature.
* @see #enableGLDebugMessage(boolean)
*/
@@ -1337,7 +1383,7 @@ 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.*/ { 0, 1, 2, 3, 4 } };
public static final int ES_VERSIONS[][] = {
/* 0.*/ { -1 },
@@ -1362,51 +1408,100 @@ public abstract class GLContext {
}
}
+ /**
+ * Returns true, if the major.minor is not inferior to the lowest
+ * valid version and does not exceed the highest known major number by more than one.
+ * <p>
+ * The minor version number is ignored by the upper limit validation
+ * and the major version number may exceed by one.
+ * </p>
+ * <p>
+ * The upper limit check is relaxed since we don't want to cut-off
+ * unforseen new GL version since the release of JOGL.
+ * </p>
+ * <p>
+ * Hence it is important to iterate through GL version from the upper limit
+ * and {@link #decrementGLVersion(int, int[], int[])} until invalid.
+ * </p>
+ */
public static final boolean isValidGLVersion(int ctxProfile, int major, int minor) {
if( 1>major || 0>minor ) {
return false;
}
- if( ( 0 != ( CTX_PROFILE_ES & ctxProfile ) ) ) {
- if( major>=ES_VERSIONS.length) return false;
- if( minor>=ES_VERSIONS[major].length) return false;
+ if( 0 != ( CTX_PROFILE_ES & ctxProfile ) ) {
+ if( major >= ES_VERSIONS.length + 1 ) return false;
} else {
- if( major>=GL_VERSIONS.length) return false;
- if( minor>=GL_VERSIONS[major].length) return false;
+ if( major>=GL_VERSIONS.length + 1 ) return false;
}
return true;
}
- public static final boolean decrementGLVersion(int ctxProfile, int major[], int minor[]) {
- if(null==major || major.length<1 ||null==minor || minor.length<1) {
- throw new GLException("invalid array arguments");
- }
- int m = major[0];
- int n = minor[0];
- if( !isValidGLVersion(ctxProfile, m, n) ) {
- return false;
+ /**
+ * Clip the given GL version to the maximum known valid version if exceeding.
+ * @return true if clipped, i.e. given value exceeds maximum, otherwise false.
+ */
+ public static final boolean clipGLVersion(int ctxProfile, int major[], int minor[]) {
+ final int m = major[0];
+ final int n = minor[0];
+
+ if( 0 != ( CTX_PROFILE_ES & ctxProfile ) ) {
+ if( m >= ES_VERSIONS.length ) {
+ major[0] = ES_VERSIONS.length - 1;
+ minor[0] = ES_VERSIONS[major[0]].length - 1;
+ return true;
+ }
+ if( n >= ES_VERSIONS[m].length ) {
+ minor[0] = ES_VERSIONS[m].length - 1;
+ return true;
+ }
+ } else if( m >= GL_VERSIONS.length ) { // !isES
+ major[0] = GL_VERSIONS.length - 1;
+ minor[0] = GL_VERSIONS[major[0]].length - 1;
+ return true;
+ } else if( n >= GL_VERSIONS[m].length ) { // !isES
+ minor[0] = GL_VERSIONS[m].length - 1;
+ return true;
}
+ return false;
+ }
- // decrement ..
- n -= 1;
- if(n < 0) {
- if( ( 0 != ( CTX_PROFILE_ES & ctxProfile ) ) ) {
- if( m >= 3) {
- m -= 1;
+ /**
+ * Decrement the given GL version by one
+ * and return true if still valid, otherwise false.
+ * <p>
+ * If the given version exceeds the maximum known valid version,
+ * it is {@link #clipGLVersion(int, int[], int[]) clipped} and
+ * true is returned.
+ * </p>
+ *
+ * @param ctxProfile
+ * @param major
+ * @param minor
+ * @return
+ */
+ public static final boolean decrementGLVersion(int ctxProfile, int major[], int minor[]) {
+ if( !clipGLVersion(ctxProfile, major, minor) ) {
+ int m = major[0];
+ int n = minor[0] - 1;
+ if(n < 0) {
+ if( 0 != ( CTX_PROFILE_ES & ctxProfile ) ) {
+ if( m >= 3 ) {
+ m -= 1;
+ } else {
+ m = 0; // major decr [1,2] -> 0
+ }
+ n = ES_VERSIONS[m].length-1;
} else {
- m = 0; // major decr [1,2] -> 0
+ m -= 1;
+ n = GL_VERSIONS[m].length-1;
}
- n = ES_VERSIONS[m].length-1;
- } else {
- m -= 1;
- n = GL_VERSIONS[m].length-1;
}
+ if( !isValidGLVersion(ctxProfile, m, n) ) {
+ return false;
+ }
+ major[0]=m;
+ minor[0]=n;
}
- if( !isValidGLVersion(ctxProfile, m, n) ) {
- return false;
- }
- major[0]=m;
- minor[0]=n;
-
return true;
}
@@ -1461,13 +1556,13 @@ public abstract class GLContext {
}
if (DEBUG) {
System.err.println(getThreadName() + ": createContextARB: SET mappedVersionsAvailableSet "+devKey);
- System.err.println(GLContext.dumpAvailableGLVersions(null).toString());
+ System.err.println(GLContext.dumpAvailableGLVersions(null).toString());
}
}
}
- /**
- * Returns a unique String object using {@link String#intern()} for the given arguments,
+ /**
+ * Returns a unique String object using {@link String#intern()} for the given arguments,
* which object reference itself can be used as a key.
*/
protected static String getDeviceVersionAvailableKey(AbstractGraphicsDevice device, int major, int profile) {
@@ -1476,8 +1571,8 @@ public abstract class GLContext {
}
/**
- * Called by {@link jogamp.opengl.GLContextImpl#createContextARBMapVersionsAvailable} not intended to be used by
- * implementations. However, if {@link #createContextARB} is not being used within
+ * 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)},
* GLProfile has to map the available versions.
*
@@ -1550,7 +1645,7 @@ public abstract class GLContext {
}
return val;
}
-
+
/**
* @param reqMajor Key Value either 1, 2, 3 or 4
* @param reqProfile Key Value either {@link #CTX_PROFILE_COMPAT}, {@link #CTX_PROFILE_CORE} or {@link #CTX_PROFILE_ES}
@@ -1594,7 +1689,8 @@ public abstract class GLContext {
if(major >= 4) { return GLProfile.GL4; }
else if(major == 3 && minor >= 1) { return GLProfile.GL3; }
} else if(0 != ( CTX_PROFILE_ES & ctp )) {
- if(major == 2) { return GLProfile.GLES2; }
+ if(major == 3) { return GLProfile.GLES3; }
+ else if(major == 2) { return GLProfile.GLES2; }
else if(major == 1) { return GLProfile.GLES1; }
}
throw new GLException("Unhandled OpenGL version/profile: "+GLContext.getGLVersion(major, minor, ctp, null));
@@ -1622,7 +1718,7 @@ public abstract class GLContext {
reqMajorCTP[1]=CTX_PROFILE_CORE;
}
}
-
+
/**
* @param device the device the context profile is being requested for
* @param GLProfile the GLProfile the context profile is being requested for
@@ -1631,7 +1727,7 @@ public abstract class GLContext {
protected static final int getAvailableContextProperties(final AbstractGraphicsDevice device, final GLProfile glp) {
final int[] reqMajorCTP = new int[] { 0, 0 };
getRequestMajorAndCompat(glp, reqMajorCTP);
-
+
int _major[] = { 0 };
int _minor[] = { 0 };
int _ctp[] = { 0 };
@@ -1645,15 +1741,27 @@ public abstract class GLContext {
* @param device the device the profile is being requested
* @param major Key Value either 1, 2, 3 or 4
* @param profile Key Value either {@link #CTX_PROFILE_COMPAT}, {@link #CTX_PROFILE_CORE} or {@link #CTX_PROFILE_ES}
- * @return the highest GLProfile regarding availability, version and profile bits.
+ * @return the highest GLProfile for the device regarding availability, version and profile bits.
*/
protected static GLProfile getAvailableGLProfile(AbstractGraphicsDevice device, int reqMajor, int reqProfile)
throws GLException {
+ final String glpName = getAvailableGLProfileName(device, reqMajor, reqProfile);
+ return null != glpName ? GLProfile.get(device, glpName) : null;
+ }
+
+ /**
+ * @param device the device the profile is being requested
+ * @param major Key Value either 1, 2, 3 or 4
+ * @param profile Key Value either {@link #CTX_PROFILE_COMPAT}, {@link #CTX_PROFILE_CORE} or {@link #CTX_PROFILE_ES}
+ * @return the highest GLProfile name for the device regarding availability, version and profile bits.
+ */
+ /* package */ static String getAvailableGLProfileName(AbstractGraphicsDevice device, int reqMajor, int reqProfile)
+ throws GLException {
int major[] = { 0 };
int minor[] = { 0 };
int ctp[] = { 0 };
if(GLContext.getAvailableGLVersion(device, reqMajor, reqProfile, major, minor, ctp)) {
- return GLProfile.get(GLContext.getGLProfile(major[0], minor[0], ctp[0]));
+ return GLContext.getGLProfile(major[0], minor[0], ctp[0]);
}
return null;
}
@@ -1677,7 +1785,7 @@ public abstract class GLContext {
* Returns true if it is possible to create an <i>framebuffer object</i> (FBO).
* <p>
* FBO feature is implemented in OpenGL, hence it is {@link GLProfile} dependent.
- * </p>
+ * </p>
* <p>
* FBO support is queried as described in {@link #hasBasicFBOSupport()}.
* </p>
@@ -1689,16 +1797,16 @@ public abstract class GLContext {
public static final boolean isFBOAvailable(AbstractGraphicsDevice device, GLProfile glp) {
return 0 != ( CTX_IMPL_FBO & getAvailableContextProperties(device, glp) );
}
-
+
/**
- * @return <code>1</code> if using a hardware rasterizer, <code>0</code> if using a software rasterizer and <code>-1</code> if not determined yet.
+ * @return <code>1</code> if using a hardware rasterizer, <code>0</code> if using a software rasterizer and <code>-1</code> if not determined yet.
* @see GLContext#isHardwareRasterizer()
- * @see GLProfile#isHardwareRasterizer()
+ * @see GLProfile#isHardwareRasterizer()
*/
public static final int isHardwareRasterizer(AbstractGraphicsDevice device, GLProfile glp) {
final int r;
final int ctp = getAvailableContextProperties(device, glp);
- if(0 == ctp) {
+ if(0 == ctp) {
r = -1;
} else if( 0 == ( CTX_IMPL_ACCEL_SOFT & ctp ) ) {
r = 1;
@@ -1707,7 +1815,7 @@ public abstract class GLContext {
}
return r;
}
-
+
/**
* @param device the device to request whether the profile is available for
* @param reqMajor Key Value either 1, 2, 3 or 4
@@ -1749,7 +1857,7 @@ public abstract class GLContext {
int minor[] = { 0 };
int ctp[] = { 0 };
boolean ok;
-
+
ok = GLContext.getAvailableGLVersion(device, 3, GLContext.CTX_PROFILE_ES, major, minor, ctp);
if( !ok ) {
ok = GLContext.getAvailableGLVersion(device, 3, GLContext.CTX_PROFILE_CORE, major, minor, ctp);
@@ -1759,7 +1867,7 @@ public abstract class GLContext {
}
return 0 != ( ctp[0] & CTX_IMPL_ES3_COMPAT );
}
-
+
public static boolean isGL4bcAvailable(AbstractGraphicsDevice device, boolean isHardware[]) {
return isGLVersionAvailable(device, 4, CTX_PROFILE_COMPAT, isHardware);
}
@@ -1796,7 +1904,7 @@ public abstract class GLContext {
needColon = appendString(sb, "ES2 compat", needColon, 0 != ( CTX_IMPL_ES2_COMPAT & ctp ));
needColon = appendString(sb, "ES3 compat", needColon, 0 != ( CTX_IMPL_ES3_COMPAT & ctp ));
needColon = appendString(sb, "FBO", needColon, 0 != ( CTX_IMPL_FBO & ctp ));
- needColon = appendString(sb, "FP32 compat-api", needColon, 0 != ( CTX_IMPL_FP32_COMPAT_API & ctp ));
+ needColon = appendString(sb, "FP32 compat", needColon, 0 != ( CTX_IMPL_FP32_COMPAT_API & ctp ));
if( 0 != ( CTX_IMPL_ACCEL_SOFT & ctp ) ) {
needColon = appendString(sb, "software", needColon, true);
} else {
@@ -1834,6 +1942,6 @@ public abstract class GLContext {
}
protected static String getThreadName() { return Thread.currentThread().getName(); }
-
+
}
diff --git a/src/jogl/classes/javax/media/opengl/GLDebugListener.java b/src/jogl/classes/javax/media/opengl/GLDebugListener.java
index 8887d02..ec7f7ce 100644
--- a/src/jogl/classes/javax/media/opengl/GLDebugListener.java
+++ b/src/jogl/classes/javax/media/opengl/GLDebugListener.java
@@ -29,16 +29,16 @@ package javax.media.opengl;
/**
* Listener for {@link GLDebugMessage}s.
- *
+ *
* <p>One can enable GLDebugOutput via {@link GLContext#enableGLDebugMessage(boolean)}
* and add listeners via {@link GLContext#addGLDebugListener(GLDebugListener)}.
*/
public interface GLDebugListener {
- /**
+ /**
* Handle {@link GLDebugMessage} message sent from native GL implementation.
- *
+ *
* <p>Since this method is invoked directly by the GL implementation, it shall
* return as fast as possible.</p>
*/
- void messageSent(GLDebugMessage event);
+ void messageSent(GLDebugMessage event);
}
diff --git a/src/jogl/classes/javax/media/opengl/GLDebugMessage.java b/src/jogl/classes/javax/media/opengl/GLDebugMessage.java
index f8959e6..acb33b0 100644
--- a/src/jogl/classes/javax/media/opengl/GLDebugMessage.java
+++ b/src/jogl/classes/javax/media/opengl/GLDebugMessage.java
@@ -29,15 +29,19 @@ package javax.media.opengl;
import com.jogamp.common.os.Platform;
+/**
+ * OpenGL debug message generated by the driver
+ * and delivered via {@link GLDebugListener}.
+ */
public class GLDebugMessage {
final GLContext source;
- final long when;
+ final long when;
final int dbgSource;
final int dbgType;
final int dbgId;
final int dbgSeverity;
final String dbgMsg;
-
+
/**
* @param source The source of the event
* @param when The time of the event
@@ -56,9 +60,9 @@ public class GLDebugMessage {
this.dbgSeverity = dbgSeverity;
this.dbgMsg = dbgMsg;
}
-
+
/**
- *
+ *
* @param source
* @param when
* @param dbgId
@@ -69,88 +73,88 @@ public class GLDebugMessage {
*/
public static GLDebugMessage translateAMDEvent(GLContext source, long when, int dbgId, int amdDbgCategory, int dbgSeverity, String dbgMsg) {
int dbgSource, dbgType;
-
+
// AMD category == ARB source/type
switch(amdDbgCategory) {
- case GL2GL3.GL_DEBUG_CATEGORY_API_ERROR_AMD:
+ case GL2GL3.GL_DEBUG_CATEGORY_API_ERROR_AMD:
dbgSource = GL2GL3.GL_DEBUG_SOURCE_API;
- dbgType = GL2GL3.GL_DEBUG_TYPE_ERROR;
+ dbgType = GL2GL3.GL_DEBUG_TYPE_ERROR;
break;
//
// def source / other type
//
-
- case GL2GL3.GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD:
+
+ case GL2GL3.GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD:
dbgSource = GL2GL3.GL_DEBUG_SOURCE_WINDOW_SYSTEM;
- dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER;
+ dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER;
break;
-
+
case GL2GL3.GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD:
dbgSource = GL2GL3.GL_DEBUG_SOURCE_SHADER_COMPILER;
- dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER;
+ dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER;
break;
-
+
case GL2GL3.GL_DEBUG_CATEGORY_APPLICATION_AMD:
dbgSource = GL2GL3.GL_DEBUG_SOURCE_APPLICATION;
dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER;
break;
-
-
+
+
//
// other source / def type
//
-
+
case GL2GL3.GL_DEBUG_CATEGORY_DEPRECATION_AMD:
dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER;
- dbgType = GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR;
+ dbgType = GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR;
break;
-
+
case GL2GL3.GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD:
dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER;
- dbgType = GL2GL3.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR;
+ dbgType = GL2GL3.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR;
break;
-
+
case GL2GL3.GL_DEBUG_CATEGORY_PERFORMANCE_AMD:
dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER;
- dbgType = GL2GL3.GL_DEBUG_TYPE_PERFORMANCE;
+ dbgType = GL2GL3.GL_DEBUG_TYPE_PERFORMANCE;
break;
-
- case GL2GL3.GL_DEBUG_CATEGORY_OTHER_AMD:
+
+ case GL2GL3.GL_DEBUG_CATEGORY_OTHER_AMD:
default:
dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER;
dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER;
}
-
- return new GLDebugMessage(source, when, dbgSource, dbgType, dbgId, dbgSeverity, dbgMsg);
+
+ return new GLDebugMessage(source, when, dbgSource, dbgType, dbgId, dbgSeverity, dbgMsg);
}
public static int translateARB2AMDCategory(int dbgSource, int dbgType) {
switch (dbgSource) {
case GL2GL3.GL_DEBUG_SOURCE_WINDOW_SYSTEM:
- return GL2GL3.GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD;
-
+ return GL2GL3.GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD;
+
case GL2GL3.GL_DEBUG_SOURCE_SHADER_COMPILER:
return GL2GL3.GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD;
-
+
case GL2GL3.GL_DEBUG_SOURCE_APPLICATION:
return GL2GL3.GL_DEBUG_CATEGORY_APPLICATION_AMD;
}
-
+
switch(dbgType) {
case GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR:
return GL2GL3.GL_DEBUG_CATEGORY_DEPRECATION_AMD;
-
+
case GL2GL3.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR:
return GL2GL3.GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD;
-
- case GL2GL3.GL_DEBUG_TYPE_PERFORMANCE:
+
+ case GL2GL3.GL_DEBUG_TYPE_PERFORMANCE:
return GL2GL3.GL_DEBUG_CATEGORY_PERFORMANCE_AMD;
}
-
- return GL2GL3.GL_DEBUG_CATEGORY_OTHER_AMD;
+
+ return GL2GL3.GL_DEBUG_CATEGORY_OTHER_AMD;
}
-
+
public GLContext getSource() {
return source;
}
@@ -158,7 +162,7 @@ public class GLDebugMessage {
public long getWhen() {
return when;
}
-
+
public int getDbgSource() {
return dbgSource;
}
@@ -178,14 +182,14 @@ public class GLDebugMessage {
public String getDbgMsg() {
return dbgMsg;
}
-
+
public StringBuilder toString(StringBuilder sb) {
- final String crtab = Platform.getNewline()+"\t";
+ final String crtab = Platform.getNewline()+"\t";
if(null==sb) {
sb = new StringBuilder();
- }
+ }
sb.append("GLDebugEvent[ id ");
- toHexString(sb, dbgId)
+ toHexString(sb, dbgId)
.append(crtab).append("type ").append(getDbgTypeString(dbgType))
.append(crtab).append("severity ").append(getDbgSeverityString(dbgSeverity))
.append(crtab).append("source ").append(getDbgSourceString(dbgSource))
@@ -195,46 +199,47 @@ public class GLDebugMessage {
sb.append(crtab).append("source ").append(source.getGLVersion()).append(" - hash 0x").append(Integer.toHexString(source.hashCode()));
}
sb.append("]");
- return sb;
+ return sb;
}
+ @Override
public String toString() {
return toString(null).toString();
}
-
+
public static String getDbgSourceString(int dbgSource) {
switch(dbgSource) {
case GL2GL3.GL_DEBUG_SOURCE_API: return "GL API";
- case GL2GL3.GL_DEBUG_SOURCE_SHADER_COMPILER: return "GLSL or extension compiler";
- case GL2GL3.GL_DEBUG_SOURCE_WINDOW_SYSTEM: return "Native Windowing binding";
+ case GL2GL3.GL_DEBUG_SOURCE_SHADER_COMPILER: return "GLSL or extension compiler";
+ case GL2GL3.GL_DEBUG_SOURCE_WINDOW_SYSTEM: return "Native Windowing binding";
case GL2GL3.GL_DEBUG_SOURCE_THIRD_PARTY: return "Third party";
case GL2GL3.GL_DEBUG_SOURCE_APPLICATION: return "Application";
case GL2GL3.GL_DEBUG_SOURCE_OTHER: return "generic";
default: return "Unknown (" + toHexString(dbgSource) + ")";
}
}
-
+
public static String getDbgTypeString(int dbgType) {
switch(dbgType) {
case GL2GL3.GL_DEBUG_TYPE_ERROR: return "Error";
- case GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: return "Warning: marked for deprecation";
+ case GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: return "Warning: marked for deprecation";
case GL2GL3.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: return "Warning: undefined behavior";
- case GL2GL3.GL_DEBUG_TYPE_PERFORMANCE: return "Warning: implementation dependent performance";
- case GL2GL3.GL_DEBUG_TYPE_PORTABILITY: return "Warning: vendor-specific extension use";
- case GL2GL3.GL_DEBUG_TYPE_OTHER: return "Warning: generic";
+ case GL2GL3.GL_DEBUG_TYPE_PERFORMANCE: return "Warning: implementation dependent performance";
+ case GL2GL3.GL_DEBUG_TYPE_PORTABILITY: return "Warning: vendor-specific extension use";
+ case GL2GL3.GL_DEBUG_TYPE_OTHER: return "Warning: generic";
default: return "Unknown (" + toHexString(dbgType) + ")";
}
}
-
+
public static String getDbgSeverityString(int dbgSeverity) {
switch(dbgSeverity) {
- case GL2GL3.GL_DEBUG_SEVERITY_HIGH: return "High: dangerous undefined behavior";
- case GL2GL3.GL_DEBUG_SEVERITY_MEDIUM: return "Medium: Severe performance/deprecation/other warnings";
- case GL2GL3.GL_DEBUG_SEVERITY_LOW: return "Low: Performance warnings (redundancy/undefined)";
+ case GL2GL3.GL_DEBUG_SEVERITY_HIGH: return "High: dangerous undefined behavior";
+ case GL2GL3.GL_DEBUG_SEVERITY_MEDIUM: return "Medium: Severe performance/deprecation/other warnings";
+ case GL2GL3.GL_DEBUG_SEVERITY_LOW: return "Low: Performance warnings (redundancy/undefined)";
default: return "Unknown (" + toHexString(dbgSeverity) + ")";
}
}
-
+
public static StringBuilder toHexString(StringBuilder sb, int i) {
if(null==sb) {
sb = new StringBuilder();
@@ -243,6 +248,6 @@ public class GLDebugMessage {
}
public static String toHexString(int i) {
return "0x"+Integer.toHexString(i);
- }
-
+ }
+
}
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawable.java b/src/jogl/classes/javax/media/opengl/GLDrawable.java
index 369ea6d..3c354a2 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawable.java
@@ -53,14 +53,15 @@ import javax.media.nativewindow.NativeSurface;
public interface GLDrawable {
/**
* Creates a new context for drawing to this drawable that will
- * optionally share display lists and other server-side OpenGL
- * objects with the specified GLContext. <P>
- *
+ * optionally share buffer objects, textures and other server-side OpenGL
+ * objects with the specified GLContext.
+ * <p>
* The GLContext <code>share</code> need not be associated with this
* GLDrawable and may be null if sharing of display lists and other
* objects is not desired. See the note in the overview
* documentation on
- * <a href="../../../overview-summary.html#SHARING">context sharing</a>.
+ * <a href="../../../spec-overview.html#SHARING">context sharing</a>.
+ * </p>
*/
public GLContext createContext(GLContext shareWith);
@@ -73,13 +74,13 @@ public interface GLDrawable {
* </p>
* <p>
* End users do not need to call this method; it is not necessary to
- * call <code>setRealized</code> on a {@link GLAutoDrawable}
+ * call <code>setRealized</code> on a {@link GLAutoDrawable}
* as these perform the appropriate calls on their underlying GLDrawables internally.
* </p>
* <p>
* Developers implementing new OpenGL components for various window
* toolkits need to call this method against GLDrawables obtained
- * from the GLDrawableFactory via the
+ * from the GLDrawableFactory via the
* {@link GLDrawableFactory#createGLDrawable(NativeSurface)} method.
* It must typically be
* called with an argument of <code>true</code> when the component
@@ -89,7 +90,7 @@ public interface GLDrawable {
* the <code>addNotify</code> method and with an argument of
* <code>false</code> in the <code>removeNotify</code> method.
* </p>
- * <p>
+ * <p>
* <code>GLDrawable</code> implementations should handle multiple
* cycles of <code>setRealized(true)</code> /
* <code>setRealized(false)</code> calls. Most, if not all, Java
@@ -104,7 +105,7 @@ public interface GLDrawable {
* associated resources as the component becomes realized and
* unrealized, respectively.
* </p>
- * <p>
+ * <p>
* With an argument of <code>true</code>,
* the minimum implementation shall call
* {@link NativeSurface#lockSurface() NativeSurface's lockSurface()} and if successful:
@@ -117,7 +118,7 @@ public interface GLDrawable {
* ensures resolving the window/surface handles, and the drawable's {@link GLCapabilities}
* might have changed.
* </p>
- * <p>
+ * <p>
* Calling this method has no other effects. For example, if
* <code>removeNotify</code> is called on a Canvas implementation
* for which a GLDrawable has been created, it is also necessary to
@@ -130,7 +131,7 @@ public interface GLDrawable {
*/
public void setRealized(boolean realized);
- /**
+ /**
* Returns <code>true</code> if this drawable is realized, otherwise <code>true</code>.
* <p>
* A drawable can be realized and unrealized via {@link #setRealized(boolean)}.
@@ -146,19 +147,19 @@ public interface GLDrawable {
public int getHeight();
/**
- * Returns <code>true</code> if the drawable is rendered in
+ * Returns <code>true</code> if the drawable is rendered in
* OpenGL's coordinate system, <i>origin at bottom left</i>.
* Otherwise returns <code>false</code>, i.e. <i>origin at top left</i>.
* <p>
* Default impl. is <code>true</code>, i.e. OpenGL coordinate system.
- * </p>
+ * </p>
* <p>
* Currently only MS-Windows bitmap offscreen drawable uses a non OpenGL orientation and hence returns <code>false</code>.<br/>
* This removes the need of a vertical flip when used in AWT or Windows applications.
* </p>
*/
public boolean isGLOriented();
-
+
/** Swaps the front and back buffers of this drawable. For {@link
GLAutoDrawable} implementations, when automatic buffer swapping
is enabled (as is the default), this method is called
@@ -191,18 +192,18 @@ public interface GLDrawable {
public NativeSurface getNativeSurface();
/**
- * Returns the GL drawable handle,
+ * Returns the GL drawable handle,
* guaranteed to be valid after {@link #setRealized(boolean) realization}
* <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
+ * It is usually identical to the underlying windowing toolkit {@link NativeSurface surface}'s
* {@link javax.media.nativewindow.NativeSurface#getSurfaceHandle() handle}
* or an intermediate layer to suite GL, e.g. an EGL surface.
* </p>
* <p>
* On EGL it is represented by the EGLSurface.<br>
* On X11/GLX it is represented by either the Window XID, GLXPixmap, or GLXPbuffer.<br>
- * On Windows it is represented by the HDC, which may change with each {@link #lockSurface()}.<br>
+ * On Windows it is represented by the HDC, which may change with each {@link NativeSurface#lockSurface()}.<br>
* </p>
* @see #setRealized(boolean)
* @see NativeSurface#lockSurface()
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index 580d3a5..2af4ba3 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -83,7 +83,7 @@ import jogamp.opengl.Debug;
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>
{@link javax.media.opengl.GLPbuffer} are always
- created immediately and their creation will fail with a
+ created immediately and their creation will fail with a
{@link javax.media.opengl.GLException} if errors occur. </P>
<P> The concrete GLDrawableFactory subclass instantiated by {@link
@@ -94,21 +94,21 @@ import jogamp.opengl.Debug;
public abstract class GLDrawableFactory {
protected static final boolean DEBUG = Debug.debug("GLDrawable");
-
- /**
- * We have to disable support for ANGLE, the D3D ES2 emulation on Windows provided w/ Firefox and Chrome.
+
+ /**
+ * 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>
* This can be overridden by explicitly enabling ANGLE on Windows by setting the property
* <code>jogl.enable.ANGLE</code>.
- * </p>
+ * </p>
*/
protected static final boolean enableANGLE = Debug.isPropertyDefined("jogl.enable.ANGLE", true);
- /**
+ /**
* In case no OpenGL ES implementation is required
* and if the running platform may have a buggy implementation,
- * setting the property <code>jogl.disable.opengles</code> disables querying a possible existing OpenGL ES implementation.
+ * setting the property <code>jogl.disable.opengles</code> disables querying a possible existing OpenGL ES implementation.
*/
protected static final boolean disableOpenGLES = Debug.isPropertyDefined("jogl.disable.opengles", true);
@@ -117,11 +117,11 @@ public abstract class GLDrawableFactory {
private static GLDrawableFactory nativeOSFactory;
private static ArrayList<GLDrawableFactory> glDrawableFactories = new ArrayList<GLDrawableFactory>();
-
+
/**
* Instantiate singleton factories if available, EGLES1, EGLES2 and the OS native ones.
*/
- public static final void initSingleton() {
+ public static final void initSingleton() {
if (!isInit) { // volatile: ok
synchronized (GLDrawableFactory.class) {
if (!isInit) {
@@ -130,15 +130,16 @@ public abstract class GLDrawableFactory {
}
}
}
- }
+ }
private static final void initSingletonImpl() {
NativeWindowFactory.initSingleton();
NativeWindowFactory.addCustomShutdownHook(false /* head */, new Runnable() {
+ @Override
public void run() {
shutdown0();
}
});
-
+
final String nwt = NativeWindowFactory.getNativeWindowType(true);
GLDrawableFactory tmp = null;
String factoryClassName = Debug.getProperty("jogl.gldrawablefactory.class.name", true);
@@ -163,7 +164,7 @@ public abstract class GLDrawableFactory {
}
try {
tmp = (GLDrawableFactory) ReflectionUtil.createInstance(factoryClassName, cl);
- } catch (Exception jre) {
+ } catch (Exception jre) {
if (DEBUG || GLProfile.DEBUG) {
System.err.println("Info: GLDrawableFactory.static - Native Platform: "+nwt+" - not available: "+factoryClassName);
jre.printStackTrace();
@@ -202,7 +203,7 @@ public abstract class GLDrawableFactory {
}
}
}
-
+
private static void shutdown0() {
// Following code will _always_ remain in shutdown hook
// due to special semantics of native utils, i.e. X11Utils.
@@ -228,22 +229,22 @@ public abstract class GLDrawableFactory {
}
}
glDrawableFactories.clear();
-
- // both were members of glDrawableFactories and are shutdown already
+
+ // both were members of glDrawableFactories and are shutdown already
nativeOSFactory = null;
eglFactory = null;
}
GLContext.shutdown();
}
-
+
protected GLDrawableFactory() {
synchronized(glDrawableFactories) {
glDrawableFactories.add(this);
}
}
-
+
protected static String getThreadName() { return Thread.currentThread().getName(); }
-
+
/** Returns true if this factory is complete, i.e. ready to be used. Otherwise return false. */
protected abstract boolean isComplete();
@@ -253,14 +254,14 @@ public abstract class GLDrawableFactory {
protected abstract void destroy();
public abstract void resetDisplayGamma();
-
+
/**
* Retrieve the default <code>device</code> {@link AbstractGraphicsDevice#getConnection() connection},
* {@link AbstractGraphicsDevice#getUnitID() unit ID} and {@link AbstractGraphicsDevice#getUniqueID() unique ID name}. for this factory<br>
* The implementation must return a non <code>null</code> default device, which must not be opened, ie. it's native handle is <code>null</code>.
* <p>
* This method shall return the default device if available
- * even if the GLDrawableFactory is not functional and hence not compatible.
+ * even if the GLDrawableFactory is not functional and hence not compatible.
* The latter situation may happen because no native OpenGL implementation is available for the specific implementation.
* </p>
* @return the default shared device for this factory, eg. :0.0 on X11 desktop.
@@ -269,10 +270,10 @@ public abstract class GLDrawableFactory {
public abstract AbstractGraphicsDevice getDefaultDevice();
/**
- * @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 AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
* @return true if the device is compatible with this factory, ie. if it can be used for GLDrawable creation. Otherwise false.
* This implies validation whether the implementation is functional.
- *
+ *
* @see #getDefaultDevice()
*/
public abstract boolean getIsDeviceCompatible(AbstractGraphicsDevice device);
@@ -287,8 +288,8 @@ public abstract class GLDrawableFactory {
System.err.println("Info: "+getClass().getSimpleName()+".validateDevice: using default device : "+device);
}
}
-
- // Always validate the device,
+
+ // Always validate the device,
// since even the default device may not be used by this factory.
if( !getIsDeviceCompatible(device) ) {
if (GLProfile.DEBUG) {
@@ -300,29 +301,29 @@ public abstract class GLDrawableFactory {
}
/**
- * Validate and start the shared resource runner thread if necessary and
+ * Validate and start the shared resource runner thread if necessary and
* if the implementation uses it.
- *
+ *
* @return the shared resource runner thread, if implementation uses it.
*/
protected abstract Thread getSharedResourceThread();
-
+
/**
* Create the shared resource used internally as a reference for capabilities etc.
* <p>
- * Returns true if a shared resource could be created
+ * Returns true if a shared resource could be created
* for the <code>device</code> {@link AbstractGraphicsDevice#getConnection()}.<br>
* This does not imply a shared resource is mapped (ie. made persistent), but is available in general<br>.
* </p>
*
- * @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.
- * @return true if a shared resource could been created, otherwise false.
+ * @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 true if a shared resource could been created, otherwise false.
*/
protected final boolean createSharedResource(AbstractGraphicsDevice device) {
return createSharedResourceImpl(device);
- }
+ }
protected abstract boolean createSharedResourceImpl(AbstractGraphicsDevice device);
-
+
/**
* Returns true if the <code>quirk</code> exist in the shared resource's context {@link GLRendererQuirks}.
* <p>
@@ -332,18 +333,18 @@ public abstract class GLDrawableFactory {
return null != glrq ? glrq.exist(quirk) : false;
* </pre>
* </p>
- *
- * @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 AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
* @param quirk the quirk to be tested, e.g. {@link GLRendererQuirks#NoDoubleBufferedPBuffer}.
* @throws IllegalArgumentException if the quirk is out of range
- * @see #getRendererQuirks()
+ * @see #getRendererQuirks(AbstractGraphicsDevice)
* @see GLRendererQuirks
*/
public final boolean hasRendererQuirk(AbstractGraphicsDevice device, int quirk) {
final GLRendererQuirks glrq = getRendererQuirks(device);
return null != glrq ? glrq.exist(quirk) : false;
}
-
+
/**
* Returns the shared resource's context {@link GLRendererQuirks}.
* <p>
@@ -353,17 +354,17 @@ public abstract class GLDrawableFactory {
* In case no shared device exist yet or the implementation doesn't support tracking quirks,
* the result is always <code>null</code>.
* </p>
- * @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 AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
* @see GLContext#getRendererQuirks()
* @see GLRendererQuirks
*/
public abstract GLRendererQuirks getRendererQuirks(AbstractGraphicsDevice device);
-
+
/**
* Returns the sole GLDrawableFactory instance for the desktop (X11, WGL, ..) if exist or null
*/
public static GLDrawableFactory getDesktopFactory() {
- GLProfile.initSingleton();
+ GLProfile.initSingleton();
return nativeOSFactory;
}
@@ -371,14 +372,14 @@ public abstract class GLDrawableFactory {
* Returns the sole GLDrawableFactory instance for EGL if exist or null
*/
public static GLDrawableFactory getEGLFactory() {
- GLProfile.initSingleton();
+ GLProfile.initSingleton();
return eglFactory;
}
- /**
- * Returns the sole GLDrawableFactory instance.
- *
- * @param glProfile GLProfile to determine the factory type, ie EGLDrawableFactory,
+ /**
+ * Returns the sole GLDrawableFactory instance.
+ *
+ * @param glProfile GLProfile to determine the factory type, ie EGLDrawableFactory,
* or one of the native GLDrawableFactory's, ie X11/GLX, Windows/WGL or MacOSX/CGL.
*/
public static GLDrawableFactory getFactory(GLProfile glProfile) throws GLException {
@@ -387,7 +388,7 @@ public abstract class GLDrawableFactory {
protected static GLDrawableFactory getFactoryImpl(String glProfileImplName) throws GLException {
if ( GLProfile.usesNativeGLES(glProfileImplName) ) {
- if(null!=eglFactory) {
+ if(null!=eglFactory) {
return eglFactory;
}
} else if(null!=nativeOSFactory) {
@@ -412,7 +413,7 @@ public abstract class GLDrawableFactory {
* The chosen GLProfile statement in the result may not refer to the maximum available profile
* due to implementation constraints, ie using the shared resource.
*
- * @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 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.
*/
public final List<GLCapabilitiesImmutable> getAvailableCapabilities(AbstractGraphicsDevice device) {
@@ -446,10 +447,10 @@ public abstract class GLDrawableFactory {
* and {@link #canCreateGLPbuffer(AbstractGraphicsDevice, GLProfile) canCreateGLPbuffer(device)} is true.
* </p>
* <p>
- * If not onscreen and neither FBO nor Pbuffer is available,
+ * If not onscreen and neither FBO nor Pbuffer is available,
* a simple pixmap/bitmap drawable/surface is created, which is unlikely to be hardware accelerated.
* </p>
- *
+ *
* @throws IllegalArgumentException if the passed target is null
* @throws GLException if any window system-specific errors caused
* the creation of the GLDrawable to fail.
@@ -459,22 +460,23 @@ public abstract class GLDrawableFactory {
* @see javax.media.opengl.GLCapabilities#isOnscreen()
* @see javax.media.opengl.GLCapabilities#isFBO()
* @see javax.media.opengl.GLCapabilities#isPBuffer()
- * @see javax.media.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen)
+ * @see GraphicsConfigurationFactory#chooseGraphicsConfiguration(CapabilitiesImmutable, CapabilitiesImmutable, CapabilitiesChooser, AbstractGraphicsScreen, int)
*/
public abstract GLDrawable createGLDrawable(NativeSurface target)
throws IllegalArgumentException, GLException;
-
+
/**
- * Creates a {@link GLDrawable#isRealized() realized} {@link GLOffscreenAutoDrawable}
- * incl it's offscreen {@link javax.media.nativewindow.NativeSurface} with the given capabilites and dimensions.
+ * Creates a {@link GLDrawable#isRealized() realized} {@link GLOffscreenAutoDrawable}
+ * incl it's offscreen {@link NativeSurface} with the given capabilites and dimensions.
* <p>
- * The {@link GLOffscreenAutoDrawable}'s {@link GLDrawable} is {@link GLDrawable#isRealized() realized}
+ * The {@link GLOffscreenAutoDrawable}'s {@link GLDrawable} is {@link GLDrawable#isRealized() realized}
* and it's {@link GLContext} assigned but not yet made current.
* </p>
* <p>
* In case the passed {@link GLCapabilitiesImmutable} contains default values, i.e.
* {@link GLCapabilitiesImmutable#isOnscreen() caps.isOnscreen()} <code> == true</code>,
- * it is auto-configured. The latter will set offscreen and also FBO <i>or</i> Pbuffer, whichever is available in that order.
+ * it is auto-configured. Auto configuration will set {@link GLCapabilitiesImmutable caps} to offscreen
+ * and FBO <i>or</i> Pbuffer, whichever is available in that order.
* </p>
* <p>
* A FBO based auto drawable, {@link GLOffscreenAutoDrawable.FBO}, is created if both {@link GLCapabilitiesImmutable#isFBO() caps.isFBO()}
@@ -485,11 +487,11 @@ public abstract class GLDrawableFactory {
* and {@link #canCreateGLPbuffer(AbstractGraphicsDevice, GLProfile) canCreateGLPbuffer(device)} is true.
* </p>
* <p>
- * If neither FBO nor Pbuffer is available,
+ * If neither FBO nor Pbuffer is available,
* a simple pixmap/bitmap auto drawable is created, which is unlikely to be hardware accelerated.
* </p>
*
- * @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 AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device.
* @param caps the requested GLCapabilties
* @param chooser the custom chooser, may be null for default
* @param width the requested offscreen width
@@ -498,17 +500,93 @@ public abstract class GLDrawableFactory {
*
* @throws GLException if any window system-specific errors caused
* the creation of the Offscreen to fail.
- *
+ *
* @see #createOffscreenDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int)
+ * @deprecated Use {@link #createOffscreenAutoDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int)
*/
public abstract GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice device,
GLCapabilitiesImmutable caps,
GLCapabilitiesChooser chooser,
int width, int height,
GLContext shareWith) throws GLException;
+
+ /**
+ * Creates a {@link GLDrawable#isRealized() realized} {@link GLOffscreenAutoDrawable}
+ * incl it's offscreen {@link NativeSurface} with the given capabilites and dimensions.
+ * <p>
+ * The {@link GLOffscreenAutoDrawable}'s {@link GLDrawable} is {@link GLDrawable#isRealized() realized}
+ * <i>without</i> an assigned {@link GLContext}, hence not initialized completely.<br>
+ * The {@link GLContext} can be assigned later manually via {@link GLAutoDrawable#setContext(GLContext, boolean) setContext(ctx)}
+ * <i>or</i> it will be created <i>lazily</i> at the 1st {@link GLAutoDrawable#display() display()} method call.<br>
+ * <i>Lazy</i> {@link GLContext} creation will take a shared {@link GLContext} into account
+ * which has been set {@link GLOffscreenAutoDrawable#setSharedContext(GLContext) directly}
+ * or {@link GLOffscreenAutoDrawable#setSharedAutoDrawable(GLAutoDrawable) via another GLAutoDrawable}.
+ * </p>
+ * <p>
+ * In case the passed {@link GLCapabilitiesImmutable} contains default values, i.e.
+ * {@link GLCapabilitiesImmutable#isOnscreen() caps.isOnscreen()} <code> == true</code>,
+ * it is auto-configured. Auto configuration will set {@link GLCapabilitiesImmutable caps} to offscreen
+ * and FBO <i>or</i> Pbuffer, whichever is available in that order.
+ * </p>
+ * <p>
+ * A FBO based auto drawable, {@link GLOffscreenAutoDrawable.FBO}, is created if both {@link GLCapabilitiesImmutable#isFBO() caps.isFBO()}
+ * and {@link GLContext#isFBOAvailable(AbstractGraphicsDevice, GLProfile) canCreateFBO(device, caps.getGLProfile())} is true.
+ * </p>
+ * <p>
+ * A Pbuffer based auto drawable is created if both {@link GLCapabilitiesImmutable#isPBuffer() caps.isPBuffer()}
+ * and {@link #canCreateGLPbuffer(AbstractGraphicsDevice, GLProfile) canCreateGLPbuffer(device)} is true.
+ * </p>
+ * <p>
+ * If neither FBO nor Pbuffer is available,
+ * a simple pixmap/bitmap auto drawable is created, which is unlikely to be hardware accelerated.
+ * </p>
+ *
+ * @param device which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device.
+ * @param caps the requested GLCapabilties
+ * @param chooser the custom chooser, may be null for default
+ * @param width the requested offscreen width
+ * @param height the requested offscreen height
+ * @return the created and realized offscreen {@link GLOffscreenAutoDrawable} instance
+ *
+ * @throws GLException if any window system-specific errors caused
+ * the creation of the Offscreen to fail.
+ *
+ * @see #createOffscreenDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int)
+ */
+ public abstract GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice device,
+ GLCapabilitiesImmutable caps,
+ GLCapabilitiesChooser chooser,
+ int width, int height) throws GLException;
+
/**
- * Creates an {@link GLDrawable#isRealized() unrealized} offscreen {@link GLDrawable}
- * incl it's offscreen {@link javax.media.nativewindow.NativeSurface} with the given capabilites and dimensions.
+ * Creates a {@link GLDrawable#isRealized() realized} <i>dummy</i> {@link GLAutoDrawable}
+ * incl it's <i>dummy, invisible</i> {@link NativeSurface}
+ * as created with {@link #createDummyDrawable(AbstractGraphicsDevice, boolean, GLCapabilitiesImmutable, GLCapabilitiesChooser)}.
+ * <p>
+ * The <i>dummy</i> {@link GLAutoDrawable}'s {@link GLDrawable} is {@link GLDrawable#isRealized() realized}
+ * <i>without</i> an assigned {@link GLContext}, hence not initialized completely.<br>
+ * The {@link GLContext} can be assigned later manually via {@link GLAutoDrawable#setContext(GLContext, boolean) setContext(ctx)}
+ * <i>or</i> it will be created <i>lazily</i> at the 1st {@link GLAutoDrawable#display() display()} method call.<br>
+ * <i>Lazy</i> {@link GLContext} creation will take a shared {@link GLContext} into account
+ * which has been set {@link GLOffscreenAutoDrawable#setSharedContext(GLContext) directly}
+ * or {@link GLOffscreenAutoDrawable#setSharedAutoDrawable(GLAutoDrawable) via another GLAutoDrawable}.
+ * </p>
+ *
+ * @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)}
+ * 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
+ *
+ * @see #createDummyDrawable(AbstractGraphicsDevice, boolean, GLCapabilitiesImmutable, GLCapabilitiesChooser)
+ */
+ public abstract GLAutoDrawable createDummyAutoDrawable(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser);
+
+ /**
+ * Creates an {@link GLDrawable#isRealized() unrealized} offscreen {@link GLDrawable}
+ * incl it's offscreen {@link NativeSurface} with the given capabilites and dimensions.
* <p>
* In case the passed {@link GLCapabilitiesImmutable} contains default values, i.e.
* {@link GLCapabilitiesImmutable#isOnscreen() caps.isOnscreen()} <code> == true</code>,
@@ -523,21 +601,21 @@ public abstract class GLDrawableFactory {
* and {@link #canCreateGLPbuffer(AbstractGraphicsDevice, GLProfile) canCreateGLPbuffer(device)} is true.
* </p>
* <p>
- * If neither FBO nor Pbuffer is available,
+ * If neither FBO nor Pbuffer is available,
* a simple pixmap/bitmap drawable is created, which is unlikely to be hardware accelerated.
* </p>
*
- * @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 AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device.
* @param caps the requested GLCapabilties
* @param chooser the custom chooser, may be null for default
* @param width the requested offscreen width
* @param height the requested offscreen height
*
- * @return the created offscreen {@link GLDrawable}
+ * @return the created unrealized offscreen {@link GLDrawable}
*
* @throws GLException if any window system-specific errors caused
* the creation of the Offscreen to fail.
- *
+ *
* @see #createOffscreenAutoDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int, GLContext)
*/
public abstract GLDrawable createOffscreenDrawable(AbstractGraphicsDevice device,
@@ -546,44 +624,64 @@ public abstract class GLDrawableFactory {
int width, int height) throws GLException;
/**
- * Creates a proxy {@link NativeSurface} w/ defined surface handle, i.e. a {@link WrappedSurface} or {@link GDISurface} instance.
+ * Creates an {@link GLDrawable#isRealized() unrealized} dummy {@link GLDrawable}.
+ * A dummy drawable is not visible on screen and will not be used to render directly to, it maybe on- or offscreen.
+ * <p>
+ * It is used to allow the creation of a {@link GLContext} to query information.
+ * It also allows creation of framebuffer objects which are used for rendering or creating a shared GLContext w/o actually rendering to this dummy drawable's framebuffer.
+ * </p>
+ * @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}
+ * or {@link GLCapabilitiesImmutable caps}
+ * across shared drawables will yield best compatibility.
+ * @param chooser the custom chooser, may be null for default
+ * @return the created unrealized dummy {@link GLDrawable}
+ */
+ public abstract GLDrawable createDummyDrawable(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser);
+
+ /**
+ * Creates a proxy {@link NativeSurface} w/ defined surface handle,
+ * i.e. a {@link jogamp.nativewindow.WrappedSurface} or {@link jogamp.nativewindow.windows.GDISurface} instance.
* <p>
- * It's {@link AbstractGraphicsConfiguration} is properly set according to the given
+ * It's {@link AbstractGraphicsConfiguration} is properly set according to the given
* <code>windowHandle</code>'s native visualID if set or the given {@link GLCapabilitiesImmutable}.
* </p>
* <p>
* Lifecycle (creation and destruction) of the given surface handle shall be handled by the caller
- * via {@link ProxySurface#createNotify()} and {@link ProxySurface#destroyNotify()}.
+ * via {@link ProxySurface#createNotify()} and {@link ProxySurface#destroyNotify()}.
* </p>
* <p>
* Such surface can be used to instantiate a GLDrawable. With the help of {@link GLAutoDrawableDelegate}
- * you will be able to implement a new native windowing system binding almost on-the-fly, see {@link com.jogamp.opengl.swt.GLCanvas}.
+ * you will be able to implement a new native windowing system binding almost on-the-fly,
+ * see {@link com.jogamp.opengl.swt.GLCanvas}.
* </p>
- *
- * @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.
- * Caller has to ensure it is compatible w/ the given <code>windowHandle</code>
+ *
+ * @param device which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
+ * Caller has to ensure it is compatible w/ the given <code>windowHandle</code>
* @param screenIdx matching screen index of given <code>windowHandle</code>
* @param windowHandle the native window handle
* @param caps the requested GLCapabilties
* @param chooser the custom chooser, may be null for default
- * @param upstream optional {@link ProxySurface.UpstreamSurfaceHook} allowing control of the {@link ProxySurface}'s lifecycle and data it presents.
+ * @param upstream optional {@link UpstreamSurfaceHook} allowing control of the {@link ProxySurface}'s lifecycle and data it presents.
* @return the created {@link ProxySurface} instance w/ defined surface handle.
*/
public abstract ProxySurface createProxySurface(AbstractGraphicsDevice device,
- int screenIdx,
- long windowHandle,
+ int screenIdx,
+ long windowHandle,
GLCapabilitiesImmutable caps, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream);
/**
* Returns true if it is possible to create an <i>framebuffer object</i> (FBO).
* <p>
* FBO feature is implemented in OpenGL, hence it is {@link GLProfile} dependent.
- * </p>
+ * </p>
* <p>
* FBO support is queried as described in {@link GLContext#hasBasicFBOSupport()}.
* </p>
*
- * @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 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 check for FBO capabilities
* @see GLContext#hasBasicFBOSupport()
*/
@@ -591,12 +689,12 @@ public abstract class GLDrawableFactory {
/**
* Returns true if it is possible to create an <i>pbuffer surface</i>.
- * <p>
- * Some older graphics cards do not have this capability,
- * as well as some new GL implementation, i.e. OpenGL 3 core on OSX.
+ * <p>
+ * Some older graphics cards do not have this capability,
+ * as well as some new GL implementation, i.e. OpenGL 3 core on OSX.
* </p>
*
- * @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 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 check for FBO capabilities
*/
public abstract boolean canCreateGLPbuffer(AbstractGraphicsDevice device, GLProfile glp);
@@ -607,10 +705,10 @@ public abstract class GLDrawableFactory {
* The GLPbuffer drawable is realized and initialized eagerly.
* </p>
*
- * See the note in the overview documentation on
- * <a href="../../../overview-summary.html#SHARING">context sharing</a>.
+ * See the note in the overview documentation in {@link GLSharedContextSetter} and on
+ * <a href="../../../spec-overview.html#SHARING">context sharing</a>.
*
- * @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 AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
* @param capabilities the requested capabilities
* @param chooser the custom chooser, may be null for default
* @param initialWidth initial width of pbuffer
@@ -621,7 +719,7 @@ public abstract class GLDrawableFactory {
*
* @throws GLException if any window system-specific errors caused
* the creation of the GLPbuffer to fail.
- *
+ *
* @deprecated {@link GLPbuffer} is deprecated, use {@link #createOffscreenAutoDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int, GLContext)}
*/
public abstract GLPbuffer createGLPbuffer(AbstractGraphicsDevice device,
@@ -632,7 +730,7 @@ public abstract class GLDrawableFactory {
GLContext shareWith)
throws GLException;
-
+
//----------------------------------------------------------------------
// Methods for interacting with third-party OpenGL libraries
@@ -665,7 +763,7 @@ public abstract class GLDrawableFactory {
* Returns true if it is possible to create an external GLDrawable
* object via {@link #createExternalGLDrawable}.
*
- * @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 AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
*/
public abstract boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device);
diff --git a/src/jogl/classes/javax/media/opengl/GLEventListener.java b/src/jogl/classes/javax/media/opengl/GLEventListener.java
index 15fae4a..c8c3440 100644
--- a/src/jogl/classes/javax/media/opengl/GLEventListener.java
+++ b/src/jogl/classes/javax/media/opengl/GLEventListener.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -49,7 +49,7 @@ import java.util.EventListener;
public interface GLEventListener extends EventListener {
/** Called by the drawable immediately after the OpenGL context is
initialized. Can be used to perform one-time OpenGL
- initialization per GLContext, such as setup of lights and display lists.<p>
+ initialization per GLContext, such as setup of lights and display lists.<p>
Note that this method may be called more than once if the underlying
OpenGL context for the GLAutoDrawable is destroyed and
@@ -57,7 +57,7 @@ public interface GLEventListener extends EventListener {
hierarchy and later added again.
*/
public void init(GLAutoDrawable drawable);
-
+
/** Notifies the listener to perform the release of all OpenGL
resources per GLContext, such as memory buffers and GLSL programs.<P>
@@ -68,11 +68,11 @@ public interface GLEventListener extends EventListener {
Note that this event does not imply the end of life of the application.
It could be produced with a followup call to {@link #init(GLAutoDrawable)}
- in case the GLContext has been recreated,
+ in case the GLContext has been recreated,
e.g. due to a pixel configuration change in a multihead environment.
*/
public void dispose(GLAutoDrawable drawable);
-
+
/** Called by the drawable to initiate OpenGL rendering by the
client. After all GLEventListeners have been notified of a
display event, the drawable will swap its buffers if {@link
diff --git a/src/jogl/classes/javax/media/opengl/GLException.java b/src/jogl/classes/javax/media/opengl/GLException.java
index 644042e..460f17b 100644
--- a/src/jogl/classes/javax/media/opengl/GLException.java
+++ b/src/jogl/classes/javax/media/opengl/GLException.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java b/src/jogl/classes/javax/media/opengl/GLFBODrawable.java
index 4d6c7c2..052b08a 100644
--- a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLFBODrawable.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -33,17 +33,17 @@ import javax.media.nativewindow.NativeWindowException;
import com.jogamp.opengl.FBObject;
import com.jogamp.opengl.FBObject.TextureAttachment;
-/**
+/**
* Platform-independent {@link GLDrawable} specialization,
* exposing {@link FBObject} functionality.
*
* <p>
- * A {@link GLFBODrawable} is uninitialized until a {@link GLContext} is bound
+ * A {@link GLFBODrawable} is uninitialized until a {@link GLContext} is bound
* and made current the first time, hence only then it's capabilities <i>fully</i> reflect expectations,
* i.e. color, depth, stencil and MSAA bits will be <i>valid</i> only after the first {@link GLContext#makeCurrent() makeCurrent()} call.
* On-/offscreen bits are <i>valid</i> after {@link #setRealized(boolean) setRealized(true)}.
* </p>
- *
+ *
* <p>
* MSAA is used if {@link GLCapabilitiesImmutable#getNumSamples() requested}.
* </p>
@@ -51,7 +51,7 @@ import com.jogamp.opengl.FBObject.TextureAttachment;
* Double buffering is used if {@link GLCapabilitiesImmutable#getDoubleBuffered() requested}.
* </p>
* <p>
- * In MSAA mode, it always uses the implicit 2nd {@link FBObject framebuffer} {@link FBObject#getSamplingSinkFBO() sink}.
+ * In MSAA mode, it always uses the implicit 2nd {@link FBObject framebuffer} {@link FBObject#getSamplingSinkFBO() sink}.
* Hence double buffering is always the case w/ MSAA.
* </p>
* <p>
@@ -61,60 +61,60 @@ import com.jogamp.opengl.FBObject.TextureAttachment;
* This method also allows usage of both textures seperately.
* </p>
* <p>
- * It would be possible to implement double buffering simply using
- * {@link FBObject.TextureAttachment texture attachment}s with one {@link FBObject framebuffer}.
+ * It would be possible to implement double buffering simply using
+ * {@link TextureAttachment}s with one {@link FBObject framebuffer}.
* This would require mode selection and hence complicate the API. Besides, it would
* not support differentiation of read and write framebuffer and hence not be spec compliant.
* </p>
* <p>
- * Actual swapping of the {@link FBObject.TextureAttachment texture}s or {@link FBObject framebuffer}
- * is performed either in the {@link #contextMadeCurrent(boolean) context current hook}
- * or when {@link #swapBuffersImpl(boolean) swapping buffers}, whatever comes first.<br/>
+ * Actual swapping of the {@link TextureAttachment texture}s and/or {@link FBObject framebuffer}
+ * is performed either in the {@link jogamp.opengl.GLContextImpl#contextMadeCurrent(boolean) context current hook}
+ * or when {@link jogamp.opengl.GLDrawableImpl#swapBuffersImpl(boolean) swapping buffers}, whatever comes first.
* </p>
- */
+ */
public interface GLFBODrawable extends GLDrawable {
// public enum DoubleBufferMode { NONE, TEXTURE, FBO }; // TODO: Add or remove TEXTURE (only) DoubleBufferMode support
-
+
/**
* @return <code>true</code> if initialized, i.e. a {@link GLContext} is bound and made current once, otherwise <code>false</code>.
*/
public boolean isInitialized();
-
+
/**
* Notify this instance about upstream size change
* to reconfigure the {@link FBObject}.
- * @param gl GL context object bound to this drawable, will be made current during operation.
- * A prev. current context will be make current after operation.
+ * @param gl GL context object bound to this drawable, will be made current during operation.
+ * A prev. current context will be make current after operation.
* @throws GLException if resize operation failed
*/
void resetSize(GL gl) throws GLException;
-
+
/**
* @return the used texture unit
*/
int getTextureUnit();
-
+
/**
- *
+ *
* @param unit the texture unit to be used
*/
void setTextureUnit(int unit);
-
+
/**
* Set the number of sample buffers if using MSAA
- *
- * @param gl GL context object bound to this drawable, will be made current during operation.
- * A prev. current context will be make current after operation.
+ *
+ * @param gl GL context object bound to this drawable, will be made current during operation.
+ * A prev. current context will be make current after operation.
* @param newSamples new sample size
* @throws GLException if resetting the FBO failed
*/
void setNumSamples(GL gl, int newSamples) throws GLException;
-
+
/**
* @return the number of sample buffers if using MSAA, otherwise 0
*/
int getNumSamples();
-
+
/**
* Sets the number of buffers (FBO) being used if using {@link GLCapabilities#getDoubleBuffered() double buffering}.
* <p>
@@ -123,22 +123,22 @@ public interface GLFBODrawable extends GLDrawable {
* <p>
* Must be called before {@link #isInitialized() initialization}, otherwise an exception is thrown.
* </p>
- * @return the new number of buffers (FBO) used, maybe different than the requested <code>bufferCount</code> (see above)
+ * @return the new number of buffers (FBO) used, maybe different than the requested <code>bufferCount</code> (see above)
* @throws GLException if already initialized, see {@link #isInitialized()}.
*/
int setNumBuffers(int bufferCount) throws GLException;
-
- /**
+
+ /**
* @return the number of buffers (FBO) being used. 1 if not using {@link GLCapabilities#getDoubleBuffered() double buffering},
- * otherwise ≥ 2, depending on {@link #setNumBuffers(int)}.
+ * otherwise ≥ 2, depending on {@link #setNumBuffers(int)}.
*/
int getNumBuffers();
-
+
/**
- * @return the used {@link DoubleBufferMode}
+ * @return the used {@link DoubleBufferMode}
*/
// DoubleBufferMode getDoubleBufferMode(); // TODO: Add or remove TEXTURE (only) DoubleBufferMode support
-
+
/**
* Sets the {@link DoubleBufferMode}. Must be called before {@link #isInitialized() initialization},
* otherwise an exception is thrown.
@@ -153,11 +153,11 @@ public interface GLFBODrawable extends GLDrawable {
* @throws GLException if already initialized, see {@link #isInitialized()}.
*/
// void setDoubleBufferMode(DoubleBufferMode mode) throws GLException; // TODO: Add or remove TEXTURE (only) DoubleBufferMode support
-
+
/**
* If MSAA is being used and {@link GL#GL_FRONT} is requested,
- * the internal {@link FBObject} {@link FBObject#getSamplingSinkFBO() sample sink} is being returned.
- *
+ * the internal {@link FBObject} {@link FBObject#getSamplingSinkFBO() sample sink} is being returned.
+ *
* @param bufferName {@link GL#GL_FRONT} and {@link GL#GL_BACK} are valid buffer names
* @return the named {@link FBObject}
* @throws IllegalArgumentException if an illegal buffer name is being used
@@ -167,7 +167,7 @@ public interface GLFBODrawable extends GLDrawable {
/**
* Returns the named texture buffer.
* <p>
- * If MSAA is being used, only the {@link GL#GL_FRONT} buffer is accessible
+ * If MSAA is being used, only the {@link GL#GL_FRONT} buffer is accessible
* and an exception is being thrown if {@link GL#GL_BACK} is being requested.
* </p>
* @param bufferName {@link GL#GL_FRONT} and {@link GL#GL_BACK} are valid buffer names
@@ -176,20 +176,20 @@ public interface GLFBODrawable extends GLDrawable {
*/
FBObject.TextureAttachment getTextureBuffer(int bufferName) throws IllegalArgumentException;
- /** Resizeable {@link GLFBODrawable} specialization */
+ /** Resizeable {@link GLFBODrawable} specialization */
public interface Resizeable extends GLFBODrawable {
/**
* Resize this drawable.
* <p>
* This drawable is being locked during operation.
* </p>
- * @param context the {@link GLContext} bound to this drawable, will be made current during operation
- * A prev. current context will be make current after operation.
+ * @param context the {@link GLContext} bound to this drawable, will be made current during operation
+ * A prev. current context will be make current after operation.
* @param newWidth
* @param newHeight
* @throws NativeWindowException in case the surface could no be locked
* @throws GLException in case an error during the resize operation occurred
*/
- void setSize(GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException;
+ void setSize(GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException;
}
}
diff --git a/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java
index 6fe76a3..d34edaf 100644
--- a/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -32,7 +32,7 @@ import javax.media.nativewindow.NativeWindowException;
import com.jogamp.opengl.FBObject;
-/**
+/**
* Platform-independent {@link GLAutoDrawable} specialization,
* exposing offscreen functionality.
* <p>
@@ -40,8 +40,8 @@ import com.jogamp.opengl.FBObject;
* with it's {@link #setSize(int, int)} functionality.
* </p>
*/
-public interface GLOffscreenAutoDrawable extends GLAutoDrawable {
-
+public interface GLOffscreenAutoDrawable extends GLAutoDrawable, GLSharedContextSetter {
+
/**
* Resize this auto drawable.
* @param newWidth
@@ -56,8 +56,8 @@ public interface GLOffscreenAutoDrawable extends GLAutoDrawable {
* @see #getUpstreamWidget()
*/
void setUpstreamWidget(Object newUpstreamWidget);
-
- /** {@link FBObject} based {@link GLOffscreenAutoDrawable} specialization */
- public interface FBO extends GLOffscreenAutoDrawable, GLFBODrawable {
- }
+
+ /** {@link FBObject} based {@link GLOffscreenAutoDrawable} specialization */
+ public interface FBO extends GLOffscreenAutoDrawable, GLFBODrawable {
+ }
}
diff --git a/src/jogl/classes/javax/media/opengl/GLPbuffer.java b/src/jogl/classes/javax/media/opengl/GLPbuffer.java
index 12f57fc..f36a4bf 100644
--- a/src/jogl/classes/javax/media/opengl/GLPbuffer.java
+++ b/src/jogl/classes/javax/media/opengl/GLPbuffer.java
@@ -46,8 +46,8 @@ package javax.media.opengl;
as a texture map and enabling rendering to floating-point frame
buffers. These methods are not guaranteed to be supported on all
platforms and may be deprecated in a future release.
-
- @deprecated Use {@link GLOffscreenAutoDrawable} w/ {@link GLCapabilities#setFBO(boolean)}
+
+ @deprecated Use {@link GLOffscreenAutoDrawable} w/ {@link GLCapabilities#setFBO(boolean)}
via {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int, GLContext) GLDrawableFactory.createOffscreenAutoDrawable(..)}.
*/
public interface GLPbuffer extends GLAutoDrawable {
diff --git a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java
index c6bf262..d947bad 100644
--- a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,7 +28,7 @@
* 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.
@@ -49,7 +49,7 @@ import jogamp.opengl.*;
public class GLPipelineFactory {
public static final boolean DEBUG = Debug.debug("GLPipelineFactory");
- /**
+ /**
* Creates a pipelined GL instance using the given downstream <code>downstream</code>
* and optional arguments <code>additionalArgs</code> for the constructor.
*
@@ -66,7 +66,7 @@ public class GLPipelineFactory {
* gl = drawable.setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) );
* </pre>
* </p>
- *
+ *
* <p>
* The upstream GL instance is determined as follows:
* <ul>
@@ -76,7 +76,7 @@ public class GLPipelineFactory {
* <li> For all <code>downstream</code> class and superclass interfaces, do:</li>
* <ul>
* <li> If <code>reqInterface</code> is not null and the interface is unequal, continue loop.</li>
- * <li> If <code>downstream</code> is not instance of interface, continue loop.</li>
+ * <li> If <code>downstream</code> is not instance of interface, continue loop.</li>
* <li> If upstream class is available use it, end loop.</li>
* </ul>
* </ul>
@@ -116,7 +116,7 @@ public class GLPipelineFactory {
if(DEBUG) {
System.out.println("GLPipelineFactory: "+downstream.getClass().getName() + " is _not_ instance of "+ clazzes[i].getName());
}
- continue; // not a compatible one
+ continue; // not a compatible one
} else {
if(DEBUG) {
System.out.println("GLPipelineFactory: "+downstream.getClass().getName() + " _is_ instance of "+ clazzes[i].getName());
@@ -153,7 +153,7 @@ public class GLPipelineFactory {
// throws exception if cstr not found!
Constructor<?> cstr = ReflectionUtil.getConstructor(upstreamClazz, cstrArgTypes);
Object instance = null;
- try {
+ try {
Object[] cstrArgs = new Object[ 1 + ( ( null==additionalArgs ) ? 0 : additionalArgs.length ) ] ;
{
int i = 0;
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index 51b8224..c049711 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,7 +29,7 @@
* 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.
@@ -61,53 +61,53 @@ import javax.media.opengl.fixedfunc.GLPointerFunc;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
+import java.util.Map;
/**
* Specifies the the OpenGL profile.
- *
+ *
* This class static singleton initialization queries the availability of all OpenGL Profiles
* and instantiates singleton GLProfile objects for each available profile.
*
- * The platform default profile may be used, using {@link GLProfile#GetProfileDefault()},
+ * The platform default profile may be used, using {@link GLProfile#GetProfileDefault()},
* or more specialized versions using the other static GetProfile methods.
*/
public class GLProfile {
-
+
public static final boolean DEBUG = Debug.debug("GLProfile");
-
+
static {
// Also initializes TempJarCache if shall be used.
Platform.initSingleton();
}
-
+
/**
* Static initialization of JOGL.
*
* <p>
* This method shall not need to be called for other reasons than having a defined initialization sequence.
* </p>
- *
+ *
* <P>
* In case this method is not invoked, GLProfile is initialized implicit by
* the first call to {@link #getDefault()}, {@link #get(java.lang.String)}.
* <P>
- *
+ *
* <p>
- * To initialize JOGL at startup ASAP, this method may be invoked in the <i>main class</i>'s
+ * To initialize JOGL at startup ASAP, this method may be invoked in the <i>main class</i>'s
* static initializer block, in the <i>static main() method</i> or in the <i>Applet init() method</i>.
* </p>
- *
+ *
* <p>
* Since JOGL's initialization is complex and involves multi threading, it is <b>not</b> recommended
- * to be have it invoked on the AWT EDT thread. In case all JOGL usage is performed
+ * to be have it invoked on the AWT EDT thread. In case all JOGL usage is performed
* on the AWT EDT, invoke this method outside the AWT EDT - see above.
* </p>
- *
+ *
*/
public static void initSingleton() {
- final boolean justInitialized;
+ final boolean justInitialized;
initLock.lock();
try {
if(!initialized) { // volatile: ok
@@ -117,42 +117,40 @@ public class GLProfile {
System.err.println("GLProfile.initSingleton() - thread "+Thread.currentThread().getName());
Thread.dumpStack();
}
-
+
// run the whole static initialization privileged to speed up,
// since this skips checking further access
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
Platform.initSingleton();
-
+
// Performance hack to trigger classloading of the GL classes impl, which makes up to 12%, 800ms down to 700ms
new Thread(new Runnable() {
+ @Override
public void run() {
final ClassLoader cl = GLProfile.class.getClassLoader();
try {
ReflectionUtil.createInstance(getGLImplBaseClassName(GL4bc)+"Impl", new Class[] { GLProfile.class, GLContextImpl.class }, new Object[] { null, null }, cl);
} catch (Throwable t) {}
try {
- ReflectionUtil.createInstance(getGLImplBaseClassName(GLES3)+"Impl", new Class[] { GLProfile.class, GLContextImpl.class }, new Object[] { null, null }, cl);
+ ReflectionUtil.createInstance(getGLImplBaseClassName(GLES3)+"Impl", new Class[] { GLProfile.class, GLContextImpl.class }, new Object[] { null, null }, cl);
} catch (Throwable t) {}
try {
- ReflectionUtil.createInstance(getGLImplBaseClassName(GLES1)+"Impl", new Class[] { GLProfile.class, GLContextImpl.class }, new Object[] { null, null }, cl);
+ ReflectionUtil.createInstance(getGLImplBaseClassName(GLES1)+"Impl", new Class[] { GLProfile.class, GLContextImpl.class }, new Object[] { null, null }, cl);
} catch (Throwable t) {}
}
- }, "GLProfile-GL_Bootstrapping").start();
+ }, "GLProfile-GL_Bootstrapping").start();
+
-
if(TempJarCache.isInitialized()) {
final ClassLoader cl = GLProfile.class.getClassLoader();
- // either: [jogl-all.jar, jogl-all-noawt.jar, jogl-all-mobile.jar] -> jogl-all-natives-<os.and.arch>.jar
- // or: nativewindow-core.jar -> nativewindow-natives-<os.and.arch>.jar,
- // jogl-core.jar -> jogl-natives-<os.and.arch>.jar,
- // (newt-core.jar -> newt-natives-<os.and.arch>.jar)? (if available)
final String newtFactoryClassName = "com.jogamp.newt.NewtFactory";
final Class<?>[] classesFromJavaJars = new Class<?>[] { NWJNILibLoader.class, GLProfile.class, null };
if( ReflectionUtil.isClassAvailable(newtFactoryClassName, cl) ) {
classesFromJavaJars[2] = ReflectionUtil.getClass(newtFactoryClassName, false, cl);
}
- JNILibLoaderBase.addNativeJarLibs(classesFromJavaJars, "-all", new String[] { "-noawt", "-mobile", "-core" } );
+ JNILibLoaderBase.addNativeJarLibsJoglCfg(classesFromJavaJars);
}
initProfilesForDefaultDevices();
return null;
@@ -168,13 +166,13 @@ public class GLProfile {
if( justInitialized && ( hasGL234Impl || hasGLES1Impl || hasGLES3Impl ) ) {
System.err.println(JoglVersion.getDefaultOpenGLInfo(defaultDevice, null, true));
}
- }
+ }
}
-
+
/**
* Trigger eager initialization of GLProfiles for the given device,
* in case it isn't done yet.
- *
+ *
* @throws GLException if no profile for the given device is available.
*/
public static void initProfiles(AbstractGraphicsDevice device) throws GLException {
@@ -198,7 +196,7 @@ public class GLProfile {
if(DEBUG) {
System.err.println("GLProfile.shutdown() - thread "+Thread.currentThread().getName());
Thread.dumpStack();
- }
+ }
GLDrawableFactory.shutdown();
}
} finally {
@@ -210,11 +208,11 @@ public class GLProfile {
// Query platform available OpenGL implementation
//
- /**
+ /**
* Returns the availability of a profile on a device.
- *
+ *
* @param device a valid AbstractGraphicsDevice, or <code>null</null> for the default device.
- * @param profile a valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..),
+ * @param profile a valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..),
* or <code>[ null, GL ]</code> for the default profile.
* @return true if the profile is available for the device, otherwise false.
*/
@@ -225,31 +223,31 @@ public class GLProfile {
private static boolean isAvailableImpl(HashMap<String /*GLProfile_name*/, GLProfile> map, String profile) {
return null != map && null != map.get(profile);
}
-
- /**
+
+ /**
* Returns the availability of a profile on the default device.
- *
- * @param profile a valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..),
+ *
+ * @param profile a valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..),
* or <code>[ null, GL ]</code> for the default profile.
* @return true if the profile is available for the default device, otherwise false.
*/
public static boolean isAvailable(String profile) {
return isAvailable(null, profile);
}
-
- /**
+
+ /**
* Returns the availability of any profile on the default device.
- *
+ *
* @return true if any profile is available for the default device, otherwise false.
*/
public static boolean isAnyAvailable() {
return isAvailable(null, null);
}
-
+
public static String glAvailabilityToString(AbstractGraphicsDevice device) {
return glAvailabilityToString(device, null).toString();
}
-
+
public static StringBuilder glAvailabilityToString(AbstractGraphicsDevice device, StringBuilder sb) {
return glAvailabilityToString(device, sb, null, 0);
}
@@ -268,139 +266,183 @@ public class GLProfile {
final boolean useIndent = null != indent;
initSingleton();
-
+
+ int allCount = 0;
+ int nativeCount = 0;
+
if(null==device) {
device = defaultDevice;
}
final HashMap<String /*GLProfile_name*/, GLProfile> map = getProfileMap(device, false);
-
+
if(useIndent) {
- doIndent(sb, indent, indentCount).append("Native");
+ doIndent(sb, indent, indentCount).append("Natives");
indentCount++;
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GL4bc").append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL4bc).append(indent);
} else {
- sb.append("Native[GL4bc ");
- }
+ sb.append("Natives["+GL4bc+" ");
+ }
avail=isAvailableImpl(map, GL4bc);
sb.append(avail);
if(avail) {
+ nativeCount++;
glAvailabilityToString(device, sb.append(" "), 4, GLContext.CTX_PROFILE_COMPAT);
}
+ allCount++;
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GL4").append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL4).append(indent);
} else {
- sb.append(", GL4 ");
+ sb.append(", "+GL4+" ");
}
avail=isAvailableImpl(map, GL4);
sb.append(avail);
if(avail) {
+ nativeCount++;
glAvailabilityToString(device, sb.append(" "), 4, GLContext.CTX_PROFILE_CORE);
}
+ allCount++;
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GLES3").append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GLES3).append(indent);
} else {
- sb.append(", GLES3 ");
+ sb.append(", "+GLES3+" ");
}
avail=isAvailableImpl(map, GLES3);
sb.append(avail);
if(avail) {
+ nativeCount++;
glAvailabilityToString(device, sb.append(" "), 3, GLContext.CTX_PROFILE_ES);
}
+ allCount++;
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GL3bc").append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL3bc).append(indent);
} else {
- sb.append(", GL3bc ");
+ sb.append(", "+GL3bc+" ");
}
avail=isAvailableImpl(map, GL3bc);
sb.append(avail);
if(avail) {
+ nativeCount++;
glAvailabilityToString(device, sb.append(" "), 3, GLContext.CTX_PROFILE_COMPAT);
}
+ allCount++;
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GL3").append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL3).append(indent);
} else {
- sb.append(", GL3 ");
+ sb.append(", "+GL3+" ");
}
avail=isAvailableImpl(map, GL3);
sb.append(avail);
if(avail) {
+ nativeCount++;
glAvailabilityToString(device, sb.append(" "), 3, GLContext.CTX_PROFILE_CORE);
}
+ allCount++;
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GL2").append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL2).append(indent);
} else {
- sb.append(", GL2 ");
+ sb.append(", "+GL2+" ");
}
avail=isAvailableImpl(map, GL2);
sb.append(avail);
if(avail) {
+ nativeCount++;
glAvailabilityToString(device, sb.append(" "), 2, GLContext.CTX_PROFILE_COMPAT);
}
+ allCount++;
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GLES2").append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GLES2).append(indent);
} else {
- sb.append(", GLES2 ");
+ sb.append(", "+GLES2+" ");
}
avail=isAvailableImpl(map, GLES2);
sb.append(avail);
if(avail) {
+ nativeCount++;
glAvailabilityToString(device, sb.append(" "), 2, GLContext.CTX_PROFILE_ES);
}
+ allCount++;
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GLES1").append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GLES1).append(indent);
} else {
- sb.append(", GLES1 ");
+ sb.append(", "+GLES1+" ");
}
avail=isAvailableImpl(map, GLES1);
sb.append(avail);
if(avail) {
+ nativeCount++;
glAvailabilityToString(device, sb.append(" "), 1, GLContext.CTX_PROFILE_ES);
}
+ allCount++;
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GL4ES3").append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("Count\t"+nativeCount+" / "+allCount);
+ indentCount--;
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("Common");
+ indentCount++;
} else {
- sb.append(", GL4ES3 ");
+ sb.append(", count "+nativeCount+" / "+allCount+"], Common[");
+ }
+
+ if(useIndent) {
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL4ES3).append(indent);
+ } else {
+ sb.append(", "+GL4ES3+" ");
}
sb.append(isAvailableImpl(map, GL4ES3));
-
+ allCount++;
+
+ if(useIndent) {
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL2GL3).append(indent);
+ } else {
+ sb.append(", "+GL2GL3+" ");
+ }
+ sb.append(isAvailableImpl(map, GL2GL3));
+ allCount++;
+
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GL2ES2").append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL2ES2).append(indent);
} else {
- sb.append(", GL2ES2 ");
+ sb.append(", "+GL2ES2+" ");
}
sb.append(isAvailableImpl(map, GL2ES2));
+ allCount++;
if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("GL2ES1").append(indent);
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append(GL2ES1).append(indent);
} else {
- sb.append(", GL2ES1 ");
+ sb.append(", "+GL2ES1+" ");
}
sb.append(isAvailableImpl(map, GL2ES1));
+ allCount++;
if(useIndent) {
indentCount--;
- doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("Profiles");
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("Mappings");
indentCount++;
} else {
- sb.append("], Profiles[");
+ sb.append("], Mappings[");
}
-
+
+ int profileCount = 0;
+
if(null != map) {
- for(Iterator<GLProfile> i=map.values().iterator(); i.hasNext(); ) {
- if(useIndent) {
- doIndent(sb.append(Platform.getNewline()), indent, indentCount);
- }
- sb.append(i.next().toString());
- if(!useIndent) {
- sb.append(", ");
+ for (Map.Entry<String,GLProfile> entry : map.entrySet()) {
+ if( !GL_DEFAULT.equals(entry.getKey()) ) {
+ if(useIndent) {
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount);
+ }
+ sb.append(entry.getKey()+(useIndent?"\t":" ")+entry.getValue());
+ if(!useIndent) {
+ sb.append(", ");
+ }
+ profileCount++;
}
}
if(useIndent) {
@@ -415,14 +457,15 @@ public class GLProfile {
}
}
if(useIndent) {
+ doIndent(sb.append(Platform.getNewline()), indent, indentCount).append("Count\t"+profileCount+" / "+allCount);
sb.append(Platform.getNewline());
} else {
- sb.append("]");
+ sb.append(", count "+profileCount+" / "+allCount+"]");
}
return sb;
}
-
+
/** Uses the default device */
public static String glAvailabilityToString() {
return glAvailabilityToString(null);
@@ -469,11 +512,11 @@ public class GLProfile {
/** The intersection of the desktop GL4 and ES3 profile */
public static final String GL4ES3 = "GL4ES3";
-
+
/** The default profile, used for the device default profile map */
private static final String GL_DEFAULT = "GL_DEFAULT";
- /**
+ /**
* All GL Profiles in the order of default detection.
* Desktop compatibility profiles (the one with fixed function pipeline) comes first
* from highest to lowest version.
@@ -496,7 +539,7 @@ public class GLProfile {
*
*/
public static final String[] GL_PROFILE_LIST_ALL = new String[] { GL4bc, GL3bc, GL2, GL4, GL3, GLES3, GL4ES3, GL2GL3, GLES2, GL2ES2, GLES1, GL2ES1 };
-
+
/**
* Order of maximum profiles.
*
@@ -530,7 +573,7 @@ public class GLProfile {
*
*/
public static final String[] GL_PROFILE_LIST_MIN = new String[] { GLES1, GLES2, GL2, GLES3, GL3, GL3bc, GL4, GL4bc };
-
+
/**
* Order of minimum original desktop profiles.
*
@@ -544,7 +587,7 @@ public class GLProfile {
*
*/
public static final String[] GL_PROFILE_LIST_MIN_DESKTOP = new String[] { GL2, GL3bc, GL4bc, GL3, GL4 };
-
+
/**
* Order of maximum fixed function profiles
*
@@ -586,7 +629,7 @@ public class GLProfile {
*
*/
public static final String[] GL_PROFILE_LIST_MAX_PROGSHADER_CORE = new String[] { GL4, GL3, GLES3, GLES2 };
-
+
/** Returns a default GLProfile object, reflecting the best for the running platform.
* It selects the first of the set {@link GLProfile#GL_PROFILE_LIST_ALL}
* and favors hardware acceleration.
@@ -601,7 +644,7 @@ public class GLProfile {
/** Returns a default GLProfile object, reflecting the best for the running platform.
* It selects the first of the set {@link GLProfile#GL_PROFILE_LIST_ALL}
* and favors hardware acceleration.
- * <p>Uses the default device.</p>
+ * <p>Uses the default device.</p>
* @throws GLException if no profile is available for the default device.
*/
public static GLProfile getDefault() {
@@ -621,7 +664,7 @@ public class GLProfile {
return get(device, GL_PROFILE_LIST_MAX, favorHardwareRasterizer);
}
- /** Uses the default device
+ /** Uses the default device
* @throws GLException if no profile is available for the default device.
* @see #GL_PROFILE_LIST_MAX
*/
@@ -644,7 +687,7 @@ public class GLProfile {
return get(device, GL_PROFILE_LIST_MIN, favorHardwareRasterizer);
}
- /** Uses the default device
+ /** Uses the default device
* @throws GLException if no desktop profile is available for the default device.
* @see #GL_PROFILE_LIST_MIN
*/
@@ -668,7 +711,7 @@ public class GLProfile {
return get(device, GL_PROFILE_LIST_MAX_FIXEDFUNC, favorHardwareRasterizer);
}
- /** Uses the default device
+ /** Uses the default device
* @throws GLException if no fixed function profile is available for the default device.
* @see #GL_PROFILE_LIST_MAX_FIXEDFUNC
*/
@@ -691,7 +734,7 @@ public class GLProfile {
return get(device, GL_PROFILE_LIST_MAX_PROGSHADER, favorHardwareRasterizer);
}
- /** Uses the default device
+ /** Uses the default device
* @throws GLException if no programmable profile is available for the default device.
* @see #GL_PROFILE_LIST_MAX_PROGSHADER
*/
@@ -710,11 +753,11 @@ public class GLProfile {
*/
public static GLProfile getMaxProgrammableCore(AbstractGraphicsDevice device, boolean favorHardwareRasterizer)
throws GLException
- {
+ {
return get(device, GL_PROFILE_LIST_MAX_PROGSHADER_CORE, favorHardwareRasterizer);
}
- /** Uses the default device
+ /** Uses the default device
* @throws GLException if no programmable core profile is available for the default device.
* @see #GL_PROFILE_LIST_MAX_PROGSHADER_CORE
*/
@@ -723,8 +766,8 @@ public class GLProfile {
{
return get(GL_PROFILE_LIST_MAX_PROGSHADER_CORE, favorHardwareRasterizer);
}
-
- /**
+
+ /**
* Returns the GL2ES1 profile implementation, hence compatible w/ GL2ES1.<br/>
* It returns:
* <pre>
@@ -743,8 +786,8 @@ public class GLProfile {
return get(device, GL2ES1).getImpl();
}
- /**
- * Calls {@link #getGL2ES1(AbstractGraphicsDevice)} using the default device.
+ /**
+ * Calls {@link #getGL2ES1(AbstractGraphicsDevice)} using the default device.
* <p>Selection favors hardware rasterizer.</p>
* @see #getGL2ES1(AbstractGraphicsDevice)
*/
@@ -754,7 +797,7 @@ public class GLProfile {
return get(defaultDevice, GL2ES1).getImpl();
}
- /**
+ /**
* Returns the GL2ES2 profile implementation, hence compatible w/ GL2ES2.<br/>
* It returns:
* <pre>
@@ -773,8 +816,8 @@ public class GLProfile {
return get(device, GL2ES2).getImpl();
}
- /**
- * Calls {@link #getGL2ES2(AbstractGraphicsDevice)} using the default device.
+ /**
+ * Calls {@link #getGL2ES2(AbstractGraphicsDevice)} using the default device.
* <p>Selection favors hardware rasterizer.</p>
* @see #getGL2ES2(AbstractGraphicsDevice)
*/
@@ -784,7 +827,7 @@ public class GLProfile {
return get(defaultDevice, GL2ES2).getImpl();
}
- /**
+ /**
* Returns the GL4ES3 profile implementation, hence compatible w/ GL4ES3.<br/>
* It returns:
* <pre>
@@ -803,8 +846,8 @@ public class GLProfile {
return get(device, GL4ES3).getImpl();
}
- /**
- * Calls {@link #getGL4ES3(AbstractGraphicsDevice)} using the default device.
+ /**
+ * Calls {@link #getGL4ES3(AbstractGraphicsDevice)} using the default device.
* <p>Selection favors hardware rasterizer.</p>
* @see #getGL4ES3(AbstractGraphicsDevice)
*/
@@ -814,7 +857,7 @@ public class GLProfile {
return get(defaultDevice, GL4ES3).getImpl();
}
- /**
+ /**
* Returns the GL2GL3 profile implementation, hence compatible w/ GL2GL3.<br/>
* It returns:
* <pre>
@@ -833,8 +876,8 @@ public class GLProfile {
return get(device, GL2GL3).getImpl();
}
- /**
- * Calls {@link #getGL2GL3(AbstractGraphicsDevice)} using the default device.
+ /**
+ * Calls {@link #getGL2GL3(AbstractGraphicsDevice)} using the default device.
* <p>Selection favors hardware rasterizer.</p>
* @see #getGL2GL3(AbstractGraphicsDevice)
*/
@@ -850,7 +893,7 @@ public class GLProfile {
* the default profile.
*
* @param device a valid AbstractGraphicsDevice, or <code>null</null> for the default device.
- * @param profile a valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..),
+ * @param profile a valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..),
* or <code>[ null, GL ]</code> for the default profile.
* @throws GLException if the requested profile is not available for the device.
*/
@@ -868,8 +911,8 @@ public class GLProfile {
return glp;
}
- /** Uses the default device
- * @param profile a valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..),
+ /** Uses the default device
+ * @param profile a valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..),
* or <code>[ null, GL ]</code> for the default profile.
* @throws GLException if the requested profile is not available for the default device.
*/
@@ -885,14 +928,14 @@ public class GLProfile {
*
* @param device a valid AbstractGraphicsDevice, or <code>null</null> for the default device.
* @param profiles array of valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..)
- * @param favorHardwareRasterizer set to true, if hardware rasterizer shall be favored, otherwise false.
+ * @param favorHardwareRasterizer set to true, if hardware rasterizer shall be favored, otherwise false.
* @throws GLException if the non of the requested profiles is available for the device.
*/
public static GLProfile get(AbstractGraphicsDevice device, String[] profiles, boolean favorHardwareRasterizer)
throws GLException
{
GLProfile glProfileAny = null;
-
+
HashMap<String /*GLProfile_name*/, GLProfile> map = getProfileMap(device, true);
for(int i=0; i<profiles.length; i++) {
final GLProfile glProfile = map.get(profiles[i]);
@@ -905,18 +948,18 @@ public class GLProfile {
}
if(null==glProfileAny) {
glProfileAny = glProfile;
- }
+ }
}
}
if(null!=glProfileAny) {
return glProfileAny;
- }
+ }
throw new GLException("Profiles "+array2String(profiles)+" not available on device "+device);
}
- /** Uses the default device
- * @param profiles array of valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..)
- * @param favorHardwareRasterizer set to true, if hardware rasterizer shall be favored, otherwise false.
+ /** Uses the default device
+ * @param profiles array of valid GLProfile name ({@link #GL4bc}, {@link #GL4}, {@link #GL2}, ..)
+ * @param favorHardwareRasterizer set to true, if hardware rasterizer shall be favored, otherwise false.
* @throws GLException if the non of the requested profiles is available for the default device.
*/
public static GLProfile get(String[] profiles, boolean favorHardwareRasterizer)
@@ -924,28 +967,28 @@ public class GLProfile {
{
return get(defaultDevice, profiles, favorHardwareRasterizer);
}
-
- /** Indicates whether the native OpenGL ES1 profile is in use.
+
+ /** Indicates whether the native OpenGL ES1 profile is in use.
* This requires an EGL interface.
*/
public static boolean usesNativeGLES1(String profileImpl) {
return GLES1.equals(profileImpl);
}
- /** Indicates whether the native OpenGL ES3 or ES2 profile is in use.
+ /** Indicates whether the native OpenGL ES3 or ES2 profile is in use.
* This requires an EGL, ES3 or ES2 compatible interface.
*/
public static boolean usesNativeGLES2(String profileImpl) {
return GLES3.equals(profileImpl) || GLES2.equals(profileImpl);
}
- /** Indicates whether the native OpenGL ES2 profile is in use.
+ /** Indicates whether the native OpenGL ES2 profile is in use.
* This requires an EGL, ES3 compatible interface.
*/
public static boolean usesNativeGLES3(String profileImpl) {
return GLES3.equals(profileImpl);
}
-
+
/** Indicates whether either of the native OpenGL ES profiles are in use. */
public static boolean usesNativeGLES(String profileImpl) {
return usesNativeGLES2(profileImpl) || usesNativeGLES1(profileImpl);
@@ -1018,12 +1061,13 @@ public class GLProfile {
throw new GLException("unsupported profile \"" + profileImpl + "\"");
}
}
-
+
/**
* @param o GLProfile object to compare with
* @return true if given Object is a GLProfile and
* if both, profile and profileImpl is equal with this.
*/
+ @Override
public final boolean equals(Object o) {
if(this==o) { return true; }
if(o instanceof GLProfile) {
@@ -1033,13 +1077,14 @@ public class GLProfile {
return false;
}
+ @Override
public int hashCode() {
int hash = 5;
hash = 97 * hash + getImplName().hashCode();
hash = 97 * hash + getName().hashCode();
return hash;
}
-
+
/**
* @param glp GLProfile to compare with
* @throws GLException if given GLProfile and this aren't equal
@@ -1059,14 +1104,14 @@ public class GLProfile {
public final GLProfile getImpl() {
return null != profileImpl ? profileImpl : this;
}
-
+
/** return true if impl. is a hardware rasterizer, otherwise false. */
public final boolean isHardwareRasterizer() {
return isHardwareRasterizer;
}
-
- /**
- * return this profiles implementation name, eg. GL2ES2 -> GL2, or GL3 -> GL3
+
+ /**
+ * return this profiles implementation name, eg. GL2ES2 -> GL2, or GL3 -> GL3
*/
public final String getImplName() {
return null != profileImpl ? profileImpl.getName() : getName();
@@ -1102,16 +1147,16 @@ public class GLProfile {
return GLES1 == profile;
}
- /** Indicates whether this profile is capable of GLES2. <p>Includes [ GLES3, GLES2 ].</p> */
+ /** Indicates whether this profile is capable of GLES2. <p>Includes [ GLES2 ].</p> */
public final boolean isGLES2() {
- return GLES3 == profile || GLES2 == profile;
+ return GLES2 == profile;
}
-
+
/** Indicates whether this profile is capable of GLES3. <p>Includes [ GLES3 ].</p> */
public final boolean isGLES3() {
return GLES3 == profile;
}
-
+
/** Indicates whether this profile is capable of GLES. <p>Includes [ GLES3, GLES1, GLES2 ].</p> */
public final boolean isGLES() {
return GLES3 == profile || GLES2 == profile || GLES1 == profile;
@@ -1126,12 +1171,21 @@ public class GLProfile {
public final boolean isGL2GL3() {
return GL2GL3 == profile || isGL3() || isGL2();
}
-
+
/** Indicates whether this profile is capable of GL2ES2. <p>Includes [ GL4bc, GL4, GL3bc, GL3, GLES3, GL2, GL2GL3, GL2ES2, GLES2 ].</p> */
public final boolean isGL2ES2() {
return GL2ES2 == profile || isGLES2() || isGL2GL3();
}
+ /**
+ * Indicates whether this profile is capable of GL2ES3. <p>Includes [ GL4bc, GL4, GL3bc, GL3, GLES3, GL3ES3, GL2, GL2GL3 ].</p>
+ * @see #isGL3ES3()
+ * @see #isGL2GL3()
+ */
+ public final boolean isGL2ES3() {
+ return isGL3ES3() || isGL2GL3();
+ }
+
/** Indicates whether this profile is capable of GL3ES3. <p>Includes [ GL4bc, GL4, GL3bc, GL3, GLES3 ].</p> */
public final boolean isGL3ES3() {
return isGL4ES3() || isGL3();
@@ -1167,7 +1221,7 @@ public class GLProfile {
return usesNativeGLES2() || usesNativeGLES1();
}
- /**
+ /**
* General validation if type is a valid GL data type
* for the current profile
*/
@@ -1195,14 +1249,14 @@ public class GLProfile {
if( isGL2() ) {
return true;
}
- }
+ }
if(throwException) {
throw new GLException("Illegal data type on profile "+this+": "+type);
}
return false;
}
-
- public boolean isValidArrayDataType(int index, int comps, int type,
+
+ public boolean isValidArrayDataType(int index, int comps, int type,
boolean isVertexAttribPointer, boolean throwException) {
final String arrayName = getGLArrayName(index);
if( isGLES1() ) {
@@ -1221,7 +1275,7 @@ public class GLProfile {
case GL.GL_FIXED:
case GL.GL_FLOAT:
break;
- default:
+ default:
if(throwException) {
throw new GLException("Illegal data type for "+arrayName+" on profile GLES1: "+type);
}
@@ -1233,7 +1287,7 @@ public class GLProfile {
case 3:
case 4:
break;
- default:
+ default:
if(throwException) {
throw new GLException("Illegal component number for "+arrayName+" on profile GLES1: "+comps);
}
@@ -1247,7 +1301,7 @@ public class GLProfile {
case GL.GL_FIXED:
case GL.GL_FLOAT:
break;
- default:
+ default:
if(throwException) {
throw new GLException("Illegal data type for "+arrayName+" on profile GLES1: "+type);
}
@@ -1257,7 +1311,7 @@ public class GLProfile {
case 0:
case 3:
break;
- default:
+ default:
if(throwException) {
throw new GLException("Illegal component number for "+arrayName+" on profile GLES1: "+comps);
}
@@ -1270,7 +1324,7 @@ public class GLProfile {
case GL.GL_FIXED:
case GL.GL_FLOAT:
break;
- default:
+ default:
if(throwException) {
throw new GLException("Illegal data type for "+arrayName+" on profile GLES1: "+type);
}
@@ -1280,7 +1334,7 @@ public class GLProfile {
case 0:
case 4:
break;
- default:
+ default:
if(throwException) {
throw new GLException("Illegal component number for "+arrayName+" on profile GLES1: "+comps);
}
@@ -1298,7 +1352,7 @@ public class GLProfile {
case GL.GL_FLOAT:
case GL.GL_FIXED:
break;
- default:
+ default:
if(throwException) {
throw new GLException("Illegal data type for "+arrayName+" on profile GLES2: "+type);
}
@@ -1312,7 +1366,7 @@ public class GLProfile {
case 3:
case 4:
break;
- default:
+ default:
if(throwException) {
throw new GLException("Illegal component number for "+arrayName+" on profile GLES2: "+comps);
}
@@ -1330,7 +1384,7 @@ public class GLProfile {
case javax.media.opengl.GL2ES2.GL_UNSIGNED_INT:
case javax.media.opengl.GL2.GL_DOUBLE:
break;
- default:
+ default:
if(throwException) {
throw new GLException("Illegal data type for "+arrayName+" on profile GL2: "+type);
}
@@ -1343,7 +1397,7 @@ public class GLProfile {
case 3:
case 4:
break;
- default:
+ default:
if(throwException) {
throw new GLException("Illegal component number for "+arrayName+" on profile GL2: "+comps);
}
@@ -1358,7 +1412,7 @@ public class GLProfile {
case javax.media.opengl.GL2ES2.GL_INT:
case javax.media.opengl.GL2.GL_DOUBLE:
break;
- default:
+ default:
if(throwException) {
throw new GLException("Illegal data type for "+arrayName+" on profile GL2: "+type);
}
@@ -1370,7 +1424,7 @@ public class GLProfile {
case 3:
case 4:
break;
- default:
+ default:
if(throwException) {
throw new GLException("Illegal component number for "+arrayName+" on profile GL2: "+comps);
}
@@ -1385,7 +1439,7 @@ public class GLProfile {
case javax.media.opengl.GL2ES2.GL_INT:
case javax.media.opengl.GL2.GL_DOUBLE:
break;
- default:
+ default:
if(throwException) {
throw new GLException("Illegal data type for "+arrayName+" on profile GL2: "+type);
}
@@ -1395,7 +1449,7 @@ public class GLProfile {
case 0:
case 3:
break;
- default:
+ default:
if(throwException) {
throw new GLException("Illegal component number for "+arrayName+" on profile GLES1: "+comps);
}
@@ -1413,7 +1467,7 @@ public class GLProfile {
case javax.media.opengl.GL2ES2.GL_UNSIGNED_INT:
case javax.media.opengl.GL2.GL_DOUBLE:
break;
- default:
+ default:
if(throwException) {
throw new GLException("Illegal data type for "+arrayName+" on profile GL2: "+type);
}
@@ -1424,7 +1478,7 @@ public class GLProfile {
case 3:
case 4:
break;
- default:
+ default:
if(throwException) {
throw new GLException("Illegal component number for "+arrayName+" on profile GL2: "+comps);
}
@@ -1438,7 +1492,7 @@ public class GLProfile {
case javax.media.opengl.GL2ES2.GL_INT:
case javax.media.opengl.GL2.GL_DOUBLE:
break;
- default:
+ default:
if(throwException) {
throw new GLException("Illegal data type for "+arrayName+" on profile GL2: "+type);
}
@@ -1451,7 +1505,7 @@ public class GLProfile {
case 3:
case 4:
break;
- default:
+ default:
if(throwException) {
throw new GLException("Illegal component number for "+arrayName+" on profile GL2: "+comps);
}
@@ -1464,13 +1518,14 @@ public class GLProfile {
return true;
}
+ @Override
public String toString() {
return "GLProfile[" + getName() + "/" + getImplName() + "."+(this.isHardwareRasterizer?"hw":"sw")+"]";
}
private static /*final*/ boolean isAWTAvailable;
- private static /*final*/ boolean hasDesktopGLFactory;
+ private static /*final*/ boolean hasDesktopGLFactory;
private static /*final*/ boolean hasGL234Impl;
private static /*final*/ boolean hasEGLFactory;
private static /*final*/ boolean hasGLES3Impl;
@@ -1503,11 +1558,11 @@ public class GLProfile {
// depends on hasDesktopGLFactory
hasGL234Impl = ReflectionUtil.isClassAvailable("jogamp.opengl.gl4.GL4bcImpl", classloader);
-
+
// depends on hasEGLFactory
hasGLES1Impl = ReflectionUtil.isClassAvailable("jogamp.opengl.es1.GLES1Impl", classloader);
hasGLES3Impl = ReflectionUtil.isClassAvailable("jogamp.opengl.es3.GLES3Impl", classloader);
-
+
//
// Iteration of desktop GL availability detection
// utilizing the detected GL version in the shared context.
@@ -1516,7 +1571,7 @@ public class GLProfile {
// which will register at GLContext ..
//
GLDrawableFactory.initSingleton();
-
+
Throwable t=null;
// if successfull it has a shared dummy drawable and context created
try {
@@ -1587,14 +1642,14 @@ public class GLProfile {
System.err.println("Info: GLProfile.init - EGL GLDrawable factory not available");
}
} else {
- defaultEGLDevice = eglFactory.getDefaultDevice();
+ defaultEGLDevice = eglFactory.getDefaultDevice();
}
if( null != defaultDesktopDevice ) {
defaultDevice = defaultDesktopDevice;
if(DEBUG) {
System.err.println("Info: GLProfile.init - Default device is desktop derived: "+defaultDevice);
- }
+ }
} else if ( null != defaultEGLDevice ) {
defaultDevice = defaultEGLDevice;
if(DEBUG) {
@@ -1606,12 +1661,12 @@ public class GLProfile {
}
defaultDevice = null;
}
-
+
// we require to initialize the EGL device 1st, if available
final boolean addedEGLProfile = null != defaultEGLDevice ? initProfilesForDevice(defaultEGLDevice) : false;
- final boolean addedDesktopProfile = null != defaultDesktopDevice ? initProfilesForDevice(defaultDesktopDevice) : false;
+ final boolean addedDesktopProfile = null != defaultDesktopDevice ? initProfilesForDevice(defaultDesktopDevice) : false;
final boolean addedAnyProfile = addedEGLProfile || addedDesktopProfile ;
-
+
if(DEBUG) {
System.err.println("GLProfile.init addedAnyProfile "+addedAnyProfile+" (desktop: "+addedDesktopProfile+", egl "+addedEGLProfile+")");
System.err.println("GLProfile.init isAWTAvailable "+isAWTAvailable);
@@ -1667,8 +1722,8 @@ public class GLProfile {
boolean addedDesktopProfile = false;
boolean addedEGLProfile = false;
- final boolean deviceIsDesktopCompatible = hasDesktopGLFactory && desktopFactory.getIsDeviceCompatible(device);
-
+ final boolean deviceIsDesktopCompatible = hasDesktopGLFactory && desktopFactory.getIsDeviceCompatible(device);
+
if( deviceIsDesktopCompatible ) {
// 1st pretend we have all Desktop and EGL profiles ..
computeProfileMap(device, true /* desktopCtxUndef*/, true /* esCtxUndef */);
@@ -1693,9 +1748,9 @@ public class GLProfile {
}
addedDesktopProfile = computeProfileMap(device, false /* desktopCtxUndef*/, false /* esCtxUndef */);
}
-
+
final boolean deviceIsEGLCompatible = hasEGLFactory && eglFactory.getIsDeviceCompatible(device);
-
+
// 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 ..
@@ -1713,7 +1768,7 @@ public class GLProfile {
}
if(!eglSharedCtxAvail) {
// Remark: On Windows there is a libEGL.dll delivered w/ Chrome 15.0.874.121m and Firefox 8.0.1
- // but it seems even EGL.eglInitialize(eglDisplay, null, null)
+ // but it seems even EGL.eglInitialize(eglDisplay, null, null)
// fails in some scenarios (eg VirtualBox 4.1.6) w/ EGL error 0x3001 (EGL_NOT_INITIALIZED).
hasEGLFactory = false;
hasGLES3Impl = false;
@@ -1969,26 +2024,26 @@ public class GLProfile {
}
}
} else if(GL4bc.equals(profile) && hasGL234Impl && ( desktopCtxUndef || GLContext.isGL4bcAvailable(device, isHardwareRasterizer))) {
- return GL4bc;
+ return desktopCtxUndef ? GL4bc : GLContext.getAvailableGLProfileName(device, 4, GLContext.CTX_PROFILE_COMPAT);
} else if(GL4.equals(profile) && hasGL234Impl && ( desktopCtxUndef || GLContext.isGL4Available(device, isHardwareRasterizer))) {
- return GL4;
+ return desktopCtxUndef ? GL4 : GLContext.getAvailableGLProfileName(device, 4, GLContext.CTX_PROFILE_CORE);
} else if(GL3bc.equals(profile) && hasGL234Impl && ( desktopCtxUndef || GLContext.isGL3bcAvailable(device, isHardwareRasterizer))) {
- return GL3bc;
+ return desktopCtxUndef ? GL3bc : GLContext.getAvailableGLProfileName(device, 3, GLContext.CTX_PROFILE_COMPAT);
} else if(GL3.equals(profile) && hasGL234Impl && ( desktopCtxUndef || GLContext.isGL3Available(device, isHardwareRasterizer))) {
- return GL3;
+ return desktopCtxUndef ? GL3 : GLContext.getAvailableGLProfileName(device, 3, GLContext.CTX_PROFILE_CORE);
} else if(GL2.equals(profile) && hasGL234Impl && ( desktopCtxUndef || GLContext.isGL2Available(device, isHardwareRasterizer))) {
- return GL2;
+ return desktopCtxUndef ? GL2 : GLContext.getAvailableGLProfileName(device, 2, GLContext.CTX_PROFILE_COMPAT);
} else if(GLES3.equals(profile) && hasGLES3Impl && ( esCtxUndef || GLContext.isGLES3Available(device, isHardwareRasterizer))) {
- return GLES3;
+ return esCtxUndef ? GLES3 : GLContext.getAvailableGLProfileName(device, 3, GLContext.CTX_PROFILE_ES);
} else if(GLES2.equals(profile) && hasGLES3Impl && ( esCtxUndef || GLContext.isGLES2Available(device, isHardwareRasterizer))) {
- return GLES2;
+ return esCtxUndef ? GLES2 : GLContext.getAvailableGLProfileName(device, 2, GLContext.CTX_PROFILE_ES);
} else if(GLES1.equals(profile) && hasGLES1Impl && ( esCtxUndef || GLContext.isGLES1Available(device, isHardwareRasterizer))) {
- return GLES1;
+ return esCtxUndef ? GLES1 : GLContext.getAvailableGLProfileName(device, 1, GLContext.CTX_PROFILE_ES);
}
return null;
}
- private static /*final*/ HashMap<String /*device_connection*/, HashMap<String /*GLProfile_name*/, GLProfile>> deviceConn2ProfileMap =
+ private static /*final*/ HashMap<String /*device_connection*/, HashMap<String /*GLProfile_name*/, GLProfile>> deviceConn2ProfileMap =
new HashMap<String /*device_connection*/, HashMap<String /*GLProfile_name*/, GLProfile>>();
/**
@@ -1999,22 +2054,22 @@ public class GLProfile {
*
* @param device the key 'device -> GLProfiles-Map'
* @param throwExceptionOnZeroProfile true if <code>GLException</code> shall be thrown in case of no mapped profile, otherwise false.
- * @return the GLProfile HashMap if exists, otherwise null
+ * @return the GLProfile HashMap if exists, otherwise null
* @throws GLException if no profile for the given device is available.
*/
- private static HashMap<String /*GLProfile_name*/, GLProfile> getProfileMap(AbstractGraphicsDevice device, boolean throwExceptionOnZeroProfile)
- throws GLException
+ private static HashMap<String /*GLProfile_name*/, GLProfile> getProfileMap(AbstractGraphicsDevice device, boolean throwExceptionOnZeroProfile)
+ throws GLException
{
initSingleton();
if(null==defaultDevice) { // avoid NPE and notify of incomplete initialization
throw new GLException("No default device available");
}
-
+
if(null==device) {
device = defaultDevice;
}
-
+
final String deviceKey = device.getUniqueID();
HashMap<String /*GLProfile_name*/, GLProfile> map = deviceConn2ProfileMap.get(deviceKey);
if( null != map ) {
diff --git a/src/jogl/classes/javax/media/opengl/GLRunnable.java b/src/jogl/classes/javax/media/opengl/GLRunnable.java
index 1ae1c9b..ad68662 100644
--- a/src/jogl/classes/javax/media/opengl/GLRunnable.java
+++ b/src/jogl/classes/javax/media/opengl/GLRunnable.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.opengl;
/**
@@ -33,8 +33,8 @@ package javax.media.opengl;
* Declares a one-shot OpenGL command usable for injection
* via {@link GLAutoDrawable#invoke(boolean, javax.media.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)}
+ * method after all registered {@link GLEventListener}s
+ * {@link GLEventListener#display(GLAutoDrawable) display(GLAutoDrawable)}
* methods has been called.
* </p>
* <p>
@@ -44,13 +44,13 @@ package javax.media.opengl;
* This might be useful to inject OpenGL commands from an I/O event listener.
* </p>
*/
-public interface GLRunnable {
+public interface GLRunnable {
/**
* @param drawable the associated drawable and current context for this call
* @return true if the GL [back] framebuffer remains intact by this runnable, otherwise false.
* If returning false {@link GLAutoDrawable} will call
- * {@link GLEventListener#display(GLAutoDrawable) display(GLAutoDrawable)}
- * of all registered {@link GLEventListener}s once more.
+ * {@link GLEventListener#display(GLAutoDrawable) display(GLAutoDrawable)}
+ * of all registered {@link GLEventListener}s once more.
* @see GLRunnable
*/
boolean run(GLAutoDrawable drawable);
diff --git a/src/jogl/classes/javax/media/opengl/GLRunnable2.java b/src/jogl/classes/javax/media/opengl/GLRunnable2.java
index 1598a62..5f03932 100644
--- a/src/jogl/classes/javax/media/opengl/GLRunnable2.java
+++ b/src/jogl/classes/javax/media/opengl/GLRunnable2.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.opengl;
/**
@@ -33,11 +33,11 @@ package javax.media.opengl;
* Declares a one-shot OpenGL command.
* </p>
*/
-public interface GLRunnable2<T,U> {
+public interface GLRunnable2<T,U> {
/**
* @param gl a current GL object
* @param args custom arguments
- * @return the desired object
+ * @return the desired object
*/
T run(GL gl, U args);
}
diff --git a/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java b/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java
new file mode 100644
index 0000000..78dd693
--- /dev/null
+++ b/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java
@@ -0,0 +1,146 @@
+/**
+ * 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.
+ */
+
+package javax.media.opengl;
+
+/**
+ * Adds capabilities to set a shared {@link GLContext} directly or via an {@link GLAutoDrawable}.
+ * <p>
+ * Sharing of server-side OpenGL objects such as buffer objects, e.g. VBOs,
+ * and textures among OpenGL contexts is supported with this interface.
+ * </p>
+ * <p>
+ * A <i>master</i> {@link GLContext} is the {@link GLContext} which is created first,
+ * shared {@link GLContext} w/ this master are referred as slave {@link GLContext}
+ * and controls the shared object's lifecycle, i.e. their construction and destruction.
+ * </p>
+ * <p>
+ * Using the nearest or same {@link GLCapabilitiesImmutable#getVisualID(javax.media.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>
+ * <p>
+ * After shared objects are created on the <i>master</i>, the OpenGL pipeline
+ * might need to be synchronized w/ the <i>slaves</i>, e.g. via {@link GL#glFinish()}.
+ * At least this has been experienced w/ OSX 10.9.
+ * </p>
+ * <p>
+ * Be aware that the <i>master</i> {@link GLContext} and related resources
+ * <i>shall not</i> be destroyed before it's <i>slave</i> {@link GLContext} instances <i>while they are using them</i>.<br>
+ * Otherwise the OpenGL driver implementation may crash w/ SIGSEGV, since using already destroyed resources,
+ * e.g. OpenGL buffer objects, may not be validated by the driver!<br>
+ * </p>
+ * <p>
+ * Either proper lifecycle synchronization is implemented, e.g. by notifying the <i>slaves</i> about the loss of the shared resources,
+ * <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}
+ * {@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>:
+ * <pre>
+ // GLProfile and GLCapabilities should be equal across all shared GL drawable/context.
+ final GLCapabilitiesImmutable caps = ... ;
+ final GLProfile glp = caps.getGLProfile();
+ ..
+ final boolean createNewDevice = true; // use 'own' display device!
+ final GLAutoDrawable sharedDrawable = GLDrawableFactory.getFactory(glp).createDummyAutoDrawable(null, createNewDevice, caps, null);
+ sharedDrawable.display(); // triggers GLContext object creation and native realization.
+ ...
+ // Later a shared 'slave' can be created e.g.:
+ GLWindow glad = GLWindow.create(caps); // or any other GLAutoDrawable supporting GLSharedContextSetter
+ glad.setSharedAutoDrawable(sharedDrawable);
+ glad.addGLEventListener(..);
+ glad.setVisible(true); // GLWindow creation ..
+ * </pre>
+ * </p>
+ * <h5><a name="driverissues">Known Driver Issues</a></h5>
+ * <h7><a name="intelmesa">Intel's Mesa >= 9.1.2 Backend for [Sandybridge/Ivybridge] on GNU/Linux</a></h7>
+ * <p>
+ * <pre>
+ * Error: 'intel_do_flush_locked: No such file or directory'
+ * JogAmp: <https://jogamp.org/bugzilla/show_bug.cgi?id=873>
+ * freedesktop.org: <https://bugs.freedesktop.org/show_bug.cgi?id=41736#c8>
+ * </pre>
+ * Shared context seems not to be supported w/ lock-free bound X11 display connections
+ * per OpenGL drawable/context. The error message above is thrown in this case.
+ * Hence the driver bug renders shared context use w/ JOGL impossible.
+ * </p>
+ * <h7><a name="hisilicon">Hisilicon's Immersion.16</a></h7>
+ * <p>
+ * </p>
+ */
+public interface GLSharedContextSetter extends GLAutoDrawable {
+ /**
+ * Specifies an {@link GLContext OpenGL context}, which shall be shared by this {@link GLAutoDrawable}'s {@link GLContext}.
+ * <p>
+ * Since the {@link GLDrawable drawable} and {@link GLContext context} is created
+ * at {@link GLAutoDrawable#initialization GLAutoDrawable initialization}
+ * this method shall be called beforehand to have any effect.
+ * </p>
+ * <p>
+ * A set <i>sharedContext</i> will block context creation, i.e. {@link GLAutoDrawable#initialization GLAutoDrawable initialization},
+ * as long it is not {@link GLContext#isCreated() created natively}.
+ * </p>
+ * <p>
+ * See <a href="#lifecycle">Lifecycle Considerations</a>.
+ * </p>
+ *
+ * @param sharedContext The OpenGL context to be shared by this {@link GLAutoDrawable}'s {@link GLContext}.
+ * @throws IllegalStateException if a {@link #setSharedContext(GLContext) shared GLContext}
+ * or {@link #setSharedAutoDrawable(GLAutoDrawable) shared GLAutoDrawable} is already set,
+ * the given sharedContext is null or equal to this {@link GLAutoDrawable}'s context.
+ * @see #setSharedAutoDrawable(GLAutoDrawable)
+ */
+ void setSharedContext(GLContext sharedContext) throws IllegalStateException;
+
+ /**
+ * Specifies an {@link GLAutoDrawable}, which {@link GLContext OpenGL context} shall be shared by this {@link GLAutoDrawable}'s {@link GLContext}.
+ * <p>
+ * Since the {@link GLDrawable drawable} and {@link GLContext context} is created
+ * at {@link GLAutoDrawable#initialization GLAutoDrawable initialization}
+ * this method shall be called beforehand to have any effect.
+ * </p>
+ * <p>
+ * A set <i>sharedAutoDrawable</i> will block context creation, i.e. {@link GLAutoDrawable#initialization GLAutoDrawable initialization},
+ * as long it's {@link GLContext} is <code>null</code>
+ * or has not been {@link GLContext#isCreated() created natively}.
+ * </p>
+ * <p>
+ * See <a href="#lifecycle">Lifecycle Considerations</a>.
+ * </p>
+ *
+ * @param sharedContext The GLAutoDrawable, which OpenGL context shall be shared by this {@link GLAutoDrawable}'s {@link GLContext}.
+ * @throws IllegalStateException if a {@link #setSharedContext(GLContext) shared GLContext}
+ * or {@link #setSharedAutoDrawable(GLAutoDrawable) shared GLAutoDrawable} is already set,
+ * the given sharedAutoDrawable is null or equal to this GLAutoDrawable.
+ * @see #setSharedContext(GLContext)
+ */
+ void setSharedAutoDrawable(GLAutoDrawable sharedAutoDrawable) throws IllegalStateException;
+}
diff --git a/src/jogl/classes/javax/media/opengl/GLUniformData.java b/src/jogl/classes/javax/media/opengl/GLUniformData.java
index 60d0c58..412bfb0 100644
--- a/src/jogl/classes/javax/media/opengl/GLUniformData.java
+++ b/src/jogl/classes/javax/media/opengl/GLUniformData.java
@@ -77,16 +77,16 @@ public class GLUniformData {
sb = new StringBuilder();
}
sb.append("GLUniformData[name ").append(name).
- append(", location ").append(location).
+ append(", location ").append(location).
append(", size ").append(rows).append("x").append(columns).
- append(", count ").append(count).
- append(", data ");
+ append(", count ").append(count).
+ append(", data ");
if(isMatrix() && data instanceof FloatBuffer) {
sb.append("\n");
- final FloatBuffer fb = (FloatBuffer)getBuffer();
+ final FloatBuffer fb = (FloatBuffer)getBuffer();
for(int i=0; i<count; i++) {
FloatUtil.matrixToString(sb, i+": ", "%10.5f", fb, i*rows*columns, rows, columns, false);
- sb.append(",\n");
+ sb.append(",\n");
}
} else if(isBuffer()) {
Buffers.toString(sb, null, getBuffer());
@@ -96,7 +96,8 @@ public class GLUniformData {
sb.append("]");
return sb;
}
-
+
+ @Override
public String toString() {
return toString(null).toString();
}
@@ -166,7 +167,7 @@ public class GLUniformData {
location = gl.glGetUniformLocation(program, name);
return location;
}
-
+
public Object getObject() {
return data;
}
diff --git a/src/jogl/classes/javax/media/opengl/Threading.java b/src/jogl/classes/javax/media/opengl/Threading.java
index 4788f9c..7503e9c 100644
--- a/src/jogl/classes/javax/media/opengl/Threading.java
+++ b/src/jogl/classes/javax/media/opengl/Threading.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -42,7 +42,7 @@ package javax.media.opengl;
import jogamp.opengl.ThreadingImpl;
-/** This API provides access to the threading model for the implementation of
+/** This API provides access to the threading model for the implementation of
the classes in this package.
<P>
@@ -59,12 +59,12 @@ import jogamp.opengl.ThreadingImpl;
Due to these limitations, and due to the inherent multithreading
in the Java platform (in particular, in the Abstract Window
- Toolkit), it is often necessary to limit the multithreading
- occurring in the typical application using the OpenGL API.
+ Toolkit), it is often necessary to limit the multithreading
+ occurring in the typical application using the OpenGL API.
<P>
- In the current reference implementation, for instance, multithreading
+ In the current reference implementation, for instance, multithreading
has been limited by
forcing all OpenGL-related work for GLAutoDrawables on to a single
thread. In other words, if an application uses only the
@@ -93,9 +93,9 @@ import jogamp.opengl.ThreadingImpl;
This class also provides mechanisms for querying whether this
internal serialization of OpenGL work is in effect, and a
- programmatic way of disabling it. In the current reference
- implementation it is enabled by default, although it could be
- disabled in the future if OpenGL drivers become more robust on
+ programmatic way of disabling it. In the current reference
+ implementation it is enabled by default, although it could be
+ disabled in the future if OpenGL drivers become more robust on
all platforms.
<P>
@@ -113,7 +113,7 @@ import jogamp.opengl.ThreadingImpl;
platforms, and also the default behavior older releases)
-Djogl.1thread=worker Enable single-threading of OpenGL work on newly-created worker thread (not suitable for Mac
OS X or X11 platforms, and risky on Windows in applet environments)
- </PRE>
+ </PRE>
*/
public class Threading {
@@ -121,9 +121,9 @@ public class Threading {
/** No reason to ever instantiate this class */
private Threading() {}
- /** If an implementation of the javax.media.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
+ /** If an implementation of the javax.media.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
calling this method unless they are aware of all of the
consequences and are prepared to enforce some amount of
@@ -133,7 +133,7 @@ public class Threading {
GLPbuffer. Currently there is no supported way to re-enable it
once disabled, partly to discourage careless use of this
method. This method should be called as early as possible in an
- application. */
+ application. */
public static final void disableSingleThreading() {
ThreadingImpl.disableSingleThreading();
}
@@ -145,11 +145,11 @@ public class Threading {
}
/** Indicates whether the current thread is the designated toolkit thread,
- if such semantics exists. */
+ if such semantics exists. */
public static final boolean isToolkitThread() throws GLException {
return ThreadingImpl.isToolkitThread();
}
-
+
/** Indicates whether the current thread is the single thread on
which this implementation of the javax.media.opengl APIs
performs all of its OpenGL-related work. This method should only
@@ -166,12 +166,12 @@ public class Threading {
thread (i.e., if <code>isOpenGLThread()</code> returns
false). It is up to the end user to check to see whether the
current thread is the OpenGL thread and either execute the
- Runnable directly or perform the work inside it.
+ Runnable directly or perform the work inside it.
**/
public static final void invokeOnOpenGLThread(boolean wait, Runnable r) throws GLException {
ThreadingImpl.invokeOnOpenGLThread(wait, r);
}
-
+
/**
* If {@link #isSingleThreaded()} <b>and</b> not {@link #isOpenGLThread()}
* <b>and</b> the <code>lock</code> is not being hold by this thread,
@@ -179,14 +179,14 @@ public class Threading {
* <p>
* Otherwise invoke Runnable <code>r</code> on the current thread.
* </p>
- *
- * @param wait set to true for waiting until Runnable <code>r</code> is finished, otherwise false.
+ *
+ * @param wait set to true for waiting until Runnable <code>r</code> is finished, otherwise false.
* @param r the Runnable to be executed
* @param lock optional lock object to be tested
* @throws GLException
*/
public static final void invoke(boolean wait, Runnable r, Object lock) throws GLException {
- if ( isSingleThreaded() && !isOpenGLThread() &&
+ if ( isSingleThreaded() && !isOpenGLThread() &&
( null == lock || !Thread.holdsLock(lock) ) ) {
invokeOnOpenGLThread(wait, r);
} else {
diff --git a/src/jogl/classes/javax/media/opengl/TraceGL2.java b/src/jogl/classes/javax/media/opengl/TraceGL2.java
index 58f5d9f..c577332 100644
--- a/src/jogl/classes/javax/media/opengl/TraceGL2.java
+++ b/src/jogl/classes/javax/media/opengl/TraceGL2.java
@@ -12,7 +12,7 @@ import java.io.PrintStream;
* Sample code which installs this pipeline, manual:
* <pre>
* gl = drawable.setGL(new TraceGL(drawable.getGL(), System.err));
- * </pre>
+ * </pre>
* For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}.
* </p>
*/
diff --git a/src/jogl/classes/javax/media/opengl/TraceGL3.java b/src/jogl/classes/javax/media/opengl/TraceGL3.java
index 616b31f..5fccf40 100644
--- a/src/jogl/classes/javax/media/opengl/TraceGL3.java
+++ b/src/jogl/classes/javax/media/opengl/TraceGL3.java
@@ -12,7 +12,7 @@ import java.io.PrintStream;
* Sample code which installs this pipeline, manual:
* <pre>
* gl = drawable.setGL(new TraceGL(drawable.getGL(), System.err));
- * </pre>
+ * </pre>
* For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}.
* </p>
*/
diff --git a/src/jogl/classes/javax/media/opengl/TraceGL3bc.java b/src/jogl/classes/javax/media/opengl/TraceGL3bc.java
index f3761d4..84f537f 100644
--- a/src/jogl/classes/javax/media/opengl/TraceGL3bc.java
+++ b/src/jogl/classes/javax/media/opengl/TraceGL3bc.java
@@ -12,7 +12,7 @@ import java.io.PrintStream;
* Sample code which installs this pipeline, manual:
* <pre>
* gl = drawable.setGL(new TraceGL(drawable.getGL(), System.err));
- * </pre>
+ * </pre>
* For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}.
* </p>
*/
diff --git a/src/jogl/classes/javax/media/opengl/TraceGL4.java b/src/jogl/classes/javax/media/opengl/TraceGL4.java
index a12bf0f..afe2cd9 100644
--- a/src/jogl/classes/javax/media/opengl/TraceGL4.java
+++ b/src/jogl/classes/javax/media/opengl/TraceGL4.java
@@ -12,7 +12,7 @@ import java.io.PrintStream;
* Sample code which installs this pipeline, manual:
* <pre>
* gl = drawable.setGL(new TraceGL(drawable.getGL(), System.err));
- * </pre>
+ * </pre>
* For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}.
* </p>
*/
diff --git a/src/jogl/classes/javax/media/opengl/TraceGLES2.java b/src/jogl/classes/javax/media/opengl/TraceGLES2.java
index 38d60e3..4740e2e 100644
--- a/src/jogl/classes/javax/media/opengl/TraceGLES2.java
+++ b/src/jogl/classes/javax/media/opengl/TraceGLES2.java
@@ -12,7 +12,7 @@ import java.io.PrintStream;
* Sample code which installs this pipeline, manual:
* <pre>
* gl = drawable.setGL(new TraceGL(drawable.getGL(), System.err));
- * </pre>
+ * </pre>
* For automatic instantiation see {@link GLPipelineFactory#create(String, Class, GL, Object[])}.
* </p>
*/
diff --git a/src/jogl/classes/javax/media/opengl/awt/ComponentEvents.java b/src/jogl/classes/javax/media/opengl/awt/ComponentEvents.java
index 0c4f63c..5feaa57 100644
--- a/src/jogl/classes/javax/media/opengl/awt/ComponentEvents.java
+++ b/src/jogl/classes/javax/media/opengl/awt/ComponentEvents.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index b7a24a7..01d6a67 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -44,16 +44,16 @@ import java.beans.Beans;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
-
import java.awt.Canvas;
import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.Frame;
import java.awt.Graphics;
+import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
+import java.awt.geom.NoninvertibleTransformException;
import java.awt.geom.Rectangle2D;
-
import java.awt.EventQueue;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
@@ -68,7 +68,6 @@ 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;
@@ -82,6 +81,7 @@ 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.common.GlueGenVersion;
@@ -92,14 +92,18 @@ import com.jogamp.common.util.locks.RecursiveLock;
import com.jogamp.nativewindow.awt.AWTGraphicsConfiguration;
import com.jogamp.nativewindow.awt.AWTGraphicsDevice;
import com.jogamp.nativewindow.awt.AWTGraphicsScreen;
+import com.jogamp.nativewindow.awt.AWTPrintLifecycle;
import com.jogamp.nativewindow.awt.AWTWindowClosingProtocol;
import com.jogamp.nativewindow.awt.JAWTWindow;
import com.jogamp.opengl.JoglVersion;
+import com.jogamp.opengl.util.GLDrawableUtil;
+import com.jogamp.opengl.util.TileRenderer;
import jogamp.opengl.Debug;
import jogamp.opengl.GLContextImpl;
import jogamp.opengl.GLDrawableHelper;
import jogamp.opengl.GLDrawableImpl;
+import jogamp.opengl.awt.AWTTilePainter;
// FIXME: Subclasses need to call resetGLFunctionAvailability() on their
// context whenever the displayChanged() function is called on our
@@ -111,17 +115,17 @@ import jogamp.opengl.GLDrawableImpl;
interfaces when adding a heavyweight doesn't work either because
of Z-ordering or LayoutManager problems.
*
- * <h5><A NAME="java2dgl">Offscreen Layer Remarks</A></h5>
- *
+ * <h5><a name="offscreenlayer">Offscreen Layer Remarks</a></h5>
+ *
* {@link OffscreenLayerOption#setShallUseOffscreenLayer(boolean) setShallUseOffscreenLayer(true)}
- * maybe called to use an offscreen drawable (FBO or PBuffer) allowing
+ * maybe called to use an offscreen drawable (FBO or PBuffer) allowing
* the underlying JAWT mechanism to composite the image, if supported.
* <p>
* {@link OffscreenLayerOption#setShallUseOffscreenLayer(boolean) setShallUseOffscreenLayer(true)}
* is being called if {@link GLCapabilitiesImmutable#isOnscreen()} is <code>false</code>.
* </p>
- *
- * <h5><A NAME="java2dgl">Java2D OpenGL Remarks</A></h5>
+ *
+ * <h5><a name="java2dgl">Java2D OpenGL Remarks</a></h5>
*
* To avoid any conflicts with a potential Java2D OpenGL context,<br>
* you shall consider setting the following JVM properties:<br>
@@ -138,7 +142,7 @@ import jogamp.opengl.GLDrawableImpl;
* <li><pre>sun.java2d.noddraw=true</pre></li>
* </ul>
*
- * <h5><A NAME="backgrounderase">Disable Background Erase</A></h5>
+ * <h5><a name="backgrounderase">Disable Background Erase</a></h5>
*
* GLCanvas tries to disable background erase for the AWT Canvas
* before native peer creation (X11) and after it (Windows), <br>
@@ -150,7 +154,7 @@ import jogamp.opengl.GLDrawableImpl;
*/
@SuppressWarnings("serial")
-public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosingProtocol, OffscreenLayerOption {
+public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosingProtocol, OffscreenLayerOption, AWTPrintLifecycle, GLSharedContextSetter {
private static final boolean DEBUG = Debug.debug("GLCanvas");
@@ -159,18 +163,17 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
private AWTGraphicsConfiguration awtConfig;
private volatile GLDrawableImpl drawable; // volatile: avoid locking for read-only access
private volatile JAWTWindow jawtWindow; // the JAWTWindow presentation of this AWT Canvas, bound to the 'drawable' lifecycle
- private GLContextImpl context;
+ private volatile GLContextImpl context; // volatile: avoid locking for read-only access
private volatile boolean sendReshape = false; // volatile: maybe written by EDT w/o locking
// copy of the cstr args, mainly for recreation
- private GLCapabilitiesImmutable capsReqUser;
- private GLCapabilitiesChooser chooser;
- private GLContext shareWith;
+ private final GLCapabilitiesImmutable capsReqUser;
+ private final GLCapabilitiesChooser chooser;
private int additionalCtxCreationFlags = 0;
- private GraphicsDevice device;
+ private final GraphicsDevice device;
private boolean shallUseOffscreenLayer = false;
- private AWTWindowClosingProtocol awtWindowClosingProtocol =
+ private final AWTWindowClosingProtocol awtWindowClosingProtocol =
new AWTWindowClosingProtocol(this, new Runnable() {
@Override
public void run() {
@@ -204,6 +207,8 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
*
* @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)
+ * @deprecated Use {@link #GLCanvas(GLCapabilitiesImmutable)}
+ * and set shared GLContext via {@link #setSharedContext(GLContext)} or {@link #setSharedAutoDrawable(GLAutoDrawable)}.
*/
public GLCanvas(GLCapabilitiesImmutable capsReqUser, GLContext shareWith)
throws GLException
@@ -216,17 +221,39 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
default set of capabilities is used. The GLCapabilitiesChooser
specifies the algorithm for selecting one of the available
GLCapabilities for the component; a DefaultGLCapabilitesChooser
+ is used if null is passed for this argument.
+ The passed GraphicsDevice indicates the screen on
+ which to create the GLCanvas; the GLDrawableFactory uses the
+ default screen device of the local GraphicsEnvironment if null
+ is passed for this argument.
+ * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
+ */
+ public GLCanvas(GLCapabilitiesImmutable capsReqUser,
+ GLCapabilitiesChooser chooser,
+ GraphicsDevice device)
+ throws GLException
+ {
+ this(capsReqUser, chooser, null, device);
+ }
+
+ /** Creates a new GLCanvas component. The passed GLCapabilities
+ specifies the OpenGL capabilities for the component; if null, a
+ default set of capabilities is used. The GLCapabilitiesChooser
+ specifies the algorithm for selecting one of the available
+ GLCapabilities for the component; a DefaultGLCapabilitesChooser
is used if null is passed for this argument. The passed
GLContext specifies an OpenGL context with which to share
textures, display lists and other OpenGL state, and may be null
if sharing is not desired. See the note in the overview
documentation on <a
- href="../../../overview-summary.html#SHARING">context
+ href="../../../spec-overview.html#SHARING">context
sharing</a>. The passed GraphicsDevice indicates the screen on
which to create the GLCanvas; the GLDrawableFactory uses the
default screen device of the local GraphicsEnvironment if null
is passed for this argument.
* @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
+ * @deprecated Use {@link #GLCanvas(GLCapabilitiesImmutable, GLCapabilitiesChooser, GraphicsDevice)}
+ * and set shared GLContext via {@link #setSharedContext(GLContext)} or {@link #setSharedAutoDrawable(GLAutoDrawable)}.
*/
public GLCanvas(GLCapabilitiesImmutable capsReqUser,
GLCapabilitiesChooser chooser,
@@ -263,15 +290,27 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
// instantiation will be issued in addNotify()
this.capsReqUser = capsReqUser;
this.chooser = chooser;
- this.shareWith = shareWith;
+ if( null != shareWith ) {
+ helper.setSharedContext(null, shareWith);
+ }
this.device = device;
}
@Override
+ public final void setSharedContext(GLContext sharedContext) throws IllegalStateException {
+ helper.setSharedContext(this.context, sharedContext);
+ }
+
+ @Override
+ public final void setSharedAutoDrawable(GLAutoDrawable sharedAutoDrawable) throws IllegalStateException {
+ helper.setSharedAutoDrawable(this, sharedAutoDrawable);
+ }
+
+ @Override
public final Object getUpstreamWidget() {
return this;
}
-
+
@Override
public void setShallUseOffscreenLayer(boolean v) {
shallUseOffscreenLayer = v;
@@ -312,11 +351,11 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
* all platforms since the peer hasn't been created.
*/
final GraphicsConfiguration gc = super.getGraphicsConfiguration();
-
+
if( Beans.isDesignTime() ) {
return gc;
}
-
+
/*
* chosen is only non-null on platforms where the GLDrawableFactory
* returns a non-null GraphicsConfiguration (in the GLCanvas
@@ -365,7 +404,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
System.err.println("Created Config (n): HAVE CF "+awtConfig);
System.err.println("Created Config (n): Choosen CF "+config);
System.err.println("Created Config (n): EQUALS CAPS "+equalCaps);
- Thread.dumpStack();
+ // Thread.dumpStack();
}
if (compatible != null) {
@@ -380,7 +419,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
destroyImpl( true );
// recreation!
awtConfig = config;
- createDrawableAndContext( true );
+ createJAWTDrawableAndContext();
validateGLDrawable();
} else {
awtConfig = config;
@@ -428,11 +467,11 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
_lock.unlock();
}
}
-
+
private final void setRealizedImpl(boolean realized) {
final RecursiveLock _lock = lock;
_lock.lock();
- try {
+ try {
final GLDrawable _drawable = drawable;
if( null == _drawable || realized == _drawable.isRealized() ||
realized && ( 0 >= _drawable.getWidth() || 0 >= _drawable.getHeight() ) ) {
@@ -445,10 +484,16 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
} finally {
_lock.unlock();
}
- }
- private final Runnable realizeOnEDTAction = new Runnable() { public void run() { setRealizedImpl(true); } };
- private final Runnable unrealizeOnEDTAction = new Runnable() { public void run() { setRealizedImpl(false); } };
-
+ }
+ private final Runnable realizeOnEDTAction = new Runnable() {
+ @Override
+ public void run() { setRealizedImpl(true); }
+ };
+ private final Runnable unrealizeOnEDTAction = new Runnable() {
+ @Override
+ public void run() { setRealizedImpl(false); }
+ };
+
@Override
public final void setRealized(boolean realized) {
// Make sure drawable realization happens on AWT-EDT and only there. Consider the AWTTree lock!
@@ -479,7 +524,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
return; // not yet available ..
}
- if( isVisible() ) {
+ if( isVisible() && !printActive ) {
Threading.invoke(true, displayOnEDTAction, getTreeLock());
}
}
@@ -500,7 +545,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
public void destroy() {
destroyImpl( false );
}
-
+
protected void destroyImpl(boolean destroyJAWTWindowAndAWTDevice) {
Threading.invoke(true, destroyOnEDTAction, getTreeLock());
if( destroyJAWTWindowAndAWTDevice ) {
@@ -550,14 +595,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
public void addNotify() {
final RecursiveLock _lock = lock;
_lock.lock();
- try {
+ try {
final boolean isBeansDesignTime = Beans.isDesignTime();
-
+
if(DEBUG) {
System.err.println(getThreadName()+": Info: addNotify - start, bounds: "+this.getBounds()+", isBeansDesignTime "+isBeansDesignTime);
- Thread.dumpStack();
+ // Thread.dumpStack();
}
-
+
if( isBeansDesignTime ) {
super.addNotify();
} else {
@@ -573,21 +618,21 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
if(null==awtConfig) {
throw new GLException("Error: NULL AWTGraphicsConfiguration");
}
-
+
// before native peer is valid: X11
disableBackgroundErase();
-
+
// issues getGraphicsConfiguration() and creates the native peer
super.addNotify();
-
+
// after native peer is valid: Windows
disableBackgroundErase();
-
- createDrawableAndContext( true );
-
+
+ createJAWTDrawableAndContext();
+
// init drawable by paint/display makes the init sequence more equal
// for all launch flavors (applet/javaws/..)
- // validateGLDrawable();
+ // validateGLDrawable();
}
awtWindowClosingProtocol.addClosingListener();
@@ -599,22 +644,35 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
}
- private void createDrawableAndContext(boolean createJAWTWindow) {
+ private void createJAWTDrawableAndContext() {
if ( !Beans.isDesignTime() ) {
- if( createJAWTWindow ) {
- jawtWindow = (JAWTWindow) NativeWindowFactory.getNativeWindow(this, awtConfig);
- jawtWindow.setShallUseOffscreenLayer(shallUseOffscreenLayer);
- }
+ jawtWindow = (JAWTWindow) NativeWindowFactory.getNativeWindow(this, awtConfig);
+ jawtWindow.setShallUseOffscreenLayer(shallUseOffscreenLayer);
jawtWindow.lockSurface();
try {
drawable = (GLDrawableImpl) GLDrawableFactory.getFactory(capsReqUser.getGLProfile()).createGLDrawable(jawtWindow);
- context = (GLContextImpl) drawable.createContext(shareWith);
- context.setContextCreationFlags(additionalCtxCreationFlags);
+ createContextImpl(drawable);
} finally {
jawtWindow.unlockSurface();
}
}
- }
+ }
+ private boolean createContextImpl(final GLDrawable drawable) {
+ final GLContext[] shareWith = { null };
+ if( !helper.isSharedGLContextPending(shareWith) ) {
+ context = (GLContextImpl) drawable.createContext(shareWith[0]);
+ context.setContextCreationFlags(additionalCtxCreationFlags);
+ if(DEBUG) {
+ System.err.println(getThreadName()+": Context created: has shared "+(null != shareWith[0]));
+ }
+ return true;
+ } else {
+ if(DEBUG) {
+ System.err.println(getThreadName()+": Context !created: pending share");
+ }
+ return false;
+ }
+ }
private boolean validateGLDrawable() {
if( Beans.isDesignTime() || !isDisplayable() ) {
@@ -622,23 +680,28 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
final GLDrawable _drawable = drawable;
if ( null != _drawable ) {
- if( _drawable.isRealized() ) {
- return true;
- }
- if( 0 >= _drawable.getWidth() || 0 >= _drawable.getHeight() ) {
- return false; // early out!
+ boolean res = _drawable.isRealized();
+ if( !res ) {
+ // re-try drawable creation
+ if( 0 >= _drawable.getWidth() || 0 >= _drawable.getHeight() ) {
+ return false; // early out!
+ }
+ setRealized(true);
+ res = _drawable.isRealized();
+ if(DEBUG) {
+ System.err.println(getThreadName()+": Realized Drawable: isRealized "+res+", "+_drawable.toString());
+ // Thread.dumpStack();
+ }
}
- setRealized(true);
- final boolean res = _drawable.isRealized();
- if(DEBUG) {
- System.err.println(getThreadName()+": Realized Drawable: isRealized "+res+", "+_drawable.toString());
- Thread.dumpStack();
+ if( res && null == context ) {
+ // re-try context creation
+ res = createContextImpl(_drawable); // pending creation.
}
return res;
}
return false;
}
-
+
/** <p>Overridden to track when this component is removed from a
container. Subclasses which override this method must call
super.removeNotify() in their removeNotify() method in order to
@@ -652,7 +715,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
public void removeNotify() {
if(DEBUG) {
System.err.println(getThreadName()+": Info: removeNotify - start");
- Thread.dumpStack();
+ // Thread.dumpStack();
}
awtWindowClosingProtocol.removeClosingListener();
@@ -683,14 +746,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
public void reshape(int x, int y, int width, int height) {
synchronized (getTreeLock()) { // super.reshape(..) claims tree lock, so we do extend it's lock over reshape
super.reshape(x, y, width, height);
-
+
if(DEBUG) {
final NativeSurface ns = getNativeSurface();
final long nsH = null != ns ? ns.getSurfaceHandle() : 0;
System.err.println("GLCanvas.sizeChanged: ("+getThreadName()+"): "+width+"x"+height+" - surfaceHandle 0x"+Long.toHexString(nsH));
// Thread.dumpStack();
- }
- if( validateGLDrawable() ) {
+ }
+ if( validateGLDrawable() && !printActive ) {
final GLDrawableImpl _drawable = drawable;
if( ! _drawable.getChosenGLCapabilities().isOnscreen() ) {
final RecursiveLock _lock = lock;
@@ -698,7 +761,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
try {
final GLDrawableImpl _drawableNew = GLDrawableHelper.resizeOffscreenDrawable(_drawable, context, width, height);
if(_drawable != _drawableNew) {
- // write back
+ // write back
drawable = _drawableNew;
}
} finally {
@@ -719,6 +782,160 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
paint(g);
}
+ private volatile boolean printActive = false;
+ private GLAnimatorControl printAnimator = null;
+ private GLAutoDrawable printGLAD = null;
+ private AWTTilePainter printAWTTiles = null;
+
+ @Override
+ public void setupPrint(double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight) {
+ printActive = true;
+ final int componentCount = isOpaque() ? 3 : 4;
+ final TileRenderer printRenderer = new TileRenderer();
+ printAWTTiles = new AWTTilePainter(printRenderer, componentCount, scaleMatX, scaleMatY, numSamples, tileWidth, tileHeight, DEBUG);
+ AWTEDTExecutor.singleton.invoke(getTreeLock(), true /* allowOnNonEDT */, true /* wait */, setupPrintOnEDT);
+ }
+ private final Runnable setupPrintOnEDT = new Runnable() {
+ @Override
+ public void run() {
+ if( !validateGLDrawable() ) {
+ if(DEBUG) {
+ System.err.println(getThreadName()+": Info: GLCanvas setupPrint - skipped GL render, drawable not valid yet");
+ }
+ printActive = false;
+ return; // not yet available ..
+ }
+ if( !isVisible() ) {
+ if(DEBUG) {
+ System.err.println(getThreadName()+": Info: GLCanvas setupPrint - skipped GL render, drawable visible");
+ }
+ printActive = false;
+ return; // not yet available ..
+ }
+ sendReshape = false; // clear reshape flag
+ printAnimator = helper.getAnimator();
+ if( null != printAnimator ) {
+ printAnimator.remove(GLCanvas.this);
+ }
+ printGLAD = GLCanvas.this; // _not_ default, shall be replaced by offscreen GLAD
+ final GLCapabilities caps = (GLCapabilities)getChosenGLCapabilities().cloneMutable();
+ final int printNumSamples = printAWTTiles.getNumSamples(caps);
+ GLDrawable printDrawable = printGLAD.getDelegatedDrawable();
+ final boolean reqNewGLADSamples = printNumSamples != caps.getNumSamples();
+ final boolean reqNewGLADSize = printAWTTiles.customTileWidth != -1 && printAWTTiles.customTileWidth != printDrawable.getWidth() ||
+ printAWTTiles.customTileHeight != -1 && printAWTTiles.customTileHeight != printDrawable.getHeight();
+ final boolean reqNewGLADOnscrn = caps.isOnscreen();
+ // It is desired to use a new offscreen GLAD, however Bug 830 forbids this for AA onscreen context.
+ // Bug 830: swapGLContextAndAllGLEventListener and onscreen MSAA w/ NV/GLX
+ final boolean reqNewGLAD = !caps.getSampleBuffers() && ( reqNewGLADOnscrn || reqNewGLADSamples || reqNewGLADSize );
+ if( DEBUG ) {
+ System.err.println("AWT print.setup: reqNewGLAD "+reqNewGLAD+"[ onscreen "+reqNewGLADOnscrn+", samples "+reqNewGLADSamples+", size "+reqNewGLADSize+"], "+
+ ", drawableSize "+printDrawable.getWidth()+"x"+printDrawable.getHeight()+
+ ", customTileSize "+printAWTTiles.customTileWidth+"x"+printAWTTiles.customTileHeight+
+ ", scaleMat "+printAWTTiles.scaleMatX+" x "+printAWTTiles.scaleMatY+
+ ", numSamples "+printAWTTiles.customNumSamples+" -> "+printNumSamples+", printAnimator "+printAnimator);
+ }
+ if( reqNewGLAD ) {
+ caps.setDoubleBuffered(false);
+ caps.setOnscreen(false);
+ if( printNumSamples != caps.getNumSamples() ) {
+ caps.setSampleBuffers(0 < printNumSamples);
+ caps.setNumSamples(printNumSamples);
+ }
+ final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
+ printGLAD = factory.createOffscreenAutoDrawable(null, caps, null,
+ printAWTTiles.customTileWidth != -1 ? printAWTTiles.customTileWidth : DEFAULT_PRINT_TILE_SIZE,
+ printAWTTiles.customTileHeight != -1 ? printAWTTiles.customTileHeight : DEFAULT_PRINT_TILE_SIZE);
+ GLDrawableUtil.swapGLContextAndAllGLEventListener(GLCanvas.this, printGLAD);
+ printDrawable = printGLAD.getDelegatedDrawable();
+ }
+ printAWTTiles.setIsGLOriented(printGLAD.isGLOriented());
+ printAWTTiles.renderer.setTileSize(printDrawable.getWidth(), printDrawable.getHeight(), 0);
+ printAWTTiles.renderer.attachAutoDrawable(printGLAD);
+ if( DEBUG ) {
+ System.err.println("AWT print.setup "+printAWTTiles);
+ System.err.println("AWT print.setup AA "+printNumSamples+", "+caps);
+ System.err.println("AWT print.setup printGLAD: "+printGLAD.getWidth()+"x"+printGLAD.getHeight()+", "+printGLAD);
+ System.err.println("AWT print.setup printDraw: "+printDrawable.getWidth()+"x"+printDrawable.getHeight()+", "+printDrawable);
+ }
+ }
+ };
+
+ @Override
+ public void releasePrint() {
+ if( !printActive || null == printGLAD ) {
+ throw new IllegalStateException("setupPrint() not called");
+ }
+ sendReshape = false; // clear reshape flag
+ AWTEDTExecutor.singleton.invoke(getTreeLock(), true /* allowOnNonEDT */, true /* wait */, releasePrintOnEDT);
+ }
+ private final Runnable releasePrintOnEDT = new Runnable() {
+ @Override
+ public void run() {
+ if( DEBUG ) {
+ System.err.println("AWT print.release "+printAWTTiles);
+ }
+ printAWTTiles.dispose();
+ printAWTTiles= null;
+ if( printGLAD != GLCanvas.this ) {
+ GLDrawableUtil.swapGLContextAndAllGLEventListener(printGLAD, GLCanvas.this);
+ printGLAD.destroy();
+ }
+ printGLAD = null;
+ if( null != printAnimator ) {
+ printAnimator.add(GLCanvas.this);
+ printAnimator = null;
+ }
+ sendReshape = true; // trigger reshape, i.e. gl-viewport and -listener - this component might got resized!
+ printActive = false;
+ display();
+ }
+ };
+
+ @Override
+ public void print(Graphics graphics) {
+ if( !printActive || null == printGLAD ) {
+ throw new IllegalStateException("setupPrint() not called");
+ }
+ if(DEBUG && !EventQueue.isDispatchThread()) {
+ System.err.println(getThreadName()+": Warning: GLCanvas print - not called from AWT-EDT");
+ // we cannot dispatch print on AWT-EDT due to printing internal locking ..
+ }
+ sendReshape = false; // clear reshape flag
+
+ final Graphics2D g2d = (Graphics2D)graphics;
+ try {
+ printAWTTiles.setupGraphics2DAndClipBounds(g2d, getWidth(), getHeight());
+ final TileRenderer tileRenderer = printAWTTiles.renderer;
+ if( DEBUG ) {
+ System.err.println("AWT print.0: "+tileRenderer);
+ }
+ if( !tileRenderer.eot() ) {
+ try {
+ do {
+ if( printGLAD != GLCanvas.this ) {
+ tileRenderer.display();
+ } else {
+ Threading.invoke(true, displayOnEDTAction, getTreeLock());
+ }
+ } while ( !tileRenderer.eot() );
+ if( DEBUG ) {
+ System.err.println("AWT print.1: "+printAWTTiles);
+ }
+ } finally {
+ tileRenderer.reset();
+ printAWTTiles.resetGraphics2D();
+ }
+ }
+ } catch (NoninvertibleTransformException nte) {
+ System.err.println("Catched: Inversion failed of: "+g2d.getTransform());
+ nte.printStackTrace();
+ }
+ if( DEBUG ) {
+ System.err.println("AWT print.X: "+printAWTTiles);
+ }
+ }
+
@Override
public void addGLEventListener(GLEventListener listener) {
helper.addGLEventListener(listener);
@@ -748,14 +965,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
public void setGLEventListenerInitState(GLEventListener listener, boolean initialized) {
helper.setGLEventListenerInitState(listener, initialized);
}
-
+
@Override
public GLEventListener disposeGLEventListener(GLEventListener listener, boolean remove) {
final DisposeGLEventListenerAction r = new DisposeGLEventListenerAction(listener, remove);
Threading.invoke(true, r, getTreeLock());
return r.listener;
}
-
+
@Override
public GLEventListener removeGLEventListener(GLEventListener listener) {
return helper.removeGLEventListener(listener);
@@ -790,7 +1007,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
public boolean invoke(final boolean wait, final List<GLRunnable> glRunnables) {
return helper.invoke(this, wait, glRunnables);
}
-
+
@Override
public GLContext setContext(GLContext newCtx, boolean destroyPrevCtx) {
final RecursiveLock _lock = lock;
@@ -809,7 +1026,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
public final GLDrawable getDelegatedDrawable() {
return drawable;
}
-
+
@Override
public GLContext getContext() {
return context;
@@ -891,7 +1108,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
final GLDrawable _drawable = drawable;
return null != _drawable ? _drawable.isGLOriented() : true;
}
-
+
@Override
public NativeSurface getNativeSurface() {
final GLDrawable _drawable = drawable;
@@ -935,15 +1152,15 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
public void run() {
final RecursiveLock _lock = lock;
_lock.lock();
- try {
+ try {
final GLAnimatorControl animator = getAnimator();
if(DEBUG) {
System.err.println(getThreadName()+": Info: destroyOnEDTAction() - START, hasContext " +
(null!=context) + ", hasDrawable " + (null!=drawable)+", "+animator);
- Thread.dumpStack();
+ // Thread.dumpStack();
}
-
+
final boolean animatorPaused;
if(null!=animator) {
// can't remove us from animator for recreational addNotify()
@@ -951,7 +1168,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
} else {
animatorPaused = false;
}
-
+
// OLS will be detached by disposeGL's context destruction below
if( null != context ) {
if( context.isCreated() ) {
@@ -979,11 +1196,11 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
if(animatorPaused) {
animator.resume();
}
-
+
if(DEBUG) {
System.err.println(getThreadName()+": dispose() - END, animator "+animator);
}
-
+
} finally {
_lock.unlock();
}
@@ -1012,7 +1229,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
jawtWindow=null;
}
-
+
if(null != awtConfig) {
final AbstractGraphicsConfiguration aconfig = awtConfig.getNativeGraphicsConfiguration();
final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
@@ -1030,7 +1247,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
awtConfig=null;
}
};
-
+
private final Runnable initAction = new Runnable() {
@Override
public void run() {
@@ -1087,12 +1304,12 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
private class DisposeGLEventListenerAction implements Runnable {
GLEventListener listener;
- private boolean remove;
+ private final boolean remove;
private DisposeGLEventListenerAction(GLEventListener listener, boolean remove) {
this.listener = listener;
this.remove = remove;
}
-
+
@Override
public void run() {
final RecursiveLock _lock = lock;
@@ -1104,7 +1321,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
}
};
-
+
// Disables the AWT's erasing of this Canvas's background on Windows
// in Java SE 6. This internal API is not available in previous
// releases, but the system property
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index 2a23def..fdacc5b 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -44,9 +44,11 @@ import java.awt.Color;
import java.awt.EventQueue;
import java.awt.FontMetrics;
import java.awt.Graphics;
+import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsEnvironment;
import java.awt.Rectangle;
+import java.awt.geom.NoninvertibleTransformException;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
@@ -60,6 +62,7 @@ import javax.media.nativewindow.WindowClosingProtocol;
import javax.media.opengl.DefaultGLCapabilitiesChooser;
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;
@@ -74,6 +77,7 @@ import javax.media.opengl.GLException;
import javax.media.opengl.GLFBODrawable;
import javax.media.opengl.GLProfile;
import javax.media.opengl.GLRunnable;
+import javax.media.opengl.GLSharedContextSetter;
import javax.media.opengl.Threading;
import javax.swing.JPanel;
@@ -82,43 +86,52 @@ import jogamp.opengl.GLContextImpl;
import jogamp.opengl.GLDrawableFactoryImpl;
import jogamp.opengl.GLDrawableHelper;
import jogamp.opengl.GLDrawableImpl;
+import jogamp.opengl.awt.AWTTilePainter;
import jogamp.opengl.awt.Java2D;
import jogamp.opengl.util.glsl.GLSLTextureRaster;
+
+import com.jogamp.common.util.awt.AWTEDTExecutor;
+import com.jogamp.nativewindow.awt.AWTPrintLifecycle;
import com.jogamp.nativewindow.awt.AWTWindowClosingProtocol;
import com.jogamp.opengl.FBObject;
+import com.jogamp.opengl.GLRendererQuirks;
import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes;
import com.jogamp.opengl.util.GLPixelBuffer.SingletonGLPixelBufferProvider;
+import com.jogamp.opengl.util.GLDrawableUtil;
import com.jogamp.opengl.util.GLPixelStorageModes;
+import com.jogamp.opengl.util.TileRenderer;
import com.jogamp.opengl.util.awt.AWTGLPixelBuffer;
import com.jogamp.opengl.util.awt.AWTGLPixelBuffer.AWTGLPixelBufferProvider;
import com.jogamp.opengl.util.awt.AWTGLPixelBuffer.SingleAWTGLPixelBufferProvider;
+import com.jogamp.opengl.util.texture.TextureState;
/** A lightweight Swing component which provides OpenGL rendering
support. Provided for compatibility with Swing user interfaces
when adding a heavyweight doesn't work either because of
Z-ordering or LayoutManager problems.
- <P>
+ <p>
The GLJPanel can be made transparent by creating it with a
GLCapabilities object with alpha bits specified and calling {@link
#setOpaque}(false). Pixels with resulting OpenGL alpha values less
- than 1.0 will be overlaid on any underlying Swing rendering. </P>
- <P>
+ than 1.0 will be overlaid on any underlying Swing rendering.
+ </p>
+ <p>
This component attempts to use hardware-accelerated rendering via FBO or pbuffers and
falls back on to software rendering if none of the former are available
using {@link GLDrawableFactory#createOffscreenDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int) GLDrawableFactory.createOffscreenDrawable(..)}.<br/>
- </P>
- <P>
+ </p>
+ <p>
In case FBO is used and GLSL is available, a fragment shader is utilized
to flip the FBO texture vertically. This hardware-accelerated step can be disabled via system property <code>jogl.gljpanel.noglsl</code>.
See <a href="#fboGLSLVerticalFlip">details here</a>.
- </P>
- <P>
+ </p>
+ <p>
The OpenGL path is concluded by copying the rendered pixels an {@link BufferedImage} via {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer) glReadPixels(..)}
for later Java2D composition.
</p>
<p>
In case the above mentioned GLSL vertical-flipping is not performed,
- {@link System#arraycopy(Object, int, Object, int, int) System.arraycopy(..)} is used line by line.
+ {@link System#arraycopy(Object, int, Object, int, int) System.arraycopy(..)} is used line by line.
This step causes more CPU load per frame and is not hardware-accelerated.
</p>
<p>
@@ -128,41 +141,47 @@ import com.jogamp.opengl.util.awt.AWTGLPixelBuffer.SingleAWTGLPixelBufferProvide
<P>
* Please read <a href="GLCanvas.html#java2dgl">Java2D OpenGL Remarks</a>.
* </P>
- *
- <a name="fboGLSLVerticalFlip"><h5>FBO / GLSL Vertical Flip</h5></a>
+ *
+ <a name="fboGLSLVerticalFlip"><h5>FBO / GLSL Vertical Flip</h5></a>
The FBO / GLSL code path uses one texture-unit and binds the FBO texture to it's active texture-target,
see {@link #setTextureUnit(int)} and {@link #getTextureUnit()}.
- If the application uses the same texture-unit, ensure it setup their texture properly, i.e. texture-unit bind, enable and then it's parameters,
- see {@link Texture#textureCallOrder Order of Texture Commands}.
+ <p>
+ The active and dedicated texture-unit's {@link GL#GL_TEXTURE_2D} state is preserved via {@link TextureState}.
+ See also {@link Texture#textureCallOrder Order of Texture Commands}.
+ </p>
+ <p>
+ The current gl-viewport is preserved.
+ </p>
+ <p>
+ <i>Warning (Bug 842)</i>: Certain GL states other than viewport and texture (see above)
+ influencing rendering, will also influence the GLSL vertical flip, e.g. {@link GL#glFrontFace(int) glFrontFace}({@link GL#GL_CCW}).
+ It is recommended to reset those states to default when leaving the {@link GLEventListener#display(GLAutoDrawable)} method!
+ We may change this behavior in the future, i.e. preserve all influencing states.
+ </p>
*/
@SuppressWarnings("serial")
-public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosingProtocol {
+public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosingProtocol, AWTPrintLifecycle, GLSharedContextSetter {
private static final boolean DEBUG;
private static final boolean DEBUG_VIEWPORT;
- private static final boolean USE_GLSL_TEXTURE_RASTERIZER;
+ private static final boolean USE_GLSL_TEXTURE_RASTERIZER;
/** Indicates whether the Java 2D OpenGL pipeline is requested by user. */
private static final boolean java2dOGLEnabledByProp;
-
+
/** Indicates whether the Java 2D OpenGL pipeline is enabled, resource-compatible and requested by user. */
private static final boolean useJava2DGLPipeline;
-
+
/** Indicates whether the Java 2D OpenGL pipeline's usage is error free. */
private static boolean java2DGLPipelineOK;
-
+
static {
Debug.initSingleton();
DEBUG = Debug.debug("GLJPanel");
DEBUG_VIEWPORT = Debug.isPropertyDefined("jogl.debug.GLJPanel.Viewport", true);
USE_GLSL_TEXTURE_RASTERIZER = !Debug.isPropertyDefined("jogl.gljpanel.noglsl", true);
-
- boolean enabled = false;
- final String sVal = System.getProperty("sun.java2d.opengl");
- if( null != sVal ) {
- enabled = Boolean.valueOf(sVal);
- }
- Debug.initSingleton();
+
+ boolean enabled = Debug.getBooleanProperty("sun.java2d.opengl", false);
java2dOGLEnabledByProp = enabled && !Debug.isPropertyDefined("jogl.gljpanel.noogl", true);
enabled = false;
@@ -184,7 +203,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
System.err.println("GLJPanel: java2DGLPipelineOK "+java2DGLPipelineOK);
}
}
-
+
private static SingleAWTGLPixelBufferProvider singleAWTGLPixelBufferProvider = null;
private static synchronized SingleAWTGLPixelBufferProvider getSingleAWTGLPixelBufferProvider() {
if( null == singleAWTGLPixelBufferProvider ) {
@@ -192,8 +211,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
return singleAWTGLPixelBufferProvider;
}
-
- private GLDrawableHelper helper = new GLDrawableHelper();
+
+ private final GLDrawableHelper helper = new GLDrawableHelper();
private volatile boolean isInitialized;
//
@@ -202,10 +221,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
private AWTGLPixelBufferProvider customPixelBufferProvider = null;
/** Single buffered offscreen caps */
private GLCapabilitiesImmutable offscreenCaps;
- private GLProfile glProfile;
- private GLDrawableFactoryImpl factory;
- private GLCapabilitiesChooser chooser;
- private GLContext shareWith;
+ private final GLProfile glProfile;
+ private final GLDrawableFactoryImpl factory;
+ private final GLCapabilitiesChooser chooser;
private int additionalCtxCreationFlags = 0;
// Lazy reshape notification: reshapeWidth -> panelWidth -> backend.width
@@ -219,25 +237,25 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
// Width of the actual GLJPanel: reshapeWidth -> panelWidth -> backend.width
private int panelWidth = 0;
private int panelHeight = 0;
-
+
// These are always set to (0, 0) except when the Java2D / OpenGL
// pipeline is active
private int viewportX;
private int viewportY;
private int requestedTextureUnit = 0; // default
-
+
// The backend in use
private volatile Backend backend;
// Used by all backends either directly or indirectly to hook up callbacks
- private Updater updater = new Updater();
+ private final Updater updater = new Updater();
private boolean oglPipelineUsable() {
return null == customPixelBufferProvider && useJava2DGLPipeline && java2DGLPipelineOK;
}
- private AWTWindowClosingProtocol awtWindowClosingProtocol =
+ private final AWTWindowClosingProtocol awtWindowClosingProtocol =
new AWTWindowClosingProtocol(this, new Runnable() {
@Override
public void run() {
@@ -268,16 +286,32 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
default set of capabilities is used. The GLCapabilitiesChooser
specifies the algorithm for selecting one of the available
GLCapabilities for the component; a DefaultGLCapabilitesChooser
+ is used if null is passed for this argument.
+ * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
+ */
+ public GLJPanel(GLCapabilitiesImmutable userCapsRequest, GLCapabilitiesChooser chooser)
+ throws GLException
+ {
+ this(userCapsRequest, chooser, null);
+ }
+
+ /** Creates a new GLJPanel component. The passed GLCapabilities
+ specifies the OpenGL capabilities for the component; if null, a
+ default set of capabilities is used. The GLCapabilitiesChooser
+ specifies the algorithm for selecting one of the available
+ GLCapabilities for the component; a DefaultGLCapabilitesChooser
is used if null is passed for this argument. The passed
GLContext specifies an OpenGL context with which to share
textures, display lists and other OpenGL state, and may be null
if sharing is not desired. See the note in the overview documentation on
- <a href="../../../overview-summary.html#SHARING">context sharing</a>.
+ <a href="../../../spec-overview.html#SHARING">context sharing</a>.
<P>
Note: Sharing cannot be enabled using J2D OpenGL FBO sharing,
since J2D GL Context must be shared and we can only share one context.
* @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
- */
+ * @deprecated Use {@link #GLJPanel(GLCapabilitiesImmutable, GLCapabilitiesChooser)}
+ * and set shared GLContext via {@link #setSharedContext(GLContext)} or {@link #setSharedAutoDrawable(GLAutoDrawable)}.
+ */
public GLJPanel(GLCapabilitiesImmutable userCapsRequest, GLCapabilitiesChooser chooser, GLContext shareWith)
throws GLException
{
@@ -298,11 +332,22 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
this.glProfile = offscreenCaps.getGLProfile();
this.factory = GLDrawableFactoryImpl.getFactoryImpl(glProfile);
this.chooser = ((chooser != null) ? chooser : new DefaultGLCapabilitiesChooser());
- this.shareWith = shareWith;
-
+ if( null != shareWith ) {
+ helper.setSharedContext(null, shareWith);
+ }
this.setFocusable(true); // allow keyboard input!
}
+ @Override
+ public final void setSharedContext(GLContext sharedContext) throws IllegalStateException {
+ helper.setSharedContext(this.getContext(), sharedContext);
+ }
+
+ @Override
+ public final void setSharedAutoDrawable(GLAutoDrawable sharedAutoDrawable) throws IllegalStateException {
+ helper.setSharedAutoDrawable(this, sharedAutoDrawable);
+ }
+
public AWTGLPixelBufferProvider getCustomPixelBufferProvider() { return customPixelBufferProvider; }
/**
@@ -319,12 +364,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
customPixelBufferProvider = custom;
}
-
+
@Override
public final Object getUpstreamWidget() {
return this;
}
-
+
@Override
public void display() {
if( isVisible() ) {
@@ -416,7 +461,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
createAndInitializeBackend();
}
- if (!isInitialized) {
+ if (!isInitialized || printActive) {
return;
}
@@ -424,15 +469,16 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
// involve destroying the pbuffer (current context) and
// re-creating it -- tricky to do properly while the context is
// current
- if (handleReshape) {
- handleReshape = false;
- sendReshape = handleReshape();
- }
+ if( !printActive ) {
+ if (handleReshape) {
+ handleReshape = false;
+ sendReshape = handleReshape();
+ }
- if( isVisible() ) {
- updater.setGraphics(g);
-
- backend.doPaintComponent(g);
+ if( isVisible() ) {
+ updater.setGraphics(g);
+ backend.doPaintComponent(g);
+ }
}
}
@@ -471,21 +517,206 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
which override this method must call super.reshape() in
their reshape() method in order to function properly. <P>
*
- * {@inheritDoc}
+ * {@inheritDoc}
*/
@SuppressWarnings("deprecation")
@Override
public void reshape(int x, int y, int width, int height) {
super.reshape(x, y, width, height);
- if (DEBUG) {
- System.err.println(getThreadName()+": GLJPanel.reshape: " +reshapeWidth+"x"+reshapeHeight + " -> " + width+"x"+height);
- }
- // reshapeX = x;
- // reshapeY = y;
- reshapeWidth = width;
- reshapeHeight = height;
- handleReshape = true;
+ if( DEBUG ) {
+ System.err.println(getThreadName()+": GLJPanel.reshape resize"+(printActive?"WithinPrint":"")+" [ panel "+
+ panelWidth+"x"+panelHeight +
+ ", reshape: " +reshapeWidth+"x"+reshapeHeight +
+ "] -> "+(printActive?"skipped":"") + width+"x"+height);
+ }
+ if( !printActive ) {
+ reshapeWidth = width;
+ reshapeHeight = height;
+ handleReshape = true;
+ }
+ }
+
+ private volatile boolean printActive = false;
+ private GLAnimatorControl printAnimator = null;
+ private GLAutoDrawable printGLAD = null;
+ private AWTTilePainter printAWTTiles = null;
+
+ @Override
+ public void setupPrint(double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight) {
+ printActive = true;
+ final int componentCount = isOpaque() ? 3 : 4;
+ final TileRenderer printRenderer = new TileRenderer();
+ printAWTTiles = new AWTTilePainter(printRenderer, componentCount, scaleMatX, scaleMatY, numSamples, tileWidth, tileHeight, DEBUG);
+ AWTEDTExecutor.singleton.invoke(getTreeLock(), true /* allowOnNonEDT */, true /* wait */, setupPrintOnEDT);
+ }
+ private final Runnable setupPrintOnEDT = new Runnable() {
+ @Override
+ public void run() {
+ if (backend == null || !isInitialized) {
+ createAndInitializeBackend();
+ }
+ if (!isInitialized) {
+ if(DEBUG) {
+ System.err.println(getThreadName()+": Info: GLJPanel setupPrint - skipped GL render, drawable not valid yet");
+ }
+ printActive = false;
+ return; // not yet available ..
+ }
+ if( !isVisible() ) {
+ if(DEBUG) {
+ System.err.println(getThreadName()+": Info: GLJPanel setupPrint - skipped GL render, drawable visible");
+ }
+ printActive = false;
+ return; // not yet available ..
+ }
+ sendReshape = false; // clear reshape flag
+ handleReshape = false; // ditto
+ printAnimator = helper.getAnimator();
+ if( null != printAnimator ) {
+ printAnimator.remove(GLJPanel.this);
+ }
+
+ printGLAD = GLJPanel.this; // default: re-use
+ final GLCapabilities caps = (GLCapabilities)getChosenGLCapabilities().cloneMutable();
+ final int printNumSamples = printAWTTiles.getNumSamples(caps);
+ GLDrawable printDrawable = printGLAD.getDelegatedDrawable();
+ final boolean reqNewGLADSamples = printNumSamples != caps.getNumSamples();
+ final boolean reqNewGLADSize = printAWTTiles.customTileWidth != -1 && printAWTTiles.customTileWidth != printDrawable.getWidth() ||
+ printAWTTiles.customTileHeight != -1 && printAWTTiles.customTileHeight != printDrawable.getHeight();
+ final boolean reqNewGLAD = reqNewGLADSamples || reqNewGLADSize ;
+ if( DEBUG ) {
+ System.err.println("AWT print.setup: reqNewGLAD "+reqNewGLAD+"[ samples "+reqNewGLADSamples+", size "+reqNewGLADSize+"], "+
+ ", drawableSize "+printDrawable.getWidth()+"x"+printDrawable.getHeight()+
+ ", customTileSize "+printAWTTiles.customTileWidth+"x"+printAWTTiles.customTileHeight+
+ ", scaleMat "+printAWTTiles.scaleMatX+" x "+printAWTTiles.scaleMatY+
+ ", numSamples "+printAWTTiles.customNumSamples+" -> "+printNumSamples+", printAnimator "+printAnimator);
+ }
+ if( reqNewGLAD ) {
+ caps.setDoubleBuffered(false);
+ caps.setOnscreen(false);
+ caps.setSampleBuffers(0 < printNumSamples);
+ caps.setNumSamples(printNumSamples);
+ final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
+ printGLAD = factory.createOffscreenAutoDrawable(null, caps, null,
+ printAWTTiles.customTileWidth != -1 ? printAWTTiles.customTileWidth : DEFAULT_PRINT_TILE_SIZE,
+ printAWTTiles.customTileHeight != -1 ? printAWTTiles.customTileHeight : DEFAULT_PRINT_TILE_SIZE);
+ GLDrawableUtil.swapGLContextAndAllGLEventListener(GLJPanel.this, printGLAD);
+ printDrawable = printGLAD.getDelegatedDrawable();
+ }
+ printAWTTiles.setIsGLOriented(printGLAD.isGLOriented());
+ printAWTTiles.renderer.setTileSize(printDrawable.getWidth(), printDrawable.getHeight(), 0);
+ printAWTTiles.renderer.attachAutoDrawable(printGLAD);
+ if( DEBUG ) {
+ System.err.println("AWT print.setup "+printAWTTiles);
+ System.err.println("AWT print.setup AA "+printNumSamples+", "+caps);
+ System.err.println("AWT print.setup printGLAD: "+printGLAD.getWidth()+"x"+printGLAD.getHeight()+", "+printGLAD);
+ System.err.println("AWT print.setup printDraw: "+printDrawable.getWidth()+"x"+printDrawable.getHeight()+", "+printDrawable);
+ }
+ }
+ };
+
+ @Override
+ public void releasePrint() {
+ if( !printActive ) {
+ throw new IllegalStateException("setupPrint() not called");
+ }
+ sendReshape = false; // clear reshape flag
+ handleReshape = false; // ditto
+ AWTEDTExecutor.singleton.invoke(getTreeLock(), true /* allowOnNonEDT */, true /* wait */, releasePrintOnEDT);
+ }
+
+ private final Runnable releasePrintOnEDT = new Runnable() {
+ @Override
+ public void run() {
+ if( DEBUG ) {
+ System.err.println(getThreadName()+": GLJPanel.releasePrintOnEDT.0 "+printAWTTiles);
+ }
+ printAWTTiles.dispose();
+ printAWTTiles= null;
+ if( printGLAD != GLJPanel.this ) {
+ GLDrawableUtil.swapGLContextAndAllGLEventListener(printGLAD, GLJPanel.this);
+ printGLAD.destroy();
+ }
+ printGLAD = null;
+ if( null != printAnimator ) {
+ printAnimator.add(GLJPanel.this);
+ printAnimator = null;
+ }
+
+ // 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 GLDrawable drawable = GLJPanel.this.getDelegatedDrawable();
+ if( awtWidth != panelWidth || awtHeight != panelHeight ||
+ drawable.getWidth() != panelWidth || drawable.getHeight() != panelHeight ) {
+ // -> !( awtSize == panelSize == drawableSize )
+ if ( DEBUG ) {
+ System.err.println(getThreadName()+": GLJPanel.releasePrintOnEDT.0: resizeWithinPrint panel " +panelWidth+"x"+panelHeight +
+ ", draw "+drawable.getWidth()+"x"+drawable.getHeight()+
+ " -> " + awtWidth+"x"+awtHeight);
+ }
+ reshapeWidth = awtWidth;
+ reshapeHeight = awtHeight;
+ sendReshape = handleReshape(); // reshapeSize -> panelSize, backend reshape w/ GL reshape
+ } else {
+ sendReshape = true; // only GL reshape
+ }
+ printActive = false;
+ display();
+ }
+ };
+
+ @Override
+ public void print(Graphics graphics) {
+ if( !printActive ) {
+ throw new IllegalStateException("setupPrint() not called");
+ }
+ if(DEBUG && !EventQueue.isDispatchThread()) {
+ System.err.println(getThreadName()+": Warning: GLCanvas print - not called from AWT-EDT");
+ // we cannot dispatch print on AWT-EDT due to printing internal locking ..
+ }
+ sendReshape = false; // clear reshape flag
+ handleReshape = false; // ditto
+
+ final Graphics2D g2d = (Graphics2D)graphics;
+ try {
+ printAWTTiles.setupGraphics2DAndClipBounds(g2d, getWidth(), getHeight());
+ final TileRenderer tileRenderer = printAWTTiles.renderer;
+ if( DEBUG ) {
+ System.err.println("AWT print.0: "+tileRenderer);
+ }
+ if( !tileRenderer.eot() ) {
+ try {
+ do {
+ if( printGLAD != GLJPanel.this ) {
+ tileRenderer.display();
+ } else {
+ backend.doPlainPaint();
+ }
+ } while ( !tileRenderer.eot() );
+ if( DEBUG ) {
+ System.err.println("AWT print.1: "+printAWTTiles);
+ }
+ } finally {
+ tileRenderer.reset();
+ printAWTTiles.resetGraphics2D();
+ }
+ }
+ } catch (NoninvertibleTransformException nte) {
+ System.err.println("Catched: Inversion failed of: "+g2d.getTransform());
+ nte.printStackTrace();
+ }
+ if( DEBUG ) {
+ System.err.println("AWT print.X: "+printAWTTiles);
+ }
+ }
+ @Override
+ protected void printComponent(Graphics g) {
+ if( DEBUG ) {
+ System.err.println("AWT printComponent.X: "+printAWTTiles);
+ }
+ print(g);
}
@Override
@@ -525,7 +756,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
public void setGLEventListenerInitState(GLEventListener listener, boolean initialized) {
helper.setGLEventListenerInitState(listener, initialized);
}
-
+
@Override
public GLEventListener disposeGLEventListener(GLEventListener listener, boolean remove) {
final DisposeGLEventListenerAction r = new DisposeGLEventListenerAction(listener, remove);
@@ -542,7 +773,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
return r.listener;
}
-
+
@Override
public GLEventListener removeGLEventListener(GLEventListener listener) {
return helper.removeGLEventListener(listener);
@@ -577,7 +808,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
public boolean invoke(final boolean wait, final List<GLRunnable> glRunnables) {
return helper.invoke(this, wait, glRunnables);
}
-
+
@Override
public GLContext createContext(GLContext shareWith) {
final Backend b = backend;
@@ -617,7 +848,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
return b.getDrawable();
}
-
+
@Override
public GLContext getContext() {
final Backend b = backend;
@@ -672,6 +903,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
// so swapping the buffers doesn't do anything. We also don't
// currently have the provision to skip copying the data to the
// Swing portion of the GLJPanel in any of the rendering paths.
+ if( printActive && isInitialized) {
+ final Backend b = backend;
+ if ( null != b ) {
+ b.getDrawable().swapBuffers();
+ }
+ }
}
@Override
@@ -708,7 +945,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
return b.getDrawable().isGLOriented();
}
-
+
@Override
public GLCapabilitiesImmutable getChosenGLCapabilities() {
final Backend b = backend;
@@ -746,11 +983,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
return factory;
}
- /**
+ /**
* Returns the used texture unit, i.e. a value of [0..n], or -1 if non used.
* <p>
* If implementation uses a texture-unit, it will be known only after the first initialization, i.e. display call.
- * </p>
+ * </p>
* <p>
* See <a href="#fboGLSLVerticalFlip">FBO / GLSL Vertical Flip</a>.
* </p>
@@ -760,9 +997,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
if ( null == b ) {
return -1;
}
- return b.getTextureUnit();
+ return b.getTextureUnit();
}
-
+
/**
* Allows user to request a texture unit to be used,
* must be called before the first initialization, i.e. {@link #display()} call.
@@ -772,14 +1009,14 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
* <p>
* See <a href="#fboGLSLVerticalFlip">FBO / GLSL Vertical Flip</a>.
* </p>
- *
+ *
* @param v requested texture unit
* @see #getTextureUnit()
*/
public final void setTextureUnit(int v) {
requestedTextureUnit = v;
}
-
+
//----------------------------------------------------------------------
// Internals only below this point
//
@@ -794,7 +1031,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
if (DEBUG) {
System.err.println(getThreadName()+": GLJPanel.createAndInitializeBackend: " +panelWidth+"x"+panelHeight + " -> " + reshapeWidth+"x"+reshapeHeight);
- }
+ }
// Pull down reshapeWidth and reshapeHeight into panelWidth and
// panelHeight eagerly in order to complete initialization, and
// force a reshape later
@@ -829,7 +1066,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
private boolean handleReshape() {
if (DEBUG) {
System.err.println(getThreadName()+": GLJPanel.handleReshape: " +panelWidth+"x"+panelHeight + " -> " + reshapeWidth+"x"+reshapeHeight);
- }
+ }
panelWidth = reshapeWidth;
panelHeight = reshapeHeight;
@@ -876,13 +1113,14 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
backend.postGL(g, true);
}
+ public void plainPaint(GLAutoDrawable drawable) {
+ helper.display(GLJPanel.this);
+ }
+
@Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
// This is handled above and dispatched directly to the appropriate context
}
-
- public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
- }
}
@Override
@@ -931,6 +1169,13 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
};
+ private final Runnable updaterPlainDisplayAction = new Runnable() {
+ @Override
+ public void run() {
+ updater.plainPaint(GLJPanel.this);
+ }
+ };
+
private final Runnable paintImmediatelyAction = new Runnable() {
@Override
public void run() {
@@ -940,7 +1185,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
private class DisposeGLEventListenerAction implements Runnable {
GLEventListener listener;
- private boolean remove;
+ private final boolean remove;
private DisposeGLEventListenerAction(GLEventListener listener, boolean remove) {
this.listener = listener;
this.remove = remove;
@@ -954,7 +1199,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
}
};
-
+
private int getGLInteger(GL gl, int which) {
int[] tmp = new int[1];
gl.glGetIntegerv(which, tmp, 0);
@@ -967,60 +1212,73 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
// Implementations of the various backends
//
- // Abstraction of the different rendering backends: i.e., pure
- // software / pixmap rendering, pbuffer-based acceleration, Java 2D
- // / JOGL bridge
+ /**
+ * Abstraction of the different rendering backends: i.e., pure
+ * software / pixmap rendering, pbuffer-based acceleration, Java 2D
+ * JOGL bridge
+ */
static interface Backend {
- // Create, Destroy, ..
+ /** Create, Destroy, .. */
public boolean isUsingOwnLifecycle();
- // Called each time the backend needs to initialize itself
+ /** Called each time the backend needs to initialize itself */
public void initialize();
- // Called when the backend should clean up its resources
+ /** Called when the backend should clean up its resources */
public void destroy();
- // Called when the opacity of the GLJPanel is changed
+ /** Called when the opacity of the GLJPanel is changed */
public void setOpaque(boolean opaque);
- // Called to manually create an additional OpenGL context against
- // this GLJPanel
+ /**
+ * Called to manually create an additional OpenGL context against
+ * this GLJPanel
+ */
public GLContext createContext(GLContext shareWith);
- // Called to set the current backend's GLContext
+ /** Called to set the current backend's GLContext */
public void setContext(GLContext ctx);
- // Called to get the current backend's GLContext
+ /** Called to get the current backend's GLContext */
public GLContext getContext();
- // Called to get the current backend's GLDrawable
+ /** Called to get the current backend's GLDrawable */
public GLDrawable getDrawable();
/** Returns the used texture unit, i.e. a value of [0..n], or -1 if non used. */
public int getTextureUnit();
-
- // Called to fetch the "real" GLCapabilities for the backend
+
+ /** Called to fetch the "real" GLCapabilities for the backend */
public GLCapabilitiesImmutable getChosenGLCapabilities();
- // Called to fetch the "real" GLProfile for the backend
+ /** Called to fetch the "real" GLProfile for the backend */
public GLProfile getGLProfile();
- // Called to handle a reshape event. When this is called, the
- // OpenGL context associated with the backend is not current, to
- // make it easier to destroy and re-create pbuffers if necessary.
+ /**
+ * Called to handle a reshape event. When this is called, the
+ * OpenGL context associated with the backend is not current, to
+ * make it easier to destroy and re-create pbuffers if necessary.
+ */
public boolean handleReshape();
- // Called before the OpenGL work is done in init() and display().
- // If false is returned, this render is aborted.
+ /**
+ * Called before the OpenGL work is done in init() and display().
+ * If false is returned, this render is aborted.
+ */
public boolean preGL(Graphics g);
- // Called after the OpenGL work is done in init() and display().
- // The isDisplay argument indicates whether this was called on
- // behalf of a call to display() rather than init().
+ /**
+ * Called after the OpenGL work is done in init() and display().
+ * The isDisplay argument indicates whether this was called on
+ * behalf of a call to display() rather than init().
+ */
public void postGL(Graphics g, boolean isDisplay);
- // Called from within paintComponent() to initiate the render
+ /** Called from within paintComponent() to initiate the render */
public void doPaintComponent(Graphics g);
+
+ /** Called from print .. no backend update desired onscreen */
+ public void doPlainPaint();
}
// Base class used by both the software (pixmap) and pbuffer
@@ -1030,26 +1288,27 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
private final AWTGLPixelBufferProvider pixelBufferProvider;
private final boolean useSingletonBuffer;
private AWTGLPixelBuffer pixelBuffer;
-
+ private BufferedImage alignedImage;
+
// One of these is used to store the read back pixels before storing
// in the BufferedImage
protected IntBuffer readBackIntsForCPUVFlip;
// Implementation using software rendering
- private GLDrawableImpl offscreenDrawable;
+ private volatile GLDrawableImpl offscreenDrawable; // volatile: avoid locking for read-only access
+ private boolean offscreenIsFBO;
private FBObject fboFlipped;
private GLSLTextureRaster glslTextureRaster;
-
- private GLContextImpl offscreenContext;
- private boolean flipVertical;
-
+
+ private volatile GLContextImpl offscreenContext; // volatile: avoid locking for read-only access
+ private boolean flipVertical;
+
// For saving/restoring of OpenGL state during ReadPixels
private final GLPixelStorageModes psm = new GLPixelStorageModes();
OffscreenBackend(GLProfile glp, AWTGLPixelBufferProvider custom) {
if(null == custom) {
- pixelBufferProvider = glp.isGL2GL3() ? getSingleAWTGLPixelBufferProvider() :
- new AWTGLPixelBufferProvider( false /* allowRowStride */ ) ;
+ pixelBufferProvider = getSingleAWTGLPixelBufferProvider();
} else {
pixelBufferProvider = custom;
}
@@ -1059,7 +1318,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
useSingletonBuffer = false;
}
}
-
+
@Override
public boolean isUsingOwnLifecycle() { return false; }
@@ -1069,20 +1328,33 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
System.err.println(getThreadName()+": OffscreenBackend: initialize()");
}
try {
+ final GLContext[] shareWith = { null };
+ if( helper.isSharedGLContextPending(shareWith) ) {
+ return; // pending ..
+ }
offscreenDrawable = (GLDrawableImpl) factory.createOffscreenDrawable(
null /* default platform device */,
offscreenCaps,
chooser,
panelWidth, panelHeight);
offscreenDrawable.setRealized(true);
- offscreenContext = (GLContextImpl) offscreenDrawable.createContext(shareWith);
+ offscreenContext = (GLContextImpl) offscreenDrawable.createContext(shareWith[0]);
offscreenContext.setContextCreationFlags(additionalCtxCreationFlags);
if( GLContext.CONTEXT_NOT_CURRENT < offscreenContext.makeCurrent() ) {
isInitialized = true;
final GL gl = offscreenContext.getGL();
flipVertical = offscreenDrawable.isGLOriented();
final GLCapabilitiesImmutable chosenCaps = offscreenDrawable.getChosenGLCapabilities();
- if( USE_GLSL_TEXTURE_RASTERIZER && chosenCaps.isFBO() && flipVertical && gl.isGL2ES2() ) {
+ offscreenIsFBO = chosenCaps.isFBO();
+ final boolean glslCompliant = !offscreenContext.hasRendererQuirk(GLRendererQuirks.GLSLNonCompliant);
+ final boolean useGLSLFlip = flipVertical && offscreenIsFBO && gl.isGL2ES2() && USE_GLSL_TEXTURE_RASTERIZER && glslCompliant;
+ if( DEBUG ) {
+ System.err.println(getThreadName()+": OffscreenBackend.initialize: useGLSLFlip "+useGLSLFlip+
+ " [flip "+flipVertical+", isFBO "+offscreenIsFBO+", isGL2ES2 "+gl.isGL2ES2()+
+ ", noglsl "+!USE_GLSL_TEXTURE_RASTERIZER+", glslNonCompliant "+!glslCompliant+
+ ", isGL2ES2 " + gl.isGL2ES2()+"]");
+ }
+ if( useGLSLFlip ) {
final boolean _autoSwapBufferMode = helper.getAutoSwapBufferMode();
helper.setAutoSwapBufferMode(false);
final GLFBODrawable fboDrawable = (GLFBODrawable) offscreenDrawable;
@@ -1110,11 +1382,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
} else {
fboFlipped = null;
glslTextureRaster = null;
- }
+ }
offscreenContext.release();
} else {
isInitialized = false;
- }
+ }
} finally {
if( !isInitialized ) {
if(null != offscreenContext) {
@@ -1135,7 +1407,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
System.err.println(getThreadName()+": OffscreenBackend: destroy() - offscreenContext: "+(null!=offscreenContext)+" - offscreenDrawable: "+(null!=offscreenDrawable));
}
if ( null != offscreenContext && offscreenContext.isCreated() ) {
- if( GLContext.CONTEXT_NOT_CURRENT < offscreenContext.makeCurrent() ) {
+ if( GLContext.CONTEXT_NOT_CURRENT < offscreenContext.makeCurrent() ) {
try {
final GL gl = offscreenContext.getGL();
if(null != glslTextureRaster) {
@@ -1153,7 +1425,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
glslTextureRaster = null;
fboFlipped = null;
offscreenContext = null;
-
+
if (offscreenDrawable != null) {
final AbstractGraphicsDevice adevice = offscreenDrawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice();
offscreenDrawable.setRealized(false);
@@ -1162,8 +1434,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
adevice.close();
}
}
-
- if( null != readBackIntsForCPUVFlip ) {
+ offscreenIsFBO = false;
+
+ if( null != readBackIntsForCPUVFlip ) {
readBackIntsForCPUVFlip.clear();
readBackIntsForCPUVFlip = null;
}
@@ -1173,6 +1446,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
pixelBuffer = null;
}
+ alignedImage = null;
}
@Override
@@ -1180,6 +1454,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
if ( opaque != isOpaque() && !useSingletonBuffer ) {
pixelBuffer.dispose();
pixelBuffer = null;
+ alignedImage = null;
}
}
@@ -1205,20 +1480,21 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
componentCount = 4;
alignment = 4;
}
-
- final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, componentCount);
-
- if( useSingletonBuffer ) { // attempt to fetch the latest AWTGLPixelBuffer
+
+ final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, componentCount);
+
+ if( useSingletonBuffer ) { // attempt to fetch the latest AWTGLPixelBuffer
pixelBuffer = (AWTGLPixelBuffer) ((SingletonGLPixelBufferProvider)pixelBufferProvider).getSingleBuffer(pixelAttribs);
}
if( null != pixelBuffer && pixelBuffer.requiresNewBuffer(gl, panelWidth, panelHeight, 0) ) {
pixelBuffer.dispose();
pixelBuffer = null;
+ alignedImage = null;
}
if ( null == pixelBuffer ) {
if (0 >= panelWidth || 0 >= panelHeight ) {
return;
- }
+ }
pixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, panelWidth, panelHeight, 1, true, 0);
if(DEBUG) {
System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: pixelBufferProvider isSingletonBufferProvider "+useSingletonBuffer+", 0x"+Integer.toHexString(pixelBufferProvider.hashCode())+", "+pixelBufferProvider.getClass().getSimpleName());
@@ -1227,8 +1503,17 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: panelSize "+panelWidth+"x"+panelHeight);
}
}
+ if( offscreenDrawable.getWidth() != panelWidth || offscreenDrawable.getHeight() != panelHeight ) {
+ throw new InternalError("OffscreenDrawable panelSize mismatch (reshape missed): panelSize "+panelWidth+"x"+panelHeight+" != drawable "+offscreenDrawable.getWidth()+"x"+offscreenDrawable.getHeight()+", on thread "+getThreadName());
+ }
+ if( null == alignedImage || panelWidth != alignedImage.getWidth() || panelHeight != alignedImage.getHeight() ) {
+ alignedImage = pixelBuffer.getAlignedImage(panelWidth, panelHeight);
+ if(DEBUG) {
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: alignedImage "+alignedImage.getWidth()+"x"+alignedImage.getHeight()+", pixelBuffer "+pixelBuffer.width+"x"+pixelBuffer.height);
+ }
+ }
final IntBuffer readBackInts;
-
+
if( !flipVertical || null != glslTextureRaster ) {
readBackInts = (IntBuffer) pixelBuffer.buffer;
} else {
@@ -1238,56 +1523,92 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
readBackInts = readBackIntsForCPUVFlip;
}
- if( DEBUG_VIEWPORT ) {
- int[] vp = new int[] { 0, 0, 0, 0 };
- gl.glGetIntegerv(GL.GL_VIEWPORT, vp, 0);
- System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL: Viewport: "+vp[0]+"/"+vp[1]+" "+vp[2]+"x"+vp[3]);
+ final TextureState usrTexState, fboTexState;
+ final int fboTexUnit = GL.GL_TEXTURE0 + ( offscreenIsFBO ? ((GLFBODrawable)offscreenDrawable).getTextureUnit() : 0 );
+
+ if( offscreenIsFBO ) {
+ usrTexState = new TextureState(gl, GL.GL_TEXTURE_2D);
+ if( fboTexUnit != usrTexState.getUnit() ) {
+ // glActiveTexture(..) + glBindTexture(..) are implicit performed in GLFBODrawableImpl's
+ // swapBuffers/contextMadeCurent -> swapFBOImpl.
+ // We need to cache the texture unit's bound texture-id before it's overwritten.
+ gl.glActiveTexture(fboTexUnit);
+ fboTexState = new TextureState(gl, fboTexUnit, GL.GL_TEXTURE_2D);
+ } else {
+ fboTexState = usrTexState;
+ }
+ } else {
+ usrTexState = null;
+ fboTexState = null;
}
-
+
// Must now copy pixels from offscreen context into surface
-
+
// Save current modes
psm.setAlignment(gl, alignment, alignment);
- if(gl.isGL2GL3()) {
- final GL2GL3 gl2gl3 = gl.getGL2GL3();
- gl2gl3.glPixelStorei(GL2GL3.GL_PACK_ROW_LENGTH, pixelBuffer.width);
- gl2gl3.glReadBuffer(gl2gl3.getDefaultReadBuffer());
+ if(gl.isGL2ES3()) {
+ final GL2ES3 gl2es3 = gl.getGL2ES3();
+ gl2es3.glPixelStorei(GL2ES3.GL_PACK_ROW_LENGTH, panelWidth);
+ gl2es3.glReadBuffer(gl2es3.getDefaultReadBuffer());
}
+ offscreenDrawable.swapBuffers();
+
if(null != glslTextureRaster) { // implies flippedVertical
- // perform vert-flipping via OpenGL/FBO
+ final boolean viewportChange;
+ final int[] usrViewport = new int[] { 0, 0, 0, 0 };
+ gl.glGetIntegerv(GL.GL_VIEWPORT, usrViewport, 0);
+ viewportChange = 0 != usrViewport[0] || 0 != usrViewport[1] ||
+ offscreenDrawable.getWidth() != usrViewport[2] || offscreenDrawable.getHeight() != usrViewport[3];
+ if( DEBUG_VIEWPORT ) {
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL: Viewport: change "+viewportChange+
+ ", "+usrViewport[0]+"/"+usrViewport[1]+" "+usrViewport[2]+"x"+usrViewport[3]+
+ " -> 0/0 "+offscreenDrawable.getWidth()+"x"+offscreenDrawable.getHeight());
+ }
+ if( viewportChange ) {
+ gl.glViewport(0, 0, offscreenDrawable.getWidth(), offscreenDrawable.getHeight());
+ }
+
+ // perform vert-flipping via OpenGL/FBO
final GLFBODrawable fboDrawable = (GLFBODrawable)offscreenDrawable;
final FBObject.TextureAttachment fboTex = fboDrawable.getTextureBuffer(GL.GL_FRONT);
-
- fboDrawable.swapBuffers();
+
fboFlipped.bind(gl);
-
+
// gl.glActiveTexture(GL.GL_TEXTURE0 + fboDrawable.getTextureUnit()); // implicit by GLFBODrawableImpl: swapBuffers/contextMadeCurent -> swapFBOImpl
gl.glBindTexture(GL.GL_TEXTURE_2D, fboTex.getName());
// gl.glClear(GL.GL_DEPTH_BUFFER_BIT); // fboFlipped runs w/o DEPTH!
+
glslTextureRaster.display(gl.getGL2ES2());
gl.glReadPixels(0, 0, panelWidth, panelHeight, pixelAttribs.format, pixelAttribs.type, readBackInts);
fboFlipped.unbind(gl);
+ if( viewportChange ) {
+ gl.glViewport(usrViewport[0], usrViewport[1], usrViewport[2], usrViewport[3]);
+ }
+ fboTexState.restore(gl);
} else {
gl.glReadPixels(0, 0, panelWidth, panelHeight, pixelAttribs.format, pixelAttribs.type, readBackInts);
-
+
if ( flipVertical ) {
// Copy temporary data into raster of BufferedImage for faster
// blitting Note that we could avoid this copy in the cases
// where !offscreenDrawable.isGLOriented(),
// but that's the software rendering path which is very slow anyway.
- final BufferedImage image = pixelBuffer.image;
+ final BufferedImage image = alignedImage;
final int[] src = readBackInts.array();
final int[] dest = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
- final int incr = pixelBuffer.width;
+ final int incr = panelWidth;
int srcPos = 0;
- int destPos = (panelHeight - 1) * pixelBuffer.width;
+ int destPos = (panelHeight - 1) * panelWidth;
for (; destPos >= 0; srcPos += incr, destPos -= incr) {
System.arraycopy(src, srcPos, dest, destPos, incr);
}
}
}
+ if( offscreenIsFBO && fboTexUnit != usrTexState.getUnit() ) {
+ usrTexState.restore(gl);
+ }
// Restore saved modes.
psm.restore(gl);
@@ -1296,7 +1617,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
// correctness on all platforms
}
}
-
+
@Override
public int getTextureUnit() {
if(null != glslTextureRaster && null != offscreenDrawable) { // implies flippedVertical
@@ -1308,32 +1629,25 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
@Override
public void doPaintComponent(Graphics g) {
helper.invokeGL(offscreenDrawable, offscreenContext, updaterDisplayAction, updaterInitAction);
-
- if ( null != pixelBuffer ) {
- final BufferedImage image = pixelBuffer.image;
+
+ if ( null != alignedImage ) {
// Draw resulting image in one shot
- g.drawImage(image, 0, 0, image.getWidth(), image.getHeight(), null); // Null ImageObserver since image data is ready.
+ g.drawImage(alignedImage, 0, 0, alignedImage.getWidth(), alignedImage.getHeight(), null); // Null ImageObserver since image data is ready.
}
}
@Override
+ public void doPlainPaint() {
+ helper.invokeGL(offscreenDrawable, offscreenContext, updaterPlainDisplayAction, updaterInitAction);
+ }
+
+ @Override
public boolean handleReshape() {
- /** FIXME: Shall we utilize such resize optimization (snippet kept alive from removed pbuffer backend) ?
- // Use factor larger than 2 during shrinks for some hysteresis
- float shrinkFactor = 2.5f;
- if ( (panelWidth > readBackWidthInPixels) || (panelHeight > readBackHeightInPixels) ||
- (panelWidth < (readBackWidthInPixels / shrinkFactor)) || (panelHeight < (readBackHeightInPixels / shrinkFactor))) {
- if (DEBUG) {
- System.err.println(getThreadName()+": Resizing offscreen from (" + readBackWidthInPixels + ", " + readBackHeightInPixels + ") " +
- " to fit (" + panelWidth + ", " + panelHeight + ")");
- }
- } */
-
GLDrawableImpl _drawable = offscreenDrawable;
{
final GLDrawableImpl _drawableNew = GLDrawableHelper.resizeOffscreenDrawable(_drawable, offscreenContext, panelWidth, panelHeight);
if(_drawable != _drawableNew) {
- // write back
+ // write back
_drawable = _drawableNew;
offscreenDrawable = _drawableNew;
}
@@ -1343,9 +1657,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
panelWidth = _drawable.getWidth();
panelHeight = _drawable.getHeight();
-
+
if( null != glslTextureRaster ) {
- if( GLContext.CONTEXT_NOT_CURRENT < offscreenContext.makeCurrent() ) {
+ if( GLContext.CONTEXT_NOT_CURRENT < offscreenContext.makeCurrent() ) {
try {
final GL gl = offscreenContext.getGL();
fboFlipped.reset(gl, _drawable.getWidth(), _drawable.getHeight(), 0, false);
@@ -1357,7 +1671,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
return _drawable.isRealized();
}
-
+
@Override
public GLContext createContext(GLContext shareWith) {
return (null != offscreenDrawable) ? offscreenDrawable.createContext(shareWith) : null;
@@ -1411,11 +1725,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
private GLContext joglContext;
// State captured from Java2D OpenGL context necessary in order to
// properly render into Java2D back buffer
- private int[] drawBuffer = new int[1];
- private int[] readBuffer = new int[1];
+ private final int[] drawBuffer = new int[1];
+ private final int[] readBuffer = new int[1];
// This is required when the FBO option of the Java2D / OpenGL
// pipeline is active
- private int[] frameBuffer = new int[1];
+ private final int[] frameBuffer = new int[1];
// Current (as of this writing) NVidia drivers have a couple of bugs
// relating to the sharing of framebuffer and renderbuffer objects
// between contexts. It appears we have to (a) reattach the color
@@ -1507,7 +1821,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
@Override
public int getTextureUnit() { return -1; }
-
+
@Override
public GLCapabilitiesImmutable getChosenGLCapabilities() {
// FIXME: should do better than this; is it possible to using only platform-independent code?
@@ -1829,6 +2143,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
});
}
+ @Override
+ public void doPlainPaint() {
+ helper.invokeGL(joglDrawable, joglContext, updaterPlainDisplayAction, updaterInitAction);
+ }
+
private void captureJ2DState(GL gl, Graphics g) {
gl.glGetIntegerv(GL2.GL_DRAW_BUFFER, drawBuffer, 0);
gl.glGetIntegerv(GL2.GL_READ_BUFFER, readBuffer, 0);
diff --git a/src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java b/src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java
index 9fee0a2..b4d7883 100644
--- a/src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java
+++ b/src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java
@@ -58,18 +58,18 @@ public interface GLMatrixFunc {
* which is the same behavior than the native JOGL GL impl
*/
public void glGetFloatv(int pname, java.nio.FloatBuffer params);
-
+
/**
* Copy the named matrix to the given storage at offset.
* @param pname {@link #GL_MODELVIEW_MATRIX}, {@link #GL_PROJECTION_MATRIX} or {@link #GL_TEXTURE_MATRIX}
* @param params storage
* @param params_offset storage offset
- */
+ */
public void glGetFloatv(int pname, float[] params, int params_offset);
-
+
/**
* glGetIntegerv
- * @param pname {@link #GL_MATRIX_MODE} to receive the current matrix mode
+ * @param pname {@link #GL_MATRIX_MODE} to receive the current matrix mode
* @param params the FloatBuffer's position remains unchanged
* which is the same behavior than the native JOGL GL impl
*/
@@ -89,7 +89,7 @@ public interface GLMatrixFunc {
* </p>
*/
public void glPushMatrix();
-
+
/**
* Pop the current matrix from it's stack.
* @see #glPushMatrix()
@@ -97,19 +97,19 @@ public interface GLMatrixFunc {
public void glPopMatrix();
/**
- * Load the current matrix with the identity matrix
+ * Load the current matrix with the identity matrix
*/
public void glLoadIdentity() ;
/**
- * Load the current matrix w/ the provided one.
+ * Load the current matrix w/ the provided one.
* @param params the FloatBuffer's position remains unchanged,
* which is the same behavior than the native JOGL GL impl
*/
- public void glLoadMatrixf(java.nio.FloatBuffer m) ;
+ public void glLoadMatrixf(java.nio.FloatBuffer m) ;
/**
* Load the current matrix w/ the provided one.
- */
+ */
public void glLoadMatrixf(float[] m, int m_offset);
/**
diff --git a/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java b/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java
index 786835f..4aff24b 100644
--- a/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java
+++ b/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java
@@ -31,7 +31,7 @@ package javax.media.opengl.fixedfunc;
import javax.media.opengl.*;
-public interface GLPointerFunc {
+public interface GLPointerFunc {
public static final int GL_VERTEX_ARRAY = 0x8074;
public static final int GL_NORMAL_ARRAY = 0x8075;
public static final int GL_COLOR_ARRAY = 0x8076;
diff --git a/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java b/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java
index 79ec38e..9bd6442 100644
--- a/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java
+++ b/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java
@@ -28,7 +28,7 @@
package javax.media.opengl.fixedfunc;
-public class GLPointerFuncUtil {
+public class GLPointerFuncUtil {
public static final String mgl_Vertex = "mgl_Vertex";
public static final String mgl_Normal = "mgl_Normal";
public static final String mgl_Color = "mgl_Color";
@@ -37,16 +37,16 @@ public class GLPointerFuncUtil {
/**
* @param glArrayIndex the fixed function array index
- * @return default fixed function array name
+ * @return default fixed function array name
*/
public static String getPredefinedArrayIndexName(int glArrayIndex) {
return getPredefinedArrayIndexName(glArrayIndex, -1);
}
-
+
/**
* @param glArrayIndex the fixed function array index
- * @param multiTexCoordIndex index for multiTexCoordIndex
- * @return default fixed function array name
+ * @param multiTexCoordIndex index for multiTexCoordIndex
+ * @return default fixed function array name
*/
public static String getPredefinedArrayIndexName(int glArrayIndex, int multiTexCoordIndex) {
switch(glArrayIndex) {
diff --git a/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java b/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java
index bd12dfb..15a7bb2 100644
--- a/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java
+++ b/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java
@@ -64,20 +64,32 @@ package javax.media.opengl.glu;
*/
public class GLUtessellatorCallbackAdapter implements GLUtessellatorCallback {
+ @Override
public void begin(int type) {}
+ @Override
public void edgeFlag(boolean boundaryEdge) {}
+ @Override
public void vertex(Object vertexData) {}
+ @Override
public void end() {}
// public void mesh(jogamp.opengl.tessellator.GLUmesh mesh) {}
+ @Override
public void error(int errnum) {}
+ @Override
public void combine(double[] coords, Object[] data,
float[] weight, Object[] outData) {}
+ @Override
public void beginData(int type, Object polygonData) {}
+ @Override
public void edgeFlagData(boolean boundaryEdge,
Object polygonData) {}
+ @Override
public void vertexData(Object vertexData, Object polygonData) {}
+ @Override
public void endData(Object polygonData) {}
+ @Override
public void errorData(int errnum, Object polygonData) {}
+ @Override
public void combineData(double[] coords, Object[] data,
float[] weight, Object[] outData,
Object polygonData) {}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RegionFactory.java b/src/jogl/classes/jogamp/graph/curve/opengl/RegionFactory.java
index 1f59b58..515583b 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/RegionFactory.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/RegionFactory.java
@@ -30,20 +30,20 @@ package jogamp.graph.curve.opengl;
import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.GLRegion;
-/** RegionFactory to create a Context specific Region implementation.
- *
+/** RegionFactory to create a Context specific Region implementation.
+ *
* @see GLRegion
*/
public class RegionFactory {
-
+
/**
* Create a Region using the passed render mode
- *
+ *
* <p> In case {@link Region#VBAA_RENDERING_BIT} is being requested the default texture unit
* {@link Region#TWO_PASS_DEFAULT_TEXTURE_UNIT} is being used.</p>
- *
+ *
* @param rs the RenderState to be used
- * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, {@link Region#VBAA_RENDERING_BIT}
+ * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, {@link Region#VBAA_RENDERING_BIT}
*/
public static GLRegion create(int renderModes) {
if( 0 != ( Region.VBAA_RENDERING_BIT & renderModes ) ){
@@ -53,18 +53,18 @@ public class RegionFactory {
return new VBORegionSPES2(renderModes);
}
}
-
+
/** Create a Single Pass Region using the passed render mode
- * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT},
+ * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT},
* {@link Region#VBAA_RENDERING_BIT}
* @return
*/
public static GLRegion createSinglePass(int renderModes) {
return new VBORegionSPES2(renderModes);
}
-
+
/** Create a Two Pass (VBAA) Region using the passed render mode
- * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT},
+ * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT},
* {@link Region#VBAA_RENDERING_BIT}
* @return
*/
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
index 7f5afcd..012b1d1 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/RegionRendererImpl01.java
@@ -43,12 +43,13 @@ import com.jogamp.opengl.util.glsl.ShaderState;
public class RegionRendererImpl01 extends RegionRenderer {
public RegionRendererImpl01(RenderState rs, int renderModes) {
super(rs, renderModes);
-
+
}
-
+
+ @Override
protected boolean initShaderProgram(GL2ES2 gl) {
final ShaderState st = rs.getShaderState();
-
+
final ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, RegionRendererImpl01.class, "shader",
"shader/bin", getVertexShaderName(), true);
final ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, RegionRendererImpl01.class, "shader",
@@ -57,29 +58,29 @@ public class RegionRendererImpl01 extends RegionRenderer {
// rsFp.defaultShaderCustomization(gl, true, true);
int pos = rsFp.addGLSLVersion(gl);
if( gl.isGLES2() ) {
- pos = rsFp.insertShaderSource(0, pos, ShaderCode.extOESDerivativesEnable);
+ pos = rsFp.insertShaderSource(0, pos, ShaderCode.extOESDerivativesEnable);
}
final String rsFpDefPrecision = getFragmentShaderPrecision(gl);
if( null != rsFpDefPrecision ) {
rsFp.insertShaderSource(0, pos, rsFpDefPrecision);
}
-
+
final ShaderProgram sp = new ShaderProgram();
sp.add(rsVp);
sp.add(rsFp);
- if( !sp.init(gl) ) {
+ if( !sp.init(gl) ) {
throw new GLException("RegionRenderer: Couldn't init program: "+sp);
}
- st.attachShaderProgram(gl, sp, false);
+ st.attachShaderProgram(gl, sp, false);
st.bindAttribLocation(gl, AttributeNames.VERTEX_ATTR_IDX, AttributeNames.VERTEX_ATTR_NAME);
- st.bindAttribLocation(gl, AttributeNames.TEXCOORD_ATTR_IDX, AttributeNames.TEXCOORD_ATTR_NAME);
-
+ st.bindAttribLocation(gl, AttributeNames.TEXCOORD_ATTR_IDX, AttributeNames.TEXCOORD_ATTR_NAME);
+
if(!sp.link(gl, System.err)) {
throw new GLException("RegionRenderer: Couldn't link program: "+sp);
- }
+ }
st.useProgram(gl, true);
-
+
if(DEBUG) {
System.err.println("RegionRendererImpl01 initialized: " + Thread.currentThread()+" "+st);
}
@@ -94,5 +95,5 @@ public class RegionRendererImpl01 extends RegionRenderer {
@Override
protected void drawImpl(GL2ES2 gl, Region region, float[] position, int[] texSize) {
((GLRegion)region).draw(gl, rs, vp_width, vp_height, texSize);
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java b/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java
index 51356ca..fe2dd73 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/RenderStateImpl.java
@@ -38,9 +38,9 @@ import com.jogamp.graph.geom.Vertex;
import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.opengl.util.glsl.ShaderState;
-public class RenderStateImpl extends RenderState {
+public class RenderStateImpl extends RenderState {
/**
- * weight is equivalent to the
+ * weight is equivalent to the
* global off-curve vertex weight.
* TODO: change to per vertex
*/
@@ -50,7 +50,7 @@ public class RenderStateImpl extends RenderState {
public RenderStateImpl(ShaderState st, Vertex.Factory<? extends Vertex> pointFactory, PMVMatrix pmvMatrix) {
super(st, pointFactory, pmvMatrix);
-
+
gcu_Weight = new GLUniformData(UniformNames.gcu_Weight, 1.0f);
st.ownUniform(gcu_PMVMatrix);
gcu_Alpha = new GLUniformData(UniformNames.gcu_Alpha, 1.0f);
@@ -60,15 +60,18 @@ public class RenderStateImpl extends RenderState {
// gcu_Strength = new GLUniformData(UniformNames.gcu_Strength, 3.0f);
// st.ownUniform(gcu_Strength);
}
-
+
public RenderStateImpl(ShaderState st, Vertex.Factory<? extends Vertex> pointFactory) {
this(st, pointFactory, new PMVMatrix());
}
-
+
+ @Override
public final GLUniformData getWeight() { return gcu_Weight; }
+ @Override
public final GLUniformData getAlpha() { return gcu_Alpha; }
+ @Override
public final GLUniformData getColorStatic() { return gcu_ColorStatic; }
//public final GLUniformData getStrength() { return gcu_Strength; }
-
-
+
+
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
index 81c4213..60758b9 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/TextRendererImpl01.java
@@ -40,11 +40,11 @@ import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.glsl.ShaderState;
-public class TextRendererImpl01 extends TextRenderer {
+public class TextRendererImpl01 extends TextRenderer {
public TextRendererImpl01(RenderState rs, int type) {
- super(rs, type);
+ super(rs, type);
}
-
+
@Override
protected boolean initShaderProgram(GL2ES2 gl){
final ShaderState st = rs.getShaderState();
@@ -63,18 +63,18 @@ public class TextRendererImpl01 extends TextRenderer {
if( null != rsFpDefPrecision ) {
rsFp.insertShaderSource(0, pos, rsFpDefPrecision);
}
-
+
final ShaderProgram sp = new ShaderProgram();
sp.add(rsVp);
sp.add(rsFp);
-
- if( !sp.init(gl) ) {
+
+ if( !sp.init(gl) ) {
throw new GLException("RegionRenderer: Couldn't init program: "+sp);
}
- st.attachShaderProgram(gl, sp, false);
+ st.attachShaderProgram(gl, sp, false);
st.bindAttribLocation(gl, AttributeNames.VERTEX_ATTR_IDX, AttributeNames.VERTEX_ATTR_NAME);
- st.bindAttribLocation(gl, AttributeNames.TEXCOORD_ATTR_IDX, AttributeNames.TEXCOORD_ATTR_NAME);
-
+ st.bindAttribLocation(gl, AttributeNames.TEXCOORD_ATTR_IDX, AttributeNames.TEXCOORD_ATTR_NAME);
+
if(!sp.link(gl, System.err)) {
throw new GLException("TextRendererImpl01: Couldn't link program: "+sp);
}
@@ -82,15 +82,15 @@ public class TextRendererImpl01 extends TextRenderer {
if(DEBUG) {
System.err.println("TextRendererImpl01 initialized: " + Thread.currentThread()+" "+st);
- }
+ }
return true;
}
-
+
@Override
protected void destroyImpl(GL2ES2 gl) {
super.destroyImpl(gl);
}
-
+
@Override
public void drawString3D(GL2ES2 gl, Font font, String str, float[] position, int fontSize, int[/*1*/] texSize) {
if(!isInitialized()){
@@ -101,7 +101,7 @@ public class TextRendererImpl01 extends TextRenderer {
glyphString = createString(gl, font, fontSize, str);
addCachedGlyphString(gl, font, str, fontSize, glyphString);
}
-
+
glyphString.renderString3D(gl, rs, vp_width, vp_height, texSize);
}
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
index 85d3ad5..77c862e 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PES2.java
@@ -30,7 +30,7 @@ package jogamp.graph.curve.opengl;
import java.nio.FloatBuffer;
import javax.media.opengl.GL2ES2;
-// FIXME: Subsume GL2GL3.GL_DRAW_FRAMEBUFFER -> GL2ES2.GL_DRAW_FRAMEBUFFER !
+// FIXME: Subsume GL2GL3.GL_DRAW_FRAMEBUFFER -> GL2ES2.GL_DRAW_FRAMEBUFFER !
import javax.media.opengl.GL;
import javax.media.opengl.GLUniformData;
import javax.media.opengl.fixedfunc.GLMatrixFunc;
@@ -58,90 +58,91 @@ public class VBORegion2PES2 extends GLRegion {
private GLArrayDataServer verticeFboAttr;
private GLArrayDataServer texCoordFboAttr;
private GLArrayDataServer indicesFbo;
-
-
+
+
private FBObject fbo;
private TextureAttachment texA;
private PMVMatrix fboPMVMatrix;
GLUniformData mgl_fboPMVMatrix;
-
+
private int tex_width_c = 0;
private int tex_height_c = 0;
- GLUniformData mgl_ActiveTexture;
+ GLUniformData mgl_ActiveTexture;
GLUniformData mgl_TextureSize; // if GLSL < 1.30
-
+
public VBORegion2PES2(int renderModes, int textureEngine) {
super(renderModes);
fboPMVMatrix = new PMVMatrix();
- mgl_fboPMVMatrix = new GLUniformData(UniformNames.gcu_PMVMatrix, 4, 4, fboPMVMatrix.glGetPMvMatrixf());
- mgl_ActiveTexture = new GLUniformData(UniformNames.gcu_TextureUnit, textureEngine);
+ mgl_fboPMVMatrix = new GLUniformData(UniformNames.gcu_PMVMatrix, 4, 4, fboPMVMatrix.glGetPMvMatrixf());
+ mgl_ActiveTexture = new GLUniformData(UniformNames.gcu_TextureUnit, textureEngine);
}
-
+
+ @Override
public void update(GL2ES2 gl, RenderState rs) {
if(!isDirty()) {
- return;
+ return;
}
if(null == indicesFbo) {
final int initialElementCount = 256;
final ShaderState st = rs.getShaderState();
-
- indicesFbo = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
+
+ indicesFbo = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
indicesFbo.puts((short) 0); indicesFbo.puts((short) 1); indicesFbo.puts((short) 3);
indicesFbo.puts((short) 1); indicesFbo.puts((short) 2); indicesFbo.puts((short) 3);
indicesFbo.seal(true);
-
- texCoordFboAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT,
+
+ texCoordFboAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT,
false, initialElementCount, GL.GL_STATIC_DRAW);
st.ownAttribute(texCoordFboAttr, true);
- texCoordFboAttr.putf(5); texCoordFboAttr.putf(5);
- texCoordFboAttr.putf(5); texCoordFboAttr.putf(6);
- texCoordFboAttr.putf(6); texCoordFboAttr.putf(6);
- texCoordFboAttr.putf(6); texCoordFboAttr.putf(5);
+ texCoordFboAttr.putf(5); texCoordFboAttr.putf(5);
+ texCoordFboAttr.putf(5); texCoordFboAttr.putf(6);
+ texCoordFboAttr.putf(6); texCoordFboAttr.putf(6);
+ texCoordFboAttr.putf(6); texCoordFboAttr.putf(5);
texCoordFboAttr.seal(true);
-
- verticeFboAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
- false, initialElementCount, GL.GL_STATIC_DRAW);
+
+ verticeFboAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
+ false, initialElementCount, GL.GL_STATIC_DRAW);
st.ownAttribute(verticeFboAttr, true);
-
-
- indicesTxt = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
-
- verticeTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
+
+
+ indicesTxt = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
+
+ verticeTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
false, initialElementCount, GL.GL_STATIC_DRAW);
st.ownAttribute(verticeTxtAttr, true);
-
- texCoordTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT,
+
+ texCoordTxtAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT,
false, initialElementCount, GL.GL_STATIC_DRAW);
st.ownAttribute(texCoordTxtAttr, true);
-
+
if(DEBUG_INSTANCE) {
System.err.println("VBORegion2PES2 Create: " + this);
- }
+ }
}
// process triangles
indicesTxt.seal(gl, false);
- indicesTxt.rewind();
+ indicesTxt.rewind();
for(int i=0; i<triangles.size(); i++) {
final Triangle t = triangles.get(i);
final Vertex[] t_vertices = t.getVertices();
-
+
if(t_vertices[0].getId() == Integer.MAX_VALUE){
t_vertices[0].setId(numVertices++);
t_vertices[1].setId(numVertices++);
t_vertices[2].setId(numVertices++);
-
+
vertices.add(t_vertices[0]);
vertices.add(t_vertices[1]);
vertices.add(t_vertices[2]);
-
+
indicesTxt.puts((short) t_vertices[0].getId());
indicesTxt.puts((short) t_vertices[1].getId());
indicesTxt.puts((short) t_vertices[2].getId());
} else {
indicesTxt.puts((short) t_vertices[0].getId());
indicesTxt.puts((short) t_vertices[1].getId());
- indicesTxt.puts((short) t_vertices[2].getId());
+ indicesTxt.puts((short) t_vertices[2].getId());
}
}
indicesTxt.seal(gl, true);
@@ -157,43 +158,44 @@ public class VBORegion2PES2 extends GLRegion {
final Vertex v = vertices.get(i);
verticeTxtAttr.putf(v.getX());
verticeTxtAttr.putf(v.getY());
- verticeTxtAttr.putf(v.getZ());
- box.resize(v.getX(), v.getY(), v.getZ());
-
+ verticeTxtAttr.putf(v.getZ());
+ box.resize(v.getX(), v.getY(), v.getZ());
+
final float[] tex = v.getTexCoord();
texCoordTxtAttr.putf(tex[0]);
- texCoordTxtAttr.putf(tex[1]);
+ texCoordTxtAttr.putf(tex[1]);
}
texCoordTxtAttr.seal(gl, true);
texCoordTxtAttr.enableBuffer(gl, false);
- verticeTxtAttr.seal(gl, true);
+ verticeTxtAttr.seal(gl, true);
verticeTxtAttr.enableBuffer(gl, false);
-
+
// update all bbox related data
verticeFboAttr.seal(gl, false);
- verticeFboAttr.rewind();
- verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]);
- verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]);
- verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]);
- verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]);
- verticeFboAttr.seal(gl, true);
+ verticeFboAttr.rewind();
+ verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]);
+ verticeFboAttr.putf(box.getLow()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]);
+ verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getHigh()[1]); verticeFboAttr.putf(box.getLow()[2]);
+ verticeFboAttr.putf(box.getHigh()[0]); verticeFboAttr.putf(box.getLow()[1]); verticeFboAttr.putf(box.getLow()[2]);
+ verticeFboAttr.seal(gl, true);
verticeFboAttr.enableBuffer(gl, false);
-
+
fboPMVMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
fboPMVMatrix.glLoadIdentity();
fboPMVMatrix.glOrthof(box.getLow()[0], box.getHigh()[0], box.getLow()[1], box.getHigh()[1], -1, 1);
-
+
// push data 2 GPU ..
indicesFbo.seal(gl, true);
indicesFbo.enableBuffer(gl, false);
-
+
setDirty(false);
-
+
// the buffers were disabled, since due to real/fbo switching and other vbo usage
}
-
+
int[] maxTexSize = new int[] { -1 } ;
-
+
+ @Override
protected void drawImpl(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth) {
if(vp_width <=0 || vp_height <= 0 || null==texWidth || texWidth[0] <= 0){
renderRegion(gl);
@@ -205,54 +207,54 @@ public class VBORegion2PES2 extends GLRegion {
if(texWidth[0] > maxTexSize[0]) {
texWidth[0] = maxTexSize[0]; // clip to max - write-back user value!
}
- renderRegion2FBO(gl, rs, texWidth);
+ renderRegion2FBO(gl, rs, texWidth);
}
// System.out.println("Scale: " + matrix.glGetMatrixf().get(1+4*3) +" " + matrix.glGetMatrixf().get(2+4*3));
renderFBO(gl, rs, vp_width, vp_height);
}
}
-
+
private void renderFBO(GL2ES2 gl, RenderState rs, int width, int hight) {
final ShaderState st = rs.getShaderState();
-
- gl.glViewport(0, 0, width, hight);
- st.uniform(gl, mgl_ActiveTexture);
+
+ gl.glViewport(0, 0, width, hight);
+ st.uniform(gl, mgl_ActiveTexture);
gl.glActiveTexture(GL.GL_TEXTURE0 + mgl_ActiveTexture.intValue());
- fbo.use(gl, texA);
- verticeFboAttr.enableBuffer(gl, true);
- texCoordFboAttr.enableBuffer(gl, true);
+ fbo.use(gl, texA);
+ verticeFboAttr.enableBuffer(gl, true);
+ texCoordFboAttr.enableBuffer(gl, true);
indicesFbo.bindBuffer(gl, true); // keeps VBO binding
-
+
gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesFbo.getElementCount() * indicesFbo.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
-
- indicesFbo.bindBuffer(gl, false);
+
+ indicesFbo.bindBuffer(gl, false);
texCoordFboAttr.enableBuffer(gl, false);
- verticeFboAttr.enableBuffer(gl, false);
+ verticeFboAttr.enableBuffer(gl, false);
fbo.unuse(gl);
-
+
// setback: gl.glActiveTexture(currentActiveTextureEngine[0]);
}
-
+
private void renderRegion2FBO(GL2ES2 gl, RenderState rs, int[/*1*/] texWidth) {
final ShaderState st = rs.getShaderState();
-
+
if(0>=texWidth[0]) {
throw new IllegalArgumentException("texWidth must be greater than 0: "+texWidth[0]);
}
-
+
tex_width_c = texWidth[0];
tex_height_c = (int) ( ( ( tex_width_c * box.getHeight() ) / box.getWidth() ) + 0.5f );
-
+
// System.out.println("FBO Size: "+texWidth[0]+" -> "+tex_width_c+"x"+tex_height_c);
// System.out.println("FBO Scale: " + m.glGetMatrixf().get(0) +" " + m.glGetMatrixf().get(5));
-
+
if(null != fbo && fbo.getWidth() != tex_width_c && fbo.getHeight() != tex_height_c ) {
fbo.reset(gl, tex_width_c, tex_height_c);
}
-
- if(null == fbo) {
+
+ if(null == fbo) {
fbo = new FBObject();
- fbo.reset(gl, tex_width_c, tex_height_c);
+ fbo.reset(gl, tex_width_c, tex_height_c);
// FIXME: shall not use bilinear, due to own AA ? However, w/o bilinear result is not smooth
texA = fbo.attachTexture2D(gl, 0, true, GL2ES2.GL_LINEAR, GL2ES2.GL_LINEAR, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE);
// texA = fbo.attachTexture2D(gl, 0, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE);
@@ -260,18 +262,18 @@ public class VBORegion2PES2 extends GLRegion {
} else {
fbo.bind(gl);
}
-
+
//render texture
gl.glViewport(0, 0, tex_width_c, tex_height_c);
st.uniform(gl, mgl_fboPMVMatrix); // use orthogonal matrix
-
+
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT);
renderRegion(gl);
fbo.unbind(gl);
-
+
st.uniform(gl, rs.getPMVMatrix()); // switch back to real PMV matrix
-
+
// if( !gl.isGL3() ) {
// GLSL < 1.30
if(null == mgl_TextureSize) {
@@ -281,21 +283,22 @@ public class VBORegion2PES2 extends GLRegion {
texSize.put(0, (float)fbo.getWidth());
texSize.put(1, (float)fbo.getHeight());
st.uniform(gl, mgl_TextureSize);
- //}
+ //}
}
-
+
private void renderRegion(GL2ES2 gl) {
- verticeTxtAttr.enableBuffer(gl, true);
+ verticeTxtAttr.enableBuffer(gl, true);
texCoordTxtAttr.enableBuffer(gl, true);
indicesTxt.bindBuffer(gl, true); // keeps VBO binding
-
+
gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesTxt.getElementCount() * indicesTxt.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
-
- indicesTxt.bindBuffer(gl, false);
+
+ indicesTxt.bindBuffer(gl, false);
texCoordTxtAttr.enableBuffer(gl, false);
- verticeTxtAttr.enableBuffer(gl, false);
+ verticeTxtAttr.enableBuffer(gl, false);
}
-
+
+ @Override
public void destroy(GL2ES2 gl, RenderState rs) {
if(DEBUG_INSTANCE) {
System.err.println("VBORegion2PES2 Destroy: " + this);
@@ -305,7 +308,7 @@ public class VBORegion2PES2 extends GLRegion {
fbo.destroy(gl);
fbo = null;
texA = null;
- }
+ }
if(null != verticeTxtAttr) {
st.ownAttribute(verticeTxtAttr, false);
verticeTxtAttr.destroy(gl);
@@ -335,6 +338,6 @@ public class VBORegion2PES2 extends GLRegion {
indicesFbo = null;
}
triangles.clear();
- vertices.clear();
- }
+ vertices.clear();
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
index 0cba444..9feb18a 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
@@ -44,13 +44,14 @@ public class VBORegionSPES2 extends GLRegion {
private GLArrayDataServer texCoordAttr = null;
private GLArrayDataServer indices = null;
- protected VBORegionSPES2(int renderModes) {
+ protected VBORegionSPES2(int renderModes) {
super(renderModes);
}
+ @Override
protected void update(GL2ES2 gl, RenderState rs) {
if(!isDirty()) {
- return;
+ return;
}
if(null == indices) {
@@ -59,11 +60,11 @@ public class VBORegionSPES2 extends GLRegion {
indices = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER);
- verticeAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
- false, initialElementCount, GL.GL_STATIC_DRAW);
+ verticeAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT,
+ false, initialElementCount, GL.GL_STATIC_DRAW);
st.ownAttribute(verticeAttr, true);
- texCoordAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT,
+ texCoordAttr = GLArrayDataServer.createGLSL(AttributeNames.TEXCOORD_ATTR_NAME, 2, GL2ES2.GL_FLOAT,
false, initialElementCount, GL.GL_STATIC_DRAW);
st.ownAttribute(texCoordAttr, true);
@@ -74,7 +75,7 @@ public class VBORegionSPES2 extends GLRegion {
// process triangles
indices.seal(gl, false);
- indices.rewind();
+ indices.rewind();
for(int i=0; i<triangles.size(); i++) {
final Triangle t = triangles.get(i);
final Vertex[] t_vertices = t.getVertices();
@@ -102,7 +103,7 @@ public class VBORegionSPES2 extends GLRegion {
// process vertices and update bbox
box.reset();
- verticeAttr.seal(gl, false);
+ verticeAttr.seal(gl, false);
verticeAttr.rewind();
texCoordAttr.seal(gl, false);
texCoordAttr.rewind();
@@ -110,14 +111,14 @@ public class VBORegionSPES2 extends GLRegion {
final Vertex v = vertices.get(i);
verticeAttr.putf(v.getX());
verticeAttr.putf(v.getY());
- verticeAttr.putf(v.getZ());
+ verticeAttr.putf(v.getZ());
box.resize(v.getX(), v.getY(), v.getZ());
final float[] tex = v.getTexCoord();
texCoordAttr.putf(tex[0]);
texCoordAttr.putf(tex[1]);
}
- verticeAttr.seal(gl, true);
+ verticeAttr.seal(gl, true);
verticeAttr.enableBuffer(gl, false);
texCoordAttr.seal(gl, true);
texCoordAttr.enableBuffer(gl, false);
@@ -125,22 +126,24 @@ public class VBORegionSPES2 extends GLRegion {
setDirty(false);
}
+ @Override
protected void drawImpl(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth) {
- verticeAttr.enableBuffer(gl, true);
- texCoordAttr.enableBuffer(gl, true);
+ verticeAttr.enableBuffer(gl, true);
+ texCoordAttr.enableBuffer(gl, true);
indices.bindBuffer(gl, true); // keeps VBO binding
-
+
gl.glDrawElements(GL2ES2.GL_TRIANGLES, indices.getElementCount() * indices.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0);
-
+
indices.bindBuffer(gl, false);
texCoordAttr.enableBuffer(gl, false);
- verticeAttr.enableBuffer(gl, false);
- }
+ verticeAttr.enableBuffer(gl, false);
+ }
+ @Override
public final void destroy(GL2ES2 gl, RenderState rs) {
if(DEBUG_INSTANCE) {
System.err.println("VBORegionSPES2 Destroy: " + this);
- }
+ }
final ShaderState st = rs.getShaderState();
if(null != verticeAttr) {
st.ownAttribute(verticeAttr, false);
@@ -156,5 +159,5 @@ public class VBORegionSPES2 extends GLRegion {
indices.destroy(gl);
indices = null;
}
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java b/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java
index 8a109c3..b466617 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/AttributeNames.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -37,9 +37,9 @@ public class AttributeNames {
*/
public static final int TEXCOORD_ATTR_IDX = 1;
public static final String TEXCOORD_ATTR_NAME = "gca_TexCoords";
-
+
/** The color index in an OGL object
*/
public static final int COLOR_ATTR_IDX = 2;
- public static final String COLOR_ATTR_NAME = "gca_Colors";
+ public static final String COLOR_ATTR_NAME = "gca_Colors";
}
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java b/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java
index ab6e0dc..ce23aad 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/UniformNames.java
@@ -3,7 +3,7 @@ package jogamp.graph.curve.opengl.shader;
public class UniformNames {
public static final String gcu_PMVMatrix = "gcu_PMVMatrix"; // gcu_PMVMatrix[3]; // P, Mv, and Mvi
public static final String gcu_ColorStatic = "gcu_ColorStatic";
- public static final String gcu_Alpha = "gcu_Alpha";
+ public static final String gcu_Alpha = "gcu_Alpha";
public static final String gcu_Weight = "gcu_Weight";
public static final String gcu_TextureUnit = "gcu_TextureUnit";
public static final String gcu_TextureSize = "gcu_TextureSize";
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java
index e96c559..a60f91b 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java
@@ -39,46 +39,48 @@ import com.jogamp.opengl.math.VectorUtil;
import jogamp.opengl.Debug;
-/** Constrained Delaunay Triangulation
+/** Constrained Delaunay Triangulation
* implementation of a list of Outlines that define a set of
* Closed Regions with optional n holes.
- *
+ *
*/
public class CDTriangulator2D implements Triangulator{
protected static final boolean DEBUG = Debug.debug("Triangulation");
-
+
private float sharpness = 0.5f;
private ArrayList<Loop> loops;
private ArrayList<Vertex> vertices;
-
+
private ArrayList<Triangle> triangles;
private int maxTriID = 0;
-
+
/** Constructor for a new Delaunay triangulator
*/
public CDTriangulator2D() {
reset();
}
-
+
/** Reset the triangulation to initial state
* Clearing cached data
*/
+ @Override
public void reset() {
maxTriID = 0;
vertices = new ArrayList<Vertex>();
triangles = new ArrayList<Triangle>(3);
loops = new ArrayList<Loop>();
}
-
+
+ @Override
public void addCurve(Outline polyline) {
Loop loop = null;
-
+
if(!loops.isEmpty()) {
loop = getContainerLoop(polyline);
}
-
+
if(loop == null) {
GraphOutline outline = new GraphOutline(polyline);
GraphOutline innerPoly = extractBoundaryTriangles(outline, false);
@@ -92,8 +94,9 @@ public class CDTriangulator2D implements Triangulator{
loop.addConstraintCurve(innerPoly);
}
}
-
- public ArrayList<Triangle> generate() {
+
+ @Override
+ public ArrayList<Triangle> generate() {
for(int i=0;i<loops.size();i++) {
Loop loop = loops.get(i);
int numTries = 0;
@@ -140,16 +143,16 @@ public class CDTriangulator2D implements Triangulator{
GraphVertex gv0 = outVertices.get((i+size-1)%size);
GraphVertex gv2 = outVertices.get((i+1)%size);
GraphVertex gv1 = currentVertex;
-
+
if(!currentVertex.getPoint().isOnCurve()) {
Vertex v0 = gv0.getPoint().clone();
Vertex v2 = gv2.getPoint().clone();
Vertex v1 = gv1.getPoint().clone();
-
+
gv0.setBoundaryContained(true);
gv1.setBoundaryContained(true);
gv2.setBoundaryContained(true);
-
+
final Triangle t;
final boolean holeLike;
if(VectorUtil.ccw(v0,v1,v2)) {
@@ -184,7 +187,7 @@ public class CDTriangulator2D implements Triangulator{
}
return innerOutline;
}
-
+
private Loop getContainerLoop(Outline polyline) {
ArrayList<Vertex> vertices = polyline.getVertices();
for(int i=0; i < loops.size(); i++) {
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java b/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java
index c8251af..2e8d4f5 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java
@@ -35,13 +35,13 @@ import com.jogamp.graph.geom.Vertex;
public class GraphOutline {
final private Outline outline;
final private ArrayList<GraphVertex> controlpoints = new ArrayList<GraphVertex>(3);
-
+
public GraphOutline(){
this.outline = new Outline();
}
-
+
/**Create a control polyline of control vertices
- * the curve pieces can be identified by onCurve flag
+ * the curve pieces can be identified by onCurve flag
* of each cp the control polyline is open by default
*/
public GraphOutline(Outline ol){
@@ -59,7 +59,7 @@ public class GraphOutline {
public ArrayList<GraphVertex> getGraphPoint() {
return controlpoints;
}
-
+
public ArrayList<Vertex> getVertices() {
return outline.getVertices();
}
@@ -68,5 +68,5 @@ public class GraphOutline {
controlpoints.add(v);
outline.addVertex(v.getPoint());
}
-
+
}
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java b/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java
index 52d02ba..1ef1d8c 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java
@@ -35,7 +35,7 @@ public class GraphVertex {
private Vertex point;
private ArrayList<HEdge> edges = null;
private boolean boundaryContained = false;
-
+
public GraphVertex(Vertex point) {
this.point = point;
}
@@ -43,15 +43,15 @@ public class GraphVertex {
public Vertex getPoint() {
return point;
}
-
+
public float getX(){
return point.getX();
}
-
+
public float getY(){
return point.getY();
}
-
+
public float getZ(){
return point.getZ();
}
@@ -70,7 +70,7 @@ public class GraphVertex {
public void setEdges(ArrayList<HEdge> edges) {
this.edges = edges;
}
-
+
public void addEdge(HEdge edge){
if(edges == null){
edges = new ArrayList<HEdge>();
@@ -112,7 +112,7 @@ public class GraphVertex {
}
return null;
}
-
+
public boolean isBoundaryContained() {
return boundaryContained;
}
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java b/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java
index 4d29a81..acaa3d7 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/HEdge.java
@@ -35,14 +35,14 @@ public class HEdge {
public static int BOUNDARY = 3;
public static int INNER = 1;
public static int HOLE = 2;
-
+
private GraphVertex vert;
private HEdge prev = null;
private HEdge next = null;
private HEdge sibling = null;
private int type = BOUNDARY;
private Triangle triangle = null;
-
+
public HEdge(GraphVertex vert, int type) {
this.vert = vert;
this.type = type;
@@ -112,19 +112,19 @@ public class HEdge {
public void setTriangle(Triangle triangle) {
this.triangle = triangle;
}
-
+
public static <T extends Vertex> void connect(HEdge first, HEdge next){
first.setNext(next);
next.setPrev(first);
}
-
+
public static <T extends Vertex> void makeSiblings(HEdge first, HEdge second){
first.setSibling(second);
second.setSibling(first);
}
-
+
public boolean vertexOnCurveVertex(){
return vert.getPoint().isOnCurve();
}
-
+
}
diff --git a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
index 6511790..c1dafc0 100644
--- a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
+++ b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java
@@ -51,7 +51,7 @@ public class Loop {
public Triangle cut(boolean delaunay){
if(isSimplex()){
- Triangle t = new Triangle(root.getGraphPoint().getPoint(), root.getNext().getGraphPoint().getPoint(),
+ Triangle t = new Triangle(root.getGraphPoint().getPoint(), root.getNext().getGraphPoint().getPoint(),
root.getNext().getNext().getGraphPoint().getPoint());
t.setVerticesBoundary(checkVerticesBoundary(root));
return t;
@@ -103,20 +103,20 @@ public class Loop {
throw new IllegalArgumentException("outline's vertices < 3: " + vertices.size());
}
final VectorUtil.Winding hasWinding = VectorUtil.getWinding(
- vertices.get(0).getPoint(),
+ vertices.get(0).getPoint(),
vertices.get(1).getPoint(),
vertices.get(2).getPoint());
//FIXME: handle case when vertices come inverted - Rami
// skips inversion CW -> CCW
final boolean invert = hasWinding != reqWinding &&
reqWinding == VectorUtil.Winding.CW;
-
+
final int max;
final int edgeType = reqWinding == VectorUtil.Winding.CCW ? HEdge.BOUNDARY : HEdge.HOLE ;
int index;
HEdge firstEdge = null;
HEdge lastEdge = null;
-
+
if(!invert) {
max = vertices.size();
index = 0;
@@ -160,7 +160,7 @@ public class Loop {
public void addConstraintCurve(GraphOutline polyline) {
// GraphOutline outline = new GraphOutline(polyline);
/**needed to generate vertex references.*/
- initFromPolyline(polyline, VectorUtil.Winding.CW);
+ initFromPolyline(polyline, VectorUtil.Winding.CW);
GraphVertex v3 = locateClosestVertex(polyline);
HEdge v3Edge = v3.findBoundEdge();
@@ -180,9 +180,9 @@ public class Loop {
HEdge.connect(crossEdgeSib, root);
}
- /** Locates the vertex and update the loops root
- * to have (root + vertex) as closest pair
- * @param polyline the control polyline
+ /** Locates the vertex and update the loops root
+ * to have (root + vertex) as closest pair
+ * @param polyline the control polyline
* to search for closestvertices
* @return the vertex that is closest to the newly set root Hedge.
*/
@@ -205,7 +205,7 @@ public class Loop {
for (GraphVertex vert:vertices){
if(vert == v || vert == nextV || vert == cand)
continue;
- inValid = VectorUtil.inCircle(v.getPoint(), nextV.getPoint(),
+ inValid = VectorUtil.inCircle(v.getPoint(), nextV.getPoint(),
cand.getPoint(), vert.getPoint());
if(inValid){
break;
@@ -243,8 +243,8 @@ public class Loop {
Vertex cand = candEdge.getGraphPoint().getPoint();
HEdge e = candEdge.getNext();
while (e != candEdge){
- if(e.getGraphPoint() == root.getGraphPoint()
- || e.getGraphPoint() == next.getGraphPoint()
+ if(e.getGraphPoint() == root.getGraphPoint()
+ || e.getGraphPoint() == next.getGraphPoint()
|| e.getGraphPoint().getPoint() == cand){
e = e.getNext();
continue;
@@ -311,15 +311,15 @@ public class Loop {
(v.getX() < (v2.getX() - v1.getX()) * (v.getY() - v1.getY()) / (v2.getY() - v1.getY()) + v1.getX()) ){
inside = !inside;
}
-
+
current = next;
next = current.getNext();
-
+
} while(current != root);
-
+
return inside;
}
-
+
public int computeLoopSize(){
int size = 0;
HEdge e = root;
diff --git a/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java b/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java
index 751a7e7..ff46c33 100644
--- a/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java
+++ b/src/jogl/classes/jogamp/graph/curve/text/GlyphShape.java
@@ -37,17 +37,17 @@ import com.jogamp.graph.curve.OutlineShape;
import com.jogamp.opengl.math.Quaternion;
public class GlyphShape {
-
+
private Quaternion quat= null;
private OutlineShape shape = null;
-
+
/** Create a new Glyph shape
* based on Parametric curve control polyline
*/
public GlyphShape(Vertex.Factory<? extends Vertex> factory){
shape = new OutlineShape(factory);
}
-
+
/** Create a new GlyphShape from a {@link OutlineShape}
* @param factory vertex impl factory {@link Factory}
* @param shape {@link OutlineShape} representation of the Glyph
@@ -57,24 +57,24 @@ public class GlyphShape {
this.shape = shape;
this.shape.transformOutlines(OutlineShape.VerticesState.QUADRATIC_NURBS);
}
-
+
public final Vertex.Factory<? extends Vertex> vertexFactory() { return shape.vertexFactory(); }
-
+
public OutlineShape getShape() {
return shape;
}
-
+
public int getNumVertices() {
return shape.getVertices().size();
}
-
+
/** Get the rotational Quaternion attached to this Shape
* @return the Quaternion Object
*/
public Quaternion getQuat() {
return quat;
}
-
+
/** Set the Quaternion that shall defien the rotation
* of this shape.
* @param quat
@@ -82,7 +82,7 @@ public class GlyphShape {
public void setQuat(Quaternion quat) {
this.quat = quat;
}
-
+
/** Triangluate the glyph shape
* @return ArrayList of triangles which define this shape
*/
@@ -95,5 +95,5 @@ public class GlyphShape {
*/
public ArrayList<Vertex> getVertices(){
return shape.getVertices();
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java b/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java
index cc850b8..2284ab6 100644
--- a/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java
+++ b/src/jogl/classes/jogamp/graph/curve/text/GlyphString.java
@@ -52,51 +52,51 @@ public class GlyphString {
* <p>The actual font size shall be accomplished by the GL PMV matrix.</p>
*/
public static final int STATIC_FONT_SIZE = 10;
-
+
private ArrayList<GlyphShape> glyphs = new ArrayList<GlyphShape>();
private CharSequence str;
private String fontname;
private GLRegion region;
-
+
private SVertex origin = new SVertex();
/**
* <p>Uses {@link #STATIC_FONT_SIZE}.</p>
* <p>No caching is performed.</p>
- *
+ *
* @param shape is not null, add all {@link GlyphShape}'s {@link Outline} to this instance.
* @param vertexFactory vertex impl factory {@link Factory}
- * @param font the target {@link Font}
+ * @param font the target {@link Font}
* @param str string text
* @return the created {@link GlyphString} instance
*/
public static GlyphString createString(OutlineShape shape, Factory<? extends Vertex> vertexFactory, Font font, String str) {
- return createString(shape, vertexFactory, font, STATIC_FONT_SIZE, str);
+ return createString(shape, vertexFactory, font, STATIC_FONT_SIZE, str);
}
-
+
/**
* <p>No caching is performed.</p>
- *
+ *
* @param shape is not null, add all {@link GlyphShape}'s {@link Outline} to this instance.
* @param vertexFactory vertex impl factory {@link Factory}
- * @param font the target {@link Font}
+ * @param font the target {@link Font}
* @param fontSize font size
* @param str string text
* @return the created {@link GlyphString} instance
*/
public static GlyphString createString(OutlineShape shape, Factory<? extends Vertex> vertexFactory, Font font, int fontSize, String str) {
ArrayList<OutlineShape> shapes = ((FontInt)font).getOutlineShapes(str, fontSize, vertexFactory);
-
+
GlyphString glyphString = new GlyphString(font.getName(Font.NAME_UNIQUNAME), str);
glyphString.createfromOutlineShapes(vertexFactory, shapes);
if(null != shape) {
for(int i=0; i<glyphString.glyphs.size(); i++) {
shape.addOutlineShape(glyphString.glyphs.get(i).getShape());
- }
+ }
}
return glyphString;
}
-
+
/** Create a new GlyphString object
* @param fontname the name of the font that this String is
* associated with
@@ -106,18 +106,18 @@ public class GlyphString {
this.fontname = fontname;
this.str = str;
}
-
+
public void addGlyphShape(GlyphShape glyph){
glyphs.add(glyph);
}
-
+
public CharSequence getString(){
return str;
}
- /**Creates the Curve based Glyphs from a list of {@link OutlineShape}
+ /**Creates the Curve based Glyphs from a list of {@link OutlineShape}
* @param vertexFactory vertex impl factory {@link Factory}
- * @param shapes list of {@link OutlineShape}
+ * @param shapes list of {@link OutlineShape}
*/
public void createfromOutlineShapes(Factory<? extends Vertex> vertexFactory, ArrayList<OutlineShape> shapes) {
final int numGlyps = shapes.size();
@@ -126,31 +126,31 @@ public class GlyphString {
continue;
}
GlyphShape glyphShape = new GlyphShape(vertexFactory, shapes.get(index));
-
+
if(glyphShape.getNumVertices() < 3) {
continue;
- }
+ }
addGlyphShape(glyphShape);
}
}
-
-
+
+
/** Generate a OGL Region to represent this Object.
* @param gl the current gl object
* @param rs the current attached RenderState
- * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, {@link Region#VBAA_RENDERING_BIT}
+ * @param renderModes bit-field of modes, e.g. {@link Region#VARIABLE_CURVE_WEIGHT_BIT}, {@link Region#VBAA_RENDERING_BIT}
*/
public GLRegion createRegion(GL2ES2 gl, int renderModes){
region = RegionFactory.create(renderModes);
// region.setFlipped(true);
-
+
int numVertices = region.getNumVertices();
-
+
for(int i=0; i< glyphs.size(); i++) {
final GlyphShape glyph = glyphs.get(i);
ArrayList<Triangle> gtris = glyph.triangulate();
region.addTriangles(gtris);
-
+
final ArrayList<Vertex> gVertices = glyph.getVertices();
for(int j=0; j<gVertices.size(); j++) {
final Vertex gVert = gVertices.get(j);
@@ -160,8 +160,8 @@ public class GlyphString {
}
return region;
}
-
- /** Generate a Hashcode for this object
+
+ /** Generate a Hashcode for this object
* @return a string defining the hashcode
*/
public String getTextHashCode(){
@@ -180,15 +180,15 @@ public class GlyphString {
* @param rs the RenderState to be used
* @param vp_width current screen width
* @param vp_height current screen height
- * @param texWidth desired texture width for multipass-rendering.
+ * @param texWidth desired texture width for multipass-rendering.
* The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched.
*/
public void renderString3D(GL2ES2 gl, RenderState rs, int vp_width, int vp_height, int[/*1*/] texWidth) {
region.draw(gl, rs, vp_width, vp_height, texWidth);
}
-
+
/** Get the Origin of this GlyphString
- * @return
+ * @return
*/
public Vertex getOrigin() {
return origin;
@@ -206,7 +206,7 @@ public class GlyphString {
}
glyphs.clear();
}
-
+
public AABBox getBounds(){
return region.getBounds();
}
diff --git a/src/jogl/classes/jogamp/graph/font/FontInt.java b/src/jogl/classes/jogamp/graph/font/FontInt.java
index 20e1ec0..4366724 100644
--- a/src/jogl/classes/jogamp/graph/font/FontInt.java
+++ b/src/jogl/classes/jogamp/graph/font/FontInt.java
@@ -40,7 +40,7 @@ public interface FontInt extends Font {
public interface GlyphInt extends Font.Glyph {
public Path2D getPath(); // unscaled path
- public Path2D getPath(float pixelSize);
+ public Path2D getPath(float pixelSize);
}
public ArrayList<OutlineShape> getOutlineShapes(CharSequence string, float pixelSize, Factory<? extends Vertex> vertexFactory);
diff --git a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java
index 3736c5f..e3df0af 100644
--- a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java
+++ b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java
@@ -40,16 +40,16 @@ import com.jogamp.graph.font.FontSet;
import com.jogamp.graph.font.FontFactory;
public class JavaFontLoader implements FontSet {
-
- // FIXME: Add cache size to limit memory usage
+
+ // FIXME: Add cache size to limit memory usage
private static final IntObjectHashMap fontMap = new IntObjectHashMap();
-
+
private static final FontSet fontLoader = new JavaFontLoader();
public static FontSet get() {
return fontLoader;
}
-
+
final static String availableFontFileNames[] =
{
/* 00 */ "LucidaBrightRegular.ttf",
@@ -61,11 +61,12 @@ public class JavaFontLoader implements FontSet {
/* 06 */ "LucidaTypewriterRegular.ttf",
/* 07 */ "LucidaTypewriterBold.ttf",
};
-
+
final String javaFontPath;
-
+
private JavaFontLoader() {
final String javaHome = AccessController.doPrivileged(new PrivilegedAction<String>() {
+ @Override
public String run() {
return System.getProperty("java.home");
}
@@ -80,11 +81,13 @@ public class JavaFontLoader implements FontSet {
static boolean is(int bits, int bit) {
return 0 != ( bits & bit ) ;
}
-
+
+ @Override
public Font getDefault() throws IOException {
- return get(FAMILY_REGULAR, 0) ; // Sans Serif Regular
+ return get(FAMILY_REGULAR, 0) ; // Sans Serif Regular
}
-
+
+ @Override
public Font get(int family, int style) throws IOException {
Font font = (Font)fontMap.get( ( family << 8 ) | style );
if (font != null) {
@@ -92,8 +95,8 @@ public class JavaFontLoader implements FontSet {
}
// 1st process Sans Serif (2 fonts)
- if( is(style, STYLE_SERIF) ) {
- if( is(style, STYLE_BOLD) ) {
+ if( is(style, STYLE_SERIF) ) {
+ if( is(style, STYLE_BOLD) ) {
font = abspath(availableFontFileNames[5], family, style);
} else {
font = abspath(availableFontFileNames[4], family, style);
@@ -103,53 +106,53 @@ public class JavaFontLoader implements FontSet {
}
return font;
}
-
+
// Serif Fonts ..
switch (family) {
case FAMILY_LIGHT:
case FAMILY_MEDIUM:
case FAMILY_CONDENSED:
case FAMILY_REGULAR:
- if( is(style, STYLE_BOLD) ) {
- if( is(style, STYLE_ITALIC) ) {
+ if( is(style, STYLE_BOLD) ) {
+ if( is(style, STYLE_ITALIC) ) {
font = abspath(availableFontFileNames[3], family, style);
} else {
font = abspath(availableFontFileNames[2], family, style);
}
- } else if( is(style, STYLE_ITALIC) ) {
+ } else if( is(style, STYLE_ITALIC) ) {
font = abspath(availableFontFileNames[1], family, style);
} else {
font = abspath(availableFontFileNames[0], family, style);
}
break;
-
+
case FAMILY_MONOSPACED:
- if( is(style, STYLE_BOLD) ) {
+ if( is(style, STYLE_BOLD) ) {
font = abspath(availableFontFileNames[7], family, style);
} else {
font = abspath(availableFontFileNames[6], family, style);
}
- break;
+ break;
}
return font;
}
-
+
Font abspath(String fname, int family, int style) throws IOException {
if(null == javaFontPath) {
throw new GLException("java font path undefined");
}
final String err = "Problem loading font "+fname+", file "+javaFontPath+fname ;
-
+
try {
final Font f = FontFactory.get( new File(javaFontPath+fname) );
if(null != f) {
fontMap.put( ( family << 8 ) | style, f );
return f;
}
- throw new IOException (err);
+ throw new IOException (err);
} catch (IOException ioe) {
- throw new IOException(err, ioe);
+ throw new IOException(err, ioe);
}
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java
index c4c5802..e1e44c9 100644
--- a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java
+++ b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java
@@ -28,34 +28,45 @@
package jogamp.graph.font;
import java.io.IOException;
-import javax.media.opengl.GLException;
+import com.jogamp.common.os.Platform;
import com.jogamp.common.util.IntObjectHashMap;
import com.jogamp.common.util.IOUtil;
-
+import com.jogamp.common.util.JarUtil;
+import com.jogamp.common.util.cache.TempJarCache;
import com.jogamp.graph.font.Font;
import com.jogamp.graph.font.FontSet;
import com.jogamp.graph.font.FontFactory;
+
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URLConnection;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
public class UbuntuFontLoader implements FontSet {
-
- // FIXME: Add cache size to limit memory usage
+
+ // FIXME: Add cache size to limit memory usage
private static final IntObjectHashMap fontMap = new IntObjectHashMap();
-
- private static final String relPath = "fonts/ubuntu/" ;
-
+
+ private static final String jarSubDir = "atomic/" ;
+ private static final String jarName = "jogl-fonts-p0.jar" ;
+
+ private static final String relFontPath = "fonts/ubuntu/" ;
+ private static final String absFontPath = "jogamp/graph/font/fonts/ubuntu/" ;
+
private static final FontSet fontLoader = new UbuntuFontLoader();
public static final FontSet get() {
return fontLoader;
}
-
+
final static String availableFontFileNames[] =
{
/* 00 */ "Ubuntu-R.ttf", // regular
/* 01 */ "Ubuntu-RI.ttf", // regular italic
- /* 02 */ "Ubuntu-B.ttf", // bold
+ /* 02 */ "Ubuntu-B.ttf", // bold
/* 03 */ "Ubuntu-BI.ttf", // bold italic
/* 04 */ "Ubuntu-L.ttf", // light
/* 05 */ "Ubuntu-LI.ttf", // light italic
@@ -63,18 +74,20 @@ public class UbuntuFontLoader implements FontSet {
/* 07 */ "Ubuntu-MI.ttf", // medium italic
};
-
+
private UbuntuFontLoader() {
}
static boolean is(int bits, int bit) {
return 0 != ( bits & bit ) ;
}
-
+
+ @Override
public Font getDefault() throws IOException {
- return get(FAMILY_REGULAR, 0) ; // Sans Serif Regular
+ return get(FAMILY_REGULAR, 0) ; // Sans Serif Regular
}
-
+
+ @Override
public Font get(int family, int style) throws IOException {
Font font = (Font)fontMap.get( ( family << 8 ) | style );
if (font != null) {
@@ -97,7 +110,7 @@ public class UbuntuFontLoader implements FontSet {
font = abspath(availableFontFileNames[0], family, style);
}
break;
-
+
case FAMILY_LIGHT:
if( is(style, STYLE_ITALIC) ) {
font = abspath(availableFontFileNames[5], family, style);
@@ -105,34 +118,90 @@ public class UbuntuFontLoader implements FontSet {
font = abspath(availableFontFileNames[4], family, style);
}
break;
-
+
case FAMILY_MEDIUM:
if( is(style, STYLE_ITALIC) ) {
font = abspath(availableFontFileNames[6], family, style);
} else {
font = abspath(availableFontFileNames[7], family, style);
}
- break;
+ break;
}
return font;
}
-
- Font abspath(String fname, int family, int style) throws IOException {
- final String err = "Problem loading font "+fname+", stream "+relPath+fname;
+
+ private static boolean attemptedJARLoading = false;
+ private static boolean useTempJarCache = false;
+
+ private synchronized Font abspath(String fname, int family, int style) throws IOException {
+ final String err = "Problem loading font "+fname+", stream "+relFontPath+fname;
+ final Exception[] privErr = { null };
try {
- URLConnection conn = IOUtil.getResource(UbuntuFontLoader.class, relPath+fname);
- if(null == conn) {
- throw new GLException(err);
+ final Font f0 = abspathImpl(fname, family, style);
+ if(null != f0) {
+ return f0;
+ }
+ if( !attemptedJARLoading ) {
+ attemptedJARLoading = true;
+ Platform.initSingleton();
+ if( TempJarCache.isInitialized() ) {
+ final URI uri = JarUtil.getRelativeOf(UbuntuFontLoader.class, jarSubDir, jarName);
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ try {
+ TempJarCache.addResources(UbuntuFontLoader.class, uri);
+ } catch (Exception e) { privErr[0] = e; }
+ return null;
+ } } );
+ if( null == privErr[0] ) {
+ useTempJarCache = true;
+ final Font f1 = abspathImpl(fname, family, style);
+ if(null != f1) {
+ return f1;
+ }
+ }
+ }
+ }
+ } catch(Exception e) {
+ throw new IOException(err, e);
+ }
+ if( null != privErr[0] ) {
+ throw new IOException(err, privErr[0]);
+ }
+ throw new IOException(err);
+ }
+ private Font abspathImpl(final String fname, final int family, final int style) throws IOException {
+ final URLConnection conn;
+ if( useTempJarCache ) {
+ // this code-path throws .. all exceptions
+ final Exception[] privErr = { null };
+ final URLConnection[] privConn = { null };
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ try {
+ final URI uri = TempJarCache.getResource(absFontPath+fname);
+ privConn[0] = null != uri ? uri.toURL().openConnection() : null;
+ } catch (Exception e) { privErr[0] = e; }
+ return null;
+ } } );
+ if( null != privErr[0] ) {
+ throw new IOException(privErr[0]);
}
+ conn = privConn[0];
+ } else {
+ // no exceptions ..
+ conn = IOUtil.getResource(UbuntuFontLoader.class, relFontPath+fname);
+ }
+ if(null != conn) {
final Font f= FontFactory.get ( conn ) ;
if(null != f) {
fontMap.put( ( family << 8 ) | style, f );
return f;
- }
- throw new IOException(err);
- } catch(IOException ioe) {
- throw new IOException(err, ioe);
+ }
}
- }
+ return null;
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
index 0441bf8..67ae6c3 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java
@@ -51,20 +51,20 @@ import com.jogamp.opengl.math.geom.AABBox;
class TypecastFont implements FontInt {
static final boolean DEBUG = false;
-
+
final OTFontCollection fontset;
final OTFont font;
TypecastHMetrics metrics;
final CmapFormat cmapFormat;
int cmapentries;
-
- // FIXME: Add cache size to limit memory usage ??
- IntObjectHashMap char2Glyph;
+
+ // FIXME: Add cache size to limit memory usage ??
+ IntObjectHashMap char2Glyph;
public TypecastFont(OTFontCollection fontset) {
this.fontset = fontset;
this.font = fontset.getFont(0);
-
+
// FIXME: Generic attempt to find the best CmapTable,
// which is assumed to be the one with the most entries (stupid 'eh?)
CmapTable cmapTable = font.getCmapTable();
@@ -77,14 +77,14 @@ class TypecastFont implements FontInt {
int pidx = cmapIdxEntry.getPlatformId();
CmapFormat cf = cmapIdxEntry.getFormat();
if(DEBUG) {
- System.err.println("CmapFormat["+i+"]: platform " + pidx +
+ System.err.println("CmapFormat["+i+"]: platform " + pidx +
", encoding "+cmapIdxEntry.getEncodingId() + ": "+cf);
}
- if( _cmapFormatP[pidx] == null ||
+ if( _cmapFormatP[pidx] == null ||
_cmapFormatP[pidx].getLength() < cf.getLength() ) {
_cmapFormatP[pidx] = cf;
if( cf.getLength() > platformLength ) {
- platformLength = cf.getLength() ;
+ platformLength = cf.getLength() ;
platform = pidx;
encoding = cmapIdxEntry.getEncodingId();
}
@@ -93,10 +93,10 @@ class TypecastFont implements FontInt {
if(0 <= platform) {
cmapFormat = _cmapFormatP[platform];
if(DEBUG) {
- System.err.println("Selected CmapFormat: platform " + platform +
+ System.err.println("Selected CmapFormat: platform " + platform +
", encoding "+encoding + ": "+cmapFormat);
}
- } else {
+ } else {
CmapFormat _cmapFormat = null;
/*if(null == _cmapFormat) {
platform = ID.platformMacintosh;
@@ -127,14 +127,14 @@ class TypecastFont implements FontInt {
cmapentries = 0;
for (int i = 0; i < cmapFormat.getRangeCount(); ++i) {
CmapFormat.Range range = cmapFormat.getRange(i);
- cmapentries += range.getEndCode() - range.getStartCode() + 1; // end included
- }
+ cmapentries += range.getEndCode() - range.getStartCode() + 1; // end included
+ }
if(DEBUG) {
System.err.println("font direction hint: "+font.getHeadTable().getFontDirectionHint());
System.err.println("num glyphs: "+font.getNumGlyphs());
System.err.println("num cmap entries: "+cmapentries);
System.err.println("num cmap ranges: "+cmapFormat.getRangeCount());
-
+
for (int i = 0; i < cmapFormat.getRangeCount(); ++i) {
CmapFormat.Range range = cmapFormat.getRange(i);
for (int j = range.getStartCode(); j <= range.getEndCode(); ++j) {
@@ -147,26 +147,32 @@ class TypecastFont implements FontInt {
}
char2Glyph = new IntObjectHashMap(cmapentries + cmapentries/4);
}
-
+
+ @Override
public StringBuilder getName(StringBuilder sb, int nameIndex) {
return font.getName(nameIndex, sb);
}
+ @Override
public String getName(int nameIndex) {
return getName(null, nameIndex).toString();
}
+ @Override
public StringBuilder getAllNames(StringBuilder sb, String separator) {
return font.getAllNames(sb, separator);
}
+ @Override
public StringBuilder getFullFamilyName(StringBuilder sb) {
sb = getName(sb, Font.NAME_FAMILY).append("-");
getName(sb, Font.NAME_SUBFAMILY);
return sb;
- }
+ }
+ @Override
public float getAdvanceWidth(int i, float pixelSize) {
- return font.getHmtxTable().getAdvanceWidth(i) * metrics.getScale(pixelSize);
+ return font.getHmtxTable().getAdvanceWidth(i) * metrics.getScale(pixelSize);
}
-
+
+ @Override
public Metrics getMetrics() {
if (metrics == null) {
metrics = new TypecastHMetrics(this);
@@ -174,8 +180,9 @@ class TypecastFont implements FontInt {
return metrics;
}
+ @Override
public Glyph getGlyph(char symbol) {
- TypecastGlyph result = (TypecastGlyph) char2Glyph.get(symbol);
+ TypecastGlyph result = (TypecastGlyph) char2Glyph.get(symbol);
if (null == result) {
// final short code = (short) char2Code.get(symbol);
short code = (short) cmapFormat.mapCharCode(symbol);
@@ -187,7 +194,7 @@ class TypecastFont implements FontInt {
default: code = Glyph.ID_UNKNOWN;
}
}
-
+
jogamp.graph.font.typecast.ot.OTGlyph glyph = font.getGlyph(code);
if(null == glyph) {
glyph = font.getGlyph(Glyph.ID_UNKNOWN);
@@ -200,30 +207,32 @@ class TypecastFont implements FontInt {
if(DEBUG) {
System.err.println("New glyph: " + (int)symbol + " ( " + (char)symbol +" ) -> " + code + ", contours " + glyph.getPointCount() + ": " + path);
}
- final HdmxTable hdmx = font.getHdmxTable();
+ final HdmxTable hdmx = font.getHdmxTable();
if (null!= result && null != hdmx) {
/*if(DEBUG) {
System.err.println("hdmx "+hdmx);
}*/
for (int i=0; i<hdmx.getNumberOfRecords(); i++)
{
- final HdmxTable.DeviceRecord dr = hdmx.getRecord(i);
+ final HdmxTable.DeviceRecord dr = hdmx.getRecord(i);
result.addAdvance(dr.getWidth(code), dr.getPixelSize());
/* if(DEBUG) {
System.err.println("hdmx advance : pixelsize = "+dr.getWidth(code)+" : "+ dr.getPixelSize());
} */
}
- }
+ }
char2Glyph.put(symbol, result);
}
return result;
}
-
+
+ @Override
public ArrayList<OutlineShape> getOutlineShapes(CharSequence string, float pixelSize, Factory<? extends Vertex> vertexFactory) {
AffineTransform transform = new AffineTransform(vertexFactory);
return TypecastRenderer.getOutlineShapes(this, string, pixelSize, transform, vertexFactory);
}
+ @Override
public float getStringWidth(CharSequence string, float pixelSize) {
float width = 0;
final int len = string.length();
@@ -238,9 +247,10 @@ class TypecastFont implements FontInt {
}
}
- return (int)(width + 0.5f);
+ return (int)(width + 0.5f);
}
+ @Override
public float getStringHeight(CharSequence string, float pixelSize) {
int height = 0;
@@ -254,9 +264,10 @@ class TypecastFont implements FontInt {
height = (int)Math.ceil(Math.max(bbox.getHeight(), height));
}
}
- return height;
+ return height;
}
+ @Override
public AABBox getStringBounds(CharSequence string, float pixelSize) {
if (string == null) {
return new AABBox();
@@ -284,17 +295,20 @@ class TypecastFont implements FontInt {
totalHeight -= advanceY;
totalWidth = Math.max(curLineWidth, totalWidth);
}
- return new AABBox(0, 0, 0, totalWidth, totalHeight,0);
+ return new AABBox(0, 0, 0, totalWidth, totalHeight,0);
}
+ @Override
final public int getNumGlyphs() {
return font.getNumGlyphs();
}
-
+
+ @Override
public boolean isPrintableChar( char c ) {
return FontFactory.isPrintableChar(c);
}
-
+
+ @Override
public String toString() {
return getFullFamilyName(null).toString();
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java
index 8479c08..d7db981 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java
@@ -43,10 +43,12 @@ import com.jogamp.graph.font.Font;
public class TypecastFontConstructor implements FontConstructor {
+ @Override
public Font create(final File ffile) throws IOException {
Object o = AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
- OTFontCollection fontset;
+ OTFontCollection fontset;
try {
fontset = OTFontCollection.create(ffile);
return new TypecastFont(fontset);
@@ -63,14 +65,16 @@ public class TypecastFontConstructor implements FontConstructor {
}
throw new InternalError("Unexpected Object: "+o);
}
-
+
+ @Override
public Font create(final URLConnection fconn) throws IOException {
return AccessController.doPrivileged(new PrivilegedAction<Font>() {
+ @Override
public Font run() {
File tf = null;
int len=0;
Font f = null;
- try {
+ try {
tf = IOUtil.createTempFile( "jogl.font", ".ttf", false);
len = IOUtil.copyURLConn2File(fconn, tf);
if(len==0) {
@@ -84,7 +88,7 @@ public class TypecastFontConstructor implements FontConstructor {
}
return f;
}
- });
+ });
}
-
+
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java
index 1205c65..574aeb8 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java
@@ -40,45 +40,46 @@ public class TypecastGlyph implements FontInt.GlyphInt {
public class Advance
{
final Font font;
- final float advance;
- HashMap<Float, Float> size2advance = new HashMap<Float, Float>();
-
+ final float advance;
+ HashMap<Float, Float> size2advance = new HashMap<Float, Float>();
+
public Advance(Font font, float advance)
{
this.font = font;
this.advance = advance;
}
-
+
public void reset() {
size2advance.clear();
}
-
+
public float getScale(float pixelSize)
{
return this.font.getMetrics().getScale(pixelSize);
}
-
+
public void add(float advance, float size)
{
size2advance.put(size, advance);
}
-
+
public float get(float size, boolean useFrationalMetrics)
{
Float fo = size2advance.get(size);
- if(null == fo) {
+ if(null == fo) {
float value = (this.advance * getScale(size));
if (useFrationalMetrics == false) {
//value = (float)Math.ceil(value);
// value = (int)value;
- value = (int) ( value + 0.5f ) ; // TODO: check
+ value = (int) ( value + 0.5f ) ; // TODO: check
}
size2advance.put(size, value);
return value;
}
return fo.floatValue();
}
-
+
+ @Override
public String toString()
{
return "\nAdvance:"+
@@ -86,147 +87,154 @@ public class TypecastGlyph implements FontInt.GlyphInt {
"\n advances: \n"+size2advance;
}
}
-
+
public class Metrics
{
AABBox bbox;
Advance advance;
-
+
public Metrics(Font font, AABBox bbox, float advance)
{
this.bbox = bbox;
this.advance = new Advance(font, advance);
}
-
+
public void reset() {
advance.reset();
}
-
+
public float getScale(float pixelSize)
{
return this.advance.getScale(pixelSize);
}
-
+
public AABBox getBBox()
{
return this.bbox;
}
-
+
public void addAdvance(float advance, float size)
{
this.advance.add(advance, size);
}
-
+
public float getAdvance(float size, boolean useFrationalMetrics)
{
return this.advance.get(size, useFrationalMetrics);
}
-
+
+ @Override
public String toString()
{
return "\nMetrics:"+
"\n bbox: "+this.bbox+
this.advance;
}
- }
+ }
public static final short INVALID_ID = (short)((1 << 16) - 1);
public static final short MAX_ID = (short)((1 << 16) - 2);
-
+
private final Font font;
-
+
char symbol;
short id;
int advance;
Metrics metrics;
-
+
protected Path2D path; // in EM units
protected Path2D pathSized;
protected float numberSized;
-
+
protected TypecastGlyph(Font font, char symbol) {
this.font = font;
this.symbol = symbol;
}
-
+
protected TypecastGlyph(Font font,
char symbol, short id, AABBox bbox, int advance, Path2D path) {
this.font = font;
this.symbol = symbol;
this.advance = advance;
-
+
init(id, bbox, advance);
-
+
this.path = path;
this.pathSized = null;
this.numberSized = 0.0f;
}
-
+
void init(short id, AABBox bbox, int advance) {
this.id = id;
this.advance = advance;
this.metrics = new Metrics(this.font, bbox, this.advance);
}
-
+
public void reset(Path2D path) {
this.path = path;
this.metrics.reset();
}
-
+
+ @Override
public Font getFont() {
return this.font;
}
-
+
+ @Override
public char getSymbol() {
return this.symbol;
}
-
+
AABBox getBBoxUnsized() {
return this.metrics.getBBox();
}
-
+
public AABBox getBBox() {
return this.metrics.getBBox();
}
-
+
public Metrics getMetrics() {
return this.metrics;
}
-
+
public short getID() {
return this.id;
}
-
+
public float getScale(float pixelSize) {
return this.metrics.getScale(pixelSize);
}
-
+
+ @Override
public AABBox getBBox(float pixelSize) {
final float size = getScale(pixelSize);
AABBox newBox = getBBox().clone();
newBox.scale(size);
- return newBox;
+ return newBox;
}
-
+
protected void addAdvance(float advance, float size) {
this.metrics.addAdvance(advance, size);
}
-
+
+ @Override
public float getAdvance(float pixelSize, boolean useFrationalMetrics) {
return this.metrics.getAdvance(pixelSize, useFrationalMetrics);
}
-
+
+ @Override
public Path2D getPath() {
return this.path;
}
-
+
+ @Override
public Path2D getPath(float pixelSize) {
final float size = getScale(pixelSize);
-
+
if (this.numberSized != size) {
this.numberSized = size;
this.pathSized = AffineTransform.getScaleInstance(null, size, size).createTransformedShape(getPath());
- }
+ }
return this.pathSized;
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java
index f170f58..ecc41e4 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java
@@ -35,7 +35,7 @@ import com.jogamp.opengl.math.geom.AABBox;
class TypecastHMetrics implements Metrics {
private final TypecastFont fontImpl;
-
+
// HeadTable
private final HeadTable headTable;
private final float unitsPerEM_Inv;
@@ -44,41 +44,47 @@ class TypecastHMetrics implements Metrics {
private final HheaTable hheaTable;
// VheaTable (for horizontal fonts)
// private final VheaTable vheaTable;
-
+
public TypecastHMetrics(TypecastFont fontImpl) {
this.fontImpl = fontImpl;
headTable = this.fontImpl.font.getHeadTable();
- hheaTable = this.fontImpl.font.getHheaTable();
+ hheaTable = this.fontImpl.font.getHheaTable();
// vheaTable = this.fontImpl.font.getVheaTable();
unitsPerEM_Inv = 1.0f / ( (float) headTable.getUnitsPerEm() );
-
+
int maxWidth = headTable.getXMax() - headTable.getXMin();
- int maxHeight = headTable.getYMax() - headTable.getYMin();
+ int maxHeight = headTable.getYMax() - headTable.getYMin();
float lowx= headTable.getXMin();
float lowy = -(headTable.getYMin()+maxHeight);
float highx = lowx + maxWidth;
float highy = lowy + maxHeight;
bbox = new AABBox(lowx, lowy, 0, highx, highy, 0); // invert
}
-
+
+ @Override
public final float getAscent(float pixelSize) {
return getScale(pixelSize) * -hheaTable.getAscender(); // invert
}
+ @Override
public final float getDescent(float pixelSize) {
return getScale(pixelSize) * -hheaTable.getDescender(); // invert
}
+ @Override
public final float getLineGap(float pixelSize) {
return getScale(pixelSize) * -hheaTable.getLineGap(); // invert
}
+ @Override
public final float getMaxExtend(float pixelSize) {
return getScale(pixelSize) * hheaTable.getXMaxExtent();
}
+ @Override
public final float getScale(float pixelSize) {
return pixelSize * unitsPerEM_Inv;
}
+ @Override
public final AABBox getBBox(float pixelSize) {
AABBox res = new AABBox(bbox.getLow(), bbox.getHigh());
- res.scale(getScale(pixelSize));
+ res.scale(getScale(pixelSize));
return res;
}
}
\ No newline at end of file
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java
index f155345..127e260 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java
@@ -43,14 +43,14 @@ import com.jogamp.graph.geom.Vertex;
import com.jogamp.graph.geom.Vertex.Factory;
/**
- * Factory to build a {@link com.jogamp.graph.geom.Path2D Path2D} from
- * {@link jogamp.graph.font.typecast.ot.OTGlyph Glyph}s.
+ * Factory to build a {@link com.jogamp.graph.geom.Path2D Path2D} from
+ * {@link jogamp.graph.font.typecast.ot.OTGlyph Glyph}s.
*/
public class TypecastRenderer {
- private static void getPaths(TypecastFont font,
+ private static void getPaths(TypecastFont font,
CharSequence string, float pixelSize, AffineTransform transform, Path2D[] p)
- {
+ {
if (string == null) {
return;
}
@@ -79,14 +79,14 @@ public class TypecastRenderer {
} else if (character == ' ') {
advanceTotal += font.getAdvanceWidth(Glyph.ID_SPACE, pixelSize);
continue;
- }
+ }
Glyph glyph = font.getGlyph(character);
Path2D gp = ((GlyphInt)glyph).getPath();
float scale = metrics.getScale(pixelSize);
t.translate(advanceTotal, y);
t.scale(scale, scale);
p[i].append(gp.iterator(t), false);
- advanceTotal += glyph.getAdvance(pixelSize, true);
+ advanceTotal += glyph.getAdvance(pixelSize, true);
}
}
@@ -119,19 +119,19 @@ public class TypecastRenderer {
case PathIterator.SEG_MOVETO:
shape.closeLastOutline();
shape.addEmptyOutline();
- shape.addVertex(0, vertexFactory.create(coords, 0, 2, true));
+ shape.addVertex(0, vertexFactory.create(coords, 0, 2, true));
break;
case PathIterator.SEG_LINETO:
- shape.addVertex(0, vertexFactory.create(coords, 0, 2, true));
+ shape.addVertex(0, vertexFactory.create(coords, 0, 2, true));
break;
case PathIterator.SEG_QUADTO:
shape.addVertex(0, vertexFactory.create(coords, 0, 2, false));
- shape.addVertex(0, vertexFactory.create(coords, 2, 2, true));
+ shape.addVertex(0, vertexFactory.create(coords, 2, 2, true));
break;
case PathIterator.SEG_CUBICTO:
shape.addVertex(0, vertexFactory.create(coords, 0, 2, false));
shape.addVertex(0, vertexFactory.create(coords, 2, 2, false));
- shape.addVertex(0, vertexFactory.create(coords, 4, 2, true));
+ shape.addVertex(0, vertexFactory.create(coords, 4, 2, true));
break;
case PathIterator.SEG_CLOSE:
shape.closeLastOutline();
@@ -184,12 +184,12 @@ public class TypecastRenderer {
if (point_plus1.onCurve) {
// s = new Line2D.Float(point.x, point.y, point_plus1.x, point_plus1.y);
gp.lineTo( point_plus1.x, point_plus1.y );
- offset++;
+ offset++;
} else {
if (point_plus2.onCurve) {
// s = new QuadCurve2D.Float( point.x, point.y, point_plus1.x, point_plus1.y, point_plus2.x, point_plus2.y);
gp.quadTo(point_plus1.x, point_plus1.y, point_plus2.x, point_plus2.y);
- offset+=2;
+ offset+=2;
} else {
// s = new QuadCurve2D.Float(point.x,point.y,point_plus1.x,point_plus1.y,
// midValue(point_plus1.x, point_plus2.x), midValue(point_plus1.y, point_plus2.y));
@@ -210,7 +210,7 @@ public class TypecastRenderer {
// midValue(point.x, point_plus1.x), midValue(point.y, point_plus1.y));
//gp.curve3(midValue(point.x, point_plus1.x), midValue(point.y, point_plus1.y), point.x, point.y);
gp.quadTo(point.x, point.y, midValue(point.x, point_plus1.x), midValue(point.y, point_plus1.y));
- offset++;
+ offset++;
}
}
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java
index b553575..8b68565 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot;
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java
index ece0aae..0a4786f 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java
@@ -840,11 +840,11 @@ public class Fixed {
}
return n;
}
-
+
public static float floatValue(long fixed) {
return (fixed >> 16) + (float)(fixed & 0xffff) / 0x10000;
}
-
+
public static float roundedFloatValue(long fixed, int decimalPlaces) {
int factor = 10 * decimalPlaces;
return (float)((int)(floatValue(fixed) * factor)) / factor;
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java
index 6b3dc1f..d6c9da2 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot;
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java
index 8c14b73..7c3b32e 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java
@@ -104,10 +104,10 @@ public class OTFont {
public StringBuilder getName(int nameIndex, StringBuilder sb) {
if(null == sb) {
sb = new StringBuilder();
- }
+ }
return _name.getRecordsRecordString(sb, nameIndex);
}
-
+
public StringBuilder getAllNames(StringBuilder sb, String separator) {
if(null != _name) {
if(null == sb) {
@@ -117,9 +117,9 @@ public class OTFont {
_name.getRecord(i).getRecordString(sb).append(separator);
}
}
- return sb;
+ return sb;
}
-
+
public Table getTable(int tableType) {
for (int i = 0; i < _tables.length; i++) {
if ((_tables[i] != null) && (_tables[i].getType() == tableType)) {
@@ -132,31 +132,31 @@ public class OTFont {
public Os2Table getOS2Table() {
return _os2;
}
-
+
public CmapTable getCmapTable() {
return _cmap;
}
-
+
public HeadTable getHeadTable() {
return _head;
}
-
+
public HheaTable getHheaTable() {
return _hhea;
}
-
+
public HdmxTable getHdmxTable() {
return _hdmx;
}
-
+
public HmtxTable getHmtxTable() {
return _hmtx;
}
-
+
public LocaTable getLocaTable() {
return _loca;
}
-
+
public MaxpTable getMaxpTable() {
return _maxp;
}
@@ -186,8 +186,8 @@ public class OTFont {
}
public OTGlyph getGlyph(int i) {
-
- final GlyfDescript _glyfDescr = _glyf.getDescription(i);
+
+ final GlyfDescript _glyfDescr = _glyf.getDescription(i);
return (null != _glyfDescr)
? new OTGlyph(
_glyfDescr,
@@ -195,11 +195,11 @@ public class OTFont {
_hmtx.getAdvanceWidth(i))
: null;
}
-
+
public TableDirectory getTableDirectory() {
return _tableDirectory;
}
-
+
private Table readTable(
DataInputStream dis,
int tablesOrigin,
@@ -228,13 +228,13 @@ public class OTFont {
DataInputStream dis,
int directoryOffset,
int tablesOrigin) throws IOException {
-
+
// Load the table directory
dis.reset();
dis.skip(directoryOffset);
_tableDirectory = new TableDirectory(dis);
_tables = new Table[_tableDirectory.getNumTables()];
-
+
// Load some prerequisite tables
_head = (HeadTable) readTable(dis, tablesOrigin, Table.head);
_hhea = (HheaTable) readTable(dis, tablesOrigin, Table.hhea);
@@ -252,7 +252,7 @@ public class OTFont {
if (_vhea != null) {
_tables[index++] = _vhea;
}
-
+
// Load all other tables
for (int i = 0; i < _tableDirectory.getNumTables(); i++) {
DirectoryEntry entry = _tableDirectory.getEntry(i);
@@ -283,6 +283,7 @@ public class OTFont {
_glyf = (GlyfTable) getTable(Table.glyf);
}
+ @Override
public String toString() {
if (_tableDirectory != null) {
return _tableDirectory.toString();
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFontCollection.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFontCollection.java
index 4a04160..c79380f 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFontCollection.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFontCollection.java
@@ -75,11 +75,11 @@ public class OTFontCollection {
public OTFont getFont(int i) {
return _fonts[i];
}
-
+
public int getFontCount() {
return _fonts.length;
}
-
+
public TTCHeader getTtcHeader() {
return _ttcHeader;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java
index 244ab40..e0d652b 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java
@@ -102,10 +102,10 @@ public class OTGlyph {
}
}
- public AABBox getBBox() {
- return _bbox;
+ public AABBox getBBox() {
+ return _bbox;
}
-
+
public int getAdvanceWidth() {
return _advanceWidth;
}
@@ -163,7 +163,7 @@ public class OTGlyph {
// Append the origin and advanceWidth points (n & n+1)
// _points[gd.getPointCount()] = new Point(0, 0, true, true);
// _points[gd.getPointCount()+1] = new Point(_advanceWidth, 0, true, true);
-
+
_bbox = new AABBox(gd.getXMinimum(), gd.getYMinimum(), 0, gd.getXMaximum(), gd.getYMaximum(), 0);
}
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceData.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceData.java
index 433ff60..7a5b0c4 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceData.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceData.java
@@ -31,7 +31,7 @@ import java.io.IOException;
public class ResourceData {
private byte[] data;
-
+
/** Creates new ResourceData */
public ResourceData(DataInput di) throws IOException {
int dataLen = di.readInt();
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceFile.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceFile.java
index 2ada22c..468ab2e 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceFile.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceFile.java
@@ -33,14 +33,14 @@ public class ResourceFile {
private ResourceHeader header;
private ResourceMap map;
-
+
/** Creates new Resource */
public ResourceFile(RandomAccessFile raf) throws IOException {
// Read header at the beginning of the file
raf.seek(0);
header = new ResourceHeader(raf);
-
+
// Seek to the map offset and read the map
raf.seek(header.getMapOffset());
map = new ResourceMap(raf);
@@ -53,18 +53,18 @@ public class ResourceFile {
public static void main(String[] args) {
try {
//RandomAccessFile raf = new RandomAccessFile("/Library/Fonts/GillSans.dfont", "r");
-
+
// Tests loading a font from a resource fork on Mac OS X
RandomAccessFile raf = new RandomAccessFile("/Library/Fonts/Georgia/..namedfork/rsrc", "r");
ResourceFile resource = new ResourceFile(raf);
for (int i = 0; i < resource.getResourceMap().getResourceTypeCount(); i++) {
System.out.println(resource.getResourceMap().getResourceType(i).getTypeAsString());
}
-
+
// Get the first 'sfnt' resource
ResourceType type = resource.getResourceMap().getResourceType("sfnt");
ResourceReference reference = type.getReference(0);
-
+
type = resource.getResourceMap().getResourceType("FOND");
for (int i = 0; i < type.getCount(); ++i) {
reference = type.getReference(i);
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceHeader.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceHeader.java
index 8f52246..de13b11 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceHeader.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceHeader.java
@@ -46,15 +46,15 @@ public class ResourceHeader {
public int getDataOffset() {
return dataOffset;
}
-
+
public int getMapOffset() {
return mapOffset;
}
-
+
public int getDataLength() {
return dataLen;
}
-
+
public int getMapLength() {
return mapLen;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceMap.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceMap.java
index 96ba060..d348c64 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceMap.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceMap.java
@@ -35,7 +35,7 @@ public class ResourceMap {
private int fileReferenceNumber;
private int attributes;
private ResourceType[] types;
-
+
/** Creates new ResourceMap */
public ResourceMap(DataInput di) throws IOException {
di.readFully(headerCopy);
@@ -45,18 +45,18 @@ public class ResourceMap {
int typeOffset = di.readUnsignedShort();
int nameOffset = di.readUnsignedShort();
int typeCount = di.readUnsignedShort() + 1;
-
+
// Read types
types = new ResourceType[typeCount];
for (int i = 0; i < typeCount; i++) {
types[i] = new ResourceType(di);
}
-
+
// Read the references
for (int i = 0; i < typeCount; i++) {
types[i].readRefs(di);
}
-
+
// Read the names
for (int i = 0; i < typeCount; i++) {
types[i].readNames(di);
@@ -76,7 +76,7 @@ public class ResourceMap {
public ResourceType getResourceType(int i) {
return types[i];
}
-
+
public int getResourceTypeCount() {
return types.length;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceReference.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceReference.java
index fd7ec46..9d15348 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceReference.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceReference.java
@@ -36,7 +36,7 @@ public class ResourceReference {
private int dataOffset;
private int handle;
private String name;
-
+
/** Creates new ResourceReference */
protected ResourceReference(DataInput di) throws IOException {
id = di.readUnsignedShort();
@@ -58,23 +58,23 @@ public class ResourceReference {
public int getId() {
return id;
}
-
+
public short getNameOffset() {
return nameOffset;
}
-
+
public short getAttributes() {
return attributes;
}
-
+
public int getDataOffset() {
return dataOffset;
}
-
+
public int getHandle() {
return handle;
}
-
+
public String getName() {
return name;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceType.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceType.java
index 1c7e24c..2ad002e 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceType.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceType.java
@@ -34,7 +34,7 @@ public class ResourceType {
private int count;
private int offset;
private ResourceReference[] references;
-
+
/** Creates new ResourceType */
protected ResourceType(DataInput di) throws IOException {
type = di.readInt();
@@ -42,7 +42,7 @@ public class ResourceType {
offset = di.readUnsignedShort();
references = new ResourceReference[count];
}
-
+
protected void readRefs(DataInput di) throws IOException {
for (int i = 0; i < count; i++) {
references[i] = new ResourceReference(di);
@@ -58,7 +58,7 @@ public class ResourceType {
public int getType() {
return type;
}
-
+
public String getTypeAsString() {
return new StringBuilder()
.append((char)((type>>24)&0xff))
@@ -67,11 +67,11 @@ public class ResourceType {
.append((char)((type)&0xff))
.toString();
}
-
+
public int getCount() {
return count;
}
-
+
public int getOffset() {
return offset;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java
index ed615eb..60975dd 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java
@@ -31,94 +31,100 @@ import java.io.IOException;
* @author <a href="mailto:davidsch at dev.java.net">David Schweinsberg</a>
*/
public class BaseTable implements Table {
-
+
private abstract class BaseCoord {
public abstract int getBaseCoordFormat();
-
+
public abstract short getCoordinate();
}
-
+
private class BaseCoordFormat1 extends BaseCoord {
private short _coordinate;
-
+
protected BaseCoordFormat1(DataInput di) throws IOException {
_coordinate = di.readShort();
}
+ @Override
public int getBaseCoordFormat() {
return 1;
}
-
+
+ @Override
public short getCoordinate() {
return _coordinate;
}
-
+
}
-
+
private class BaseCoordFormat2 extends BaseCoord {
private short _coordinate;
private int _referenceGlyph;
private int _baseCoordPoint;
-
+
protected BaseCoordFormat2(DataInput di) throws IOException {
_coordinate = di.readShort();
_referenceGlyph = di.readUnsignedShort();
_baseCoordPoint = di.readUnsignedShort();
}
+ @Override
public int getBaseCoordFormat() {
return 2;
}
-
+
+ @Override
public short getCoordinate() {
return _coordinate;
}
-
+
}
-
+
private class BaseCoordFormat3 extends BaseCoord {
private short _coordinate;
private int _deviceTableOffset;
-
+
protected BaseCoordFormat3(DataInput di) throws IOException {
_coordinate = di.readShort();
_deviceTableOffset = di.readUnsignedShort();
}
+ @Override
public int getBaseCoordFormat() {
return 2;
}
-
+
+ @Override
public short getCoordinate() {
return _coordinate;
}
-
+
}
-
+
private class FeatMinMaxRecord {
-
+
private int _tag;
private int _minCoordOffset;
private int _maxCoordOffset;
-
+
protected FeatMinMaxRecord(DataInput di) throws IOException {
_tag = di.readInt();
_minCoordOffset = di.readUnsignedShort();
_maxCoordOffset = di.readUnsignedShort();
}
}
-
+
private class MinMax {
-
+
private int _minCoordOffset;
private int _maxCoordOffset;
private int _featMinMaxCount;
private FeatMinMaxRecord[] _featMinMaxRecord;
-
+
protected MinMax(int minMaxOffset) throws IOException {
DataInput di = getDataInputForOffset(minMaxOffset);
_minCoordOffset = di.readUnsignedShort();
@@ -130,14 +136,14 @@ public class BaseTable implements Table {
}
}
}
-
+
private class BaseValues {
-
+
private int _defaultIndex;
private int _baseCoordCount;
private int[] _baseCoordOffset;
private BaseCoord[] _baseCoords;
-
+
protected BaseValues(int baseValuesOffset) throws IOException {
DataInput di = getDataInputForOffset(baseValuesOffset);
_defaultIndex = di.readUnsignedShort();
@@ -163,12 +169,12 @@ public class BaseTable implements Table {
}
}
}
-
+
private class BaseLangSysRecord {
-
+
private int _baseLangSysTag;
private int _minMaxOffset;
-
+
protected BaseLangSysRecord(DataInput di) throws IOException {
_baseLangSysTag = di.readInt();
_minMaxOffset = di.readUnsignedShort();
@@ -177,14 +183,14 @@ public class BaseTable implements Table {
public int getBaseLangSysTag() {
return _baseLangSysTag;
}
-
+
public int getMinMaxOffset() {
return _minMaxOffset;
}
}
-
+
private class BaseScript {
-
+
private int _thisOffset;
private int _baseValuesOffset;
private int _defaultMinMaxOffset;
@@ -192,7 +198,7 @@ public class BaseTable implements Table {
private BaseLangSysRecord[] _baseLangSysRecord;
private BaseValues _baseValues;
private MinMax[] _minMax;
-
+
protected BaseScript(int baseScriptOffset) throws IOException {
_thisOffset = baseScriptOffset;
DataInput di = getDataInputForOffset(baseScriptOffset);
@@ -211,6 +217,7 @@ public class BaseTable implements Table {
}
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder()
.append("\nBaseScript BaseScriptT").append(Integer.toHexString(_thisOffset))
@@ -231,9 +238,9 @@ public class BaseTable implements Table {
return sb.toString();
}
}
-
+
private class BaseScriptRecord {
-
+
private int _baseScriptTag;
private int _baseScriptOffset;
@@ -245,19 +252,19 @@ public class BaseTable implements Table {
public int getBaseScriptTag() {
return _baseScriptTag;
}
-
+
public int getBaseScriptOffset() {
return _baseScriptOffset;
}
}
-
+
private class BaseScriptList {
-
+
private int _thisOffset;
private int _baseScriptCount;
private BaseScriptRecord[] _baseScriptRecord;
private BaseScript[] _baseScripts;
-
+
protected BaseScriptList(int baseScriptListOffset) throws IOException {
_thisOffset = baseScriptListOffset;
DataInput di = getDataInputForOffset(baseScriptListOffset);
@@ -273,6 +280,7 @@ public class BaseTable implements Table {
}
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder()
.append("\nBaseScriptList BaseScriptListT").append(Integer.toHexString(_thisOffset))
@@ -288,13 +296,13 @@ public class BaseTable implements Table {
return sb.toString();
}
}
-
+
private class BaseTagList {
-
+
private int _thisOffset;
private int _baseTagCount;
private int[] _baselineTag;
-
+
protected BaseTagList(int baseTagListOffset) throws IOException {
_thisOffset = baseTagListOffset;
DataInput di = getDataInputForOffset(baseTagListOffset);
@@ -305,6 +313,7 @@ public class BaseTable implements Table {
}
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder()
.append("\nBaseTagList BaseTagListT").append(Integer.toHexString(_thisOffset))
@@ -315,9 +324,9 @@ public class BaseTable implements Table {
return sb.toString();
}
}
-
+
private class Axis {
-
+
private int _thisOffset;
private int _baseTagListOffset;
private int _baseScriptListOffset;
@@ -338,6 +347,7 @@ public class BaseTable implements Table {
}
}
+ @Override
public String toString() {
return new StringBuilder()
.append("\nAxis AxisT").append(Integer.toHexString(_thisOffset))
@@ -348,7 +358,7 @@ public class BaseTable implements Table {
.toString();
}
}
-
+
private DirectoryEntry _de;
private int _version;
private int _horizAxisOffset;
@@ -375,25 +385,25 @@ public class BaseTable implements Table {
if (_vertAxisOffset != 0) {
_vertAxis = new Axis(_vertAxisOffset);
}
-
+
// Let go of the buffer
_buf = null;
}
-
+
private DataInput getDataInputForOffset(int offset) {
return new DataInputStream(new ByteArrayInputStream(
_buf, offset,
_de.getLength() - offset));
}
-
+
// private String valueAsShortHex(int value) {
// return String.format("%1$4x", value);
// }
-//
+//
// private String valueAsLongHex(int value) {
// return String.format("%1$8x", value);
// }
-
+
static protected String tagAsString(int tag) {
char[] c = new char[4];
c[0] = (char)((tag >> 24) & 0xff);
@@ -402,11 +412,13 @@ public class BaseTable implements Table {
c[3] = (char)(tag & 0xff);
return String.valueOf(c);
}
-
+
+ @Override
public int getType() {
return BASE;
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder()
.append("; 'BASE' Table - Baseline\n;-------------------------------------\n\n")
@@ -422,13 +434,14 @@ public class BaseTable implements Table {
}
return sb.toString();
}
-
+
/**
* Get a directory entry for this table. This uniquely identifies the
* table in collections where there may be more than one instance of a
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return _de;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java
index 966f6e1..a36a499 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java
@@ -36,13 +36,13 @@ import java.util.Hashtable;
* @author <a href="mailto:davidsch at dev.java.net">David Schweinsberg</a>
*/
public class CffTable implements Table {
-
+
public class Dict {
-
+
private Dictionary<Integer, Object> _entries = new Hashtable<Integer, Object>();
private int[] _data;
private int _index;
-
+
protected Dict(int[] data, int offset, int length) {
_data = data;
_index = offset;
@@ -50,11 +50,11 @@ public class CffTable implements Table {
addKeyAndValueEntry();
}
}
-
+
public Object getValue(int key) {
return _entries.get(key);
}
-
+
private boolean addKeyAndValueEntry() {
ArrayList<Object> operands = new ArrayList<Object>();
Object operand = null;
@@ -74,7 +74,7 @@ public class CffTable implements Table {
}
return true;
}
-
+
private boolean isOperandAtIndex() {
int b0 = _data[_index];
if ((32 <= b0 && b0 <= 254)
@@ -97,31 +97,31 @@ public class CffTable implements Table {
private Object nextOperand() {
int b0 = _data[_index];
if (32 <= b0 && b0 <= 246) {
-
+
// 1 byte integer
++_index;
return new Integer(b0 - 139);
} else if (247 <= b0 && b0 <= 250) {
-
+
// 2 byte integer
int b1 = _data[_index + 1];
_index += 2;
return new Integer((b0 - 247) * 256 + b1 + 108);
} else if (251 <= b0 && b0 <= 254) {
-
+
// 2 byte integer
int b1 = _data[_index + 1];
_index += 2;
return new Integer(-(b0 - 251) * 256 - b1 - 108);
} else if (b0 == 28) {
-
+
// 3 byte integer
int b1 = _data[_index + 1];
int b2 = _data[_index + 2];
_index += 3;
return new Integer(b1 << 8 | b2);
} else if (b0 == 29) {
-
+
// 5 byte integer
int b1 = _data[_index + 1];
int b2 = _data[_index + 2];
@@ -130,7 +130,7 @@ public class CffTable implements Table {
_index += 5;
return new Integer(b1 << 24 | b2 << 16 | b3 << 8 | b4);
} else if (b0 == 30) {
-
+
// Real number
StringBuilder fString = new StringBuilder();
int nibble1 = 0;
@@ -142,13 +142,13 @@ public class CffTable implements Table {
++_index;
fString.append(decodeRealNibble(nibble1));
fString.append(decodeRealNibble(nibble2));
- }
+ }
return new Float(fString.toString());
} else {
return null;
}
}
-
+
private String decodeRealNibble(int nibble) {
if (nibble < 0xa) {
return Integer.toString(nibble);
@@ -163,7 +163,8 @@ public class CffTable implements Table {
}
return "";
}
-
+
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
Enumeration<Integer> keys = _entries.keys();
@@ -179,14 +180,14 @@ public class CffTable implements Table {
return sb.toString();
}
}
-
+
public class Index {
-
+
private int _count;
private int _offSize;
private int[] _offset;
private int[] _data;
-
+
protected Index(DataInput di) throws IOException {
_count = di.readUnsignedShort();
_offset = new int[_count + 1];
@@ -203,23 +204,24 @@ public class CffTable implements Table {
_data[i] = di.readUnsignedByte();
}
}
-
+
public int getCount() {
return _count;
}
-
+
public int getOffset(int index) {
return _offset[index];
}
-
+
public int getDataLength() {
return _offset[_offset.length - 1] - 1;
}
-
+
public int[] getData() {
return _data;
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("DICT\n");
@@ -241,19 +243,20 @@ public class CffTable implements Table {
return sb.toString();
}
}
-
+
public class TopDictIndex extends Index {
protected TopDictIndex(DataInput di) throws IOException {
super(di);
}
-
+
public Dict getTopDict(int index) {
int offset = getOffset(index) - 1;
int len = getOffset(index + 1) - offset - 1;
return new Dict(getData(), offset, len);
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < getCount(); ++i) {
@@ -262,13 +265,13 @@ public class CffTable implements Table {
return sb.toString();
}
}
-
+
public class NameIndex extends Index {
protected NameIndex(DataInput di) throws IOException {
super(di);
}
-
+
public String getName(int index) {
String name = null;
int offset = getOffset(index) - 1;
@@ -286,7 +289,8 @@ public class CffTable implements Table {
}
return name;
}
-
+
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < getCount(); ++i) {
@@ -301,7 +305,7 @@ public class CffTable implements Table {
protected StringIndex(DataInput di) throws IOException {
super(di);
}
-
+
public String getString(int index) {
if (index < CffStandardStrings.standardStrings.length) {
return CffStandardStrings.standardStrings[index];
@@ -320,7 +324,8 @@ public class CffTable implements Table {
return sb.toString();
}
}
-
+
+ @Override
public String toString() {
int nonStandardBase = CffStandardStrings.standardStrings.length;
StringBuilder sb = new StringBuilder();
@@ -331,12 +336,12 @@ public class CffTable implements Table {
return sb.toString();
}
}
-
+
private class CharsetRange {
-
+
private int _first;
private int _left;
-
+
public int getFirst() {
return _first;
}
@@ -344,7 +349,7 @@ public class CffTable implements Table {
protected void setFirst(int first) {
_first = first;
}
-
+
public int getLeft() {
return _left;
}
@@ -355,43 +360,45 @@ public class CffTable implements Table {
}
private class CharsetRange1 extends CharsetRange {
-
+
protected CharsetRange1(DataInput di) throws IOException {
setFirst(di.readUnsignedShort());
setLeft(di.readUnsignedByte());
}
}
-
+
private class CharsetRange2 extends CharsetRange {
-
+
protected CharsetRange2(DataInput di) throws IOException {
setFirst(di.readUnsignedShort());
setLeft(di.readUnsignedShort());
}
}
-
+
private abstract class Charset {
-
+
public abstract int getFormat();
-
+
public abstract int getSID(int gid);
}
-
+
private class CharsetFormat0 extends Charset {
-
+
private int[] _glyph;
-
+
protected CharsetFormat0(DataInput di, int glyphCount) throws IOException {
_glyph = new int[glyphCount - 1]; // minus 1 because .notdef is omitted
for (int i = 0; i < glyphCount - 1; ++i) {
_glyph[i] = di.readUnsignedShort();
}
}
-
+
+ @Override
public int getFormat() {
return 0;
}
+ @Override
public int getSID(int gid) {
if (gid == 0) {
return 0;
@@ -399,11 +406,11 @@ public class CffTable implements Table {
return _glyph[gid - 1];
}
}
-
+
private class CharsetFormat1 extends Charset {
-
+
private ArrayList<CharsetRange> _charsetRanges = new ArrayList<CharsetRange>();
-
+
protected CharsetFormat1(DataInput di, int glyphCount) throws IOException {
int glyphsCovered = glyphCount - 1; // minus 1 because .notdef is omitted
while (glyphsCovered > 0) {
@@ -413,15 +420,17 @@ public class CffTable implements Table {
}
}
+ @Override
public int getFormat() {
return 1;
}
+ @Override
public int getSID(int gid) {
if (gid == 0) {
return 0;
}
-
+
// Count through the ranges to find the one of interest
int count = 0;
for (CharsetRange range : _charsetRanges) {
@@ -436,9 +445,9 @@ public class CffTable implements Table {
}
private class CharsetFormat2 extends Charset {
-
+
private ArrayList<CharsetRange> _charsetRanges = new ArrayList<CharsetRange>();
-
+
protected CharsetFormat2(DataInput di, int glyphCount) throws IOException {
int glyphsCovered = glyphCount - 1; // minus 1 because .notdef is omitted
while (glyphsCovered > 0) {
@@ -448,15 +457,17 @@ public class CffTable implements Table {
}
}
+ @Override
public int getFormat() {
return 2;
}
+ @Override
public int getSID(int gid) {
if (gid == 0) {
return 0;
}
-
+
// Count through the ranges to find the one of interest
int count = 0;
for (CharsetRange range : _charsetRanges) {
@@ -469,7 +480,7 @@ public class CffTable implements Table {
return 0;
}
}
-
+
private DirectoryEntry _de;
private int _major;
private int _minor;
@@ -499,24 +510,24 @@ public class CffTable implements Table {
_minor = di2.readUnsignedByte();
_hdrSize = di2.readUnsignedByte();
_offSize = di2.readUnsignedByte();
-
+
// Name INDEX
di2 = getDataInputForOffset(_hdrSize);
_nameIndex = new NameIndex(di2);
-
+
// Top DICT INDEX
_topDictIndex = new TopDictIndex(di2);
// String INDEX
_stringIndex = new StringIndex(di2);
-
+
// Global Subr INDEX
_globalSubrIndex = new Index(di2);
-
+
// Encodings go here -- but since this is an OpenType font will this
// not always be a CIDFont? In which case there are no encodings
// within the CFF data.
-
+
// Load each of the fonts
_charStringsIndexArray = new Index[_topDictIndex.getCount()];
_charsets = new Charset[_topDictIndex.getCount()];
@@ -530,7 +541,7 @@ public class CffTable implements Table {
di2 = getDataInputForOffset(charStringsOffset);
_charStringsIndexArray[i] = new Index(di2);
int glyphCount = _charStringsIndexArray[i].getCount();
-
+
// Charsets
Integer charsetOffset = (Integer) _topDictIndex.getTopDict(i).getValue(15);
di2 = getDataInputForOffset(charsetOffset);
@@ -563,7 +574,7 @@ public class CffTable implements Table {
}
}
}
-
+
private DataInput getDataInputForOffset(int offset) {
return new DataInputStream(new ByteArrayInputStream(
_buf, offset,
@@ -573,7 +584,7 @@ public class CffTable implements Table {
public NameIndex getNameIndex() {
return _nameIndex;
}
-
+
public Charset getCharset(int fontIndex) {
return _charsets[fontIndex];
}
@@ -581,15 +592,17 @@ public class CffTable implements Table {
public Charstring getCharstring(int fontIndex, int gid) {
return _charstringsArray[fontIndex][gid];
}
-
+
public int getCharstringCount(int fontIndex) {
return _charstringsArray[fontIndex].length;
}
+ @Override
public int getType() {
return CFF;
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("'CFF' Table - Compact Font Format\n---------------------------------\n");
@@ -607,13 +620,14 @@ public class CffTable implements Table {
}
return sb.toString();
}
-
+
/**
* Get a directory entry for this table. This uniquely identifies the
* table in collections where there may be more than one instance of a
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return _de;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Charstring.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Charstring.java
index d411d1e..01e2d49 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Charstring.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Charstring.java
@@ -28,6 +28,6 @@ package jogamp.graph.font.typecast.ot.table;
public abstract class Charstring {
public abstract int getIndex();
-
+
public abstract String getName();
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java
index 9c40a0e..7a7b518 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java
@@ -28,7 +28,7 @@ import jogamp.graph.font.typecast.ot.table.CffTable;
* @author <a href="mailto:davidsch at dev.java.net">David Schweinsberg</a>
*/
public class CharstringType2 extends Charstring {
-
+
private static final String[] _oneByteOperators = {
"-Reserved-",
"hstem",
@@ -105,7 +105,7 @@ public class CharstringType2 extends Charstring {
"flex1",
"-Reserved-"
};
-
+
private int _index;
private String _name;
private int[] _data;
@@ -132,15 +132,17 @@ public class CharstringType2 extends Charstring {
_localSubrIndex = localSubrIndex;
_globalSubrIndex = globalSubrIndex;
}
-
+
+ @Override
public int getIndex() {
return _index;
}
+ @Override
public String getName() {
return _name;
}
-
+
private void disassemble(StringBuilder sb) {
Number operand = null;
while (isOperandAtIndex()) {
@@ -151,7 +153,7 @@ public class CharstringType2 extends Charstring {
String mnemonic;
if (operator == 12) {
operator = nextByte();
-
+
// Check we're not exceeding the upper limit of our mnemonics
if (operator > 38) {
operator = 38;
@@ -162,7 +164,7 @@ public class CharstringType2 extends Charstring {
}
sb.append(mnemonic);
}
-
+
public void resetIP() {
_ip = _offset;
}
@@ -214,15 +216,16 @@ public class CharstringType2 extends Charstring {
return null;
}
}
-
+
public int nextByte() {
return _data[_ip++];
}
-
+
public boolean moreBytes() {
return _ip < _offset + _length;
}
-
+
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
resetIP();
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDef.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDef.java
index 4c2f3de..21698c7 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDef.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDef.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat1.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat1.java
index 0c99ad6..94910e4 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat1.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat1.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -32,6 +32,7 @@ public class ClassDefFormat1 extends ClassDef {
}
}
+ @Override
public int getFormat() {
return 1;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat2.java
index 5b7c4d6..9906ecf 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat2.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat2.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -30,6 +30,7 @@ public class ClassDefFormat2 extends ClassDef {
}
}
+ @Override
public int getFormat() {
return 2;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat.java
index 7ce531c..f705485 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat.java
@@ -58,21 +58,21 @@ import java.io.IOException;
* @author <a href="mailto:davidsch at dev.java.net">David Schweinsberg</a>
*/
public abstract class CmapFormat {
-
+
public class Range {
-
+
private int _startCode;
private int _endCode;
-
+
protected Range(int startCode, int endCode) {
_startCode = startCode;
_endCode = endCode;
}
-
+
public int getStartCode() {
return _startCode;
}
-
+
public int getEndCode() {
return _endCode;
}
@@ -116,12 +116,13 @@ public abstract class CmapFormat {
}
public abstract int getRangeCount();
-
+
public abstract Range getRange(int index)
throws ArrayIndexOutOfBoundsException;
public abstract int mapCharCode(int charCode);
-
+
+ @Override
public String toString() {
return new StringBuilder()
.append("format: ")
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat0.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat0.java
index e374f82..dd1ede2 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat0.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat0.java
@@ -71,10 +71,12 @@ public class CmapFormat0 extends CmapFormat {
}
}
+ @Override
public int getRangeCount() {
return 1;
}
-
+
+ @Override
public Range getRange(int index) throws ArrayIndexOutOfBoundsException {
if (index != 0) {
throw new ArrayIndexOutOfBoundsException();
@@ -82,6 +84,7 @@ public class CmapFormat0 extends CmapFormat {
return new Range(0, 255);
}
+ @Override
public int mapCharCode(int charCode) {
if (0 <= charCode && charCode < 256) {
return _glyphIdArray[charCode];
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat2.java
index 319d8c0..d071e94 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat2.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat2.java
@@ -67,7 +67,7 @@ public class CmapFormat2 extends CmapFormat {
int _idRangeOffset;
int _arrayIndex;
}
-
+
private int[] _subHeaderKeys = new int[256];
private SubHeader[] _subHeaders;
private int[] _glyphIndexArray;
@@ -75,9 +75,9 @@ public class CmapFormat2 extends CmapFormat {
protected CmapFormat2(DataInput di) throws IOException {
super(di);
_format = 2;
-
+
int pos = 6;
-
+
// Read the subheader keys, noting the highest value, as this will
// determine the number of subheaders to read.
int highest = 0;
@@ -88,7 +88,7 @@ public class CmapFormat2 extends CmapFormat {
}
int subHeaderCount = highest / 8 + 1;
_subHeaders = new SubHeader[subHeaderCount];
-
+
// Read the subheaders, once again noting the highest glyphIndexArray
// index range.
int indexArrayOffset = 8 * subHeaderCount + 518;
@@ -99,18 +99,18 @@ public class CmapFormat2 extends CmapFormat {
sh._entryCount = di.readUnsignedShort();
sh._idDelta = di.readShort();
sh._idRangeOffset = di.readUnsignedShort();
-
+
// Calculate the offset into the _glyphIndexArray
pos += 8;
sh._arrayIndex =
(pos - 2 + sh._idRangeOffset - indexArrayOffset) / 2;
-
+
// What is the highest range within the glyphIndexArray?
highest = Math.max(highest, sh._arrayIndex + sh._entryCount);
-
+
_subHeaders[i] = sh;
}
-
+
// Read the glyphIndexArray
_glyphIndexArray = new int[highest];
for (int i = 0; i < _glyphIndexArray.length; ++i) {
@@ -118,15 +118,17 @@ public class CmapFormat2 extends CmapFormat {
}
}
+ @Override
public int getRangeCount() {
return _subHeaders.length;
}
-
+
+ @Override
public Range getRange(int index) throws ArrayIndexOutOfBoundsException {
if (index < 0 || index >= _subHeaders.length) {
throw new ArrayIndexOutOfBoundsException();
}
-
+
// Find the high-byte (if any)
int highByte = 0;
if (index != 0) {
@@ -137,15 +139,16 @@ public class CmapFormat2 extends CmapFormat {
}
}
}
-
+
return new Range(
highByte | _subHeaders[index]._firstCode,
highByte | (_subHeaders[index]._firstCode +
_subHeaders[index]._entryCount - 1));
}
+ @Override
public int mapCharCode(int charCode) {
-
+
// Get the appropriate subheader
int index = 0;
int highByte = charCode >> 8;
@@ -153,14 +156,14 @@ public class CmapFormat2 extends CmapFormat {
index = _subHeaderKeys[highByte] / 8;
}
SubHeader sh = _subHeaders[index];
-
+
// Is the charCode out-of-range?
int lowByte = charCode & 0xff;
if (lowByte < sh._firstCode ||
lowByte >= (sh._firstCode + sh._entryCount)) {
return 0;
}
-
+
// Now calculate the glyph index
int glyphIndex =
_glyphIndexArray[sh._arrayIndex + (lowByte - sh._firstCode)];
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat4.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat4.java
index c09bdc8..2ae23d0 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat4.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat4.java
@@ -102,7 +102,7 @@ public class CmapFormat4 extends CmapFormat {
for (int i = 0; i < count; i++) {
_glyphIdArray[i] = di.readUnsignedShort();
} // + 2*count (8*segCount + 2*count + 18)
-
+
// Are there any padding bytes we need to consume?
// int leftover = length - (8*segCount + 2*count + 18);
// if (leftover > 0) {
@@ -110,10 +110,12 @@ public class CmapFormat4 extends CmapFormat {
// }
}
+ @Override
public int getRangeCount() {
return _segCount;
}
-
+
+ @Override
public Range getRange(int index) throws ArrayIndexOutOfBoundsException {
if (index < 0 || index >= _segCount) {
throw new ArrayIndexOutOfBoundsException();
@@ -121,6 +123,7 @@ public class CmapFormat4 extends CmapFormat {
return new Range(_startCode[index], _endCode[index]);
}
+ @Override
public int mapCharCode(int charCode) {
try {
for (int i = 0; i < _segCount; i++) {
@@ -142,6 +145,7 @@ public class CmapFormat4 extends CmapFormat {
return 0;
}
+ @Override
public String toString() {
return new StringBuilder()
.append(super.toString())
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat6.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat6.java
index a58531d..2a33d8d 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat6.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat6.java
@@ -67,20 +67,23 @@ public class CmapFormat6 extends CmapFormat {
protected CmapFormat6(DataInput di) throws IOException {
super(di);
_format = 6;
-
+
// HACK: As this is not yet implemented, we need to skip over the bytes
// we should be consuming
//di.skipBytes(_length - 4);
}
+ @Override
public int getRangeCount() {
return 0;
}
-
+
+ @Override
public Range getRange(int index) throws ArrayIndexOutOfBoundsException {
throw new ArrayIndexOutOfBoundsException();
}
+ @Override
public int mapCharCode(int charCode) {
return 0;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormatUnknown.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormatUnknown.java
index 83366b5..392683b 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormatUnknown.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormatUnknown.java
@@ -30,24 +30,27 @@ import java.io.IOException;
* @version $Id: CmapFormatUnknown.java,v 1.1 2004-12-21 10:21:23 davidsch Exp $
*/
public class CmapFormatUnknown extends CmapFormat {
-
+
/** Creates a new instance of CmapFormatUnknown */
protected CmapFormatUnknown(int format, DataInput di) throws IOException {
super(di);
_format = format;
-
+
// We don't know how to handle this data, so we'll just skip over it
di.skipBytes(_length - 4);
}
+ @Override
public int getRangeCount() {
return 0;
}
-
+
+ @Override
public Range getRange(int index) throws ArrayIndexOutOfBoundsException {
throw new ArrayIndexOutOfBoundsException();
}
+ @Override
public int mapCharCode(int charCode) {
return 0;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapIndexEntry.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapIndexEntry.java
index 85fdf72..4833318 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapIndexEntry.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapIndexEntry.java
@@ -85,11 +85,12 @@ public class CmapIndexEntry implements Comparable {
public CmapFormat getFormat() {
return _format;
}
-
+
public void setFormat(CmapFormat format) {
_format = format;
}
+ @Override
public String toString() {
return new StringBuilder()
.append("platform id: ")
@@ -104,6 +105,7 @@ public class CmapIndexEntry implements Comparable {
.append(_offset).toString();
}
+ @Override
public int compareTo(java.lang.Object obj) {
CmapIndexEntry entry = (CmapIndexEntry) obj;
if (getOffset() < entry.getOffset()) {
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java
index 0050fdd..2cdddb3 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java
@@ -94,7 +94,7 @@ public class CmapTable implements Table {
} else if (_entries[i].getOffset() > bytesRead) {
di.skipBytes(_entries[i].getOffset() - (int) bytesRead);
} else if (_entries[i].getOffset() != bytesRead) {
-
+
// Something is amiss
throw new IOException();
}
@@ -109,15 +109,15 @@ public class CmapTable implements Table {
public int getVersion() {
return _version;
}
-
+
public int getNumTables() {
return _numTables;
}
-
+
public CmapIndexEntry getCmapIndexEntry(int i) {
return _entries[i];
}
-
+
public CmapFormat getCmapFormat(short platformId, short encodingId) {
// Find the requested format
@@ -130,10 +130,12 @@ public class CmapTable implements Table {
return null;
}
+ @Override
public int getType() {
return cmap;
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder().append("cmap\n");
@@ -148,13 +150,14 @@ public class CmapTable implements Table {
// }
return sb.toString();
}
-
+
/**
* Get a directory entry for this table. This uniquely identifies the
* table in collections where there may be more than one instance of a
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return _de;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Coverage.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Coverage.java
index e85fadb..4f526f5 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Coverage.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Coverage.java
@@ -68,7 +68,7 @@ public abstract class Coverage {
* can't be found.
*/
public abstract int findGlyph(int glyphId);
-
+
protected static Coverage read(DataInput di) throws IOException {
Coverage c = null;
int format = di.readUnsignedShort();
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat1.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat1.java
index 712da54..715bf11 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat1.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat1.java
@@ -72,10 +72,12 @@ public class CoverageFormat1 extends Coverage {
}
}
+ @Override
public int getFormat() {
return 1;
}
+ @Override
public int findGlyph(int glyphId) {
for (int i = 0; i < _glyphCount; i++) {
if (_glyphIds[i] == glyphId) {
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat2.java
index 7196ed5..bd2a28f 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat2.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat2.java
@@ -72,10 +72,12 @@ public class CoverageFormat2 extends Coverage {
}
}
+ @Override
public int getFormat() {
return 2;
}
+ @Override
public int findGlyph(int glyphId) {
for (int i = 0; i < _rangeCount; i++) {
int n = _rangeRecords[i].getCoverageIndex(glyphId);
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java
index 9631635..9e1c47d 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -29,6 +29,7 @@ public class CvtTable implements Table {
}
}
+ @Override
public int getType() {
return cvt;
}
@@ -37,6 +38,7 @@ public class CvtTable implements Table {
return values;
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("'cvt ' Table - Control Value Table\n----------------------------------\n");
@@ -47,15 +49,16 @@ public class CvtTable implements Table {
}
return sb.toString();
}
-
+
/**
* Get a directory entry for this table. This uniquely identifies the
* table in collections where there may be more than one instance of a
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return de;
}
-
+
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Device.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Device.java
index 6b4af69..5451f45 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Device.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Device.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DirectoryEntry.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DirectoryEntry.java
index c98f03f..e34fa32 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DirectoryEntry.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DirectoryEntry.java
@@ -70,7 +70,8 @@ public class DirectoryEntry implements Cloneable {
_offset = di.readInt();
_length = di.readInt();
}
-
+
+ @Override
public Object clone() {
try {
return super.clone();
@@ -103,7 +104,8 @@ public class DirectoryEntry implements Cloneable {
.append((char)((_tag)&0xff))
.toString();
}
-
+
+ @Override
public String toString() {
return new StringBuilder()
.append("'").append(getTagAsString())
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigEntry.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigEntry.java
index 4b41f45..4a09a4c 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigEntry.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigEntry.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -21,7 +21,7 @@ public class DsigEntry {
private int format;
private int length;
private int offset;
-
+
/** Creates new DsigEntry */
protected DsigEntry(DataInput di) throws IOException {
format = di.readInt();
@@ -32,11 +32,11 @@ public class DsigEntry {
public int getFormat() {
return format;
}
-
+
public int getLength() {
return length;
}
-
+
public int getOffset() {
return offset;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java
index e2784f9..2b85f52 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -45,20 +45,23 @@ public class DsigTable implements Table {
* Get the table type, as a table directory value.
* @return The table type
*/
+ @Override
public int getType() {
return DSIG;
}
-
+
/**
* Get a directory entry for this table. This uniquely identifies the
* table in collections where there may be more than one instance of a
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return de;
}
-
+
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder().append("DSIG\n");
for (int i = 0; i < numSigs; i++) {
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureList.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureList.java
index 3cfb54a..fdedca9 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureList.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureList.java
@@ -66,11 +66,11 @@ public class FeatureList {
/** Creates new FeatureList */
public FeatureList(DataInputStream dis, int offset) throws IOException {
-
+
// Ensure we're in the right place
dis.reset();
dis.skipBytes(offset);
-
+
// Start reading
_featureCount = dis.readUnsignedShort();
_featureRecords = new FeatureRecord[_featureCount];
@@ -88,11 +88,11 @@ public class FeatureList {
public int getFeatureCount() {
return _featureCount;
}
-
+
public FeatureRecord getFeatureRecord(int i) {
return _featureRecords[i];
}
-
+
public Feature getFeature(int i) {
return _features[i];
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureRecord.java
index eb61081..1da74f4 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureRecord.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureRecord.java
@@ -72,7 +72,7 @@ public class FeatureRecord {
public int getTag() {
return _tag;
}
-
+
public int getOffset() {
return _offset;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java
index 9a60001..467a4f3 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -26,22 +26,25 @@ public class FpgmTable extends Program implements Table {
readInstructions(di, de.getLength());
}
+ @Override
public int getType() {
return fpgm;
}
+ @Override
public String toString() {
return Disassembler.disassemble(getInstructions(), 0);
}
-
+
/**
* Get a directory entry for this table. This uniquely identifies the
* table in collections where there may be more than one instance of a
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return de;
}
-
+
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspRange.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspRange.java
index 2748406..cc87b19 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspRange.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspRange.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -20,16 +20,17 @@ public class GaspRange {
public static final int GASP_GRIDFIT = 1;
public static final int GASP_DOGRAY = 2;
-
+
private int rangeMaxPPEM;
private int rangeGaspBehavior;
-
+
/** Creates new GaspRange */
protected GaspRange(DataInput di) throws IOException {
rangeMaxPPEM = di.readUnsignedShort();
rangeGaspBehavior = di.readUnsignedShort();
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(" rangeMaxPPEM: ").append(rangeMaxPPEM)
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java
index a83db5b..8f91e6d 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -22,7 +22,7 @@ public class GaspTable implements Table {
private int version;
private int numRanges;
private GaspRange[] gaspRange;
-
+
/** Creates new GaspTable */
protected GaspTable(DirectoryEntry de, DataInput di) throws IOException {
this.de = (DirectoryEntry) de.clone();
@@ -34,10 +34,12 @@ public class GaspTable implements Table {
}
}
+ @Override
public int getType() {
return gasp;
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("'gasp' Table - Grid-fitting And Scan-conversion Procedure\n---------------------------------------------------------");
@@ -49,15 +51,16 @@ public class GaspTable implements Table {
}
return sb.toString();
}
-
+
/**
* Get a directory entry for this table. This uniquely identifies the
* table in collections where there may be more than one instance of a
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return de;
}
-
+
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java
index 4cf2541..50e0fa3 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java
@@ -73,7 +73,7 @@ public class GlyfCompositeDescript extends GlyfDescript {
int glyphIndex,
DataInput di) throws IOException {
super(parentTable, glyphIndex, (short) -1, di);
-
+
// Get all of the composite components
GlyfCompositeComp comp;
int firstIndex = 0;
@@ -99,6 +99,7 @@ public class GlyfCompositeDescript extends GlyfDescript {
}
}
+ @Override
public int getEndPtOfContours(int i) {
GlyfCompositeComp c = getCompositeCompEndPt(i);
if (c != null) {
@@ -108,6 +109,7 @@ public class GlyfCompositeDescript extends GlyfDescript {
return 0;
}
+ @Override
public byte getFlags(int i) {
GlyfCompositeComp c = getCompositeComp(i);
if (c != null) {
@@ -117,6 +119,7 @@ public class GlyfCompositeDescript extends GlyfDescript {
return 0;
}
+ @Override
public short getXCoordinate(int i) {
GlyfCompositeComp c = getCompositeComp(i);
if (c != null) {
@@ -131,6 +134,7 @@ public class GlyfCompositeDescript extends GlyfDescript {
return 0;
}
+ @Override
public short getYCoordinate(int i) {
GlyfCompositeComp c = getCompositeComp(i);
if (c != null) {
@@ -145,10 +149,12 @@ public class GlyfCompositeDescript extends GlyfDescript {
return 0;
}
+ @Override
public boolean isComposite() {
return true;
}
+ @Override
public int getPointCount() {
GlyfCompositeComp c = _components.get(_components.size()-1);
GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex());
@@ -159,6 +165,7 @@ public class GlyfCompositeDescript extends GlyfDescript {
}
}
+ @Override
public int getContourCount() {
GlyfCompositeComp c = _components.get(_components.size()-1);
return c.getFirstContour() + _parentTable.getDescription(c.getGlyphIndex()).getContourCount();
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfDescript.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfDescript.java
index a9342a4..6b06eb3 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfDescript.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfDescript.java
@@ -92,26 +92,32 @@ public abstract class GlyfDescript extends Program implements GlyphDescription {
return _numberOfContours;
}
+ @Override
public int getGlyphIndex() {
return _glyphIndex;
}
+ @Override
public short getXMaximum() {
return _xMax;
}
+ @Override
public short getXMinimum() {
return _xMin;
}
+ @Override
public short getYMaximum() {
return _yMax;
}
+ @Override
public short getYMinimum() {
return _yMin;
}
-
+
+ @Override
public String toString() {
return new StringBuilder()
.append(" numberOfContours: ").append(_numberOfContours)
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfSimpleDescript.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfSimpleDescript.java
index c11d2d8..c06ceaa 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfSimpleDescript.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfSimpleDescript.java
@@ -73,7 +73,7 @@ public class GlyfSimpleDescript extends GlyfDescript {
short numberOfContours,
DataInput di) throws IOException {
super(parentTable, glyphIndex, numberOfContours, di);
-
+
// Simple glyph description
_endPtsOfContours = new int[numberOfContours];
for (int i = 0; i < numberOfContours; i++) {
@@ -92,30 +92,37 @@ public class GlyfSimpleDescript extends GlyfDescript {
readCoords(_count, di);
}
+ @Override
public int getEndPtOfContours(int i) {
return _endPtsOfContours[i];
}
+ @Override
public byte getFlags(int i) {
return _flags[i];
}
+ @Override
public short getXCoordinate(int i) {
return _xCoordinates[i];
}
+ @Override
public short getYCoordinate(int i) {
return _yCoordinates[i];
}
+ @Override
public boolean isComposite() {
return false;
}
+ @Override
public int getPointCount() {
return _count;
}
+ @Override
public int getContourCount() {
return getNumberOfContours();
}
@@ -184,7 +191,8 @@ public class GlyfSimpleDescript extends GlyfDescript {
System.out.println("error: array index out of bounds");
}
}
-
+
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(super.toString());
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java
index 22fdd88..4b196c9 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java
@@ -71,12 +71,12 @@ public class GlyfTable implements Table {
LocaTable loca) throws IOException {
_de = (DirectoryEntry) de.clone();
_descript = new GlyfDescript[maxp.getNumGlyphs()];
-
+
// Buffer the whole table so we can randomly access it
byte[] buf = new byte[de.getLength()];
di.readFully(buf);
ByteArrayInputStream bais = new ByteArrayInputStream(buf);
-
+
// Process all the simple glyphs
for (int i = 0; i < maxp.getNumGlyphs(); i++) {
int len = loca.getOffset(i + 1) - loca.getOffset(i);
@@ -116,16 +116,18 @@ public class GlyfTable implements Table {
}
}
+ @Override
public int getType() {
return glyf;
}
-
+
/**
* Get a directory entry for this table. This uniquely identifies the
* table in collections where there may be more than one instance of a
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return _de;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyphDescription.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyphDescription.java
index 106e179..025778d 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyphDescription.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyphDescription.java
@@ -56,29 +56,29 @@ package jogamp.graph.font.typecast.ot.table;
* @author <a href="mailto:davidsch at dev.java.net">David Schweinsberg</a>
*/
public interface GlyphDescription {
-
+
public int getGlyphIndex();
-
+
public int getEndPtOfContours(int i);
-
+
public byte getFlags(int i);
-
+
public short getXCoordinate(int i);
-
+
public short getYCoordinate(int i);
-
+
public short getXMaximum();
-
+
public short getXMinimum();
-
+
public short getYMaximum();
-
+
public short getYMinimum();
-
+
public boolean isComposite();
-
+
public int getPointCount();
-
+
public int getContourCount();
// public int getComponentIndex(int c);
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java
index 91a6236..30ecdd0 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java
@@ -45,10 +45,12 @@ public class GposTable implements Table {
/** Get the table type, as a table directory value.
* @return The table type
*/
+ @Override
public int getType() {
return GPOS;
}
-
+
+ @Override
public String toString() {
return "GPOS";
}
@@ -59,8 +61,9 @@ public class GposTable implements Table {
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return _de;
}
-
+
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java
index c002de3..c23d420 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java
@@ -66,10 +66,10 @@ public class GsubTable implements Table, LookupSubtableFactory {
private ScriptList _scriptList;
private FeatureList _featureList;
private LookupList _lookupList;
-
+
protected GsubTable(DirectoryEntry de, DataInput di) throws IOException {
_de = (DirectoryEntry) de.clone();
-
+
// Load into a temporary buffer, and create another input stream
byte[] buf = new byte[de.getLength()];
di.readFully(buf);
@@ -86,19 +86,20 @@ public class GsubTable implements Table, LookupSubtableFactory {
// Feature List
_featureList = new FeatureList(dis, featureListOffset);
-
+
// Lookup List
_lookupList = new LookupList(dis, lookupListOffset, this);
}
/**
- * 1 - Single - Replace one glyph with one glyph
- * 2 - Multiple - Replace one glyph with more than one glyph
- * 3 - Alternate - Replace one glyph with one of many glyphs
- * 4 - Ligature - Replace multiple glyphs with one glyph
- * 5 - Context - Replace one or more glyphs in context
+ * 1 - Single - Replace one glyph with one glyph
+ * 2 - Multiple - Replace one glyph with more than one glyph
+ * 3 - Alternate - Replace one glyph with one of many glyphs
+ * 4 - Ligature - Replace multiple glyphs with one glyph
+ * 5 - Context - Replace one or more glyphs in context
* 6 - Chaining - Context Replace one or more glyphs in chained context
*/
+ @Override
public LookupSubtable read(
int type,
DataInputStream dis,
@@ -130,6 +131,7 @@ public class GsubTable implements Table, LookupSubtableFactory {
/** Get the table type, as a table directory value.
* @return The table type
*/
+ @Override
public int getType() {
return GSUB;
}
@@ -146,6 +148,7 @@ public class GsubTable implements Table, LookupSubtableFactory {
return _lookupList;
}
+ @Override
public String toString() {
return "GSUB";
}
@@ -167,15 +170,16 @@ public class GsubTable implements Table, LookupSubtableFactory {
}
return "Unknown";
}
-
+
/**
* Get a directory entry for this table. This uniquely identifies the
* table in collections where there may be more than one instance of a
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return _de;
}
-
+
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java
index 5b1fa20..64f5e64 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java
@@ -30,9 +30,9 @@ import java.io.IOException;
* @version $Id: HdmxTable.java,v 1.2 2007-07-26 11:12:30 davidsch Exp $
*/
public class HdmxTable implements Table {
-
+
public class DeviceRecord {
-
+
private short _pixelSize;
private short _maxWidth;
private short[] _widths;
@@ -49,11 +49,11 @@ public class HdmxTable implements Table {
public short getPixelSize() {
return _pixelSize;
}
-
+
public short getMaxWidth() {
return _maxWidth;
}
-
+
public short[] getWidths() {
return _widths;
}
@@ -61,9 +61,9 @@ public class HdmxTable implements Table {
public short getWidth(int glyphidx) {
return _widths[glyphidx];
}
-
+
}
-
+
private DirectoryEntry _de;
private int _version;
private short _numRecords;
@@ -78,7 +78,7 @@ public class HdmxTable implements Table {
_numRecords = di.readShort();
_sizeDeviceRecords = di.readInt();
_records = new DeviceRecord[_numRecords];
-
+
// Read the device records
for (int i = 0; i < _numRecords; ++i) {
_records[i] = new DeviceRecord(maxp.getNumGlyphs(), di);
@@ -88,15 +88,17 @@ public class HdmxTable implements Table {
public int getNumberOfRecords() {
return _numRecords;
}
-
+
public DeviceRecord getRecord(int i) {
return _records[i];
}
-
+
+ @Override
public int getType() {
return hdmx;
}
-
+
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("'hdmx' Table - Horizontal Device Metrics\n----------------------------------------\n");
@@ -124,6 +126,7 @@ public class HdmxTable implements Table {
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return _de;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java
index 9d7fe42..47e60f9 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java
@@ -142,6 +142,7 @@ public class HeadTable implements Table {
return _modified;
}
+ @Override
public int getType() {
return head;
}
@@ -170,6 +171,7 @@ public class HeadTable implements Table {
return _yMin;
}
+ @Override
public String toString() {
return new StringBuilder()
.append("'head' Table - Font Header\n--------------------------")
@@ -192,15 +194,16 @@ public class HeadTable implements Table {
.append("\n glyphDataFormat: ").append(_glyphDataFormat)
.toString();
}
-
+
/**
* Get a directory entry for this table. This uniquely identifies the
* table in collections where there may be more than one instance of a
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return _de;
}
-
+
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java
index 20a21e4..242c9b1 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -92,6 +92,7 @@ public class HheaTable implements Table {
return numberOfHMetrics;
}
+ @Override
public int getType() {
return hhea;
}
@@ -100,6 +101,7 @@ public class HheaTable implements Table {
return xMaxExtent;
}
+ @Override
public String toString() {
return new StringBuilder()
.append("'hhea' Table - Horizontal Header\n--------------------------------")
@@ -122,15 +124,16 @@ public class HheaTable implements Table {
.append("\n numOf_LongHorMetrics: ").append(numberOfHMetrics)
.toString();
}
-
+
/**
* Get a directory entry for this table. This uniquely identifies the
* table in collections where there may be more than one instance of a
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return de;
}
-
+
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HmtxTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HmtxTable.java
index dacd9e2..122a0a8 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HmtxTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HmtxTable.java
@@ -106,10 +106,12 @@ public class HmtxTable implements Table {
}
}
+ @Override
public int getType() {
return hmtx;
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("'hmtx' Table - Horizontal Metrics\n---------------------------------\n");
@@ -135,6 +137,7 @@ public class HmtxTable implements Table {
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return _de;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ID.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ID.java
index 9fd66e7..eed8c18 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ID.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ID.java
@@ -38,7 +38,7 @@ public abstract class ID {
public static final short encodingUnicode11Semantics = 1;
public static final short encodingISO10646Semantics = 2;
public static final short encodingUnicode20Semantics = 3;
-
+
// Microsoft Encoding IDs
// public static final short encodingUndefined = 0;
// public static final short encodingUGL = 1;
@@ -203,7 +203,7 @@ public abstract class ID {
public static String getEncodingName(short platformId, short encodingId) {
if (platformId == platformUnicode) {
-
+
// Unicode specific encodings
switch (encodingId) {
case encodingUnicode10Semantics: return "Unicode 1.0 semantics";
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtable.java
index 7a4cccb..04fd646 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtable.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -21,7 +21,7 @@ public abstract class KernSubtable {
/** Creates new KernSubtable */
protected KernSubtable() {
}
-
+
public abstract int getKerningPairCount();
public abstract KerningPair getKerningPair(int i);
@@ -32,7 +32,7 @@ public abstract class KernSubtable {
int length = di.readUnsignedShort();
int coverage = di.readUnsignedShort();
int format = coverage >> 8;
-
+
switch (format) {
case 0:
table = new KernSubtableFormat0(di);
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat0.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat0.java
index b55bef6..1e7ff8c 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat0.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat0.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -17,7 +17,7 @@ import java.io.IOException;
* @version $Id: KernSubtableFormat0.java,v 1.1.1.1 2004-12-05 23:14:48 davidsch Exp $
*/
public class KernSubtableFormat0 extends KernSubtable {
-
+
private int nPairs;
private int searchRange;
private int entrySelector;
@@ -36,10 +36,12 @@ public class KernSubtableFormat0 extends KernSubtable {
}
}
+ @Override
public int getKerningPairCount() {
return nPairs;
}
+ @Override
public KerningPair getKerningPair(int i) {
return kerningPairs[i];
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat2.java
index 60d584c..9c7fc81 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat2.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat2.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -31,10 +31,12 @@ public class KernSubtableFormat2 extends KernSubtable {
array = di.readUnsignedShort();
}
+ @Override
public int getKerningPairCount() {
return 0;
}
+ @Override
public KerningPair getKerningPair(int i) {
return null;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java
index 70aee70..006a868 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -17,7 +17,7 @@ import java.io.IOException;
* @version $Id: KernTable.java,v 1.1.1.1 2004-12-05 23:14:48 davidsch Exp $
*/
public class KernTable implements Table {
-
+
private DirectoryEntry de;
private int version;
private int nTables;
@@ -37,7 +37,7 @@ public class KernTable implements Table {
public int getSubtableCount() {
return nTables;
}
-
+
public KernSubtable getSubtable(int i) {
return tables[i];
}
@@ -45,6 +45,7 @@ public class KernTable implements Table {
/** Get the table type, as a table directory value.
* @return The table type
*/
+ @Override
public int getType() {
return kern;
}
@@ -55,8 +56,9 @@ public class KernTable implements Table {
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return de;
}
-
+
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KerningPair.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KerningPair.java
index ce7cebc..52f82cc 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KerningPair.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KerningPair.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSys.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSys.java
index 6759208..1ab112a 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSys.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSys.java
@@ -64,7 +64,7 @@ public class LangSys {
private int _reqFeatureIndex;
private int _featureCount;
private int[] _featureIndex;
-
+
/** Creates new LangSys */
protected LangSys(DataInput di) throws IOException {
_lookupOrder = di.readUnsignedShort();
@@ -75,19 +75,19 @@ public class LangSys {
_featureIndex[i] = di.readUnsignedShort();
}
}
-
+
public int getLookupOrder() {
return _lookupOrder;
}
-
+
public int getReqFeatureIndex() {
return _reqFeatureIndex;
}
-
+
public int getFeatureCount() {
return _featureCount;
}
-
+
public int getFeatureIndex(int i) {
return _featureIndex[i];
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSysRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSysRecord.java
index 9511f66..f3befe3 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSysRecord.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSysRecord.java
@@ -62,7 +62,7 @@ public class LangSysRecord {
private int _tag;
private int _offset;
-
+
/** Creates new LangSysRecord */
public LangSysRecord(DataInput di) throws IOException {
_tag = di.readInt();
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Ligature.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Ligature.java
index d3e2ad5..de862a9 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Ligature.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Ligature.java
@@ -73,11 +73,11 @@ public class Ligature {
_components[i] = di.readUnsignedShort();
}
}
-
+
public int getGlyphCount() {
return _compCount;
}
-
+
public int getGlyphId(int i) {
return (i == 0) ? _ligGlyph : _components[i-1];
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubstFormat1.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubstFormat1.java
index a0f4266..1979ea5 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubstFormat1.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubstFormat1.java
@@ -89,7 +89,8 @@ public class LigatureSubstFormat1 extends LigatureSubst {
return 1;
}
+ @Override
public String getTypeAsString() {
return "LigatureSubstFormat1";
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java
index 5eb7c58..2c7079f 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -49,10 +49,12 @@ public class LocaTable implements Table {
return _offsets[i] * _factor;
}
+ @Override
public int getType() {
return loca;
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("'loca' Table - Index To Location Table\n--------------------------------------\n")
@@ -64,13 +66,14 @@ public class LocaTable implements Table {
}
return sb.toString();
}
-
+
/**
* Get a directory entry for this table. This uniquely identifies the
* table in collections where there may be more than one instance of a
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return _de;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Lookup.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Lookup.java
index 2899c24..6496c37 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Lookup.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Lookup.java
@@ -79,7 +79,7 @@ public class Lookup {
// Ensure we're in the right place
dis.reset();
dis.skipBytes(offset);
-
+
// Start reading
_type = dis.readUnsignedShort();
_flag = dis.readUnsignedShort();
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupList.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupList.java
index a3b71b6..e70a932 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupList.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupList.java
@@ -67,11 +67,11 @@ public class LookupList {
/** Creates new LookupList */
public LookupList(DataInputStream dis, int offset, LookupSubtableFactory factory)
throws IOException {
-
+
// Ensure we're in the right place
dis.reset();
dis.skipBytes(offset);
-
+
// Start reading
_lookupCount = dis.readUnsignedShort();
_lookupOffsets = new int[_lookupCount];
@@ -87,11 +87,11 @@ public class LookupList {
public int getLookupCount() {
return _lookupCount;
}
-
+
public int getLookupOffset(int i) {
return _lookupOffsets[i];
}
-
+
public Lookup getLookup(int i) {
return _lookups[i];
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupSubtableFactory.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupSubtableFactory.java
index cb4d28d..ca67df7 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupSubtableFactory.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupSubtableFactory.java
@@ -47,13 +47,13 @@
Apache Software Foundation, please see <http://www.apache.org/>.
*/
-
+
package jogamp.graph.font.typecast.ot.table;
import java.io.DataInputStream;
import java.io.IOException;
-/**
+/**
*
* @author <a href="mailto:davidsch at dev.java.net">David Schweinsberg</a>
* @version $Id: LookupSubtableFactory.java,v 1.2 2007-01-24 09:47:46 davidsch Exp $
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java
index ace3d38..47874cc 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -22,7 +22,7 @@ public class LtshTable implements Table {
private int version;
private int numGlyphs;
private int[] yPels;
-
+
/** Creates new LtshTable */
protected LtshTable(DirectoryEntry de, DataInput di) throws IOException {
this.de = (DirectoryEntry) de.clone();
@@ -38,10 +38,12 @@ public class LtshTable implements Table {
* Get the table type, as a table directory value.
* @return The table type
*/
+ @Override
public int getType() {
return LTSH;
}
-
+
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("'LTSH' Table - Linear Threshold Table\n-------------------------------------")
@@ -54,15 +56,16 @@ public class LtshTable implements Table {
}
return sb.toString();
}
-
+
/**
* Get a directory entry for this table. This uniquely identifies the
* table in collections where there may be more than one instance of a
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return de;
}
-
+
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java
index 0e8ec44..abb6047 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -39,7 +39,7 @@ public class MaxpTable implements Table {
protected MaxpTable(DirectoryEntry de, DataInput di) throws IOException {
this.de = (DirectoryEntry) de.clone();
versionNumber = di.readInt();
-
+
// CFF fonts use version 0.5, TrueType fonts use version 1.0
if (versionNumber == 0x00005000) {
numGlyphs = di.readUnsignedShort();
@@ -121,10 +121,12 @@ public class MaxpTable implements Table {
return numGlyphs;
}
+ @Override
public int getType() {
return maxp;
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("'maxp' Table - Maximum Profile\n------------------------------")
@@ -149,15 +151,16 @@ public class MaxpTable implements Table {
}
return sb.toString();
}
-
+
/**
* Get a directory entry for this table. This uniquely identifies the
* table in collections where there may be more than one instance of a
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return de;
}
-
+
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameRecord.java
index 268d6cf..a1787e3 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameRecord.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameRecord.java
@@ -75,19 +75,19 @@ public class NameRecord {
_stringLength = di.readShort();
_stringOffset = di.readShort();
}
-
+
public short getEncodingId() {
return _encodingId;
}
-
+
public short getLanguageId() {
return _languageId;
}
-
+
public short getNameId() {
return _nameId;
}
-
+
public short getPlatformId() {
return _platformId;
}
@@ -101,7 +101,7 @@ public class NameRecord {
StringBuilder sb = new StringBuilder();
di.skipBytes(_stringOffset);
if (_platformId == ID.platformUnicode) {
-
+
// Unicode (big-endian)
for (int i = 0; i < _stringLength/2; i++) {
sb.append(di.readChar());
@@ -113,13 +113,13 @@ public class NameRecord {
sb.append((char) di.readByte());
}
} else if (_platformId == ID.platformISO) {
-
+
// ISO encoding, ASCII
for (int i = 0; i < _stringLength; i++) {
sb.append((char) di.readByte());
}
} else if (_platformId == ID.platformMicrosoft) {
-
+
// Microsoft encoding, Unicode
char c;
for (int i = 0; i < _stringLength/2; i++) {
@@ -130,9 +130,10 @@ public class NameRecord {
_record = sb.toString();
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
-
+
sb.append(" Platform ID: ").append(_platformId)
.append("\n Specific ID: ").append(_encodingId)
.append("\n Language ID: ").append(_languageId)
@@ -140,7 +141,7 @@ public class NameRecord {
.append("\n Length: ").append(_stringLength)
.append("\n Offset: ").append(_stringOffset)
.append("\n\n").append(_record);
-
+
return sb.toString();
}
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java
index 6daf2ad..ad8198b 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java
@@ -68,25 +68,25 @@ public class NameTable implements Table {
private short _numberOfNameRecords;
private short _stringStorageOffset;
private NameRecord[] _records;
-
+
protected NameTable(DirectoryEntry de, DataInput di) throws IOException {
_de = (DirectoryEntry) de.clone();
_formatSelector = di.readShort();
_numberOfNameRecords = di.readShort();
_stringStorageOffset = di.readShort();
_records = new NameRecord[_numberOfNameRecords];
-
+
// Load the records, which contain the encoding information and string
// offsets
for (int i = 0; i < _numberOfNameRecords; i++) {
_records[i] = new NameRecord(di);
}
-
+
// Load the string data into a buffer so the records can copy out the
// bits they are interested in
byte[] buffer = new byte[_de.getLength() - _stringStorageOffset];
di.readFully(buffer);
-
+
// Now let the records get their hands on them
for (int i = 0; i < _numberOfNameRecords; i++) {
_records[i].loadString(
@@ -98,7 +98,7 @@ public class NameTable implements Table {
return _numberOfNameRecords;
}
-
+
public NameRecord getRecord(int i) {
if(_numberOfNameRecords > i) {
return _records[i];
@@ -130,18 +130,20 @@ public class NameTable implements Table {
return sb;
}
+ @Override
public int getType() {
return name;
}
-
+
/**
* Get a directory entry for this table. This uniquely identifies the
* table in collections where there may be more than one instance of a
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return _de;
}
-
+
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java
index f4fa76e..5340b29 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java
@@ -134,7 +134,7 @@ public class Os2Table implements Table {
_usWinDescent = di.readUnsignedShort();
_ulCodePageRange1 = di.readInt();
_ulCodePageRange2 = di.readInt();
-
+
// OpenType 1.3
if (_version == 2) {
_sxHeight = di.readShort();
@@ -276,27 +276,29 @@ public class Os2Table implements Table {
public short getXHeight() {
return _sxHeight;
}
-
+
public short getCapHeight() {
return _sCapHeight;
}
-
+
public int getDefaultChar() {
return _usDefaultChar;
}
-
+
public int getBreakChar() {
return _usBreakChar;
}
-
+
public int getMaxContext() {
return _usMaxContext;
}
+ @Override
public int getType() {
return OS_2;
}
+ @Override
public String toString() {
return new StringBuilder()
.append("'OS/2' Table - OS/2 and Windows Metrics\n---------------------------------------")
@@ -335,7 +337,7 @@ public class Os2Table implements Table {
.append("\n CodePage Range 2( Bits 32- 63 ): ").append(Integer.toHexString(_ulCodePageRange2).toUpperCase())
.toString();
}
-
+
private String getVendorIDAsString() {
return new StringBuilder()
.append((char)((_achVendorID>>24)&0xff))
@@ -344,13 +346,14 @@ public class Os2Table implements Table {
.append((char)((_achVendorID)&0xff))
.toString();
}
-
+
/**
* Get a directory entry for this table. This uniquely identifies the
* table in collections where there may be more than one instance of a
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return _de;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Panose.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Panose.java
index 6127140..7713181 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Panose.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Panose.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -42,11 +42,11 @@ public class Panose {
public byte getFamilyType() {
return bFamilyType;
}
-
+
public byte getSerifStyle() {
return bSerifStyle;
}
-
+
public byte getWeight() {
return bWeight;
}
@@ -54,31 +54,32 @@ public class Panose {
public byte getProportion() {
return bProportion;
}
-
+
public byte getContrast() {
return bContrast;
}
-
+
public byte getStrokeVariation() {
return bStrokeVariation;
}
-
+
public byte getArmStyle() {
return bArmStyle;
}
-
+
public byte getLetterForm() {
return bLetterform;
}
-
+
public byte getMidline() {
return bMidline;
}
-
+
public byte getXHeight() {
return bXHeight;
}
-
+
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(String.valueOf(bFamilyType)).append(" ")
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java
index f9dcf2c..a1f603d 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -65,10 +65,12 @@ public class PcltTable implements Table {
* Get the table type, as a table directory value.
* @return The table type
*/
+ @Override
public int getType() {
return PCLT;
}
-
+
+ @Override
public String toString() {
return new StringBuilder()
.append("'PCLT' Table - Printer Command Language Table\n---------------------------------------------")
@@ -91,15 +93,16 @@ public class PcltTable implements Table {
.append("\n reserved: ").append(reserved)
.toString();
}
-
+
/**
* Get a directory entry for this table. This uniquely identifies the
* table in collections where there may be more than one instance of a
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return de;
}
-
+
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java
index c913b4c..188b441 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -294,7 +294,7 @@ public class PostTable implements Table {
private int maxMemType42;
private int minMemType1;
private int maxMemType1;
-
+
// v2
private int numGlyphs;
private int[] glyphNameIndex;
@@ -312,7 +312,7 @@ public class PostTable implements Table {
maxMemType42 = di.readInt();
minMemType1 = di.readInt();
maxMemType1 = di.readInt();
-
+
if (version == 0x00020000) {
numGlyphs = di.readUnsignedShort();
glyphNameIndex = new int[numGlyphs];
@@ -366,14 +366,16 @@ public class PostTable implements Table {
return false;
}
}
-
+
/** Get the table type, as a table directory value.
* @return The table type
*/
+ @Override
public int getType() {
return post;
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("'post' Table - PostScript Metrics\n---------------------------------\n")
@@ -409,15 +411,16 @@ public class PostTable implements Table {
}
return sb.toString();
}
-
+
/**
* Get a directory entry for this table. This uniquely identifies the
* table in collections where there may be more than one instance of a
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return de;
}
-
+
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java
index aac10c5..4c64673 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -26,22 +26,25 @@ public class PrepTable extends Program implements Table {
readInstructions(di, de.getLength());
}
+ @Override
public int getType() {
return prep;
}
+ @Override
public String toString() {
return Disassembler.disassemble(getInstructions(), 0);
}
-
+
/**
* Get a directory entry for this table. This uniquely identifies the
* table in collections where there may be more than one instance of a
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return de;
}
-
+
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Program.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Program.java
index 28c148c..e3beabe 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Program.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Program.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/RangeRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/RangeRecord.java
index 72d703b..40ddf42 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/RangeRecord.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/RangeRecord.java
@@ -75,7 +75,7 @@ public class RangeRecord {
public boolean isInRange(int glyphId) {
return (_start <= glyphId && glyphId <= _end);
}
-
+
public int getCoverageIndex(int glyphId) {
if (isInRange(glyphId)) {
return _startCoverageIndex + glyphId - _start;
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Script.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Script.java
index eb534b5..04781a8 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Script.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Script.java
@@ -65,14 +65,14 @@ public class Script {
private LangSysRecord[] _langSysRecords;
private LangSys _defaultLangSys;
private LangSys[] _langSys;
-
+
/** Creates new ScriptTable */
protected Script(DataInputStream dis, int offset) throws IOException {
// Ensure we're in the right place
dis.reset();
dis.skipBytes(offset);
-
+
// Start reading
_defaultLangSysOffset = dis.readUnsignedShort();
_langSysCount = dis.readUnsignedShort();
@@ -102,7 +102,7 @@ public class Script {
public int getLangSysCount() {
return _langSysCount;
}
-
+
public LangSysRecord getLangSysRecord(int i) {
return _langSysRecords[i];
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptList.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptList.java
index 4af62b0..18589b7 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptList.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptList.java
@@ -63,14 +63,14 @@ public class ScriptList {
private int _scriptCount = 0;
private ScriptRecord[] _scriptRecords;
private Script[] _scripts;
-
+
/** Creates new ScriptList */
protected ScriptList(DataInputStream dis, int offset) throws IOException {
-
+
// Ensure we're in the right place
dis.reset();
dis.skipBytes(offset);
-
+
// Start reading
_scriptCount = dis.readUnsignedShort();
_scriptRecords = new ScriptRecord[_scriptCount];
@@ -86,15 +86,15 @@ public class ScriptList {
public int getScriptCount() {
return _scriptCount;
}
-
+
public ScriptRecord getScriptRecord(int i) {
return _scriptRecords[i];
}
-
+
public Script getScript(int i) {
return _scripts[i];
}
-
+
public Script findScript(String tag) {
if (tag.length() != 4) {
return null;
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptRecord.java
index 5da0608..183ca2f 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptRecord.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptRecord.java
@@ -62,7 +62,7 @@ public class ScriptRecord {
private int _tag;
private int _offset;
-
+
/** Creates new ScriptRecord */
protected ScriptRecord(DataInput di) throws IOException {
_tag = di.readInt();
@@ -72,7 +72,7 @@ public class ScriptRecord {
public int getTag() {
return _tag;
}
-
+
public int getOffset() {
return _offset;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SignatureBlock.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SignatureBlock.java
index 5a5de11..31a2d17 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SignatureBlock.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SignatureBlock.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -22,7 +22,7 @@ public class SignatureBlock {
private int reserved2;
private int signatureLen;
private byte[] signature;
-
+
/** Creates new SignatureBlock */
protected SignatureBlock(DataInput di) throws IOException {
reserved1 = di.readUnsignedShort();
@@ -32,6 +32,7 @@ public class SignatureBlock {
di.readFully(signature);
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < signatureLen; i += 16) {
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubst.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubst.java
index 8c56a74..e31281f 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubst.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubst.java
@@ -63,7 +63,7 @@ public abstract class SingleSubst extends LookupSubtable {
public abstract int getFormat();
public abstract int substitute(int glyphId);
-
+
public static SingleSubst read(DataInputStream dis, int offset) throws IOException {
SingleSubst s = null;
dis.reset();
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat1.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat1.java
index 99b85f3..e97e62a 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat1.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat1.java
@@ -73,10 +73,12 @@ public class SingleSubstFormat1 extends SingleSubst {
_coverage = Coverage.read(dis);
}
+ @Override
public int getFormat() {
return 1;
}
+ @Override
public int substitute(int glyphId) {
int i = _coverage.findGlyph(glyphId);
if (i > -1) {
@@ -84,7 +86,8 @@ public class SingleSubstFormat1 extends SingleSubst {
}
return glyphId;
}
-
+
+ @Override
public String getTypeAsString() {
return "SingleSubstFormat1";
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat2.java
index cd3b6d1..4d46b07 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat2.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat2.java
@@ -78,10 +78,12 @@ public class SingleSubstFormat2 extends SingleSubst {
_coverage = Coverage.read(dis);
}
+ @Override
public int getFormat() {
return 2;
}
+ @Override
public int substitute(int glyphId) {
int i = _coverage.findGlyph(glyphId);
if (i > -1) {
@@ -90,8 +92,9 @@ public class SingleSubstFormat2 extends SingleSubst {
return glyphId;
}
+ @Override
public String getTypeAsString() {
return "SingleSubstFormat2";
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TTCHeader.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TTCHeader.java
index b801517..f7c7d99 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TTCHeader.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TTCHeader.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -17,7 +17,7 @@ import java.io.IOException;
* @author <a href="mailto:davidsch at dev.java.net">David Schweinsberg</a>
*/
public class TTCHeader {
-
+
public static final int ttcf = 0x74746366;
private int ttcTag;
@@ -47,7 +47,7 @@ public class TTCHeader {
public int getDirectoryCount() {
return directoryCount;
}
-
+
public int getTableDirectory(int i) {
return tableDirectory[i];
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java
index 624f47b..30fd2f4 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Table.java
@@ -1,9 +1,9 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- * ------------------------------------------------------------------------- *
- * This software is published under the terms of the Apache Software License *
- * version 1.1, a copy of which has been included with this distribution in *
- * the LICENSE file. *
+ * ------------------------------------------------------------------------- *
+ * This software is published under the terms of the Apache Software License *
+ * version 1.1, a copy of which has been included with this distribution in *
+ * the LICENSE file. *
*****************************************************************************/
package jogamp.graph.font.typecast.ot.table;
@@ -51,7 +51,7 @@ public interface Table {
public static final int vmtx = 0x766d7478; // Vertical Metrics
public static final String notAvailable = "n/a";
-
+
/**
* Get the table type, as a table directory value.
* @return The table type
@@ -65,5 +65,5 @@ public interface Table {
* @return A directory entry
*/
public DirectoryEntry getDirectoryEntry();
-
+
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableDirectory.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableDirectory.java
index bacc26d..23ecba8 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableDirectory.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableDirectory.java
@@ -112,7 +112,8 @@ public class TableDirectory {
public int getVersion() {
return _version;
}
-
+
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder()
.append("Offset Table\n------ -----")
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableException.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableException.java
index 7749ea8..65aa84b 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableException.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableException.java
@@ -26,7 +26,7 @@ package jogamp.graph.font.typecast.ot.table;
* @version $Id: TableException.java,v 1.1.1.1 2004-12-05 23:15:00 davidsch Exp $
*/
public class TableException extends java.lang.Exception {
-
+
private static final long serialVersionUID = 1L;
/**
@@ -34,8 +34,8 @@ public class TableException extends java.lang.Exception {
*/
public TableException() {
}
-
-
+
+
/**
* Constructs an instance of <code>TableException</code> with the specified detail message.
* @param msg the detail message.
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableFactory.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableFactory.java
index 998ce08..956d1ae 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableFactory.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableFactory.java
@@ -47,7 +47,7 @@
Apache Software Foundation, please see <http://www.apache.org/>.
*/
-
+
package jogamp.graph.font.typecast.ot.table;
import java.io.DataInputStream;
@@ -56,7 +56,7 @@ import java.io.IOException;
import jogamp.graph.font.typecast.ot.OTFont;
import jogamp.graph.font.typecast.ot.OTFontCollection;
-/**
+/**
*
* @version $Id: TableFactory.java,v 1.7 2007-02-05 12:39:51 davidsch Exp $
* @author <a href="mailto:davidsch at dev.java.net">David Schweinsberg</a>
@@ -69,7 +69,7 @@ public class TableFactory {
DirectoryEntry de,
DataInputStream dis) throws IOException {
Table t = null;
-
+
// First, if we have a font collection, look for the table there
if (fc != null) {
t = fc.getTable(de);
@@ -77,7 +77,7 @@ public class TableFactory {
return t;
}
}
-
+
// Create the table
switch (de.getTag()) {
case Table.BASE:
@@ -175,7 +175,7 @@ public class TableFactory {
t = new VmtxTable(de, dis, font.getVheaTable(), font.getMaxpTable());
break;
}
-
+
// If we have a font collection, add this table to it
if ((fc != null) && (t != null)) {
fc.addTable(t);
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java
index 80579f5..bebd7f9 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java
@@ -31,12 +31,12 @@ import java.io.IOException;
public class VdmxTable implements Table {
private class Ratio {
-
+
private byte _bCharSet;
private byte _xRatio;
private byte _yStartRatio;
private byte _yEndRatio;
-
+
protected Ratio(DataInput di) throws IOException {
_bCharSet = di.readByte();
_xRatio = di.readByte();
@@ -47,26 +47,26 @@ public class VdmxTable implements Table {
public byte getBCharSet() {
return _bCharSet;
}
-
+
public byte getXRatio() {
return _xRatio;
}
-
+
public byte getYStartRatio() {
return _yStartRatio;
}
-
+
public byte getYEndRatio() {
return _yEndRatio;
}
}
-
+
private class VTableRecord {
-
+
private int _yPelHeight;
private short _yMax;
private short _yMin;
-
+
protected VTableRecord(DataInput di) throws IOException {
_yPelHeight = di.readUnsignedShort();
_yMax = di.readShort();
@@ -76,23 +76,23 @@ public class VdmxTable implements Table {
public int getYPelHeight() {
return _yPelHeight;
}
-
+
public short getYMax() {
return _yMax;
}
-
+
public short getYMin() {
return _yMin;
}
}
-
+
private class Group {
-
+
private int _recs;
private int _startsz;
private int _endsz;
private VTableRecord[] _entry;
-
+
protected Group(DataInput di) throws IOException {
_recs = di.readUnsignedShort();
_startsz = di.readUnsignedByte();
@@ -106,20 +106,20 @@ public class VdmxTable implements Table {
public int getRecs() {
return _recs;
}
-
+
public int getStartSZ() {
return _startsz;
}
-
+
public int getEndSZ() {
return _endsz;
}
-
+
public VTableRecord[] getEntry() {
return _entry;
}
}
-
+
private DirectoryEntry _de;
private int _version;
private int _numRecs;
@@ -127,7 +127,7 @@ public class VdmxTable implements Table {
private Ratio[] _ratRange;
private int _offset[];
private Group[] _groups;
-
+
/** Creates a new instance of VdmxTable */
protected VdmxTable(DirectoryEntry de, DataInput di) throws IOException {
_de = (DirectoryEntry) de.clone();
@@ -147,11 +147,13 @@ public class VdmxTable implements Table {
_groups[i] = new Group(di);
}
}
-
+
+ @Override
public int getType() {
return VDMX;
}
-
+
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("'VDMX' Table - Precomputed Vertical Device Metrics\n")
@@ -191,6 +193,7 @@ public class VdmxTable implements Table {
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return _de;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java
index 19c9176..521b87c 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java
@@ -105,6 +105,7 @@ public class VheaTable implements Table {
return _numberOfLongVerMetrics;
}
+ @Override
public int getType() {
return vhea;
}
@@ -113,6 +114,7 @@ public class VheaTable implements Table {
return _yMaxExtent;
}
+ @Override
public String toString() {
return new StringBuilder()
.append("'vhea' Table - Vertical Header\n------------------------------")
@@ -135,13 +137,14 @@ public class VheaTable implements Table {
.append("\n numOf_LongVerMetrics: ").append(_numberOfLongVerMetrics)
.toString();
}
-
+
/**
* Get a directory entry for this table. This uniquely identifies the
* table in collections where there may be more than one instance of a
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return _de;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VmtxTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VmtxTable.java
index 3484053..1b77a6f 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VmtxTable.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VmtxTable.java
@@ -77,10 +77,12 @@ public class VmtxTable implements Table {
}
}
+ @Override
public int getType() {
return vmtx;
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("'vmtx' Table - Vertical Metrics\n-------------------------------\n");
@@ -106,6 +108,7 @@ public class VmtxTable implements Table {
* particular table.
* @return A directory entry
*/
+ @Override
public DirectoryEntry getDirectoryEntry() {
return _de;
}
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/t2/T2Interpreter.java b/src/jogl/classes/jogamp/graph/font/typecast/t2/T2Interpreter.java
index 887f8c3..181ec7e 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/t2/T2Interpreter.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/t2/T2Interpreter.java
@@ -34,23 +34,23 @@ import jogamp.graph.font.typecast.ot.table.CharstringType2;
* @version $Id: T2Interpreter.java,v 1.2 2007-07-26 11:10:18 davidsch Exp $
*/
public class T2Interpreter {
-
+
private static final int ARGUMENT_STACK_LIMIT = 48;
private static final int SUBR_STACK_LIMIT = 10;
private static final int TRANSIENT_ARRAY_ELEMENT_COUNT = 32;
-
+
private Number[] _argStack = new Number[ARGUMENT_STACK_LIMIT];
private int _argStackIndex = 0;
private int[] _subrStack = new int[SUBR_STACK_LIMIT];
private int _subrStackIndex = 0;
private Number[] _transientArray = new Number[TRANSIENT_ARRAY_ELEMENT_COUNT];
-
+
private ArrayList<Point> _points;
/** Creates a new instance of T2Interpreter */
public T2Interpreter() {
}
-
+
/**
* Moves the current point to a position at the relative coordinates
* (dx1, dy1).
@@ -72,7 +72,7 @@ public class T2Interpreter {
Point lastPoint = getLastPoint();
moveTo(lastPoint.x + dx1, lastPoint.y);
}
-
+
/**
* Moves the current point dy1 units in the vertical direction.
*/
@@ -82,7 +82,7 @@ public class T2Interpreter {
Point lastPoint = getLastPoint();
moveTo(lastPoint.x, lastPoint.y + dy1);
}
-
+
/**
* Appends a line from the current point to a position at the
* relative coordinates dxa, dya. Additional rlineto operations are
@@ -103,7 +103,7 @@ public class T2Interpreter {
}
clearArg();
}
-
+
/**
* Appends a horizontal line of length dx1 to the current point.
* With an odd number of arguments, subsequent argument pairs
@@ -130,7 +130,7 @@ public class T2Interpreter {
}
clearArg();
}
-
+
/**
* Appends a vertical line of length dy1 to the current point. With
* an odd number of arguments, subsequent argument pairs are
@@ -157,7 +157,7 @@ public class T2Interpreter {
}
clearArg();
}
-
+
/**
* Appends a Bezier curve, defined by dxa...dyc, to the current
* point. For each subsequent set of six arguments, an additional
@@ -194,7 +194,7 @@ public class T2Interpreter {
}
clearArg();
}
-
+
/**
* Appends one or more Bezier curves, as described by the
* dxa...dxc set of arguments, to the current point. For each curve,
@@ -230,7 +230,7 @@ public class T2Interpreter {
}
clearArg();
}
-
+
/**
* Appends one or more Bezier curves to the current point. The
* tangent for the first Bezier must be horizontal, and the second
@@ -327,13 +327,13 @@ public class T2Interpreter {
int yf = ye + dyf[i];
curveTo(xa, ya, xb, yb, xc, yc);
curveTo(xd, yd, xe, ye, xf, yf);
-
+
// What on earth do we do with dx1, dx2, dy2 and dy3?
}
}
clearArg();
}
-
+
/**
* Is equivalent to one rrcurveto for each set of six arguments
* dxa...dyc, followed by exactly one rlineto using the dxd, dyd
@@ -373,7 +373,7 @@ public class T2Interpreter {
lineTo(xc + dxd, yc + dyd);
clearArg();
}
-
+
/**
* Is equivalent to one rlineto for each pair of arguments beyond
* the six arguments dxb...dyd needed for the one rrcurveto
@@ -411,7 +411,7 @@ public class T2Interpreter {
curveTo(xb, yb, xc, yc, xd, yd);
clearArg();
}
-
+
/**
* Appends one or more Bezier curves to the current point, where
* the first tangent is vertical and the second tangent is horizontal.
@@ -465,7 +465,7 @@ public class T2Interpreter {
}
clearArg();
}
-
+
/**
* Appends one or more curves to the current point. If the argument
* count is a multiple of four, the curve starts and ends vertical. If
@@ -473,10 +473,10 @@ public class T2Interpreter {
* vertical tangent.
*/
private void _vvcurveto() {
-
+
clearArg();
}
-
+
/**
* Causes two Bezier curves, as described by the arguments (as
* shown in Figure 2 below), to be rendered as a straight line when
@@ -485,10 +485,10 @@ public class T2Interpreter {
* pixels.
*/
private void _flex() {
-
+
clearArg();
}
-
+
/**
* Causes the two curves described by the arguments dx1...dx6 to
* be rendered as a straight line when the flex depth is less than
@@ -496,10 +496,10 @@ public class T2Interpreter {
* flex depth is greater than or equal to 0.5 device pixels.
*/
private void _hflex() {
-
+
clearArg();
}
-
+
/**
* Causes the two curves described by the arguments to be
* rendered as a straight line when the flex depth is less than 0.5
@@ -507,10 +507,10 @@ public class T2Interpreter {
* than or equal to 0.5 device pixels.
*/
private void _hflex1() {
-
+
clearArg();
}
-
+
/**
* Causes the two curves described by the arguments to be
* rendered as a straight line when the flex depth is less than 0.5
@@ -518,10 +518,10 @@ public class T2Interpreter {
* than or equal to 0.5 device pixels.
*/
private void _flex1() {
-
+
clearArg();
}
-
+
/**
* Finishes a charstring outline definition, and must be the
* last operator in a character's outline.
@@ -530,37 +530,37 @@ public class T2Interpreter {
endContour();
clearArg();
}
-
+
private void _hstem() {
-
+
clearArg();
}
-
+
private void _vstem() {
-
+
clearArg();
}
-
+
private void _hstemhm() {
-
+
clearArg();
}
-
+
private void _vstemhm() {
-
+
clearArg();
}
-
+
private void _hintmask() {
-
+
clearArg();
}
-
+
private void _cntrmask() {
-
+
clearArg();
}
-
+
/**
* Returns the absolute value of num.
*/
@@ -568,7 +568,7 @@ public class T2Interpreter {
double num = popArg().doubleValue();
pushArg(Math.abs(num));
}
-
+
/**
* Returns the sum of the two numbers num1 and num2.
*/
@@ -577,7 +577,7 @@ public class T2Interpreter {
double num1 = popArg().doubleValue();
pushArg(num1 + num2);
}
-
+
/**
* Returns the result of subtracting num2 from num1.
*/
@@ -586,7 +586,7 @@ public class T2Interpreter {
double num1 = popArg().doubleValue();
pushArg(num1 - num2);
}
-
+
/**
* Returns the quotient of num1 divided by num2. The result is
* undefined if overflow occurs and is zero for underflow.
@@ -596,7 +596,7 @@ public class T2Interpreter {
double num1 = popArg().doubleValue();
pushArg(num1 / num2);
}
-
+
/**
* Returns the negative of num.
*/
@@ -604,7 +604,7 @@ public class T2Interpreter {
double num = popArg().doubleValue();
pushArg(-num);
}
-
+
/**
* Returns a pseudo random number num2 in the range (0,1], that
* is, greater than zero and less than or equal to one.
@@ -612,7 +612,7 @@ public class T2Interpreter {
private void _random() {
pushArg(1.0 - Math.random());
}
-
+
/**
* Returns the product of num1 and num2. If overflow occurs, the
* result is undefined, and zero is returned for underflow.
@@ -622,7 +622,7 @@ public class T2Interpreter {
double num1 = popArg().doubleValue();
pushArg(num1 * num2);
}
-
+
/**
* Returns the square root of num. If num is negative, the result is
* undefined.
@@ -631,14 +631,14 @@ public class T2Interpreter {
double num = popArg().doubleValue();
pushArg(Math.sqrt(num));
}
-
+
/**
* Removes the top element num from the Type 2 argument stack.
*/
private void _drop() {
popArg();
}
-
+
/**
* Exchanges the top two elements on the argument stack.
*/
@@ -648,7 +648,7 @@ public class T2Interpreter {
pushArg(num2);
pushArg(num1);
}
-
+
/**
* Retrieves the element i from the top of the argument stack and
* pushes a copy of that element onto that stack. If i is negative,
@@ -666,7 +666,7 @@ public class T2Interpreter {
}
pushArg(nums[i]);
}
-
+
/**
* Performs a circular shift of the elements num(Nx1) ... num0 on
* the argument stack by the amount J. Positive J indicates upward
@@ -685,7 +685,7 @@ public class T2Interpreter {
pushArg(nums[(n + i + j) % n]);
}
}
-
+
/**
* Duplicates the top element on the argument stack.
*/
@@ -694,7 +694,7 @@ public class T2Interpreter {
pushArg(any);
pushArg(any);
}
-
+
/**
* Stores val into the transient array at the location given by i.
*/
@@ -703,7 +703,7 @@ public class T2Interpreter {
Number val = popArg();
_transientArray[i] = val;
}
-
+
/**
* Retrieves the value stored in the transient array at the location
* given by i and pushes the value onto the argument stack. If get
@@ -714,7 +714,7 @@ public class T2Interpreter {
int i = popArg().intValue();
pushArg(_transientArray[i]);
}
-
+
/**
* Puts a 1 on the stack if num1 and num2 are both non-zero, and
* puts a 0 on the stack if either argument is zero.
@@ -724,7 +724,7 @@ public class T2Interpreter {
double num1 = popArg().doubleValue();
pushArg((num1!=0.0) && (num2!=0.0) ? 1 : 0);
}
-
+
/**
* Puts a 1 on the stack if either num1 or num2 are non-zero, and
* puts a 0 on the stack if both arguments are zero.
@@ -734,7 +734,7 @@ public class T2Interpreter {
double num1 = popArg().doubleValue();
pushArg((num1!=0.0) || (num2!=0.0) ? 1 : 0);
}
-
+
/**
* Returns a 0 if num1 is non-zero; returns a 1 if num1 is zero.
*/
@@ -742,7 +742,7 @@ public class T2Interpreter {
double num1 = popArg().doubleValue();
pushArg((num1!=0.0) ? 0 : 1);
}
-
+
/**
* Puts a 1 on the stack if num1 equals num2, otherwise a 0 (zero)
* is put on the stack.
@@ -752,7 +752,7 @@ public class T2Interpreter {
double num1 = popArg().doubleValue();
pushArg(num1 == num2 ? 1 : 0);
}
-
+
/**
* Leaves the value s1 on the stack if v1 ? v2, or leaves s2 on the
* stack if v1 > v2. The value of s1 and s2 is usually the biased
@@ -765,7 +765,7 @@ public class T2Interpreter {
Number s1 = popArg();
pushArg(v1 <= v2 ? s1 : s2);
}
-
+
/**
* Calls a charstring subroutine with index subr# (actually the subr
* number plus the subroutine bias number, as described in section
@@ -777,25 +777,25 @@ public class T2Interpreter {
* Calling an undefined subr (gsubr) has undefined results.
*/
private void _callsubr() {
-
+
}
-
+
/**
* Operates in the same manner as callsubr except that it calls a
* global subroutine.
*/
private void _callgsubr() {
-
+
}
-
+
/**
* Returns from either a local or global charstring subroutine, and
* continues execution after the corresponding call(g)subr.
*/
private void _return() {
-
+
}
-
+
public Point[] execute(CharstringType2 cs) {
_points = new ArrayList<Point>();
cs.resetIP();
@@ -975,7 +975,7 @@ public class T2Interpreter {
private int getArgCount() {
return _argStackIndex;
}
-
+
/**
* Pop a value off the argument stack
*/
@@ -989,7 +989,7 @@ public class T2Interpreter {
private void pushArg(Number n) {
_argStack[_argStackIndex++] = n;
}
-
+
/**
* Pop a value off the subroutine stack
*/
@@ -1003,14 +1003,14 @@ public class T2Interpreter {
private void pushSubr(int n) {
_subrStack[_subrStackIndex++] = n;
}
-
+
/**
* Clear the argument stack
*/
private void clearArg() {
_argStackIndex = 0;
}
-
+
private Point getLastPoint() {
int size = _points.size();
if (size > 0) {
@@ -1019,22 +1019,22 @@ public class T2Interpreter {
return new Point(0, 0, true, false);
}
}
-
+
private void moveTo(int x, int y) {
endContour();
_points.add(new Point(x, y, true, false));
}
-
+
private void lineTo(int x, int y) {
_points.add(new Point(x, y, true, false));
}
-
+
private void curveTo(int cx1, int cy1, int cx2, int cy2, int x, int y) {
_points.add(new Point(cx1, cy1, false, false));
_points.add(new Point(cx2, cy2, false, false));
_points.add(new Point(x, y, true, false));
}
-
+
private void endContour() {
Point lastPoint = getLastPoint();
if (lastPoint != null) {
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java
index a659a70..2bb5cec 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java
@@ -570,7 +570,7 @@ public class Interpreter {
private void _mps() {
push(0);
}
-
+
private void _msirp(short param) {
pop();
pop();
@@ -1190,7 +1190,7 @@ public class Interpreter {
while (ip < ((ip & 0xffff0000) | parser.getISLength(ip >> 16))) {
short opcode = parser.getOpcode(ip);
if (inFuncDef) {
-
+
// We're within a function definition, so don't execute the code
if (opcode == Mnemonic.ENDF) {
inFuncDef = false;
diff --git a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Parser.java b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Parser.java
index c5a2b6e..1159b2c 100644
--- a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Parser.java
+++ b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Parser.java
@@ -148,6 +148,7 @@ public class Parser {
instructions[2] = program;
}
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder();
int ip = 0;
diff --git a/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java b/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java
index 0fd174c..32e2b6a 100644
--- a/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java
+++ b/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java
@@ -33,7 +33,7 @@ public class AffineTransform implements Cloneable, Serializable {
private static final long serialVersionUID = 1330973210523860834L;
static final String determinantIsZero = "Determinant is zero";
-
+
public static final int TYPE_IDENTITY = 0;
public static final int TYPE_TRANSLATION = 1;
public static final int TYPE_UNIFORM_SCALE = 2;
@@ -49,14 +49,14 @@ public class AffineTransform implements Cloneable, Serializable {
* The <code>TYPE_UNKNOWN</code> is an initial type value
*/
static final int TYPE_UNKNOWN = -1;
-
+
/**
- * The min value equivalent to zero. If absolute value less then ZERO it considered as zero.
+ * The min value equivalent to zero. If absolute value less then ZERO it considered as zero.
*/
static final float ZERO = (float) 1E-10;
-
+
private final Vertex.Factory<? extends Vertex> pointFactory;
-
+
/**
* The values of transformation matrix
*/
@@ -68,7 +68,7 @@ public class AffineTransform implements Cloneable, Serializable {
float m12;
/**
- * The transformation <code>type</code>
+ * The transformation <code>type</code>
*/
transient int type;
@@ -123,20 +123,20 @@ public class AffineTransform implements Cloneable, Serializable {
/*
* Method returns type of affine transformation.
- *
+ *
* Transform matrix is
* m00 m01 m02
* m10 m11 m12
- *
- * According analytic geometry new basis vectors are (m00, m01) and (m10, m11),
- * translation vector is (m02, m12). Original basis vectors are (1, 0) and (0, 1).
- * Type transformations classification:
+ *
+ * According analytic geometry new basis vectors are (m00, m01) and (m10, m11),
+ * translation vector is (m02, m12). Original basis vectors are (1, 0) and (0, 1).
+ * Type transformations classification:
* TYPE_IDENTITY - new basis equals original one and zero translation
- * TYPE_TRANSLATION - translation vector isn't zero
+ * TYPE_TRANSLATION - translation vector isn't zero
* TYPE_UNIFORM_SCALE - vectors length of new basis equals
- * TYPE_GENERAL_SCALE - vectors length of new basis doesn't equal
+ * TYPE_GENERAL_SCALE - vectors length of new basis doesn't equal
* TYPE_FLIP - new basis vector orientation differ from original one
- * TYPE_QUADRANT_ROTATION - new basis is rotated by 90, 180, 270, or 360 degrees
+ * TYPE_QUADRANT_ROTATION - new basis is rotated by 90, 180, 270, or 360 degrees
* TYPE_GENERAL_ROTATION - new basis is rotated by arbitrary angle
* TYPE_GENERAL_TRANSFORM - transformation can't be inversed
*/
@@ -322,7 +322,7 @@ public class AffineTransform implements Cloneable, Serializable {
}
public static <T extends Vertex> AffineTransform getShearInstance(Vertex.Factory<? extends Vertex> factory, float shx, float shy) {
- AffineTransform t = new AffineTransform(factory);
+ AffineTransform t = new AffineTransform(factory);
t.setToShear(shx, shy);
return t;
}
@@ -359,13 +359,13 @@ public class AffineTransform implements Cloneable, Serializable {
concatenate(AffineTransform.getRotateInstance(pointFactory, angle, px, py));
}
- /**
+ /**
* Multiply matrix of two AffineTransform objects.
* The first argument's {@link Vertex.Factory} is being used.
- *
+ *
* @param t1 - the AffineTransform object is a multiplicand
* @param t2 - the AffineTransform object is a multiplier
- * @return an AffineTransform object that is a result of t1 multiplied by matrix t2.
+ * @return an AffineTransform object that is a result of t1 multiplied by matrix t2.
*/
AffineTransform multiply(AffineTransform t1, AffineTransform t2) {
return new AffineTransform(t1.pointFactory,
@@ -415,7 +415,7 @@ public class AffineTransform implements Cloneable, Serializable {
public void transform(Vertex[] src, int srcOff, Vertex[] dst, int dstOff, int length) {
while (--length >= 0) {
- Vertex srcPoint = src[srcOff++];
+ Vertex srcPoint = src[srcOff++];
float x = srcPoint.getX();
float y = srcPoint.getY();
Vertex dstPoint = dst[dstOff];
@@ -426,7 +426,7 @@ public class AffineTransform implements Cloneable, Serializable {
dst[dstOff++] = dstPoint;
}
}
-
+
public void transform(float[] src, int srcOff, float[] dst, int dstOff, int length) {
int step = 2;
if (src == dst && srcOff < dstOff && dstOff < srcOff + length * 2) {
@@ -443,7 +443,7 @@ public class AffineTransform implements Cloneable, Serializable {
dstOff += step;
}
}
-
+
public Vertex deltaTransform(Vertex src, Vertex dst) {
if (dst == null) {
dst = pointFactory.create();
@@ -486,7 +486,7 @@ public class AffineTransform implements Cloneable, Serializable {
{
float det = getDeterminant();
if (FloatUtil.abs(det) < ZERO) {
- throw new NoninvertibleTransformException(determinantIsZero);
+ throw new NoninvertibleTransformException(determinantIsZero);
}
while (--length >= 0) {
@@ -554,7 +554,7 @@ public class AffineTransform implements Cloneable, Serializable {
return false;
}
-
+
/**
* Write AffineTrasform object to the output steam.
* @param stream - the output stream
@@ -564,12 +564,12 @@ public class AffineTransform implements Cloneable, Serializable {
stream.defaultWriteObject();
}
-
+
/**
* Read AffineTransform object from the input stream
* @param stream - the input steam
* @throws IOException - if there are I/O errors while reading from the input strem
- * @throws ClassNotFoundException - if class could not be found
+ * @throws ClassNotFoundException - if class could not be found
*/
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
diff --git a/src/jogl/classes/jogamp/graph/geom/plane/Crossing.java b/src/jogl/classes/jogamp/graph/geom/plane/Crossing.java
index cd4ee2a..4ee0c25 100644
--- a/src/jogl/classes/jogamp/graph/geom/plane/Crossing.java
+++ b/src/jogl/classes/jogamp/graph/geom/plane/Crossing.java
@@ -29,17 +29,17 @@ public class Crossing {
* Allowable tolerance for bounds comparison
*/
static final float DELTA = (float) 1E-5;
-
+
/**
* If roots have distance less then <code>ROOT_DELTA</code> they are double
*/
static final float ROOT_DELTA = (float) 1E-10;
-
+
/**
* Rectangle cross segment
*/
public static final int CROSSING = 255;
-
+
/**
* Unknown crossing result
*/
@@ -130,8 +130,8 @@ public class Crossing {
}
/**
- * Excludes float roots. Roots are float if they lies enough close with each other.
- * @param res - the roots
+ * Excludes float roots. Roots are float if they lies enough close with each other.
+ * @param res - the roots
* @param rc - the roots count
* @return new roots count
*/
@@ -384,12 +384,12 @@ public class Crossing {
// START
if (x == x1) {
- return x1 < x2 ? 0 : -1;
+ return x1 < x2 ? 0 : -1;
}
-
+
// END
if (x == x2) {
- return x1 < x2 ? 1 : 0;
+ return x1 < x2 ? 1 : 0;
}
// INSIDE-DOWN
@@ -493,10 +493,10 @@ public class Crossing {
}
break;
default:
- throw new IllegalArgumentException("Unhandled Segment Type: "+segmentType);
+ throw new IllegalArgumentException("Unhandled Segment Type: "+segmentType);
}
-
- // checks if the point (x,y) is the vertex of shape with PathIterator p
+
+ // checks if the point (x,y) is the vertex of shape with PathIterator p
if (x == cx && y == cy) {
cross = 0;
cy = my;
@@ -554,9 +554,9 @@ public class Crossing {
}
}
}
-
+
/**
- * Returns are bounds intersect or not intersect rectangle
+ * Returns are bounds intersect or not intersect rectangle
*/
static int crossBound(float bound[], int bc, float py1, float py2) {
diff --git a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java
index 945eece..33b80d6 100644
--- a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java
+++ b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java
@@ -33,12 +33,12 @@ public final class Path2D implements Cloneable {
static final String invalidWindingRuleValue = "Invalid winding rule value";
static final String iteratorOutOfBounds = "Iterator out of bounds";
-
+
/**
* The buffers size
*/
private static final int BUFFER_SIZE = 10;
-
+
/**
* The buffers capacity
*/
@@ -48,24 +48,24 @@ public final class Path2D implements Cloneable {
* The point's types buffer
*/
byte[] types;
-
+
/**
* The points buffer
*/
float[] points;
-
+
/**
* The point's type buffer size
*/
int typeSize;
-
+
/**
* The points buffer size
*/
int pointSize;
-
+
/**
- * The path rule
+ * The path rule
*/
int rule;
@@ -80,7 +80,7 @@ public final class Path2D implements Cloneable {
0}; // CLOSE
/*
- * GeneralPath path iterator
+ * GeneralPath path iterator
*/
class Iterator implements PathIterator {
@@ -88,17 +88,17 @@ public final class Path2D implements Cloneable {
* The current cursor position in types buffer
*/
int typeIndex;
-
+
/**
* The current cursor position in points buffer
*/
int pointIndex;
-
+
/**
* The source GeneralPath object
*/
Path2D p;
-
+
/**
* The path iterator transformation
*/
@@ -122,18 +122,22 @@ public final class Path2D implements Cloneable {
this.t = at;
}
+ @Override
public int getWindingRule() {
return p.getWindingRule();
}
+ @Override
public boolean isDone() {
return typeIndex >= p.typeSize;
}
+ @Override
public void next() {
typeIndex++;
}
+ @Override
public int currentSegment(float[] coords) {
if (isDone()) {
throw new NoSuchElementException(iteratorOutOfBounds);
@@ -183,7 +187,7 @@ public final class Path2D implements Cloneable {
}
/**
- * Checks points and types buffer size to add pointCount points. If necessary realloc buffers to enlarge size.
+ * Checks points and types buffer size to add pointCount points. If necessary realloc buffers to enlarge size.
* @param pointCount - the point count to be added in buffer
*/
void checkBuf(int pointCount, boolean checkMove) {
@@ -244,18 +248,19 @@ public final class Path2D implements Cloneable {
final public int size() {
return typeSize;
}
-
+
final public boolean isClosed() {
return typeSize > 0 && types[typeSize - 1] == PathIterator.SEG_CLOSE ;
}
-
+
public void closePath() {
if (!isClosed()) {
checkBuf(0, true);
types[typeSize++] = PathIterator.SEG_CLOSE;
}
}
-
+
+ @Override
public String toString() {
return "[size "+size()+", closed "+isClosed()+"]";
}
@@ -295,7 +300,7 @@ public final class Path2D implements Cloneable {
closePath();
break;
default:
- throw new IllegalArgumentException("Unhandled Segment Type: "+segmentType);
+ throw new IllegalArgumentException("Unhandled Segment Type: "+segmentType);
}
path.next();
connect = false;
@@ -366,9 +371,9 @@ public final class Path2D implements Cloneable {
}
/**
- * Checks cross count according to path rule to define is it point inside shape or not.
+ * Checks cross count according to path rule to define is it point inside shape or not.
* @param cross - the point cross count
- * @return true if point is inside path, or false otherwise
+ * @return true if point is inside path, or false otherwise
*/
boolean isInside(int cross) {
if (rule == WIND_NON_ZERO) {
@@ -396,7 +401,7 @@ public final class Path2D implements Cloneable {
}
public boolean contains(AABBox r) {
- return contains(r.getMinX(), r.getMinY(), r.getWidth(), r.getHeight());
+ return contains(r.getMinX(), r.getMinY(), r.getWidth(), r.getHeight());
}
public boolean intersects(AABBox r) {
@@ -404,9 +409,9 @@ public final class Path2D implements Cloneable {
}
public PathIterator iterator() {
- return new Iterator(this);
+ return new Iterator(this);
}
-
+
public PathIterator iterator(AffineTransform t) {
return new Iterator(this, t);
}
diff --git a/src/jogl/classes/jogamp/opengl/Debug.java b/src/jogl/classes/jogamp/opengl/Debug.java
index b88a09b..9332b67 100644
--- a/src/jogl/classes/jogamp/opengl/Debug.java
+++ b/src/jogl/classes/jogamp/opengl/Debug.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -51,14 +51,15 @@ public class Debug extends PropertyAccess {
// Some common properties
private static final boolean verbose;
private static final boolean debugAll;
-
+
static {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
PropertyAccess.addTrustedPrefix("jogl.");
return null;
} } );
-
+
verbose = isPropertyDefined("jogl.verbose", true);
debugAll = isPropertyDefined("jogl.debug", true);
if (verbose) {
@@ -68,7 +69,7 @@ public class Debug extends PropertyAccess {
System.err.println("JOGL implementation vendor " + p.getImplementationVendor());
}
}
-
+
/** Ensures static init block has been issues, i.e. if calling through to {@link PropertyAccess#isPropertyDefined(String, boolean)}. */
public static final void initSingleton() {}
diff --git a/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLibraryBundleInfo.java
index ef9477a..578f416 100644
--- a/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLibraryBundleInfo.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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;
import java.util.List;
@@ -47,11 +47,11 @@ public abstract class DesktopGLDynamicLibraryBundleInfo extends GLDynamicLibrary
public final List<String> getGlueLibNames() {
return glueLibNames;
}
-
+
@Override
public final boolean useToolGetProcAdressFirst(String funcName) {
return true;
}
-
+
}
diff --git a/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLookupHelper.java b/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLookupHelper.java
index 8eb3468..c1e1d18 100644
--- a/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLookupHelper.java
+++ b/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLookupHelper.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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;
import com.jogamp.common.os.NativeLibrary;
@@ -39,6 +39,7 @@ public class DesktopGLDynamicLookupHelper extends GLDynamicLookupHelper {
public final DesktopGLDynamicLibraryBundleInfo getDesktopGLBundleInfo() { return (DesktopGLDynamicLibraryBundleInfo) getBundleInfo(); }
+ @Override
public final synchronized boolean loadGLULibrary() {
/** hacky code .. where all platform GLU libs are tried ..*/
if(null==gluLib) {
diff --git a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
index 94acf93..8d3d207 100644
--- a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
+++ b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -59,7 +59,7 @@ final class ExtensionAvailabilityCache {
}
/**
- * Flush the cache.
+ * Flush the cache.
*/
final void flush()
{
@@ -87,7 +87,7 @@ final class ExtensionAvailabilityCache {
validateInitialization();
return availableExtensionCache.size();
}
-
+
final boolean isExtensionAvailable(String glExtensionName) {
validateInitialization();
return availableExtensionCache.contains(glExtensionName);
@@ -97,7 +97,7 @@ final class ExtensionAvailabilityCache {
validateInitialization();
return glXExtensionCount;
}
-
+
final String getPlatformExtensionsString() {
validateInitialization();
return glXExtensions;
@@ -107,7 +107,7 @@ final class ExtensionAvailabilityCache {
validateInitialization();
return glExtensionCount;
}
-
+
final String getGLExtensionsString() {
validateInitialization();
if(DEBUG) {
@@ -151,7 +151,7 @@ final class ExtensionAvailabilityCache {
", use "+ ( useGetStringi ? "glGetStringi" : "glGetString" ) );
}
- HashSet<String> glExtensionSet = new HashSet<String>(gl.isGLES() ? 50 : 320); // far less gl extension expected on mobile
+ HashSet<String> glExtensionSet = new HashSet<String>(gl.isGLES() ? 50 : 320); // far less gl extension expected on mobile
if(useGetStringi) {
GL2GL3 gl2gl3 = gl.getGL2GL3();
final int count;
@@ -163,7 +163,7 @@ final class ExtensionAvailabilityCache {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < count; i++) {
if(i > 0) {
- sb.append(" ");
+ sb.append(" ");
}
final String ext = gl2gl3.glGetStringi(GL.GL_EXTENSIONS, i);
glExtensionSet.add(ext);
@@ -185,7 +185,7 @@ final class ExtensionAvailabilityCache {
}
}
}
- glExtensionCount = glExtensionSet.size();
+ glExtensionCount = glExtensionSet.size();
if (DEBUG) {
System.err.println(getThreadName() + ":ExtensionAvailabilityCache: GL_EXTENSIONS: "+glExtensionCount+
", used "+ ( useGetStringi ? "glGetStringi" : "glGetString" ) );
@@ -193,17 +193,17 @@ final class ExtensionAvailabilityCache {
// Platform Extensions
HashSet<String> glXExtensionSet = new HashSet<String>(50);
- {
- // unify platform extension .. might have duplicates
+ {
+ // unify platform extension .. might have duplicates
StringTokenizer tok = new StringTokenizer(context.getPlatformExtensionsStringImpl().toString());
while (tok.hasMoreTokens()) {
- glXExtensionSet.add(tok.nextToken().trim());
+ glXExtensionSet.add(tok.nextToken().trim());
}
final StringBuilder sb = new StringBuilder();
for(Iterator<String> iter = glXExtensionSet.iterator(); iter.hasNext(); ) {
sb.append(iter.next());
if(iter.hasNext()) {
- sb.append(" ");
+ sb.append(" ");
}
}
glXExtensions = sb.toString();
@@ -222,15 +222,14 @@ final class ExtensionAvailabilityCache {
final int ctxOptions = context.getCtxOptions();
final VersionNumber version = context.getGLVersionNumber();
int major[] = new int[] { version.getMajor() };
- int minor[] = new int[] { version.getMinor() };
- while (GLContext.isValidGLVersion(ctxOptions, major[0], minor[0])) {
+ int minor[] = new int[] { version.getMinor() };
+ do{
final String GL_XX_VERSION = ( context.isGLES() ? "GL_ES_VERSION_" : "GL_VERSION_" ) + major[0] + "_" + minor[0];
availableExtensionCache.add(GL_XX_VERSION);
if (DEBUG) {
System.err.println(getThreadName() + ":ExtensionAvailabilityCache: Added "+GL_XX_VERSION+" to known extensions");
}
- if(!GLContext.decrementGLVersion(ctxOptions, major, minor)) break;
- }
+ } while( GLContext.decrementGLVersion(ctxOptions, major, minor) );
// put a dummy var in here so that the cache is no longer empty even if
// no extensions are in the GL_EXTENSIONS string
@@ -248,7 +247,7 @@ final class ExtensionAvailabilityCache {
private int glExtensionCount = 0;
private String glXExtensions = null;
private int glXExtensionCount = 0;
- private HashSet<String> availableExtensionCache = new HashSet<String>(50);
+ private final HashSet<String> availableExtensionCache = new HashSet<String>(50);
static String getThreadName() { return Thread.currentThread().getName(); }
diff --git a/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java b/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java
index b74ac9f..08a1fe8 100644
--- a/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java
+++ b/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java
@@ -41,39 +41,39 @@ public class FPSCounterImpl implements FPSCounter {
private long fpsStartTime, fpsLastUpdateTime, fpsLastPeriod, fpsTotalDuration;
private int fpsTotalFrames;
private float fpsLast, fpsTotal;
-
+
/** Creates a disabled instance */
public FPSCounterImpl() {
setUpdateFPSFrames(0, null);
}
-
+
/**
* Increases total frame count and updates values if feature is enabled and
* update interval is reached.<br>
- *
+ *
* Shall be called by actual FPSCounter implementing renderer, after display a new frame.
- *
+ *
*/
public final synchronized void tickFPS() {
fpsTotalFrames++;
if(fpsUpdateFramesInterval>0 && fpsTotalFrames%fpsUpdateFramesInterval == 0) {
final long now = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
fpsLastPeriod = now - fpsLastUpdateTime;
- fpsLastPeriod = Math.max(fpsLastPeriod, 1); // div 0
- fpsLast = ( (float)fpsUpdateFramesInterval * 1000f ) / ( (float) fpsLastPeriod ) ;
-
+ fpsLastPeriod = Math.max(fpsLastPeriod, 1); // div 0
+ fpsLast = ( (float)fpsUpdateFramesInterval * 1000f ) / ( (float) fpsLastPeriod ) ;
+
fpsTotalDuration = now - fpsStartTime;
fpsTotalDuration = Math.max(fpsTotalDuration, 1); // div 0
fpsTotal= ( (float)fpsTotalFrames * 1000f ) / ( (float) fpsTotalDuration ) ;
-
+
if(null != fpsOutputStream) {
fpsOutputStream.println(toString());
}
-
+
fpsLastUpdateTime = now;
}
}
-
+
public StringBuilder toString(StringBuilder sb) {
if(null==sb) {
sb = new StringBuilder();
@@ -81,22 +81,25 @@ public class FPSCounterImpl implements FPSCounter {
String fpsLastS = String.valueOf(fpsLast);
fpsLastS = fpsLastS.substring(0, fpsLastS.indexOf('.') + 2);
String fpsTotalS = String.valueOf(fpsTotal);
- fpsTotalS = fpsTotalS.substring(0, fpsTotalS.indexOf('.') + 2);
+ fpsTotalS = fpsTotalS.substring(0, fpsTotalS.indexOf('.') + 2);
sb.append(fpsTotalDuration/1000 +" s: "+ fpsUpdateFramesInterval+" f / "+ fpsLastPeriod+" ms, " + fpsLastS+" fps, "+ fpsLastPeriod/fpsUpdateFramesInterval+" ms/f; "+
"total: "+ fpsTotalFrames+" f, "+ fpsTotalS+ " fps, "+ fpsTotalDuration/fpsTotalFrames+" ms/f");
return sb;
}
-
+
+ @Override
public String toString() {
return toString(null).toString();
}
-
+
+ @Override
public final synchronized void setUpdateFPSFrames(int frames, PrintStream out) {
fpsUpdateFramesInterval = frames;
fpsOutputStream = out;
resetFPSCounter();
}
-
+
+ @Override
public final synchronized void resetFPSCounter() {
fpsStartTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); // overwrite startTime to real init one
fpsLastUpdateTime = fpsStartTime;
@@ -106,35 +109,43 @@ public class FPSCounterImpl implements FPSCounter {
fpsLastPeriod = 0; fpsTotalDuration=0;
}
+ @Override
public final synchronized int getUpdateFPSFrames() {
return fpsUpdateFramesInterval;
}
-
- public final synchronized long getFPSStartTime() {
- return fpsStartTime;
+
+ @Override
+ public final synchronized long getFPSStartTime() {
+ return fpsStartTime;
}
+ @Override
public final synchronized long getLastFPSUpdateTime() {
return fpsLastUpdateTime;
}
+ @Override
public final synchronized long getLastFPSPeriod() {
return fpsLastPeriod;
}
-
+
+ @Override
public final synchronized float getLastFPS() {
return fpsLast;
}
-
- public final synchronized int getTotalFPSFrames() {
- return fpsTotalFrames;
+
+ @Override
+ public final synchronized int getTotalFPSFrames() {
+ return fpsTotalFrames;
}
- public final synchronized long getTotalFPSDuration() {
- return fpsTotalDuration;
+ @Override
+ public final synchronized long getTotalFPSDuration() {
+ return fpsTotalDuration;
}
-
+
+ @Override
public final synchronized float getTotalFPS() {
return fpsTotal;
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
index bfa748a..42d0a2e 100644
--- a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
+++ b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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;
import java.io.PrintStream;
@@ -45,8 +45,10 @@ 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.common.util.locks.RecursiveLock;
import com.jogamp.opengl.GLAutoDrawableDelegate;
@@ -56,20 +58,21 @@ import com.jogamp.opengl.GLStateKeeper;
/**
* Abstract common code for GLAutoDrawable implementations.
- *
+ *
* @see GLAutoDrawable
* @see GLAutoDrawableDelegate
+ * @see GLOffscreenAutoDrawable
+ * @see GLOffscreenAutoDrawableImpl
* @see GLPBufferImpl
- * @see GLWindow
+ * @see com.jogamp.newt.opengl.GLWindow
*/
-public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeeper, FPSCounter {
+public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeeper, FPSCounter, GLSharedContextSetter {
public static final boolean DEBUG = GLDrawableImpl.DEBUG;
-
protected final GLDrawableHelper helper = new GLDrawableHelper();
protected final FPSCounterImpl fpsCounter = new FPSCounterImpl();
-
+
protected volatile GLDrawableImpl drawable; // volatile: avoid locking for read-only access
- protected GLContextImpl context;
+ protected volatile GLContextImpl context;
protected boolean preserveGLELSAtDestroy;
protected GLEventListenerState glels;
protected GLStateKeeper.Listener glStateKeeperListener;
@@ -79,12 +82,19 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
protected volatile boolean sendDestroy = false; // volatile: maybe written by WindowManager thread w/o locking
/**
- * @param drawable upstream {@link GLDrawableImpl} instance,
+ * <p>
+ * The {@link GLContext} can be assigned later manually via {@link GLAutoDrawable#setContext(GLContext, boolean) setContext(ctx)}
+ * <i>or</i> it will be created <i>lazily</i> at the 1st {@link GLAutoDrawable#display() display()} method call.<br>
+ * <i>Lazy</i> {@link GLContext} creation will take a shared {@link GLContext} into account
+ * which has been set {@link #setSharedContext(GLContext) directly}
+ * or {@link #setSharedAutoDrawable(GLAutoDrawable) via another GLAutoDrawable}.
+ * </p>
+ * @param drawable upstream {@link GLDrawableImpl} instance,
* may be <code>null</code> for lazy initialization
- * @param context upstream {@link GLContextImpl} instance,
+ * @param context upstream {@link GLContextImpl} instance,
* may not have been made current (created) yet,
* may not be associated w/ <code>drawable<code> yet,
- * may be <code>null</code> for lazy initialization
+ * may be <code>null</code> for lazy initialization at 1st {@link #display()}.
* @param ownsDevice pass <code>true</code> if {@link AbstractGraphicsDevice#close()} shall be issued,
* otherwise pass <code>false</code>. Closing the device is required in case
* the drawable is created w/ it's own new instance, e.g. offscreen drawables,
@@ -100,34 +110,45 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
if(null != context && null != drawable) {
context.setGLDrawable(drawable, false);
}
- resetFPSCounter();
+ resetFPSCounter();
+ }
+
+ @Override
+ public final void setSharedContext(GLContext sharedContext) throws IllegalStateException {
+ helper.setSharedContext(this.context, sharedContext);
+ }
+
+ @Override
+ public final void setSharedAutoDrawable(GLAutoDrawable sharedAutoDrawable) throws IllegalStateException {
+ helper.setSharedAutoDrawable(this, sharedAutoDrawable);
}
-
- /** Returns the recursive lock object of the upstream implementation, which synchronizes multithreaded access on top of {@link NativeSurface#lockSurface()}. */
+
+ /** Returns the recursive lock object of the upstream implementation, which synchronizes multithreaded access on top of {@link NativeSurface#lockSurface()}. */
protected abstract RecursiveLock getLock();
@Override
public final GLStateKeeper.Listener setGLStateKeeperListener(Listener l) {
final GLStateKeeper.Listener pre = glStateKeeperListener;
glStateKeeperListener = l;
- return pre;
+ return pre;
}
-
+
@Override
public final boolean preserveGLStateAtDestroy(boolean value) {
final boolean res = isGLStatePreservationSupported() ? true : false;
if( res ) {
if( DEBUG ) {
- System.err.println("GLAutoDrawableBase.setPreserveGLStateAtDestroy: ("+getThreadName()+"): "+preserveGLELSAtDestroy+" -> "+value+" - surfaceHandle 0x"+Long.toHexString(getNativeSurface().getSurfaceHandle()));
+ final long surfaceHandle = null != getNativeSurface() ? getNativeSurface().getSurfaceHandle() : 0;
+ System.err.println("GLAutoDrawableBase.setPreserveGLStateAtDestroy: ("+getThreadName()+"): "+preserveGLELSAtDestroy+" -> "+value+" - surfaceHandle 0x"+Long.toHexString(surfaceHandle));
}
preserveGLELSAtDestroy = value;
}
return res;
}
-
+
@Override
public boolean isGLStatePreservationSupported() { return false; }
-
+
@Override
public final GLEventListenerState getPreservedGLState() {
return glels;
@@ -139,20 +160,20 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
glels = null;
return r;
}
-
+
/**
- * Pulls the {@link GLEventListenerState} from this {@link GLAutoDrawable}.
- *
- * @return <code>true</code> if the {@link GLEventListenerState} is pulled successfully from this {@link GLAutoDrawable},
+ * Preserves the {@link GLEventListenerState} from this {@link GLAutoDrawable}.
+ *
+ * @return <code>true</code> if the {@link GLEventListenerState} is preserved successfully from this {@link GLAutoDrawable},
* otherwise <code>false</code>.
- *
- * @throws IllegalStateException if the {@link GLEventListenerState} is already pulled
- *
- * @see #pushGLEventListenerState()
+ *
+ * @throws IllegalStateException if the {@link GLEventListenerState} is already preserved
+ *
+ * @see #restoreGLEventListenerState()
*/
- protected final boolean pullGLEventListenerState() throws IllegalStateException {
+ protected final boolean preserveGLEventListenerState() throws IllegalStateException {
if( null != glels ) {
- throw new IllegalStateException("GLEventListenerState already pulled");
+ throw new IllegalStateException("GLEventListenerState already pulled");
}
if( null != context && context.isCreated() ) {
if( null!= glStateKeeperListener) {
@@ -163,28 +184,28 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
}
return false;
}
-
+
/**
- * Pushes a previously {@link #pullGLEventListenerState() pulled} {@link GLEventListenerState} to this {@link GLAutoDrawable}.
- *
- * @return <code>true</code> if the {@link GLEventListenerState} was previously {@link #pullGLEventListenerState() pulled}
- * and is pushed successfully to this {@link GLAutoDrawable},
+ * Restores a previously {@link #preserveGLEventListenerState() preserved} {@link GLEventListenerState} to this {@link GLAutoDrawable}.
+ *
+ * @return <code>true</code> if the {@link GLEventListenerState} was previously {@link #preserveGLEventListenerState() preserved}
+ * and is moved successfully to this {@link GLAutoDrawable},
* otherwise <code>false</code>.
- *
- * @see #pullGLEventListenerState()
+ *
+ * @see #preserveGLEventListenerState()
*/
- protected final boolean pushGLEventListenerState() {
+ protected final boolean restoreGLEventListenerState() {
if( null != glels ) {
glels.moveTo(this);
glels = null;
if( null!= glStateKeeperListener) {
glStateKeeperListener.glStateRestored(this);
- }
+ }
return true;
}
- return false;
+ return false;
}
-
+
/** Default implementation to handle repaint events from the windowing system */
protected final void defaultWindowRepaintOp() {
final GLDrawable _drawable = drawable;
@@ -194,13 +215,14 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
}
}
}
-
+
/** Default implementation to handle resize events from the windowing system. All required locks are being claimed. */
protected final void defaultWindowResizedOp(int newWidth, int newHeight) throws NativeWindowException, GLException {
GLDrawableImpl _drawable = drawable;
if( null!=_drawable ) {
if(DEBUG) {
- System.err.println("GLAutoDrawableBase.sizeChanged: ("+getThreadName()+"): "+newWidth+"x"+newHeight+" - surfaceHandle 0x"+Long.toHexString(getNativeSurface().getSurfaceHandle()));
+ final long surfaceHandle = null != getNativeSurface() ? getNativeSurface().getSurfaceHandle() : 0;
+ System.err.println("GLAutoDrawableBase.sizeChanged: ("+getThreadName()+"): "+newWidth+"x"+newHeight+" - surfaceHandle 0x"+Long.toHexString(surfaceHandle));
}
if( ! _drawable.getChosenGLCapabilities().isOnscreen() ) {
final RecursiveLock _lock = getLock();
@@ -208,7 +230,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
try {
final GLDrawableImpl _drawableNew = GLDrawableHelper.resizeOffscreenDrawable(_drawable, context, newWidth, newHeight);
if(_drawable != _drawableNew) {
- // write back
+ // write back
_drawable = _drawableNew;
drawable = _drawableNew;
}
@@ -224,15 +246,15 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
}
}
}
-
- /**
+
+ /**
* Default implementation to handle destroy notifications from the windowing system.
- *
+ *
* <p>
- * If the {@link NativeSurface} does not implement {@link WindowClosingProtocol}
+ * If the {@link NativeSurface} does not implement {@link WindowClosingProtocol}
* or {@link WindowClosingMode#DISPOSE_ON_CLOSE} is enabled (default),
* a thread safe destruction is being induced.
- * </p>
+ * </p>
*/
protected final void defaultWindowDestroyNotifyOp() {
final NativeSurface ns = getNativeSurface();
@@ -241,22 +263,22 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
shallClose = WindowClosingMode.DISPOSE_ON_CLOSE == ((WindowClosingProtocol)ns).getDefaultCloseOperation();
} else {
shallClose = true;
- }
+ }
if( shallClose ) {
destroyAvoidAwareOfLocking();
- }
+ }
}
/**
- * Calls {@link #destroy()}
+ * Calls {@link #destroy()}
* directly if the following requirements are met:
* <ul>
- * <li>An {@link GLAnimatorControl} is bound (see {@link #getAnimator()}) and running on another thread.
+ * <li>An {@link GLAnimatorControl} is bound (see {@link #getAnimator()}) and running on another thread.
* Here we pause the animation while issuing the destruction.</li>
* <li>Surface is not locked by another thread (considered anonymous).</li>
* </ul>
* <p>
- * Otherwise destroy is being flagged to be called within the next
+ * Otherwise destroy is being flagged to be called within the next
* call of display().
* </p>
* <p>
@@ -268,9 +290,9 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
*/
protected final void destroyAvoidAwareOfLocking() {
final NativeSurface ns = getNativeSurface();
-
+
final GLAnimatorControl ctrl = helper.getAnimator();
-
+
// Is an animator thread perform rendering?
if ( helper.isAnimatorStartedOnOtherThread() ) {
// Pause animations before initiating safe destroy.
@@ -290,7 +312,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
destroy();
}
}
-
+
/**
* Calls {@link #destroyImplInLock()} while claiming the lock.
*/
@@ -303,7 +325,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
lock.unlock();
}
}
-
+
/**
* Default implementation to destroys the drawable and context of this GLAutoDrawable:
* <ul>
@@ -318,10 +340,10 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
protected void destroyImplInLock() {
if( preserveGLELSAtDestroy ) {
preserveGLStateAtDestroy(false);
- pullGLEventListenerState();
+ preserveGLEventListenerState();
}
if( null != context ) {
- if( context.isCreated() ) {
+ if( context.isCreated() ) {
// Catch dispose GLExceptions by GLEventListener, just 'print' them
// so we can continue with the destruction.
try {
@@ -339,9 +361,9 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
if( ownsDevice ) {
device.close();
}
- }
+ }
}
-
+
public final void defaultSwapBuffers() throws GLException {
final RecursiveLock _lock = getLock();
_lock.lock();
@@ -357,7 +379,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
//
// GLAutoDrawable
//
-
+
protected final Runnable defaultInitAction = new Runnable() {
@Override
public final void run() {
@@ -387,7 +409,25 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
final RecursiveLock _lock = getLock();
_lock.lock();
try {
- if( null != context ) {
+ if( null == context ) {
+ boolean contextCreated = false;
+ final GLDrawableImpl _drawable = drawable;
+ if ( null != _drawable && _drawable.isRealized() && 0<_drawable.getWidth()*_drawable.getHeight() ) {
+ final GLContext[] shareWith = { null };
+ if( !helper.isSharedGLContextPending(shareWith) ) {
+ if( !restoreGLEventListenerState() ) {
+ context = (GLContextImpl) _drawable.createContext(shareWith[0]);
+ context.setContextCreationFlags(additionalCtxCreationFlags);
+ contextCreated = true;
+ // surface is locked/unlocked implicit by context's makeCurrent/release
+ helper.invokeGL(_drawable, context, defaultDisplayAction, defaultInitAction);
+ }
+ }
+ }
+ if(DEBUG) {
+ System.err.println("GLAutoDrawableBase.defaultDisplay: contextCreated "+contextCreated);
+ }
+ } else {
// surface is locked/unlocked implicit by context's makeCurrent/release
helper.invokeGL(drawable, context, defaultDisplayAction, defaultInitAction);
}
@@ -395,7 +435,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
_lock.unlock();
}
}
-
+
protected final GLEventListener defaultDisposeGLEventListener(GLEventListener listener, boolean remove) {
final RecursiveLock _lock = getLock();
_lock.lock();
@@ -403,14 +443,14 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
return helper.disposeGLEventListener(GLAutoDrawableBase.this, drawable, context, listener, remove);
} finally {
_lock.unlock();
- }
+ }
}
-
+
@Override
public final GLDrawable getDelegatedDrawable() {
return drawable;
}
-
+
@Override
public final GLContext getContext() {
return context;
@@ -456,7 +496,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
@Override
public final void addGLEventListener(int index, GLEventListener listener) throws IndexOutOfBoundsException {
- helper.addGLEventListener(index, listener);
+ helper.addGLEventListener(index, listener);
}
@Override
@@ -478,21 +518,21 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
public void setGLEventListenerInitState(GLEventListener listener, boolean initialized) {
helper.setGLEventListenerInitState(listener, initialized);
}
-
+
@Override
public GLEventListener disposeGLEventListener(GLEventListener listener, boolean remove) {
return defaultDisposeGLEventListener(listener, remove);
}
-
+
@Override
public final GLEventListener removeGLEventListener(GLEventListener listener) {
- return helper.removeGLEventListener(listener);
+ return helper.removeGLEventListener(listener);
}
-
+
@Override
public final void setAnimator(GLAnimatorControl animatorControl)
throws GLException {
- helper.setAnimator(animatorControl);
+ helper.setAnimator(animatorControl);
}
@Override
@@ -509,20 +549,20 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
public final Thread getExclusiveContextThread() {
return helper.getExclusiveContextThread();
}
-
+
@Override
public final boolean invoke(boolean wait, GLRunnable glRunnable) {
- return helper.invoke(this, wait, glRunnable);
+ return helper.invoke(this, wait, glRunnable);
}
@Override
public boolean invoke(final boolean wait, final List<GLRunnable> glRunnables) {
return helper.invoke(this, wait, glRunnables);
}
-
+
@Override
public final void setAutoSwapBufferMode(boolean enable) {
- helper.setAutoSwapBufferMode(enable);
+ helper.setAutoSwapBufferMode(enable);
}
@Override
@@ -532,7 +572,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
@Override
public final void setContextCreationFlags(int flags) {
- additionalCtxCreationFlags = flags;
+ additionalCtxCreationFlags = flags;
final GLContext _context = context;
if(null != _context) {
_context.setContextCreationFlags(additionalCtxCreationFlags);
@@ -547,7 +587,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
//
// FPSCounter
//
-
+
@Override
public final void setUpdateFPSFrames(int frames, PrintStream out) {
fpsCounter.setUpdateFPSFrames(frames, out);
@@ -597,11 +637,11 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
public final float getTotalFPS() {
return fpsCounter.getTotalFPS();
}
-
+
//
// GLDrawable delegation
//
-
+
@Override
public final GLContext createContext(final GLContext shareWith) {
final RecursiveLock lock = getLock();
@@ -622,10 +662,10 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
public final void setRealized(boolean realized) {
final RecursiveLock _lock = getLock();
_lock.lock();
- try {
+ try {
final GLDrawable _drawable = drawable;
if( null == _drawable || realized && ( 0 >= _drawable.getWidth() || 0 >= _drawable.getHeight() ) ) {
- return;
+ return;
}
_drawable.setRealized(realized);
if( realized && _drawable.isRealized() ) {
@@ -635,7 +675,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
_lock.unlock();
}
}
-
+
@Override
public final boolean isRealized() {
final GLDrawable _drawable = drawable;
@@ -659,7 +699,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
final GLDrawable _drawable = drawable;
return null != _drawable ? _drawable.isGLOriented() : true;
}
-
+
@Override
public final GLCapabilitiesImmutable getChosenGLCapabilities() {
final GLDrawable _drawable = drawable;
@@ -683,7 +723,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
final GLDrawable _drawable = drawable;
return null != _drawable ? _drawable.getHandle() : 0;
}
-
+
protected static String getThreadName() { return Thread.currentThread().getName(); }
@Override
diff --git a/src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java
index 17646cc..fa05902 100644
--- a/src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java
+++ b/src/jogl/classes/jogamp/opengl/GLBufferSizeTracker.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2006 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -93,7 +93,7 @@ public class GLBufferSizeTracker {
Debug.initSingleton();
DEBUG = Debug.isPropertyDefined("jogl.debug.GLBufferSizeTracker", true);
}
-
+
// Map from buffer names to sizes.
// Note: should probably have some way of shrinking this map, but
// can't just make it a WeakHashMap because nobody holds on to the
@@ -101,11 +101,12 @@ public class GLBufferSizeTracker {
// objects, which is probably sub-optimal. The expected usage
// pattern of buffer objects indicates that the fact that this map
// never shrinks is probably not that bad.
- private IntLongHashMap bufferSizeMap;
-
+ private final IntLongHashMap bufferSizeMap;
+ private final long keyNotFount = 0xFFFFFFFFFFFFFFFFL;
+
public GLBufferSizeTracker() {
bufferSizeMap = new IntLongHashMap();
- bufferSizeMap.setKeyNotFoundValue(0xFFFFFFFFFFFFFFFFL);
+ bufferSizeMap.setKeyNotFoundValue(keyNotFount);
}
public final void setBufferSize(GLBufferStateTracker bufferStateTracker,
@@ -142,7 +143,7 @@ public class GLBufferSizeTracker {
if (DEBUG) {
System.err.println("GLBufferSizeTracker.getBufferSize(): no cached buffer information");
}
- return (long) tmp[0];
+ return tmp[0];
}
public final long getDirectStateBufferSize(int buffer, GL caller) {
@@ -154,7 +155,7 @@ public class GLBufferSizeTracker {
// point we almost certainly should if the application is
// written correctly
long sz = bufferSizeMap.get(buffer);
- if (0xFFFFFFFFFFFFFFFFL == sz) {
+ if (keyNotFount == sz) {
// For robustness, try to query this value from the GL as we used to
// FIXME: both functions return 'int' types, which is not suitable,
// since buffer lenght is 64bit ?
@@ -176,7 +177,7 @@ public class GLBufferSizeTracker {
" was zero; probably application error");
}
// Assume we just don't know what's happening
- sz = (long) tmp[0];
+ sz = tmp[0];
bufferSizeMap.put(buffer, sz);
if (DEBUG) {
System.err.println("GLBufferSizeTracker.getBufferSize(): made slow query to cache size " +
diff --git a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java
index 890c82c..16b7edc 100644
--- a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java
+++ b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2006 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -41,6 +41,7 @@
package jogamp.opengl;
import javax.media.opengl.*;
+
import com.jogamp.common.util.IntIntHashMap;
/**
@@ -50,7 +51,7 @@ import com.jogamp.common.util.IntIntHashMap;
* This class is used to verify that e.g. the vertex
* buffer object extension is in use when the glVertexPointer variant
* taking a long as argument is called. <P>
- *
+ *
* Note that because the enumerated value used for the binding of a
* buffer object (e.g. GL_ARRAY_BUFFER) is different than that used to
* query the binding using glGetIntegerv (e.g.
@@ -77,37 +78,55 @@ import com.jogamp.common.util.IntIntHashMap;
public class GLBufferStateTracker {
protected static final boolean DEBUG;
-
+
static {
Debug.initSingleton();
DEBUG = Debug.isPropertyDefined("jogl.debug.GLBufferStateTracker", true);
}
-
+
// Maps binding targets to buffer objects. A null value indicates
// that the binding is unknown. A zero value indicates that it is
- // known that no buffer is bound to the target, according to the
- // OpenGL specifications.
+ // known that no buffer is bound to the target, according to the
+ // OpenGL specifications.
// http://www.opengl.org/sdk/docs/man/xhtml/glBindBuffer.xml
- private IntIntHashMap bindingMap;
+ private final IntIntHashMap bindingMap;
+ private final int keyNotFound = 0xFFFFFFFF;
- private int[] bufTmp = new int[1];
+ private final int[] bufTmp = new int[1];
public GLBufferStateTracker() {
bindingMap = new IntIntHashMap();
- bindingMap.setKeyNotFoundValue(0xFFFFFFFF);
+ bindingMap.setKeyNotFoundValue(keyNotFound);
// Start with known unbound targets for known keys
- // setBoundBufferObject(GL2GL3.GL_VERTEX_ARRAY_BINDING, 0); // not using default VAO (removed in GL3 core) - only explicit
+ // setBoundBufferObject(GL2ES3.GL_VERTEX_ARRAY_BINDING, 0); // not using default VAO (removed in GL3 core) - only explicit
setBoundBufferObject(GL.GL_ARRAY_BUFFER, 0);
setBoundBufferObject(GL.GL_ELEMENT_ARRAY_BUFFER, 0);
setBoundBufferObject(GL2.GL_PIXEL_PACK_BUFFER, 0);
setBoundBufferObject(GL2.GL_PIXEL_UNPACK_BUFFER, 0);
+ setBoundBufferObject(GL4.GL_DRAW_INDIRECT_BUFFER, 0);
}
public final void setBoundBufferObject(int target, int value) {
bindingMap.put(target, value);
+ /***
+ * Test for clearing bound buffer states when unbinding VAO,
+ * Bug 692 Comment 5 is invalid, i.e. <https://jogamp.org/bugzilla/show_bug.cgi?id=692#c5>.
+ * However spec doesn't mention such behavior, and rendering w/ CPU sourced data
+ * after unbinding a VAO w/o unbinding the VBOs resulted to no visible image.
+ * Leaving code in here for discussion - in case I am wrong.
+ *
+ final int pre = bindingMap.put(target, value);
+ if( GL2ES3.GL_VERTEX_ARRAY_BINDING == target && keyNotFound != pre && 0 == value ) {
+ // Unbinding a previous bound VAO leads to unbinding of all buffers!
+ bindingMap.put(GL.GL_ARRAY_BUFFER, 0);
+ bindingMap.put(GL.GL_ELEMENT_ARRAY_BUFFER, 0);
+ bindingMap.put(GL2.GL_PIXEL_PACK_BUFFER, 0);
+ bindingMap.put(GL2.GL_PIXEL_UNPACK_BUFFER, 0);
+ bindingMap.put(GL4.GL_DRAW_INDIRECT_BUFFER, 0);
+ } */
if (DEBUG) {
- System.err.println("GLBufferStateTracker.setBoundBufferObject() target 0x" +
+ System.err.println("GLBufferStateTracker.setBoundBufferObject() target 0x" +
Integer.toHexString(target) + " -> mapped bound buffer 0x" +
Integer.toHexString(value));
// Thread.dumpStack();
@@ -120,18 +139,19 @@ public class GLBufferStateTracker {
return value is valid. */
public final int getBoundBufferObject(int target, GL caller) {
int value = bindingMap.get(target);
- if (0xFFFFFFFF == value) {
+ if (keyNotFound == value) {
// User probably either called glPushClientAttrib /
// glPopClientAttrib or is querying an unknown target. See
// whether we know how to fetch this state.
boolean gotQueryTarget = true;
int queryTarget = 0;
switch (target) {
- case GL2GL3.GL_VERTEX_ARRAY_BINDING: queryTarget = GL2GL3.GL_VERTEX_ARRAY_BINDING; break;
+ case GL2ES3.GL_VERTEX_ARRAY_BINDING: queryTarget = GL2ES3.GL_VERTEX_ARRAY_BINDING; break;
case GL.GL_ARRAY_BUFFER: queryTarget = GL.GL_ARRAY_BUFFER_BINDING; break;
case GL.GL_ELEMENT_ARRAY_BUFFER: queryTarget = GL.GL_ELEMENT_ARRAY_BUFFER_BINDING; break;
case GL2.GL_PIXEL_PACK_BUFFER: queryTarget = GL2.GL_PIXEL_PACK_BUFFER_BINDING; break;
case GL2.GL_PIXEL_UNPACK_BUFFER: queryTarget = GL2.GL_PIXEL_UNPACK_BUFFER_BINDING; break;
+ case GL4.GL_DRAW_INDIRECT_BUFFER: queryTarget = GL4.GL_DRAW_INDIRECT_BUFFER_BINDING; break;
default: gotQueryTarget = false; break;
}
if (gotQueryTarget) {
@@ -144,7 +164,7 @@ public class GLBufferStateTracker {
value = 0;
}
if (DEBUG) {
- System.err.println("GLBufferStateTracker.getBoundBufferObject() glerr[pre 0x"+Integer.toHexString(glerrPre)+", post 0x"+Integer.toHexString(glerrPost)+"], [queried value]: target 0x" +
+ System.err.println("GLBufferStateTracker.getBoundBufferObject() glerr[pre 0x"+Integer.toHexString(glerrPre)+", post 0x"+Integer.toHexString(glerrPost)+"], [queried value]: target 0x" +
Integer.toHexString(target) + " / query 0x"+Integer.toHexString(queryTarget)+
" -> mapped bound buffer 0x" + Integer.toHexString(value));
}
@@ -154,7 +174,7 @@ public class GLBufferStateTracker {
return 0;
}
if (DEBUG) {
- System.err.println("GLBufferStateTracker.getBoundBufferObject() [mapped value]: target 0x" +
+ System.err.println("GLBufferStateTracker.getBoundBufferObject() [mapped value]: target 0x" +
Integer.toHexString(target) + " -> mapped bound buffer 0x" +
Integer.toHexString(value));
}
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 996a475..3f6eb01 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -106,14 +106,14 @@ public abstract class GLContextImpl extends GLContext {
private final GLStateTracker glStateTracker = new GLStateTracker();
private GLDebugMessageHandler glDebugHandler = null;
private final int[] boundFBOTarget = new int[] { 0, 0 }; // { draw, read }
- private int defaultVAO = 0;
-
+ private int defaultVAO = 0;
+
protected GLDrawableImpl drawable;
protected GLDrawableImpl drawableRead;
-
+
private volatile boolean pixelDataEvaluated;
private int /* pixelDataInternalFormat, */ pixelDataFormat, pixelDataType;
-
+
protected GL gl;
protected static final Object mappedContextTypeObjectLock;
@@ -148,8 +148,7 @@ public abstract class GLContextImpl extends GLContext {
this.glDebugHandler = new GLDebugMessageHandler(this);
}
- @Override
- protected void resetStates() {
+ private final void clearStates() {
// Because we don't know how many other contexts we might be
// sharing with (and it seems too complicated to implement the
// GLObjectTracker's ref/unref scheme for the buffer-related
@@ -158,15 +157,16 @@ public abstract class GLContextImpl extends GLContext {
if (bufferSizeTracker != null) {
bufferSizeTracker.clearCachedBufferSizes();
}
+ bufferStateTracker.clearBufferObjectState();
+ glStateTracker.setEnabled(false);
+ glStateTracker.clearStates();
+ }
- if (bufferStateTracker != null) { // <init>
- bufferStateTracker.clearBufferObjectState();
- }
-
- if (glStateTracker != null) { // <init>
- glStateTracker.clearStates(false);
+ @Override
+ protected void resetStates(boolean isInit) {
+ if( !isInit ) {
+ clearStates();
}
-
extensionAvailability = null;
glProcAddressTable = null;
gl = null;
@@ -177,20 +177,20 @@ public abstract class GLContextImpl extends GLContext {
glRenderer = glVendor;
glRendererLowerCase = glRenderer;
glVersion = glVendor;
-
+
if (boundFBOTarget != null) { // <init>
boundFBOTarget[0] = 0; // draw
boundFBOTarget[1] = 0; // read
}
-
+
pixelDataEvaluated = false;
- super.resetStates();
+ super.resetStates(isInit);
}
@Override
public final GLDrawable setGLReadDrawable(GLDrawable read) {
- if(!isGLReadDrawableAvailable()) {
+ if(!isGLReadDrawableAvailable()) {
throw new GLException("Setting read drawable feature not available");
}
final boolean lockHeld = lock.isOwner(Thread.currentThread());
@@ -220,7 +220,7 @@ public abstract class GLContextImpl extends GLContext {
final Thread currentThread = Thread.currentThread();
if( lock.isLockedByOtherThread() ) {
throw new GLException("GLContext current by other thread "+lock.getOwner().getName()+", operation not allowed on this thread "+currentThread.getName());
- }
+ }
final boolean lockHeld = lock.isOwner(currentThread);
if( lockHeld && lock.getHoldCount() > 1 ) {
// would need to makeCurrent * holdCount
@@ -272,7 +272,7 @@ public abstract class GLContextImpl extends GLContext {
}
return _gl;
}
-
+
@Override
public final GL getGL() {
return gl;
@@ -280,11 +280,11 @@ public abstract class GLContextImpl extends GLContext {
@Override
public GL setGL(GL gl) {
- if(DEBUG) {
- String sgl1 = (null!=this.gl)?this.gl.getClass().getSimpleName()+", "+this.gl.toString():"<null>";
- String sgl2 = (null!=gl)?gl.getClass().getSimpleName()+", "+gl.toString():"<null>";
- Exception e = new Exception("Info: setGL (OpenGL "+getGLVersion()+"): "+getThreadName()+", "+sgl1+" -> "+sgl2);
- e.printStackTrace();
+ if( DEBUG ) {
+ 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();
}
this.gl = gl;
return gl;
@@ -314,13 +314,13 @@ public abstract class GLContextImpl extends GLContext {
@Override
public void release() throws GLException {
release(false);
- }
+ }
private void release(boolean inDestruction) throws GLException {
if( TRACE_SWITCH ) {
System.err.println(getThreadName() +": GLContext.ContextSwitch[release.0]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+", inDestruction: "+inDestruction+", "+lock);
}
if ( !lock.isOwner(Thread.currentThread()) ) {
- final String msg = getThreadName() +": Context not current on current thread, obj " + toHexString(hashCode())+", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+", inDestruction: "+inDestruction+", "+lock;
+ final String msg = getThreadName() +": Context not current on thread, obj " + toHexString(hashCode())+", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+", inDestruction: "+inDestruction+", "+lock;
if( DEBUG_TRACE_SWITCH ) {
System.err.println(msg);
if( null != lastCtxReleaseStack ) {
@@ -332,7 +332,7 @@ public abstract class GLContextImpl extends GLContext {
}
throw new GLException(msg);
}
-
+
Throwable drawableContextMadeCurrentException = null;
final boolean actualRelease = ( inDestruction || lock.getHoldCount() == 1 ) && 0 != contextHandle;
try {
@@ -365,7 +365,7 @@ public abstract class GLContextImpl extends GLContext {
if(null != drawableContextMadeCurrentException) {
throw new GLException("GLContext.release(false) during GLDrawableImpl.contextMadeCurrent(this, false)", drawableContextMadeCurrentException);
}
-
+
}
private Throwable lastCtxReleaseStack = null;
protected abstract void releaseImpl() throws GLException;
@@ -429,9 +429,10 @@ public abstract class GLContextImpl extends GLContext {
contextHandle = 0;
glDebugHandler = null;
// this maybe impl. in a platform specific way to release remaining shared ctx.
- if(GLContextShareSet.contextDestroyed(this) && !GLContextShareSet.hasCreatedSharedLeft(this)) {
+ if( GLContextShareSet.contextDestroyed(this) && !GLContextShareSet.hasCreatedSharedLeft(this) ) {
GLContextShareSet.unregisterSharing(this);
}
+ resetStates(false);
} finally {
lock.unlock();
if ( DEBUG_TRACE_SWITCH ) {
@@ -443,10 +444,11 @@ public abstract class GLContextImpl extends GLContext {
drawable.unlockSurface();
}
if( null != associateDrawableException ) {
- throw new GLException("GLContext.destroy() during associateDrawable(false)", associateDrawableException);
+ throw new GLException("Exception @ destroy's associateDrawable(false)", associateDrawableException);
}
+ } else {
+ resetStates(false);
}
- resetStates();
}
protected abstract void destroyImpl() throws GLException;
@@ -516,21 +518,21 @@ public abstract class GLContextImpl extends GLContext {
public final int makeCurrent() throws GLException {
return makeCurrent(false);
}
-
+
protected final int makeCurrent(boolean forceDrawableAssociation) throws GLException {
if( TRACE_SWITCH ) {
System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.0]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - "+lock);
- }
+ }
// Note: the surface is locked within [makeCurrent .. swap .. release]
final int lockRes = drawable.lockSurface();
if (NativeSurface.LOCK_SURFACE_NOT_READY >= lockRes) {
if( DEBUG_TRACE_SWITCH ) {
- System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X1]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - Surface Not Ready - CONTEXT_NOT_CURRENT - "+lock);
+ System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X1]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - Surface Not Ready - CONTEXT_NOT_CURRENT - "+lock);
}
return CONTEXT_NOT_CURRENT;
}
-
+
boolean unlockResources = true; // Must be cleared if successful, otherwise finally block will release context and/or surface!
int res = CONTEXT_NOT_CURRENT;
try {
@@ -550,7 +552,7 @@ public abstract class GLContextImpl extends GLContext {
drawableUpdatedNotify();
unlockResources = false; // success
if( TRACE_SWITCH ) {
- System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X2]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - keep - CONTEXT_CURRENT - "+lock);
+ System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X2]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - keep - CONTEXT_CURRENT - "+lock);
}
return CONTEXT_CURRENT;
} else {
@@ -559,7 +561,7 @@ public abstract class GLContextImpl extends GLContext {
}
res = makeCurrentWithinLock(lockRes);
unlockResources = CONTEXT_NOT_CURRENT == res; // success ?
-
+
/**
* FIXME: refactor dependence on Java 2D / JOGL bridge
if ( tracker != null && res == CONTEXT_CURRENT_NEW ) {
@@ -598,24 +600,24 @@ public abstract class GLContextImpl extends GLContext {
glDebugHandler.init( isGL2GL3() && isGLDebugEnabled() );
if(DEBUG_GL) {
- gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) );
+ setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) );
if(glDebugHandler.isEnabled()) {
glDebugHandler.addListener(new GLDebugMessageHandler.StdErrGLDebugListener(true));
}
}
if(TRACE_GL) {
- gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) );
+ setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) );
}
-
+
forceDrawableAssociation = true;
}
-
+
if( forceDrawableAssociation ) {
associateDrawable(true);
}
-
+
contextMadeCurrent(true);
-
+
/* FIXME: refactor dependence on Java 2D / JOGL bridge
// Try cleaning up any stale server-side OpenGL objects
@@ -626,11 +628,11 @@ public abstract class GLContextImpl extends GLContext {
*/
}
if( TRACE_SWITCH ) {
- System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X3]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - switch - "+makeCurrentResultToString(res)+" - "+lock);
- }
+ System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X3]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - switch - "+makeCurrentResultToString(res)+" - stateTracker.on "+glStateTracker.isEnabled()+" - "+lock);
+ }
return res;
}
-
+
private final int makeCurrentWithinLock(int surfaceLockRes) throws GLException {
if (!isCreated()) {
if( 0 >= drawable.getWidth() || 0 >= drawable.getHeight() ) {
@@ -645,9 +647,13 @@ public abstract class GLContextImpl extends GLContext {
additionalCtxCreationFlags |= GLContext.CTX_OPTION_DEBUG ;
}
- final GLContextImpl shareWith = (GLContextImpl) GLContextShareSet.getShareContext(this);
+ final GLContextImpl shareWith = (GLContextImpl) GLContextShareSet.getCreatedShare(this);
if (null != shareWith) {
shareWith.getDrawableImpl().lockSurface();
+ // FIXME:
+ // Contemplate whether we shall 'fail' creating this context
+ // if 0==shareWith.getHandle(), since at this point
+ // both context are locked and current values are available.
}
final boolean created;
try {
@@ -681,7 +687,7 @@ public abstract class GLContextImpl extends GLContext {
final AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice device = config.getScreen().getDevice();
- // Non ARB desktop profiles may not have been registered
+ // Non ARB desktop profiles may not have been registered
if( !GLContext.getAvailableGLVersionsSet(device) ) { // not yet set
if( 0 == ( ctxOptions & GLContext.CTX_PROFILE_ES) ) { // not ES profile
final int reqMajor;
@@ -699,10 +705,10 @@ public abstract class GLContextImpl extends GLContext {
GLContext.mapAvailableGLVersion(device, reqMajor, reqProfile,
ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
GLContext.setAvailableGLVersionsSet(device);
-
+
if (DEBUG) {
System.err.println(getThreadName() + ": createContextOLD-MapVersionsAvailable HAVE: " + device+" -> "+reqMajor+"."+reqProfile+ " -> "+getGLVersion());
- }
+ }
}
}
}
@@ -715,17 +721,17 @@ public abstract class GLContextImpl extends GLContext {
protected abstract void makeCurrentImpl() throws GLException;
/**
- * Calls {@link GLDrawableImpl#associateContext(GLContext, boolean)}
- */
- protected void associateDrawable(boolean bound) {
- drawable.associateContext(this, bound);
+ * Calls {@link GLDrawableImpl#associateContext(GLContext, boolean)}
+ */
+ protected void associateDrawable(boolean bound) {
+ drawable.associateContext(this, bound);
}
-
+
/**
- * Calls {@link GLDrawableImpl#contextMadeCurrent(GLContext, boolean)}
- */
+ * Calls {@link GLDrawableImpl#contextMadeCurrent(GLContext, boolean)}
+ */
protected void contextMadeCurrent(boolean current) {
- drawable.contextMadeCurrent(this, current);
+ drawable.contextMadeCurrent(this, current);
}
/**
@@ -824,8 +830,11 @@ public abstract class GLContextImpl extends GLContext {
final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
final int[] reqMajorCTP = new int[] { 0, 0 };
- getRequestMajorAndCompat(glCaps.getGLProfile(), reqMajorCTP);
-
+ GLContext.getRequestMajorAndCompat(glCaps.getGLProfile(), reqMajorCTP);
+
+ if(DEBUG) {
+ System.err.println(getThreadName() + ": createContextARB: Requested "+GLContext.getGLVersion(reqMajorCTP[0], 0, reqMajorCTP[0], null));
+ }
int _major[] = { 0 };
int _minor[] = { 0 };
int _ctp[] = { 0 };
@@ -833,14 +842,19 @@ public abstract class GLContextImpl extends GLContext {
if( GLContext.getAvailableGLVersion(device, reqMajorCTP[0], reqMajorCTP[1],
_major, _minor, _ctp)) {
_ctp[0] |= additionalCtxCreationFlags;
+ if(DEBUG) {
+ System.err.println(getThreadName() + ": createContextARB: Mapped "+GLContext.getGLVersion(_major[0], _minor[0], _ctp[0], null));
+ }
_ctx = createContextARBImpl(share, direct, _ctp[0], _major[0], _minor[0]);
if(0!=_ctx) {
- setGLFunctionAvailability(true, _major[0], _minor[0], _ctp[0], false);
+ if( !setGLFunctionAvailability(true, _major[0], _minor[0], _ctp[0], false /* strictMatch */, false /* withinGLVersionsMapping */) ) {
+ throw new InternalError("setGLFunctionAvailability !strictMatch failed");
+ }
}
}
return _ctx;
}
-
+
private final boolean mapGLVersions(AbstractGraphicsDevice device) {
synchronized (GLContext.deviceVersionAvailable) {
final long t0 = ( DEBUG ) ? System.nanoTime() : 0;
@@ -851,80 +865,100 @@ public abstract class GLContextImpl extends GLContext {
boolean hasGL2 = false;
boolean hasGL4 = false;
boolean hasGL3 = false;
- boolean hasES3 = false;
-
+
// Even w/ PROFILE_ALIASING, try to use true core GL profiles
// ensuring proper user behavior across platforms due to different feature sets!
//
- if(!hasGL4) {
+ if( Platform.OSType.MACOS == Platform.getOSType() &&
+ Platform.getOSVersionNumber().compareTo(Platform.OSXVersion.Mavericks) >= 0 ) {
+ /**
+ * OSX 10.9 GLRendererQuirks.GL4NeedsGL3Request, quirk is added as usual @ setRendererQuirks(..)
+ */
+ if( !hasGL4 && !hasGL3 ) {
+ hasGL3 = createContextARBMapVersionsAvailable(3, CTX_PROFILE_CORE); // GL3
+ success |= hasGL3;
+ if( hasGL3 ) {
+ final boolean isHWAccel = 0 == ( CTX_IMPL_ACCEL_SOFT & ctxOptions );
+ if( isHWAccel && ctxVersion.getMajor() >= 4 ) {
+ // Gotcha: Creating a '3.2' ctx delivers a >= 4 ctx.
+ GLContext.mapAvailableGLVersion(device, 4, CTX_PROFILE_CORE, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
+ hasGL4 = true;
+ if(DEBUG) {
+ System.err.println("Quirk Triggerd: "+GLRendererQuirks.toString(GLRendererQuirks.GL4NeedsGL3Request)+": cause: OS "+Platform.getOSType()+", OS Version "+Platform.getOSVersionNumber());
+ }
+ }
+ resetStates(false); // clean this context states, since creation was temporary
+ }
+ }
+ }
+ if( !hasGL4 ) {
hasGL4 = createContextARBMapVersionsAvailable(4, CTX_PROFILE_CORE); // GL4
success |= hasGL4;
- if(hasGL4) {
- // Map all lower compatible profiles: GL3
- GLContext.mapAvailableGLVersion(device, 3, CTX_PROFILE_CORE, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
- if(PROFILE_ALIASING) {
- hasGL3 = true;
+ if( hasGL4 ) {
+ if( 0 == ( CTX_IMPL_ACCEL_SOFT & ctxOptions ) ) {
+ // Map hw-accel GL4 to all lower core profiles: GL3
+ GLContext.mapAvailableGLVersion(device, 3, CTX_PROFILE_CORE, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
+ if( PROFILE_ALIASING ) {
+ hasGL3 = true;
+ }
}
- resetStates(); // clean context states, since creation was temporary
+ resetStates(false); // clean context states, since creation was temporary
}
}
- if(!hasGL3) {
+ if( !hasGL3 ) {
hasGL3 = createContextARBMapVersionsAvailable(3, CTX_PROFILE_CORE); // GL3
success |= hasGL3;
- if(hasGL3) {
- resetStates(); // clean this context states, since creation was temporary
+ if( hasGL3 ) {
+ resetStates(false); // clean this context states, since creation was temporary
}
}
- if(!hasGL4bc) {
+ if( !hasGL4bc ) {
hasGL4bc = createContextARBMapVersionsAvailable(4, CTX_PROFILE_COMPAT); // GL4bc
success |= hasGL4bc;
- if(hasGL4bc) {
- // Map all lower compatible profiles: GL3bc, GL2, GL4, GL3
- GLContext.mapAvailableGLVersion(device, 3, CTX_PROFILE_COMPAT, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
- GLContext.mapAvailableGLVersion(device, 2, CTX_PROFILE_COMPAT, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
- if(!hasGL4) {
+ if( hasGL4bc ) {
+ if( !hasGL4 ) { // last chance .. ignore hw-accel
GLContext.mapAvailableGLVersion(device, 4, CTX_PROFILE_CORE, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
+ hasGL4 = true;
}
- if(!hasGL3) {
+ if( !hasGL3 ) { // last chance .. ignore hw-accel
GLContext.mapAvailableGLVersion(device, 3, CTX_PROFILE_CORE, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
- }
- if(PROFILE_ALIASING) {
- hasGL3bc = true;
- hasGL2 = true;
- hasGL4 = true;
hasGL3 = true;
}
- resetStates(); // clean this context states, since creation was temporary
+ if( 0 == ( CTX_IMPL_ACCEL_SOFT & ctxOptions ) ) {
+ // Map hw-accel GL4bc to all lower compatible profiles: GL3bc, GL2
+ GLContext.mapAvailableGLVersion(device, 3, CTX_PROFILE_COMPAT, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
+ GLContext.mapAvailableGLVersion(device, 2, CTX_PROFILE_COMPAT, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
+ if(PROFILE_ALIASING) {
+ hasGL3bc = true;
+ hasGL2 = true;
+ }
+ }
+ resetStates(false); // clean this context states, since creation was temporary
}
}
- if(!hasGL3bc) {
+ if( !hasGL3bc ) {
hasGL3bc = createContextARBMapVersionsAvailable(3, CTX_PROFILE_COMPAT); // GL3bc
success |= hasGL3bc;
- if(hasGL3bc) {
- // Map all lower compatible profiles: GL2 and GL3
- GLContext.mapAvailableGLVersion(device, 2, CTX_PROFILE_COMPAT, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
- if(!hasGL3) {
+ if( hasGL3bc ) {
+ if(!hasGL3) { // last chance .. ignore hw-accel
GLContext.mapAvailableGLVersion(device, 3, CTX_PROFILE_CORE, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
- }
- if(PROFILE_ALIASING) {
- hasGL2 = true;
hasGL3 = true;
}
- resetStates(); // clean this context states, since creation was temporary
+ if( 0 == ( CTX_IMPL_ACCEL_SOFT & ctxOptions ) ) {
+ // Map hw-accel GL3bc to all lower compatible profiles: GL2
+ GLContext.mapAvailableGLVersion(device, 2, CTX_PROFILE_COMPAT, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
+ if(PROFILE_ALIASING) {
+ hasGL2 = true;
+ }
+ }
+ resetStates(false); // clean this context states, since creation was temporary
}
}
- if(!hasGL2) {
+ if( !hasGL2 ) {
hasGL2 = createContextARBMapVersionsAvailable(2, CTX_PROFILE_COMPAT); // GL2
success |= hasGL2;
- if(hasGL2) {
- resetStates(); // clean this context states, since creation was temporary
- }
- }
- if(!hasES3) {
- hasES3 = createContextARBMapVersionsAvailable(3, CTX_PROFILE_ES); // ES3
- success |= hasES3;
- if(hasES3) {
- resetStates(); // clean this context states, since creation was temporary
+ if( hasGL2 ) {
+ resetStates(false); // clean this context states, since creation was temporary
}
}
if(success) {
@@ -933,7 +967,7 @@ public abstract class GLContextImpl extends GLContext {
if(DEBUG) {
final long t1 = System.nanoTime();
System.err.println("GLContextImpl.mapGLVersions: "+device+", profileAliasing: "+PROFILE_ALIASING+", total "+(t1-t0)/1e6 +"ms");
- System.err.println(GLContext.dumpAvailableGLVersions(null).toString());
+ System.err.println(GLContext.dumpAvailableGLVersions(null).toString());
}
} else if (DEBUG) {
System.err.println(getThreadName() + ": createContextARB-MapVersions NONE for :"+device);
@@ -942,9 +976,9 @@ public abstract class GLContextImpl extends GLContext {
}
}
- /**
- * Note: Since context creation is temporary, caller need to issue {@link #resetStates()}, if creation was successful, i.e. returns true.
- * This method does not reset the states, allowing the caller to utilize the state variables.
+ /**
+ * Note: Since context creation is temporary, caller need to issue {@link #resetStates(boolean)}, if creation was successful, i.e. returns true.
+ * This method does not reset the states, allowing the caller to utilize the state variables.
**/
private final boolean createContextARBMapVersionsAvailable(int reqMajor, int reqProfile) {
long _context;
@@ -1020,16 +1054,18 @@ public abstract class GLContextImpl extends GLContext {
major[0]=majorMax;
minor[0]=minorMax;
long _context=0;
+ int i=0;
- while ( GLContext.isValidGLVersion(ctxOptionFlags, major[0], minor[0]) &&
- ( major[0]>majorMin || major[0]==majorMin && minor[0] >=minorMin ) ) {
+ do {
if (DEBUG) {
- System.err.println(getThreadName() + ": createContextARBVersions: share "+share+", direct "+direct+", version "+major[0]+"."+minor[0]);
+ i++;
+ System.err.println(getThreadName() + ": createContextARBVersions."+i+": share "+share+", direct "+direct+
+ ", version "+major[0]+"."+minor[0]+", major["+majorMin+".."+majorMax+"], minor["+minorMin+".."+minorMax+"]");
}
_context = createContextARBImpl(share, direct, ctxOptionFlags, major[0], minor[0]);
if(0 != _context) {
- if( setGLFunctionAvailability(true, major[0], minor[0], ctxOptionFlags, true) ) {
+ if( setGLFunctionAvailability(true, major[0], minor[0], ctxOptionFlags, true /* strictMatch */, true /* withinGLVersionsMapping */) ) {
break;
} else {
destroyContextARBImpl(_context);
@@ -1037,9 +1073,12 @@ public abstract class GLContextImpl extends GLContext {
}
}
- if(!GLContext.decrementGLVersion(ctxOptionFlags, major, minor)) {
- break;
- }
+ } while ( ( major[0]>majorMin || major[0]==majorMin && minor[0] >minorMin ) && // #1 check whether version is above lower limit
+ GLContext.decrementGLVersion(ctxOptionFlags, major, minor) // #2 decrement version
+ );
+ if (DEBUG) {
+ System.err.println(getThreadName() + ": createContextARBVersions.X: ctx "+toHexString(_context)+", share "+share+", direct "+direct+
+ ", version "+major[0]+"."+minor[0]+", major["+majorMin+".."+majorMax+"], minor["+minorMin+".."+minorMax+"]");
}
return _context;
}
@@ -1057,10 +1096,6 @@ public abstract class GLContextImpl extends GLContext {
if ( 0 == ctp ) {
throw new GLException("Invalid GL Version "+major+"."+minor+", ctp "+toHexString(ctp));
}
-
- if (!GLContext.isValidGLVersion(ctp, major, minor)) {
- throw new GLException("Invalid GL Version "+major+"."+minor+", ctp "+toHexString(ctp));
- }
ctxVersion = new VersionNumber(major, minor, 0);
ctxVersionString = getGLVersion(major, minor, ctp, glVersion);
ctxVendorVersion = glVendorVersion;
@@ -1078,10 +1113,10 @@ public abstract class GLContextImpl extends GLContext {
if( ctxGLSLVersion.isZero() ) {
ctxGLSLVersion = getStaticGLSLVersionNumber(major, minor, ctxOptions);
}
- }
+ }
}
}
-
+
//----------------------------------------------------------------------
// Helpers for various context implementations
//
@@ -1105,8 +1140,8 @@ public abstract class GLContextImpl extends GLContext {
*/
return gl;
}
-
- /**
+
+ /**
* Finalizes GL instance initialization after this context has been initialized.
* <p>
* Method calls 'void finalizeInit()' of instance 'gl' as retrieved by reflection, if exist.
@@ -1136,7 +1171,7 @@ public abstract class GLContextImpl extends GLContext {
* ie for GLXExt, EGLExt, ..
*/
public abstract ProcAddressTable getPlatformExtProcAddressTable();
-
+
/**
* Part of <code>GL_NV_vertex_array_range</code>.
* <p>
@@ -1152,7 +1187,7 @@ public abstract class GLContextImpl extends GLContext {
* Provides platform-independent access to the <code>wglFreeMemoryNV</code> /
* <code>glXFreeMemoryNV</code>.
* </p>
- */
+ */
public abstract void glFreeMemoryNV(ByteBuffer pointer);
/** Maps the given "platform-independent" function name to a real function
@@ -1187,13 +1222,14 @@ public abstract class GLContextImpl extends GLContext {
GLEmitter by looking up anew all of its function pointers. */
protected final void resetProcAddressTable(final ProcAddressTable table) {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
table.reset(getDrawableImpl().getGLDynamicLookupHelper() );
return null;
}
} );
}
-
+
private final boolean initGLRendererAndGLVersionStrings() {
final GLDynamicLookupHelper glDynLookupHelper = getDrawableImpl().getGLDynamicLookupHelper();
final long _glGetString = glDynLookupHelper.dynamicLookupFunction("glGetString");
@@ -1213,7 +1249,7 @@ public abstract class GLContextImpl extends GLContext {
return false;
}
glVendor = _glVendor;
-
+
final String _glRenderer = glGetStringInt(GL.GL_RENDERER, _glGetString);
if(null == _glRenderer) {
if(DEBUG) {
@@ -1224,7 +1260,7 @@ public abstract class GLContextImpl extends GLContext {
}
glRenderer = _glRenderer;
glRendererLowerCase = glRenderer.toLowerCase();
-
+
final String _glVersion = glGetStringInt(GL.GL_VERSION, _glGetString);
if(null == _glVersion) {
// FIXME
@@ -1235,22 +1271,12 @@ public abstract class GLContextImpl extends GLContext {
return false;
}
glVersion = _glVersion;
-
+
return true;
}
}
/**
- * We cannot promote a non ARB context to >= 3.1, reduce it to 3.0 then.
- */
- private static void limitNonARBContextVersion(int[] major, int[] minor, int ctp) {
- if ( 0 == (ctp & CTX_IS_ARB_CREATED) && ( major[0] > 3 || major[0] == 3 && minor[0] >= 1 ) ) {
- major[0] = 3;
- minor[0] = 0;
- }
- }
-
- /**
* Returns null if version string is invalid, otherwise a valid instance.
* <p>
* Note: Non ARB ctx is limited to GL 3.0.
@@ -1262,7 +1288,6 @@ public abstract class GLContextImpl extends GLContext {
if ( version.isValid() ) {
int[] major = new int[] { version.getMajor() };
int[] minor = new int[] { version.getMinor() };
- limitNonARBContextVersion(major, minor, ctp);
if ( GLContext.isValidGLVersion(ctp, major[0], minor[0]) ) {
return new VersionNumber(major[0], minor[0], 0);
}
@@ -1276,7 +1301,7 @@ public abstract class GLContextImpl extends GLContext {
* version for given arrays.
* <p>
* If the GL query fails, major will be zero.
- * </p>
+ * </p>
* <p>
* Note: Non ARB ctx is limited to GL 3.0.
* </p>
@@ -1290,20 +1315,19 @@ public abstract class GLContextImpl extends GLContext {
if(DEBUG) {
Thread.dumpStack();
}
- return false;
+ return false;
} else {
glGetIntegervInt(GL2GL3.GL_MAJOR_VERSION, glIntMajor, 0, _glGetIntegerv);
glGetIntegervInt(GL2GL3.GL_MINOR_VERSION, glIntMinor, 0, _glGetIntegerv);
- limitNonARBContextVersion(glIntMajor, glIntMinor, ctp);
- return true;
+ return true;
}
}
-
+
protected final int getCtxOptions() {
return ctxOptions;
}
-
+
/**
* Sets the OpenGL implementation class and
* the cache of which GL functions are available for calling through this
@@ -1322,15 +1346,21 @@ public abstract class GLContextImpl extends GLContext {
* <ul>
* <li>be greater or equal than the requested <code>major.minor</code> version, and</li>
* <li>match the ctxProfileBits</li>
- * </ul>, otherwise method aborts and returns <code>false</code>.
- * @return returns <code>true</code> if successful, otherwise <code>false</code>. See <code>strictMatch</code>.
- * If <code>false</code> is returned, no data has been cached or mapped, i.e. ProcAddressTable, Extensions, Version, etc.
+ * <li>match ES major versions</li>
+ * </ul>, otherwise method aborts and returns <code>false</code>.<br>
+ * if <code>false</code> no version check is performed.
+ * @param withinGLVersionsMapping if <code>true</code> GL version mapping is in process, i.e. quering avail versions.
+ * Otherwise normal user context creation.
+ * @return returns <code>true</code> if successful, otherwise <code>false</code>.<br>
+ * 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
*/
- protected final boolean setGLFunctionAvailability(boolean force, int major, int minor, int ctxProfileBits, boolean strictMatch) {
+ protected final boolean setGLFunctionAvailability(boolean force, int major, int minor, int ctxProfileBits,
+ boolean strictMatch, boolean withinGLVersionsMapping) {
if(null!=this.gl && null!=glProcAddressTable && !force) {
return true; // already done and not forced
}
@@ -1338,7 +1368,7 @@ public abstract class GLContextImpl extends GLContext {
if ( 0 < major && !GLContext.isValidGLVersion(ctxProfileBits, major, minor) ) {
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( getGLDrawable().getGLProfile() ) );
}
@@ -1346,7 +1376,8 @@ public abstract class GLContextImpl extends GLContext {
final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
-
+ final int reqCtxProfileBits = ctxProfileBits;
+ final VersionNumber reqGLVersion = new VersionNumber(major, minor, 0);
{
final boolean initGLRendererAndGLVersionStringsOK = initGLRendererAndGLVersionStrings();
if( !initGLRendererAndGLVersionStringsOK ) {
@@ -1365,107 +1396,131 @@ public abstract class GLContextImpl extends GLContext {
System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: Given "+adevice+" - "+GLContext.getGLVersion(major, minor, ctxProfileBits, glVersion));
}
}
-
+
+ final boolean isES = 0 != ( CTX_PROFILE_ES & ctxProfileBits );
+
//
// Validate GL version either by GL-Integer or GL-String
//
if (DEBUG) {
- System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: Pre version verification - expected "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)+", strictMatch "+strictMatch);
+ System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: Pre version verification - expected "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)+", strictMatch "+strictMatch+", glVersionsMapping " +withinGLVersionsMapping);
}
boolean versionValidated = false;
boolean versionGL3IntFailed = false;
{
- // Validate the requested version w/ the GL-version from an integer query.
- final int[] glIntMajor = new int[] { 0 }, glIntMinor = new int[] { 0 };
- final boolean getGLIntVersionOK = getGLIntVersion(glIntMajor, glIntMinor, ctxProfileBits);
- 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);
+ // Validate the requested version w/ the GL-version from an integer query.
+ final VersionNumber hasGLVersionByInt;
+ {
+ final int[] glIntMajor = new int[] { 0 }, glIntMinor = new int[] { 0 };
+ final boolean getGLIntVersionOK = getGLIntVersion(glIntMajor, glIntMinor, ctxProfileBits);
+ 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);
}
- return false;
- } else {
- // unusable GL context - non query mode - hard fail!
- throw new GLException(errMsg);
}
- }
+ hasGLVersionByInt = new VersionNumber(glIntMajor[0], glIntMinor[0], 0);
+ }
if (DEBUG) {
- System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: version verification (Int): "+glVersion+", "+glIntMajor[0]+"."+glIntMinor[0]);
+ System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: Version verification (Int): "+glVersion+", "+hasGLVersionByInt);
}
-
+
// Only validate if a valid int version was fetched, otherwise cont. w/ version-string method -> 3.0 > Version || Version > MAX!
- if ( GLContext.isValidGLVersion(ctxProfileBits, glIntMajor[0], glIntMinor[0]) ) {
- if( glIntMajor[0]<major || ( glIntMajor[0]==major && glIntMinor[0]<minor ) || 0 == major ) {
- if( strictMatch && 2 < major ) { // relaxed match for versions major < 3 requests, last resort!
- if(DEBUG) {
- System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: FAIL, GL version mismatch (Int): "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)+" -> "+glVersion+", "+glIntMajor[0]+"."+glIntMinor[0]);
- }
- return false;
+ if ( GLContext.isValidGLVersion(ctxProfileBits, hasGLVersionByInt.getMajor(), hasGLVersionByInt.getMinor()) ) {
+ // Strict Match (GLVersionMapping):
+ // Relaxed match for versions ( !isES && major < 3 ) requests, last resort!
+ // Otherwise:
+ // - fail if hasVersion < reqVersion
+ // - fail if ES major-version mismatch
+ //
+ if( strictMatch &&
+ ( ( ( isES || major >= 3 ) && hasGLVersionByInt.compareTo(reqGLVersion) < 0 ) ||
+ ( isES && major != hasGLVersionByInt.getMajor() )
+ ) ) {
+ if(DEBUG) {
+ System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: FAIL, GL version mismatch (Int): "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)+" -> "+glVersion+", "+hasGLVersionByInt);
}
- major = glIntMajor[0];
- minor = glIntMinor[0];
+ return false;
}
+ // Use returned GL version!
+ major = hasGLVersionByInt.getMajor();
+ minor = hasGLVersionByInt.getMinor();
versionValidated = true;
} else {
versionGL3IntFailed = true;
}
}
if( !versionValidated ) {
- // Validate the requested version w/ the GL-version from the version string.
- final VersionNumber setGLVersionNumber = new VersionNumber(major, minor, 0);
- final VersionNumber strGLVersionNumber = getGLVersionNumber(ctxProfileBits, glVersion);
+ // Validate the requested version w/ the GL-version from the version string.
+ final VersionNumber hasGLVersionByString = getGLVersionNumber(ctxProfileBits, glVersion);
if (DEBUG) {
- System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: version verification (String): "+glVersion+", "+strGLVersionNumber);
+ System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: Version verification (String): "+glVersion+", "+hasGLVersionByString);
}
-
+
// Only validate if a valid string version was fetched -> MIN > Version || Version > MAX!
- if( null != strGLVersionNumber ) {
- if( strGLVersionNumber.compareTo(setGLVersionNumber) < 0 || 0 == major ) {
- if( strictMatch && 2 < major ) { // relaxed match for versions major < 3 requests, last resort!
- if(DEBUG) {
- System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: FAIL, GL version mismatch (String): "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)+" -> "+glVersion+", "+strGLVersionNumber);
- }
- return false;
+ if( null != hasGLVersionByString ) {
+ // Strict Match (GLVersionMapping):
+ // Relaxed match for versions ( !isES && major < 3 ) requests, last resort!
+ // Otherwise:
+ // - fail if hasVersion < reqVersion
+ // - fail if ES major-version mismatch
+ //
+ if( strictMatch &&
+ ( ( ( isES || major >= 3 ) && hasGLVersionByString.compareTo(reqGLVersion) < 0 ) ||
+ ( isES && major != hasGLVersionByString.getMajor() )
+ ) ) {
+ if(DEBUG) {
+ System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: FAIL, GL version mismatch (String): "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)+" -> "+glVersion+", "+hasGLVersionByString);
}
- major = strGLVersionNumber.getMajor();
- minor = strGLVersionNumber.getMinor();
+ return false;
}
if( strictMatch && versionGL3IntFailed && major >= 3 ) {
if(DEBUG) {
- System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: FAIL, GL3 version Int failed, String: "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)+" -> "+glVersion+", "+strGLVersionNumber);
+ System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: FAIL, GL3/ES3 version Int failed, String: "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)+" -> "+glVersion+", "+hasGLVersionByString);
}
- return false;
+ return false;
}
+ // Use returned GL version!
+ major = hasGLVersionByString.getMajor();
+ minor = hasGLVersionByString.getMinor();
versionValidated = true;
}
}
- if( strictMatch && !versionValidated && 0 < major ) {
+ if( strictMatch && !versionValidated ) {
if(DEBUG) {
System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: FAIL, No GL version validation possible: "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)+" -> "+glVersion);
}
- return false;
+ return false;
}
if (DEBUG) {
- System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: post version verification "+GLContext.getGLVersion(major, minor, ctxProfileBits, null)+", strictMatch "+strictMatch+", versionValidated "+versionValidated+", versionGL3IntFailed "+versionGL3IntFailed);
+ System.err.println(getThreadName() + ": GLContext.setGLFuncAvail: Post version verification req "+
+ GLContext.getGLVersion(reqGLVersion.getMajor(), reqGLVersion.getMinor(), reqCtxProfileBits, null)+" -> has "+
+ GLContext.getGLVersion(major, minor, ctxProfileBits, null)+
+ ", strictMatch "+strictMatch+", versionValidated "+versionValidated+", versionGL3IntFailed "+versionGL3IntFailed);
}
-
- if( 2 > major ) { // there is no ES2/3-compat for a profile w/ major < 2
+
+ if( major < 2 ) { // there is no ES2/3-compat for a profile w/ major < 2
ctxProfileBits &= ~ ( GLContext.CTX_IMPL_ES2_COMPAT | GLContext.CTX_IMPL_ES3_COMPAT ) ;
}
-
+
final VersionNumberString vendorVersion = GLVersionNumber.createVendorVersion(glVersion);
-
- setRendererQuirks(adevice, major, minor, ctxProfileBits, vendorVersion);
-
+
+ setRendererQuirks(adevice, reqGLVersion.getMajor(), reqGLVersion.getMinor(), reqCtxProfileBits, major, minor, ctxProfileBits, vendorVersion, withinGLVersionsMapping);
+
if( strictMatch && glRendererQuirks.exist(GLRendererQuirks.GLNonCompliant) ) {
if(DEBUG) {
System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: FAIL, GL is not compliant: "+GLContext.getGLVersion(major, minor, ctxProfileBits, glVersion)+", "+glRenderer);
}
return false;
}
-
+
if(!isCurrentContextHardwareRasterizer()) {
ctxProfileBits |= GLContext.CTX_IMPL_ACCEL_SOFT;
}
@@ -1527,8 +1582,8 @@ public abstract class GLContextImpl extends GLContext {
}
}
}
-
- if( 0 != ( CTX_PROFILE_ES & ctxProfileBits ) ) {
+
+ if( isES ) {
if( major >= 3 ) {
ctxProfileBits |= CTX_IMPL_ES3_COMPAT | CTX_IMPL_ES2_COMPAT ;
ctxProfileBits |= CTX_IMPL_FBO;
@@ -1548,45 +1603,50 @@ public abstract class GLContextImpl extends GLContext {
} else if( hasFBOImpl(major, ctxProfileBits, extensionAvailability) ) {
ctxProfileBits |= CTX_IMPL_FBO;
}
-
- if( ( 0 != ( CTX_PROFILE_ES & ctxProfileBits ) && major == 1 ) || isExtensionAvailable(GLExtensions.OES_single_precision) ) {
+
+ if( ( isES && major == 1 ) || isExtensionAvailable(GLExtensions.OES_single_precision) ) {
ctxProfileBits |= CTX_IMPL_FP32_COMPAT_API;
}
-
+
if(FORCE_NO_FBO_SUPPORT) {
ctxProfileBits &= ~CTX_IMPL_FBO ;
- }
-
+ }
+
//
// Set GL Version (complete w/ version string)
//
setContextVersion(major, minor, ctxProfileBits, vendorVersion, true);
-
+
finalizeInit(gl);
-
+
setDefaultSwapInterval();
-
+
final int glErrX = gl.glGetError(); // clear GL error, maybe caused by above operations
-
+
if(DEBUG) {
System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.X: OK "+contextFQN+" - "+GLContext.getGLVersion(ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions, null)+" - glErr "+toHexString(glErrX));
}
return true;
}
-
- private final void setRendererQuirks(final AbstractGraphicsDevice adevice, int major, int minor, int ctp, final VersionNumberString vendorVersion) {
+
+ private final void setRendererQuirks(final AbstractGraphicsDevice adevice,
+ int reqMajor, int reqMinor, int reqCTP,
+ int major, int minor, int ctp, final VersionNumberString vendorVersion,
+ boolean withinGLVersionsMapping) {
int[] quirks = new int[GLRendererQuirks.COUNT + 1]; // + 1 ( NoFullFBOSupport )
int i = 0;
-
+
final String MesaSP = "Mesa ";
- // final String MesaRendererAMDsp = " AMD ";
- // final String MesaRendererIntelsp = "Intel(R)";
+ // final String MesaRendererAMDsp = " AMD ";
+ final String MesaRendererIntelsp = "Intel(R)";
final boolean hwAccel = 0 == ( ctp & GLContext.CTX_IMPL_ACCEL_SOFT );
final boolean compatCtx = 0 != ( ctp & GLContext.CTX_PROFILE_COMPAT );
+ final boolean isX11 = NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true);
+ final boolean isWindows = Platform.getOSType() == Platform.OSType.WINDOWS;
final boolean isDriverMesa = glRenderer.contains(MesaSP) || glRenderer.contains("Gallium ");
final boolean isDriverATICatalyst = !isDriverMesa && ( glVendor.contains("ATI Technologies") || glRenderer.startsWith("ATI ") );
final boolean isDriverNVIDIAGeForce = !isDriverMesa && ( glVendor.contains("NVIDIA Corporation") || glRenderer.contains("NVIDIA ") );
-
+
//
// OS related quirks
//
@@ -1601,16 +1661,35 @@ public abstract class GLContextImpl extends GLContext {
}
quirks[i++] = quirk;
}
-
- final VersionNumber OSXVersion173 = new VersionNumber(1,7,3);
- if( Platform.getOSVersionNumber().compareTo(OSXVersion173) < 0 && isDriverNVIDIAGeForce ) {
- final int quirk = GLRendererQuirks.GLFlushBeforeRelease;
+ if( Platform.getOSVersionNumber().compareTo(Platform.OSXVersion.Mavericks) >= 0 && 3==reqMajor && 4==major ) {
+ final int quirk = GLRendererQuirks.GL4NeedsGL3Request;
if(DEBUG) {
- System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType()+", OS Version "+Platform.getOSVersionNumber()+", Renderer "+glRenderer);
+ System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType()+", OS Version "+Platform.getOSVersionNumber()+", req "+reqMajor+"."+reqMinor);
}
quirks[i++] = quirk;
+ if( withinGLVersionsMapping ) {
+ // Thread safe due to single threaded initialization!
+ GLRendererQuirks.addStickyDeviceQuirks(adevice, quirks, i-1, 1);
+ }
+ }
+ if( isDriverNVIDIAGeForce ) {
+ final VersionNumber osxVersionNVFlushClean = new VersionNumber(10,7,3); // < OSX 10.7.3 w/ NV needs glFlush
+ if( Platform.getOSVersionNumber().compareTo(osxVersionNVFlushClean) < 0 ) {
+ final int quirk = GLRendererQuirks.GLFlushBeforeRelease;
+ if(DEBUG) {
+ System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType()+", OS Version "+Platform.getOSVersionNumber()+", Renderer "+glRenderer);
+ }
+ quirks[i++] = quirk;
+ }
+ if( Platform.getOSVersionNumber().compareTo(Platform.OSXVersion.Lion) < 0 ) { // < OSX 10.7.0 w/ NV has unstable GLSL
+ final int quirk = GLRendererQuirks.GLSLNonCompliant;
+ if(DEBUG) {
+ System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType()+", OS Version "+Platform.getOSVersionNumber()+", Renderer "+glRenderer);
+ }
+ quirks[i++] = quirk;
+ }
}
- } else if( Platform.getOSType() == Platform.OSType.WINDOWS ) {
+ } else if( isWindows ) {
//
// WINDOWS
//
@@ -1621,28 +1700,28 @@ public abstract class GLContextImpl extends GLContext {
}
quirks[i++] = quirk;
}
-
+
if( isDriverATICatalyst ) {
- final VersionNumber winXPVersionNumber = new VersionNumber ( 5, 1, 0);
- final VersionNumber amdSafeMobilityVersion = new VersionNumber(12, 102, 3);
-
+ final VersionNumber winXPVersionNumber = new VersionNumber ( 5, 1, 0);
+ final VersionNumber amdSafeMobilityVersion = new VersionNumber(12, 102, 3);
+
if ( vendorVersion.compareTo(amdSafeMobilityVersion) < 0 ) { // includes: vendorVersion.isZero()
final int quirk = GLRendererQuirks.NeedCurrCtx4ARBCreateContext;
if(DEBUG) {
System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType()+", [Vendor "+glVendor+" or Renderer "+glRenderer+"], driverVersion "+vendorVersion);
}
- quirks[i++] = quirk;
+ quirks[i++] = quirk;
}
-
+
if( Platform.getOSVersionNumber().compareTo(winXPVersionNumber) <= 0 ) {
final int quirk = GLRendererQuirks.NeedCurrCtx4ARBPixFmtQueries;
if(DEBUG) {
System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS-Version "+Platform.getOSType()+" "+Platform.getOSVersionNumber()+", [Vendor "+glVendor+" or Renderer "+glRenderer+"]");
}
- quirks[i++] = quirk;
+ quirks[i++] = quirk;
}
}
- } else if( Platform.OSType.ANDROID == Platform.getOSType() ) {
+ } else if( Platform.OSType.ANDROID == Platform.getOSType() ) {
//
// ANDROID
//
@@ -1654,12 +1733,19 @@ public abstract class GLContextImpl extends GLContext {
}
quirks[i++] = quirk;
}
+ if( glRenderer.contains("Immersion.16") ) {
+ final int quirk = GLRendererQuirks.GLSharedContextBuggy;
+ if(DEBUG) {
+ System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType() + " / Renderer " + glRenderer);
+ }
+ quirks[i++] = quirk;
+ }
}
-
+
//
// Windowing Toolkit related quirks
//
- if( NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true) ) {
+ if( isX11 ) {
//
// X11
//
@@ -1692,12 +1778,14 @@ public abstract class GLContextImpl extends GLContext {
}
}
}
-
-
+
+
//
// RENDERER related quirks
//
if( isDriverMesa ) {
+ final VersionNumber mesaIntelBuggySharedCtx921 = new VersionNumber(9, 2, 1);
+
{
final int quirk = GLRendererQuirks.NoSetSwapIntervalPostRetarget;
if(DEBUG) {
@@ -1721,10 +1809,17 @@ public abstract class GLContextImpl extends GLContext {
}
quirks[i++] = quirk;
}
- if( Platform.getOSType() == Platform.OSType.WINDOWS && glRenderer.contains("SVGA3D") )
- {
- final VersionNumber mesaSafeFBOVersion = new VersionNumber(8, 0, 0);
- if ( vendorVersion.compareTo(mesaSafeFBOVersion) < 0 ) { // includes: vendorVersion.isZero()
+ if( glRenderer.contains( MesaRendererIntelsp ) &&
+ vendorVersion.compareTo(mesaIntelBuggySharedCtx921) >= 0 && isX11 ) {
+ final int quirk = GLRendererQuirks.GLSharedContextBuggy;
+ if(DEBUG) {
+ System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: X11 / Renderer " + glRenderer + " / Mesa-Version "+vendorVersion);
+ }
+ quirks[i++] = quirk;
+ }
+ if( isWindows && glRenderer.contains("SVGA3D") ) {
+ final VersionNumber mesaSafeFBOVersion = new VersionNumber(8, 0, 0);
+ if ( vendorVersion.compareTo(mesaSafeFBOVersion) < 0 ) { // includes: vendorVersion.isZero()
final int quirk = GLRendererQuirks.NoFullFBOSupport;
if(DEBUG) {
System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType() + " / Renderer " + glRenderer + " / Mesa-Version "+vendorVersion);
@@ -1733,7 +1828,7 @@ public abstract class GLContextImpl extends GLContext {
}
}
}
-
+
//
// Property related quirks
//
@@ -1742,28 +1837,33 @@ public abstract class GLContextImpl extends GLContext {
if(DEBUG) {
System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: property");
}
- quirks[i++] = quirk;
+ quirks[i++] = quirk;
}
-
+
glRendererQuirks = new GLRendererQuirks(quirks, 0, i);
+ GLRendererQuirks.pushStickyDeviceQuirks(adevice, glRendererQuirks); // Thread safe due to single threaded initialization!
+ if(DEBUG) {
+ System.err.println("Quirks local: "+glRendererQuirks);
+ System.err.println("Quirks sticky on "+adevice+": "+GLRendererQuirks.getStickyDeviceQuirks(adevice));
+ }
}
-
+
private static final boolean hasFBOImpl(int major, int ctp, ExtensionAvailabilityCache extCache) {
return ( 0 != (ctp & CTX_PROFILE_ES) && major >= 2 ) || // ES >= 2.0
-
- major >= 3 || // any >= 3.0 GL ctx
-
+
+ major >= 3 || // any >= 3.0 GL ctx
+
( null != extCache &&
-
+
extCache.isExtensionAvailable(GLExtensions.ARB_ES2_compatibility) || // ES 2.0 compatible
-
+
extCache.isExtensionAvailable(GLExtensions.ARB_framebuffer_object) || // ARB_framebuffer_object
-
+
extCache.isExtensionAvailable(GLExtensions.EXT_framebuffer_object) || // EXT_framebuffer_object
-
- extCache.isExtensionAvailable(GLExtensions.OES_framebuffer_object) ) ; // OES_framebuffer_object excluded
+
+ extCache.isExtensionAvailable(GLExtensions.OES_framebuffer_object) ) ; // OES_framebuffer_object excluded
}
-
+
private final void removeCachedVersion(int major, int minor, int ctxProfileBits) {
if(!isCurrentContextHardwareRasterizer()) {
ctxProfileBits |= GLContext.CTX_IMPL_ACCEL_SOFT;
@@ -1799,7 +1899,7 @@ public abstract class GLContextImpl extends GLContext {
if(!drawable.getChosenGLCapabilities().getHardwareAccelerated()) {
isHardwareRasterizer = false;
} else {
- isHardwareRasterizer = ! ( glRendererLowerCase.contains("software") /* Mesa3D */ ||
+ isHardwareRasterizer = ! ( glRendererLowerCase.contains("software") /* Mesa3D, Apple */ ||
glRendererLowerCase.contains("mesa x11") /* Mesa3D */ ||
glRendererLowerCase.contains("softpipe") /* Gallium */ ||
glRendererLowerCase.contains("llvmpipe") /* Gallium */
@@ -1920,28 +2020,32 @@ public abstract class GLContextImpl extends GLContext {
evalPixelDataType();
return pixelDataFormat;
}
-
+
private final void evalPixelDataType() {
if(!pixelDataEvaluated) {
synchronized(this) {
if(!pixelDataEvaluated) {
+ boolean ok = false;
/* if(isGL2GL3() && 3 == components) {
pixelDataInternalFormat=GL.GL_RGB;
pixelDataFormat=GL.GL_RGB;
- pixelDataType = GL.GL_UNSIGNED_BYTE;
- } else */ if(isGLES2Compatible() || isExtensionAvailable(GLExtensions.OES_read_format)) {
+ pixelDataType = GL.GL_UNSIGNED_BYTE;
+ ok = true;
+ } else */ if( isGLES2Compatible() || isExtensionAvailable(GLExtensions.OES_read_format) ) {
final int[] glImplColorReadVals = new int[] { 0, 0 };
gl.glGetIntegerv(GL.GL_IMPLEMENTATION_COLOR_READ_FORMAT, glImplColorReadVals, 0);
- gl.glGetIntegerv(GL.GL_IMPLEMENTATION_COLOR_READ_TYPE, glImplColorReadVals, 1);
+ gl.glGetIntegerv(GL.GL_IMPLEMENTATION_COLOR_READ_TYPE, glImplColorReadVals, 1);
// pixelDataInternalFormat = (4 == components) ? GL.GL_RGBA : GL.GL_RGB;
pixelDataFormat = glImplColorReadVals[0];
pixelDataType = glImplColorReadVals[1];
- } else {
- // RGBA read is safe for all GL profiles
+ ok = 0 != pixelDataFormat && 0 != pixelDataType;
+ }
+ if( !ok ) {
+ // RGBA read is safe for all GL profiles
// pixelDataInternalFormat = (4 == components) ? GL.GL_RGBA : GL.GL_RGB;
pixelDataFormat=GL.GL_RGBA;
pixelDataType = GL.GL_UNSIGNED_BYTE;
- }
+ }
// TODO: Consider:
// return gl.isGL2GL3()?GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1;
pixelDataEvaluated = true;
@@ -1968,54 +2072,54 @@ public abstract class GLContextImpl extends GLContext {
public final GLStateTracker getGLStateTracker() {
return glStateTracker;
}
-
+
//---------------------------------------------------------------------------
// Helpers for context optimization where the last context is left
// current on the OpenGL worker thread
//
- /**
+ /**
* Returns true if the given thread is owner, otherwise false.
* <p>
* Method exists merely for code validation of {@link #isCurrent()}.
- * </p>
+ * </p>
*/
public final boolean isOwner(Thread thread) {
return lock.isOwner(thread);
}
-
- /**
+
+ /**
* Returns true if there are other threads waiting for this GLContext to {@link #makeCurrent()}, otherwise false.
* <p>
* Since method does not perform any synchronization, accurate result are returned if lock is hold - only.
- * </p>
+ * </p>
*/
public final boolean hasWaiters() {
return lock.getQueueLength()>0;
}
-
- /**
+
+ /**
* Returns the number of hold locks. See {@link RecursiveLock#getHoldCount()} for semantics.
* <p>
* Since method does not perform any synchronization, accurate result are returned if lock is hold - only.
- * </p>
+ * </p>
*/
public final int getLockCount() {
return lock.getHoldCount();
}
-
+
//---------------------------------------------------------------------------
// Special FBO hook
//
-
+
/**
* Tracks {@link GL#GL_FRAMEBUFFER}, {@link GL2GL3#GL_DRAW_FRAMEBUFFER} and {@link GL2GL3#GL_READ_FRAMEBUFFER}
* to be returned via {@link #getBoundFramebuffer(int)}.
- *
+ *
* <p>Invoked by {@link GL#glBindFramebuffer(int, int)}. </p>
- *
- * <p>Assumes valid <code>framebufferName</code> range of [0..{@link Integer#MAX_VALUE}]</p>
- *
+ *
+ * <p>Assumes valid <code>framebufferName</code> range of [0..{@link Integer#MAX_VALUE}]</p>
+ *
* <p>Does not throw an exception if <code>target</code> is unknown or <code>framebufferName</code> invalid.</p>
*/
public final void setBoundFramebuffer(int target, int framebufferName) {
@@ -2048,14 +2152,14 @@ public abstract class GLContextImpl extends GLContext {
throw new InternalError("Invalid FBO target name: "+toHexString(target));
}
}
-
+
@Override
- public final int getDefaultDrawFramebuffer() { return drawable.getDefaultDrawFramebuffer(); }
+ public final int getDefaultDrawFramebuffer() { return drawable.getDefaultDrawFramebuffer(); }
@Override
- public final int getDefaultReadFramebuffer() { return drawable.getDefaultReadFramebuffer(); }
+ public final int getDefaultReadFramebuffer() { return drawable.getDefaultReadFramebuffer(); }
@Override
public final int getDefaultReadBuffer() { return drawable.getDefaultReadBuffer(gl); }
-
+
//---------------------------------------------------------------------------
// GL_ARB_debug_output, GL_AMD_debug_output helpers
//
@@ -2074,7 +2178,7 @@ public abstract class GLContextImpl extends GLContext {
public final int getContextCreationFlags() {
return additionalCtxCreationFlags;
}
-
+
@Override
public final void setContextCreationFlags(int flags) {
if(!isCreated()) {
@@ -2144,7 +2248,7 @@ public abstract class GLContextImpl extends GLContext {
/** Internal bootstraping glGetString(GL_RENDERER) */
private static native String glGetStringInt(int name, long procAddress);
-
+
/** Internal bootstraping glGetIntegerv(..) for version */
private static native void glGetIntegervInt(int pname, int[] params, int params_offset, long procAddress);
}
diff --git a/src/jogl/classes/jogamp/opengl/GLContextShareSet.java b/src/jogl/classes/jogamp/opengl/GLContextShareSet.java
index b7acc0d..483767b 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextShareSet.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextShareSet.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2011 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
@@ -29,18 +29,19 @@
* 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;
-import java.util.HashMap;
+import java.util.ArrayList;
+import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -55,39 +56,39 @@ import javax.media.opengl.GLException;
public class GLContextShareSet {
private static final boolean DEBUG = GLContextImpl.DEBUG;
-
+
// This class is implemented using a HashMap which maps from all shared contexts
// to a share set, containing all shared contexts itself.
- private static final Map<GLContext, ShareSet> shareMap = new HashMap<GLContext, ShareSet>();
+ private static final Map<GLContext, ShareSet> shareMap = new IdentityHashMap<GLContext, ShareSet>();
private static final Object dummyValue = new Object();
private static class ShareSet {
- private Map<GLContext, Object> allShares = new HashMap<GLContext, Object>();
- private Map<GLContext, Object> createdShares = new HashMap<GLContext, Object>();
- private Map<GLContext, Object> destroyedShares = new HashMap<GLContext, Object>();
+ private final Map<GLContext, Object> allShares = new IdentityHashMap<GLContext, Object>();
+ private final Map<GLContext, Object> createdShares = new IdentityHashMap<GLContext, Object>();
+ private final Map<GLContext, Object> destroyedShares = new IdentityHashMap<GLContext, Object>();
- public void add(GLContext ctx) {
+ public void add(final GLContext ctx) {
if (allShares.put(ctx, dummyValue) == null) {
if (ctx.isCreated()) {
createdShares.put(ctx, dummyValue);
} else {
destroyedShares.put(ctx, dummyValue);
}
- }
+ }
}
public Set<GLContext> getCreatedShares() {
return createdShares.keySet();
}
-
+
public Set<GLContext> getDestroyedShares() {
return destroyedShares.keySet();
}
-
- public GLContext getCreatedShare(GLContext ignore) {
- for (Iterator<GLContext> iter = createdShares.keySet().iterator(); iter.hasNext(); ) {
- GLContext ctx = iter.next();
+
+ public GLContext getCreatedShare(final GLContext ignore) {
+ for (final Iterator<GLContext> iter = createdShares.keySet().iterator(); iter.hasNext(); ) {
+ final GLContext ctx = iter.next();
if (ctx != ignore) {
return ctx;
}
@@ -95,21 +96,21 @@ public class GLContextShareSet {
return null;
}
- public void contextCreated(GLContext ctx) {
- Object res = destroyedShares.remove(ctx);
+ public void contextCreated(final GLContext ctx) {
+ final Object res = destroyedShares.remove(ctx);
assert res != null : "State of ShareSet corrupted; thought context " +
ctx + " should have been in destroyed set but wasn't";
- res = createdShares.put(ctx, dummyValue);
- assert res == null : "State of ShareSet corrupted; thought context " +
+ final Object res2 = createdShares.put(ctx, dummyValue);
+ assert res2 == null : "State of ShareSet corrupted; thought context " +
ctx + " shouldn't have been in created set but was";
}
- public void contextDestroyed(GLContext ctx) {
- Object res = createdShares.remove(ctx);
+ public void contextDestroyed(final GLContext ctx) {
+ final Object res = createdShares.remove(ctx);
assert res != null : "State of ShareSet corrupted; thought context " +
ctx + " should have been in created set but wasn't";
- res = destroyedShares.put(ctx, dummyValue);
- assert res == null : "State of ShareSet corrupted; thought context " +
+ final Object res2 = destroyedShares.put(ctx, dummyValue);
+ assert res2 == null : "State of ShareSet corrupted; thought context " +
ctx + " shouldn't have been in destroyed set but was";
}
}
@@ -117,7 +118,7 @@ public class GLContextShareSet {
/** Indicate that contexts <code>share1</code> and
<code>share2</code> will share textures and display lists. Both
must be non-null. */
- public static synchronized void registerSharing(GLContext share1, GLContext share2) {
+ public static synchronized void registerSharing(final GLContext share1, final GLContext share2) {
if (share1 == null || share2 == null) {
throw new IllegalArgumentException("Both share1 and share2 must be non-null");
}
@@ -133,12 +134,12 @@ public class GLContextShareSet {
addEntry(share1, share);
addEntry(share2, share);
if (DEBUG) {
- System.err.println("GLContextShareSet: registereSharing: 1: " +
+ System.err.println("GLContextShareSet: registereSharing: 1: " +
toHexString(share1.getHandle()) + ", 2: " + toHexString(share2.getHandle()));
- }
+ }
}
- public static synchronized void unregisterSharing(GLContext lastContext) {
+ public static synchronized void unregisterSharing(final GLContext lastContext) {
if (lastContext == null) {
throw new IllegalArgumentException("Last context is null");
}
@@ -155,9 +156,9 @@ public class GLContextShareSet {
throw new GLException("Last context's share set contains no destroyed context");
}
if (DEBUG) {
- System.err.println("GLContextShareSet: unregisterSharing: " +
+ System.err.println("GLContextShareSet: unregisterSharing: " +
toHexString(lastContext.getHandle())+", entries: "+s.size());
- }
+ }
for(Iterator<GLContext> iter = s.iterator() ; iter.hasNext() ; ) {
GLContext ctx = iter.next();
if(null == removeEntry(ctx)) {
@@ -165,61 +166,85 @@ public class GLContextShareSet {
}
}
}
-
- private static synchronized Set<GLContext> getCreatedSharedImpl(GLContext context) {
+
+ /** Returns true if the given GLContext is shared, otherwise false. */
+ public static synchronized boolean isShared(final GLContext context) {
if (context == null) {
throw new IllegalArgumentException("context is null");
}
final ShareSet share = entryFor(context);
- if (share != null) {
- return share.getCreatedShares();
+ return share != null;
+ }
+
+ /** Returns one created GLContext shared with the given <code>context</code>, otherwise return <code>null</code>. */
+ public static synchronized GLContext getCreatedShare(final GLContext context) {
+ final ShareSet share = entryFor(context);
+ if (share == null) {
+ return null;
}
- return null;
+ return share.getCreatedShare(context);
}
-
- public static synchronized boolean isShared(GLContext context) {
+
+ private static synchronized Set<GLContext> getCreatedSharesImpl(final GLContext context) {
if (context == null) {
throw new IllegalArgumentException("context is null");
}
final ShareSet share = entryFor(context);
- return share != null;
- }
-
- public static synchronized boolean hasCreatedSharedLeft(GLContext context) {
- final Set<GLContext> s = getCreatedSharedImpl(context);
- return null != s && s.size()>0 ;
- }
-
- /** currently not used ..
- public static synchronized Set<GLContext> getCreatedShared(GLContext context) {
- final Set<GLContext> s = getCreatedSharedImpl(context);
- if (s == null) {
- throw new GLException("context is unknown: "+context);
+ if (share != null) {
+ return share.getCreatedShares();
}
- return s;
+ return null;
}
-
- public static synchronized Set<GLContext> getDestroyedShared(GLContext context) {
+ private static synchronized Set<GLContext> getDestroyedSharesImpl(final GLContext context) {
if (context == null) {
throw new IllegalArgumentException("context is null");
}
- ShareSet share = entryFor(context);
- if (share == null) {
- throw new GLException("context is unknown: "+context);
- }
- return share.getDestroyedShares();
- } */
-
- public static synchronized GLContext getShareContext(GLContext contextToCreate) {
- ShareSet share = entryFor(contextToCreate);
- if (share == null) {
- return null;
+ final ShareSet share = entryFor(context);
+ if (share != null) {
+ return share.getDestroyedShares();
}
- return share.getCreatedShare(contextToCreate);
+ return null;
}
- public static synchronized boolean contextCreated(GLContext context) {
- ShareSet share = entryFor(context);
+ /** Returns true if the given GLContext has shared and created GLContext left including itself, otherwise false. */
+ public static synchronized boolean hasCreatedSharedLeft(GLContext context) {
+ final Set<GLContext> s = getCreatedSharesImpl(context);
+ return null != s && s.size() > 0;
+ }
+
+ /** Returns a new array-list of created GLContext shared with the given GLContext. */
+ public static synchronized ArrayList<GLContext> getCreatedShares(final GLContext context) {
+ final ArrayList<GLContext> otherShares = new ArrayList<GLContext>();
+ final Set<GLContext> createdShares = getCreatedSharesImpl(context);
+ if( null != createdShares ) {
+ for (final Iterator<GLContext> iter = createdShares.iterator(); iter.hasNext(); ) {
+ final GLContext ctx = iter.next();
+ if (ctx != context) {
+ otherShares.add(ctx);
+ }
+ }
+ }
+ return otherShares;
+ }
+
+ /** Returns a new array-list of destroyed GLContext shared with the given GLContext. */
+ public static synchronized ArrayList<GLContext> getDestroyedShares(final GLContext context) {
+ final ArrayList<GLContext> otherShares = new ArrayList<GLContext>();
+ final Set<GLContext> destroyedShares = getDestroyedSharesImpl(context);
+ if( null != destroyedShares ) {
+ for (final Iterator<GLContext> iter = destroyedShares.iterator(); iter.hasNext(); ) {
+ final GLContext ctx = iter.next();
+ if (ctx != context) {
+ otherShares.add(ctx);
+ }
+ }
+ }
+ return otherShares;
+ }
+
+ /** Mark the given GLContext as being created. */
+ public static synchronized boolean contextCreated(final GLContext context) {
+ final ShareSet share = entryFor(context);
if (share != null) {
share.contextCreated(context);
return true;
@@ -227,8 +252,9 @@ public class GLContextShareSet {
return false;
}
- public static synchronized boolean contextDestroyed(GLContext context) {
- ShareSet share = entryFor(context);
+ /** Mark the given GLContext as being destroyed. */
+ public static synchronized boolean contextDestroyed(final GLContext context) {
+ final ShareSet share = entryFor(context);
if (share != null) {
share.contextDestroyed(context);
return true;
@@ -245,9 +271,9 @@ public class GLContextShareSet {
currently only needed in a fairly esoteric case, when the
Java2D/JOGL bridge is active, but the GLBufferSizeTracker
mechanism is now always required.) */
- public static void synchronizeBufferObjectSharing(GLContext olderContextOrNull, GLContext newContext) {
- GLContextImpl older = (GLContextImpl) olderContextOrNull;
- GLContextImpl newer = (GLContextImpl) newContext;
+ public static void synchronizeBufferObjectSharing(final GLContext olderContextOrNull, final GLContext newContext) {
+ final GLContextImpl older = (GLContextImpl) olderContextOrNull;
+ final GLContextImpl newer = (GLContextImpl) newContext;
GLBufferSizeTracker tracker = null;
if (older != null) {
tracker = older.getBufferSizeTracker();
@@ -262,22 +288,22 @@ public class GLContextShareSet {
//----------------------------------------------------------------------
// Internals only below this point
-
- private static ShareSet entryFor(GLContext context) {
- return (ShareSet) shareMap.get(context);
+
+ private static ShareSet entryFor(final GLContext context) {
+ return shareMap.get(context);
}
- private static void addEntry(GLContext context, ShareSet share) {
+ private static void addEntry(final GLContext context, final ShareSet share) {
if (shareMap.get(context) == null) {
shareMap.put(context, share);
}
}
- private static ShareSet removeEntry(GLContext context) {
- return (ShareSet) shareMap.remove(context);
+ private static ShareSet removeEntry(final GLContext context) {
+ return shareMap.remove(context);
}
-
- protected static String toHexString(long hex) {
+
+ private static String toHexString(long hex) {
return "0x" + Long.toHexString(hex);
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java
index 9ecaca7..2c94769 100644
--- a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java
+++ b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java
@@ -44,57 +44,57 @@ import com.jogamp.opengl.GLExtensions;
/**
* The GLDebugMessageHandler, handling <i>GL_ARB_debug_output</i> or <i>GL_AMD_debug_output</i>
* debug messages.<br>
- *
+ *
* <p>An instance must be bound to the current thread's GLContext to achieve thread safety.</p>
- *
- * <p>A native callback function is registered at {@link #enable(boolean) enable(true)},
- * which forwards received messages to the added {@link GLDebugListener} directly.
+ *
+ * <p>A native callback function is registered at {@link #enable(boolean) enable(true)},
+ * which forwards received messages to the added {@link GLDebugListener} directly.
* Hence the {@link GLDebugListener#messageSent(GLDebugMessage)} implementation shall
* 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>
*/
public class GLDebugMessageHandler {
private static final boolean DEBUG = Debug.debug("GLDebugMessageHandler");
-
+
private static final int EXT_ARB = 1;
- private static final int EXT_AMD = 2;
-
+ private static final int EXT_AMD = 2;
+
static {
if ( !initIDs0() ) {
throw new NativeWindowException("Failed to initialize GLDebugMessageHandler jmethodIDs");
- }
+ }
}
-
- private final GLContextImpl ctx;
+
+ private final GLContextImpl ctx;
private final ListenerSyncedImplStub<GLDebugListener> listenerImpl;
-
+
// licefycle: init - EOL
private String extName;
private int extType;
private long glDebugMessageCallbackProcAddress;
- private boolean extAvailable;
+ private boolean extAvailable;
private boolean synchronous;
-
+
// licefycle: enable - disable/EOL
private long handle;
-
+
/**
* @param ctx the associated GLContext
* @param glDebugExtension chosen extension to use
*/
- public GLDebugMessageHandler(GLContextImpl ctx) {
+ public GLDebugMessageHandler(GLContextImpl ctx) {
this.ctx = ctx;
- this.listenerImpl = new ListenerSyncedImplStub<GLDebugListener>();
+ this.listenerImpl = new ListenerSyncedImplStub<GLDebugListener>();
this.glDebugMessageCallbackProcAddress = 0;
this.extName = null;
this.extType = 0;
- this.extAvailable = false;
+ this.extAvailable = false;
this.handle = 0;
this.synchronous = true;
}
-
+
public void init(boolean enable) {
if(DEBUG) {
System.err.println("GLDebugMessageHandler.init("+enable+")");
@@ -106,13 +106,14 @@ public class GLDebugMessageHandler {
System.err.println("GLDebugMessageHandler.init("+enable+") .. n/a");
}
}
-
+
private final long getAddressFor(final ProcAddressTable table, final String functionName) {
return AccessController.doPrivileged(new PrivilegedAction<Long>() {
+ @Override
public Long run() {
try {
return Long.valueOf( table.getAddressFor(functionName) );
- } catch (IllegalArgumentException iae) {
+ } catch (IllegalArgumentException iae) {
return Long.valueOf(0);
}
}
@@ -124,12 +125,12 @@ public class GLDebugMessageHandler {
if( isAvailable()) {
return;
}
-
+
if( !ctx.isGLDebugEnabled() ) {
if(DEBUG) {
System.err.println("GLDebugMessageHandler: GL DEBUG not set in ARB ctx options: "+ctx.getGLVersion());
}
- return;
+ return;
}
if(Platform.OS_TYPE == Platform.OSType.WINDOWS && Platform.is32Bit()) {
// Currently buggy, ie. throws an exception after leaving the native callback.
@@ -149,93 +150,93 @@ public class GLDebugMessageHandler {
if(DEBUG) {
System.err.println("GLDebugMessageHandler: Using extension: <"+extName+">");
}
-
+
if(0 == extType) {
if(DEBUG) {
System.err.println("GLDebugMessageHandler: No extension available! "+ctx.getGLVersion());
System.err.println("GL_EXTENSIONS "+ctx.getGLExtensionCount());
- System.err.println(ctx.getGLExtensionsString());
+ System.err.println(ctx.getGLExtensionsString());
}
return;
}
-
+
final ProcAddressTable procAddressTable = ctx.getGLProcAddressTable();
if( !ctx.isGLES1() && !ctx.isGLES2() ) {
switch(extType) {
- case EXT_ARB:
+ case EXT_ARB:
glDebugMessageCallbackProcAddress = getAddressFor(procAddressTable, "glDebugMessageCallbackARB");
break;
- case EXT_AMD:
+ case EXT_AMD:
glDebugMessageCallbackProcAddress = getAddressFor(procAddressTable, "glDebugMessageCallbackAMD");
break;
}
} else {
glDebugMessageCallbackProcAddress = 0;
if(DEBUG) {
- System.err.println("Non desktop context not supported");
- }
+ System.err.println("Non desktop context not supported");
+ }
}
extAvailable = 0 < extType && null != extName && 0 != glDebugMessageCallbackProcAddress;
-
+
if(DEBUG) {
System.err.println("GLDebugMessageHandler: extAvailable: "+extAvailable+", glDebugMessageCallback* : 0x"+Long.toHexString(glDebugMessageCallbackProcAddress));
}
-
+
if(!extAvailable) {
glDebugMessageCallbackProcAddress = 0;
}
-
+
handle = 0;
}
public final boolean isAvailable() { return extAvailable; }
-
+
/**
- * @return The extension implementing the GLDebugMessage feature,
- * either {@link #GL_ARB_debug_output} or {@link #GL_AMD_debug_output}.
- * If unavailable <i>null</i> is returned.
+ * @return The extension implementing the GLDebugMessage feature,
+ * either {@link #GL_ARB_debug_output} or {@link #GL_AMD_debug_output}.
+ * If unavailable <i>null</i> is returned.
*/
public final String getExtension() {
return extName;
}
-
+
public final boolean isExtensionARB() {
return extName == GLExtensions.ARB_debug_output;
}
-
+
public final boolean isExtensionAMD() {
return extName == GLExtensions.AMD_debug_output;
}
-
+
/**
- * @see javax.media.opengl.GLContext#isGLDebugSynchronous()
+ * @see javax.media.opengl.GLContext#isGLDebugSynchronous()
*/
public final boolean isSynchronous() { return synchronous; }
-
+
/**
- * @see javax.media.opengl.GLContext#setGLDebugSynchronous(boolean)
+ * @see javax.media.opengl.GLContext#setGLDebugSynchronous(boolean)
*/
public final void setSynchronous(boolean synchronous) {
this.synchronous = synchronous;
if( isEnabled() ) {
setSynchronousImpl();
}
- }
+ }
private final void setSynchronousImpl() {
if(isExtensionARB()) {
if(synchronous) {
ctx.getGL().glEnable(GL2GL3.GL_DEBUG_OUTPUT_SYNCHRONOUS);
} else {
ctx.getGL().glDisable(GL2GL3.GL_DEBUG_OUTPUT_SYNCHRONOUS);
- }
+ }
if(DEBUG) {
System.err.println("GLDebugMessageHandler: synchronous "+synchronous);
}
}
}
-
+
/**
- * @see javax.media.opengl.GLContext#enableGLDebugMessage(boolean)
+ * @see javax.media.opengl.GLContext#enableGLDebugMessage(boolean)
*/
public final void enable(boolean enable) throws GLException {
ctx.validateCurrent();
@@ -243,7 +244,7 @@ public class GLDebugMessageHandler {
return;
}
enableImpl(enable);
- }
+ }
final void enableImpl(boolean enable) throws GLException {
if(enable) {
if(0 == handle) {
@@ -257,19 +258,19 @@ public class GLDebugMessageHandler {
if(0 != handle) {
unregister0(glDebugMessageCallbackProcAddress, handle);
handle = 0;
- }
+ }
}
if(DEBUG) {
System.err.println("GLDebugMessageHandler: enable("+enable+") -> 0x" + Long.toHexString(handle));
}
}
-
+
public final boolean isEnabled() { return 0 != handle; }
- public final int listenerSize() {
- return listenerImpl.size();
+ public final int listenerSize() {
+ return listenerImpl.size();
}
-
+
public final void addListener(GLDebugListener listener) {
listenerImpl.addListener(-1, listener);
}
@@ -277,11 +278,11 @@ public class GLDebugMessageHandler {
public final void addListener(int index, GLDebugListener listener) {
listenerImpl.addListener(index, listener);
}
-
+
public final void removeListener(GLDebugListener listener) {
listenerImpl.removeListener(listener);
}
-
+
private final void sendMessage(GLDebugMessage msg) {
synchronized(listenerImpl) {
if(DEBUG) {
@@ -293,25 +294,26 @@ public class GLDebugMessageHandler {
}
}
}
-
+
public static class StdErrGLDebugListener implements GLDebugListener {
boolean threadDump;
-
+
public StdErrGLDebugListener(boolean threadDump) {
this.threadDump = threadDump;
}
+ @Override
public void messageSent(GLDebugMessage event) {
System.err.println(event);
if(threadDump) {
Thread.dumpStack();
}
- }
+ }
}
-
+
//
// native -> java
//
-
+
protected final void glDebugMessageARB(int source, int type, int id, int severity, String msg) {
final GLDebugMessage event = new GLDebugMessage(ctx, System.currentTimeMillis(), source, type, id, severity, msg);
sendMessage(event);
@@ -321,11 +323,11 @@ public class GLDebugMessageHandler {
final GLDebugMessage event = GLDebugMessage.translateAMDEvent(ctx, System.currentTimeMillis(), id, category, severity, msg);
sendMessage(event);
}
-
+
//
// java -> native
- //
-
+ //
+
private static native boolean initIDs0();
private native long register0(long glDebugMessageCallbackProcAddress, int extType);
private native void unregister0(long glDebugMessageCallbackProcAddress, long handle);
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
index 41ea06d..cadf40f 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
@@ -49,6 +49,7 @@ 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;
@@ -64,6 +65,7 @@ import javax.media.opengl.GLProfile;
import com.jogamp.nativewindow.MutableGraphicsConfiguration;
import com.jogamp.nativewindow.DelegatedUpstreamSurfaceHookWithSurfaceSize;
import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize;
+import com.jogamp.opengl.GLAutoDrawableDelegate;
import com.jogamp.opengl.GLRendererQuirks;
@@ -95,14 +97,14 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
}
} catch (GLException gle) {
if(DEBUG) {
- System.err.println("Catched Exception on thread "+getThreadName());
+ System.err.println("Catched Exception on thread "+getThreadName());
gle.printStackTrace();
}
}
return null;
}
protected abstract SharedResourceRunner.Resource getOrCreateSharedResourceImpl(AbstractGraphicsDevice device);
-
+
/**
* Returns the shared context mapped to the <code>device</code> {@link AbstractGraphicsDevice#getConnection()},
* either a pre-existing or newly created, or <code>null</code> if creation failed or <b>not supported</b>.<br>
@@ -162,7 +164,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
// Dispatching GLDrawable construction in respect to the NativeSurface Capabilities
//
@Override
- public GLDrawable createGLDrawable(NativeSurface target) {
+ public final GLDrawable createGLDrawable(NativeSurface target) {
if (target == null) {
throw new IllegalArgumentException("Null target");
}
@@ -176,7 +178,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
final OffscreenLayerSurface ols = NativeWindowFactory.getOffscreenLayerSurface(target, true);
if(null != ols) {
final GLCapabilitiesImmutable chosenCapsMod = GLGraphicsConfigurationUtil.fixOffscreenGLCapabilities(chosenCaps, this, adevice);
-
+
// layered surface -> Offscreen/[FBO|PBuffer]
if( !chosenCapsMod.isFBO() && !chosenCapsMod.isPBuffer() ) {
throw new GLException("Neither FBO nor Pbuffer is available for "+chosenCapsMod+", "+target);
@@ -193,10 +195,10 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
}
if( ! ( target instanceof MutableSurface ) ) {
throw new IllegalArgumentException("Passed NativeSurface must implement SurfaceChangeable for offscreen layered surface: "+target);
- }
+ }
if( chosenCapsMod.isFBO() ) {
result = createFBODrawableImpl(target, chosenCapsMod, 0);
- } else {
+ } else {
result = createOffscreenDrawableImpl(target);
}
} else if(chosenCaps.isOnscreen()) {
@@ -217,7 +219,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
throw new IllegalArgumentException("Passed NativeSurface must implement MutableSurface for offscreen: "+target);
}
if( chosenCaps.isFBO() && isFBOAvailable ) {
- // need to hook-up a native dummy surface since source may not have & use minimum GLCapabilities for it w/ same profile
+ // need to hook-up a native dummy surface since source may not have & use minimum GLCapabilities for it w/ same profile
final ProxySurface dummySurface = createDummySurfaceImpl(adevice, false, new GLCapabilities(chosenCaps.getGLProfile()), (GLCapabilitiesImmutable)config.getRequestedCapabilities(), null, 64, 64);
dummySurface.setUpstreamSurfaceHook(new DelegatedUpstreamSurfaceHookWithSurfaceSize(dummySurface.getUpstreamSurfaceHook(), target));
result = createFBODrawableImpl(dummySurface, chosenCaps, 0);
@@ -245,12 +247,12 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
//
// PBuffer Offscreen GLAutoDrawable construction
//
-
+
@Override
public abstract boolean canCreateGLPbuffer(AbstractGraphicsDevice device, GLProfile glp);
@Override
- public GLPbuffer createGLPbuffer(AbstractGraphicsDevice deviceReq,
+ public final GLPbuffer createGLPbuffer(AbstractGraphicsDevice deviceReq,
GLCapabilitiesImmutable capsRequested,
GLCapabilitiesChooser chooser,
int width,
@@ -271,7 +273,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
GLDrawableImpl drawable = null;
device.lock();
try {
- drawable = createOffscreenDrawableImpl( createMutableSurfaceImpl(device, true, capsChosen, capsRequested, chooser,
+ drawable = createOffscreenDrawableImpl( createMutableSurfaceImpl(device, true, capsChosen, capsRequested, chooser,
new UpstreamSurfaceHookMutableSize(width, height) ) );
if(null != drawable) {
drawable.setRealized(true);
@@ -288,16 +290,17 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
// Offscreen GLDrawable construction
//
+ @Override
public final boolean canCreateFBO(AbstractGraphicsDevice deviceReq, GLProfile glp) {
AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq);
if(null == device) {
throw new GLException("No shared device for requested: "+deviceReq);
}
- return GLContext.isFBOAvailable(device, glp);
+ return GLContext.isFBOAvailable(device, glp);
}
-
+
@Override
- public GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice deviceReq,
+ public final GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice deviceReq,
GLCapabilitiesImmutable capsRequested,
GLCapabilitiesChooser chooser,
int width, int height,
@@ -310,9 +313,30 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
}
return new GLOffscreenAutoDrawableImpl( drawable, context, null, null);
}
-
+
+ @Override
+ public final GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice deviceReq,
+ GLCapabilitiesImmutable capsRequested,
+ GLCapabilitiesChooser chooser,
+ int width, int height) {
+ final GLDrawable drawable = createOffscreenDrawable( deviceReq, capsRequested, chooser, width, height );
+ drawable.setRealized(true);
+ if(drawable instanceof GLFBODrawableImpl) {
+ return new GLOffscreenAutoDrawableImpl.FBOImpl( (GLFBODrawableImpl)drawable, null, null, null );
+ }
+ return new GLOffscreenAutoDrawableImpl( drawable, null, null, null);
+ }
+
+ @Override
+ public final GLAutoDrawable createDummyAutoDrawable(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) {
+ final GLDrawable drawable = createDummyDrawable(deviceReq, createNewDevice, capsRequested, chooser);
+ drawable.setRealized(true);
+ final GLAutoDrawable sharedDrawable = new GLAutoDrawableDelegate(drawable, null, null, true /*ownDevice*/, null) { };
+ return sharedDrawable;
+ }
+
@Override
- public GLDrawable createOffscreenDrawable(AbstractGraphicsDevice deviceReq,
+ public final GLDrawable createOffscreenDrawable(AbstractGraphicsDevice deviceReq,
GLCapabilitiesImmutable capsRequested,
GLCapabilitiesChooser chooser,
int width, int height) {
@@ -323,31 +347,46 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
if(null == device) {
throw new GLException("No shared device for requested: "+deviceReq);
}
-
+
final GLCapabilitiesImmutable capsChosen = GLGraphicsConfigurationUtil.fixOffscreenGLCapabilities(capsRequested, this, device);
device.lock();
try {
if( capsChosen.isFBO() ) {
- // Use minimum GLCapabilities for the dummy surface w/ same profile
+ // 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);
- }
- return createOffscreenDrawableImpl( createMutableSurfaceImpl(device, true, capsChosen, capsRequested, chooser,
+ }
+ return createOffscreenDrawableImpl( createMutableSurfaceImpl(device, true, capsChosen, capsRequested, chooser,
new UpstreamSurfaceHookMutableSize(width, height) ) );
} finally {
device.unlock();
}
}
- /** Creates a platform independent unrealized FBO offscreen GLDrawable */
- protected GLFBODrawable createFBODrawableImpl(NativeSurface dummySurface, GLCapabilitiesImmutable fboCaps, int textureUnit) {
+ @Override
+ public final GLDrawable createDummyDrawable(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) {
+ final AbstractGraphicsDevice device = createNewDevice ? getOrCreateSharedDevice(deviceReq) : deviceReq;
+ if(null == device) {
+ throw new GLException("No shared device for requested: "+deviceReq+", createNewDevice "+createNewDevice);
+ }
+ device.lock();
+ try {
+ final ProxySurface dummySurface = createDummySurfaceImpl(device, createNewDevice, capsRequested, capsRequested, chooser, 64, 64);
+ return createOnscreenDrawableImpl(dummySurface);
+ } finally {
+ device.unlock();
+ }
+ }
+
+ /** Creates a platform independent unrealized FBO offscreen GLDrawable */
+ protected final GLFBODrawable createFBODrawableImpl(NativeSurface dummySurface, GLCapabilitiesImmutable fboCaps, int textureUnit) {
final GLDrawableImpl dummyDrawable = createOnscreenDrawableImpl(dummySurface);
return new GLFBODrawableImpl(this, dummyDrawable, dummySurface, fboCaps, textureUnit);
}
-
- /** Creates a platform dependent unrealized offscreen pbuffer/pixmap GLDrawable instance */
+
+ /** Creates a platform dependent unrealized offscreen pbuffer/pixmap GLDrawable instance */
protected abstract GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) ;
/**
@@ -364,10 +403,10 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
* @param capsChosen
* @param capsRequested
* @param chooser the custom chooser, may be null for default
- * @param upstreamHook surface size information and optional control of the surface's lifecycle
+ * @param upstreamHook surface size information and optional control of the surface's lifecycle
* @return the created {@link MutableSurface} instance w/o defined surface handle
*/
- protected abstract ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice device, boolean createNewDevice,
+ protected abstract ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice device, boolean createNewDevice,
GLCapabilitiesImmutable capsChosen,
GLCapabilitiesImmutable capsRequested,
GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook);
@@ -377,17 +416,19 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
* it maybe 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.
+ * 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 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 requestedCaps
* @param chooser the custom chooser, may be null for default
- * @param width the initial width
- * @param height the initial height
+ * @param width the initial width as returned by {@link NativeSurface#getWidth()}, not the actual dummy surface width.
+ * The latter is platform specific and small
+ * @param height the initial height as returned by {@link NativeSurface#getHeight()}, 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 ProxySurface createDummySurface(AbstractGraphicsDevice deviceReq, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser,
+ public final ProxySurface createDummySurface(AbstractGraphicsDevice deviceReq, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser,
int width, int height) {
final AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq);
if(null == device) {
@@ -400,13 +441,13 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
device.unlock();
}
}
-
+
/**
* A dummy surface is not visible on screen and will not be used to render directly to,
* it maybe 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.
+ * 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,
@@ -414,22 +455,22 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
* @param chosenCaps
* @param requestedCaps
* @param chooser the custom chooser, may be null for default
- * @param width the initial width as returned by {@link NativeSurface#getWidth()}, not the actual dummy surface width.
+ * @param width the initial width as returned by {@link NativeSurface#getWidth()}, not the actual dummy surface width.
* The latter is platform specific and small
* @param height the initial height as returned by {@link NativeSurface#getHeight()}, 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 createDummySurfaceImpl(AbstractGraphicsDevice device, boolean createNewDevice,
+ public abstract ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice device, boolean createNewDevice,
GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height);
//---------------------------------------------------------------------------
//
// ProxySurface (Wrapped pre-existing native surface) construction
//
-
+
@Override
- public ProxySurface createProxySurface(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle,
+ public ProxySurface createProxySurface(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle,
GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) {
final AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq);
if(null == device) {
@@ -454,7 +495,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
* </p>
* @param upstream TODO
*/
- protected abstract ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle,
+ protected abstract ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle,
GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream);
//---------------------------------------------------------------------------
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
index 5418fba..61735c4 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -48,6 +48,7 @@ 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;
@@ -63,12 +64,12 @@ import javax.media.opengl.GLRunnable;
public class GLDrawableHelper {
/** true if property <code>jogl.debug.GLDrawable.PerfStats</code> is defined. */
private static final boolean PERF_STATS;
-
+
static {
Debug.initSingleton();
PERF_STATS = Debug.isPropertyDefined("jogl.debug.GLDrawable.PerfStats", true);
}
-
+
protected static final boolean DEBUG = GLDrawableImpl.DEBUG;
private final Object listenersLock = new Object();
private final ArrayList<GLEventListener> listeners = new ArrayList<GLEventListener>();
@@ -80,7 +81,11 @@ public class GLDrawableHelper {
/** -1 release, 0 nop, 1 claim */
private volatile int exclusiveContextSwitch;
private GLAnimatorControl animatorCtrl;
- private static Runnable nop = new Runnable() { public void run() {} };
+ private static Runnable nop = new Runnable() { @Override public void run() {} };
+
+ private GLContext sharedContext;
+ private GLAutoDrawable sharedAutoDrawable;
+
public GLDrawableHelper() {
reset();
@@ -98,6 +103,60 @@ public class GLDrawableHelper {
glRunnables.clear();
}
animatorCtrl = null;
+ sharedContext = null;
+ sharedAutoDrawable = null;
+ }
+
+ public final void setSharedContext(GLContext thisContext, GLContext sharedContext) throws IllegalStateException {
+ if( null == sharedContext ) {
+ throw new IllegalStateException("Null shared GLContext");
+ }
+ if( thisContext == sharedContext ) {
+ throw new IllegalStateException("Shared GLContext same as local");
+ }
+ if( null != this.sharedContext ) {
+ throw new IllegalStateException("Shared GLContext already set");
+ }
+ if( null != this.sharedAutoDrawable ) {
+ throw new IllegalStateException("Shared GLAutoDrawable already set");
+ }
+ this.sharedContext = sharedContext;
+ }
+
+ public final void setSharedAutoDrawable(GLAutoDrawable thisAutoDrawable, GLAutoDrawable sharedAutoDrawable) throws IllegalStateException {
+ if( null == sharedAutoDrawable ) {
+ throw new IllegalStateException("Null shared GLAutoDrawable");
+ }
+ if( thisAutoDrawable == sharedAutoDrawable ) {
+ throw new IllegalStateException("Shared GLAutoDrawable same as this");
+ }
+ if( null != this.sharedContext ) {
+ throw new IllegalStateException("Shared GLContext already set");
+ }
+ if( null != this.sharedAutoDrawable ) {
+ throw new IllegalStateException("Shared GLAutoDrawable already set");
+ }
+ this.sharedAutoDrawable = sharedAutoDrawable;
+ }
+
+ /**
+ * @param shared returns the shared GLContext, based on set shared GLAutoDrawable
+ * or GLContext. Maybe null if none is set.
+ * @return true if initialization is pending due to a set shared GLAutoDrawable or GLContext
+ * which is not ready yet. Otherwise false.
+ */
+ public boolean isSharedGLContextPending(GLContext[] shared) {
+ final GLContext shareWith;
+ final boolean pending;
+ if ( null != sharedAutoDrawable ) {
+ shareWith = sharedAutoDrawable.getContext();
+ pending = null == shareWith || !shareWith.isCreated();
+ } else {
+ shareWith = sharedContext;
+ pending = null != shareWith && !shareWith.isCreated();
+ }
+ shared[0] = shareWith;
+ return pending;
}
@Override
@@ -120,7 +179,7 @@ public class GLDrawableHelper {
/** Limit release calls of {@link #forceNativeRelease(GLContext)} to {@value}. */
private static final int MAX_RELEASE_ITER = 512;
-
+
/**
* Since GLContext's {@link GLContext#makeCurrent()} and {@link GLContext#release()}
* is recursive, a call to {@link GLContext#release()} may not natively release the context.
@@ -138,36 +197,36 @@ public class GLDrawableHelper {
System.err.println("GLDrawableHelper.forceNativeRelease() #"+releaseCount+" -- currentThread "+Thread.currentThread()+" -> "+GLContext.getCurrent());
}
} while( MAX_RELEASE_ITER > releaseCount && ctx.isCurrent() );
-
+
if( ctx.isCurrent() ) {
throw new GLException("Context still current after "+MAX_RELEASE_ITER+" releases: "+ctx);
}
}
-
+
/**
* Switch {@link GLContext} / {@link GLDrawable} association.
* <p>
* The <code>oldCtx</code> will be destroyed if <code>destroyPrevCtx</code> is <code>true</code>,
- * otherwise dis-associate <code>oldCtx</code> from <code>drawable</code>
+ * otherwise dis-associate <code>oldCtx</code> from <code>drawable</code>
* via {@link GLContext#setGLDrawable(GLDrawable, boolean) oldCtx.setGLDrawable(null, true);}.
* </p>
* <p>
- * Re-associate <code>newCtx</code> with <code>drawable</code>
+ * Re-associate <code>newCtx</code> with <code>drawable</code>
* via {@link GLContext#setGLDrawable(GLDrawable, boolean) newCtx.setGLDrawable(drawable, true);}.
* </p>
- * <p>
+ * <p>
* If the old or new context was current on this thread, it is being released before switching the drawable.
* </p>
* <p>
* No locking is being performed on the drawable, caller is required to take care of it.
* </p>
- *
+ *
* @param drawable the drawable which context is changed
* @param oldCtx the old context, maybe <code>null</code>.
* @param destroyOldCtx if <code>true</code>, destroy the <code>oldCtx</code>
* @param newCtx the new context, maybe <code>null</code> for dis-association.
* @param newCtxCreationFlags additional creation flags if newCtx is not null and not been created yet, see {@link GLContext#setContextCreationFlags(int)}
- *
+ *
* @see GLAutoDrawable#setContext(GLContext, boolean)
*/
public static final void switchContext(GLDrawable drawable, GLContext oldCtx, boolean destroyOldCtx, GLContext newCtx, int newCtxCreationFlags) {
@@ -178,16 +237,16 @@ public class GLDrawableHelper {
oldCtx.setGLDrawable(null, true); // dis-associate old pair
}
}
-
+
if(null!=newCtx) {
newCtx.setContextCreationFlags(newCtxCreationFlags);
- newCtx.setGLDrawable(drawable, true); // re-associate new pair
+ newCtx.setGLDrawable(drawable, true); // re-associate new pair
}
}
-
+
/**
* If the drawable is not realized, OP is a NOP.
- * <ul>
+ * <ul>
* <li>release context if current</li>
* <li>destroy old drawable</li>
* <li>create new drawable</li>
@@ -197,12 +256,12 @@ public class GLDrawableHelper {
* <p>
* Locking is performed via {@link GLContext#makeCurrent()} on the passed <code>context</code>.
* </p>
- *
+ *
* @param drawable
* @param context maybe null
* @return the new drawable
*/
- public static final GLDrawableImpl recreateGLDrawable(GLDrawableImpl drawable, GLContext context) {
+ public static final GLDrawableImpl recreateGLDrawable(GLDrawableImpl drawable, GLContext context) {
if( ! drawable.isRealized() ) {
return drawable;
}
@@ -210,7 +269,7 @@ public class GLDrawableHelper {
final GLDrawableFactory factory = drawable.getFactory();
final NativeSurface surface = drawable.getNativeSurface();
final ProxySurface proxySurface = (surface instanceof ProxySurface) ? (ProxySurface)surface : null;
-
+
if( null != context ) {
// Ensure to sync GL command stream
if( currentContext != context ) {
@@ -219,7 +278,7 @@ public class GLDrawableHelper {
context.getGL().glFinish();
context.setGLDrawable(null, true); // dis-associate
}
-
+
if(null != proxySurface) {
proxySurface.enableUpstreamSurfaceHookLifecycle(false);
}
@@ -236,18 +295,18 @@ public class GLDrawableHelper {
if(null != context) {
context.setGLDrawable(drawable, true); // re-association
}
-
+
if( null != currentContext ) {
currentContext.makeCurrent();
}
return drawable;
}
-
+
/**
* Performs resize operation on the given drawable, assuming it is offscreen.
* <p>
* The {@link GLDrawableImpl}'s {@link NativeSurface} is being locked during operation.
- * In case the holder is an auto drawable or similar, it's lock shall be claimed by the caller.
+ * In case the holder is an auto drawable or similar, it's lock shall be claimed by the caller.
* </p>
* <p>
* May recreate the drawable via {@link #recreateGLDrawable(GLDrawableImpl, GLContext)}
@@ -257,10 +316,10 @@ public class GLDrawableHelper {
* FBO drawables are resized w/o drawable destruction.
* </p>
* <p>
- * Offscreen resize operation is validated w/ drawable size in the end.
+ * Offscreen resize operation is validated w/ drawable size in the end.
* An exception is thrown if not successful.
* </p>
- *
+ *
* @param drawable
* @param context
* @param newWidth the new width, it's minimum is capped to 1
@@ -270,7 +329,7 @@ public class GLDrawableHelper {
* @throws GLException may be thrown a resize operation
*/
public static final GLDrawableImpl resizeOffscreenDrawable(GLDrawableImpl drawable, GLContext context, int newWidth, int newHeight)
- throws NativeWindowException, GLException
+ throws NativeWindowException, GLException
{
if(drawable.getChosenGLCapabilities().isOnscreen()) {
throw new NativeWindowException("Drawable is not offscreen: "+drawable);
@@ -288,7 +347,7 @@ public class GLDrawableHelper {
}
if(0>=newWidth) { newWidth = 1; validateSize=false; }
if(0>=newHeight) { newHeight = 1; validateSize=false; }
- // propagate new size
+ // propagate new size
if(ns instanceof ProxySurface) {
final ProxySurface ps = (ProxySurface) ns;
final UpstreamSurfaceHook ush = ps.getUpstreamSurfaceHook();
@@ -301,7 +360,7 @@ public class GLDrawableHelper {
System.err.println("GLDrawableHelper.resizeOffscreenDrawable: Drawable's offscreen surface n.a. ProxySurface, but "+ns.getClass().getName()+": "+ns);
}
if(drawable instanceof GLFBODrawable) {
- if( null != context && context.isCreated() ) {
+ if( null != context && context.isCreated() ) {
((GLFBODrawable) drawable).resetSize(context.getGL());
}
} else {
@@ -315,7 +374,7 @@ public class GLDrawableHelper {
}
return drawable;
}
-
+
public final void addGLEventListener(GLEventListener listener) {
addGLEventListener(-1, listener);
}
@@ -328,14 +387,14 @@ public class GLDrawableHelper {
// GLEventListener may be added after context is created,
// hence we earmark initialization for the next display call.
listenersToBeInit.add(listener);
-
+
listeners.add(index, listener);
}
}
/**
* Note that no {@link GLEventListener#dispose(GLAutoDrawable)} call is being issued
- * due to the lack of a current context.
+ * due to the lack of a current context.
* Consider calling {@link #disposeGLEventListener(GLAutoDrawable, GLDrawable, GLContext, GLEventListener)}.
* @return the removed listener, or null if listener was not added
*/
@@ -356,11 +415,11 @@ public class GLDrawableHelper {
return listener;
}
}
-
+
public final int getGLEventListenerCount() {
synchronized(listenersLock) {
return listeners.size();
- }
+ }
}
public final GLEventListener getGLEventListener(int index) throws IndexOutOfBoundsException {
@@ -371,13 +430,13 @@ public class GLDrawableHelper {
return listeners.get(index);
}
}
-
+
public final boolean getGLEventListenerInitState(GLEventListener listener) {
synchronized(listenersLock) {
return !listenersToBeInit.contains(listener);
}
}
-
+
public final void setGLEventListenerInitState(GLEventListener listener, boolean initialized) {
synchronized(listenersLock) {
if(initialized) {
@@ -387,16 +446,16 @@ public class GLDrawableHelper {
}
}
}
-
+
/**
- * Disposes the given {@link GLEventListener} via {@link GLEventListener#dispose(GLAutoDrawable)}
+ * Disposes the given {@link GLEventListener} via {@link GLEventListener#dispose(GLAutoDrawable)}
* if it has been initialized and added to this queue.
* <p>
* If <code>remove</code> is <code>true</code>, the {@link GLEventListener} is removed from this drawable queue before disposal,
* otherwise marked uninitialized.
* </p>
* <p>
- * Please consider using {@link #disposeGLEventListener(GLAutoDrawable, GLDrawable, GLContext, GLEventListener)}
+ * Please consider using {@link #disposeGLEventListener(GLAutoDrawable, GLDrawable, GLContext, GLEventListener)}
* for correctness, i.e. encapsulating all calls w/ makeCurrent etc.
* </p>
* @param autoDrawable
@@ -405,9 +464,9 @@ public class GLDrawableHelper {
*/
public final GLEventListener disposeGLEventListener(GLAutoDrawable autoDrawable, GLEventListener listener, boolean remove) {
synchronized(listenersLock) {
- if( remove ) {
+ if( remove ) {
if( listeners.remove(listener) ) {
- if( !listenersToBeInit.remove(listener) ) {
+ if( !listenersToBeInit.remove(listener) ) {
listener.dispose(autoDrawable);
}
return listener;
@@ -417,12 +476,12 @@ public class GLDrawableHelper {
listener.dispose(autoDrawable);
listenersToBeInit.add(listener);
return listener;
- }
+ }
}
}
return null;
}
-
+
/**
* Disposes all added initialized {@link GLEventListener}s via {@link GLEventListener#dispose(GLAutoDrawable)}.
* <p>
@@ -456,20 +515,20 @@ public class GLDrawableHelper {
listenersToBeInit.add(listener);
disposeCount++;
}
- }
+ }
}
}
return disposeCount;
}
/**
- * Principal helper method which runs {@link #disposeGLEventListener(GLAutoDrawable, GLEventListener, boolean)}
+ * Principal helper method which runs {@link #disposeGLEventListener(GLAutoDrawable, GLEventListener, boolean)}
* with the context made current.
* <p>
- * If an {@link GLAnimatorControl} is being attached and the current thread is different
+ * If an {@link GLAnimatorControl} is being attached and the current thread is different
* than {@link GLAnimatorControl#getThread() the animator's thread}, it is paused during the operation.
* </p>
- *
+ *
* @param autoDrawable
* @param context
* @param listener
@@ -477,7 +536,7 @@ public class GLDrawableHelper {
*/
public final GLEventListener disposeGLEventListener(final GLAutoDrawable autoDrawable,
final GLDrawable drawable,
- final GLContext context,
+ final GLContext context,
final GLEventListener listener,
final boolean remove) {
synchronized(listenersLock) {
@@ -485,7 +544,7 @@ public class GLDrawableHelper {
if( listenersToBeInit.contains(listener) ) {
if( remove ) {
listenersToBeInit.remove(listener);
- return listeners.remove(listener) ? listener : null;
+ return listeners.remove(listener) ? listener : null;
}
return null;
}
@@ -493,26 +552,27 @@ public class GLDrawableHelper {
final boolean isPaused = isAnimatorAnimatingOnOtherThread() && animatorCtrl.pause();
final GLEventListener[] res = new GLEventListener[] { null };
final Runnable action = new Runnable() {
+ @Override
public void run() {
res[0] = disposeGLEventListener(autoDrawable, listener, remove);
}
};
invokeGL(drawable, context, action, nop);
-
+
if(isPaused) {
animatorCtrl.resume();
}
return res[0];
}
-
+
/**
- * Principal helper method which runs {@link #disposeAllGLEventListener(GLAutoDrawable, boolean)}
+ * Principal helper method which runs {@link #disposeAllGLEventListener(GLAutoDrawable, boolean)}
* with the context made current.
* <p>
- * If an {@link GLAnimatorControl} is being attached and the current thread is different
+ * If an {@link GLAnimatorControl} is being attached and the current thread is different
* than {@link GLAnimatorControl#getThread() the animator's thread}, it is paused during the operation.
* </p>
- *
+ *
* @param autoDrawable
* @param context
* @param remove
@@ -521,21 +581,22 @@ public class GLDrawableHelper {
final GLDrawable drawable,
final GLContext context,
final boolean remove) {
-
+
final boolean isPaused = isAnimatorAnimatingOnOtherThread() && animatorCtrl.pause();
-
+
final Runnable action = new Runnable() {
+ @Override
public void run() {
disposeAllGLEventListener(autoDrawable, remove);
}
};
invokeGL(drawable, context, action, nop);
-
+
if(isPaused) {
animatorCtrl.resume();
}
}
-
+
private final void init(GLEventListener l, GLAutoDrawable drawable, boolean sendReshape, boolean setViewport) {
l.init(drawable);
if(sendReshape) {
@@ -543,8 +604,8 @@ public class GLDrawableHelper {
}
}
- /**
- * The default init action to be called once after ctx is being created @ 1st makeCurrent().
+ /**
+ * The default init action to be called once after ctx is being created @ 1st makeCurrent().
* @param sendReshape set to true if the subsequent display call won't reshape, otherwise false to avoid double reshape.
**/
public final void init(GLAutoDrawable drawable, boolean sendReshape) {
@@ -554,7 +615,7 @@ public class GLDrawableHelper {
if( listenerCount > 0 ) {
for (int i=0; i < listenerCount; i++) {
final GLEventListener listener = _listeners.get(i) ;
-
+
// If make ctx current, invoked by invokGL(..), results in a new ctx, init gets called.
// This may happen not just for initial setup, but for ctx recreation due to resource change (drawable/window),
// hence it must be called unconditional, always.
@@ -571,7 +632,7 @@ public class GLDrawableHelper {
public final void display(GLAutoDrawable drawable) {
displayImpl(drawable);
if( glRunnables.size()>0 && !execGLRunnables(drawable) ) { // glRunnables volatile OK; execGL.. only executed if size > 0
- displayImpl(drawable);
+ displayImpl(drawable);
}
}
private final void displayImpl(GLAutoDrawable drawable) {
@@ -580,7 +641,7 @@ public class GLDrawableHelper {
final int listenerCount = _listeners.size();
for (int i=0; i < listenerCount; i++) {
final GLEventListener listener = _listeners.get(i) ;
- // GLEventListener may need to be init,
+ // GLEventListener may need to be init,
// in case this one is added after the realization of the GLAutoDrawable
if( listenersToBeInit.remove(listener) ) {
init( listener, drawable, true /* sendReshape */, listenersToBeInit.size() + 1 == listenerCount /* setViewport if 1st init */ );
@@ -589,11 +650,11 @@ public class GLDrawableHelper {
}
}
}
-
+
private final void reshape(GLEventListener listener, GLAutoDrawable drawable,
int x, int y, int width, int height, boolean setViewport, boolean checkInit) {
if(checkInit) {
- // GLEventListener may need to be init,
+ // GLEventListener may need to be init,
// in case this one is added after the realization of the GLAutoDrawable
synchronized(listenersLock) {
if( listenersToBeInit.remove(listener) ) {
@@ -602,6 +663,14 @@ public class GLDrawableHelper {
}
}
if(setViewport) {
+ final GL gl = drawable.getGL();
+ final int glerr0 = gl.glGetError();
+ if( GL.GL_NO_ERROR != glerr0 ) {
+ System.err.println("Info: GLDrawableHelper.reshape: pre-exisiting GL error 0x"+Integer.toHexString(glerr0));
+ if(DEBUG) {
+ Thread.dumpStack();
+ }
+ }
drawable.getGL().glViewport(x, y, width, height);
}
listener.reshape(drawable, x, y, width, height);
@@ -610,7 +679,7 @@ public class GLDrawableHelper {
public final void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
synchronized(listenersLock) {
for (int i=0; i < listeners.size(); i++) {
- reshape((GLEventListener) listeners.get(i), drawable, x, y, width, height, 0==i /* setViewport */, true /* checkInit */);
+ reshape(listeners.get(i), drawable, x, y, width, height, 0==i /* setViewport */, true /* checkInit */);
}
}
}
@@ -627,7 +696,7 @@ public class GLDrawableHelper {
_glRunnables = null;
}
}
-
+
if(null!=_glRunnables) {
for (int i=0; i < _glRunnables.size(); i++) {
res = _glRunnables.get(i).run(drawable) && res;
@@ -648,7 +717,7 @@ public class GLDrawableHelper {
_glRunnables = null;
}
}
-
+
if(null!=_glRunnables) {
for (int i=0; i < _glRunnables.size(); i++) {
_glRunnables.get(i).flush();
@@ -656,7 +725,7 @@ public class GLDrawableHelper {
}
}
}
-
+
public final void setAnimator(GLAnimatorControl animator) throws GLException {
synchronized(glRunnablesLock) {
if(animatorCtrl!=animator && null!=animator && null!=animatorCtrl) {
@@ -693,7 +762,7 @@ public class GLDrawableHelper {
* If <code>wait</code> is <code>true</code> the call blocks until the <code>glRunnable</code>
* has been executed.<p>
* <p>
- * If <code>wait</code> is <code>true</code> <b>and</b>
+ * If <code>wait</code> is <code>true</code> <b>and</b>
* {@link GLDrawable#isRealized()} returns <code>false</code> <i>or</i> {@link GLAutoDrawable#getContext()} returns <code>null</code>,
* the call is ignored and returns <code>false</code>.<br>
* This helps avoiding deadlocking the caller.
@@ -709,7 +778,7 @@ public class GLDrawableHelper {
wait && ( !drawable.isRealized() || null==drawable.getContext() ) ) {
return false;
}
-
+
GLRunnableTask rTask = null;
Object rTaskLock = new Object();
Throwable throwable = null;
@@ -743,13 +812,13 @@ public class GLDrawableHelper {
}
return true;
}
-
+
public final boolean invoke(GLAutoDrawable drawable, boolean wait, List<GLRunnable> newGLRunnables) {
if( null == newGLRunnables || newGLRunnables.size() == 0 || null == drawable ||
wait && ( !drawable.isRealized() || null==drawable.getContext() ) ) {
return false;
}
-
+
final int count = newGLRunnables.size();
GLRunnableTask rTask = null;
Object rTaskLock = new Object();
@@ -785,18 +854,18 @@ public class GLDrawableHelper {
}
}
}
- return true;
+ return true;
}
public final void enqueue(GLRunnable glRunnable) {
if( null == glRunnable) {
return;
- }
+ }
synchronized(glRunnablesLock) {
glRunnables.add( new GLRunnableTask(glRunnable, null, false) );
}
}
-
+
public final void setAutoSwapBufferMode(boolean enable) {
autoSwapBufferMode = enable;
}
@@ -812,17 +881,17 @@ public class GLDrawableHelper {
/**
* Dedicates this instance's {@link GLContext} to the given thread.<br/>
* The thread will exclusively claim the {@link GLContext} via {@link #display()} and not release it
- * until {@link #destroy()} or <code>setExclusiveContextThread(null)</code> has been called.
+ * until {@link #destroy()} or <code>setExclusiveContextThread(null)</code> has been called.
* <p>
* Default non-exclusive behavior is <i>requested</i> via <code>setExclusiveContextThread(null)</code>,
- * which will cause the next call of {@link #display()} on the exclusive thread to
- * release the {@link GLContext}. Only after it's async release, {@link #getExclusiveContextThread()}
+ * which will cause the next call of {@link #display()} on the exclusive thread to
+ * release the {@link GLContext}. Only after it's async release, {@link #getExclusiveContextThread()}
* will return <code>null</code>.
* </p>
* <p>
* To release a previous made exclusive thread, a user issues <code>setExclusiveContextThread(null)</code>
- * and may poll {@link #getExclusiveContextThread()} until it returns <code>null</code>,
- * <i>while</i> the exclusive thread is still running.
+ * and may poll {@link #getExclusiveContextThread()} until it returns <code>null</code>,
+ * <i>while</i> the exclusive thread is still running.
* </p>
* <p>
* Note: Setting a new exclusive thread without properly releasing a previous one
@@ -833,7 +902,7 @@ public class GLDrawableHelper {
* and spare redundant context switches.
* </p>
* @param t the exclusive thread to claim the context, or <code>null</code> for default operation.
- * @return previous exclusive context thread
+ * @return previous exclusive context thread
* @throws GLException If an exclusive thread is still active but a new one is attempted to be set
*/
public final Thread setExclusiveContextThread(Thread t, GLContext context) throws GLException {
@@ -857,7 +926,7 @@ public class GLDrawableHelper {
ex.printStackTrace();
throw new GLException(ex);
}
- }
+ }
exclusiveContextThread = t;
}
if (DEBUG) {
@@ -865,14 +934,14 @@ public class GLDrawableHelper {
}
return oldExclusiveContextThread;
}
-
+
/**
- * @see #setExclusiveContextThread(Thread, GLContext)
+ * @see #setExclusiveContextThread(Thread, GLContext)
*/
public final Thread getExclusiveContextThread() {
return exclusiveContextThread;
}
-
+
private static final ThreadLocal<Runnable> perThreadInitAction = new ThreadLocal<Runnable>();
/** Principal helper method which runs a Runnable with the context
@@ -904,15 +973,15 @@ public class GLDrawableHelper {
}
if(PERF_STATS) {
- invokeGLImplStats(drawable, context, runnable, initAction);
+ invokeGLImplStats(drawable, context, runnable, initAction);
} else {
invokeGLImpl(drawable, context, runnable, initAction);
}
}
- /**
- * Principal helper method which runs
- * {@link #disposeAllGLEventListener(GLAutoDrawable, boolean) disposeAllGLEventListener(autoDrawable, false)}
+ /**
+ * Principal helper method which runs
+ * {@link #disposeAllGLEventListener(GLAutoDrawable, boolean) disposeAllGLEventListener(autoDrawable, false)}
* with the context made current.
* <p>
* If <code>destroyContext</code> is <code>true</code> the context is destroyed in the end while holding the lock.
@@ -940,7 +1009,7 @@ public class GLDrawableHelper {
}
}
- int res;
+ int res;
try {
res = context.makeCurrent();
if (GLContext.CONTEXT_NOT_CURRENT != res) {
@@ -975,7 +1044,7 @@ public class GLDrawableHelper {
private final void invokeGLImpl(final GLDrawable drawable,
final GLContext context,
final Runnable runnable,
- final Runnable initAction) {
+ final Runnable initAction) {
final Thread currentThread = Thread.currentThread();
// Exclusive Cases:
@@ -1013,7 +1082,7 @@ public class GLDrawableHelper {
lastContext.release();
}
}
-
+
try {
final boolean releaseContext;
if( GLContext.CONTEXT_NOT_CURRENT == res ) {
@@ -1110,7 +1179,7 @@ public class GLDrawableHelper {
long tdX = 0; // release
boolean ctxClaimed = false;
boolean ctxReleased = false;
- boolean ctxDestroyed = false;
+ boolean ctxDestroyed = false;
try {
final boolean releaseContext;
if( GLContext.CONTEXT_NOT_CURRENT == res ) {
@@ -1129,7 +1198,7 @@ public class GLDrawableHelper {
}
initAction.run();
}
- tdR = System.currentTimeMillis();
+ tdR = System.currentTimeMillis();
tdA = tdR - t0; // makeCurrent
runnable.run();
tdS = System.currentTimeMillis();
@@ -1172,5 +1241,5 @@ public class GLDrawableHelper {
}
protected static String getThreadName() { return Thread.currentThread().getName(); }
-
+
}
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
index e1088da..94d39a4 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
@@ -53,11 +53,11 @@ import javax.media.opengl.GLProfile;
public abstract class GLDrawableImpl implements GLDrawable {
protected static final boolean DEBUG = GLDrawableFactoryImpl.DEBUG;
-
+
protected GLDrawableImpl(GLDrawableFactory factory, NativeSurface comp, boolean realized) {
this(factory, comp, (GLCapabilitiesImmutable) comp.getGraphicsConfiguration().getRequestedCapabilities(), realized);
}
-
+
protected GLDrawableImpl(GLDrawableFactory factory, NativeSurface comp, GLCapabilitiesImmutable requestedCapabilities, boolean realized) {
this.factory = factory;
this.surface = comp;
@@ -100,20 +100,20 @@ public abstract class GLDrawableImpl implements GLDrawable {
}
} finally {
unlockSurface();
- }
+ }
surface.surfaceUpdated(this, surface, System.currentTimeMillis());
}
-
+
/**
* Platform and implementation depending surface swap.
* <p>The surface is locked.</p>
* <p>
- * If <code>doubleBuffered</code> is <code>true</code>,
+ * If <code>doubleBuffered</code> is <code>true</code>,
* an actual platform dependent surface swap shall be executed.
* </p>
* <p>
- * If <code>doubleBuffered</code> is <code>false</code>,
- * {@link GL#glFlush()} has been called already and
+ * If <code>doubleBuffered</code> is <code>false</code>,
+ * {@link GL#glFlush()} has been called already and
* the implementation may execute implementation specific code.
* </p>
* @param doubleBuffered indicates whether double buffering is enabled, see above.
@@ -143,19 +143,19 @@ public abstract class GLDrawableImpl implements GLDrawable {
return surface;
}
- /**
+ /**
* called with locked surface @ setRealized(false) or @ lockSurface(..) when surface changed
* <p>
* Must be paired w/ {@link #createHandle()}.
- * </p>
+ * </p>
*/
protected void destroyHandle() {}
- /**
+ /**
* called with locked surface @ setRealized(true) or @ lockSurface(..) when surface changed
* <p>
* Must be paired w/ {@link #destroyHandle()}.
- * </p>
+ * </p>
*/
protected void createHandle() {}
@@ -213,16 +213,16 @@ public abstract class GLDrawableImpl implements GLDrawable {
System.err.println(getThreadName() + ": setRealized: "+getClass().getName()+" "+this.realized+" == "+realizedArg);
}
}
-
+
/**
- * Platform specific realization of drawable
+ * Platform specific realization of drawable
*/
protected abstract void setRealizedImpl();
/**
* Callback for special implementations, allowing
* <ul>
- * <li>to associate bound context to this drawable (bound == true)
+ * <li>to associate bound context to this drawable (bound == true)
* or to remove such association (bound == false).</li>
* <li>to trigger GLContext/GLDrawable related lifecycle: <code>construct</code>, <code>destroy</code>.</li>
* </ul>
@@ -239,8 +239,8 @@ public abstract class GLDrawableImpl implements GLDrawable {
* @param bound if <code>true</code> create an association, otherwise remove it
*/
protected void associateContext(GLContext ctx, boolean bound) { }
-
- /**
+
+ /**
* Callback for special implementations, allowing GLContext to trigger GL related lifecycle: <code>makeCurrent</code>, <code>release</code>.
* <p>
* If <code>current</code> is <code>true</code>, the context has just been made current.
@@ -252,13 +252,13 @@ public abstract class GLDrawableImpl implements GLDrawable {
* Being called by {@link GLContextImpl#contextMadeCurrent(boolean)}.
* </p>
* @see #associateContext(GLContext, boolean)
- */
+ */
protected void contextMadeCurrent(GLContext glc, boolean current) { }
/** Callback for special implementations, allowing GLContext to fetch a custom default render framebuffer. Defaults to zero.*/
protected int getDefaultDrawFramebuffer() { return 0; }
/** Callback for special implementations, allowing GLContext to fetch a custom default read framebuffer. Defaults to zero. */
- protected int getDefaultReadFramebuffer() { return 0; }
+ protected int getDefaultReadFramebuffer() { return 0; }
/** Callback for special implementations, allowing GLContext to fetch a custom default read buffer of current framebuffer. */
protected int getDefaultReadBuffer(GL gl) {
if(gl.isGLES() || getChosenGLCapabilities().getDoubleBuffered()) {
@@ -266,9 +266,9 @@ public abstract class GLDrawableImpl implements GLDrawable {
// Note-2: ES3 only supports GL_BACK, GL_NONE or GL_COLOR_ATTACHMENT0+i
return GL.GL_BACK;
}
- return GL.GL_FRONT ;
+ return GL.GL_FRONT ;
}
-
+
@Override
public final boolean isRealized() {
return realized;
@@ -286,22 +286,22 @@ public abstract class GLDrawableImpl implements GLDrawable {
@Override
public boolean isGLOriented() {
- return true;
+ return true;
}
-
- /**
+
+ /**
* {@link NativeSurface#lockSurface() Locks} the underlying windowing toolkit's {@link NativeSurface surface}.
* <p>
* <i>If</i> drawable is {@link #setRealized(boolean) realized},
- * the {@link #getHandle() drawable handle} is valid after successfully {@link NativeSurface#lockSurface() locking}
+ * the {@link #getHandle() drawable handle} is valid after successfully {@link NativeSurface#lockSurface() locking}
* it's {@link NativeSurface surface} until being {@link #unlockSurface() unlocked}.
* </p>
* <p>
- * In case the {@link NativeSurface surface} has changed as indicated by it's
+ * In case the {@link NativeSurface surface} has changed as indicated by it's
* {@link NativeSurface#lockSurface() lock} result {@link NativeSurface#LOCK_SURFACE_CHANGED},
- * the implementation is required to update this information as needed within it's implementation.
+ * the implementation is required to update this information as needed within it's implementation.
* </p>
- *
+ *
* @see NativeSurface#lockSurface()
* @see #getHandle()
*/
@@ -312,7 +312,7 @@ public abstract class GLDrawableImpl implements GLDrawable {
final long _handle1 = getHandle();
destroyHandle();
createHandle();
- final long _handle2 = getHandle();
+ final long _handle2 = getHandle();
if(DEBUG) {
if( _handle1 != _handle2) {
System.err.println(getThreadName() + ": Drawable handle changed: "+toHexString(_handle1)+" -> "+toHexString(_handle2));
@@ -320,14 +320,14 @@ public abstract class GLDrawableImpl implements GLDrawable {
}
}
return lockRes;
-
+
}
- /**
+ /**
* {@link NativeSurface#unlockSurface() Unlocks} the underlying windowing toolkit {@link NativeSurface surface},
* which may render the {@link #getHandle() drawable handle} invalid.
- *
- * @see NativeSurface#unlockSurface()
+ *
+ * @see NativeSurface#unlockSurface()
* @see #getHandle()
*/
public final void unlockSurface() {
@@ -344,9 +344,9 @@ public abstract class GLDrawableImpl implements GLDrawable {
protected static String getThreadName() { return Thread.currentThread().getName(); }
- protected GLDrawableFactory factory;
- protected NativeSurface surface;
- protected GLCapabilitiesImmutable requestedCapabilities;
+ protected final GLDrawableFactory factory;
+ protected final NativeSurface surface;
+ protected final GLCapabilitiesImmutable requestedCapabilities;
// Indicates whether the surface (if an onscreen context) has been
// realized. Plausibly, before the surface is realized the JAWT
diff --git a/src/jogl/classes/jogamp/opengl/GLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/GLDynamicLibraryBundleInfo.java
index 8ba9f61..39de320 100644
--- a/src/jogl/classes/jogamp/opengl/GLDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/GLDynamicLibraryBundleInfo.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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;
import com.jogamp.common.os.DynamicLibraryBundle;
@@ -36,7 +36,7 @@ public abstract class GLDynamicLibraryBundleInfo implements DynamicLibraryBundle
protected GLDynamicLibraryBundleInfo() {
}
- /**
+ /**
* Returns <code>true</code>,
* since we might load a desktop GL library and allow symbol access to subsequent libs.
* <p>
@@ -46,20 +46,21 @@ public abstract class GLDynamicLibraryBundleInfo implements DynamicLibraryBundle
* </pre>
* </p>
*/
+ @Override
public final boolean shallLinkGlobal() { return true; }
-
+
/**
* {@inheritDoc}
* <p>
* Returns <code>false</code>.
* </p>
- */
+ */
@Override
public boolean shallLookupGlobal() { return false; }
@Override
public final RunnableExecutor getLibLoaderExecutor() {
return DynamicLibraryBundle.getDefaultRunnableExecutor();
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/opengl/GLDynamicLookupHelper.java b/src/jogl/classes/jogamp/opengl/GLDynamicLookupHelper.java
index 1ed73f1..421f062 100644
--- a/src/jogl/classes/jogamp/opengl/GLDynamicLookupHelper.java
+++ b/src/jogl/classes/jogamp/opengl/GLDynamicLookupHelper.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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;
import com.jogamp.common.os.DynamicLibraryBundle;
diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
index 3833e68..ab31892 100644
--- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
@@ -26,11 +26,11 @@ import com.jogamp.opengl.JoglVersion;
* to initialize the {@link FBObject} instance.
* </p>
* <p>
- * It utilizes the context current hook {@link #contextMadeCurrent(GLContext, boolean) contextMadeCurrent(context, true)}
+ * It utilizes the context current hook {@link #contextMadeCurrent(GLContext, boolean) contextMadeCurrent(context, true)}
* to {@link FBObject#bind(GL) bind} the FBO.
* </p>
* See {@link GLFBODrawable} for double buffering details.
- *
+ *
* @see GLDrawableImpl#contextRealized(GLContext, boolean)
* @see GLDrawableImpl#contextMadeCurrent(GLContext, boolean)
* @see GLDrawableImpl#getDefaultDrawFramebuffer()
@@ -39,21 +39,21 @@ import com.jogamp.opengl.JoglVersion;
public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
protected static final boolean DEBUG;
protected static final boolean DEBUG_SWAP;
-
+
static {
Debug.initSingleton();
DEBUG = GLDrawableImpl.DEBUG || Debug.debug("FBObject");
- DEBUG_SWAP = Debug.isPropertyDefined("jogl.debug.FBObject.Swap", true);
+ DEBUG_SWAP = DEBUG || Debug.isPropertyDefined("jogl.debug.FBObject.Swap", true);
}
-
+
private final GLDrawableImpl parent;
private GLCapabilitiesImmutable origParentChosenCaps;
-
+
private boolean initialized;
private int texUnit;
private int samples;
private boolean fboResetQuirk;
-
+
private FBObject[] fbos;
private int fboIBack; // points to GL_BACK buffer
private int fboIFront; // points to GL_FRONT buffer
@@ -64,19 +64,19 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
private boolean fboSwapped;
/** dump fboResetQuirk info only once pre ClassLoader and only in DEBUG mode */
- private static volatile boolean resetQuirkInfoDumped = false;
-
+ private static volatile boolean resetQuirkInfoDumped = false;
+
/** number of FBOs for double buffering. TODO: Possible to configure! */
- private static final int bufferCount = 2;
-
+ private static final int bufferCount = 2;
+
// private DoubleBufferMode doubleBufferMode; // TODO: Add or remove TEXTURE (only) DoubleBufferMode support
-
+
private SwapBufferContext swapBufferContext;
-
+
public static interface SwapBufferContext {
public void swapBuffers(boolean doubleBuffered);
}
-
+
/**
* @param factory
* @param parent
@@ -84,7 +84,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
* @param fboCaps the requested FBO capabilities
* @param textureUnit
*/
- protected GLFBODrawableImpl(GLDrawableFactoryImpl factory, GLDrawableImpl parent, NativeSurface surface,
+ protected GLFBODrawableImpl(GLDrawableFactoryImpl factory, GLDrawableImpl parent, NativeSurface surface,
GLCapabilitiesImmutable fboCaps, int textureUnit) {
super(factory, surface, fboCaps, false);
this.initialized = false;
@@ -94,20 +94,27 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
this.texUnit = textureUnit;
this.samples = fboCaps.getNumSamples();
fboResetQuirk = false;
-
+
// default .. // TODO: Add or remove TEXTURE (only) DoubleBufferMode support
// this.doubleBufferMode = ( samples > 0 || fboCaps.getDoubleBuffered() ) ? DoubleBufferMode.FBO : DoubleBufferMode.NONE ;
-
+
this.swapBufferContext = null;
}
-
+
private final void initialize(boolean realize, GL gl) {
+ if( !initialized && !realize ) {
+ if( DEBUG ) {
+ System.err.println("GLFBODrawableImpl.initialize(): WARNING - Already unrealized!");
+ Thread.dumpStack();
+ }
+ return; // NOP, no exception for de-init twice or no init!
+ }
if( initialized == realize ) {
- throw new InternalError("Already set to initialize := "+realize+": "+this);
+ throw new IllegalStateException("initialize already in state "+realize+": "+this);
}
if(realize) {
final GLCapabilities chosenFBOCaps = (GLCapabilities) getChosenGLCapabilities(); // cloned at setRealized(true)
-
+
final int maxSamples = gl.getMaxRenderbufferSamples();
{
final int newSamples = samples <= maxSamples ? samples : maxSamples;
@@ -116,7 +123,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
}
samples = newSamples;
}
-
+
final int fbosN;
if(samples > 0) {
fbosN = 1;
@@ -129,7 +136,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
fbos = new FBObject[fbosN];
fboIBack = 0; // head
fboIFront = fbos.length - 1; // tail
-
+
for(int i=0; i<fbosN; i++) {
fbos[i] = new FBObject();
fbos[i].reset(gl, getWidth(), getHeight(), samples, false);
@@ -161,13 +168,13 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
fboSwapped = false;
pendingFBOReset = -1;
initialized = realize;
-
+
if(DEBUG) {
System.err.println("GLFBODrawableImpl.initialize("+realize+"): "+this);
Thread.dumpStack();
}
}
-
+
public final void setSwapBufferContext(SwapBufferContext sbc) {
swapBufferContext = sbc;
}
@@ -193,7 +200,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
System.err.println(joglVersion.toString());
System.err.println(JoglVersion.getGLInfo(gl, null));
} else {
- System.err.println(joglVersion.getBriefOSGLBuildInfo(gl, null));
+ System.err.println(joglVersion.getBriefOSGLBuildInfo(gl, null));
}
e.printStackTrace();
}
@@ -219,16 +226,16 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
fbos[idx].attachRenderbuffer(gl, Attachment.Type.DEPTH, 24);
}
}
-
+
private final void reset(GL gl, int newSamples) throws GLException {
if(!initialized) {
// NOP if not yet initializes
return;
}
-
+
final GLContext curContext = GLContext.getCurrent();
final GLContext ourContext = gl.getContext();
- final boolean ctxSwitch = null != curContext && curContext != ourContext;
+ final boolean ctxSwitch = null != curContext && curContext != ourContext;
if(DEBUG) {
System.err.println("GLFBODrawableImpl.reset(newSamples "+newSamples+"): BEGIN - ctxSwitch "+ctxSwitch+", "+this);
Thread.dumpStack();
@@ -240,9 +247,9 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
fboBound = false; // clear bound-flag immediatly, caused by contextMadeCurrent(..) - otherwise we would swap @ release
fboSwapped = false;
try {
- final int maxSamples = gl.getMaxRenderbufferSamples();
+ final int maxSamples = gl.getMaxRenderbufferSamples();
newSamples = newSamples <= maxSamples ? newSamples : maxSamples;
-
+
if(0==samples && 0<newSamples || 0<samples && 0==newSamples) {
// MSAA on/off switch
if(DEBUG) {
@@ -251,7 +258,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
initialize(false, gl);
samples = newSamples;
initialize(true, gl);
- } else {
+ } else {
if(DEBUG) {
System.err.println("GLFBODrawableImpl.reset(): simple reconfig: "+samples+" -> "+newSamples+"/"+maxSamples);
}
@@ -290,11 +297,11 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
System.err.println("GLFBODrawableImpl.reset(newSamples "+newSamples+"): END "+this);
}
}
-
+
//
// GLDrawable
//
-
+
@Override
public final GLContext createContext(GLContext shareWith) {
final GLContext ctx = parent.createContext(shareWith);
@@ -305,7 +312,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
//
// GLDrawableImpl
//
-
+
@Override
public final GLDynamicLookupHelper getGLDynamicLookupHelper() {
return parent.getGLDynamicLookupHelper();
@@ -313,13 +320,13 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
@Override
protected final int getDefaultDrawFramebuffer() { return initialized ? fbos[fboIBack].getWriteFramebuffer() : 0; }
-
+
@Override
protected final int getDefaultReadFramebuffer() { return initialized ? fbos[fboIFront].getReadFramebuffer() : 0; }
@Override
protected final int getDefaultReadBuffer(GL gl) { return initialized ? fbos[fboIFront].getDefaultReadBuffer() : GL.GL_COLOR_ATTACHMENT0 ; }
-
+
@Override
protected final void setRealizedImpl() {
final MutableGraphicsConfiguration msConfig = (MutableGraphicsConfiguration) surface.getGraphicsConfiguration();
@@ -334,12 +341,12 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
parent.setRealized(false);
}
}
-
+
@Override
protected void associateContext(GLContext glc, boolean bound) {
- initialize(bound, glc.getGL());
+ initialize(bound, glc.getGL());
}
-
+
@Override
protected final void contextMadeCurrent(GLContext glc, boolean current) {
final GL gl = glc.getGL();
@@ -360,7 +367,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
}
}
}
-
+
@Override
protected void swapBuffersImpl(boolean doubleBuffered) {
final GLContext ctx = GLContext.getCurrent();
@@ -382,7 +389,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
swapFBOImplPost(ctx);
}
}
-
+
private final void swapFBOImplPost(GLContext glc) {
// Safely reset the previous front FBO - after completing propagating swap
if(0 <= pendingFBOReset) {
@@ -391,18 +398,18 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
pendingFBOReset = -1;
}
}
-
+
private final void swapFBOImpl(GLContext glc) {
final GL gl = glc.getGL();
fbos[fboIBack].markUnbound(); // fast path, use(gl,..) is called below
-
+
if(DEBUG) {
int _fboIFront = ( fboIFront + 1 ) % fbos.length;
if(_fboIFront != fboIBack) { throw new InternalError("XXX: "+_fboIFront+"!="+fboIBack); }
}
fboIFront = fboIBack;
fboIBack = ( fboIBack + 1 ) % fbos.length;
-
+
final Colorbuffer colorbuffer = samples > 0 ? fbos[fboIFront].getSamplingSink() : fbos[fboIFront].getColorbuffer(0);
final TextureAttachment texAttachment;
if(colorbuffer instanceof TextureAttachment) {
@@ -416,12 +423,12 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
}
gl.glActiveTexture(GL.GL_TEXTURE0 + texUnit);
fbos[fboIFront].use(gl, texAttachment);
-
- /* Included in above use command:
+
+ /* Included in above use command:
gl.glBindFramebuffer(GL2GL3.GL_DRAW_FRAMEBUFFER, fbos[fboIBack].getDrawFramebuffer());
gl.glBindFramebuffer(GL2GL3.GL_READ_FRAMEBUFFER, fbos[fboIFront].getReadFramebuffer());
} */
-
+
if(DEBUG_SWAP) {
System.err.println("Post FBO swap(X): fboI back "+fboIBack+", front "+fboIFront+", num "+fbos.length);
}
@@ -429,62 +436,62 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
//
// GLFBODrawable
- //
-
+ //
+
@Override
public final boolean isInitialized() {
return initialized;
}
-
+
@Override
public final void resetSize(GL gl) throws GLException {
reset(gl, samples);
- }
-
+ }
+
@Override
public final int getTextureUnit() { return texUnit; }
-
+
@Override
public final void setTextureUnit(int u) { texUnit = u; }
-
+
@Override
public final int getNumSamples() { return samples; }
-
+
@Override
public void setNumSamples(GL gl, int newSamples) throws GLException {
if(samples != newSamples) {
reset(gl, newSamples);
}
}
-
+
@Override
public final int setNumBuffers(int bufferCount) throws GLException {
// FIXME: Implement
return bufferCount;
}
-
+
@Override
public final int getNumBuffers() {
return bufferCount;
}
-
+
/** // TODO: Add or remove TEXTURE (only) DoubleBufferMode support
@Override
public final DoubleBufferMode getDoubleBufferMode() {
return doubleBufferMode;
}
-
+
@Override
public final void setDoubleBufferMode(DoubleBufferMode mode) throws GLException {
if(initialized) {
throw new GLException("Not allowed past initialization: "+this);
- }
+ }
final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) surface.getGraphicsConfiguration().getChosenCapabilities();
if(0 == samples && caps.getDoubleBuffered() && DoubleBufferMode.NONE != mode) {
doubleBufferMode = mode;
}
} */
-
+
@Override
public FBObject getFBObject(int bufferName) throws IllegalArgumentException {
if(!initialized) {
@@ -502,12 +509,12 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
case GL.GL_BACK:
res = fbos[fboIBack];
break;
- default:
+ default:
throw new IllegalArgumentException(illegalBufferName+toHexString(bufferName));
- }
- return res;
+ }
+ return res;
}
-
+
@Override
public final TextureAttachment getTextureBuffer(int bufferName) throws IllegalArgumentException {
if(!initialized) {
@@ -529,13 +536,13 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
res = (TextureAttachment) fbos[fboIBack].getColorbuffer(0);
}
break;
- default:
+ default:
throw new IllegalArgumentException(illegalBufferName+toHexString(bufferName));
- }
- return res;
+ }
+ return res;
}
private static final String illegalBufferName = "Only GL_FRONT and GL_BACK buffer are allowed, passed ";
-
+
@Override
public String toString() {
return getClass().getSimpleName()+"[Initialized "+initialized+", realized "+isRealized()+", texUnit "+texUnit+", samples "+samples+
@@ -548,13 +555,13 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
",\n\tSurface "+getNativeSurface()+
"]";
}
-
+
public static class ResizeableImpl extends GLFBODrawableImpl implements GLFBODrawable.Resizeable {
- protected ResizeableImpl(GLDrawableFactoryImpl factory, GLDrawableImpl parent, ProxySurface surface,
+ protected ResizeableImpl(GLDrawableFactoryImpl factory, GLDrawableImpl parent, ProxySurface surface,
GLCapabilitiesImmutable fboCaps, int textureUnit) {
super(factory, parent, surface, fboCaps, textureUnit);
}
-
+
@Override
public final void setSize(GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException {
if(DEBUG) {
@@ -565,7 +572,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
throw new NativeWindowException("Could not lock surface: "+this);
}
try {
- // propagate new size
+ // propagate new size
final ProxySurface ps = (ProxySurface) getNativeSurface();
final UpstreamSurfaceHook ush = ps.getUpstreamSurfaceHook();
if(ush instanceof UpstreamSurfaceHook.MutableSize) {
diff --git a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java
index d54da4d..702fb77 100644
--- a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java
+++ b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java
@@ -85,12 +85,12 @@ public class GLGraphicsConfigurationUtil {
}
if(isFBO) {
winattrbits |= FBO_BIT;
- }
+ }
if(isPBuffer ){
winattrbits |= PBUFFER_BIT;
- }
+ }
if(isBitmap) {
- winattrbits |= BITMAP_BIT;
+ winattrbits |= BITMAP_BIT;
}
return winattrbits;
}
@@ -110,7 +110,7 @@ public class GLGraphicsConfigurationUtil {
} else if(isPBuffer ){
winattrbits = PBUFFER_BIT;
} else if(isBitmap) {
- winattrbits = BITMAP_BIT;
+ winattrbits = BITMAP_BIT;
} else {
throw new InternalError("Empty bitmask");
}
@@ -136,9 +136,9 @@ public class GLGraphicsConfigurationUtil {
caps.setHardwareAccelerated(false);
}
- return caps;
+ return caps;
}
-
+
/**
* Fixes the requested {@link GLCapabilitiesImmutable} according to on- and offscreen usage.
* <p>
@@ -150,17 +150,17 @@ public class GLGraphicsConfigurationUtil {
* @param device the device on which the drawable will be created, maybe null for the {@link GLDrawableFactory#getDefaultDevice() default device}.
* @return either the given requested {@link GLCapabilitiesImmutable} instance if no modifications were required, or a modified {@link GLCapabilitiesImmutable} instance.
*/
- public static GLCapabilitiesImmutable fixGLCapabilities(GLCapabilitiesImmutable capsRequested,
+ public static GLCapabilitiesImmutable fixGLCapabilities(GLCapabilitiesImmutable capsRequested,
GLDrawableFactory factory, AbstractGraphicsDevice device) {
if( !capsRequested.isOnscreen() ) {
return fixOffscreenGLCapabilities(capsRequested, factory, device);
}
return capsRequested;
}
-
+
public static GLCapabilitiesImmutable fixOnscreenGLCapabilities(GLCapabilitiesImmutable capsRequested)
{
- if( !capsRequested.isOnscreen() || capsRequested.isFBO() || capsRequested.isPBuffer() || capsRequested.isBitmap() ) {
+ if( !capsRequested.isOnscreen() || capsRequested.isFBO() || capsRequested.isPBuffer() || capsRequested.isBitmap() ) {
// fix caps ..
final GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable();
caps2.setBitmap (false);
@@ -174,7 +174,7 @@ public class GLGraphicsConfigurationUtil {
public static GLCapabilitiesImmutable fixOffscreenBitOnly(GLCapabilitiesImmutable capsRequested)
{
- if( capsRequested.isOnscreen() ) {
+ if( capsRequested.isOnscreen() ) {
// fix caps ..
final GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable();
caps2.setOnscreen(false);
@@ -182,7 +182,7 @@ public class GLGraphicsConfigurationUtil {
}
return capsRequested;
}
-
+
/**
* Fixes the requested {@link GLCapabilitiesImmutable} according to:
* <ul>
@@ -203,15 +203,15 @@ public class GLGraphicsConfigurationUtil {
final GLProfile glp = capsRequested.getGLProfile();
final boolean fboAvailable = GLContext.isFBOAvailable(device, glp);
final boolean pbufferAvailable = factory.canCreateGLPbuffer(device, glp);
-
+
final GLRendererQuirks glrq = factory.getRendererQuirks(device);
final boolean bitmapAvailable;
final boolean doubleBufferAvailable;
-
+
if(null != glrq) {
bitmapAvailable = !glrq.exist(GLRendererQuirks.NoOffscreenBitmap);
if( capsRequested.getDoubleBuffered() &&
- ( capsRequested.isPBuffer() && glrq.exist(GLRendererQuirks.NoDoubleBufferedPBuffer) ) ||
+ ( capsRequested.isPBuffer() && glrq.exist(GLRendererQuirks.NoDoubleBufferedPBuffer) ) ||
( capsRequested.isBitmap() && glrq.exist(GLRendererQuirks.NoDoubleBufferedBitmap) ) ) {
doubleBufferAvailable = false;
} else {
@@ -221,25 +221,25 @@ public class GLGraphicsConfigurationUtil {
bitmapAvailable = true;
doubleBufferAvailable = true;
}
-
- final boolean auto = !( fboAvailable && capsRequested.isFBO() ) &&
- !( pbufferAvailable && capsRequested.isPBuffer() ) &&
+
+ final boolean auto = !( fboAvailable && capsRequested.isFBO() ) &&
+ !( pbufferAvailable && capsRequested.isPBuffer() ) &&
!( bitmapAvailable && capsRequested.isBitmap() ) ;
final boolean useFBO = fboAvailable && ( auto || capsRequested.isFBO() ) ;
final boolean usePbuffer = !useFBO && pbufferAvailable && ( auto || capsRequested.isPBuffer() ) ;
final boolean useBitmap = !useFBO && !usePbuffer && bitmapAvailable && ( auto || capsRequested.isBitmap() ) ;
-
+
if( capsRequested.isOnscreen() ||
- useFBO != capsRequested.isFBO() ||
- usePbuffer != capsRequested.isPBuffer() ||
+ useFBO != capsRequested.isFBO() ||
+ usePbuffer != capsRequested.isPBuffer() ||
useBitmap != capsRequested.isBitmap() ||
!doubleBufferAvailable && capsRequested.getDoubleBuffered() )
{
// fix caps ..
final GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable();
caps2.setOnscreen(false);
- caps2.setFBO( useFBO );
+ caps2.setFBO( useFBO );
caps2.setPBuffer( usePbuffer );
caps2.setBitmap( useBitmap );
if( !doubleBufferAvailable ) {
@@ -253,8 +253,8 @@ public class GLGraphicsConfigurationUtil {
public static GLCapabilitiesImmutable fixGLPBufferGLCapabilities(GLCapabilitiesImmutable capsRequested)
{
if( capsRequested.isOnscreen() ||
- !capsRequested.isPBuffer() ||
- capsRequested.isFBO() )
+ !capsRequested.isPBuffer() ||
+ capsRequested.isFBO() )
{
// fix caps ..
final GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable();
@@ -277,7 +277,7 @@ public class GLGraphicsConfigurationUtil {
}
return capsRequested;
}
-
+
/** Fix double buffered setting */
public static GLCapabilitiesImmutable fixDoubleBufferedGLCapabilities(GLCapabilitiesImmutable capsRequested, boolean doubleBuffered)
{
@@ -288,7 +288,7 @@ public class GLGraphicsConfigurationUtil {
}
return capsRequested;
}
-
+
public static GLCapabilitiesImmutable clipRGBAGLCapabilities(GLCapabilitiesImmutable caps, boolean allowRGB555, boolean allowAlpha)
{
final int iR = caps.getRedBits();
@@ -305,21 +305,21 @@ public class GLGraphicsConfigurationUtil {
caps2.setGreenBits(oG);
caps2.setBlueBits(oB);
caps2.setAlphaBits(oA);
- return caps2;
+ return caps2;
}
return caps;
}
-
+
public static int clipColor(final int compIn, final boolean allowRGB555) {
final int compOut;
if( 5 < compIn || !allowRGB555 ) {
- compOut = 8;
+ compOut = 8;
} else {
compOut = 5;
- }
+ }
return compOut;
}
-
+
public static GLCapabilitiesImmutable fixGLProfile(GLCapabilitiesImmutable caps, GLProfile glp)
{
if( caps.getGLProfile() != glp ) {
diff --git a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java
index 6d91163..345f08e 100644
--- a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -42,29 +42,29 @@ import com.jogamp.opengl.GLAutoDrawableDelegate;
import jogamp.opengl.GLFBODrawableImpl;
public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implements GLOffscreenAutoDrawable {
-
+
/**
* @param drawable a valid {@link GLDrawable}, may not be {@link GLDrawable#isRealized() realized} yet.
- * @param context a valid {@link GLContext},
+ * @param context a valid {@link GLContext},
* may not have been made current (created) yet,
* may not be associated w/ <code>drawable<code> yet,
- * may be <code>null</code> for lazy initialization
+ * may be <code>null</code> for lazy initialization at 1st {@link #display()}.
* @param upstreamWidget optional UI element holding this instance, see {@link #getUpstreamWidget()}.
* @param lock optional upstream lock, may be null
*/
public GLOffscreenAutoDrawableImpl(GLDrawable drawable, GLContext context, Object upstreamWidget, RecursiveLock lock) {
super(drawable, context, upstreamWidget, true, lock);
}
-
+
@Override
public void setSize(int newWidth, int newHeight) throws NativeWindowException, GLException {
this.defaultWindowResizedOp(newWidth, newHeight);
}
-
- public static class FBOImpl extends GLOffscreenAutoDrawableImpl implements GLOffscreenAutoDrawable.FBO {
+
+ public static class FBOImpl extends GLOffscreenAutoDrawableImpl implements GLOffscreenAutoDrawable.FBO {
/**
* @param drawable a valid {@link GLDrawable}, may not be {@link GLDrawable#isRealized() realized} yet.
- * @param context a valid {@link GLContext},
+ * @param context a valid {@link GLContext},
* may not have been made current (created) yet,
* may not be associated w/ <code>drawable<code> yet,
* may be <code>null</code> for lazy initialization
@@ -74,7 +74,7 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen
public FBOImpl(GLFBODrawableImpl drawable, GLContext context, Object upstreamWidget, RecursiveLock lock) {
super(drawable, context, upstreamWidget, lock);
}
-
+
@Override
public boolean isInitialized() {
return ((GLFBODrawableImpl)drawable).isInitialized();
@@ -84,7 +84,7 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen
public final int getTextureUnit() {
return ((GLFBODrawableImpl)drawable).getTextureUnit();
}
-
+
@Override
public final void setTextureUnit(int unit) {
((GLFBODrawableImpl)drawable).setTextureUnit(unit);
@@ -94,23 +94,23 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen
public final int getNumSamples() {
return ((GLFBODrawableImpl)drawable).getNumSamples();
}
-
+
@Override
public final void setNumSamples(GL gl, int newSamples) throws GLException {
((GLFBODrawableImpl)drawable).setNumSamples(gl, newSamples);
windowRepaintOp();
}
-
+
@Override
public final int setNumBuffers(int bufferCount) throws GLException {
return ((GLFBODrawableImpl)drawable).setNumBuffers(bufferCount);
}
-
+
@Override
public final int getNumBuffers() {
return ((GLFBODrawableImpl)drawable).getNumBuffers();
}
-
+
/** // TODO: Add or remove TEXTURE (only) DoubleBufferMode support
@Override
public DoubleBufferMode getDoubleBufferMode() {
@@ -119,14 +119,15 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen
@Override
public void setDoubleBufferMode(DoubleBufferMode mode) throws GLException {
- ((GLFBODrawableImpl)drawable).setDoubleBufferMode(mode);
+ ((GLFBODrawableImpl)drawable).setDoubleBufferMode(mode);
} */
-
+
@Override
- public final FBObject getFBObject(int bufferName) {
+ public final FBObject getFBObject(int bufferName) {
return ((GLFBODrawableImpl)drawable).getFBObject(bufferName);
}
-
+
+ @Override
public final FBObject.TextureAttachment getTextureBuffer(int bufferName) {
return ((GLFBODrawableImpl)drawable).getTextureBuffer(bufferName);
}
@@ -134,6 +135,6 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen
@Override
public void resetSize(GL gl) throws GLException {
((GLFBODrawableImpl)drawable).resetSize(gl);
- }
+ }
}
}
diff --git a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java
index b8841d6..c32957b 100644
--- a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java
@@ -51,7 +51,7 @@ import com.jogamp.common.util.locks.RecursiveLock;
public class GLPbufferImpl extends GLAutoDrawableBase implements GLPbuffer {
public GLPbufferImpl(GLDrawableImpl pbufferDrawable, GLContextImpl pbufferContext) {
- super(pbufferDrawable, pbufferContext, true); // drawable := pbufferDrawable, context := pbufferContext
+ super(pbufferDrawable, pbufferContext, true); // drawable := pbufferDrawable, context := pbufferContext
}
//
@@ -60,26 +60,26 @@ public class GLPbufferImpl extends GLAutoDrawableBase implements GLPbuffer {
//
// GLDrawable delegation
- //
-
+ //
+
@Override
public final void swapBuffers() throws GLException {
defaultSwapBuffers();
}
-
+
//
// GLAutoDrawable completion
//
private final RecursiveLock lock = LockFactory.createRecursiveLock(); // instance wide lock
-
+
@Override
protected final RecursiveLock getLock() { return lock; }
-
+
@Override
public final Object getUpstreamWidget() {
return null;
}
-
+
@Override
public void destroy() {
defaultDestroy();
@@ -92,7 +92,7 @@ public class GLPbufferImpl extends GLAutoDrawableBase implements GLPbuffer {
@Override
public final void display() {
- final RecursiveLock _lock = lock;
+ final RecursiveLock _lock = lock;
_lock.lock(); // sync: context/drawable could been recreated/destroyed while animating
try {
if( null != context ) {
diff --git a/src/jogl/classes/jogamp/opengl/GLRunnableTask.java b/src/jogl/classes/jogamp/opengl/GLRunnableTask.java
index 244a3fd..6de92f5 100644
--- a/src/jogl/classes/jogamp/opengl/GLRunnableTask.java
+++ b/src/jogl/classes/jogamp/opengl/GLRunnableTask.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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;
import javax.media.opengl.GLRunnable;
@@ -52,6 +52,7 @@ public class GLRunnableTask implements GLRunnable {
isFlushed = false;
}
+ @Override
public boolean run(GLAutoDrawable drawable) {
boolean res = true;
if(null == notifyObject) {
@@ -86,41 +87,41 @@ public class GLRunnableTask implements GLRunnable {
}
return res;
}
-
- /**
+
+ /**
* Simply flush this task and notify a waiting executor.
* The executor which might have been blocked until notified
* will be unblocked and the task removed from the queue.
- *
+ *
* @see #isFlushed()
* @see #isInQueue()
- */
+ */
public void flush() {
if(!isExecuted() && null != notifyObject) {
synchronized (notifyObject) {
isFlushed=true;
- notifyObject.notifyAll();
+ notifyObject.notifyAll();
}
}
}
-
+
/**
* @return !{@link #isExecuted()} && !{@link #isFlushed()}
*/
public boolean isInQueue() { return !isExecuted && !isFlushed; }
-
+
/**
* @return whether this task has been executed.
* @see #isInQueue()
*/
public boolean isExecuted() { return isExecuted; }
-
+
/**
* @return whether this task has been flushed.
* @see #isInQueue()
*/
public boolean isFlushed() { return isFlushed; }
-
+
public Throwable getThrowable() { return runnableException; }
}
diff --git a/src/jogl/classes/jogamp/opengl/GLStateTracker.java b/src/jogl/classes/jogamp/opengl/GLStateTracker.java
index 391f96a..307fd0a 100644
--- a/src/jogl/classes/jogamp/opengl/GLStateTracker.java
+++ b/src/jogl/classes/jogamp/opengl/GLStateTracker.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2006 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -40,7 +40,9 @@
package jogamp.opengl;
import javax.media.opengl.*;
+
import com.jogamp.common.util.IntIntHashMap;
+
import java.nio.IntBuffer;
import java.util.ArrayList;
@@ -51,68 +53,67 @@ import java.util.ArrayList;
* Currently supported states: PixelStorei
*/
public class GLStateTracker {
-
- /** Minimum value of MAX_CLIENT_ATTRIB_STACK_DEPTH */
+
+ /** Minimum value of MAX_CLIENT_ATTRIB_STACK_DEPTH */
public static final int MIN_CLIENT_ATTRIB_STACK_DEPTH = 16;
-
+
/** static size of pixel state map */
static final int PIXEL_STATE_MAP_SIZE = 16;
/** avoid rehash of static size pixel state map */
static final int PIXEL_STATE_MAP_CAPACITY = 32;
-
+
private volatile boolean enabled = true;
private IntIntHashMap pixelStateMap;
private final ArrayList<SavedState> stack;
-
+
private static class SavedState {
/**
* Empty pixel-store state
- */
+ */
private IntIntHashMap pixelStateMap;
-
+
/**
* set (client) pixel-store state, deep copy
- */
+ */
private final void setPixelStateMap(IntIntHashMap pixelStateMap) {
this.pixelStateMap = (IntIntHashMap) pixelStateMap.clone();
}
-
+
/**
* get (client) pixel-store state, return reference
- */
+ */
private final IntIntHashMap getPixelStateMap() { return pixelStateMap; }
}
-
- public GLStateTracker() {
+
+ public GLStateTracker() {
pixelStateMap = new IntIntHashMap(PIXEL_STATE_MAP_CAPACITY, 0.75f);
pixelStateMap.setKeyNotFoundValue(0xFFFFFFFF);
resetStates();
-
+
stack = new ArrayList<SavedState>(MIN_CLIENT_ATTRIB_STACK_DEPTH);
}
- public final void clearStates(boolean enable) {
- enabled = enable;
+ public final void clearStates() {
pixelStateMap.clear();
}
public final void setEnabled(boolean on) {
- enabled = on;
+ enabled = on;
}
public final boolean isEnabled() {
return enabled;
}
- /** @return true if found in our map, otherwise false,
+ /** @return true if found in our map, otherwise false,
* which forces the caller to query GL. */
public final boolean getInt(int pname, int[] params, int params_offset) {
if(enabled) {
- int value = pixelStateMap.get(pname);
+ final int value = pixelStateMap.get(pname);
if(0xFFFFFFFF != value) {
params[params_offset] = value;
return true;
@@ -121,11 +122,11 @@ public class GLStateTracker {
return false;
}
- /** @return true if found in our map, otherwise false,
+ /** @return true if found in our map, otherwise false,
* which forces the caller to query GL. */
public final boolean getInt(int pname, IntBuffer params, int dummy) {
if(enabled) {
- int value = pixelStateMap.get(pname);
+ final int value = pixelStateMap.get(pname);
if(0xFFFFFFFF != value) {
params.put(params.position(), value);
return true;
@@ -157,7 +158,7 @@ public class GLStateTracker {
throw new GLException("stack contains no elements");
}
SavedState state = stack.remove(stack.size()-1); // pop
-
+
if(null==state) {
throw new GLException("null stack element (remaining stack size "+stack.size()+")");
}
@@ -165,7 +166,7 @@ public class GLStateTracker {
if ( null != state.getPixelStateMap() ) {
// use pulled client pixel-store state from stack
pixelStateMap = state.getPixelStateMap();
- } // else: empty-slot, not pushed by GL_CLIENT_PIXEL_STORE_BIT
+ } // else: empty-slot, not pushed by GL_CLIENT_PIXEL_STORE_BIT
}
}
diff --git a/src/jogl/classes/jogamp/opengl/GLVersionNumber.java b/src/jogl/classes/jogamp/opengl/GLVersionNumber.java
index e4187b3..431c1a3 100644
--- a/src/jogl/classes/jogamp/opengl/GLVersionNumber.java
+++ b/src/jogl/classes/jogamp/opengl/GLVersionNumber.java
@@ -43,9 +43,9 @@ public class GLVersionNumber extends VersionNumberString {
super(val[0], val[1], val[2], strEnd, state, versionString);
this.valid = valid;
}
-
+
private static java.util.regex.Pattern getUnderscorePattern() {
- if( null == _Pattern ) { // volatile dbl-checked-locking OK
+ if( null == _Pattern ) { // volatile dbl-checked-locking OK
synchronized( VersionNumber.class ) {
if( null == _Pattern ) {
_Pattern = getVersionNumberPattern("_");
@@ -55,7 +55,7 @@ public class GLVersionNumber extends VersionNumberString {
return _Pattern;
}
private static volatile java.util.regex.Pattern _Pattern = null;
-
+
public static final GLVersionNumber create(String versionString) {
int[] val = new int[] { 0, 0, 0 };
int strEnd = 0;
@@ -73,7 +73,7 @@ public class GLVersionNumber extends VersionNumberString {
strEnd = version.endOfStringMatch();
val[0] = version.getMajor();
val[1] = version.getMinor();
- state = (short) ( ( version.hasMajor() ? VersionNumber.HAS_MAJOR : (short)0 ) |
+ state = (short) ( ( version.hasMajor() ? VersionNumber.HAS_MAJOR : (short)0 ) |
( version.hasMinor() ? VersionNumber.HAS_MINOR : (short)0 ) );
valid = version.hasMajor() && version.hasMinor(); // Requires at least a defined major and minor version component!
} catch (Exception e) {
@@ -82,16 +82,16 @@ public class GLVersionNumber extends VersionNumberString {
val[0] = 1;
val[1] = 0;
}
- }
+ }
return new GLVersionNumber(val, strEnd, state, versionString, valid);
}
public final boolean isValid() {
return valid;
}
-
- /**
- * Returns the optional vendor version at the end of the
+
+ /**
+ * Returns the optional vendor version at the end of the
* <code>GL_VERSION</code> string if exists, otherwise the {@link VersionNumberString#zeroVersion zero version} instance.
* <pre>
* 2.1 Mesa 7.0.3-rc2 -> 7.0.3 (7.0.3-rc2)
@@ -105,14 +105,14 @@ public class GLVersionNumber extends VersionNumberString {
if (versionString == null || versionString.length() <= 0) {
return null;
}
-
+
// Skip the 1st GL version
String str;
{
final GLVersionNumber glv = create(versionString);
str = versionString.substring(glv.endOfStringMatch()).trim();
}
-
+
while ( str.length() > 0 ) {
final VersionNumberString version = new VersionNumberString(str, getDefaultVersionNumberPattern());
final int eosm = version.endOfStringMatch();
diff --git a/src/jogl/classes/jogamp/opengl/GLWorkerThread.java b/src/jogl/classes/jogamp/opengl/GLWorkerThread.java
index 112dfcb..100b46a 100644
--- a/src/jogl/classes/jogamp/opengl/GLWorkerThread.java
+++ b/src/jogl/classes/jogamp/opengl/GLWorkerThread.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2006 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -67,7 +67,7 @@ public class GLWorkerThread {
private static volatile Runnable work;
// Queue of Runnables to be asynchronously invoked
private static List<Runnable> queue = new ArrayList<Runnable>();
-
+
/** Should only be called by Threading class if creation of the
GLWorkerThread was requested via the opengl.1thread system
property. <br>
@@ -149,7 +149,7 @@ public class GLWorkerThread {
}
}
- public static void invoke(boolean wait, Runnable runnable)
+ public static void invoke(boolean wait, Runnable runnable)
throws InvocationTargetException, InterruptedException {
if(wait) {
invokeAndWait(runnable);
@@ -157,7 +157,7 @@ public class GLWorkerThread {
invokeLater(runnable);
}
}
-
+
public static void invokeAndWait(Runnable runnable)
throws InvocationTargetException, InterruptedException {
if (!started) {
@@ -220,8 +220,9 @@ public class GLWorkerThread {
}
protected static String getThreadName() { return Thread.currentThread().getName(); }
-
+
static class WorkerRunnable implements Runnable {
+ @Override
public void run() {
// Notify starting thread that we're ready
synchronized (lock) {
@@ -244,7 +245,7 @@ public class GLWorkerThread {
break;
}
}
-
+
if (shouldTerminate) {
lock.notifyAll();
thread = null;
diff --git a/src/jogl/classes/jogamp/opengl/GLXExtensions.java b/src/jogl/classes/jogamp/opengl/GLXExtensions.java
index 36c6c46..9325c6f 100644
--- a/src/jogl/classes/jogamp/opengl/GLXExtensions.java
+++ b/src/jogl/classes/jogamp/opengl/GLXExtensions.java
@@ -28,9 +28,9 @@
package jogamp.opengl;
/**
- * Class holding GLX/WGL/.. extension strings, commonly used by JOGL's implementation.
+ * Class holding GLX/WGL/.. extension strings, commonly used by JOGL's implementation.
*/
-public class GLXExtensions {
+public class GLXExtensions {
public static final String GLX_MESA_swap_control = "GLX_MESA_swap_control";
public static final String GLX_SGI_swap_control = "GLX_SGI_swap_control";
public static final String GLX_NV_swap_group = "GLX_NV_swap_group";
diff --git a/src/jogl/classes/jogamp/opengl/ListenerSyncedImplStub.java b/src/jogl/classes/jogamp/opengl/ListenerSyncedImplStub.java
index 1cde551..a64a2f5 100644
--- a/src/jogl/classes/jogamp/opengl/ListenerSyncedImplStub.java
+++ b/src/jogl/classes/jogamp/opengl/ListenerSyncedImplStub.java
@@ -33,9 +33,9 @@ import java.util.ArrayList;
/**
* Simple locked listener implementation stub to be used for listener handler,
* synchronized on it's instance.
- *
+ *
* <p>Utilizing simple locking via synchronized.</p>
- *
+ *
* @param <E> The listener type
*/
public class ListenerSyncedImplStub<E> {
@@ -48,7 +48,7 @@ public class ListenerSyncedImplStub<E> {
public synchronized final void reset() {
listeners = new ArrayList<E>();
}
-
+
public synchronized final void destroy() {
listeners.clear();
listeners = null;
@@ -57,7 +57,7 @@ public class ListenerSyncedImplStub<E> {
public synchronized final int size() {
return listeners.size();
}
-
+
public synchronized final void addListener(E listener) {
addListener(-1, listener);
}
@@ -68,12 +68,12 @@ public class ListenerSyncedImplStub<E> {
}
listeners.add(index, listener);
}
-
+
public synchronized final void removeListener(E listener) {
listeners.remove(listener);
}
public final ArrayList<E> getListeners() {
return listeners;
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/opengl/MemoryObject.java b/src/jogl/classes/jogamp/opengl/MemoryObject.java
index df793da..d107476 100644
--- a/src/jogl/classes/jogamp/opengl/MemoryObject.java
+++ b/src/jogl/classes/jogamp/opengl/MemoryObject.java
@@ -59,10 +59,12 @@ public class MemoryObject {
/**
* @return the 32bit hash value generated via {@link HashUtil#getAddrSizeHash32_EqualDist(long, long)}.
*/
+ @Override
public int hashCode() {
return hash;
}
+ @Override
public String toString() {
return "MemoryObject[addr 0x"+Long.toHexString(addr)+", size 0x"+Long.toHexString(size)+", hash32: 0x"+Integer.toHexString(hash)+"]";
}
diff --git a/src/jogl/classes/jogamp/opengl/ProjectFloat.java b/src/jogl/classes/jogamp/opengl/ProjectFloat.java
index 439ddc7..d4fd1c9 100644
--- a/src/jogl/classes/jogamp/opengl/ProjectFloat.java
+++ b/src/jogl/classes/jogamp/opengl/ProjectFloat.java
@@ -6,9 +6,9 @@
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
-**
+**
** http://oss.sgi.com/projects/FreeB
-**
+**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
@@ -24,13 +24,13 @@
** except that Section 2.2 and 11 are omitted. Any differences between
** the Alternative License and the SGI License are offered solely by Sun
** and not by SGI.
-**
+**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
-**
+**
** Additional Notice Provisions: The application programming interfaces
** established by SGI in conjunction with the Original Code are The
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -45,34 +45,34 @@
** $Header$
*/
-/*
+/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
+ * modification, are permitted provided that the following conditions are
* met:
- *
- * * Redistributions of source code must retain the above copyright
+ *
+ * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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
+ * 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.
*/
@@ -80,22 +80,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2011 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
@@ -108,7 +108,7 @@
* 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.
@@ -129,14 +129,14 @@ import com.jogamp.opengl.math.FloatUtil;
* <p>
* Created 11-jan-2004
* </p>
- *
+ *
* @author Erik Duijs
* @author Kenneth Russell
* @author Sven Gothel
*/
public class ProjectFloat {
public static final int getRequiredFloatBufferSize() { return 1*16; }
-
+
// Note that we have cloned parts of the implementation in order to
// support incoming Buffers. The reason for this is to avoid loading
// non-direct buffer subclasses unnecessarily, because doing so can
@@ -162,22 +162,22 @@ public class ProjectFloat {
public ProjectFloat() {
this(true);
}
-
+
public ProjectFloat(boolean useBackingArray) {
- this(useBackingArray ? null : Buffers.newDirectByteBuffer(getRequiredFloatBufferSize() * Buffers.SIZEOF_FLOAT),
- useBackingArray ? new float[getRequiredFloatBufferSize()] : null,
+ this(useBackingArray ? null : Buffers.newDirectByteBuffer(getRequiredFloatBufferSize() * Buffers.SIZEOF_FLOAT),
+ useBackingArray ? new float[getRequiredFloatBufferSize()] : null,
0);
}
/**
* @param floatBuffer source buffer, may be ByteBuffer (recommended) or FloatBuffer or <code>null</code>.
- * If used, shall be ≥ {@link #getRequiredFloatBufferSize()} + floatOffset.
+ * If used, shall be ≥ {@link #getRequiredFloatBufferSize()} + floatOffset.
* Buffer's position is ignored and floatPos is being used.
* @param floatArray source float array or <code>null</code>.
* If used, size shall be ≥ {@link #getRequiredFloatBufferSize()} + floatOffset.
* @param floatOffset Offset for either of the given sources (buffer or array)
*/
- public ProjectFloat(Buffer floatBuffer, float[] floatArray, int floatOffset) {
+ public ProjectFloat(Buffer floatBuffer, float[] floatArray, int floatOffset) {
matrixBuf = Buffers.slice2Float(floatBuffer, floatArray, floatOffset, 16);
}
@@ -259,7 +259,7 @@ public class ProjectFloat {
/**
* @param src
* @param inverse
- *
+ *
* @return
*/
public boolean gluInvertMatrixf(FloatBuffer src, FloatBuffer inverse) {
@@ -268,7 +268,7 @@ public class ProjectFloat {
final int srcPos = src.position();
final int invPos = inverse.position();
-
+
final float[][] temp = tempInvertMatrix;
for (i = 0; i < 4; i++) {
@@ -297,7 +297,7 @@ public class ProjectFloat {
t = temp[i][k];
temp[i][k] = temp[swap][k];
temp[swap][k] = t;
-
+
t = inverse.get(i*4+k + invPos);
inverse.put(i*4+k + invPos, inverse.get(swap*4+k + invPos));
inverse.put(swap*4+k + invPos, t);
@@ -335,7 +335,7 @@ public class ProjectFloat {
/**
* Method gluOrtho2D.
- *
+ *
* @param left
* @param right
* @param bottom
@@ -347,7 +347,7 @@ public class ProjectFloat {
/**
* Method gluPerspective.
- *
+ *
* @param fovy
* @param aspect
* @param zNear
@@ -380,7 +380,7 @@ public class ProjectFloat {
/**
* Method gluLookAt
- *
+ *
* @param eyex
* @param eyey
* @param eyez
@@ -436,7 +436,7 @@ public class ProjectFloat {
/**
* Map object coordinates to window coordinates.
- *
+ *
* @param objx
* @param objy
* @param objz
@@ -444,7 +444,7 @@ public class ProjectFloat {
* @param projMatrix
* @param viewport
* @param win_pos
- *
+ *
* @return
*/
public boolean gluProject(float objx, float objy, float objz,
@@ -518,13 +518,13 @@ public class ProjectFloat {
win_pos[0+win_pos_offset] = in[0] * viewport[2+viewport_offset] + viewport[0+viewport_offset];
win_pos[1+win_pos_offset] = in[1] * viewport[3+viewport_offset] + viewport[1+viewport_offset];
win_pos[2+win_pos_offset] = in[2];
-
+
return true;
}
-
+
/**
* Map object coordinates to window coordinates.
- *
+ *
* @param objx
* @param objy
* @param objz
@@ -532,7 +532,7 @@ public class ProjectFloat {
* @param projMatrix
* @param viewport
* @param win_pos
- *
+ *
* @return
*/
public boolean gluProject(float objx, float objy, float objz,
@@ -576,7 +576,7 @@ public class ProjectFloat {
/**
* Map window coordinates to object coordinates.
- *
+ *
* @param winx
* @param winy
* @param winz
@@ -584,7 +584,7 @@ public class ProjectFloat {
* @param projMatrix
* @param viewport
* @param obj_pos
- *
+ *
* @return
*/
public boolean gluUnProject(float winx, float winy, float winz,
@@ -633,7 +633,7 @@ public class ProjectFloat {
/**
* Map window coordinates to object coordinates.
- *
+ *
* @param winx
* @param winy
* @param winz
@@ -646,7 +646,7 @@ public class ProjectFloat {
* @return
*/
public boolean gluUnProject(float winx, float winy, float winz,
- FloatBuffer modelMatrix,
+ FloatBuffer modelMatrix,
FloatBuffer projMatrix,
int[] viewport, int viewport_offset,
float[] obj_pos, int obj_pos_offset) {
@@ -674,7 +674,7 @@ public class ProjectFloat {
in[2] = in[2] * 2 - 1;
FloatUtil.multMatrixVecf(matrixBuf, in, out);
-
+
if (out[3] == 0.0) {
return false;
}
@@ -687,10 +687,10 @@ public class ProjectFloat {
return true;
}
-
+
/**
* Map window coordinates to object coordinates.
- *
+ *
* @param winx
* @param winy
* @param winz
@@ -698,11 +698,11 @@ public class ProjectFloat {
* @param projMatrix
* @param viewport
* @param obj_pos
- *
+ *
* @return
*/
public boolean gluUnProject(float winx, float winy, float winz,
- FloatBuffer modelMatrix,
+ FloatBuffer modelMatrix,
FloatBuffer projMatrix,
IntBuffer viewport,
FloatBuffer obj_pos) {
@@ -722,7 +722,7 @@ public class ProjectFloat {
// Map x and y from window coordinates
final int vPos = viewport.position();
- final int oPos = obj_pos.position();
+ final int oPos = obj_pos.position();
in[0] = (in[0] - viewport.get(0+vPos)) / viewport.get(2+vPos);
in[1] = (in[1] - viewport.get(1+vPos)) / viewport.get(3+vPos);
@@ -749,7 +749,7 @@ public class ProjectFloat {
/**
* Map window coordinates to object coordinates.
- *
+ *
* @param winx
* @param winy
* @param winz
@@ -760,7 +760,7 @@ public class ProjectFloat {
* @param near
* @param far
* @param obj_pos
- *
+ *
* @return
*/
public boolean gluUnProject4(float winx,
@@ -815,7 +815,7 @@ public class ProjectFloat {
/**
* Map window coordinates to object coordinates.
- *
+ *
* @param winx
* @param winy
* @param winz
@@ -826,7 +826,7 @@ public class ProjectFloat {
* @param near
* @param far
* @param obj_pos
- *
+ *
* @return
*/
public boolean gluUnProject4(float winx,
@@ -857,7 +857,7 @@ public class ProjectFloat {
in[0] = (in[0] - viewport.get(0+vPos)) / viewport.get(2+vPos);
in[1] = (in[1] - viewport.get(1+vPos)) / viewport.get(3+vPos);
in[2] = (in[2] - near) / (far - near);
-
+
// Map to range -1 to 1
in[0] = in[0] * 2 - 1;
in[1] = in[1] * 2 - 1;
@@ -873,14 +873,14 @@ public class ProjectFloat {
obj_pos.put(0+oPos, out[0]);
obj_pos.put(1+oPos, out[1]);
obj_pos.put(2+oPos, out[2]);
- obj_pos.put(3+oPos, out[3]);
+ obj_pos.put(3+oPos, out[3]);
return true;
}
/**
* Method gluPickMatrix
- *
+ *
* @param x
* @param y
* @param deltaX
@@ -907,7 +907,7 @@ public class ProjectFloat {
/**
* Method gluPickMatrix
- *
+ *
* @param x
* @param y
* @param deltaX
diff --git a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java
index f454904..283ecdb 100644
--- a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java
+++ b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java
@@ -49,21 +49,33 @@ public class SharedResourceRunner implements Runnable {
public static interface Implementation {
/**
- * @param connection for creation a {@link AbstractGraphicsDevice} instance.
- * @return <code>true</code> if the device supports all protocols required for the implementation, otherwise <code>false</code>.
+ * <p>
+ * Called within synchronized block.
+ * </p>
+ * @param connection 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);
-
+
/**
- * @param connection for creation a {@link AbstractGraphicsDevice} instance.
- * @return A new shared resource instance
+ * <p>
+ * Called within synchronized block.
+ * </p>
+ * @param connection for creation a {@link AbstractGraphicsDevice} instance.
+ * @return A new shared resource instance
*/
Resource createSharedResource(String connection);
+
+ /** Called within synchronized block. */
void releaseSharedResource(Resource shared);
+ /** Called within synchronized block. */
void clear();
+ /** Called within synchronized block. */
Resource mapPut(String connection, Resource resource);
+ /** Called within synchronized block. */
Resource mapGet(String connection);
+ /** Called within synchronized block. */
Collection<Resource> mapValues();
}
@@ -71,108 +83,115 @@ public class SharedResourceRunner implements Runnable {
final Implementation impl;
Thread thread;
+ boolean running;
boolean ready;
- boolean released;
boolean shouldRelease;
String initConnection;
String releaseConnection;
- private boolean getDeviceTried(String connection) {
- synchronized (devicesTried) {
- return devicesTried.contains(connection);
- }
+ private boolean getDeviceTried(String connection) { // synchronized call
+ return devicesTried.contains(connection);
}
- private void addDeviceTried(String connection) {
- synchronized (devicesTried) {
- devicesTried.add(connection);
- }
+ private void addDeviceTried(String connection) { // synchronized call
+ devicesTried.add(connection);
}
- private void removeDeviceTried(String connection) {
- synchronized (devicesTried) {
- devicesTried.remove(connection);
- }
+ private void removeDeviceTried(String connection) { // synchronized call
+ devicesTried.remove(connection);
}
public SharedResourceRunner(Implementation impl) {
this.impl = impl;
resetState();
}
-
- private void resetState() {
+
+ private void resetState() { // synchronized call
devicesTried.clear();
thread = null;
ready = false;
- released = false;
+ running = false;
shouldRelease = false;
initConnection = null;
releaseConnection = null;
}
- /**
+ /**
* Start the shared resource runner thread, if not running.
* <p>
* Validate the thread upfront and release all related resource if it was killed.
* </p>
- *
+ *
* @return the shared resource runner thread.
*/
public Thread start() {
- if(null != thread && !thread.isAlive()) {
- // thread was killed unrecognized ..
- if (DEBUG) {
- System.err.println("SharedResourceRunner.start() - dead-old-thread cleanup - "+getThreadName());
+ synchronized (this) {
+ if(null != thread && !thread.isAlive()) {
+ // thread was killed unrecognized ..
+ if (DEBUG) {
+ System.err.println("SharedResourceRunner.start() - dead-old-thread cleanup - "+getThreadName());
+ }
+ releaseSharedResources();
+ thread = null;
+ running = false;
}
- releaseSharedResources();
- thread = null;
- }
- if(null == thread) {
- if (DEBUG) {
- System.err.println("SharedResourceRunner.start() - start new Thread - "+getThreadName());
+ if( null == thread ) {
+ if (DEBUG) {
+ System.err.println("SharedResourceRunner.start() - start new Thread - "+getThreadName());
+ }
+ resetState();
+ thread = new Thread(this, getThreadName()+"-SharedResourceRunner");
+ thread.setDaemon(true); // Allow JVM to exit, even if this one is running
+ thread.start();
+ while (!running) {
+ try {
+ this.wait();
+ } catch (InterruptedException ex) { }
+ }
}
- resetState();
- thread = new Thread(this, getThreadName()+"-SharedResourceRunner");
- thread.setDaemon(true); // Allow JVM to exit, even if this one is running
- thread.start();
}
return thread;
}
-
+
public void stop() {
- if(null != thread) {
- if (DEBUG) {
- System.err.println("SharedResourceRunner.stop() - "+getThreadName());
- }
- synchronized (this) {
- shouldRelease = true;
- this.notifyAll();
-
- while (!released) {
- try {
- this.wait();
- } catch (InterruptedException ex) {
+ synchronized (this) {
+ if(null != thread) {
+ if (DEBUG) {
+ System.err.println("SharedResourceRunner.stop() - "+getThreadName());
+ }
+ synchronized (this) {
+ shouldRelease = true;
+ this.notifyAll();
+
+ while (running) {
+ try {
+ this.wait();
+ } catch (InterruptedException ex) { }
}
}
}
}
}
-
+
public SharedResourceRunner.Resource getOrCreateShared(AbstractGraphicsDevice device) {
SharedResourceRunner.Resource sr = null;
if(null != device) {
- start();
- final String connection = device.getConnection();
- sr = impl.mapGet(connection);
- if (null == sr && !getDeviceTried(connection)) {
- addDeviceTried(connection);
- if (DEBUG) {
- System.err.println("SharedResourceRunner.getOrCreateShared() " + connection + ": trying - "+getThreadName());
- }
- if ( impl.isDeviceSupported(connection) ) {
- doAndWait(connection, null);
- sr = impl.mapGet(connection);
- }
- if (DEBUG) {
- System.err.println("SharedResourceRunner.getOrCreateShared() " + connection + ": "+ ( ( null != sr ) ? "success" : "failed" ) +" - "+getThreadName());
+ synchronized (this) {
+ start();
+ final String connection = device.getConnection();
+ sr = impl.mapGet(connection);
+ if (null == sr) {
+ if ( !getDeviceTried(connection) ) {
+ addDeviceTried(connection);
+ if (DEBUG) {
+ System.err.println("SharedResourceRunner.getOrCreateShared() " + connection + ": trying - "+getThreadName());
+ }
+ if ( impl.isDeviceSupported(connection) ) {
+ doAndWait(connection, null);
+ sr = impl.mapGet(connection);
+ }
+ if (DEBUG) {
+ System.err.println("SharedResourceRunner.getOrCreateShared() " + connection + ": "+ ( ( null != sr ) ? "success" : "failed" ) +" - "+getThreadName());
+ }
+ }
}
}
}
@@ -182,16 +201,18 @@ public class SharedResourceRunner implements Runnable {
public SharedResourceRunner.Resource releaseShared(AbstractGraphicsDevice device) {
SharedResourceRunner.Resource sr = null;
if(null != device) {
- String connection = device.getConnection();
- sr = impl.mapGet(connection);
- if (null != sr) {
- removeDeviceTried(connection);
- if (DEBUG) {
- System.err.println("SharedResourceRunner.releaseShared() " + connection + ": trying - "+getThreadName());
- }
- doAndWait(null, connection);
- if (DEBUG) {
- System.err.println("SharedResourceRunner.releaseShared() " + connection + ": done - "+getThreadName());
+ synchronized (this) {
+ final String connection = device.getConnection();
+ sr = impl.mapGet(connection);
+ if (null != sr) {
+ removeDeviceTried(connection);
+ if (DEBUG) {
+ System.err.println("SharedResourceRunner.releaseShared() " + connection + ": trying - "+getThreadName());
+ }
+ doAndWait(null, connection);
+ if (DEBUG) {
+ System.err.println("SharedResourceRunner.releaseShared() " + connection + ": done - "+getThreadName());
+ }
}
}
}
@@ -199,18 +220,17 @@ public class SharedResourceRunner implements Runnable {
}
private final void doAndWait(String initConnection, String releaseConnection) {
- // 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);
- }
synchronized (this) {
- while (!ready) {
+ // 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);
+ }
+ while (!ready && running) {
try {
this.wait();
- } catch (InterruptedException ex) {
- }
+ } catch (InterruptedException ex) { }
}
if (DEBUG) {
System.err.println("SharedResourceRunner.doAndWait() set command: " + initConnection + ", release: "+releaseConnection+" - "+threadName);
@@ -220,11 +240,10 @@ public class SharedResourceRunner implements Runnable {
this.notifyAll();
// wait until thread has init/released the device
- while (!ready || null != this.initConnection || null != this.releaseConnection) {
+ while ( running && ( !ready || null != this.initConnection || null != this.releaseConnection ) ) {
try {
this.wait();
- } catch (InterruptedException ex) {
- }
+ } catch (InterruptedException ex) { }
}
if (DEBUG) {
System.err.println("SharedResourceRunner.initializeAndWait END init: " + initConnection + ", release: "+releaseConnection+" - "+threadName);
@@ -233,6 +252,7 @@ public class SharedResourceRunner implements Runnable {
// done
}
+ @Override
public final void run() {
final String threadName = getThreadName();
@@ -241,6 +261,8 @@ public class SharedResourceRunner implements Runnable {
}
synchronized (this) {
+ running = true;
+
while (!shouldRelease) {
try {
// wait for stop or init
@@ -250,7 +272,7 @@ public class SharedResourceRunner implements Runnable {
}
notifyAll();
this.wait();
- } catch (InterruptedException ex) {
+ } catch (InterruptedException ex) {
shouldRelease = true;
if(DEBUG) {
System.err.println("SharedResourceRunner.run(): INTERRUPTED - "+threadName);
@@ -290,7 +312,7 @@ public class SharedResourceRunner implements Runnable {
} catch (Exception e) {
e.printStackTrace();
}
- }
+ }
}
}
initConnection = null;
@@ -308,16 +330,14 @@ public class SharedResourceRunner implements Runnable {
}
shouldRelease = false;
- released = true;
+ running = false;
thread = null;
notifyAll();
}
}
- private void releaseSharedResources() {
- synchronized (devicesTried) {
- devicesTried.clear();
- }
+ private void releaseSharedResources() { // synchronized call
+ devicesTried.clear();
Collection<Resource> sharedResources = impl.mapValues();
for (Iterator<Resource> iter = sharedResources.iterator(); iter.hasNext();) {
try {
diff --git a/src/jogl/classes/jogamp/opengl/ThreadingImpl.java b/src/jogl/classes/jogamp/opengl/ThreadingImpl.java
index d55a2c9..bf700d9 100644
--- a/src/jogl/classes/jogamp/opengl/ThreadingImpl.java
+++ b/src/jogl/classes/jogamp/opengl/ThreadingImpl.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2009 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.opengl;
@@ -49,14 +49,14 @@ import com.jogamp.common.util.ReflectionUtil;
public class ThreadingImpl {
public enum Mode {
- MT(0), ST_AWT(1), ST_WORKER(2);
-
+ MT(0), ST_AWT(1), ST_WORKER(2);
+
public final int id;
Mode(int id){
this.id = id;
}
- }
+ }
protected static final boolean DEBUG = Debug.debug("Threading");
@@ -68,10 +68,11 @@ public class ThreadingImpl {
private static boolean _isX11;
private static final ToolkitThreadingPlugin threadingPlugin;
-
+
static {
threadingPlugin =
AccessController.doPrivileged(new PrivilegedAction<ToolkitThreadingPlugin>() {
+ @Override
public ToolkitThreadingPlugin run() {
final String singleThreadProp;
{
@@ -94,7 +95,7 @@ public class ThreadingImpl {
// default setting
singleThreaded = true;
mode = ( hasAWT ? Mode.ST_AWT : Mode.ST_WORKER );
-
+
if (singleThreadProp != null) {
if (singleThreadProp.equals("true") ||
singleThreadProp.equals("auto")) {
@@ -113,7 +114,7 @@ public class ThreadingImpl {
throw new RuntimeException("Unsupported value for property jogl.1thread: "+singleThreadProp+", should be [true/auto, worker, awt or false]");
}
}
-
+
ToolkitThreadingPlugin threadingPlugin=null;
if(hasAWT) {
// try to fetch the AWTThreadingPlugin
@@ -139,9 +140,9 @@ 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
- multithreading option but the default behavior is single-threading,
- this API provides a mechanism for end users to disable single-threading
+ /** If an implementation of the javax.media.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
calling this method unless they are aware of all of the
consequences and are prepared to enforce some amount of
@@ -151,7 +152,7 @@ public class ThreadingImpl {
GLPbuffer. Currently there is no supported way to re-enable it
once disabled, partly to discourage careless use of this
method. This method should be called as early as possible in an
- application. */
+ application. */
public static final void disableSingleThreading() {
singleThreaded = false;
if (Debug.verbose()) {
@@ -183,7 +184,7 @@ public class ThreadingImpl {
throw new InternalError("Illegal single-threading mode " + mode);
}
}
-
+
public static final boolean isToolkitThread() throws GLException {
if(null!=threadingPlugin) {
return threadingPlugin.isToolkitThread();
@@ -215,7 +216,7 @@ public class ThreadingImpl {
throw new InternalError("Illegal single-threading mode " + mode);
}
}
-
+
public static final void invokeOnWorkerThread(boolean wait, Runnable r) throws GLException {
GLWorkerThread.start(); // singleton start via volatile-dbl-checked-locking
try {
@@ -224,6 +225,6 @@ public class ThreadingImpl {
throw new GLException(e.getTargetException());
} catch (InterruptedException e) {
throw new GLException(e);
- }
+ }
}
}
diff --git a/src/jogl/classes/jogamp/opengl/ToolkitThreadingPlugin.java b/src/jogl/classes/jogamp/opengl/ToolkitThreadingPlugin.java
index 2297295..06fb0fe 100644
--- a/src/jogl/classes/jogamp/opengl/ToolkitThreadingPlugin.java
+++ b/src/jogl/classes/jogamp/opengl/ToolkitThreadingPlugin.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -46,7 +46,7 @@ public interface ToolkitThreadingPlugin {
/** Indicates whether the current thread is the designated toolkit thread,
if such semantics exists. */
public boolean isToolkitThread() throws GLException;
-
+
/** Indicates whether the current thread is the thread on
which this implementation of the javax.media.opengl APIs
performs all of its OpenGL-related work. This method should only
diff --git a/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java b/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java
index 8356a2b..25a0bc1 100644
--- a/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java
+++ b/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -28,12 +28,17 @@
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.common.os.AndroidVersion;
import com.jogamp.common.os.Platform;
+import com.jogamp.opengl.util.TimeFrameI;
+import com.jogamp.opengl.util.av.GLMediaPlayer;
+import com.jogamp.opengl.util.texture.Texture;
import com.jogamp.opengl.util.texture.TextureSequence;
import jogamp.common.os.android.StaticContext;
@@ -41,7 +46,9 @@ import jogamp.opengl.util.av.GLMediaPlayerImpl;
import android.graphics.SurfaceTexture;
import android.graphics.SurfaceTexture.OnFrameAvailableListener;
+import android.hardware.Camera;
import android.media.MediaPlayer;
+import android.media.MediaPlayer.OnCompletionListener;
import android.net.Uri;
import android.view.Surface;
@@ -49,6 +56,11 @@ import android.view.Surface;
* Android implementation utilizes API level 14 (4.0.? ICS) features
* as listed below.
* <p>
+ * Implementation is single threaded only, since we are not able to utilize multiple textures.
+ * We would need to add an implementation for API level 16 using MediaCodec/MediaExtractor
+ * to expose multithreading on multiple surface/textures.
+ * </p>
+ * <p>
* We utilize the {@link MediaPlayer} with direct to texture streaming.
* The MediaPlayer uses <code>libstagefright</code> to access the OpenMAX AL implementation
* for hardware decoding.
@@ -57,10 +69,16 @@ import android.view.Surface;
* <li>Android API Level 14: {@link MediaPlayer#setSurface(Surface)}</li>
* <li>Android API Level 14: {@link Surface#Surface(android.graphics.SurfaceTexture)}</li>
* </ul>
+ * <p>
+ * Since the MediaPlayer API can only deal w/ <i>one</i> SurfaceTexture,
+ * we enforce <code>textureCount</code> = 2 via {@link #validateTextureCount(int)}
+ * and duplicate the single texture via {@link #createTexFrames(GL, int)} .. etc.
+ * Two instanceds of TextureFrame are required due our framework implementation w/ Ringbuffer and 'lastFrame' access.
+ * </p>
*/
public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl {
static final boolean available;
-
+
static {
boolean _avail = false;
if(Platform.OS_TYPE.equals(Platform.OSType.ANDROID)) {
@@ -70,40 +88,44 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl {
}
available = _avail;
}
-
+
public static final boolean isAvailable() { return available; }
-
- MediaPlayer mp;
- volatile boolean updateSurface = false;
- Object updateSurfaceLock = new Object();
- TextureSequence.TextureFrame lastTexFrame = null;
+
+ private MediaPlayer mp;
+ private Camera cam;
+ private long playStart = 0;
+ private volatile boolean updateSurface = false;
+ private final Object updateSurfaceLock = new Object();
+ private SurfaceTextureFrame singleSTexFrame = null;
+ private int sTexFrameCount = 0;
+ private boolean sTexFrameAttached = false;
+ private volatile boolean eos = false;
/**
private static String toString(MediaPlayer m) {
if(null == m) return "<nil>";
return "MediaPlayer[playing "+m.isPlaying()+", pos "+m.getCurrentPosition()/1000.0f+"s, "+m.getVideoWidth()+"x"+m.getVideoHeight()+"]";
} */
-
+
public AndroidGLMediaPlayerAPI14() {
super();
if(!available) {
throw new RuntimeException("AndroidGLMediaPlayerAPI14 not available");
}
this.setTextureTarget(GLES2.GL_TEXTURE_EXTERNAL_OES);
- this.setTextureCount(1);
- mp = new MediaPlayer();
}
@Override
- protected boolean setPlaySpeedImpl(float rate) {
+ protected final boolean setPlaySpeedImpl(float rate) {
+ // FIXME
return false;
}
@Override
- protected boolean startImpl() {
- if(null != mp) {
+ protected final boolean setAudioVolumeImpl(float v) {
+ if(null != mp) {
try {
- mp.start();
+ mp.setVolume(v, v);
return true;
} catch (IllegalStateException ise) {
if(DEBUG) {
@@ -115,11 +137,24 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl {
}
@Override
- protected boolean pauseImpl() {
+ protected final boolean playImpl() {
+ playStart = Platform.currentTimeMillis();
if(null != mp) {
- wakeUp(false);
try {
- mp.pause();
+ mp.start();
+ eos = false;
+ mp.setOnCompletionListener(onCompletionListener);
+ return true;
+ } catch (IllegalStateException ise) {
+ if(DEBUG) {
+ ise.printStackTrace();
+ }
+ }
+ } else if( null != cam ) {
+ try {
+ if( sTexFrameAttached ) {
+ cam.startPreview();
+ }
return true;
} catch (IllegalStateException ise) {
if(DEBUG) {
@@ -131,11 +166,21 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl {
}
@Override
- protected boolean stopImpl() {
+ protected final boolean pauseImpl() {
if(null != mp) {
wakeUp(false);
try {
- mp.stop();
+ mp.pause();
+ return true;
+ } catch (IllegalStateException ise) {
+ if(DEBUG) {
+ ise.printStackTrace();
+ }
+ }
+ } else if( null != cam ) {
+ wakeUp(false);
+ try {
+ cam.stopPreview();
return true;
} catch (IllegalStateException ise) {
if(DEBUG) {
@@ -145,9 +190,9 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl {
}
return false;
}
-
+
@Override
- protected int seekImpl(int msec) {
+ protected final int seekImpl(int msec) {
if(null != mp) {
mp.seekTo(msec);
return mp.getCurrentPosition();
@@ -155,40 +200,6 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl {
return 0;
}
- @Override
- protected TextureSequence.TextureFrame getLastTextureImpl() {
- return lastTexFrame;
- }
-
- @Override
- protected TextureSequence.TextureFrame getNextTextureImpl(GL gl, boolean blocking) {
- if(null != stex && null != mp) {
- // Only block once, no while-loop.
- // This relaxes locking code of non crucial resources/events.
- boolean update = updateSurface;
- if(!update && blocking) {
- synchronized(updateSurfaceLock) {
- if(!updateSurface) { // volatile OK.
- try {
- updateSurfaceLock.wait();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- updateSurface = false;
- update = true;
- }
- }
- if(update) {
- stex.updateTexImage();
- // stex.getTransformMatrix(atex.getSTMatrix());
- lastTexFrame=texFrames[0];
- }
-
- }
- return lastTexFrame;
- }
-
private void wakeUp(boolean newFrame) {
synchronized(updateSurfaceLock) {
if(newFrame) {
@@ -197,29 +208,80 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl {
updateSurfaceLock.notifyAll();
}
}
-
+
@Override
- protected int getCurrentPositionImpl() {
- return null != mp ? mp.getCurrentPosition() : 0;
- }
+ protected final int getAudioPTSImpl() { return null != mp ? mp.getCurrentPosition() : 0; }
@Override
- protected void destroyImpl(GL gl) {
+ protected final void destroyImpl(GL gl) {
if(null != mp) {
wakeUp(false);
+ try {
+ mp.stop();
+ } catch (IllegalStateException ise) {
+ if(DEBUG) {
+ ise.printStackTrace();
+ }
+ }
mp.release();
mp = null;
}
+ if( null != cam ) {
+ wakeUp(false);
+ try {
+ cam.stopPreview();
+ } catch (IllegalStateException ise) {
+ if(DEBUG) {
+ ise.printStackTrace();
+ }
+ }
+ cam.release();
+ cam = null;
+ }
}
-
- SurfaceTexture stex = null;
-
+
+ public static class SurfaceTextureFrame extends TextureSequence.TextureFrame {
+ public SurfaceTextureFrame(Texture t, SurfaceTexture stex) {
+ super(t);
+ this.surfaceTex = stex;
+ }
+
+ public String toString() {
+ return "SurfaceTextureFrame[pts " + pts + " ms, l " + duration + " ms, texID "+ texture.getTextureObject() + ", " + surfaceTex + "]";
+ }
+ public final SurfaceTexture surfaceTex;
+ }
+
@Override
- protected void initGLStreamImpl(GL gl, int[] texNames) throws IOException {
- if(null!=mp && null!=urlConn) {
+ protected final void initStreamImpl(final int vid, final int aid) throws IOException {
+ if( null == streamLoc ) {
+ return;
+ }
+ if( null == mp && null == cam ) {
+ if( null == cameraPath ) {
+ mp = new MediaPlayer();
+ } else {
+ int cameraId = 0;
+ try {
+ cameraId = Integer.valueOf(cameraPath);
+ } catch (NumberFormatException nfe) {}
+ if( 0 <= cameraId && cameraId < Camera.getNumberOfCameras() ) {
+ cam = Camera.open(cameraId);
+ } else {
+ cam = Camera.open();
+ }
+ }
+ }
+
+ if(null!=mp) {
+ if( GLMediaPlayer.STREAM_ID_NONE == aid ) {
+ mp.setVolume(0f, 0f);
+ // FIXME: Disable audio handling
+ } // else FIXME: Select aid !
+ // Note: Both FIXMEs seem to be n/a via Android's MediaPlayer -> Switch to API level 16 MediaCodec/MediaExtractor ..
try {
- final Uri uri = Uri.parse(urlConn.getURL().toExternalForm());
- mp.setDataSource(StaticContext.getContext(), uri);
+ final Uri _uri = Uri.parse(streamLoc.toString());
+ mp.setDataSource(StaticContext.getContext(), _uri);
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (SecurityException e) {
@@ -227,44 +289,206 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl {
} catch (IllegalStateException e) {
throw new RuntimeException(e);
}
- stex = new SurfaceTexture(texNames[0]); // only 1 texture
- stex.setOnFrameAvailableListener(onFrameAvailableListener);
- final Surface surf = new Surface(stex);
- mp.setSurface(surf);
- surf.release();
+ mp.setSurface(null);
try {
mp.prepare();
} catch (IOException ioe) {
- throw new IOException("MediaPlayer failed to process stream <"+urlConn.getURL().toExternalForm()+">: "+ioe.getMessage(), ioe);
+ throw new IOException("MediaPlayer failed to process stream <"+streamLoc.toString()+">: "+ioe.getMessage(), ioe);
+ }
+ final int r_aid = GLMediaPlayer.STREAM_ID_NONE == aid ? GLMediaPlayer.STREAM_ID_NONE : 1 /* fake */;
+ final String icodec = "android";
+ updateAttributes(0 /* fake */, r_aid,
+ mp.getVideoWidth(), mp.getVideoHeight(), 0,
+ 0, 0, 0f,
+ 0, 0, mp.getDuration(), icodec, icodec);
+ /**
+ mp.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
+ @Override
+ public void onPrepared(final MediaPlayer mp) {
+ final int r_aid = GLMediaPlayer.STREAM_ID_NONE == aid ? GLMediaPlayer.STREAM_ID_NONE : 1; // fake
+ final String icodec = "android";
+ updateAttributes(0, r_aid, // fake
+ mp.getVideoWidth(), mp.getVideoHeight(), 0,
+ 0, 0, 0f,
+ 0, 0, mp.getDuration(), icodec, icodec);
+ }
+ });
+ mp.prepareAsync();
+ *
+ */
+ } else if( null != cam ) {
+ final String icodec = "android";
+ final int[] fpsRange = { 0, 0 };
+ final Camera.Parameters p = cam.getParameters();
+ p.getPreviewFpsRange(fpsRange);
+ final Camera.Size size = p.getPreviewSize();
+ if( DEBUG ) {
+ final int picFmt = p.getPictureFormat();
+ final Camera.Size prefSize = p.getPreferredPreviewSizeForVideo();
+ System.err.println("MediaPlayer.Camera: fps "+fpsRange[0]+".."+fpsRange[1]+", size[pref "+camSz2Str(prefSize)+", cur "+camSz2Str(size)+"], fmt "+picFmt);
+ final List<Camera.Size> supSizes = p.getSupportedVideoSizes();
+ if( null != supSizes ) {
+ for(int i=0; i<supSizes.size(); i++) {
+ System.err.println("size #"+i+": "+camSz2Str(supSizes.get(i)));
+ }
+ }
+ }
+ updateAttributes(0 /* fake */, GLMediaPlayer.STREAM_ID_NONE,
+ size.width, size.height,
+ 0, 0, 0,
+ fpsRange[1]/1000f,
+ 0, 0, 0, icodec, icodec);
+ }
+ }
+ private static String camSz2Str(Camera.Size csize) {
+ if( null != csize ) {
+ return csize.width+"x"+csize.height;
+ } else {
+ return "n/a";
+ }
+ }
+ @Override
+ protected final void initGLImpl(GL gl) throws IOException, GLException {
+ // NOP
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Returns {@link #TEXTURE_COUNT_MIN}, using a single texture
+ * </p>
+ */
+ @Override
+ protected int validateTextureCount(int desiredTextureCount) {
+ return TEXTURE_COUNT_MIN;
+ }
+
+ @Override
+ protected final int getNextTextureImpl(GL gl, TextureFrame nextFrame) {
+ int pts = TimeFrameI.INVALID_PTS;
+ if(null != mp || null != cam) {
+ final SurfaceTextureFrame sTexFrame = null != nextFrame ? (SurfaceTextureFrame) nextFrame : singleSTexFrame;
+ final SurfaceTexture surfTex = sTexFrame.surfaceTex;
+ if( !sTexFrameAttached ) {
+ sTexFrameAttached = true;
+ final Surface surface;
+ if( null != mp ) {
+ surface = new Surface(sTexFrame.surfaceTex);
+ mp.setSurface(surface);
+ } else {
+ surface = null;
+ try {
+ cam.setPreviewTexture(sTexFrame.surfaceTex);
+ cam.startPreview();
+ } catch (IOException ioe) {
+ throw new RuntimeException("MediaPlayer failed to process stream <"+streamLoc.toString()+">: "+ioe.getMessage(), ioe);
+ }
+ }
+ if( null != surface ) {
+ surface.release();
+ }
+ surfTex.setOnFrameAvailableListener(onFrameAvailableListener);
}
- updateAttributes(mp.getVideoWidth(), mp.getVideoHeight(),
- 0, 0, 0,
- 0f, 0, mp.getDuration(),
- null, null);
+ if( eos || (null != mp && !mp.isPlaying() ) ) {
+ eos = true;
+ pts = TimeFrameI.END_OF_STREAM_PTS;
+ } else {
+ // Only block once, no while-loop.
+ // This relaxes locking code of non crucial resources/events.
+ boolean update = updateSurface;
+ if( !update ) {
+ synchronized(updateSurfaceLock) {
+ if(!updateSurface) { // volatile OK.
+ try {
+ updateSurfaceLock.wait();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ update = updateSurface;
+ updateSurface = false;
+ }
+ }
+ if(update) {
+ surfTex.updateTexImage();
+ // nextFrame.setPTS( (int) ( nextSTex.getTimestamp() / 1000000L ) ); // nano -9 -> milli -3
+ if( null != mp ) {
+ pts = mp.getCurrentPosition();
+ } else {
+ pts = (int) ( Platform.currentTimeMillis() - playStart );
+ }
+ // stex.getTransformMatrix(atex.getSTMatrix());
+ }
+ }
+ nextFrame.setPTS( pts );
}
+ return pts;
}
-
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Creates only one single texture and duplicated content to 2 TextureFrames
+ * </p>
+ */
@Override
- protected TextureSequence.TextureFrame createTexImage(GL gl, int idx, int[] tex) {
- lastTexFrame = new TextureSequence.TextureFrame( createTexImageImpl(gl, idx, tex, width, height, true) );
- return lastTexFrame;
+ protected TextureFrame[] createTexFrames(GL gl, final int count) {
+ final int[] texNames = new int[1];
+ gl.glGenTextures(1, texNames, 0);
+ final int err = gl.glGetError();
+ if( GL.GL_NO_ERROR != err ) {
+ throw new RuntimeException("TextureNames creation failed (num: 1/"+count+"): err "+toHexString(err));
+ }
+ final TextureFrame[] texFrames = new TextureFrame[count];
+ for(int i=0; i<count; i++) {
+ texFrames[i] = createTexImage(gl, texNames[0]);
+ }
+ return texFrames;
+ }
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Returns the single texture, which is created at 1st call.
+ * </p>
+ */
+ @Override
+ protected final TextureSequence.TextureFrame createTexImage(GL gl, int texName) {
+ sTexFrameCount++;
+ if( 1 == sTexFrameCount ) {
+ singleSTexFrame = new SurfaceTextureFrame( createTexImageImpl(gl, texName, width, height), new SurfaceTexture(texName) );
+ }
+ return singleSTexFrame;
}
-
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Destroys the single texture at last call.
+ * </p>
+ */
@Override
- protected void destroyTexImage(GL gl, TextureSequence.TextureFrame imgTex) {
- if(null != stex) {
- stex.release();
- stex = null;
+ protected final void destroyTexFrame(GL gl, TextureSequence.TextureFrame frame) {
+ sTexFrameCount--;
+ if( 0 == sTexFrameCount ) {
+ singleSTexFrame = null;
+ sTexFrameAttached = false;
+ final SurfaceTextureFrame sFrame = (SurfaceTextureFrame) frame;
+ sFrame.surfaceTex.release();
+ super.destroyTexFrame(gl, frame);
}
- lastTexFrame = null;
- super.destroyTexImage(gl, imgTex);
}
-
- protected OnFrameAvailableListener onFrameAvailableListener = new OnFrameAvailableListener() {
+
+ private final OnFrameAvailableListener onFrameAvailableListener = new OnFrameAvailableListener() {
@Override
public void onFrameAvailable(SurfaceTexture surfaceTexture) {
wakeUp(true);
- AndroidGLMediaPlayerAPI14.this.newFrameAvailable();
- }
- };
+ }
+ };
+
+ private final OnCompletionListener onCompletionListener = new OnCompletionListener() {
+ @Override
+ public void onCompletion(MediaPlayer mp) {
+ eos = true;
+ }
+ };
}
diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java b/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java
index 56f00b3..72c9ac5 100644
--- a/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java
+++ b/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -54,10 +54,12 @@ public class AWTThreadingPlugin implements ToolkitThreadingPlugin {
public AWTThreadingPlugin() {}
+ @Override
public final boolean isToolkitThread() throws GLException {
return EventQueue.isDispatchThread();
}
-
+
+ @Override
public final boolean isOpenGLThread() throws GLException {
switch (ThreadingImpl.getMode()) {
case ST_AWT:
@@ -83,6 +85,7 @@ public class AWTThreadingPlugin implements ToolkitThreadingPlugin {
}
}
+ @Override
public final void invokeOnOpenGLThread(boolean wait, Runnable r) throws GLException {
switch (ThreadingImpl.getMode()) {
case ST_AWT:
diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java
new file mode 100644
index 0000000..ff07b04
--- /dev/null
+++ b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java
@@ -0,0 +1,389 @@
+/**
+ * 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.
+ */
+package jogamp.opengl.awt;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.Shape;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.NoninvertibleTransformException;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
+import java.awt.image.DataBufferInt;
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Iterator;
+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 jogamp.opengl.Debug;
+
+import com.jogamp.opengl.util.TileRenderer;
+import com.jogamp.opengl.util.TileRendererBase;
+import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes;
+import com.jogamp.opengl.util.awt.AWTGLPixelBuffer;
+import com.jogamp.opengl.util.awt.AWTGLPixelBuffer.AWTGLPixelBufferProvider;
+
+/**
+ * Implementing AWT {@link Graphics2D} based {@link TileRenderer} <i>painter</i>.
+ * <p>
+ * Maybe utilized for AWT printing.
+ * </p>
+ */
+public class AWTTilePainter {
+ private static final boolean DEBUG_TILES = Debug.debug("TileRenderer.PNG");
+
+ public final TileRenderer renderer;
+ public final int componentCount;
+ public final double scaleMatX, scaleMatY;
+ public final int customTileWidth, customTileHeight, customNumSamples;
+ public final boolean verbose;
+
+ public boolean flipVertical;
+ private AWTGLPixelBuffer tBuffer = null;
+ private BufferedImage vFlipImage = null;
+ private Graphics2D g2d = null;
+ private AffineTransform saveAT = null;
+
+ public static void dumpHintsAndScale(Graphics2D g2d) {
+ final RenderingHints rHints = g2d.getRenderingHints();
+ final Set<Entry<Object, Object>> rEntries = rHints.entrySet();
+ int count = 0;
+ for(Iterator<Entry<Object, Object>> rEntryIter = rEntries.iterator(); rEntryIter.hasNext(); count++) {
+ final Entry<Object, Object> rEntry = rEntryIter.next();
+ System.err.println("Hint["+count+"]: "+rEntry.getKey()+" -> "+rEntry.getValue());
+ }
+ final AffineTransform aTrans = g2d.getTransform();
+ if( null != aTrans ) {
+ System.err.println(" type "+aTrans.getType());
+ System.err.println(" scale "+aTrans.getScaleX()+" x "+aTrans.getScaleY());
+ System.err.println(" move "+aTrans.getTranslateX()+" x "+aTrans.getTranslateY());
+ System.err.println(" mat "+aTrans);
+ } else {
+ System.err.println(" null transform");
+ }
+ }
+
+ /**
+ * @return resulting number of samples by comparing w/ {@link #customNumSamples} and the caps-config, 0 if disabled
+ */
+ public int getNumSamples(GLCapabilitiesImmutable caps) {
+ if( 0 > customNumSamples ) {
+ return 0;
+ } else if( 0 < customNumSamples ) {
+ if ( !caps.getGLProfile().isGL2ES3() ) {
+ return 0;
+ }
+ return Math.max(caps.getNumSamples(), customNumSamples);
+ } else {
+ return caps.getNumSamples();
+ }
+ }
+
+ /**
+ * Assumes a configured {@link TileRenderer}, i.e.
+ * an {@link TileRenderer#attachAutoDrawable(GLAutoDrawable) attached}
+ * {@link GLAutoDrawable} with {@link TileRenderer#setTileSize(int, int, int) set tile size}.
+ * <p>
+ * Sets the renderer to {@link TileRenderer#TR_TOP_TO_BOTTOM} row order.
+ * </p>
+ * <p>
+ * <code>componentCount</code> reflects opaque, i.e. 4 if non opaque.
+ * </p>
+ * @param renderer
+ * @param componentCount
+ * @param scaleMatX {@link Graphics2D} {@link Graphics2D#scale(double, double) scaling factor}, i.e. rendering 1/scaleMatX * width pixels
+ * @param scaleMatY {@link Graphics2D} {@link Graphics2D#scale(double, double) scaling factor}, i.e. rendering 1/scaleMatY * height pixels
+ * @param numSamples custom multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples
+ * @param tileWidth custom tile width for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
+ * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
+ * @param verbose
+ */
+ public AWTTilePainter(TileRenderer renderer, int componentCount, double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight, boolean verbose) {
+ this.renderer = renderer;
+ this.renderer.setGLEventListener(preTileGLEL, postTileGLEL);
+ this.componentCount = componentCount;
+ this.scaleMatX = scaleMatX;
+ this.scaleMatY = scaleMatY;
+ this.customNumSamples = numSamples;
+ this.customTileWidth= tileWidth;
+ this.customTileHeight = tileHeight;
+ this.verbose = verbose;
+ this.flipVertical = true;
+ }
+
+ @Override
+ public String toString() { return renderer.toString(); }
+
+ public void setIsGLOriented(boolean v) {
+ flipVertical = v;
+ }
+
+ private static Rectangle2D getClipBounds2D(Graphics2D g) {
+ final Shape shape = g.getClip();
+ return null != shape ? shape.getBounds2D() : null;
+ }
+ private static Rectangle2D clipNegative(Rectangle2D in) {
+ if( null == in ) { return null; }
+ double x=in.getX(), y=in.getY(), width=in.getWidth(), height=in.getHeight();
+ if( 0 > x ) {
+ width += x;
+ x = 0;
+ }
+ if( 0 > y ) {
+ height += y;
+ y = 0;
+ }
+ return new Rectangle2D.Double(x, y, width, height);
+ }
+
+ /**
+ * Caches the {@link Graphics2D} instance for rendering.
+ * <p>
+ * Copies the current {@link Graphics2D} {@link AffineTransform}
+ * and scales {@link Graphics2D} w/ <code>scaleMatX</code> x <code>scaleMatY</code>.<br>
+ * After rendering, the {@link AffineTransform} should be reset via {@link #resetGraphics2D()}.
+ * </p>
+ * <p>
+ * Sets the {@link TileRenderer}'s {@link TileRenderer#setImageSize(int, int) image size}
+ * and {@link TileRenderer#setTileOffset(int, int) tile offset} according the
+ * the {@link Graphics2D#getClipBounds() graphics clip bounds}.
+ * </p>
+ * @param g2d Graphics2D instance used for transform and clipping
+ * @param width width of the AWT component in case clipping is null
+ * @param height height of the AWT component in case clipping is null
+ * @throws NoninvertibleTransformException if the {@link Graphics2D}'s {@link AffineTransform} {@link AffineTransform#invert() inversion} fails.
+ * Since inversion is tested before scaling the given {@link Graphics2D}, caller shall ignore the whole <i>term</i>.
+ */
+ public void setupGraphics2DAndClipBounds(Graphics2D g2d, int width, int height) throws NoninvertibleTransformException {
+ this.g2d = g2d;
+ saveAT = g2d.getTransform();
+ if( null == saveAT ) {
+ saveAT = new AffineTransform(); // use identity
+ }
+ // We use double precision for scaling
+ //
+ // Setup original rectangles
+ final Rectangle2D dClipOrigR = getClipBounds2D(g2d);
+ final Rectangle2D dClipOrig = clipNegative(dClipOrigR);
+ final Rectangle2D dImageSizeOrig = new Rectangle2D.Double(0, 0, width, height);
+
+ // Retrieve scaled image-size and clip-bounds
+ // Note: Clip bounds lie within image-size!
+ final Rectangle2D dImageSizeScaled, dClipScaled;
+ {
+ final AffineTransform scaledATI;
+ {
+ final AffineTransform scaledAT = new AffineTransform(saveAT);
+ scaledAT.scale(scaleMatX, scaleMatY);
+ scaledATI = scaledAT.createInverse(); // -> NoninvertibleTransformException
+ }
+ Shape s0 = saveAT.createTransformedShape(dImageSizeOrig); // user in
+ dImageSizeScaled = scaledATI.createTransformedShape(s0).getBounds2D(); // scaled out
+ if( null == dClipOrig ) {
+ dClipScaled = (Rectangle2D) dImageSizeScaled.clone();
+ } else {
+ s0 = saveAT.createTransformedShape(dClipOrig); // user in
+ dClipScaled = scaledATI.createTransformedShape(s0).getBounds2D(); // scaled out
+ }
+ }
+ final Rectangle iClipScaled = dClipScaled.getBounds();
+ final Rectangle iImageSizeScaled = dImageSizeScaled.getBounds();
+ renderer.setImageSize(iImageSizeScaled.width, iImageSizeScaled.height);
+ renderer.clipImageSize(iClipScaled.width, iClipScaled.height);
+ final int clipH = Math.min(iImageSizeScaled.height, iClipScaled.height);
+ // Clip bounds lie within image-size!
+ // GL y-offset is lower-left origin, AWT y-offset upper-left.
+ scaledYOffset = iClipScaled.y;
+ renderer.setTileOffset(iClipScaled.x, iImageSizeScaled.height - ( iClipScaled.y + clipH ));
+
+ // Scale actual Grahics2D matrix
+ g2d.scale(scaleMatX, scaleMatY);
+
+ if( verbose ) {
+ System.err.println("AWT print.0: image "+dImageSizeOrig + " -> " + dImageSizeScaled + " -> " + iImageSizeScaled);
+ System.err.println("AWT print.0: clip "+dClipOrigR + " -> " + dClipOrig + " -> " + dClipScaled + " -> " + iClipScaled);
+ System.err.println("AWT print.0: "+renderer);
+ }
+ }
+ private int scaledYOffset;
+
+ /** See {@ #setupGraphics2DAndClipBounds(Graphics2D)}. */
+ public void resetGraphics2D() {
+ g2d.setTransform(saveAT);
+ }
+
+ /**
+ * Disposes resources and {@link TileRenderer#detachAutoDrawable() detaches}
+ * the {@link TileRenderer}'s {@link GLAutoDrawable}.
+ */
+ public void dispose() {
+ renderer.detachAutoDrawable(); // tile-renderer -> printGLAD
+ g2d = null;
+ if( null != tBuffer ) {
+ tBuffer.dispose();
+ tBuffer = null;
+ }
+ if( null != vFlipImage ) {
+ vFlipImage.flush();
+ vFlipImage = null;
+ }
+ }
+
+ final GLEventListener preTileGLEL = new GLEventListener() {
+ @Override
+ public void init(GLAutoDrawable drawable) {}
+ @Override
+ public void dispose(GLAutoDrawable drawable) {}
+ @Override
+ public void display(GLAutoDrawable drawable) {
+ final GL gl = drawable.getGL();
+ if( null == tBuffer ) {
+ 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);
+ renderer.setTileBuffer(tBuffer);
+ if( flipVertical ) {
+ vFlipImage = new BufferedImage(tBuffer.width, tBuffer.height, tBuffer.image.getType());
+ } else {
+ vFlipImage = null;
+ }
+ }
+ if( verbose ) {
+ System.err.println("XXX tile-pre "+renderer);
+ }
+ }
+ @Override
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {}
+ };
+ static int _counter = 0;
+ final GLEventListener postTileGLEL = new GLEventListener() {
+ @Override
+ public void init(GLAutoDrawable drawable) {
+ }
+ @Override
+ public void dispose(GLAutoDrawable drawable) {}
+ @Override
+ public void display(GLAutoDrawable drawable) {
+ final DimensionImmutable cis = renderer.getClippedImageSize();
+ final int tWidth = renderer.getParam(TileRendererBase.TR_CURRENT_TILE_WIDTH);
+ final int tHeight = renderer.getParam(TileRendererBase.TR_CURRENT_TILE_HEIGHT);
+ final int tY = renderer.getParam(TileRendererBase.TR_CURRENT_TILE_Y_POS);
+ final int tYOff = renderer.getParam(TileRenderer.TR_TILE_Y_OFFSET);
+ final int imgYOff = flipVertical ? 0 : renderer.getParam(TileRenderer.TR_TILE_HEIGHT) - tHeight; // imgYOff will be cut-off via sub-image
+ final int pX = renderer.getParam(TileRendererBase.TR_CURRENT_TILE_X_POS); // tileX == pX
+ final int pY = cis.getHeight() - ( tY - tYOff + tHeight ) + scaledYOffset;
+
+ // Copy temporary data into raster of BufferedImage for faster
+ // blitting Note that we could avoid this copy in the cases
+ // where !offscreenDrawable.isGLOriented(),
+ // but that's the software rendering path which is very slow anyway.
+ final BufferedImage dstImage;
+ if( DEBUG_TILES ) {
+ final String fname = String.format("file_%03d_0_tile_[%02d][%02d]_sz_%03dx%03d_pos0_%03d_%03d_yOff_%03d_pos1_%03d_%03d.png",
+ _counter,
+ renderer.getParam(TileRenderer.TR_CURRENT_COLUMN), renderer.getParam(TileRenderer.TR_CURRENT_ROW),
+ tWidth, tHeight,
+ pX, tY, tYOff, pX, pY).replace(' ', '_');
+ System.err.println("XXX file "+fname);
+ final File fout = new File(fname);
+ try {
+ ImageIO.write(tBuffer.image, "png", fout);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ if( flipVertical ) {
+ final BufferedImage srcImage = tBuffer.image;
+ dstImage = vFlipImage;
+ final int[] src = ((DataBufferInt) srcImage.getRaster().getDataBuffer()).getData();
+ final int[] dst = ((DataBufferInt) dstImage.getRaster().getDataBuffer()).getData();
+ if( DEBUG_TILES ) {
+ Arrays.fill(dst, 0x55);
+ }
+ final int incr = tBuffer.width;
+ int srcPos = 0;
+ int destPos = (tHeight - 1) * tBuffer.width;
+ for (; destPos >= 0; srcPos += incr, destPos -= incr) {
+ System.arraycopy(src, srcPos, dst, destPos, incr);
+ }
+ } else {
+ dstImage = tBuffer.image;
+ }
+ if( DEBUG_TILES ) {
+ final String fname = String.format("file_%03d_1_tile_[%02d][%02d]_sz_%03dx%03d_pos0_%03d_%03d_yOff_%03d_pos1_%03d_%03d.png",
+ _counter,
+ renderer.getParam(TileRenderer.TR_CURRENT_COLUMN), renderer.getParam(TileRenderer.TR_CURRENT_ROW),
+ tWidth, tHeight,
+ pX, tY, tYOff, pX, pY).replace(' ', '_');
+ System.err.println("XXX file "+fname);
+ final File fout = new File(fname);
+ try {
+ ImageIO.write(dstImage, "png", fout);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ _counter++;
+ }
+ // Draw resulting image in one shot
+ final BufferedImage outImage = dstImage.getSubimage(0, imgYOff, tWidth, tHeight);
+ final boolean drawDone = g2d.drawImage(outImage, pX, pY, null); // Null ImageObserver since image data is ready.
+ if( verbose ) {
+ final Shape oClip = g2d.getClip();
+ System.err.println("XXX tile-post.X tile 0 / "+imgYOff+" "+tWidth+"x"+tHeight+", clippedImgSize "+cis);
+ System.err.println("XXX tile-post.X pYf "+cis.getHeight()+" - ( "+tY+" - "+tYOff+" + "+tHeight+" ) "+scaledYOffset+" = "+ pY);
+ System.err.println("XXX tile-post.X clip "+oClip+" + "+pX+" / [pY "+tY+", pYOff "+tYOff+", pYf "+pY+"] -> "+g2d.getClip());
+ g2d.setColor(Color.BLACK);
+ g2d.drawRect(pX, pY, tWidth, tHeight);
+ if( null != oClip ) {
+ final Rectangle r = oClip.getBounds();
+ g2d.setColor(Color.YELLOW);
+ g2d.drawRect(r.x, r.y, r.width, r.height);
+ }
+ System.err.println("XXX tile-post.X "+renderer);
+ System.err.println("XXX tile-post.X dst-img "+dstImage.getWidth()+"x"+dstImage.getHeight());
+ System.err.println("XXX tile-post.X out-img "+outImage.getWidth()+"x"+outImage.getHeight());
+ System.err.println("XXX tile-post.X y-flip "+flipVertical+" -> "+pX+"/"+pY+", drawDone "+drawDone);
+ }
+ }
+ @Override
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {}
+ };
+}
diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java b/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java
index e15e538..dc286ca 100644
--- a/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java
+++ b/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,7 +29,7 @@
* 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.
@@ -85,7 +85,7 @@ public class AWTUtil {
NativeWindowFactory.getAWTToolkitLock().lock();
}
} catch (Exception e) { j2dOk=false; }
- }
+ }
if(!j2dOk) {
NativeWindowFactory.getAWTToolkitLock().lock();
}
@@ -108,7 +108,7 @@ public class AWTUtil {
NativeWindowFactory.getAWTToolkitLock().unlock();
}
} catch (Exception e) { j2dOk=false; }
- }
+ }
if(!j2dOk) {
NativeWindowFactory.getAWTToolkitLock().unlock();
}
diff --git a/src/jogl/classes/jogamp/opengl/awt/Java2D.java b/src/jogl/classes/jogamp/opengl/awt/Java2D.java
index edf9e89..886cd93 100644
--- a/src/jogl/classes/jogamp/opengl/awt/Java2D.java
+++ b/src/jogl/classes/jogamp/opengl/awt/Java2D.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003-2005 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -116,6 +116,7 @@ public class Java2D {
static {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
if (DEBUG) {
System.err.println("Checking for Java2D/OpenGL support");
@@ -144,7 +145,7 @@ public class Java2D {
} else {
if (DEBUG) {
System.err.println("Java2D support disabled: by Property "+java2dOGLDisabledByProp+", by OS "+java2dOGLDisabledByOS);
- }
+ }
cfg = null;
cfgName = "nil";
}
@@ -154,8 +155,8 @@ public class Java2D {
System.err.println("Java2D support: default GraphicsConfiguration = " + cfgName);
}
isOGLPipelineActive = cfgName.startsWith("sun.java2d.opengl");
- isOGLPipelineResourceCompatible = isOGLPipelineActive;
-
+ isOGLPipelineResourceCompatible = isOGLPipelineActive;
+
if (isOGLPipelineActive) {
try {
// Try to get methods we need to integrate
@@ -179,19 +180,19 @@ public class Java2D {
Integer.TYPE
});
getOGLViewportMethod.setAccessible(true);
-
+
getOGLScissorBoxMethod = utils.getDeclaredMethod("getOGLScissorBox",
new Class[] {
Graphics.class
});
getOGLScissorBoxMethod.setAccessible(true);
-
+
getOGLSurfaceIdentifierMethod = utils.getDeclaredMethod("getOGLSurfaceIdentifier",
new Class[] {
Graphics.class
});
getOGLSurfaceIdentifierMethod.setAccessible(true);
-
+
// Try to get additional methods required for proper FBO support
fbObjectSupportInitialized = true;
try {
@@ -201,7 +202,7 @@ public class Java2D {
Runnable.class
});
invokeWithOGLSharedContextCurrentMethod.setAccessible(true);
-
+
getOGLSurfaceTypeMethod = utils.getDeclaredMethod("getOGLSurfaceType",
new Class[] {
Graphics.class
@@ -214,7 +215,7 @@ public class Java2D {
System.err.println("Info: Disabling Java2D/JOGL FBO support");
}
}
-
+
// Try to get an additional method for FBO support in recent Mustang builds
try {
getOGLTextureTypeMethod = utils.getDeclaredMethod("getOGLTextureType",
@@ -228,7 +229,7 @@ public class Java2D {
System.err.println("Info: GL_ARB_texture_rectangle FBO support disabled");
}
}
-
+
// Try to set up APIs for enabling the bridge on OS X,
// where it isn't possible to create generalized
// external GLDrawables
@@ -244,7 +245,7 @@ public class Java2D {
if (cglSurfaceData != null) {
// FIXME: for now, assume that FBO support is not enabled on OS X
fbObjectSupportInitialized = false;
-
+
// We need to find these methods in order to make the bridge work on OS X
createOGLContextOnSurfaceMethod = cglSurfaceData.getDeclaredMethod("createOGLContextOnSurface",
new Class[] {
@@ -252,14 +253,14 @@ public class Java2D {
Long.TYPE
});
createOGLContextOnSurfaceMethod.setAccessible(true);
-
+
makeOGLContextCurrentOnSurfaceMethod = cglSurfaceData.getDeclaredMethod("makeOGLContextCurrentOnSurface",
new Class[] {
Graphics.class,
Long.TYPE
});
makeOGLContextCurrentOnSurfaceMethod.setAccessible(true);
-
+
destroyOGLContextMethod = cglSurfaceData.getDeclaredMethod("destroyOGLContext",
new Class[] {
Long.TYPE
@@ -273,7 +274,7 @@ public class Java2D {
System.err.println("Info: Disabling Java2D/JOGL integration");
}
isOGLPipelineActive = false;
- isOGLPipelineResourceCompatible = false;
+ isOGLPipelineResourceCompatible = false;
}
}
} catch (HeadlessException e) {
@@ -297,7 +298,7 @@ public class Java2D {
public static boolean isOGLPipelineActive() {
return isOGLPipelineActive;
}
-
+
public static boolean isOGLPipelineResourceCompatible() {
return isOGLPipelineResourceCompatible;
}
@@ -317,7 +318,7 @@ public class Java2D {
throw (InternalError) new InternalError().initCause(e);
}
}
-
+
/** Makes current the OpenGL context associated with the passed
Graphics object and runs the given Runnable on the Queue
Flushing Thread in one atomic action. */
@@ -556,7 +557,7 @@ public class Java2D {
throw new GLException("Java2D OpenGL pipeline not active");
}
}
-
+
private static void checkCompatible() {
if ( !isOGLPipelineResourceCompatible() ) {
throw new GLException("Java2D OpenGL pipeline not resource compatible");
@@ -565,6 +566,7 @@ public class Java2D {
private static int getOGLUtilitiesIntField(final String name) {
Integer i = AccessController.doPrivileged(new PrivilegedAction<Integer>() {
+ @Override
public Integer run() {
try {
Class<?> utils = Class.forName("sun.java2d.opengl.OGLUtilities");
@@ -608,6 +610,7 @@ public class Java2D {
System.err.println("Starting initialization of J2D FBO share context");
}
invokeWithOGLSharedContextCurrent(device.getDefaultConfiguration(), new Runnable() {
+ @Override
public void run() {
j2dFBOShareContext = GLDrawableFactory.getFactory(GLProfile.getDefault(GLProfile.getDefaultDevice())).createExternalGLContext();
}
diff --git a/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java b/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java
index 55fb3f9..9173a38 100644
--- a/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java
+++ b/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java
@@ -42,7 +42,7 @@ public class VersionApplet extends Applet {
va.init();
frame.add(va, BorderLayout.CENTER);
frame.validate();
-
+
frame.setVisible(true);
va.start();
}
@@ -54,6 +54,7 @@ public class VersionApplet extends Applet {
this.f = f;
this.va = va;
}
+ @Override
public void windowClosing(WindowEvent ev) {
f.setVisible(false);
va.stop();
@@ -68,7 +69,7 @@ public class VersionApplet extends Applet {
if(null != canvas) { return; }
setEnabled(true);
-
+
GLProfile glp = GLProfile.getDefault();
GLCapabilities glcaps = new GLCapabilities(glp);
@@ -87,7 +88,7 @@ public class VersionApplet extends Applet {
/*
s = NativeWindowVersion.getInstance().toString();
System.err.println(s);
- tareaVersion.append(NativeWindowVersion.getInstance().toString());
+ tareaVersion.append(NativeWindowVersion.getInstance().toString());
*/
s = JoglVersion.getInstance().toString();
@@ -129,24 +130,28 @@ public class VersionApplet extends Applet {
}
}
+ @Override
public void init() {
System.err.println("VersionApplet: init() - begin");
my_init();
System.err.println("VersionApplet: init() - end");
}
+ @Override
public void start() {
System.err.println("VersionApplet: start() - begin");
canvas.setVisible(true);
System.err.println("VersionApplet: start() - end");
}
+ @Override
public void stop() {
System.err.println("VersionApplet: stop() - begin");
canvas.setVisible(false);
System.err.println("VersionApplet: stop() - end");
}
+ @Override
public void destroy() {
System.err.println("VersionApplet: destroy() - start");
my_release();
@@ -154,6 +159,7 @@ public class VersionApplet extends Applet {
}
class GLInfo implements GLEventListener {
+ @Override
public void init(GLAutoDrawable drawable) {
GL gl = drawable.getGL();
String s = JoglVersion.getGLInfo(gl, null).toString();
@@ -161,12 +167,15 @@ public class VersionApplet extends Applet {
tareaVersion.append(s);
}
+ @Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
}
+ @Override
public void display(GLAutoDrawable drawable) {
}
+ @Override
public void dispose(GLAutoDrawable drawable) {
}
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java
index 3d59d1d..7b85c3e 100644
--- a/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.*;
@@ -47,25 +47,29 @@ public final class DesktopES2DynamicLibraryBundleInfo extends GLDynamicLibraryBu
super();
}
+ @Override
public final List<String> getToolGetProcAddressFuncNameList() {
List<String> res = new ArrayList<String>();
res.add("eglGetProcAddress");
return res;
}
+ @Override
public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) {
return EGL.eglGetProcAddress(toolGetProcAddressHandle, funcName);
}
+ @Override
public final boolean useToolGetProcAdressFirst(String funcName) {
return true;
}
-
+
+ @Override
public final List<List<String>> getToolLibNames() {
final List<List<String>> libsList = new ArrayList<List<String>>();
final List<String> libsGL = new ArrayList<String>();
-
- // Be aware that on DRI systems, eg ATI fglrx, etc,
+
+ // Be aware that on DRI systems, eg ATI fglrx, etc,
// you have to set LIBGL_DRIVERS_PATH env variable.
// Eg on Ubuntu 64bit systems this is:
// export LIBGL_DRIVERS_PATH=/usr/lib/fglrx/dri:/usr/lib32/fglrx/dri
@@ -82,15 +86,16 @@ public final class DesktopES2DynamicLibraryBundleInfo extends GLDynamicLibraryBu
// OSX (guess ES2 on OSX will never happen)
libsGL.add("/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib");
-
+
// last but not least .. the generic one
libsGL.add("GL");
-
+
libsList.add(libsGL);
return libsList;
- }
-
+ }
+
+ @Override
public final List<String> getGlueLibNames() {
return glueLibNames;
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
index e7977e3..2eb277f 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
@@ -70,12 +70,12 @@ public class EGLContext extends GLContextImpl {
}
@Override
- protected void resetStates() {
+ protected void resetStates(boolean isInit) {
eglQueryStringInitialized = false;
eglQueryStringAvailable = false;
eglExtProcAddressTable = null;
// no inner state _eglExt = null;
- super.resetStates();
+ super.resetStates(isInit);
}
@Override
@@ -115,7 +115,7 @@ public class EGLContext extends GLContextImpl {
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) +
+ throw new GLException("Error making context " + toHexString(contextHandle) +
" current on Thread " + getThreadName() +
" with display " + toHexString(dpy) +
", drawableWrite " + toHexString(drawable.getHandle()) +
@@ -128,7 +128,7 @@ public class EGLContext extends GLContextImpl {
@Override
protected void releaseImpl() throws GLException {
if (!EGL.eglMakeCurrent(drawable.getNativeSurface().getDisplayHandle(), EGL.EGL_NO_SURFACE, EGL.EGL_NO_SURFACE, EGL.EGL_NO_CONTEXT)) {
- throw new GLException("Error freeing OpenGL context " + toHexString(contextHandle) +
+ throw new GLException("Error freeing OpenGL context " + toHexString(contextHandle) +
": error code " + toHexString(EGL.eglGetError()));
}
}
@@ -138,7 +138,7 @@ public class EGLContext extends GLContextImpl {
if (!EGL.eglDestroyContext(drawable.getNativeSurface().getDisplayHandle(), contextHandle)) {
final int eglError = EGL.eglGetError();
if(EGL.EGL_SUCCESS != eglError) { /* oops, Mesa EGL impl. may return false, but has no EGL error */
- throw new GLException("Error destroying OpenGL context " + toHexString(contextHandle) +
+ throw new GLException("Error destroying OpenGL context " + toHexString(contextHandle) +
": error code " + toHexString(eglError));
}
}
@@ -222,7 +222,19 @@ public class EGLContext extends GLContextImpl {
throw new GLException("Error making context " +
toHexString(contextHandle) + " current: error code " + toHexString(EGL.eglGetError()));
}
- return setGLFunctionAvailability(true, contextVersionReq, 0, CTX_PROFILE_ES, contextVersionReq>=3); // strict match for es >= 3
+ 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;
+ }
}
@Override
@@ -285,11 +297,11 @@ public class EGLContext extends GLContextImpl {
//
// Accessible ..
//
-
+
/* pp */ void mapCurrentAvailableGLVersion(AbstractGraphicsDevice device) {
mapStaticGLVersion(device, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
}
- /* pp */ int getContextOptions() { return ctxOptions; }
+ /* pp */ int getContextOptions() { return ctxOptions; }
/* pp */ static void mapStaticGLESVersion(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps) {
final GLProfile glp = caps.getGLProfile();
final int[] reqMajorCTP = new int[2];
@@ -305,7 +317,7 @@ public class EGLContext extends GLContextImpl {
reqMajorCTP[1] |= GLContext.CTX_IMPL_ACCEL_SOFT;
}
mapStaticGLVersion(device, reqMajorCTP[0], 0, reqMajorCTP[1]);
- }
+ }
/* pp */ static void mapStaticGLESVersion(AbstractGraphicsDevice device, final int major) {
int ctp = GLContext.CTX_PROFILE_ES;
if( major >= 3 ) {
@@ -324,20 +336,20 @@ public class EGLContext extends GLContextImpl {
if(! ( device instanceof EGLGraphicsDevice ) ) {
final EGLGraphicsDevice eglDevice = new EGLGraphicsDevice(device.getHandle(), EGL.EGL_NO_DISPLAY, device.getConnection(), device.getUnitID(), null);
GLContext.mapAvailableGLVersion(eglDevice, reqMajor, reqProfile, major, minor, ctp);
- }
+ }
}
}
protected static String getGLVersion(int major, int minor, int ctp, String gl_version) {
return GLContext.getGLVersion(major, minor, ctp, gl_version);
}
-
+
protected static boolean getAvailableGLVersionsSet(AbstractGraphicsDevice device) {
return GLContext.getAvailableGLVersionsSet(device);
}
protected static void setAvailableGLVersionsSet(AbstractGraphicsDevice device) {
GLContext.setAvailableGLVersionsSet(device);
}
-
+
protected static String toHexString(int hex) {
return GLContext.toHexString(hex);
}
@@ -358,7 +370,7 @@ public class EGLContext extends GLContextImpl {
public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) {
throw new GLException("Should not call this");
}
-
+
@Override
public final void glFreeMemoryNV(ByteBuffer pointer) {
throw new GLException("Should not call this");
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java
index f2efb04..3d864ad 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -41,8 +41,8 @@ import jogamp.opengl.Debug;
import com.jogamp.common.util.LongObjectHashMap;
import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
-/**
- * This implementation provides recursive calls to
+/**
+ * This implementation provides recursive calls to
* {@link EGL#eglInitialize(long, IntBuffer, IntBuffer)} and {@link EGL#eglTerminate(long)},
* where <code>eglInitialize(..)</code> is issued only for the 1st call per <code>eglDisplay</code>
* and <code>eglTerminate(..)</code> is issued only for the last call.
@@ -53,30 +53,31 @@ import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
*/
public class EGLDisplayUtil {
protected static final boolean DEBUG = Debug.debug("EGLDisplayUtil");
-
+
private static class DpyCounter {
final long eglDisplay;
final Throwable createdStack;
int refCount;
-
+
private DpyCounter(long eglDisplay) {
this.eglDisplay = eglDisplay;
this.refCount = 0;
this.createdStack = DEBUG ? new Throwable() : null;
}
-
+
+ @Override
public String toString() {
return "EGLDisplay[0x"+Long.toHexString(eglDisplay)+": refCnt "+refCount+"]";
}
}
static final LongObjectHashMap eglDisplayCounter;
-
+
static {
eglDisplayCounter = new LongObjectHashMap();
eglDisplayCounter.setKeyNotFoundValue(null);
}
- /**
+ /**
* @return number of unclosed EGL Displays.<br>
*/
public static int shutdown(boolean verbose) {
@@ -91,7 +92,7 @@ public class EGLDisplayUtil {
}
return eglDisplayCounter.size();
}
-
+
public static void dumpOpenDisplayConnections() {
System.err.println("EGLDisplayUtil: Open EGL Display Connections: "+eglDisplayCounter.size());
int i=0;
@@ -104,7 +105,7 @@ public class EGLDisplayUtil {
}
}
}
-
+
public static long eglGetDisplay(long nativeDisplay_id) {
final long eglDisplay = EGL.eglGetDisplay(nativeDisplay_id);
if(DEBUG) {
@@ -114,16 +115,16 @@ public class EGLDisplayUtil {
}
return eglDisplay;
}
-
+
/**
* @param eglDisplay
* @param major
* @param minor
* @return true if the eglDisplay is valid and it's reference counter becomes one and {@link EGL#eglInitialize(long, IntBuffer, IntBuffer)} was successful, otherwise false
- *
+ *
* @see EGL#eglInitialize(long, IntBuffer, IntBuffer)
*/
- public static synchronized boolean eglInitialize(long eglDisplay, IntBuffer major, IntBuffer minor) {
+ public static synchronized boolean eglInitialize(long eglDisplay, IntBuffer major, IntBuffer minor) {
if( EGL.EGL_NO_DISPLAY == eglDisplay) {
return false;
}
@@ -157,16 +158,16 @@ public class EGLDisplayUtil {
}
return res;
}
-
+
/**
* @param nativeDisplayID
* @param eglDisplay array of size 1 holding return value if successful, otherwise {@link EGL#EGL_NO_DISPLAY}.
- * @param eglErr array of size 1 holding the EGL error value as retrieved by {@link EGL#eglGetError()} if not successful.
+ * @param eglErr array of size 1 holding the EGL error value as retrieved by {@link EGL#eglGetError()} if not successful.
* @param major
* @param minor
- * @return {@link EGL#EGL_SUCCESS} if successful, otherwise {@link EGL#EGL_BAD_DISPLAY} if {@link #eglGetDisplay(long)} failed
+ * @return {@link EGL#EGL_SUCCESS} if successful, otherwise {@link EGL#EGL_BAD_DISPLAY} if {@link #eglGetDisplay(long)} failed
* or {@link EGL#EGL_NOT_INITIALIZED} if {@link #eglInitialize(long, IntBuffer, IntBuffer)} failed.
- *
+ *
* @see #eglGetDisplay(long)
* @see #eglInitialize(long, IntBuffer, IntBuffer)
*/
@@ -184,7 +185,7 @@ public class EGLDisplayUtil {
eglDisplay[0] = _eglDisplay;
return EGL.EGL_SUCCESS;
}
-
+
/**
* @param nativeDisplayID in/out array of size 1, passing the requested nativeVisualID, may return a different revised nativeVisualID handle
* @return the initialized EGL display ID
@@ -209,7 +210,7 @@ public class EGLDisplayUtil {
}
throw new GLException("Failed to created/initialize EGL display incl. fallback default: native "+EGLContext.toHexString(nativeDisplayID[0])+", error "+EGLContext.toHexString(eglRes)+"/"+EGLContext.toHexString(eglError[0]));
}
-
+
/**
* @param eglDisplay the EGL display handle
* @return true if the eglDisplay is valid and it's reference counter becomes zero and {@link EGL#eglTerminate(long)} was successful, otherwise false
@@ -218,7 +219,7 @@ public class EGLDisplayUtil {
if( EGL.EGL_NO_DISPLAY == eglDisplay) {
return false;
}
- final boolean res;
+ final boolean res;
final int refCnt;
final DpyCounter d;
{
@@ -237,7 +238,7 @@ public class EGLDisplayUtil {
} else {
if(0 < refCnt) { // no negative refCount
d.refCount = refCnt;
- }
+ }
res = true;
}
if(DEBUG) {
@@ -246,34 +247,36 @@ public class EGLDisplayUtil {
}
return res;
}
-
+
public static final EGLGraphicsDevice.EGLDisplayLifecycleCallback eglLifecycleCallback = new EGLGraphicsDevice.EGLDisplayLifecycleCallback() {
+ @Override
public long eglGetAndInitDisplay(long[] nativeDisplayID) {
return eglGetDisplayAndInitialize(nativeDisplayID);
}
+ @Override
public void eglTerminate(long eglDisplayHandle) {
EGLDisplayUtil.eglTerminate(eglDisplayHandle);
}
};
-
+
/**
* @param nativeDisplayID
* @param connection
* @param unitID
- * @return an initialized EGLGraphicsDevice
+ * @return an initialized EGLGraphicsDevice
* @throws GLException if {@link EGL#eglGetDisplay(long)} or {@link EGL#eglInitialize(long, int[], int, int[], int)} fails
- * @see EGLGraphicsDevice#EGLGraphicsDevice(long, long, String, int, com.jogamp.nativewindow.egl.EGLGraphicsDevice.EGLDisplayLifecycleCallback)
+ * @see EGLGraphicsDevice#EGLGraphicsDevice(long, long, String, int, com.jogamp.nativewindow.egl.EGLGraphicsDevice.EGLDisplayLifecycleCallback)
*/
public static EGLGraphicsDevice eglCreateEGLGraphicsDevice(long nativeDisplayID, String connection, int unitID) {
final EGLGraphicsDevice eglDisplay = new EGLGraphicsDevice(nativeDisplayID, EGL.EGL_NO_DISPLAY, connection, unitID, eglLifecycleCallback);
eglDisplay.open();
return eglDisplay;
}
-
+
/**
* @param surface
- * @return an initialized EGLGraphicsDevice
- * @throws GLException if {@link EGL#eglGetDisplay(long)} or {@link EGL#eglInitialize(long, int[], int, int[], int)} fails incl fallback
+ * @return an initialized EGLGraphicsDevice
+ * @throws GLException if {@link EGL#eglGetDisplay(long)} or {@link EGL#eglInitialize(long, int[], int, int[], int)} fails incl fallback
*/
public static EGLGraphicsDevice eglCreateEGLGraphicsDevice(NativeSurface surface) {
final long nativeDisplayID;
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
index 2edf261..ab28fb3 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
@@ -59,15 +59,15 @@ public abstract class EGLDrawable extends GLDrawableImpl {
@Override
public abstract GLContext createContext(GLContext shareWith);
- protected abstract long createSurface(EGLGraphicsConfiguration config, int width, int height, long nativeSurfaceHandle);
+ 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 EGLGraphicsConfiguration eglConfig = (EGLGraphicsConfiguration) eglws.getGraphicsConfiguration();
final NativeSurface upstreamSurface = eglws.getUpstreamSurface();
-
+
long eglSurface = createSurface(eglConfig, eglws.getWidth(), eglws.getHeight(), upstreamSurface.getSurfaceHandle());
-
+
int eglError0;
if (EGL.EGL_NO_SURFACE == eglSurface) {
eglError0 = EGL.eglGetError();
@@ -104,7 +104,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
final EGLWrappedSurface eglws = (EGLWrappedSurface) surface;
if(DEBUG) {
System.err.println(getThreadName() + ": createHandle of "+eglws);
- }
+ }
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);
@@ -114,12 +114,13 @@ public abstract class EGLDrawable extends GLDrawableImpl {
throw new InternalError("Nil surface but claimed to be valid: "+eglws);
}
}
-
- protected void destroyHandle() {
+
+ @Override
+ protected void destroyHandle() {
final EGLWrappedSurface eglws = (EGLWrappedSurface) surface;
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);
}
@@ -134,7 +135,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
if( 0 == surfaceHandle ) {
return false;
}
- final IntBuffer val = Buffers.newDirectIntBuffer(1);
+ 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();
@@ -144,7 +145,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
}
return eglSurfaceValid;
}
-
+
@Override
protected final void setRealizedImpl() {
if(DEBUG) {
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
index 5d99e3e..1a881ee 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
@@ -83,14 +83,14 @@ import com.jogamp.opengl.GLRendererQuirks;
public class EGLDrawableFactory extends GLDrawableFactoryImpl {
protected static final boolean DEBUG = GLDrawableFactoryImpl.DEBUG; // allow package access
-
+
/* package */ static final boolean QUERY_EGL_ES_NATIVE_TK;
-
+
static {
Debug.initSingleton();
QUERY_EGL_ES_NATIVE_TK = Debug.isPropertyDefined("jogl.debug.EGLDrawableFactory.QueryNativeTK", true);
}
-
+
private static GLDynamicLookupHelper eglES1DynamicLookupHelper = null;
private static GLDynamicLookupHelper eglES2DynamicLookupHelper = null;
@@ -109,7 +109,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
dl.isFunctionAvailable("glEnableClientState") &&
dl.isFunctionAvailable("glColorPointer");
}
-
+
public EGLDrawableFactory() {
super();
@@ -189,10 +189,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
} else {
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>();
-
+
// FIXME: Following triggers eglInitialize(..) which crashed on Windows w/ Chrome/Angle, FF/Angle!
defaultDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(EGL.EGL_DEFAULT_DISPLAY, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT);
}
@@ -204,8 +204,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
protected final boolean isComplete() {
return null != sharedMap; // null != eglES2DynamicLookupHelper || null != eglES1DynamicLookupHelper;
}
-
-
+
+
@Override
protected final void destroy() {
if(null != sharedMap) {
@@ -247,7 +247,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
EGLGraphicsConfigurationFactory.unregisterFactory();
EGLDisplayUtil.shutdown(DEBUG);
}
-
+
private void dumpMap() {
synchronized(sharedMap) {
System.err.println("EGLDrawableFactory.map "+sharedMap.size());
@@ -265,7 +265,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
private HashMap<String /*uniqueKey*/, SharedResource> sharedMap = null;
- private HashSet<String> sharedMapCreateAttempt = null;
+ private HashSet<String> sharedMapCreateAttempt = null;
private EGLGraphicsDevice defaultDevice = null;
private SharedResource defaultSharedResource = null;
private boolean isANGLE = false;
@@ -286,9 +286,9 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
private final boolean hasPBufferES1;
private final boolean hasPBufferES3ES2;
- SharedResource(EGLGraphicsDevice dev,
- boolean wasContextES1Created, boolean hasPBufferES1, GLRendererQuirks rendererQuirksES1, int ctpES1,
- boolean wasContextES2Created, boolean wasContextES3Created,
+ SharedResource(EGLGraphicsDevice dev,
+ boolean wasContextES1Created, boolean hasPBufferES1, GLRendererQuirks rendererQuirksES1, int ctpES1,
+ boolean wasContextES2Created, boolean wasContextES3Created,
boolean hasPBufferES3ES2, GLRendererQuirks rendererQuirksES3ES2, int ctpES3ES2) {
this.device = dev;
// this.contextES1 = ctxES1;
@@ -296,7 +296,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
this.hasPBufferES1= hasPBufferES1;
this.rendererQuirksES1 = rendererQuirksES1;
this.ctpES1 = ctpES1;
-
+
// this.contextES2 = ctxES2;
// this.contextES3 = ctxES3;
this.wasES2ContextCreated = wasContextES2Created;
@@ -314,7 +314,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
// final EGLContext getContextES1() { return contextES1; }
// final EGLContext getContextES2() { return contextES2; }
// final EGLContext getContextES3() { return contextES3; }
-
+
@Override
public AbstractGraphicsScreen getScreen() {
return null;
@@ -329,7 +329,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
public GLRendererQuirks getRendererQuirks() {
- return null != rendererQuirksES3ES2 ? rendererQuirksES3ES2 : rendererQuirksES1 ;
+ return null != rendererQuirksES3ES2 ? rendererQuirksES3ES2 : rendererQuirksES1 ;
}
}
@@ -359,18 +359,18 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
return new ArrayList<GLCapabilitiesImmutable>(0);
}
-
- private boolean mapAvailableEGLESConfig(AbstractGraphicsDevice adevice, int esProfile,
+
+ private boolean mapAvailableEGLESConfig(AbstractGraphicsDevice adevice, int esProfile,
boolean[] hasPBuffer, GLRendererQuirks[] rendererQuirks, int[] ctp) {
final String profileString;
switch( esProfile ) {
case 3:
- profileString = GLProfile.GLES3; break;
+ profileString = GLProfile.GLES3; break;
case 2:
- profileString = GLProfile.GLES2; break;
- case 1:
+ profileString = GLProfile.GLES2; break;
+ case 1:
profileString = GLProfile.GLES1; break;
- default:
+ default:
throw new GLException("Invalid ES profile number "+esProfile);
}
if ( !GLProfile.isAvailable(adevice, profileString) ) {
@@ -394,23 +394,23 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
ProxySurface upstreamSurface = null; // X11, GLX, ..
boolean success = false;
boolean deviceFromUpstreamSurface = false;
- try {
+ 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.
+ // Only one default shared resource instance is ever be created.
final GLCapabilitiesImmutable reqCapsPBuffer = GLGraphicsConfigurationUtil.fixGLPBufferGLCapabilities(reqCapsAny);
final List<GLCapabilitiesImmutable> availablePBufferCapsL = getAvailableEGLConfigs(defaultDevice, reqCapsPBuffer);
hasPBuffer[0] = availablePBufferCapsL.size() > 0;
-
+
// 1st case: adevice is not the EGL default device, map default shared resources
if( adevice != defaultDevice ) {
if(null == defaultSharedResource) {
return false;
- }
+ }
switch(esProfile) {
case 3:
if( !defaultSharedResource.wasES3ContextCreated ) {
@@ -419,14 +419,14 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
rendererQuirks[0] = defaultSharedResource.rendererQuirksES3ES2;
ctp[0] = defaultSharedResource.ctpES3ES2;
break;
- case 2:
+ case 2:
if( !defaultSharedResource.wasES2ContextCreated ) {
return false;
}
rendererQuirks[0] = defaultSharedResource.rendererQuirksES3ES2;
ctp[0] = defaultSharedResource.ctpES3ES2;
break;
- case 1:
+ case 1:
if( !defaultSharedResource.wasES1ContextCreated ) {
return false;
}
@@ -437,11 +437,11 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
EGLContext.mapStaticGLVersion(adevice, esProfile, 0, ctp[0]);
return true;
}
-
+
// attempt to created the default shared resources ..
-
+
eglDevice = defaultDevice; // reuse
-
+
if( hasPBuffer[0] ) {
// 2nd case create defaultDevice shared resource using pbuffer surface
surface = createDummySurfaceImpl(eglDevice, false, reqCapsPBuffer, reqCapsPBuffer, null, 64, 64); // egl pbuffer offscreen
@@ -459,15 +459,15 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
if(DEBUG) {
System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig() no pbuffer config available, detected !pbuffer config: "+success);
EGLGraphicsConfigurationFactory.printCaps("!PBufferCaps", capsAnyL, System.err);
- }
- }
+ }
+ }
} else {
- // 4th case always creates a true mapping of given device to EGL
+ // 4th case always creates a true mapping of given device to EGL
surface = desktopFactory.createDummySurface(adevice, reqCapsAny, null, 64, 64); // X11, WGL, .. dummy window
upstreamSurface = ( surface instanceof ProxySurface ) ? (ProxySurface)surface : null ;
if(null != upstreamSurface) {
upstreamSurface.createNotify();
- }
+ }
eglDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(surface);
deviceFromUpstreamSurface = true;
hasPBuffer[0] = true;
@@ -482,7 +482,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
context.makeCurrent(); // could cause exception
if(context.isCurrent()) {
final String glVersion = context.getGL().glGetString(GL.GL_VERSION);
- if(null != glVersion) {
+ if(null != glVersion) {
context.mapCurrentAvailableGLVersion(eglDevice);
if(eglDevice != adevice) {
context.mapCurrentAvailableGLVersion(adevice);
@@ -493,7 +493,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
} else {
// Oops .. something is wrong
if(DEBUG) {
- System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: "+eglDevice+", "+context.getGLVersion()+" - VERSION is null, dropping availability!");
+ System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: "+eglDevice+", "+context.getGLVersion()+" - VERSION is null, dropping availability!");
}
}
}
@@ -510,7 +510,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
} catch (Throwable t) {
if(DEBUG) {
- System.err.println("Catched Exception on thread "+getThreadName());
+ System.err.println("Catched Exception on thread "+getThreadName());
t.printStackTrace();
}
success = false;
@@ -518,7 +518,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
if(eglDevice == defaultDevice) {
if(null != upstreamSurface) {
upstreamSurface.destroyNotify();
- }
+ }
} else if( deviceFromUpstreamSurface ) {
if(null != eglDevice) {
eglDevice.close();
@@ -529,7 +529,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
} else {
if(null != upstreamSurface) {
upstreamSurface.destroyNotify();
- }
+ }
if(null != eglDevice) {
eglDevice.close();
}
@@ -553,9 +553,9 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
return false;
}
- }
+ }
}
-
+
@Override
protected final SharedResource getOrCreateSharedResourceImpl(AbstractGraphicsDevice adevice) {
if(null == sharedMap) { // null == eglES1DynamicLookupHelper && null == eglES2DynamicLookupHelper
@@ -571,27 +571,27 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
dumpMap();
throw new InternalError("defaultSharedResource already exist: "+defaultSharedResource);
}
- defaultSharedResource = createEGLSharedResourceImpl(defaultDevice);
+ 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
+ if( null == defaultSharedResource) { // defaultDevice must be initialized before host-device
dumpMap();
- throw new InternalError("defaultSharedResource does not exist");
+ throw new InternalError("defaultSharedResource does not exist");
}
final SharedResource[] existing = new SharedResource[] { null };
if ( !needsToCreateSharedResource(key, existing) ) {
return existing[0];
- }
+ }
return createEGLSharedResourceImpl(adevice);
}
}
-
+
private SharedResource createEGLSharedResourceImpl(AbstractGraphicsDevice adevice) {
- final boolean madeCurrentES1;
+ final boolean madeCurrentES1;
final boolean madeCurrentES2;
final boolean madeCurrentES3;
boolean[] hasPBufferES1 = new boolean[] { false };
@@ -602,12 +602,12 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
GLRendererQuirks[] rendererQuirksES3ES2 = new GLRendererQuirks[] { null };
int[] ctpES1 = new int[] { -1 };
int[] ctpES3ES2 = new int[] { -1 };
-
-
+
+
if (DEBUG) {
System.err.println("EGLDrawableFactory.createShared(): device "+adevice);
}
-
+
if( null != eglES1DynamicLookupHelper ) {
madeCurrentES1 = mapAvailableEGLESConfig(adevice, 1, hasPBufferES1, rendererQuirksES1, ctpES1);
} else {
@@ -616,8 +616,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
if( null != eglES2DynamicLookupHelper ) {
madeCurrentES3 = mapAvailableEGLESConfig(adevice, 3, hasPBufferES3ES2, rendererQuirksES3ES2, ctpES3ES2);
if( madeCurrentES3 ) {
- madeCurrentES2 = true;
- EGLContext.mapStaticGLVersion(adevice, 2, 0, ctpES3ES2[0]);
+ // Only support highest - FIXME: Proper ES2/ES3 profile selection
+ madeCurrentES2 = false;
} else {
madeCurrentES2 = mapAvailableEGLESConfig(adevice, 2, hasPBufferES3ES2, rendererQuirksES3ES2, ctpES3ES2);
}
@@ -625,10 +625,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
madeCurrentES2 = false;
madeCurrentES3 = false;
}
-
+
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.
+ // avoid exception due to double 'set' - carefull exception of the rule.
EGLContext.setAvailableGLVersionsSet(adevice);
}
if( hasX11 ) {
@@ -637,7 +637,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
final SharedResource sr = new SharedResource(defaultDevice, madeCurrentES1, hasPBufferES1[0], rendererQuirksES1[0], ctpES1[0],
madeCurrentES2, madeCurrentES3, hasPBufferES3ES2[0], rendererQuirksES3ES2[0], ctpES3ES2[0]);
-
+
synchronized(sharedMap) {
sharedMap.put(adevice.getUniqueID(), sr);
}
@@ -650,7 +650,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
return sr;
}
-
+
private void handleDontCloseX11DisplayQuirk(GLRendererQuirks quirks) {
if( null != quirks && quirks.exist( GLRendererQuirks.DontCloseX11Display ) ) {
jogamp.nativewindow.x11.X11Util.markAllDisplaysUnclosable();
@@ -692,7 +692,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
return new EGLOnscreenDrawable(this, EGLWrappedSurface.get(target));
}
-
+
@Override
protected GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) {
if (target == null) {
@@ -715,8 +715,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
- protected ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
- GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested,
+ protected ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
+ GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested,
GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) {
final boolean ownDevice;
final EGLGraphicsDevice device;
@@ -732,21 +732,21 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
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);
- }
+ throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen);
+ }
return new WrappedSurface(config, 0, upstreamHook, ownDevice);
}
-
+
@Override
- public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
+ public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height) {
- chosenCaps = GLGraphicsConfigurationUtil.fixOffscreenBitOnly(chosenCaps); // complete validation in EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(..) above
+ chosenCaps = GLGraphicsConfigurationUtil.fixGLPBufferGLCapabilities(chosenCaps); // complete validation in EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(..) above
return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new EGLDummyUpstreamSurfaceHook(width, height));
}
-
+
/**
- * @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.
+ * @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.
* @param useTexture
* @return the passed {@link MutableSurface} which now has the EGL pbuffer surface set as it's handle
*/
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java
index 162e716..818f326 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java
@@ -7,19 +7,20 @@ import javax.media.nativewindow.UpstreamSurfaceHook;
import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize;
import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
+/** Uses a PBuffer offscreen surface */
public class EGLDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize {
/**
- * @param width the initial width as returned by {@link NativeSurface#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)},
- * not the actual dummy surface width.
+ * @param width the initial width as returned by {@link NativeSurface#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)},
+ * not the actual dummy surface width.
* The latter is platform specific and small
- * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)},
+ * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)},
* not the actual dummy surface height,
* The latter is platform specific and small
*/
public EGLDummyUpstreamSurfaceHook(int width, int height) {
super(width, height);
}
-
+
@Override
public final void create(ProxySurface s) {
final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) s.getGraphicsConfiguration().getScreen().getDevice();
@@ -31,14 +32,14 @@ public class EGLDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize
}
if( EGL.EGL_NO_SURFACE == s.getSurfaceHandle() ) {
s.setSurfaceHandle( EGLDrawableFactory.createPBufferSurfaceImpl((EGLGraphicsConfiguration)s.getGraphicsConfiguration(), 64, 64, false) );
- s.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
+ s.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
}
s.addUpstreamOptionBits(ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE);
} finally {
eglDevice.unlock();
}
}
-
+
@Override
public final void destroy(ProxySurface s) {
if( s.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) {
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java
index 778f0cb..ac880eb 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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 com.jogamp.common.os.AndroidVersion;
@@ -52,7 +52,7 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle
super();
}
- /**
+ /**
* Returns <code>true</code> on <code>Android</code>,
* and <code>false</code> otherwise.
*/
@@ -65,7 +65,7 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle
// default behavior for other platforms
return false;
}
-
+
@Override
public final List<String> getToolGetProcAddressFuncNameList() {
List<String> res = new ArrayList<String>();
@@ -87,26 +87,26 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle
return true;
}
}
-
+
protected final List<String> getEGLLibNamesList() {
List<String> eglLibNames = new ArrayList<String>();
-
- // this is the default EGL lib name, according to the spec
+
+ // this is the default EGL lib name, according to the spec
eglLibNames.add("libEGL.so.1");
-
+
// try these as well, if spec fails
eglLibNames.add("libEGL.so");
eglLibNames.add("EGL");
-
- // for windows distributions using the 'unlike' lib prefix,
+
+ // for windows distributions using the 'unlike' lib prefix,
// where our tool does not add it.
eglLibNames.add("libEGL");
-
+
return eglLibNames;
}
@Override
public final List<String> getGlueLibNames() {
return glueLibNames;
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java
index dd3d6fa..361ec26 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.*;
@@ -35,33 +35,34 @@ public final class EGLES1DynamicLibraryBundleInfo extends EGLDynamicLibraryBundl
super();
}
+ @Override
public final List<List<String>> getToolLibNames() {
final List<List<String>> libsList = new ArrayList<List<String>>();
{
final List<String> libsGL = new ArrayList<String>();
-
- // this is the default lib name, according to the spec
+
+ // this is the default lib name, according to the spec
libsGL.add("libGLESv1_CM.so.2");
-
+
// try these as well, if spec fails
libsGL.add("libGLESv1_CM.so");
- libsGL.add("GLESv1_CM");
+ libsGL.add("GLESv1_CM");
// alternative names
libsGL.add("GLES_CM");
libsGL.add("GLES_CL");
-
- // for windows distributions using the 'unlike' lib prefix,
+
+ // for windows distributions using the 'unlike' lib prefix,
// where our tool does not add it.
libsGL.add("libGLESv1_CM");
libsGL.add("libGLES_CM");
libsGL.add("libGLES_CL");
-
+
libsList.add(libsGL);
}
libsList.add(getEGLLibNamesList());
-
+
return libsList;
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java
index 0d20fd4..7473846 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,17 +20,17 @@
* 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.*;
-/**
+/**
* <p>
* Covering ES3 and ES2.
* </p>
@@ -40,16 +40,17 @@ public final class EGLES2DynamicLibraryBundleInfo extends EGLDynamicLibraryBundl
super();
}
+ @Override
public final List<List<String>> getToolLibNames() {
final List<List<String>> libsList = new ArrayList<List<String>>();
{
final List<String> libsGL = new ArrayList<String>();
-
- // ES3: This is the default lib name, according to the spec
+
+ // ES3: This is the default lib name, according to the spec
libsGL.add("libGLESv3.so.3");
-
+
// ES3: Try these as well, if spec fails
- libsGL.add("libGLESv3.so");
+ libsGL.add("libGLESv3.so");
libsGL.add("GLESv3");
// ES3: Alternative names
@@ -59,12 +60,12 @@ public final class EGLES2DynamicLibraryBundleInfo extends EGLDynamicLibraryBundl
// where our tool does not add it.
libsGL.add("libGLESv3");
libsGL.add("libGLES30");
-
- // ES2: This is the default lib name, according to the spec
+
+ // ES2: This is the default lib name, according to the spec
libsGL.add("libGLESv2.so.2");
-
+
// ES2: Try these as well, if spec fails
- libsGL.add("libGLESv2.so");
+ libsGL.add("libGLESv2.so");
libsGL.add("GLESv2");
// ES2: Alternative names
@@ -75,14 +76,14 @@ public final class EGLES2DynamicLibraryBundleInfo extends EGLDynamicLibraryBundl
// where our tool does not add it.
libsGL.add("libGLESv2");
libsGL.add("libGLESv2_CM");
- libsGL.add("libGLES20");
-
+ libsGL.add("libGLES20");
+
libsList.add(libsGL);
}
libsList.add(getEGLLibNamesList());
-
+
return libsList;
- }
-
+ }
+
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java
index 4685e8b..aff18fc 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java
@@ -38,6 +38,7 @@ package jogamp.opengl.egl;
import javax.media.opengl.*;
import jogamp.opengl.*;
+
import javax.media.nativewindow.*;
public class EGLExternalContext extends EGLContext {
@@ -45,7 +46,9 @@ public class EGLExternalContext extends EGLContext {
public EGLExternalContext(AbstractGraphicsScreen screen) {
super(null, null);
GLContextShareSet.contextCreated(this);
- setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_ES, false);
+ if( !setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_ES, false /* strictMatch */, false /* withinGLVersionsMapping */) ) { // use GL_VERSION
+ throw new InternalError("setGLFunctionAvailability !strictMatch failed");
+ }
getGLStateTracker().setEnabled(false); // external context usage can't track state in Java
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
index b1ffe60..f3592c1 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -57,7 +57,7 @@ import com.jogamp.nativewindow.MutableGraphicsConfiguration;
import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable {
-
+
public final long getNativeConfig() {
return ((EGLGLCapabilities)capabilitiesChosen).getEGLConfig();
}
@@ -66,7 +66,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
return ((EGLGLCapabilities)capabilitiesChosen).getEGLConfigID();
}
- EGLGraphicsConfiguration(AbstractGraphicsScreen absScreen,
+ EGLGraphicsConfiguration(AbstractGraphicsScreen absScreen,
EGLGLCapabilities capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) {
super(absScreen, capsChosen, capsRequested);
this.chooser = chooser;
@@ -77,7 +77,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
* @param absScreen
* @param eglConfigID {@link EGL#EGL_CONFIG_ID} for which the config is being created for.
* @return
- * @throws GLException if invalid EGL display.
+ * @throws GLException if invalid EGL display.
*/
public static EGLGraphicsConfiguration create(GLCapabilitiesImmutable capsRequested, AbstractGraphicsScreen absScreen, int eglConfigID) {
final AbstractGraphicsDevice absDevice = absScreen.getDevice();
@@ -101,9 +101,9 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
public Object clone() {
return super.clone();
}
-
+
void updateGraphicsConfiguration() {
- CapabilitiesImmutable capsChosen = getChosenCapabilities();
+ CapabilitiesImmutable capsChosen = getChosenCapabilities();
EGLGraphicsConfiguration newConfig = (EGLGraphicsConfiguration)
GraphicsConfigurationFactory.getFactory(getScreen().getDevice(), capsChosen).chooseGraphicsConfiguration(
capsChosen, getRequestedCapabilities(), chooser, getScreen(), VisualIDHolder.VID_UNDEFINED);
@@ -140,7 +140,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
return false;
}
final IntBuffer val = Buffers.newDirectIntBuffer(1);
-
+
// get the configID
if(!EGL.eglGetConfigAttrib(display, config, EGL.EGL_CONFIG_ID, val)) {
final int eglErr = EGL.eglGetError();
@@ -169,7 +169,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
}
if ( 0 != ( _stype & EGL.EGL_PBUFFER_BIT ) ) {
val |= GLGraphicsConfigurationUtil.PBUFFER_BIT |
- GLGraphicsConfigurationUtil.FBO_BIT;
+ GLGraphicsConfigurationUtil.FBO_BIT;
}
return val;
}
@@ -189,7 +189,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
final int cfgID;
final int rType;
final int visualID;
-
+
// get the configID
if(!EGL.eglGetConfigAttrib(display, config, EGL.EGL_CONFIG_ID, val)) {
if(DEBUG) {
@@ -199,7 +199,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
return null;
}
cfgID = val.get(0);
-
+
if(!EGL.eglGetConfigAttrib(display, config, EGL.EGL_RENDERABLE_TYPE, val)) {
if(DEBUG) {
System.err.println("EGL couldn't retrieve EGL_RENDERABLE_TYPE for config "+toHexString(config)+", error "+toHexString(EGL.eglGetError()));
@@ -213,8 +213,8 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
} else {
visualID = VisualIDHolder.VID_UNDEFINED;
}
-
- EGLGLCapabilities caps = null;
+
+ EGLGLCapabilities caps = null;
try {
if(null == glp) {
glp = EGLGLCapabilities.getCompatible(device, rType);
@@ -232,8 +232,8 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
System.err.println("config "+toHexString(config)+": "+gle);
}
return null;
- }
-
+ }
+
if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_CONFIG_CAVEAT, val)) {
if( EGL.EGL_SLOW_CONFIG == val.get(0) ) {
caps.setHardwareAccelerated(false);
@@ -244,11 +244,11 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
caps.setNumSamples(val.get(0));
}
if(!caps.getSampleBuffers()) {
- // try NV_coverage_sample extension
+ // try NV_coverage_sample extension
if(EGL.eglGetConfigAttrib(display, config, EGLExt.EGL_COVERAGE_BUFFERS_NV, val)) {
if(val.get(0)>0 &&
EGL.eglGetConfigAttrib(display, config, EGLExt.EGL_COVERAGE_SAMPLES_NV, val)) {
- caps.setSampleExtension(GLGraphicsConfigurationUtil.NV_coverage_sample);
+ caps.setSampleExtension(GLGraphicsConfigurationUtil.NV_coverage_sample);
caps.setSampleBuffers(true);
caps.setNumSamples(val.get(0));
}
@@ -269,7 +269,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_TRANSPARENT_BLUE_VALUE, val)) {
caps.setTransparentBlueValue(val.get(0)==EGL.EGL_DONT_CARE?-1:val.get(0));
}
- /** Not defined in EGL
+ /** Not defined in EGL
if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_TRANSPARENT_ALPHA_VALUE, val)) {
caps.setTransparentAlphaValue(val.get(0)==EGL.EGL_DONT_CARE?-1:val.get(0));
} */
@@ -294,16 +294,16 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
caps.setDepthBits(val.get(0));
}
- // Since the passed GLProfile may be null,
+ // Since the passed GLProfile may be null,
// we use EGL_RENDERABLE_TYPE derived profile as created in the EGLGLCapabilities constructor.
- final int availableTypeBits = EGLConfigDrawableTypeBits(device, config);
+ final int availableTypeBits = EGLConfigDrawableTypeBits(device, config);
final int drawableTypeBits = winattrmask & availableTypeBits;
if( 0 == drawableTypeBits ) {
return null;
}
-
- return (EGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, caps);
+
+ return (EGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, caps);
}
public static IntBuffer GLCapabilities2AttribList(GLCapabilitiesImmutable caps) {
@@ -313,7 +313,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
attrs.put(idx++, EGL.EGL_SURFACE_TYPE);
final int surfaceType;
if( caps.isOnscreen() ) {
- surfaceType = EGL.EGL_WINDOW_BIT;
+ surfaceType = EGL.EGL_WINDOW_BIT;
} else if( caps.isFBO() ) {
surfaceType = EGL.EGL_PBUFFER_BIT; // native replacement!
} else if( caps.isPBuffer() ) {
@@ -338,7 +338,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
attrs.put(idx++, EGL.EGL_ALPHA_SIZE);
attrs.put(idx++, caps.getAlphaBits());
}
-
+
if(caps.getStencilBits()>0) {
attrs.put(idx++, EGL.EGL_STENCIL_SIZE);
attrs.put(idx++, caps.getStencilBits());
@@ -382,7 +382,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
attrs.put(idx++, caps.getTransparentAlphaValue()>=0?caps.getTransparentAlphaValue():EGL.EGL_DONT_CARE; */
}
- // 28
+ // 28
attrs.put(idx++, EGL.EGL_RENDERABLE_TYPE);
if(caps.getGLProfile().usesNativeGLES1()) {
attrs.put(idx++, EGL.EGL_OPENGL_ES_BIT);
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
index b44e085..54510b5 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -75,10 +75,10 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
static GraphicsConfigurationFactory nativeGraphicsConfigurationFactory = null;
static GraphicsConfigurationFactory kdeglGraphicsConfigurationFactory = null;
static GraphicsConfigurationFactory fallbackGraphicsConfigurationFactory = null;
-
+
static void registerFactory() {
GraphicsConfigurationFactory eglFactory = new EGLGraphicsConfigurationFactory();
-
+
// become the pre-selector for X11/.. to match the native visual id w/ EGL, if native ES is selected
final String nwType = NativeWindowFactory.getNativeWindowType(false);
if(NativeWindowFactory.TYPE_X11 == nwType) {
@@ -86,35 +86,36 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
if(null != nativeGraphicsConfigurationFactory) {
fallbackGraphicsConfigurationFactory = nativeGraphicsConfigurationFactory;
} else {
- fallbackGraphicsConfigurationFactory = GraphicsConfigurationFactory.getFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, CapabilitiesImmutable.class);
+ 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);
- } else if(NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false)) {
+ } else if(NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false)) {
} */
-
+
// become the selector for KD/EGL ..
- kdeglGraphicsConfigurationFactory = GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.egl.EGLGraphicsDevice.class, GLCapabilitiesImmutable.class, eglFactory);
+ kdeglGraphicsConfigurationFactory = GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.egl.EGLGraphicsDevice.class, GLCapabilitiesImmutable.class, eglFactory);
}
-
+
static void unregisterFactory() {
final String nwType = NativeWindowFactory.getNativeWindowType(false);
if(NativeWindowFactory.TYPE_X11 == nwType) {
- GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, GLCapabilitiesImmutable.class, nativeGraphicsConfigurationFactory);
+ 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);
- } else if(NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false)) {
+ } else if(NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false)) {
} */
nativeGraphicsConfigurationFactory = null;
fallbackGraphicsConfigurationFactory = null;
-
+
GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.egl.EGLGraphicsDevice.class, GLCapabilitiesImmutable.class, kdeglGraphicsConfigurationFactory);
kdeglGraphicsConfigurationFactory = null;
}
-
+
private EGLGraphicsConfigurationFactory() {
}
+ @Override
protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl (
CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested,
CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) {
@@ -139,21 +140,21 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
AbstractGraphicsDevice absDevice = absScreen.getDevice();
if(null==absDevice) {
throw new GLException("Null AbstractGraphicsDevice");
- }
-
+ }
+
AbstractGraphicsConfiguration cfg = null;
-
+
if( absDevice instanceof EGLGraphicsDevice ) {
cfg = chooseGraphicsConfigurationStatic((GLCapabilitiesImmutable) capsChosen,
(GLCapabilitiesImmutable) capsRequested,
(GLCapabilitiesChooser) chooser,
- absScreen, nativeVisualID, false);
+ absScreen, nativeVisualID, false);
} else {
- // handle non native cases (X11, ..)
+ // handle non native cases (X11, ..)
if(null == fallbackGraphicsConfigurationFactory) {
throw new InternalError("Native fallback GraphicsConfigurationFactory is null, but call issued for device: "+absDevice+" of type "+absDevice.getClass().getSimpleName());
}
-
+
if(glCapsChosen.getGLProfile().usesNativeGLES()) {
if(DEBUG) {
System.err.println("EGLGraphicsConfigurationFactory.choose..: Handle native device "+absDevice.getClass().getSimpleName());
@@ -175,7 +176,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
System.err.println("EGLGraphicsConfigurationFactory.choose..: Delegate to "+fallbackGraphicsConfigurationFactory.getClass().getSimpleName());
}
cfg = fallbackGraphicsConfigurationFactory.chooseGraphicsConfiguration(capsChosen, capsRequested, chooser, absScreen, nativeVisualID);
- }
+ }
}
return cfg;
}
@@ -219,7 +220,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
public static EGLGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilitiesImmutable capsChosen,
GLCapabilitiesImmutable capsReq,
GLCapabilitiesChooser chooser,
- AbstractGraphicsScreen absScreen, int nativeVisualID,
+ AbstractGraphicsScreen absScreen, int nativeVisualID,
boolean forceTransparentFlag) {
if (capsChosen == null) {
capsChosen = new GLCapabilities(null);
@@ -232,7 +233,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
if(null==absDevice) {
throw new GLException("Null AbstractGraphicsDevice");
}
-
+
final EGLGraphicsDevice eglDevice;
final boolean ownEGLDisplay;
if( absDevice instanceof EGLGraphicsDevice ) {
@@ -253,7 +254,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
if(DEBUG) {
System.err.println("eglChooseConfig failed with given capabilities "+capsChosen);
}
-
+
// Last try .. add a fixed embedded profile [ATI, Nokia, Intel, ..]
//
// rgb888 - d16, s4
@@ -268,7 +269,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
fixedCaps.setOnscreen(false);
fixedCaps.setPBuffer(capsChosen.isPBuffer());
fixedCaps.setFBO(capsChosen.isFBO());
- }
+ }
if(DEBUG) {
System.err.println("trying fixed caps (1): "+fixedCaps);
}
@@ -286,7 +287,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
fixedCaps.setOnscreen(false);
fixedCaps.setPBuffer(capsChosen.isPBuffer());
fixedCaps.setFBO(capsChosen.isFBO());
- }
+ }
if(DEBUG) {
System.err.println("trying fixed caps (2): "+fixedCaps);
}
@@ -306,7 +307,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
fixedCaps.setOnscreen(false);
fixedCaps.setPBuffer(capsChosen.isPBuffer());
fixedCaps.setFBO(capsChosen.isFBO());
- }
+ }
if(DEBUG) {
System.err.println("trying fixed caps (3): "+fixedCaps);
}
@@ -322,8 +323,8 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
return res;
}
-
- static EGLGraphicsConfiguration eglChooseConfig(EGLGraphicsDevice device,
+
+ static EGLGraphicsConfiguration eglChooseConfig(EGLGraphicsDevice device,
GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested,
GLCapabilitiesChooser chooser,
AbstractGraphicsScreen absScreen,
@@ -354,7 +355,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
final IntBuffer attrs = EGLGraphicsConfiguration.GLCapabilities2AttribList(capsChosen);
PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0));
- // 1st choice: get GLCapabilities based on users GLCapabilities
+ // 1st choice: get GLCapabilities based on users GLCapabilities
// setting recommendedIndex as preferred choice
// skipped if nativeVisualID is given
if( VisualIDHolder.VID_UNDEFINED != nativeVisualID || !EGL.eglChooseConfig(eglDisplay, attrs, configs, configs.capacity(), numConfigs) ) {
@@ -387,7 +388,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
throw new GLException("EGLGraphicsConfiguration.eglChooseConfig: #2 Get all configs (eglGetConfigs) call failed, error "+toHexString(EGL.eglGetError()));
}
if (numConfigs.get(0) > 0) {
- availableCaps = eglConfigs2GLCaps(device, glp, configs, numConfigs.get(0), winattrmask, forceTransparentFlag);
+ availableCaps = eglConfigs2GLCaps(device, glp, configs, numConfigs.get(0), winattrmask, forceTransparentFlag);
}
}
@@ -400,7 +401,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
}
return null;
}
-
+
if(DEBUG) {
System.err.println("EGLGraphicsConfiguration.eglChooseConfig: got configs: "+availableCaps.size());
for(int i=0; i<availableCaps.size(); i++) {
@@ -415,7 +416,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
if(aCap.getVisualID(VIDType.NATIVE) != nativeVisualID) {
if(DEBUG) { System.err.println("Remove["+i+"] (mismatch VisualID): "+aCap); }
removedCaps.add(availableCaps.remove(i));
- } if( 0 == aCap.getDepthBits() && 0 < capsChosen.getDepthBits() ) {
+ } else if( 0 == aCap.getDepthBits() && 0 < capsChosen.getDepthBits() ) {
// Hack for HiSilicon/Vivante/Immersion.16 Renderer ..
if(DEBUG) { System.err.println("Remove["+i+"] (mismatch depth-bits): "+aCap); }
removedCaps.add(availableCaps.remove(i));
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java
index 19084ba..065f80d 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java
@@ -54,8 +54,8 @@ public class EGLOnscreenDrawable extends EGLDrawable {
}
@Override
- protected long createSurface(EGLGraphicsConfiguration config, int width, int height, long nativeSurfaceHandle) {
+ protected long createSurface(EGLGraphicsConfiguration config, int width, int height, long nativeSurfaceHandle) {
return EGL.eglCreateWindowSurface(config.getScreen().getDevice().getHandle(), config.getNativeConfig(), nativeSurfaceHandle, null);
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java
index 8dea10d..dac058d 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java
@@ -23,8 +23,8 @@ import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize {
protected static final boolean DEBUG = EGLDrawableFactory.DEBUG;
private final NativeSurface upstreamSurface;
- private final UpstreamSurfaceHook.MutableSize upstreamSurfaceHookMutableSize;
-
+ private final UpstreamSurfaceHook.MutableSize upstreamSurfaceHookMutableSize;
+
public EGLUpstreamSurfaceHook(NativeSurface upstream) {
upstreamSurface = upstream;
if(upstreamSurface instanceof ProxySurface) {
@@ -39,32 +39,33 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize {
upstreamSurfaceHookMutableSize = null;
}
}
-
+
public final NativeSurface getUpstreamSurface() { return upstreamSurface; }
-
+
static String getThreadName() { return Thread.currentThread().getName(); }
-
+
+ @Override
public final void setSize(int width, int height) {
if(null != upstreamSurfaceHookMutableSize) {
upstreamSurfaceHookMutableSize.setSize(width, height);
- }
+ }
}
-
+
@Override
public final void create(ProxySurface surface) {
final String dbgPrefix;
if(DEBUG) {
dbgPrefix = getThreadName() + ": EGLUpstreamSurfaceHook.create( up "+upstreamSurface.getClass().getSimpleName()+" -> this "+surface.getClass().getSimpleName()+" ): ";
- System.err.println(dbgPrefix+this);
+ System.err.println(dbgPrefix+this);
} else {
dbgPrefix = null;
}
-
+
if(upstreamSurface instanceof ProxySurface) {
- // propagate createNotify(..) so upstreamSurface will be created
+ // propagate createNotify(..) so upstreamSurface will be created
((ProxySurface)upstreamSurface).createNotify();
}
-
+
// lock upstreamSurface, so it can be used in case EGLDisplay is derived from it!
if(NativeSurface.LOCK_SURFACE_NOT_READY >= upstreamSurface.lockSurface()) {
throw new GLException("Could not lock: "+upstreamSurface);
@@ -73,16 +74,16 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize {
evalUpstreamSurface(dbgPrefix, surface);
} finally {
upstreamSurface.unlockSurface();
- }
+ }
}
-
+
private final void evalUpstreamSurface(String dbgPrefix, ProxySurface surface) {
//
// evaluate nature of upstreamSurface, may create EGL instances if required
//
-
+
boolean isEGLSurfaceValid = true; // assume yes
-
+
final EGLGraphicsDevice eglDevice;
final AbstractGraphicsConfiguration aConfig;
{
@@ -92,14 +93,14 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize {
System.err.println(dbgPrefix+"SurfaceDevice: "+surfaceDevice.getClass().getSimpleName()+", hash 0x"+Integer.toHexString(surfaceDevice.hashCode())+", "+surfaceDevice);
System.err.println(dbgPrefix+"SurfaceConfig: "+surfaceConfig.getClass().getSimpleName()+", hash 0x"+Integer.toHexString(surfaceConfig.hashCode())+", "+surfaceConfig);
}
-
- final AbstractGraphicsConfiguration upstreamConfig = upstreamSurface.getGraphicsConfiguration();
+
+ final AbstractGraphicsConfiguration upstreamConfig = upstreamSurface.getGraphicsConfiguration();
final AbstractGraphicsDevice upstreamDevice = upstreamConfig.getScreen().getDevice();
if(DEBUG) {
System.err.println(dbgPrefix+"UpstreamDevice: "+upstreamDevice.getClass().getSimpleName()+", hash 0x"+Integer.toHexString(upstreamDevice.hashCode())+", "+upstreamDevice);
System.err.println(dbgPrefix+"UpstreamConfig: "+upstreamConfig.getClass().getSimpleName()+", hash 0x"+Integer.toHexString(upstreamConfig.hashCode())+", "+upstreamConfig);
}
-
+
if( surfaceDevice instanceof EGLGraphicsDevice ) {
eglDevice = (EGLGraphicsDevice) surfaceDevice;
aConfig = surfaceConfig;
@@ -129,13 +130,13 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize {
surface.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_DEVICE );
}
}
-
+
final GLCapabilitiesImmutable capsRequested = (GLCapabilitiesImmutable) aConfig.getRequestedCapabilities();
final EGLGraphicsConfiguration eglConfig;
if( aConfig instanceof EGLGraphicsConfiguration ) {
// Config is already in EGL type - reuse ..
final EGLGLCapabilities capsChosen = (EGLGLCapabilities) aConfig.getChosenCapabilities();
- if( !isEGLSurfaceValid || !EGLGraphicsConfiguration.isEGLConfigValid(eglDevice.getHandle(), capsChosen.getEGLConfig()) ) {
+ if( !isEGLSurfaceValid || !EGLGraphicsConfiguration.isEGLConfigValid(eglDevice.getHandle(), capsChosen.getEGLConfig()) ) {
// 'refresh' the native EGLConfig handle
capsChosen.setEGLConfig(EGLGraphicsConfiguration.EGLConfigId2EGLConfig(eglDevice.getHandle(), capsChosen.getEGLConfigID()));
if( 0 == capsChosen.getEGLConfig() ) {
@@ -166,7 +167,7 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize {
isEGLSurfaceValid = false;
}
surface.setGraphicsConfiguration(eglConfig);
-
+
if(isEGLSurfaceValid) {
isEGLSurfaceValid = EGLDrawable.isValidEGLSurface(eglDevice.getHandle(), upstreamSurface.getSurfaceHandle());
}
@@ -182,15 +183,15 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize {
if(DEBUG) {
System.err.println(dbgPrefix+"Fin: EGL surface n/a - TBD: "+upstreamSurface);
}
- }
+ }
}
@Override
public final void destroy(ProxySurface surface) {
if(EGLDrawableFactory.DEBUG) {
- System.err.println("EGLUpstreamSurfaceHook.destroy("+surface.getClass().getSimpleName()+"): "+this);
+ System.err.println("EGLUpstreamSurfaceHook.destroy("+surface.getClass().getSimpleName()+"): "+this);
}
- surface.clearUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
+ surface.clearUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
if(upstreamSurface instanceof ProxySurface) {
((ProxySurface)upstreamSurface).destroyNotify();
}
@@ -205,7 +206,7 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize {
public final int getHeight(ProxySurface s) {
return upstreamSurface.getHeight();
}
-
+
@Override
public String toString() {
final String us_s = null != upstreamSurface ? ( upstreamSurface.getClass().getName() + ": 0x" + Long.toHexString(upstreamSurface.getSurfaceHandle()) ) : "nil";
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java b/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java
index f816151..e6d43d9 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java
@@ -19,16 +19,16 @@ public class EGLWrappedSurface extends WrappedSurface {
}
return new EGLWrappedSurface(surface);
}
-
+
public EGLWrappedSurface(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);
+ System.err.println("EGLWrappedSurface.ctor(): "+this);
}
}
@Override
- public final NativeSurface getUpstreamSurface() {
- return ((EGLUpstreamSurfaceHook)super.getUpstreamSurfaceHook()).getUpstreamSurface();
- }
+ public final NativeSurface getUpstreamSurface() {
+ return ((EGLUpstreamSurfaceHook)super.getUpstreamSurfaceHook()).getUpstreamSurface();
+ }
}
diff --git a/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java b/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java
index 9165dbc..a4aa1c7 100644
--- a/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java
+++ b/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java
@@ -6,9 +6,9 @@
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
-**
+**
** http://oss.sgi.com/projects/FreeB
-**
+**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
@@ -24,13 +24,13 @@
** except that Section 2.2 and 11 are omitted. Any differences between
** the Alternative License and the SGI License are offered solely by Sun
** and not by SGI.
-**
+**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
-**
+**
** Additional Notice Provisions: The application programming interfaces
** established by SGI in conjunction with the Original Code are The
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -45,56 +45,56 @@
** $Header$
*/
-/*
+/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
+ * modification, are permitted provided that the following conditions are
* met:
- *
- * * Redistributions of source code must retain the above copyright
+ *
+ * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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
+ * 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.
*/
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -107,7 +107,7 @@
* 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.
@@ -125,7 +125,7 @@ import com.jogamp.common.nio.Buffers;
* <p/>
* <p/>
* Created 11-jan-2004
- *
+ *
* @author Erik Duijs
* @author Kenneth Russell
*/
@@ -155,7 +155,7 @@ public class ProjectDouble {
private final double[] forward = new double[3];
private final double[] side = new double[3];
private final double[] up = new double[3];
-
+
// Buffer-based implementation
private DoubleBuffer locbuf;
private final DoubleBuffer matrixBuf;
@@ -227,7 +227,7 @@ public class ProjectDouble {
/**
* Method __gluMultMatrixVecd
- *
+ *
* @param matrix
* @param in
* @param out
@@ -244,7 +244,7 @@ public class ProjectDouble {
/**
* Method __gluMultMatrixVecd
- *
+ *
* @param matrix
* @param in
* @param out
@@ -265,7 +265,7 @@ public class ProjectDouble {
/**
* @param src
* @param inverse
- *
+ *
* @return
*/
private boolean __gluInvertMatrixd(double[] src, double[] inverse) {
@@ -335,7 +335,7 @@ public class ProjectDouble {
/**
* @param src
* @param inverse
- *
+ *
* @return
*/
private boolean __gluInvertMatrixd(DoubleBuffer src, DoubleBuffer inverse) {
@@ -525,7 +525,7 @@ public class ProjectDouble {
/**
* Method gluOrtho2D.
- *
+ *
* @param left
* @param right
* @param bottom
@@ -537,7 +537,7 @@ public class ProjectDouble {
/**
* Method gluPerspective.
- *
+ *
* @param fovy
* @param aspect
* @param zNear
@@ -570,7 +570,7 @@ public class ProjectDouble {
/**
* Method gluLookAt
- *
+ *
* @param eyex
* @param eyey
* @param eyez
@@ -631,7 +631,7 @@ public class ProjectDouble {
/**
* Method gluProject
- *
+ *
* @param objx
* @param objy
* @param objz
@@ -639,7 +639,7 @@ public class ProjectDouble {
* @param projMatrix
* @param viewport
* @param win_pos
- *
+ *
* @return
*/
public boolean gluProject(double objx,
@@ -685,7 +685,7 @@ public class ProjectDouble {
/**
* Method gluProject
- *
+ *
* @param objx
* @param objy
* @param objz
@@ -693,7 +693,7 @@ public class ProjectDouble {
* @param projMatrix
* @param viewport
* @param win_pos
- *
+ *
* @return
*/
public boolean gluProject(double objx,
@@ -738,7 +738,7 @@ public class ProjectDouble {
/**
* Method gluUnproject
- *
+ *
* @param winx
* @param winy
* @param winz
@@ -746,7 +746,7 @@ public class ProjectDouble {
* @param projMatrix
* @param viewport
* @param obj_pos
- *
+ *
* @return
*/
public boolean gluUnProject(double winx,
@@ -799,7 +799,7 @@ public class ProjectDouble {
/**
* Method gluUnproject
- *
+ *
* @param winx
* @param winy
* @param winz
@@ -807,7 +807,7 @@ public class ProjectDouble {
* @param projMatrix
* @param viewport
* @param obj_pos
- *
+ *
* @return
*/
public boolean gluUnProject(double winx,
@@ -858,7 +858,7 @@ public class ProjectDouble {
/**
* Method gluUnproject4
- *
+ *
* @param winx
* @param winy
* @param winz
@@ -869,7 +869,7 @@ public class ProjectDouble {
* @param near
* @param far
* @param obj_pos
- *
+ *
* @return
*/
public boolean gluUnProject4(double winx,
@@ -923,7 +923,7 @@ public class ProjectDouble {
/**
* Method gluUnproject4
- *
+ *
* @param winx
* @param winy
* @param winz
@@ -934,7 +934,7 @@ public class ProjectDouble {
* @param near
* @param far
* @param obj_pos
- *
+ *
* @return
*/
public boolean gluUnProject4(double winx,
@@ -987,7 +987,7 @@ public class ProjectDouble {
/**
* Method gluPickMatrix
- *
+ *
* @param x
* @param y
* @param deltaX
@@ -1014,7 +1014,7 @@ public class ProjectDouble {
/**
* Method gluPickMatrix
- *
+ *
* @param x
* @param y
* @param deltaX
diff --git a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java
index 7cd7da5..717b125 100644
--- a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java
+++ b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java
@@ -6,15 +6,15 @@
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
-**
+**
** http://oss.sgi.com/projects/FreeB
-**
+**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
-**
+**
** NOTE: The Original Code (as defined below) has been licensed to Sun
** Microsystems, Inc. ("Sun") under the SGI Free Software License B
** (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
-**
+**
** Additional Notice Provisions: The application programming interfaces
** established by SGI in conjunction with the Original Code are The
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -45,56 +45,56 @@
** $Header$
*/
-/*
+/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
+ * modification, are permitted provided that the following conditions are
* met:
- *
- * * Redistributions of source code must retain the above copyright
+ *
+ * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
- * * Neither the name of 'LWJGL' nor the names of
- * its contributors may be used to endorse or promote products derived
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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
+ * 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.
*/
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -107,7 +107,7 @@
* 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.
@@ -124,8 +124,8 @@ import com.jogamp.opengl.util.glsl.ShaderState;
/**
* GLUquadricImpl.java
- *
- *
+ *
+ *
* Created 22-dec-2003 (originally Quadric.java)
* @author Erik Duijs
* @author Kenneth Russell, Sven Gothel
@@ -164,6 +164,7 @@ public class GLUquadricImpl implements GLUquadric {
replaceImmModeSink();
}
+ @Override
public void enableImmModeSink(boolean val) {
if(gl.isGL2()) {
immModeSinkEnabled=val;
@@ -175,10 +176,12 @@ public class GLUquadricImpl implements GLUquadric {
}
}
+ @Override
public boolean isImmModeSinkEnabled() {
return immModeSinkEnabled;
}
+ @Override
public void setImmMode(boolean val) {
if(immModeSinkEnabled) {
immModeSinkImmediate=val;
@@ -187,29 +190,31 @@ public class GLUquadricImpl implements GLUquadric {
}
}
+ @Override
public boolean getImmMode() {
return immModeSinkImmediate;
}
+ @Override
public ImmModeSink replaceImmModeSink() {
if(!immModeSinkEnabled) return null;
ImmModeSink res = immModeSink;
if(useGLSL) {
if(null != shaderState) {
- immModeSink = ImmModeSink.createGLSL (32,
- 3, GL.GL_FLOAT, // vertex
+ immModeSink = ImmModeSink.createGLSL (32,
+ 3, GL.GL_FLOAT, // vertex
0, GL.GL_FLOAT, // color
USE_NORM?3:0, normalType, // normal
USE_TEXT?2:0, GL.GL_FLOAT, // texCoords
GL.GL_STATIC_DRAW, shaderState);
} else {
- immModeSink = ImmModeSink.createGLSL (32,
- 3, GL.GL_FLOAT, // vertex
+ immModeSink = ImmModeSink.createGLSL (32,
+ 3, GL.GL_FLOAT, // vertex
0, GL.GL_FLOAT, // color
USE_NORM?3:0, normalType, // normal
USE_TEXT?2:0, GL.GL_FLOAT, // texCoords
- GL.GL_STATIC_DRAW, shaderProgram);
+ GL.GL_STATIC_DRAW, shaderProgram);
}
} else {
immModeSink = ImmModeSink.createFixed(32,
@@ -222,6 +227,7 @@ public class GLUquadricImpl implements GLUquadric {
return res;
}
+ @Override
public void resetImmModeSink(GL gl) {
if(immModeSinkEnabled) {
immModeSink.reset(gl);
@@ -229,7 +235,7 @@ public class GLUquadricImpl implements GLUquadric {
}
/**
- * specifies the draw style for quadrics.
+ * specifies the draw style for quadrics.
*
* The legal values are as follows:
*
@@ -243,7 +249,7 @@ public class GLUquadricImpl implements GLUquadric {
* separating coplanar faces will not be drawn.
*
* GLU.POINT: Quadrics are rendered as a set of points.
- *
+ *
* @param drawStyle The drawStyle to set
*/
public void setDrawStyle(int drawStyle) {
@@ -260,7 +266,7 @@ public class GLUquadricImpl implements GLUquadric {
*
* GLU.SMOOTH: One normal is generated for every vertex of a quadric. This
* is the default.
- *
+ *
* @param normals The normals to set
*/
public void setNormals(int normals) {
@@ -277,7 +283,7 @@ public class GLUquadricImpl implements GLUquadric {
*
* Note that the interpretation of outward and inward depends on the quadric
* being drawn.
- *
+ *
* @param orientation The orientation to set
*/
public void setOrientation(int orientation) {
@@ -292,7 +298,7 @@ public class GLUquadricImpl implements GLUquadric {
*
* The manner in which texture coordinates are generated depends upon the
* specific quadric rendered.
- *
+ *
* @param textureFlag The textureFlag to set
*/
public void setTextureFlag(boolean textureFlag) {
@@ -512,10 +518,10 @@ public class GLUquadricImpl implements GLUquadric {
glNormal3f(gl, 0.0f, 0.0f, -1.0f);
}
}
-
+
da = 2.0f * PI / slices;
dr = (outerRadius - innerRadius) / loops;
-
+
switch (drawStyle) {
case GLU.GLU_FILL:
{
@@ -648,18 +654,18 @@ public class GLUquadricImpl implements GLUquadric {
* through startAngle + sweepAngle is included (where 0 degrees is along
* the +y axis, 90 degrees along the +x axis, 180 along the -y axis, and
* 270 along the -x axis).
- *
+ *
* The partial disk has a radius of outerRadius, and contains a concentric
* circular hole with a radius of innerRadius. If innerRadius is zero, then
* no hole is generated. The partial disk is subdivided around the z axis
* into slices (like pizza slices), and also about the z axis into rings
* (as specified by slices and loops, respectively).
- *
+ *
* With respect to orientation, the +z side of the partial disk is
* considered to be outside (see gluQuadricOrientation). This means that if
* the orientation is set to GLU.GLU_OUTSIDE, then any normals generated point
* along the +z axis. Otherwise, they point along the -z axis.
- *
+ *
* If texturing is turned on (with gluQuadricTexture), texture coordinates
* are generated linearly such that where r=outerRadius, the value at (r, 0, 0)
* is (1, 0.5), at (0, r, 0) it is (0.5, 1), at (-r, 0, 0) it is (0, 0.5),
@@ -1204,7 +1210,7 @@ public class GLUquadricImpl implements GLUquadric {
*/
private void normal3f(GL gl, float x, float y, float z) {
float mag;
-
+
mag = (float)Math.sqrt(x * x + y * y + z * z);
if (mag > 0.00001F) {
x /= mag;
diff --git a/src/jogl/classes/jogamp/opengl/glu/Glue.java b/src/jogl/classes/jogamp/opengl/glu/Glue.java
index 636d17f..2ad3d8c 100644
--- a/src/jogl/classes/jogamp/opengl/glu/Glue.java
+++ b/src/jogl/classes/jogamp/opengl/glu/Glue.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -89,15 +89,15 @@ public class Glue {
"null control point reference",
"duplicate point on piecewise linear trimming curve"
} ;
-
+
/** Creates a new instance of Glue */
public Glue() {
}
-
+
public static String __gluNURBSErrorString( int errno ) {
return( __gluNurbsErrors[ errno ] );
}
-
+
private static String[] __gluTessErrors = {
" ",
"gluTessBeginPolygon() must precede a gluTessEndPolygon",
@@ -107,7 +107,7 @@ public class Glue {
"a coordinate is too large",
"need combine callback"
};
-
+
public static String __gluTessErrorString( int errno ) {
return( __gluTessErrors[ errno ] );
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/error/Error.java b/src/jogl/classes/jogamp/opengl/glu/error/Error.java
index 2f49db9..ffb8d94 100644
--- a/src/jogl/classes/jogamp/opengl/glu/error/Error.java
+++ b/src/jogl/classes/jogamp/opengl/glu/error/Error.java
@@ -6,9 +6,9 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
@@ -24,13 +24,13 @@
* except that Section 2.2 and 11 are omitted. Any differences between
* the Alternative License and the SGI License are offered solely by Sun
* and not by SGI.
- *
+ *
* Original Code. The Original Code is: OpenGL Sample Implementation,
* Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -53,7 +53,7 @@ import jogamp.opengl.glu.Glue;
* @author Administrator
*/
public class Error {
-
+
private static String[] glErrorStrings = {
"invalid enumerant",
"invalid value",
@@ -63,7 +63,7 @@ public class Error {
"out of memory",
"invalid framebuffer operation"
};
-
+
private static String[] gluErrorStrings = {
"invalid enumerant",
"invalid value",
@@ -71,11 +71,11 @@ public class Error {
"",
"invalid operation"
};
-
+
/** Creates a new instance of Error */
public Error() {
}
-
+
public static String gluErrorString( int errorCode ) {
if( errorCode == 0 ) {
return( "no error" );
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 2ef4468..4213dfd 100644
--- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java
+++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java
@@ -48,7 +48,7 @@ import javax.media.opengl.glu.gl2.GLUgl2;
class GL2CurveEvaluator implements CurveEvaluator {
/**
- * Output triangles (for callback) or render curve
+ * Output triangles (for callback) or render curve
*/
private boolean output_triangles;
@@ -92,6 +92,7 @@ class GL2CurveEvaluator implements CurveEvaluator {
/**
* Pushes eval bit
*/
+ @Override
public void bgnmap1f() {
// DONE
if (output_triangles) {
@@ -108,6 +109,7 @@ class GL2CurveEvaluator implements CurveEvaluator {
/**
* Pops all OpenGL attributes
*/
+ @Override
public void endmap1f() {
// DONE
if (output_triangles) {
@@ -127,6 +129,7 @@ class GL2CurveEvaluator implements CurveEvaluator {
* @param order curve order
* @param ps control points
*/
+ @Override
public void map1f(int type, float ulo, float uhi, int stride, int order,
CArrayOfFloats ps) {
if (output_triangles) {
@@ -153,6 +156,7 @@ class GL2CurveEvaluator implements CurveEvaluator {
* Calls opengl enable
* @param type what to enable
*/
+ @Override
public void enable(int type) {
// DONE
gl.glEnable(type);
@@ -164,6 +168,7 @@ class GL2CurveEvaluator implements CurveEvaluator {
* @param u1 low u
* @param u2 high u
*/
+ @Override
public void mapgrid1f(int nu, float u1, float u2) {
if (output_triangles) {
// System.out.println("TODO curveevaluator.mapgrid1f");
@@ -179,6 +184,7 @@ class GL2CurveEvaluator implements CurveEvaluator {
* @param from lowest param
* @param to highest param
*/
+ @Override
public void mapmesh1f(int style, int from, int to) {
/* //DEBUG drawing control points
this.poradi++;
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 155c4f9..e9c9fca 100644
--- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java
+++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java
@@ -72,6 +72,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator {
/**
* Pushes eval bit
*/
+ @Override
public void bgnmap2f() {
if (output_triangles) {
@@ -88,6 +89,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator {
* Sets glPolygonMode
* @param style polygon mode (N_MESHFILL/N_MESHLINE/N_MESHPOINT)
*/
+ @Override
public void polymode(int style) {
if (!output_triangles) {
switch (style) {
@@ -109,6 +111,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator {
/**
* Pops all attributes
*/
+ @Override
public void endmap2f() {
// TODO Auto-generated method stub
if (output_triangles) {
@@ -126,6 +129,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator {
* @param vlo
* @param vhi
*/
+ @Override
public void domain2f(float ulo, float uhi, float vlo, float vhi) {
// DONE
}
@@ -139,6 +143,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator {
* @param v0 lowest v
* @param v1 highest v
*/
+ @Override
public void mapgrid2f(int nu, float u0, float u1, int nv, float v0, float v1) {
if (output_triangles) {
@@ -157,6 +162,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator {
* @param vmin minimum V
* @param vmax maximum V
*/
+ @Override
public void mapmesh2f(int style, int umin, int umax, int vmin, int vmax) {
if (output_triangles) {
// System.out.println("TODO openglsurfaceavaluator.mapmesh2f output_triangles");
@@ -195,6 +201,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator {
* @param vorder surface order in v direction
* @param pts control points
*/
+ @Override
public void map2f(int type, float ulo, float uhi, int ustride, int uorder,
float vlo, float vhi, int vstride, int vorder, CArrayOfFloats pts) {
// TODO Auto-generated method stub
@@ -210,6 +217,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator {
* Calls opengl enable
* @param type what to enable
*/
+ @Override
public void enable(int type) {
//DONE
gl.glEnable(type);
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 58b5654..f83b3a8 100644
--- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java
+++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java
@@ -43,9 +43,9 @@ import javax.media.opengl.glu.GLUnurbs;
/**
* Base object for working with NURBS curves and surfaces
- *
+ *
* @author Tomas Hrasky
- *
+ *
*/
public class GLUgl2nurbsImpl implements GLUnurbs {
@@ -272,7 +272,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
/**
* Sets domain distance for dom.dist. sampling in u direction
- *
+ *
* @param d
* distance
*/
@@ -283,7 +283,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
/**
* Sets domain distance for dom.dist. sampling in v direction
- *
+ *
* @param d
* distance
*/
@@ -303,7 +303,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
/**
* Calls a method with given name and passes argumet
- *
+ *
* @param name
* name of a method to be called
* @param arg
@@ -329,7 +329,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
/**
* Calls a method with given name
- *
+ *
* @param name
* name of a method to be called
*/
@@ -349,7 +349,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
/**
* Begins a NURBS curve
- *
+ *
* @param o_curve
* curve object
*/
@@ -381,7 +381,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
/**
* Begins new surface
- *
+ *
* @param o_surface
* surface object
*/
@@ -503,7 +503,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
/**
* Method for handling error codes
- *
+ *
* @param i
* error code
*/
@@ -539,7 +539,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
/**
* Make a NURBS curve
- *
+ *
* @param nknots
* number of knots in knot vector
* @param knot
@@ -587,7 +587,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
/**
* Check knot vector specification
- *
+ *
* @param knots
* knot vector
* @param msg
@@ -607,7 +607,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
/**
* Draw a curve
- *
+ *
* @param o_nurbscurve
* NURBS curve object
*/
@@ -660,7 +660,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
/**
* Draw NURBS surface
- *
+ *
* @param o_nurbssurface
* NURBS surface object
*/
@@ -704,7 +704,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
/**
* Define a map of given properties
- *
+ *
* @param type
* map type
* @param rational
@@ -719,7 +719,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
/**
* Set NURBS property
- *
+ *
* @param type
* property type
* @param tag
@@ -744,7 +744,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
/**
* Set parameters of existing property
- *
+ *
* @param prop
* property
*/
@@ -755,7 +755,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
/**
* Set given property to rendering hints
- *
+ *
* @param prop
* property to be set
*/
@@ -767,7 +767,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
/**
* Sets wheteher we use domain distance sampling
- *
+ *
* @param i
* domain distance sampling flag
*/
@@ -805,7 +805,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs {
/**
* Make NURBS surface
- *
+ *
* @param sknot_count
* number of knots in s direction
* @param sknot
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java
index f5fe17a..81a99be 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -64,7 +64,7 @@ public class BuildMipmap {
/** Creates a new instance of BuildMipmap */
public BuildMipmap() {
}
-
+
public static int gluBuild1DMipmapLevelsCore( GL gl, int target, int internalFormat,
int width, int widthPowerOf2, int format, int type, int userLevel,
int baseLevel, int maxLevel, ByteBuffer data ) {
@@ -78,34 +78,34 @@ public class BuildMipmap {
int maxsize;
int cmpts;
PixelStorageModes psm = new PixelStorageModes();
-
+
assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 );
assert( width >= 1 );
-
+
newwidth = widthPowerOf2;
levels = Mipmap.computeLog( newwidth );
-
+
levels += userLevel;
-
+
Mipmap.retrieveStoreModes( gl, psm );
try {
- newImage = Buffers.newDirectByteBuffer( Mipmap.image_size( width, 1, format,
+ newImage = Buffers.newDirectByteBuffer( Mipmap.image_size( width, 1, format,
GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer();
} catch( OutOfMemoryError ome ) {
return( GLU.GLU_OUT_OF_MEMORY );
}
newImage_width = width;
-
+
Image.fill_image( psm, width, 1, format, type, Mipmap.is_index( format ), data, newImage );
cmpts = Mipmap.elements_per_group( format, type );
gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, 2 );
gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 );
gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 );
gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 );
-
+
// if swap_bytes was set, swapping occurred in fill_image
gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE );
-
+
for( level = userLevel; level <= levels; level++ ) {
if( newImage_width == newwidth ) {
// user newimage for this level
@@ -132,10 +132,10 @@ public class BuildMipmap {
imageTemp = otherImage;
otherImage = newImage;
newImage = imageTemp;
-
+
newImage_width = newwidth;
if( baseLevel <= level && level <= maxLevel ) {
- gl.getGL2().glTexImage1D( target, level, internalFormat, newImage_width, 0,
+ gl.getGL2().glTexImage1D( target, level, internalFormat, newImage_width, 0,
format, GL2.GL_UNSIGNED_SHORT, newImage );
}
}
@@ -148,10 +148,10 @@ public class BuildMipmap {
gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() );
gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() );
gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) );
-
+
return( 0 );
}
-
+
public static int bitmapBuild2DMipmaps( GL gl, int target, int internalFormat,
int width, int height, int format, int type, ByteBuffer data ) {
int newwidth[] = new int[1];
@@ -166,37 +166,37 @@ public class BuildMipmap {
int maxsize;
int cmpts;
PixelStorageModes psm = new PixelStorageModes();
-
+
Mipmap.retrieveStoreModes( gl, psm );
-
+
Mipmap.closestFit( gl, target, width, height, internalFormat, format, type, newwidth, newheight );
-
+
levels = Mipmap.computeLog( newwidth[0] );
level = Mipmap.computeLog( newheight[0] );
if( level > levels ) {
levels = level;
}
-
+
try {
- newImage = Buffers.newDirectByteBuffer( Mipmap.image_size( width, height,
+ newImage = Buffers.newDirectByteBuffer( Mipmap.image_size( width, height,
format, GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer();
} catch( OutOfMemoryError ome ) {
return( GLU.GLU_OUT_OF_MEMORY );
}
newImage_width = width;
newImage_height = height;
-
+
Image.fill_image( psm, width, height, format, type, Mipmap.is_index( format ), data, newImage );
-
+
cmpts = Mipmap.elements_per_group( format, type );
gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, 2 );
gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 );
gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 );
gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 );
-
+
// if swap_bytes is set, swapping occurred in fill_image
gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE );
-
+
for( level = 0; level < levels; level++ ) {
if( newImage_width == newwidth[0] && newImage_height == newheight[0] ) {
newImage.rewind();
@@ -216,13 +216,13 @@ public class BuildMipmap {
return( GLU.GLU_OUT_OF_MEMORY );
}
}
- ScaleInternal.scale_internal( cmpts, newImage_width, newImage_height,
+ ScaleInternal.scale_internal( cmpts, newImage_width, newImage_height,
newImage, newwidth[0], newheight[0], otherImage );
// swap newImage and otherImage
tempImage = otherImage;
otherImage = newImage;
newImage = tempImage;
-
+
newImage_width = newwidth[0];
newImage_height = newheight[0];
newImage.rewind();
@@ -241,10 +241,10 @@ public class BuildMipmap {
gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() );
gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() );
gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) );
-
+
return( 0 );
}
-
+
public static int gluBuild2DMipmapLevelsCore( GL gl, int target, int internalFormat,
int width, int height, int widthPowerOf2, int heightPowerOf2,
int format, int type, int userLevel, int baseLevel, int maxLevel,
@@ -263,19 +263,19 @@ public class BuildMipmap {
int maxsize;
int cmpts;
int mark=-1;
-
+
boolean myswap_bytes;
int groups_per_line, element_size, group_size;
int rowsize, padding;
PixelStorageModes psm = new PixelStorageModes();
-
+
assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 );
assert( width >= 1 && height >= 1 );
-
+
if( type == GL2.GL_BITMAP ) {
return( bitmapBuild2DMipmaps( gl, target, internalFormat, width, height, format, type, data ) );
}
-
+
newwidth = widthPowerOf2;
newheight = heightPowerOf2;
levels = Mipmap.computeLog( newwidth );
@@ -283,9 +283,9 @@ public class BuildMipmap {
if( level > levels ) {
levels = level;
}
-
+
levels += userLevel;
-
+
Mipmap.retrieveStoreModes( gl, psm );
myswap_bytes = psm.getUnpackSwapBytes();
cmpts = Mipmap.elements_per_group( format, type );
@@ -294,28 +294,28 @@ public class BuildMipmap {
} else {
groups_per_line = width;
}
-
+
element_size = Mipmap.bytes_per_element( type );
group_size = element_size * cmpts;
if( element_size == 1 ) {
myswap_bytes = false;
}
-
+
rowsize = groups_per_line * group_size;
padding = ( rowsize % psm.getUnpackAlignment() );
if( padding != 0 ) {
rowsize += psm.getUnpackAlignment() - padding;
}
-
+
mark = psm.getUnpackSkipRows() * rowsize + psm.getUnpackSkipPixels() * group_size;
data.position( mark );
-
+
gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 );
gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 );
gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 );
-
+
level = userLevel;
-
+
// already power of two square
if( width == newwidth && height == newheight ) {
// use usersImage for level userLevel
@@ -333,7 +333,7 @@ public class BuildMipmap {
}
int nextWidth = newwidth / 2;
int nextHeight = newheight / 2;
-
+
// clamp to 1
if( nextWidth < 1 ) {
nextWidth = 1;
@@ -342,7 +342,7 @@ public class BuildMipmap {
nextHeight = 1;
}
memReq = Mipmap.image_size( nextWidth, nextHeight, format, type );
-
+
try {
switch( type ) {
case( GL2.GL_UNSIGNED_BYTE ):
@@ -452,7 +452,7 @@ public class BuildMipmap {
if( newheight < 1 ) {
newheight = 1;
}
-
+
myswap_bytes = false;
rowsize = newwidth * group_size;
memReq = Mipmap.image_size( newwidth, newheight, format, type );
@@ -498,7 +498,7 @@ public class BuildMipmap {
level = userLevel + 1;
} else { // user's image is not nice powerof2 size square
memReq = Mipmap.image_size( newwidth, newheight, format, type );
- try {
+ try {
switch( type ) {
case( GL2.GL_UNSIGNED_BYTE ):
case( GL2.GL_BYTE ):
@@ -535,15 +535,15 @@ public class BuildMipmap {
data.position( mark );
switch( type ) {
case( GL2.GL_UNSIGNED_BYTE ):
- ScaleInternal.scale_internal_ubyte( cmpts, width, height, data,
+ ScaleInternal.scale_internal_ubyte( cmpts, width, height, data,
newwidth, newheight, dstImage, element_size, rowsize, group_size );
break;
case( GL2.GL_BYTE ):
- ScaleInternal.scale_internal_byte( cmpts, width, height, data, newwidth,
+ ScaleInternal.scale_internal_byte( cmpts, width, height, data, newwidth,
newheight, dstImage, element_size, rowsize, group_size );
break;
case( GL2.GL_UNSIGNED_SHORT ):
- ScaleInternal.scale_internal_ushort( cmpts, width, height, data, newwidth,
+ ScaleInternal.scale_internal_ushort( cmpts, width, height, data, newwidth,
newheight, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes );
break;
case( GL2.GL_SHORT ):
@@ -620,7 +620,7 @@ public class BuildMipmap {
tempImage = srcImage;
srcImage = dstImage;
dstImage = tempImage;
-
+
if( levels != 0 ) { // use as little memory as possible
int nextWidth = newwidth / 2;
int nextHeight = newheight / 2;
@@ -630,7 +630,7 @@ public class BuildMipmap {
if( nextHeight < 1 ) {
nextHeight = 1;
}
-
+
memReq = Mipmap.image_size( nextWidth, nextHeight, format, type );
try {
switch( type ) {
@@ -670,7 +670,7 @@ public class BuildMipmap {
// level userLevel is in srcImage; nothing saved yet
level = userLevel;
}
-
+
gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE );
if( baseLevel <= level && level <= maxLevel ) {
srcImage.rewind();
@@ -685,7 +685,7 @@ public class BuildMipmap {
}
}
}
-
+
level++; // update current level for the loop
for( ; level <= levels; level++ ) {
srcImage.rewind();
@@ -754,12 +754,12 @@ public class BuildMipmap {
assert( false );
break;
}
-
+
// swap dstImage and srcImage
tempImage = srcImage;
srcImage = dstImage;
dstImage = tempImage;
-
+
if( newwidth > 1 ) {
newwidth /= 2;
rowsize /= 2;
@@ -769,7 +769,7 @@ public class BuildMipmap {
}
// compute amount to pad per row if any
int rowPad = rowsize % psm.getUnpackAlignment();
-
+
// should row be padded
if( rowPad == 0 ) {
// call teximage with srcImage untouched since its not padded
@@ -792,7 +792,7 @@ public class BuildMipmap {
int ii, jj;
int dstTrav;
int srcTrav;
-
+
// allocate new image for mipmap of size newRowLength x newheight
ByteBuffer newMipmapImage = null;
try {
@@ -813,7 +813,7 @@ public class BuildMipmap {
newMipmapImage.put( srcImage.get() );
}
}
-
+
// and use this new image for mipmapping instead
if( baseLevel <= level && level <= maxLevel ) {
newMipmapImage.rewind();
@@ -833,10 +833,10 @@ public class BuildMipmap {
gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() );
gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() );
gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) );
-
+
return( 0 );
}
-
+
public static int fastBuild2DMipmaps( GL gl, PixelStorageModes psm, int target,
int components, int width, int height, int format, int type, ByteBuffer data ) {
int[] newwidth = new int[1];
@@ -850,22 +850,22 @@ public class BuildMipmap {
int memReq;
int maxsize;
int cmpts;
-
- Mipmap.closestFit( gl, target, width, height, components, format, type, newwidth,
+
+ Mipmap.closestFit( gl, target, width, height, components, format, type, newwidth,
newheight );
-
+
levels = Mipmap.computeLog( newwidth[0] );
level = Mipmap.computeLog( newheight[0] );
if( level > levels ) {
levels = level;
}
-
+
cmpts = Mipmap.elements_per_group( format, type );
-
+
otherImage = null;
// No need to copy the user data if its packed correctly.
// Make sure that later routines don't change that data.
-
+
if( psm.getUnpackSkipRows() == 0 && psm.getUnpackSkipPixels() == 0 ) {
newImage = data;
newImage_width = width;
@@ -878,7 +878,7 @@ public class BuildMipmap {
int iter;
int iter2;
int i, j;
-
+
try {
newImage = Buffers.newDirectByteBuffer( Mipmap.image_size(width, height, format, GL2.GL_UNSIGNED_BYTE ) );
} catch( OutOfMemoryError err ) {
@@ -896,7 +896,7 @@ public class BuildMipmap {
rowsize = group_per_line * cmpts;
elements_per_line = width * cmpts;
start = psm.getUnpackSkipRows() * rowsize + psm.getUnpackSkipPixels() * cmpts;
-
+
for( i = 0; i < height; i++ ) {
iter = start;
data.position( iter );
@@ -906,13 +906,13 @@ public class BuildMipmap {
start += rowsize;
}
}
-
+
gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, 1 );
gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 );
gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 );
gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 );
gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE );
-
+
for( level = 0; level <= levels; level++ ) {
if( newImage_width == newwidth[0] && newImage_height == newheight[0] ) {
// use newImage for this level
@@ -937,7 +937,7 @@ public class BuildMipmap {
imageTemp = otherImage;
otherImage = newImage;
newImage = imageTemp;
-
+
newImage_width = newwidth[0];
newImage_height = newheight[0];
newImage.rewind();
@@ -956,10 +956,10 @@ public class BuildMipmap {
gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() );
gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() );
gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ;
-
+
return( 0 );
}
-
+
public static int gluBuild3DMipmapLevelsCore( GL gl, int target, int internalFormat,
int width, int height, int depth, int widthPowerOf2, int heightPowerOf2,
int depthPowerOf2, int format, int type, int userLevel, int baseLevel,
@@ -977,19 +977,19 @@ public class BuildMipmap {
int maxSize;
int cmpts;
int mark=-1;
-
+
boolean myswapBytes;
int groupsPerLine, elementSize, groupSize;
int rowsPerImage, imageSize;
int rowSize, padding;
PixelStorageModes psm = new PixelStorageModes();
-
+
assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 );
assert( width >= 1 && height >= 1 && depth >= 1 );
assert( type != GL2.GL_BITMAP );
-
+
srcImage = dstImage = null;
-
+
newWidth = widthPowerOf2;
newHeight = heightPowerOf2;
newDepth = depthPowerOf2;
@@ -1002,9 +1002,9 @@ public class BuildMipmap {
if( level > levels ) {
levels = level;
}
-
+
levels += userLevel;
-
+
Mipmap.retrieveStoreModes3D( gl, psm );
myswapBytes = psm.getUnpackSwapBytes();
cmpts = Mipmap.elements_per_group( format, type );
@@ -1013,42 +1013,42 @@ public class BuildMipmap {
} else {
groupsPerLine = width;
}
-
+
elementSize = Mipmap.bytes_per_element( type );
groupSize = elementSize * cmpts;
if( elementSize == 1 ) {
myswapBytes = false;
}
-
+
// 3dstuff
if( psm.getUnpackImageHeight() > 0 ) {
rowsPerImage = psm.getUnpackImageHeight();
} else {
rowsPerImage = height;
}
-
+
rowSize = groupsPerLine * groupSize;
padding = ( rowSize % psm.getUnpackAlignment() );
if( padding != 0 ) {
rowSize += psm.getUnpackAlignment() - padding;
}
-
+
imageSize = rowsPerImage * rowSize;
-
+
usersImage = ByteBuffer.wrap(data.array());
mark = psm.getUnpackSkipRows() * rowSize +
psm.getUnpackSkipPixels() * groupSize +
psm.getUnpackSkipImages() * imageSize;
usersImage.position( mark );
-
+
gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 );
gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 );
gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 );
gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, 0 );
gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, 0 );
-
+
level = userLevel;
-
+
if( width == newWidth && height == newHeight && depth == newDepth ) {
// use usersImage for level userlevel
if( baseLevel <= level && level <= maxLevel ) {
@@ -1068,7 +1068,7 @@ public class BuildMipmap {
int nextWidth = newWidth / 2;
int nextHeight = newHeight / 2;
int nextDepth = newDepth / 2;
-
+
// clamp to one
if( nextWidth < 1 ) {
nextWidth = 1;
@@ -1116,13 +1116,13 @@ public class BuildMipmap {
gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() );
return( GLU.GLU_OUT_OF_MEMORY );
}
-
+
if( dstImage != null ) {
switch( type ) {
case( GL2.GL_UNSIGNED_BYTE ):
if( depth > 1 ) {
HalveImage.halveImage3D( cmpts, new ExtractUByte(), width, height, depth,
- usersImage, dstImage, elementSize,
+ usersImage, dstImage, elementSize,
groupSize, rowSize, imageSize, myswapBytes );
} else {
HalveImage.halveImage_ubyte( cmpts, width, height, usersImage,
@@ -1145,7 +1145,7 @@ public class BuildMipmap {
usersImage, dstImage, elementSize, groupSize, rowSize,
imageSize, myswapBytes );
} else {
- HalveImage.halveImage_ushort( cmpts, width, height, usersImage,
+ HalveImage.halveImage_ushort( cmpts, width, height, usersImage,
dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes );
}
break;
@@ -1257,7 +1257,7 @@ public class BuildMipmap {
if( newDepth < 1 ) {
newDepth = 1;
}
-
+
myswapBytes = false;
rowSize = newWidth * groupSize;
imageSize = rowSize * newHeight;
@@ -1302,7 +1302,7 @@ public class BuildMipmap {
gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() );
return( GLU.GLU_OUT_OF_MEMORY );
}
-
+
// level userLevel + 1 is in srcImage; level userLevel already saved
level = userLevel + 1;
} else {
@@ -1343,10 +1343,10 @@ public class BuildMipmap {
gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() );
return( GLU.GLU_OUT_OF_MEMORY );
}
-
+
ScaleInternal.gluScaleImage3D( gl, format, width, height, depth, type,
usersImage, newWidth, newHeight, newDepth, type, dstImage );
-
+
myswapBytes = false;
rowSize = newWidth * groupSize;
imageSize = rowSize * newHeight;
@@ -1354,7 +1354,7 @@ public class BuildMipmap {
tempImage = srcImage;
srcImage = dstImage;
dstImage = tempImage;
-
+
if( levels != 0 ) {
int nextWidth = newWidth / 2;
int nextHeight = newHeight / 2;
@@ -1409,7 +1409,7 @@ public class BuildMipmap {
// level userLevel is in srcImage; nothing saved yet
level = userLevel;
}
-
+
gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE );
if( baseLevel <= level && level <= maxLevel ) {
usersImage.position( mark );
@@ -1541,11 +1541,11 @@ public class BuildMipmap {
assert( false );
break;
}
-
+
tempImage = srcImage;
srcImage = dstImage;
dstImage = tempImage;
-
+
if( newWidth > 1 ) {
newWidth /= 2;
rowSize /= 2;
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract.java
index a564269..0eee9bf 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java
index 10ea1d7..0c155ff 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -51,42 +51,44 @@ import java.nio.ByteBuffer;
* @author Administrator
*/
public class Extract1010102 implements Extract {
-
+
/** Creates a new instance of Extract1010102 */
public Extract1010102() {
}
-
+
+ @Override
public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) {
long uint = 0;
-
+
if( isSwap ) {
uint = 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( packedPixel.getInt() );
} else {
uint = 0x00000000FFFFFFFF & packedPixel.getInt();
}
-
+
// 11111111,11000000,00000000,00000000 == 0xFFC00000
// 00000000,00111111,11110000,00000000 == 0x003F0000
// 00000000,00000000,00001111,11111100 == 0x00000FFC
// 00000000,00000000,00000000,00000011 == 0x00000003
-
+
extractComponents[0] = (float)( ( uint & 0xFFC00000 ) >> 22 ) / 1023.0f;
extractComponents[1] = (float)( ( uint & 0x003FF000 ) >> 12 ) / 1023.0f;
extractComponents[2] = (float)( ( uint & 0x00000FFC ) >> 2 ) / 1023.0f;
extractComponents[3] = (float)( ( uint & 0x00000003 ) ) / 3.0f;
}
-
+
+ @Override
public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) {
// 11110000,00000000 == 0xF000
// 00001111,00000000 == 0x0F00
// 00000000,11110000 == 0x00F0
// 00000000,00001111 == 0x000F
-
+
assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f );
assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f );
assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f );
assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f );
-
+
// due to limited precision, need to round before shoving
long uint = (((int)((shoveComponents[0] * 1023) + 0.5f) << 22) & 0xFFC00000 );
uint |= (((int)((shoveComponents[1] * 1023) + 0.5f) << 12) & 0x003FF000 );
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java
index 1234da5..5208ea5 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -51,42 +51,44 @@ import java.nio.ByteBuffer;
* @author Administrator
*/
public class Extract1555rev implements Extract {
-
+
/** Creates a new instance of Extract1555rev */
public Extract1555rev() {
}
-
+
+ @Override
public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) {
int ushort = 0;
-
+
if( isSwap ) {
ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() );
} else {
ushort = 0x0000FFFF & packedPixel.getShort();
}
-
+
// 00000000,00011111 == 0x001F
// 00000011,11100000 == 0x03E0
// 01111100,00000000 == 0x7C00
// 10000000,00000000 == 0x8000
-
+
extractComponents[0] = (float)( ( ushort & 0x001F ) ) / 31.0f;
extractComponents[1] = (float)( ( ushort & 0x003E ) >> 5 ) / 31.0f;
extractComponents[2] = (float)( ( ushort & 0x7C00 ) >> 10) / 31.0f;
extractComponents[3] = (float)( ( ushort & 0x8000 ) >> 15);
}
-
+
+ @Override
public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) {
// 00000000,00011111 == 0x001F
// 00000011,11100000 == 0x03E0
// 01111100,00000000 == 0x7C00
// 10000000,00000000 == 0x8000
-
+
assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f );
assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f );
assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f );
assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f );
-
+
// due to limited precision, need to round before shoving
int ushort = (((int)((shoveComponents[0] * 31) + 0.5f) ) & 0x0000001F );
ushort |= (((int)((shoveComponents[1] * 31) + 0.5f) << 5) & 0x000003E0 );
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java
index 226254f..1bf8abc 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -51,42 +51,44 @@ import java.nio.ByteBuffer;
* @author Administrator
*/
public class Extract2101010rev implements Extract {
-
+
/** Creates a new instance of Extract2101010 */
public Extract2101010rev() {
}
-
+
+ @Override
public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) {
long uint = 0;
-
+
if( isSwap ) {
uint = 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( packedPixel.getInt() );
} else {
uint = 0x00000000FFFFFFFF & packedPixel.getInt();
}
-
+
// 11111111,11000000,00000000,00000000 == 0xFFC00000
// 00000000,00111111,11110000,00000000 == 0x003F0000
// 00000000,00000000,00001111,11111100 == 0x00000FFC
// 00000000,00000000,00000000,00000011 == 0x00000003
-
+
extractComponents[0] = (float)( ( uint & 0x000003FF ) ) / 1023.0f;
extractComponents[1] = (float)( ( uint & 0x000FFC00 ) >> 10 ) / 1023.0f;
extractComponents[2] = (float)( ( uint & 0x3FF00000 ) >> 20 ) / 1023.0f;
extractComponents[3] = (float)( ( uint & 0xC0000000 ) >> 30 ) / 3.0f;
}
-
+
+ @Override
public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) {
// 11110000,00000000 == 0xF000
// 00001111,00000000 == 0x0F00
// 00000000,11110000 == 0x00F0
// 00000000,00001111 == 0x000F
-
+
assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f );
assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f );
assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f );
assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f );
-
+
// due to limited precision, need to round before shoving
long uint = (((int)((shoveComponents[0] * 1023) + 0.5f) ) & 0x000003FF );
uint |= (((int)((shoveComponents[1] * 1023) + 0.5f) << 10) & 0x000FFC00 );
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java
index 9fa2a3a..c86b39e 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -51,11 +51,12 @@ import java.nio.ByteBuffer;
* @author Administrator
*/
public class Extract233rev implements Extract {
-
+
/** Creates a new instance of Extract223rev */
public Extract233rev() {
}
-
+
+ @Override
public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) {
// 11100000 == 0xe0
// 00011100 == 0x1c
@@ -65,16 +66,17 @@ public class Extract233rev implements Extract {
extractComponents[1] = (float)((ubyte & 0x38) >> 3) / 7.0f;
extractComponents[2] = (float)((ubyte & 0xC0) >> 6) / 3.0f;
}
-
+
+ @Override
public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) {
// 11100000 == 0xE0
// 00011100 == 0x1C
// 00000011 == 0x03
-
+
assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f );
assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f );
assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f );
-
+
// due to limited precision, need to round before shoving
byte b = (byte)( ( (int)( ( shoveComponents[0] * 7 ) + 0.5f ) ) & 0x07 );
b |= (byte)( ( (int)( ( shoveComponents[1] * 7 ) + 0.5f ) << 3 ) & 0x38 );
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java
index 92d141b..706f0c3 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -51,11 +51,12 @@ import java.nio.ByteBuffer;
* @author Administrator
*/
public class Extract332 implements Extract {
-
+
/** Creates a new instance of Extract332 */
public Extract332() {
}
-
+
+ @Override
public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) {
// 11100000 == 0xe0
// 00011100 == 0x1c
@@ -65,16 +66,17 @@ public class Extract332 implements Extract {
extractComponents[1] = (float)((ubyte & 0x1c) >> 2) / 7.0f;
extractComponents[2] = (float)((ubyte & 0x03)) / 3.0f;
}
-
+
+ @Override
public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) {
// 11100000 == 0xE0
// 00011100 == 0x1C
// 00000011 == 0x03
-
+
assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f );
assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f );
assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f );
-
+
// due to limited precision, need to round before shoving
byte b = (byte)( ( (int)( ( shoveComponents[0] * 7 ) + 0.5f ) << 5 ) & 0xE0 );
b |= (byte)( ( (int)( ( shoveComponents[1] * 7 ) + 0.5f ) << 2 ) & 0x1C );
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java
index af99d15..182d66c 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -51,41 +51,43 @@ import java.nio.*;
* @author Administrator
*/
public class Extract4444 implements Extract {
-
+
/** Creates a new instance of Extract4444 */
public Extract4444() {
}
-
+
+ @Override
public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) {
int ushort = 0;
-
+
if( isSwap ) {
ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() );
} else {
ushort = 0x0000FFFF & packedPixel.getShort();
}
-
+
// 11110000,00000000 == 0xF000
// 00001111,00000000 == 0x0F00
// 00000000,11110000 == 0x00F0
// 00000000,00001111 == 0x000F
-
+
extractComponents[0] = (float)( ( ushort & 0xF000 ) >> 12 ) / 15.0f;
extractComponents[1] = (float)( ( ushort & 0x0F00 ) >> 8 ) / 15.0f;
extractComponents[2] = (float)( ( ushort & 0x00F0 ) >> 4 ) / 15.0f;
extractComponents[3] = (float)( ( ushort & 0x000F ) ) / 15.0f;
}
-
+
+ @Override
public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) {
// 11110000,00000000 == 0xF000
// 00001111,00000000 == 0x0F00
// 00000000,11110000 == 0x00F0
// 00000000,00001111 == 0x000F
-
+
assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f );
assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f );
assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f );
-
+
// due to limited precision, need to round before shoving
int ushort = (((int)((shoveComponents[0] * 15) + 0.5f) << 12) & 0x0000F000 );
ushort |= (((int)((shoveComponents[1] * 15) + 0.5f) << 8) & 0x00000F00 );
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java
index e5bce60..52ecdc1 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -51,42 +51,44 @@ import java.nio.*;
* @author Administrator
*/
public class Extract4444rev implements Extract {
-
+
/** Creates a new instance of Extract4444rev */
public Extract4444rev() {
}
-
+
+ @Override
public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) {
int ushort = 0;
-
+
if( isSwap ) {
ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() );
} else {
ushort = 0x0000FFFF & packedPixel.getShort();
}
-
+
// 00000000,00001111 == 0x000F
// 00000000,11110000 == 0x00F0
// 00001111,00000000 == 0x0F00
// 11110000,00000000 == 0xF000
-
+
extractComponents[0] = (float)( ( ushort & 0x000F ) ) / 15.0f;
extractComponents[1] = (float)( ( ushort & 0x00F0 ) >> 4 ) / 15.0f;
extractComponents[2] = (float)( ( ushort & 0x0F00 ) >> 8 ) / 15.0f;
extractComponents[3] = (float)( ( ushort & 0xF000 ) >> 12 ) / 15.0f;
}
-
+
+ @Override
public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) {
// 11110000,00000000 == 0xF000
// 00001111,00000000 == 0x0F00
// 00000000,11110000 == 0x00F0
// 00000000,00001111 == 0x000F
-
+
assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f );
assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f );
assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f );
assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f );
-
+
// due to limited precision, need to round before shoving
int ushort = (((int)((shoveComponents[0] * 15) + 0.5f) ) & 0x0000000F );
ushort |= (((int)((shoveComponents[1] * 15) + 0.5f) << 4) & 0x000000F0 );
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java
index 5c38310..21f53aa 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -51,42 +51,44 @@ import java.nio.*;
* @author Administrator
*/
public class Extract5551 implements Extract {
-
+
/** Creates a new instance of Extract5551 */
public Extract5551() {
}
-
+
+ @Override
public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) {
int ushort = 0;
-
+
if( isSwap ) {
ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() );
} else {
ushort = 0x0000FFFF & packedPixel.getShort();
}
-
+
// 11111000,00000000 == 0xF800
// 00000111,11000000 == 0x07C0
// 00000000,00111110 == 0x003E
// 00000000,00000001 == 0x0001
-
+
extractComponents[0] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f;
extractComponents[1] = (float)( ( ushort & 0x00F0 ) >> 6 ) / 31.0f;
extractComponents[2] = (float)( ( ushort & 0x0F00 ) >> 1 ) / 31.0f;
extractComponents[3] = (float)( ( ushort & 0xF000 ) );
}
-
+
+ @Override
public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) {
// 11110000,00000000 == 0xF000
// 00001111,00000000 == 0x0F00
// 00000000,11110000 == 0x00F0
// 00000000,00001111 == 0x000F
-
+
assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f );
assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f );
assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f );
assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f );
-
+
// due to limited precision, need to round before shoving
int ushort = (((int)((shoveComponents[0] * 31) + 0.5f) << 11) & 0x0000F800 );
ushort |= (((int)((shoveComponents[1] * 31) + 0.5f) << 6) & 0x000007C0 );
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java
index f6193dd..7408c45 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -51,38 +51,40 @@ import java.nio.*;
* @author Administrator
*/
public class Extract565 implements Extract {
-
+
/** Creates a new instance of Extract565 */
public Extract565() {
}
-
+
+ @Override
public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) {
int ushort = 0;
-
+
if( isSwap ) {
ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() );
} else {
ushort = 0x0000FFFF & packedPixel.getShort();
}
-
+
// 11111000,00000000 == 0xF800
// 00000111,11100000 == 0x07E0
// 00000000,00111111 == 0x001F
-
+
extractComponents[0] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f;
extractComponents[1] = (float)( ( ushort & 0x07E0 ) >> 5 ) / 63.0f;
extractComponents[2] = (float)( ( ushort & 0x001F ) ) / 31.0f;
}
-
+
+ @Override
public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) {
// 11111000,00000000 == 0xF800
// 00000111,11100000 == 0x07E0
// 00000000,00111111 == 0x001F
-
+
assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f );
assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f );
assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f );
-
+
// due to limited precision, need to round before shoving
int ushort = (((int)((shoveComponents[0] * 31) + 0.5f) << 11) & 0x0000F800 );
ushort |= (((int)((shoveComponents[1] * 63) + 0.5f) << 5) & 0x000007E0 );
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java
index 2e455ad..adaafa7 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -51,38 +51,40 @@ import java.nio.*;
* @author Administrator
*/
public class Extract565rev implements Extract {
-
+
/** Creates a new instance of Extract565rev */
public Extract565rev() {
}
-
+
+ @Override
public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) {
int ushort = 0;
-
+
if( isSwap ) {
ushort = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( packedPixel.getShort() );
} else {
ushort = 0x0000FFFF & packedPixel.getShort();
}
-
+
// 00000000,00011111 == 0x001F
// 00000111,11100000 == 0x07E0
// 11111000,00000000 == 0xF800
-
+
extractComponents[0] = (float)( ( ushort & 0x001F ) ) / 31.0f;
extractComponents[1] = (float)( ( ushort & 0x07E0 ) >> 5 ) / 63.0f;
extractComponents[2] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f;
}
-
+
+ @Override
public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) {
// 00000000,00111111 == 0x001F
// 00000111,11100000 == 0x07E0
// 11111000,00000000 == 0xF800
-
+
assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f );
assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f );
assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f );
-
+
// due to limited precision, need to round before shoving
int ushort = (((int)((shoveComponents[0] * 31) + 0.5f) ) & 0x0000001F );
ushort |= (((int)((shoveComponents[1] * 63) + 0.5f) << 5) & 0x000007E0 );
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java
index 137fa3c..be155d5 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -51,42 +51,44 @@ import java.nio.*;
* @author Administrator
*/
public class Extract8888 implements Extract {
-
+
/** Creates a new instance of Extract8888 */
public Extract8888() {
}
-
+
+ @Override
public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) {
long uint = 0;
-
+
if( isSwap ) {
uint = 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( packedPixel.getInt() );
} else {
uint = 0x00000000FFFFFFFF & packedPixel.getInt();
}
-
+
// 11111000,00000000 == 0xF800
// 00000111,11000000 == 0x07C0
// 00000000,00111110 == 0x003E
// 00000000,00000001 == 0x0001
-
+
extractComponents[0] = (float)( ( uint & 0xFF000000 ) >> 24 ) / 255.0f;
extractComponents[1] = (float)( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f;
extractComponents[2] = (float)( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f;
extractComponents[3] = (float)( ( uint & 0x000000FF ) ) / 255.0f;
}
-
+
+ @Override
public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) {
// 11110000,00000000 == 0xF000
// 00001111,00000000 == 0x0F00
// 00000000,11110000 == 0x00F0
// 00000000,00001111 == 0x000F
-
+
assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f );
assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f );
assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f );
assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f );
-
+
// due to limited precision, need to round before shoving
long uint = (((int)((shoveComponents[0] * 255) + 0.5f) << 24) & 0xFF000000 );
uint |= (((int)((shoveComponents[1] * 255) + 0.5f) << 16) & 0x00FF0000 );
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java
index 2ac942c..294e60e 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -51,42 +51,44 @@ import java.nio.*;
* @author Administrator
*/
public class Extract8888rev implements Extract {
-
+
/** Creates a new instance of Extract8888rev */
public Extract8888rev() {
}
-
+
+ @Override
public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) {
long uint = 0;
-
+
if( isSwap ) {
uint = 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( packedPixel.getInt() );
} else {
uint = 0x00000000FFFFFFFF & packedPixel.getInt();
}
-
+
// 11111000,00000000 == 0xF800
// 00000111,11000000 == 0x07C0
// 00000000,00111110 == 0x003E
// 00000000,00000001 == 0x0001
-
+
extractComponents[0] = (float)( ( uint & 0x000000FF ) ) / 255.0f;
extractComponents[1] = (float)( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f;
extractComponents[2] = (float)( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f;
extractComponents[3] = (float)( ( uint & 0xFF000000 ) >> 24 ) / 255.0f;
}
-
+
+ @Override
public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) {
// 11110000,00000000 == 0xF000
// 00001111,00000000 == 0x0F00
// 00000000,11110000 == 0x00F0
// 00000000,00001111 == 0x000F
-
+
assert( 0.0f <= shoveComponents[0] && shoveComponents[0] <= 1.0f );
assert( 0.0f <= shoveComponents[1] && shoveComponents[1] <= 1.0f );
assert( 0.0f <= shoveComponents[2] && shoveComponents[2] <= 1.0f );
assert( 0.0f <= shoveComponents[3] && shoveComponents[3] <= 1.0f );
-
+
// due to limited precision, need to round before shoving
long uint = (((int)((shoveComponents[0] * 255) + 0.5f) ) & 0x000000FF );
uint |= (((int)((shoveComponents[1] * 255) + 0.5f) << 8) & 0x0000FF00 );
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java
index 52c2191..1dd8bff 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -51,11 +51,12 @@ import java.nio.*;
* @author Administrator
*/
public class ExtractFloat implements ExtractPrimitive {
-
+
/** Creates a new instance of ExtractFloat */
public ExtractFloat() {
}
-
+
+ @Override
public double extract( boolean isSwap, ByteBuffer data ) {
float f = 0;
if( isSwap ) {
@@ -66,7 +67,8 @@ public class ExtractFloat implements ExtractPrimitive {
assert( f <= 1.0f );
return( f );
}
-
+
+ @Override
public void shove( double value, int index, ByteBuffer data ) {
assert(0.0 <= value && value < 1.0);
data.asFloatBuffer().put( index, (float)value );
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractPrimitive.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractPrimitive.java
index 9260966..a44fb95 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractPrimitive.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractPrimitive.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java
index 2e1a9a0..dcbe52a 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -51,17 +51,19 @@ import java.nio.ByteBuffer;
* @author Administrator
*/
public class ExtractSByte implements ExtractPrimitive {
-
+
/** Creates a new instance of ExtractUByte */
public ExtractSByte() {
}
-
+
+ @Override
public double extract( boolean isSwap, ByteBuffer sbyte ) {
byte b = sbyte.get();
assert( b <= 127 );
return( b );
}
-
+
+ @Override
public void shove( double value, int index, ByteBuffer data ) {
data.position( index );
data.put( (byte)value );
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java
index ca80747..547bd94 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -51,11 +51,12 @@ import java.nio.*;
* @author Administrator
*/
public class ExtractSInt implements ExtractPrimitive {
-
+
/** Creates a new instance of ExtractSInt */
public ExtractSInt() {
}
-
+
+ @Override
public double extract( boolean isSwap, ByteBuffer uint ) {
int i = 0;
if( isSwap ) {
@@ -66,7 +67,8 @@ public class ExtractSInt implements ExtractPrimitive {
assert( i <= 0x7FFFFFFF );
return( i );
}
-
+
+ @Override
public void shove( double value, int index, ByteBuffer data ) {
assert(0.0 <= value && value < Integer.MAX_VALUE);
IntBuffer ib = data.asIntBuffer();
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java
index 979c3b4..7dc1729 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -51,11 +51,12 @@ import java.nio.*;
* @author Administrator
*/
public class ExtractSShort implements ExtractPrimitive {
-
+
/** Creates a new instance of ExtractSShort */
public ExtractSShort() {
}
-
+
+ @Override
public double extract( boolean isSwap, ByteBuffer ushort ) {
short s = 0;
if( isSwap ) {
@@ -66,7 +67,8 @@ public class ExtractSShort implements ExtractPrimitive {
assert( s <= 32767 );
return( s );
}
-
+
+ @Override
public void shove( double value, int index, ByteBuffer data ) {
assert(0.0 <= value && value < 32768.0);
ShortBuffer sb = data.asShortBuffer();
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java
index 4d14212..3e93381 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -51,17 +51,19 @@ import java.nio.ByteBuffer;
* @author Administrator
*/
public class ExtractUByte implements ExtractPrimitive {
-
+
/** Creates a new instance of ExtractUByte */
public ExtractUByte() {
}
-
+
+ @Override
public double extract( boolean isSwap, ByteBuffer ubyte ) {
int i = 0x000000FF & ubyte.get();
assert( i <= 255 );
return( i );
}
-
+
+ @Override
public void shove( double value, int index, ByteBuffer data ) {
assert(0.0 <= value && value < 256.0);
data.position( index );
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java
index c088ca3..1c34828 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -51,11 +51,12 @@ import java.nio.*;
* @author Administrator
*/
public class ExtractUInt implements ExtractPrimitive {
-
+
/** Creates a new instance of ExtractUInt */
public ExtractUInt() {
}
-
+
+ @Override
public double extract( boolean isSwap, ByteBuffer uint ) {
long i = 0;
if( isSwap ) {
@@ -66,7 +67,8 @@ public class ExtractUInt implements ExtractPrimitive {
assert( i <= 0xFFFFFFFF );
return( i );
}
-
+
+ @Override
public void shove( double value, int index, ByteBuffer data ) {
assert(0.0 <= value && value < 0xFFFFFFFF);
IntBuffer ib = data.asIntBuffer();
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java
index 81db60f..8e0d25c 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -51,11 +51,12 @@ import java.nio.*;
* @author Administrator
*/
public class ExtractUShort implements ExtractPrimitive {
-
+
/** Creates a new instance of ExtracUShort */
public ExtractUShort() {
}
-
+
+ @Override
public double extract( boolean isSwap, ByteBuffer ushort ) {
int i = 0;
if( isSwap ) {
@@ -66,7 +67,8 @@ public class ExtractUShort implements ExtractPrimitive {
assert( i <= 65535 );
return( i );
}
-
+
+ @Override
public void shove( double value, int index, ByteBuffer data ) {
assert(0.0 <= value && value < 65536.0);
ShortBuffer sb = data.asShortBuffer();
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java
index 7549044..184c5fd 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -52,11 +52,11 @@ import java.nio.*;
* @author Administrator
*/
public class HalveImage {
-
+
private static final int BOX2 = 2;
private static final int BOX4 = 4;
private static final int BOX8 = 8;
-
+
public static void halveImage( int components, int width, int height,
ShortBuffer datain, ShortBuffer dataout ) {
int i, j, k;
@@ -64,11 +64,11 @@ public class HalveImage {
int delta;
int t = 0;
short temp = 0;
-
+
newwidth = width / 2;
newheight = height /2;
delta = width * components;
-
+
// Piece of cake
for( i = 0; i < newheight; i++ ) {
for( j = 0; j < newwidth; j++ ) {
@@ -91,7 +91,7 @@ public class HalveImage {
t += delta;
}
}
-
+
public static void halveImage_ubyte( int components, int width, int height,
ByteBuffer datain, ByteBuffer dataout,
int element_size, int ysize, int group_size ) {
@@ -99,19 +99,19 @@ public class HalveImage {
int newwidth, newheight;
int s;
int t;
-
+
// Handle case where there is only 1 column/row
if( width == 1 || height == 1 ) {
assert( !( width == 1 && height == 1 ) ); // can't be 1x1
halve1Dimage_ubyte( components, width, height, datain, dataout, element_size, ysize, group_size );
return;
}
-
+
newwidth = width / 2;
newheight = height / 2;
s = 0;
t = 0;
-
+
int temp = 0;
// piece of cake
for( i = 0; i < newheight; i++ ) {
@@ -133,9 +133,9 @@ public class HalveImage {
t += ysize;
}
}
-
+
public static void halve1Dimage_ubyte( int components, int width, int height,
- ByteBuffer datain, ByteBuffer dataout,
+ ByteBuffer datain, ByteBuffer dataout,
int element_size, int ysize, int group_size ) {
int halfWidth = width / 2;
int halfHeight = height / 2;
@@ -143,14 +143,14 @@ public class HalveImage {
int dest = 0;
int jj;
int temp = 0;
-
+
assert( width == 1 || height == 1 ); // Must be 1D
assert( width != height ); // can't be square
-
+
if( height == 1 ) { // 1 row
assert( width != 1 ); // widthxheight can't be 1x1
halfHeight = 1;
-
+
for( jj = 0; jj < halfWidth; jj++ ) {
int kk;
for( kk = 0; kk < components; kk++ ) {
@@ -161,7 +161,7 @@ public class HalveImage {
temp /= 2;
dataout.put( (byte)temp );
/*
- dataout.setByte( (byte)(((0x000000FF & datain.setIndexInBytes(src).getByte()) +
+ dataout.setByte( (byte)(((0x000000FF & datain.setIndexInBytes(src).getByte()) +
(0x000000FF & datain.setIndexInBytes( src + group_size ).getByte())) / 2 ) );
*/
src += element_size;
@@ -188,7 +188,7 @@ public class HalveImage {
temp /= 2;
dataout.put( (byte)temp );
/*
- dataout.setByte( (byte)(((0x000000FF & datain.setIndexInBytes(src).getByte()) +
+ dataout.setByte( (byte)(((0x000000FF & datain.setIndexInBytes(src).getByte()) +
(0x000000FF & datain.setIndexInBytes(src + ysize).getByte()) ) / 2 ) );
*/
src += element_size;
@@ -202,7 +202,7 @@ public class HalveImage {
assert( src == ysize * height );
assert( dest == components * element_size * halfWidth * halfHeight );
}
-
+
public static void halveImage_byte( int components, int width, int height,
ByteBuffer datain, ByteBuffer dataout, int element_size,
int ysize, int group_size ) {
@@ -211,7 +211,7 @@ public class HalveImage {
int s = 0;
int t = 0;
byte temp = (byte)0;
-
+
// handle case where there is only 1 column
if( width == 1 || height == 1 ) {
assert( !( width == 1 && height == 1 ) );
@@ -219,10 +219,10 @@ public class HalveImage {
ysize, group_size );
return;
}
-
+
newwidth = width / 2;
newheight = height / 2;
-
+
for( i = 0; i < newheight; i++ ) {
for( j = 0; j < newwidth; j++ ) {
for( k = 0; k < components; k++ ) {
@@ -244,7 +244,7 @@ public class HalveImage {
t += ysize;
}
}
-
+
public static void halve1Dimage_byte( int components, int width, int height,
ByteBuffer datain, ByteBuffer dataout,
int element_size, int ysize, int group_size ) {
@@ -254,14 +254,14 @@ public class HalveImage {
int dest = 0;
int jj;
byte temp = (byte)0;
-
+
assert( width == 1 || height == 1 ); // must be 1D
assert( width != height ); // can't be square
-
+
if( height == 1 ) { // 1 row
assert( width != 1 ); // widthxheight can't be 1
halfHeight = 1;
-
+
for( jj = 0; jj < halfWidth; jj++ ) {
int kk;
for( kk = 0; kk < components; kk++ ) {
@@ -284,7 +284,7 @@ public class HalveImage {
halfWidth = 1;
// one vertical column with possible pad bytes per row
// average two at a time
-
+
for( jj = 0; jj < halfHeight; jj++ ) {
int kk;
for( kk = 0; kk < components; kk++ ) {
@@ -303,7 +303,7 @@ public class HalveImage {
}
assert( dest == components * element_size * halfWidth * halfHeight );
}
-
+
public static void halveImage_ushort( int components, int width, int height,
ByteBuffer datain, ShortBuffer dataout, int element_size,
int ysize, int group_size, boolean myswap_bytes ) {
@@ -319,10 +319,10 @@ public class HalveImage {
ysize, group_size, myswap_bytes );
return;
}
-
+
newwidth = width / 2;
newheight = height / 2;
-
+
// Piece of cake
if( !myswap_bytes ) {
for( i = 0; i < newheight; i++ ) {
@@ -364,7 +364,7 @@ public class HalveImage {
}
}
}
-
+
public static void halve1Dimage_ushort( int components, int width, int height,
ByteBuffer datain, ShortBuffer dataout, int element_size,
int ysize, int group_size, boolean myswap_bytes ) {
@@ -373,14 +373,14 @@ public class HalveImage {
int src = 0;
int dest = 0;
int jj;
-
+
assert( width == 1 || height == 1 ); // must be 1D
assert( width != height ); // can't be square
-
+
if( height == 1 ) { // 1 row
assert( width != 1 ); // widthxheight can't be 1
halfHeight = 1;
-
+
for( jj = 0; jj < halfWidth; jj++ ) {
int kk;
for( kk = 0; kk < halfHeight; kk++ ) {
@@ -410,7 +410,7 @@ public class HalveImage {
halfWidth = 1;
// one vertical column with possible pad bytes per row
// average two at a time
-
+
for( jj = 0; jj < halfHeight; jj++ ) {
int kk;
for( kk = 0; kk < components; kk++ ) {
@@ -437,7 +437,7 @@ public class HalveImage {
}
assert( dest == components * element_size * halfWidth * halfHeight );
}
-
+
public static void halveImage_short( int components, int width, int height,
ByteBuffer datain, ShortBuffer dataout, int element_size,
int ysize, int group_size, boolean myswap_bytes ) {
@@ -453,10 +453,10 @@ public class HalveImage {
ysize, group_size, myswap_bytes );
return;
}
-
+
newwidth = width / 2;
newheight = height / 2;
-
+
// Piece of cake
if( !myswap_bytes ) {
for( i = 0; i < newheight; i++ ) {
@@ -504,7 +504,7 @@ public class HalveImage {
}
}
}
-
+
public static void halve1Dimage_short( int components, int width, int height,
ByteBuffer datain, ShortBuffer dataout, int element_size, int ysize,
int group_size, boolean myswap_bytes ) {
@@ -513,14 +513,14 @@ public class HalveImage {
int src = 0;
int dest = 0;
int jj;
-
+
assert( width == 1 || height == 1 ); // must be 1D
assert( width != height ); // can't be square
-
+
if( height == 1 ) { // 1 row
assert( width != 1 ); // can't be 1x1
halfHeight = 1;
-
+
for( jj = 0; jj < halfWidth; jj++ ) {
int kk;
for( kk = 0; kk < components; kk++ ) {
@@ -550,7 +550,7 @@ public class HalveImage {
halfWidth = 1;
// one vertical column with possible pad bytes per row
// average two at a time
-
+
for( jj = 0; jj < halfHeight; jj++ ) {
int kk;
for( kk = 0; kk < components; kk++ ) {
@@ -577,7 +577,7 @@ public class HalveImage {
}
assert( dest == ( components * element_size * halfWidth * halfHeight ) );
}
-
+
public static void halveImage_uint( int components, int width, int height,
ByteBuffer datain, IntBuffer dataout, int element_size,
int ysize, int group_size, boolean myswap_bytes ) {
@@ -586,7 +586,7 @@ public class HalveImage {
int s = 0;
int t = 0;
double temp = 0;
-
+
// handle case where there is only 1 column/row
if( width == 1 || height == 1 ) {
assert( !( width == 1 && height == 1 ) ); // can't be 1x1
@@ -594,10 +594,10 @@ public class HalveImage {
ysize, group_size, myswap_bytes );
return;
}
-
+
newwidth = width / 2;
newheight = height / 2;
-
+
// Piece of cake
if( !myswap_bytes ) {
for( i = 0; i < newheight; i++ ) {
@@ -643,7 +643,7 @@ public class HalveImage {
}
}
}
-
+
public static void halve1Dimage_uint( int components, int width, int height,
ByteBuffer datain, IntBuffer dataout, int element_size, int ysize,
int group_size, boolean myswap_bytes ) {
@@ -652,14 +652,14 @@ public class HalveImage {
int src = 0;
int dest = 0;
int jj;
-
+
assert( width == 1 || height == 1 ); // must be 1D
assert( width != height ); // can't be square
-
+
if( height == 1 ) { // 1 row
assert( width != 1 ); // widthxheight can't be 1
halfHeight = 1;
-
+
for( jj = 0; jj < halfWidth; jj++ ) {
int kk;
for( kk = 0; kk < halfHeight; kk++ ) {
@@ -689,7 +689,7 @@ public class HalveImage {
halfWidth = 1;
// one vertical column with possible pad bytes per row
// average two at a time
-
+
for( jj = 0; jj < halfHeight; jj++ ) {
int kk;
for( kk = 0; kk < components; kk++ ) {
@@ -716,7 +716,7 @@ public class HalveImage {
}
assert( dest == components * element_size * halfWidth * halfHeight );
}
-
+
public static void halveImage_int( int components, int width, int height,
ByteBuffer datain, IntBuffer dataout, int element_size,
int ysize, int group_size, boolean myswap_bytes ) {
@@ -725,7 +725,7 @@ public class HalveImage {
int s = 0;
int t = 0;
int temp = 0;
-
+
// handle case where there is only 1 column/row
if( width == 1 || height == 1 ) {
assert( !( width == 1 && height == 1 ) ); // can't be 1x1
@@ -733,10 +733,10 @@ public class HalveImage {
ysize, group_size, myswap_bytes );
return;
}
-
+
newwidth = width / 2;
newheight = height / 2;
-
+
// Piece of cake
if( !myswap_bytes ) {
for( i = 0; i < newheight; i++ ) {
@@ -785,7 +785,7 @@ public class HalveImage {
}
}
}
-
+
public static void halve1Dimage_int( int components, int width, int height,
ByteBuffer datain, IntBuffer dataout, int element_size, int ysize,
int group_size, boolean myswap_bytes ) {
@@ -794,14 +794,14 @@ public class HalveImage {
int src = 0;
int dest = 0;
int jj;
-
+
assert( width == 1 || height == 1 ); // must be 1D
assert( width != height ); // can't be square
-
+
if( height == 1 ) { // 1 row
assert( width != 1 ); // can't be 1x1
halfHeight = 1;
-
+
for( jj = 0; jj < halfWidth; jj++ ) {
int kk;
for( kk = 0; kk < components; kk++ ) {
@@ -831,7 +831,7 @@ public class HalveImage {
halfWidth = 1;
// one vertical column with possible pad bytes per row
// average two at a time
-
+
for( jj = 0; jj < halfHeight; jj++ ) {
int kk;
for( kk = 0; kk < components; kk++ ) {
@@ -858,7 +858,7 @@ public class HalveImage {
}
assert( dest == ( components * element_size * halfWidth * halfHeight ) );
}
-
+
public static void halveImage_float( int components, int width, int height,
ByteBuffer datain, FloatBuffer dataout, int element_size,
int ysize, int group_size, boolean myswap_bytes ) {
@@ -874,10 +874,10 @@ public class HalveImage {
ysize, group_size, myswap_bytes );
return;
}
-
+
newwidth = width / 2;
newheight = height / 2;
-
+
// Piece of cake
if( !myswap_bytes ) {
for( i = 0; i < newheight; i++ ) {
@@ -920,7 +920,7 @@ public class HalveImage {
}
}
}
-
+
public static void halve1Dimage_float( int components, int width, int height,
ByteBuffer datain, FloatBuffer dataout, int element_size, int ysize,
int group_size, boolean myswap_bytes ) {
@@ -929,14 +929,14 @@ public class HalveImage {
int src = 0;
int dest = 0;
int jj;
-
+
assert( width == 1 || height == 1 ); // must be 1D
assert( width != height ); // can't be square
-
+
if( height == 1 ) { // 1 row
assert( width != 1 ); // can't be 1x1
halfHeight = 1;
-
+
for( jj = 0; jj < halfWidth; jj++ ) {
int kk;
for( kk = 0; kk < components; kk++ ) {
@@ -966,7 +966,7 @@ public class HalveImage {
halfWidth = 1;
// one vertical column with possible pad bytes per row
// average two at a time
-
+
for( jj = 0; jj < halfHeight; jj++ ) {
int kk;
for( kk = 0; kk < components; kk++ ) {
@@ -993,9 +993,9 @@ public class HalveImage {
}
assert( dest == ( components * element_size * halfWidth * halfHeight ) );
}
-
- public static void halveImagePackedPixel( int components, Extract extract, int width,
- int height, ByteBuffer datain, ByteBuffer dataout,
+
+ public static void halveImagePackedPixel( int components, Extract extract, int width,
+ int height, ByteBuffer datain, ByteBuffer dataout,
int pixelSizeInBytes, int rowSizeInBytes, boolean isSwap ) {
if( width == 1 || height == 1 ) {
assert( !( width == 1 && height == 1 ) );
@@ -1004,19 +1004,19 @@ public class HalveImage {
return;
}
int ii, jj;
-
+
int halfWidth = width / 2;
int halfHeight = height / 2;
int src = 0;
int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes );
int outIndex = 0;
-
+
for( ii = 0; ii < halfHeight; ii++ ) {
for( jj = 0; jj < halfWidth; jj++ ) {
float totals[] = new float[4];
float extractTotals[][] = new float[BOX4][4];
int cc;
-
+
datain.position( src );
extract.extract( isSwap, datain, extractTotals[0] );
datain.position( src + pixelSizeInBytes );
@@ -1045,7 +1045,7 @@ public class HalveImage {
assert( src == rowSizeInBytes * height );
assert( outIndex == halfWidth * halfHeight );
}
-
+
public static void halve1DimagePackedPixel( int components, Extract extract, int width,
int height, ByteBuffer datain, ByteBuffer dataout,
int pixelSizeInBytes, int rowSizeInBytes, boolean isSwap ) {
@@ -1053,23 +1053,23 @@ public class HalveImage {
int halfHeight = height / 2;
int src = 0;
int jj;
-
+
assert( width == 1 || height == 1 );
assert( width != height );
-
+
if( height == 1 ) {
int outIndex = 0;
-
+
assert( width != 1 );
halfHeight = 1;
-
+
// one horizontal row with possible pad bytes
-
+
for( jj = 0; jj < halfWidth; jj++ ) {
float[] totals = new float[4];
float[][] extractTotals = new float[BOX2][4];
int cc;
-
+
datain.position( src );
extract.extract( isSwap, datain, extractTotals[0] );
datain.position( src + pixelSizeInBytes );
@@ -1090,17 +1090,17 @@ public class HalveImage {
}
int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes );
src += padBytes;
-
+
assert( src == rowSizeInBytes );
assert( outIndex == halfWidth * halfHeight );
} else if( width == 1 ) {
int outIndex = 0;
-
+
assert( height != 1 );
halfWidth = 1;
// one vertical volumn with possible pad bytes per row
// average two at a time
-
+
for( jj = 0; jj < halfHeight; jj++ ) {
float[] totals = new float[4];
float[][] extractTotals = new float[BOX2][4];
@@ -1128,7 +1128,7 @@ public class HalveImage {
assert( outIndex == halfWidth * halfHeight );
}
}
-
+
public static void halveImagePackedPixelSlice( int components, Extract extract,
int width, int height, int depth, ByteBuffer dataIn,
ByteBuffer dataOut, int pixelSizeInBytes, int rowSizeInBytes,
@@ -1140,26 +1140,26 @@ public class HalveImage {
int src = 0;
int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes );
int outIndex = 0;
-
+
assert( (width == 1 || height == 1) && depth >= 2 );
-
+
if( width == height ) {
assert( width == 1 && height == 1 );
assert( depth >= 2 );
-
+
for( ii = 0; ii < halfDepth; ii++ ) {
float totals[] = new float[4];
float extractTotals[][] = new float[BOX2][4];
int cc;
-
+
dataIn.position( src );
extract.extract( isSwap, dataIn, extractTotals[0] );
dataIn.position( src + imageSizeInBytes );
extract.extract( isSwap, dataIn, extractTotals[1] );
-
+
for( cc = 0; cc < components; cc++ ) {
int kk;
-
+
// average only 2 pixels since a column
totals[cc]= 0.0f;
for( kk = 0; kk < BOX2; kk++ ) {
@@ -1167,7 +1167,7 @@ public class HalveImage {
}
totals[cc] /= BOX2;
} // for cc
-
+
extract.shove( totals, outIndex, dataOut );
outIndex++;
// skip over to next group of 2
@@ -1175,13 +1175,13 @@ public class HalveImage {
} // for ii
} else if( height == 1 ) {
assert( width != 1 );
-
+
for( ii = 0; ii < halfDepth; ii++ ) {
for( jj = 0; jj < halfWidth; jj++ ) {
float totals[] = new float[4];
float extractTotals[][] = new float[BOX4][4];
int cc;
-
+
dataIn.position( src );
extract.extract( isSwap, dataIn, extractTotals[0] );
dataIn.position( src + pixelSizeInBytes );
@@ -1190,10 +1190,10 @@ public class HalveImage {
extract.extract( isSwap, dataIn, extractTotals[2] );
dataIn.position( src + pixelSizeInBytes + imageSizeInBytes );
extract.extract( isSwap, dataIn, extractTotals[3] );
-
+
for( cc = 0; cc < components; cc++ ) {
int kk;
-
+
// grab 4 pixels to average
totals[cc] = 0.0f;
for( kk = 0; kk < BOX4; kk++ ) {
@@ -1209,13 +1209,13 @@ public class HalveImage {
}
} else if( width == 1 ) {
assert( height != 1 );
-
+
for( ii = 0; ii < halfDepth; ii++ ) {
for( jj = 0; jj < halfWidth; jj++ ) {
float totals[] = new float[4];
float extractTotals[][] = new float[BOX4][4];
int cc;
-
+
dataIn.position( src );
extract.extract( isSwap, dataIn, extractTotals[0] );
dataIn.position( src + rowSizeInBytes );
@@ -1224,10 +1224,10 @@ public class HalveImage {
extract.extract( isSwap, dataIn, extractTotals[2] );
dataIn.position( src + rowSizeInBytes + imageSizeInBytes );
extract.extract( isSwap, dataIn, extractTotals[3] );
-
+
for( cc = 0; cc < components; cc++ ) {
int kk;
-
+
// grab 4 pixels to average
totals[cc] = 0.0f;
for( kk = 0; kk < BOX4; kk++ ) {
@@ -1243,7 +1243,7 @@ public class HalveImage {
}
}
}
-
+
public static void halveImageSlice( int components, ExtractPrimitive extract, int width,
int height, int depth, ByteBuffer dataIn, ByteBuffer dataOut,
int elementSizeInBytes, int groupSizeInBytes, int rowSizeInBytes,
@@ -1255,25 +1255,25 @@ public class HalveImage {
int src = 0;
int padBytes = rowSizeInBytes - ( width * groupSizeInBytes );
int outIndex = 0;
-
+
assert( (width == 1 || height == 1) && depth >= 2 );
-
+
if( width == height ) {
assert( width == 1 && height == 1 );
assert( depth >= 2 );
-
+
for( ii = 0; ii < halfDepth; ii++ ) {
int cc;
for( cc = 0; cc < components; cc++ ) {
double[] totals = new double[4];
double[][] extractTotals = new double[BOX2][4];
int kk;
-
+
dataIn.position( src );
extractTotals[0][cc] = extract.extract( isSwap, dataIn );
dataIn.position( src + imageSizeInBytes );
extractTotals[1][cc] = extract.extract( isSwap, dataIn );
-
+
// average 2 pixels since only a column
totals[cc] = 0.0f;
// totals[red] = extractTotals[0][red] + extractTotals[1][red];
@@ -1282,7 +1282,7 @@ public class HalveImage {
totals[cc] += extractTotals[kk][cc];
}
totals[cc] /= (double)BOX2;
-
+
extract.shove( totals[cc], outIndex, dataOut );
outIndex++;
src += elementSizeInBytes;
@@ -1290,12 +1290,12 @@ public class HalveImage {
// skip over next group of 2
src += rowSizeInBytes;
} // for ii
-
+
assert( src == rowSizeInBytes * height * depth );
assert( outIndex == halfDepth * components );
} else if( height == 1 ) {
assert( width != 1 );
-
+
for( ii = 0; ii < halfDepth; ii++ ) {
for( jj = 0; jj < halfWidth; jj++ ) {
int cc;
@@ -1303,7 +1303,7 @@ public class HalveImage {
int kk;
double totals[] = new double[4];
double extractTotals[][] = new double[BOX4][4];
-
+
dataIn.position( src );
extractTotals[0][cc] = extract.extract( isSwap, dataIn );
dataIn.position( src + groupSizeInBytes );
@@ -1312,7 +1312,7 @@ public class HalveImage {
extractTotals[2][cc] = extract.extract( isSwap, dataIn );
dataIn.position( src + imageSizeInBytes + groupSizeInBytes );
extractTotals[3][cc] = extract.extract( isSwap, dataIn );
-
+
// grab 4 pixels to average
totals[cc] = 0.0f;
// totals[red] = extractTotals[0][red] + extractTotals[1][red] +
@@ -1322,7 +1322,7 @@ public class HalveImage {
totals[cc] += extractTotals[kk][cc];
}
totals[cc] /= (double)BOX4;
-
+
extract.shove( totals[cc], outIndex, dataOut );
outIndex++;
src += elementSizeInBytes;
@@ -1337,7 +1337,7 @@ public class HalveImage {
assert( outIndex == halfWidth * halfDepth * components );
} else if( width == 1 ) {
assert( height != 1 );
-
+
for( ii = 0; ii < halfDepth; ii++ ) {
for( jj = 0; jj < halfHeight; jj++ ) {
int cc;
@@ -1345,7 +1345,7 @@ public class HalveImage {
int kk;
double totals[] = new double[4];
double extractTotals[][] = new double[BOX4][4];
-
+
dataIn.position( src );
extractTotals[0][cc] = extract.extract( isSwap, dataIn );
dataIn.position( src + rowSizeInBytes );
@@ -1354,8 +1354,8 @@ public class HalveImage {
extractTotals[2][cc] = extract.extract( isSwap, dataIn );
dataIn.position( src + imageSizeInBytes + groupSizeInBytes );
extractTotals[3][cc] = extract.extract( isSwap, dataIn );
-
-
+
+
// grab 4 pixels to average
totals[cc] = 0.0f;
// totals[red] = extractTotals[0][red] + extractTotals[1][red] +
@@ -1365,7 +1365,7 @@ public class HalveImage {
totals[cc] += extractTotals[kk][cc];
}
totals[cc] /= (double)BOX4;
-
+
extract.shove( totals[cc], outIndex, dataOut );
outIndex++;
src += elementSizeInBytes;
@@ -1380,32 +1380,32 @@ public class HalveImage {
assert( outIndex == halfWidth * halfDepth * components );
}
}
-
+
public static void halveImage3D( int components, ExtractPrimitive extract,
int width, int height, int depth, ByteBuffer dataIn, ByteBuffer dataOut,
int elementSizeInBytes, int groupSizeInBytes, int rowSizeInBytes,
int imageSizeInBytes, boolean isSwap ) {
assert( depth > 1 );
-
+
// horizontal/vertical/onecolumn slice viewed from top
if( width == 1 || height == 1 ) {
assert( 1 <= depth );
-
+
halveImageSlice( components, extract, width, height, depth, dataIn, dataOut,
elementSizeInBytes, groupSizeInBytes, rowSizeInBytes, imageSizeInBytes,
isSwap );
return;
}
-
+
int ii, jj, dd;
-
+
int halfWidth = width / 2;
int halfHeight = height / 2;
int halfDepth = depth / 2;
int src = 0;
int padBytes = rowSizeInBytes - ( width * groupSizeInBytes );
int outIndex = 0;
-
+
for( dd = 0; dd < halfDepth; dd++ ) {
for( ii = 0; ii < halfHeight; ii++ ) {
for( jj = 0; jj < halfWidth; jj++ ) {
@@ -1414,7 +1414,7 @@ public class HalveImage {
int kk;
double totals[] = new double[4];
double extractTotals[][] = new double[BOX8][4];
-
+
dataIn.position( src );
extractTotals[0][cc] = extract.extract( isSwap, dataIn );
dataIn.position( src + groupSizeInBytes );
@@ -1431,17 +1431,17 @@ public class HalveImage {
extractTotals[6][cc] = extract.extract( isSwap, dataIn );
dataIn.position( src + rowSizeInBytes + imageSizeInBytes + groupSizeInBytes );
extractTotals[7][cc] = extract.extract( isSwap, dataIn );
-
+
totals[cc] = 0.0f;
-
+
for( kk = 0; kk < BOX8; kk++ ) {
totals[cc] += extractTotals[kk][cc];
}
totals[cc] /= (double)BOX8;
-
+
extract.shove( totals[cc], outIndex, dataOut );
outIndex++;
-
+
src += elementSizeInBytes;
} // for cc
// skip over to next square of 4
@@ -1456,40 +1456,40 @@ public class HalveImage {
assert( src == rowSizeInBytes * height * depth );
assert( outIndex == halfWidth * halfHeight * halfDepth * components );
}
-
+
public static void halveImagePackedPixel3D( int components, Extract extract,
- int width, int height, int depth, ByteBuffer dataIn,
+ int width, int height, int depth, ByteBuffer dataIn,
ByteBuffer dataOut, int pixelSizeInBytes, int rowSizeInBytes,
int imageSizeInBytes, boolean isSwap ) {
if( depth == 1 ) {
assert( 1 <= width && 1 <= height );
-
+
halveImagePackedPixel( components, extract, width, height, dataIn, dataOut,
pixelSizeInBytes, rowSizeInBytes, isSwap );
return;
} else if( width == 1 || height == 1 ) { // a horizontal or vertical slice viewed from top
assert( 1 <= depth );
-
+
halveImagePackedPixelSlice( components, extract, width, height, depth, dataIn,
dataOut, pixelSizeInBytes, rowSizeInBytes, imageSizeInBytes, isSwap );
return;
}
int ii, jj, dd;
-
+
int halfWidth = width / 2;
int halfHeight = height / 2;
int halfDepth = depth / 2;
int src = 0;
int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes );
int outIndex = 0;
-
+
for( dd = 0; dd < halfDepth; dd++ ) {
for( ii = 0; ii < halfHeight; ii++ ) {
for( jj = 0; jj < halfWidth; jj++ ) {
float totals[] = new float[4]; // 4 is max components
float extractTotals[][] = new float[BOX8][4];
int cc;
-
+
dataIn.position( src );
extract.extract( isSwap, dataIn, extractTotals[0] );
dataIn.position( src + pixelSizeInBytes );
@@ -1506,7 +1506,7 @@ public class HalveImage {
extract.extract( isSwap, dataIn, extractTotals[6] );
dataIn.position( src + rowSizeInBytes + pixelSizeInBytes + imageSizeInBytes );
extract.extract( isSwap, dataIn, extractTotals[7] );
-
+
for( cc = 0; cc < components; cc++ ) {
int kk;
// grab 8 pixels to average
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java
index b610ce8..18f814d 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -53,18 +53,18 @@ import java.nio.*;
* @author Administrator
*/
public class Image {
-
+
/** Creates a new instance of Image */
public Image() {
}
-
+
public static short getShortFromByteArray( byte[] array, int index ) {
short s;
s = (short)(array[index] << 8 );
s |= (short)(0x00FF & array[index+1]);
return( s );
}
-
+
public static int getIntFromByteArray( byte[] array, int index ) {
int i;
i = ( array[index] << 24 ) & 0xFF000000;
@@ -73,12 +73,12 @@ public class Image {
i |= ( array[index+3] ) & 0x000000FF;
return( i );
}
-
+
public static float getFloatFromByteArray( byte[] array, int index ) {
int i = getIntFromByteArray( array, index );
return( Float.intBitsToFloat(i) );
}
-
+
/*
* Extract array from user's data applying all pixel store modes.
* The internal format used is an array of unsigned shorts.
@@ -98,7 +98,7 @@ public class Image {
int iter2;
int i, j, k;
boolean myswap_bytes;
-
+
// Create a Extract interface object
Extract extract = null;
switch( type ) {
@@ -139,7 +139,7 @@ public class Image {
extract = new Extract2101010rev();
break;
}
-
+
myswap_bytes = psm.getUnpackSwapBytes();
components = Mipmap.elements_per_group( format, type );
if( psm.getUnpackRowLength() > 0 ) {
@@ -147,12 +147,12 @@ public class Image {
} else {
groups_per_line = width;
}
-
+
// All formats except GL_BITMAP fall out trivially
if( type == GL2.GL_BITMAP ) {
int bit_offset;
int current_bit;
-
+
rowsize = ( groups_per_line * components + 7 ) / 8;
padding = ( rowsize % psm.getUnpackAlignment() );
if( padding != 0 ) {
@@ -200,7 +200,7 @@ public class Image {
if( element_size == 1 ) {
myswap_bytes = false;
}
-
+
rowsize = groups_per_line * group_size;
padding = ( rowsize % psm.getUnpackAlignment() );
if( padding != 0 ) {
@@ -208,7 +208,7 @@ public class Image {
}
start = psm.getUnpackSkipRows() * rowsize + psm.getUnpackSkipPixels() * group_size;
elements_per_line = width * components;
-
+
iter2 = 0;
for( i = 0; i < height; i++ ) {
iter = start;
@@ -364,7 +364,7 @@ public class Image {
// want iter pointing at start, not within, row for assertion purposes
iter = start;
} // for i
-
+
// iterators should be one byte past end
if( !Mipmap.isTypePackedPixel( type ) ) {
assert( iter2 == ( width * height * components ) );
@@ -374,16 +374,16 @@ public class Image {
assert( iter == ( rowsize * height + psm.getUnpackSkipRows() * rowsize + psm.getUnpackSkipPixels() * group_size ) );
}
}
-
+
/*
* Insert array into user's data applying all pixel store modes.
* Theinternal format is an array of unsigned shorts.
* empty_image() because it is the opposet of fill_image().
*/
- public static void empty_image( PixelStorageModes psm, int width, int height,
- int format, int type, boolean index_format,
+ public static void empty_image( PixelStorageModes psm, int width, int height,
+ int format, int type, boolean index_format,
ShortBuffer oldimage, ByteBuffer userdata ) {
-
+
int components;
int element_size;
int rowsize;
@@ -396,7 +396,7 @@ public class Image {
int iter2;
int i, j, k;
boolean myswap_bytes;
-
+
// Create a Extract interface object
Extract extract = null;
switch( type ) {
@@ -437,7 +437,7 @@ public class Image {
extract = new Extract2101010rev();
break;
}
-
+
myswap_bytes = psm.getPackSwapBytes();
components = Mipmap.elements_per_group( format, type );
if( psm.getPackRowLength() > 0 ) {
@@ -445,12 +445,12 @@ public class Image {
} else {
groups_per_line = width;
}
-
+
// all formats except GL_BITMAP fall out trivially
if( type == GL2.GL_BITMAP ) {
int bit_offset;
int current_bit;
-
+
rowsize = ( groups_per_line * components + 7 ) / 8;
padding = ( rowsize % psm.getPackAlignment() );
if( padding != 0 ) {
@@ -472,7 +472,7 @@ public class Image {
current_bit = 0;
}
}
-
+
if( current_bit != 0 ) {
if( psm.getPackLsbFirst() ) {
userdata.put( iter, (byte)( ( userdata.get( iter ) | ( 1 << bit_offset ) ) ) );
@@ -488,7 +488,7 @@ public class Image {
userdata.put( iter, (byte)( ( userdata.get( iter ) & ~( 7 - bit_offset ) ) ) );
}
}
-
+
bit_offset++;
if( bit_offset == 8 ) {
bit_offset = 0;
@@ -500,13 +500,13 @@ public class Image {
}
} else {
float shoveComponents[] = new float[4];
-
+
element_size = Mipmap.bytes_per_element( type );
group_size = element_size * components;
if( element_size == 1 ) {
myswap_bytes = false;
}
-
+
rowsize = groups_per_line * group_size;
padding = ( rowsize % psm.getPackAlignment() );
if( padding != 0 ) {
@@ -514,13 +514,13 @@ public class Image {
}
start = psm.getPackSkipRows() * rowsize + psm.getPackSkipPixels() * group_size;
elements_per_line = width * components;
-
+
iter2 = 0;
for( i = 0; i < height; i++ ) {
iter = start;
for( j = 0; j < elements_per_line; j++ ) {
Type_Widget widget = new Type_Widget();
-
+
switch( type ) {
case( GL2.GL_UNSIGNED_BYTE_3_3_2 ):
for( k = 0; k < 3; k++ ) {
@@ -799,7 +799,7 @@ public class Image {
assert( iter == rowsize * height + psm.getPackSkipRows() * rowsize + psm.getPackSkipPixels() * group_size );
}
}
-
+
public static void fillImage3D( PixelStorageModes psm, int width, int height,
int depth, int format, int type, boolean indexFormat, ByteBuffer userImage,
ShortBuffer newImage ) {
@@ -819,7 +819,7 @@ public class Image {
int ww, hh, dd, k;
Type_Widget widget = new Type_Widget();
float extractComponents[] = new float[4];
-
+
// Create a Extract interface object
Extract extract = null;
switch( type ) {
@@ -860,7 +860,7 @@ public class Image {
extract = new Extract2101010rev();
break;
}
-
+
myswapBytes = psm.getUnpackSwapBytes();
components = Mipmap.elements_per_group( format, type );
if( psm.getUnpackRowLength() > 0 ) {
@@ -873,7 +873,7 @@ public class Image {
if( elementSize == 1 ) {
myswapBytes = false;
}
-
+
// 3dstuff begin
if( psm.getUnpackImageHeight() > 0 ) {
rowsPerImage = psm.getUnpackImageHeight();
@@ -881,27 +881,27 @@ public class Image {
rowsPerImage = height;
}
// 3dstuff end
-
+
rowSize = groupsPerLine * groupSize;
padding = rowSize % psm.getUnpackAlignment();
if( padding != 0 ) {
rowSize += psm.getUnpackAlignment() - padding;
}
-
+
imageSize = rowsPerImage * rowSize; // 3dstuff
-
- start = psm.getUnpackSkipRows() * rowSize +
- psm.getUnpackSkipPixels() * groupSize +
+
+ start = psm.getUnpackSkipRows() * rowSize +
+ psm.getUnpackSkipPixels() * groupSize +
psm.getUnpackSkipImages() * imageSize;
elementsPerLine = width * components;
-
+
iter2 = 0;
for( dd = 0; dd < depth; dd++ ) {
rowStart = start;
for( hh = 0; hh < height; hh++ ) {
iter = rowStart;
for( ww = 0; ww < elementsPerLine; ww++ ) {
-
+
switch( type ) {
case( GL2.GL_UNSIGNED_BYTE ):
if( indexFormat ) {
@@ -1063,18 +1063,18 @@ public class Image {
} // for hh
start += imageSize;
}// for dd
-
+
// iterators should be one byte past end
if( !Mipmap.isTypePackedPixel( type ) ) {
assert( iter2 == width * height * depth * components );
} else {
assert( iter2 == width * height * depth * Mipmap.elements_per_group( format, 0 ) );
}
- assert( iter == rowSize * height * depth + psm.getUnpackSkipRows() * rowSize +
+ assert( iter == rowSize * height * depth + psm.getUnpackSkipRows() * rowSize +
psm.getUnpackSkipPixels() * groupSize +
psm.getUnpackSkipImages() * imageSize );
}
-
+
public static void emptyImage3D( PixelStorageModes psm, int width, int height, int depth,
int format, int type, boolean indexFormat, ShortBuffer oldImage, ByteBuffer userImage ) {
boolean myswapBytes;
@@ -1092,7 +1092,7 @@ public class Image {
int imageSize;
Type_Widget widget = new Type_Widget();
float[] shoveComponents = new float[4];
-
+
// Create a Extract interface object
Extract extract = null;
switch( type ) {
@@ -1133,9 +1133,9 @@ public class Image {
extract = new Extract2101010rev();
break;
}
-
+
iter = 0;
-
+
myswapBytes = psm.getPackSwapBytes();
components = Mipmap.elements_per_group( format, type );
if( psm.getPackRowLength() > 0 ) {
@@ -1143,44 +1143,44 @@ public class Image {
} else {
groupsPerLine = width;
}
-
+
elementSize = Mipmap.bytes_per_element( type );
groupSize = elementSize * components;
if( elementSize == 1 ) {
myswapBytes = false;
}
-
+
// 3dstuff begin
if( psm.getPackImageHeight() > 0 ) {
rowsPerImage = psm.getPackImageHeight();
} else {
rowsPerImage = height;
}
-
+
// 3dstuff end
-
+
rowSize = groupsPerLine * groupSize;
padding = rowSize % psm.getPackAlignment();
if( padding != 0 ) {
rowSize += psm.getPackAlignment() - padding;
}
-
+
imageSize = rowsPerImage * rowSize;
-
+
start = psm.getPackSkipRows() * rowSize +
psm.getPackSkipPixels() * groupSize +
psm.getPackSkipImages() * imageSize;
elementsPerLine = width * components;
-
+
iter2 = 0;
for( dd = 0; dd < depth; dd++ ) {
rowStart = start;
-
+
for( ii = 0; ii < height; ii++ ) {
iter = rowStart;
-
+
for( jj = 0; jj < elementsPerLine; jj++ ) {
-
+
switch( type ) {
case( GL2.GL_UNSIGNED_BYTE ):
if( indexFormat ) {
@@ -1392,20 +1392,20 @@ public class Image {
default:
assert( false );
}
-
+
iter += elementSize;
} // for jj
rowStart += rowSize;
} // for ii
start += imageSize;
} // for dd
-
+
if( !Mipmap.isTypePackedPixel( type ) ) {
assert( iter2 == width * height * depth * components );
} else {
assert( iter2 == width * height * depth * Mipmap.elements_per_group( format, 0 ) );
}
- assert( iter == rowSize * height * depth +
+ assert( iter == rowSize * height * depth +
psm.getUnpackSkipRows() * rowSize +
psm.getUnpackSkipPixels() * groupSize +
psm.getUnpackSkipImages() * imageSize );
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java
index b74d0a6..938873e 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -57,11 +57,11 @@ import com.jogamp.common.nio.Buffers;
* @author Administrator
*/
public class Mipmap {
-
+
/** Creates a new instance of Mipmap */
public Mipmap() {
}
-
+
public static int computeLog( int value ) {
int i = 0;
// Error
@@ -79,7 +79,7 @@ public class Mipmap {
i++;
}
}
-
+
/* Compute the nearest power of 2 number. This algorithm is a little strange
* but it works quite well.
*/
@@ -99,7 +99,7 @@ public class Mipmap {
i *= 2;
}
}
-
+
public static short GLU_SWAP_2_BYTES( short s ) {
byte b = 0;
b = (byte)( s >>> 8 );
@@ -107,7 +107,7 @@ public class Mipmap {
s = (short)( s | (0x00FF & b) );
return( s );
}
-
+
public static int GLU_SWAP_4_BYTES( int i ) {
int t = i << 24;
t |= 0x00FF0000 & ( i << 8 );
@@ -115,13 +115,13 @@ public class Mipmap {
t |= 0x000000FF & ( i >>> 24 );
return( t );
}
-
+
public static float GLU_SWAP_4_BYTES( float f ) {
int i = Float.floatToRawIntBits( f );
float temp = Float.intBitsToFloat( i );
return( temp );
}
-
+
public static int checkMipmapArgs( int internalFormat, int format, int type ) {
if( !legalFormat( format ) || !legalType( type ) ) {
return( GLU.GLU_INVALID_ENUM );
@@ -134,7 +134,7 @@ public class Mipmap {
}
return( 0 );
}
-
+
public static boolean legalFormat( int format ) {
switch( format ) {
case( GL2.GL_COLOR_INDEX ):
@@ -155,7 +155,7 @@ public class Mipmap {
return( false );
}
}
-
+
public static boolean legalType( int type ) {
switch( type ) {
case( GL2.GL_BITMAP ):
@@ -183,10 +183,10 @@ public class Mipmap {
return( false );
}
}
-
+
public static boolean isTypePackedPixel( int type ) {
assert( legalType( type ) );
-
+
if( type == GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ||
type == GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ||
type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5 ||
@@ -203,20 +203,20 @@ public class Mipmap {
}
return( false );
}
-
+
public static boolean isLegalFormatForPackedPixelType( int format, int type ) {
// if not a packed pixel type then return true
if( isTypePackedPixel( type ) ) {
return( true );
}
-
+
// 3_3_2/2_3_3_REV & 5_6_5/5_6_5_REV are only compatible with RGB
if( (type == GL2GL3.GL_UNSIGNED_BYTE_3_3_2 || type == GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ||
type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5 || type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV )
& format != GL2GL3.GL_RGB ) {
return( false );
}
-
+
// 4_4_4_4/4_4_4_4_REV & 5_5_5_1/1_5_5_5_REV & 8_8_8_8/8_8_8_8_REV &
// 10_10_10_2/2_10_10_10_REV are only campatible with RGBA, BGRA & ARGB_EXT
if( ( type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 ||
@@ -232,7 +232,7 @@ public class Mipmap {
}
return( true );
}
-
+
public static boolean isLegalLevels( int userLevel, int baseLevel, int maxLevel,
int totalLevels ) {
if( (baseLevel < 0) || (baseLevel < userLevel) || (maxLevel < baseLevel) ||
@@ -241,7 +241,7 @@ public class Mipmap {
}
return( true );
}
-
+
/* Given user requested textures size, determine if it fits. If it doesn't then
* halve both sides and make the determination again until it does fit ( for
* IR only ).
@@ -257,7 +257,7 @@ public class Mipmap {
int heightPowerOf2 = nearestPower( height );
int[] proxyWidth = new int[1];
boolean noProxyTextures = false;
-
+
// Some drivers (in particular, ATI's) seem to set a GL error
// when proxy textures are used even though this is in violation
// of the spec. Guard against this and interactions with the
@@ -268,20 +268,20 @@ public class Mipmap {
int widthAtLevelOne = ( ( width > 1 ) ? (widthPowerOf2 >> 1) : widthPowerOf2 );
int heightAtLevelOne = ( ( height > 1 ) ? (heightPowerOf2 >> 1) : heightPowerOf2 );
int proxyTarget;
-
+
assert( widthAtLevelOne > 0 );
assert( heightAtLevelOne > 0 );
-
+
// does width x height at level 1 & all their mipmaps fit?
if( target == GL2GL3.GL_TEXTURE_2D || target == GL2GL3.GL_PROXY_TEXTURE_2D ) {
proxyTarget = GL2GL3.GL_PROXY_TEXTURE_2D;
gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne,
heightAtLevelOne, 0, format, type, null );
- } else if( (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_X) ||
- (target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_X) ||
- (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_Y) ||
- (target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) ||
- (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_Z) ||
+ } else if( (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_X) ||
+ (target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_X) ||
+ (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_Y) ||
+ (target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) ||
+ (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_Z) ||
(target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) ) {
proxyTarget = GL2GL3.GL_PROXY_TEXTURE_CUBE_MAP;
gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne,
@@ -289,7 +289,7 @@ public class Mipmap {
} else {
assert( target == GL2GL3.GL_TEXTURE_1D || target == GL2GL3.GL_PROXY_TEXTURE_1D );
proxyTarget = GL2GL3.GL_PROXY_TEXTURE_1D;
- gl.getGL2GL3().glTexImage1D( proxyTarget, 1, internalFormat, widthAtLevelOne,
+ gl.getGL2GL3().glTexImage1D( proxyTarget, 1, internalFormat, widthAtLevelOne,
0, format, type, null );
}
if(gl.isGL2GL3()) {
@@ -336,15 +336,15 @@ public class Mipmap {
newHeight[0] = maxsize[0];
}
}
-
- public static void closestFit3D( GL gl, int target, int width, int height, int depth,
+
+ public static void closestFit3D( GL gl, int target, int width, int height, int depth,
int internalFormat, int format, int type, int[] newWidth, int[] newHeight,
int[] newDepth ) {
int widthPowerOf2 = nearestPower( width );
int heightPowerOf2 = nearestPower( height );
int depthPowerOf2 = nearestPower( depth );
int[] proxyWidth = new int[1];
-
+
do {
// compute level 1 width & height & depth, clamping each at 1
int widthAtLevelOne = (widthPowerOf2 > 1) ? widthPowerOf2 >> 1 : widthPowerOf2;
@@ -354,7 +354,7 @@ public class Mipmap {
assert( widthAtLevelOne > 0 );
assert( heightAtLevelOne > 0 );
assert( depthAtLevelOne > 0 );
-
+
// does width x height x depth at level 1 & all their mipmaps fit?
if( target == GL2GL3.GL_TEXTURE_3D || target == GL2GL3.GL_PROXY_TEXTURE_3D ) {
proxyTarget = GL2GL3.GL_PROXY_TEXTURE_3D;
@@ -378,16 +378,16 @@ public class Mipmap {
}
} while( proxyWidth[0] == 0 );
// loop must terminate
-
+
// return the width & height at level 0 that fits
newWidth[0] = widthPowerOf2;
newHeight[0] = heightPowerOf2;
newDepth[0] = depthPowerOf2;
}
-
+
public static int elements_per_group( int format, int type ) {
// Return the number of elements per grtoup of a specified gromat
-
+
// If the type is packedpixels then answer is 1
if( type == GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ||
type == GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ||
@@ -403,7 +403,7 @@ public class Mipmap {
type == GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ) {
return( 1 );
}
-
+
// Types are not packed pixels so get elements per group
switch( format ) {
case( GL2GL3.GL_RGB ):
@@ -418,10 +418,10 @@ public class Mipmap {
return( 1 );
}
}
-
+
public static int bytes_per_element( int type ) {
// return the number of bytes per element, based on the element type
-
+
switch( type ) {
case( GL2.GL_BITMAP ):
case( GL2GL3.GL_BYTE ):
@@ -450,17 +450,17 @@ public class Mipmap {
return( 4 );
}
}
-
+
public static boolean is_index( int format ) {
return( format == GL2.GL_COLOR_INDEX || format == GL2GL3.GL_STENCIL_INDEX );
}
-
+
/* Compute memory required for internal packed array of data of given type and format. */
-
+
public static int image_size( int width, int height, int format, int type ) {
int bytes_per_row;
int components;
-
+
assert( width > 0 );
assert( height > 0 );
components = elements_per_group( format, type );
@@ -471,17 +471,17 @@ public class Mipmap {
}
return( bytes_per_row * height * components );
}
-
+
public static int imageSize3D( int width, int height, int depth, int format, int type ) {
int components = elements_per_group( format, type );
int bytes_per_row = bytes_per_element( type ) * width;
-
+
assert( width > 0 && height > 0 && depth > 0 );
assert( type != GL2.GL_BITMAP );
-
+
return( bytes_per_row * height * depth * components );
}
-
+
public static void retrieveStoreModes( GL gl, PixelStorageModes psm ) {
int[] a = new int[1];
gl.glGetIntegerv( GL2GL3.GL_UNPACK_ALIGNMENT, a, 0);
@@ -496,7 +496,7 @@ public class Mipmap {
psm.setUnpackLsbFirst( ( a[0] == 1 ) );
gl.glGetIntegerv( GL2GL3.GL_UNPACK_SWAP_BYTES, a, 0);
psm.setUnpackSwapBytes( ( a[0] == 1 ) );
-
+
gl.glGetIntegerv( GL2GL3.GL_PACK_ALIGNMENT, a, 0);
psm.setPackAlignment( a[0] );
gl.glGetIntegerv( GL2GL3.GL_PACK_ROW_LENGTH, a, 0);
@@ -510,7 +510,7 @@ public class Mipmap {
gl.glGetIntegerv( GL2GL3.GL_PACK_SWAP_BYTES, a, 0);
psm.setPackSwapBytes( ( a[0] == 1 ) );
}
-
+
public static void retrieveStoreModes3D( GL gl, PixelStorageModes psm ) {
int[] a = new int[1];
gl.glGetIntegerv( GL2GL3.GL_UNPACK_ALIGNMENT, a, 0);
@@ -529,7 +529,7 @@ public class Mipmap {
psm.setUnpackSkipImages( a[0] );
gl.glGetIntegerv( GL2GL3.GL_UNPACK_IMAGE_HEIGHT, a, 0);
psm.setUnpackImageHeight( a[0] );
-
+
gl.glGetIntegerv( GL2GL3.GL_PACK_ALIGNMENT, a, 0);
psm.setPackAlignment( a[0] );
gl.glGetIntegerv( GL2GL3.GL_PACK_ROW_LENGTH, a, 0);
@@ -547,9 +547,9 @@ public class Mipmap {
gl.glGetIntegerv( GL2GL3.GL_PACK_IMAGE_HEIGHT, a, 0 );
psm.setPackImageHeight( a[0] );
}
-
- public static int gluScaleImage( GL gl, int format, int widthin, int heightin,
- int typein, ByteBuffer datain, int widthout, int heightout,
+
+ public static int gluScaleImage( GL gl, int format, int widthin, int heightin,
+ int typein, ByteBuffer datain, int widthout, int heightout,
int typeout, ByteBuffer dataout ) {
int datainPos = datain.position();
int dataoutPos = dataout.position();
@@ -559,7 +559,7 @@ public class Mipmap {
ByteBuffer beforeimage;
ByteBuffer afterimage;
PixelStorageModes psm = new PixelStorageModes();
-
+
if( (widthin == 0) || (heightin == 0) || (widthout == 0) || (heightout == 0) ) {
return( 0 );
}
@@ -580,20 +580,20 @@ public class Mipmap {
if( beforeimage == null || afterimage == null ) {
return( GLU.GLU_OUT_OF_MEMORY );
}
-
+
retrieveStoreModes( gl, psm );
Image.fill_image( psm, widthin, heightin, format, typein, is_index( format ), datain, beforeimage.asShortBuffer() );
components = elements_per_group( format, 0 );
ScaleInternal.scale_internal( components, widthin, heightin, beforeimage.asShortBuffer(), widthout, heightout, afterimage.asShortBuffer() );
Image.empty_image( psm, widthout, heightout, format, typeout, is_index( format ), afterimage.asShortBuffer(), dataout );
-
+
return( 0 );
} finally {
datain.position(datainPos);
dataout.position(dataoutPos);
}
}
-
+
public static int gluBuild1DMipmapLevels( GL gl, int target, int internalFormat,
int width, int format, int type, int userLevel, int baseLevel,
int maxLevel, ByteBuffer data ) {
@@ -601,30 +601,30 @@ public class Mipmap {
try {
int levels;
-
+
int rc = checkMipmapArgs( internalFormat, format, type );
if( rc != 0 ) {
return( rc );
}
-
+
if( width < 1 ) {
return( GLU.GLU_INVALID_VALUE );
}
-
+
levels = computeLog( width );
-
+
levels += userLevel;
if( !isLegalLevels( userLevel, baseLevel, maxLevel, levels ) ) {
return( GLU.GLU_INVALID_VALUE );
}
-
+
return( BuildMipmap.gluBuild1DMipmapLevelsCore( gl, target, internalFormat, width,
width, format, type, userLevel, baseLevel, maxLevel, data ) );
} finally {
data.position(dataPos);
}
}
-
+
public static int gluBuild1DMipmaps( GL gl, int target, int internalFormat, int width,
int format, int type, ByteBuffer data ) {
int dataPos = data.position();
@@ -633,54 +633,54 @@ public class Mipmap {
int[] widthPowerOf2 = new int[1];
int levels;
int[] dummy = new int[1];
-
+
int rc = checkMipmapArgs( internalFormat, format, type );
if( rc != 0 ) {
return( rc );
}
-
+
if( width < 1 ) {
return( GLU.GLU_INVALID_VALUE );
}
-
+
closestFit( gl, target, width, 1, internalFormat, format, type, widthPowerOf2, dummy );
levels = computeLog( widthPowerOf2[0] );
-
- return( BuildMipmap.gluBuild1DMipmapLevelsCore( gl, target, internalFormat,
+
+ return( BuildMipmap.gluBuild1DMipmapLevelsCore( gl, target, internalFormat,
width, widthPowerOf2[0], format, type, 0, 0, levels, data ) );
} finally {
data.position(dataPos);
}
}
-
+
public static int gluBuild2DMipmapLevels( GL gl, int target, int internalFormat,
int width, int height, int format, int type, int userLevel,
int baseLevel, int maxLevel, Object data ) {
int dataPos = 0;
int level, levels;
-
+
int rc = checkMipmapArgs( internalFormat, format, type );
if( rc != 0 ) {
return( rc );
}
-
+
if( width < 1 || height < 1 ) {
return( GLU.GLU_INVALID_VALUE );
}
-
+
levels = computeLog( width );
level = computeLog( height );
if( level > levels ) {
levels = level;
}
-
+
levels += userLevel;
if( !isLegalLevels( userLevel, baseLevel, maxLevel, levels ) ) {
return( GLU.GLU_INVALID_VALUE );
}
-
+
//PointerWrapper pointer = PointerWrapperFactory.getPointerWrapper( data );
ByteBuffer buffer = null;
if( data instanceof ByteBuffer ) {
@@ -706,7 +706,7 @@ public class Mipmap {
FloatBuffer fb = buffer.asFloatBuffer();
fb.put( array );
}
-
+
try {
return( BuildMipmap.gluBuild2DMipmapLevelsCore( gl, target, internalFormat,
width, height, width, height, format, type, userLevel, baseLevel,
@@ -716,7 +716,7 @@ public class Mipmap {
}
}
-
+
public static int gluBuild2DMipmaps( GL gl, int target, int internalFormat,
int width, int height, int format, int type, Object data ) {
int dataPos = 0;
@@ -724,25 +724,25 @@ public class Mipmap {
int[] widthPowerOf2 = new int[1];
int[] heightPowerOf2 = new int[1];
int level, levels;
-
+
int rc = checkMipmapArgs( internalFormat, format, type );
if( rc != 0 ) {
return( rc );
}
-
+
if( width < 1 || height < 1 ) {
return( GLU.GLU_INVALID_VALUE );
}
-
- closestFit( gl, target, width, height, internalFormat, format, type,
+
+ closestFit( gl, target, width, height, internalFormat, format, type,
widthPowerOf2, heightPowerOf2 );
-
+
levels = computeLog( widthPowerOf2[0] );
level = computeLog( heightPowerOf2[0] );
if( level > levels ) {
levels = level;
}
-
+
//PointerWrapper pointer = PointerWrapperFactory.getPointerWrapper( data );
ByteBuffer buffer = null;
if( data instanceof ByteBuffer ) {
@@ -768,17 +768,17 @@ public class Mipmap {
FloatBuffer fb = buffer.asFloatBuffer();
fb.put( array );
}
-
+
try {
- return( BuildMipmap.gluBuild2DMipmapLevelsCore( gl, target, internalFormat,
- width, height, widthPowerOf2[0], heightPowerOf2[0], format, type, 0,
+ return( BuildMipmap.gluBuild2DMipmapLevelsCore( gl, target, internalFormat,
+ width, height, widthPowerOf2[0], heightPowerOf2[0], format, type, 0,
0, levels, buffer ) );
} finally {
buffer.position(dataPos);
}
}
-
-
+
+
public static int gluBuild3DMipmaps( GL gl, int target, int internalFormat,
int width, int height, int depth, int format, int type, ByteBuffer data ) {
int dataPos = data.position();
@@ -788,23 +788,23 @@ public class Mipmap {
int[] heightPowerOf2 = new int[1];
int[] depthPowerOf2 = new int[1];
int level, levels;
-
+
int rc = checkMipmapArgs( internalFormat, format, type );
if( rc != 0 ) {
return( rc );
}
-
+
if( width < 1 || height < 1 || depth < 1 ) {
return( GLU.GLU_INVALID_VALUE );
}
-
+
if( type == GL2.GL_BITMAP ) {
return( GLU.GLU_INVALID_ENUM );
}
-
+
closestFit3D( gl, target, width, height, depth, internalFormat, format,
type, widthPowerOf2, heightPowerOf2, depthPowerOf2 );
-
+
levels = computeLog( widthPowerOf2[0] );
level = computeLog( heightPowerOf2[0] );
if( level > levels ) {
@@ -814,7 +814,7 @@ public class Mipmap {
if( level > levels ) {
levels = level;
}
-
+
return( BuildMipmap.gluBuild3DMipmapLevelsCore( gl, target, internalFormat, width,
height, depth, widthPowerOf2[0], heightPowerOf2[0], depthPowerOf2[0],
format, type, 0, 0, levels, data ) );
@@ -822,27 +822,27 @@ public class Mipmap {
data.position(dataPos);
}
}
-
+
public static int gluBuild3DMipmapLevels( GL gl, int target, int internalFormat,
int width, int height, int depth, int format, int type, int userLevel,
int baseLevel, int maxLevel, ByteBuffer data ) {
int dataPos = data.position();
try {
int level, levels;
-
+
int rc = checkMipmapArgs( internalFormat, format, type );
if( rc != 0 ) {
return( rc );
}
-
+
if( width < 1 || height < 1 || depth < 1 ) {
return( GLU.GLU_INVALID_VALUE );
}
-
+
if( type == GL2.GL_BITMAP ) {
return( GLU.GLU_INVALID_ENUM );
}
-
+
levels = computeLog( width );
level = computeLog( height );
if( level > levels ) {
@@ -852,12 +852,12 @@ public class Mipmap {
if( level > levels ) {
levels = level;
}
-
+
levels += userLevel;
if( !isLegalLevels( userLevel, baseLevel, maxLevel, levels ) ) {
return( GLU.GLU_INVALID_VALUE );
}
-
+
return( BuildMipmap.gluBuild3DMipmapLevelsCore( gl, target, internalFormat, width,
height, depth, width, height, depth, format, type, userLevel,
baseLevel, maxLevel, data ) );
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java
index 0b1af83..7eb98db 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -129,7 +129,7 @@ public class PixelStorageModes {
* Holds value of property unpackImageHeight.
*/
private int unpackImageHeight;
-
+
/** Creates a new instance of PixelStorageModes */
public PixelStorageModes() {
}
@@ -421,6 +421,6 @@ public class PixelStorageModes {
this.unpackImageHeight = unpackImageHeight;
}
-
-
+
+
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java
index 5f086ce..9aca1fb 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -55,9 +55,9 @@ import com.jogamp.common.nio.Buffers;
* @author Administrator
*/
public class ScaleInternal {
-
+
public static final float UINT_MAX = (float)(0x00000000FFFFFFFF);
-
+
public static void scale_internal( int components, int widthin, int heightin,
ShortBuffer datain, int widthout, int heightout, ShortBuffer dataout ) {
float x, lowx, highx, convx, halfconvx;
@@ -69,7 +69,7 @@ public class ScaleInternal {
float area;
int i, j, k, yint, xint, xindex, yindex;
int temp;
-
+
if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) {
HalveImage.halveImage( components, widthin, heightin, datain, dataout );
return;
@@ -101,7 +101,7 @@ public class ScaleInternal {
// data.
totals[0] = totals[1] = totals[2] = totals[3] = 0.0f;
area = 0.0f;
-
+
y = lowy;
yint = (int)Math.floor( y );
while( y < highy ) {
@@ -111,10 +111,10 @@ public class ScaleInternal {
} else {
ypercent = yint + 1 - y;
}
-
+
x = lowx;
xint = (int)Math.floor( x );
-
+
while( x < highx ) {
xindex = ( xint + widthin ) % widthin;
if( highx < xint + 1 ) {
@@ -122,21 +122,21 @@ public class ScaleInternal {
} else {
xpercent = xint + 1 - x;
}
-
+
percent = xpercent * ypercent;
area += percent;
temp = ( xindex + ( yindex * widthin) ) * components;
for( k = 0; k < components; k++ ) {
- totals[k] += datain.get( temp + k ) * percent;
+ totals[k] += datain.get( temp + k ) * percent;
}
-
+
xint++;
x = xint;
}
yint++;
y = yint;
}
-
+
temp = ( j + ( i * widthout ) ) * components;
for( k = 0; k < components; k++ ) {
// totals[] should be rounded in the case of enlarging an RGB
@@ -146,9 +146,9 @@ public class ScaleInternal {
}
}
}
-
+
public static void scale_internal_ubyte( int components, int widthin, int heightin,
- ByteBuffer datain, int widthout, int heightout,
+ ByteBuffer datain, int widthout, int heightout,
ByteBuffer dataout, int element_size, int ysize, int group_size ) {
float x, convx;
float y, convy;
@@ -157,11 +157,11 @@ public class ScaleInternal {
float[] totals = new float[4];
float area;
int i, j, k, xindex;
-
+
int temp, temp0;
int temp_index;
int outindex;
-
+
int lowx_int, highx_int, lowy_int, highy_int;
float x_percent, y_percent;
float lowx_float, highx_float, lowy_float, highy_float;
@@ -169,9 +169,9 @@ public class ScaleInternal {
int convy_int, convx_int;
int l, m;
int left, right;
-
+
if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) {
- HalveImage.halveImage_ubyte( components, widthin, heightin, datain, dataout,
+ HalveImage.halveImage_ubyte( components, widthin, heightin, datain, dataout,
element_size, ysize, group_size );
return;
}
@@ -181,35 +181,42 @@ public class ScaleInternal {
convy_float = convy - convy_int;
convx_int = (int)Math.floor( convx );
convx_float = convx - convx_int;
-
+
area = convx * convy;
-
+
lowy_int = 0;
lowy_float = 0.0f;
highy_int = convy_int;
highy_float = convy_float;
-
+
for( i = 0; i < heightout; i++ ) {
// Clamp here to be sure we don't read beyond input buffer.
if (highy_int >= heightin)
highy_int = heightin - 1;
lowx_int = 0;
lowx_float = 0.0f;
- highx_int = convx_int;
- highx_float = convx_float;
-
+ // If we have a single column, fix the max width values
+ // to prevent buffer overflow
+ if (widthin == 1 && widthout == 1) {
+ highx_int = 0;
+ highx_float = 0.0f;
+ } else {
+ highx_int = convx_int;
+ highx_float = convx_float;
+ }
+
for( j = 0; j < widthout; j++ ) {
-
+
// Ok, now apply box filter to box that goes from (lowx, lowy)
// to (highx, highy) on input data into this pixel on output
// data.
totals[0] = totals[1] = totals[2] = totals[3] = 0.0f;
-
+
// caulate the value for pixels in the 1st row
xindex = lowx_int * group_size;
if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) {
-
+
y_percent = 1 - lowy_float;
temp = xindex + lowy_int * ysize;
percent = y_percent * ( 1 - lowx_float );
@@ -232,7 +239,7 @@ public class ScaleInternal {
datain.position( temp_index );
totals[k] += ( 0x000000FF & datain.get() ) * percent;
}
-
+
// calculate the value for pixels in the last row
y_percent = highy_float;
percent = y_percent * ( 1 - lowx_float );
@@ -254,7 +261,7 @@ public class ScaleInternal {
datain.position( temp_index );
totals[k] += ( 0x000000FF & datain.get() ) * percent;
}
-
+
// calculate the value for the pixels in the 1st and last column
for( m = lowy_int + 1; m < highy_int; m++ ) {
left += ysize;
@@ -332,7 +339,7 @@ public class ScaleInternal {
}
temp0 += ysize;
}
-
+
outindex = ( j + ( i * widthout ) ) * components;
for( k = 0; k < components; k++ ) {
dataout.position( outindex + k );
@@ -364,9 +371,9 @@ public class ScaleInternal {
}
}
}
-
+
public static void scale_internal_byte( int components, int widthin, int heightin,
- ByteBuffer datain, int widthout, int heightout,
+ ByteBuffer datain, int widthout, int heightout,
ByteBuffer dataout, int element_size, int ysize,
int group_size ) {
float x, convx;
@@ -376,11 +383,11 @@ public class ScaleInternal {
float[] totals = new float[4];
float area;
int i, j, k, xindex;
-
+
int temp, temp0;
int temp_index;
int outindex;
-
+
int lowx_int, highx_int, lowy_int, highy_int;
float x_percent, y_percent;
float lowx_float, highx_float, lowy_float, highy_float;
@@ -388,9 +395,9 @@ public class ScaleInternal {
int convy_int, convx_int;
int l, m;
int left, right;
-
+
if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) {
- HalveImage.halveImage_byte( components, widthin, heightin, datain, dataout,
+ HalveImage.halveImage_byte( components, widthin, heightin, datain, dataout,
element_size, ysize, group_size );
return;
}
@@ -400,34 +407,41 @@ public class ScaleInternal {
convy_float = convy - convy_int;
convx_int = (int)Math.floor( convx );
convx_float = convx - convx_int;
-
+
area = convx * convy;
-
+
lowy_int = 0;
lowy_float = 0.0f;
highy_int = convy_int;
highy_float = convy_float;
-
+
for( i = 0; i < heightout; i++ ) {
// Clamp here to be sure we don't read beyond input buffer.
if (highy_int >= heightin)
highy_int = heightin - 1;
lowx_int = 0;
lowx_float = 0.0f;
- highx_int = convx_int;
- highx_float = convx_float;
-
+ // If we have a single column, fix the max width values
+ // to prevent buffer overflow
+ if (widthin == 1 && widthout == 1) {
+ highx_int = 0;
+ highx_float = 0.0f;
+ } else {
+ highx_int = convx_int;
+ highx_float = convx_float;
+ }
+
for( j = 0; j < widthout; j++ ) {
-
+
// Ok, now apply box filter to box that goes from (lowx, lowy)
// to (highx, highy) on input data into this pixel on output
// data.
totals[0] = totals[1] = totals[2] = totals[3] = 0.0f;
-
+
// caulate the value for pixels in the 1st row
xindex = lowx_int * group_size;
if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) {
-
+
y_percent = 1 - lowy_float;
temp = xindex + lowy_int * ysize;
percent = y_percent * ( 1 - lowx_float );
@@ -450,7 +464,7 @@ public class ScaleInternal {
datain.position( temp_index );
totals[k] += datain.get() * percent;
}
-
+
// calculate the value for pixels in the last row
y_percent = highy_float;
percent = y_percent * ( 1 - lowx_float );
@@ -472,7 +486,7 @@ public class ScaleInternal {
datain.position( temp_index );
totals[k] += datain.get() * percent;
}
-
+
// calculate the value for the pixels in the 1st and last column
for( m = lowy_int + 1; m < highy_int; m++ ) {
left += ysize;
@@ -536,7 +550,7 @@ public class ScaleInternal {
totals[k] += datain.get() * percent;
}
}
-
+
// this is for the pixels in the body
temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize;
for( m = lowy_int + 1; m < highy_int; m++ ) {
@@ -550,7 +564,7 @@ public class ScaleInternal {
}
temp0 += ysize;
}
-
+
outindex = ( j + ( i * widthout ) ) * components;
for( k = 0; k < components; k++ ) {
dataout.position( outindex + k );
@@ -582,10 +596,10 @@ public class ScaleInternal {
}
}
}
-
+
public static void scale_internal_ushort( int components, int widthin, int heightin,
- ByteBuffer datain, int widthout, int heightout,
- ShortBuffer dataout, int element_size, int ysize,
+ ByteBuffer datain, int widthout, int heightout,
+ ShortBuffer dataout, int element_size, int ysize,
int group_size, boolean myswap_bytes ) {
float x, convx;
float y, convy;
@@ -594,11 +608,11 @@ public class ScaleInternal {
float[] totals = new float[4];
float area;
int i, j, k, xindex;
-
+
int temp, temp0;
int temp_index;
int outindex;
-
+
int lowx_int, highx_int, lowy_int, highy_int;
float x_percent, y_percent;
float lowx_float, highx_float, lowy_float, highy_float;
@@ -606,9 +620,9 @@ public class ScaleInternal {
int convy_int, convx_int;
int l, m;
int left, right;
-
+
if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) {
- HalveImage.halveImage_ushort( components, widthin, heightin, datain, dataout,
+ HalveImage.halveImage_ushort( components, widthin, heightin, datain, dataout,
element_size, ysize, group_size, myswap_bytes );
return;
}
@@ -618,34 +632,41 @@ public class ScaleInternal {
convy_float = convy - convy_int;
convx_int = (int)Math.floor( convx );
convx_float = convx - convx_int;
-
+
area = convx * convy;
-
+
lowy_int = 0;
lowy_float = 0.0f;
highy_int = convy_int;
highy_float = convy_float;
-
+
for( i = 0; i < heightout; i++ ) {
// Clamp here to be sure we don't read beyond input buffer.
if (highy_int >= heightin)
highy_int = heightin - 1;
lowx_int = 0;
lowx_float = 0.0f;
- highx_int = convx_int;
- highx_float = convx_float;
-
+ // If we have a single column, fix the max width values
+ // to prevent buffer overflow
+ if (widthin == 1 && widthout == 1) {
+ highx_int = 0;
+ highx_float = 0.0f;
+ } else {
+ highx_int = convx_int;
+ highx_float = convx_float;
+ }
+
for( j = 0; j < widthout; j++ ) {
-
+
// Ok, now apply box filter to box that goes from (lowx, lowy)
// to (highx, highy) on input data into this pixel on output
// data.
totals[0] = totals[1] = totals[2] = totals[3] = 0.0f;
-
+
// caulate the value for pixels in the 1st row
xindex = lowx_int * group_size;
if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) {
-
+
y_percent = 1 - lowy_float;
temp = xindex + lowy_int * ysize;
percent = y_percent * ( 1 - lowx_float );
@@ -680,7 +701,7 @@ public class ScaleInternal {
totals[k] += ( 0x0000FFFF & datain.getShort()) * percent;
}
}
-
+
// calculate the value for pixels in the last row
y_percent = highy_float;
percent = y_percent * ( 1 - lowx_float );
@@ -714,7 +735,7 @@ public class ScaleInternal {
totals[k] += ( 0x0000FFFF & datain.getShort()) * percent;
}
}
-
+
// calculate the value for the pixels in the 1st and last column
for( m = lowy_int + 1; m < highy_int; m++ ) {
left += ysize;
@@ -813,7 +834,7 @@ public class ScaleInternal {
}
}
}
-
+
// this is for the pixels in the body
temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize;
for( m = lowy_int + 1; m < highy_int; m++ ) {
@@ -831,7 +852,7 @@ public class ScaleInternal {
}
temp0 += ysize;
}
-
+
outindex = ( j + ( i * widthout ) ) * components;
for( k = 0; k < components; k++ ) {
dataout.position( outindex + k );
@@ -863,10 +884,10 @@ public class ScaleInternal {
}
}
}
-
+
public static void scale_internal_short( int components, int widthin, int heightin,
ByteBuffer datain, int widthout, int heightout,
- ShortBuffer dataout, int element_size, int ysize,
+ ShortBuffer dataout, int element_size, int ysize,
int group_size, boolean myswap_bytes ) {
float x, convx;
float y, convy;
@@ -875,11 +896,11 @@ public class ScaleInternal {
float[] totals = new float[4];
float area;
int i, j, k, xindex;
-
+
int temp, temp0;
int temp_index;
int outindex;
-
+
int lowx_int, highx_int, lowy_int, highy_int;
float x_percent, y_percent;
float lowx_float, highx_float, lowy_float, highy_float;
@@ -887,11 +908,11 @@ public class ScaleInternal {
int convy_int, convx_int;
int l, m;
int left, right;
-
+
int swapbuf; // unsigned buffer
-
+
if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) {
- HalveImage.halveImage_short( components, widthin, heightin, datain, dataout,
+ HalveImage.halveImage_short( components, widthin, heightin, datain, dataout,
element_size, ysize, group_size, myswap_bytes );
return;
}
@@ -901,34 +922,41 @@ public class ScaleInternal {
convy_float = convy - convy_int;
convx_int = (int)Math.floor( convx );
convx_float = convx - convx_int;
-
+
area = convx * convy;
-
+
lowy_int = 0;
lowy_float = 0.0f;
highy_int = convy_int;
highy_float = convy_float;
-
+
for( i = 0; i < heightout; i++ ) {
// Clamp here to be sure we don't read beyond input buffer.
if (highy_int >= heightin)
highy_int = heightin - 1;
lowx_int = 0;
lowx_float = 0.0f;
- highx_int = convx_int;
- highx_float = convx_float;
-
+ // If we have a single column, fix the max width values
+ // to prevent buffer overflow
+ if (widthin == 1 && widthout == 1) {
+ highx_int = 0;
+ highx_float = 0.0f;
+ } else {
+ highx_int = convx_int;
+ highx_float = convx_float;
+ }
+
for( j = 0; j < widthout; j++ ) {
-
+
// Ok, now apply box filter to box that goes from (lowx, lowy)
// to (highx, highy) on input data into this pixel on output
// data.
totals[0] = totals[1] = totals[2] = totals[3] = 0.0f;
-
+
// caulate the value for pixels in the 1st row
xindex = lowx_int * group_size;
if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) {
-
+
y_percent = 1 - lowy_float;
temp = xindex + lowy_int * ysize;
percent = y_percent * ( 1 - lowx_float );
@@ -966,7 +994,7 @@ public class ScaleInternal {
totals[k] += datain.getShort() * percent;
}
}
-
+
// calculate the value for pixels in the last row
y_percent = highy_float;
percent = y_percent * ( 1 - lowx_float );
@@ -1003,7 +1031,7 @@ public class ScaleInternal {
totals[k] += datain.getShort() * percent;
}
}
-
+
// calculate the value for the pixels in the 1st and last column
for( m = lowy_int + 1; m < highy_int; m++ ) {
left += ysize;
@@ -1109,7 +1137,7 @@ public class ScaleInternal {
}
}
}
-
+
// this is for the pixels in the body
temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize;
for( m = lowy_int + 1; m < highy_int; m++ ) {
@@ -1128,7 +1156,7 @@ public class ScaleInternal {
}
temp0 += ysize;
}
-
+
outindex = ( j + ( i * widthout ) ) * components;
for( k = 0; k < components; k++ ) {
dataout.position( outindex + k );
@@ -1160,10 +1188,10 @@ public class ScaleInternal {
}
}
}
-
+
public static void scale_internal_uint( int components, int widthin, int heightin,
- ByteBuffer datain, int widthout, int heightout,
- IntBuffer dataout, int element_size, int ysize,
+ ByteBuffer datain, int widthout, int heightout,
+ IntBuffer dataout, int element_size, int ysize,
int group_size, boolean myswap_bytes ) {
float x, convx;
float y, convy;
@@ -1172,11 +1200,11 @@ public class ScaleInternal {
float[] totals = new float[4];
float area;
int i, j, k, xindex;
-
+
int temp, temp0;
int temp_index;
int outindex;
-
+
int lowx_int, highx_int, lowy_int, highy_int;
float x_percent, y_percent;
float lowx_float, highx_float, lowy_float, highy_float;
@@ -1184,9 +1212,9 @@ public class ScaleInternal {
int convy_int, convx_int;
int l, m;
int left, right;
-
+
if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) {
- HalveImage.halveImage_uint( components, widthin, heightin, datain, dataout,
+ HalveImage.halveImage_uint( components, widthin, heightin, datain, dataout,
element_size, ysize, group_size, myswap_bytes );
return;
}
@@ -1196,34 +1224,41 @@ public class ScaleInternal {
convy_float = convy - convy_int;
convx_int = (int)Math.floor( convx );
convx_float = convx - convx_int;
-
+
area = convx * convy;
-
+
lowy_int = 0;
lowy_float = 0.0f;
highy_int = convy_int;
highy_float = convy_float;
-
+
for( i = 0; i < heightout; i++ ) {
// Clamp here to be sure we don't read beyond input buffer.
if (highy_int >= heightin)
highy_int = heightin - 1;
lowx_int = 0;
lowx_float = 0.0f;
- highx_int = convx_int;
- highx_float = convx_float;
-
+ // If we have a single column, fix the max width values
+ // to prevent buffer overflow
+ if (widthin == 1 && widthout == 1) {
+ highx_int = 0;
+ highx_float = 0.0f;
+ } else {
+ highx_int = convx_int;
+ highx_float = convx_float;
+ }
+
for( j = 0; j < widthout; j++ ) {
-
+
// Ok, now apply box filter to box that goes from (lowx, lowy)
// to (highx, highy) on input data into this pixel on output
// data.
totals[0] = totals[1] = totals[2] = totals[3] = 0.0f;
-
+
// caulate the value for pixels in the 1st row
xindex = lowx_int * group_size;
if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) {
-
+
y_percent = 1 - lowy_float;
temp = xindex + lowy_int * ysize;
percent = y_percent * ( 1 - lowx_float );
@@ -1258,7 +1293,7 @@ public class ScaleInternal {
totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent;
}
}
-
+
// calculate the value for pixels in the last row
y_percent = highy_float;
percent = y_percent * ( 1 - lowx_float );
@@ -1292,7 +1327,7 @@ public class ScaleInternal {
totals[k] += (0x00000000FFFFFFFF & datain.getInt()) * percent;
}
}
-
+
// calculate the value for the pixels in the 1st and last column
for( m = lowy_int + 1; m < highy_int; m++ ) {
left += ysize;
@@ -1392,7 +1427,7 @@ public class ScaleInternal {
}
}
}
-
+
// this is for the pixels in the body
temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize;
for( m = lowy_int + 1; m < highy_int; m++ ) {
@@ -1410,7 +1445,7 @@ public class ScaleInternal {
}
temp0 += ysize;
}
-
+
outindex = ( j + ( i * widthout ) ) * components;
float value = 0.0f;
for( k = 0; k < components; k++ ) {
@@ -1448,10 +1483,10 @@ public class ScaleInternal {
}
}
}
-
+
public static void scale_internal_int( int components, int widthin, int heightin,
- ByteBuffer datain, int widthout, int heightout,
- IntBuffer dataout, int element_size, int ysize,
+ ByteBuffer datain, int widthout, int heightout,
+ IntBuffer dataout, int element_size, int ysize,
int group_size, boolean myswap_bytes ) {
float x, convx;
float y, convy;
@@ -1460,11 +1495,11 @@ public class ScaleInternal {
float[] totals = new float[4];
float area;
int i, j, k, xindex;
-
+
int temp, temp0;
int temp_index;
int outindex;
-
+
int lowx_int, highx_int, lowy_int, highy_int;
float x_percent, y_percent;
float lowx_float, highx_float, lowy_float, highy_float;
@@ -1472,11 +1507,11 @@ public class ScaleInternal {
int convy_int, convx_int;
int l, m;
int left, right;
-
+
long swapbuf; // unsigned buffer
-
+
if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) {
- HalveImage.halveImage_int( components, widthin, heightin, datain, dataout,
+ HalveImage.halveImage_int( components, widthin, heightin, datain, dataout,
element_size, ysize, group_size, myswap_bytes );
return;
}
@@ -1486,34 +1521,41 @@ public class ScaleInternal {
convy_float = convy - convy_int;
convx_int = (int)Math.floor( convx );
convx_float = convx - convx_int;
-
+
area = convx * convy;
-
+
lowy_int = 0;
lowy_float = 0.0f;
highy_int = convy_int;
highy_float = convy_float;
-
+
for( i = 0; i < heightout; i++ ) {
// Clamp here to be sure we don't read beyond input buffer.
if (highy_int >= heightin)
highy_int = heightin - 1;
lowx_int = 0;
lowx_float = 0.0f;
- highx_int = convx_int;
- highx_float = convx_float;
-
+ // If we have a single column, fix the max width values
+ // to prevent buffer overflow
+ if (widthin == 1 && widthout == 1) {
+ highx_int = 0;
+ highx_float = 0.0f;
+ } else {
+ highx_int = convx_int;
+ highx_float = convx_float;
+ }
+
for( j = 0; j < widthout; j++ ) {
-
+
// Ok, now apply box filter to box that goes from (lowx, lowy)
// to (highx, highy) on input data into this pixel on output
// data.
totals[0] = totals[1] = totals[2] = totals[3] = 0.0f;
-
+
// caulate the value for pixels in the 1st row
xindex = lowx_int * group_size;
if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) {
-
+
y_percent = 1 - lowy_float;
temp = xindex + lowy_int * ysize;
percent = y_percent * ( 1 - lowx_float );
@@ -1551,7 +1593,7 @@ public class ScaleInternal {
totals[k] += datain.getInt() * percent;
}
}
-
+
// calculate the value for pixels in the last row
y_percent = highy_float;
percent = y_percent * ( 1 - lowx_float );
@@ -1588,7 +1630,7 @@ public class ScaleInternal {
totals[k] += datain.getInt() * percent;
}
}
-
+
// calculate the value for the pixels in the 1st and last column
for( m = lowy_int + 1; m < highy_int; m++ ) {
left += ysize;
@@ -1694,7 +1736,7 @@ public class ScaleInternal {
}
}
}
-
+
// this is for the pixels in the body
temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize;
for( m = lowy_int + 1; m < highy_int; m++ ) {
@@ -1713,7 +1755,7 @@ public class ScaleInternal {
}
temp0 += ysize;
}
-
+
outindex = ( j + ( i * widthout ) ) * components;
for( k = 0; k < components; k++ ) {
dataout.position( outindex + k );
@@ -1745,10 +1787,10 @@ public class ScaleInternal {
}
}
}
-
+
public static void scale_internal_float( int components, int widthin, int heightin,
- ByteBuffer datain, int widthout, int heightout,
- FloatBuffer dataout, int element_size, int ysize,
+ ByteBuffer datain, int widthout, int heightout,
+ FloatBuffer dataout, int element_size, int ysize,
int group_size, boolean myswap_bytes ) {
float x, convx;
float y, convy;
@@ -1757,11 +1799,11 @@ public class ScaleInternal {
float[] totals = new float[4];
float area;
int i, j, k, xindex;
-
+
int temp, temp0;
int temp_index;
int outindex;
-
+
int lowx_int, highx_int, lowy_int, highy_int;
float x_percent, y_percent;
float lowx_float, highx_float, lowy_float, highy_float;
@@ -1769,11 +1811,11 @@ public class ScaleInternal {
int convy_int, convx_int;
int l, m;
int left, right;
-
+
float swapbuf; // unsigned buffer
-
+
if( (widthin == (widthout * 2)) && (heightin == (heightout * 2)) ) {
- HalveImage.halveImage_float( components, widthin, heightin, datain, dataout,
+ HalveImage.halveImage_float( components, widthin, heightin, datain, dataout,
element_size, ysize, group_size, myswap_bytes );
return;
}
@@ -1783,34 +1825,41 @@ public class ScaleInternal {
convy_float = convy - convy_int;
convx_int = (int)Math.floor( convx );
convx_float = convx - convx_int;
-
+
area = convx * convy;
-
+
lowy_int = 0;
lowy_float = 0.0f;
highy_int = convy_int;
highy_float = convy_float;
-
+
for( i = 0; i < heightout; i++ ) {
// Clamp here to be sure we don't read beyond input buffer.
if (highy_int >= heightin)
highy_int = heightin - 1;
lowx_int = 0;
lowx_float = 0.0f;
- highx_int = convx_int;
- highx_float = convx_float;
-
+ // If we have a single column, fix the max width values
+ // to prevent buffer overflow
+ if (widthin == 1 && widthout == 1) {
+ highx_int = 0;
+ highx_float = 0.0f;
+ } else {
+ highx_int = convx_int;
+ highx_float = convx_float;
+ }
+
for( j = 0; j < widthout; j++ ) {
-
+
// Ok, now apply box filter to box that goes from (lowx, lowy)
// to (highx, highy) on input data into this pixel on output
// data.
totals[0] = totals[1] = totals[2] = totals[3] = 0.0f;
-
+
// caulate the value for pixels in the 1st row
xindex = lowx_int * group_size;
if( ( highy_int > lowy_int ) && ( highx_int > lowx_int ) ) {
-
+
y_percent = 1 - lowy_float;
temp = xindex + lowy_int * ysize;
percent = y_percent * ( 1 - lowx_float );
@@ -1848,7 +1897,7 @@ public class ScaleInternal {
totals[k] += datain.getFloat() * percent;
}
}
-
+
// calculate the value for pixels in the last row
y_percent = highy_float;
percent = y_percent * ( 1 - lowx_float );
@@ -1885,7 +1934,7 @@ public class ScaleInternal {
totals[k] += datain.getFloat() * percent;
}
}
-
+
// calculate the value for the pixels in the 1st and last column
for( m = lowy_int + 1; m < highy_int; m++ ) {
left += ysize;
@@ -1991,7 +2040,7 @@ public class ScaleInternal {
}
}
}
-
+
// this is for the pixels in the body
temp0 = xindex + group_size + ( lowy_int + 1 ) * ysize;
for( m = lowy_int + 1; m < highy_int; m++ ) {
@@ -2010,7 +2059,7 @@ public class ScaleInternal {
}
temp0 += ysize;
}
-
+
outindex = ( j + ( i * widthout ) ) * components;
for( k = 0; k < components; k++ ) {
dataout.position( outindex + k );
@@ -2042,28 +2091,28 @@ public class ScaleInternal {
}
}
}
-
- public static void scaleInternalPackedPixel( int components, Extract extract,
+
+ public static void scaleInternalPackedPixel( int components, Extract extract,
int widthIn, int heightIn, ByteBuffer dataIn, int widthOut,
int heightOut, ByteBuffer dataOut, int pixelSizeInBytes,
int rowSizeInBytes, boolean isSwap ) {
float x, convx;
float y, convy;
float percent;
-
+
// max components in a format is 4, so
float[] totals = new float[4];
float[] extractTotals = new float[4];
float[] extractMoreTotals = new float[4];
float[] shoveTotals = new float[4];
-
+
float area;
int i, j, k, xindex;
-
+
int temp, temp0;
int temp_index;
int outIndex = 0;
-
+
int lowx_int, highx_int, lowy_int, highy_int;
float x_percent, y_percent;
float lowx_float, highx_float, lowy_float, highy_float;
@@ -2071,7 +2120,7 @@ public class ScaleInternal {
int convy_int, convx_int;
int l, m;
int left, right;
-
+
if( widthIn == widthOut * 2 && heightIn == heightOut * 2 ) {
HalveImage.halveImagePackedPixel( components, extract, widthIn, heightIn, dataIn, dataOut,
pixelSizeInBytes, rowSizeInBytes, isSwap );
@@ -2083,14 +2132,14 @@ public class ScaleInternal {
convy_float = convy - convy_int;
convx_int = (int)Math.floor( convx );
convx_float = convx - convx_int;
-
+
area = convx * convy;
-
+
lowy_int = 0;
lowy_float = 0.0f;
highy_int = convy_int;
highy_float = convx_float;
-
+
for( i = 0; i < heightOut; i++ ) {
// Clamp here to be sure we don't read beyond input buffer.
if (highy_int >= heightIn)
@@ -2099,16 +2148,16 @@ public class ScaleInternal {
lowx_float = 0.0f;
highx_int = convx_int;
highx_float = convx_float;
-
+
for( j = 0; j < widthOut; j++ ) {
// ok now apply box filter to box that goes from( lowx, lowy )
// to ( highx, highy ) on input data into this pixel on output data
totals[0] = totals[1] = totals[2] = totals[3] = 0.0f;
-
+
// calculate that value for pixels in the 1st row
xindex = lowx_int * pixelSizeInBytes;
if( (highy_int > lowy_int) && (highx_int > lowx_int) ) {
-
+
y_percent = 1 - lowy_float;
temp = xindex + lowy_int * rowSizeInBytes;
percent = y_percent * ( 1 - lowx_float );
@@ -2135,7 +2184,7 @@ public class ScaleInternal {
totals[k] += extractTotals[k] * percent;
}
// calculate the value for pixels in the last row
-
+
y_percent = highy_float;
percent = y_percent * ( 1 - lowx_float );
temp = xindex + highy_int * rowSizeInBytes;
@@ -2158,7 +2207,7 @@ public class ScaleInternal {
for( k = 0; k < components; k++ ) {
totals[k] += extractTotals[k] * percent;
}
-
+
// calculate the value for pixels in the 1st and last column
for( m = lowy_int + 1; m < highy_int; m++ ) {
left += rowSizeInBytes;
@@ -2228,7 +2277,7 @@ public class ScaleInternal {
totals[k] += extractTotals[k] * percent;
}
}
-
+
// this is for the pixels in the body
temp0 = xindex + pixelSizeInBytes + ( lowy_int + 1 ) * rowSizeInBytes;
for( m = lowy_int + 1; m < highy_int; m++ ) {
@@ -2243,7 +2292,7 @@ public class ScaleInternal {
}
temp0 += rowSizeInBytes;
}
-
+
outIndex = ( j + ( i * widthOut ) );
for( k = 0; k < components; k++ ) {
shoveTotals[k] = totals[k] / area;
@@ -2276,7 +2325,7 @@ public class ScaleInternal {
}
assert( outIndex == ( widthOut * heightOut - 1) );
}
-
+
public static void scaleInternal3D( int components, int widthIn, int heightIn,
int depthIn, ShortBuffer dataIn, int widthOut, int heightOut,
int depthOut, ShortBuffer dataOut ) {
@@ -2290,9 +2339,9 @@ public class ScaleInternal {
float volume;
int i, j, d, k, zint, yint, xint, xindex, yindex, zindex;
int temp;
-
+
lowy = highy = lowx = highx = 0.0f;
-
+
convz = (float)depthIn / depthOut;
convy = (float)heightIn / heightOut;
convx = (float)widthIn / widthOut;
@@ -2326,13 +2375,13 @@ public class ScaleInternal {
highz = x + 0.5f;
lowz = x - 0.5f;
}
-
+
// Ok, now apply box filter to box that goes from ( lowx, lowy, lowz )
// to ( highx, highy, highz ) on input data into this pixel on output data
-
+
totals[0] = totals[1] = totals[2] = totals[3] = 0.0f;
volume = 0.0f;
-
+
z = lowz;
zint = (int)(Math.floor( z ) );
while( z < highz ) {
@@ -2342,7 +2391,7 @@ public class ScaleInternal {
} else {
zpercent = zint + 1 - z;
}
-
+
y = lowy;
yint = (int)(Math.floor( y ) );
while( y < highy ) {
@@ -2352,10 +2401,10 @@ public class ScaleInternal {
} else {
ypercent = yint + 1 - y;
}
-
+
x = lowx;
xint = (int)(Math.floor( x ) );
-
+
while( x < highx ) {
xindex = (xint + widthIn ) % widthIn;
if( highx < xint + 1 ) {
@@ -2363,10 +2412,10 @@ public class ScaleInternal {
} else {
xpercent = xint + 1 - x;
}
-
+
percent = xpercent * ypercent * zpercent;
volume += percent;
-
+
temp = (xindex + ( yindex *widthIn) + (zindex * widthIn *heightIn)) * components;
for( k = 0; k < components; k++ ) {
assert( 0 <= (temp+k) && (temp+k) < (widthIn * heightIn * depthIn * components) );
@@ -2381,7 +2430,7 @@ public class ScaleInternal {
zint++;
z = zint;
} // while z
-
+
temp = ( j + ( i * widthOut ) + (d * widthOut * heightOut ) ) * components;
for( k = 0; k < components; k++ ) {
// totals should be rounded in the case of enlarging an rgb ramp when the type is 332 or 4444
@@ -2392,48 +2441,48 @@ public class ScaleInternal {
}
}
}
-
- public static int gluScaleImage3D( GL gl, int format, int widthIn, int heightIn,
- int depthIn, int typeIn, ByteBuffer dataIn, int widthOut, int heightOut,
+
+ public static int gluScaleImage3D( GL gl, int format, int widthIn, int heightIn,
+ int depthIn, int typeIn, ByteBuffer dataIn, int widthOut, int heightOut,
int depthOut, int typeOut, ByteBuffer dataOut ) {
int components;
ShortBuffer beforeImage, afterImage;
PixelStorageModes psm = new PixelStorageModes();
-
+
if( widthIn == 0 || heightIn == 0 || depthIn == 0 ||
widthOut == 0 || heightOut == 0 || depthOut == 0 ) {
return( 0 );
}
-
+
if( widthIn < 0 || heightIn < 0 || depthIn < 0 ||
widthOut < 0 || heightOut < 0 || depthOut < 0 ) {
return( GLU.GLU_INVALID_VALUE );
}
-
- if( !Mipmap.legalFormat(format) || !Mipmap.legalType(typeIn) ||
+
+ if( !Mipmap.legalFormat(format) || !Mipmap.legalType(typeIn) ||
!Mipmap.legalType(typeOut) || typeIn == GL2.GL_BITMAP ||
typeOut == GL2.GL_BITMAP ) {
return( GLU.GLU_INVALID_ENUM );
}
-
+
if( !Mipmap.isLegalFormatForPackedPixelType( format, typeIn ) ) {
return( GLU.GLU_INVALID_OPERATION );
}
-
+
if( !Mipmap.isLegalFormatForPackedPixelType( format, typeOut ) ) {
return( GLU.GLU_INVALID_OPERATION );
}
-
+
try {
- beforeImage = Buffers.newDirectByteBuffer( Mipmap.imageSize3D( widthIn,
+ beforeImage = Buffers.newDirectByteBuffer( Mipmap.imageSize3D( widthIn,
heightIn, depthIn, format, GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer();
- afterImage = Buffers.newDirectByteBuffer( Mipmap.imageSize3D( widthIn,
+ afterImage = Buffers.newDirectByteBuffer( Mipmap.imageSize3D( widthIn,
heightIn, depthIn, format, GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer();
} catch( OutOfMemoryError err ) {
return( GLU.GLU_OUT_OF_MEMORY );
}
Mipmap.retrieveStoreModes3D( gl, psm );
-
+
Image.fillImage3D( psm, widthIn, heightIn, depthIn, format, typeIn,
Mipmap.is_index( format ), dataIn, beforeImage );
components = Mipmap.elements_per_group( format, 0 );
@@ -2441,7 +2490,7 @@ public class ScaleInternal {
beforeImage, widthOut, heightOut, depthOut, afterImage );
Image.emptyImage3D( psm, widthOut, heightOut, depthOut, format, typeOut,
Mipmap.is_index( format ), afterImage, dataOut );
-
+
return( 0 );
}
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java
index 38113f6..dc40188 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -51,176 +51,176 @@ import java.nio.*;
* @author Administrator
*/
public class Type_Widget {
-
+
ByteBuffer buffer;
-
+
/** Creates a new instance of Type_Widget */
public Type_Widget() {
// can't make this direct, because JVM doesn't allocate small direct buffers efficiently
// see https://jogamp.org/bugzilla/show_bug.cgi?id=463 for details
buffer = ByteBuffer.allocate( 4 );
}
-
+
public void setUB0( byte b ) {
buffer.position( 0 );
buffer.put( b );
}
-
+
public byte getUB0() {
buffer.position( 0 );
return( buffer.get() );
}
-
+
public void setUB1( byte b ) {
buffer.position( 1 );
buffer.put( b );
}
-
+
public byte getUB1() {
buffer.position( 1 );
return( buffer.get() );
}
-
+
public void setUB2( byte b ) {
buffer.position( 2 );
buffer.put( b );
}
-
+
public byte getUB2() {
buffer.position( 2 );
return( buffer.get() );
}
-
+
public void setUB3( byte b ) {
buffer.position( 3 );
buffer.put( b );
}
-
+
public byte getUB3() {
buffer.position( 3 );
return( buffer.get() );
}
-
+
public void setUS0( short s ) {
buffer.position( 0 );
buffer.putShort( s );
}
-
+
public short getUS0() {
buffer.position( 0 );
return( buffer.getShort() );
}
-
+
public void setUS1( short s ) {
buffer.position( 2 );
buffer.putShort( s );
}
-
+
public short getUS1() {
buffer.position( 2 );
return( buffer.getShort() );
}
-
+
public void setUI( int i ) {
buffer.position( 0 );
buffer.putInt( i );
}
-
+
public int getUI() {
buffer.position( 0 );
return( buffer.getInt() );
}
-
+
public void setB0( byte b ) {
buffer.position( 0 );
buffer.put( b );
}
-
+
public byte getB0() {
buffer.position( 0 );
return( buffer.get() );
}
-
+
public void setB1( byte b ) {
buffer.position( 1 );
buffer.put( b );
}
-
+
public byte getB1() {
buffer.position( 1 );
return( buffer.get() );
}
-
+
public void setB2( byte b ) {
buffer.position( 2 );
buffer.put( b );
}
-
+
public byte getB2() {
buffer.position( 2 );
return( buffer.get() );
}
-
+
public void setB3( byte b ) {
buffer.position( 3 );
buffer.put( b );
}
-
+
public byte getB3() {
buffer.position( 3 );
return( buffer.get() );
}
-
+
public void setS0( short s ) {
buffer.position( 0 );
buffer.putShort( s );
}
-
+
public short getS0() {
buffer.position( 0 );
return( buffer.getShort() );
}
-
+
public void setS1( short s ) {
buffer.position( 2 );
buffer.putShort( s );
}
-
+
public short getS1() {
buffer.position( 2 );
return( buffer.getShort() );
}
-
+
public void setI( int i ) {
buffer.position( 0 );
buffer.putInt( i );
}
-
+
public int getI() {
buffer.position( 0 );
return( buffer.getInt() );
}
-
+
public void setF( float f ) {
buffer.position( 0 );
buffer.putFloat( f );
}
-
+
public float getF() {
buffer.position( 0 );
return( buffer.getFloat() );
}
-
+
public ByteBuffer getBuffer() {
buffer.rewind();
return( buffer );
}
-
+
public static void main( String args[] ) {
Type_Widget t = new Type_Widget();
t.setI( 1000000 );
-
+
System.out.println("int: " + Integer.toHexString( t.getI() ) );
-
+
}
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java
index 422f8d4..df2b9a1 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java
@@ -72,7 +72,7 @@ public class Arc {
/**
* Makes new arc at specified side
- *
+ *
* @param side
* which side doeas this arc form
*/
@@ -86,7 +86,7 @@ public class Arc {
/**
* Sets side the arc is at
- *
+ *
* @param side
* arc side
*/
@@ -104,7 +104,7 @@ public class Arc {
type &= ~(0x7 << 8);
}
- // this one replaces enum arc_side
+ // this one replaces enum arc_side
/**
* Side not specified
*/
@@ -147,7 +147,7 @@ public class Arc {
/**
* Appends arc to the list
- *
+ *
* @param jarc
* arc to be append
* @return this
@@ -169,7 +169,7 @@ public class Arc {
/**
* Unused
- *
+ *
* @return true
*/
public boolean check() {
@@ -187,7 +187,7 @@ public class Arc {
/**
* Returns tail of linked list coords
- *
+ *
* @return tail coords
*/
public float[] tail() {
@@ -197,7 +197,7 @@ public class Arc {
/**
* Returns head of linked list coords
- *
+ *
* @return head coords
*/
public float[] head() {
@@ -207,7 +207,7 @@ public class Arc {
/**
* Returns whether arc is marked with arc_tag
- *
+ *
* @return is arc marked with arc_tag
*/
public boolean ismarked() {
@@ -241,7 +241,7 @@ public class Arc {
/**
* Returns whether arc is marked tail
- *
+ *
* @return is tail
*/
public boolean getitail() {
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java
index f4ad701..c299b10 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java
@@ -44,7 +44,7 @@ public class ArcSdirSorter {
/**
* Makes new ArcSdirSorter with Subdivider
* @param subdivider subdivider
- */
+ */
public ArcSdirSorter(Subdivider subdivider) {
//TODO
// System.out.println("TODO arcsdirsorter.constructor");
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java
index be72c53..1a584c3 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java
@@ -43,7 +43,7 @@ public class ArcTdirSorter {
/**
* Makes new ArcSdirSorter with Subdivider
* @param subdivider subdivider
- */
+ */
public ArcTdirSorter(Subdivider subdivider) {
// TODO Auto-generated constructor stub
// System.out.println("TODO arcTsorter.konstruktor");
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java
index 610a195..3e97424 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java
@@ -67,7 +67,7 @@ public abstract class Backend {
protected SurfaceEvaluator surfaceEvaluator;
/**
- * Makes new backend
+ * Makes new backend
*/
public Backend() {
// curveEvaluator = new OpenGLCurveEvaluator();
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java
index df8b16a..17437ef 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java
@@ -143,7 +143,7 @@ public class Bin {
/**
* Returns next arc in linked list
* @return next arc
- *
+ *
*/
private Arc nextarc() {
// DONE
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Breakpt.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Breakpt.java
index f45571d..f84640d 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Breakpt.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Breakpt.java
@@ -36,9 +36,9 @@ package jogamp.opengl.glu.nurbs;
/**
* Class holding break point parameters
- *
+ *
* @author Tomas Hrasky
- *
+ *
*/
public class Breakpt {
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfArcs.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfArcs.java
index aaa8cb5..b67764c 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfArcs.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfArcs.java
@@ -2,9 +2,9 @@ package jogamp.opengl.glu.nurbs;
/**
* Class replacing C language pointer
- *
+ *
* @author Tomas Hrasky
- *
+ *
*/
public class CArrayOfArcs {
/**
@@ -24,7 +24,7 @@ public class CArrayOfArcs {
/**
* Makes new CArray
- *
+ *
* @param array
* underlaying array
* @param pointer
@@ -38,7 +38,7 @@ public class CArrayOfArcs {
/**
* Makes new CArray from other CArray
- *
+ *
* @param carray
* reference array
*/
@@ -50,7 +50,7 @@ public class CArrayOfArcs {
/**
* Makes new CArray with pointer set to 0
- *
+ *
* @param ctlarray
* underlaying array
*/
@@ -61,7 +61,7 @@ public class CArrayOfArcs {
/**
* Returns element at pointer
- *
+ *
* @return element at pointer
*/
public Arc get() {
@@ -78,7 +78,7 @@ public class CArrayOfArcs {
/**
* Sets element at pointer
- *
+ *
* @param f
* desired value
*/
@@ -89,7 +89,7 @@ public class CArrayOfArcs {
/**
* Returns array element at specified index
- *
+ *
* @param i
* array index
* @return element at index
@@ -100,7 +100,7 @@ public class CArrayOfArcs {
/**
* Returns array element at specified index relatively to pointer
- *
+ *
* @param i
* relative index
* @return element at relative index
@@ -111,7 +111,7 @@ public class CArrayOfArcs {
/**
* Sets value of element at specified index relatively to pointer
- *
+ *
* @param i
* relative index
* @param value
@@ -123,7 +123,7 @@ public class CArrayOfArcs {
/**
* Lessens pointer by value
- *
+ *
* @param i
* lessen by
*/
@@ -134,7 +134,7 @@ public class CArrayOfArcs {
/**
* Returns pointer value
- *
+ *
* @return pointer value
*/
public int getPointer() {
@@ -143,7 +143,7 @@ public class CArrayOfArcs {
/**
* Sets ponter value
- *
+ *
* @param pointer
* pointer value to be set
*/
@@ -156,7 +156,7 @@ public class CArrayOfArcs {
/**
* Raises pointer by value
- *
+ *
* @param i
* raise by
*/
@@ -175,7 +175,7 @@ public class CArrayOfArcs {
/**
* Returns underlaying array
- *
+ *
* @return underlaying array
*/
public Arc[] getArray() {
@@ -184,7 +184,7 @@ public class CArrayOfArcs {
/**
* Sets underlaying array
- *
+ *
* @param array
* underlaying array
*/
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java
index 5112b07..b5f5889 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java
@@ -2,9 +2,9 @@ package jogamp.opengl.glu.nurbs;
/**
* Class replacing C language pointer
- *
+ *
* @author Tomas Hrasky
- *
+ *
*/
public class CArrayOfBreakpts {
/**
@@ -19,7 +19,7 @@ public class CArrayOfBreakpts {
/**
* Makes new CArray
- *
+ *
* @param array
* underlaying array
* @param pointer
@@ -32,7 +32,7 @@ public class CArrayOfBreakpts {
/**
* Makes new CArray from other CArray
- *
+ *
* @param carray
* reference array
*/
@@ -43,7 +43,7 @@ public class CArrayOfBreakpts {
/**
* Returns element at pointer
- *
+ *
* @return element at pointer
*/
public Breakpt get() {
@@ -59,7 +59,7 @@ public class CArrayOfBreakpts {
/**
* Sets element at pointer
- *
+ *
* @param f
* desired value
*/
@@ -70,7 +70,7 @@ public class CArrayOfBreakpts {
/**
* Returns array element at specified index
- *
+ *
* @param i
* array index
* @return element at index
@@ -81,7 +81,7 @@ public class CArrayOfBreakpts {
/**
* Lessens pointer by value
- *
+ *
* @param i
* lessen by
*/
@@ -92,7 +92,7 @@ public class CArrayOfBreakpts {
/**
* Returns pointer value
- *
+ *
* @return pointer value
*/
public int getPointer() {
@@ -101,7 +101,7 @@ public class CArrayOfBreakpts {
/**
* Sets ponter value
- *
+ *
* @param pointer
* pointer value to be set
*/
@@ -111,7 +111,7 @@ public class CArrayOfBreakpts {
/**
* Raises pointer by value
- *
+ *
* @param i
* raise by
*/
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java
index 39ef841..d9e4d0f 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java
@@ -2,9 +2,9 @@ package jogamp.opengl.glu.nurbs;
/**
* Class replacing C language pointer
- *
+ *
* @author Tomas Hrasky
- *
+ *
*/
public class CArrayOfFloats {
@@ -25,7 +25,7 @@ public class CArrayOfFloats {
/**
* Makes new CArray
- *
+ *
* @param array
* underlaying array
* @param pointer
@@ -39,7 +39,7 @@ public class CArrayOfFloats {
/**
* Makes new CArray from other CArray
- *
+ *
* @param carray
* reference array
*/
@@ -51,7 +51,7 @@ public class CArrayOfFloats {
/**
* Makes new CArray with pointer set to 0
- *
+ *
* @param ctlarray
* underlaying array
*/
@@ -62,7 +62,7 @@ public class CArrayOfFloats {
/**
* Returns element at pointer
- *
+ *
* @return element at pointer
*/
public float get() {
@@ -79,7 +79,7 @@ public class CArrayOfFloats {
/**
* Sets element at pointer
- *
+ *
* @param f
* desired value
*/
@@ -90,7 +90,7 @@ public class CArrayOfFloats {
/**
* Returns array element at specified index
- *
+ *
* @param i
* array index
* @return element at index
@@ -101,7 +101,7 @@ public class CArrayOfFloats {
/**
* Returns array element at specified index relatively to pointer
- *
+ *
* @param i
* relative index
* @return element at relative index
@@ -112,7 +112,7 @@ public class CArrayOfFloats {
/**
* Sets value of element at specified index relatively to pointer
- *
+ *
* @param i
* relative index
* @param value
@@ -124,7 +124,7 @@ public class CArrayOfFloats {
/**
* Lessens pointer by value
- *
+ *
* @param i
* lessen by
*/
@@ -135,7 +135,7 @@ public class CArrayOfFloats {
/**
* Returns pointer value
- *
+ *
* @return pointer value
*/
public int getPointer() {
@@ -144,7 +144,7 @@ public class CArrayOfFloats {
/**
* Sets ponter value
- *
+ *
* @param pointer
* pointer value to be set
*/
@@ -157,7 +157,7 @@ public class CArrayOfFloats {
/**
* Raises pointer by value
- *
+ *
* @param i
* raise by
*/
@@ -176,7 +176,7 @@ public class CArrayOfFloats {
/**
* Returns underlaying array
- *
+ *
* @return underlaying array
*/
public float[] getArray() {
@@ -185,7 +185,7 @@ public class CArrayOfFloats {
/**
* Sets underlaying array
- *
+ *
* @param array
* underlaying array
*/
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfQuiltspecs.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfQuiltspecs.java
index 4b21f2d..e7bbac1 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfQuiltspecs.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfQuiltspecs.java
@@ -2,9 +2,9 @@ package jogamp.opengl.glu.nurbs;
/**
* Class replacing C language pointer
- *
+ *
* @author Tomas Hrasky
- *
+ *
*/
public class CArrayOfQuiltspecs {
/**
@@ -19,7 +19,7 @@ public class CArrayOfQuiltspecs {
/**
* Makes new CArray
- *
+ *
* @param array
* underlaying array
* @param pointer
@@ -32,7 +32,7 @@ public class CArrayOfQuiltspecs {
/**
* Makes new CArray from other CArray
- *
+ *
* @param carray
* reference array
*/
@@ -43,7 +43,7 @@ public class CArrayOfQuiltspecs {
/**
* Makes new CArray with pointer set to 0
- *
+ *
* @param array
* underlaying array
*/
@@ -54,7 +54,7 @@ public class CArrayOfQuiltspecs {
/**
* Returns element at pointer
- *
+ *
* @return element at pointer
*/
public Quiltspec get() {
@@ -70,7 +70,7 @@ public class CArrayOfQuiltspecs {
/**
* Sets element at pointer
- *
+ *
* @param f
* desired value
*/
@@ -81,7 +81,7 @@ public class CArrayOfQuiltspecs {
/**
* Returns array element at specified index
- *
+ *
* @param i
* array index
* @return element at index
@@ -92,7 +92,7 @@ public class CArrayOfQuiltspecs {
/**
* Lessens pointer by value
- *
+ *
* @param i
* lessen by
*/
@@ -103,7 +103,7 @@ public class CArrayOfQuiltspecs {
/**
* Returns pointer value
- *
+ *
* @return pointer value
*/
public int getPointer() {
@@ -112,7 +112,7 @@ public class CArrayOfQuiltspecs {
/**
* Sets ponter value
- *
+ *
* @param pointer
* pointer value to be set
*/
@@ -122,7 +122,7 @@ public class CArrayOfQuiltspecs {
/**
* Raises pointer by value
- *
+ *
* @param i
* raise by
*/
@@ -141,7 +141,7 @@ public class CArrayOfQuiltspecs {
/**
* Returns underlaying array
- *
+ *
* @return underlaying array
*/
public Quiltspec[] getArray() {
@@ -150,7 +150,7 @@ public class CArrayOfQuiltspecs {
/**
* Sets underlaying array
- *
+ *
* @param array
* underlaying array
*/
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java
index 7867817..ea3a3d1 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java
@@ -103,7 +103,7 @@ public class Curve {
/**
* Makes new Curve
- *
+ *
* @param geo
* @param pta
* @param ptb
@@ -143,7 +143,7 @@ public class Curve {
range[0] = qs.get().breakpoints[qs.get().index];
range[1] = qs.get().breakpoints[qs.get().index + 1];
range[2] = range[1] - range[0];
- // TODO it is necessary to solve problem with "this" pointer here
+ // TODO it is necessary to solve problem with "this" pointer here
if (range[0] != pta[0]) {
// System.out.println("TODO curve.Curve-range0");
// Curve lower=new Curve(this,pta,0);
@@ -229,7 +229,7 @@ public class Curve {
/**
* Tells whether curve needs subdivision
- *
+ *
* @return curve needs subdivison
*/
public boolean needsSamplingSubdivision() {
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Flist.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Flist.java
index 6983691..f9c4c2d 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Flist.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Flist.java
@@ -45,12 +45,12 @@ public class Flist {
/**
* Data elements end index
- *
+ *
*/
public int end;
/**
- *Data elements start index
+ *Data elements start index
*/
public int start;
@@ -80,7 +80,7 @@ public class Flist {
}
/**
- * Removes duplicate array elemnts
+ * Removes duplicate array elemnts
*/
public void filter() {
// INFO the aim of this method is to remove duplicates from array
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java
index 114832a..1dcf393 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java
@@ -36,9 +36,9 @@ package jogamp.opengl.glu.nurbs;
/**
* Knot vector specification
- *
+ *
* @author Tomas Hrasky
- *
+ *
*/
public class Knotspec {
@@ -314,7 +314,7 @@ public class Knotspec {
/**
* Copies control points
- *
+ *
* @param _inpt
* input control points
* @param _outpt
@@ -346,7 +346,7 @@ public class Knotspec {
/**
* Copies one control point to other
- *
+ *
* @param topt
* source control point
* @param frompt
@@ -374,7 +374,7 @@ public class Knotspec {
/**
* Inserts a knot
- *
+ *
* @param _p
* inserted knot
*/
@@ -402,7 +402,7 @@ public class Knotspec {
}
}
- } else {//code for curve
+ } else {//code for curve
if (this.equals(kspectotrans)) {
insert(p);
} else {
@@ -428,7 +428,7 @@ public class Knotspec {
/**
* Inserts a knot and computes new control points
- *
+ *
* @param p
* inserted knot
*/
@@ -490,7 +490,7 @@ public class Knotspec {
/**
* Copies one control point to another
- *
+ *
* @param topt
* source ctrl point
* @param frompt
@@ -519,7 +519,7 @@ public class Knotspec {
/**
* Computes new control point
- *
+ *
* @param x
* first point
* @param y
@@ -549,7 +549,7 @@ public class Knotspec {
* z.getRelative(0)));
break;
default:
- //no need of default - see previous method and its case statement
+ //no need of default - see previous method and its case statement
// System.out.println("TODO pt_oo_sum default");
break;
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java
index aac4dfc..571f44f 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java
@@ -36,9 +36,9 @@ package jogamp.opengl.glu.nurbs;
/**
* Knot vector used in curve specification
- *
+ *
* @author Tomas Hrasky
- *
+ *
*/
public class Knotvector {
@@ -75,7 +75,7 @@ public class Knotvector {
/**
* Makes new knotvector
- *
+ *
* @param nknots
* number of knots
* @param stride
@@ -92,7 +92,7 @@ public class Knotvector {
/**
* Initializes knotvector
- *
+ *
* @param nknots
* number of knots
* @param stride
@@ -116,7 +116,7 @@ public class Knotvector {
/**
* Validates knot vector parameters
- *
+ *
* @return knot vector validity
*/
public int validate() {
@@ -154,7 +154,7 @@ public class Knotvector {
/**
* Show specified message
- *
+ *
* @param msg
* message to be shown
*/
@@ -166,7 +166,7 @@ public class Knotvector {
/**
* Compares two knots for equality
- *
+ *
* @param a
* first knot
* @param b
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java
index bd5d2db..86638a8 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java
@@ -112,7 +112,7 @@ public class Mapdesc {
float clampfactor;
/**
- * Value of N_MINSAVINGS property
+ * Value of N_MINSAVINGS property
*/
private float minsavings;
@@ -162,7 +162,7 @@ public class Mapdesc {
private float[] bboxsize;
/**
- * Makes new mapdesc
+ * Makes new mapdesc
* @param type map type
* @param rational is rational
* @param ncoords number of control points coords
@@ -318,7 +318,7 @@ public class Mapdesc {
}
/**
- * Tells whether map is culling
+ * Tells whether map is culling
* @return is map culling
*/
public boolean isCulling() {
@@ -327,7 +327,7 @@ public class Mapdesc {
}
/**
- * Tells whether map is constantly sampling
+ * Tells whether map is constantly sampling
* @return is map constant sampling
*/
public boolean isConstantSampling() {
@@ -335,7 +335,7 @@ public class Mapdesc {
}
/**
- * Tells whether map is domain sampling
+ * Tells whether map is domain sampling
* @return is map domain sampling
*/
public boolean isDomainSampling() {
@@ -343,7 +343,7 @@ public class Mapdesc {
}
/**
- * Returns property of specified tag value
+ * Returns property of specified tag value
* @param tag property tag
* @return property value
*/
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbscurve.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbscurve.java
index 05c89eb..a686da6 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbscurve.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbscurve.java
@@ -68,7 +68,7 @@ public class O_nurbscurve {
/**
* Makes new O_nurbscurve
- * @param realType type of curve
+ * @param realType type of curve
*/
public O_nurbscurve(int realType) {
// DONE
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java
index f1e499a..8c29225 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java
@@ -52,7 +52,7 @@ public class Patchlist {
private Patch patch;
/**
- * Makes new list of patches
+ * Makes new list of patches
* @param quilts list of quilts
* @param pta low border
* @param ptb high border
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Property.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Property.java
index 25b4dc4..79f36ce 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Property.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Property.java
@@ -36,9 +36,9 @@ package jogamp.opengl.glu.nurbs;
/**
* Class representing property
- *
+ *
* @author Tomas Hrasky
- *
+ *
*/
public class Property {
@@ -59,7 +59,7 @@ public class Property {
/**
* Makes new property with given parameters
- *
+ *
* @param type
* property type
* @param tag
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Renderhints.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Renderhints.java
index 4729e24..7c63612 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Renderhints.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Renderhints.java
@@ -35,7 +35,7 @@ package jogamp.opengl.glu.nurbs;
*/
/**
- * Class holding rendering params
+ * Class holding rendering params
* @author Tomas Hrasky
*
*/
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java
index 37774f8..4d8296c 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java
@@ -41,7 +41,7 @@ package jogamp.opengl.glu.nurbs;
*/
public class Subdivider {
/**
- * Cull type
+ * Cull type
*/
public static final int CULL_TRIVIAL_REJECT = 0;
@@ -76,7 +76,7 @@ public class Subdivider {
private int subdivisions;
/**
- * U step when using domain distance sampling
+ * U step when using domain distance sampling
*/
private float domain_distance_u_rate;
@@ -375,7 +375,7 @@ public class Subdivider {
}
/**
- * Sample
+ * Sample
* @param source
* @param patchlist
* @param subdivisions
diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/TrimVertex.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/TrimVertex.java
index e88d697..1025afb 100644
--- a/src/jogl/classes/jogamp/opengl/glu/nurbs/TrimVertex.java
+++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/TrimVertex.java
@@ -36,9 +36,9 @@ package jogamp.opengl.glu.nurbs;
/**
* Holds vertex used in trim
- *
+ *
* @author Tomas Hrasky
- *
+ *
*/
public class TrimVertex {
diff --git a/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java b/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java
index 3d669d9..9c8523e 100644
--- a/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java
+++ b/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java
@@ -6,15 +6,15 @@
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
* Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
- *
+ *
* http://oss.sgi.com/projects/FreeB
- *
+ *
* Note that, as provided in the License, the Software is distributed on an
* "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
* DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
* CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
* PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
- *
+ *
* NOTE: The Original Code (as defined below) has been licensed to Sun
* Microsystems, Inc. ("Sun") under the SGI Free Software License B
* (Version 1.1), shown above ("SGI License"). Pursuant to Section
@@ -30,7 +30,7 @@
* Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
* Copyright in any portions created by third parties is as indicated
* elsewhere herein. All Rights Reserved.
- *
+ *
* Additional Notice Provisions: The application programming interfaces
* established by SGI in conjunction with the Original Code are The
* OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
@@ -51,11 +51,11 @@ import javax.media.opengl.glu.GLU;
* @author Administrator
*/
public class Registry {
-
+
/** Creates a new instance of Registry */
public Registry() {
}
-
+
public static String gluGetString(int name) {
if( name == GLU.GLU_VERSION ) {
return( "1.3" );
@@ -64,7 +64,7 @@ public class Registry {
}
return( null );
}
-
+
public static boolean gluCheckExtension( String extName, String extString ) {
if( extName == null || extString == null ) {
return( false );
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java
index 474056c..1ac0fd4 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java
@@ -81,6 +81,7 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ {
}
/* really __gl_pqHeapDeletePriorityQ */
+ @Override
void pqDeletePriorityQ() {
handles = null;
nodes = null;
@@ -137,6 +138,7 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ {
}
/* really __gl_pqHeapInit */
+ @Override
boolean pqInit() {
int i;
@@ -152,6 +154,7 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ {
/* really __gl_pqHeapInsert */
/* returns LONG_MAX iff out of memory */
+ @Override
int pqInsert(Object keyNew) {
int curr;
int free;
@@ -207,6 +210,7 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ {
}
/* really __gl_pqHeapExtractMin */
+ @Override
Object pqExtractMin() {
jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes;
jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles;
@@ -229,6 +233,7 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ {
}
/* really __gl_pqHeapDelete */
+ @Override
void pqDelete(int hCurr) {
jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes;
jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles;
@@ -252,10 +257,12 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ {
freeList = hCurr;
}
+ @Override
Object pqMinimum() {
return handles[nodes[1].handle].key;
}
+ @Override
boolean pqIsEmpty() {
return size == 0;
}
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java
index f9e0225..cf54b15 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java
@@ -71,6 +71,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ {
}
/* really __gl_pqSortDeletePriorityQ */
+ @Override
void pqDeletePriorityQ() {
if (heap != null) heap.pqDeletePriorityQ();
order = null;
@@ -100,6 +101,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ {
}
/* really __gl_pqSortInit */
+ @Override
boolean pqInit() {
int p, r, i, j;
int piv;
@@ -191,6 +193,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ {
/* really __gl_pqSortInsert */
/* returns LONG_MAX iff out of memory */
+ @Override
int pqInsert(Object keyNew) {
int curr;
@@ -220,6 +223,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ {
}
/* really __gl_pqSortExtractMin */
+ @Override
Object pqExtractMin() {
Object sortMin, heapMin;
@@ -240,6 +244,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ {
}
/* really __gl_pqSortMinimum */
+ @Override
Object pqMinimum() {
Object sortMin, heapMin;
@@ -257,11 +262,13 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ {
}
/* really __gl_pqSortIsEmpty */
+ @Override
boolean pqIsEmpty() {
return (size == 0) && heap.pqIsEmpty();
}
/* really __gl_pqSortDelete */
+ @Override
void pqDelete(int curr) {
if (curr >= 0) {
heap.pqDelete(curr);
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java
index 1801e1c..a2e9735 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java
@@ -279,6 +279,7 @@ class Render {
}
private static class RenderTriangle implements renderCallBack {
+ @Override
public void render(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUhalfEdge e, long size) {
/* Just add the triangle to a triangle list, so we can render all
* the separate triangles at once.
@@ -323,6 +324,7 @@ class Render {
}
private static class RenderFan implements renderCallBack {
+ @Override
public void render(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUhalfEdge e, long size) {
/* Render as many CCW triangles as possible in a fan starting from
* edge "e". The fan *should* contain exactly "size" triangles
@@ -345,6 +347,7 @@ class Render {
}
private static class RenderStrip implements renderCallBack {
+ @Override
public void render(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUhalfEdge e, long size) {
/* Render as many CCW triangles as possible in a strip starting from
* edge "e". The strip *should* contain exactly "size" triangles
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java
index b4a400c..d2c0db6 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java
@@ -742,7 +742,7 @@ class Sweep {
eUp.Org.s = isect.s;
eUp.Org.t = isect.t;
eUp.Org.pqHandle = tess.pq.pqInsert(eUp.Org); /* __gl_pqSortInsert */
- if (eUp.Org.pqHandle == Long.MAX_VALUE) {
+ if (eUp.Org.pqHandle == Integer.MAX_VALUE) {
tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */
tess.pq = null;
throw new RuntimeException();
@@ -1150,6 +1150,7 @@ class Sweep {
*/ {
/* __gl_dictListNewDict */
tess.dict = Dict.dictNewDict(tess, new Dict.DictLeq() {
+ @Override
public boolean leq(Object frame, Object key1, Object key2) {
return EdgeLeq(tess, (ActiveRegion) key1, (ActiveRegion) key2);
}
@@ -1231,6 +1232,7 @@ class Sweep {
/* __gl_pqSortNewPriorityQ */
pq = tess.pq = PriorityQ.pqNewPriorityQ(new PriorityQ.Leq() {
+ @Override
public boolean leq(Object key1, Object key2) {
return Geom.VertLeq(((GLUvertex) key1), (GLUvertex) key2);
}
@@ -1240,7 +1242,7 @@ class Sweep {
vHead = tess.mesh.vHead;
for (v = vHead.next; v != vHead; v = v.next) {
v.pqHandle = pq.pqInsert(v); /* __gl_pqSortInsert */
- if (v.pqHandle == Long.MAX_VALUE) break;
+ if (v.pqHandle == Integer.MAX_VALUE) break;
}
if (v != vHead || !pq.pqInit()) { /* __gl_pqSortInit */
tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index 6787ef5..037aaca 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -80,7 +80,7 @@ import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
public class MacOSXCGLContext extends GLContextImpl
-{
+{
// Abstract interface for implementation of this context (either
// NSOpenGL-based or CGL-based)
protected interface GLBackendImpl {
@@ -98,11 +98,13 @@ public class MacOSXCGLContext extends GLContextImpl
/* package */ static final boolean isTigerOrLater;
/* package */ static final boolean isLionOrLater;
+ /* package */ static final boolean isMavericksOrLater;
static {
final VersionNumber osvn = Platform.getOSVersionNumber();
- isTigerOrLater = osvn.getMajor() > 10 || ( osvn.getMajor() == 10 && osvn.getMinor() >= 4 );
- isLionOrLater = osvn.getMajor() > 10 || ( osvn.getMajor() == 10 && osvn.getMinor() >= 7 );
+ isTigerOrLater = osvn.compareTo(Platform.OSXVersion.Tiger) >= 0;
+ isLionOrLater = osvn.compareTo(Platform.OSXVersion.Lion) >= 0;
+ isMavericksOrLater = osvn.compareTo(Platform.OSXVersion.Mavericks) >= 0;
}
static boolean isGLProfileSupported(int ctp, int major, int minor) {
@@ -110,43 +112,58 @@ public class MacOSXCGLContext extends GLContextImpl
boolean ctCore = 0 != ( CTX_PROFILE_CORE & ctp ) ;
// We exclude 3.0, since we would map it's core to GL2. Hence we force mapping 2.1 to GL2
- if(3==major && 1<=minor && minor<=2) {
- // [3.1..3.2] -> GL3*
+ if( 3 < major || 3 == major && 1 <= minor ) {
+ if(ctBwdCompat || !ctCore) {
+ // No compatibility profile on OS X
+ // Only core is supported
+ return false;
+ }
if(!isLionOrLater) {
- // no GL3* on pre lion
+ // no GL Profile >= GL3 core on pre lion
return false;
}
- if(ctBwdCompat) {
- // no compatibility profile on OS X
+ if(3 < major && !isMavericksOrLater) {
+ // no GL Profile >= GL4 core on pre mavericks
return false;
}
- return ctCore;
- } else if(major<3) {
+ // [3.1..3.x] -> GL3
+ // [4.0..4.x] -> GL4
+ return true;
+ } else if( major < 3 ) {
// < 3.0 -> GL2
return true;
}
return false; // 3.0 && > 3.2
}
- static int GLProfile2CGLOGLProfileValue(int ctp, int major, int minor) {
+ static int GLProfile2CGLOGLProfileValue(AbstractGraphicsDevice device, int ctp, int major, int minor) {
if(!MacOSXCGLContext.isGLProfileSupported(ctp, major, minor)) {
throw new GLException("OpenGL profile not supported: "+getGLVersion(major, minor, ctp, "@GLProfile2CGLOGLProfileVersion"));
}
- boolean ctCore = 0 != ( CTX_PROFILE_CORE & ctp ) ;
- if( major == 3 && minor >= 1 && ctCore ) {
- return CGL.kCGLOGLPVersion_3_2_Core;
+ final boolean ctCore = 0 != ( CTX_PROFILE_CORE & ctp ) ;
+
+ if( major == 4 && ctCore ) {
+ if( GLRendererQuirks.existStickyDeviceQuirk(device, GLRendererQuirks.GL4NeedsGL3Request) ) {
+ // Thread safe GLRendererQuirks sticky access, since we are only interested of the result _after_ GL version mapping,
+ // i.e. after single threaded initialization!
+ return CGL.kCGLOGLPVersion_GL3_Core;
+ } else {
+ return CGL.kCGLOGLPVersion_GL4_Core;
+ }
+ } else if( major == 3 && minor >= 1 && ctCore ) {
+ return CGL.kCGLOGLPVersion_GL3_Core;
} else {
return CGL.kCGLOGLPVersion_Legacy;
}
}
private static final String shaderBasename = "texture01_xxx";
-
+
private static ShaderProgram createCALayerShader(GL3ES3 gl) {
// Create & Link the shader program
final ShaderProgram sp = new ShaderProgram();
- final ShaderCode vp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, MacOSXCGLContext.class,
+ final ShaderCode vp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, MacOSXCGLContext.class,
"../../shader", "../../shader/bin", shaderBasename, true);
- final ShaderCode fp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, MacOSXCGLContext.class,
+ final ShaderCode fp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, MacOSXCGLContext.class,
"../../shader", "../../shader/bin", shaderBasename, true);
vp.defaultShaderCustomization(gl, true, true);
fp.defaultShaderCustomization(gl, true, true);
@@ -162,7 +179,7 @@ public class MacOSXCGLContext extends GLContextImpl
pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
- pmvMatrix.glLoadIdentity();
+ pmvMatrix.glLoadIdentity();
final GLUniformData pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv
pmvMatrixUniform.setLocation(gl, sp.program());
gl.glUniform(pmvMatrixUniform);
@@ -170,8 +187,8 @@ public class MacOSXCGLContext extends GLContextImpl
sp.useProgram(gl, false);
return sp;
}
-
-
+
+
private boolean haveSetOpenGLMode = false;
private GLBackendType openGLMode = GLBackendType.NSOPENGL;
@@ -185,7 +202,7 @@ public class MacOSXCGLContext extends GLContextImpl
private long updateHandle = 0;
private int lastWidth, lastHeight;
-
+
protected MacOSXCGLContext(GLDrawableImpl drawable,
GLContext shareWith) {
super(drawable, shareWith);
@@ -193,10 +210,10 @@ public class MacOSXCGLContext extends GLContextImpl
}
@Override
- protected void resetStates() {
+ protected void resetStates(boolean isInit) {
// no inner state _cglExt = null;
cglExtProcAddressTable = null;
- super.resetStates();
+ super.resetStates(isInit);
}
@Override
@@ -283,7 +300,8 @@ public class MacOSXCGLContext extends GLContextImpl
MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration();
GLCapabilitiesImmutable capabilitiesChosen = (GLCapabilitiesImmutable) config.getChosenCapabilities();
GLProfile glp = capabilitiesChosen.getGLProfile();
- if(glp.isGLES1() || glp.isGLES2() || glp.isGL4() || glp.isGL3() && !isLionOrLater) {
+ if( glp.isGLES1() || glp.isGLES2() || glp.isGLES3() ||
+ ( glp.isGL3() && !isLionOrLater ) || ( glp.isGL4() && !isMavericksOrLater ) ) {
throw new GLException("OpenGL profile not supported on MacOSX "+Platform.getOSVersionNumber()+": "+glp);
}
@@ -303,7 +321,7 @@ public class MacOSXCGLContext extends GLContextImpl
@Override
protected void makeCurrentImpl() throws GLException {
/** FIXME: won't work w/ special drawables (like FBO) - check for CGL mode regressions!
- *
+ *
if (getOpenGLMode() != ((MacOSXCGLDrawable)drawable).getOpenGLMode()) {
setOpenGLMode(((MacOSXCGLDrawable)drawable).getOpenGLMode());
} */
@@ -327,7 +345,7 @@ public class MacOSXCGLContext extends GLContextImpl
throw new GLException("Error destroying OpenGL Context: "+this);
}
}
-
+
private final long getUpdateHandle() {
if( 0 == updateHandle ) {
lastWidth = -1;
@@ -340,7 +358,7 @@ public class MacOSXCGLContext extends GLContextImpl
} else {
incompleteView = false;
}
- if(!incompleteView) {
+ if(!incompleteView) {
updateHandle = CGL.updateContextRegister(contextHandle, drawable.getHandle());
if(0 == updateHandle) {
throw new InternalError("XXX2");
@@ -350,14 +368,14 @@ public class MacOSXCGLContext extends GLContextImpl
}
return updateHandle;
}
-
+
private final void releaseUpdateHandle() {
if ( 0 != updateHandle ) {
CGL.updateContextUnregister(updateHandle);
updateHandle = 0;
- }
+ }
}
-
+
@Override
protected void drawableUpdatedNotify() throws GLException {
if( drawable.getChosenGLCapabilities().isOnscreen() ) {
@@ -376,7 +394,7 @@ public class MacOSXCGLContext extends GLContextImpl
}
}
}
-
+
@Override
protected void associateDrawable(boolean bound) {
// context stuff depends on drawable stuff
@@ -390,12 +408,12 @@ public class MacOSXCGLContext extends GLContextImpl
super.associateDrawable(false); // 2) free drawable stuff
}
}
-
+
/* pp */ void detachPBuffer() {
impl.detachPBuffer();
}
-
+
@Override
protected void copyImpl(GLContext source, int mask) throws GLException {
if( isNSContext() != ((MacOSXCGLContext)source).isNSContext() ) {
@@ -429,7 +447,7 @@ public class MacOSXCGLContext extends GLContextImpl
// FIXME: apparently the Apple extension doesn't require a custom memory allocator
throw new GLException("Not yet implemented");
}
-
+
@Override
protected final void updateGLXProcAddressTable() {
final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration();
@@ -520,11 +538,11 @@ public class MacOSXCGLContext extends GLContextImpl
private int lastWidth=0, lastHeight=0; // allowing to detect size change
private boolean needsSetContextPBuffer = false;
private ShaderProgram gl3ShaderProgram = null;
-
+
@Override
public boolean isNSContext() { return true; }
-
+
/** Only returns a valid NSView. If !NSView, return null and mark either pbuffer and FBO. */
private long getNSViewHandle(boolean[] isPBuffer, boolean[] isFBO) {
final long nsViewHandle;
@@ -558,11 +576,11 @@ public class MacOSXCGLContext extends GLContextImpl
needsSetContextPBuffer = isPBuffer[0];
return nsViewHandle;
}
-
+
@Override
public long create(long share, int ctp, int major, int minor) {
long ctx = 0;
- final NativeSurface surface = drawable.getNativeSurface();
+ final NativeSurface surface = drawable.getNativeSurface();
final MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) surface.getGraphicsConfiguration();
final GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
final long nsViewHandle;
@@ -589,7 +607,7 @@ public class MacOSXCGLContext extends GLContextImpl
} else {
targetCaps = chosenCaps;
}
- pixelFormat = MacOSXCGLGraphicsConfiguration.GLCapabilities2NSPixelFormat(targetCaps, ctp, major, minor);
+ pixelFormat = MacOSXCGLGraphicsConfiguration.GLCapabilities2NSPixelFormat(config.getScreen().getDevice(), targetCaps, ctp, major, minor);
}
if (pixelFormat == 0) {
if(DEBUG) {
@@ -606,7 +624,7 @@ public class MacOSXCGLContext extends GLContextImpl
if( !_fixedCaps.isPBuffer() && isPBuffer ) {
throw new InternalError("handle is PBuffer, fixedCaps not: "+drawable);
}
- // determine on-/offscreen caps, since pformat is ambiguous
+ // 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 );
@@ -617,7 +635,7 @@ public class MacOSXCGLContext extends GLContextImpl
screenVSyncTimeout = 1000000 / sRefreshRate;
}
if(DEBUG) {
- System.err.println("NS create OSX>=lion "+isLionOrLater);
+ System.err.println("NS create OSX>=lion "+isLionOrLater+", OSX>=mavericks "+isMavericksOrLater);
System.err.println("NS create incompleteView: "+incompleteView);
System.err.println("NS create backingLayerHost: "+backingLayerHost);
System.err.println("NS create share: "+share);
@@ -632,7 +650,7 @@ public class MacOSXCGLContext extends GLContextImpl
// Thread.dumpStack();
}
config.setChosenCapabilities(fixedCaps);
-
+
final IntBuffer viewNotReady = Buffers.newDirectIntBuffer(1);
// Try to allocate a context with this
ctx = CGL.createContext(share, nsViewHandle, incompleteView,
@@ -665,12 +683,12 @@ public class MacOSXCGLContext extends GLContextImpl
* <p>
* Since NSOpenGLLayer creation requires this context for it's shared context creation,
* this method attempts to acquire the surface and context lock with {@link #screenVSyncTimeout}/2 maximum wait time.
- * If the surface and context lock could not be acquired, this runnable is being re-queued for later execution.
+ * If the surface and context lock could not be acquired, this runnable is being re-queued for later execution.
* </p>
* <p>
* Hence this method blocks the main-thread only for a short period of time.
* </p>
- */
+ */
class AttachGLLayerCmd implements Runnable {
final OffscreenLayerSurface ols;
final long ctx;
@@ -685,7 +703,7 @@ public class MacOSXCGLContext extends GLContextImpl
long nsOpenGLLayer;
/** Synchronized by instance's monitor */
boolean valid;
-
+
AttachGLLayerCmd(OffscreenLayerSurface ols, long ctx, int shaderProgram, long pfmt, long pbuffer, int texID, boolean isOpaque, int width, int height) {
this.ols = ols;
this.ctx = ctx;
@@ -699,23 +717,23 @@ public class MacOSXCGLContext extends GLContextImpl
this.valid = false;
this.nsOpenGLLayer = 0;
}
-
+
public final String contentToString() {
return "valid "+valid+", size "+width+"x"+height+", ctx "+toHexString(ctx)+", opaque "+isOpaque+", texID "+texID+", pbuffer "+toHexString(pbuffer)+", nsOpenGLLayer "+toHexString(nsOpenGLLayer);
}
-
+
@Override
public final String toString() {
return "AttachGLLayerCmd["+contentToString()+"]";
}
-
+
@Override
public void run() {
synchronized(this) {
if( !valid ) {
try {
final int maxwait = screenVSyncTimeout/2000; // TO 1/2 of current screen-vsync in [ms]
- final RecursiveLock surfaceLock = ols.getLock();
+ final RecursiveLock surfaceLock = ols.getLock();
if( surfaceLock.tryLock( maxwait ) ) {
try {
if( MacOSXCGLContext.this.lock.tryLock( maxwait ) ) {
@@ -745,26 +763,26 @@ public class MacOSXCGLContext extends GLContextImpl
if (DEBUG) {
System.err.println("NSOpenGLLayer.Attach: Re-Queue, drawableHandle "+toHexString(drawable.getHandle())+" - "+getThreadName());
}
- OSXUtil.RunLater(this, 1);
+ OSXUtil.RunLater(true /* onMain */, this, 1);
}
}
}
}
}
AttachGLLayerCmd attachGLLayerCmd = null;
-
+
class DetachGLLayerCmd implements Runnable {
final AttachGLLayerCmd cmd;
-
+
DetachGLLayerCmd(AttachGLLayerCmd cmd) {
this.cmd = cmd;
}
-
+
@Override
public final String toString() {
return "DetachGLLayerCmd["+cmd.contentToString()+"]";
}
-
+
@Override
public void run() {
synchronized( cmd ) {
@@ -777,7 +795,7 @@ public class MacOSXCGLContext extends GLContextImpl
ols.detachSurfaceLayer();
}
} catch(Throwable t) {
- System.err.println("Catched Exception on thread "+getThreadName());
+ System.err.println("Catched Exception on thread "+getThreadName());
t.printStackTrace();
}
CGL.releaseNSOpenGLLayer(cmd.nsOpenGLLayer);
@@ -790,27 +808,27 @@ public class MacOSXCGLContext extends GLContextImpl
System.err.println("NSOpenGLLayer.Detach: Skipped "+toHexString(cmd.nsOpenGLLayer)+" - "+getThreadName());
}
}
- }
+ }
}
-
+
@Override
public void associateDrawable(boolean bound) {
backingLayerHost = NativeWindowFactory.getOffscreenLayerSurface(drawable.getNativeSurface(), true);
-
+
if(DEBUG) {
System.err.println("MaxOSXCGLContext.NSOpenGLImpl.associateDrawable: "+bound+", ctx "+toHexString(contextHandle)+
", hasBackingLayerHost "+(null!=backingLayerHost)+", attachGLLayerCmd "+attachGLLayerCmd);
// Thread.dumpStack();
- }
-
- if( bound ) {
+ }
+
+ if( bound ) {
if( null != backingLayerHost ) {
final GLCapabilitiesImmutable chosenCaps;
final long ctx;
final int texID;
final long pbufferHandle;
final int gl3ShaderProgramName;
-
+
//
// handled layered surface
//
@@ -822,9 +840,10 @@ public class MacOSXCGLContext extends GLContextImpl
texID = fbod.getTextureBuffer(GL.GL_FRONT).getName();
pbufferHandle = 0;
fbod.setSwapBufferContext(new GLFBODrawableImpl.SwapBufferContext() {
+ @Override
public void swapBuffers(boolean doubleBuffered) {
- MacOSXCGLContext.NSOpenGLImpl.this.swapBuffers();
- } } ) ;
+ MacOSXCGLContext.NSOpenGLImpl.this.swapBuffers();
+ } } ) ;
} else if( CGL.isNSOpenGLPixelBuffer(drawableHandle) ) {
texID = 0;
pbufferHandle = drawableHandle;
@@ -847,19 +866,19 @@ public class MacOSXCGLContext extends GLContextImpl
gl3ShaderProgramName = gl3ShaderProgram.program();
} else {
gl3ShaderProgramName = 0;
- }
-
+ }
+
// All CALayer lifecycle ops are deferred on main-thread
- attachGLLayerCmd = new AttachGLLayerCmd(
- backingLayerHost, ctx, gl3ShaderProgramName, pixelFormat, pbufferHandle, texID,
+ attachGLLayerCmd = new AttachGLLayerCmd(
+ backingLayerHost, ctx, gl3ShaderProgramName, pixelFormat, pbufferHandle, texID,
chosenCaps.isBackgroundOpaque(), lastWidth, lastHeight );
if(DEBUG) {
System.err.println("MaxOSXCGLContext.NSOpenGLImpl.associateDrawable(true): "+attachGLLayerCmd);
- }
+ }
OSXUtil.RunOnMainThread(false, attachGLLayerCmd);
- } else { // -> null == backingLayerHost
+ } else { // -> null == backingLayerHost
lastWidth = drawable.getWidth();
- lastHeight = drawable.getHeight();
+ lastHeight = drawable.getHeight();
boolean[] isPBuffer = { false };
boolean[] isFBO = { false };
CGL.setContextView(contextHandle, getNSViewHandle(isPBuffer, isFBO));
@@ -882,7 +901,7 @@ public class MacOSXCGLContext extends GLContextImpl
final DetachGLLayerCmd dCmd = new DetachGLLayerCmd(cmd);
if(DEBUG) {
System.err.println("MaxOSXCGLContext.NSOpenGLImpl.associateDrawable(false): "+dCmd);
- }
+ }
OSXUtil.RunOnMainThread(false, dCmd);
if( null != gl3ShaderProgram ) {
gl3ShaderProgram.destroy(MacOSXCGLContext.this.gl.getGL3());
@@ -903,11 +922,11 @@ public class MacOSXCGLContext extends GLContextImpl
needsSetContextPBuffer = false;
CGL.setContextPBuffer(ctx, drawableHandle);
if(DEBUG) {
- System.err.println("NS.validateDrawableConfig bind pbuffer "+toHexString(drawableHandle)+" -> ctx "+toHexString(ctx));
+ System.err.println("NS.validateDrawableConfig bind pbuffer "+toHexString(drawableHandle)+" -> ctx "+toHexString(ctx));
}
}
}
-
+
/** Returns true if size has been updated, otherwise false (same size). */
private final boolean validateDrawableSizeConfig(long ctx) {
final int width = drawable.getWidth();
@@ -916,13 +935,13 @@ public class MacOSXCGLContext extends GLContextImpl
lastWidth = drawable.getWidth();
lastHeight = drawable.getHeight();
if(DEBUG) {
- System.err.println("NS.validateDrawableConfig size changed");
+ System.err.println("NS.validateDrawableConfig size changed");
}
return true;
}
return false;
}
-
+
@Override
public boolean copyImpl(long src, int mask) {
CGL.copyContext(contextHandle, src, mask);
@@ -975,7 +994,7 @@ public class MacOSXCGLContext extends GLContextImpl
// CGL.setContextPBuffer(contextHandle, 0); // doesn't work, i.e. not taking nil
return true;
}
-
+
@Override
public boolean setSwapInterval(int interval) {
final AttachGLLayerCmd cmd = attachGLLayerCmd;
@@ -1004,7 +1023,7 @@ public class MacOSXCGLContext extends GLContextImpl
if(DEBUG) { System.err.println("CGL setSwapInterval: "+interval); }
CGL.setSwapInterval(contextHandle, interval);
}
-
+
private int skipSync=0;
/** TODO: Remove after discussion
private boolean perfIterReset = false;
@@ -1014,7 +1033,7 @@ public class MacOSXCGLContext extends GLContextImpl
private long frameXS = 0;
private long lastFrameStart = 0;
*/
-
+
@Override
public boolean swapBuffers() {
final AttachGLLayerCmd cmd = attachGLLayerCmd;
@@ -1026,7 +1045,7 @@ public class MacOSXCGLContext extends GLContextImpl
// allowing to update the texture IDs ASAP.
skipSync = 10;
}
-
+
final boolean res;
final int texID;
final boolean valid;
@@ -1054,19 +1073,19 @@ public class MacOSXCGLContext extends GLContextImpl
final long lastFramePeriod0 = TimeUnit.NANOSECONDS.toMicros(System.nanoTime()) - lastFrameStart;
gl.glFinish(); // Require to finish previous GL rendering to give CALayer proper result
final long lastFramePeriod1 = TimeUnit.NANOSECONDS.toMicros(System.nanoTime()) - lastFrameStart;
-
- // If v-sync is disabled, frames will be drawn as quickly as possible w/o delay,
+
+ // If v-sync is disabled, frames will be drawn as quickly as possible w/o delay,
// while still synchronizing w/ CALayer.
// If v-sync is enabled wait until next swap interval (v-sync).
CGL.waitUntilNSOpenGLLayerIsReady(cmd.nsOpenGLLayer, vsyncTimeout);
final long lastFramePeriodX = TimeUnit.NANOSECONDS.toMicros(System.nanoTime()) - lastFrameStart;
-
+
final long finishGL = lastFramePeriod1 - lastFramePeriod0;
final long waitGL = lastFramePeriodX - lastFramePeriod1;
finishGLS += finishGL;
waitGLS += waitGL;
frameXS += lastFramePeriodX;
-
+
System.err.println("XXX["+perfIter+"] TO "+vsyncTimeout/1000+" ms, "+
"lFrame0 "+lastFramePeriod0/1000+" ms, "+
"lFrameX "+lastFramePeriodX/1000+" / "+frameXS/1000+" ~"+(frameXS/perfIter)/1000.0+" ms, "+
@@ -1080,8 +1099,8 @@ public class MacOSXCGLContext extends GLContextImpl
// FIXME: IMHO this synchronization should be implicitly performed via 'CGL.flushBuffer(contextHandle)' above,
// in case this will be determined a driver bug - use a QUIRK entry in GLRendererQuirks!
gl.glFinish();
-
- // If v-sync is disabled, frames will be drawn as quickly as possible w/o delay,
+
+ // If v-sync is disabled, frames will be drawn as quickly as possible w/o delay,
// while still synchronizing w/ CALayer.
// If v-sync is enabled wait until next swap interval (v-sync).
CGL.waitUntilNSOpenGLLayerIsReady(cmd.nsOpenGLLayer, vsyncTimeout);
@@ -1093,7 +1112,7 @@ public class MacOSXCGLContext extends GLContextImpl
CGL.setNSOpenGLLayerNeedsDisplayFBO(cmd.nsOpenGLLayer, texID);
} else {
// trigger CALayer to update incl. possible surface change (new pbuffer handle)
- CGL.setNSOpenGLLayerNeedsDisplayPBuffer(cmd.nsOpenGLLayer, drawable.getHandle());
+ CGL.setNSOpenGLLayerNeedsDisplayPBuffer(cmd.nsOpenGLLayer, drawable.getHandle());
}
// lastFrameStart = TimeUnit.NANOSECONDS.toMicros(System.nanoTime());
}
@@ -1116,9 +1135,10 @@ public class MacOSXCGLContext extends GLContextImpl
@Override
public long create(long share, int ctp, int major, int minor) {
long ctx = 0;
- MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration();
- GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable)config.getChosenCapabilities();
- long pixelFormat = MacOSXCGLGraphicsConfiguration.GLCapabilities2CGLPixelFormat(chosenCaps, ctp, major, minor);
+ final MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration();
+ final GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable)config.getChosenCapabilities();
+ final long pixelFormat = MacOSXCGLGraphicsConfiguration.GLCapabilities2CGLPixelFormat(config.getScreen().getDevice(),
+ chosenCaps, ctp, major, minor);
if (pixelFormat == 0) {
throw new GLException("Unable to allocate pixel format with requested GLCapabilities");
}
@@ -1137,8 +1157,8 @@ public class MacOSXCGLContext extends GLContextImpl
if (0 != ctx) {
GLCapabilities fixedCaps = MacOSXCGLGraphicsConfiguration.CGLPixelFormat2GLCapabilities(pixelFormat);
fixedCaps = GLGraphicsConfigurationUtil.fixOpaqueGLCapabilities(fixedCaps, chosenCaps.isBackgroundOpaque());
- { // determine on-/offscreen caps, since pformat is ambiguous
- fixedCaps.setFBO( false ); // n/a for CGLImpl
+ { // determine on-/offscreen caps, since pformat is ambiguous
+ fixedCaps.setFBO( false ); // n/a for CGLImpl
fixedCaps.setPBuffer( fixedCaps.isPBuffer() && !chosenCaps.isOnscreen() );
fixedCaps.setBitmap( false ); // n/a in our OSX impl.
fixedCaps.setOnscreen( !fixedCaps.isPBuffer() );
@@ -1153,7 +1173,7 @@ public class MacOSXCGLContext extends GLContextImpl
if (res != CGL.kCGLNoError) {
throw new GLException("Error code " + res + " while attaching context to pbuffer");
}
- }
+ }
}
} finally {
CGL.CGLDestroyPixelFormat(pixelFormat);
@@ -1224,7 +1244,7 @@ public class MacOSXCGLContext extends GLContextImpl
} */
return true;
}
-
+
@Override
public boolean setSwapInterval(int interval) {
final IntBuffer lval = Buffers.newDirectIntBuffer(1);
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
index 4bd7bc9..bb36a72 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
@@ -105,7 +105,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
@Override
protected void setRealizedImpl() {
}
-
+
@Override
protected void associateContext(GLContext ctx, boolean bound) {
// NOTE: we need to keep track of the created contexts in order to
@@ -123,14 +123,14 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
} else {
i++;
}
- }
+ }
}
- }
+ }
}
-
+
@Override
protected final void swapBuffersImpl(boolean doubleBuffered) {
- if(doubleBuffered) {
+ if(doubleBuffered) {
synchronized (createdContexts) {
for(int i=0; i<createdContexts.size(); ) {
final MacOSXCGLContext ctx = createdContexts.get(i).get();
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
index 83d6564..994eee8 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -124,7 +124,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
protected final boolean isComplete() {
return null != macOSXCGLDynamicLookupHelper;
}
-
+
@Override
protected final void destroy() {
if(null != sharedMap) {
@@ -194,7 +194,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
public GLRendererQuirks getRendererQuirks() {
- return glRendererQuirks;
+ return glRendererQuirks;
}
}
@@ -229,6 +229,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
}
}
+ @Override
protected final SharedResource getOrCreateSharedResourceImpl(AbstractGraphicsDevice adevice) {
final String connection = adevice.getConnection();
SharedResource sr;
@@ -251,12 +252,12 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
final GLDrawableImpl sharedDrawable = createOnscreenDrawableImpl(createDummySurfaceImpl(sharedDevice, false, caps, caps, null, 64, 64));
sharedDrawable.setRealized(true);
-
+
final MacOSXCGLContext sharedContext = (MacOSXCGLContext) sharedDrawable.createContext(null);
if (null == sharedContext) {
throw new GLException("Couldn't create shared context for drawable: "+sharedDrawable);
}
-
+
try {
sharedContext.makeCurrent(); // could cause exception
isValid = sharedContext.isCurrent();
@@ -342,8 +343,8 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
- protected ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
- GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested,
+ protected ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
+ GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested,
GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) {
final MacOSXGraphicsDevice device;
if( createNewDevice || !(deviceReq instanceof MacOSXGraphicsDevice) ) {
@@ -354,24 +355,24 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, 0);
final MacOSXCGLGraphicsConfiguration config = MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen, true);
if(null == config) {
- throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen);
- }
+ throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen);
+ }
return new WrappedSurface(config, 0, upstreamHook, createNewDevice);
}
@Override
- public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
+ public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height) {
chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps);
- return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser,
- new OSXDummyUpstreamSurfaceHook(width, height));
- }
-
+ return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser,
+ new OSXDummyUpstreamSurfaceHook(width, height));
+ }
+
@Override
protected ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) {
final MacOSXGraphicsDevice device = new MacOSXGraphicsDevice(deviceReq.getUnitID());
final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, screenIdx);
- final MacOSXCGLGraphicsConfiguration config = MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsRequested, capsRequested, chooser, screen, true);
+ final MacOSXCGLGraphicsConfiguration config = MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsRequested, capsRequested, chooser, screen, true);
return new WrappedSurface(config, windowHandle, upstream, true);
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java
index f8c874a..cda8307 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.macosx.cgl;
import jogamp.opengl.*;
@@ -42,13 +42,13 @@ public final class MacOSXCGLDynamicLibraryBundleInfo extends DesktopGLDynamicLib
final List<String> libsGL = new ArrayList<String>();
libsGL.add("/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib");
libsGL.add("GL");
- libsList.add(libsGL);
+ libsList.add(libsGL);
return libsList;
}
-
+
@Override
public final List<String> getToolGetProcAddressFuncNameList() {
- return null;
+ return null;
/** OSX manual says: NSImage use is discouraged
List res = new ArrayList();
res.add("GetProcAddress"); // dummy
@@ -59,7 +59,7 @@ public final class MacOSXCGLDynamicLibraryBundleInfo extends DesktopGLDynamicLib
public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) {
return 0;
/** OSX manual says: NSImage use is discouraged
- return CGL.getProcAddress(glFuncName); // manual implementation
+ return CGL.getProcAddress(glFuncName); // manual implementation
*/
}
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
index 5eb11c6..481c0b9 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -47,18 +47,18 @@ import javax.media.opengl.GLCapabilitiesImmutable;
import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
-
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.nio.PointerBuffer;
import com.jogamp.nativewindow.MutableGraphicsConfiguration;
public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable {
- MacOSXCGLGraphicsConfiguration(AbstractGraphicsScreen screen,
+ MacOSXCGLGraphicsConfiguration(AbstractGraphicsScreen screen,
GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested) {
super(screen, capsChosen, capsRequested);
}
+ @Override
public Object clone() {
return super.clone();
}
@@ -71,10 +71,10 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
// MacOSXGraphicsDevice osxDevice = sharedResource.getDevice();
return new ArrayList<GLCapabilitiesImmutable>(0);
}
-
+
static final IntBuffer cglInternalAttributeToken = Buffers.newDirectIntBuffer(new int[] {
CGL.kCGLPFAOpenGLProfile, // >= lion
- CGL.NSOpenGLPFAAccelerated, // query only (prefer accelerated, but allow non accelerated), ignored for createPixelformat
+ CGL.NSOpenGLPFAAccelerated, // query only (prefer accelerated, but allow non accelerated), ignored for createPixelformat
CGL.NSOpenGLPFANoRecovery,
CGL.kCGLPFAColorFloat,
CGL.NSOpenGLPFAPixelBuffer,
@@ -88,7 +88,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
CGL.NSOpenGLPFASampleBuffers,
CGL.NSOpenGLPFASamples });
- static IntBuffer GLCapabilities2NSAttribList(IntBuffer attrToken, GLCapabilitiesImmutable caps, int ctp, int major, int minor) {
+ static IntBuffer GLCapabilities2NSAttribList(AbstractGraphicsDevice device, IntBuffer attrToken, GLCapabilitiesImmutable caps, int ctp, int major, int minor) {
final int len = attrToken.remaining();
final int off = attrToken.position();
final IntBuffer ivalues = Buffers.newDirectIntBuffer(len);
@@ -96,13 +96,13 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
for (int idx = 0; idx < len; idx++) {
final int attr = attrToken.get(idx+off);
switch (attr) {
- case CGL.kCGLPFAOpenGLProfile:
- ivalues.put(idx, MacOSXCGLContext.GLProfile2CGLOGLProfileValue(ctp, major, minor));
+ case CGL.kCGLPFAOpenGLProfile:
+ ivalues.put(idx, MacOSXCGLContext.GLProfile2CGLOGLProfileValue(device, ctp, major, minor));
break;
case CGL.NSOpenGLPFANoRecovery:
ivalues.put(idx, caps.getHardwareAccelerated() ? 1 : 0);
break;
-
+
case CGL.kCGLPFAColorFloat:
// ivalues.put(idx, ( !caps.isOnscreen() && caps.isPBuffer() && caps.getPbufferFloatingPointBuffers() ) ? 1 : 0);
ivalues.put(idx, 0);
@@ -155,13 +155,13 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
return ivalues;
}
- static long GLCapabilities2NSPixelFormat(GLCapabilitiesImmutable caps, int ctp, int major, int minor) {
+ static long GLCapabilities2NSPixelFormat(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps, int ctp, int major, int minor) {
final IntBuffer attrToken = cglInternalAttributeToken.duplicate();
if ( !MacOSXCGLContext.isLionOrLater ) {
// no OpenGLProfile
attrToken.position(1);
- }
- final IntBuffer ivalues = GLCapabilities2NSAttribList(attrToken, caps, ctp, major, minor);
+ }
+ final IntBuffer ivalues = GLCapabilities2NSAttribList(device, attrToken, caps, ctp, major, minor);
return CGL.createPixelFormat(attrToken, attrToken.remaining(), ivalues);
}
@@ -169,13 +169,13 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
return PixelFormat2GLCapabilities(glp, pixelFormat, true);
}
- static long GLCapabilities2CGLPixelFormat(GLCapabilitiesImmutable caps, int ctp, int major, int minor) {
+ static long GLCapabilities2CGLPixelFormat(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps, int ctp, int major, int minor) {
// Set up pixel format attributes
final IntBuffer attrs = Buffers.newDirectIntBuffer(256);
int i = 0;
if(MacOSXCGLContext.isLionOrLater) {
- attrs.put(i++, CGL.kCGLPFAOpenGLProfile);
- attrs.put(i++, MacOSXCGLContext.GLProfile2CGLOGLProfileValue(ctp, major, minor));
+ attrs.put(i++, CGL.kCGLPFAOpenGLProfile);
+ attrs.put(i++, MacOSXCGLContext.GLProfile2CGLOGLProfileValue(device, ctp, major, minor));
}
/**
if(!caps.isOnscreen() && caps.isPBuffer()) {
@@ -222,8 +222,8 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
}
return fmt.get(0);
}
-
- static GLCapabilities CGLPixelFormat2GLCapabilities(long pixelFormat) {
+
+ static GLCapabilities CGLPixelFormat2GLCapabilities(long pixelFormat) {
return PixelFormat2GLCapabilities(null, pixelFormat, false);
}
@@ -235,7 +235,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
off = 1;
} else {
off = 0;
- }
+ }
attrToken.position(off);
final int len = attrToken.remaining();
final IntBuffer ivalues = Buffers.newDirectIntBuffer(len);
@@ -243,7 +243,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
// On this platform the pixel format is associated with the
// context and not the drawable. However it's a reasonable
// approximation to just store the chosen pixel format up in the
- // NativeSurface's AbstractGraphicsConfiguration,
+ // NativeSurface's AbstractGraphicsConfiguration,
// since the public API doesn't provide for a different GLCapabilities per context.
// Note: These restrictions of the platform's API might be considered as a bug anyways.
@@ -253,23 +253,26 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
} else {
CGL.CGLQueryPixelFormat(pixelFormat, attrToken, len, ivalues);
}
-
+
if(null == glp && MacOSXCGLContext.isLionOrLater) {
// pre-scan for OpenGL Profile
for (int i = 0; i < len; i++) {
final int ivalue = ivalues.get(i);
if(CGL.kCGLPFAOpenGLProfile == attrToken.get(i+off)) {
switch(ivalue) {
- case CGL.kCGLOGLPVersion_3_2_Core:
+ case CGL.kCGLOGLPVersion_GL4_Core:
+ glp = GLProfile.get(GLProfile.GL4);
+ break;
+ case CGL.kCGLOGLPVersion_GL3_Core:
glp = GLProfile.get(GLProfile.GL3);
break;
case CGL.kCGLOGLPVersion_Legacy:
glp = GLProfile.get(GLProfile.GL2);
- break;
+ break;
default:
throw new RuntimeException("Unhandled OSX OpenGL Profile: 0x"+Integer.toHexString(ivalue));
}
- }
+ }
}
}
if(null == glp) {
@@ -284,7 +287,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
case CGL.NSOpenGLPFAAccelerated:
caps.setHardwareAccelerated(ivalue != 0);
break;
-
+
case CGL.kCGLPFAColorFloat:
// caps.setPbufferFloatingPointBuffers(ivalue != 0);
break;
@@ -346,7 +349,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
}
}
caps.setAlphaBits(alphaBits);
-
+
return caps;
}
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java
index 3bbba2c..db2a1df 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -56,13 +56,14 @@ public class MacOSXCGLGraphicsConfigurationFactory extends GLGraphicsConfigurati
static void registerFactory() {
GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.macosx.MacOSXGraphicsDevice.class, GLCapabilitiesImmutable.class, new MacOSXCGLGraphicsConfigurationFactory());
}
- private MacOSXCGLGraphicsConfigurationFactory() {
+ private MacOSXCGLGraphicsConfigurationFactory() {
}
+ @Override
protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl(
CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested,
CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) {
-
+
if (absScreen == null) {
throw new IllegalArgumentException("AbstractGraphicsScreen is null");
}
@@ -78,7 +79,7 @@ public class MacOSXCGLGraphicsConfigurationFactory extends GLGraphicsConfigurati
if (chooser != null && !(chooser instanceof GLCapabilitiesChooser)) {
throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects");
}
-
+
return chooseGraphicsConfigurationStatic((GLCapabilitiesImmutable)capsChosen, (GLCapabilitiesImmutable)capsRequested, (GLCapabilitiesChooser)chooser, absScreen, false);
}
@@ -91,7 +92,7 @@ public class MacOSXCGLGraphicsConfigurationFactory extends GLGraphicsConfigurati
}
final AbstractGraphicsDevice device = absScreen.getDevice();
capsChosen = GLGraphicsConfigurationUtil.fixGLCapabilities( capsChosen, GLDrawableFactory.getDesktopFactory(), device);
-
+
return new MacOSXCGLGraphicsConfiguration(absScreen, (GLCapabilitiesImmutable)capsChosen, (GLCapabilitiesImmutable)capsRequested);
}
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java
index d23d8a7..5d036d4 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java
@@ -49,7 +49,6 @@ import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLException;
-
import jogamp.nativewindow.WrappedSurface;
import jogamp.opengl.GLContextImpl;
import jogamp.opengl.GLContextShareSet;
@@ -63,7 +62,9 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext {
setOpenGLMode(isNSContext ? GLBackendType.NSOPENGL : GLBackendType.CGL );
this.contextHandle = handle;
GLContextShareSet.contextCreated(this);
- setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_COMPAT, false);
+ if( !setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_COMPAT, false /* strictMatch */, false /* withinGLVersionsMapping */) ) { // use GL_VERSION
+ throw new InternalError("setGLFunctionAvailability !strictMatch failed");
+ }
getGLStateTracker().setEnabled(false); // external context usage can't track state in Java
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
index 4e791cb..f6e8b8f 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
@@ -90,7 +90,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
public GLContext createContext(GLContext shareWith) {
return new MacOSXCGLContext(this, shareWith);
}
-
+
protected int getTextureTarget() { return pBufferTexTarget; }
protected int getTextureWidth() { return pBufferTexWidth; }
protected int getTextureHeight() { return pBufferTexHeight; }
@@ -101,7 +101,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
if (0 != pBuffer) {
synchronized (createdContexts) {
for(int i=0; i<createdContexts.size(); ) {
- final WeakReference<MacOSXCGLContext> ref = createdContexts.get(i);
+ final WeakReference<MacOSXCGLContext> ref = createdContexts.get(i);
final MacOSXCGLContext ctx = ref.get();
if (ctx != null) {
ctx.detachPBuffer();
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 edf9b7c..2192353 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -59,10 +59,11 @@ import jogamp.opengl.macosx.cgl.MacOSXCGLGraphicsConfiguration;
public class MacOSXAWTCGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFactory {
public static void registerFactory() {
GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.awt.AWTGraphicsDevice.class, GLCapabilitiesImmutable.class, new MacOSXAWTCGLGraphicsConfigurationFactory());
- }
+ }
private MacOSXAWTCGLGraphicsConfigurationFactory() {
}
+ @Override
protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl(
CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested,
CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) {
diff --git a/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java b/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java
index 87c7b93..ecb6b60 100644
--- a/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java
+++ b/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java
@@ -28,13 +28,20 @@
package jogamp.opengl.openal.av;
-import jogamp.opengl.util.av.SyncedRingbuffer;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import com.jogamp.common.util.LFRingbuffer;
+import com.jogamp.common.util.Ringbuffer;
+import com.jogamp.common.util.locks.LockFactory;
+import com.jogamp.common.util.locks.RecursiveLock;
import com.jogamp.openal.AL;
import com.jogamp.openal.ALC;
import com.jogamp.openal.ALCcontext;
import com.jogamp.openal.ALCdevice;
+import com.jogamp.openal.ALExt;
import com.jogamp.openal.ALFactory;
+import com.jogamp.openal.util.ALHelpers;
import com.jogamp.opengl.util.av.AudioSink;
/***
@@ -42,49 +49,70 @@ import com.jogamp.opengl.util.av.AudioSink;
*/
public class ALAudioSink implements AudioSink {
- /** Chunk of audio processed at one time. FIXME: Parameterize .. */
- public static final int BUFFER_SIZE = 4096;
- public static final int SAMPLES_PER_BUFFER = BUFFER_SIZE / 2;
-
+ private static final String AL_SOFT_buffer_samples = "AL_SOFT_buffer_samples";
private static final ALC alc;
private static final AL al;
+ private static final ALExt alExt;
private static final boolean staticAvailable;
private String deviceSpecifier;
private ALCdevice device;
+ private boolean hasSOFTBufferSamples;
+ private AudioFormat preferredAudioFormat;
private ALCcontext context;
+ private final RecursiveLock lock = LockFactory.createRecursiveLock();
- /** Sample period in seconds */
- public float samplePeriod;
- /** Buffer period in seconds */
- public float bufferPeriod;
-
- static class ActiveBuffer {
- ActiveBuffer(Integer name, int size) {
- this.name = name;
- this.size = size;
+ /** Playback speed, range [0.5 - 2.0], default 1.0. */
+ private float playSpeed;
+ private float volume = 1.0f;
+
+ static class ALAudioFrame extends AudioFrame {
+ private final int alBuffer;
+
+ ALAudioFrame(int alBuffer) {
+ this.alBuffer = alBuffer;
+ }
+ public ALAudioFrame(int alBuffer, int pts, int duration, int dataSize) {
+ super(pts, duration, dataSize);
+ this.alBuffer = alBuffer;
+ }
+
+ /** Get this frame's OpenAL buffer name */
+ public final int getALBuffer() { return alBuffer; }
+
+ public String toString() {
+ return "ALAudioFrame[pts " + pts + " ms, l " + duration + " ms, " + byteSize + " bytes, buffer "+alBuffer+"]";
}
- public final Integer name;
- public final int size;
- public String toString() { return "ABuffer[name "+name+", size "+size+"]"; }
}
- int[] alBuffers = null;
- private SyncedRingbuffer<Integer> alBufferAvail = null;
- private SyncedRingbuffer<ActiveBuffer> alBufferPlaying = null;
- private int alBufferBytesQueued = 0;
+ // private ALAudioFrame[] alFrames = null;
+ private int[] alBufferNames = null;
+ private int frameGrowAmount = 0;
+ private int frameLimit = 0;
+
+ private Ringbuffer<ALAudioFrame> alFramesAvail = null;
+ private Ringbuffer<ALAudioFrame> alFramesPlaying = null;
+ private volatile int alBufferBytesQueued = 0;
+ private volatile int playingPTS = AudioFrame.INVALID_PTS;
+ private volatile int enqueuedFrameCount;
private int[] alSource = null;
- private AudioDataFormat chosenFormat;
- private int alFormat;
+ private AudioFormat chosenFormat;
+ private int alChannelLayout;
+ private int alSampleType;
+ private int alFormat;
private boolean initialized;
+
+ private volatile boolean playRequested = false;
static {
ALC _alc = null;
AL _al = null;
+ ALExt _alExt = null;
try {
_alc = ALFactory.getALC();
_al = ALFactory.getAL();
+ _alExt = ALFactory.getALExt();
} catch(Throwable t) {
if( DEBUG ) {
System.err.println("ALAudioSink: Catched "+t.getClass().getName()+": "+t.getMessage());
@@ -93,7 +121,8 @@ public class ALAudioSink implements AudioSink {
}
alc = _alc;
al = _al;
- staticAvailable = null != alc && null != al;
+ alExt = _alExt;
+ staticAvailable = null != alc && null != al && null != alExt;
}
public ALAudioSink() {
@@ -120,32 +149,44 @@ public class ALAudioSink implements AudioSink {
// Create audio context.
context = alc.alcCreateContext(device, null);
if (context == null) {
- throw new RuntimeException("ALAudioSink: Error creating OpenAL context");
+ throw new RuntimeException("ALAudioSink: Error creating OpenAL context for "+deviceSpecifier);
}
- // Set active context.
- alc.alcMakeContextCurrent(context);
-
- // Check for an error.
- if ( alc.alcGetError(device) != ALC.ALC_NO_ERROR ) {
- throw new RuntimeException("ALAudioSink: Error making OpenAL context current");
- }
-
- // Create source
- {
- alSource = new int[1];
- al.alGenSources(1, alSource, 0);
- final int err = al.alGetError();
- if( err != AL.AL_NO_ERROR ) {
- alSource = null;
- throw new RuntimeException("ALAudioSink: Error generating Source: 0x"+Integer.toHexString(err));
- }
- }
-
- if( DEBUG ) {
- System.err.println("ALAudioSink: Using device: " + deviceSpecifier);
+ lockContext();
+ try {
+ // Check for an error.
+ if ( alc.alcGetError(device) != ALC.ALC_NO_ERROR ) {
+ throw new RuntimeException("ALAudioSink: Error making OpenAL context current");
+ }
+
+ hasSOFTBufferSamples = al.alIsExtensionPresent(AL_SOFT_buffer_samples);
+ preferredAudioFormat = queryPreferredAudioFormat();
+ if( DEBUG ) {
+ System.out.println("ALAudioSink: OpenAL Extensions:"+al.alGetString(AL.AL_EXTENSIONS));
+ System.out.println("ALAudioSink: Null device OpenAL Extensions:"+alc.alcGetString(null, ALC.ALC_EXTENSIONS));
+ System.out.println("ALAudioSink: Device "+deviceSpecifier+" OpenAL Extensions:"+alc.alcGetString(device, ALC.ALC_EXTENSIONS));
+ System.out.println("ALAudioSink: hasSOFTBufferSamples "+hasSOFTBufferSamples);
+ System.out.println("ALAudioSink: preferredAudioFormat "+preferredAudioFormat);
+ }
+
+ // Create source
+ {
+ alSource = new int[1];
+ al.alGenSources(1, alSource, 0);
+ final int err = al.alGetError();
+ if( err != AL.AL_NO_ERROR ) {
+ alSource = null;
+ throw new RuntimeException("ALAudioSink: Error generating Source: 0x"+Integer.toHexString(err));
+ }
+ }
+
+ if( DEBUG ) {
+ System.err.println("ALAudioSink: Using device: " + deviceSpecifier);
+ }
+ initialized = true;
+ } finally {
+ unlockContext();
}
- initialized = true;
return;
} catch ( Exception e ) {
if( DEBUG ) {
@@ -155,124 +196,259 @@ public class ALAudioSink implements AudioSink {
}
}
+ private final AudioFormat queryPreferredAudioFormat() {
+ int sampleRate = DefaultFormat.sampleRate;
+ final int[] value = new int[1];
+ alc.alcGetIntegerv(device, ALC.ALC_FREQUENCY, 1, value, 0);
+ if ( alc.alcGetError(device) == ALC.ALC_NO_ERROR ) {
+ sampleRate = value[0];
+ }
+ return new AudioFormat(sampleRate, DefaultFormat.sampleSize, DefaultFormat.channelCount, DefaultFormat.signed, DefaultFormat.fixedP, DefaultFormat.planar, DefaultFormat.littleEndian);
+ }
+
+ private final void lockContext() {
+ lock.lock();
+ alc.alcMakeContextCurrent(context);
+ }
+ private final void unlockContext() {
+ alc.alcMakeContextCurrent(null);
+ lock.unlock();
+ }
+ private final void destroyContext() {
+ lock.lock();
+ try {
+ if( null != context ) {
+ try {
+ alc.alcDestroyContext(context);
+ } catch (Throwable t) {
+ if( DEBUG ) {
+ System.err.println("Catched "+t.getClass().getName()+": "+t.getMessage());
+ t.printStackTrace();
+ }
+ }
+ context = null;
+ }
+ // unroll lock !
+ while(lock.getHoldCount() > 1) {
+ lock.unlock();
+ }
+ } finally {
+ lock.unlock();
+ }
+ }
+
@Override
- public String toString() {
+ public final String toString() {
final int alSrcName = null != alSource ? alSource[0] : 0;
- final int alBuffersLen = null != alBuffers ? alBuffers.length : 0;
- return "ALAudioSink[init "+initialized+", device "+deviceSpecifier+", ctx "+context+", alSource "+alSrcName+
- ", chosen "+chosenFormat+", alFormat "+toHexString(alFormat)+
- ", buffers[total "+alBuffersLen+", avail "+alBufferAvail.size()+", "+alBufferPlaying.getFreeSlots()+
- ", queued[bufferCount "+alBufferPlaying.size()+", "+getQueuedTime() + " ms, " + alBufferBytesQueued+" bytes]";
+ final int alBuffersLen = null != alBufferNames ? alBufferNames.length : 0;
+ final int ctxHash = context != null ? context.hashCode() : 0;
+ return "ALAudioSink[init "+initialized+", playRequested "+playRequested+", device "+deviceSpecifier+", ctx "+toHexString(ctxHash)+", alSource "+alSrcName+
+ ", chosen "+chosenFormat+
+ ", al[chan "+ALHelpers.alChannelLayoutName(alChannelLayout)+", type "+ALHelpers.alSampleTypeName(alSampleType)+
+ ", fmt "+toHexString(alFormat)+", soft "+hasSOFTBufferSamples+
+ "], playSpeed "+playSpeed+", buffers[total "+alBuffersLen+", avail "+alFramesAvail.size()+", "+
+ "queued["+alFramesPlaying.size()+", apts "+getPTS()+", "+getQueuedTime() + " ms, " + alBufferBytesQueued+" bytes], "+
+ "queue[g "+frameGrowAmount+", l "+frameLimit+"]";
}
- @Override
- public AudioDataFormat getPreferredFormat() {
- return DefaultFormat;
+ public final String getPerfString() {
+ final int alBuffersLen = null != alBufferNames ? alBufferNames.length : 0;
+ return "Play [buffer "+alFramesPlaying.size()+"/"+alBuffersLen+", apts "+getPTS()+", "+getQueuedTime() + " ms, " + alBufferBytesQueued+" bytes]";
}
@Override
- public AudioDataFormat initSink(AudioDataFormat requestedFormat, int bufferCount) {
+ public final AudioFormat getPreferredFormat() {
if( !staticAvailable ) {
return null;
}
- samplePeriod = 1.0f / requestedFormat.sampleRate;
- bufferPeriod = samplePeriod * SAMPLES_PER_BUFFER;
- switch( requestedFormat.channelCount ) {
- case 1: {
- switch ( requestedFormat.sampleSize ) {
- case 8:
- alFormat = AL.AL_FORMAT_MONO8; break;
- case 16:
- alFormat = AL.AL_FORMAT_MONO16; break;
- default:
- return null;
- }
- } break;
- case 2:
- switch ( requestedFormat.sampleSize ) {
- case 8:
- alFormat = AL.AL_FORMAT_STEREO8; break;
- case 16:
- alFormat = AL.AL_FORMAT_STEREO16; break;
- default:
- return null;
+ return preferredAudioFormat;
+ }
+
+ @Override
+ public final int getMaxSupportedChannels() {
+ if( !staticAvailable ) {
+ return 0;
+ }
+ return hasSOFTBufferSamples ? 8 : 2;
+ }
+
+ @Override
+ public final boolean isSupported(AudioFormat format) {
+ if( !staticAvailable ) {
+ return false;
+ }
+ if( format.planar || !format.littleEndian ) {
+ // FIXME big-endian supported w/ SOFT where it's native format!
+ return false;
+ }
+ final int alChannelLayout = ALHelpers.getDefaultALChannelLayout(format.channelCount);
+ if( AL.AL_NONE != alChannelLayout ) {
+ final int alSampleType = ALHelpers.getALSampleType(format.sampleSize, format.signed, format.fixedP);
+ if( AL.AL_NONE != alSampleType ) {
+ lockContext();
+ try {
+ final int alFormat = ALHelpers.getALFormat(alChannelLayout, alSampleType, hasSOFTBufferSamples, al, alExt);
+ return AL.AL_NONE != alFormat;
+ } finally {
+ unlockContext();
}
+ }
}
- // Allocate buffers
- destroyBuffers();
- {
- alBuffers = new int[bufferCount];
- al.alGenBuffers(bufferCount, alBuffers, 0);
- final int err = al.alGetError();
- if( err != AL.AL_NO_ERROR ) {
- alBuffers = null;
- throw new RuntimeException("ALAudioSink: Error generating Buffers: 0x"+Integer.toHexString(err));
+ return false;
+ }
+
+ @Override
+ public final boolean init(AudioFormat requestedFormat, float frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit) {
+ if( !staticAvailable ) {
+ return false;
+ }
+ alChannelLayout = ALHelpers.getDefaultALChannelLayout(requestedFormat.channelCount);
+ alSampleType = ALHelpers.getALSampleType(requestedFormat.sampleSize, requestedFormat.signed, requestedFormat.fixedP);
+ lockContext();
+ try {
+ if( AL.AL_NONE != alChannelLayout && AL.AL_NONE != alSampleType ) {
+ alFormat = ALHelpers.getALFormat(alChannelLayout, alSampleType, hasSOFTBufferSamples, al, alExt);
+ } else {
+ alFormat = AL.AL_NONE;
+ }
+ if( AL.AL_NONE == alFormat ) {
+ // not supported
+ return false;
}
- final Integer[] alBufferRingArray = new Integer[bufferCount];
- for(int i=0; i<bufferCount; i++) {
- alBufferRingArray[i] = Integer.valueOf(alBuffers[i]);
+ // Allocate buffers
+ destroyBuffers();
+ {
+ final float useFrameDuration = frameDuration > 1f ? frameDuration : AudioSink.DefaultFrameDuration;
+ final int initialFrameCount = requestedFormat.getFrameCount(
+ initialQueueSize > 0 ? initialQueueSize : AudioSink.DefaultInitialQueueSize, useFrameDuration);
+ // frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit) {
+ alBufferNames = new int[initialFrameCount];
+ al.alGenBuffers(initialFrameCount, alBufferNames, 0);
+ final int err = al.alGetError();
+ if( err != AL.AL_NO_ERROR ) {
+ alBufferNames = null;
+ throw new RuntimeException("ALAudioSink: Error generating Buffers: 0x"+Integer.toHexString(err));
+ }
+ final ALAudioFrame[] alFrames = new ALAudioFrame[initialFrameCount];
+ for(int i=0; i<initialFrameCount; i++) {
+ alFrames[i] = new ALAudioFrame(alBufferNames[i]);
+ }
+
+ alFramesAvail = new LFRingbuffer<ALAudioFrame>(alFrames);
+ alFramesPlaying = new LFRingbuffer<ALAudioFrame>(ALAudioFrame[].class, initialFrameCount);
+ this.frameGrowAmount = requestedFormat.getFrameCount(
+ queueGrowAmount > 0 ? queueGrowAmount : AudioSink.DefaultQueueGrowAmount, useFrameDuration);
+ this.frameLimit = requestedFormat.getFrameCount(
+ queueLimit > 0 ? queueLimit : AudioSink.DefaultQueueLimitWithVideo, useFrameDuration);
}
- alBufferAvail = new SyncedRingbuffer<Integer>(alBufferRingArray, true /* full */);
- alBufferPlaying = new SyncedRingbuffer<ActiveBuffer>(new ActiveBuffer[bufferCount], false /* full */);
+ } finally {
+ unlockContext();
}
-
chosenFormat = requestedFormat;
- return chosenFormat;
+ return true;
+ }
+
+ private static int[] concat(int[] first, int[] second) {
+ final int[] result = Arrays.copyOf(first, first.length + second.length);
+ System.arraycopy(second, 0, result, first.length, second.length);
+ return result;
+ }
+ /**
+ private static <T> T[] concat(T[] first, T[] second) {
+ final T[] result = Arrays.copyOf(first, first.length + second.length);
+ System.arraycopy(second, 0, result, first.length, second.length);
+ return result;
+ } */
+
+ private boolean growBuffers() {
+ if( !alFramesAvail.isEmpty() || !alFramesPlaying.isFull() ) {
+ throw new InternalError("Buffers: Avail is !empty "+alFramesAvail+" or Playing is !full "+alFramesPlaying);
+ }
+ if( alFramesAvail.capacity() >= frameLimit || alFramesPlaying.capacity() >= frameLimit ) {
+ if( DEBUG ) {
+ System.err.println(getThreadName()+": ALAudioSink.growBuffers: Frame limit "+frameLimit+" reached: Avail "+alFramesAvail+", Playing "+alFramesPlaying);
+ }
+ return false;
+ }
+
+ final int[] newALBufferNames = new int[frameGrowAmount];
+ al.alGenBuffers(frameGrowAmount, newALBufferNames, 0);
+ final int err = al.alGetError();
+ if( err != AL.AL_NO_ERROR ) {
+ if( DEBUG ) {
+ System.err.println(getThreadName()+": ALAudioSink.growBuffers: Error generating "+frameGrowAmount+" new Buffers: 0x"+Integer.toHexString(err));
+ }
+ return false;
+ }
+ alBufferNames = concat(alBufferNames, newALBufferNames);
+
+ final ALAudioFrame[] newALBuffers = new ALAudioFrame[frameGrowAmount];
+ for(int i=0; i<frameGrowAmount; i++) {
+ newALBuffers[i] = new ALAudioFrame(newALBufferNames[i]);
+ }
+ // alFrames = concat(alFrames , newALBuffers);
+
+ alFramesAvail.growEmptyBuffer(newALBuffers);
+ alFramesPlaying.growFullBuffer(frameGrowAmount);
+ if( alFramesAvail.isEmpty() || alFramesPlaying.isFull() ) {
+ throw new InternalError("Buffers: Avail is empty "+alFramesAvail+" or Playing is full "+alFramesPlaying);
+ }
+ if( DEBUG ) {
+ System.err.println(getThreadName()+": ALAudioSink: Buffer grown "+frameGrowAmount+": Avail "+alFramesAvail+", playing "+alFramesPlaying);
+ }
+ return true;
}
private void destroyBuffers() {
if( !staticAvailable ) {
return;
}
- if( null != alBuffers ) {
+ if( null != alBufferNames ) {
try {
- al.alDeleteBuffers(alBufferAvail.capacity(), alBuffers, 0);
+ al.alDeleteBuffers(alBufferNames.length, alBufferNames, 0);
} catch (Throwable t) {
if( DEBUG ) {
System.err.println("Catched "+t.getClass().getName()+": "+t.getMessage());
t.printStackTrace();
}
}
- alBufferAvail.clear(true);
- alBufferAvail = null;
- alBufferPlaying.clear(true);
- alBufferPlaying = null;
+ alFramesAvail.clear();
+ alFramesAvail = null;
+ alFramesPlaying.clear();
+ alFramesPlaying = null;
alBufferBytesQueued = 0;
- alBuffers = null;
+ // alFrames = null;
+ alBufferNames = null;
}
}
@Override
- public void destroy() {
+ public final void destroy() {
initialized = false;
if( !staticAvailable ) {
return;
}
- if( null != alSource ) {
- try {
- al.alDeleteSources(1, alSource, 0);
- } catch (Throwable t) {
- if( DEBUG ) {
- System.err.println("Catched "+t.getClass().getName()+": "+t.getMessage());
- t.printStackTrace();
- }
- }
- alSource = null;
- }
-
- destroyBuffers();
-
if( null != context ) {
- try {
- alc.alcDestroyContext(context);
- } catch (Throwable t) {
- if( DEBUG ) {
- System.err.println("Catched "+t.getClass().getName()+": "+t.getMessage());
- t.printStackTrace();
+ lockContext();
+ }
+ try {
+ stopImpl();
+ if( null != alSource ) {
+ try {
+ al.alDeleteSources(1, alSource, 0);
+ } catch (Throwable t) {
+ if( DEBUG ) {
+ System.err.println("Catched "+t.getClass().getName()+": "+t.getMessage());
+ t.printStackTrace();
+ }
}
+ alSource = null;
}
- context = null;
+
+ destroyBuffers();
+ } finally {
+ destroyContext();
}
if( null != device ) {
try {
@@ -289,140 +465,385 @@ public class ALAudioSink implements AudioSink {
}
@Override
- public boolean isInitialized() {
+ public final boolean isInitialized() {
return initialized;
}
- private final void dequeueBuffer(boolean wait) {
+ private final int dequeueBuffer(boolean flush, boolean wait) {
int alErr = AL.AL_NO_ERROR;
- final int[] val=new int[1];
- do {
- al.alGetSourcei(alSource[0], AL.AL_BUFFERS_PROCESSED, val, 0);
- alErr = al.alGetError();
- if( AL.AL_NO_ERROR != alErr ) {
- throw new RuntimeException("ALError "+toHexString(alErr)+" while quering processed buffers at source. "+this);
- }
- if( wait && val[0] <= 0 ) {
- try {
- Thread.sleep(1);
- } catch (InterruptedException e){
+ final int releaseBufferCount;
+ if( flush ) {
+ releaseBufferCount = alFramesPlaying.size();
+ } else if( alBufferBytesQueued > 0 ) {
+ final int releaseBufferLimes = Math.max(1, alFramesPlaying.size() / 4 );
+ final int[] val=new int[1];
+ int i=0;
+ do {
+ al.alGetSourcei(alSource[0], AL.AL_BUFFERS_PROCESSED, val, 0);
+ alErr = al.alGetError();
+ if( AL.AL_NO_ERROR != alErr ) {
+ throw new RuntimeException("ALError "+toHexString(alErr)+" while quering processed buffers at source. "+this);
}
- }
- } while (val[0] <= 0);
- final int processedBuffers = val[0];
+ if( wait && val[0] < releaseBufferLimes ) {
+ i++;
+ // clip wait at [2 .. 100] ms
+ final int avgBufferDura = chosenFormat.getBytesDuration( alBufferBytesQueued / alFramesPlaying.size() );
+ final int sleep = Math.max(2, Math.min(100, releaseBufferLimes * avgBufferDura));
+ if( DEBUG || true ) {
+ System.err.println(getThreadName()+": ALAudioSink: Dequeue.wait["+i+"]: avgBufferDura "+avgBufferDura+", releaseBufferLimes "+releaseBufferLimes+", sleep "+sleep+" ms, playImpl "+isPlayingImpl1()+", processed "+val[0]+", "+this);
+ }
+ unlockContext();
+ try {
+ Thread.sleep( sleep - 1 );
+ } catch (InterruptedException e) {
+ } finally {
+ lockContext();
+ }
+ }
+ } while ( wait && val[0] < releaseBufferLimes && alBufferBytesQueued > 0 );
+ releaseBufferCount = val[0];
+ } else {
+ releaseBufferCount = 0;
+ }
- if( processedBuffers > 0 ) {
- int[] buffers=new int[processedBuffers];
- al.alSourceUnqueueBuffers(alSource[0], processedBuffers, buffers, 0);
+ if( releaseBufferCount > 0 ) {
+ int[] buffers=new int[releaseBufferCount];
+ al.alSourceUnqueueBuffers(alSource[0], releaseBufferCount, buffers, 0);
alErr = al.alGetError();
if( AL.AL_NO_ERROR != alErr ) {
- throw new RuntimeException("ALError "+toHexString(alErr)+" while dequeueing "+processedBuffers+" processed buffers. "+this);
+ throw new RuntimeException("ALError "+toHexString(alErr)+" while dequeueing "+releaseBufferCount+" buffers. "+this);
}
- for ( int i=0; i<processedBuffers; i++ ) {
- final ActiveBuffer releasedBuffer = alBufferPlaying.get(true /* clearRef */);
+ for ( int i=0; i<releaseBufferCount; i++ ) {
+ final ALAudioFrame releasedBuffer = alFramesPlaying.get();
if( null == releasedBuffer ) {
throw new InternalError("Internal Error: "+this);
}
- if( releasedBuffer.name.intValue() != buffers[i] ) {
- throw new InternalError("Buffer name mismatch: dequeued: "+buffers[i]+", released "+releasedBuffer);
- // System.err.println("XXX ["+i+"]: dequeued: "+buffers[i]+", released "+releasedBuffer);
+ if( releasedBuffer.alBuffer != buffers[i] ) {
+ alFramesAvail.dump(System.err, "Avail-deq02-post");
+ alFramesPlaying.dump(System.err, "Playi-deq02-post");
+ throw new InternalError("Buffer name mismatch: dequeued: "+buffers[i]+", released "+releasedBuffer+", "+this);
}
- alBufferBytesQueued -= releasedBuffer.size;
- if( !alBufferAvail.put(releasedBuffer.name) ) {
+ alBufferBytesQueued -= releasedBuffer.getByteSize();
+ if( !alFramesAvail.put(releasedBuffer) ) {
throw new InternalError("Internal Error: "+this);
}
- if( DEBUG ) {
- System.err.println("ALAudioSink: Dequeued "+processedBuffers+", wait "+wait+", "+this);
- }
+ }
+ if( flush && ( !alFramesAvail.isFull() || !alFramesPlaying.isEmpty() ) ) {
+ alFramesAvail.dump(System.err, "Avail-deq03-post");
+ alFramesPlaying.dump(System.err, "Playi-deq03-post");
+ throw new InternalError("Flush failure: "+this);
+ }
+ }
+ return releaseBufferCount;
+ }
+
+ private final int dequeueBuffer(boolean wait, int inPTS, int inDuration) {
+ final int dequeuedBufferCount = dequeueBuffer( false /* flush */, wait );
+ final ALAudioFrame currentBuffer = alFramesPlaying.peek();
+ if( null != currentBuffer ) {
+ playingPTS = currentBuffer.getPTS();
+ } else {
+ playingPTS = inPTS;
+ }
+ if( DEBUG ) {
+ if( dequeuedBufferCount > 0 ) {
+ System.err.println(getThreadName()+": ALAudioSink: Write "+inPTS+", "+inDuration+" ms, dequeued "+dequeuedBufferCount+", wait "+wait+", "+getPerfString());
}
}
+ return dequeuedBufferCount;
}
- private static final String toHexString(int v) {
- return "0x"+Integer.toHexString(v);
+ @Override
+ public final AudioFrame enqueueData(AudioDataFrame audioDataFrame) {
+ return enqueueData(audioDataFrame.getPTS(), audioDataFrame.getData(), audioDataFrame.getByteSize());
}
-
+
@Override
- public void writeData(AudioFrame audioFrame) {
+ public final AudioFrame enqueueData(int pts, ByteBuffer bytes, int byteCount) {
if( !initialized || null == chosenFormat ) {
- return;
+ return null;
}
+ final ALAudioFrame alFrame;
int alErr = AL.AL_NO_ERROR;
// OpenAL consumes buffers in the background
// we first need to initialize the OpenAL buffers then
// start continuous playback.
- alc.alcMakeContextCurrent(context);
- alErr = al.alGetError();
- if(al.alGetError() != AL.AL_NO_ERROR) {
- throw new RuntimeException("ALError "+toHexString(alErr)+" while makeCurrent. "+this);
+ lockContext();
+ try {
+ alErr = al.alGetError();
+ if(al.alGetError() != AL.AL_NO_ERROR) {
+ throw new RuntimeException("ALError "+toHexString(alErr)+" while makeCurrent. "+this);
+ }
+
+ final int duration = chosenFormat.getBytesDuration(byteCount);
+ final boolean dequeueDone;
+ if( alFramesAvail.isEmpty() ) {
+ // try to dequeue first
+ dequeueDone = dequeueBuffer(false, pts, duration) > 0;
+ if( alFramesAvail.isEmpty() ) {
+ // try to grow
+ growBuffers();
+ }
+ } else {
+ dequeueDone = false;
+ }
+ if( !dequeueDone && alFramesPlaying.size() > 0 ) { // dequeue only possible if playing ..
+ final boolean wait = isPlayingImpl0() && alFramesAvail.isEmpty(); // possible if grow failed or already exceeds it's limit!
+ dequeueBuffer(wait, pts, duration);
+ }
+
+ alFrame = alFramesAvail.get();
+ if( null == alFrame ) {
+ alFramesAvail.dump(System.err, "Avail");
+ throw new InternalError("Internal Error: avail.get null "+alFramesAvail+", "+this);
+ }
+ alFrame.setPTS(pts);
+ alFrame.setDuration(duration);
+ alFrame.setByteSize(byteCount);
+ if( !alFramesPlaying.put( alFrame ) ) {
+ throw new InternalError("Internal Error: "+this);
+ }
+ if( hasSOFTBufferSamples ) {
+ final int samplesPerChannel = chosenFormat.getBytesSampleCount(byteCount) / chosenFormat.channelCount;
+ // final int samplesPerChannel = ALHelpers.bytesToSampleCount(byteCount, alChannelLayout, alSampleType);
+ alExt.alBufferSamplesSOFT(alFrame.alBuffer, chosenFormat.sampleRate, alFormat,
+ samplesPerChannel, alChannelLayout, alSampleType, bytes);
+ } else {
+ al.alBufferData(alFrame.alBuffer, alFormat, bytes, byteCount, chosenFormat.sampleRate);
+ }
+
+ final int[] alBufferNames = new int[] { alFrame.alBuffer };
+ al.alSourceQueueBuffers(alSource[0], 1, alBufferNames, 0);
+ alErr = al.alGetError();
+ if(al.alGetError() != AL.AL_NO_ERROR) {
+ throw new RuntimeException("ALError "+toHexString(alErr)+" while queueing buffer "+toHexString(alBufferNames[0])+". "+this);
+ }
+ alBufferBytesQueued += byteCount;
+ enqueuedFrameCount++;
+
+ playImpl(); // continue playing, fixes issue where we ran out of enqueued data!
+ } finally {
+ unlockContext();
}
-
- if( alBufferAvail.isEmpty() ) {
- dequeueBuffer(true);
+ return alFrame;
+ }
+
+ @Override
+ public final boolean isPlaying() {
+ if( !initialized || null == chosenFormat ) {
+ return false;
}
-
- final Integer alBufferName = alBufferAvail.get(true /* clearRef */);
- if( null == alBufferName ) {
- throw new InternalError("Internal Error: "+this);
+ if( playRequested ) {
+ lockContext();
+ try {
+ return isPlayingImpl0();
+ } finally {
+ unlockContext();
+ }
+ } else {
+ return false;
}
- if( !alBufferPlaying.put( new ActiveBuffer(alBufferName, audioFrame.dataSize) ) ) {
- throw new InternalError("Internal Error: "+this);
+ }
+ private final boolean isPlayingImpl0() {
+ if( playRequested ) {
+ return isPlayingImpl1();
+ } else {
+ return false;
}
- al.alBufferData(alBufferName.intValue(), alFormat, audioFrame.data, audioFrame.dataSize, chosenFormat.sampleRate);
- final int[] alBufferNames = new int[] { alBufferName.intValue() };
- al.alSourceQueueBuffers(alSource[0], 1, alBufferNames, 0);
- alErr = al.alGetError();
+ }
+ private final boolean isPlayingImpl1() {
+ final int[] val = new int[1];
+ al.alGetSourcei(alSource[0], AL.AL_SOURCE_STATE, val, 0);
+ final int alErr = al.alGetError();
if(al.alGetError() != AL.AL_NO_ERROR) {
- throw new RuntimeException("ALError "+toHexString(alErr)+" while queueing buffer "+toHexString(alBufferNames[0])+". "+this);
+ throw new RuntimeException("ALError "+toHexString(alErr)+" while querying isPlaying. "+this);
}
- alBufferBytesQueued += audioFrame.dataSize;
-
- // Restart openal playback if needed
- {
- int[] val = new int[1];
- al.alGetSourcei(alSource[0], AL.AL_SOURCE_STATE, val, 0);
- if(val[0] != AL.AL_PLAYING) {
+ return val[0] == AL.AL_PLAYING;
+ }
+
+ @Override
+ public final void play() {
+ if( !initialized || null == chosenFormat ) {
+ return;
+ }
+ playRequested = true;
+ lockContext();
+ try {
+ playImpl();
+ if( DEBUG ) {
+ System.err.println(getThreadName()+": ALAudioSink: PLAY playImpl "+isPlayingImpl1()+", "+this);
+ }
+ } finally {
+ unlockContext();
+ }
+ }
+ private final void playImpl() {
+ if( playRequested && !isPlayingImpl1() ) {
+ al.alSourcePlay(alSource[0]);
+ final int alErr = al.alGetError();
+ if(al.alGetError() != AL.AL_NO_ERROR) {
+ throw new RuntimeException("ALError "+toHexString(alErr)+" while start playing. "+this);
+ }
+ }
+ }
+
+ @Override
+ public final void pause() {
+ if( !initialized || null == chosenFormat ) {
+ return;
+ }
+ if( playRequested ) {
+ lockContext();
+ try {
+ pauseImpl();
if( DEBUG ) {
- System.err.println("ALAudioSink: Start playing: "+this);
- }
- al.alSourcePlay(alSource[0]);
- alErr = al.alGetError();
- if(al.alGetError() != AL.AL_NO_ERROR) {
- throw new RuntimeException("ALError "+toHexString(alErr)+" while start playing. "+this);
- }
+ System.err.println(getThreadName()+": ALAudioSink: PAUSE playImpl "+isPlayingImpl1()+", "+this);
+ }
+ } finally {
+ unlockContext();
}
}
}
-
+ private final void pauseImpl() {
+ if( isPlayingImpl0() ) {
+ playRequested = false;
+ al.alSourcePause(alSource[0]);
+ final int alErr = al.alGetError();
+ if(al.alGetError() != AL.AL_NO_ERROR) {
+ throw new RuntimeException("ALError "+toHexString(alErr)+" while pausing. "+this);
+ }
+ }
+ }
+ private final void stopImpl() {
+ if( isPlayingImpl0() ) {
+ playRequested = false;
+ al.alSourceStop(alSource[0]);
+ final int alErr = al.alGetError();
+ if(al.alGetError() != AL.AL_NO_ERROR) {
+ throw new RuntimeException("ALError "+toHexString(alErr)+" while pausing. "+this);
+ }
+ }
+ }
+
+ @Override
+ public final float getPlaySpeed() { return playSpeed; }
+
+ @Override
+ public final boolean setPlaySpeed(float rate) {
+ if( !initialized || null == chosenFormat ) {
+ return false;
+ }
+ lockContext();
+ try {
+ if( Math.abs(1.0f - rate) < 0.01f ) {
+ rate = 1.0f;
+ }
+ if( 0.5f <= rate && rate <= 2.0f ) { // OpenAL limits
+ playSpeed = rate;
+ al.alSourcef(alSource[0], AL.AL_PITCH, playSpeed);
+ return true;
+ }
+ } finally {
+ unlockContext();
+ }
+ return false;
+ }
+
+ @Override
+ public final float getVolume() {
+ return volume;
+ }
+
+ @Override
+ public final boolean setVolume(float v) {
+ if( !initialized || null == chosenFormat ) {
+ return false;
+ }
+ lockContext();
+ try {
+ if( Math.abs(v) < 0.01f ) {
+ v = 0.0f;
+ } else if( Math.abs(1.0f - v) < 0.01f ) {
+ v = 1.0f;
+ }
+ if( 0.0f <= v && v <= 1.0f ) { // OpenAL limits
+ volume = v;
+ al.alSourcef(alSource[0], AL.AL_GAIN, v);
+ return true;
+ }
+ } finally {
+ unlockContext();
+ }
+ return false;
+ }
+
+ @Override
+ public final void flush() {
+ if( !initialized || null == chosenFormat ) {
+ return;
+ }
+ lockContext();
+ try {
+ // pauseImpl();
+ stopImpl();
+ dequeueBuffer( true /* flush */, false /* wait */ );
+ if( alBufferNames.length != alFramesAvail.size() || alFramesPlaying.size() != 0 ) {
+ throw new InternalError("XXX: "+this);
+ }
+ if( DEBUG ) {
+ System.err.println(getThreadName()+": ALAudioSink: FLUSH playImpl "+isPlayingImpl1()+", "+this);
+ }
+ } finally {
+ unlockContext();
+ }
+ }
+
+ @Override
+ public final int getEnqueuedFrameCount() {
+ return enqueuedFrameCount;
+ }
+
+ @Override
+ public final int getFrameCount() {
+ return null != alBufferNames ? alBufferNames.length : 0;
+ }
+
@Override
- public int getQueuedByteCount() {
+ public final int getQueuedFrameCount() {
if( !initialized || null == chosenFormat ) {
return 0;
}
- return alBufferBytesQueued;
+ return alFramesPlaying.size();
}
@Override
- public int getQueuedTime() {
+ public final int getFreeFrameCount() {
if( !initialized || null == chosenFormat ) {
return 0;
}
- final int bps = chosenFormat.sampleSize / 8;
- return alBufferBytesQueued / ( chosenFormat.channelCount * bps * ( chosenFormat.sampleRate / 1000 ) );
+ return alFramesAvail.size();
}
@Override
- public int getWritableBufferCount() {
+ public final int getQueuedByteCount() {
if( !initialized || null == chosenFormat ) {
return 0;
}
- return alBufferPlaying.getFreeSlots();
+ return alBufferBytesQueued;
}
@Override
- public boolean isDataAvailable(int data_size) {
- return initialized && null != chosenFormat;
+ public final int getQueuedTime() {
+ if( !initialized || null == chosenFormat ) {
+ return 0;
+ }
+ return chosenFormat.getBytesDuration(alBufferBytesQueued);
}
+ @Override
+ public final int getPTS() { return playingPTS; }
+
+ private static final String toHexString(int v) { return "0x"+Integer.toHexString(v); }
+ private static final String getThreadName() { return Thread.currentThread().getName(); }
}
diff --git a/src/jogl/classes/jogamp/opengl/openal/av/ALDummyUsage.java b/src/jogl/classes/jogamp/opengl/openal/av/ALDummyUsage.java
index 69223d0..2c1dfa2 100644
--- a/src/jogl/classes/jogamp/opengl/openal/av/ALDummyUsage.java
+++ b/src/jogl/classes/jogamp/opengl/openal/av/ALDummyUsage.java
@@ -1,7 +1,5 @@
package jogamp.opengl.openal.av;
-import jogamp.opengl.util.av.impl.FFMPEGMediaPlayer;
-
import com.jogamp.openal.AL;
import com.jogamp.openal.JoalVersion;
@@ -10,7 +8,6 @@ import com.jogamp.openal.JoalVersion;
*/
public class ALDummyUsage {
static AL al;
- static FFMPEGMediaPlayer.PixelFormat pfmt;
public static void main(String args[]) {
System.err.println("JOGL> Hello JOAL");
diff --git a/src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java
index 1a4ca34..810a928 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java
@@ -37,22 +37,22 @@ import javax.media.opengl.*;
*/
public interface GLArrayHandler {
-
+
/**
- * if <code>bind</code> is true and the data uses VBO,
+ * if <code>bind</code> is true and the data uses VBO,
* the latter will be bound and data written to the GPU if required.
* <p>
* If <code>bind</code> is false and the data uses VBO,
* the latter will be unbound.
* </p>
- *
+ *
* @param gl current GL object
- * @param bind true if VBO shall be bound and data written,
+ * @param bind true if VBO shall be bound and data written,
* otherwise clear VBO binding.
- * @return true if data uses VBO and action was performed, otherwise false
+ * @return true if data uses VBO and action was performed, otherwise false
*/
public boolean bindBuffer(GL gl, boolean bind);
-
+
/**
* Implementation shall enable or disable the array state.
* <p>
@@ -60,23 +60,23 @@ public interface GLArrayHandler {
* implementation shall synchronize the data with the GPU
* and associate the data with the array.
* </p>
- *
+ *
* @param gl current GL object
* @param enable true if array shall be enabled, otherwise false.
- * @param ext extension object allowing passing of an implementation detail
+ * @param ext extension object allowing passing of an implementation detail
*/
public void enableState(GL gl, boolean enable, Object ext);
-
+
/**
- * Supporting interleaved arrays, where sub handlers may handle
+ * Supporting interleaved arrays, where sub handlers may handle
* the array state and the <i>master</i> handler the buffer consistency.
- *
+ *
* @param handler the sub handler
* @throws UnsupportedOperationException if this array handler does not support interleaved arrays
*/
public void addSubHandler(GLArrayHandlerFlat handler) throws UnsupportedOperationException;
public void setSubArrayVBOName(int vboName);
-
+
}
diff --git a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java
index 4a8f406..179142f 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java
@@ -39,21 +39,21 @@ public interface GLArrayHandlerFlat {
/**
* Implementation shall associate the data with the array
- *
+ *
* @param gl current GL object
- * @param ext extension object allowing passing of an implementation detail
+ * @param ext extension object allowing passing of an implementation detail
*/
public void syncData(GL gl, Object ext);
-
+
/**
* Implementation shall enable or disable the array state.
- *
+ *
* @param gl current GL object
* @param enable true if array shall be enabled, otherwise false.
- * @param ext extension object allowing passing of an implementation detail
+ * @param ext extension object allowing passing of an implementation detail
*/
- public void enableState(GL gl, boolean enable, Object ext);
-
+ public void enableState(GL gl, boolean enable, Object ext);
+
public GLArrayDataWrapper getData();
}
diff --git a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java
index 98f711b..89e01ed 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java
@@ -36,22 +36,24 @@ import javax.media.opengl.GL;
import com.jogamp.opengl.util.GLArrayDataEditable;
/**
- * Interleaved fixed function arrays, i.e. where this buffer data
- * represents many arrays.
+ * Interleaved fixed function arrays, i.e. where this buffer data
+ * represents many arrays.
*/
-public class GLArrayHandlerInterleaved extends GLVBOArrayHandler implements GLArrayHandler {
- private List<GLArrayHandlerFlat> subArrays = new ArrayList<GLArrayHandlerFlat>();
+public class GLArrayHandlerInterleaved extends GLVBOArrayHandler {
+ private final List<GLArrayHandlerFlat> subArrays = new ArrayList<GLArrayHandlerFlat>();
public GLArrayHandlerInterleaved(GLArrayDataEditable ad) {
super(ad);
}
-
+
+ @Override
public final void setSubArrayVBOName(int vboName) {
for(int i=0; i<subArrays.size(); i++) {
subArrays.get(i).getData().setVBOName(vboName);
- }
+ }
}
-
+
+ @Override
public final void addSubHandler(GLArrayHandlerFlat handler) {
subArrays.add(handler);
}
@@ -59,20 +61,21 @@ public class GLArrayHandlerInterleaved extends GLVBOArrayHandler implements GLAr
private final void syncSubData(GL gl, Object ext) {
for(int i=0; i<subArrays.size(); i++) {
subArrays.get(i).syncData(gl, ext);
- }
- }
-
+ }
+ }
+
+ @Override
public final void enableState(GL gl, boolean enable, Object ext) {
if(enable) {
final boolean vboBound = bindBuffer(gl, true);
syncSubData(gl, ext);
if(vboBound) {
bindBuffer(gl, false);
- }
+ }
}
for(int i=0; i<subArrays.size(); i++) {
subArrays.get(i).enableState(gl, enable, ext);
- }
+ }
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java
index 862d49d..8a58798 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java
@@ -35,24 +35,27 @@ import com.jogamp.opengl.util.GLArrayDataEditable;
/**
- * Used for pure VBO data arrays, i.e. where the buffer data
- * does not represents a specific array name.
+ * Used for pure VBO data arrays, i.e. where the buffer data
+ * does not represents a specific array name.
*/
-public class GLDataArrayHandler extends GLVBOArrayHandler implements GLArrayHandler {
+public class GLDataArrayHandler extends GLVBOArrayHandler {
public GLDataArrayHandler(GLArrayDataEditable ad) {
super(ad);
}
+ @Override
public final void setSubArrayVBOName(int vboName) {
throw new UnsupportedOperationException();
}
-
+
+ @Override
public final void addSubHandler(GLArrayHandlerFlat handler) {
throw new UnsupportedOperationException();
}
-
- public final void enableState(GL gl, boolean enable, Object ext) {
+
+ @Override
+ public final void enableState(GL gl, boolean enable, Object ext) {
if(enable) {
if(!ad.isVBO()) {
// makes no sense otherwise
diff --git a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java
index 32bba89..7f7a99a 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java
@@ -35,22 +35,25 @@ import javax.media.opengl.fixedfunc.GLPointerFunc;
import com.jogamp.opengl.util.GLArrayDataEditable;
/**
- * Used for 1:1 fixed function arrays, i.e. where the buffer data
- * represents this array only.
+ * Used for 1:1 fixed function arrays, i.e. where the buffer data
+ * represents this array only.
*/
-public class GLFixedArrayHandler extends GLVBOArrayHandler implements GLArrayHandler {
+public class GLFixedArrayHandler extends GLVBOArrayHandler {
public GLFixedArrayHandler(GLArrayDataEditable ad) {
super(ad);
}
-
+
+ @Override
public final void setSubArrayVBOName(int vboName) {
throw new UnsupportedOperationException();
}
-
+
+ @Override
public final void addSubHandler(GLArrayHandlerFlat handler) {
throw new UnsupportedOperationException();
}
-
+
+ @Override
public final void enableState(GL gl, boolean enable, Object ext) {
final GLPointerFunc glp = gl.getGL2ES1();
if(enable) {
@@ -69,12 +72,12 @@ public class GLFixedArrayHandler extends GLVBOArrayHandler implements GLArrayHan
glp.glTexCoordPointer(ad);
break;
default:
- throw new GLException("invalid glArrayIndex: "+ad.getIndex()+":\n\t"+ad);
+ throw new GLException("invalid glArrayIndex: "+ad.getIndex()+":\n\t"+ad);
}
if(vboBound) {
bindBuffer(gl, false);
- }
- glp.glEnableClientState(ad.getIndex());
+ }
+ glp.glEnableClientState(ad.getIndex());
} else {
glp.glDisableClientState(ad.getIndex());
}
diff --git a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java
index ff1813b..acec051 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java
@@ -35,7 +35,7 @@ import javax.media.opengl.fixedfunc.GLPointerFunc;
import com.jogamp.opengl.util.GLArrayDataWrapper;
/**
- * Used for interleaved fixed function arrays, i.e. where the buffer data itself is handled
+ * Used for interleaved fixed function arrays, i.e. where the buffer data itself is handled
* separately and interleaves many arrays.
*/
public class GLFixedArrayHandlerFlat implements GLArrayHandlerFlat {
@@ -45,10 +45,12 @@ public class GLFixedArrayHandlerFlat implements GLArrayHandlerFlat {
this.ad = ad;
}
+ @Override
public GLArrayDataWrapper getData() {
return ad;
}
-
+
+ @Override
public final void syncData(GL gl, Object ext) {
final GLPointerFunc glp = gl.getGL2ES1();
switch(ad.getIndex()) {
@@ -65,14 +67,15 @@ public class GLFixedArrayHandlerFlat implements GLArrayHandlerFlat {
glp.glTexCoordPointer(ad);
break;
default:
- throw new GLException("invalid glArrayIndex: "+ad.getIndex()+":\n\t"+ad);
+ throw new GLException("invalid glArrayIndex: "+ad.getIndex()+":\n\t"+ad);
}
}
+ @Override
public final void enableState(GL gl, boolean enable, Object ext) {
final GLPointerFunc glp = gl.getGL2ES1();
if(enable) {
- glp.glEnableClientState(ad.getIndex());
+ glp.glEnableClientState(ad.getIndex());
} else {
glp.glDisableClientState(ad.getIndex());
}
diff --git a/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java
index ad88a70..5198cac 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java
@@ -28,18 +28,15 @@
package jogamp.opengl.util;
-
import java.nio.Buffer;
-import java.util.ArrayList;
-import java.util.List;
import javax.media.opengl.GL;
import com.jogamp.opengl.util.GLArrayDataEditable;
/**
- * Interleaved fixed function arrays, i.e. where this buffer data
- * represents many arrays.
+ * Interleaved fixed function arrays, i.e. where this buffer data
+ * represents many arrays.
*/
public abstract class GLVBOArrayHandler implements GLArrayHandler {
protected GLArrayDataEditable ad;
@@ -47,13 +44,14 @@ public abstract class GLVBOArrayHandler implements GLArrayHandler {
public GLVBOArrayHandler(GLArrayDataEditable ad) {
this.ad = ad;
}
-
+
+ @Override
public final boolean bindBuffer(GL gl, boolean bind) {
if( !ad.isVBO() ) {
return false;
}
if(bind) {
- // always bind and refresh the VBO mgr,
+ // always bind and refresh the VBO mgr,
// in case more than one gl*Pointer objects are in use
gl.glBindBuffer(ad.getVBOTarget(), ad.getVBOName());
if(!ad.isVBOWritten()) {
@@ -68,6 +66,6 @@ public abstract class GLVBOArrayHandler implements GLArrayHandler {
}
return true;
}
-
+
}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java
index 274ccff..c39b78b 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -44,43 +44,40 @@ import jogamp.opengl.egl.EGLExt;
public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl {
final protected TextureType texType;
final protected boolean useKHRSync;
-
+
public enum TextureType {
- GL(0), KHRImage(1);
-
+ GL(0), KHRImage(1);
+
public final int id;
TextureType(int id){
this.id = id;
}
- }
-
+ }
+
public static class EGLTextureFrame extends TextureSequence.TextureFrame {
-
+
public EGLTextureFrame(Buffer clientBuffer, Texture t, long khrImage, long khrSync) {
super(t);
this.clientBuffer = clientBuffer;
this.image = khrImage;
this.sync = khrSync;
}
-
+
public final Buffer getClientBuffer() { return clientBuffer; }
- public final long getImage() { return image; }
+ public final long getImage() { return image; }
public final long getSync() { return sync; }
-
+
+ @Override
public String toString() {
- return "EGLTextureFrame[" + texture + ", img "+ image + ", sync "+ sync+", clientBuffer "+clientBuffer+"]";
+ return "EGLTextureFrame[pts " + pts + " ms, l " + duration + " ms, texID "+ texture.getTextureObject() + ", img "+ image + ", sync "+ sync+", clientBuffer "+clientBuffer+"]";
}
protected final Buffer clientBuffer;
protected final long image;
protected final long sync;
}
-
- protected EGLMediaPlayerImpl() {
- this(TextureType.GL, false);
- }
-
+
protected EGLMediaPlayerImpl(TextureType texType, boolean useKHRSync) {
super();
this.texType = texType;
@@ -88,26 +85,26 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl {
}
@Override
- protected TextureSequence.TextureFrame createTexImage(GL gl, int idx, int[] tex) {
- final Texture texture = super.createTexImageImpl(gl, idx, tex, width, height, false);
+ protected TextureSequence.TextureFrame createTexImage(GL gl, int texName) {
+ final Texture texture = super.createTexImageImpl(gl, texName, width, height);
final Buffer clientBuffer;
final long image;
final long sync;
- final boolean eglUsage = TextureType.KHRImage == texType || useKHRSync ;
+ final boolean eglUsage = TextureType.KHRImage == texType || useKHRSync ;
final EGLContext eglCtx;
final EGLExt eglExt;
final EGLDrawable eglDrawable;
-
+
if(eglUsage) {
eglCtx = (EGLContext) gl.getContext();
eglExt = eglCtx.getEGLExt();
- eglDrawable = (EGLDrawable) eglCtx.getGLDrawable();
+ eglDrawable = (EGLDrawable) eglCtx.getGLDrawable();
} else {
eglCtx = null;
eglExt = null;
eglDrawable = null;
}
-
+
if(TextureType.KHRImage == texType) {
IntBuffer nioTmp = Buffers.newDirectIntBuffer(1);
// create EGLImage from texture
@@ -117,7 +114,7 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl {
EGLExt.EGL_GL_TEXTURE_2D_KHR,
clientBuffer, nioTmp);
if (0==image) {
- throw new RuntimeException("EGLImage creation failed: "+EGL.eglGetError()+", ctx "+eglCtx+", tex "+tex[idx]+", err "+toHexString(EGL.eglGetError()));
+ throw new RuntimeException("EGLImage creation failed: "+EGL.eglGetError()+", ctx "+eglCtx+", tex "+texName+", err "+toHexString(EGL.eglGetError()));
}
} else {
clientBuffer = null;
@@ -139,31 +136,31 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl {
}
return new EGLTextureFrame(clientBuffer, texture, image, sync);
}
-
+
@Override
- protected void destroyTexImage(GL gl, TextureSequence.TextureFrame imgTex) {
- final boolean eglUsage = TextureType.KHRImage == texType || useKHRSync ;
+ protected void destroyTexFrame(GL gl, TextureSequence.TextureFrame frame) {
+ final boolean eglUsage = TextureType.KHRImage == texType || useKHRSync ;
final EGLContext eglCtx;
final EGLExt eglExt;
final EGLDrawable eglDrawable;
-
+
if(eglUsage) {
eglCtx = (EGLContext) gl.getContext();
eglExt = eglCtx.getEGLExt();
- eglDrawable = (EGLDrawable) eglCtx.getGLDrawable();
+ eglDrawable = (EGLDrawable) eglCtx.getGLDrawable();
} else {
eglCtx = null;
eglExt = null;
eglDrawable = null;
}
- final EGLTextureFrame eglTex = (EGLTextureFrame) imgTex;
-
+ final EGLTextureFrame eglTex = (EGLTextureFrame) frame;
+
if(0!=eglTex.getImage()) {
eglExt.eglDestroyImageKHR(eglDrawable.getNativeSurface().getDisplayHandle(), eglTex.getImage());
}
if(0!=eglTex.getSync()) {
eglExt.eglDestroySyncKHR(eglDrawable.getNativeSurface().getDisplayHandle(), eglTex.getSync());
}
- super.destroyTexImage(gl, imgTex);
+ super.destroyTexFrame(gl, frame);
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
index 2ff91a3..9164739 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -28,336 +28,647 @@
package jogamp.opengl.util.av;
import java.io.IOException;
-import java.net.URLConnection;
+import java.net.URI;
import java.util.ArrayList;
-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.GL2;
+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 jogamp.opengl.Debug;
+import com.jogamp.common.net.URIQueryProps;
+import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.LFRingbuffer;
+import com.jogamp.common.util.Ringbuffer;
+import com.jogamp.opengl.util.TimeFrameI;
+import com.jogamp.opengl.util.av.AudioSink;
import com.jogamp.opengl.util.av.GLMediaPlayer;
import com.jogamp.opengl.util.texture.Texture;
import com.jogamp.opengl.util.texture.TextureSequence;
+import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame;
/**
* After object creation an implementation may customize the behavior:
* <ul>
- * <li>{@link #setTextureCount(int)}</li>
+ * <li>{@link #setDesTextureCount(int)}</li>
* <li>{@link #setTextureTarget(int)}</li>
* <li>{@link EGLMediaPlayerImpl#setEGLTexImageAttribs(boolean, boolean)}.</li>
* </ul>
- *
+ *
* <p>
* See {@link GLMediaPlayer}.
* </p>
*/
public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
+ private static final int STREAM_WORKER_DELAY = Debug.getIntProperty("jogl.debug.GLMediaPlayer.StreamWorker.delay", false, 0);
protected static final String unknown = "unknown";
- protected State state;
+ protected volatile State state;
+ private final Object stateLock = new Object();
+
protected int textureCount;
protected int textureTarget;
protected int textureFormat;
- protected int textureInternalFormat;
+ protected int textureInternalFormat;
protected int textureType;
protected int texUnit;
-
-
+
+
protected int[] texMinMagFilter = { GL.GL_NEAREST, GL.GL_NEAREST };
protected int[] texWrapST = { GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE };
-
- protected URLConnection urlConn = null;
-
+
+ /** User requested URI stream location. */
+ protected URI streamLoc = null;
+ /**
+ * In case {@link #streamLoc} is a {@link GLMediaPlayer#CameraInputScheme},
+ * {@link #cameraPath} holds the URI's path portion
+ * as parsed in {@link #initStream(URI, int, int, int)}.
+ * @see #cameraProps
+ */
+ protected String cameraPath = null;
+ /** Optional camera properties, see {@link #cameraPath}. */
+ protected Map<String, String> cameraProps = null;
+
protected volatile float playSpeed = 1.0f;
-
- /** Shall be set by the {@link #initGLStreamImpl(GL, int[])} method implementation. */
+ protected float audioVolume = 1.0f;
+
+ /** Shall be set by the {@link #initStreamImpl(int, int)} method implementation. */
+ protected int vid = GLMediaPlayer.STREAM_ID_AUTO;
+ /** Shall be set by the {@link #initStreamImpl(int, int)} method implementation. */
+ protected int aid = GLMediaPlayer.STREAM_ID_AUTO;
+ /** Shall be set by the {@link #initStreamImpl(int, int)} method implementation. */
protected int width = 0;
- /** Shall be set by the {@link #initGLStreamImpl(GL, int[])} method implementation. */
+ /** Shall be set by the {@link #initStreamImpl(int, int)} method implementation. */
protected int height = 0;
- /** Video fps. Shall be set by the {@link #initGLStreamImpl(GL, int[])} method implementation. */
+ /** Video avg. fps. Shall be set by the {@link #initStreamImpl(int, int)} method implementation. */
protected float fps = 0;
- /** Stream bps. Shall be set by the {@link #initGLStreamImpl(GL, int[])} method implementation. */
+ /** Video avg. frame duration in ms. Shall be set by the {@link #initStreamImpl(int, int)} method implementation. */
+ protected float frame_duration = 0f;
+ /** Stream bps. Shall be set by the {@link #initStreamImpl(int, int)} method implementation. */
protected int bps_stream = 0;
- /** Video bps. Shall be set by the {@link #initGLStreamImpl(GL, int[])} method implementation. */
+ /** Video bps. Shall be set by the {@link #initStreamImpl(int, int)} method implementation. */
protected int bps_video = 0;
- /** Audio bps. Shall be set by the {@link #initGLStreamImpl(GL, int[])} method implementation. */
+ /** Audio bps. Shall be set by the {@link #initStreamImpl(int, int)} method implementation. */
protected int bps_audio = 0;
- /** In frames. Shall be set by the {@link #initGLStreamImpl(GL, int[])} method implementation. */
- protected int totalFrames = 0;
- /** In ms. Shall be set by the {@link #initGLStreamImpl(GL, int[])} method implementation. */
+ /** In frames. Shall be set by the {@link #initStreamImpl(int, int)} method implementation. */
+ protected int videoFrames = 0;
+ /** In frames. Shall be set by the {@link #initStreamImpl(int, int)} method implementation. */
+ protected int audioFrames = 0;
+ /** In ms. Shall be set by the {@link #initStreamImpl(int, int)} method implementation. */
protected int duration = 0;
- /** Shall be set by the {@link #initGLStreamImpl(GL, int[])} method implementation. */
+ /** Shall be set by the {@link #initStreamImpl(int, int)} method implementation. */
protected String acodec = unknown;
- /** Shall be set by the {@link #initGLStreamImpl(GL, int[])} method implementation. */
+ /** Shall be set by the {@link #initStreamImpl(int, int)} method implementation. */
protected String vcodec = unknown;
-
- protected int frameNumber = 0;
-
- protected TextureSequence.TextureFrame[] texFrames = null;
- protected HashMap<Integer, TextureSequence.TextureFrame> texFrameMap = new HashMap<Integer, TextureSequence.TextureFrame>();
- private ArrayList<GLMediaEventListener> eventListeners = new ArrayList<GLMediaEventListener>();
+
+ protected volatile int decodedFrameCount = 0;
+ protected int presentedFrameCount = 0;
+ protected int displayedFrameCount = 0;
+ protected volatile int video_pts_last = 0;
+
+ /** See {@link #getAudioSink()}. Set by implementation if used from within {@link #initStreamImpl(int, int)}! */
+ protected AudioSink audioSink = null;
+ protected boolean audioSinkPlaySpeedSet = false;
+
+ /** System Clock Reference (SCR) of first audio PTS at start time. */
+ private long audio_scr_t0 = 0;
+ private boolean audioSCR_reset = true;
+
+ /** System Clock Reference (SCR) of first video frame at start time. */
+ private long video_scr_t0 = 0;
+ /** System Clock Reference (SCR) PTS offset, i.e. first video PTS at start time. */
+ private int video_scr_pts = 0;
+ /** Cumulative video pts diff. */
+ private float video_dpts_cum = 0;
+ /** Cumulative video frames. */
+ private int video_dpts_count = 0;
+ /** Number of min frame count required for video cumulative sync. */
+ private static final int VIDEO_DPTS_NUM = 20;
+ /** Cumulative coefficient, value {@value}. */
+ private static final float VIDEO_DPTS_COEFF = 0.7943282f; // (float) Math.exp(Math.log(0.01) / VIDEO_DPTS_NUM);
+ /** Maximum valid video pts diff. */
+ private static final int VIDEO_DPTS_MAX = 5000; // 5s max diff
+ /** Trigger video PTS reset with given cause as bitfield. */
+ private boolean videoSCR_reset = false;
+
+ protected TextureFrame[] videoFramesOrig = null;
+ protected Ringbuffer<TextureFrame> videoFramesFree = null;
+ protected Ringbuffer<TextureFrame> videoFramesDecoded = null;
+ protected volatile TextureFrame lastFrame = null;
+ /**
+ * @see #isGLOriented()
+ */
+ protected boolean isInGLOrientation = false;
+
+ private final ArrayList<GLMediaEventListener> eventListeners = new ArrayList<GLMediaEventListener>();
protected GLMediaPlayerImpl() {
- this.textureCount=3;
+ this.textureCount=0;
this.textureTarget=GL.GL_TEXTURE_2D;
this.textureFormat = GL.GL_RGBA;
this.textureInternalFormat = GL.GL_RGBA;
- this.textureType = GL.GL_UNSIGNED_BYTE;
+ this.textureType = GL.GL_UNSIGNED_BYTE;
this.texUnit = 0;
this.state = State.Uninitialized;
}
@Override
- public void setTextureUnit(int u) { texUnit = u; }
-
+ public final void setTextureUnit(int u) { texUnit = u; }
+
@Override
- public int getTextureUnit() { return texUnit; }
-
- protected final void setTextureCount(int textureCount) {
- this.textureCount=textureCount;
- }
+ public final int getTextureUnit() { return texUnit; }
+
+ @Override
+ public final int getTextureTarget() { return textureTarget; }
+
@Override
public final int getTextureCount() { return textureCount; }
-
+
protected final void setTextureTarget(int target) { textureTarget=target; }
- protected final void setTextureFormat(int internalFormat, int format) {
- textureInternalFormat=internalFormat;
- textureFormat=format;
- }
+ protected final void setTextureFormat(int internalFormat, int format) {
+ textureInternalFormat=internalFormat;
+ textureFormat=format;
+ }
protected final void setTextureType(int t) { textureType=t; }
+ @Override
public final void setTextureMinMagFilter(int[] minMagFilter) { texMinMagFilter[0] = minMagFilter[0]; texMinMagFilter[1] = minMagFilter[1];}
+ @Override
public final int[] getTextureMinMagFilter() { return texMinMagFilter; }
-
- public final void setTextureWrapST(int[] wrapST) { texWrapST[0] = wrapST[0]; texWrapST[1] = wrapST[1];}
- public final int[] getTextureWrapST() { return texWrapST; }
@Override
- public final TextureSequence.TextureFrame getLastTexture() throws IllegalStateException {
- if(State.Uninitialized == state) {
- throw new IllegalStateException("Instance not initialized: "+this);
- }
- return getLastTextureImpl();
- }
- protected abstract TextureSequence.TextureFrame getLastTextureImpl();
-
+ public final void setTextureWrapST(int[] wrapST) { texWrapST[0] = wrapST[0]; texWrapST[1] = wrapST[1];}
@Override
- public final synchronized TextureSequence.TextureFrame getNextTexture(GL gl, boolean blocking) throws IllegalStateException {
- if(State.Uninitialized == state) {
- throw new IllegalStateException("Instance not initialized: "+this);
- }
- if(State.Playing == state) {
- final TextureSequence.TextureFrame f = getNextTextureImpl(gl, blocking);
- return f;
+ public final int[] getTextureWrapST() { return texWrapST; }
+
+ private final void checkGLInit() {
+ if(State.Uninitialized == state || State.Initialized == state ) {
+ throw new IllegalStateException("GL not initialized: "+this);
}
- return getLastTextureImpl();
}
- protected abstract TextureSequence.TextureFrame getNextTextureImpl(GL gl, boolean blocking);
-
+
@Override
public String getRequiredExtensionsShaderStub() throws IllegalStateException {
- if(State.Uninitialized == state) {
- throw new IllegalStateException("Instance not initialized: "+this);
- }
+ checkGLInit();
if(GLES2.GL_TEXTURE_EXTERNAL_OES == textureTarget) {
return TextureSequence.GL_OES_EGL_image_external_Required_Prelude;
}
return "";
}
-
+
@Override
public String getTextureSampler2DType() throws IllegalStateException {
- if(State.Uninitialized == state) {
- throw new IllegalStateException("Instance not initialized: "+this);
- }
+ checkGLInit();
switch(textureTarget) {
case GL.GL_TEXTURE_2D:
- case GL2.GL_TEXTURE_RECTANGLE:
+ case GL2.GL_TEXTURE_RECTANGLE:
return TextureSequence.sampler2D;
case GLES2.GL_TEXTURE_EXTERNAL_OES:
return TextureSequence.samplerExternalOES;
default:
- throw new GLException("Unsuported texture target: "+toHexString(textureTarget));
+ throw new GLException("Unsuported texture target: "+toHexString(textureTarget));
}
}
-
+
/**
* {@inheritDoc}
- *
+ *
* This implementation simply returns the build-in function name of <code>texture2D</code>,
* if not overridden by specialization.
*/
@Override
public String getTextureLookupFunctionName(String desiredFuncName) throws IllegalStateException {
- if(State.Uninitialized == state) {
- throw new IllegalStateException("Instance not initialized: "+this);
- }
+ checkGLInit();
return "texture2D";
}
-
+
/**
* {@inheritDoc}
- *
- * This implementation simply returns an empty string since it's using
+ *
+ * This implementation simply returns an empty string since it's using
* the build-in function <code>texture2D</code>,
* if not overridden by specialization.
*/
@Override
public String getTextureLookupFragmentShaderImpl() throws IllegalStateException {
- if(State.Uninitialized == state) {
- throw new IllegalStateException("Instance not initialized: "+this);
- }
- return "";
+ checkGLInit();
+ return "";
}
-
+
@Override
- public final float getPlaySpeed() {
- return playSpeed;
- }
-
+ public final int getDecodedFrameCount() { return decodedFrameCount; }
+
@Override
- public final synchronized void setPlaySpeed(float rate) {
- if(State.Uninitialized != state && setPlaySpeedImpl(rate)) {
- playSpeed = rate;
+ public final int getPresentedFrameCount() { return presentedFrameCount; }
+
+ @Override
+ public final int getVideoPTS() { return video_pts_last; }
+
+ @Override
+ public final int getAudioPTS() {
+ if( State.Uninitialized != state ) {
+ return getAudioPTSImpl();
}
- if(DEBUG) { System.err.println("SetPlaySpeed: "+toString()); }
+ return 0;
}
- protected abstract boolean setPlaySpeedImpl(float rate);
-
- public final State start() {
- switch(state) {
- case Stopped:
- case Paused:
- if(startImpl()) {
- state = State.Playing;
- }
+ /** Override if not using audioSink! */
+ protected int getAudioPTSImpl() {
+ if( null != audioSink ) {
+ return audioSink.getPTS();
+ } else {
+ return 0;
}
- if(DEBUG) { System.err.println("Start: "+toString()); }
- return state;
}
- protected abstract boolean startImpl();
-
- public final State pause() {
- if(State.Playing == state && pauseImpl()) {
- state = State.Paused;
+
+ @Override
+ public final State getState() { return state; }
+
+ @Override
+ public final State play() {
+ synchronized( stateLock ) {
+ final State preState = state;
+ switch( state ) {
+ case Paused:
+ if( playImpl() ) {
+ resetAVPTS();
+ if( null != audioSink ) {
+ audioSink.play(); // cont. w/ new data
+ }
+ if( null != streamWorker ) {
+ streamWorker.doResume();
+ }
+ changeState(0, State.Playing);
+ }
+ default:
+ }
+ if(DEBUG) { System.err.println("Play: "+preState+" -> "+state+", "+toString()); }
+ return state;
}
- if(DEBUG) { System.err.println("Pause: "+toString()); }
- return state;
}
- protected abstract boolean pauseImpl();
-
- public final State stop() {
- switch(state) {
- case Playing:
- case Paused:
- if(stopImpl()) {
- state = State.Stopped;
+ protected abstract boolean playImpl();
+
+ @Override
+ public final State pause(boolean flush) {
+ return pauseImpl(flush, 0);
+ }
+ private final State pauseImpl(boolean flush, int event_mask) {
+ synchronized( stateLock ) {
+ final State preState = state;
+ if( State.Playing == state ) {
+ event_mask = addStateEventMask(event_mask, GLMediaPlayer.State.Paused);
+ state = State.Paused;
+ if( null != streamWorker ) {
+ streamWorker.doPause();
}
+ if( flush ) {
+ resetAVPTSAndFlush();
+ } else if( null != audioSink ) {
+ audioSink.pause();
+ }
+ attributesUpdated( event_mask );
+ if( !pauseImpl() ) {
+ play();
+ }
+ }
+ if(DEBUG) { System.err.println("Pause: "+preState+" -> "+state+", "+toString()); }
+ return state;
}
- if(DEBUG) { System.err.println("Stop: "+toString()); }
- return state;
}
- protected abstract boolean stopImpl();
-
+ protected abstract boolean pauseImpl();
+
@Override
- public final int getCurrentPosition() {
- if(State.Uninitialized != state) {
- return getCurrentPositionImpl();
+ public final State destroy(GL gl) {
+ return destroyImpl(gl, 0);
+ }
+ private final State destroyImpl(GL gl, int event_mask) {
+ synchronized( stateLock ) {
+ if( null != streamWorker ) {
+ streamWorker.doStop();
+ streamWorker = null;
+ }
+ destroyImpl(gl);
+ removeAllTextureFrames(gl);
+ textureCount=0;
+ changeState(event_mask, State.Uninitialized);
+ return state;
}
- return 0;
}
- protected abstract int getCurrentPositionImpl();
-
+ protected abstract void destroyImpl(GL gl);
+
+ @Override
public final int seek(int msec) {
- final int cp;
- switch(state) {
- case Stopped:
- case Playing:
- case Paused:
- cp = seekImpl(msec);
- break;
- default:
- cp = 0;
+ synchronized( stateLock ) {
+ final State preState = state;
+ final int pts1;
+ switch(state) {
+ case Playing:
+ case Paused:
+ final State _state = state;
+ state = State.Paused;
+ if( null != streamWorker ) {
+ streamWorker.doPause();
+ }
+ pts1 = seekImpl(msec);
+ resetAVPTSAndFlush();
+ if( null != audioSink && State.Playing == _state ) {
+ audioSink.play(); // cont. w/ new data
+ }
+ System.err.println("SEEK XXX: "+getPerfString());
+ if( null != streamWorker ) {
+ streamWorker.doResume();
+ }
+ state = _state;
+ break;
+ default:
+ pts1 = 0;
+ }
+ if(DEBUG) { System.err.println("Seek("+msec+"): "+preState+" -> "+state+", "+toString()); }
+ return pts1;
}
- if(DEBUG) { System.err.println("Seek("+msec+"): "+toString()); }
- return cp;
}
protected abstract int seekImpl(int msec);
-
- public final State getState() { return state; }
-
- @Override
- public final State initGLStream(GL gl, URLConnection urlConn) throws IllegalStateException, GLException, IOException {
- if(State.Uninitialized != state) {
- throw new IllegalStateException("Instance not in state "+State.Uninitialized+", but "+state+", "+this);
- }
- this.urlConn = urlConn;
- if (this.urlConn != null) {
- try {
- if(null != gl) {
- if(null!=texFrames) {
- // re-init ..
- removeAllImageTextures(gl);
- } else {
- texFrames = new TextureSequence.TextureFrame[textureCount];
- }
- final int[] tex = new int[textureCount];
- {
- gl.glGenTextures(textureCount, tex, 0);
- final int err = gl.glGetError();
- if( GL.GL_NO_ERROR != err ) {
- throw new RuntimeException("TextureNames creation failed (num: "+textureCount+"): err "+toHexString(err));
- }
+
+ @Override
+ public final float getPlaySpeed() {
+ return playSpeed;
+ }
+
+ @Override
+ public final boolean setPlaySpeed(float rate) {
+ synchronized( stateLock ) {
+ final float preSpeed = playSpeed;
+ boolean res = false;
+ if(State.Uninitialized != state ) {
+ if( rate > 0.01f ) {
+ if( Math.abs(1.0f - rate) < 0.01f ) {
+ rate = 1.0f;
}
- initGLStreamImpl(gl, tex);
-
- for(int i=0; i<textureCount; i++) {
- final TextureSequence.TextureFrame tf = createTexImage(gl, i, tex);
- texFrames[i] = tf;
- texFrameMap.put(tex[i], tf);
+ if( setPlaySpeedImpl(rate) ) {
+ resetAVPTS();
+ playSpeed = rate;
+ res = true;
}
}
- state = State.Stopped;
- return state;
- } catch (Throwable t) {
- throw new GLException("Error initializing GL resources", t);
}
+ if(DEBUG) { System.err.println("setPlaySpeed("+rate+"): "+state+", "+preSpeed+" -> "+playSpeed+", "+toString()); }
+ return res;
+ }
+ }
+ /**
+ * Override if not using AudioSink, or AudioSink's {@link AudioSink#setPlaySpeed(float)} is not sufficient!
+ * <p>
+ * AudioSink shall respect <code>!audioSinkPlaySpeedSet</code> to determine data_size
+ * at {@link AudioSink#enqueueData(com.jogamp.opengl.util.av.AudioSink.AudioFrame)}.
+ * </p>
+ */
+ protected boolean setPlaySpeedImpl(float rate) {
+ if( null != audioSink ) {
+ audioSinkPlaySpeedSet = audioSink.setPlaySpeed(rate);
+ }
+ // still true, even if audioSink rejects command since we deal w/ video sync
+ // and AudioSink w/ audioSinkPlaySpeedSet at enqueueData(..).
+ return true;
+ }
+
+ @Override
+ public final float getAudioVolume() {
+ getAudioVolumeImpl();
+ return audioVolume;
+ }
+ /**
+ * Override if not using AudioSink, or AudioSink's {@link AudioSink#getVolume()} is not sufficient!
+ */
+ protected void getAudioVolumeImpl() {
+ if( null != audioSink ) {
+ audioVolume = audioSink.getVolume();
+ }
+ }
+
+ @Override
+ public boolean setAudioVolume(float v) {
+ synchronized( stateLock ) {
+ final float preVolume = audioVolume;
+ boolean res = false;
+ if(State.Uninitialized != state ) {
+ if( Math.abs(v) < 0.01f ) {
+ v = 0.0f;
+ } else if( Math.abs(1.0f - v) < 0.01f ) {
+ v = 1.0f;
+ }
+ if( setAudioVolumeImpl(v) ) {
+ audioVolume = v;
+ res = true;
+ }
+ }
+ if(DEBUG) { System.err.println("setAudioVolume("+v+"): "+state+", "+preVolume+" -> "+audioVolume+", "+toString()); }
+ return res;
}
- return state;
}
-
/**
- * Implementation shall set the following set of data here
- * @param gl TODO
- * @param texNames TODO
+ * Override if not using AudioSink, or AudioSink's {@link AudioSink#setVolume(float)} is not sufficient!
+ */
+ protected boolean setAudioVolumeImpl(float v) {
+ if( null != audioSink ) {
+ return audioSink.setVolume(v);
+ }
+ // still true, even if audioSink rejects command ..
+ return true;
+ }
+
+ @Override
+ public final void initStream(URI streamLoc, final int vid, final int aid, int reqTextureCount) throws IllegalStateException, IllegalArgumentException {
+ synchronized( stateLock ) {
+ if(State.Uninitialized != state) {
+ throw new IllegalStateException("Instance not in state unintialized: "+this);
+ }
+ if(null == streamLoc) {
+ throw new IllegalArgumentException("streamLock is null");
+ }
+ if( STREAM_ID_NONE != vid ) {
+ textureCount = validateTextureCount(reqTextureCount);
+ if( textureCount < TEXTURE_COUNT_MIN ) {
+ throw new InternalError("Validated texture count < "+TEXTURE_COUNT_MIN+": "+textureCount);
+ }
+ } else {
+ textureCount = 0;
+ }
+ decodedFrameCount = 0;
+ presentedFrameCount = 0;
+ displayedFrameCount = 0;
+ this.streamLoc = streamLoc;
+
+ // Pre-parse for camera-input scheme
+ cameraPath = null;
+ cameraProps = null;
+ final String streamLocScheme = streamLoc.getScheme();
+ if( null != streamLocScheme && streamLocScheme.equals(CameraInputScheme) ) {
+ final String rawPath = streamLoc.getRawPath();
+ if( null != rawPath && rawPath.length() > 0 ) {
+ // cut-off root fwd-slash
+ cameraPath = rawPath.substring(1);
+ final URIQueryProps props = URIQueryProps.create(streamLoc, ';');
+ cameraProps = props.getProperties();
+ } else {
+ throw new IllegalArgumentException("Camera path is empty: "+streamLoc.toString());
+ }
+ }
+
+ this.vid = vid;
+ this.aid = aid;
+ if ( this.streamLoc != null ) {
+ if( TEXTURE_COUNT_MIN < textureCount ) {
+ streamWorker = new StreamWorker();
+ } else {
+ new Thread() {
+ public void run() {
+ try {
+ initStreamImpl(vid, aid);
+ } catch (Throwable t) {
+ streamErr = new StreamException(t.getClass().getSimpleName()+" while initializing: "+GLMediaPlayerImpl.this.toString(), t);
+ changeState(GLMediaEventListener.EVENT_CHANGE_ERR, GLMediaPlayer.State.Uninitialized);
+ } // also initializes width, height, .. etc
+ }
+ }.start();
+ }
+ }
+ }
+ }
+ /**
+ * Implementation shall set the following set of data here
+ * @see #vid
+ * @see #aid
* @see #width
* @see #height
* @see #fps
* @see #bps_stream
- * @see #totalFrames
+ * @see #videoFrames
+ * @see #audioFrames
* @see #acodec
* @see #vcodec
*/
- protected abstract void initGLStreamImpl(GL gl, int[] texNames) throws IOException;
-
- protected TextureSequence.TextureFrame createTexImage(GL gl, int idx, int[] tex) {
- return new TextureSequence.TextureFrame( createTexImageImpl(gl, idx, tex, width, height, false) );
+ protected abstract void initStreamImpl(int vid, int aid) throws Exception;
+
+ @Override
+ public final StreamException getStreamException() {
+ final StreamException e;
+ synchronized( stateLock ) {
+ e = streamErr;
+ streamErr = null;
+ }
+ return e;
+ }
+
+ @Override
+ public final void initGL(GL gl) throws IllegalStateException, StreamException, GLException {
+ synchronized( stateLock ) {
+ if(State.Initialized != state ) {
+ throw new IllegalStateException("Stream not in state initialized: "+this);
+ }
+ if( null != streamWorker ) {
+ final StreamException streamInitErr = getStreamException();
+ if( null != streamInitErr ) {
+ streamWorker = null; // already terminated!
+ destroy(null);
+ throw streamInitErr;
+ }
+ }
+ try {
+ if( STREAM_ID_NONE != vid ) {
+ removeAllTextureFrames(gl);
+ initGLImpl(gl);
+ if(DEBUG) {
+ System.err.println("initGLImpl.X "+this);
+ }
+ videoFramesOrig = createTexFrames(gl, textureCount);
+ if( TEXTURE_COUNT_MIN == textureCount ) {
+ videoFramesFree = null;
+ videoFramesDecoded = null;
+ lastFrame = videoFramesOrig[0];
+ } else {
+ videoFramesFree = new LFRingbuffer<TextureFrame>(videoFramesOrig);
+ videoFramesDecoded = new LFRingbuffer<TextureFrame>(TextureFrame[].class, textureCount);
+ lastFrame = videoFramesFree.getBlocking( );
+ }
+ if( null != streamWorker ) {
+ streamWorker.initGL(gl);
+ }
+ } else {
+ removeAllTextureFrames(null);
+ initGLImpl(null);
+ setTextureFormat(-1, -1);
+ setTextureType(-1);
+ videoFramesOrig = null;
+ videoFramesFree = null;
+ videoFramesDecoded = null;
+ lastFrame = null;
+ }
+ changeState(0, State.Paused);
+ } catch (Throwable t) {
+ destroyImpl(gl, GLMediaEventListener.EVENT_CHANGE_ERR); // -> GLMediaPlayer.State.Uninitialized
+ throw new GLException("Error initializing GL resources", t);
+ }
+ }
+ }
+ /**
+ * Shall initialize all GL related resources, if not audio-only.
+ * <p>
+ * Shall also take care of {@link AudioSink} initialization if appropriate.
+ * </p>
+ * @param gl null for audio-only, otherwise a valid and current GL object.
+ * @throws IOException
+ * @throws GLException
+ */
+ protected abstract void initGLImpl(GL gl) throws IOException, GLException;
+
+ /**
+ * Returns the validated number of textures to be handled.
+ * <p>
+ * Default is {@link #TEXTURE_COUNT_DEFAULT} minimum textures, if <code>desiredTextureCount</code>
+ * is < {@link #TEXTURE_COUNT_MIN}, {@link #TEXTURE_COUNT_MIN} is returned.
+ * </p>
+ * <p>
+ * Implementation must at least return a texture count of {@link #TEXTURE_COUNT_MIN}, <i>two</i>, the last texture and the decoding texture.
+ * </p>
+ */
+ protected int validateTextureCount(int desiredTextureCount) {
+ return desiredTextureCount < TEXTURE_COUNT_MIN ? TEXTURE_COUNT_MIN : desiredTextureCount;
+ }
+
+ protected TextureFrame[] createTexFrames(GL gl, final int count) {
+ final int[] texNames = new int[count];
+ gl.glGenTextures(count, texNames, 0);
+ final int err = gl.glGetError();
+ if( GL.GL_NO_ERROR != err ) {
+ throw new RuntimeException("TextureNames creation failed (num: "+count+"): err "+toHexString(err));
+ }
+ final TextureFrame[] texFrames = new TextureFrame[count];
+ for(int i=0; i<count; i++) {
+ texFrames[i] = createTexImage(gl, texNames[i]);
+ }
+ return texFrames;
}
-
- protected Texture createTexImageImpl(GL gl, int idx, int[] tex, int tWidth, int tHeight, boolean mustFlipVertically) {
- if( 0 > tex[idx] ) {
- throw new RuntimeException("TextureName "+toHexString(tex[idx])+" invalid.");
+ protected abstract TextureFrame createTexImage(GL gl, int texName);
+
+ protected final Texture createTexImageImpl(GL gl, int texName, int tWidth, int tHeight) {
+ if( 0 > texName ) {
+ throw new RuntimeException("TextureName "+toHexString(texName)+" invalid.");
}
gl.glActiveTexture(GL.GL_TEXTURE0+getTextureUnit());
- gl.glBindTexture(textureTarget, tex[idx]);
+ gl.glBindTexture(textureTarget, texName);
{
final int err = gl.glGetError();
if( GL.GL_NO_ERROR != err ) {
- throw new RuntimeException("Couldn't bind textureName "+toHexString(tex[idx])+" to 2D target, err "+toHexString(err));
+ throw new RuntimeException("Couldn't bind textureName "+toHexString(texName)+" to 2D target, err "+toHexString(err));
}
}
@@ -376,55 +687,624 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
{
final int err = gl.glGetError();
if( GL.GL_NO_ERROR != err ) {
- throw new RuntimeException("Couldn't create TexImage2D RGBA "+tWidth+"x"+tHeight+", err "+toHexString(err));
+ throw new RuntimeException("Couldn't create TexImage2D RGBA "+tWidth+"x"+tHeight+", target "+toHexString(textureTarget)+
+ ", ifmt "+toHexString(textureInternalFormat)+", fmt "+toHexString(textureFormat)+", type "+toHexString(textureType)+
+ ", err "+toHexString(err));
}
}
if(DEBUG) {
System.err.println("Created TexImage2D RGBA "+tWidth+"x"+tHeight+", target "+toHexString(textureTarget)+
- ", ifmt "+toHexString(GL.GL_RGBA)+", fmt "+toHexString(textureFormat)+", type "+toHexString(textureType));
+ ", ifmt "+toHexString(textureInternalFormat)+", fmt "+toHexString(textureFormat)+", type "+toHexString(textureType));
}
}
gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MIN_FILTER, texMinMagFilter[0]);
- gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MAG_FILTER, texMinMagFilter[1]);
+ gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_MAG_FILTER, texMinMagFilter[1]);
gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_S, texWrapST[0]);
gl.glTexParameteri(textureTarget, GL.GL_TEXTURE_WRAP_T, texWrapST[1]);
-
- return com.jogamp.opengl.util.texture.TextureIO.newTexture(tex[idx],
- textureTarget,
+
+ return com.jogamp.opengl.util.texture.TextureIO.newTexture(
+ texName, textureTarget,
tWidth, tHeight,
width, height,
- mustFlipVertically);
- }
-
- protected void destroyTexImage(GL gl, TextureSequence.TextureFrame imgTex) {
- imgTex.getTexture().destroy(gl);
- }
-
- protected void removeAllImageTextures(GL gl) {
- if(null != texFrames) {
- for(int i=0; i<textureCount; i++) {
- final TextureSequence.TextureFrame imgTex = texFrames[i];
- if(null != imgTex) {
- destroyTexImage(gl, imgTex);
+ !isInGLOrientation);
+ }
+
+ protected void destroyTexFrame(GL gl, TextureFrame frame) {
+ frame.getTexture().destroy(gl);
+ }
+
+ @Override
+ public final TextureFrame getLastTexture() throws IllegalStateException {
+ if( State.Paused != state && State.Playing != state ) {
+ throw new IllegalStateException("Instance not paused or playing: "+this);
+ }
+ return lastFrame;
+ }
+
+ private final void removeAllTextureFrames(GL gl) {
+ final TextureFrame[] texFrames = videoFramesOrig;
+ videoFramesOrig = null;
+ videoFramesFree = null;
+ videoFramesDecoded = null;
+ lastFrame = null;
+ if( null != texFrames ) {
+ for(int i=0; i<texFrames.length; i++) {
+ final TextureFrame frame = texFrames[i];
+ if(null != frame) {
+ if( null != gl ) {
+ destroyTexFrame(gl, frame);
+ }
texFrames[i] = null;
}
+ System.err.println(Thread.currentThread().getName()+"> Clear TexFrame["+i+"]: "+frame+" -> null");
+ }
+ }
+ }
+
+ protected TextureFrame cachedFrame = null;
+ protected long lastTimeMillis = 0;
+
+ @Override
+ public final TextureFrame getNextTexture(GL gl) throws IllegalStateException {
+ synchronized( stateLock ) {
+ if( State.Paused != state && State.Playing != state ) {
+ throw new IllegalStateException("Instance not paused or playing: "+this);
+ }
+ if(State.Playing == state) {
+ TextureFrame nextFrame = null;
+ boolean dropFrame = false;
+ try {
+ do {
+ final long currentTimeMillis;
+ final boolean playCached = null != cachedFrame;
+ final boolean droppedFrame;
+ if( dropFrame ) {
+ presentedFrameCount--;
+ dropFrame = false;
+ droppedFrame = true;
+ } else {
+ droppedFrame = false;
+ }
+ if( playCached ) {
+ nextFrame = cachedFrame;
+ cachedFrame = null;
+ presentedFrameCount--;
+ } else if( STREAM_ID_NONE != vid ) {
+ if( null != videoFramesDecoded ) { // single threaded ? TEXTURE_COUNT_MIN == textureCount
+ nextFrame = videoFramesDecoded.get();
+ } else {
+ nextFrame = getNextSingleThreaded(gl, lastFrame);
+ }
+ }
+ currentTimeMillis = Platform.currentTimeMillis();
+ if( null != nextFrame ) {
+ presentedFrameCount++;
+ final int video_pts = nextFrame.getPTS();
+ if( video_pts == TimeFrameI.END_OF_STREAM_PTS ) {
+ pauseImpl(true, GLMediaEventListener.EVENT_CHANGE_EOS);
+ } else if( video_pts != TimeFrameI.INVALID_PTS ) {
+ final int audio_pts = getAudioPTSImpl();
+ final int audio_scr = (int) ( ( currentTimeMillis - audio_scr_t0 ) * playSpeed );
+ final int d_apts;
+ if( audio_pts != TimeFrameI.INVALID_PTS ) {
+ d_apts = audio_pts - audio_scr;
+ } else {
+ d_apts = 0;
+ }
+
+ final int frame_period_last = video_pts - video_pts_last; // rendering loop interrupted ?
+ if( videoSCR_reset || frame_period_last > frame_duration*10 ) {
+ videoSCR_reset = false;
+ video_scr_t0 = currentTimeMillis;
+ video_scr_pts = video_pts;
+ }
+ final int video_scr = video_scr_pts + (int) ( ( currentTimeMillis - video_scr_t0 ) * playSpeed );
+ final int d_vpts = video_pts - video_scr;
+ // final int d_avpts = d_vpts - d_apts;
+ if( -VIDEO_DPTS_MAX > d_vpts || d_vpts > VIDEO_DPTS_MAX ) {
+ // if( -VIDEO_DPTS_MAX > d_avpts || d_avpts > VIDEO_DPTS_MAX ) {
+ if( DEBUG ) {
+ System.err.println( "AV*: dT "+(currentTimeMillis-lastTimeMillis)+", "+
+ getPerfStringImpl( video_scr, video_pts, d_vpts, audio_scr, audio_pts, d_apts, 0 ) + ", "+nextFrame+", playCached " + playCached+ ", dropFrame "+dropFrame);
+ }
+ } else {
+ final int dpy_den = displayedFrameCount > 0 ? displayedFrameCount : 1;
+ final int avg_dpy_duration = ( (int) ( currentTimeMillis - video_scr_t0 ) ) / dpy_den ; // ms/f
+ final int maxVideoDelay = Math.min(avg_dpy_duration, MAXIMUM_VIDEO_ASYNC);
+ video_dpts_count++;
+ // video_dpts_cum = d_avpts + VIDEO_DPTS_COEFF * video_dpts_cum;
+ video_dpts_cum = d_vpts + VIDEO_DPTS_COEFF * video_dpts_cum;
+ final int video_dpts_avg_diff = video_dpts_count >= VIDEO_DPTS_NUM ? getVideoDPTSAvg() : 0;
+ final int dt = (int) ( video_dpts_avg_diff / playSpeed + 0.5f );
+ // final int dt = (int) ( d_vpts / playSpeed + 0.5f );
+ // final int dt = (int) ( d_avpts / playSpeed + 0.5f );
+ final TextureFrame _nextFrame = nextFrame;
+ if( dt > maxVideoDelay ) {
+ cachedFrame = nextFrame;
+ nextFrame = null;
+ } else if ( !droppedFrame && dt < -maxVideoDelay && null != videoFramesDecoded && videoFramesDecoded.size() > 0 ) {
+ // only drop if prev. frame has not been dropped and
+ // frame is too late and one decoded frame is already available.
+ dropFrame = true;
+ }
+ video_pts_last = video_pts;
+ if( DEBUG ) {
+ System.err.println( "AV_: dT "+(currentTimeMillis-lastTimeMillis)+", "+
+ getPerfStringImpl( video_scr, video_pts, d_vpts,
+ audio_scr, audio_pts, d_apts,
+ video_dpts_avg_diff ) +
+ ", avg dpy-fps "+avg_dpy_duration+" ms/f, maxD "+maxVideoDelay+" ms, "+_nextFrame+", playCached " + playCached + ", dropFrame "+dropFrame);
+ }
+ }
+ } else if( DEBUG ) {
+ System.err.println("Invalid PTS: "+nextFrame);
+ }
+ if( null != nextFrame && null != videoFramesFree ) {
+ // Had frame and not single threaded ? (TEXTURE_COUNT_MIN < textureCount)
+ final TextureFrame _lastFrame = lastFrame;
+ lastFrame = nextFrame;
+ videoFramesFree.putBlocking(_lastFrame);
+ }
+ } else if( DEBUG ) {
+ final int video_pts = lastFrame.getPTS();
+ final int audio_pts = getAudioPTSImpl();
+ final int audio_scr = (int) ( ( currentTimeMillis - audio_scr_t0 ) * playSpeed );
+ final int d_apts;
+ if( audio_pts != TimeFrameI.INVALID_PTS ) {
+ d_apts = audio_pts - audio_scr;
+ } else {
+ d_apts = 0;
+ }
+ final int video_scr = video_scr_pts + (int) ( ( currentTimeMillis - video_scr_t0 ) * playSpeed );
+ final int d_vpts = video_pts - video_scr;
+ System.err.println( "AV~: dT "+(currentTimeMillis-lastTimeMillis)+", "+
+ getPerfStringImpl( video_scr, video_pts, d_vpts, audio_scr, audio_pts, d_apts, 0 ) + ", droppedFrame "+droppedFrame);
+ }
+ lastTimeMillis = currentTimeMillis;
+ } while( dropFrame );
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ displayedFrameCount++;
+ return lastFrame;
+ }
+ }
+ protected void preNextTextureImpl(GL gl) {}
+ protected void postNextTextureImpl(GL gl) {}
+ /**
+ * Process stream until the next video frame, i.e. {@link TextureFrame}, has been reached.
+ * Audio frames, i.e. {@link AudioSink.AudioFrame}, shall be handled in the process.
+ * <p>
+ * Video frames shall be ignored, if {@link #getVID()} is {@link #STREAM_ID_NONE}.
+ * </p>
+ * <p>
+ * Audio frames shall be ignored, if {@link #getAID()} is {@link #STREAM_ID_NONE}.
+ * </p>
+ * <p>
+ * Method may be invoked on the <a href="#streamworker"><i>StreamWorker</i> decoding thread</a>.
+ * </p>
+ * <p>
+ * Implementation shall care of OpenGL synchronization as required, e.g. glFinish()/glFlush()!
+ * </p>
+ * @param gl valid and current GL instance, shall be <code>null</code> for audio only.
+ * @param nextFrame the {@link TextureFrame} to store the video PTS and texture data,
+ * shall be <code>null</code> for audio only.
+ * @return the last processed video PTS value, maybe {@link TimeFrameI#INVALID_PTS} if video frame is invalid or n/a.
+ * Will be {@link TimeFrameI#END_OF_STREAM_PTS} if end of stream reached.
+ */
+ protected abstract int getNextTextureImpl(GL gl, TextureFrame nextFrame);
+
+ protected final TextureFrame getNextSingleThreaded(final GL gl, final TextureFrame nextFrame) throws InterruptedException {
+ if( STREAM_ID_NONE != vid ) {
+ preNextTextureImpl(gl);
+ final int vPTS = getNextTextureImpl(gl, nextFrame);
+ postNextTextureImpl(gl);
+ if( TimeFrameI.INVALID_PTS != vPTS ) {
+ newFrameAvailable(nextFrame, Platform.currentTimeMillis());
+ return nextFrame;
+ }
+ } else {
+ // audio only
+ final int vPTS = getNextTextureImpl(null, null);
+ if( TimeFrameI.INVALID_PTS != vPTS && TimeFrameI.END_OF_STREAM_PTS == vPTS ) {
+ // state transition incl. notification
+ pauseImpl(true, GLMediaEventListener.EVENT_CHANGE_EOS);
+ }
+ }
+ return null;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Note: All {@link AudioSink} operations are performed from {@link GLMediaPlayerImpl},
+ * i.e. {@link #play()}, {@link #pause(boolean)}, {@link #seek(int)}, {@link #setPlaySpeed(float)}, {@link #getAudioPTS()}.
+ * </p>
+ * <p>
+ * Implementations using an {@link AudioSink} shall write it's instance to {@link #audioSink}
+ * from within their {@link #initStreamImpl(int, int)} implementation.
+ * </p>
+ */
+ @Override
+ public final AudioSink getAudioSink() { return audioSink; }
+
+ /**
+ * To be called from implementation at 1st PTS after start
+ * w/ current pts value in milliseconds.
+ * @param audio_scr_t0
+ */
+ protected void setFirstAudioPTS2SCR(int pts) {
+ if( audioSCR_reset ) {
+ audio_scr_t0 = Platform.currentTimeMillis() - pts;
+ audioSCR_reset = false;
+ }
+ }
+ private void flushAllVideoFrames() {
+ if( null != videoFramesFree ) {
+ videoFramesFree.resetFull(videoFramesOrig);
+ lastFrame = videoFramesFree.get();
+ if( null == lastFrame ) { throw new InternalError("XXX"); }
+ videoFramesDecoded.clear();
+ }
+ cachedFrame = null;
+ }
+ private void resetAVPTSAndFlush() {
+ video_dpts_cum = 0;
+ video_dpts_count = 0;
+ resetAVPTS();
+ flushAllVideoFrames();
+ if( null != audioSink ) {
+ audioSink.flush();
+ }
+ }
+ private void resetAVPTS() {
+ presentedFrameCount = 0;
+ displayedFrameCount = 0;
+ decodedFrameCount = 0;
+ audioSCR_reset = true;
+ videoSCR_reset = true;
+ }
+ private final int getVideoDPTSAvg() {
+ return (int) ( video_dpts_cum * (1.0f - VIDEO_DPTS_COEFF) + 0.5f );
+ }
+
+ private final void newFrameAvailable(TextureFrame frame, long currentTimeMillis) {
+ decodedFrameCount++;
+ if( 0 == frame.getDuration() ) { // patch frame duration if not set already
+ frame.setDuration( (int) frame_duration );
+ }
+ synchronized(eventListenersLock) {
+ for(Iterator<GLMediaEventListener> i = eventListeners.iterator(); i.hasNext(); ) {
+ i.next().newFrameAvailable(this, frame, currentTimeMillis);
+ }
+ }
+ }
+
+ class StreamWorker extends Thread {
+ private volatile boolean isRunning = false;
+ private volatile boolean isActive = false;
+ private volatile boolean isBlocked = false;
+
+ private volatile boolean shallPause = true;
+ private volatile boolean shallStop = false;
+
+ private volatile GLContext sharedGLCtx = null;
+ private boolean sharedGLCtxCurrent = false;
+ private GLDrawable dummyDrawable = null;
+
+ /**
+ * Starts this daemon thread,
+ * which initializes the stream first via {@link GLMediaPlayerImpl#initStreamImpl(int, int)} first.
+ * <p>
+ * After stream initialization, this thread pauses!
+ * </p>
+ **/
+ StreamWorker() {
+ setDaemon(true);
+ start();
+ }
+
+ private void makeCurrent(GLContext ctx) {
+ if( GLContext.CONTEXT_NOT_CURRENT >= ctx.makeCurrent() ) {
+ throw new GLException("Couldn't make ctx current: "+ctx);
+ }
+ }
+
+ private void destroySharedGL() {
+ if( null != sharedGLCtx ) {
+ if( sharedGLCtx.isCreated() ) {
+ // Catch dispose GLExceptions by GLEventListener, just 'print' them
+ // so we can continue with the destruction.
+ try {
+ sharedGLCtx.destroy();
+ } catch (GLException gle) {
+ gle.printStackTrace();
+ }
+ }
+ sharedGLCtx = null;
+ }
+ if( null != dummyDrawable ) {
+ final AbstractGraphicsDevice device = dummyDrawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice();
+ dummyDrawable.setRealized(false);
+ dummyDrawable = null;
+ device.close();
+ }
+ }
+
+ public final synchronized void initGL(GL gl) {
+ final GLContext glCtx = gl.getContext();
+ final boolean glCtxCurrent = glCtx.isCurrent();
+ final GLProfile glp = gl.getGLProfile();
+ final GLDrawableFactory factory = GLDrawableFactory.getFactory(glp);
+ final AbstractGraphicsDevice device = glCtx.getGLDrawable().getNativeSurface().getGraphicsConfiguration().getScreen().getDevice();
+ dummyDrawable = factory.createDummyDrawable(device, true, glCtx.getGLDrawable().getChosenGLCapabilities(), null); // own device!
+ dummyDrawable.setRealized(true);
+ sharedGLCtx = dummyDrawable.createContext(glCtx);
+ makeCurrent(sharedGLCtx);
+ if( glCtxCurrent ) {
+ makeCurrent(glCtx);
+ } else {
+ sharedGLCtx.release();
+ }
+ }
+ public final synchronized void doPause() {
+ if( isActive ) {
+ shallPause = true;
+ if( Thread.currentThread() != this ) {
+ if( isBlocked && isActive ) {
+ this.interrupt();
+ }
+ while( isActive ) {
+ try {
+ this.wait(); // wait until paused
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+ public final synchronized void doResume() {
+ if( isRunning && !isActive ) {
+ shallPause = false;
+ if( Thread.currentThread() != this ) {
+ while( !isActive ) {
+ this.notify(); // wake-up pause-block
+ try {
+ this.wait(); // wait until resumed
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+ public final synchronized void doStop() {
+ if( isRunning ) {
+ shallStop = true;
+ if( Thread.currentThread() != this ) {
+ if( isBlocked && isRunning ) {
+ this.interrupt();
+ }
+ while( isRunning ) {
+ this.notify(); // wake-up pause-block (opt)
+ try {
+ this.wait(); // wait until stopped
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+ public final boolean isRunning() { return isRunning; }
+ public final boolean isActive() { return isActive; }
+
+ @Override
+ public final void run() {
+ setName(getName()+"-StreamWorker_"+StreamWorkerInstanceId);
+ StreamWorkerInstanceId++;
+
+ synchronized ( this ) {
+ isRunning = true;
+ try {
+ isBlocked = true;
+ initStreamImpl(vid, aid);
+ isBlocked = false;
+ } catch (Throwable t) {
+ streamErr = new StreamException(t.getClass().getSimpleName()+" while initializing: "+GLMediaPlayerImpl.this.toString(), t);
+ isBlocked = false;
+ isRunning = false;
+ changeState(GLMediaEventListener.EVENT_CHANGE_ERR, GLMediaPlayer.State.Uninitialized);
+ return; // end of thread!
+ } // also initializes width, height, .. etc
+ }
+
+ while( !shallStop ){
+ if( shallPause ) {
+ synchronized ( this ) {
+ if( sharedGLCtxCurrent ) {
+ postNextTextureImpl(sharedGLCtx.getGL());
+ sharedGLCtx.release();
+ }
+ while( shallPause && !shallStop ) {
+ isActive = false;
+ this.notify(); // wake-up doPause()
+ try {
+ this.wait(); // wait until resumed
+ } catch (InterruptedException e) {
+ if( !shallPause ) {
+ e.printStackTrace();
+ }
+ }
+ }
+ if( sharedGLCtxCurrent ) {
+ makeCurrent(sharedGLCtx);
+ preNextTextureImpl(sharedGLCtx.getGL());
+ }
+ isActive = true;
+ this.notify(); // wake-up doResume()
+ }
+ }
+ if( !sharedGLCtxCurrent && null != sharedGLCtx ) {
+ synchronized ( this ) {
+ if( null != sharedGLCtx ) {
+ makeCurrent( sharedGLCtx );
+ preNextTextureImpl(sharedGLCtx.getGL());
+ sharedGLCtxCurrent = true;
+ }
+ if( null == videoFramesFree ) {
+ throw new InternalError("XXX videoFramesFree is null");
+ }
+ }
+ }
+
+ if( !shallStop ) {
+ TextureFrame nextFrame = null;
+ try {
+ isBlocked = true;
+ final GL gl;
+ if( STREAM_ID_NONE != vid ) {
+ nextFrame = videoFramesFree.getBlocking();
+ nextFrame.setPTS( TimeFrameI.INVALID_PTS ); // mark invalid until processed!
+ gl = sharedGLCtx.getGL();
+ } else {
+ gl = null;
+ }
+ isBlocked = false;
+ final int vPTS = getNextTextureImpl(gl, nextFrame);
+ if( TimeFrameI.INVALID_PTS != vPTS ) {
+ if( null != nextFrame ) {
+ if( STREAM_WORKER_DELAY > 0 ) {
+ Thread.sleep(STREAM_WORKER_DELAY);
+ }
+ if( !videoFramesDecoded.put(nextFrame) ) {
+ throw new InternalError("XXX: free "+videoFramesFree+", decoded "+videoFramesDecoded+", "+GLMediaPlayerImpl.this);
+ }
+ newFrameAvailable(nextFrame, Platform.currentTimeMillis());
+ nextFrame = null;
+ } else {
+ // audio only
+ if( TimeFrameI.END_OF_STREAM_PTS == vPTS ) {
+ // state transition incl. notification
+ shallPause = true;
+ isActive = false;
+ pauseImpl(true, GLMediaEventListener.EVENT_CHANGE_EOS);
+ }
+ }
+ }
+ } catch (InterruptedException e) {
+ isBlocked = false;
+ if( !shallStop && !shallPause ) {
+ streamErr = new StreamException("InterruptedException while decoding: "+GLMediaPlayerImpl.this.toString(), e);
+ }
+ } catch (Throwable t) {
+ streamErr = new StreamException(t.getClass().getSimpleName()+" while decoding: "+GLMediaPlayerImpl.this.toString(), t);
+ } finally {
+ if( null != nextFrame ) { // put back
+ videoFramesFree.put(nextFrame);
+ }
+ if( null != streamErr ) {
+ if( DEBUG ) {
+ final Throwable t = null != streamErr.getCause() ? streamErr.getCause() : streamErr;
+ System.err.println("Caught StreamException: "+t.getMessage());
+ t.printStackTrace();
+ }
+ // state transition incl. notification
+ shallPause = true;
+ isActive = false;
+ pauseImpl(true, GLMediaEventListener.EVENT_CHANGE_ERR);
+ }
+ }
+ }
+ }
+ synchronized ( this ) {
+ if( sharedGLCtxCurrent ) {
+ postNextTextureImpl(sharedGLCtx.getGL());
+ }
+ destroySharedGL();
+ isRunning = false;
+ isActive = false;
+ this.notify(); // wake-up doStop()
+ }
+ }
+ }
+ static int StreamWorkerInstanceId = 0;
+ private StreamWorker streamWorker = null;
+ private volatile StreamException streamErr = null;
+
+ protected final int addStateEventMask(int event_mask, State newState) {
+ if( state != newState ) {
+ switch( newState ) {
+ case Uninitialized:
+ event_mask |= GLMediaEventListener.EVENT_CHANGE_UNINIT;
+ break;
+ case Initialized:
+ event_mask |= GLMediaEventListener.EVENT_CHANGE_INIT;
+ break;
+ case Playing:
+ event_mask |= GLMediaEventListener.EVENT_CHANGE_PLAY;
+ break;
+ case Paused:
+ event_mask |= GLMediaEventListener.EVENT_CHANGE_PAUSE;
+ break;
+ }
+ }
+ return event_mask;
+ }
+
+ protected final void attributesUpdated(int event_mask) {
+ if( 0 != event_mask ) {
+ final long now = Platform.currentTimeMillis();
+ synchronized(eventListenersLock) {
+ for(Iterator<GLMediaEventListener> i = eventListeners.iterator(); i.hasNext(); ) {
+ i.next().attributesChanged(this, event_mask, now);
+ }
}
}
- texFrameMap.clear();
}
- protected final void updateAttributes(int width, int height, int bps_stream, int bps_video, int bps_audio,
- float fps, int totalFrames, int duration,
- String vcodec, String acodec) {
+ protected final void changeState(int event_mask, State newState) {
+ event_mask = addStateEventMask(event_mask, newState);
+ if( 0 != event_mask ) {
+ state = newState;
+ attributesUpdated( event_mask );
+ }
+ }
+
+ protected final void updateAttributes(int vid, int aid, int width, int height, int bps_stream,
+ int bps_video, int bps_audio, float fps,
+ int videoFrames, int audioFrames, int duration, String vcodec, String acodec) {
int event_mask = 0;
+ if( state == State.Uninitialized ) {
+ event_mask |= GLMediaEventListener.EVENT_CHANGE_INIT;
+ state = State.Initialized;
+ }
+ if( STREAM_ID_AUTO == vid ) {
+ vid = STREAM_ID_NONE;
+ }
+ if( this.vid != vid ) {
+ event_mask |= GLMediaEventListener.EVENT_CHANGE_VID;
+ this.vid = vid;
+ }
+ if( STREAM_ID_AUTO == vid ) {
+ vid = STREAM_ID_NONE;
+ }
+ if( this.aid != aid ) {
+ event_mask |= GLMediaEventListener.EVENT_CHANGE_AID;
+ this.aid = aid;
+ }
if( this.width != width || this.height != height ) {
event_mask |= GLMediaEventListener.EVENT_CHANGE_SIZE;
this.width = width;
this.height = height;
- }
+ }
if( this.fps != fps ) {
event_mask |= GLMediaEventListener.EVENT_CHANGE_FPS;
this.fps = fps;
+ this.frame_duration = 1000f / fps;
}
if( this.bps_stream != bps_stream || this.bps_video != bps_video || this.bps_audio != bps_audio ) {
event_mask |= GLMediaEventListener.EVENT_CHANGE_BPS;
@@ -432,12 +1312,13 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
this.bps_video = bps_video;
this.bps_audio = bps_audio;
}
- if( this.totalFrames != totalFrames || this.duration != duration ) {
+ if( this.videoFrames != videoFrames || this.audioFrames != audioFrames || this.duration != duration ) {
event_mask |= GLMediaEventListener.EVENT_CHANGE_LENGTH;
- this.totalFrames = totalFrames;
+ this.videoFrames = videoFrames;
+ this.audioFrames = audioFrames;
this.duration = duration;
}
- if( (null!=acodec && acodec.length()>0 && !this.acodec.equals(acodec)) ) {
+ if( (null!=acodec && acodec.length()>0 && !this.acodec.equals(acodec)) ) {
event_mask |= GLMediaEventListener.EVENT_CHANGE_CODEC;
this.acodec = acodec;
}
@@ -448,97 +1329,141 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
if(0==event_mask) {
return;
}
- attributesUpdated(event_mask);
+ attributesUpdated(event_mask);
}
- protected final void attributesUpdated(int event_mask) {
- synchronized(eventListenersLock) {
- for(Iterator<GLMediaEventListener> i = eventListeners.iterator(); i.hasNext(); ) {
- i.next().attributesChanges(this, event_mask, System.currentTimeMillis());
+ protected void setIsGLOriented(boolean isGLOriented) {
+ if( isInGLOrientation != isGLOriented ) {
+ if( DEBUG ) {
+ System.err.println("XXX gl-orient "+isInGLOrientation+" -> "+isGLOriented);
}
- }
- }
- protected final void newFrameAvailable() {
- frameNumber++;
- synchronized(eventListenersLock) {
- for(Iterator<GLMediaEventListener> i = eventListeners.iterator(); i.hasNext(); ) {
- i.next().newFrameAvailable(this, System.currentTimeMillis());
+ isInGLOrientation = isGLOriented;
+ for(int i=0; i<videoFramesOrig.length; i++) {
+ videoFramesOrig[i].getTexture().setMustFlipVertically(!isGLOriented);
}
+ attributesUpdated(GLMediaEventListener.EVENT_CHANGE_SIZE);
}
}
-
+
@Override
- public final synchronized State destroy(GL gl) {
- destroyImpl(gl);
- removeAllImageTextures(gl);
- state = State.Uninitialized;
- return state;
+ public final URI getURI() {
+ return streamLoc;
}
- protected abstract void destroyImpl(GL gl);
@Override
- public final synchronized URLConnection getURLConnection() {
- return urlConn;
- }
+ public final int getVID() { return vid; }
+
+ @Override
+ public final int getAID() { return aid; }
@Override
- public final synchronized String getVideoCodec() {
+ public final String getVideoCodec() {
return vcodec;
}
@Override
- public final synchronized String getAudioCodec() {
+ public final String getAudioCodec() {
return acodec;
}
@Override
- public final synchronized long getTotalFrames() {
- return totalFrames;
+ public final int getVideoFrames() {
+ return videoFrames;
}
@Override
- public final synchronized int getDuration() {
+ public final int getAudioFrames() {
+ return audioFrames;
+ }
+
+ @Override
+ public final int getDuration() {
return duration;
}
-
+
@Override
- public final synchronized long getStreamBitrate() {
+ public final long getStreamBitrate() {
return bps_stream;
}
@Override
- public final synchronized int getVideoBitrate() {
+ public final int getVideoBitrate() {
return bps_video;
}
-
+
@Override
- public final synchronized int getAudioBitrate() {
+ public final int getAudioBitrate() {
return bps_audio;
}
-
+
@Override
- public final synchronized float getFramerate() {
+ public final float getFramerate() {
return fps;
}
@Override
- public final synchronized int getWidth() {
+ public final boolean isGLOriented() {
+ return isInGLOrientation;
+ }
+
+ @Override
+ public final int getWidth() {
return width;
}
@Override
- public final synchronized int getHeight() {
+ public final int getHeight() {
return height;
}
@Override
- public final synchronized String toString() {
- final float ct = getCurrentPosition() / 1000.0f, tt = getDuration() / 1000.0f;
- final String loc = ( null != urlConn ) ? urlConn.getURL().toExternalForm() : "<undefined stream>" ;
- return "GLMediaPlayer["+state+", "+frameNumber+"/"+totalFrames+" frames, "+ct+"/"+tt+"s, speed "+playSpeed+", "+bps_stream+" bps, "+
- "Texture[count "+textureCount+", target "+toHexString(textureTarget)+", format "+toHexString(textureFormat)+", type "+toHexString(textureType)+"], "+
- "Stream[Video[<"+vcodec+">, "+width+"x"+height+", "+fps+" fps, "+bps_video+" bsp], "+
- "Audio[<"+acodec+">, "+bps_audio+" bsp]], "+loc+"]";
+ public final String toString() {
+ final float tt = getDuration() / 1000.0f;
+ final String loc = ( null != streamLoc ) ? streamLoc.toString() : "<undefined stream>" ;
+ final int freeVideoFrames = null != videoFramesFree ? videoFramesFree.size() : 0;
+ final int decVideoFrames = null != videoFramesDecoded ? videoFramesDecoded.size() : 0;
+ final int video_scr = video_scr_pts + (int) ( ( Platform.currentTimeMillis() - video_scr_t0 ) * playSpeed );
+ final String camPath = null != cameraPath ? ", camera: "+cameraPath : "";
+ return "GLMediaPlayer["+state+", vSCR "+video_scr+", frames[p "+presentedFrameCount+", d "+decodedFrameCount+", t "+videoFrames+" ("+tt+" s)], "+
+ "speed "+playSpeed+", "+bps_stream+" bps, "+
+ "Texture[count "+textureCount+", free "+freeVideoFrames+", dec "+decVideoFrames+", tagt "+toHexString(textureTarget)+", ifmt "+toHexString(textureInternalFormat)+", fmt "+toHexString(textureFormat)+", type "+toHexString(textureType)+"], "+
+ "Video[id "+vid+", <"+vcodec+">, "+width+"x"+height+", glOrient "+isInGLOrientation+", "+fps+" fps, "+frame_duration+" fdur, "+bps_video+" bps], "+
+ "Audio[id "+aid+", <"+acodec+">, "+bps_audio+" bps, "+audioFrames+" frames], uri "+loc+camPath+"]";
+ }
+
+ @Override
+ public final String getPerfString() {
+ final long currentTimeMillis = Platform.currentTimeMillis();
+ final int video_scr = video_scr_pts + (int) ( ( currentTimeMillis - video_scr_t0 ) * playSpeed );
+ final int d_vpts = video_pts_last - video_scr;
+ final int audio_scr = (int) ( ( currentTimeMillis - audio_scr_t0 ) * playSpeed );
+ final int audio_pts = getAudioPTSImpl();
+ final int d_apts = audio_pts - audio_scr;
+ return getPerfStringImpl( video_scr, video_pts_last, d_vpts, audio_scr, audio_pts, d_apts, getVideoDPTSAvg() );
+ }
+ private final String getPerfStringImpl(final int video_scr, final int video_pts, final int d_vpts,
+ final int audio_scr, final int audio_pts, final int d_apts,
+ final int video_dpts_avg_diff) {
+ final float tt = getDuration() / 1000.0f;
+ final String audioSinkInfo;
+ final AudioSink audioSink = getAudioSink();
+ if( null != audioSink ) {
+ audioSinkInfo = "AudioSink[frames [p "+audioSink.getEnqueuedFrameCount()+", q "+audioSink.getQueuedFrameCount()+", f "+audioSink.getFreeFrameCount()+", c "+audioSink.getFrameCount()+"], time "+audioSink.getQueuedTime()+", bytes "+audioSink.getQueuedByteCount()+"]";
+ } else {
+ audioSinkInfo = "";
+ }
+ final int freeVideoFrames, decVideoFrames;
+ if( null != videoFramesFree ) {
+ freeVideoFrames = videoFramesFree.size();
+ decVideoFrames = videoFramesDecoded.size();
+ } else {
+ freeVideoFrames = 0;
+ decVideoFrames = 0;
+ }
+ return state+", frames[(p "+presentedFrameCount+", d "+decodedFrameCount+") / "+videoFrames+", "+tt+" s], "+
+ "speed " + playSpeed+", dAV "+( d_vpts - d_apts )+", vSCR "+video_scr+", vpts "+video_pts+", dSCR["+d_vpts+", avrg "+video_dpts_avg_diff+"], "+
+ "aSCR "+audio_scr+", apts "+audio_pts+" ( "+d_apts+" ), "+audioSinkInfo+
+ ", Texture[count "+textureCount+", free "+freeVideoFrames+", dec "+decVideoFrames+"]";
}
@Override
@@ -562,13 +1487,13 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
@Override
- public final synchronized GLMediaEventListener[] getEventListeners() {
+ public final GLMediaEventListener[] getEventListeners() {
synchronized(eventListenersLock) {
return eventListeners.toArray(new GLMediaEventListener[eventListeners.size()]);
}
}
- private Object eventListenersLock = new Object();
+ private final Object eventListenersLock = new Object();
protected static final String toHexString(long v) {
return "0x"+Long.toHexString(v);
@@ -576,5 +1501,15 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
protected static final String toHexString(int v) {
return "0x"+Integer.toHexString(v);
}
-
+ protected static final int getPropIntVal(Map<String, String> props, String key) {
+ final String val = props.get(key);
+ try {
+ return Integer.valueOf(val).intValue();
+ } catch (NumberFormatException nfe) {
+ if(DEBUG) {
+ System.err.println("Not a valid integer for <"+key+">: <"+val+">");
+ }
+ }
+ return 0;
+ }
}
\ No newline at end of file
diff --git a/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java b/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java
index a5fedce..6e006d9 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java
@@ -1,5 +1,6 @@
package jogamp.opengl.util.av;
+import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.sound.sampled.AudioSystem;
@@ -21,45 +22,79 @@ public class JavaSoundAudioSink implements AudioSink {
public static final int BUFFER_SIZE = 1000;
public static final int SAMPLES_PER_BUFFER = BUFFER_SIZE / 2;
private static final boolean staticAvailable;
-
+
// Sample time values
// public static final double SAMPLE_TIME_IN_SECS = 1.0 / DEFAULT_SAMPLE_RATE;
// public static final double BUFFER_TIME_IN_SECS = SAMPLE_TIME_IN_SECS * SAMPLES_PER_BUFFER;
-
+
private javax.sound.sampled.AudioFormat format;
private DataLine.Info info;
private SourceDataLine auline;
private int bufferCount;
- private byte [] sampleData = new byte[BUFFER_SIZE];
+ private byte [] sampleData = new byte[BUFFER_SIZE];
private boolean initialized = false;
- private AudioDataFormat chosenFormat = null;
-
+ private AudioSink.AudioFormat chosenFormat = null;
+
+ private volatile boolean playRequested = false;
+ private float volume = 1.0f;
+
static {
boolean ok = false;
try {
AudioSystem.getAudioFileTypes();
ok = true;
} catch (Throwable t) {
-
+
}
staticAvailable=ok;
- }
-
+ }
+
@Override
public String toString() {
return "JavaSoundSink[init "+initialized+", dataLine "+info+", source "+auline+", bufferCount "+bufferCount+
", chosen "+chosenFormat+", jsFormat "+format;
}
-
+
+ @Override
+ public final float getPlaySpeed() { return 1.0f; } // FIXME
+
+ @Override
+ public final boolean setPlaySpeed(float rate) {
+ return false; // FIXME
+ }
+
+ @Override
+ public final float getVolume() {
+ // FIXME
+ return volume;
+ }
+
+ @Override
+ public final boolean setVolume(float v) {
+ // FIXME
+ volume = v;
+ return true;
+ }
+
@Override
- public AudioDataFormat getPreferredFormat() {
+ public AudioSink.AudioFormat getPreferredFormat() {
return DefaultFormat;
}
-
+
+ @Override
+ public final int getMaxSupportedChannels() {
+ return 2;
+ }
+
@Override
- public AudioDataFormat initSink(AudioDataFormat requestedFormat, int bufferCount) {
+ public final boolean isSupported(AudioSink.AudioFormat format) {
+ return true;
+ }
+
+ @Override
+ public boolean init(AudioSink.AudioFormat requestedFormat, float frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit) {
if( !staticAvailable ) {
- return null;
+ return false;
}
// Create the audio format we wish to use
format = new javax.sound.sampled.AudioFormat(requestedFormat.sampleRate, requestedFormat.sampleSize, requestedFormat.channelCount, requestedFormat.signed, !requestedFormat.littleEndian);
@@ -80,9 +115,59 @@ public class JavaSoundAudioSink implements AudioSink {
} catch (Exception e) {
initialized=false;
}
- return chosenFormat;
+ return true;
+ }
+
+ @Override
+ public boolean isPlaying() {
+ return playRequested && auline.isRunning();
}
-
+
+ @Override
+ public void play() {
+ if( null != auline ) {
+ playRequested = true;
+ playImpl();
+ }
+ }
+ private void playImpl() {
+ if( playRequested && !auline.isRunning() ) {
+ auline.start();
+ }
+ }
+
+ @Override
+ public void pause() {
+ if( null != auline ) {
+ playRequested = false;
+ auline.stop();
+ }
+ }
+
+ @Override
+ public void flush() {
+ if( null != auline ) {
+ playRequested = false;
+ auline.stop();
+ auline.flush();
+ }
+ }
+
+ @Override
+ public final int getEnqueuedFrameCount() {
+ return 0; // FIXME
+ }
+
+ @Override
+ public int getFrameCount() {
+ return 1;
+ }
+
+ @Override
+ public int getQueuedFrameCount() {
+ return 0;
+ }
+
@Override
public boolean isInitialized() {
return initialized;
@@ -94,42 +179,51 @@ public class JavaSoundAudioSink implements AudioSink {
chosenFormat = null;
// FIXEM: complete code!
}
-
- public void writeData(AudioFrame audioFrame) {
- int data_size = audioFrame.dataSize;
- final byte[] lala = new byte[data_size];
- final int p = audioFrame.data.position();
- audioFrame.data.get(lala, 0, data_size);
- audioFrame.data.position(p);
-
+
+ @Override
+ public AudioFrame enqueueData(AudioDataFrame audioDataFrame) {
+ int byteSize = audioDataFrame.getByteSize();
+ final ByteBuffer byteBuffer = audioDataFrame.getData();
+ final byte[] bytes = new byte[byteSize];
+ final int p = byteBuffer.position();
+ byteBuffer.get(bytes, 0, byteSize);
+ byteBuffer.position(p);
+
int written = 0;
int len;
- while (data_size > 0) {
- // Nope: We don't make compromises for this crappy API !
- len = auline.write(lala, written, data_size);
- data_size -= len;
+ while (byteSize > 0) {
+ len = auline.write(bytes, written, byteSize);
+ byteSize -= len;
written += len;
- }
+ }
+ playImpl();
+ return audioDataFrame;
+ }
+
+ @Override
+ public AudioFrame enqueueData(int pts, ByteBuffer bytes, int byteCount) {
+ return enqueueData(new AudioDataFrame(pts, chosenFormat.getBytesDuration(byteCount), bytes, byteCount));
}
@Override
public int getQueuedByteCount() {
- return auline.available();
+ return auline.getBufferSize() - auline.available();
}
-
+
@Override
- public int getQueuedTime() {
- return 0; // FIXME
+ public int getFreeFrameCount() {
+ return auline.available();
}
-
@Override
- public int getWritableBufferCount() {
- return 1;
+ public int getQueuedTime() {
+ return getQueuedTimeImpl( getQueuedByteCount() );
}
-
- public boolean isDataAvailable(int data_size) {
- return auline.available()>=data_size;
+ private final int getQueuedTimeImpl(int byteCount) {
+ final int bytesPerSample = chosenFormat.sampleSize >>> 3; // /8
+ return byteCount / ( chosenFormat.channelCount * bytesPerSample * ( chosenFormat.sampleRate / 1000 ) );
}
+ @Override
+ public final int getPTS() { return 0; } // FIXME
}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java b/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java
index cef1c33..8d3dbdf 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java
@@ -1,6 +1,8 @@
package jogamp.opengl.util.av;
+import java.nio.ByteBuffer;
+
import com.jogamp.opengl.util.av.AudioSink;
public class NullAudioSink implements AudioSink {
@@ -10,41 +12,118 @@ public class NullAudioSink implements AudioSink {
return true;
}
+ private volatile float playSpeed = 1.0f;
+ private volatile boolean playRequested = false;
+ private float volume = 1.0f;
+
+ @Override
+ public final float getPlaySpeed() { return playSpeed; }
+
+ @Override
+ public final boolean setPlaySpeed(float rate) {
+ if( Math.abs(1.0f - rate) < 0.01f ) {
+ rate = 1.0f;
+ }
+ playSpeed = rate;
+ return true;
+ }
+
+ @Override
+ public final float getVolume() {
+ // FIXME
+ return volume;
+ }
+
@Override
- public AudioDataFormat getPreferredFormat() {
+ public final boolean setVolume(float v) {
+ // FIXME
+ volume = v;
+ return true;
+ }
+
+ @Override
+ public AudioFormat getPreferredFormat() {
return DefaultFormat;
}
@Override
- public AudioDataFormat initSink(AudioDataFormat requestedFormat, int bufferCount) {
- return requestedFormat;
+ public final int getMaxSupportedChannels() {
+ return 8;
}
-
+
+ @Override
+ public final boolean isSupported(AudioFormat format) {
+ return true;
+ }
+
+ @Override
+ public boolean init(AudioFormat requestedFormat, float frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit) {
+ return true;
+ }
+
+ @Override
+ public boolean isPlaying() {
+ return playRequested;
+ }
+
+ @Override
+ public void play() {
+ playRequested = true;
+ }
+
+ @Override
+ public void pause() {
+ playRequested = false;
+ }
+
+ @Override
+ public void flush() {
+ }
+
@Override
public void destroy() {
}
-
+
+ @Override
+ public final int getEnqueuedFrameCount() {
+ return 0;
+ }
+
+ @Override
+ public int getFrameCount() {
+ return 0;
+ }
+
+ @Override
+ public int getQueuedFrameCount() {
+ return 0;
+ }
+
@Override
public int getQueuedByteCount() {
return 0;
}
-
+
@Override
public int getQueuedTime() {
return 0;
}
@Override
- public int getWritableBufferCount() {
- return 1;
+ public final int getPTS() { return 0; }
+
+ @Override
+ public int getFreeFrameCount() {
+ return 1;
}
-
+
@Override
- public boolean isDataAvailable(int data_size) {
- return false;
+ public AudioFrame enqueueData(AudioDataFrame audioDataFrame) {
+ return null;
}
@Override
- public void writeData(AudioFrame audioFrame) {
+ public AudioFrame enqueueData(int pts, ByteBuffer bytes, int byteCount) {
+ return null;
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java
index cd48c39..fc621a1 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -32,12 +32,15 @@ import java.net.URLConnection;
import java.nio.ByteBuffer;
import javax.media.opengl.GL;
+import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
import jogamp.opengl.util.av.GLMediaPlayerImpl;
import com.jogamp.common.nio.Buffers;
+import com.jogamp.common.os.Platform;
import com.jogamp.common.util.IOUtil;
+import com.jogamp.opengl.util.av.GLMediaPlayer;
import com.jogamp.opengl.util.texture.Texture;
import com.jogamp.opengl.util.texture.TextureData;
import com.jogamp.opengl.util.texture.TextureIO;
@@ -49,114 +52,126 @@ import com.jogamp.opengl.util.texture.TextureSequence;
*/
public class NullGLMediaPlayer extends GLMediaPlayerImpl {
private TextureData texData = null;
- private TextureSequence.TextureFrame frame = null;
private int pos_ms = 0;
- private int pos_start = 0;
-
+ private long pos_start = 0;
+
public NullGLMediaPlayer() {
super();
- this.setTextureCount(1);
+
}
@Override
- protected boolean setPlaySpeedImpl(float rate) {
+ protected final boolean setPlaySpeedImpl(float rate) {
return false;
}
@Override
- protected boolean startImpl() {
- pos_start = (int)System.currentTimeMillis();
+ protected final boolean playImpl() {
+ pos_start = Platform.currentTimeMillis();
return true;
}
@Override
- protected boolean pauseImpl() {
+ protected final boolean pauseImpl() {
return true;
}
@Override
- protected boolean stopImpl() {
- return true;
- }
-
- @Override
- protected int seekImpl(int msec) {
+ protected final int seekImpl(int msec) {
pos_ms = msec;
validatePos();
return pos_ms;
}
-
- @Override
- protected TextureSequence.TextureFrame getLastTextureImpl() {
- return frame;
- }
@Override
- protected TextureSequence.TextureFrame getNextTextureImpl(GL gl, boolean blocking) {
- return frame;
+ protected final int getNextTextureImpl(GL gl, TextureFrame nextFrame) {
+ final int pts = getAudioPTSImpl();
+ nextFrame.setPTS( pts );
+ return pts;
}
-
+
@Override
- protected int getCurrentPositionImpl() {
- pos_ms = (int)System.currentTimeMillis() - pos_start;
+ protected final int getAudioPTSImpl() {
+ pos_ms = (int) ( Platform.currentTimeMillis() - pos_start );
validatePos();
return pos_ms;
}
@Override
- protected void destroyImpl(GL gl) {
+ protected final void destroyImpl(GL gl) {
+ if(null != texData) {
+ texData.destroy();
+ texData = null;
+ }
}
-
- @Override
- protected void initGLStreamImpl(GL gl, int[] texNames) throws IOException {
+
+ public final static TextureData createTestTextureData() {
+ TextureData res = null;
try {
- URLConnection urlConn = IOUtil.getResource("jogl/util/data/av/test-ntsc01-160x90.png", this.getClass().getClassLoader());
+ URLConnection urlConn = IOUtil.getResource("jogl/util/data/av/test-ntsc01-160x90.png", NullGLMediaPlayer.class.getClassLoader());
if(null != urlConn) {
- texData = TextureIO.newTextureData(GLProfile.getGL2ES2(), urlConn.getInputStream(), false, TextureIO.PNG);
+ res = TextureIO.newTextureData(GLProfile.getGL2ES2(), urlConn.getInputStream(), false, TextureIO.PNG);
}
} catch (Exception e) {
e.printStackTrace();
}
- if(null != texData) {
- width = texData.getWidth();
- height = texData.getHeight();
- } else {
- width = 640;
- height = 480;
- ByteBuffer buffer = Buffers.newDirectByteBuffer(width*height*4);
+ if(null == res) {
+ final int w = 160;
+ final int h = 90;
+ ByteBuffer buffer = Buffers.newDirectByteBuffer(w*h*4);
while(buffer.hasRemaining()) {
buffer.put((byte) 0xEA); buffer.put((byte) 0xEA); buffer.put((byte) 0xEA); buffer.put((byte) 0xEA);
}
buffer.rewind();
- texData = new TextureData(GLProfile.getGL2ES2(),
- GL.GL_RGBA, width, height, 0,
- GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, false,
+ res = new TextureData(GLProfile.getGL2ES2(),
+ GL.GL_RGBA, w, h, 0,
+ GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, false,
false, false, buffer, null);
}
- fps = 24f;
- duration = 10*60*1000; // msec
- totalFrames = (int) ( (duration/1000)*fps );
- vcodec = "png-static";
+ return res;
+ }
+
+ @Override
+ protected final void initStreamImpl(int vid, int aid) throws IOException {
+ texData = createTestTextureData();
+ final float _fps = 24f;
+ final int _duration = 10*60*1000; // msec
+ final int _totalFrames = (int) ( (_duration/1000)*_fps );
+ updateAttributes(0 /* fake */, GLMediaPlayer.STREAM_ID_NONE,
+ texData.getWidth(), texData.getHeight(), 0,
+ 0, 0, _fps,
+ _totalFrames, 0, _duration, "png-static", null);
+ }
+ @Override
+ protected final void initGLImpl(GL gl) throws IOException, GLException {
+ isInGLOrientation = true;
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Returns {@link GLMediaPlayer#TEXTURE_COUNT_MIN}.
+ * </p>
+ */
+ @Override
+ protected int validateTextureCount(int desiredTextureCount) {
+ return TEXTURE_COUNT_MIN;
}
-
+
@Override
- protected TextureSequence.TextureFrame createTexImage(GL gl, int idx, int[] tex) {
- Texture texture = super.createTexImageImpl(gl, idx, tex, width, height, false);
+ protected final TextureSequence.TextureFrame createTexImage(GL gl, int texName) {
+ final Texture texture = super.createTexImageImpl(gl, texName, width, height);
if(null != texData) {
texture.updateImage(gl, texData);
- texData.destroy();
- texData = null;
- }
- frame = new TextureSequence.TextureFrame( texture );
- return frame;
+ }
+ return new TextureSequence.TextureFrame( texture );
}
-
+
@Override
- protected void destroyTexImage(GL gl, TextureSequence.TextureFrame imgTex) {
- frame = null;
- super.destroyTexImage(gl, imgTex);
+ protected final void destroyTexFrame(GL gl, TextureSequence.TextureFrame frame) {
+ super.destroyTexFrame(gl, frame);
}
-
+
private void validatePos() {
boolean considerPausing = false;
if( 0 > pos_ms) {
diff --git a/src/jogl/classes/jogamp/opengl/util/av/SyncedRingbuffer.java b/src/jogl/classes/jogamp/opengl/util/av/SyncedRingbuffer.java
deleted file mode 100644
index 5f5d69c..0000000
--- a/src/jogl/classes/jogamp/opengl/util/av/SyncedRingbuffer.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/**
- * 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.
- */
-
-package jogamp.opengl.util.av;
-
-/**
- * Simple synchronized ring buffer implementation.
- * <p>
- * Caller can chose whether to block until get / put is able to proceed or not.
- * </p>
- * <p>
- * Caller can chose whether to pass an empty array and clear references at get,
- * or using a preset array for circular access of same objects.
- * </p>
- * <p>
- * Circular write position is equal to the read position if buffer is full or if buffer is empty.
- * </p>
- */
-public class SyncedRingbuffer<T> {
-
- protected final Object sync = new Object();
- protected final T[] array;
- protected final int capacity;
- protected int readPos;
- protected int writePos;
- protected int size;
-
- public final String toString() {
- return "SyncedRingbuffer<?>[filled "+size+" / "+capacity+", writePos "+writePos+", readPos "+readPos+"]";
- }
-
- /**
- * Create instance w/ the given array and it's capacity, e.g.:
- * <pre>
- * SyncedRingbuffer r = new SyncedRingbuffer<Integer>(new Integer[10]);
- * </pre>
- * <p>
- * The array may either be clear, or preset w/ elements!
- * </p>
- * @param full if true, given array is assumed to be full, i.e. {@link #isFull()} will return true.
- * @param array
- */
- public SyncedRingbuffer(T[] array, boolean full) {
- this.array = array;
- this.capacity = array.length;
- clearImpl(false);
- if(full) {
- size = capacity;
- }
- }
-
- public final int capacity() {
- return capacity;
- }
-
- /**
- * Resets all ring buffer pointer to zero.
- * <p>
- * {@link #isEmpty()} will return <code>true</code> after calling this method.
- * </p>
- * <p>
- * If <code>clearRefs</code> is true, all ring buffer slots will be set to <code>null</code>.
- * </p>
- * @param clearRefs if true, all ring buffer slots will be flushed, otherwise they remain intact.
- */
- public final void clear(boolean clearRefs) {
- synchronized ( sync ) {
- clearImpl(clearRefs);
- }
- }
-
- private final void clearImpl(boolean clearRefs) {
- readPos = 0;
- writePos = 0;
- size = 0;
- if( clearRefs ) {
- for(int i=0; i<capacity; i++) {
- this.array[i] = null;
- }
- }
- }
-
- /** Returns the number of elements in this ring buffer. */
- public final int size() {
- synchronized ( sync ) {
- return size;
- }
- }
-
- /** Returns the number of free slots available to put. */
- public final int getFreeSlots() {
- synchronized ( sync ) {
- return capacity - size;
- }
- }
-
- /** Returns true if this ring buffer is empty, otherwise false. */
- public final boolean isEmpty() {
- synchronized ( sync ) {
- return 0 == size;
- }
- }
-
- /** Returns true if this ring buffer is full, otherwise false. */
- public final boolean isFull() {
- synchronized ( sync ) {
- return capacity == size;
- }
- }
-
- /**
- * Returns the oldest put element if available, otherwise null.
- * <p>
- * Impl. returns the element at the current read position
- * and advances the read position - if available.
- * </p>
- * <p>
- * If <code>clearRef</code> is true, the returned ring buffer slot will be set to <code>null</code>.
- * </p>
- * <p>
- * Method is non blocking and returns immediately;.
- * </p>
- * @param clearRef if true, the returned ring buffer slot will be flushed, otherwise it remains intact.
- * @return the oldest put element if available, otherwise null.
- */
- public final T get(boolean clearRef) {
- try {
- return getImpl(clearRef, false, false);
- } catch (InterruptedException ie) { throw new RuntimeException(ie); }
- }
-
- /**
- * Returns the oldest put element.
- * <p>
- * Impl. returns the element at the current read position
- * and advances the read position.
- * </p>
- * <p>
- * If <code>clearRef</code> is true, the returned ring buffer slot will be set to <code>null</code>.
- * </p>
- * <p>
- * Methods blocks until an element becomes available via put.
- * </p>
- * @param clearRef if true, the returned ring buffer slot will be flushed, otherwise it remains intact.
- * @return the oldest put element
- * @throws InterruptedException
- */
- public final T getBlocking(boolean clearRef) throws InterruptedException {
- return getImpl(clearRef, true, false);
- }
-
- public final T peek() throws InterruptedException {
- return getImpl(false, false, true);
- }
- public final T peekBlocking() throws InterruptedException {
- return getImpl(false, true, true);
- }
-
- private final T getImpl(boolean clearRef, boolean blocking, boolean peek) throws InterruptedException {
- synchronized ( sync ) {
- if( 0 == size ) {
- if( blocking ) {
- while( 0 == size ) {
- sync.wait();
- }
- } else {
- return null;
- }
- }
- final T r = array[readPos];
- if( !peek ) {
- if( clearRef ) {
- array[readPos] = null;
- }
- readPos = (readPos + 1) % capacity;
- size--;
- sync.notifyAll(); // notify waiting putter
- }
- return r;
- }
- }
-
- /**
- * Puts the element <code>e</code> at the current write position
- * and advances the write position.
- * <p>
- * Returns true if successful, otherwise false in case buffer is full.
- * </p>
- * <p>
- * Method is non blocking and returns immediately;.
- * </p>
- */
- public final boolean put(T e) {
- try {
- return putImpl(e, false, false);
- } catch (InterruptedException ie) { throw new RuntimeException(ie); }
- }
-
- /**
- * Puts the element <code>e</code> at the current write position
- * and advances the write position.
- * <p>
- * Method blocks until a free slot becomes available via get.
- * </p>
- * @throws InterruptedException
- */
- public final void putBlocking(T e) throws InterruptedException {
- if( !putImpl(e, false, true) ) {
- throw new InternalError("Blocking put failed: "+this);
- }
- }
-
- /**
- * Keeps the element at the current write position intact
- * and advances the write position.
- * <p>
- * Returns true if successful, otherwise false in case buffer is full.
- * </p>
- * <p>
- * If <code>blocking</code> is true, method blocks until a free slot becomes available via get.
- * </p>
- * @param blocking if true, wait until a free slot becomes available via get.
- * @throws InterruptedException
- */
- public final boolean putSame(boolean blocking) throws InterruptedException {
- return putImpl(null, true, blocking);
- }
-
- private final boolean putImpl(T e, boolean sameRef, boolean blocking) throws InterruptedException {
- synchronized ( sync ) {
- if( capacity <= size ) {
- if( blocking ) {
- while( capacity <= size ) {
- sync.wait();
- }
- } else {
- return false;
- }
- }
- if( !sameRef ) {
- array[ writePos ] = e;
- }
- writePos = (writePos + 1) % capacity;
- size++;
- sync.notifyAll(); // notify waiting getter
- return true;
- }
- }
-
- public final void waitForFreeSlots(int count) throws InterruptedException {
- synchronized ( sync ) {
- if( capacity - size < count ) {
- while( capacity - size < count ) {
- System.err.println("XXXX AAA XXX");
- sync.wait();
- }
- }
- }
- }
-
-}
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 852e514..a6a6fba 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,22 +20,20 @@
* 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;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import javax.media.opengl.GLProfile;
@@ -43,175 +41,269 @@ import javax.media.opengl.GLProfile;
import com.jogamp.common.os.DynamicLibraryBundle;
import com.jogamp.common.os.DynamicLibraryBundleInfo;
import com.jogamp.common.util.RunnableExecutor;
+import com.jogamp.common.util.VersionNumber;
/**
- * FIXME: We need native structure access methods to deal with API changes
- * in the libav headers, which break binary compatibility!
- * Currently we are binary compatible w/ [0.6 ?, ] 0.7 and 0.8 but not w/ trunk.
- *
- * ChangeList for trunk:
- * Thu Jan 12 11:21:02 2012 a17479dfce67fbea2d0a1bf303010dce1e79059f major 53 -> 54
- * Mon Feb 27 22:40:11 2012 ee42df8a35c2b795f524c856834d0823dbd4e75d reorder AVStream and AVFormatContext
- * Tue Feb 28 12:07:53 2012 322537478b63c6bc01e640643550ff539864d790 minor 1 -> 2
+ * See {@link FFMPEGMediaPlayer#compatibility}.
*/
class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
+ private static final boolean DEBUG = FFMPEGMediaPlayer.DEBUG || DynamicLibraryBundleInfo.DEBUG;
+
private static final List<String> glueLibNames = new ArrayList<String>(); // none
-
- private static final int symbolCount = 32;
+
+ private static final int symbolCount = 65;
private static final String[] symbolNames = {
- "avcodec_version",
+ "avutil_version",
"avformat_version",
-/* 3 */ "avutil_version",
-
+ "avcodec_version",
+ "avresample_version",
+/* 5 */ "swresample_version",
+
// libavcodec
- "avcodec_close",
- "avcodec_string",
- "avcodec_find_decoder",
- "avcodec_open2", // 53.6.0 (opt)
- "avcodec_open",
- "avcodec_alloc_frame",
- "avcodec_default_get_buffer",
- "avcodec_default_release_buffer",
- "av_free_packet",
+ "avcodec_register_all",
+ "avcodec_close",
+ "avcodec_string",
+ "avcodec_find_decoder",
+ "avcodec_open2", // 53.6.0 (opt)
+ "avcodec_alloc_frame",
+ "avcodec_get_frame_defaults",
+ "avcodec_free_frame", // 54.28.0 (opt)
+ "avcodec_default_get_buffer", // <= 54 (opt), else sp_avcodec_default_get_buffer2
+ "avcodec_default_release_buffer", // <= 54 (opt), else sp_av_frame_unref
+ "avcodec_default_get_buffer2", // 55 (opt)
+ "avcodec_get_edge_width",
+ "av_image_fill_linesizes",
+ "avcodec_align_dimensions",
+ "avcodec_align_dimensions2",
+ "avcodec_flush_buffers",
+ "av_init_packet",
+ "av_new_packet",
+ "av_destruct_packet",
+ "av_free_packet",
"avcodec_decode_audio4", // 53.25.0 (opt)
- "avcodec_decode_audio3", // 52.23.0
-/* 15 */ "avcodec_decode_video2", // 52.23.0
-
+/* 27 */ "avcodec_decode_video2", // 52.23.0
+
// libavutil
- "av_pix_fmt_descriptors",
- "av_free",
+ "av_pix_fmt_descriptors",
+ "av_frame_unref", // 55.0.0 (opt)
+ "av_realloc",
+ "av_free",
"av_get_bits_per_pixel",
-/* 19 */ "av_samples_get_buffer_size",
-
+ "av_samples_get_buffer_size",
+ "av_get_bytes_per_sample", // 51.4.0
+ "av_opt_set_int", // 51.12.0
+ "av_dict_get",
+ "av_dict_count", // 54.* (opt)
+ "av_dict_set",
+/* 28 */ "av_dict_free",
+
// libavformat
"avformat_alloc_context",
"avformat_free_context", // 52.96.0 (opt)
"avformat_close_input", // 53.17.0 (opt)
- "av_close_input_file",
- "av_register_all",
- "avformat_open_input",
- "av_dump_format",
+ "av_register_all",
+ "av_find_input_format",
+ "avformat_open_input",
+ "av_dump_format",
"av_read_frame",
"av_seek_frame",
+ "avformat_seek_file", // ??? (opt)
+ "av_read_play",
+ "av_read_pause",
"avformat_network_init", // 53.13.0 (opt)
"avformat_network_deinit", // 53.13.0 (opt)
- "avformat_find_stream_info", // 53.3.0 (opt)
-/* 32 */ "av_find_stream_info",
- };
-
- // alternate symbol names
- private static final String[][] altSymbolNames = {
- { "avcodec_open", "avcodec_open2" }, // old, 53.6.0
- { "avcodec_decode_audio3", "avcodec_decode_audio4" }, // old, 53.25.0
- { "av_close_input_file", "avformat_close_input" }, // old, 53.17.0
- { "av_find_stream_info", "avformat_find_stream_info" }, // old, 53.3.0
+/* 54 */ "avformat_find_stream_info", // 53.3.0 (opt)
+
+ // libavdevice
+/* 55 */ "avdevice_register_all", // ???
+
+ // libavresample
+ "avresample_alloc_context", // 1.0.1
+ "avresample_open",
+ "avresample_close",
+ "avresample_free",
+/* 60 */ "avresample_convert",
+
+ // libavresample
+ "av_opt_set_sample_fmt", // actually lavu .. but exist only w/ swresample!
+ "swr_alloc",
+ "swr_init",
+ "swr_free",
+/* 65 */ "swr_convert",
+
};
-
+
// optional symbol names
private static final String[] optionalSymbolNames = {
- "avformat_free_context", // 52.96.0 (opt)
- "avformat_network_init", // 53.13.0 (opt)
- "avformat_network_deinit", // 53.13.0 (opt)
+ "avformat_seek_file", // ??? (opt)
+ "avcodec_free_frame", // 54.28.0 (opt)
+ "av_frame_unref", // 55.0.0 (opt)
+ "av_dict_count", // 54.* (opt)
+ "avcodec_default_get_buffer", // <= 54 (opt), else sp_avcodec_default_get_buffer2
+ "avcodec_default_release_buffer", // <= 54 (opt), else sp_av_frame_unref
+ "avcodec_default_get_buffer2", // 55 (opt)
+
+ // libavdevice
+ "avdevice_register_all", // 53.0.0 (opt)
+
+ // libavresample
+ "avresample_version", // 1.0.1
+ "avresample_alloc_context", // 1.0.1
+ "avresample_open",
+ "avresample_close",
+ "avresample_free",
+ "avresample_convert",
+
+ // libavresample
+ "av_opt_set_sample_fmt", // actually lavu .. but exist only w/ swresample!
+ "swresample_version", // 0
+ "swr_alloc",
+ "swr_init",
+ "swr_free",
+ "swr_convert",
};
-
- private static long[] symbolAddr;
+
+ 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;
+ static final VersionNumber avResampleVersion;
+ static final VersionNumber swResampleVersion;
+ private static final FFMPEGNatives natives;
+
+ private static final int LIB_IDX_UTI = 0;
+ private static final int LIB_IDX_FMT = 1;
+ private static final int LIB_IDX_COD = 2;
+ private static final int LIB_IDX_DEV = 3;
+ private static final int LIB_IDX_AVR = 4;
+ private static final int LIB_IDX_SWR = 5;
+
static {
- // native ffmpeg media player implementation is included in jogl_desktop and jogl_mobile
+ // native ffmpeg media player implementation is included in jogl_desktop and jogl_mobile
GLProfile.initSingleton();
boolean _ready = false;
+ /** util, format, codec, device, avresample, swresample */
+ boolean[] _loaded= new boolean[6];
+ /** util, format, codec, avresample, swresample */
+ VersionNumber[] _versions = new VersionNumber[5];
try {
- _ready = initSymbols();
+ _ready = initSymbols(_loaded, _versions);
} catch (Throwable t) {
t.printStackTrace();
}
- ready = _ready;
- if(!ready) {
- System.err.println("FFMPEG: Not Available");
+ 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];
+ avUtilVersion = _versions[0];
+ avFormatVersion = _versions[1];
+ avCodecVersion = _versions[2];
+ avResampleVersion = _versions[3];
+ swResampleVersion = _versions[4];
+ if(!libsUFCLoaded) {
+ System.err.println("LIB_AV Not Available: lavu, lavc, lavu");
+ natives = null;
+ ready = false;
+ } else if(!_ready) {
+ System.err.println("LIB_AV Not Matching");
+ natives = null;
+ ready = false;
+ } else {
+ if( avCodecVersion.getMajor() == 53 && avFormatVersion.getMajor() == 53 && avUtilVersion.getMajor() == 51 ) {
+ // lavc53.lavf53.lavu51
+ natives = new FFMPEGv08Natives();
+ } else if( avCodecVersion.getMajor() == 54 && avFormatVersion.getMajor() == 54 && avUtilVersion.getMajor() == 52 ) {
+ // lavc54.lavf54.lavu52.lavr01
+ natives = new FFMPEGv09Natives();
+ } else if( avCodecVersion.getMajor() == 55 && avFormatVersion.getMajor() == 55 && avUtilVersion.getMajor() == 52 ) {
+ // lavc55.lavf55.lavu52.lavr01
+ natives = new FFMPEGv10Natives();
+ } else {
+ System.err.println("LIB_AV No Version/Native-Impl Match");
+ natives = null;
+ }
+ if( null != natives && FFMPEGStaticNatives.initIDs0() ) {
+ ready = natives.initSymbols0(symbolAddr, symbolCount);
+ } else {
+ ready = false;
+ }
}
}
-
+
+ static boolean libsLoaded() { return libsUFCLoaded; }
+ static boolean avDeviceLoaded() { return avdeviceLoaded; }
+ static boolean avResampleLoaded() { return avresampleLoaded; }
+ static boolean swResampleLoaded() { return swresampleLoaded; }
+ static FFMPEGNatives getNatives() { return natives; }
static boolean initSingleton() { return ready; }
-
- private static final boolean initSymbols() {
+
+ /**
+ * @param loaded 6: util, format, codec, device, avresample, swresample
+ * @param versions 5: util, format, codec, avresample, swresample
+ * @return
+ */
+ private static final boolean initSymbols(boolean[] loaded, 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());
} } );
- final boolean avutilLoaded = dl.isToolLibLoaded(0);
- final boolean avformatLoaded = dl.isToolLibLoaded(1);
- final boolean avcodecLoaded = dl.isToolLibLoaded(2);
- if(!avutilLoaded || !avformatLoaded || !avcodecLoaded) {
- throw new RuntimeException("FFMPEG Tool library incomplete: [ avutil "+avutilLoaded+", avformat "+avformatLoaded+", avcodec "+avcodecLoaded+"]");
- }
- if(!dl.isToolLibComplete()) {
- throw new RuntimeException("FFMPEG Tool libraries incomplete");
+ 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);
}
- symbolAddr = new long[symbolCount];
-
+
// optional symbol name set
final Set<String> optionalSymbolNameSet = new HashSet<String>();
optionalSymbolNameSet.addAll(Arrays.asList(optionalSymbolNames));
-
- // alternate symbol name mapping to indexed array
- final Map<String, Integer> mAltSymbolNames = new HashMap<String, Integer>();
- final int[][] iAltSymbolNames = new int[altSymbolNames.length][];
- {
- final List<String> symbolNameList = Arrays.asList(symbolNames);
- for(int i=0; i<altSymbolNames.length; i++) {
- iAltSymbolNames[i] = new int[altSymbolNames[i].length];
- for(int j=0; j<altSymbolNames[i].length; j++) {
- mAltSymbolNames.put(altSymbolNames[i][j], new Integer(i));
- iAltSymbolNames[i][j] = symbolNameList.indexOf(altSymbolNames[i][j]);
- }
- }
- }
-
+
// 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) ) {
- // check for API changed symbols
- boolean ok = false;
- final Integer cI = mAltSymbolNames.get(symbol);
- if ( null != cI ) {
- // check whether alternative symbol is available
- final int ci = cI.intValue();
- for(int j=0; !ok && j<iAltSymbolNames[ci].length; j++) {
- final int si = iAltSymbolNames[ci][j];
- ok = 0 != symbolAddr[si];
- if(ok && (true || DEBUG )) { // keep it verbose per default for now ..
- System.err.println("OK: Unresolved symbol <"+symbol+">, but has alternative <"+symbolNames[si]+">");
- }
- }
- }
- if(!ok) {
- System.err.println("Fail: Could not resolve symbol <"+symbolNames[i]+">: not optional, no alternatives.");
- return false;
- }
- } else if(true || DEBUG ) { // keep it verbose per default for now ..
+ 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]+">");
}
}
}
- return initSymbols0(symbolAddr, symbolCount);
+ 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() {
}
@@ -223,12 +315,12 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
* <p>
* Returns <code>true</code>.
* </p>
- */
+ */
@Override
public final boolean shallLookupGlobal() {
- return true;
+ return true;
}
-
+
@Override
public final List<String> getGlueLibNames() {
return glueLibNames;
@@ -238,46 +330,88 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
public final List<List<String>> getToolLibNames() {
List<List<String>> libsList = new ArrayList<List<String>>();
+ // 6: util, format, codec, device, avresample, swresample
+
final List<String> avutil = new ArrayList<String>();
avutil.add("avutil"); // default
- avutil.add("libavutil.so.52"); // dummy future proof
+ avutil.add("libavutil.so.53"); // dummy future proof
+ avutil.add("libavutil.so.52"); // ffmpeg 1.2 + 2 / libav 9 + 10
avutil.add("libavutil.so.51"); // 0.8
avutil.add("libavutil.so.50"); // 0.7
-
- avutil.add("avutil-52"); // dummy future proof
+
+ avutil.add("avutil-53"); // dummy future proof
+ avutil.add("avutil-52"); // ffmpeg 1.2 + 2 / libav 9 + 10
avutil.add("avutil-51"); // 0.8
avutil.add("avutil-50"); // 0.7
libsList.add(avutil);
-
+
final List<String> avformat = new ArrayList<String>();
avformat.add("avformat"); // default
- avformat.add("libavformat.so.55"); // dummy future proof
- avformat.add("libavformat.so.54"); // 0.?
+ avformat.add("libavformat.so.56"); // dummy future proof
+ avformat.add("libavformat.so.55"); // ffmpeg 2 / 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-55"); // dummy future proof
- avformat.add("avformat-54"); // 0.?
+
+ avformat.add("avformat-56"); // dummy future proof
+ avformat.add("avformat-55"); // ffmpeg 2 / libav 10
+ avformat.add("avformat-54"); // ffmpeg 1.2 / libav 9
avformat.add("avformat-53"); // 0.8
avformat.add("avformat-52"); // 0.7
libsList.add(avformat);
-
+
final List<String> avcodec = new ArrayList<String>();
avcodec.add("avcodec"); // default
- avcodec.add("libavcodec.so.55"); // dummy future proof
- avcodec.add("libavcodec.so.54"); // 0.?
+ avcodec.add("libavcodec.so.56"); // dummy future proof
+ avcodec.add("libavcodec.so.55"); // ffmpeg 2/ 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-55"); // dummy future proof
- avcodec.add("avcodec-54"); // 0.?
+ 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-54"); // ffmpeg 1.2 / libav 9
avcodec.add("avcodec-53"); // 0.8
avcodec.add("avcodec-52"); // 0.7
libsList.add(avcodec);
-
+
+ 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.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-54"); // ffmpeg 1.2 / libav 10
+ avdevice.add("avdevice-53"); // 0.8 && libav 9
+ libsList.add(avdevice);
+
+ final List<String> avresample = new ArrayList<String>();
+ avresample.add("avresample"); // default
+
+ avresample.add("libavresample.so.2"); // dummy future proof
+ avresample.add("libavresample.so.1"); // libav 9 + 10
+
+ avresample.add("avresample-2"); // dummy future proof
+ 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("swresample-1"); // dummy future proof
+ swresample.add("swresample-0"); // ffmpeg 1.2 + 2.x
+ libsList.add(swresample);
+
return libsList;
}
@@ -299,7 +433,5 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
@Override
public final RunnableExecutor getLibLoaderExecutor() {
return DynamicLibraryBundle.getDefaultRunnableExecutor();
- }
-
- private static native boolean initSymbols0(long[] symbols, int count);
+ }
}
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 b6708b3..d2ef026 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -29,7 +29,6 @@
package jogamp.opengl.util.av.impl;
import java.io.IOException;
-import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -38,411 +37,639 @@ import javax.media.opengl.GL;
import javax.media.opengl.GL2ES2;
import javax.media.opengl.GLException;
+import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.IOUtil;
import com.jogamp.common.util.VersionNumber;
import com.jogamp.gluegen.runtime.ProcAddressTable;
+import com.jogamp.opengl.util.TimeFrameI;
import com.jogamp.opengl.util.GLPixelStorageModes;
import com.jogamp.opengl.util.av.AudioSink;
+import com.jogamp.opengl.util.av.AudioSink.AudioFormat;
import com.jogamp.opengl.util.av.AudioSinkFactory;
+import com.jogamp.opengl.util.av.GLMediaPlayer;
import com.jogamp.opengl.util.texture.Texture;
-import com.jogamp.opengl.util.texture.TextureSequence;
import jogamp.opengl.GLContextImpl;
-import jogamp.opengl.util.av.EGLMediaPlayerImpl;
-import jogamp.opengl.util.av.SyncedRingbuffer;
+import jogamp.opengl.util.av.GLMediaPlayerImpl;
+import jogamp.opengl.util.av.impl.FFMPEGNatives.PixelFormat;
+import jogamp.opengl.util.av.impl.FFMPEGNatives.SampleFormat;
/***
* Implementation utilizes <a href="http://libav.org/">Libav</a>
- * or <a href="http://ffmpeg.org/">FFmpeg</a> which is ubiquitous
- * available and usually pre-installed on Unix platforms. Due to legal
- * reasons we cannot deploy binaries of it, which contains patented codecs.
+ * or <a href="http://ffmpeg.org/">FFmpeg</a> which are ubiquitous
+ * available and usually pre-installed on Unix platforms.
+ * <p>
+ * Due to legal reasons we cannot deploy binaries of it, which contains patented codecs.
+ * </p>
+ * <p>
* Besides the default BSD/Linux/.. repositories and installations,
- * precompiled binaries can be found at the listed location below.
+ * precompiled binaries can be found at the
+ * <a href="#libavavail">listed location below</a>.
+ * </p>
+ *
+ * <a name="implspecifics"><h5>Implementation specifics</h5></a>
* <p>
- * Implements YUV420P to RGB fragment shader conversion
- * and the usual packed RGB formats.
- * The decoded video frame is written directly into an OpenGL texture
- * on the GPU in it's native format. A custom fragment shader converts
- * the native pixelformat to a usable RGB format if required.
- * Hence only 1 copy is required before bloating the picture
- * from YUV to RGB, for example.
- * </p>
+ * The decoded video frame is written directly into an OpenGL texture
+ * on the GPU in it's native format. A custom fragment shader converts
+ * the native pixelformat to a usable <i>RGB</i> format if required.
+ * Hence only 1 copy is required before bloating the picture
+ * from <i>YUV*</i> to <i>RGB</i>, for example.
+ * </p>
* <p>
- * Utilizes a slim dynamic and native binding to the Lib_av
+ * Implements pixel format conversion to <i>RGB</i> via
+ * fragment shader texture-lookup functions:
+ * <ul>
+ * <li>{@link PixelFormat#YUV420P}</li>
+ * <li>{@link PixelFormat#YUVJ420P}</li>
+ * <li>{@link PixelFormat#YUV422P}</li>
+ * <li>{@link PixelFormat#YUVJ422P}</li>
+ * <li>{@link PixelFormat#YUYV422}</li>
+ * <li>{@link PixelFormat#BGR24}</li>
+ * </ul>
+ * </p>
+ * <p>
+ *
+ * <a name="libavspecifics"><h5>Libav Specifics</h5></a>
+ * <p>
+ * Utilizes a slim dynamic and native binding to the Lib_av
* libraries:
* <ul>
- * <li>libavutil</li>
- * <li>libavformat</li>
* <li>libavcodec</li>
- * </ul>
+ * <li>libavformat</li>
+ * <li>libavutil</li>
+ * <li>libavresample (opt)</li>
+ * <li>libavdevice (opt)</li>
+ * </ul>
+ * </p>
+ *
+ * <a name="compatibility"><h5>LibAV Compatibility</h5></a>
+ * <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><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>52</td> <td>01/00</td> <td>FFMPEGv10</td></tr>
+ * </table>
* </p>
* <p>
- * http://libav.org/
+ * See http://upstream-tracker.org/versions/libav.html
* </p>
- * <p>
- * Check tag 'FIXME: Add more planar formats !'
+ * <p>
+ * Check tag 'FIXME: Add more planar formats !'
* here and in the corresponding native code
- * <code>jogl/src/jogl/native/ffmpeg/jogamp_opengl_util_av_impl_FFMPEGMediaPlayer.c</code>
+ * <code>jogl/src/jogl/native/libav/ffmpeg_impl_template.c</code>
* </p>
+ *
+ *
+ * <a name="todo"><h5>TODO:</h5></a>
* <p>
- * TODO:
* <ul>
- * <li>Audio Output</li>
- * <li>Off thread <i>next frame</i> processing using multiple target textures</li>
- * <li>better pts sync handling</li>
- * <li>fix seek</li>
- * </ul>
+ * <li>better audio synchronization handling? (video is synchronized)</li>
+ * </ul>
* </p>
- * Pre-compiled Libav / FFmpeg packages:
+ *
+ * <a name="libavavail"><h5>FFMPEG / LibAV Availability</h5></a>
+ * <p>
* <ul>
- * <li>Windows: http://ffmpeg.zeranoe.com/builds/</li>
- * <li>MacOSX: http://www.ffmpegx.com/</li>
+ * <li>GNU/Linux: ffmpeg or libav are deployed in most distributions.</li>
+ * <li>Windows:
+ * <ul>
+ * <li>http://ffmpeg.zeranoe.com/builds/ (ffmpeg) <i>recommended, works w/ dshow</i></li>
+ * <li>http://win32.libav.org/releases/ (libav)</li>
+ * </ul></li>
+ * <li>MacOSX: http://ffmpegmac.net/</li>
* <li>OpenIndiana/Solaris:<pre>
* pkg set-publisher -p http://pkg.openindiana.org/sfe-encumbered.
* pkt install pkg:/video/ffmpeg
* </pre></li>
- * </ul>
+ * </ul>
+ * </p>
*/
-public class FFMPEGMediaPlayer extends EGLMediaPlayerImpl {
+public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
- // Count of zeroed buffers to return before switching to real sample provider
- private static final int TEMP_BUFFER_COUNT = 20;
+ /** POSIX ENOSYS {@value}: Function not implemented. FIXME: Move to GlueGen ?!*/
+ private static final int ENOSYS = 38;
// Instance data
- public static final VersionNumber avUtilVersion;
- public static final VersionNumber avFormatVersion;
- public static final VersionNumber avCodecVersion;
- static final boolean available;
-
+ private static final FFMPEGNatives natives;
+ private static final int avUtilMajorVersionCC;
+ private static final int avFormatMajorVersionCC;
+ private static final int avCodecMajorVersionCC;
+ private static final int avResampleMajorVersionCC;
+ private static final int swResampleMajorVersionCC;
+ private static final boolean available;
+
static {
- if(FFMPEGDynamicLibraryBundleInfo.initSingleton()) {
- avUtilVersion = getAVVersion(getAvUtilVersion0());
- avFormatVersion = getAVVersion(getAvFormatVersion0());
- avCodecVersion = getAVVersion(getAvCodecVersion0());
- System.err.println("LIB_AV Util : "+avUtilVersion);
- System.err.println("LIB_AV Format: "+avFormatVersion);
- System.err.println("LIB_AV Codec : "+avCodecVersion);
- initIDs0();
- available = true;
+ final boolean libAVGood = FFMPEGDynamicLibraryBundleInfo.initSingleton();
+ final boolean libAVVersionGood;
+ if( FFMPEGDynamicLibraryBundleInfo.libsLoaded() ) {
+ natives = FFMPEGDynamicLibraryBundleInfo.getNatives();
+ if( null != natives ) {
+ avCodecMajorVersionCC = natives.getAvCodecMajorVersionCC0();
+ avFormatMajorVersionCC = natives.getAvFormatMajorVersionCC0();
+ avUtilMajorVersionCC = natives.getAvUtilMajorVersionCC0();
+ avResampleMajorVersionCC = natives.getAvResampleMajorVersionCC0();
+ swResampleMajorVersionCC = natives.getSwResampleMajorVersionCC0();
+ } else {
+ avUtilMajorVersionCC = 0;
+ avFormatMajorVersionCC = 0;
+ avCodecMajorVersionCC = 0;
+ avResampleMajorVersionCC = 0;
+ swResampleMajorVersionCC = 0;
+ }
+ final VersionNumber avCodecVersion = FFMPEGDynamicLibraryBundleInfo.avCodecVersion;
+ final VersionNumber avFormatVersion = FFMPEGDynamicLibraryBundleInfo.avFormatVersion;
+ final VersionNumber avUtilVersion = FFMPEGDynamicLibraryBundleInfo.avUtilVersion;
+ final VersionNumber avResampleVersion = FFMPEGDynamicLibraryBundleInfo.avResampleVersion;
+ final boolean avResampleLoaded = FFMPEGDynamicLibraryBundleInfo.avResampleLoaded();
+ final VersionNumber swResampleVersion = FFMPEGDynamicLibraryBundleInfo.swResampleVersion;
+ final boolean swResampleLoaded = FFMPEGDynamicLibraryBundleInfo.swResampleLoaded();
+ System.err.println("LIB_AV Codec : "+avCodecVersion+" [cc "+avCodecMajorVersionCC+"]");
+ System.err.println("LIB_AV Format : "+avFormatVersion+" [cc "+avFormatMajorVersionCC+"]");
+ System.err.println("LIB_AV Util : "+avUtilVersion+" [cc "+avUtilMajorVersionCC+"]");
+ System.err.println("LIB_AV Resample: "+avResampleVersion+" [cc "+avResampleMajorVersionCC+", loaded "+avResampleLoaded+"]");
+ System.err.println("LIB_SW Resample: "+swResampleVersion+" [cc "+swResampleMajorVersionCC+", loaded "+swResampleLoaded+"]");
+ System.err.println("LIB_AV Device : [loaded "+FFMPEGDynamicLibraryBundleInfo.avDeviceLoaded()+"]");
+ System.err.println("LIB_AV Class : "+(null!= natives ? natives.getClass().getSimpleName() : "n/a"));
+ libAVVersionGood = avCodecMajorVersionCC == avCodecVersion.getMajor() &&
+ avFormatMajorVersionCC == avFormatVersion.getMajor() &&
+ avUtilMajorVersionCC == avUtilVersion.getMajor() &&
+ ( !avResampleLoaded || avResampleMajorVersionCC < 0 || avResampleMajorVersionCC == avResampleVersion.getMajor() ) &&
+ ( !swResampleLoaded || swResampleMajorVersionCC < 0 || swResampleMajorVersionCC == swResampleVersion.getMajor() ) ;
+ if( !libAVVersionGood ) {
+ System.err.println("LIB_AV Not Matching Compile-Time / Runtime Major-Version");
+ }
} else {
- avUtilVersion = null;
- avFormatVersion = null;
- avCodecVersion = null;
- available = false;
+ natives = null;
+ avUtilMajorVersionCC = 0;
+ avFormatMajorVersionCC = 0;
+ avCodecMajorVersionCC = 0;
+ avResampleMajorVersionCC = 0;
+ swResampleMajorVersionCC = 0;
+ libAVVersionGood = false;
}
+ available = libAVGood && libAVVersionGood && null != natives;
}
-
+
public static final boolean isAvailable() { return available; }
- private static VersionNumber getAVVersion(int vers) {
- return new VersionNumber( ( vers >> 16 ) & 0xFF,
- ( vers >> 8 ) & 0xFF,
- ( vers >> 0 ) & 0xFF );
- }
-
+ //
+ // General
+ //
+
+ private long moviePtr = 0;
+
//
// Video
//
-
- protected long moviePtr = 0;
- protected long procAddrGLTexSubImage2D = 0;
- protected EGLMediaPlayerImpl.EGLTextureFrame lastTex = null;
- protected GLPixelStorageModes psm;
- protected PixelFormat vPixelFmt = null;
- protected int vPlanes = 0;
- protected int vBitsPerPixel = 0;
- protected int vBytesPerPixelPerPlane = 0;
- protected int[] vLinesize = { 0, 0, 0 }; // per plane
- protected int[] vTexWidth = { 0, 0, 0 }; // per plane
- protected int texWidth, texHeight; // overall (stuffing planes in one texture)
- protected ByteBuffer texCopy;
- protected String singleTexComp = "r";
+
+ private String texLookupFuncName = "ffmpegTexture2D";
+ private boolean usesTexLookupShader = false;
+ private PixelFormat vPixelFmt = null;
+ private int vPlanes = 0;
+ private int vBitsPerPixel = 0;
+ private int vBytesPerPixelPerPlane = 0;
+ private int texWidth, texHeight; // overall (stuffing planes in one texture)
+ private String singleTexComp = "r";
+ private GLPixelStorageModes psm;
//
// Audio
//
-
- protected static final boolean USE_AUDIO_PUSHER = false;
- protected final int AudioFrameCount = 8;
- protected final AudioSink audioSink;
- protected final int maxAvailableAudio;
- protected AudioSink.AudioDataFormat chosenAudioFormat;
- protected final SyncedRingbuffer<AudioSink.AudioFrame> audioFramesBuffer =
- USE_AUDIO_PUSHER ? new SyncedRingbuffer<AudioSink.AudioFrame>(new AudioSink.AudioFrame[AudioFrameCount], false /* full */)
- : null;
-
+
+ private AudioSink.AudioFormat avChosenAudioFormat;
+ private int audioSamplesPerFrameAndChannel = 0;
+
public FFMPEGMediaPlayer() {
- super(TextureType.GL, false);
if(!available) {
throw new RuntimeException("FFMPEGMediaPlayer not available");
}
- setTextureCount(1);
- moviePtr = createInstance0(DEBUG);
+ moviePtr = natives.createInstance0(this, DEBUG_NATIVE);
if(0==moviePtr) {
throw new GLException("Couldn't create FFMPEGInstance");
}
psm = new GLPixelStorageModes();
- audioSink = AudioSinkFactory.createDefault();
- maxAvailableAudio = audioSink.getQueuedByteCount();
+ audioSink = null;
}
-
- @Override
- protected TextureSequence.TextureFrame createTexImage(GL gl, int idx, int[] tex) {
- if(TextureType.GL == texType) {
- final Texture texture = super.createTexImageImpl(gl, idx, tex, texWidth, texHeight, true);
- lastTex = new EGLTextureFrame(null, texture, 0, 0);
- } else {
- throw new InternalError("n/a");
- }
- return lastTex;
- }
-
- @Override
- protected void destroyTexImage(GL gl, TextureSequence.TextureFrame imgTex) {
- lastTex = null;
- super.destroyTexImage(gl, imgTex);
- }
-
+
@Override
- protected void destroyImpl(GL gl) {
+ protected final void destroyImpl(GL gl) {
if (moviePtr != 0) {
- destroyInstance0(moviePtr);
+ natives.destroyInstance0(moviePtr);
moviePtr = 0;
}
+ destroyAudioSink();
}
-
+ private final void destroyAudioSink() {
+ final AudioSink _audioSink = audioSink;
+ if( null != _audioSink ) {
+ audioSink = null;
+ _audioSink.destroy();
+ }
+ }
+
+ public static final String dev_video_linux = "/dev/video";
+
@Override
- protected void initGLStreamImpl(GL gl, int[] texNames) throws IOException {
+ protected final void initStreamImpl(int vid, int aid) throws IOException {
if(0==moviePtr) {
throw new GLException("FFMPEG native instance null");
}
- final String urlS=urlConn.getURL().toExternalForm();
-
- chosenAudioFormat = audioSink.initSink(audioSink.getPreferredFormat(), AudioFrameCount);
- System.err.println("setURL: p1 "+this);
- setStream0(moviePtr, urlS, -1, -1, AudioFrameCount);
- System.err.println("setURL: p2 "+this);
-
- int tf, tif=GL.GL_RGBA; // texture format and internal format
- switch(vBytesPerPixelPerPlane) {
- case 1:
- if( gl.isGL3ES3() ) {
- // RED is supported on ES3 and >= GL3 [core]; ALPHA is deprecated on core
- tf = GL2ES2.GL_RED; tif=GL2ES2.GL_RED; singleTexComp = "r";
- } else {
- // ALPHA is supported on ES2 and GL2, i.e. <= GL3 [core] or compatibility
- tf = GL2ES2.GL_ALPHA; tif=GL2ES2.GL_ALPHA; singleTexComp = "a";
- }
- break;
- case 3: tf = GL2ES2.GL_RGB; tif=GL.GL_RGB; break;
- case 4: tf = GL2ES2.GL_RGBA; tif=GL.GL_RGBA; break;
- default: throw new RuntimeException("Unsupported bytes-per-pixel / plane "+vBytesPerPixelPerPlane);
- }
- setTextureFormat(tif, tf);
- setTextureType(GL.GL_UNSIGNED_BYTE);
- final GLContextImpl ctx = (GLContextImpl)gl.getContext();
- final ProcAddressTable pt = ctx.getGLProcAddressTable();
- procAddrGLTexSubImage2D = getAddressFor(pt, "glTexSubImage2D");
- if( 0 == procAddrGLTexSubImage2D ) {
- throw new InternalError("glTexSubImage2D n/a in ProcAddressTable: "+pt.getClass().getName()+" of "+ctx.getGLVersion());
+ if(DEBUG) {
+ System.err.println("initStream: p1 "+this);
+ }
+
+ final String streamLocS=IOUtil.decodeFromURI(streamLoc.toString());
+ destroyAudioSink();
+ if( GLMediaPlayer.STREAM_ID_NONE == aid ) {
+ audioSink = AudioSinkFactory.createNull();
+ } else {
+ audioSink = AudioSinkFactory.createDefault();
+ }
+ final AudioFormat preferredAudioFormat = audioSink.getPreferredFormat();
+ if(DEBUG) {
+ System.err.println("initStream: p2 preferred "+preferredAudioFormat+", "+this);
}
- }
-
- /**
- * Catches IllegalArgumentException and returns 0 if functionName is n/a,
- * otherwise the ProcAddressTable's field value.
- */
- private final long getAddressFor(final ProcAddressTable table, final String functionName) {
- return AccessController.doPrivileged(new PrivilegedAction<Long>() {
- public Long run() {
- try {
- return Long.valueOf( table.getAddressFor(functionName) );
- } catch (IllegalArgumentException iae) {
- return Long.valueOf(0);
- }
- }
- } ).longValue();
- }
- private final void pushSound(ByteBuffer sampleData, int data_size, int audio_pts) {
- if( USE_AUDIO_PUSHER ) {
- if( audioPusher != null && audioPusher.isRunning() ) {
- try {
- audioFramesBuffer.putBlocking(new AudioSink.AudioFrame(sampleData, data_size, audio_pts));
- } catch (InterruptedException e) {
- e.printStackTrace(); // oops
- }
+ final boolean isCameraInput = null != cameraPath;
+ final String resStreamLocS;
+ // int rw=640, rh=480, rr=15;
+ int rw=-1, rh=-1, rr=-1;
+ String sizes = null;
+ if( isCameraInput ) {
+ switch(Platform.OS_TYPE) {
+ case ANDROID:
+ // ??
+ case FREEBSD:
+ case HPUX:
+ case LINUX:
+ case SUNOS:
+ resStreamLocS = dev_video_linux + cameraPath;
+ break;
+ case WINDOWS:
+ resStreamLocS = cameraPath;
+ break;
+ case MACOS:
+ case OPENKODE:
+ default:
+ resStreamLocS = streamLocS; // FIXME: ??
+ break;
+ }
+ if( null != cameraProps ) {
+ sizes = cameraProps.get(CameraPropSizeS);
+ int v = getPropIntVal(cameraProps, CameraPropWidth);
+ if( v > 0 ) { rw = v; }
+ v = getPropIntVal(cameraProps, CameraPropHeight);
+ if( v > 0 ) { rh = v; }
+ v = getPropIntVal(cameraProps, CameraPropRate);
+ if( v > 0 ) { rr = v; }
}
} else {
- pushAudioFrame(new AudioSink.AudioFrame(sampleData, data_size, audio_pts));
+ resStreamLocS = streamLocS;
}
+ final int aMaxChannelCount = audioSink.getMaxSupportedChannels();
+ final int aPrefSampleRate = preferredAudioFormat.sampleRate;
+ // setStream(..) issues updateAttributes*(..), and defines avChosenAudioFormat, vid, aid, .. etc
+ natives.setStream0(moviePtr, resStreamLocS, isCameraInput, vid, sizes, rw, rh, rr, aid, aMaxChannelCount, aPrefSampleRate);
}
- private final void pushAudioFrame(AudioSink.AudioFrame audioFrame) {
- // poor mans audio sync ..
- final long now = System.currentTimeMillis();
- final long now_d = now - lastAudioTime;
- final long pts_d = audioFrame.audioPTS - lastAudioPTS;
- final long dt = (long) ( (float) ( pts_d - now_d ) / getPlaySpeed() ) ;
- final boolean sleep = dt > audio_dt_d;
- final long sleepP = dt - ( audio_dt_d / 2 );
- if(DEBUG) {
- final int qAT = audioSink.getQueuedTime();
- System.err.println("s: pts-a "+audioFrame.audioPTS+", qAT "+qAT+", pts-d "+pts_d+", now_d "+now_d+", dt "+dt+", sleep "+sleep+", sleepP "+sleepP+" ms");
- }
- if( sleep ) {
- try {
- Thread.sleep( sleepP );
- } catch (InterruptedException e) {
- e.printStackTrace(); // oops
- }
- lastAudioTime = System.currentTimeMillis();
+ @Override
+ protected final void initGLImpl(GL gl) throws IOException, GLException {
+ if(0==moviePtr) {
+ throw new GLException("FFMPEG native instance null");
+ }
+ if(null == audioSink) {
+ throw new GLException("AudioSink null");
+ }
+ final int audioQueueLimit;
+ if( null != gl && STREAM_ID_NONE != vid ) {
+ final GLContextImpl ctx = (GLContextImpl)gl.getContext();
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ final ProcAddressTable pt = ctx.getGLProcAddressTable();
+ final long procAddrGLTexSubImage2D = pt.getAddressFor("glTexSubImage2D");
+ final long procAddrGLGetError = pt.getAddressFor("glGetError");
+ final long procAddrGLFlush = pt.getAddressFor("glFlush");
+ final long procAddrGLFinish = pt.getAddressFor("glFinish");
+ natives.setGLFuncs0(moviePtr, procAddrGLTexSubImage2D, procAddrGLGetError, procAddrGLFlush, procAddrGLFinish);
+ return null;
+ } } );
+ audioQueueLimit = AudioSink.DefaultQueueLimitWithVideo;
} else {
- lastAudioTime = now;
+ audioQueueLimit = AudioSink.DefaultQueueLimitAudioOnly;
}
- if( audioSink.isDataAvailable(audioFrame.dataSize) ) {
- audioSink.writeData(audioFrame);
- lastAudioPTS=audioFrame.audioPTS;
+ if(DEBUG) {
+ System.err.println("initGL: p3 avChosen "+avChosenAudioFormat);
}
- }
-
- class AudioPusher extends Thread {
- volatile boolean shallStop = false;
- volatile boolean isBlocked = false;
-
- AudioPusher() {
- setDaemon(true);
- }
- public void requestStop() {
- shallStop = true;
- if( isBlocked ) {
- interrupt();
+
+ if( STREAM_ID_NONE == aid ) {
+ audioSink.destroy();
+ audioSink = AudioSinkFactory.createNull();
+ audioSink.init(AudioSink.DefaultFormat, 0, AudioSink.DefaultInitialQueueSize, AudioSink.DefaultQueueGrowAmount, audioQueueLimit);
+ } else {
+ final float frameDuration;
+ if( audioSamplesPerFrameAndChannel > 0 ) {
+ frameDuration= avChosenAudioFormat.getSamplesDuration(audioSamplesPerFrameAndChannel);
+ } else {
+ frameDuration = AudioSink.DefaultFrameDuration;
+ }
+ final boolean audioSinkOK = audioSink.init(avChosenAudioFormat, frameDuration, AudioSink.DefaultInitialQueueSize, AudioSink.DefaultQueueGrowAmount, audioQueueLimit);
+ if( !audioSinkOK ) {
+ System.err.println("AudioSink "+audioSink.getClass().getName()+" does not support "+avChosenAudioFormat+", using Null");
+ audioSink.destroy();
+ audioSink = AudioSinkFactory.createNull();
+ audioSink.init(avChosenAudioFormat, 0, AudioSink.DefaultInitialQueueSize, AudioSink.DefaultQueueGrowAmount, audioQueueLimit);
}
}
- public boolean isRunning() { return !shallStop; }
-
- public void run() {
- setName(getName()+"-AudioPusher_"+AudioPusherInstanceId);
- AudioPusherInstanceId++;
-
- while( !shallStop ){
- final AudioSink.AudioFrame audioFrame;
- try {
- isBlocked = true;
- audioFrame = audioFramesBuffer.getBlocking(true /* clearRef */);
- } catch (InterruptedException e) {
- if( !shallStop ) {
- e.printStackTrace(); // oops
+ if(DEBUG) {
+ System.err.println("initGL: p4 chosen "+avChosenAudioFormat);
+ System.err.println("initGL: p4 chosen "+audioSink);
+ }
+
+ if( null != gl && STREAM_ID_NONE != vid ) {
+ int tf, tif=GL.GL_RGBA; // texture format and internal format
+ int tt = GL.GL_UNSIGNED_BYTE;
+ switch(vBytesPerPixelPerPlane) {
+ case 1:
+ if( gl.isGL3ES3() ) {
+ // RED is supported on ES3 and >= GL3 [core]; ALPHA is deprecated on core
+ tf = GL2ES2.GL_RED; tif=GL2ES2.GL_RED; singleTexComp = "r";
+ } else {
+ // ALPHA is supported on ES2 and GL2, i.e. <= GL3 [core] or compatibility
+ tf = GL2ES2.GL_ALPHA; tif=GL2ES2.GL_ALPHA; singleTexComp = "a";
}
- shallStop = true;
- return;
- }
- isBlocked = false;
-
- if( null != audioFrame ) {
- FFMPEGMediaPlayer.this.pushAudioFrame(audioFrame);
- }
+ break;
+
+ case 2: if( vPixelFmt == PixelFormat.YUYV422 ) {
+ // YUYV422: // < packed YUV 4:2:2, 2x 16bpp, Y0 Cb Y1 Cr
+ // Stuffed into RGBA half width texture
+ tf = GL2ES2.GL_RGBA; tif=GL2ES2.GL_RGBA; break;
+ } else {
+ tf = GL2ES2.GL_RG; tif=GL2ES2.GL_RG; break;
+ }
+ case 3: tf = GL2ES2.GL_RGB; tif=GL.GL_RGB; break;
+ case 4: if( vPixelFmt == PixelFormat.BGRA ) {
+ tf = GL2ES2.GL_BGRA; tif=GL.GL_RGBA; break;
+ } else {
+ tf = GL2ES2.GL_RGBA; tif=GL.GL_RGBA; break;
+ }
+ default: throw new RuntimeException("Unsupported bytes-per-pixel / plane "+vBytesPerPixelPerPlane);
}
- }
- }
- static int AudioPusherInstanceId = 0;
- private AudioPusher audioPusher = null;
-
- private final void stopAudioPusher() {
- if( USE_AUDIO_PUSHER ) {
- if( null != audioPusher ) {
- audioPusher.requestStop();
- audioPusher = null;
+ setTextureFormat(tif, tf);
+ setTextureType(tt);
+ if(DEBUG) {
+ System.err.println("initGL: p5: video "+vPixelFmt+", planes "+vPlanes+", bpp "+vBitsPerPixel+"/"+vBytesPerPixelPerPlane+
+ ", tex "+texWidth+"x"+texHeight+", usesTexLookupShader "+usesTexLookupShader);
}
- audioFramesBuffer.clear(true);
}
}
- private final void startAudioPusher() {
- if( USE_AUDIO_PUSHER ) {
- stopAudioPusher();
- audioPusher = new AudioPusher();
- audioPusher.start();
+ @Override
+ protected final TextureFrame createTexImage(GL gl, int texName) {
+ return new TextureFrame( createTexImageImpl(gl, texName, texWidth, texHeight) );
+ }
+
+ /**
+ * @param sampleRate sample rate in Hz (1/s)
+ * @param sampleSize sample size in bits
+ * @param channelCount number of channels
+ * @param signed true if signed number, false for unsigned
+ * @param fixedP true for fixed point value, false for unsigned floating point value with a sampleSize of 32 (float) or 64 (double)
+ * @param planar true for planar data package (each channel in own data buffer), false for packed data channels interleaved in one buffer.
+ * @param littleEndian true for little-endian, false for big endian
+ * @return
+ */
+
+ /**
+ * Native callback
+ * Converts the given libav/ffmpeg values to {@link AudioFormat} and returns {@link AudioSink#isSupported(AudioFormat)}.
+ * @param audioSampleFmt ffmpeg/libav audio-sample-format, see {@link SampleFormat}.
+ * @param audioSampleRate sample rate in Hz (1/s)
+ * @param audioChannels number of channels
+ */
+ final boolean isAudioFormatSupported(int audioSampleFmt, int audioSampleRate, int audioChannels) {
+ final SampleFormat avFmt = SampleFormat.valueOf(audioSampleFmt);
+ final AudioFormat audioFormat = avAudioFormat2Local(avFmt, audioSampleRate, audioChannels);
+ final boolean res = audioSink.isSupported(audioFormat);
+ if( DEBUG ) {
+ System.err.println("AudioSink.isSupported: "+res+": av[fmt "+avFmt+", rate "+audioSampleRate+", chan "+audioChannels+"] -> "+audioFormat);
}
+ return res;
}
- private void updateAttributes2(int pixFmt, int planes, int bitsPerPixel, int bytesPerPixelPerPlane,
- int lSz0, int lSz1, int lSz2,
- int tWd0, int tWd1, int tWd2) {
- vPixelFmt = PixelFormat.valueOf(pixFmt);
- vPlanes = planes;
- vBitsPerPixel = bitsPerPixel;
- vBytesPerPixelPerPlane = bytesPerPixelPerPlane;
- vLinesize[0] = lSz0; vLinesize[1] = lSz1; vLinesize[2] = lSz2;
- vTexWidth[0] = tWd0; vTexWidth[1] = tWd1; vTexWidth[2] = tWd2;
-
- switch(vPixelFmt) {
- case YUV420P:
- // YUV420P: Adding U+V on right side of fixed height texture,
- // since width is already aligned by decoder.
- // Y=w*h, Y=w/2*h/2, U=w/2*h/2
- // w*h + 2 ( w/2 * h/2 )
- // w*h + w*h/2
- // 2*w/2 * h
- texWidth = vTexWidth[0] + vTexWidth[1]; texHeight = height;
+ /**
+ * Returns {@link AudioFormat} as converted from the given libav/ffmpeg values.
+ * @param audioSampleFmt ffmpeg/libav audio-sample-format, see {@link SampleFormat}.
+ * @param audioSampleRate sample rate in Hz (1/s)
+ * @param audioChannels number of channels
+ */
+ private final AudioFormat avAudioFormat2Local(SampleFormat audioSampleFmt, int audioSampleRate, int audioChannels) {
+ final int sampleSize;
+ boolean planar = true;
+ boolean fixedP = true;
+ final boolean signed;
+ switch( audioSampleFmt ) {
+ case S32:
+ planar = false;
+ case S32P:
+ sampleSize = 32;
+ signed = true;
+ break;
+ case S16:
+ planar = false;
+ case S16P:
+ sampleSize = 16;
+ signed = true;
+ break;
+ case U8:
+ planar = false;
+ case U8P:
+ sampleSize = 8;
+ signed = false;
break;
- // case PIX_FMT_YUYV422:
- case RGB24:
- case BGR24:
- case ARGB:
- case RGBA:
- case ABGR:
- case BGRA:
- texWidth = vTexWidth[0]; texHeight = height;
+ case DBL:
+ planar = false;
+ case DBLP:
+ sampleSize = 64;
+ signed = true;
+ fixedP = false;
break;
- default: // FIXME: Add more planar formats !
- throw new RuntimeException("Unsupported pixelformat: "+vPixelFmt);
+ case FLT:
+ planar = false;
+ case FLTP:
+ sampleSize = 32;
+ signed = true;
+ fixedP = false;
+ break;
+ default: // FIXME: Add more formats !
+ throw new IllegalArgumentException("Unsupported sampleformat: "+audioSampleFmt);
}
+ return new AudioFormat(audioSampleRate, sampleSize, audioChannels, signed, fixedP, planar, true /* littleEndian */);
+ }
+
+ /**
+ * Native callback
+ * @param vid
+ * @param pixFmt
+ * @param planes
+ * @param bitsPerPixel
+ * @param bytesPerPixelPerPlane
+ * @param tWd0
+ * @param tWd1
+ * @param tWd2
+ * @param aid
+ * @param audioSampleFmt
+ * @param audioSampleRate
+ * @param audioChannels
+ * @param audioSamplesPerFrameAndChannel in audio samples per frame and channel
+ */
+ void setupFFAttributes(int vid, int pixFmt, int planes, int bitsPerPixel, int bytesPerPixelPerPlane,
+ int tWd0, int tWd1, int tWd2, int vW, int vH,
+ int aid, int audioSampleFmt, int audioSampleRate,
+ int audioChannels, int audioSamplesPerFrameAndChannel) {
+ // defaults ..
+ vPixelFmt = null;
+ vPlanes = 0;
+ vBitsPerPixel = 0;
+ vBytesPerPixelPerPlane = 0;
+ usesTexLookupShader = false;
+ texWidth = 0; texHeight = 0;
+
+ final int[] vTexWidth = { 0, 0, 0 }; // per plane
+
+ if( STREAM_ID_NONE != vid ) {
+ vPixelFmt = PixelFormat.valueOf(pixFmt);
+ vPlanes = planes;
+ vBitsPerPixel = bitsPerPixel;
+ vBytesPerPixelPerPlane = bytesPerPixelPerPlane;
+ vTexWidth[0] = tWd0; vTexWidth[1] = tWd1; vTexWidth[2] = tWd2;
+
+ switch(vPixelFmt) {
+ case YUVJ420P:
+ case YUV420P: // < planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
+ usesTexLookupShader = true;
+ // YUV420P: Adding U+V on right side of fixed height texture,
+ // since width is already aligned by decoder.
+ // Splitting texture to 4 quadrants:
+ // Y covers left top/low quadrant
+ // U on top-right quadrant.
+ // V on low-right quadrant.
+ // Y=w*h, U=w/2*h/2, V=w/2*h/2
+ // w*h + 2 ( w/2 * h/2 )
+ // w*h + w*h/2
+ texWidth = vTexWidth[0] + vTexWidth[1]; texHeight = vH;
+ break;
+ case YUVJ422P:
+ case YUV422P:
+ usesTexLookupShader = true;
+ // YUV422P: Adding U+V on right side of fixed height texture,
+ // since width is already aligned by decoder.
+ // Splitting texture to 4 columns
+ // Y covers columns 1+2
+ // U covers columns 3
+ // V covers columns 4
+ texWidth = vTexWidth[0] + vTexWidth[1] + vTexWidth[2]; texHeight = vH;
+ break;
+ case YUYV422: // < packed YUV 4:2:2, 2x 16bpp, Y0 Cb Y1 Cr - stuffed into RGBA half width texture
+ case BGR24:
+ usesTexLookupShader = true;
+ texWidth = vTexWidth[0]; texHeight = vH;
+ break;
+
+ case RGB24:
+ case ARGB:
+ case RGBA:
+ case ABGR:
+ case BGRA:
+ usesTexLookupShader = false;
+ texWidth = vTexWidth[0]; texHeight = vH;
+ break;
+ default: // FIXME: Add more formats !
+ throw new RuntimeException("Unsupported pixelformat: "+vPixelFmt);
+ }
+ }
+
+ // defaults ..
+ final SampleFormat aSampleFmt;
+ avChosenAudioFormat = null;;
+ this.audioSamplesPerFrameAndChannel = 0;
+
+ if( STREAM_ID_NONE != aid ) {
+ aSampleFmt = SampleFormat.valueOf(audioSampleFmt);
+ avChosenAudioFormat = avAudioFormat2Local(aSampleFmt, audioSampleRate, audioChannels);
+ this.audioSamplesPerFrameAndChannel = audioSamplesPerFrameAndChannel;
+ } else {
+ aSampleFmt = null;
+ }
+
if(DEBUG) {
- System.err.println("XXX0: fmt "+vPixelFmt+", planes "+vPlanes+", bpp "+vBitsPerPixel+"/"+vBytesPerPixelPerPlane);
+ System.err.println("audio: id "+aid+", fmt "+aSampleFmt+", "+avChosenAudioFormat+", aFrameSize/fc "+audioSamplesPerFrameAndChannel);
+ System.err.println("video: id "+vid+", fmt "+vW+"x"+vH+", "+vPixelFmt+", planes "+vPlanes+", bpp "+vBitsPerPixel+"/"+vBytesPerPixelPerPlane+", usesTexLookupShader "+usesTexLookupShader);
for(int i=0; i<3; i++) {
- System.err.println("XXX0 "+i+": "+vTexWidth[i]+"/"+vLinesize[i]);
+ System.err.println("video: p["+i+"]: "+vTexWidth[i]);
}
- System.err.println("XXX0 total tex "+texWidth+"x"+texHeight);
+ System.err.println("video: total tex "+texWidth+"x"+texHeight);
+ System.err.println(this.toString());
}
}
-
+
+ /**
+ * Native callback
+ * @param isInGLOrientation
+ * @param pixFmt
+ * @param planes
+ * @param bitsPerPixel
+ * @param bytesPerPixelPerPlane
+ * @param tWd0
+ * @param tWd1
+ * @param tWd2
+ */
+ void updateVidAttributes(boolean isInGLOrientation, int pixFmt, int planes, int bitsPerPixel, int bytesPerPixelPerPlane,
+ int tWd0, int tWd1, int tWd2, int vW, int vH) {
+ }
+
/**
* {@inheritDoc}
- *
+ *
* If this implementation generates a specialized shader,
* it allows the user to override the default function name <code>ffmpegTexture2D</code>.
* Otherwise the call is delegated to it's super class.
*/
@Override
- public String getTextureLookupFunctionName(String desiredFuncName) throws IllegalStateException {
+ public final String getTextureLookupFunctionName(String desiredFuncName) throws IllegalStateException {
if(State.Uninitialized == state) {
throw new IllegalStateException("Instance not initialized: "+this);
}
- if(PixelFormat.YUV420P == vPixelFmt) {
+ if( usesTexLookupShader ) {
if(null != desiredFuncName && desiredFuncName.length()>0) {
- textureLookupFunctionName = desiredFuncName;
+ texLookupFuncName = desiredFuncName;
}
- return textureLookupFunctionName;
+ return texLookupFuncName;
}
- return super.getTextureLookupFunctionName(desiredFuncName);
+ return super.getTextureLookupFunctionName(desiredFuncName);
}
- private String textureLookupFunctionName = "ffmpegTexture2D";
-
+
/**
* {@inheritDoc}
- *
+ *
* Depending on the pixelformat, a specific conversion shader is being created,
- * e.g. YUV420P to RGB. Otherwise the call is delegated to it's super class.
- */
+ * e.g. YUV420P to RGB. Otherwise the call is delegated to it's super class.
+ */
@Override
- public String getTextureLookupFragmentShaderImpl() throws IllegalStateException {
+ public final String getTextureLookupFragmentShaderImpl() throws IllegalStateException {
if(State.Uninitialized == state) {
throw new IllegalStateException("Instance not initialized: "+this);
}
+ if( !usesTexLookupShader ) {
+ return super.getTextureLookupFragmentShaderImpl();
+ }
final float tc_w_1 = (float)getWidth() / (float)texWidth;
switch(vPixelFmt) {
- case YUV420P:
+ case YUVJ420P:
+ case YUV420P: // < planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
return
- "vec4 "+textureLookupFunctionName+"(in "+getTextureSampler2DType()+" image, in vec2 texCoord) {\n"+
+ "vec4 "+texLookupFuncName+"(in "+getTextureSampler2DType()+" image, in vec2 texCoord) {\n"+
" vec2 u_off = vec2("+tc_w_1+", 0.0);\n"+
" vec2 v_off = vec2("+tc_w_1+", 0.5);\n"+
" vec2 tc_half = texCoord*0.5;\n"+
@@ -459,265 +686,133 @@ public class FFMPEGMediaPlayer extends EGLMediaPlayerImpl {
" return vec4(r, g, b, 1);\n"+
"}\n"
;
- default: // FIXME: Add more planar formats !
- return super.getTextureLookupFragmentShaderImpl();
- }
- }
-
- @Override
- protected synchronized int getCurrentPositionImpl() {
- return 0!=moviePtr ? getVideoPTS0(moviePtr) : 0;
- }
- @Override
- protected synchronized boolean setPlaySpeedImpl(float rate) {
- return true;
+ case YUVJ422P:
+ case YUV422P: ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
+ return
+ "vec4 "+texLookupFuncName+"(in "+getTextureSampler2DType()+" image, in vec2 texCoord) {\n"+
+ " vec2 u_off = vec2("+tc_w_1+" , 0.0);\n"+
+ " vec2 v_off = vec2("+tc_w_1+" * 1.5, 0.0);\n"+
+ " vec2 tc_halfw = vec2(texCoord.x*0.5, texCoord.y);\n"+
+ " float y,u,v,r,g,b;\n"+
+ " y = texture2D(image, texCoord)."+singleTexComp+";\n"+
+ " u = texture2D(image, u_off+tc_halfw)."+singleTexComp+";\n"+
+ " v = texture2D(image, v_off+tc_halfw)."+singleTexComp+";\n"+
+ " y = 1.1643*(y-0.0625);\n"+
+ " u = u-0.5;\n"+
+ " v = v-0.5;\n"+
+ " r = y+1.5958*v;\n"+
+ " g = y-0.39173*u-0.81290*v;\n"+
+ " b = y+2.017*u;\n"+
+ " return vec4(r, g, b, 1);\n"+
+ "}\n"
+ ;
+
+ case YUYV422: // < packed YUV 4:2:2, 2 x 16bpp, [Y0 Cb] [Y1 Cr]
+ // Stuffed into RGBA half width texture
+ return
+ "vec4 "+texLookupFuncName+"(in "+getTextureSampler2DType()+" image, in vec2 texCoord) {\n"+
+ " "+
+ " float y1,u,y2,v,y,r,g,b;\n"+
+ " vec2 tc_halfw = vec2(texCoord.x*0.5, texCoord.y);\n"+
+ " vec4 yuyv = texture2D(image, tc_halfw).rgba;\n"+
+ " y1 = yuyv.r;\n"+
+ " u = yuyv.g;\n"+
+ " y2 = yuyv.b;\n"+
+ " v = yuyv.a;\n"+
+ " y = mix( y1, y2, mod(gl_FragCoord.x, 2) ); /* avoid branching! */\n"+
+ " y = 1.1643*(y-0.0625);\n"+
+ " u = u-0.5;\n"+
+ " v = v-0.5;\n"+
+ " r = y+1.5958*v;\n"+
+ " g = y-0.39173*u-0.81290*v;\n"+
+ " b = y+2.017*u;\n"+
+ " return vec4(r, g, b, 1);\n"+
+ "}\n"
+ ;
+ case BGR24:
+ return
+ "vec4 "+texLookupFuncName+"(in "+getTextureSampler2DType()+" image, in vec2 texCoord) {\n"+
+ " "+
+ " vec3 bgr = texture2D(image, texCoord).rgb;\n"+
+ " return vec4(bgr.b, bgr.g, bgr.r, 1);\n"+ /* just swizzle */
+ "}\n"
+ ;
+
+ default: // FIXME: Add more formats !
+ throw new InternalError("Add proper mapping of: vPixelFmt "+vPixelFmt+", usesTexLookupShader "+usesTexLookupShader);
+ }
}
@Override
- public synchronized boolean startImpl() {
+ public final boolean playImpl() {
if(0==moviePtr) {
return false;
}
- startAudioPusher();
+ final int errno = natives.play0(moviePtr);
+ if( DEBUG_NATIVE && errno != 0 && errno != -ENOSYS) {
+ System.err.println("libav play err: "+errno);
+ }
return true;
}
- /** @return time position after issuing the command */
@Override
- public synchronized boolean pauseImpl() {
+ public final boolean pauseImpl() {
if(0==moviePtr) {
return false;
}
- stopAudioPusher();
+ final int errno = natives.pause0(moviePtr);
+ if( DEBUG_NATIVE && errno != 0 && errno != -ENOSYS) {
+ System.err.println("libav pause err: "+errno);
+ }
return true;
}
- /** @return time position after issuing the command */
@Override
- public synchronized boolean stopImpl() {
+ protected final synchronized int seekImpl(int msec) {
if(0==moviePtr) {
- return false;
+ throw new GLException("FFMPEG native instance null");
}
- stopAudioPusher();
- return true;
+ return natives.seek0(moviePtr, msec);
}
- /** @return time position after issuing the command */
@Override
- protected synchronized int seekImpl(int msec) {
- if(0==moviePtr) {
- throw new GLException("FFMPEG native instance null");
- }
- stopAudioPusher();
- int pts0 = getVideoPTS0(moviePtr);
- int pts1 = seek0(moviePtr, msec);
- System.err.println("Seek: "+pts0+" -> "+msec+" : "+pts1);
- lastAudioPTS=pts1;
- lastVideoPTS=pts1;
- startAudioPusher();
- return pts1;
+ protected void preNextTextureImpl(GL gl) {
+ psm.setUnpackAlignment(gl, 1); // RGBA ? 4 : 1
+ gl.glActiveTexture(GL.GL_TEXTURE0+getTextureUnit());
}
@Override
- protected TextureSequence.TextureFrame getLastTextureImpl() {
- return lastTex;
+ protected void postNextTextureImpl(GL gl) {
+ psm.restore(gl);
}
-
- private long lastAudioTime = 0;
- private int lastAudioPTS = 0;
- private static final int audio_dt_d = 400;
- private long lastVideoTime = 0;
- private int lastVideoPTS = 0;
- private static final int video_dt_d = 9;
-
+
@Override
- protected TextureSequence.TextureFrame getNextTextureImpl(GL gl, boolean blocking) {
+ protected final int getNextTextureImpl(GL gl, TextureFrame nextFrame) {
if(0==moviePtr) {
throw new GLException("FFMPEG native instance null");
- }
- if(null != lastTex) {
- psm.setUnpackAlignment(gl, 1); // RGBA ? 4 : 1
- try {
- final Texture tex = lastTex.getTexture();
- gl.glActiveTexture(GL.GL_TEXTURE0+getTextureUnit());
- tex.enable(gl);
- tex.bind(gl);
-
- if( USE_AUDIO_PUSHER ) {
- try {
- audioFramesBuffer.waitForFreeSlots(2);
- } catch (InterruptedException e) {
- e.printStackTrace(); // oops
- }
- }
-
- /* try decode 10 packets to find one containing video
- (res == 2) */
- int res = 0;
- int retry = 10;
- while(res!=2 && retry >= 0) {
- res = readNextPacket0(moviePtr, procAddrGLTexSubImage2D, textureTarget, textureFormat, textureType);
- retry--;
- }
- } finally {
- psm.restore(gl);
- }
- final int pts = getVideoPTS0(moviePtr); // this frame
- if(blocking) {
- // poor mans video sync .. TODO: off thread 'readNextPackage0(..)' on shared GLContext and multi textures/unit!
- final long now = System.currentTimeMillis();
- // Try sync video to audio
- final long now_d = now - lastAudioTime;
- final long pts_d = pts - lastAudioPTS - 444; /* hack 444 == play video 444ms ahead of audio */
- final long dt = Math.min(47, (long) ( (float) ( pts_d - now_d ) / getPlaySpeed() ) ) ;
- //final long dt = (long) ( (float) ( pts_d - now_d ) / getPlaySpeed() ) ;
- final boolean sleep = dt>video_dt_d && dt<1000 && audioSink.getQueuedByteCount()<maxAvailableAudio-10000;
- final long sleepP = dt-video_dt_d;
- if(DEBUG) {
- final int qAT = audioSink.getQueuedTime();
- System.err.println("s: pts-v "+pts+", qAT "+qAT+", pts-d "+pts_d+", now_d "+now_d+", dt "+dt+", sleep "+sleep+", sleepP "+sleepP+" ms");
- }
- // ?? Maybe use audioSink.getQueuedTime();
- if( sleep ) {
- try {
- Thread.sleep(sleepP);
- } catch (InterruptedException e) { }
- lastVideoTime = System.currentTimeMillis();
- } else {
- lastVideoTime = now;
- }
- }
- lastVideoPTS = pts;
}
- return lastTex;
+ int vPTS = TimeFrameI.INVALID_PTS;
+ if( null != gl ) {
+ final Texture tex = nextFrame.getTexture();
+ tex.enable(gl);
+ tex.bind(gl);
+ }
+
+ /** Try decode up to 10 packets to find one containing video. */
+ for(int i=0; TimeFrameI.INVALID_PTS == vPTS && 10 > i; i++) {
+ vPTS = natives.readNextPacket0(moviePtr, textureTarget, textureFormat, textureType);
+ }
+ if( null != nextFrame ) {
+ nextFrame.setPTS(vPTS);
+ }
+ return vPTS;
}
-
- private static native int getAvUtilVersion0();
- private static native int getAvFormatVersion0();
- private static native int getAvCodecVersion0();
- private static native boolean initIDs0();
- private native long createInstance0(boolean verbose);
- private native void destroyInstance0(long moviePtr);
-
- private native void setStream0(long moviePtr, String url, int vid, int aid, int audioFrameCount);
-
- private native int getVideoPTS0(long moviePtr);
-
- private native int getAudioPTS0(long moviePtr);
- private native Buffer getAudioBuffer0(long moviePtr, int plane);
-
- private native int readNextPacket0(long moviePtr, long procAddrGLTexSubImage2D, int texTarget, int texFmt, int texType);
-
- private native int seek0(long moviePtr, int position);
-
- public static enum PixelFormat {
- // NONE= -1,
- YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
- YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
- RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB...
- BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR...
- YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
- YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
- YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
- YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
- GRAY8, ///< Y , 8bpp
- MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb
- MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb
- PAL8, ///< 8 bit with RGB32 palette
- YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of YUV420P and setting color_range
- YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of YUV422P and setting color_range
- YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of YUV444P and setting color_range
- XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
- XVMC_MPEG2_IDCT,
- UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
- UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3
- BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
- 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
- BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
- RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
- 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
- RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
- 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)
- NV21, ///< as above, but U and V bytes are swapped
-
- ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
- RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
- ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
- BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
-
- GRAY16BE, ///< Y , 16bpp, big-endian
- GRAY16LE, ///< Y , 16bpp, little-endian
- YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
- YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of YUV440P and setting color_range
- YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
- 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
- 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
- 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
- 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
- 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
- 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
- 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
-
- RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
- RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
- RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0
- RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0
-
- BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
- BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
- BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1
- BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1
-
- 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
- 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
- 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
-
- YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
- YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
- YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
- YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
- YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
- YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
- 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
- DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
-
- RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0
- RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0
- BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1
- BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1
- Y400A, ///< 8bit gray, 8bit alpha
- 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
- 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
- YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
- YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
- YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
- YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
- YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
- YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
- YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
- YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
- YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
- YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
- YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
- YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
- VDA_VLD, ///< hardware decoding through VDA
- GBRP, ///< planar GBR 4:4:4 24bpp
- GBRP9BE, ///< planar GBR 4:4:4 27bpp, big endian
- GBRP9LE, ///< planar GBR 4:4:4 27bpp, little endian
- GBRP10BE, ///< planar GBR 4:4:4 30bpp, big endian
- GBRP10LE, ///< planar GBR 4:4:4 30bpp, little endian
- GBRP16BE, ///< planar GBR 4:4:4 48bpp, big endian
- GBRP16LE, ///< planar GBR 4:4:4 48bpp, little endian
- COUNT ///< number of pixel formats in this list
- ;
- public static PixelFormat valueOf(int i) {
- for (PixelFormat fmt : PixelFormat.values()) {
- if(fmt.ordinal() == i) {
- return fmt;
- }
- }
- return null;
+
+ final void pushSound(ByteBuffer sampleData, int data_size, int audio_pts) {
+ setFirstAudioPTS2SCR( audio_pts );
+ if( 1.0f == playSpeed || audioSinkPlaySpeedSet ) {
+ audioSink.enqueueData( audio_pts, sampleData, data_size);
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java
new file mode 100644
index 0000000..bc0865a
--- /dev/null
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java
@@ -0,0 +1,276 @@
+/**
+ * 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.
+ */
+package jogamp.opengl.util.av.impl;
+
+import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame;
+
+interface FFMPEGNatives {
+
+ boolean initSymbols0(long[] symbols, int count);
+ int getAvUtilMajorVersionCC0();
+ int getAvFormatMajorVersionCC0();
+ int getAvCodecMajorVersionCC0();
+ int getAvResampleMajorVersionCC0();
+ int getSwResampleMajorVersionCC0();
+
+ long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose);
+ void destroyInstance0(long moviePtr);
+
+ /**
+ * Issues {@link #updateAttributes(int, int, int, int, int, int, int, float, int, int, String, String)}
+ * and {@link #updateAttributes2(int, int, int, int, int, int, int, int, int, int)}.
+ *
+ * @param moviePtr
+ * @param url
+ * @param vid
+ * @param sizes requested video size as string, i.e. 'hd720'. May be null to favor vWidth and vHeight.
+ * @param vWidth requested video width (for camera mode)
+ * @param vHeight requested video width (for camera mode)
+ * @param vRate requested video framerate (for camera mode)
+ * @param aid
+ * @param aPrefSampleRate
+ * @param aPrefChannelCount
+ */
+ void setStream0(long moviePtr, String url, boolean isCameraInput,
+ int vid, String sizes, int vWidth, int vHeight,
+ int vRate, int aid, int aMaxChannelCount, int aPrefSampleRate);
+
+ void setGLFuncs0(long moviePtr, long procAddrGLTexSubImage2D, long procAddrGLGetError, long procAddrGLFlush, long procAddrGLFinish);
+
+ int getVideoPTS0(long moviePtr);
+
+ int getAudioPTS0(long moviePtr);
+
+ /**
+ * @return resulting current video PTS, or {@link TextureFrame#INVALID_PTS}
+ */
+ int readNextPacket0(long moviePtr, int texTarget, int texFmt, int texType);
+
+ int play0(long moviePtr);
+ int pause0(long moviePtr);
+ int seek0(long moviePtr, int position);
+
+ /** FFMPEG/libAV Audio Sample Format */
+ public static enum SampleFormat {
+ // NONE = -1,
+ U8, ///< unsigned 8 bits
+ S16, ///< signed 16 bits
+ S32, ///< signed 32 bits
+ FLT, ///< float
+ DBL, ///< double
+
+ U8P, ///< unsigned 8 bits, planar
+ S16P, ///< signed 16 bits, planar
+ S32P, ///< signed 32 bits, planar
+ FLTP, ///< float, planar
+ DBLP, ///< double, planar
+
+ COUNT; ///< Number of sample formats.
+
+ /**
+ * Returns the matching SampleFormat value corresponding to the given SampleFormat's integer ordinal.
+ * <pre>
+ * given:
+ * ordinal = enumValue.ordinal()
+ * reverse:
+ * enumValue = EnumClass.values()[ordinal]
+ * </pre>
+ * @throws IllegalArgumentException if the given ordinal is out of range, i.e. not within [ 0 .. SampleFormat.values().length-1 ]
+ */
+ public static SampleFormat valueOf(int ordinal) throws IllegalArgumentException {
+ final SampleFormat[] all = SampleFormat.values();
+ if( 0 <= ordinal && ordinal < all.length ) {
+ return all[ordinal];
+ }
+ throw new IllegalArgumentException("Ordinal "+ordinal+" out of range of SampleFormat.values()[0.."+(all.length-1)+"]");
+ }
+ };
+
+ /** FFMPEG/libAV Pixel Format */
+ public static enum PixelFormat {
+ // NONE= -1,
+ /** planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) */
+ YUV420P,
+ /** packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr ( sharing Cb and Cr w/ 2 pixels )*/
+ YUYV422,
+ /** packed RGB 8:8:8, 24bpp, RGBRGB... */
+ RGB24,
+ /** packed RGB 8:8:8, 24bpp, BGRBGR... */
+ BGR24,
+ /** planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) */
+ YUV422P,
+ /** planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) */
+ YUV444P,
+ /** planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) */
+ YUV410P,
+ /** planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) */
+ YUV411P,
+ /** Y, 8bpp */
+ GRAY8,
+ /** Y, 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb */
+ MONOWHITE,
+ /** Y, 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb */
+ MONOBLACK,
+ /** 8 bit with RGB32 palette */
+ PAL8,
+ /** planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of YUV420P and setting color_range */
+ YUVJ420P,
+ /** planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of YUV422P and setting color_range */
+ YUVJ422P,
+ /** planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of YUV444P and setting color_range */
+ YUVJ444P,
+ /** XVideo Motion Acceleration via common packet passing */
+ XVMC_MPEG2_MC,
+ /** */
+ XVMC_MPEG2_IDCT,
+ /** packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 */
+ UYVY422,
+ /** packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 */
+ UYYVYY411,
+ /** packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) */
+ BGR8,
+ /** 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 */
+ BGR4,
+ /** packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) */
+ BGR4_BYTE,
+ /** packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) */
+ RGB8,
+ /** 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 */
+ RGB4,
+ /** packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) */
+ RGB4_BYTE,
+ /** 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) */
+ NV12,
+ /** as above, but U and V bytes are swapped */
+ NV21,
+
+ /** packed ARGB 8:8:8:8, 32bpp, ARGBARGB... */
+ ARGB,
+ /** packed RGBA 8:8:8:8, 32bpp, RGBARGBA... */
+ RGBA,
+ /** packed ABGR 8:8:8:8, 32bpp, ABGRABGR... */
+ ABGR,
+ /** packed BGRA 8:8:8:8, 32bpp, BGRABGRA... */
+ BGRA,
+
+ /** Y, 16bpp, big-endian */
+ GRAY16BE,
+ /** Y , 16bpp, little-endian */
+ GRAY16LE,
+ /** planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) */
+ YUV440P,
+ /** planar YUV 4:4:0 full scale (JPEG), deprecated in favor of YUV440P and setting color_range */
+ YUVJ440P,
+ /** planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) */
+ YUVA420P,
+ /** 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 */
+ VDPAU_H264,
+ /** 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 */
+ VDPAU_MPEG1,
+ /** 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 */
+ VDPAU_MPEG2,
+ /** 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 */
+ VDPAU_WMV3,
+ /** 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 */
+ VDPAU_VC1,
+ /** packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian */
+ RGB48BE,
+ /** packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian */
+ RGB48LE,
+
+ RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
+ RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
+ RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0
+ RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0
+
+ BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
+ BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
+ BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1
+ BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1
+
+ 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
+ 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
+ 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
+
+ YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
+ YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
+ YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
+ YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
+ YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
+ YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
+ 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
+ DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer
+
+ RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0
+ RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0
+ BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1
+ BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1
+ Y400A, ///< 8bit gray, 8bit alpha
+ 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
+ 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
+ YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
+ YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
+ YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
+ YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian
+ YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
+ YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
+ YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
+ YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
+ YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian
+ YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian
+ YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian
+ YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian
+ VDA_VLD, ///< hardware decoding through VDA
+ GBRP, ///< planar GBR 4:4:4 24bpp
+ GBRP9BE, ///< planar GBR 4:4:4 27bpp, big endian
+ GBRP9LE, ///< planar GBR 4:4:4 27bpp, little endian
+ GBRP10BE, ///< planar GBR 4:4:4 30bpp, big endian
+ GBRP10LE, ///< planar GBR 4:4:4 30bpp, little endian
+ GBRP16BE, ///< planar GBR 4:4:4 48bpp, big endian
+ GBRP16LE, ///< planar GBR 4:4:4 48bpp, little endian
+ COUNT ///< number of pixel formats in this list
+ ;
+ /**
+ * Returns the matching PixelFormat value corresponding to the given PixelFormat's integer ordinal.
+ * <pre>
+ * given:
+ * ordinal = enumValue.ordinal()
+ * reverse:
+ * enumValue = EnumClass.values()[ordinal]
+ * </pre>
+ * @throws IllegalArgumentException if the given ordinal is out of range, i.e. not within [ 0 .. PixelFormat.values().length-1 ]
+ */
+ public static PixelFormat valueOf(int ordinal) throws IllegalArgumentException {
+ final PixelFormat[] all = PixelFormat.values();
+ if( 0 <= ordinal && ordinal < all.length ) {
+ return all[ordinal];
+ }
+ throw new IllegalArgumentException("Ordinal "+ordinal+" out of range of PixelFormat.values()[0.."+(all.length-1)+"]");
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGStaticNatives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGStaticNatives.java
new file mode 100644
index 0000000..22a0458
--- /dev/null
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGStaticNatives.java
@@ -0,0 +1,41 @@
+/**
+ * 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.
+ */
+package jogamp.opengl.util.av.impl;
+
+import com.jogamp.common.util.VersionNumber;
+
+class FFMPEGStaticNatives {
+ static VersionNumber getAVVersion(int vers) {
+ return new VersionNumber( ( vers >> 16 ) & 0xFF,
+ ( vers >> 8 ) & 0xFF,
+ ( vers >> 0 ) & 0xFF );
+ }
+ static native boolean initIDs0();
+
+ static native int getAvVersion0(long func);
+}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java
new file mode 100644
index 0000000..4b013c1
--- /dev/null
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java
@@ -0,0 +1,78 @@
+/**
+ * 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.
+ */
+package jogamp.opengl.util.av.impl;
+
+class FFMPEGv08Natives implements FFMPEGNatives {
+ @Override
+ public native boolean initSymbols0(long[] symbols, int count);
+
+ @Override
+ public native int getAvUtilMajorVersionCC0();
+
+ @Override
+ public native int getAvFormatMajorVersionCC0();
+
+ @Override
+ public native int getAvCodecMajorVersionCC0();
+
+ @Override
+ public native int getAvResampleMajorVersionCC0();
+
+ @Override
+ public native int getSwResampleMajorVersionCC0();
+
+ @Override
+ public native long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose);
+
+ @Override
+ public native void destroyInstance0(long moviePtr);
+
+ @Override
+ public 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
+ public native void setGLFuncs0(long moviePtr, long procAddrGLTexSubImage2D, long procAddrGLGetError, long procAddrGLFlush, long procAddrGLFinish);
+
+ @Override
+ public native int getVideoPTS0(long moviePtr);
+
+ @Override
+ public native int getAudioPTS0(long moviePtr);
+
+ @Override
+ public native int readNextPacket0(long moviePtr, int texTarget, int texFmt, int texType);
+
+ @Override
+ public native int play0(long moviePtr);
+
+ @Override
+ public native int pause0(long moviePtr);
+
+ @Override
+ public native int seek0(long moviePtr, int position);
+}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java
new file mode 100644
index 0000000..d697632
--- /dev/null
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java
@@ -0,0 +1,78 @@
+/**
+ * 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.
+ */
+package jogamp.opengl.util.av.impl;
+
+class FFMPEGv09Natives implements FFMPEGNatives {
+ @Override
+ public native boolean initSymbols0(long[] symbols, int count);
+
+ @Override
+ public native int getAvUtilMajorVersionCC0();
+
+ @Override
+ public native int getAvFormatMajorVersionCC0();
+
+ @Override
+ public native int getAvCodecMajorVersionCC0();
+
+ @Override
+ public native int getAvResampleMajorVersionCC0();
+
+ @Override
+ public native int getSwResampleMajorVersionCC0();
+
+ @Override
+ public native long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose);
+
+ @Override
+ public native void destroyInstance0(long moviePtr);
+
+ @Override
+ public 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
+ public native void setGLFuncs0(long moviePtr, long procAddrGLTexSubImage2D, long procAddrGLGetError, long procAddrGLFlush, long procAddrGLFinish);
+
+ @Override
+ public native int getVideoPTS0(long moviePtr);
+
+ @Override
+ public native int getAudioPTS0(long moviePtr);
+
+ @Override
+ public native int readNextPacket0(long moviePtr, int texTarget, int texFmt, int texType);
+
+ @Override
+ public native int play0(long moviePtr);
+
+ @Override
+ public native int pause0(long moviePtr);
+
+ @Override
+ public native int seek0(long moviePtr, int position);
+}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java
new file mode 100644
index 0000000..0b5f70d
--- /dev/null
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java
@@ -0,0 +1,78 @@
+/**
+ * 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.
+ */
+package jogamp.opengl.util.av.impl;
+
+class FFMPEGv10Natives implements FFMPEGNatives {
+ @Override
+ public native boolean initSymbols0(long[] symbols, int count);
+
+ @Override
+ public native int getAvUtilMajorVersionCC0();
+
+ @Override
+ public native int getAvFormatMajorVersionCC0();
+
+ @Override
+ public native int getAvCodecMajorVersionCC0();
+
+ @Override
+ public native int getAvResampleMajorVersionCC0();
+
+ @Override
+ public native int getSwResampleMajorVersionCC0();
+
+ @Override
+ public native long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose);
+
+ @Override
+ public native void destroyInstance0(long moviePtr);
+
+ @Override
+ public 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
+ public native void setGLFuncs0(long moviePtr, long procAddrGLTexSubImage2D, long procAddrGLGetError, long procAddrGLFlush, long procAddrGLFinish);
+
+ @Override
+ public native int getVideoPTS0(long moviePtr);
+
+ @Override
+ public native int getAudioPTS0(long moviePtr);
+
+ @Override
+ public native int readNextPacket0(long moviePtr, int texTarget, int texFmt, int texType);
+
+ @Override
+ public native int play0(long moviePtr);
+
+ @Override
+ public native int pause0(long moviePtr);
+
+ @Override
+ public 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 aef98fc..05a94de 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -29,11 +29,9 @@
package jogamp.opengl.util.av.impl;
import java.io.IOException;
-import java.net.URL;
import javax.media.opengl.GL;
import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
import com.jogamp.opengl.util.texture.TextureSequence;
@@ -47,18 +45,18 @@ import jogamp.opengl.util.av.EGLMediaPlayerImpl;
*/
public class OMXGLMediaPlayer extends EGLMediaPlayerImpl {
static final boolean available;
-
+
static {
- // OMX binding is included in jogl_desktop and jogl_mobile
+ available = false;
+ /** FIXME!
+ // OMX binding is included in jogl_desktop and jogl_mobile
GLProfile.initSingleton();
- available = initIDs0();
+ available = initIDs0(); */
}
-
+
public static final boolean isAvailable() { return available; }
-
+
protected long moviePtr = 0;
-
- protected TextureSequence.TextureFrame lastTex = null;
public OMXGLMediaPlayer() {
super(TextureType.KHRImage, true);
@@ -72,51 +70,60 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl {
moviePtr = _createInstance();
if(0==moviePtr) {
throw new GLException("Couldn't create OMXInstance");
- }
+ }
}
-
+
@Override
- protected TextureSequence.TextureFrame createTexImage(GL gl, int idx, int[] tex) {
- final EGLTextureFrame eglTex = (EGLTextureFrame) super.createTexImage(gl, idx, tex);
- _setStreamEGLImageTexture2D(moviePtr, idx, tex[idx], eglTex.getImage(), eglTex.getSync());
- lastTex = eglTex;
+ protected TextureSequence.TextureFrame createTexImage(GL gl, int texName) {
+ final EGLTextureFrame eglTex = (EGLTextureFrame) super.createTexImage(gl, texName);
+ _setStreamEGLImageTexture2D(moviePtr, texName, eglTex.getImage(), eglTex.getSync());
return eglTex;
}
-
+
@Override
- protected void destroyTexImage(GL gl, TextureSequence.TextureFrame imgTex) {
- lastTex = null;
- super.destroyTexImage(gl, imgTex);
+ protected void destroyTexFrame(GL gl, TextureSequence.TextureFrame imgTex) {
+ super.destroyTexFrame(gl, imgTex);
}
-
+
@Override
protected void destroyImpl(GL gl) {
- _detachVideoRenderer(moviePtr);
if (moviePtr != 0) {
+ _stop(moviePtr);
+ _detachVideoRenderer(moviePtr);
_destroyInstance(moviePtr);
moviePtr = 0;
}
}
-
+
@Override
- protected void initGLStreamImpl(GL gl, int[] texNames) throws IOException {
+ protected void initStreamImpl(int vid, int aid) throws IOException {
if(0==moviePtr) {
throw new GLException("OMX native instance null");
}
- final URL url = urlConn.getURL();
- if(!url.getProtocol().equals("file")) {
- throw new IOException("Only file URLs are allowed: "+url);
+ if(!streamLoc.getScheme().equals("file")) {
+ throw new IOException("Only file schemes are allowed: "+streamLoc);
+ }
+ final String path=streamLoc.getPath();
+ if(DEBUG) {
+ System.out.println("initGLStream: clean path "+path);
+ }
+
+ if(DEBUG) {
+ System.out.println("initGLStream: p1 "+this);
}
- final String path=url.getPath();
- System.out.println("setURL: clean path "+path);
-
- System.out.println("setURL: p1 "+this);
_setStream(moviePtr, textureCount, path);
- System.out.println("setURL: p2 "+this);
+ if(DEBUG) {
+ System.out.println("initGLStream: p2 "+this);
+ }
}
-
@Override
- protected int getCurrentPositionImpl() {
+ protected final void initGLImpl(GL gl) throws IOException, GLException {
+ // NOP
+ isInGLOrientation = true;
+ }
+
+ @Override
+ protected int getAudioPTSImpl() {
return 0!=moviePtr ? _getCurrentPosition(moviePtr) : 0;
}
@@ -130,7 +137,7 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl {
}
@Override
- public synchronized boolean startImpl() {
+ public synchronized boolean playImpl() {
if(0==moviePtr) {
return false;
}
@@ -150,16 +157,6 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl {
/** @return time position after issuing the command */
@Override
- public synchronized boolean stopImpl() {
- if(0==moviePtr) {
- return false;
- }
- _stop(moviePtr);
- return true;
- }
-
- /** @return time position after issuing the command */
- @Override
protected int seekImpl(int msec) {
if(0==moviePtr) {
throw new GLException("OMX native instance null");
@@ -168,36 +165,33 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl {
}
@Override
- protected TextureSequence.TextureFrame getLastTextureImpl() {
- return lastTex;
- }
-
- @Override
- protected TextureSequence.TextureFrame getNextTextureImpl(GL gl, boolean blocking) {
+ protected int getNextTextureImpl(GL gl, TextureFrame nextFrame) {
if(0==moviePtr) {
throw new GLException("OMX native instance null");
}
- final int nextTex = _getNextTextureID(moviePtr, blocking);
+ final int nextTex = _getNextTextureID(moviePtr, true);
if(0 < nextTex) {
- final TextureSequence.TextureFrame eglImgTex = texFrameMap.get(new Integer(_getNextTextureID(moviePtr, blocking)));
+ // FIXME set pts !
+ /* FIXME
+ final TextureSequence.TextureFrame eglImgTex =
+ texFrameMap.get(new Integer(_getNextTextureID(moviePtr, blocking)));
if(null!=eglImgTex) {
lastTex = eglImgTex;
- }
+ } */
}
- return lastTex;
+ return 0; // FIXME: return pts
}
-
+
private String replaceAll(String orig, String search, String repl) {
- String dest=null;
+ StringBuilder dest = new StringBuilder();
// In case replaceAll / java.util.regex.* is not supported (-> CVM)
int i=0,j;
- dest = new String();
while((j=orig.indexOf(search, i))>=0) {
- dest=dest.concat(orig.substring(i, j));
- dest=dest.concat(repl);
+ dest.append(orig.substring(i, j));
+ dest.append(repl);
i=j+1;
}
- return dest.concat(orig.substring(i, orig.length()));
+ return dest.append(orig.substring(i, orig.length())).toString();
}
private void errorCheckEGL(String s) {
@@ -208,15 +202,15 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl {
}
private static native boolean initIDs0();
- private native long _createInstance();
+ private native long _createInstance();
private native void _destroyInstance(long moviePtr);
-
+
private native void _detachVideoRenderer(long moviePtr); // stop before
private native void _attachVideoRenderer(long moviePtr); // detach before
private native void _setStream(long moviePtr, int textureNum, String path);
private native void _activateStream(long moviePtr);
-
- private native void _setStreamEGLImageTexture2D(long moviePtr, int i, int tex, long image, long sync);
+
+ private native void _setStreamEGLImageTexture2D(long moviePtr, int tex, long image, long sync);
private native int _seek(long moviePtr, int position);
private native void _setPlaySpeed(long moviePtr, float rate);
private native void _play(long moviePtr);
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java
index 3c468f3..1f402f4 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java
@@ -33,7 +33,6 @@ import java.nio.Buffer;
import javax.media.opengl.GL;
import javax.media.opengl.GL2ES2;
-import jogamp.opengl.util.GLArrayHandler;
import jogamp.opengl.util.GLArrayHandlerFlat;
import jogamp.opengl.util.GLVBOArrayHandler;
@@ -41,23 +40,26 @@ import com.jogamp.opengl.util.GLArrayDataEditable;
import com.jogamp.opengl.util.glsl.ShaderState;
/**
- * Used for 1:1 GLSL arrays, i.e. where the buffer data
- * represents this array only.
+ * Used for 1:1 GLSL arrays, i.e. where the buffer data
+ * represents this array only.
*/
-public class GLSLArrayHandler extends GLVBOArrayHandler implements GLArrayHandler {
-
+public class GLSLArrayHandler extends GLVBOArrayHandler {
+
public GLSLArrayHandler(GLArrayDataEditable ad) {
super(ad);
}
-
+
+ @Override
public final void setSubArrayVBOName(int vboName) {
throw new UnsupportedOperationException();
}
-
+
+ @Override
public final void addSubHandler(GLArrayHandlerFlat handler) {
throw new UnsupportedOperationException();
}
-
+
+ @Override
public final void enableState(GL gl, boolean enable, Object ext) {
final GL2ES2 glsl = gl.getGL2ES2();
if( null != ext ) {
@@ -66,12 +68,12 @@ public class GLSLArrayHandler extends GLVBOArrayHandler implements GLArrayHandle
enableSimple(glsl, enable);
}
}
-
+
private final void enableShaderState(GL2ES2 glsl, boolean enable, ShaderState st) {
if(enable) {
/*
* This would be the non optimized code path:
- *
+ *
if(ad.isVBO()) {
glsl.glBindBuffer(ad.getVBOTarget(), ad.getVBOName());
if(!ad.isVBOWritten()) {
@@ -108,13 +110,13 @@ public class GLSLArrayHandler extends GLVBOArrayHandler implements GLArrayHandle
} else if(null!=buffer) {
st.vertexAttribPointer(glsl, ad);
}
-
+
st.enableVertexAttribArray(glsl, ad);
} else {
st.disableVertexAttribArray(glsl, ad);
}
}
-
+
private final void enableSimple(GL2ES2 glsl, boolean enable) {
final int location = ad.getLocation();
if( 0 > location ) {
@@ -123,7 +125,7 @@ public class GLSLArrayHandler extends GLVBOArrayHandler implements GLArrayHandle
if(enable) {
/*
* This would be the non optimized code path:
- *
+ *
if(ad.isVBO()) {
glsl.glBindBuffer(ad.getVBOTarget(), ad.getVBOName());
if(!ad.isVBOWritten()) {
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java
index 855406d..34a381d 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java
@@ -37,7 +37,7 @@ import com.jogamp.opengl.util.GLArrayDataWrapper;
import com.jogamp.opengl.util.glsl.ShaderState;
/**
- * Used for interleaved GLSL arrays, i.e. where the buffer data itself is handled
+ * Used for interleaved GLSL arrays, i.e. where the buffer data itself is handled
* separately and interleaves many arrays.
*/
public class GLSLArrayHandlerFlat implements GLArrayHandlerFlat {
@@ -47,10 +47,12 @@ public class GLSLArrayHandlerFlat implements GLArrayHandlerFlat {
this.ad = ad;
}
+ @Override
public GLArrayDataWrapper getData() {
return ad;
}
-
+
+ @Override
public final void syncData(GL gl, Object ext) {
final GL2ES2 glsl = gl.getGL2ES2();
if( null != ext ) {
@@ -62,7 +64,7 @@ public class GLSLArrayHandlerFlat implements GLArrayHandlerFlat {
}
/**
* Due to probable application VBO switching, this might not make any sense ..
- *
+ *
if(!written) {
st.vertexAttribPointer(glsl, ad);
} else if(st.getAttribLocation(glsl, ad) >= 0) {
@@ -77,6 +79,7 @@ public class GLSLArrayHandlerFlat implements GLArrayHandlerFlat {
}*/
}
+ @Override
public final void enableState(GL gl, boolean enable, Object ext) {
final GL2ES2 glsl = gl.getGL2ES2();
if( null != ext ) {
@@ -94,7 +97,7 @@ public class GLSLArrayHandlerFlat implements GLArrayHandlerFlat {
} else {
glsl.glDisableVertexAttribArray(location);
}
- }
+ }
}
- }
+ }
}
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java
index c2048d6..e153082 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java
@@ -33,29 +33,30 @@ import java.util.List;
import javax.media.opengl.GL;
-import jogamp.opengl.util.GLArrayHandler;
import jogamp.opengl.util.GLArrayHandlerFlat;
import jogamp.opengl.util.GLVBOArrayHandler;
import com.jogamp.opengl.util.GLArrayDataEditable;
/**
- * Interleaved fixed function arrays, i.e. where this buffer data
- * represents many arrays.
+ * Interleaved fixed function arrays, i.e. where this buffer data
+ * represents many arrays.
*/
-public class GLSLArrayHandlerInterleaved extends GLVBOArrayHandler implements GLArrayHandler {
- private List<GLArrayHandlerFlat> subArrays = new ArrayList<GLArrayHandlerFlat>();
+public class GLSLArrayHandlerInterleaved extends GLVBOArrayHandler {
+ private final List<GLArrayHandlerFlat> subArrays = new ArrayList<GLArrayHandlerFlat>();
public GLSLArrayHandlerInterleaved(GLArrayDataEditable ad) {
super(ad);
}
-
+
+ @Override
public final void setSubArrayVBOName(int vboName) {
for(int i=0; i<subArrays.size(); i++) {
subArrays.get(i).getData().setVBOName(vboName);
- }
+ }
}
-
+
+ @Override
public final void addSubHandler(GLArrayHandlerFlat handler) {
subArrays.add(handler);
}
@@ -63,9 +64,10 @@ public class GLSLArrayHandlerInterleaved extends GLVBOArrayHandler implements GL
private final void syncSubData(GL gl, Object ext) {
for(int i=0; i<subArrays.size(); i++) {
subArrays.get(i).syncData(gl, ext);
- }
- }
-
+ }
+ }
+
+ @Override
public final void enableState(GL gl, boolean enable, Object ext) {
if(enable) {
if(!ad.isVBO()) {
@@ -78,7 +80,7 @@ public class GLSLArrayHandlerInterleaved extends GLVBOArrayHandler implements GL
}
for(int i=0; i<subArrays.size(); i++) {
subArrays.get(i).enableState(gl, enable, ext);
- }
+ }
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java
index eaf8dc3..dba4085 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.glsl;
import java.nio.FloatBuffer;
@@ -45,33 +45,33 @@ import javax.media.opengl.fixedfunc.GLMatrixFunc;
public class GLSLTextureRaster {
private final boolean textureVertFlipped;
private final int textureUnit;
-
+
private ShaderProgram sp;
private PMVMatrix pmvMatrix;
private GLUniformData pmvMatrixUniform;
private GLUniformData activeTexUniform;
private GLArrayDataServer interleavedVBO;
-
+
public GLSLTextureRaster(int textureUnit, boolean textureVertFlipped) {
this.textureVertFlipped = textureVertFlipped;
this.textureUnit = textureUnit;
}
-
+
public int getTextureUnit() { return textureUnit; }
static final String shaderBasename = "texture01_xxx";
static final String shaderSrcPath = "../../shader";
static final String shaderBinPath = "../../shader/bin";
-
+
public void init(GL2ES2 gl) {
// Create & Compile the shader objects
- final ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(),
+ final ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(),
shaderSrcPath, shaderBinPath, shaderBasename, true);
- final ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(),
+ final ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(),
shaderSrcPath, shaderBinPath, shaderBasename, true);
rsVp.defaultShaderCustomization(gl, true, true);
rsFp.defaultShaderCustomization(gl, true, true);
-
+
// Create & Link the shader program
sp = new ShaderProgram();
sp.add(rsVp);
@@ -80,13 +80,13 @@ public class GLSLTextureRaster {
throw new GLException("Couldn't link program: "+sp);
}
sp.useProgram(gl, true);
-
+
// setup mgl_PMVMatrix
pmvMatrix = new PMVMatrix();
pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
- pmvMatrix.glLoadIdentity();
+ pmvMatrix.glLoadIdentity();
pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv
if( pmvMatrixUniform.setLocation(gl, sp.program()) < 0 ) {
throw new GLException("Couldn't locate "+pmvMatrixUniform+" in shader: "+sp);
@@ -105,9 +105,9 @@ public class GLSLTextureRaster {
} else {
s_quadTexCoords = s_quadTexCoords00;
}
-
+
interleavedVBO = GLArrayDataServer.createGLSLInterleaved(3+2, GL.GL_FLOAT, false, 2*4, GL.GL_STATIC_DRAW);
- {
+ {
final GLArrayData vArrayData = interleavedVBO.addGLSLSubArray("mgl_Vertex", 3, GL.GL_ARRAY_BUFFER);
if( vArrayData.setLocation(gl, sp.program()) < 0 ) {
throw new GLException("Couldn't locate "+vArrayData+" in shader: "+sp);
@@ -116,15 +116,15 @@ public class GLSLTextureRaster {
if( tArrayData.setLocation(gl, sp.program()) < 0 ) {
throw new GLException("Couldn't locate "+tArrayData+" in shader: "+sp);
}
- final FloatBuffer ib = (FloatBuffer)interleavedVBO.getBuffer();
+ final FloatBuffer ib = (FloatBuffer)interleavedVBO.getBuffer();
for(int i=0; i<4; i++) {
ib.put(s_quadVertices, i*3, 3);
ib.put(s_quadTexCoords, i*2, 2);
- }
+ }
}
interleavedVBO.seal(gl, true);
interleavedVBO.enableBuffer(gl, false);
-
+
sp.useProgram(gl, false);
}
@@ -133,14 +133,14 @@ public class GLSLTextureRaster {
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
pmvMatrix.glOrthof(-1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 10.0f);
-
+
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
-
+
sp.useProgram(gl, true);
gl.glUniform(pmvMatrixUniform);
sp.useProgram(gl, false);
- }
+ }
}
public void dispose(GL2ES2 gl) {
@@ -162,34 +162,34 @@ public class GLSLTextureRaster {
}
public void display(GL2ES2 gl) {
- if(null != sp) {
- sp.useProgram(gl, true);
+ if(null != sp) {
+ sp.useProgram(gl, true);
interleavedVBO.enableBuffer(gl, true);
-
+
gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4);
-
- interleavedVBO.enableBuffer(gl, false);
+
+ interleavedVBO.enableBuffer(gl, false);
sp.useProgram(gl, false);
}
}
-
- private static final float[] s_quadVertices = {
+
+ private static final float[] s_quadVertices = {
-1f, -1f, 0f, // LB
1f, -1f, 0f, // RB
-1f, 1f, 0f, // LT
- 1f, 1f, 0f // RT
+ 1f, 1f, 0f // RT
};
- private static final float[] s_quadTexCoords00 = {
+ private static final float[] s_quadTexCoords00 = {
0f, 0f, // LB
1f, 0f, // RB
- 0f, 1f, // LT
+ 0f, 1f, // LT
1f, 1f // RT
};
- private static final float[] s_quadTexCoords01 = {
+ private static final float[] s_quadTexCoords01 = {
0f, 1f, // LB
1f, 1f, // RB
- 0f, 0f, // LT
+ 0f, 0f, // LT
1f, 0f // RT
- };
+ };
}
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 351d7a1..c329945 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java
@@ -77,7 +77,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
* @param mode TODO
* @param pmvMatrix optional pass through PMVMatrix for the {@link FixedFuncHook} and {@link FixedFuncPipeline}
*/
- public FixedFuncHook(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix,
+ public FixedFuncHook(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix,
Class<?> shaderRootClass, String shaderSrcRoot, String shaderBinRoot,
String vertexColorFile, String vertexColorLightFile,
String fragmentColorFile, String fragmentColorTextureFile) {
@@ -90,14 +90,14 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
this.pmvMatrix = new PMVMatrix();
}
- fixedFunction = new FixedFuncPipeline(this.gl, mode, this.pmvMatrix, shaderRootClass, shaderSrcRoot,
+ fixedFunction = new FixedFuncPipeline(this.gl, mode, this.pmvMatrix, shaderRootClass, shaderSrcRoot,
shaderBinRoot, vertexColorFile, vertexColorLightFile, fragmentColorFile, fragmentColorTextureFile);
}
public boolean verbose() { return fixedFunction.verbose(); }
public void setVerbose(boolean v) { fixedFunction.setVerbose(v); }
-
+
public void destroy() {
fixedFunction.destroy(gl);
fixedFunction = null;
@@ -111,16 +111,16 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
public PMVMatrix getMatrix() { return pmvMatrix; }
//
- // FixedFuncHookIf - hooks
+ // FixedFuncHookIf - hooks
//
public void glDrawArrays(int mode, int first, int count) {
fixedFunction.glDrawArrays(gl, mode, first, count);
}
public void glDrawElements(int mode, int count, int type, java.nio.Buffer indices) {
- fixedFunction.glDrawElements(gl, mode, count, type, indices);
+ fixedFunction.glDrawElements(gl, mode, count, type, indices);
}
public void glDrawElements(int mode, int count, int type, long indices_buffer_offset) {
- fixedFunction.glDrawElements(gl, mode, count, type, indices_buffer_offset);
+ fixedFunction.glDrawElements(gl, mode, count, type, indices_buffer_offset);
}
public void glActiveTexture(int texture) {
@@ -136,7 +136,8 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
if(fixedFunction.glEnable(cap, false)) {
gl.glDisable(cap);
}
- }
+ }
+ @Override
public void glGetFloatv(int pname, java.nio.FloatBuffer params) {
if(PMVMatrix.isMatrixGetName(pname)) {
pmvMatrix.glGetFloatv(pname, params);
@@ -144,6 +145,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
gl.glGetFloatv(pname, params);
}
+ @Override
public void glGetFloatv(int pname, float[] params, int params_offset) {
if(PMVMatrix.isMatrixGetName(pname)) {
pmvMatrix.glGetFloatv(pname, params, params_offset);
@@ -151,6 +153,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
gl.glGetFloatv(pname, params, params_offset);
}
+ @Override
public void glGetIntegerv(int pname, IntBuffer params) {
if(PMVMatrix.isMatrixGetName(pname)) {
pmvMatrix.glGetIntegerv(pname, params);
@@ -158,6 +161,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
gl.glGetIntegerv(pname, params);
}
+ @Override
public void glGetIntegerv(int pname, int[] params, int params_offset) {
if(PMVMatrix.isMatrixGetName(pname)) {
pmvMatrix.glGetIntegerv(pname, params, params_offset);
@@ -165,7 +169,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
gl.glGetIntegerv(pname, params, params_offset);
}
-
+
public void glTexEnvi(int target, int pname, int value) {
fixedFunction.glTexEnvi(target, pname, value);
}
@@ -179,7 +183,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
fixedFunction.glBindTexture(target, texture);
gl.glBindTexture(target, texture);
}
- public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border,
+ public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border,
int format, int type, Buffer pixels) {
// align internalformat w/ format, an ES2 requirement
switch(internalformat) {
@@ -212,84 +216,103 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
public void glPointParameterfv(int pname, java.nio.FloatBuffer params) {
fixedFunction.glPointParameterfv(pname, params);
}
-
- //
+
+ //
// MatrixIf
//
public int glGetMatrixMode() {
return pmvMatrix.glGetMatrixMode();
}
+ @Override
public void glMatrixMode(int mode) {
pmvMatrix.glMatrixMode(mode);
}
+ @Override
public void glLoadMatrixf(java.nio.FloatBuffer m) {
pmvMatrix.glLoadMatrixf(m);
}
+ @Override
public void glLoadMatrixf(float[] m, int m_offset) {
glLoadMatrixf(GLBuffers.newDirectFloatBuffer(m, m_offset));
}
+ @Override
public void glPopMatrix() {
pmvMatrix.glPopMatrix();
}
+ @Override
public void glPushMatrix() {
pmvMatrix.glPushMatrix();
}
+ @Override
public void glLoadIdentity() {
pmvMatrix.glLoadIdentity();
}
+ @Override
public void glMultMatrixf(java.nio.FloatBuffer m) {
pmvMatrix.glMultMatrixf(m);
}
+ @Override
public void glMultMatrixf(float[] m, int m_offset) {
glMultMatrixf(GLBuffers.newDirectFloatBuffer(m, m_offset));
}
+ @Override
public void glTranslatef(float x, float y, float z) {
pmvMatrix.glTranslatef(x, y, z);
}
+ @Override
public void glRotatef(float angdeg, float x, float y, float z) {
pmvMatrix.glRotatef(angdeg, x, y, z);
}
+ @Override
public void glScalef(float x, float y, float z) {
pmvMatrix.glScalef(x, y, z);
}
public void glOrtho(double left, double right, double bottom, double top, double near_val, double far_val) {
- glOrthof((float) left, (float) right, (float) bottom, (float) top, (float) near_val, (float) far_val);
+ glOrthof((float) left, (float) right, (float) bottom, (float) top, (float) near_val, (float) far_val);
}
+ @Override
public void glOrthof(float left, float right, float bottom, float top, float zNear, float zFar) {
pmvMatrix.glOrthof(left, right, bottom, top, zNear, zFar);
}
public void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar) {
- glFrustumf((float) left, (float) right, (float) bottom, (float) top, (float) zNear, (float) zFar);
+ glFrustumf((float) left, (float) right, (float) bottom, (float) top, (float) zNear, (float) zFar);
}
+ @Override
public void glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar) {
pmvMatrix.glFrustumf(left, right, bottom, top, zNear, zFar);
}
- //
+ //
// LightingIf
//
+ @Override
public void glColor4f(float red, float green, float blue, float alpha) {
fixedFunction.glColor4f(gl, red, green, blue, alpha);
}
-
+
public void glColor4ub(byte red, byte green, byte blue, byte alpha) {
- glColor4f(ValueConv.byte_to_float(red, false),
- ValueConv.byte_to_float(green, false),
- ValueConv.byte_to_float(blue, false),
+ glColor4f(ValueConv.byte_to_float(red, false),
+ ValueConv.byte_to_float(green, false),
+ ValueConv.byte_to_float(blue, false),
ValueConv.byte_to_float(alpha, false) );
}
+ @Override
public void glLightfv(int light, int pname, java.nio.FloatBuffer params) {
fixedFunction.glLightfv(gl, light, pname, params);
}
+ @Override
public void glLightfv(int light, int pname, float[] params, int params_offset) {
glLightfv(light, pname, GLBuffers.newDirectFloatBuffer(params, params_offset));
}
+ @Override
public void glMaterialfv(int face, int pname, java.nio.FloatBuffer params) {
fixedFunction.glMaterialfv(gl, face, pname, params);
}
+ @Override
public void glMaterialfv(int face, int pname, float[] params, int params_offset) {
glMaterialfv(face, pname, GLBuffers.newDirectFloatBuffer(params, params_offset));
}
+ @Override
public void glMaterialf(int face, int pname, float param) {
glMaterialfv(face, pname, GLBuffers.newDirectFloatBuffer(new float[] { param }));
}
@@ -297,39 +320,43 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
//
// Misc Simple States
//
+ @Override
public void glShadeModel(int mode) {
fixedFunction.glShadeModel(gl, mode);
- }
+ }
public void glAlphaFunc(int func, float ref) {
fixedFunction.glAlphaFunc(func, ref);
}
-
- /** ES2 supports CullFace implicit
+
+ /** ES2 supports CullFace implicit
public void glCullFace(int faceName) {
fixedFunction.glCullFace(faceName);
gl.glCullFace(faceName);
} */
-
+
//
// PointerIf
//
public void glClientActiveTexture(int textureUnit) {
fixedFunction.glClientActiveTexture(textureUnit);
}
+ @Override
public void glEnableClientState(int glArrayIndex) {
fixedFunction.glEnableClientState(gl, glArrayIndex);
}
+ @Override
public void glDisableClientState(int glArrayIndex) {
fixedFunction.glDisableClientState(gl, glArrayIndex);
}
+ @Override
public void glVertexPointer(GLArrayData array) {
if(array.isVBO()) {
- if(!gl.glIsVBOArrayEnabled()) {
+ if(!gl.glIsVBOArrayBound()) {
throw new GLException("VBO array is not enabled: "+array);
}
} else {
- if(gl.glIsVBOArrayEnabled()) {
+ if(gl.glIsVBOArrayBound()) {
throw new GLException("VBO array is not disabled: "+array);
}
Buffers.rangeCheck(array.getBuffer(), 1);
@@ -339,26 +366,29 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
fixedFunction.glVertexPointer(gl, array);
}
+ @Override
public void glVertexPointer(int size, int type, int stride, java.nio.Buffer pointer) {
- glVertexPointer(GLArrayDataWrapper.createFixed(GL_VERTEX_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
+ glVertexPointer(GLArrayDataWrapper.createFixed(GL_VERTEX_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
pointer, 0, 0, 0, GL.GL_ARRAY_BUFFER));
}
+ @Override
public void glVertexPointer(int size, int type, int stride, long pointer_buffer_offset) {
int vboName = gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER);
if(vboName==0) {
throw new GLException("no GL_ARRAY_BUFFER VBO bound");
}
- glVertexPointer(GLArrayDataWrapper.createFixed(GL_VERTEX_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
+ glVertexPointer(GLArrayDataWrapper.createFixed(GL_VERTEX_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
null, vboName, pointer_buffer_offset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER));
}
+ @Override
public void glColorPointer(GLArrayData array) {
if(array.isVBO()) {
- if(!gl.glIsVBOArrayEnabled()) {
+ if(!gl.glIsVBOArrayBound()) {
throw new GLException("VBO array is not enabled: "+array);
}
} else {
- if(gl.glIsVBOArrayEnabled()) {
+ if(gl.glIsVBOArrayBound()) {
throw new GLException("VBO array is not disabled: "+array);
}
Buffers.rangeCheck(array.getBuffer(), 1);
@@ -367,29 +397,32 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
fixedFunction.glColorPointer(gl, array);
}
+ @Override
public void glColorPointer(int size, int type, int stride, java.nio.Buffer pointer) {
- glColorPointer(GLArrayDataWrapper.createFixed(GL_COLOR_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
+ glColorPointer(GLArrayDataWrapper.createFixed(GL_COLOR_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
pointer, 0, 0, 0, GL.GL_ARRAY_BUFFER));
}
+ @Override
public void glColorPointer(int size, int type, int stride, long pointer_buffer_offset) {
int vboName = gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER);
if(vboName==0) {
throw new GLException("no GL_ARRAY_BUFFER VBO bound");
}
- glColorPointer(GLArrayDataWrapper.createFixed(GL_COLOR_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
+ glColorPointer(GLArrayDataWrapper.createFixed(GL_COLOR_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
null, vboName, pointer_buffer_offset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER));
}
+ @Override
public void glNormalPointer(GLArrayData array) {
if(array.getComponentCount()!=3) {
throw new GLException("Only 3 components per normal allowed");
}
if(array.isVBO()) {
- if(!gl.glIsVBOArrayEnabled()) {
+ if(!gl.glIsVBOArrayBound()) {
throw new GLException("VBO array is not enabled: "+array);
}
} else {
- if(gl.glIsVBOArrayEnabled()) {
+ if(gl.glIsVBOArrayBound()) {
throw new GLException("VBO array is not disabled: "+array);
}
Buffers.rangeCheck(array.getBuffer(), 1);
@@ -398,26 +431,29 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
fixedFunction.glNormalPointer(gl, array);
}
+ @Override
public void glNormalPointer(int type, int stride, java.nio.Buffer pointer) {
- glNormalPointer(GLArrayDataWrapper.createFixed(GL_NORMAL_ARRAY, 3, type, GLBuffers.isGLTypeFixedPoint(type), stride,
+ glNormalPointer(GLArrayDataWrapper.createFixed(GL_NORMAL_ARRAY, 3, type, GLBuffers.isGLTypeFixedPoint(type), stride,
pointer, 0, 0, 0, GL.GL_ARRAY_BUFFER));
}
+ @Override
public void glNormalPointer(int type, int stride, long pointer_buffer_offset) {
int vboName = gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER);
if(vboName==0) {
throw new GLException("no GL_ARRAY_BUFFER VBO bound");
}
- glNormalPointer(GLArrayDataWrapper.createFixed(GL_NORMAL_ARRAY, 3, type, GLBuffers.isGLTypeFixedPoint(type), stride,
+ glNormalPointer(GLArrayDataWrapper.createFixed(GL_NORMAL_ARRAY, 3, type, GLBuffers.isGLTypeFixedPoint(type), stride,
null, vboName, pointer_buffer_offset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER));
}
+ @Override
public void glTexCoordPointer(GLArrayData array) {
if(array.isVBO()) {
- if(!gl.glIsVBOArrayEnabled()) {
+ if(!gl.glIsVBOArrayBound()) {
throw new GLException("VBO array is not enabled: "+array);
}
} else {
- if(gl.glIsVBOArrayEnabled()) {
+ if(gl.glIsVBOArrayBound()) {
throw new GLException("VBO array is not disabled: "+array);
}
Buffers.rangeCheck(array.getBuffer(), 1);
@@ -426,21 +462,24 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
}
fixedFunction.glTexCoordPointer(gl, array);
}
+ @Override
public void glTexCoordPointer(int size, int type, int stride, java.nio.Buffer pointer) {
glTexCoordPointer(
- GLArrayDataWrapper.createFixed(GL_TEXTURE_COORD_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
+ GLArrayDataWrapper.createFixed(GL_TEXTURE_COORD_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
pointer, 0, 0, 0, GL.GL_ARRAY_BUFFER));
}
+ @Override
public void glTexCoordPointer(int size, int type, int stride, long pointer_buffer_offset) {
int vboName = gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER);
if(vboName==0) {
throw new GLException("no GL_ARRAY_BUFFER VBO bound");
}
glTexCoordPointer(
- GLArrayDataWrapper.createFixed(GL_TEXTURE_COORD_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
+ GLArrayDataWrapper.createFixed(GL_TEXTURE_COORD_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride,
null, vboName, pointer_buffer_offset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER) );
}
+ @Override
public final String toString() {
StringBuilder buf = new StringBuilder();
buf.append(getClass().getName()+" (");
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 2e924cb..4226958 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java
@@ -40,6 +40,7 @@ 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;
@@ -58,25 +59,25 @@ import com.jogamp.opengl.util.glsl.ShaderState;
import com.jogamp.opengl.util.glsl.fixedfunc.ShaderSelectionMode;
/**
- *
+ *
* <p>
- * Note: Certain GL FFP state values (e.g.: alphaTestFunc and cullFace)
- * are mapped to a lower number range so they can be stored in low precision storage,
+ * Note: Certain GL FFP state values (e.g.: alphaTestFunc and cullFace)
+ * are mapped to a lower number range so they can be stored in low precision storage,
* i.e. in a 'lowp int' (GL ES2).
* </p>
*/
public class FixedFuncPipeline {
protected static final boolean DEBUG;
-
+
static {
Debug.initSingleton();
DEBUG = Debug.isPropertyDefined("jogl.debug.FixedFuncPipeline", true);
}
-
+
/** The maximum texture units which could be used, depending on {@link ShaderSelectionMode}. */
public static final int MAX_TEXTURE_UNITS = 8;
public static final int MAX_LIGHTS = 8;
-
+
public FixedFuncPipeline(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix) {
shaderRootClass = FixedFuncPipeline.class;
shaderSrcRoot = shaderSrcRootDef;
@@ -87,8 +88,8 @@ public class FixedFuncPipeline {
fragmentColorTextureFile = fragmentColorTextureFileDef;
init(gl, mode, pmvMatrix);
}
- public FixedFuncPipeline(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix,
- Class<?> shaderRootClass, String shaderSrcRoot,
+ public FixedFuncPipeline(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix,
+ Class<?> shaderRootClass, String shaderSrcRoot,
String shaderBinRoot,
String vertexColorFile, String vertexColorLightFile,
String fragmentColorFile, String fragmentColorTextureFile) {
@@ -99,9 +100,9 @@ public class FixedFuncPipeline {
this.vertexColorLightFile = vertexColorLightFile;
this.fragmentColorFile = fragmentColorFile;
this.fragmentColorTextureFile = fragmentColorTextureFile;
- init(gl, mode, pmvMatrix);
+ init(gl, mode, pmvMatrix);
}
-
+
public ShaderSelectionMode getShaderSelectionMode() { return requestedShaderSelectionMode; }
public void setShaderSelectionMode(ShaderSelectionMode mode) { requestedShaderSelectionMode=mode; }
public ShaderSelectionMode getCurrentShaderSelectionMode() { return currentShaderSelectionMode; }
@@ -152,21 +153,21 @@ public class FixedFuncPipeline {
colorStatic.put(1, green);
colorStatic.put(2, blue);
colorStatic.put(3, alpha);
-
+
shaderState.useProgram(gl, true);
- final GLUniformData ud = shaderState.getUniform(mgl_ColorStatic);
+ final GLUniformData ud = shaderState.getUniform(mgl_ColorStatic);
if(null!=ud) {
// same data object ..
shaderState.uniform(gl, ud);
} else {
throw new GLException("Failed to update: mgl_ColorStatic");
- }
+ }
}
-
+
//
// Arrays / States
//
-
+
public void glEnableClientState(GL2ES2 gl, int glArrayIndex) {
glToggleClientState(gl, glArrayIndex, true);
}
@@ -201,7 +202,7 @@ public class FixedFuncPipeline {
break;
}
}
-
+
public void glVertexPointer(GL2ES2 gl, GLArrayData data) {
shaderState.useProgram(gl, true);
shaderState.vertexAttribPointer(gl, data);
@@ -216,14 +217,14 @@ public class FixedFuncPipeline {
shaderState.useProgram(gl, true);
shaderState.vertexAttribPointer(gl, data);
}
-
+
//
// MULTI-TEXTURE
//
/** Enables/Disables the named texture unit (if changed), returns previous state */
private boolean glEnableTexture(boolean enable, int unit) {
- final boolean isEnabled = 0 != ( textureEnabledBits & ( 1 << activeTextureUnit ) );
+ final boolean isEnabled = 0 != ( textureEnabledBits & ( 1 << activeTextureUnit ) );
if( isEnabled != enable ) {
if(enable) {
textureEnabledBits |= ( 1 << unit );
@@ -236,7 +237,7 @@ public class FixedFuncPipeline {
}
return isEnabled;
}
-
+
public void glClientActiveTexture(int textureUnit) {
textureUnit -= GL.GL_TEXTURE0;
if(0 <= textureUnit && textureUnit<MAX_TEXTURE_UNITS) {
@@ -245,7 +246,7 @@ public class FixedFuncPipeline {
throw new GLException("glClientActiveTexture textureUnit not within GL_TEXTURE0 + [0.."+MAX_TEXTURE_UNITS+"]: "+textureUnit);
}
}
-
+
public void glActiveTexture(int textureUnit) {
textureUnit -= GL.GL_TEXTURE0;
if(0 <= textureUnit && textureUnit<MAX_TEXTURE_UNITS) {
@@ -263,7 +264,7 @@ public class FixedFuncPipeline {
data.setName( GLPointerFuncUtil.getPredefinedArrayIndexName(data.getIndex(), clientActiveTextureUnit) ) ;
shaderState.vertexAttribPointer(gl, data);
}
-
+
public void glBindTexture(int target, int texture) {
if(GL.GL_TEXTURE_2D == target) {
if( texture != boundTextureObject[activeTextureUnit] ) {
@@ -271,15 +272,15 @@ public class FixedFuncPipeline {
textureFormatDirty = true;
}
} else {
- System.err.println("FixedFuncPipeline: Unimplemented glBindTexture for target "+toHexString(target)+". Texture name "+toHexString(texture));
+ System.err.println("FixedFuncPipeline: Unimplemented glBindTexture for target "+toHexString(target)+". Texture name "+toHexString(texture));
}
}
-
+
public void glTexImage2D(int target, /* int level, */ int internalformat, /*, int width, int height, int border, */
int format /*, int type, Buffer pixels */) {
final int ifmt;
if(GL.GL_TEXTURE_2D == target) {
- switch(internalformat) {
+ switch(internalformat) {
case 3:
case GL.GL_RGB:
case GL.GL_RGB565:
@@ -305,16 +306,16 @@ public class FixedFuncPipeline {
// System.err.println("glTexImage2D TEXTURE_2D: internalformat ifmt "+toHexString(internalformat)+" fmt "+toHexString(format)+" -> "+toHexString(ifmt));
}
} else {
- System.err.println("FixedFuncPipeline: Unimplemented glTexImage2D: target "+toHexString(target)+", internalformat "+toHexString(internalformat));
+ System.err.println("FixedFuncPipeline: Unimplemented glTexImage2D: target "+toHexString(target)+", internalformat "+toHexString(internalformat));
}
}
/*
public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border,
- int format, int type, long pixels_buffer_offset) {
+ int format, int type, long pixels_buffer_offset) {
textureFormat.put(activeTextureUnit, internalformat);
textureFormatDirty = true;
}*/
-
+
public void glTexEnvi(int target, int pname, int value) {
if(GL2ES1.GL_TEXTURE_ENV == target && GL2ES1.GL_TEXTURE_ENV_MODE == pname) {
final int mode;
@@ -350,7 +351,7 @@ public class FixedFuncPipeline {
if( value != textureEnvMode.get(activeTextureUnit) ) {
textureEnvMode.put(activeTextureUnit, value);
textureEnvModeDirty = true;
- }
+ }
}
public void glGetTexEnviv(int target, int pname, IntBuffer params) { // FIXME
System.err.println("FixedFuncPipeline: Unimplemented glGetTexEnviv: target "+toHexString(target)+", pname "+toHexString(pname));
@@ -358,13 +359,13 @@ public class FixedFuncPipeline {
public void glGetTexEnviv(int target, int pname, int[] params, int params_offset) { // FIXME
System.err.println("FixedFuncPipeline: Unimplemented glGetTexEnviv: target "+toHexString(target)+", pname "+toHexString(pname));
}
-
+
//
// Point Sprites
//
public void glPointSize(float size) {
pointParams.put(0, size);
- pointParamsDirty = true;
+ pointParamsDirty = true;
}
public void glPointParameterf(int pname, float param) {
switch(pname) {
@@ -378,7 +379,7 @@ public class FixedFuncPipeline {
pointParams.put(4+3, param);
break;
}
- pointParamsDirty = true;
+ pointParamsDirty = true;
}
public void glPointParameterfv(int pname, float[] params, int params_offset) {
switch(pname) {
@@ -388,7 +389,7 @@ public class FixedFuncPipeline {
pointParams.put(4+2, params[params_offset + 2]);
break;
}
- pointParamsDirty = true;
+ pointParamsDirty = true;
}
public void glPointParameterfv(int pname, java.nio.FloatBuffer params) {
final int o = params.position();
@@ -399,24 +400,24 @@ public class FixedFuncPipeline {
pointParams.put(4+2, params.get(o + 2));
break;
}
- pointParamsDirty = true;
+ pointParamsDirty = true;
}
// private int[] pointTexObj = new int[] { 0 };
-
+
private void glDrawPoints(GL2ES2 gl, GLRunnable2<Object,Object> glDrawAction, Object args) {
if(gl.isGL2GL3()) {
gl.glEnable(GL2GL3.GL_VERTEX_PROGRAM_POINT_SIZE);
}
if(gl.isGL2ES1()) {
gl.glEnable(GL2ES1.GL_POINT_SPRITE);
- }
+ }
loadShaderPoints(gl);
shaderState.attachShaderProgram(gl, shaderProgramPoints, true);
validate(gl, false); // sync uniforms
glDrawAction.run(gl, args);
-
+
if(gl.isGL2ES1()) {
gl.glDisable(GL2ES1.GL_POINT_SPRITE);
}
@@ -431,17 +432,17 @@ public class FixedFuncPipeline {
int[] _args = (int[])args;
gl.glDrawArrays(GL.GL_POINTS, _args[0], _args[1]);
return null;
- }
- };
+ }
+ };
private final void glDrawPointArrays(GL2ES2 gl, int first, int count) {
- glDrawPoints(gl, glDrawArraysAction, new int[] { first, count });
+ glDrawPoints(gl, glDrawArraysAction, new int[] { first, count });
}
-
+
//
// Lighting
- //
+ //
- public void glLightfv(GL2ES2 gl, int light, int pname, java.nio.FloatBuffer params) {
+ public void glLightfv(GL2ES2 gl, int light, int pname, java.nio.FloatBuffer params) {
shaderState.useProgram(gl, true);
light -=GLLightingFunc.GL_LIGHT0;
if(0 <= light && light < MAX_LIGHTS) {
@@ -535,14 +536,14 @@ public class FixedFuncPipeline {
ud.setData(params);
shaderState.uniform(gl, ud);
} else if(verbose) {
-
+
}
}
//
// Misc States
//
-
+
public void glShadeModel(GL2ES2 gl, int mode) {
shaderState.useProgram(gl, true);
GLUniformData ud = shaderState.getUniform(mgl_ShadeModel);
@@ -607,7 +608,7 @@ public class FixedFuncPipeline {
_func = 8;
break;
default:
- throw new GLException("glAlphaFunc invalid func: "+toHexString(func));
+ throw new GLException("glAlphaFunc invalid func: "+toHexString(func));
}
if(0 < _func) {
if(0>alphaTestFunc) {
@@ -622,7 +623,7 @@ public class FixedFuncPipeline {
}
/**
- * @return false if digested in regard to GL2ES2 spec,
+ * @return false if digested in regard to GL2ES2 spec,
* eg this call must not be passed to an underlying ES2 implementation.
* true if this call shall be passed to an underlying GL2ES2/ES2 implementation as well.
*/
@@ -630,16 +631,16 @@ public class FixedFuncPipeline {
switch(cap) {
case GL.GL_BLEND:
case GL.GL_DEPTH_TEST:
- case GL.GL_DITHER:
+ case GL.GL_DITHER:
case GL.GL_POLYGON_OFFSET_FILL:
case GL.GL_SAMPLE_ALPHA_TO_COVERAGE:
case GL.GL_SAMPLE_COVERAGE:
case GL.GL_SCISSOR_TEST:
case GL.GL_STENCIL_TEST:
return true;
-
+
case GL.GL_CULL_FACE:
- /** ES2 supports CullFace implicit
+ /** ES2 supports CullFace implicit
final int _cullFace;
if(0>cullFace && enable || 0<cullFace && !enable) {
_cullFace = cullFace * -1;
@@ -651,15 +652,15 @@ public class FixedFuncPipeline {
cullFace=_cullFace;
} */
return true;
-
+
case GL.GL_TEXTURE_2D:
glEnableTexture(enable, activeTextureUnit);
return false;
-
+
case GLLightingFunc.GL_LIGHTING:
lightingEnabled=enable;
return false;
-
+
case GL2ES1.GL_ALPHA_TEST:
final int _alphaTestFunc;
if(0>alphaTestFunc && enable || 0<alphaTestFunc && !enable) {
@@ -672,12 +673,12 @@ public class FixedFuncPipeline {
alphaTestFunc=_alphaTestFunc;
}
return false;
-
+
case GL2ES1.GL_POINT_SMOOTH:
pointParams.put(1, enable ? 1.0f : 0.0f);
pointParamsDirty = true;
return false;
-
+
case GL2ES1.GL_POINT_SPRITE:
// gl_PointCoord always enabled
return false;
@@ -698,7 +699,7 @@ public class FixedFuncPipeline {
//
// Draw
//
-
+
public void glDrawArrays(GL2ES2 gl, int mode, int first, int count) {
switch(mode) {
case GL2.GL_QUAD_STRIP:
@@ -716,50 +717,56 @@ public class FixedFuncPipeline {
for (int j = first; j < count - 3; j += 4) {
gl.glDrawArrays(GL.GL_TRIANGLE_FAN, j, 4);
}
- } else {
+ } else {
gl.glDrawArrays(mode, first, count);
}
}
public void glDrawElements(GL2ES2 gl, int mode, int count, int type, java.nio.Buffer indices) {
- validate(gl, true);
+ validate(gl, true);
if ( GL2.GL_QUADS == mode && !gl.isGL2() ) {
final int idx0 = indices.position();
-
+
if( GL.GL_UNSIGNED_BYTE == type ) {
final ByteBuffer b = (ByteBuffer) indices;
for (int j = 0; j < count; j++) {
gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0x000000ff & b.get(idx0+j)), 4);
- }
+ }
} else if( GL.GL_UNSIGNED_SHORT == type ){
final ShortBuffer b = (ShortBuffer) indices;
for (int j = 0; j < count; j++) {
gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0x0000ffff & b.get(idx0+j)), 4);
- }
+ }
} else {
final IntBuffer b = (IntBuffer) indices;
for (int j = 0; j < count; j++) {
gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0xffffffff & b.get(idx0+j)), 4);
- }
+ }
}
- } else if( GL2ES1.GL_POINTS != mode ) {
- gl.glDrawElements(mode, count, type, indices);
} else {
- // FIXME GL_POINTS !
- gl.glDrawElements(mode, count, type, indices);
+ // FIXME: Impl. VBO usage .. or unroll (see above)!
+ if( !gl.getContext().isCPUDataSourcingAvail() ) {
+ throw new GLException("CPU data sourcing n/a w/ "+gl.getContext());
+ }
+ if( GL2ES1.GL_POINTS != mode ) {
+ ((GLES2)gl).glDrawElements(mode, count, type, indices);
+ } else {
+ // FIXME GL_POINTS !
+ ((GLES2)gl).glDrawElements(mode, count, type, indices);
+ }
}
}
public void glDrawElements(GL2ES2 gl, int mode, int count, int type, long indices_buffer_offset) {
- validate(gl, true);
+ validate(gl, true);
if ( GL2.GL_QUADS == mode && !gl.isGL2() ) {
throw new GLException("Cannot handle indexed QUADS on !GL2 w/ VBO due to lack of CPU index access");
- } else if( GL2ES1.GL_POINTS != mode ) {
+ } else if( GL2ES1.GL_POINTS != mode ) {
// FIXME GL_POINTS !
gl.glDrawElements(mode, count, type, indices_buffer_offset);
} else {
gl.glDrawElements(mode, count, type, indices_buffer_offset);
}
}
-
+
private final int textureEnabledCount() {
int n=0;
for(int i=MAX_TEXTURE_UNITS-1; i>=0; i--) {
@@ -769,12 +776,12 @@ public class FixedFuncPipeline {
}
return n;
}
-
+
public void validate(GL2ES2 gl, boolean selectShader) {
if( selectShader ) {
if( ShaderSelectionMode.AUTO == requestedShaderSelectionMode) {
final ShaderSelectionMode newMode;
-
+
// pre-validate shader switch
if( 0 != textureEnabledBits ) {
if(lightingEnabled) {
@@ -801,9 +808,9 @@ public class FixedFuncPipeline {
shaderState.useProgram(gl, true);
}
}
-
+
GLUniformData ud;
- if( pmvMatrix.update() ) {
+ if( pmvMatrix.update() ) {
ud = shaderState.getUniform(mgl_PMVMatrix);
if(null!=ud) {
final FloatBuffer m;
@@ -811,7 +818,7 @@ public class FixedFuncPipeline {
ShaderSelectionMode.COLOR_LIGHT_PER_VERTEX== currentShaderSelectionMode ) {
m = pmvMatrix.glGetPMvMvitMatrixf();
} else {
- m = pmvMatrix.glGetPMvMatrixf();
+ m = pmvMatrix.glGetPMvMatrixf();
}
if(m != ud.getBuffer()) {
ud.setData(m);
@@ -822,7 +829,7 @@ public class FixedFuncPipeline {
throw new GLException("Failed to update: mgl_PMVMatrix");
}
}
- if(colorVAEnabledDirty) {
+ if(colorVAEnabledDirty) {
ud = shaderState.getUniform(mgl_ColorEnabled);
if(null!=ud) {
int ca = true == shaderState.isVertexAttribArrayEnabled(GLPointerFuncUtil.mgl_Color) ? 1 : 0 ;
@@ -831,7 +838,7 @@ public class FixedFuncPipeline {
shaderState.uniform(gl, ud);
}
} else {
- throw new GLException("Failed to update: mgl_ColorEnabled");
+ throw new GLException("Failed to update: mgl_ColorEnabled");
}
colorVAEnabledDirty = false;
}
@@ -861,16 +868,16 @@ public class FixedFuncPipeline {
if(pointParamsDirty) {
ud = shaderState.getUniform(mgl_PointParams);
if(null!=ud) {
- // same data object
+ // same data object
shaderState.uniform(gl, ud);
}
pointParamsDirty = false;
}
-
+
if(lightsEnabledDirty) {
ud = shaderState.getUniform(mgl_LightsEnabled);
if(null!=ud) {
- // same data object
+ // same data object
shaderState.uniform(gl, ud);
}
lightsEnabledDirty=false;
@@ -879,41 +886,41 @@ public class FixedFuncPipeline {
if(textureCoordEnabledDirty) {
ud = shaderState.getUniform(mgl_TexCoordEnabled);
if(null!=ud) {
- // same data object
+ // same data object
shaderState.uniform(gl, ud);
}
textureCoordEnabledDirty=false;
- }
+ }
if(textureEnvModeDirty) {
ud = shaderState.getUniform(mgl_TexEnvMode);
if(null!=ud) {
- // same data object
+ // same data object
shaderState.uniform(gl, ud);
}
textureEnvModeDirty = false;
}
-
+
if(textureFormatDirty) {
for(int i = 0; i<MAX_TEXTURE_UNITS; i++) {
textureFormat.put(i, texID2Format.get(boundTextureObject[i]));
}
ud = shaderState.getUniform(mgl_TexFormat);
if(null!=ud) {
- // same data object
+ // same data object
shaderState.uniform(gl, ud);
- }
+ }
textureFormatDirty = false;
- }
+ }
if(textureEnabledDirty) {
ud = shaderState.getUniform(mgl_TextureEnabled);
if(null!=ud) {
- // same data object
+ // same data object
shaderState.uniform(gl, ud);
}
textureEnabledDirty=false;
}
-
+
if(verbose) {
System.err.println("validate: "+toString(null, DEBUG).toString());
}
@@ -937,8 +944,9 @@ public class FixedFuncPipeline {
sb.append("\n\t, ShaderState: ");
shaderState.toString(sb, alsoUnlocated);
sb.append("]");
- return sb;
+ return sb;
}
+ @Override
public String toString() {
return toString(null, DEBUG).toString();
}
@@ -947,19 +955,19 @@ public class FixedFuncPipeline {
private static final String constMaxTextures2 = "#define MAX_TEXTURE_UNITS 2\n";
private static final String constMaxTextures4 = "#define MAX_TEXTURE_UNITS 4\n";
private static final String constMaxTextures8 = "#define MAX_TEXTURE_UNITS 8\n";
-
+
private final void customizeShader(GL2ES2 gl, ShaderCode vp, ShaderCode fp, String maxTextureDefine) {
int rsVpPos = vp.defaultShaderCustomization(gl, true, true);
- int rsFpPos = fp.defaultShaderCustomization(gl, true, true);
+ int rsFpPos = fp.defaultShaderCustomization(gl, true, true);
vp.insertShaderSource(0, rsVpPos, maxTextureDefine);
- fp.insertShaderSource(0, rsFpPos, maxTextureDefine);
+ fp.insertShaderSource(0, rsFpPos, maxTextureDefine);
}
private final void loadShaderPoints(GL2ES2 gl) {
if( null != shaderProgramPoints ) {
return;
}
-
+
final ShaderCode vp = ShaderCode.create( gl, GL2ES2.GL_VERTEX_SHADER, shaderRootClass, shaderSrcRoot,
shaderBinRoot, shaderPointFileDef, true);
final ShaderCode fp = ShaderCode.create( gl, GL2ES2.GL_FRAGMENT_SHADER, shaderRootClass, shaderSrcRoot,
@@ -970,18 +978,18 @@ public class FixedFuncPipeline {
shaderProgramPoints.add(fp);
if(!shaderProgramPoints.link(gl, System.err)) {
throw new GLException("Couldn't link VertexColor program: "+shaderProgramPoints);
- }
+ }
}
-
+
private final void loadShader(GL2ES2 gl, ShaderSelectionMode mode) {
final boolean loadColor = ShaderSelectionMode.COLOR == mode;
final boolean loadColorTexture2 = ShaderSelectionMode.COLOR_TEXTURE2 == mode;
final boolean loadColorTexture4 = ShaderSelectionMode.COLOR_TEXTURE4 == mode;
final boolean loadColorTexture8 = ShaderSelectionMode.COLOR_TEXTURE8 == mode;
- final boolean loadColorTexture = loadColorTexture2 || loadColorTexture4 || loadColorTexture8 ;
+ final boolean loadColorTexture = loadColorTexture2 || loadColorTexture4 || loadColorTexture8 ;
final boolean loadColorLightPerVertex = ShaderSelectionMode.COLOR_LIGHT_PER_VERTEX == mode;
final boolean loadColorTexture8LightPerVertex = ShaderSelectionMode.COLOR_TEXTURE8_LIGHT_PER_VERTEX == mode;
-
+
if( null != shaderProgramColor && loadColor ||
null != shaderProgramColorTexture2 && loadColorTexture2 ||
null != shaderProgramColorTexture4 && loadColorTexture4 ||
@@ -990,7 +998,7 @@ public class FixedFuncPipeline {
null != shaderProgramColorTexture8Light && loadColorTexture8LightPerVertex ) {
return;
}
-
+
if( loadColor ) {
final ShaderCode vp = ShaderCode.create( gl, GL2ES2.GL_VERTEX_SHADER, shaderRootClass, shaderSrcRoot,
shaderBinRoot, vertexColorFile, true);
@@ -1007,7 +1015,7 @@ public class FixedFuncPipeline {
final ShaderCode vp = ShaderCode.create( gl, GL2ES2.GL_VERTEX_SHADER, shaderRootClass, shaderSrcRoot, shaderBinRoot, vertexColorFile, true);
final ShaderCode fp = ShaderCode.create( gl, GL2ES2.GL_FRAGMENT_SHADER, shaderRootClass, shaderSrcRoot,
shaderBinRoot, fragmentColorTextureFile, true);
-
+
if( loadColorTexture2 ) {
customizeShader(gl, vp, fp, constMaxTextures2);
shaderProgramColorTexture2 = new ShaderProgram();
@@ -1059,7 +1067,7 @@ public class FixedFuncPipeline {
}
}
}
-
+
private ShaderProgram selectShaderProgram(GL2ES2 gl, ShaderSelectionMode newMode) {
if(ShaderSelectionMode.AUTO == newMode) {
newMode = ShaderSelectionMode.COLOR;
@@ -1089,13 +1097,13 @@ public class FixedFuncPipeline {
currentShaderSelectionMode = newMode;
return sp;
}
-
- private void init(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix) {
+
+ private void init(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix) {
if(null==pmvMatrix) {
throw new GLException("PMVMatrix is null");
}
this.pmvMatrix=pmvMatrix;
- this.requestedShaderSelectionMode = mode;
+ this.requestedShaderSelectionMode = mode;
this.shaderState=new ShaderState();
this.shaderState.setVerbose(verbose);
@@ -1108,11 +1116,11 @@ public class FixedFuncPipeline {
shaderState.uniform(gl, new GLUniformData(mgl_ColorEnabled, 0));
shaderState.uniform(gl, new GLUniformData(mgl_ColorStatic, 4, colorStatic));
-
- texID2Format.setKeyNotFoundValue(0);
+
+ texID2Format.setKeyNotFoundValue(0);
shaderState.uniform(gl, new GLUniformData(mgl_TexCoordEnabled, 1, textureCoordEnabled));
shaderState.uniform(gl, new GLUniformData(mgl_TexEnvMode, 1, textureEnvMode));
- shaderState.uniform(gl, new GLUniformData(mgl_TexFormat, 1, textureFormat));
+ shaderState.uniform(gl, new GLUniformData(mgl_TexFormat, 1, textureFormat));
shaderState.uniform(gl, new GLUniformData(mgl_TextureEnabled, 1, textureEnabled));
for(int i=0; i<MAX_TEXTURE_UNITS; i++) {
shaderState.uniform(gl, new GLUniformData(mgl_Texture+i, i));
@@ -1121,7 +1129,7 @@ public class FixedFuncPipeline {
/** ES2 supports CullFace implicit
shaderState.uniform(gl, new GLUniformData(mgl_CullFace, cullFace)); */
shaderState.uniform(gl, new GLUniformData(mgl_AlphaTestFunc, alphaTestFunc));
- shaderState.uniform(gl, new GLUniformData(mgl_AlphaTestRef, alphaTestRef));
+ shaderState.uniform(gl, new GLUniformData(mgl_AlphaTestRef, alphaTestRef));
shaderState.uniform(gl, new GLUniformData(mgl_PointParams, 4, pointParams));
for(int i=0; i<MAX_LIGHTS; i++) {
shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].ambient", 4, defAmbient));
@@ -1134,7 +1142,7 @@ public class FixedFuncPipeline {
shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].constantAttenuation", defConstantAtten));
shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].linearAttenuation", defLinearAtten));
shaderState.uniform(gl, new GLUniformData(mgl_LightSource+"["+i+"].quadraticAttenuation", defQuadraticAtten));
- }
+ }
shaderState.uniform(gl, new GLUniformData(mgl_LightModel+".ambient", 4, defLightModelAmbient));
shaderState.uniform(gl, new GLUniformData(mgl_LightsEnabled, 1, lightsEnabled));
shaderState.uniform(gl, new GLUniformData(mgl_FrontMaterial+".ambient", 4, defMatAmbient));
@@ -1152,11 +1160,11 @@ public class FixedFuncPipeline {
private String toHexString(int i) {
return "0x"+Integer.toHexString(i);
}
-
+
protected boolean verbose = DEBUG;
private final FloatBuffer colorStatic = Buffers.copyFloatBuffer(one4f);
-
+
private int activeTextureUnit=0;
private int clientActiveTextureUnit=0;
private final IntIntHashMap texID2Format = new IntIntHashMap();
@@ -1165,9 +1173,9 @@ public class FixedFuncPipeline {
private final IntBuffer textureEnabled = Buffers.newDirectIntBuffer(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }); // per unit
private boolean textureEnabledDirty = false;
private final IntBuffer textureCoordEnabled = Buffers.newDirectIntBuffer(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }); // per unit
- private boolean textureCoordEnabledDirty = false;
+ private boolean textureCoordEnabledDirty = false;
// textureEnvMode: 1 GL_ADD, 2 GL_MODULATE (default), 3 GL_DECAL, 4 GL_BLEND, 5 GL_REPLACE, 6 GL_COMBINE
- private final IntBuffer textureEnvMode = Buffers.newDirectIntBuffer(new int[] { 2, 2, 2, 2, 2, 2, 2, 2 });
+ private final IntBuffer textureEnvMode = Buffers.newDirectIntBuffer(new int[] { 2, 2, 2, 2, 2, 2, 2, 2 });
private boolean textureEnvModeDirty = false;
private final IntBuffer textureFormat = Buffers.newDirectIntBuffer(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 }); // per unit
private boolean textureFormatDirty = false;
@@ -1185,11 +1193,11 @@ public class FixedFuncPipeline {
private boolean alphaTestDirty=false;
private int alphaTestFunc=-8; // <=0 disabled; 1 GL_NEVER, 2 GL_LESS, 3 GL_EQUAL, 4 GL_LEQUAL, 5 GL_GREATER, 6 GL_NOTEQUAL, 7 GL_GEQUAL, and 8 GL_ALWAYS (default)
private float alphaTestRef=0f;
-
+
private boolean pointParamsDirty = false;
/** ( pointSize, pointSmooth, attn. pointMinSize, attn. pointMaxSize ) , ( attenuation coefficients 1f 0f 0f, attenuation fade theshold 1f ) */
- private final FloatBuffer pointParams = Buffers.newDirectFloatBuffer(new float[] { 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f });
-
+ private final FloatBuffer pointParams = Buffers.newDirectFloatBuffer(new float[] { 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f });
+
private PMVMatrix pmvMatrix;
private ShaderState shaderState;
private ShaderProgram shaderProgramColor;
@@ -1197,7 +1205,7 @@ public class FixedFuncPipeline {
private ShaderProgram shaderProgramColorLight;
private ShaderProgram shaderProgramColorTexture8Light;
private ShaderProgram shaderProgramPoints;
-
+
private ShaderSelectionMode requestedShaderSelectionMode = ShaderSelectionMode.AUTO;
private ShaderSelectionMode currentShaderSelectionMode = requestedShaderSelectionMode;
@@ -1212,7 +1220,7 @@ public class FixedFuncPipeline {
private static final String mgl_LightsEnabled = "mgl_LightsEnabled"; // int mgl_LightsEnabled[MAX_LIGHTS];
private static final String mgl_AlphaTestFunc = "mgl_AlphaTestFunc"; // 1i (lowp int)
- private static final String mgl_AlphaTestRef = "mgl_AlphaTestRef"; // 1f
+ private static final String mgl_AlphaTestRef = "mgl_AlphaTestRef"; // 1f
private static final String mgl_ShadeModel = "mgl_ShadeModel"; // 1i
private static final String mgl_PointParams = "mgl_PointParams"; // vec4[2]: { (sz, smooth, attnMinSz, attnMaxSz), (attnCoeff(3), attnFadeTs) }
@@ -1224,7 +1232,7 @@ public class FixedFuncPipeline {
// private static final FloatBuffer zero4f = Buffers.newDirectFloatBuffer(new float[] { 0.0f, 0.0f, 0.0f, 0.0f });
private static final FloatBuffer neut4f = Buffers.newDirectFloatBuffer(new float[] { 0.0f, 0.0f, 0.0f, 1.0f });
- private static final FloatBuffer one4f = Buffers.newDirectFloatBuffer(new float[] { 1.0f, 1.0f, 1.0f, 1.0f });
+ private static final FloatBuffer one4f = Buffers.newDirectFloatBuffer(new float[] { 1.0f, 1.0f, 1.0f, 1.0f });
public static final FloatBuffer defAmbient = neut4f;
public static final FloatBuffer defDiffuseN = neut4f;
@@ -1238,7 +1246,7 @@ public class FixedFuncPipeline {
public static final float defQuadraticAtten = 0f;
public static final FloatBuffer defLightModelAmbient = Buffers.newDirectFloatBuffer(new float[] { 0.2f, 0.2f, 0.2f, 1.0f });
-
+
public static final FloatBuffer defMatAmbient = Buffers.newDirectFloatBuffer(new float[] { 0.2f, 0.2f, 0.2f, 1.0f });
public static final FloatBuffer defMatDiffuse = Buffers.newDirectFloatBuffer(new float[] { 0.8f, 0.8f, 0.8f, 1.0f });
public static final FloatBuffer defMatSpecular = neut4f;
@@ -1252,13 +1260,13 @@ public class FixedFuncPipeline {
private static final String shaderPointFileDef = "FixedFuncPoints";
private static final String shaderSrcRootDef = "shaders" ;
private static final String shaderBinRootDef = "shaders/bin" ;
-
+
private final Class<?> shaderRootClass;
- private final String shaderSrcRoot;
+ private final String shaderSrcRoot;
private final String shaderBinRoot;
private final String vertexColorFile;
private final String vertexColorLightFile;
private final String fragmentColorFile;
- private final String fragmentColorTextureFile;
+ private final String fragmentColorTextureFile;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java b/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java
index 833771d..d5b01ef 100644
--- a/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java
+++ b/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java
@@ -1,16 +1,16 @@
/**
* Original JavaScript code from <https://github.com/notmasteryet/jpgjs/blob/master/jpg.js>,
* ported to Java for JogAmp Community.
- *
+ *
* Enhancements:
* * InputStream instead of memory buffer
* * User provided memory handler
- * * Fixed JPEG Component ID/Index mapping
+ * * Fixed JPEG Component ID/Index mapping
* * Color space conversion (YCCK, CMYK -> RGB)
* * More error tolerant
- *
+ *
* *****************
- *
+ *
* Copyright 2011 notmasteryet
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,21 +24,21 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* *****************
- *
+ *
* 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
@@ -48,7 +48,7 @@
* 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.
@@ -70,7 +70,7 @@ import com.jogamp.opengl.util.texture.TextureData;
import com.jogamp.opengl.util.texture.TextureData.ColorSpace;
/**
- *
+ *
* <ul>
* <li> The JPEG specification can be found in the ITU CCITT Recommendation T.81
* (www.w3.org/Graphics/JPEG/itu-t81.pdf) </li>
@@ -89,22 +89,22 @@ public class JPEGDecoder {
private static final boolean DEBUG = Debug.debug("JPEGImage");
private static final boolean DEBUG_IN = false;
- /** Allows user to hook a {@link ColorSink} to another toolkit to produce {@link TextureData}. */
+ /** Allows user to hook a {@link ColorSink} to another toolkit to produce {@link TextureData}. */
public static interface ColorSink {
/**
* @param width
* @param height
* @param sourceCS the color-space of the decoded JPEG
* @param sourceComponents number of components used for the given source color-space
- * @return Either {@link TextureData.ColorSpace#RGB} or {@link TextureData.ColorSpace#YCbCr}. {@link TextureData.ColorSpace#YCCK} and {@link TextureData.ColorSpace#CMYK} will throw an exception!
+ * @return Either {@link TextureData.ColorSpace#RGB} or {@link TextureData.ColorSpace#YCbCr}. {@link TextureData.ColorSpace#YCCK} and {@link TextureData.ColorSpace#CMYK} will throw an exception!
* @throws RuntimeException
*/
public TextureData.ColorSpace allocate(int width, int height, TextureData.ColorSpace sourceCS, int sourceComponents) throws RuntimeException;
public void store2(int x, int y, byte c1, byte c2);
public void storeRGB(int x, int y, byte r, byte g, byte b);
- public void storeYCbCr(int x, int y, byte Y, byte Cb, byte Cr);
+ public void storeYCbCr(int x, int y, byte Y, byte Cb, byte Cr);
}
-
+
public static class JFIF {
final VersionNumber version;
final int densityUnits;
@@ -138,11 +138,12 @@ public class JPEGDecoder {
} else {
return null;
}
- }
+ }
+ @Override
public final String toString() {
return "JFIF[ver "+version+", density[units "+densityUnits+", "+xDensity+"x"+yDensity+"], thumb "+thumbWidth+"x"+thumbHeight+"]";
- }
+ }
}
public static class Adobe {
@@ -151,7 +152,7 @@ public class JPEGDecoder {
final short flags1;
final short colorCode;
final ColorSpace colorSpace;
-
+
private Adobe(final byte[] data) {
version = data[6];
flags0 = (short) ( (data[7] << 8) | data[8] ) ;
@@ -172,9 +173,10 @@ public class JPEGDecoder {
return null;
}
}
+ @Override
public final String toString() {
return "Adobe[ver "+version+", flags["+toHexString(flags0)+", "+toHexString(flags1)+"], colorSpace/Code "+colorSpace+"/"+toHexString(colorCode)+"]";
- }
+ }
}
/** TODO */
public static class EXIF {
@@ -189,10 +191,11 @@ public class JPEGDecoder {
} else {
return null;
}
- }
+ }
+ @Override
public final String toString() {
return "EXIF[]";
- }
+ }
}
@SuppressWarnings("serial")
@@ -210,7 +213,7 @@ public class JPEGDecoder {
}
public int getMarker() { return marker; }
}
-
+
/** Start of Image */
private static final int M_SOI = 0xFFD8;
/** End of Image */
@@ -264,8 +267,8 @@ public class JPEGDecoder {
private static final int M_APP15 = 0xFFEF;
/** Annotation / Comment */
- private static final int M_ANO = 0xFFFE;
-
+ private static final int M_ANO = 0xFFFE;
+
static final int[] dctZigZag = new int[] {
0,
1, 8,
@@ -323,7 +326,7 @@ public class JPEGDecoder {
private final void checkBounds(int idx) {
if( 0 > idx || idx >= compCount ) {
throw new CodecException("Idx out of bounds "+idx+", "+this);
- }
+ }
}
public final void validateComponents() {
for(int i=0; i<compCount; i++) {
@@ -362,6 +365,7 @@ public class JPEGDecoder {
public final boolean hasCompID(int componentID) {
return compIDs.contains(componentID);
}
+ @Override
public final String toString() {
return "Frame[progressive "+progressive+", precision "+precision+", scanLines "+scanLines+", samplesPerLine "+samplesPerLine+
", components[count "+compCount+", maxID "+maxCompID+", componentIDs "+compIDs+", comps "+Arrays.asList(comps)+"]]";
@@ -378,7 +382,7 @@ public class JPEGDecoder {
int blocksPerLine;
int blocksPerLineForMcu;
/** [blocksPerColumnForMcu][blocksPerLineForMcu][64]; */
- int[][][] blocks;
+ int[][][] blocks;
int pred;
BinObj huffmanTableAC;
BinObj huffmanTableDC;
@@ -400,9 +404,10 @@ public class JPEGDecoder {
if( row >= blocksPerColumnForMcu || col >= blocksPerLineForMcu ) {
throw new CodecException("Out of bounds given ["+row+"]["+col+"] - "+this);
}
- return blocks[row][col];
+ return blocks[row][col];
}
-
+
+ @Override
public final String toString() {
return "CompIn[h "+h+", v "+v+", qttIdx "+qttIdx+", blocks["+blocksPerColumn+", mcu "+blocksPerColumnForMcu+"]["+blocksPerLine+", mcu "+blocksPerLineForMcu+"][64]]";
}
@@ -410,7 +415,7 @@ public class JPEGDecoder {
/** The decoded components */
class ComponentOut {
- private final ArrayList<byte[]> lines;
+ private final ArrayList<byte[]> lines;
final float scaleX;
final float scaleY;
@@ -419,18 +424,20 @@ public class JPEGDecoder {
this.scaleX = scaleX;
this.scaleY = scaleY;
}
-
+
/** Safely returning a line, if index exceeds number of lines, last line is returned. */
public final byte[] getLine(int i) {
final int sz = lines.size();
return lines.get( i < sz ? i : sz - 1);
}
-
+
+ @Override
public final String toString() {
return "CompOut[lines "+lines.size()+", scale "+scaleX+"x"+scaleY+"]";
}
}
+ @Override
public String toString() {
final String jfifS = null != jfif ? jfif.toString() : "JFIF nil";
final String exifS = null != exif ? exif.toString() : "Exif nil";
@@ -442,7 +449,7 @@ public class JPEGDecoder {
private BufferedInputStream istream;
private int _ipos = 0;
private int _iposSave = 0;
-
+
private int width = 0;
private int height = 0;
private JFIF jfif = null;
@@ -457,14 +464,14 @@ public class JPEGDecoder {
public final int getHeight() { return height; }
private final void resetInput(InputStream is) {
- if( is instanceof BufferedInputStream ) {
+ if( is instanceof BufferedInputStream ) {
istream = (BufferedInputStream) is;
} else {
istream = new BufferedInputStream(is);
}
_ipos = 0;
}
-
+
private final void markStream(int readLimit) {
istream.mark(readLimit);
_iposSave = _ipos;
@@ -480,7 +487,7 @@ public class JPEGDecoder {
if( -1 < r ) {
if(DEBUG_IN) { System.err.println("u8["+_ipos+"]: "+toHexString(r)); }
_ipos++;
- } else if(DEBUG_IN) {
+ } else if(DEBUG_IN) {
System.err.println("u8["+_ipos+"]: EOS");
}
return r;
@@ -519,7 +526,7 @@ public class JPEGDecoder {
}
if(DEBUG_IN) { System.err.println("JPEG.readDataBlock: net-len "+(len-2)+", "+this); dumpData(data, 0, len-2); }
return data;
- }
+ }
static final void dumpData(byte[] data, int offset, int len) {
for(int i=0; i<len; ) {
System.err.print(i%8+": ");
@@ -527,8 +534,8 @@ public class JPEGDecoder {
System.err.println(toHexString(0x000000FF & data[offset+i])+", ");
}
System.err.println("");
- }
- }
+ }
+ }
public synchronized void clear(InputStream inputStream) {
resetInput(inputStream);
@@ -536,17 +543,17 @@ public class JPEGDecoder {
height = 0;
jfif = null;
exif = null;
- adobe = null;
- components = null;
+ adobe = null;
+ components = null;
}
- public synchronized JPEGDecoder parse(final InputStream inputStream) throws IOException {
+ public synchronized JPEGDecoder parse(final InputStream inputStream) throws IOException {
clear(inputStream);
-
+
final int[][] quantizationTables = new int[0x0F][]; // 4 bits
final BinObj[] huffmanTablesAC = new BinObj[0x0F]; // Huffman table spec - 4 bits
final BinObj[] huffmanTablesDC = new BinObj[0x0F]; // Huffman table spec - 4 bits
// final ArrayList<Frame> frames = new ArrayList<Frame>(); // JAU: max 1-frame
-
+
Frame frame = null;
int resetInterval = 0;
int fileMarker = readUint16();
@@ -614,7 +621,7 @@ public class JPEGDecoder {
quantizationTables[tableIdx] = tableData;
if( DEBUG ) {
System.err.println("JPEG.parse.QTT["+tableIdx+"]: spec "+quantizationTableSpec+", precision "+precisionID+", data "+count+"/"+quantizationTablesLength);
- }
+ }
}
if(count!=quantizationTablesLength){
throw new CodecException("ERROR: QTT format error [count!=Length]: "+count+"/"+quantizationTablesLength);
@@ -660,7 +667,7 @@ public class JPEGDecoder {
}
break;
- case M_DHT: {
+ case M_DHT: {
int count = 0;
final int huffmanLength = readUint16(); count+=2;
int i=count, codeLengthTotal = 0;
@@ -675,7 +682,7 @@ public class JPEGDecoder {
for (int j = 0; j < codeLengthSum; j++) {
huffmanValues[j] = (byte)readUint8(); count++;
}
- codeLengthTotal += codeLengthSum;
+ codeLengthTotal += codeLengthSum;
i += 17 + codeLengthSum;
final BinObj[] table = ( huffmanTableSpec >> 4 ) == 0 ? huffmanTablesDC : huffmanTablesAC;
table[huffmanTableSpec & 0x0F] = buildHuffmanTable(codeLengths, huffmanValues);
@@ -699,7 +706,7 @@ public class JPEGDecoder {
final int sosLen = readUint16(); count+=2;
final int selectorsCount = readUint8(); count++;
ArrayList<ComponentIn> components = new ArrayList<ComponentIn>();
- if(DEBUG) { System.err.println("JPG.parse.SOS: selectorCount [0.."+(selectorsCount-1)+"]: "+frame); }
+ if(DEBUG) { System.err.println("JPG.parse.SOS: selectorCount [0.."+(selectorsCount-1)+"]: "+frame); }
for (int i = 0; i < selectorsCount; i++) {
final int compID = readUint8(); count++;
final ComponentIn component = frame.getCompByID(compID);
@@ -751,8 +758,8 @@ public class JPEGDecoder {
final ComponentIn component = frame.getCompByIndex(i);
// System.err.println("JPG.parse.buildComponentData["+i+"]: "+component); // JAU
// System.err.println("JPG.parse.buildComponentData["+i+"]: "+frame); // JAU
- this.components[i] = new ComponentOut( output.buildComponentData(frame, component),
- (float)component.h / (float)frame.maxH,
+ this.components[i] = new ComponentOut( output.buildComponentData(frame, component),
+ (float)component.h / (float)frame.maxH,
(float)component.v / (float)frame.maxV );
}
if(DEBUG) { System.err.println("JPG.parse.X: End of processing input "+this); }
@@ -797,7 +804,7 @@ public class JPEGDecoder {
final boolean isValue;
final BinObj[] tree;
final byte b;
-
+
BinObj(byte b) {
this.isValue= true;
this.b = b;
@@ -815,13 +822,13 @@ public class JPEGDecoder {
}
private BinObj buildHuffmanTable(int[] codeLengths, byte[] values) {
- int k = 0;
- int length = 16;
+ int k = 0;
+ int length = 16;
final ArrayList<BinObjIdxed> code = new ArrayList<BinObjIdxed>();
while (length > 0 && 0==codeLengths[length - 1]) {
length--;
}
- code.add(new BinObjIdxed());
+ code.add(new BinObjIdxed());
BinObjIdxed p = code.get(0), q;
for (int i = 0; i < length; i++) {
for (int j = 0; j < codeLengths[i]; j++) {
@@ -959,7 +966,7 @@ public class JPEGDecoder {
t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12;
v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12;
v6 = t;
-
+
// stage 1
p[0 + row] = v0 + v7;
p[7 + row] = v0 - v7;
@@ -1066,7 +1073,7 @@ public class JPEGDecoder {
private int successiveACState, successiveACNextValue;
private int decodeScan(Frame frame, ArrayList<ComponentIn> components, int resetInterval,
- int spectralStart, int spectralEnd, int successivePrev, int successive) throws IOException {
+ int spectralStart, int spectralEnd, int successivePrev, int successive) throws IOException {
// this.precision = frame.precision;
// this.samplesPerLine = frame.samplesPerLine;
// this.scanLines = frame.scanLines;
@@ -1079,7 +1086,7 @@ public class JPEGDecoder {
this.spectralStart = spectralStart;
this.spectralEnd = spectralEnd;
this.successive = successive;
-
+
final int componentsLength = components.size();
final DecoderFunction decodeFn;
@@ -1096,7 +1103,7 @@ public class JPEGDecoder {
int mcu = 0;
int mcuExpected;
if (componentsLength == 1) {
- final ComponentIn c = components.get(0);
+ final ComponentIn c = components.get(0);
mcuExpected = c.blocksPerLine * c.blocksPerColumn;
} else {
mcuExpected = mcusPerLine * frame.mcusPerColumn;
@@ -1153,14 +1160,14 @@ public class JPEGDecoder {
if( marker < 0xFF00 ) {
rewindStream();
throw new CodecException("marker not found @ mcu "+mcu+"/"+mcuExpected+", u16: "+toHexString(marker));
- }
+ }
final boolean isRSTx = 0xFFD0 <= marker && marker <= 0xFFD7; // !RSTx
if(DEBUG) {
System.err.println("JPEG.decodeScan: MCUs "+mcu+"/"+mcuExpected+", u16 "+toHexString(marker)+", RSTx "+isRSTx+", "+frame);
}
if ( !isRSTx ) {
break; // handle !RSTx marker in caller
- }
+ }
}
return marker;
}
@@ -1227,6 +1234,7 @@ public class JPEGDecoder {
final DecoderFunction decodeACSuccessive = new ACSuccessiveDecoder();
class BaselineDecoder implements DecoderFunction {
+ @Override
public void decode(ComponentIn component, int[] zz) throws IOException {
final int t = decodeHuffman(component.huffmanTableDC);
final int diff = ( t == 0 ) ? 0 : receiveAndExtend(t);
@@ -1250,6 +1258,7 @@ public class JPEGDecoder {
}
}
class DCFirstDecoder implements DecoderFunction {
+ @Override
public void decode(ComponentIn component, int[] zz) throws IOException {
final int t = decodeHuffman(component.huffmanTableDC);
final int diff = ( t == 0 ) ? 0 : (receiveAndExtend(t) << successive);
@@ -1257,12 +1266,14 @@ public class JPEGDecoder {
}
}
class DCSuccessiveDecoder implements DecoderFunction {
+ @Override
public void decode(ComponentIn component, int[] zz) throws IOException {
zz[0] |= readBit() << successive;
}
}
class ACFirstDecoder implements DecoderFunction {
+ @Override
public void decode(ComponentIn component, int[] zz) throws IOException {
if (eobrun > 0) {
eobrun--;
@@ -1288,6 +1299,7 @@ public class JPEGDecoder {
}
}
class ACSuccessiveDecoder implements DecoderFunction {
+ @Override
public void decode(ComponentIn component, int[] zz) throws IOException {
int k = spectralStart, e = spectralEnd, r = 0;
while (k <= e) {
@@ -1306,7 +1318,7 @@ public class JPEGDecoder {
successiveACState = 1;
}
} else {
- // if (s !== 1) {
+ // if (s !== 1) {
if (s != 1) {
throw new CodecException("invalid ACn encoding");
}
@@ -1380,18 +1392,18 @@ public class JPEGDecoder {
int R = Y + ( ( 91881 * Cr ) >> 16 );
if(R<0) R=0;
else if(R>255) R=255;
-
+
pixelStorage.storeRGB(x, y, (byte)R, (byte)G, (byte)B);
} */
-
+
public synchronized void getPixel(JPEGDecoder.ColorSink pixelStorage, int width, int height) {
final int scaleX = this.width / width, scaleY = this.height / height;
final int componentCount = this.components.length;
- final ColorSpace sourceCS = ( null != adobe ) ? adobe.colorSpace : ColorSpace.YCbCr;
+ final ColorSpace sourceCS = ( null != adobe ) ? adobe.colorSpace : ColorSpace.YCbCr;
final ColorSpace storageCS = pixelStorage.allocate(width, height, sourceCS, componentCount);
if( ColorSpace.RGB != storageCS && ColorSpace.YCbCr != storageCS ) {
- throw new IllegalArgumentException("Unsupported storage color space: "+storageCS);
+ throw new IllegalArgumentException("Unsupported storage color space: "+storageCS);
}
switch (componentCount) {
@@ -1504,7 +1516,7 @@ public class JPEGDecoder {
final byte G = clampTo8bit( ( cM * cK ) / 255f );
final byte B = clampTo8bit( ( cY * cK ) / 255f );
pixelStorage.storeRGB(x, y, R, G, B);
- }
+ }
} else { // ColorModel.YCCK == sourceCM
for (int x = 0; x < width; x++) {
final int xs = x * scaleX;
@@ -1525,7 +1537,7 @@ public class JPEGDecoder {
}
}
}
- }
+ }
break;
default:
throw new CodecException("Unsupported color model: Space "+sourceCS+", components "+componentCount);
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java b/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java
index 0fffc85..5e177b8 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java
@@ -4,7 +4,7 @@ import java.util.HashMap;
/**
* Internal PNG predictor filter, or strategy to select it.
- *
+ *
*/
public enum FilterType {
/**
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java
index e62134c..ac7b858 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java
@@ -98,7 +98,7 @@ public class ImageInfo {
/**
* Full constructor
- *
+ *
* @param cols
* Width in pixels
* @param rows
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java
index e34e6a2..e6afd86 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java
@@ -25,7 +25,7 @@ public class ImageLine {
* Except for 'packed' formats (gray/indexed with 1-2-4 bitdepth) each
* <code>int</code> is a "sample" (one for channel), (0-255 or 0-65535) in
* the corresponding PNG sequence: <code>R G B R G B...</code> or
- * <code>R G B A R G B A...</tt>
+ * <code>R G B A R G B A...</tt>
* or <code>g g g ...</code> or <code>i i i</code> (palette index)
* <p>
* For bitdepth=1/2/4 , and if samplesUnpacked=false, each value is a PACKED
@@ -60,7 +60,7 @@ public class ImageLine {
/**
* true: each element of the scanline array represents a sample always, even
* for internally packed PNG formats
- *
+ *
* false: if the original image was of packed type (bit depth less than 8)
* we keep samples packed in a single array element
*/
@@ -74,7 +74,7 @@ public class ImageLine {
}
/**
- *
+ *
* @param imgInfo
* Inmutable ImageInfo, basic parameter of the image we are
* reading or writing
@@ -84,7 +84,7 @@ public class ImageLine {
* @param unpackedMode
* If true, we use unpacked format, even for packed original
* images
- *
+ *
*/
public ImageLine(ImageInfo imgInfo, SampleType stype, boolean unpackedMode) {
this(imgInfo, stype, unpackedMode, null, null);
@@ -124,13 +124,13 @@ public class ImageLine {
/*
* Unpacks scanline (for bitdepth 1-2-4)
- *
+ *
* Arrays must be prealocated. src : samplesPerRowPacked dst : samplesPerRow
- *
+ *
* This usually works in place (with src==dst and length=samplesPerRow)!
- *
+ *
* If not, you should only call this only when necesary (bitdepth <8)
- *
+ *
* If <code>scale==true<code>, it scales the value (just a bit shift) towards 0-255.
*/
static void unpackInplaceInt(final ImageInfo iminfo, final int[] src, final int[] dst, final boolean scale) {
@@ -165,15 +165,15 @@ public class ImageLine {
/*
* Unpacks scanline (for bitdepth 1-2-4)
- *
+ *
* Arrays must be prealocated. src : samplesPerRow dst : samplesPerRowPacked
- *
+ *
* This usually works in place (with src==dst and length=samplesPerRow)! If not, you should only call this only when
* necesary (bitdepth <8)
- *
+ *
* The trailing elements are trash
- *
- *
+ *
+ *
* If <code>scale==true<code>, it scales the value (just a bit shift) towards 0-255.
*/
static void packInplaceInt(final ImageInfo iminfo, final int[] src, final int[] dst, final boolean scaled) {
@@ -270,7 +270,7 @@ public class ImageLine {
/**
* Creates a new ImageLine similar to this, but unpacked
- *
+ *
* The caller must be sure that the original was really packed
*/
public ImageLine unpackToNewImageLine() {
@@ -284,7 +284,7 @@ public class ImageLine {
/**
* Creates a new ImageLine similar to this, but packed
- *
+ *
* The caller must be sure that the original was really unpacked
*/
public ImageLine packToNewImageLine() {
@@ -315,6 +315,7 @@ public class ImageLine {
/**
* Basic info
*/
+ @Override
public String toString() {
return "row=" + rown + " cols=" + imgInfo.cols + " bpc=" + imgInfo.bitDepth + " size=" + scanline.length;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java
index 91516a7..4636c39 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java
@@ -23,7 +23,7 @@ public class ImageLineHelper {
/**
* Given an indexed line with a palette, unpacks as a RGB array, or RGBA if
* a non nul PngChunkTRNS chunk is passed
- *
+ *
* @param line
* ImageLine as returned from PngReader
* @param pal
@@ -92,6 +92,7 @@ public class ImageLineHelper {
public double[] maxdif = { BIG_VALUE_NEG, BIG_VALUE_NEG, BIG_VALUE_NEG, BIG_VALUE }; // maxima
public final int channels; // diferencia
+ @Override
public String toString() {
return channels == 3 ? String.format(
"prom=%.1f (%.1f %.1f %.1f) max=%.1f (%.1f %.1f %.1f) min=%.1f (%.1f %.1f %.1f)", promlum, prom[0],
@@ -143,7 +144,7 @@ public class ImageLineHelper {
/**
* integer packed R G B only for bitdepth=8! (does not check!)
- *
+ *
**/
public static int getPixelRGB8(ImageLine line, int column) {
int offset = column * line.channels;
@@ -252,7 +253,7 @@ public class ImageLineHelper {
* <code>scale==true<code>, it scales the value (just a bit shift) towards 0-255.
* <p>
* You probably should use {@link ImageLine#unpackToNewImageLine()}
- *
+ *
*/
public static int[] unpack(ImageInfo imgInfo, int[] src, int[] dst, boolean scale) {
int len1 = imgInfo.samplesPerRow;
@@ -282,7 +283,7 @@ public class ImageLineHelper {
* Packs scanline (for bitdepth 1-2-4) from array into the scanline
* <p>
* If <code>scale==true<code>, it scales the value (just a bit shift).
- *
+ *
* You probably should use {@link ImageLine#packToNewImageLine()}
*/
public static int[] pack(ImageInfo imgInfo, int[] src, int[] dst, boolean scale) {
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java
index feb50e7..fb2cf59 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java
@@ -5,7 +5,7 @@ import jogamp.opengl.util.pngj.ImageLine.SampleType;
/**
* Wraps in a matrix a set of image rows, not necessarily contiguous - but
* equispaced.
- *
+ *
* The fields mirrors those of {@link ImageLine}, and you can access each row as
* a ImageLine backed by the matrix row, see
* {@link #getImageLineAtMatrixRow(int)}
@@ -28,7 +28,7 @@ public class ImageLines {
* Allocates a matrix to store {@code nRows} image rows. See
* {@link ImageLine} and {@link PngReader#readRowsInt()}
* {@link PngReader#readRowsByte()}
- *
+ *
* @param imgInfo
* @param stype
* @param unpackedMode
@@ -77,7 +77,7 @@ public class ImageLines {
/**
* Converts from matrix row number (0 : nRows-1) to image row number
- *
+ *
* @param mrow
* Matrix row number
* @return Image row number. Invalid only if mrow is invalid
@@ -88,7 +88,7 @@ public class ImageLines {
/**
* Returns a ImageLine is backed by the matrix, no allocation done
- *
+ *
* @param mrow
* Matrix row, from 0 to nRows This is not necessarily the image
* row, see {@link #imageRowToMatrixRow(int)} and
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java
index a950c6b..9e64c3e 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java
@@ -49,7 +49,7 @@ public class PngHelperInternal {
/**
* -1 if eof
- *
+ *
* PNG uses "network byte order"
*/
public static int readInt2(InputStream is) {
@@ -186,6 +186,7 @@ public class PngHelperInternal {
}
private static final ThreadLocal<CRC32> crcProvider = new ThreadLocal<CRC32>() {
+ @Override
protected CRC32 initialValue() {
return new CRC32();
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java
index e42dd87..0412beb 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java
@@ -92,13 +92,13 @@ public class PngReader {
* Constructs a PngReader from an InputStream.
* <p>
* See also <code>FileHelper.createPngReader(File f)</code> if available.
- *
+ *
* Reads only the signature and first chunk (IDHR)
- *
+ *
* @param filenameOrDescription
* : Optional, can be a filename or a description. Just for
* error/debug messages
- *
+ *
*/
public PngReader(InputStream inputStream, String filenameOrDescription) {
this.filename = filenameOrDescription == null ? "" : filenameOrDescription;
@@ -411,7 +411,7 @@ public class PngReader {
/**
* Determines which ancillary chunks (metada) are to be loaded
- *
+ *
* @param chunkLoadBehaviour
* {@link ChunkLoadBehaviour}
*/
@@ -427,7 +427,7 @@ public class PngReader {
* replaced by a single dummy-marker IDAT chunk. These might be copied to
* the PngWriter
* <p>
- *
+ *
* @see #getMetadata()
*/
public ChunksList getChunksList() {
@@ -442,7 +442,7 @@ public class PngReader {
/**
* High level wrapper over chunksList
- *
+ *
* @see #getChunksList()
*/
public PngMetadata getMetadata() {
@@ -456,7 +456,7 @@ public class PngReader {
* appropiate readRowInt/readRowByte
* <p>
* In general, specifying the concrete readRowInt/readRowByte is preferrable
- *
+ *
* @see #readRowInt(int) {@link #readRowByte(int)}
*/
public ImageLine readRow(int nrow) {
@@ -468,9 +468,9 @@ public class PngReader {
/**
* Reads the row as INT, storing it in the {@link #imgLine} property and
* returning it.
- *
+ *
* The row must be greater or equal than the last read row.
- *
+ *
* @param nrow
* Row number, from 0 to rows-1. Increasing order.
* @return ImageLine object, also available as field. Data is in
@@ -490,10 +490,10 @@ public class PngReader {
/**
* Reads the row as BYTES, storing it in the {@link #imgLine} property and
* returning it.
- *
+ *
* The row must be greater or equal than the last read row. This method
* allows to pass the same row that was last read.
- *
+ *
* @param nrow
* Row number, from 0 to rows-1. Increasing order.
* @return ImageLine object, also available as field. Data is in
@@ -524,13 +524,13 @@ public class PngReader {
* <p>
* If the bitdepth is less than 8, the bytes are packed - unless
* {@link #unpackedMode} is true.
- *
+ *
* @param buffer
* Prealocated buffer, or null.
* @param nrow
* Row number (0 is top). Most be strictly greater than the last
* read row.
- *
+ *
* @return The scanline in the same passwd buffer if it was allocated, a
* newly allocated one otherwise
*/
@@ -562,13 +562,13 @@ public class PngReader {
* {@link #unpackedMode} is true. <br>
* If the bitdepth is 16, the least significant byte is lost.
* <p>
- *
+ *
* @param buffer
* Prealocated buffer, or null.
* @param nrow
* Row number (0 is top). Most be strictly greater than the last
* read row.
- *
+ *
* @return The scanline in the same passwd buffer if it was allocated, a
* newly allocated one otherwise
*/
@@ -632,9 +632,9 @@ public class PngReader {
* <p>
* Notice that the columns in the matrix is not the pixel width of the
* image, but rather pixels x channels
- *
+ *
* @see #readRowInt(int) to read about the format of each row
- *
+ *
* @param rowOffset
* Number of rows to be skipped
* @param nRows
@@ -678,7 +678,7 @@ public class PngReader {
/**
* Same as readRowsInt(0, imgInfo.rows, 1)
- *
+ *
* @see #readRowsInt(int, int, int)
*/
public ImageLines readRowsInt() {
@@ -696,10 +696,10 @@ public class PngReader {
* <p>
* Notice that the columns in the matrix is not the pixel width of the
* image, but rather pixels x channels
- *
+ *
* @see #readRowByte(int) to read about the format of each row. Notice that
* if the bitdepth is 16 this will lose information
- *
+ *
* @param rowOffset
* Number of rows to be skipped
* @param nRows
@@ -743,7 +743,7 @@ public class PngReader {
/**
* Same as readRowsByte(0, imgInfo.rows, 1)
- *
+ *
* @see #readRowsByte(int, int, int)
*/
public ImageLines readRowsByte() {
@@ -752,13 +752,13 @@ public class PngReader {
/*
* For the interlaced case, nrow indicates the subsampled image - the pass must be set already.
- *
+ *
* This must be called in strict order, both for interlaced or no interlaced.
- *
+ *
* Updates rowNum.
- *
+ *
* Leaves raw result in rowb
- *
+ *
* Returns bytes actually read (not including the filter byte)
*/
private int readRowRaw(final int nrow) {
@@ -933,7 +933,7 @@ public class PngReader {
* scanline will be sample. This implies more processing and memory, but
* it's the most efficient option if you intend to read individual pixels. <br>
* This option should only be set before start reading.
- *
+ *
* @param unPackedMode
*/
public void setUnpackedMode(boolean unPackedMode) {
@@ -951,7 +951,7 @@ public class PngReader {
* Tries to reuse the allocated buffers from other already used PngReader
* object. This will have no effect if the buffers are smaller than necessary.
* It also reuses the inflater.
- *
+ *
* @param other A PngReader that has already finished reading pixels. Can be null.
*/
public void reuseBuffersFrom(PngReader other) {
@@ -977,7 +977,7 @@ public class PngReader {
/**
* Just for testing. TO be called after ending reading, only if
* initCrctest() was called before start
- *
+ *
* @return CRC of the raw pixels values
*/
long getCrctestVal() {
@@ -994,6 +994,7 @@ public class PngReader {
/**
* Basic info, for debugging.
*/
+ @Override
public String toString() { // basic info
return "filename=" + filename + " " + imgInfo.toString();
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java
index 3e684a8..2f475aa 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java
@@ -88,7 +88,7 @@ public class PngWriter {
* filters) and queue chunks before start writing the pixels.
* <p>
* See also <code>FileHelper.createPngWriter()</code> if available.
- *
+ *
* @param outputStream
* Opened stream for binary writing
* @param imgInfo
@@ -422,7 +422,7 @@ public class PngWriter {
* Should be called when creating an image from another, before starting
* writing lines, to copy relevant chunks.
* <p>
- *
+ *
* @param reader
* : PngReader object, already opened.
* @param copy_mask
@@ -439,7 +439,7 @@ public class PngWriter {
* Should be called when creating an image from another, after writing all
* lines, before closing the writer, to copy additional chunks.
* <p>
- *
+ *
* @param reader
* : PngReader object, already opened and fully read.
* @param copy_mask
@@ -455,7 +455,7 @@ public class PngWriter {
* <p>
* Actually: compressed size = total size of IDAT data , raw size =
* uncompressed pixel bytes = rows * (bytesPerRow + 1).
- *
+ *
* This must be called after pngw.end()
*/
public double computeCompressionRatio() {
@@ -512,7 +512,7 @@ public class PngWriter {
* This must be called just after constructor, before starting writing.
* <p>
* See also setFilterType()
- *
+ *
* @param compLevel
* between 0 and 9 (default:6 , recommended: 6 or more)
*/
@@ -528,7 +528,7 @@ public class PngWriter {
* This must be called just after constructor, before starting writing.
* <p>
* See also setCompLevel()
- *
+ *
* @param filterType
* One of the five prediction types or strategy to choose it (see
* <code>PngFilterType</code>) Recommended values: DEFAULT
@@ -542,7 +542,7 @@ public class PngWriter {
* Sets maximum size of IDAT fragments. This has little effect on
* performance you should rarely call this
* <p>
- *
+ *
* @param idatMaxSize
* default=0 : use defaultSize (32K)
*/
@@ -572,7 +572,7 @@ public class PngWriter {
/**
* Writes line, checks that the row number is consistent with that of the
* ImageLine See writeRow(int[] newrow, int rown)
- *
+ *
* @deprecated Better use writeRow(ImageLine imgline, int rownumber)
*/
public void writeRow(ImageLine imgline) {
@@ -581,9 +581,9 @@ public class PngWriter {
/**
* Writes line. See writeRow(int[] newrow, int rown)
- *
+ *
* The <tt>packed</tt> flag of the imageline is honoured!
- *
+ *
* @see #writeRowInt(int[], int)
*/
public void writeRow(ImageLine imgline, int rownumber) {
@@ -596,7 +596,7 @@ public class PngWriter {
/**
* Same as writeRow(int[] newrow, int rown), but does not check row number
- *
+ *
* @param newrow
*/
public void writeRow(int[] newrow) {
@@ -605,7 +605,7 @@ public class PngWriter {
/**
* Alias to writeRowInt
- *
+ *
* @see #writeRowInt(int[], int)
*/
public void writeRow(int[] newrow, int rown) {
@@ -624,7 +624,7 @@ public class PngWriter {
* Warning: the array might be modified in some cases (unpacked row with low
* bitdepth)
* <p>
- *
+ *
* @param newrow
* Array of pixel values. Warning: the array size should be exact
* (samplesPerRowP)
@@ -642,7 +642,7 @@ public class PngWriter {
* Same semantics as writeRowInt but using bytes. Each byte is still a
* sample. If 16bitdepth, we are passing only the most significant byte (and
* hence losing some info)
- *
+ *
* @see PngWriter#writeRowInt(int[], int)
*/
public void writeRowByte(byte[] newrow, int rown) {
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java
index 4a45cb5..97e24fc 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java
@@ -2,9 +2,9 @@ package jogamp.opengl.util.pngj;
/**
* Generic exception
- *
+ *
* @author Hernan J Gonzalez
- *
+ *
*/
public class PngjException extends RuntimeException {
private static final long serialVersionUID = 1L;
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java
index c429b89..5da70de 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java
@@ -3,9 +3,9 @@ package jogamp.opengl.util.pngj;
/**
* Exception for anomalous internal problems (sort of asserts) that point to
* some issue with the library
- *
+ *
* @author Hernan J Gonzalez
- *
+ *
*/
public class PngjExceptionInternal extends RuntimeException {
private static final long serialVersionUID = 1L;
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java
index a995e44..4e8bf56 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java
@@ -47,19 +47,21 @@ public class ChunkHelper {
public static final String zTXt = "zTXt";
private static final ThreadLocal<Inflater> inflaterProvider = new ThreadLocal<Inflater>() {
+ @Override
protected Inflater initialValue() {
return new Inflater();
}
};
private static final ThreadLocal<Deflater> deflaterProvider = new ThreadLocal<Deflater>() {
+ @Override
protected Deflater initialValue() {
return new Deflater();
}
};
/*
- * static auxiliary buffer. any method that uses this should synchronize against this
+ * static auxiliary buffer. any method that uses this should synchronize against this
*/
private static byte[] tmpbuffer = new byte[4096];
@@ -136,7 +138,7 @@ public class ChunkHelper {
/**
* Finds position of null byte in array
- *
+ *
* @param b
* @return -1 if not found
*/
@@ -149,7 +151,7 @@ public class ChunkHelper {
/**
* Decides if a chunk should be loaded, according to a ChunkLoadBehaviour
- *
+ *
* @param id
* @param behav
* @return true/false
@@ -208,7 +210,7 @@ public class ChunkHelper {
/**
* Returns only the chunks that "match" the predicate
- *
+ *
* See also trimList()
*/
public static List<PngChunk> filterList(List<PngChunk> target, ChunkPredicate predicateKeep) {
@@ -223,7 +225,7 @@ public class ChunkHelper {
/**
* Remove (in place) the chunks that "match" the predicate
- *
+ *
* See also filterList
*/
public static int trimList(List<PngChunk> target, ChunkPredicate predicateRemove) {
@@ -244,10 +246,10 @@ public class ChunkHelper {
* they have same id and (perhaps, if multiple are allowed) if the match
* also in some "internal key" (eg: key for string values, palette for sPLT,
* etc)
- *
+ *
* Notice that the use of this is optional, and that the PNG standard allows
* Text chunks that have same key
- *
+ *
* @return true if "equivalent"
*/
public static final boolean equivalent(PngChunk c1, PngChunk c2) {
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java
index 82ab3bc..1fa0038 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkLoadBehaviour.java
@@ -15,7 +15,7 @@ public enum ChunkLoadBehaviour {
*/
LOAD_CHUNK_KNOWN,
/**
- *
+ *
* Load chunk if "known" or "safe to copy".
*/
LOAD_CHUNK_IF_SAFE,
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkPredicate.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkPredicate.java
index a750ae3..4695ccf 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkPredicate.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkPredicate.java
@@ -6,7 +6,7 @@ package jogamp.opengl.util.pngj.chunks;
public interface ChunkPredicate {
/**
* The other chunk matches with this one
- *
+ *
* @param chunk
* @return true if match
*/
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java
index 3aba26c..dcb1958 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java
@@ -108,6 +108,7 @@ public class ChunkRaw {
return new ByteArrayInputStream(data);
}
+ @Override
public String toString() {
return "chunkid=" + ChunkHelper.toString(idbytes) + " len=" + len;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java
index 5ce94ff..75107d7 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java
@@ -24,7 +24,7 @@ public class ChunksList {
/**
* All chunks, read (or written)
- *
+ *
* But IDAT is a single pseudo chunk without data
*/
protected List<PngChunk> chunks = new ArrayList<PngChunk>();
@@ -37,7 +37,7 @@ public class ChunksList {
/**
* Keys of processed (read or writen) chunks
- *
+ *
* @return key:chunk id, val: number of occurrences
*/
public HashMap<String, Integer> getChunksKeys() {
@@ -59,12 +59,14 @@ public class ChunksList {
protected static List<PngChunk> getXById(final List<PngChunk> list, final String id, final String innerid) {
if (innerid == null)
return ChunkHelper.filterList(list, new ChunkPredicate() {
+ @Override
public boolean match(PngChunk c) {
return c.id.equals(id);
}
});
else
return ChunkHelper.filterList(list, new ChunkPredicate() {
+ @Override
public boolean match(PngChunk c) {
if (!c.id.equals(id))
return false;
@@ -87,7 +89,7 @@ public class ChunksList {
/**
* All chunks with this ID
- *
+ *
* @param id
* @return List, empty if none
*/
@@ -98,7 +100,7 @@ public class ChunksList {
/**
* If innerid!=null and the chunk is PngChunkTextVar or PngChunkSPLT, it's
* filtered by that id
- *
+ *
* @param id
* @return innerid Only used for text and SPLT chunks
* @return List, empty if none
@@ -109,7 +111,7 @@ public class ChunksList {
/**
* Returns only one chunk
- *
+ *
* @param id
* @return First chunk found, null if not found
*/
@@ -146,18 +148,20 @@ public class ChunksList {
/**
* Finds all chunks "equivalent" to this one
- *
+ *
* @param c2
* @return Empty if nothing found
*/
public List<PngChunk> getEquivalent(final PngChunk c2) {
return ChunkHelper.filterList(chunks, new ChunkPredicate() {
+ @Override
public boolean match(PngChunk c) {
return ChunkHelper.equivalent(c, c2);
}
});
}
+ @Override
public String toString() {
return "ChunkList: read: " + chunks.size();
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java
index e76456a..c502e90 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java
@@ -67,7 +67,7 @@ public class ChunksListForWrite extends ChunksList {
/**
* Remove Chunk: only from queued
- *
+ *
* WARNING: this depends on c.equals() implementation, which is
* straightforward for SingleChunks. For MultipleChunks, it will normally
* check for reference equality!
@@ -78,9 +78,9 @@ public class ChunksListForWrite extends ChunksList {
/**
* Adds chunk to queue
- *
+ *
* Does not check for duplicated or anything
- *
+ *
* @param c
*/
public boolean queue(PngChunk c) {
@@ -149,6 +149,7 @@ public class ChunksListForWrite extends ChunksList {
return queuedChunks;
}
+ @Override
public String toString() {
return "ChunkList: written: " + chunks.size() + " queue: " + queuedChunks.size();
}
@@ -156,6 +157,7 @@ public class ChunksListForWrite extends ChunksList {
/**
* for debugging
*/
+ @Override
public String toStringFull() {
StringBuilder sb = new StringBuilder(toString());
sb.append("\n Written:\n");
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java
index a45979e..6cd86eb 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java
@@ -248,7 +248,7 @@ public abstract class PngChunk {
/**
* Creates the physical chunk. This is used when writing (serialization).
* Each particular chunk class implements its own logic.
- *
+ *
* @return A newly allocated and filled raw chunk
*/
public abstract ChunkRaw createRawChunk();
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java
index 4a8502a..ea62354 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java
@@ -70,7 +70,7 @@ public class PngChunkBKGD extends PngChunkSingle {
/**
* Set gray value (0-255 if bitdept=8)
- *
+ *
* @param gray
*/
public void setGray(int gray) {
@@ -87,7 +87,7 @@ public class PngChunkBKGD extends PngChunkSingle {
/**
* Set pallette index
- *
+ *
*/
public void setPaletteIndex(int i) {
if (!imgInfo.indexed)
@@ -103,7 +103,7 @@ public class PngChunkBKGD extends PngChunkSingle {
/**
* Set rgb values
- *
+ *
*/
public void setRGB(int r, int g, int b) {
if (imgInfo.greyscale || imgInfo.indexed)
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java
index d44250a..057f6c2 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java
@@ -19,9 +19,9 @@ public abstract class PngChunkMultiple extends PngChunk {
/**
* NOTE: this chunk uses the default Object's equals() hashCode()
* implementation.
- *
+ *
* This is the right thing to do, normally.
- *
+ *
* This is important, eg see ChunkList.removeFromList()
*/
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java
index bc70c6e..3a49065 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java
@@ -106,7 +106,7 @@ public class PngChunkSBIT extends PngChunkSingle {
/**
* Set rgb values
- *
+ *
*/
public void setRGB(int r, int g, int b) {
if (imgInfo.greyscale || imgInfo.indexed)
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java
index 5247169..7df5ba0 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java
@@ -12,6 +12,7 @@ public abstract class PngChunkSingle extends PngChunk {
super(id, imgInfo);
}
+ @Override
public final boolean allowsMultiple() {
return false;
}
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java
index b687764..867e348 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java
@@ -82,7 +82,7 @@ public class PngChunkTRNS extends PngChunkSingle {
/**
* Set rgb values
- *
+ *
*/
public void setRGB(int r, int g, int b) {
if (imgInfo.greyscale || imgInfo.indexed)
diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java
index ecf8b98..1396034 100644
--- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java
+++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java
@@ -41,6 +41,7 @@ public class PngMetadata {
throw new PngjException("cannot set chunk : readonly metadata");
if (lazyOverwrite) {
ChunkHelper.trimList(cl.getQueuedChunks(), new ChunkPredicate() {
+ @Override
public boolean match(PngChunk c2) {
return ChunkHelper.equivalent(c, c2);
}
@@ -87,7 +88,7 @@ public class PngMetadata {
/**
* Creates a time chunk with current time, less secsAgo seconds
* <p>
- *
+ *
* @return Returns the created-queued chunk, just in case you want to
* examine or modify it
*/
@@ -105,7 +106,7 @@ public class PngMetadata {
/**
* Creates a time chunk with diven date-time
* <p>
- *
+ *
* @return Returns the created-queued chunk, just in case you want to
* examine or modify it
*/
@@ -133,7 +134,7 @@ public class PngMetadata {
/**
* Creates a text chunk and queue it.
* <p>
- *
+ *
* @param k
* : key (latin1)
* @param val
@@ -201,7 +202,7 @@ public class PngMetadata {
/**
* Returns the palette chunk, if present
- *
+ *
* @return null if not present
*/
public PngChunkPLTE getPLTE() {
@@ -220,7 +221,7 @@ public class PngMetadata {
/**
* Returns the TRNS chunk, if present
- *
+ *
* @return null if not present
*/
public PngChunkTRNS getTRNS() {
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java
index bf2d3fa..7a4e08d 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java
@@ -58,7 +58,7 @@ public class WGLGLCapabilities extends GLCapabilities {
setRedBits(pfd.getCRedBits());
setGreenBits(pfd.getCGreenBits());
setBlueBits(pfd.getCBlueBits());
- setAlphaBits(pfd.getCAlphaBits());
+ setAlphaBits(pfd.getCAlphaBits());
setAccumRedBits(pfd.getCAccumRedBits());
setAccumGreenBits(pfd.getCAccumGreenBits());
setAccumBlueBits(pfd.getCAccumBlueBits());
@@ -77,12 +77,12 @@ public class WGLGLCapabilities extends GLCapabilities {
return true;
}
-
+
public static final String PFD2String(PIXELFORMATDESCRIPTOR pfd, int pfdID) {
final int dwFlags = pfd.getDwFlags();
StringBuilder sb = new StringBuilder();
boolean sep = false;
-
+
if( 0 != (GDI.PFD_DRAW_TO_WINDOW & dwFlags ) ) {
sep = true;
sb.append("window");
@@ -106,7 +106,7 @@ public class WGLGLCapabilities extends GLCapabilities {
if( 0 == (GDI.PFD_GENERIC_FORMAT & dwFlags ) || 0 == (GDI.PFD_GENERIC_ACCELERATED & dwFlags ) ) {
if(sep) { sb.append(CSEP); } sep=true;
sb.append("hw-accel");
- }
+ }
return "PFD[id = "+pfdID+" (0x"+Integer.toHexString(pfdID)+
"), colorBits "+pfd.getCColorBits()+", rgba "+pfd.getCRedBits()+ESEP+pfd.getCGreenBits()+ESEP+pfd.getCBlueBits()+ESEP+pfd.getCAlphaBits()+
", accum-rgba "+pfd.getCAccumRedBits()+ESEP+pfd.getCAccumGreenBits()+ESEP+pfd.getCAccumBlueBits()+ESEP+pfd.getCAccumAlphaBits()+
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLUtil.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLUtil.java
index 3e788d2..6454a34 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLUtil.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLUtil.java
@@ -33,15 +33,15 @@ import jogamp.opengl.Debug;
public class WGLUtil {
/**
- * Switch to use the <code>wgl</code> variants of {@link jogamp.opengl.windows.wgl.WGL}
+ * Switch to use the <code>wgl</code> variants of {@link jogamp.opengl.windows.wgl.WGL}
* to replace the following 5 GDI based functions (see below).
* <p>
* Disabled per default.
- * </p>
+ * </p>
* <p>
* You can enable it by defining the property <code>jogl.windows.useWGLVersionOf5WGLGDIFuncSet</code>.
* </p>
- *
+ *
* @see jogamp.nativewindow.windows.GDI#ChoosePixelFormat(long, PIXELFORMATDESCRIPTOR)
* @see jogamp.nativewindow.windows.GDI#DescribePixelFormat(long, int, int, PIXELFORMATDESCRIPTOR)
* @see jogamp.nativewindow.windows.GDI#GetPixelFormat(long)
@@ -49,7 +49,7 @@ public class WGLUtil {
* @see jogamp.nativewindow.windows.GDI#SwapBuffers(long)
*/
public static final boolean USE_WGLVersion_Of_5WGLGDIFuncSet;
-
+
static {
Debug.initSingleton();
USE_WGLVersion_Of_5WGLGDIFuncSet = Debug.isPropertyDefined("jogl.windows.useWGLVersionOf5WGLGDIFuncSet", true);
@@ -63,34 +63,34 @@ public class WGLUtil {
return WGL.wglChoosePixelFormat(hdc, pfd);
} else {
return GDI.ChoosePixelFormat(hdc, pfd);
- }
+ }
}
public static int DescribePixelFormat(long hdc, int pfdid, int pfdSize, PIXELFORMATDESCRIPTOR pfd) {
if(USE_WGLVersion_Of_5WGLGDIFuncSet) {
return WGL.wglDescribePixelFormat(hdc, pfdid, pfdSize, pfd);
} else {
return GDI.DescribePixelFormat(hdc, pfdid, pfdSize, pfd);
- }
+ }
}
public static int GetPixelFormat(long hdc) {
if(USE_WGLVersion_Of_5WGLGDIFuncSet) {
return WGL.wglGetPixelFormat(hdc);
} else {
return GDI.GetPixelFormat(hdc);
- }
+ }
}
- public static boolean SetPixelFormat(long hdc, int pfdid, PIXELFORMATDESCRIPTOR pfd) {
+ public static boolean SetPixelFormat(long hdc, int pfdid, PIXELFORMATDESCRIPTOR pfd) {
if(USE_WGLVersion_Of_5WGLGDIFuncSet) {
return WGL.wglSetPixelFormat(hdc, pfdid, pfd);
} else {
return GDI.SetPixelFormat(hdc, pfdid, pfd);
- }
+ }
}
- public static boolean SwapBuffers(long hdc) {
+ public static boolean SwapBuffers(long hdc) {
if(USE_WGLVersion_Of_5WGLGDIFuncSet) {
return WGL.wglSwapBuffers(hdc);
} else {
return GDI.SwapBuffers(hdc);
- }
+ }
}
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java
index 909a017..f658a35 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java
@@ -63,7 +63,7 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable {
private WindowsBitmapWGLDrawable(GLDrawableFactory factory, NativeSurface comp) {
super(factory, comp, false);
}
-
+
protected static WindowsBitmapWGLDrawable create(GLDrawableFactory factory, NativeSurface comp) {
final WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)comp.getGraphicsConfiguration();
final AbstractGraphicsDevice aDevice = config.getScreen().getDevice();
@@ -102,7 +102,7 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable {
public boolean isGLOriented() {
return false;
}
-
+
private void createBitmap() {
int werr;
final NativeSurface ns = getNativeSurface();
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java
index a589377..c46b3c9 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java
@@ -50,13 +50,12 @@ import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
-
import jogamp.nativewindow.WrappedSurface;
import jogamp.nativewindow.windows.GDI;
import jogamp.opengl.GLContextShareSet;
public class WindowsExternalWGLContext extends WindowsWGLContext {
-
+
private WindowsExternalWGLContext(Drawable drawable, long ctx, WindowsWGLGraphicsConfiguration cfg) {
super(drawable, null);
this.contextHandle = ctx;
@@ -64,7 +63,9 @@ public class WindowsExternalWGLContext extends WindowsWGLContext {
System.err.println(getThreadName() + ": Created external OpenGL context " + toHexString(ctx) + " for " + this);
}
GLContextShareSet.contextCreated(this);
- setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_COMPAT, false); // use GL_VERSION
+ if( !setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_COMPAT, false /* strictMatch */, false /* withinGLVersionsMapping */) ) { // use GL_VERSION
+ throw new InternalError("setGLFunctionAvailability !strictMatch failed");
+ }
getGLStateTracker().setEnabled(false); // external context usage can't track state in Java
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java
index 217ca18..2e60c68 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java
@@ -127,7 +127,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
}
final int winattrPbuffer = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(false /* onscreen */, false /* fbo */, true /* pbuffer */, false /* bitmap */);
-
+
final IntBuffer iattributes = Buffers.newDirectIntBuffer(2*WindowsWGLGraphicsConfiguration.MAX_ATTRIBS);
final FloatBuffer fattributes = Buffers.newDirectFloatBuffer(1);
int[] floatModeTmp = new int[1];
@@ -162,7 +162,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
if (DEBUG) {
System.err.println("" + nformats + " suitable pixel formats found");
for (int i = 0; i < nformats; i++) {
- WGLGLCapabilities dbgCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedResource, device, glProfile,
+ WGLGLCapabilities dbgCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedResource, device, glProfile,
sharedHdc, pformats.get(i), winattrPbuffer);
System.err.println("pixel format " + pformats.get(i) + " (index " + i + "): " + dbgCaps);
}
@@ -209,7 +209,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
// Re-query chosen pixel format
{
- WGLGLCapabilities newCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedResource, device, glProfile,
+ WGLGLCapabilities newCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedResource, device, glProfile,
sharedHdc, pfdid, winattrPbuffer);
if(null == newCaps) {
throw new GLException("pbuffer creation error: unable to re-query chosen PFD ID: " + pfdid + ", hdc " + GLDrawableImpl.toHexString(tmpHdc));
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
index b8979c9..b1e4162 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
@@ -93,7 +93,7 @@ public class WindowsWGLContext extends GLContextImpl {
}
@Override
- protected void resetStates() {
+ protected void resetStates(boolean isInit) {
wglGetExtensionsStringEXTInitialized=false;
wglGetExtensionsStringEXTAvailable=false;
wglGLReadDrawableAvailableSet=false;
@@ -102,7 +102,7 @@ public class WindowsWGLContext extends GLContextImpl {
wglExtProcAddressTable=null;
hasSwapIntervalSGI = 0;
hasSwapGroupNV = 0;
- super.resetStates();
+ super.resetStates(isInit);
}
@Override
@@ -280,7 +280,7 @@ public class WindowsWGLContext extends GLContextImpl {
if (DEBUG) {
System.err.println(getThreadName() + ": createImpl: START "+glCaps+", share "+shareWith);
}
-
+
// Windows can set up sharing of display lists after creation time
long share;
if ( null != shareWith ) {
@@ -325,7 +325,9 @@ public class WindowsWGLContext extends GLContextImpl {
if ( !WGL.wglMakeCurrent(drawable.getHandle(), temp_ctx) ) {
throw new GLException("Error making temp context current: 0x" + toHexString(temp_ctx) + ", werr: "+GDI.GetLastError());
}
- setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT, false); // use GL_VERSION
+ if( !setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT, false /* strictMatch */, false /* withinGLVersionsMapping */) ) { // use GL_VERSION
+ throw new InternalError("setGLFunctionAvailability !strictMatch failed");
+ }
WGL.wglMakeCurrent(0, 0); // release temp context
if( !createContextARBTried ) {
@@ -405,7 +407,7 @@ public class WindowsWGLContext extends GLContextImpl {
protected void makeCurrentImpl() throws GLException {
if (WGL.wglGetCurrentContext() != contextHandle) {
if (!wglMakeContextCurrent(drawable.getHandle(), drawableRead.getHandle(), contextHandle)) {
- throw new GLException("Error making context " + toHexString(contextHandle) +
+ throw new GLException("Error making context " + toHexString(contextHandle) +
" current on Thread " + getThreadName() +
", drawableWrite " + toHexString(drawable.getHandle()) +
", drawableRead "+ toHexString(drawableRead.getHandle()) +
@@ -563,13 +565,13 @@ public class WindowsWGLContext extends GLContextImpl {
}
@Override
- public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) {
+ public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) {
return getWGLExt().wglAllocateMemoryNV(size, readFrequency, writeFrequency, priority);
}
-
+
@Override
public final void glFreeMemoryNV(ByteBuffer pointer) {
getWGLExt().wglFreeMemoryNV(pointer);
}
-
+
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java
index 741e671..66071cb 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java
@@ -52,12 +52,12 @@ import jogamp.opengl.GLDynamicLookupHelper;
public abstract class WindowsWGLDrawable extends GLDrawableImpl {
private static final boolean PROFILING;
-
+
static {
Debug.initSingleton();
PROFILING = Debug.isPropertyDefined("jogl.debug.GLDrawable.profiling", true);
}
-
+
private static final int PROFILING_TICKS = 200;
private int profilingSwapBuffersTicks;
private long profilingSwapBuffersTime;
@@ -87,11 +87,11 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl {
} else {
t0 = 0;
}
-
+
if (!WGLUtil.SwapBuffers(getHandle()) && (GDI.GetLastError() != GDI.ERROR_SUCCESS)) {
throw new GLException("Error swapping buffers");
}
-
+
if (PROFILING) {
profilingSwapBuffersTime += System.currentTimeMillis() - t0;
if (++profilingSwapBuffersTicks == PROFILING_TICKS) {
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
index 338a351..95485b0 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -92,6 +92,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
synchronized(WindowsWGLDrawableFactory.class) {
if( null == windowsWGLDynamicLookupHelper ) {
windowsWGLDynamicLookupHelper = AccessController.doPrivileged(new PrivilegedAction<DesktopGLDynamicLookupHelper>() {
+ @Override
public DesktopGLDynamicLookupHelper run() {
DesktopGLDynamicLookupHelper tmp;
try {
@@ -137,8 +138,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
protected final boolean isComplete() {
return null != windowsWGLDynamicLookupHelper;
}
-
-
+
+
@Override
protected final void destroy() {
if(null != sharedResourceRunner) {
@@ -216,7 +217,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
private AbstractGraphicsScreen screen;
private GLDrawableImpl drawable;
private GLContextImpl context;
-
+
SharedResource(WindowsGraphicsDevice dev, AbstractGraphicsScreen scrn, GLDrawableImpl draw, GLContextImpl ctx,
boolean arbPixelFormat, boolean arbMultisample, boolean arbPBuffer, boolean arbReadDrawable) {
device = dev;
@@ -243,7 +244,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
final public GLContextImpl getContext() { return context; }
@Override
public GLRendererQuirks getRendererQuirks() {
- return null != context ? context.getRendererQuirks() : null;
+ return null != context ? context.getRendererQuirks() : null;
}
final boolean hasARBPixelFormat() { return hasARBPixelFormat; }
@@ -255,21 +256,15 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
class SharedResourceImplementation implements SharedResourceRunner.Implementation {
@Override
public void clear() {
- synchronized(sharedMap) {
- sharedMap.clear();
- }
+ sharedMap.clear();
}
@Override
public SharedResourceRunner.Resource mapPut(String connection, SharedResourceRunner.Resource resource) {
- synchronized(sharedMap) {
- return sharedMap.put(connection, resource);
- }
+ return sharedMap.put(connection, resource);
}
@Override
public SharedResourceRunner.Resource mapGet(String connection) {
- synchronized(sharedMap) {
- return sharedMap.get(connection);
- }
+ return sharedMap.get(connection);
}
@Override
public Collection<SharedResourceRunner.Resource> mapValues() {
@@ -282,7 +277,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
public boolean isDeviceSupported(String connection) {
return true;
}
-
+
@Override
public SharedResourceRunner.Resource createSharedResource(String connection) {
final WindowsGraphicsDevice sharedDevice = new WindowsGraphicsDevice(connection, AbstractGraphicsDevice.DEFAULT_UNIT);
@@ -296,7 +291,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
final GLDrawableImpl sharedDrawable = createOnscreenDrawableImpl(createDummySurfaceImpl(sharedDevice, false, caps, caps, null, 64, 64));
sharedDrawable.setRealized(true);
-
+
final GLContextImpl sharedContext = (GLContextImpl) sharedDrawable.createContext(null);
if (null == sharedContext) {
throw new GLException("Couldn't create shared context for drawable: "+sharedDrawable);
@@ -479,8 +474,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
- protected final ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
- GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested,
+ protected final ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
+ GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested,
GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) {
final WindowsGraphicsDevice device;
if(createNewDevice || !(deviceReq instanceof WindowsGraphicsDevice)) {
@@ -491,13 +486,13 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, 0);
final WindowsWGLGraphicsConfiguration config = WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen);
if(null == config) {
- throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen);
- }
+ throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen);
+ }
return new WrappedSurface(config, 0, upstreamHook, createNewDevice);
}
@Override
- public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
+ public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height) {
final WindowsGraphicsDevice device;
if( createNewDevice || !(deviceReq instanceof WindowsGraphicsDevice) ) {
@@ -508,12 +503,12 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, 0);
chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps);
final WindowsWGLGraphicsConfiguration config = WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(chosenCaps, requestedCaps, chooser, screen);
- if(null == config) {
+ if(null == config) {
throw new GLException("Choosing GraphicsConfiguration failed w/ "+chosenCaps+" on "+screen);
- }
+ }
return new GDISurface(config, 0, new GDIDummyUpstreamSurfaceHook(width, height), createNewDevice);
- }
-
+ }
+
@Override
protected final ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) {
final WindowsGraphicsDevice device = new WindowsGraphicsDevice(deviceReq.getConnection(), deviceReq.getUnitID());
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java
index 7ec6c50..6098cde 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.windows.wgl;
import jogamp.opengl.*;
@@ -41,10 +41,10 @@ public final class WindowsWGLDynamicLibraryBundleInfo extends DesktopGLDynamicLi
final List<List<String>> libsList = new ArrayList<List<String>>();
final List<String> libsGL = new ArrayList<String>();
libsGL.add("OpenGL32");
- libsList.add(libsGL);
+ libsList.add(libsGL);
return libsList;
}
-
+
@Override
public final List<String> getToolGetProcAddressFuncNameList() {
List<String> res = new ArrayList<String>();
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
index 42b9230..5f2b0c2 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -58,7 +58,7 @@ import jogamp.nativewindow.windows.MARGINS;
import jogamp.nativewindow.windows.PIXELFORMATDESCRIPTOR;
import jogamp.opengl.GLGraphicsConfigurationUtil;
-public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable {
+public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable {
protected static final int MAX_PFORMATS = 256;
protected static final int MAX_ATTRIBS = 256;
@@ -66,7 +66,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
private boolean isDetermined = false;
private boolean isExternal = false;
- WindowsWGLGraphicsConfiguration(AbstractGraphicsScreen screen,
+ WindowsWGLGraphicsConfiguration(AbstractGraphicsScreen screen,
GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested,
GLCapabilitiesChooser chooser) {
super(screen, capsChosen, capsRequested);
@@ -119,6 +119,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
return cfg;
}
+ @Override
public Object clone() {
return super.clone();
}
@@ -161,7 +162,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
if (0 == hdc) {
throw new GLException("Error: HDC is null");
}
-
+
if (!WGLUtil.SetPixelFormat(hdc, caps.getPFDID(), caps.getPFD())) {
throw new GLException("Unable to set pixel format " + caps.getPFDID() + " of " + caps +
" for device context " + toHexString(hdc) +
@@ -192,7 +193,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
}
setCapsPFD(caps);
}
-
+
/**
* Only sets this configuration's capabilities and marks it as determined,
* the actual pixelformat is not set.
@@ -209,20 +210,20 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
* External configuration's HDC pixelformat shall not be modified
*/
public final boolean isExternal() { return isExternal; }
-
+
final void markExternal() {
this.isExternal=true;
}
-
+
/**
* Determined configuration states set target capabilties via {@link #setCapsPFD(WGLGLCapabilities)},
* but does not imply a set pixelformat.
- *
- * @see #setPixelFormat(long, WGLGLCapabilities)
+ *
+ * @see #setPixelFormat(long, WGLGLCapabilities)
* @see #setCapsPFD(WGLGLCapabilities)
*/
public final boolean isDetermined() { return isDetermined; }
-
+
public final PIXELFORMATDESCRIPTOR getPixelFormat() { return isDetermined ? ((WGLGLCapabilities)capabilitiesChosen).getPFD() : null; }
public final int getPixelFormatID() { return isDetermined ? ((WGLGLCapabilities)capabilitiesChosen).getPFDID() : 0; }
public final boolean isChoosenByARB() { return isDetermined ? ((WGLGLCapabilities)capabilitiesChosen).isSetByARB() : false; }
@@ -255,7 +256,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
}
return niattribs;
}
-
+
static boolean wglARBPFIDValid(WindowsWGLContext sharedCtx, long hdc, int pfdID) {
final IntBuffer out = Buffers.newDirectIntBuffer(1);
final IntBuffer in = Buffers.newDirectIntBuffer(1);
@@ -270,7 +271,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
static int wglARBPFDIDCount(WindowsWGLContext sharedCtx, long hdc) {
final IntBuffer iresults = Buffers.newDirectIntBuffer(1);
final IntBuffer iattributes = Buffers.newDirectIntBuffer(1);
- iattributes.put(0, WGLExt.WGL_NUMBER_PIXEL_FORMATS_ARB);
+ iattributes.put(0, WGLExt.WGL_NUMBER_PIXEL_FORMATS_ARB);
WGLExt wglExt = sharedCtx.getWGLExt();
// pfdID shall be ignored here (spec), however, pass a valid pdf index '1' below (possible driver bug)
@@ -293,7 +294,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
}
return pfdIDCount;
}
-
+
static int[] wglAllARBPFDIDs(int pfdIDCount) {
int[] pfdIDs = new int[pfdIDCount];
for (int i = 0; i < pfdIDCount; i++) {
@@ -301,7 +302,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
}
return pfdIDs;
}
-
+
static WGLGLCapabilities wglARBPFID2GLCapabilities(WindowsWGLDrawableFactory.SharedResource sharedResource,
AbstractGraphicsDevice device, GLProfile glp,
long hdc, int pfdID, int winattrbits) {
@@ -314,7 +315,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
final int niattribs = fillAttribsForGeneralWGLARBQuery(sharedResource, iattributes);
if (!((WindowsWGLContext)sharedResource.getContext()).getWGLExt().wglGetPixelFormatAttribivARB(hdc, pfdID, 0, niattribs, iattributes, iresults)) {
- throw new GLException("wglARBPFID2GLCapabilities: Error getting pixel format attributes for pixel format " + pfdID +
+ throw new GLException("wglARBPFID2GLCapabilities: Error getting pixel format attributes for pixel format " + pfdID +
" of device context " + toHexString(hdc) + ", werr " + GDI.GetLastError());
}
return AttribList2GLCapabilities(device, glp, hdc, pfdID, iattributes, niattribs, iresults, winattrbits);
@@ -338,7 +339,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
final WGLExt wglExt = ((WindowsWGLContext)sharedResource.getContext()).getWGLExt();
final IntBuffer pformatsTmp = Buffers.newDirectIntBuffer(WindowsWGLGraphicsConfiguration.MAX_PFORMATS);
final IntBuffer numFormatsTmp = Buffers.newDirectIntBuffer(1);
-
+
if ( !wglExt.wglChoosePixelFormatARB(hdc, iattributes, fattributes,
WindowsWGLGraphicsConfiguration.MAX_PFORMATS,
pformatsTmp, numFormatsTmp) ) {
@@ -388,7 +389,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
if(null != caps) {
bucket.add(caps);
if(DEBUG) {
- final int j = bucket.size() - 1;
+ final int j = bucket.size() - 1;
System.err.println("wglARBPFIDs2GLCapabilities: bucket["+i+" -> "+j+"]: "+caps);
}
} else if(DEBUG) {
@@ -411,7 +412,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
IntBuffer iattributes,
WindowsWGLDrawableFactory.SharedResource sharedResource,
int accelerationValue,
- int[] floatMode) throws GLException {
+ int[] floatMode) throws GLException {
if (!sharedResource.hasARBPixelFormat()) {
return false;
}
@@ -426,10 +427,10 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
}
final boolean usePBuffer = caps.isPBuffer() && sharedResource.hasARBPBuffer() ;
-
+
final int surfaceType;
if( caps.isOnscreen() ) {
- surfaceType = WGLExt.WGL_DRAW_TO_WINDOW_ARB;
+ surfaceType = WGLExt.WGL_DRAW_TO_WINDOW_ARB;
} else if( caps.isFBO() ) {
surfaceType = WGLExt.WGL_DRAW_TO_WINDOW_ARB; // native replacement!
} else if( usePBuffer ) {
@@ -441,7 +442,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
}
iattributes.put(niattribs++, surfaceType);
iattributes.put(niattribs++, GL.GL_TRUE);
-
+
iattributes.put(niattribs++, WGLExt.WGL_DOUBLE_BUFFER_ARB);
if (caps.getDoubleBuffered()) {
iattributes.put(niattribs++, GL.GL_TRUE);
@@ -455,7 +456,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
} else {
iattributes.put(niattribs++, GL.GL_FALSE);
}
-
+
iattributes.put(niattribs++, WGLExt.WGL_RED_BITS_ARB);
iattributes.put(niattribs++, caps.getRedBits());
iattributes.put(niattribs++, WGLExt.WGL_GREEN_BITS_ARB);
@@ -505,7 +506,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
return true;
}
- static int AttribList2DrawableTypeBits(final IntBuffer iattribs,
+ static int AttribList2DrawableTypeBits(final IntBuffer iattribs,
final int niattribs, final IntBuffer iresults) {
int val = 0;
@@ -533,7 +534,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
return val;
}
- static WGLGLCapabilities AttribList2GLCapabilities(final AbstractGraphicsDevice device,
+ static WGLGLCapabilities AttribList2GLCapabilities(final AbstractGraphicsDevice device,
final GLProfile glp, final long hdc, final int pfdID,
final IntBuffer iattribs, final int niattribs, IntBuffer iresults, final int winattrmask) {
final int allDrawableTypeBits = AttribList2DrawableTypeBits(iattribs, niattribs, iresults);
@@ -554,7 +555,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
}
final WGLGLCapabilities res = new WGLGLCapabilities(pfd, pfdID, glp);
res.setValuesByARB(iattribs, niattribs, iresults);
- return (WGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res);
+ return (WGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res);
}
//
@@ -608,7 +609,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
}
if( GLGraphicsConfigurationUtil.BITMAP_BIT == drawableTypeBits ) {
// BITMAP exclusive PFD SafeGuard: Only accept BITMAP compatible color formats!
- final int pfdColorBits = pfd.getCColorBits();
+ final int pfdColorBits = pfd.getCColorBits();
if ( pfdColorBits != 24 || 0 < pfd.getCAlphaBits() ) { // Allowed: RGB888 && !alpha
if(DEBUG) {
System.err.println("Drop [color bits excl BITMAP]: " + WGLGLCapabilities.PFD2String(pfd, pfdID));
@@ -619,24 +620,24 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
final WGLGLCapabilities res = new WGLGLCapabilities(pfd, pfdID, glp);
res.setValuesByGDI();
- return (WGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res);
+ return (WGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res);
}
static WGLGLCapabilities PFD2GLCapabilitiesNoCheck(AbstractGraphicsDevice device, final GLProfile glp, final long hdc, final int pfdID) {
PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor(hdc, pfdID);
return PFD2GLCapabilitiesNoCheck(device, glp, pfd, pfdID);
}
-
+
static WGLGLCapabilities PFD2GLCapabilitiesNoCheck(AbstractGraphicsDevice device, GLProfile glp, PIXELFORMATDESCRIPTOR pfd, int pfdID) {
if(null == pfd) {
return null;
}
final WGLGLCapabilities res = new WGLGLCapabilities(pfd, pfdID, glp);
res.setValuesByGDI();
-
- return (WGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, PFD2DrawableTypeBits(pfd), res);
+
+ return (WGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, PFD2DrawableTypeBits(pfd), res);
}
-
+
static PIXELFORMATDESCRIPTOR GLCapabilities2PFD(GLCapabilitiesImmutable caps, PIXELFORMATDESCRIPTOR pfd) {
int colorDepth = (caps.getRedBits() +
caps.getGreenBits() +
@@ -665,7 +666,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
pfdFlags |= GDI.PFD_DOUBLEBUFFER;
}
}
-
+
if (caps.getStereo()) {
pfdFlags |= GDI.PFD_STEREO;
}
@@ -715,6 +716,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
return createPixelFormatDescriptor(0, 0);
}
+ @Override
public String toString() {
return "WindowsWGLGraphicsConfiguration["+getScreen()+", pfdID " + getPixelFormatID() + ", ARB-Choosen " + isChoosenByARB() +
",\n\trequested " + getRequestedCapabilities() +
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
index 3d093b9..9612952 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -79,6 +79,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
private WindowsWGLGraphicsConfigurationFactory() {
}
+ @Override
protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl(
CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) {
@@ -93,7 +94,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
if (chooser != null && !(chooser instanceof GLCapabilitiesChooser)) {
throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects");
}
-
+
return chooseGraphicsConfigurationStatic((GLCapabilitiesImmutable)capsChosen, (GLCapabilitiesImmutable)capsRequested, (GLCapabilitiesChooser)chooser, absScreen);
}
@@ -123,7 +124,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
final GLProfile glp = GLProfile.getDefault(device);
List<GLCapabilitiesImmutable> availableCaps = null;
-
+
final GLContext sharedContext;
if ( factory.hasRendererQuirk(device, GLRendererQuirks.NeedCurrCtx4ARBPixFmtQueries) ) {
sharedContext = sharedResource.getContext();
@@ -151,10 +152,10 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
}
} finally {
if ( null != sharedContext ) {
- sharedContext.release();
+ sharedContext.release();
} else {
sharedDrawable.unlockSurface();
- }
+ }
}
if( null != availableCaps && availableCaps.size() > 1 ) {
@@ -166,7 +167,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
private static List<GLCapabilitiesImmutable> getAvailableGLCapabilitiesARB(WindowsWGLDrawableFactory.SharedResource sharedResource, AbstractGraphicsDevice device, GLProfile glProfile, long hdc) {
final int pfdIDCount = WindowsWGLGraphicsConfiguration.wglARBPFDIDCount((WindowsWGLContext)sharedResource.getContext(), hdc);
final int[] pformats = WindowsWGLGraphicsConfiguration.wglAllARBPFDIDs(pfdIDCount);
- return WindowsWGLGraphicsConfiguration.wglARBPFIDs2GLCapabilities(sharedResource, device, glProfile, hdc, pformats,
+ return WindowsWGLGraphicsConfiguration.wglARBPFIDs2GLCapabilities(sharedResource, device, glProfile, hdc, pformats,
GLGraphicsConfigurationUtil.ALL_BITS & ~GLGraphicsConfigurationUtil.BITMAP_BIT); // w/o BITMAP
}
@@ -175,7 +176,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
int numFormats = pformats.length;
List<GLCapabilitiesImmutable> bucket = new ArrayList<GLCapabilitiesImmutable>(numFormats);
for (int i = 0; i < numFormats; i++) {
- final GLCapabilitiesImmutable caps = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(device, glProfile, hdc, pformats[i],
+ final GLCapabilitiesImmutable caps = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(device, glProfile, hdc, pformats[i],
bitmapOnly ? GLGraphicsConfigurationUtil.BITMAP_BIT : GLGraphicsConfigurationUtil.ALL_BITS );
if(null != caps) {
bucket.add(caps);
@@ -226,7 +227,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
" for device context " + toHexString(hdc) +
": error code " + GDI.GetLastError());
}
- set = true;
+ set = true;
}
if (DEBUG) {
System.err.println("setPixelFormat (post): hdc "+toHexString(hdc) +", "+pfdID+" -> "+config.getPixelFormatID()+", set: "+set);
@@ -332,9 +333,9 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
final boolean isOpaque = capsChosen.isBackgroundOpaque() && GDI.DwmIsCompositionEnabled();
final int winattrbits = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(capsChosen) & ~GLGraphicsConfigurationUtil.BITMAP_BIT; // w/o BITMAP
final GLProfile glProfile = capsChosen.getGLProfile();
-
+
final int pfdIDCount = WindowsWGLGraphicsConfiguration.wglARBPFDIDCount((WindowsWGLContext)sharedResource.getContext(), hdc);
-
+
if(DEBUG) {
System.err.println("updateGraphicsConfigurationARB: hdc "+toHexString(hdc)+", pfdIDCount(hdc) "+pfdIDCount+", capsChosen "+capsChosen+", "+GLGraphicsConfigurationUtil.winAttributeBits2String(null, winattrbits).toString());
System.err.println("isOpaque "+isOpaque+" (translucency requested: "+(!capsChosen.isBackgroundOpaque())+", compositioning enabled: "+GDI.DwmIsCompositionEnabled()+")");
@@ -346,7 +347,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
}
return false;
}
-
+
WGLGLCapabilities pixelFormatCaps = null; // chosen or preset PFD ID's caps
boolean pixelFormatSet = false; // indicates a preset PFD ID [caps]
final int presetPFDID = extHDC ? -1 : WGLUtil.GetPixelFormat(hdc) ;
@@ -406,9 +407,9 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
}
}
- List<GLCapabilitiesImmutable> availableCaps =
+ List<GLCapabilitiesImmutable> availableCaps =
WindowsWGLGraphicsConfiguration.wglARBPFIDs2GLCapabilities(sharedResource, device, glProfile, hdc, pformats, winattrbits);
-
+
if( null == availableCaps || 0 == availableCaps.size() ) {
if (DEBUG) {
System.err.println("updateGraphicsConfigurationARB: wglARBPFIDs2GLCapabilities failed with " + pformats.length + " pfd ids");
@@ -467,11 +468,11 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
// final boolean useFBO = capsChosen.isFBO();
final GLProfile glProfile = capsChosen.getGLProfile();
final int winattrmask = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(capsChosen);
-
+
if(DEBUG) {
System.err.println("updateGraphicsConfigurationGDI: capsChosen "+capsChosen+", "+GLGraphicsConfigurationUtil.winAttributeBits2String(null, winattrmask).toString());
}
-
+
AbstractGraphicsDevice device = config.getScreen().getDevice();
int pfdID; // chosen or preset PFD ID
WGLGLCapabilities pixelFormatCaps = null; // chosen or preset PFD ID's caps
@@ -503,7 +504,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
if(null != caps) {
availableCaps.add(caps);
if(DEBUG) {
- final int j = availableCaps.size() - 1;
+ final int j = availableCaps.size() - 1;
System.err.println("updateGraphicsConfigurationGDI: availableCaps["+i+" -> "+j+"]: "+caps);
}
} else if(DEBUG) {
@@ -543,7 +544,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
}
pixelFormatCaps = (WGLGLCapabilities) availableCaps.get(chosenIndex);
if (DEBUG) {
- System.err.println("chosen pfdID (GDI): chosenIndex "+ chosenIndex + ", caps " + pixelFormatCaps +
+ System.err.println("chosen pfdID (GDI): chosenIndex "+ chosenIndex + ", caps " + pixelFormatCaps +
" (" + WGLGLCapabilities.PFD2String(pixelFormatCaps.getPFD(), pixelFormatCaps.getPFDID()) +")");
}
}
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 3b2ff13..96bd0bd 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -65,9 +65,10 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu
public static void registerFactory() {
GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.awt.AWTGraphicsDevice.class, GLCapabilitiesImmutable.class, new WindowsAWTWGLGraphicsConfigurationFactory());
}
- private WindowsAWTWGLGraphicsConfigurationFactory() {
+ private WindowsAWTWGLGraphicsConfigurationFactory() {
}
+ @Override
protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl(
CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested,
CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) {
@@ -114,7 +115,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu
throw new GLException("Unable to choose a GraphicsConfiguration: "+capsChosen+",\n\t"+chooser+"\n\t"+winScreen);
}
- GLDrawableFactory drawableFactory = GLDrawableFactory.getFactory(((GLCapabilitiesImmutable)capsChosen).getGLProfile());
+ GLDrawableFactory drawableFactory = GLDrawableFactory.getFactory(((GLCapabilitiesImmutable)capsChosen).getGLProfile());
GraphicsConfiguration chosenGC = null;
if ( drawableFactory instanceof WindowsWGLDrawableFactory ) {
@@ -138,7 +139,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu
}
// go on ..
}
-
+
if( null == chosenGC ) {
// 2nd Choice: Choose and match the GL Visual with AWT:
// - collect all AWT PFDs
@@ -147,7 +148,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu
// The resulting GraphicsConfiguration has to be 'forced' on the AWT native peer,
// ie. returned by GLCanvas's getGraphicsConfiguration() befor call by super.addNotify().
//
-
+
// collect all available PFD IDs
GraphicsConfiguration[] configs = device.getConfigurations();
int[] pfdIDs = new int[configs.length];
@@ -171,11 +172,11 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu
System.err.println("WindowsAWTWGLGraphicsConfigurationFactory: Found matching AWT PFD ID "+winConfig.getPixelFormatID()+" -> "+winConfig);
}
}
- }
+ }
} else {
chosenGC = device.getDefaultConfiguration();
}
-
+
if ( null == chosenGC ) {
throw new GLException("Unable to determine GraphicsConfiguration: "+winConfig);
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java
index 2c591cf..12e3db3 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -45,14 +45,14 @@ import com.jogamp.nativewindow.x11.X11GraphicsDevice;
public class GLXUtil {
public static final boolean DEBUG = Debug.debug("GLXUtil");
-
+
public static synchronized boolean isGLXAvailableOnServer(X11GraphicsDevice x11Device) {
if(null == x11Device) {
throw new IllegalArgumentException("null X11GraphicsDevice");
}
if(0 == x11Device.getHandle()) {
throw new IllegalArgumentException("null X11GraphicsDevice display handle");
- }
+ }
boolean glXAvailable = false;
x11Device.lock();
try {
@@ -60,17 +60,17 @@ public class GLXUtil {
} catch (Throwable t) { /* n/a */
} finally {
x11Device.unlock();
- }
- return glXAvailable;
+ }
+ return glXAvailable;
}
-
+
public static String getGLXClientString(X11GraphicsDevice x11Device, int name) {
x11Device.lock();
try {
return GLX.glXGetClientString(x11Device.getHandle(), name);
} finally {
x11Device.unlock();
- }
+ }
}
public static String queryGLXServerString(X11GraphicsDevice x11Device, int screen_idx, int name) {
x11Device.lock();
@@ -78,27 +78,27 @@ public class GLXUtil {
return GLX.glXQueryServerString(x11Device.getHandle(), screen_idx, name);
} finally {
x11Device.unlock();
- }
- }
+ }
+ }
public static String queryGLXExtensionsString(X11GraphicsDevice x11Device, int screen_idx) {
x11Device.lock();
try {
return GLX.glXQueryExtensionsString(x11Device.getHandle(), screen_idx);
} finally {
x11Device.unlock();
- }
+ }
}
-
+
public static VersionNumber getGLXServerVersionNumber(X11GraphicsDevice x11Device) {
final IntBuffer major = Buffers.newDirectIntBuffer(1);
final IntBuffer minor = Buffers.newDirectIntBuffer(1);
-
+
x11Device.lock();
try {
if (!GLX.glXQueryVersion(x11Device.getHandle(), major, minor)) {
throw new GLException("glXQueryVersion failed");
}
-
+
// Work around bugs in ATI's Linux drivers where they report they
// only implement GLX version 1.2 on the server side
if (major.get(0) == 1 && minor.get(0) == 2) {
@@ -117,7 +117,7 @@ public class GLXUtil {
}
return new VersionNumber(major.get(0), minor.get(0), 0);
}
-
+
public static boolean isMultisampleAvailable(String extensions) {
if (extensions != null) {
return (extensions.indexOf("GLX_ARB_multisample") >= 0);
@@ -142,8 +142,8 @@ public class GLXUtil {
public static VersionNumber getClientVersionNumber() {
return clientVersionNumber;
}
-
- public static synchronized void initGLXClientDataSingleton(X11GraphicsDevice x11Device) {
+
+ public static synchronized void initGLXClientDataSingleton(X11GraphicsDevice x11Device) {
if(null != clientVendorName) {
return; // already initialized
}
@@ -152,10 +152,10 @@ public class GLXUtil {
}
if(0 == x11Device.getHandle()) {
throw new IllegalArgumentException("null X11GraphicsDevice display handle");
- }
+ }
clientMultisampleAvailable = isMultisampleAvailable(GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_EXTENSIONS));
clientVendorName = GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_VENDOR);
-
+
int[] major = new int[1];
int[] minor = new int[1];
final String str = GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_VERSION);
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java
index 72e84b0..9b7b0f5 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java
@@ -63,7 +63,9 @@ public class X11ExternalGLXContext extends X11GLXContext {
super(drawable, null);
this.contextHandle = ctx;
GLContextShareSet.contextCreated(this);
- setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_COMPAT, false);
+ if( !setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_COMPAT, false /* strictMatch */, false /* withinGLVersionsMapping */) ) { // use GL_VERSION
+ throw new InternalError("setGLFunctionAvailability !strictMatch failed");
+ }
getGLStateTracker().setEnabled(false); // external context usage can't track state in Java
}
@@ -79,15 +81,15 @@ public class X11ExternalGLXContext extends X11GLXContext {
long drawable = GLX.glXGetCurrentDrawable();
if (drawable == 0) {
throw new GLException("Error: attempted to make an external GLDrawable without a drawable/context current");
- }
+ }
IntBuffer val = Buffers.newDirectIntBuffer(1);
-
+
int w, h;
GLX.glXQueryDrawable(display, drawable, GLX.GLX_WIDTH, val);
w=val.get(0);
GLX.glXQueryDrawable(display, drawable, GLX.GLX_HEIGHT, val);
h=val.get(0);
-
+
GLX.glXQueryContext(display, ctx, GLX.GLX_SCREEN, val);
X11GraphicsScreen x11Screen = (X11GraphicsScreen) X11GraphicsScreen.createScreenDevice(display, val.get(0), false);
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java
index fca36c0..650fd31 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java
@@ -73,7 +73,7 @@ public class X11ExternalGLXDrawable extends X11GLXDrawable {
throw new GLException("Error: attempted to make an external GLDrawable without a drawable current");
}
IntBuffer val = Buffers.newDirectIntBuffer(1);
-
+
GLX.glXQueryContext(display, context, GLX.GLX_SCREEN, val);
X11GraphicsScreen x11Screen = (X11GraphicsScreen) X11GraphicsScreen.createScreenDevice(display, val.get(0), false);
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
index 4bfe0cb..10f21f0 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
@@ -100,7 +100,7 @@ public class X11GLXContext extends GLContextImpl {
}
@Override
- protected void resetStates() {
+ protected void resetStates(boolean isInit) {
// no inner state _glXExt=null;
glXExtProcAddressTable = null;
hasSwapInterval = 0;
@@ -108,7 +108,7 @@ public class X11GLXContext extends GLContextImpl {
isDirect = false;
glXServerVersion = null;
isGLXVersionGreaterEqualOneThree = false;
- super.resetStates();
+ super.resetStates(isInit);
}
@Override
@@ -142,7 +142,7 @@ public class X11GLXContext extends GLContextImpl {
if(null != glXServerVersion) {
return isGLXVersionGreaterEqualOneThree;
}
- glXServerVersion = ((X11GLXDrawableFactory)drawable.getFactoryImpl()).getGLXVersionNumber(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice());
+ glXServerVersion = ((X11GLXDrawableFactory)drawable.getFactoryImpl()).getGLXVersionNumber(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice());
isGLXVersionGreaterEqualOneThree = null != glXServerVersion ? glXServerVersion.compareTo(X11GLXDrawableFactory.versionOneThree) >= 0 : false;
return isGLXVersionGreaterEqualOneThree;
}
@@ -262,7 +262,7 @@ public class X11GLXContext extends GLContextImpl {
t.printStackTrace();
}
}
-
+
if(0!=ctx) {
if (!glXMakeContextCurrent(display, drawable.getHandle(), drawableRead.getHandle(), ctx)) {
if(DEBUG) {
@@ -320,7 +320,9 @@ public class X11GLXContext extends GLContextImpl {
if ( !glXMakeContextCurrent(display, drawable.getHandle(), drawableRead.getHandle(), contextHandle) ) {
throw new GLException(getThreadName()+": Error making temp context(0) current: display "+toHexString(display)+", context "+toHexString(contextHandle)+", drawable "+drawable);
}
- setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT, false); // use GL_VERSION
+ if( !setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT, false /* strictMatch */, false /* withinGLVersionsMapping */) ) { // use GL_VERSION
+ throw new InternalError("setGLFunctionAvailability !strictMatch failed");
+ }
isDirect = GLX.glXIsDirect(display, contextHandle);
if (DEBUG) {
System.err.println(getThreadName() + ": createContextImpl: OK (old-1) share "+share+", direct "+isDirect+"/"+direct);
@@ -350,7 +352,7 @@ 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); // use GL_VERSION
+ setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT, false /* strictMatch */, false /* withinGLVersionsMapping */); // use GL_VERSION
glXMakeContextCurrent(display, 0, 0, 0); // release temp context
if( !createContextARBTried ) {
// is*Available calls are valid since setGLFunctionAvailability(..) was called
@@ -419,7 +421,7 @@ public class X11GLXContext extends GLContextImpl {
if (GLX.glXGetCurrentContext() != contextHandle) {
if (!glXMakeContextCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) {
- throw new GLException("Error making context " + toHexString(contextHandle) +
+ throw new GLException("Error making context " + toHexString(contextHandle) +
" current on Thread " + getThreadName() +
" with display " + toHexString(dpy) +
", drawableWrite " + toHexString(drawable.getHandle()) +
@@ -525,7 +527,7 @@ public class X11GLXContext extends GLContextImpl {
@Override
protected boolean setSwapIntervalImpl(int interval) {
- if( !drawable.getChosenGLCapabilities().isOnscreen() ) { return false; }
+ if( !drawable.getChosenGLCapabilities().isOnscreen() ) { return false; }
final GLXExt glXExt = getGLXExt();
if(0==hasSwapInterval) {
@@ -534,7 +536,7 @@ public class X11GLXContext extends GLContextImpl {
if( glXExt.isExtensionAvailable(GLXExtensions.GLX_MESA_swap_control) ) {
if(DEBUG) { System.err.println("X11GLXContext.setSwapInterval using: "+GLXExtensions.GLX_MESA_swap_control); }
hasSwapInterval = 1;
- } else */
+ } else */
if ( glXExt.isExtensionAvailable(GLXExtensions.GLX_SGI_swap_control) ) {
if(DEBUG) { System.err.println("X11GLXContext.setSwapInterval using: "+GLXExtensions.GLX_SGI_swap_control); }
hasSwapInterval = 2;
@@ -542,7 +544,7 @@ public class X11GLXContext extends GLContextImpl {
hasSwapInterval = -1;
}
} catch (Throwable t) { hasSwapInterval=-1; }
- }
+ }
/* try {
switch( hasSwapInterval ) {
case 1:
@@ -581,7 +583,7 @@ public class X11GLXContext extends GLContextImpl {
try {
final IntBuffer maxGroupsNIO = Buffers.newDirectIntBuffer(maxGroups.length - maxGroups_offset);
final IntBuffer maxBarriersNIO = Buffers.newDirectIntBuffer(maxBarriers.length - maxBarriers_offset);
-
+
if( glXExt.glXQueryMaxSwapGroupsNV(ns.getDisplayHandle(), ns.getScreenIndex(),
maxGroupsNIO, maxBarriersNIO) ) {
maxGroupsNIO.get(maxGroups, maxGroups_offset, maxGroupsNIO.remaining());
@@ -623,7 +625,7 @@ public class X11GLXContext extends GLContextImpl {
}
@Override
- public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) {
+ public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) {
return getGLXExt().glXAllocateMemoryNV(size, readFrequency, writeFrequency, priority);
}
@@ -631,7 +633,7 @@ public class X11GLXContext extends GLContextImpl {
public final void glFreeMemoryNV(ByteBuffer pointer) {
getGLXExt().glXFreeMemoryNV(pointer);
}
-
+
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
index 52069b8..78e5495 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
@@ -86,7 +86,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
public static final VersionNumber versionOneFour = new VersionNumber(1, 4, 0);
static final String GLX_SGIX_pbuffer = "GLX_SGIX_pbuffer";
-
+
private static DesktopGLDynamicLookupHelper x11GLXDynamicLookupHelper = null;
public X11GLXDrawableFactory() {
@@ -95,6 +95,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
synchronized(X11GLXDrawableFactory.class) {
if( null == x11GLXDynamicLookupHelper ) {
x11GLXDynamicLookupHelper = AccessController.doPrivileged(new PrivilegedAction<DesktopGLDynamicLookupHelper>() {
+ @Override
public DesktopGLDynamicLookupHelper run() {
DesktopGLDynamicLookupHelper tmp;
try {
@@ -134,7 +135,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
protected final boolean isComplete() {
return null != x11GLXDynamicLookupHelper;
}
-
+
@Override
protected final void destroy() {
if(null != sharedResourceRunner) {
@@ -205,7 +206,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
final public GLContextImpl getContext() { return context; }
@Override
public GLRendererQuirks getRendererQuirks() {
- return null != context ? context.getRendererQuirks() : null;
+ return null != context ? context.getRendererQuirks() : null;
}
final String getGLXVendorName() { return glXServerVendorName; }
@@ -220,27 +221,19 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
class SharedResourceImplementation implements SharedResourceRunner.Implementation {
@Override
public void clear() {
- synchronized(sharedMap) {
- sharedMap.clear();
- }
+ sharedMap.clear();
}
@Override
public SharedResourceRunner.Resource mapPut(String connection, SharedResourceRunner.Resource resource) {
- synchronized(sharedMap) {
- return sharedMap.put(connection, resource);
- }
+ return sharedMap.put(connection, resource);
}
@Override
public SharedResourceRunner.Resource mapGet(String connection) {
- synchronized(sharedMap) {
- return sharedMap.get(connection);
- }
+ return sharedMap.get(connection);
}
@Override
public Collection<SharedResourceRunner.Resource> mapValues() {
- synchronized(sharedMap) {
- return sharedMap.values();
- }
+ return sharedMap.values();
}
@Override
@@ -259,18 +252,18 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
return res;
}
-
+
@Override
public SharedResourceRunner.Resource createSharedResource(String connection) {
final X11GraphicsDevice sharedDevice = new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */);
sharedDevice.lock();
try {
final X11GraphicsScreen sharedScreen = new X11GraphicsScreen(sharedDevice, sharedDevice.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));
-
+
final GLProfile glp = GLProfile.get(sharedDevice, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false);
if (null == glp) {
throw new GLException("Couldn't get default GLProfile for device: "+sharedDevice);
@@ -291,7 +284,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
if (null == sharedContext) {
throw new GLException("Couldn't create shared context for drawable: "+sharedDrawable);
}
-
+
boolean madeCurrent = false;
sharedContext.makeCurrent();
try {
@@ -336,8 +329,8 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
if (null != sr.context) {
- // may cause JVM SIGSEGV:
- sr.context.destroy(); // will also pull the dummy MutuableSurface
+ // may cause JVM SIGSEGV, or freeze (ATI fglrx 3-6-beta2 32on64 shared ctx):
+ sr.context.destroy(); // will also pull the dummy MutableSurface
sr.context = null;
}
@@ -501,12 +494,12 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
- protected final ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
+ protected final ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
GLCapabilitiesImmutable capsChosen,
GLCapabilitiesImmutable capsRequested,
GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) {
final X11GraphicsDevice device;
- if( createNewDevice || !(deviceReq instanceof X11GraphicsDevice) ) {
+ if( createNewDevice || !(deviceReq instanceof X11GraphicsDevice) ) {
device = new X11GraphicsDevice(X11Util.openDisplay(deviceReq.getConnection()), deviceReq.getUnitID(), true /* owner */);
} else {
device = (X11GraphicsDevice) deviceReq;
@@ -514,18 +507,18 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
final X11GraphicsScreen screen = new X11GraphicsScreen(device, device.getDefaultScreen());
final X11GLXGraphicsConfiguration config = X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen, VisualIDHolder.VID_UNDEFINED);
if(null == config) {
- throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen);
+ throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen);
}
return new WrappedSurface(config, 0, upstreamHook, createNewDevice);
}
-
+
@Override
- public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
+ public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice,
GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height) {
chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps);
- return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new X11DummyUpstreamSurfaceHook(width, height));
- }
-
+ return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new X11DummyUpstreamSurfaceHook(width, height));
+ }
+
@Override
protected final ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) {
final X11GraphicsDevice device = new X11GraphicsDevice(X11Util.openDisplay(deviceReq.getConnection()), deviceReq.getUnitID(), true /* owner */);
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java
index f25f7ae..951174f 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.x11.glx;
import jogamp.opengl.*;
@@ -40,8 +40,8 @@ public final class X11GLXDynamicLibraryBundleInfo extends DesktopGLDynamicLibrar
public final List<List<String>> getToolLibNames() {
final List<List<String>> libsList = new ArrayList<List<String>>();
final List<String> libsGL = new ArrayList<String>();
-
- // Be aware that on DRI systems, eg ATI fglrx, etc,
+
+ // Be aware that on DRI systems, eg ATI fglrx, etc,
// you have to set LIBGL_DRIVERS_PATH env variable.
// Eg on Ubuntu 64bit systems this is:
// export LIBGL_DRIVERS_PATH=/usr/lib/fglrx/dri:/usr/lib32/fglrx/dri
@@ -55,11 +55,11 @@ public final class X11GLXDynamicLibraryBundleInfo extends DesktopGLDynamicLibrar
// last but not least .. the generic one
libsGL.add("GL");
-
- libsList.add(libsGL);
+
+ libsList.add(libsGL);
return libsList;
- }
-
+ }
+
@Override
public final List<String> getToolGetProcAddressFuncNameList() {
List<String> res = new ArrayList<String>();
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java
index c23bd53..4d1ed39 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -61,14 +61,15 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen;
public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implements Cloneable {
public static final int MAX_ATTRIBS = 128;
- private GLCapabilitiesChooser chooser;
+ private GLCapabilitiesChooser chooser;
- X11GLXGraphicsConfiguration(X11GraphicsScreen screen,
+ X11GLXGraphicsConfiguration(X11GraphicsScreen screen,
X11GLCapabilities capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) {
super(screen, capsChosen, capsRequested, capsChosen.getXVisualInfo());
this.chooser=chooser;
}
+ @Override
public Object clone() {
return super.clone();
}
@@ -86,8 +87,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
void updateGraphicsConfiguration() {
final CapabilitiesImmutable aChosenCaps = getChosenCapabilities();
if( !(aChosenCaps instanceof X11GLCapabilities) || VisualIDHolder.VID_UNDEFINED == aChosenCaps.getVisualID(VIDType.X11_XVISUAL) ) {
- // This case is actually quite impossible, since on X11 the visualID and hence GraphicsConfiguration
- // must be determined _before_ window creation!
+ // This case is actually quite impossible, since on X11 the visualID and hence GraphicsConfiguration
+ // must be determined _before_ window creation!
final X11GLXGraphicsConfiguration newConfig = (X11GLXGraphicsConfiguration)
GraphicsConfigurationFactory.getFactory(getScreen().getDevice(), aChosenCaps).chooseGraphicsConfiguration(
aChosenCaps, getRequestedCapabilities(), chooser, getScreen(), VisualIDHolder.VID_UNDEFINED);
@@ -121,7 +122,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
glp = GLProfile.getDefault(x11Screen.getDevice());
}
final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory();
- final X11GLCapabilities caps = GLXFBConfig2GLCapabilities(device, glp, fbcfg, GLGraphicsConfigurationUtil.ALL_BITS, factory.isGLXMultisampleAvailable(device));
+ final X11GLCapabilities caps = GLXFBConfig2GLCapabilities(device, glp, fbcfg, GLGraphicsConfigurationUtil.ALL_BITS, factory.isGLXMultisampleAvailable(device));
if(null==caps) {
throw new GLException("GLCapabilities null of "+toHexString(fbcfg));
}
@@ -130,7 +131,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
static IntBuffer GLCapabilities2AttribList(GLCapabilitiesImmutable caps,
boolean forFBAttr, boolean isMultisampleAvailable,
- long display, int screen)
+ long display, int screen)
{
int colorDepth = (caps.getRedBits() +
caps.getGreenBits() +
@@ -143,7 +144,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
if (forFBAttr) {
res.put(idx++, GLX.GLX_DRAWABLE_TYPE);
-
+
final int surfaceType;
if( caps.isOnscreen() ) {
surfaceType = GLX.GLX_WINDOW_BIT;
@@ -157,7 +158,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
throw new GLException("no surface type set in caps: "+caps);
}
res.put(idx++, surfaceType);
-
+
res.put(idx++, GLX.GLX_RENDER_TYPE);
res.put(idx++, GLX.GLX_RGBA_BIT);
} else {
@@ -233,8 +234,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
}
// FBConfig
-
- static boolean GLXFBConfigIDValid(long display, int screen, int fbcfgid) {
+
+ static boolean GLXFBConfigIDValid(long display, int screen, int fbcfgid) {
long fbcfg = X11GLXGraphicsConfiguration.glXFBConfigID2FBConfig(display, screen, fbcfgid);
return (0 != fbcfg) ? X11GLXGraphicsConfiguration.GLXFBConfigValid( display, fbcfg ) : false ;
}
@@ -278,8 +279,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
int winattrmask, boolean isMultisampleAvailable) {
final int allDrawableTypeBits = FBCfgDrawableTypeBits(device, fbcfg);
int drawableTypeBits = winattrmask & allDrawableTypeBits;
-
- final long display = device.getHandle();
+
+ final long display = device.getHandle();
int fbcfgid = X11GLXGraphicsConfiguration.glXFBConfig2FBConfigID(display, fbcfg);
XVisualInfo visualInfo = GLX.glXGetVisualFromFBConfig(display, fbcfg);
if(null == visualInfo) {
@@ -307,8 +308,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
res.setSampleBuffers(glXGetFBConfig(display, fbcfg, GLX.GLX_SAMPLE_BUFFERS, tmp) != 0);
res.setNumSamples (glXGetFBConfig(display, fbcfg, GLX.GLX_SAMPLES, tmp));
}
- final XRenderDirectFormat xrmask = ( null != visualInfo ) ?
- XVisual2XRenderMask( display, visualInfo.getVisual() ) :
+ final XRenderDirectFormat xrmask = ( null != visualInfo ) ?
+ XVisual2XRenderMask( display, visualInfo.getVisual() ) :
null ;
final int alphaMask = ( null != xrmask ) ? xrmask.getAlphaMask() : 0;
res.setBackgroundOpaque( 0 >= alphaMask );
@@ -318,7 +319,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
res.setTransparentBlueValue(xrmask.getBlueMask());
res.setTransparentAlphaValue(alphaMask);
}
- // ALPHA shall be set at last - due to it's auto setting by the above (!opaque / samples)
+ // ALPHA shall be set at last - due to it's auto setting by the above (!opaque / samples)
res.setDoubleBuffered(glXGetFBConfig(display, fbcfg, GLX.GLX_DOUBLEBUFFER, tmp) != 0);
res.setStereo (glXGetFBConfig(display, fbcfg, GLX.GLX_STEREO, tmp) != 0);
res.setHardwareAccelerated(glXGetFBConfig(display, fbcfg, GLX.GLX_CONFIG_CAVEAT, tmp) != GLX.GLX_SLOW_CONFIG);
@@ -332,8 +333,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
res.setAccumAlphaBits(glXGetFBConfig(display, fbcfg, GLX.GLX_ACCUM_ALPHA_SIZE, tmp));
res.setDepthBits (glXGetFBConfig(display, fbcfg, GLX.GLX_DEPTH_SIZE, tmp));
res.setStencilBits (glXGetFBConfig(display, fbcfg, GLX.GLX_STENCIL_SIZE, tmp));
-
- return (X11GLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res);
+
+ return (X11GLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res);
}
private static String glXGetFBConfigErrorCode(int err) {
@@ -363,7 +364,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
static long glXFBConfigID2FBConfig(long display, int screen, int id) {
final IntBuffer attribs = Buffers.newDirectIntBuffer(new int[] { GLX.GLX_FBCONFIG_ID, id, 0 });
final IntBuffer count = Buffers.newDirectIntBuffer(1);
- count.put(0, -1);
+ count.put(0, -1);
PointerBuffer fbcfgsL = GLX.glXChooseFBConfig(display, screen, attribs, count);
if (fbcfgsL == null || fbcfgsL.limit()<1) {
return 0;
@@ -380,7 +381,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualIDMask, template, count, 0);
if (infos == null || infos.length == 0) {
return null;
- }
+ }
XVisualInfo res = XVisualInfo.create(infos[0]);
if (DEBUG) {
System.err.println("Fetched XVisualInfo for visual ID " + toHexString(visualID));
@@ -391,10 +392,10 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
static X11GLCapabilities XVisualInfo2GLCapabilities(final X11GraphicsDevice device, GLProfile glp, XVisualInfo info,
final int winattrmask, boolean isMultisampleEnabled) {
- final int allDrawableTypeBits = GLGraphicsConfigurationUtil.WINDOW_BIT |
+ final int allDrawableTypeBits = GLGraphicsConfigurationUtil.WINDOW_BIT |
GLGraphicsConfigurationUtil.BITMAP_BIT |
GLGraphicsConfigurationUtil.FBO_BIT ;
-
+
final int drawableTypeBits = winattrmask & allDrawableTypeBits;
if( 0 == drawableTypeBits ) {
@@ -425,13 +426,13 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
// Note: use of hardware acceleration is determined by
// glXCreateContext, not by the XVisualInfo. Optimistically claim
// that all GLCapabilities have the capability to be hardware
- // accelerated.
+ // accelerated.
if (isMultisampleEnabled) {
res.setSampleBuffers(glXGetConfig(display, info, GLX.GLX_SAMPLE_BUFFERS, tmp) != 0);
res.setNumSamples (glXGetConfig(display, info, GLX.GLX_SAMPLES, tmp));
}
- final XRenderDirectFormat xrmask = ( null != info ) ?
- XVisual2XRenderMask( display, info.getVisual() ) :
+ final XRenderDirectFormat xrmask = ( null != info ) ?
+ XVisual2XRenderMask( display, info.getVisual() ) :
null ;
final int alphaMask = ( null != xrmask ) ? xrmask.getAlphaMask() : 0;
res.setBackgroundOpaque( 0 >= alphaMask );
@@ -454,7 +455,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
res.setAccumBlueBits (glXGetConfig(display, info, GLX.GLX_ACCUM_BLUE_SIZE, tmp));
res.setAccumAlphaBits(glXGetConfig(display, info, GLX.GLX_ACCUM_ALPHA_SIZE, tmp));
- return (X11GLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res);
+ return (X11GLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res);
}
private static String glXGetConfigErrorCode(int err) {
@@ -478,6 +479,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
return tmp.get(tmp.position());
}
+ @Override
public String toString() {
return "X11GLXGraphicsConfiguration["+getScreen()+", visualID " + toHexString(getXVisualID()) + ", fbConfigID " + toHexString(getFBConfigID()) +
",\n\trequested " + getRequestedCapabilities()+
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
index a7c7d3f..6050dab 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -92,6 +92,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
private X11GLXGraphicsConfigurationFactory() {
}
+ @Override
protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl(
CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) {
if (!(absScreen instanceof X11GraphicsScreen)) {
@@ -109,7 +110,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
if (chooser != null && !(chooser instanceof GLCapabilitiesChooser)) {
throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects");
}
-
+
if(!GLXUtil.isGLXAvailableOnServer((X11GraphicsDevice)absScreen.getDevice())) {
if(null != fallbackX11GraphicsConfigurationFactory) {
if(DEBUG) {
@@ -118,7 +119,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
return fallbackX11GraphicsConfigurationFactory.chooseGraphicsConfiguration(capsChosen, capsRequested, chooser, absScreen, VisualIDHolder.VID_UNDEFINED);
}
throw new InternalError("No GLX and no fallback GraphicsConfigurationFactory available for: "+absScreen);
- }
+ }
return chooseGraphicsConfigurationStatic((GLCapabilitiesImmutable)capsChosen, (GLCapabilitiesImmutable)capsRequested,
(GLCapabilitiesChooser)chooser, (X11GraphicsScreen)absScreen, nativeVisualID);
}
@@ -134,7 +135,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
final GLProfile glp = GLProfile.getDefault(device);
List<GLCapabilitiesImmutable> availableCaps = null;
-
+
sharedDevice.lock();
try {
if( sharedResource.isGLXVersionGreaterEqualOneThree() ) {
@@ -219,9 +220,9 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
if (capsChosen == null) {
capsChosen = new GLCapabilities(null);
}
- X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice();
+ X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice();
X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory();
-
+
capsChosen = GLGraphicsConfigurationUtil.fixGLCapabilities( capsChosen, factory, x11Device);
final boolean usePBuffer = !capsChosen.isOnscreen() && capsChosen.isPBuffer();
@@ -262,7 +263,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
return null;
}
final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory();
-
+
final X11GLCapabilities caps = X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities(x11Device, glp, fbcfg, GLGraphicsConfigurationUtil.ALL_BITS, factory.isGLXMultisampleAvailable(x11Device));
return new X11GLXGraphicsConfiguration(x11Screen, caps, caps, new DefaultGLCapabilitiesChooser());
}
@@ -280,8 +281,8 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice();
long display = x11Device.getHandle();
int screen = x11Screen.getIndex();
-
- final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory();
+
+ final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory();
final boolean isMultisampleAvailable = factory.isGLXMultisampleAvailable(x11Device);
final IntBuffer attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(capsChosen, true, isMultisampleAvailable, display, screen);
final IntBuffer count = Buffers.newDirectIntBuffer(1);
@@ -337,14 +338,14 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
}
}
}
-
+
if(DEBUG) {
System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: got configs: "+availableCaps.size());
for(int i=0; i<availableCaps.size(); i++) {
System.err.println(i+": "+availableCaps.get(i));
}
}
-
+
if( VisualIDHolder.VID_UNDEFINED != xvisualID ) {
for(int i=0; i<availableCaps.size(); ) {
VisualIDHolder vidh = (VisualIDHolder) availableCaps.get(i);
@@ -363,7 +364,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: post filter visualID "+toHexString(xvisualID)+" got configs: "+availableCaps.size());
}
}
-
+
int chosenIndex = chooseCapabilities(chooser, capsChosen, availableCaps, recommendedIndex);
if ( 0 > chosenIndex ) {
if (DEBUG) {
@@ -393,15 +394,15 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
X11GraphicsDevice absDevice = (X11GraphicsDevice) x11Screen.getDevice();
long display = absDevice.getHandle();
int screen = x11Screen.getIndex();
-
- final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory();
- final boolean isMultisampleAvailable = factory.isGLXMultisampleAvailable(absDevice);
+
+ final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory();
+ final boolean isMultisampleAvailable = factory.isGLXMultisampleAvailable(absDevice);
final IntBuffer attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(capsChosen, false, isMultisampleAvailable, display, screen);
XVisualInfo recommendedVis = null;
// 1st choice: get GLCapabilities based on users GLCapabilities setting recommendedIndex as preferred choice
// skipped if xvisualID is given
- if( VisualIDHolder.VID_UNDEFINED == xvisualID ) {
+ if( VisualIDHolder.VID_UNDEFINED == xvisualID ) {
recommendedVis = GLX.glXChooseVisual(display, screen, attribs);
if (DEBUG) {
System.err.print("glXChooseVisual recommended ");
@@ -441,7 +442,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
System.err.println(i+": "+availableCaps.get(i));
}
}
-
+
if( VisualIDHolder.VID_UNDEFINED != xvisualID ) {
for(int i=0; i<availableCaps.size(); ) {
VisualIDHolder vidh = (VisualIDHolder) availableCaps.get(i);
@@ -453,14 +454,14 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
}
if(0==availableCaps.size()) {
if(DEBUG) {
- System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationXVisual: post filter visualID "+toHexString(xvisualID )+" no config found, failed - return null");
+ System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationXVisual: post filter visualID "+toHexString(xvisualID )+" no config found, failed - return null");
}
return null;
} else if(DEBUG) {
System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationXVisual: post filter visualID "+toHexString(xvisualID)+" got configs: "+availableCaps.size());
}
}
-
+
int chosenIndex = chooseCapabilities(chooser, capsChosen, availableCaps, recommendedIndex);
if ( 0 > chosenIndex ) {
if (DEBUG) {
diff --git a/src/jogl/native/GLContext.c b/src/jogl/native/GLContext.c
new file mode 100644
index 0000000..f10d0e4
--- /dev/null
+++ b/src/jogl/native/GLContext.c
@@ -0,0 +1,46 @@
+
+#include "jogamp_opengl_GLContextImpl.h"
+#include "JoglCommon.h"
+
+#include <assert.h>
+#include <KHR/khrplatform.h>
+
+/*
+ * Class: jogamp_opengl_GLContextImpl
+ * Method: glGetStringInt
+ * Signature: (IJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_jogamp_opengl_GLContextImpl_glGetStringInt(JNIEnv *env, jclass _unused, jint name, jlong procAddress) {
+ typedef const khronos_uint8_t * (KHRONOS_APIENTRY*_local_PFNGLGETSTRINGPROC)(unsigned int name);
+ _local_PFNGLGETSTRINGPROC ptr_glGetString;
+ const khronos_uint8_t * _res;
+ ptr_glGetString = (_local_PFNGLGETSTRINGPROC) (intptr_t) procAddress;
+ assert(ptr_glGetString != NULL);
+ _res = (* ptr_glGetString) ((unsigned int) name);
+ if (NULL == _res) return NULL;
+ return (*env)->NewStringUTF(env, _res);
+}
+
+/*
+ * Class: jogamp_opengl_GLContextImpl
+ * Method: glGetIntegervInt
+ * Signature: (ILjava/lang/Object;I)V
+ */
+JNIEXPORT void JNICALL
+Java_jogamp_opengl_GLContextImpl_glGetIntegervInt(JNIEnv *env, jclass _unused, jint pname, jobject params, jint params_byte_offset, jlong procAddress) {
+ typedef void (KHRONOS_APIENTRY*_local_PFNGLGETINTEGERVPROC)(unsigned int pname, int * params);
+
+ _local_PFNGLGETINTEGERVPROC ptr_glGetIntegerv;
+ int * _params_ptr = NULL;
+ if ( NULL != params ) {
+ _params_ptr = (int *) (((char*) (*env)->GetPrimitiveArrayCritical(env, params, NULL) ) + params_byte_offset);
+ }
+ ptr_glGetIntegerv = (_local_PFNGLGETINTEGERVPROC) (intptr_t) procAddress;
+ assert(ptr_glGetIntegerv != NULL);
+ (* ptr_glGetIntegerv) ((unsigned int) pname, (int *) _params_ptr);
+ if ( NULL != params ) {
+ (*env)->ReleasePrimitiveArrayCritical(env, params, _params_ptr, 0);
+ }
+}
+
diff --git a/src/jogl/native/JoglCommon.c b/src/jogl/native/JoglCommon.c
index 62dd8ef..4170b13 100644
--- a/src/jogl/native/JoglCommon.c
+++ b/src/jogl/native/JoglCommon.c
@@ -1,5 +1,4 @@
-#include "jogamp_opengl_GLContextImpl.h"
#include "JoglCommon.h"
#include <assert.h>
@@ -132,42 +131,3 @@ void JoglCommon_ReleaseJNIEnv (int shallBeDetached) {
}
}
-/*
- * Class: jogamp_opengl_GLContextImpl
- * Method: glGetStringInt
- * Signature: (IJ)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_jogamp_opengl_GLContextImpl_glGetStringInt(JNIEnv *env, jclass _unused, jint name, jlong procAddress) {
- typedef const khronos_uint8_t * (KHRONOS_APIENTRY*_local_PFNGLGETSTRINGPROC)(unsigned int name);
- _local_PFNGLGETSTRINGPROC ptr_glGetString;
- const khronos_uint8_t * _res;
- ptr_glGetString = (_local_PFNGLGETSTRINGPROC) (intptr_t) procAddress;
- assert(ptr_glGetString != NULL);
- _res = (* ptr_glGetString) ((unsigned int) name);
- if (NULL == _res) return NULL;
- return (*env)->NewStringUTF(env, _res);
-}
-
-/*
- * Class: jogamp_opengl_GLContextImpl
- * Method: glGetIntegervInt
- * Signature: (ILjava/lang/Object;I)V
- */
-JNIEXPORT void JNICALL
-Java_jogamp_opengl_GLContextImpl_glGetIntegervInt(JNIEnv *env, jclass _unused, jint pname, jobject params, jint params_byte_offset, jlong procAddress) {
- typedef void (KHRONOS_APIENTRY*_local_PFNGLGETINTEGERVPROC)(unsigned int pname, int * params);
-
- _local_PFNGLGETINTEGERVPROC ptr_glGetIntegerv;
- int * _params_ptr = NULL;
- if ( NULL != params ) {
- _params_ptr = (int *) (((char*) (*env)->GetPrimitiveArrayCritical(env, params, NULL) ) + params_byte_offset);
- }
- ptr_glGetIntegerv = (_local_PFNGLGETINTEGERVPROC) (intptr_t) procAddress;
- assert(ptr_glGetIntegerv != NULL);
- (* ptr_glGetIntegerv) ((unsigned int) pname, (int *) _params_ptr);
- if ( NULL != params ) {
- (*env)->ReleasePrimitiveArrayCritical(env, params, _params_ptr, 0);
- }
-}
-
diff --git a/src/jogl/native/libav/ffmpeg_dshow.c b/src/jogl/native/libav/ffmpeg_dshow.c
new file mode 100644
index 0000000..4f1523a
--- /dev/null
+++ b/src/jogl/native/libav/ffmpeg_dshow.c
@@ -0,0 +1,215 @@
+/**
+ * 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 "ffmpeg_dshow.h"
+
+#ifdef _WIN32
+
+#include <stdio.h>
+#include <string.h>
+
+// dshow includes strsafe.h, hence tchar.h cannot be used
+// include strsafe.h here for documentation
+// #include <tchar.h>
+#include <strsafe.h>
+#include <dshow.h>
+
+static HRESULT EnumerateDevices(REFGUID category, IEnumMoniker **ppEnum)
+{
+ // Create the System Device Enumerator.
+ ICreateDevEnum *pDevEnum;
+ void *pv = NULL;
+
+ HRESULT hr = CoCreateInstance(&CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, &IID_ICreateDevEnum, (void**)&pDevEnum);
+
+ if (SUCCEEDED(hr)) {
+ // Create an enumerator for the category.
+ hr = pDevEnum->lpVtbl->CreateClassEnumerator(pDevEnum, category, ppEnum,0);
+ if (hr == S_FALSE)
+ {
+ hr = VFW_E_NOT_FOUND; // The category is empty. Treat as an error.
+ }
+ pDevEnum->lpVtbl->Release(pDevEnum);
+ }
+ return hr;
+}
+
+static void getBSTRChars(BSTR bstr, char *pDest, int destLen) {
+
+ #ifdef UNICODE
+ // _sntprintf(pDest, destLen, _T("%s"), bstr);
+ StringCbPrintfW(pDest, destLen, L"%s", bstr);
+ #else
+ // _sntprintf(pDest, destLen, _T("%S"), bstr);
+ StringCchPrintfA(pDest, destLen, "%S", bstr);
+ #endif
+}
+
+
+static int GetDeviceInformation(IEnumMoniker *pEnum, int verbose, int devIdx,
+ char *pDescr, int descrSize,
+ char *pName, int nameSize,
+ char *pPath, int pathSize, int *pWaveID) {
+ IMoniker *pMoniker = NULL;
+ int i=0;
+ int res = devIdx >= 0 ? -1 : 0;
+
+ if( NULL != pDescr ) {
+ *pDescr=0;
+ }
+ if( NULL != pName ) {
+ *pName=0;
+ }
+ if( NULL != pPath ) {
+ *pPath=0;
+ }
+ if( NULL != pWaveID ) {
+ *pWaveID=0;
+ }
+
+ while (pEnum->lpVtbl->Next(pEnum, 1, &pMoniker, NULL) == S_OK) {
+ IPropertyBag *pPropBag;
+ HRESULT hr;
+
+ hr = pMoniker->lpVtbl->BindToStorage(pMoniker, 0, 0, &IID_IPropertyBag, (void**)&pPropBag);
+ if (FAILED(hr)) {
+ if( verbose ) {
+ fprintf(stderr, "DShowParser: Dev[%d]: bind failed ...\n", i);
+ }
+ pMoniker->lpVtbl->Release(pMoniker);
+ continue;
+ }
+ VARIANT var;
+ VariantInit(&var);
+
+ // Get description or friendly name.
+ hr = pPropBag->lpVtbl->Read(pPropBag, L"Description", &var, 0);
+ if (SUCCEEDED(hr)) {
+ if( i == devIdx && NULL != pDescr ) {
+ res = 0;
+ getBSTRChars(var.bstrVal, pDescr, descrSize);
+ }
+ if( verbose ) {
+ fprintf(stderr, "DShowParser: Dev[%d]: Descr %S\n", i, var.bstrVal);
+ }
+ VariantClear(&var);
+ } else if( verbose ) {
+ fprintf(stderr, "DShowParser: Dev[%d]: cannot read Descr..\n", i);
+ }
+
+ hr = pPropBag->lpVtbl->Read(pPropBag, L"FriendlyName", &var, 0);
+ if (SUCCEEDED(hr)) {
+ if( i == devIdx && NULL != pName ) {
+ res = 0;
+ getBSTRChars(var.bstrVal, pName, nameSize);
+ }
+ if( verbose ) {
+ fprintf(stderr, "DShowParser: Dev[%d]: Name %S\n", i, var.bstrVal);
+ }
+ VariantClear(&var);
+ } else if( verbose ) {
+ fprintf(stderr, "DShowParser: Dev[%d]: cannot read Name..\n", i);
+ }
+
+ hr = pPropBag->lpVtbl->Write(pPropBag, L"FriendlyName", &var);
+
+ // WaveInID applies only to audio capture devices.
+ hr = pPropBag->lpVtbl->Read(pPropBag, L"WaveInID", &var, 0);
+ if (SUCCEEDED(hr)) {
+ if( i == devIdx && NULL != pWaveID ) {
+ res = 0;
+ *pWaveID=(int)var.lVal;
+ }
+ if( verbose ) {
+ fprintf(stderr, "DShowParser: Dev[%d]: WaveInID %d\n", i, var.lVal);
+ }
+ VariantClear(&var);
+ }
+
+ hr = pPropBag->lpVtbl->Read(pPropBag, L"DevicePath", &var, 0);
+ if (SUCCEEDED(hr)) {
+ if( i == devIdx && NULL != pPath ) {
+ res = 0;
+ getBSTRChars(var.bstrVal, pPath, pathSize);
+ }
+ if( verbose ) {
+ fprintf(stderr, "DShowParser: Dev[%d]: Path %S\n", i, var.bstrVal);
+ }
+ VariantClear(&var);
+ }
+
+ pPropBag->lpVtbl->Release(pPropBag);
+ pMoniker->lpVtbl->Release(pMoniker);
+
+ if( devIdx >= 0 && i == devIdx ) {
+ break; // done!
+ }
+ i++;
+ }
+ return res;
+}
+
+int findDShowVideoDevice(char * dest, int destSize, int devIdx, int verbose) {
+ int res = -1;
+
+ HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ if (SUCCEEDED(hr)) {
+ IEnumMoniker *pEnum;
+
+ hr = EnumerateDevices(&CLSID_VideoInputDeviceCategory, &pEnum);
+ if (SUCCEEDED(hr)) {
+ res = GetDeviceInformation(pEnum, verbose, devIdx, NULL /* pDescr */, 0, dest, destSize, NULL /* pPath */, 0, NULL /* pWaveID */);
+ pEnum->lpVtbl->Release(pEnum);
+ if( verbose ) {
+ fprintf(stderr, "DShowParser: Get VideoInputDevice: res %d, '%s'\n", res, dest);
+ }
+ } else if( verbose ) {
+ fprintf(stderr, "DShowParser: Get VideoInputDevice failed\n");
+ }
+ /**
+ hr = EnumerateDevices(&CLSID_AudioInputDeviceCategory, &pEnum);
+ if (SUCCEEDED(hr)) {
+ res = GetDeviceInformation(pEnum, verbose, devIdx, NULL, 0, NULL, 0, NULL, 0, NULL);
+ pEnum->lpVtbl->Release(pEnum);
+ } else if( verbose ) {
+ fprintf(stderr, "DShowParser: Get AudioInputDevice failed\n");
+ } */
+ CoUninitialize();
+ } else if( verbose ) {
+ fprintf(stderr, "DShowParser: CoInit failed\n");
+ }
+ return res;
+}
+
+#else
+
+int findDShowVideoDevice(char * dest, int destSize, int devIdx, int verbose) {
+ return -1;
+}
+
+#endif
diff --git a/src/jogl/native/libav/ffmpeg_dshow.h b/src/jogl/native/libav/ffmpeg_dshow.h
new file mode 100644
index 0000000..44524bf
--- /dev/null
+++ b/src/jogl/native/libav/ffmpeg_dshow.h
@@ -0,0 +1,47 @@
+/**
+ * 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.
+ */
+
+#ifndef _FFMPEG_DSHOW_H
+#define _FFMPEG_DSHOW_H
+
+#ifdef _WIN32
+
+#include <windows.h>
+
+#endif // _WIN32
+
+#include <gluegen_stdint.h>
+#include <gluegen_inttypes.h>
+#include <gluegen_stddef.h>
+#include <gluegen_stdint.h>
+
+extern int findDShowVideoDevice(char * dest, int destSize, int devIdx, int verbose);
+
+
+#endif // _FFMPEG_DSHOW_H
+
diff --git a/src/jogl/native/libav/ffmpeg_impl_template.c b/src/jogl/native/libav/ffmpeg_impl_template.c
new file mode 100644
index 0000000..34a2bae
--- /dev/null
+++ b/src/jogl/native/libav/ffmpeg_impl_template.c
@@ -0,0 +1,1548 @@
+/**
+ * Copyright 2012 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.
+ */
+
+// #define FF_FUNC(METHOD) Java_jogamp_opengl_util_av_impl_FFMPEGv08 ## METHOD
+
+#include "JoglCommon.h"
+#include "ffmpeg_tool.h"
+#include "ffmpeg_static.h"
+#include "ffmpeg_dshow.h"
+
+#include "libavutil/pixdesc.h"
+#include "libavutil/samplefmt.h"
+#if LIBAVUTIL_VERSION_MAJOR < 53
+ #include "libavutil/audioconvert.h"
+ // 52: #include "libavutil/channel_layout.h"
+#endif
+
+#include <GL/gl.h>
+
+#define HAS_FUNC(f) (NULL!=(f))
+
+typedef unsigned (APIENTRYP AVUTIL_VERSION)(void);
+typedef unsigned (APIENTRYP AVFORMAT_VERSION)(void);
+typedef unsigned (APIENTRYP AVCODEC_VERSION)(void);
+typedef unsigned (APIENTRYP AVRESAMPLE_VERSION)(void);
+typedef unsigned (APIENTRYP SWRESAMPLE_VERSION)(void);
+
+static AVUTIL_VERSION sp_avutil_version;
+static AVFORMAT_VERSION sp_avformat_version;
+static AVCODEC_VERSION sp_avcodec_version;
+static AVRESAMPLE_VERSION sp_avresample_version;
+static SWRESAMPLE_VERSION sp_swresample_version;
+// count: 5
+
+// libavcodec
+typedef int (APIENTRYP AVCODEC_REGISTER_ALL)(void);
+typedef int (APIENTRYP AVCODEC_CLOSE)(AVCodecContext *avctx);
+typedef void (APIENTRYP AVCODEC_STRING)(char *buf, int buf_size, AVCodecContext *enc, int encode);
+typedef AVCodec *(APIENTRYP AVCODEC_FIND_DECODER)(int avCodecID); // lavc 53: 'enum CodecID id', lavc 54: 'enum AVCodecID id'
+typedef int (APIENTRYP AVCODEC_OPEN2)(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options); // 53.6.0
+typedef AVFrame *(APIENTRYP AVCODEC_ALLOC_FRAME)(void);
+typedef void (APIENTRYP AVCODEC_GET_FRAME_DEFAULTS)(AVFrame *frame);
+typedef void (APIENTRYP AVCODEC_FREE_FRAME)(AVFrame **frame);
+typedef int (APIENTRYP AVCODEC_DEFAULT_GET_BUFFER)(AVCodecContext *s, AVFrame *pic); // <= 54 (opt), else AVCODEC_DEFAULT_GET_BUFFER2
+typedef void (APIENTRYP AVCODEC_DEFAULT_RELEASE_BUFFER)(AVCodecContext *s, AVFrame *pic); // <= 54 (opt), else AV_FRAME_UNREF
+typedef int (APIENTRYP AVCODEC_DEFAULT_GET_BUFFER2)(AVCodecContext *s, AVFrame *frame, int flags); // 55. (opt)
+typedef int (APIENTRYP AVCODEC_GET_EDGE_WIDTH)();
+typedef int (APIENTRYP AV_IMAGE_FILL_LINESIZES)(int linesizes[4], int pix_fmt, int width); // lavu 51: 'enum PixelFormat pix_fmt', lavu 53: 'enum AVPixelFormat pix_fmt'
+typedef void (APIENTRYP AVCODEC_ALIGN_DIMENSIONS)(AVCodecContext *s, int *width, int *height);
+typedef void (APIENTRYP AVCODEC_ALIGN_DIMENSIONS2)(AVCodecContext *s, int *width, int *height, int linesize_align[AV_NUM_DATA_POINTERS]);
+typedef void (APIENTRYP AVCODEC_FLUSH_BUFFERS)(AVCodecContext *avctx);
+typedef void (APIENTRYP AV_INIT_PACKET)(AVPacket *pkt);
+typedef int (APIENTRYP AV_NEW_PACKET)(AVPacket *pkt, int size);
+typedef void (APIENTRYP AV_DESTRUCT_PACKET)(AVPacket *pkt);
+typedef void (APIENTRYP AV_FREE_PACKET)(AVPacket *pkt);
+typedef int (APIENTRYP AVCODEC_DECODE_AUDIO4)(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt); // 53.25.0
+typedef int (APIENTRYP AVCODEC_DECODE_VIDEO2)(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt); // 52.23.0
+
+static AVCODEC_REGISTER_ALL sp_avcodec_register_all;
+static AVCODEC_CLOSE sp_avcodec_close;
+static AVCODEC_STRING sp_avcodec_string;
+static AVCODEC_FIND_DECODER sp_avcodec_find_decoder;
+static AVCODEC_OPEN2 sp_avcodec_open2; // 53.6.0
+static AVCODEC_ALLOC_FRAME sp_avcodec_alloc_frame;
+static AVCODEC_GET_FRAME_DEFAULTS sp_avcodec_get_frame_defaults;
+static AVCODEC_FREE_FRAME sp_avcodec_free_frame;
+static AVCODEC_DEFAULT_GET_BUFFER sp_avcodec_default_get_buffer; // <= 54 (opt), else sp_avcodec_default_get_buffer2
+static AVCODEC_DEFAULT_RELEASE_BUFFER sp_avcodec_default_release_buffer; // <= 54 (opt), else sp_av_frame_unref
+static AVCODEC_DEFAULT_GET_BUFFER2 sp_avcodec_default_get_buffer2; // 55. (opt)
+static AVCODEC_GET_EDGE_WIDTH sp_avcodec_get_edge_width;
+static AV_IMAGE_FILL_LINESIZES sp_av_image_fill_linesizes;
+static AVCODEC_ALIGN_DIMENSIONS sp_avcodec_align_dimensions;
+static AVCODEC_ALIGN_DIMENSIONS2 sp_avcodec_align_dimensions2;
+static AVCODEC_FLUSH_BUFFERS sp_avcodec_flush_buffers;
+static AV_INIT_PACKET sp_av_init_packet;
+static AV_NEW_PACKET sp_av_new_packet;
+static AV_DESTRUCT_PACKET sp_av_destruct_packet;
+static AV_FREE_PACKET sp_av_free_packet;
+static AVCODEC_DECODE_AUDIO4 sp_avcodec_decode_audio4; // 53.25.0
+static AVCODEC_DECODE_VIDEO2 sp_avcodec_decode_video2; // 52.23.0
+// count: 27
+
+// libavutil
+typedef void (APIENTRYP AV_FRAME_UNREF)(AVFrame *frame);
+typedef void* (APIENTRYP AV_REALLOC)(void *ptr, size_t size);
+typedef void (APIENTRYP AV_FREE)(void *ptr);
+typedef int (APIENTRYP AV_GET_BITS_PER_PIXEL)(const AVPixFmtDescriptor *pixdesc);
+typedef int (APIENTRYP AV_SAMPLES_GET_BUFFER_SIZE)(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align);
+typedef int (APIENTRYP AV_GET_BYTES_PER_SAMPLE)(enum AVSampleFormat sample_fmt);
+typedef int (APIENTRYP AV_OPT_SET_INT)(void *obj, const char *name, int64_t val, int search_flags);
+typedef AVDictionaryEntry* (APIENTRYP AV_DICT_GET)(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags);
+typedef int (APIENTRYP AV_DICT_COUNT)(AVDictionary *m);
+typedef int (APIENTRYP AV_DICT_SET)(AVDictionary **pm, const char *key, const char *value, int flags);
+typedef void (APIENTRYP AV_DICT_FREE)(AVDictionary **m);
+
+static const AVPixFmtDescriptor* sp_av_pix_fmt_descriptors;
+static AV_FRAME_UNREF sp_av_frame_unref;
+static AV_REALLOC sp_av_realloc;
+static AV_FREE sp_av_free;
+static AV_GET_BITS_PER_PIXEL sp_av_get_bits_per_pixel;
+static AV_SAMPLES_GET_BUFFER_SIZE sp_av_samples_get_buffer_size;
+static AV_GET_BYTES_PER_SAMPLE sp_av_get_bytes_per_sample;
+static AV_OPT_SET_INT sp_av_opt_set_int;
+static AV_DICT_GET sp_av_dict_get;
+static AV_DICT_COUNT sp_av_dict_count;
+static AV_DICT_SET sp_av_dict_set;
+static AV_DICT_FREE sp_av_dict_free;
+// count: 39
+
+// libavformat
+typedef AVFormatContext *(APIENTRYP AVFORMAT_ALLOC_CONTEXT)(void);
+typedef void (APIENTRYP AVFORMAT_FREE_CONTEXT)(AVFormatContext *s); // 52.96.0
+typedef void (APIENTRYP AVFORMAT_CLOSE_INPUT)(AVFormatContext **s); // 53.17.0
+typedef void (APIENTRYP AV_REGISTER_ALL)(void);
+typedef AVInputFormat *(APIENTRYP AV_FIND_INPUT_FORMAT)(const char *short_name);
+typedef int (APIENTRYP AVFORMAT_OPEN_INPUT)(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options);
+typedef void (APIENTRYP AV_DUMP_FORMAT)(AVFormatContext *ic, int index, const char *url, int is_output);
+typedef int (APIENTRYP AV_READ_FRAME)(AVFormatContext *s, AVPacket *pkt);
+typedef int (APIENTRYP AV_SEEK_FRAME)(AVFormatContext *s, int stream_index, int64_t timestamp, int flags);
+typedef int (APIENTRYP AVFORMAT_SEEK_FILE)(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags);
+typedef int (APIENTRYP AV_READ_PLAY)(AVFormatContext *s);
+typedef int (APIENTRYP AV_READ_PAUSE)(AVFormatContext *s);
+typedef int (APIENTRYP AVFORMAT_NETWORK_INIT)(void); // 53.13.0
+typedef int (APIENTRYP AVFORMAT_NETWORK_DEINIT)(void); // 53.13.0
+typedef int (APIENTRYP AVFORMAT_FIND_STREAM_INFO)(AVFormatContext *ic, AVDictionary **options); // 53.3.0
+
+static AVFORMAT_ALLOC_CONTEXT sp_avformat_alloc_context;
+static AVFORMAT_FREE_CONTEXT sp_avformat_free_context; // 52.96.0 (not used, only for outfile cts)
+static AVFORMAT_CLOSE_INPUT sp_avformat_close_input; // 53.17.0
+static AV_REGISTER_ALL sp_av_register_all;
+static AV_FIND_INPUT_FORMAT sp_av_find_input_format;
+static AVFORMAT_OPEN_INPUT sp_avformat_open_input;
+static AV_DUMP_FORMAT sp_av_dump_format;
+static AV_READ_FRAME sp_av_read_frame;
+static AV_SEEK_FRAME sp_av_seek_frame;
+static AVFORMAT_SEEK_FILE sp_avformat_seek_file;
+static AV_READ_PLAY sp_av_read_play;
+static AV_READ_PAUSE sp_av_read_pause;
+static AVFORMAT_NETWORK_INIT sp_avformat_network_init; // 53.13.0
+static AVFORMAT_NETWORK_DEINIT sp_avformat_network_deinit; // 53.13.0
+static AVFORMAT_FIND_STREAM_INFO sp_avformat_find_stream_info; // 53.3.0
+// count: 54
+
+// libavdevice [53.0.0]
+typedef int (APIENTRYP AVDEVICE_REGISTER_ALL)(void);
+static AVDEVICE_REGISTER_ALL sp_avdevice_register_all;
+// count: 55
+
+// libavresample [1.0.1]
+typedef AVAudioResampleContext* (APIENTRYP AVRESAMPLE_ALLOC_CONTEXT)(void); // 1.0.1
+typedef int (APIENTRYP AVRESAMPLE_OPEN)(AVAudioResampleContext *avr); // 1.0.1
+typedef void (APIENTRYP AVRESAMPLE_CLOSE)(AVAudioResampleContext *avr); // 1.0.1
+typedef void (APIENTRYP AVRESAMPLE_FREE)(AVAudioResampleContext **avr); // 1.0.1
+typedef int (APIENTRYP AVRESAMPLE_CONVERT)(AVAudioResampleContext *avr, uint8_t **output,
+ int out_plane_size, int out_samples, uint8_t **input,
+ int in_plane_size, int in_samples); // 1.0.1
+static AVRESAMPLE_ALLOC_CONTEXT sp_avresample_alloc_context;
+static AVRESAMPLE_OPEN sp_avresample_open;
+static AVRESAMPLE_CLOSE sp_avresample_close;
+static AVRESAMPLE_FREE sp_avresample_free;
+static AVRESAMPLE_CONVERT sp_avresample_convert;
+// count: 60
+
+// libswresample [1...]
+typedef int (APIENTRYP AV_OPT_SET_SAMPLE_FMT)(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags); // actually lavu .. but exist only w/ swresample!
+typedef struct SwrContext *(APIENTRYP SWR_ALLOC)(void);
+typedef int (APIENTRYP SWR_INIT)(struct SwrContext *s);
+typedef void (APIENTRYP SWR_FREE)(struct SwrContext **s);
+typedef int (APIENTRYP SWR_CONVERT)(struct SwrContext *s, uint8_t **out, int out_count, const uint8_t **in , int in_count);
+
+static AV_OPT_SET_SAMPLE_FMT sp_av_opt_set_sample_fmt;
+static SWR_ALLOC sp_swr_alloc;
+static SWR_INIT sp_swr_init;
+static SWR_FREE sp_swr_free;
+static SWR_CONVERT sp_swr_convert;
+// count: 65
+
+#define SYMBOL_COUNT 65
+
+JNIEXPORT jboolean JNICALL FF_FUNC(initSymbols0)
+ (JNIEnv *env, jobject instance, jobject jSymbols, jint count)
+{
+ int64_t* symbols; // jlong -> int64_t -> intptr_t -> FUNC_PTR
+ int i;
+
+ if(SYMBOL_COUNT != count) {
+ fprintf(stderr, "FFMPEGNatives.initSymbols0: Wrong symbol count: Expected %d, Is %d\n",
+ SYMBOL_COUNT, count);
+ return JNI_FALSE;
+ }
+ JoglCommon_init(env);
+
+ i = 0;
+ symbols = (int64_t *) (*env)->GetPrimitiveArrayCritical(env, jSymbols, NULL);
+
+ sp_avutil_version = (AVUTIL_VERSION) (intptr_t) symbols[i++];
+ sp_avformat_version = (AVFORMAT_VERSION) (intptr_t) symbols[i++];
+ sp_avcodec_version = (AVCODEC_VERSION) (intptr_t) symbols[i++];
+ sp_avresample_version = (AVRESAMPLE_VERSION) (intptr_t) symbols[i++];
+ sp_swresample_version = (SWRESAMPLE_VERSION) (intptr_t) symbols[i++];
+
+ sp_avcodec_register_all = (AVCODEC_REGISTER_ALL) (intptr_t) symbols[i++];
+ sp_avcodec_close = (AVCODEC_CLOSE) (intptr_t) symbols[i++];
+ sp_avcodec_string = (AVCODEC_STRING) (intptr_t) symbols[i++];
+ sp_avcodec_find_decoder = (AVCODEC_FIND_DECODER) (intptr_t) symbols[i++];
+ sp_avcodec_open2 = (AVCODEC_OPEN2) (intptr_t) symbols[i++];
+ sp_avcodec_alloc_frame = (AVCODEC_ALLOC_FRAME) (intptr_t) symbols[i++];
+ sp_avcodec_get_frame_defaults = (AVCODEC_GET_FRAME_DEFAULTS) (intptr_t) symbols[i++];
+ sp_avcodec_free_frame = (AVCODEC_FREE_FRAME) (intptr_t) symbols[i++];
+ sp_avcodec_default_get_buffer = (AVCODEC_DEFAULT_GET_BUFFER) (intptr_t) symbols[i++];
+ sp_avcodec_default_release_buffer = (AVCODEC_DEFAULT_RELEASE_BUFFER) (intptr_t) symbols[i++];
+ sp_avcodec_default_get_buffer2 = (AVCODEC_DEFAULT_GET_BUFFER2) (intptr_t) symbols[i++];
+ sp_avcodec_get_edge_width = (AVCODEC_GET_EDGE_WIDTH) (intptr_t) symbols[i++];
+ sp_av_image_fill_linesizes = (AV_IMAGE_FILL_LINESIZES) (intptr_t) symbols[i++];
+ sp_avcodec_align_dimensions = (AVCODEC_ALIGN_DIMENSIONS) (intptr_t) symbols[i++];
+ sp_avcodec_align_dimensions2 = (AVCODEC_ALIGN_DIMENSIONS2) (intptr_t) symbols[i++];
+ sp_avcodec_flush_buffers = (AVCODEC_FLUSH_BUFFERS) (intptr_t) symbols[i++];
+ sp_av_init_packet = (AV_INIT_PACKET) (intptr_t) symbols[i++];
+ sp_av_new_packet = (AV_NEW_PACKET) (intptr_t) symbols[i++];
+ sp_av_destruct_packet = (AV_DESTRUCT_PACKET) (intptr_t) symbols[i++];
+ sp_av_free_packet = (AV_FREE_PACKET) (intptr_t) symbols[i++];
+ sp_avcodec_decode_audio4 = (AVCODEC_DECODE_AUDIO4) (intptr_t) symbols[i++];
+ sp_avcodec_decode_video2 = (AVCODEC_DECODE_VIDEO2) (intptr_t) symbols[i++];
+
+ sp_av_pix_fmt_descriptors = (const AVPixFmtDescriptor*) (intptr_t) symbols[i++];
+ sp_av_frame_unref = (AV_FRAME_UNREF) (intptr_t) symbols[i++];
+ sp_av_realloc = (AV_REALLOC) (intptr_t) symbols[i++];
+ sp_av_free = (AV_FREE) (intptr_t) symbols[i++];
+ sp_av_get_bits_per_pixel = (AV_GET_BITS_PER_PIXEL) (intptr_t) symbols[i++];
+ sp_av_samples_get_buffer_size = (AV_SAMPLES_GET_BUFFER_SIZE) (intptr_t) symbols[i++];
+ sp_av_get_bytes_per_sample = (AV_GET_BYTES_PER_SAMPLE) (intptr_t) symbols[i++];
+ sp_av_opt_set_int = (AV_OPT_SET_INT) (intptr_t) symbols[i++];
+ sp_av_dict_get = (AV_DICT_GET) (intptr_t) symbols[i++];
+ sp_av_dict_count = (AV_DICT_COUNT) (intptr_t) symbols[i++];
+ sp_av_dict_set = (AV_DICT_SET) (intptr_t) symbols[i++];
+ sp_av_dict_free = (AV_DICT_FREE) (intptr_t) symbols[i++];
+
+ sp_avformat_alloc_context = (AVFORMAT_ALLOC_CONTEXT) (intptr_t) symbols[i++];;
+ sp_avformat_free_context = (AVFORMAT_FREE_CONTEXT) (intptr_t) symbols[i++];
+ sp_avformat_close_input = (AVFORMAT_CLOSE_INPUT) (intptr_t) symbols[i++];
+ sp_av_register_all = (AV_REGISTER_ALL) (intptr_t) symbols[i++];
+ sp_av_find_input_format = (AV_FIND_INPUT_FORMAT) (intptr_t) symbols[i++];
+ sp_avformat_open_input = (AVFORMAT_OPEN_INPUT) (intptr_t) symbols[i++];
+ sp_av_dump_format = (AV_DUMP_FORMAT) (intptr_t) symbols[i++];
+ sp_av_read_frame = (AV_READ_FRAME) (intptr_t) symbols[i++];
+ sp_av_seek_frame = (AV_SEEK_FRAME) (intptr_t) symbols[i++];
+ sp_avformat_seek_file = (AVFORMAT_SEEK_FILE) (intptr_t) symbols[i++];
+ sp_av_read_play = (AV_READ_PLAY) (intptr_t) symbols[i++];
+ sp_av_read_pause = (AV_READ_PAUSE) (intptr_t) symbols[i++];
+ sp_avformat_network_init = (AVFORMAT_NETWORK_INIT) (intptr_t) symbols[i++];
+ sp_avformat_network_deinit = (AVFORMAT_NETWORK_DEINIT) (intptr_t) symbols[i++];
+ sp_avformat_find_stream_info = (AVFORMAT_FIND_STREAM_INFO) (intptr_t) symbols[i++];
+
+ sp_avdevice_register_all = (AVDEVICE_REGISTER_ALL) (intptr_t) symbols[i++];
+
+ sp_avresample_alloc_context = (AVRESAMPLE_ALLOC_CONTEXT) (intptr_t) symbols[i++];
+ sp_avresample_open = (AVRESAMPLE_OPEN) (intptr_t) symbols[i++];
+ sp_avresample_close = (AVRESAMPLE_CLOSE) (intptr_t) symbols[i++];
+ sp_avresample_free = (AVRESAMPLE_FREE) (intptr_t) symbols[i++];
+ sp_avresample_convert = (AVRESAMPLE_CONVERT) (intptr_t) symbols[i++];
+
+ sp_av_opt_set_sample_fmt = (AV_OPT_SET_SAMPLE_FMT) (intptr_t) symbols[i++];
+ sp_swr_alloc = (SWR_ALLOC) (intptr_t) symbols[i++];
+ sp_swr_init = (SWR_INIT) (intptr_t) symbols[i++];
+ sp_swr_free = (SWR_FREE) (intptr_t) symbols[i++];
+ sp_swr_convert = (SWR_CONVERT) (intptr_t) symbols[i++];
+
+ (*env)->ReleasePrimitiveArrayCritical(env, jSymbols, symbols, 0);
+
+ if(SYMBOL_COUNT != i) {
+ // boom
+ fprintf(stderr, "FFMPEGNatives.initSymbols0: Wrong symbol assignment count: Expected %d, Is %d\n",
+ SYMBOL_COUNT, i);
+ return JNI_FALSE;
+ }
+
+ #if LIBAVCODEC_VERSION_MAJOR >= 55
+ if(!HAS_FUNC(sp_avcodec_default_get_buffer2) ||
+ !HAS_FUNC(sp_av_frame_unref) ) {
+ fprintf(stderr, "avcodec >= 55: avcodec_default_get_buffer2 %p, av_frame_unref %p\n",
+ sp_avcodec_default_get_buffer2, sp_av_frame_unref);
+ return JNI_FALSE;
+ }
+ #else
+ if(!HAS_FUNC(sp_avcodec_default_get_buffer) ||
+ !HAS_FUNC(sp_avcodec_default_release_buffer)) {
+ fprintf(stderr, "avcodec < 55: avcodec_default_get_buffer %p, sp_avcodec_default_release_buffer %p\n",
+ sp_avcodec_default_get_buffer2, sp_avcodec_default_release_buffer);
+ return JNI_FALSE;
+ }
+ #endif
+
+ return JNI_TRUE;
+}
+
+static int _isAudioFormatSupported(JNIEnv *env, jobject ffmpegMediaPlayer, enum AVSampleFormat aSampleFmt, int32_t aSampleRate, int32_t aChannels) {
+ return JNI_TRUE == (*env)->CallBooleanMethod(env, ffmpegMediaPlayer, ffmpeg_jni_mid_isAudioFormatSupported, aSampleFmt, aSampleRate, aChannels);
+}
+static void _updateJavaAttributes(JNIEnv *env, FFMPEGToolBasicAV_t* pAV) {
+ if(NULL!=env) {
+ (*env)->CallVoidMethod(env, pAV->ffmpegMediaPlayer, ffmpeg_jni_mid_setupFFAttributes,
+ pAV->vid, pAV->vPixFmt, pAV->vBufferPlanes,
+ pAV->vBitsPerPixel, pAV->vBytesPerPixelPerPlane,
+ pAV->vTexWidth[0], pAV->vTexWidth[1], pAV->vTexWidth[2],
+ pAV->vWidth, pAV->vHeight,
+ pAV->aid, pAV->aSampleFmtOut, pAV->aSampleRateOut, pAV->aChannelsOut, pAV->aFrameSize);
+ (*env)->CallVoidMethod(env, pAV->ffmpegMediaPlayer, ffmpeg_jni_mid_updateAttributes,
+ pAV->vid, pAV->aid,
+ pAV->vWidth, pAV->vHeight,
+ pAV->bps_stream, pAV->bps_video, pAV->bps_audio,
+ pAV->fps, pAV->frames_video, pAV->frames_audio, pAV->duration,
+ (*env)->NewStringUTF(env, pAV->vcodec),
+ (*env)->NewStringUTF(env, pAV->acodec) );
+ }
+}
+static void _setIsGLOriented(JNIEnv *env, FFMPEGToolBasicAV_t* pAV) {
+ if(NULL!=env) {
+ (*env)->CallVoidMethod(env, pAV->ffmpegMediaPlayer, ffmpeg_jni_mid_setIsGLOriented, pAV->vFlipped);
+ }
+}
+
+static void freeInstance(JNIEnv *env, FFMPEGToolBasicAV_t* pAV) {
+ int i;
+ if(NULL != pAV) {
+ // Close the A resampler
+ if( NULL != pAV->avResampleCtx ) {
+ sp_avresample_free(&pAV->avResampleCtx);
+ pAV->avResampleCtx = NULL;
+ }
+ if( NULL != pAV->swResampleCtx ) {
+ sp_swr_free(&pAV->swResampleCtx);
+ pAV->swResampleCtx = NULL;
+ }
+ if( NULL != pAV->aResampleBuffer ) {
+ sp_av_free(pAV->aResampleBuffer);
+ pAV->aResampleBuffer = NULL;
+ }
+
+ // Close the V codec
+ if(NULL != pAV->pVCodecCtx) {
+ sp_avcodec_close(pAV->pVCodecCtx);
+ pAV->pVCodecCtx = NULL;
+ }
+ pAV->pVCodec=NULL;
+
+ // Close the A codec
+ if(NULL != pAV->pACodecCtx) {
+ sp_avcodec_close(pAV->pACodecCtx);
+ pAV->pACodecCtx = NULL;
+ }
+ pAV->pACodec=NULL;
+
+ // Close the frames
+ if(NULL != pAV->pVFrame) {
+ if(HAS_FUNC(sp_avcodec_free_frame)) {
+ sp_avcodec_free_frame(&pAV->pVFrame);
+ } else {
+ sp_av_free(pAV->pVFrame);
+ }
+ pAV->pVFrame = NULL;
+ }
+ if(NULL != pAV->pANIOBuffers) {
+ for(i=0; i<pAV->aFrameCount; i++) {
+ NIOBuffer_t * pNIOBuffer = &pAV->pANIOBuffers[i];
+ if( NULL != pNIOBuffer->nioRef ) {
+ if(pAV->verbose) {
+ fprintf(stderr, "A NIO: Free.X ptr %p / ref %p, %d bytes\n",
+ pNIOBuffer->origPtr, pNIOBuffer->nioRef, pNIOBuffer->size);
+ }
+ (*env)->DeleteGlobalRef(env, pNIOBuffer->nioRef);
+ }
+ }
+ free(pAV->pANIOBuffers);
+ pAV->pANIOBuffers = NULL;
+ }
+ if(NULL != pAV->pAFrames) {
+ for(i=0; i<pAV->aFrameCount; i++) {
+ if(HAS_FUNC(sp_avcodec_free_frame)) {
+ sp_avcodec_free_frame(&pAV->pAFrames[i]);
+ } else {
+ sp_av_free(pAV->pAFrames[i]);
+ }
+ }
+ free(pAV->pAFrames);
+ pAV->pAFrames = NULL;
+ }
+
+ // Close the video file
+ if(NULL != pAV->pFormatCtx) {
+ sp_avformat_close_input(&pAV->pFormatCtx);
+ // Only for output files!
+ // sp_avformat_free_context(pAV->pFormatCtx);
+ pAV->pFormatCtx = NULL;
+ }
+ if( NULL != pAV->ffmpegMediaPlayer ) {
+ (*env)->DeleteGlobalRef(env, pAV->ffmpegMediaPlayer);
+ pAV->ffmpegMediaPlayer = NULL;
+ }
+ free(pAV);
+ }
+}
+
+static int my_getPlaneCount(AVPixFmtDescriptor *pDesc) {
+ int i, p=-1;
+ for(i=pDesc->nb_components-1; i>=0; i--) {
+ int p0 = pDesc->comp[i].plane;
+ if( p < p0 ) {
+ p = p0;
+ }
+ }
+ return p+1;
+}
+
+#if 0
+static int my_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt) {
+ return sp_av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_HWACCEL;
+}
+
+static enum PixelFormat my_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt) {
+ int i=0;
+ enum PixelFormat f0, fR = PIX_FMT_NONE;
+ char buf[256];
+
+ fprintf(stderr, "get_format ****\n");
+ while (fmt[i] != PIX_FMT_NONE /* && ff_is_hwaccel_pix_fmt(fmt[i]) */) {
+ f0 = fmt[i];
+ if(fR==PIX_FMT_NONE && !my_is_hwaccel_pix_fmt(f0)) {
+ fR = f0;
+ }
+ sp_av_get_pix_fmt_string(buf, sizeof(buf), f0);
+ fprintf(stderr, "get_format %d: %d - %s - %s\n", i, f0, sp_av_get_pix_fmt_name(f0), buf);
+ ++i;
+ }
+ fprintf(stderr, "get_format %d - %s *** \n", fR, sp_av_get_pix_fmt_name(fR));
+ fflush(NULL);
+ return fR;
+}
+#endif
+
+JNIEXPORT jint JNICALL FF_FUNC(getAvUtilMajorVersionCC0)
+ (JNIEnv *env, jobject instance) {
+ return (jint) LIBAVUTIL_VERSION_MAJOR;
+}
+
+JNIEXPORT jint JNICALL FF_FUNC(getAvFormatMajorVersionCC0)
+ (JNIEnv *env, jobject instance) {
+ return (jint) LIBAVFORMAT_VERSION_MAJOR;
+}
+
+JNIEXPORT jint JNICALL FF_FUNC(getAvCodecMajorVersionCC0)
+ (JNIEnv *env, jobject instance) {
+ return (jint) LIBAVCODEC_VERSION_MAJOR;
+}
+
+JNIEXPORT jint JNICALL FF_FUNC(getAvResampleMajorVersionCC0)
+ (JNIEnv *env, jobject instance) {
+ return (jint) LIBAVRESAMPLE_VERSION_MAJOR;
+}
+
+JNIEXPORT jint JNICALL FF_FUNC(getSwResampleMajorVersionCC0)
+ (JNIEnv *env, jobject instance) {
+ return (jint) LIBSWRESAMPLE_VERSION_MAJOR;
+}
+
+JNIEXPORT jlong JNICALL FF_FUNC(createInstance0)
+ (JNIEnv *env, jobject instance, jobject ffmpegMediaPlayer, jboolean verbose)
+{
+ FFMPEGToolBasicAV_t * pAV = calloc(1, sizeof(FFMPEGToolBasicAV_t));
+ if(NULL==pAV) {
+ JoglCommon_throwNewRuntimeException(env, "Couldn't alloc instance");
+ return 0;
+ }
+ pAV->avcodecVersion = sp_avcodec_version();
+ pAV->avformatVersion = sp_avformat_version();
+ pAV->avutilVersion = sp_avutil_version();
+ if(HAS_FUNC(sp_avresample_version)) {
+ pAV->avresampleVersion = sp_avresample_version();
+ } else {
+ pAV->avresampleVersion = 0;
+ }
+ if(HAS_FUNC(sp_swresample_version)) {
+ pAV->swresampleVersion = sp_swresample_version();
+ } else {
+ pAV->swresampleVersion = 0;
+ }
+
+ #if LIBAVCODEC_VERSION_MAJOR >= 55
+ // TODO: We keep code on using 1 a/v frame per decoding cycle now.
+ // This is compatible w/ OpenAL's alBufferData(..)
+ // and w/ OpenGL's texture update command, both copy data immediatly.
+ // pAV->useRefCountedFrames = AV_HAS_API_REFCOUNTED_FRAMES(pAV);
+ pAV->useRefCountedFrames = 0;
+ #else
+ pAV->useRefCountedFrames = 0;
+ #endif
+
+ pAV->ffmpegMediaPlayer = (*env)->NewGlobalRef(env, ffmpegMediaPlayer);
+ pAV->verbose = verbose;
+ pAV->vid=AV_STREAM_ID_AUTO;
+ pAV->aid=AV_STREAM_ID_AUTO;
+
+ if(pAV->verbose) {
+ fprintf(stderr, "Info: Use avresample %d, swresample %d, device %d, refCount %d\n",
+ AV_HAS_API_AVRESAMPLE(pAV), AV_HAS_API_SWRESAMPLE(pAV), HAS_FUNC(sp_avdevice_register_all), pAV->useRefCountedFrames);
+ }
+ return (jlong) (intptr_t) pAV;
+}
+
+JNIEXPORT void JNICALL FF_FUNC(destroyInstance0)
+ (JNIEnv *env, jobject instance, jlong ptr)
+{
+ FFMPEGToolBasicAV_t *pAV = (FFMPEGToolBasicAV_t *)((void *)((intptr_t)ptr));
+ if (pAV != NULL) {
+ // stop assumed ..
+ freeInstance(env, pAV);
+ }
+}
+
+static uint64_t getDefaultAudioChannelLayout(int channelCount) {
+ switch(channelCount) {
+ case 1: return AV_CH_LAYOUT_MONO;
+ case 2: return AV_CH_LAYOUT_STEREO;
+ case 3: return AV_CH_LAYOUT_SURROUND;
+ case 4: return AV_CH_LAYOUT_QUAD;
+ case 5: return AV_CH_LAYOUT_5POINT0;
+ case 6: return AV_CH_LAYOUT_5POINT1;
+ case 7: return AV_CH_LAYOUT_6POINT1;
+ case 8: return AV_CH_LAYOUT_7POINT1;
+ default: return AV_CH_LAYOUT_NATIVE;
+ }
+}
+
+static void initPTSStats(PTSStats *ptsStats);
+static int64_t evalPTS(PTSStats *ptsStats, int64_t inPTS, int64_t inDTS);
+
+static AVInputFormat* tryAVInputFormat(const char * name, int verbose) {
+ AVInputFormat* inFmt = sp_av_find_input_format(name);
+ if( verbose) {
+ if ( NULL == inFmt ) {
+ fprintf(stderr, "Warning: Could not find input format '%s'\n", name);
+ } else {
+ fprintf(stderr, "Info: Found input format '%s'\n", name);
+ }
+ }
+ return inFmt;
+}
+static const char * inFmtNames[] = {
+ "video4linux2", // linux
+ "video4linux", // linux (old)
+ "dshow", // windows
+ "vfwcap", // windows (old)
+ "mpg",
+ "yuv2",
+ "mjpeg",
+ "avi",
+ "wmv",
+ "libx264",
+ "h264",
+ "mpegts"
+};
+static AVInputFormat* findAVInputFormat(int verbose) {
+ AVInputFormat* inFmt = NULL;
+ const char *inFmtName;
+ int i=0;
+ do {
+ inFmtName = inFmtNames[i++];
+ if( NULL == inFmtName ) {
+ break;
+ }
+ inFmt = tryAVInputFormat(inFmtName, verbose);
+ } while ( NULL == inFmt );
+ return inFmt;
+}
+
+#if 0
+static void getAlignedLinesizes(AVCodecContext *avctx, int linesize[/*4*/]) {
+ int stride_align[AV_NUM_DATA_POINTERS];
+ int w = avctx->width;
+ int h = avctx->height;
+ int unaligned;
+ int i;
+
+ sp_avcodec_align_dimensions2(avctx, &w, &h, stride_align);
+
+ if (!(avctx->flags & CODEC_FLAG_EMU_EDGE)) {
+ int edge_width = sp_avcodec_get_edge_width();
+ w += edge_width * 2;
+ h += edge_width * 2;
+ }
+
+ do {
+ // Get alignment for all planes (-> YUVP .. etc)
+ sp_av_image_fill_linesizes(linesize, avctx->pix_fmt, w);
+ // increase alignment of w for next try (rhs gives the lowest bit set in w)
+ w += w & ~(w - 1);
+
+ unaligned = 0;
+ for (i = 0; i < 4; i++)
+ unaligned |= linesize[i] % stride_align[i];
+ } while (unaligned);
+}
+#endif
+
+JNIEXPORT void JNICALL FF_FUNC(setStream0)
+ (JNIEnv *env, jobject instance, jlong ptr, jstring jURL, jboolean jIsCameraInput,
+ jint vid, jstring jSizeS, jint vWidth, jint vHeight, jint vRate,
+ jint aid, jint aMaxChannelCount, jint aPrefSampleRate)
+{
+ char cameraName[256];
+ int res, i;
+ jboolean iscopy;
+ FFMPEGToolBasicAV_t *pAV = (FFMPEGToolBasicAV_t *)(intptr_t)ptr;
+
+ if (pAV == NULL) {
+ JoglCommon_throwNewRuntimeException(env, "NULL AV ptr");
+ return;
+ }
+
+ // Register all formats and codecs
+ sp_avcodec_register_all();
+ if( jIsCameraInput && HAS_FUNC(sp_avdevice_register_all) ) {
+ sp_avdevice_register_all();
+ }
+ sp_av_register_all();
+ // Network too ..
+ if(HAS_FUNC(sp_avformat_network_init)) {
+ sp_avformat_network_init();
+ }
+
+ pAV->pFormatCtx = sp_avformat_alloc_context();
+
+ const char *urlPath = (*env)->GetStringUTFChars(env, jURL, &iscopy);
+ const char *filename = urlPath; // allow changing path for camera ..
+
+ // Open video file
+ AVDictionary *inOpts = NULL;
+ AVInputFormat* inFmt = NULL;
+ if( jIsCameraInput ) {
+ char buffer[256];
+ inFmt = findAVInputFormat(pAV->verbose);
+ if( NULL == inFmt ) {
+ JoglCommon_throwNewRuntimeException(env, "Couldn't find input format for camera: %s", urlPath);
+ (*env)->ReleaseStringChars(env, jURL, (const jchar *)urlPath);
+ return;
+ }
+ if(pAV->verbose) {
+ fprintf(stderr, "Camera: Format: %s (%s)\n", inFmt->long_name, inFmt->name);
+ }
+ if( 0 == strncmp(inFmt->name, "dshow", 255) ) {
+ int devIdx = atoi(urlPath);
+ strncpy(cameraName, "video=", sizeof(cameraName));
+ res = findDShowVideoDevice(cameraName+6, sizeof(cameraName)-6, devIdx, pAV->verbose);
+ if( 0 == res ) {
+ if(pAV->verbose) {
+ fprintf(stderr, "Camera %d found: %s\n", devIdx, cameraName);
+ }
+ filename = cameraName;
+ } else if(pAV->verbose) {
+ fprintf(stderr, "Camera %d not found\n", devIdx);
+ }
+ }
+
+ const char *sizeS = NULL != jSizeS ? (*env)->GetStringUTFChars(env, jSizeS, &iscopy) : NULL;
+ int hasSize = 0;
+ if( NULL != sizeS ) {
+ snprintf(buffer, sizeof(buffer), "%s", sizeS);
+ (*env)->ReleaseStringChars(env, jSizeS, (const jchar *)sizeS);
+ hasSize = 1;
+ } else if( vWidth > 0 && vHeight > 0 ) {
+ snprintf(buffer, sizeof(buffer), "%dx%d", vWidth, vHeight);
+ hasSize = 1;
+ }
+ if( hasSize ) {
+ if(pAV->verbose) {
+ fprintf(stderr, "Camera: Size: %s\n", buffer);
+ }
+ sp_av_dict_set(&inOpts, "video_size", buffer, 0);
+ }
+ if( vRate > 0 ) {
+ snprintf(buffer, sizeof(buffer), "%d", vRate);
+ if(pAV->verbose) {
+ fprintf(stderr, "Camera: FPS: %s\n", buffer);
+ }
+ sp_av_dict_set(&inOpts, "framerate", buffer, 0);
+ }
+ }
+ res = sp_avformat_open_input(&pAV->pFormatCtx, filename, inFmt, NULL != inOpts ? &inOpts : NULL);
+ if( NULL != inOpts ) {
+ sp_av_dict_free(&inOpts);
+ }
+ if(res != 0) {
+ JoglCommon_throwNewRuntimeException(env, "Couldn't open URI: %s [%dx%d @ %d hz], err %d", filename, vWidth, vHeight, vRate, res);
+ (*env)->ReleaseStringChars(env, jURL, (const jchar *)urlPath);
+ return;
+ }
+
+ // Retrieve detailed stream information
+ if(sp_avformat_find_stream_info(pAV->pFormatCtx, NULL)<0) {
+ (*env)->ReleaseStringChars(env, jURL, (const jchar *)urlPath);
+ JoglCommon_throwNewRuntimeException(env, "Couldn't find stream information");
+ return;
+ }
+
+ if(pAV->verbose) {
+ // Dump information about file onto standard error
+ sp_av_dump_format(pAV->pFormatCtx, 0, filename, JNI_FALSE);
+ }
+ (*env)->ReleaseStringChars(env, jURL, (const jchar *)urlPath);
+
+
+ // FIXME: Libav Binary compatibility! JAU01
+ if (pAV->pFormatCtx->duration != AV_NOPTS_VALUE) {
+ pAV->duration = pAV->pFormatCtx->duration / AV_TIME_BASE_MSEC;
+ }
+ if (pAV->pFormatCtx->start_time != AV_NOPTS_VALUE) {
+ pAV->start_time = pAV->pFormatCtx->start_time / AV_TIME_BASE_MSEC;
+ }
+ if (pAV->pFormatCtx->bit_rate) {
+ pAV->bps_stream = pAV->pFormatCtx->bit_rate;
+ }
+
+ if(pAV->verbose) {
+ fprintf(stderr, "Streams: %d, req vid %d aid %d\n", pAV->pFormatCtx->nb_streams, vid, aid);
+ }
+
+ // Find the first audio and video stream, or the one matching vid
+ // FIXME: Libav Binary compatibility! JAU01
+ for(i=0; ( AV_STREAM_ID_AUTO==pAV->aid || AV_STREAM_ID_AUTO==pAV->vid ) && i<pAV->pFormatCtx->nb_streams; i++) {
+ AVStream *st = pAV->pFormatCtx->streams[i];
+ if(pAV->verbose) {
+ fprintf(stderr, "Stream: %d: is-video %d, is-audio %d\n", i, (AVMEDIA_TYPE_VIDEO == st->codec->codec_type), AVMEDIA_TYPE_AUDIO == st->codec->codec_type);
+ }
+ if(AVMEDIA_TYPE_VIDEO == st->codec->codec_type) {
+ if(AV_STREAM_ID_AUTO==pAV->vid && (AV_STREAM_ID_AUTO==vid || vid == i) ) {
+ pAV->pVStream = st;
+ pAV->vid=i;
+ }
+ } else if(AVMEDIA_TYPE_AUDIO == st->codec->codec_type) {
+ if(AV_STREAM_ID_AUTO==pAV->aid && (AV_STREAM_ID_AUTO==aid || aid == i) ) {
+ pAV->pAStream = st;
+ pAV->aid=i;
+ }
+ }
+ }
+ if( AV_STREAM_ID_AUTO == pAV->aid ) {
+ pAV->aid = AV_STREAM_ID_NONE;
+ }
+ if( AV_STREAM_ID_AUTO == pAV->vid ) {
+ pAV->vid = AV_STREAM_ID_NONE;
+ }
+
+ if( pAV->verbose ) {
+ fprintf(stderr, "Found vid %d, aid %d\n", pAV->vid, pAV->aid);
+ }
+
+ if(0<=pAV->aid) {
+ AVFrame * pAFrame0 = sp_avcodec_alloc_frame();
+ if( NULL == pAFrame0 ) {
+ JoglCommon_throwNewRuntimeException(env, "Couldn't alloc 1st audio frame\n");
+ return;
+ }
+
+ // Get a pointer to the codec context for the audio stream
+ // FIXME: Libav Binary compatibility! JAU01
+ pAV->pACodecCtx=pAV->pAStream->codec;
+
+ // FIXME: Libav Binary compatibility! JAU01
+ if (pAV->pACodecCtx->bit_rate) {
+ pAV->bps_audio = pAV->pACodecCtx->bit_rate;
+ }
+
+ // Customize ..
+ // pAV->pACodecCtx->thread_count=2;
+ // pAV->pACodecCtx->thread_type=FF_THREAD_FRAME|FF_THREAD_SLICE; // Decode more than one frame at once
+ pAV->pACodecCtx->thread_count=0;
+ pAV->pACodecCtx->thread_type=0;
+ pAV->pACodecCtx->workaround_bugs=FF_BUG_AUTODETECT;
+ pAV->pACodecCtx->skip_frame=AVDISCARD_DEFAULT;
+
+ // Note: OpenAL well supports n-channel by now (SOFT),
+ // however - AFAIK AV_SAMPLE_FMT_S16 would allow no conversion!
+ pAV->pACodecCtx->request_sample_fmt=AV_SAMPLE_FMT_S16;
+ if( 1 <= aMaxChannelCount && aMaxChannelCount <= 2 ) {
+ pAV->pACodecCtx->request_channel_layout=getDefaultAudioChannelLayout(aMaxChannelCount);
+ #if LIBAVCODEC_VERSION_MAJOR < 54
+ /** Until 55.0.0, but stopped working w/ 54 already :( */
+ pAV->pACodecCtx->request_channels=aMaxChannelCount;
+ #endif
+ }
+ pAV->pACodecCtx->skip_frame=AVDISCARD_DEFAULT;
+
+ sp_avcodec_string(pAV->acodec, sizeof(pAV->acodec), pAV->pACodecCtx, 0);
+
+ // Find the decoder for the audio stream
+ pAV->pACodec=sp_avcodec_find_decoder(pAV->pACodecCtx->codec_id);
+ if(pAV->pACodec==NULL) {
+ JoglCommon_throwNewRuntimeException(env, "Couldn't find audio codec %d, %s", pAV->pACodecCtx->codec_id, pAV->acodec);
+ return;
+ }
+
+ // Open codec
+ #if LIBAVCODEC_VERSION_MAJOR >= 55
+ pAV->pACodecCtx->refcounted_frames = pAV->useRefCountedFrames;
+ #endif
+ res = sp_avcodec_open2(pAV->pACodecCtx, pAV->pACodec, NULL);
+ if(res<0) {
+ JoglCommon_throwNewRuntimeException(env, "Couldn't open audio codec %d, %s", pAV->pACodecCtx->codec_id, pAV->acodec);
+ return;
+ }
+ if (!pAV->pACodecCtx->channel_layout) {
+ pAV->pACodecCtx->channel_layout = getDefaultAudioChannelLayout(pAV->pACodecCtx->channels);
+ }
+ if (!pAV->pACodecCtx->channel_layout) {
+ JoglCommon_throwNewRuntimeException(env, "Couldn't determine channel layout of %d channels\n", pAV->pACodecCtx->channels);
+ return;
+ }
+ pAV->aSampleRate = pAV->pACodecCtx->sample_rate;
+ pAV->aChannels = pAV->pACodecCtx->channels;
+ pAV->aFrameSize = pAV->pACodecCtx->frame_size; // in samples per channel!
+ pAV->aSampleFmt = pAV->pACodecCtx->sample_fmt;
+ pAV->frames_audio = pAV->pAStream->nb_frames;
+ pAV->aSinkSupport = _isAudioFormatSupported(env, pAV->ffmpegMediaPlayer, pAV->aSampleFmt, pAV->aSampleRate, pAV->aChannels);
+ if( pAV->verbose ) {
+ fprintf(stderr, "A channels %d [l %"PRId64"], sample_rate %d, frame_size %d, frame_number %d, [afps %f, rfps %f, cfps %f, sfps %f], nb_frames %"PRId64", [maxChan %d, prefRate %d, req_chan_layout %"PRId64", req_chan %d], sink-support %d \n",
+ pAV->aChannels, pAV->pACodecCtx->channel_layout, pAV->aSampleRate, pAV->aFrameSize, pAV->pACodecCtx->frame_number,
+ my_av_q2f(pAV->pAStream->avg_frame_rate),
+ #if LIBAVCODEC_VERSION_MAJOR < 55
+ my_av_q2f(pAV->pVStream->r_frame_rate),
+ #else
+ 0.0f,
+ #endif
+ my_av_q2f_r(pAV->pAStream->codec->time_base),
+ my_av_q2f_r(pAV->pAStream->time_base),
+ pAV->pAStream->nb_frames,
+ aMaxChannelCount, aPrefSampleRate, pAV->pACodecCtx->request_channel_layout,
+ #if LIBAVCODEC_VERSION_MAJOR < 54
+ pAV->pACodecCtx->request_channels,
+ #else
+ 0,
+ #endif
+ pAV->aSinkSupport);
+ }
+
+ // default
+ pAV->aSampleFmtOut = pAV->aSampleFmt;
+ pAV->aChannelsOut = pAV->aChannels;
+ pAV->aSampleRateOut = pAV->aSampleRate;
+
+ if( ( AV_HAS_API_AVRESAMPLE(pAV) || AV_HAS_API_SWRESAMPLE(pAV) ) &&
+ ( pAV->aSampleFmt != AV_SAMPLE_FMT_S16 ||
+ ( 0 != aPrefSampleRate && pAV->aSampleRate != aPrefSampleRate ) ||
+ !pAV->aSinkSupport ) ) {
+
+ if( 0 == aPrefSampleRate ) {
+ aPrefSampleRate = pAV->aSampleRate;
+ }
+ int32_t aSinkSupport = 0;
+ enum AVSampleFormat aSampleFmtOut = AV_SAMPLE_FMT_S16;
+ int32_t aChannelsOut;
+ int32_t aSampleRateOut;
+ int32_t minChannelCount = MIN_INT(aMaxChannelCount,pAV->pACodecCtx->channels);
+
+ if( _isAudioFormatSupported(env, pAV->ffmpegMediaPlayer, aSampleFmtOut, aPrefSampleRate, pAV->pACodecCtx->channels) ) {
+ aChannelsOut = pAV->pACodecCtx->channels;
+ aSampleRateOut = aPrefSampleRate;
+ aSinkSupport = 1;
+ } else if( _isAudioFormatSupported(env, pAV->ffmpegMediaPlayer, aSampleFmtOut, aPrefSampleRate, minChannelCount) ) {
+ aChannelsOut = minChannelCount;
+ aSampleRateOut = aPrefSampleRate;
+ aSinkSupport = 1;
+ }
+
+ if( aSinkSupport ) {
+ if( AV_HAS_API_AVRESAMPLE(pAV) ) {
+ pAV->avResampleCtx = sp_avresample_alloc_context();
+ sp_av_opt_set_int(pAV->avResampleCtx, "in_channel_layout", pAV->pACodecCtx->channel_layout, 0);
+ sp_av_opt_set_int(pAV->avResampleCtx, "out_channel_layout", getDefaultAudioChannelLayout(aChannelsOut), 0);
+ sp_av_opt_set_int(pAV->avResampleCtx, "in_sample_rate", pAV->aSampleRate, 0);
+ sp_av_opt_set_int(pAV->avResampleCtx, "out_sample_rate", aSampleRateOut, 0);
+ sp_av_opt_set_int(pAV->avResampleCtx, "in_sample_fmt", pAV->aSampleFmt, 0);
+ sp_av_opt_set_int(pAV->avResampleCtx, "out_sample_fmt", aSampleFmtOut, 0);
+
+ if ( sp_avresample_open(pAV->avResampleCtx) < 0 ) {
+ sp_avresample_free(&pAV->avResampleCtx);
+ pAV->avResampleCtx = NULL;
+ fprintf(stderr, "error initializing avresample ctx\n");
+ } else {
+ // OK
+ pAV->aSampleFmtOut = aSampleFmtOut;
+ pAV->aChannelsOut = aChannelsOut;
+ pAV->aSampleRateOut = aSampleRateOut;
+ pAV->aSinkSupport = 1;
+ }
+ } else if( AV_HAS_API_SWRESAMPLE(pAV) ) {
+ pAV->swResampleCtx = sp_swr_alloc();
+ sp_av_opt_set_int(pAV->swResampleCtx, "in_channel_layout", pAV->pACodecCtx->channel_layout, 0);
+ sp_av_opt_set_int(pAV->swResampleCtx, "out_channel_layout", getDefaultAudioChannelLayout(aChannelsOut), 0);
+ sp_av_opt_set_int(pAV->swResampleCtx, "in_sample_rate", pAV->aSampleRate, 0);
+ sp_av_opt_set_int(pAV->swResampleCtx, "out_sample_rate", aSampleRateOut, 0);
+ sp_av_opt_set_sample_fmt(pAV->swResampleCtx, "in_sample_fmt", pAV->aSampleFmt, 0);
+ sp_av_opt_set_sample_fmt(pAV->swResampleCtx, "out_sample_fmt", aSampleFmtOut, 0);
+
+ if ( sp_swr_init(pAV->swResampleCtx) < 0 ) {
+ sp_swr_free(&pAV->swResampleCtx);
+ pAV->swResampleCtx = NULL;
+ fprintf(stderr, "error initializing swresample ctx\n");
+ } else {
+ // OK
+ pAV->aSampleFmtOut = aSampleFmtOut;
+ pAV->aChannelsOut = aChannelsOut;
+ pAV->aSampleRateOut = aSampleRateOut;
+ pAV->aSinkSupport = 1;
+ }
+ }
+ }
+ }
+
+ // Allocate audio frames
+ // FIXME: Libav Binary compatibility! JAU01
+ pAV->aFrameCount = 1;
+ pAV->pANIOBuffers = calloc(pAV->aFrameCount, sizeof(NIOBuffer_t));
+ pAV->pAFrames = calloc(pAV->aFrameCount, sizeof(AVFrame*));
+ pAV->pAFrames[0] = pAFrame0;
+ for(i=1; i<pAV->aFrameCount; i++) {
+ pAV->pAFrames[i] = sp_avcodec_alloc_frame();
+ if( NULL == pAV->pAFrames[i] ) {
+ JoglCommon_throwNewRuntimeException(env, "Couldn't alloc audio frame %d / %d", i, pAV->aFrameCount);
+ return;
+ }
+ }
+ pAV->aFrameCurrent = 0;
+ }
+
+ if(0<=pAV->vid) {
+ // Get a pointer to the codec context for the video stream
+ // FIXME: Libav Binary compatibility! JAU01
+ pAV->pVCodecCtx=pAV->pVStream->codec;
+ #if 0
+ pAV->pVCodecCtx->get_format = my_get_format;
+ #endif
+
+ if (pAV->pVCodecCtx->bit_rate) {
+ // FIXME: Libav Binary compatibility! JAU01
+ pAV->bps_video = pAV->pVCodecCtx->bit_rate;
+ }
+
+ // Customize ..
+ // pAV->pVCodecCtx->thread_count=2;
+ // pAV->pVCodecCtx->thread_type=FF_THREAD_FRAME|FF_THREAD_SLICE; // Decode more than one frame at once
+ pAV->pVCodecCtx->thread_count=0;
+ pAV->pVCodecCtx->thread_type=0;
+ pAV->pVCodecCtx->workaround_bugs=FF_BUG_AUTODETECT;
+ pAV->pVCodecCtx->skip_frame=AVDISCARD_DEFAULT;
+
+ sp_avcodec_string(pAV->vcodec, sizeof(pAV->vcodec), pAV->pVCodecCtx, 0);
+
+ // Find the decoder for the video stream
+ pAV->pVCodec=sp_avcodec_find_decoder(pAV->pVCodecCtx->codec_id);
+ if(pAV->pVCodec==NULL) {
+ JoglCommon_throwNewRuntimeException(env, "Couldn't find video codec %d, %s", pAV->pVCodecCtx->codec_id, pAV->vcodec);
+ return;
+ }
+
+ // Open codec
+ #if LIBAVCODEC_VERSION_MAJOR >= 55
+ pAV->pVCodecCtx->refcounted_frames = pAV->useRefCountedFrames;
+ #endif
+ res = sp_avcodec_open2(pAV->pVCodecCtx, pAV->pVCodec, NULL);
+ if(res<0) {
+ JoglCommon_throwNewRuntimeException(env, "Couldn't open video codec %d, %s", pAV->pVCodecCtx->codec_id, pAV->vcodec);
+ return;
+ }
+
+ // Hack to correct wrong frame rates that seem to be generated by some codecs
+ // FIXME: Libav Binary compatibility! JAU01
+ if(pAV->pVCodecCtx->time_base.num>1000 && pAV->pVCodecCtx->time_base.den==1) {
+ pAV->pVCodecCtx->time_base.den=1000;
+ }
+ // FIXME: Libav Binary compatibility! JAU01
+ if( pAV->pVStream->avg_frame_rate.den && pAV->pVStream->avg_frame_rate.num ) {
+ pAV->fps = my_av_q2f(pAV->pVStream->avg_frame_rate);
+ #if LIBAVCODEC_VERSION_MAJOR < 55
+ } else if( pAV->pVStream->r_frame_rate.den && pAV->pVStream->r_frame_rate.num ) {
+ pAV->fps = my_av_q2f(pAV->pVStream->r_frame_rate);
+ #endif
+ } else if( pAV->pVStream->codec->time_base.den && pAV->pVStream->codec->time_base.num ) {
+ pAV->fps = my_av_q2f_r(pAV->pVStream->codec->time_base);
+ } else if( pAV->pVStream->time_base.den && pAV->pVStream->time_base.num ) {
+ pAV->fps = my_av_q2f_r(pAV->pVStream->time_base);
+ } else {
+ pAV->fps = 0.0f; // duh!
+ }
+ pAV->frames_video = pAV->pVStream->nb_frames;
+
+ // Allocate video frame
+ // FIXME: Libav Binary compatibility! JAU01
+ pAV->vWidth = pAV->pVCodecCtx->width;
+ pAV->vHeight = pAV->pVCodecCtx->height;
+ pAV->vPixFmt = pAV->pVCodecCtx->pix_fmt;
+ pAV->vFlipped = JNI_FALSE;
+ {
+ AVPixFmtDescriptor pixDesc = sp_av_pix_fmt_descriptors[pAV->vPixFmt];
+ pAV->vBitsPerPixel = sp_av_get_bits_per_pixel(&pixDesc);
+ pAV->vBufferPlanes = my_getPlaneCount(&pixDesc);
+ }
+
+ if( pAV->verbose ) {
+ fprintf(stderr, "V frame_size %d, frame_number %d, [afps %f, rfps %f, cfps %f, sfps %f] -> %f fps, nb_frames %"PRId64", size %dx%d, fmt 0x%X, bpp %d, planes %d, codecCaps 0x%X\n",
+ pAV->pVCodecCtx->frame_size, pAV->pVCodecCtx->frame_number,
+ my_av_q2f(pAV->pVStream->avg_frame_rate),
+ #if LIBAVCODEC_VERSION_MAJOR < 55
+ my_av_q2f(pAV->pVStream->r_frame_rate),
+ #else
+ 0.0f,
+ #endif
+ my_av_q2f_r(pAV->pVStream->codec->time_base),
+ my_av_q2f_r(pAV->pVStream->time_base),
+ pAV->fps,
+ pAV->pVStream->nb_frames,
+ pAV->vWidth, pAV->vHeight, pAV->vPixFmt, pAV->vBitsPerPixel, pAV->vBufferPlanes, pAV->pVCodecCtx->codec->capabilities);
+ }
+
+ pAV->pVFrame=sp_avcodec_alloc_frame();
+ if( pAV->pVFrame == NULL ) {
+ JoglCommon_throwNewRuntimeException(env, "Couldn't alloc video frame");
+ return;
+ }
+ // Min. requirement for 'get_buffer2' !
+ pAV->pVFrame->width = pAV->pVCodecCtx->width;
+ pAV->pVFrame->height = pAV->pVCodecCtx->height;
+ pAV->pVFrame->format = pAV->pVCodecCtx->pix_fmt;
+ #if LIBAVCODEC_VERSION_MAJOR >= 55
+ res = sp_avcodec_default_get_buffer2(pAV->pVCodecCtx, pAV->pVFrame, 0);
+ #else
+ res = sp_avcodec_default_get_buffer(pAV->pVCodecCtx, pAV->pVFrame);
+ #endif
+ if(0!=res) {
+ JoglCommon_throwNewRuntimeException(env, "Couldn't peek video buffer dimension");
+ return;
+ }
+ {
+ const int32_t bytesPerPixel = ( pAV->vBitsPerPixel + 7 ) / 8 ;
+ if(1 == pAV->vBufferPlanes) {
+ pAV->vBytesPerPixelPerPlane = bytesPerPixel;
+ } else {
+ pAV->vBytesPerPixelPerPlane = 1;
+ }
+ int32_t vLinesize[4];
+ if( pAV->vBufferPlanes > 1 ) {
+ #if 0
+ getAlignedLinesizes(pAV->pVCodecCtx, vLinesize);
+ for(i=0; i<pAV->vBufferPlanes; i++) {
+ // FIXME: Libav Binary compatibility! JAU01
+ pAV->vTexWidth[i] = vLinesize[i] / pAV->vBytesPerPixelPerPlane ;
+ }
+ #else
+ for(i=0; i<pAV->vBufferPlanes; i++) {
+ // FIXME: Libav Binary compatibility! JAU01
+ vLinesize[i] = pAV->pVFrame->linesize[i];
+ pAV->vTexWidth[i] = vLinesize[i] / pAV->vBytesPerPixelPerPlane ;
+ }
+ #endif
+ } else {
+ vLinesize[0] = pAV->pVFrame->linesize[0];
+ if( pAV->vPixFmt == PIX_FMT_YUYV422 ) {
+ // Stuff 2x 16bpp (YUYV) into one RGBA pixel!
+ pAV->vTexWidth[0] = pAV->pVCodecCtx->width / 2;
+ } else {
+ pAV->vTexWidth[0] = pAV->pVCodecCtx->width;
+ }
+ }
+ if( pAV->verbose ) {
+ for(i=0; i<pAV->vBufferPlanes; i++) {
+ fprintf(stderr, "Video: P[%d]: %d texw * %d bytesPP -> %d line\n", i, pAV->vTexWidth[i], pAV->vBytesPerPixelPerPlane, vLinesize[i]);
+ }
+ }
+ }
+ #if LIBAVCODEC_VERSION_MAJOR >= 55
+ sp_av_frame_unref(pAV->pVFrame);
+ #else
+ sp_avcodec_default_release_buffer(pAV->pVCodecCtx, pAV->pVFrame);
+ #endif
+ }
+ pAV->vPTS=0;
+ pAV->aPTS=0;
+ initPTSStats(&pAV->vPTSStats);
+ initPTSStats(&pAV->aPTSStats);
+ _updateJavaAttributes(env, pAV);
+}
+
+JNIEXPORT void JNICALL FF_FUNC(setGLFuncs0)
+ (JNIEnv *env, jobject instance, jlong ptr, jlong jProcAddrGLTexSubImage2D, jlong jProcAddrGLGetError, jlong jProcAddrGLFlush, jlong jProcAddrGLFinish)
+{
+ FFMPEGToolBasicAV_t *pAV = (FFMPEGToolBasicAV_t *)((void *)((intptr_t)ptr));
+ pAV->procAddrGLTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC) (intptr_t)jProcAddrGLTexSubImage2D;
+ pAV->procAddrGLGetError = (PFNGLGETERRORPROC) (intptr_t)jProcAddrGLGetError;
+ pAV->procAddrGLFlush = (PFNGLFLUSH) (intptr_t)jProcAddrGLFlush;
+ pAV->procAddrGLFinish = (PFNGLFINISH) (intptr_t)jProcAddrGLFinish;
+}
+
+#if 0
+#define DBG_TEXSUBIMG2D_a(c,p,w1,w2,h,i) fprintf(stderr, "TexSubImage2D.%c offset %d / %d, size %d x %d, ", c, (w1*p->pVCodecCtx->width)/w2, p->pVCodecCtx->height/h, p->vTexWidth[i], p->pVCodecCtx->height/h)
+#define DBG_TEXSUBIMG2D_b(p) fprintf(stderr, "err 0x%X\n", pAV->procAddrGLGetError())
+#else
+#define DBG_TEXSUBIMG2D_a(c,p,w1,w2,h,i)
+#define DBG_TEXSUBIMG2D_b(p)
+#endif
+
+JNIEXPORT jint JNICALL FF_FUNC(readNextPacket0)
+ (JNIEnv *env, jobject instance, jlong ptr, jint texTarget, jint texFmt, jint texType)
+{
+ FFMPEGToolBasicAV_t *pAV = (FFMPEGToolBasicAV_t *)((void *)((intptr_t)ptr));
+
+ AVPacket packet;
+ jint resPTS = INVALID_PTS;
+ uint8_t * pkt_odata;
+ int pkt_osize;
+
+ packet.data = NULL; // minimum
+ packet.size = 0; // requirement
+ sp_av_init_packet(&packet);
+
+ const int avRes = sp_av_read_frame(pAV->pFormatCtx, &packet);
+ pkt_odata = packet.data;
+ pkt_osize = packet.size;
+ if( AVERROR_EOF == avRes || ( pAV->pFormatCtx->pb && pAV->pFormatCtx->pb->eof_reached ) ) {
+ resPTS = END_OF_STREAM_PTS;
+ } else if( 0 <= avRes ) {
+ if( pAV->verbose ) {
+ fprintf(stderr, "P: ptr %p, size %d\n", packet.data, packet.size);
+ }
+ if(packet.stream_index==pAV->aid) {
+ // Decode audio frame
+ if(NULL == pAV->pAFrames) { // no audio registered
+ sp_av_free_packet(&packet);
+ return INVALID_PTS;
+ }
+ int frameCount;
+ int flush_complete = 0;
+ for ( frameCount=0; 0 < packet.size || 0 == frameCount; frameCount++ ) {
+ int frameDecoded;
+ int len1;
+ AVFrame* pAFrameCurrent = pAV->pAFrames[pAV->aFrameCurrent];
+ if( pAV->useRefCountedFrames ) {
+ sp_av_frame_unref(pAFrameCurrent);
+ pAV->aFrameCurrent = ( pAV->aFrameCurrent + 1 ) % pAV->aFrameCount ;
+ }
+ sp_avcodec_get_frame_defaults(pAFrameCurrent);
+
+ if (flush_complete) {
+ break;
+ }
+ len1 = sp_avcodec_decode_audio4(pAV->pACodecCtx, pAFrameCurrent, &frameDecoded, &packet);
+ if (len1 < 0) {
+ // if error, we skip the frame
+ packet.size = 0;
+ break;
+ }
+ packet.data += len1;
+ packet.size -= len1;
+
+ if (!frameDecoded) {
+ // stop sending empty packets if the decoder is finished
+ if (!packet.data && pAV->pACodecCtx->codec->capabilities & CODEC_CAP_DELAY) {
+ flush_complete = 1;
+ }
+ continue;
+ }
+
+ int32_t data_size = 0;
+ if(HAS_FUNC(sp_av_samples_get_buffer_size)) {
+ data_size = sp_av_samples_get_buffer_size(NULL /* linesize, may be NULL */,
+ pAV->aChannels,
+ pAFrameCurrent->nb_samples,
+ pAFrameCurrent->format,
+ 1 /* align */);
+ }
+ #if 0
+ fprintf(stderr, "channels %d sample_rate %d \n", pAV->aChannels , pAV->aSampleRate);
+ fprintf(stderr, "data %d \n", pAV->aFrameSize);
+ #endif
+
+ const AVRational time_base = pAV->pAStream->time_base;
+ const int64_t pkt_pts = pAFrameCurrent->pkt_pts;
+ if( 0 == frameCount && AV_NOPTS_VALUE != pkt_pts ) { // 1st frame only, discard invalid PTS ..
+ pAV->aPTS = my_av_q2i32( pkt_pts * 1000, time_base);
+ } else { // subsequent frames or invalid PTS ..
+ const int32_t bytesPerSample = sp_av_get_bytes_per_sample( pAV->pACodecCtx->sample_fmt );
+ pAV->aPTS += data_size / ( pAV->aChannels * bytesPerSample * ( pAV->aSampleRate / 1000 ) );
+ }
+ if( pAV->verbose ) {
+ int32_t aDTS = my_av_q2i32( pAFrameCurrent->pkt_dts * 1000, time_base);
+
+ fprintf(stderr, "A pts %d [pkt_pts %"PRId64"], dts %d [pkt_dts %"PRId64"], f# %d, aFrame %d/%d %p, dataPtr %p, dataSize %d\n",
+ pAV->aPTS, pkt_pts, aDTS, pAFrameCurrent->pkt_dts, frameCount,
+ pAV->aFrameCurrent, pAV->aFrameCount, pAFrameCurrent, pAFrameCurrent->data[0], data_size);
+ }
+ if( NULL != env ) {
+ void* data_ptr = pAFrameCurrent->data[0]; // default
+
+ if( NULL != pAV->avResampleCtx || NULL != pAV->swResampleCtx ) {
+ uint8_t *tmp_out;
+ int out_samples=-1, out_size, out_linesize;
+ int osize = sp_av_get_bytes_per_sample( pAV->aSampleFmtOut );
+ int nb_samples = pAFrameCurrent->nb_samples;
+
+ out_size = sp_av_samples_get_buffer_size(&out_linesize,
+ pAV->aChannelsOut,
+ nb_samples,
+ pAV->aSampleFmtOut, 0 /* align */);
+
+ tmp_out = sp_av_realloc(pAV->aResampleBuffer, out_size);
+ if (!tmp_out) {
+ JoglCommon_throwNewRuntimeException(env, "Couldn't alloc resample buffer of size %d", out_size);
+ return INVALID_PTS;
+ }
+ pAV->aResampleBuffer = tmp_out;
+
+ if( NULL != pAV->avResampleCtx ) {
+ out_samples = sp_avresample_convert(pAV->avResampleCtx,
+ &pAV->aResampleBuffer,
+ out_linesize, nb_samples,
+ pAFrameCurrent->data,
+ pAFrameCurrent->linesize[0],
+ pAFrameCurrent->nb_samples);
+ } else if( NULL != pAV->swResampleCtx ) {
+ out_samples = sp_swr_convert(pAV->swResampleCtx,
+ &pAV->aResampleBuffer, nb_samples,
+ (const uint8_t **)pAFrameCurrent->data, pAFrameCurrent->nb_samples);
+ }
+ if (out_samples < 0) {
+ JoglCommon_throwNewRuntimeException(env, "avresample_convert() failed");
+ return INVALID_PTS;
+ }
+ data_size = out_samples * osize * pAV->aChannelsOut;
+ data_ptr = tmp_out;
+ }
+ NIOBuffer_t * pNIOBufferCurrent = &pAV->pANIOBuffers[pAV->aFrameCurrent];
+ int newNIO = NULL == pNIOBufferCurrent->nioRef;
+ if( !newNIO && ( data_ptr != pNIOBufferCurrent->origPtr || data_size > pNIOBufferCurrent->size ) ) {
+ if(pAV->verbose) {
+ fprintf(stderr, "A NIO: Free.0 ptr %p / ref %p, %d bytes\n",
+ pNIOBufferCurrent->origPtr, pNIOBufferCurrent->nioRef, pNIOBufferCurrent->size);
+ }
+ (*env)->DeleteGlobalRef(env, pNIOBufferCurrent->nioRef);
+ newNIO = 1;
+ }
+ if( newNIO ) {
+ jobject jSampleData = (*env)->NewDirectByteBuffer(env, data_ptr, data_size);
+ pNIOBufferCurrent->nioRef = (*env)->NewGlobalRef(env, jSampleData);
+ pNIOBufferCurrent->origPtr = data_ptr;
+ pNIOBufferCurrent->size = data_size;
+ if(pAV->verbose) {
+ fprintf(stderr, "A NIO: Alloc ptr %p / ref %p, %d bytes\n",
+ pNIOBufferCurrent->origPtr, pNIOBufferCurrent->nioRef, pNIOBufferCurrent->size);
+ }
+ }
+ (*env)->CallVoidMethod(env, pAV->ffmpegMediaPlayer, ffmpeg_jni_mid_pushSound, pNIOBufferCurrent->nioRef, data_size, pAV->aPTS);
+ }
+ }
+ } else if(packet.stream_index==pAV->vid) {
+ // Decode video frame
+ if(NULL == pAV->pVFrame) {
+ sp_av_free_packet(&packet);
+ return INVALID_PTS;
+ }
+ int frameCount;
+ int flush_complete = 0;
+ for ( frameCount=0; 0 < packet.size || 0 == frameCount; frameCount++ ) {
+ int frameDecoded;
+ int len1;
+ sp_avcodec_get_frame_defaults(pAV->pVFrame);
+ if (flush_complete) {
+ break;
+ }
+ len1 = sp_avcodec_decode_video2(pAV->pVCodecCtx, pAV->pVFrame, &frameDecoded, &packet);
+ if (len1 < 0) {
+ // if error, we skip the frame
+ packet.size = 0;
+ break;
+ }
+ packet.data += len1;
+ packet.size -= len1;
+
+ if (!frameDecoded) {
+ // stop sending empty packets if the decoder is finished
+ if (!packet.data && pAV->pVCodecCtx->codec->capabilities & CODEC_CAP_DELAY) {
+ flush_complete = 1;
+ }
+ continue;
+ }
+
+ // FIXME: Libav Binary compatibility! JAU01
+ const AVRational time_base = pAV->pVStream->time_base;
+ const int64_t pkt_pts = pAV->pVFrame->pkt_pts;
+ const int64_t pkt_dts = pAV->pVFrame->pkt_dts;
+ const int64_t fix_pts = evalPTS(&pAV->vPTSStats, pkt_pts, pkt_dts);
+ if( AV_NOPTS_VALUE != fix_pts ) { // discard invalid PTS ..
+ pAV->vPTS = my_av_q2i32( fix_pts * 1000, time_base);
+ }
+ if( pAV->verbose ) {
+ const int32_t vPTS = AV_NOPTS_VALUE != pkt_pts ? my_av_q2i32( pkt_pts * 1000, time_base) : 0;
+ const int32_t vDTS = AV_NOPTS_VALUE != pkt_dts ? my_av_q2i32( pkt_dts * 1000, time_base) : 0;
+
+ const double frame_delay_d = av_q2d(pAV->pVCodecCtx->time_base);
+ const double frame_repeat_d = pAV->pVFrame->repeat_pict * (frame_delay_d * 0.5);
+
+ const int32_t frame_delay_i = my_av_q2i32(1000, pAV->pVCodecCtx->time_base);
+ const int32_t frame_repeat_i = pAV->pVFrame->repeat_pict * (frame_delay_i / 2);
+
+ const char * warn = frame_repeat_i > 0 ? "REPEAT" : "NORMAL" ;
+
+ fprintf(stderr, "V fix_pts %d, pts %d [pkt_pts %"PRId64"], dts %d [pkt_dts %"PRId64"], time d(%lf s + r %lf = %lf s), i(%d ms + r %d = %d ms) - %s - f# %d, dec %d, data %p, lsz %d\n",
+ pAV->vPTS, vPTS, pkt_pts, vDTS, pkt_dts,
+ frame_delay_d, frame_repeat_d, (frame_delay_d + frame_repeat_d),
+ frame_delay_i, frame_repeat_i, (frame_delay_i + frame_repeat_i), warn, frameCount,
+ len1, pAV->pVFrame->data[0], pAV->pVFrame->linesize[0]);
+ // fflush(NULL);
+ }
+ if( 0 == pAV->pVFrame->linesize[0] ) {
+ if( pAV->useRefCountedFrames ) {
+ sp_av_frame_unref(pAV->pVFrame);
+ }
+ continue;
+ }
+ resPTS = pAV->vPTS; // Video Frame!
+
+ int p_offset[] = { 0, 0, 0, 0 };
+ if( pAV->pVFrame->linesize[0] < 0 ) {
+ if( JNI_FALSE == pAV->vFlipped ) {
+ pAV->vFlipped = JNI_TRUE;
+ _setIsGLOriented(env, pAV);
+ }
+
+ // image bottom-up
+ int h_1 = pAV->pVCodecCtx->height - 1;
+ p_offset[0] = pAV->pVFrame->linesize[0] * h_1;
+ if( pAV->vBufferPlanes > 1 ) {
+ p_offset[1] = pAV->pVFrame->linesize[1] * h_1;
+ }
+ if( pAV->vBufferPlanes > 2 ) {
+ p_offset[2] = pAV->pVFrame->linesize[2] * h_1;
+ }
+ /**
+ if( pAV->vBufferPlanes > 3 ) {
+ p_offset[3] = pAV->pVFrame->linesize[3] * h_1;
+ } */
+ } else if( JNI_TRUE == pAV->vFlipped ) {
+ pAV->vFlipped = JNI_FALSE;
+ _setIsGLOriented(env, pAV);
+ }
+
+ // 1st plane or complete packed frame
+ // FIXME: Libav Binary compatibility! JAU01
+ DBG_TEXSUBIMG2D_a('Y',pAV,1,1,1,0);
+ pAV->procAddrGLTexSubImage2D(texTarget, 0,
+ 0, 0,
+ pAV->vTexWidth[0], pAV->pVCodecCtx->height,
+ texFmt, texType, pAV->pVFrame->data[0] + p_offset[0]);
+ DBG_TEXSUBIMG2D_b(pAV);
+
+ if( pAV->vPixFmt == PIX_FMT_YUV420P || pAV->vPixFmt == PIX_FMT_YUVJ420P ) {
+ // U plane
+ // FIXME: Libav Binary compatibility! JAU01
+ DBG_TEXSUBIMG2D_a('U',pAV,1,1,2,1);
+ pAV->procAddrGLTexSubImage2D(texTarget, 0,
+ pAV->pVCodecCtx->width, 0,
+ pAV->vTexWidth[1], pAV->pVCodecCtx->height/2,
+ texFmt, texType, pAV->pVFrame->data[1] + p_offset[1]);
+ DBG_TEXSUBIMG2D_b(pAV);
+ // V plane
+ // FIXME: Libav Binary compatibility! JAU01
+ DBG_TEXSUBIMG2D_a('V',pAV,1,1,2,2);
+ pAV->procAddrGLTexSubImage2D(texTarget, 0,
+ pAV->pVCodecCtx->width, pAV->pVCodecCtx->height/2,
+ pAV->vTexWidth[2], pAV->pVCodecCtx->height/2,
+ texFmt, texType, pAV->pVFrame->data[2] + p_offset[2]);
+ DBG_TEXSUBIMG2D_b(pAV);
+ } else if( pAV->vPixFmt == PIX_FMT_YUV422P || pAV->vPixFmt == PIX_FMT_YUVJ422P ) {
+ // U plane
+ // FIXME: Libav Binary compatibility! JAU01
+ DBG_TEXSUBIMG2D_a('U',pAV,1,1,1,1);
+ pAV->procAddrGLTexSubImage2D(texTarget, 0,
+ pAV->pVCodecCtx->width, 0,
+ pAV->vTexWidth[1], pAV->pVCodecCtx->height,
+ texFmt, texType, pAV->pVFrame->data[1] + p_offset[1]);
+ DBG_TEXSUBIMG2D_b(pAV);
+ // V plane
+ // FIXME: Libav Binary compatibility! JAU01
+ DBG_TEXSUBIMG2D_a('V',pAV,3,2,1,1);
+ pAV->procAddrGLTexSubImage2D(texTarget, 0,
+ pAV->pVCodecCtx->width+pAV->pVCodecCtx->width/2, 0,
+ pAV->vTexWidth[2], pAV->pVCodecCtx->height,
+ texFmt, texType, pAV->pVFrame->data[2] + p_offset[2]);
+ DBG_TEXSUBIMG2D_b(pAV);
+ } // FIXME: Add more planar formats !
+
+ pAV->procAddrGLFinish();
+ //pAV->procAddrGLFlush();
+ if( pAV->useRefCountedFrames ) {
+ sp_av_frame_unref(pAV->pVFrame);
+ }
+ }
+ }
+ // restore orig pointer and size values, we may have moved along within packet
+ packet.data = pkt_odata;
+ packet.size = pkt_osize;
+ sp_av_free_packet(&packet);
+ }
+ return resPTS;
+}
+
+static void initPTSStats(PTSStats *ptsStats) {
+ ptsStats->ptsError = 0;
+ ptsStats->dtsError = 0;
+ ptsStats->ptsLast = INT64_MIN;
+ ptsStats->dtsLast = INT64_MIN;
+}
+static int64_t evalPTS(PTSStats *ptsStats, int64_t inPTS, int64_t inDTS) {
+ int64_t resPTS = AV_NOPTS_VALUE;
+
+ if ( inDTS != AV_NOPTS_VALUE ) {
+ ptsStats->dtsError += inDTS <= ptsStats->dtsLast;
+ ptsStats->dtsLast = inDTS;
+ }
+ if ( inPTS != AV_NOPTS_VALUE ) {
+ ptsStats->ptsError += inPTS <= ptsStats->ptsLast;
+ ptsStats->ptsLast = inPTS;
+ }
+ if ( inPTS != AV_NOPTS_VALUE &&
+ ( ptsStats->ptsError<=ptsStats->dtsError || inDTS == AV_NOPTS_VALUE ) ) {
+ resPTS = inPTS;
+ } else {
+ resPTS = inDTS;
+ }
+ return resPTS;
+}
+
+
+JNIEXPORT jint JNICALL FF_FUNC(play0)
+ (JNIEnv *env, jobject instance, jlong ptr)
+{
+ FFMPEGToolBasicAV_t *pAV = (FFMPEGToolBasicAV_t *)((void *)((intptr_t)ptr));
+ return sp_av_read_play(pAV->pFormatCtx);
+}
+JNIEXPORT jint JNICALL FF_FUNC(pause0)
+ (JNIEnv *env, jobject instance, jlong ptr)
+{
+ FFMPEGToolBasicAV_t *pAV = (FFMPEGToolBasicAV_t *)((void *)((intptr_t)ptr));
+ return sp_av_read_pause(pAV->pFormatCtx);
+}
+
+JNIEXPORT jint JNICALL FF_FUNC(seek0)
+ (JNIEnv *env, jobject instance, jlong ptr, jint pos1)
+{
+ const FFMPEGToolBasicAV_t *pAV = (FFMPEGToolBasicAV_t *)((void *)((intptr_t)ptr));
+ const int64_t pos0 = pAV->vPTS;
+ int64_t pts0;
+ int streamID;
+ AVRational time_base;
+ if( pAV->vid >= 0 ) {
+ streamID = pAV->vid;
+ time_base = pAV->pVStream->time_base;
+ pts0 = pAV->pVFrame->pkt_pts;
+ } else if( pAV->aid >= 0 ) {
+ streamID = pAV->aid;
+ time_base = pAV->pAStream->time_base;
+ pts0 = pAV->pAFrames[pAV->aFrameCurrent]->pkt_pts;
+ } else {
+ return pAV->vPTS;
+ }
+ int64_t pts1 = (int64_t) (pos1 * (int64_t) time_base.den)
+ / (1000 * (int64_t) time_base.num);
+ if(pAV->verbose) {
+ fprintf(stderr, "SEEK: vid %d, aid %d, pos1 %d, pts: %"PRId64" -> %"PRId64"\n", pAV->vid, pAV->aid, pos1, pts0, pts1);
+ }
+ int flags = 0;
+ if(pos1 < pos0) {
+ flags |= AVSEEK_FLAG_BACKWARD;
+ }
+ int res;
+ if(HAS_FUNC(sp_av_seek_frame)) {
+ if(pAV->verbose) {
+ fprintf(stderr, "SEEK.0: pre : s %"PRId64" / %"PRId64" -> t %d / %"PRId64"\n", pos0, pts0, pos1, pts1);
+ }
+ sp_av_seek_frame(pAV->pFormatCtx, streamID, pts1, flags);
+ } else if(HAS_FUNC(sp_avformat_seek_file)) {
+ int64_t ptsD = pts1 - pts0;
+ int64_t seek_min = ptsD > 0 ? pts1 - ptsD : INT64_MIN;
+ int64_t seek_max = ptsD < 0 ? pts1 - ptsD : INT64_MAX;
+ if(pAV->verbose) {
+ fprintf(stderr, "SEEK.1: pre : s %"PRId64" / %"PRId64" -> t %d / %"PRId64" [%"PRId64" .. %"PRId64"]\n",
+ pos0, pts0, pos1, pts1, seek_min, seek_max);
+ }
+ res = sp_avformat_seek_file(pAV->pFormatCtx, -1, seek_min, pts1, seek_max, flags);
+ }
+ if(NULL != pAV->pVCodecCtx) {
+ sp_avcodec_flush_buffers( pAV->pVCodecCtx );
+ }
+ if(NULL != pAV->pACodecCtx) {
+ sp_avcodec_flush_buffers( pAV->pACodecCtx );
+ }
+ const jint rPTS = my_av_q2i32( ( pAV->vid >= 0 ? pAV->pVFrame->pkt_pts : pAV->pAFrames[pAV->aFrameCurrent]->pkt_pts ) * 1000, time_base);
+ if(pAV->verbose) {
+ fprintf(stderr, "SEEK: post : res %d, u %d\n", res, rPTS);
+ }
+ return rPTS;
+}
+
+JNIEXPORT jint JNICALL FF_FUNC(getVideoPTS0)
+ (JNIEnv *env, jobject instance, jlong ptr)
+{
+ FFMPEGToolBasicAV_t *pAV = (FFMPEGToolBasicAV_t *)((void *)((intptr_t)ptr));
+ return pAV->vPTS;
+}
+
+JNIEXPORT jint JNICALL FF_FUNC(getAudioPTS0)
+ (JNIEnv *env, jobject instance, jlong ptr)
+{
+ FFMPEGToolBasicAV_t *pAV = (FFMPEGToolBasicAV_t *)((void *)((intptr_t)ptr));
+ return pAV->aPTS;
+}
+
diff --git a/src/jogl/native/libav/ffmpeg_lavc53_lavf53_lavu51.c b/src/jogl/native/libav/ffmpeg_lavc53_lavf53_lavu51.c
new file mode 100644
index 0000000..edce2ba
--- /dev/null
+++ b/src/jogl/native/libav/ffmpeg_lavc53_lavf53_lavu51.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_FFMPEGv08Natives.h"
+
+#define FF_FUNC(METHOD) Java_jogamp_opengl_util_av_impl_FFMPEGv08Natives_ ## METHOD
+
+#include "ffmpeg_impl_template.c"
diff --git a/src/jogl/native/libav/ffmpeg_lavc54_lavf54_lavu52_lavr01.c b/src/jogl/native/libav/ffmpeg_lavc54_lavf54_lavu52_lavr01.c
new file mode 100644
index 0000000..651a649
--- /dev/null
+++ b/src/jogl/native/libav/ffmpeg_lavc54_lavf54_lavu52_lavr01.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_FFMPEGv09Natives.h"
+
+#define FF_FUNC(METHOD) Java_jogamp_opengl_util_av_impl_FFMPEGv09Natives_ ## METHOD
+
+#include "ffmpeg_impl_template.c"
diff --git a/src/jogl/native/libav/ffmpeg_lavc55_lavf55_lavu52_lavr01.c b/src/jogl/native/libav/ffmpeg_lavc55_lavf55_lavu52_lavr01.c
new file mode 100644
index 0000000..2771003
--- /dev/null
+++ b/src/jogl/native/libav/ffmpeg_lavc55_lavf55_lavu52_lavr01.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_FFMPEGv10Natives.h"
+
+#define FF_FUNC(METHOD) Java_jogamp_opengl_util_av_impl_FFMPEGv10Natives_ ## METHOD
+
+#include "ffmpeg_impl_template.c"
diff --git a/src/jogl/native/libav/ffmpeg_static.c b/src/jogl/native/libav/ffmpeg_static.c
new file mode 100644
index 0000000..c8af595
--- /dev/null
+++ b/src/jogl/native/libav/ffmpeg_static.c
@@ -0,0 +1,91 @@
+/**
+ * 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 "ffmpeg_static.h"
+
+#include "JoglCommon.h"
+
+#include <GL/gl-platform.h>
+
+static const char * const ClazzNameFFMPEGMediaPlayer = "jogamp/opengl/util/av/impl/FFMPEGMediaPlayer";
+
+static jclass ffmpegMediaPlayerClazz = NULL;
+jmethodID ffmpeg_jni_mid_pushSound = NULL;
+jmethodID ffmpeg_jni_mid_updateAttributes = NULL;
+jmethodID ffmpeg_jni_mid_setIsGLOriented = NULL;
+jmethodID ffmpeg_jni_mid_setupFFAttributes = NULL;
+jmethodID ffmpeg_jni_mid_isAudioFormatSupported = NULL;
+
+typedef unsigned (APIENTRYP AV_GET_VERSION)(void);
+
+JNIEXPORT jboolean JNICALL Java_jogamp_opengl_util_av_impl_FFMPEGStaticNatives_initIDs0
+ (JNIEnv *env, jclass clazz)
+{
+ jboolean res = JNI_TRUE;
+ JoglCommon_init(env);
+
+ jclass c;
+ if (ffmpegMediaPlayerClazz != NULL) {
+ return JNI_FALSE;
+ }
+
+ c = (*env)->FindClass(env, ClazzNameFFMPEGMediaPlayer);
+ if(NULL==c) {
+ JoglCommon_FatalError(env, "JOGL FFMPEG: can't find %s", ClazzNameFFMPEGMediaPlayer);
+ }
+ ffmpegMediaPlayerClazz = (jclass)(*env)->NewGlobalRef(env, c);
+ (*env)->DeleteLocalRef(env, c);
+ if(NULL==ffmpegMediaPlayerClazz) {
+ JoglCommon_FatalError(env, "JOGL FFMPEG: can't use %s", ClazzNameFFMPEGMediaPlayer);
+ }
+
+ ffmpeg_jni_mid_pushSound = (*env)->GetMethodID(env, ffmpegMediaPlayerClazz, "pushSound", "(Ljava/nio/ByteBuffer;II)V");
+ ffmpeg_jni_mid_updateAttributes = (*env)->GetMethodID(env, ffmpegMediaPlayerClazz, "updateAttributes", "(IIIIIIIFIIILjava/lang/String;Ljava/lang/String;)V");
+ ffmpeg_jni_mid_setIsGLOriented = (*env)->GetMethodID(env, ffmpegMediaPlayerClazz, "setIsGLOriented", "(Z)V");
+ ffmpeg_jni_mid_setupFFAttributes = (*env)->GetMethodID(env, ffmpegMediaPlayerClazz, "setupFFAttributes", "(IIIIIIIIIIIIIII)V");
+ ffmpeg_jni_mid_isAudioFormatSupported = (*env)->GetMethodID(env, ffmpegMediaPlayerClazz, "isAudioFormatSupported", "(III)Z");
+
+ if(ffmpeg_jni_mid_pushSound == NULL ||
+ ffmpeg_jni_mid_updateAttributes == NULL ||
+ ffmpeg_jni_mid_setIsGLOriented == NULL ||
+ ffmpeg_jni_mid_setupFFAttributes == NULL ||
+ ffmpeg_jni_mid_isAudioFormatSupported == NULL) {
+ return JNI_FALSE;
+ }
+ return res;
+}
+
+JNIEXPORT jint JNICALL Java_jogamp_opengl_util_av_impl_FFMPEGStaticNatives_getAvVersion0
+ (JNIEnv *env, jclass clazz, jlong func) {
+ if( 0 != func ) {
+ return (jint) ((AV_GET_VERSION) (intptr_t) func)();
+ } else {
+ return 0;
+ }
+}
+
diff --git a/src/jogl/native/libav/ffmpeg_static.h b/src/jogl/native/libav/ffmpeg_static.h
new file mode 100644
index 0000000..ab4db25
--- /dev/null
+++ b/src/jogl/native/libav/ffmpeg_static.h
@@ -0,0 +1,50 @@
+/**
+ * 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.
+ */
+
+#ifndef _FFMPEG_STATIC_H
+#define _FFMPEG_STATIC_H
+
+#ifdef _WIN32
+ #include <windows.h>
+#endif
+
+#include <gluegen_stdint.h>
+#include <gluegen_inttypes.h>
+#include <gluegen_stddef.h>
+#include <gluegen_stdint.h>
+
+#include "jogamp_opengl_util_av_impl_FFMPEGStaticNatives.h"
+
+extern jmethodID ffmpeg_jni_mid_pushSound;
+extern jmethodID ffmpeg_jni_mid_updateAttributes;
+extern jmethodID ffmpeg_jni_mid_setIsGLOriented;
+extern jmethodID ffmpeg_jni_mid_setupFFAttributes;
+extern jmethodID ffmpeg_jni_mid_isAudioFormatSupported;
+
+#endif /* _FFMPEG_STATIC_H */
+
diff --git a/src/jogl/native/libav/ffmpeg_tool.h b/src/jogl/native/libav/ffmpeg_tool.h
index 5560b86..97e60af 100644
--- a/src/jogl/native/libav/ffmpeg_tool.h
+++ b/src/jogl/native/libav/ffmpeg_tool.h
@@ -41,28 +41,113 @@
#include <gluegen_stddef.h>
#include <gluegen_stdint.h>
-#include <libavcodec/avcodec.h>
-#include <libavformat/avformat.h>
+#include "libavcodec/avcodec.h"
+#include "libavformat/avformat.h"
+#include "libavutil/avutil.h"
+#if LIBAVCODEC_VERSION_MAJOR >= 54
+ #include "libavresample/avresample.h"
+ #include "libswresample/swresample.h"
+#endif
+
+#ifndef LIBAVRESAMPLE_VERSION_MAJOR
+#define LIBAVRESAMPLE_VERSION_MAJOR -1
+// Opaque
+typedef void* AVAudioResampleContext;
+#endif
+#ifndef LIBSWRESAMPLE_VERSION_MAJOR
+#define LIBSWRESAMPLE_VERSION_MAJOR -1
+// Opaque
+typedef struct SwrContext SwrContext;
+#endif
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
+#include <GL/gl.h>
+
+typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
+typedef GLenum (APIENTRYP PFNGLGETERRORPROC) (void);
+typedef void (APIENTRYP PFNGLFLUSH) (void);
+typedef void (APIENTRYP PFNGLFINISH) (void);
+
/**
* AV_TIME_BASE 1000000
*/
#define AV_TIME_BASE_MSEC (AV_TIME_BASE/1000)
+#define AV_VERSION_MAJOR(i) ( ( i >> 16 ) & 0xFF )
+#define AV_VERSION_MINOR(i) ( ( i >> 8 ) & 0xFF )
+#define AV_VERSION_SUB(i) ( ( i >> 0 ) & 0xFF )
+
+/** Sync w/ GLMediaPlayer.STREAM_ID_NONE */
+#define AV_STREAM_ID_NONE -2
+
+/** Sync w/ GLMediaPlayer.STREAM_ID_AUTO */
+#define AV_STREAM_ID_AUTO -1
+
+/** Default number of audio frames per video frame. Sync w/ FFMPEGMediaPlayer.AV_DEFAULT_AFRAMES. */
+#define AV_DEFAULT_AFRAMES 8
+
+/** Constant PTS marking an invalid PTS, i.e. Integer.MIN_VALUE == 0x80000000 == {@value}. Sync w/ TimeFrameI.INVALID_PTS */
+#define INVALID_PTS 0x80000000
+
+/** Constant PTS marking the end of the stream, i.e. Integer.MIN_VALUE - 1 == 0x7FFFFFFF == {@value}. Sync w/ TimeFrameI.END_OF_STREAM_PTS */
+#define END_OF_STREAM_PTS 0x7FFFFFFF
+
+/** Since 54.0.0.1 */
+#define AV_HAS_API_AVRESAMPLE(pAV) ( ( LIBAVRESAMPLE_VERSION_MAJOR >= 0 ) && ( pAV->avresampleVersion != 0 ) )
+
+/** Since 55.0.0.1 */
+#define AV_HAS_API_SWRESAMPLE(pAV) ( ( LIBSWRESAMPLE_VERSION_MAJOR >= 0 ) && ( pAV->swresampleVersion != 0 ) )
+
+#define MAX_INT(a,b) ( (a >= b) ? a : b )
+#define MIN_INT(a,b) ( (a <= b) ? a : b )
+
static inline float my_av_q2f(AVRational a){
- return a.num / (float) a.den;
+ return (float)a.num / (float)a.den;
+}
+static inline float my_av_q2f_r(AVRational a){
+ return (float)a.den / (float)a.num;
}
-static inline int32_t my_av_q2i32(int32_t snum, AVRational a){
- return (snum * a.num) / a.den;
+static inline int32_t my_av_q2i32(int64_t snum, AVRational a){
+ return (int32_t) ( ( snum * (int64_t) a.num ) / (int64_t)a.den );
}
+static inline int my_align(int v, int a){
+ return ( v + a - 1 ) & ~( a - 1 );
+}
+
+typedef struct {
+ void *origPtr;
+ jobject nioRef;
+ int32_t size;
+} NIOBuffer_t;
+
+typedef struct {
+ int64_t ptsError; // Number of backward PTS values (earlier than last PTS, excluding AV_NOPTS_VALUE)
+ int64_t dtsError; // Number of backward DTS values (earlier than last PTS, excluding AV_NOPTS_VALUE)
+ int64_t ptsLast; // PTS of the last frame
+ int64_t dtsLast; // DTS of the last frame
+} PTSStats;
+
typedef struct {
+ jobject ffmpegMediaPlayer;
int32_t verbose;
+ uint32_t avcodecVersion;
+ uint32_t avformatVersion;
+ uint32_t avutilVersion;
+ uint32_t avresampleVersion;
+ uint32_t swresampleVersion;
+
+ int32_t useRefCountedFrames;
+
+ PFNGLTEXSUBIMAGE2DPROC procAddrGLTexSubImage2D;
+ PFNGLGETERRORPROC procAddrGLGetError;
+ PFNGLFLUSH procAddrGLFlush;
+ PFNGLFINISH procAddrGLFinish;
+
AVFormatContext* pFormatCtx;
int32_t vid;
AVStream* pVStream;
@@ -74,28 +159,40 @@ typedef struct {
uint32_t vBytesPerPixelPerPlane;
enum PixelFormat vPixFmt; // native decoder fmt
int32_t vPTS; // msec - overall last video PTS
- int32_t vLinesize[3]; // decoded video linesize in bytes for each plane
- int32_t vTexWidth[3]; // decoded video tex width in bytes for each plane
-
+ PTSStats vPTSStats;
+ int32_t vTexWidth[4]; // decoded video tex width in bytes for each plane (max 4)
+ int32_t vWidth;
+ int32_t vHeight;
+ jboolean vFlipped; // false: !GL-Orientation, true: GL-Orientation
int32_t aid;
AVStream* pAStream;
AVCodecContext* pACodecCtx;
AVCodec* pACodec;
AVFrame** pAFrames;
+ NIOBuffer_t* pANIOBuffers;
int32_t aFrameCount;
int32_t aFrameCurrent;
+ int32_t aFrameSize; // in samples per channel!
+ enum AVSampleFormat aSampleFmt; // native decoder fmt
int32_t aSampleRate;
int32_t aChannels;
- int32_t aFrameSize;
- enum AVSampleFormat aSampleFmt; // native decoder fmt
+ int32_t aSinkSupport; // supported by AudioSink
+ AVAudioResampleContext* avResampleCtx;
+ struct SwrContext* swResampleCtx;
+ uint8_t* aResampleBuffer;
+ enum AVSampleFormat aSampleFmtOut; // out fmt
+ int32_t aChannelsOut;
+ int32_t aSampleRateOut;
int32_t aPTS; // msec - overall last audio PTS
+ PTSStats aPTSStats;
float fps; // frames per seconds
int32_t bps_stream; // bits per seconds
int32_t bps_video; // bits per seconds
int32_t bps_audio; // bits per seconds
- int32_t totalFrames;
+ int32_t frames_video;
+ int32_t frames_audio;
int32_t duration; // msec
int32_t start_time; // msec
diff --git a/src/jogl/native/libav/jogamp_opengl_util_av_impl_FFMPEGMediaPlayer.c b/src/jogl/native/libav/jogamp_opengl_util_av_impl_FFMPEGMediaPlayer.c
deleted file mode 100644
index 623bdca..0000000
--- a/src/jogl/native/libav/jogamp_opengl_util_av_impl_FFMPEGMediaPlayer.c
+++ /dev/null
@@ -1,784 +0,0 @@
-/**
- * Copyright 2012 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_FFMPEGMediaPlayer.h"
-
-#include "JoglCommon.h"
-#include "ffmpeg_tool.h"
-#include <libavutil/pixdesc.h>
-#include <GL/gl.h>
-
-typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
-
-static const char * const ClazzNameFFMPEGMediaPlayer = "jogamp/opengl/util/av/impl/FFMPEGMediaPlayer";
-
-static jclass ffmpegMediaPlayerClazz = NULL;
-static jmethodID jni_mid_pushSound = NULL;
-static jmethodID jni_mid_updateAttributes1 = NULL;
-static jmethodID jni_mid_updateAttributes2 = NULL;
-
-#define HAS_FUNC(f) (NULL!=(f))
-
-typedef unsigned (APIENTRYP AVCODEC_VERSION)(void);
-typedef unsigned (APIENTRYP AVUTIL_VERSION)(void);
-typedef unsigned (APIENTRYP AVFORMAT_VERSION)(void);
-
-static AVCODEC_VERSION sp_avcodec_version;
-static AVFORMAT_VERSION sp_avformat_version;
-static AVUTIL_VERSION sp_avutil_version;
-// count: 3
-
-
-// libavcodec
-typedef int (APIENTRYP AVCODEC_CLOSE)(AVCodecContext *avctx);
-typedef void (APIENTRYP AVCODEC_STRING)(char *buf, int buf_size, AVCodecContext *enc, int encode);
-typedef AVCodec *(APIENTRYP AVCODEC_FIND_DECODER)(enum CodecID id);
-typedef int (APIENTRYP AVCODEC_OPEN2)(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options); // 53.6.0
-typedef int (APIENTRYP AVCODEC_OPEN)(AVCodecContext *avctx, AVCodec *codec);
-typedef AVFrame *(APIENTRYP AVCODEC_ALLOC_FRAME)(void);
-typedef int (APIENTRYP AVCODEC_DEFAULT_GET_BUFFER)(AVCodecContext *s, AVFrame *pic);
-typedef void (APIENTRYP AVCODEC_DEFAULT_RELEASE_BUFFER)(AVCodecContext *s, AVFrame *pic);
-typedef void (APIENTRYP AV_FREE_PACKET)(AVPacket *pkt);
-typedef int (APIENTRYP AVCODEC_DECODE_AUDIO4)(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt); // 53.25.0
-typedef int (APIENTRYP AVCODEC_DECODE_AUDIO3)(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, AVPacket *avpkt); // 52.23.0
-typedef int (APIENTRYP AVCODEC_DECODE_VIDEO2)(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, AVPacket *avpkt); // 52.23.0
-
-static AVCODEC_CLOSE sp_avcodec_close;
-static AVCODEC_STRING sp_avcodec_string;
-static AVCODEC_FIND_DECODER sp_avcodec_find_decoder;
-static AVCODEC_OPEN2 sp_avcodec_open2; // 53.6.0
-static AVCODEC_OPEN sp_avcodec_open;
-static AVCODEC_ALLOC_FRAME sp_avcodec_alloc_frame;
-static AVCODEC_DEFAULT_GET_BUFFER sp_avcodec_default_get_buffer;
-static AVCODEC_DEFAULT_RELEASE_BUFFER sp_avcodec_default_release_buffer;
-static AV_FREE_PACKET sp_av_free_packet;
-static AVCODEC_DECODE_AUDIO4 sp_avcodec_decode_audio4; // 53.25.0
-static AVCODEC_DECODE_AUDIO3 sp_avcodec_decode_audio3; // 52.23.0
-static AVCODEC_DECODE_VIDEO2 sp_avcodec_decode_video2; // 52.23.0
-// count: 15
-
-// libavutil
-typedef void (APIENTRYP AV_FREE)(void *ptr);
-typedef int (APIENTRYP AV_GET_BITS_PER_PIXEL)(const AVPixFmtDescriptor *pixdesc);
-typedef int (APIENTRYP AV_SAMPLES_GET_BUFFER_SIZE)(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align);
-static const AVPixFmtDescriptor* sp_av_pix_fmt_descriptors;
-static AV_FREE sp_av_free;
-static AV_GET_BITS_PER_PIXEL sp_av_get_bits_per_pixel;
-static AV_SAMPLES_GET_BUFFER_SIZE sp_av_samples_get_buffer_size;
-// count: 19
-
-// libavformat
-typedef AVFormatContext *(APIENTRYP AVFORMAT_ALLOC_CONTEXT)(void);
-typedef void (APIENTRYP AVFORMAT_FREE_CONTEXT)(AVFormatContext *s); // 52.96.0
-typedef void (APIENTRYP AVFORMAT_CLOSE_INPUT)(AVFormatContext **s); // 53.17.0
-typedef void (APIENTRYP AV_CLOSE_INPUT_FILE)(AVFormatContext *s);
-typedef void (APIENTRYP AV_REGISTER_ALL)(void);
-typedef int (APIENTRYP AVFORMAT_OPEN_INPUT)(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options);
-typedef void (APIENTRYP AV_DUMP_FORMAT)(AVFormatContext *ic, int index, const char *url, int is_output);
-typedef int (APIENTRYP AV_READ_FRAME)(AVFormatContext *s, AVPacket *pkt);
-typedef int (APIENTRYP AV_SEEK_FRAME)(AVFormatContext *s, int stream_index, int64_t timestamp, int flags);
-typedef int (APIENTRYP AVFORMAT_NETWORK_INIT)(void); // 53.13.0
-typedef int (APIENTRYP AVFORMAT_NETWORK_DEINIT)(void); // 53.13.0
-typedef int (APIENTRYP AVFORMAT_FIND_STREAM_INFO)(AVFormatContext *ic, AVDictionary **options); // 53.3.0
-typedef int (APIENTRYP AV_FIND_STREAM_INFO)(AVFormatContext *ic);
-
-static AVFORMAT_ALLOC_CONTEXT sp_avformat_alloc_context;
-static AVFORMAT_FREE_CONTEXT sp_avformat_free_context; // 52.96.0
-static AVFORMAT_CLOSE_INPUT sp_avformat_close_input; // 53.17.0
-static AV_CLOSE_INPUT_FILE sp_av_close_input_file;
-static AV_REGISTER_ALL sp_av_register_all;
-static AVFORMAT_OPEN_INPUT sp_avformat_open_input;
-static AV_DUMP_FORMAT sp_av_dump_format;
-static AV_READ_FRAME sp_av_read_frame;
-static AV_SEEK_FRAME sp_av_seek_frame;
-static AVFORMAT_NETWORK_INIT sp_avformat_network_init; // 53.13.0
-static AVFORMAT_NETWORK_DEINIT sp_avformat_network_deinit; // 53.13.0
-static AVFORMAT_FIND_STREAM_INFO sp_avformat_find_stream_info; // 53.3.0
-static AV_FIND_STREAM_INFO sp_av_find_stream_info;
-// count: 32
-
-#define SYMBOL_COUNT 32
-
-JNIEXPORT jboolean JNICALL Java_jogamp_opengl_util_av_impl_FFMPEGDynamicLibraryBundleInfo_initSymbols0
- (JNIEnv *env, jclass clazz, jobject jSymbols, jint count)
-{
- int64_t* symbols; // jlong -> int64_t -> intptr_t -> FUNC_PTR
- int i;
-
- if(SYMBOL_COUNT != count) {
- fprintf(stderr, "FFMPEGDynamicLibraryBundleInfo.initSymbols0: Wrong symbol count: Expected %d, Is %d\n",
- SYMBOL_COUNT, count);
- return JNI_FALSE;
- }
- JoglCommon_init(env);
-
- i = 0;
- symbols = (int64_t *) (*env)->GetPrimitiveArrayCritical(env, jSymbols, NULL);
-
- sp_avcodec_version = (AVCODEC_VERSION) (intptr_t) symbols[i++];
- sp_avformat_version = (AVFORMAT_VERSION) (intptr_t) symbols[i++];
- sp_avutil_version = (AVUTIL_VERSION) (intptr_t) symbols[i++];
- // count: 3
-
- sp_avcodec_close = (AVCODEC_CLOSE) (intptr_t) symbols[i++];
- sp_avcodec_string = (AVCODEC_STRING) (intptr_t) symbols[i++];
- sp_avcodec_find_decoder = (AVCODEC_FIND_DECODER) (intptr_t) symbols[i++];
- sp_avcodec_open2 = (AVCODEC_OPEN2) (intptr_t) symbols[i++];
- sp_avcodec_open = (AVCODEC_OPEN) (intptr_t) symbols[i++];
- sp_avcodec_alloc_frame = (AVCODEC_ALLOC_FRAME) (intptr_t) symbols[i++];
- sp_avcodec_default_get_buffer = (AVCODEC_DEFAULT_GET_BUFFER) (intptr_t) symbols[i++];
- sp_avcodec_default_release_buffer = (AVCODEC_DEFAULT_RELEASE_BUFFER) (intptr_t) symbols[i++];
- sp_av_free_packet = (AV_FREE_PACKET) (intptr_t) symbols[i++];
- sp_avcodec_decode_audio4 = (AVCODEC_DECODE_AUDIO4) (intptr_t) symbols[i++];
- sp_avcodec_decode_audio3 = (AVCODEC_DECODE_AUDIO3) (intptr_t) symbols[i++];
- sp_avcodec_decode_video2 = (AVCODEC_DECODE_VIDEO2) (intptr_t) symbols[i++];
- // count: 15
-
- sp_av_pix_fmt_descriptors = (const AVPixFmtDescriptor*) (intptr_t) symbols[i++];
- sp_av_free = (AV_FREE) (intptr_t) symbols[i++];
- sp_av_get_bits_per_pixel = (AV_GET_BITS_PER_PIXEL) (intptr_t) symbols[i++];
- sp_av_samples_get_buffer_size = (AV_SAMPLES_GET_BUFFER_SIZE) (intptr_t) symbols[i++];
- // count: 19
-
- sp_avformat_alloc_context = (AVFORMAT_ALLOC_CONTEXT) (intptr_t) symbols[i++];;
- sp_avformat_free_context = (AVFORMAT_FREE_CONTEXT) (intptr_t) symbols[i++];
- sp_avformat_close_input = (AVFORMAT_CLOSE_INPUT) (intptr_t) symbols[i++];
- sp_av_close_input_file = (AV_CLOSE_INPUT_FILE) (intptr_t) symbols[i++];
- sp_av_register_all = (AV_REGISTER_ALL) (intptr_t) symbols[i++];
- sp_avformat_open_input = (AVFORMAT_OPEN_INPUT) (intptr_t) symbols[i++];
- sp_av_dump_format = (AV_DUMP_FORMAT) (intptr_t) symbols[i++];
- sp_av_read_frame = (AV_READ_FRAME) (intptr_t) symbols[i++];
- sp_av_seek_frame = (AV_SEEK_FRAME) (intptr_t) symbols[i++];
- sp_avformat_network_init = (AVFORMAT_NETWORK_INIT) (intptr_t) symbols[i++];
- sp_avformat_network_deinit = (AVFORMAT_NETWORK_DEINIT) (intptr_t) symbols[i++];
- sp_avformat_find_stream_info = (AVFORMAT_FIND_STREAM_INFO) (intptr_t) symbols[i++];
- sp_av_find_stream_info = (AV_FIND_STREAM_INFO) (intptr_t) symbols[i++];
- // count: 32
-
- (*env)->ReleasePrimitiveArrayCritical(env, jSymbols, symbols, 0);
-
- if(SYMBOL_COUNT != i) {
- // boom
- fprintf(stderr, "FFMPEGDynamicLibraryBundleInfo.initSymbols0: Wrong symbol assignment count: Expected %d, Is %d\n",
- SYMBOL_COUNT, i);
- return JNI_FALSE;
- }
-
- return JNI_TRUE;
-}
-
-static void _updateJavaAttributes(JNIEnv *env, jobject instance, FFMPEGToolBasicAV_t* pAV)
-{
- // int shallBeDetached = 0;
- // JNIEnv * env = JoglCommon_GetJNIEnv (&shallBeDetached);
- if(NULL!=env) {
- int32_t w, h;
- if( NULL != pAV->pVCodecCtx ) {
- // FIXME: Libav Binary compatibility! JAU01
- w = pAV->pVCodecCtx->width; h = pAV->pVCodecCtx->height;
- } else {
- w = 0; h = 0;
- }
-
- (*env)->CallVoidMethod(env, instance, jni_mid_updateAttributes1,
- w, h,
- pAV->bps_stream, pAV->bps_video, pAV->bps_audio,
- pAV->fps, (int32_t)((pAV->duration/1000)*pAV->fps), pAV->duration,
- (*env)->NewStringUTF(env, pAV->vcodec),
- (*env)->NewStringUTF(env, pAV->acodec) );
- (*env)->CallVoidMethod(env, instance, jni_mid_updateAttributes2,
- pAV->vPixFmt, pAV->vBufferPlanes,
- pAV->vBitsPerPixel, pAV->vBytesPerPixelPerPlane,
- pAV->vLinesize[0], pAV->vLinesize[1], pAV->vLinesize[2],
- pAV->vTexWidth[0], pAV->vTexWidth[1], pAV->vTexWidth[2]);
- // JoglCommon_ReleaseJNIEnv (shallBeDetached);
- }
-}
-
-static void freeInstance(FFMPEGToolBasicAV_t* pAV) {
- int i;
- if(NULL != pAV) {
- // Close the V codec
- if(NULL != pAV->pVCodecCtx) {
- sp_avcodec_close(pAV->pVCodecCtx);
- pAV->pVCodecCtx = NULL;
- }
- pAV->pVCodec=NULL;
-
- // Close the A codec
- if(NULL != pAV->pACodecCtx) {
- sp_avcodec_close(pAV->pACodecCtx);
- pAV->pACodecCtx = NULL;
- }
- pAV->pACodec=NULL;
-
- // Close the frames
- if(NULL != pAV->pVFrame) {
- sp_av_free(pAV->pVFrame);
- pAV->pVFrame = NULL;
- }
- if(NULL != pAV->pAFrames) {
- for(i=0; i<pAV->aFrameCount; i++) {
- sp_av_free(pAV->pAFrames[i]);
- }
- free(pAV->pAFrames);
- pAV->pAFrames = NULL;
- }
-
- // Close the video file
- if(NULL != pAV->pFormatCtx) {
- if(HAS_FUNC(sp_avformat_close_input)) {
- sp_avformat_close_input(&pAV->pFormatCtx);
- } else {
- sp_av_close_input_file(pAV->pFormatCtx);
- if(HAS_FUNC(sp_avformat_free_context)) {
- sp_avformat_free_context(pAV->pFormatCtx);
- }
- }
- pAV->pFormatCtx = NULL;
- }
- free(pAV);
- }
-}
-
-static int my_getPlaneCount(AVPixFmtDescriptor *pDesc) {
- int i, p=-1;
- for(i=pDesc->nb_components-1; i>=0; i--) {
- int p0 = pDesc->comp[i].plane;
- if( p < p0 ) {
- p = p0;
- }
- }
- return p+1;
-}
-
-static int my_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt) {
- return sp_av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_HWACCEL;
-}
-
-#if 0
-static enum PixelFormat my_get_format(struct AVCodecContext *s, const enum PixelFormat * fmt) {
- int i=0;
- enum PixelFormat f0, fR = PIX_FMT_NONE;
- char buf[256];
-
- fprintf(stderr, "get_format ****\n");
- while (fmt[i] != PIX_FMT_NONE /* && ff_is_hwaccel_pix_fmt(fmt[i]) */) {
- f0 = fmt[i];
- if(fR==PIX_FMT_NONE && !my_is_hwaccel_pix_fmt(f0)) {
- fR = f0;
- }
- sp_av_get_pix_fmt_string(buf, sizeof(buf), f0);
- fprintf(stderr, "get_format %d: %d - %s - %s\n", i, f0, sp_av_get_pix_fmt_name(f0), buf);
- ++i;
- }
- fprintf(stderr, "get_format %d - %s *** \n", fR, sp_av_get_pix_fmt_name(fR));
- fflush(NULL);
- return fR;
-}
-#endif
-
-JNIEXPORT jint JNICALL Java_jogamp_opengl_util_av_impl_FFMPEGMediaPlayer_getAvUtilVersion0
- (JNIEnv *env, jclass clazz) {
- return (jint) sp_avutil_version();
-}
-
-JNIEXPORT jint JNICALL Java_jogamp_opengl_util_av_impl_FFMPEGMediaPlayer_getAvFormatVersion0
- (JNIEnv *env, jclass clazz) {
- return (jint) sp_avformat_version();
-}
-
-JNIEXPORT jint JNICALL Java_jogamp_opengl_util_av_impl_FFMPEGMediaPlayer_getAvCodecVersion0
- (JNIEnv *env, jclass clazz) {
- return (jint) sp_avcodec_version();
-}
-
-JNIEXPORT jboolean JNICALL Java_jogamp_opengl_util_av_impl_FFMPEGMediaPlayer_initIDs0
- (JNIEnv *env, jclass clazz)
-{
- JoglCommon_init(env);
-
- jclass c;
- if (ffmpegMediaPlayerClazz != NULL) {
- return;
- }
-
- c = (*env)->FindClass(env, ClazzNameFFMPEGMediaPlayer);
- if(NULL==c) {
- JoglCommon_FatalError(env, "JOGL FFMPEG: can't find %s", ClazzNameFFMPEGMediaPlayer);
- }
- ffmpegMediaPlayerClazz = (jclass)(*env)->NewGlobalRef(env, c);
- (*env)->DeleteLocalRef(env, c);
- if(NULL==ffmpegMediaPlayerClazz) {
- JoglCommon_FatalError(env, "JOGL FFMPEG: can't use %s", ClazzNameFFMPEGMediaPlayer);
- }
-
- jni_mid_pushSound = (*env)->GetMethodID(env, ffmpegMediaPlayerClazz, "pushSound", "(Ljava/nio/ByteBuffer;II)V");
- jni_mid_updateAttributes1 = (*env)->GetMethodID(env, ffmpegMediaPlayerClazz, "updateAttributes", "(IIIIIFIILjava/lang/String;Ljava/lang/String;)V");
- jni_mid_updateAttributes2 = (*env)->GetMethodID(env, ffmpegMediaPlayerClazz, "updateAttributes2", "(IIIIIIIIII)V");
-
- if(jni_mid_pushSound == NULL ||
- jni_mid_updateAttributes1 == NULL ||
- jni_mid_updateAttributes2 == NULL) {
- return JNI_FALSE;
- }
- return JNI_TRUE;
-}
-
-JNIEXPORT jlong JNICALL Java_jogamp_opengl_util_av_impl_FFMPEGMediaPlayer_createInstance0
- (JNIEnv *env, jobject instance, jboolean verbose)
-{
- FFMPEGToolBasicAV_t * pAV = calloc(1, sizeof(FFMPEGToolBasicAV_t));
- if(NULL==pAV) {
- JoglCommon_throwNewRuntimeException(env, "Couldn't alloc instance");
- return 0;
- }
- // Register all formats and codecs
- sp_av_register_all();
- // Network too ..
- if(HAS_FUNC(sp_avformat_network_init)) {
- sp_avformat_network_init();
- }
-
- pAV->verbose = verbose;
- pAV->vid=-1;
- pAV->aid=-1;
-
- return (jlong) (intptr_t) pAV;
-}
-
-JNIEXPORT void JNICALL Java_jogamp_opengl_util_av_impl_FFMPEGMediaPlayer_destroyInstance0
- (JNIEnv *env, jobject instance, jlong ptr)
-{
- FFMPEGToolBasicAV_t *pAV = (FFMPEGToolBasicAV_t *)((void *)((intptr_t)ptr));
- if (pAV != NULL) {
- // stop assumed ..
- freeInstance(pAV);
- }
-}
-
-JNIEXPORT void JNICALL Java_jogamp_opengl_util_av_impl_FFMPEGMediaPlayer_setStream0
- (JNIEnv *env, jobject instance, jlong ptr, jstring jURL, jint vid, jint aid, jint audioFrameCount)
-{
- int res, i;
- jboolean iscopy;
- FFMPEGToolBasicAV_t *pAV = (FFMPEGToolBasicAV_t *)(intptr_t)ptr;
-
- if (pAV == NULL) {
- JoglCommon_throwNewRuntimeException(env, "NULL AV ptr");
- return;
- }
-
- pAV->pFormatCtx = sp_avformat_alloc_context();
-
- // Open video file
- const char *urlPath = (*env)->GetStringUTFChars(env, jURL, &iscopy);
- res = sp_avformat_open_input(&pAV->pFormatCtx, urlPath, NULL, NULL);
- if(res != 0) {
- (*env)->ReleaseStringChars(env, jURL, (const jchar *)urlPath);
- JoglCommon_throwNewRuntimeException(env, "Couldn't open URL");
- return;
- }
-
- // Retrieve detailed stream information
- if(HAS_FUNC(sp_avformat_find_stream_info)) {
- if(sp_avformat_find_stream_info(pAV->pFormatCtx, NULL)<0) {
- (*env)->ReleaseStringChars(env, jURL, (const jchar *)urlPath);
- JoglCommon_throwNewRuntimeException(env, "Couldn't find stream information");
- return;
- }
- } else {
- if(sp_av_find_stream_info(pAV->pFormatCtx)<0) {
- (*env)->ReleaseStringChars(env, jURL, (const jchar *)urlPath);
- JoglCommon_throwNewRuntimeException(env, "Couldn't find stream information");
- return;
- }
- }
-
- if(pAV->verbose) {
- // Dump information about file onto standard error
- sp_av_dump_format(pAV->pFormatCtx, 0, urlPath, JNI_FALSE);
- }
- (*env)->ReleaseStringChars(env, jURL, (const jchar *)urlPath);
- // FIXME: Libav Binary compatibility! JAU01
- if (pAV->pFormatCtx->duration != AV_NOPTS_VALUE) {
- pAV->duration = pAV->pFormatCtx->duration / AV_TIME_BASE_MSEC;
- }
- if (pAV->pFormatCtx->start_time != AV_NOPTS_VALUE) {
- pAV->start_time = pAV->pFormatCtx->start_time / AV_TIME_BASE_MSEC;
- }
- if (pAV->pFormatCtx->bit_rate) {
- pAV->bps_stream = pAV->pFormatCtx->bit_rate;
- }
-
- fprintf(stderr, "Streams: %d\n", pAV->pFormatCtx->nb_streams); // JAU
-
- // Find the first audio and video stream, or the one matching vid
- // FIXME: Libav Binary compatibility! JAU01
- for(i=0; ( -1==pAV->aid || -1==pAV->vid ) && i<pAV->pFormatCtx->nb_streams; i++) {
- AVStream *st = pAV->pFormatCtx->streams[i];
- fprintf(stderr, "Stream: %d: is-video %d, is-audio %d\n", i, (AVMEDIA_TYPE_VIDEO == st->codec->codec_type), AVMEDIA_TYPE_AUDIO == st->codec->codec_type); // JAU
- if(AVMEDIA_TYPE_VIDEO == st->codec->codec_type) {
- if(-1==pAV->vid && (-1==vid || vid == i) ) {
- pAV->pVStream = st;
- pAV->vid=i;
- }
- } else if(AVMEDIA_TYPE_AUDIO == st->codec->codec_type) {
- if(-1==pAV->aid && (-1==aid || aid == i) ) {
- pAV->pAStream = st;
- pAV->aid=i;
- }
- }
- }
-
- fprintf(stderr, "Found vid %d, aid %d\n", pAV->vid, pAV->aid); // JAU
-
- if(0<=pAV->aid) {
- // Get a pointer to the codec context for the audio stream
- // FIXME: Libav Binary compatibility! JAU01
- pAV->pACodecCtx=pAV->pAStream->codec;
-
- // FIXME: Libav Binary compatibility! JAU01
- if (pAV->pACodecCtx->bit_rate) {
- pAV->bps_audio = pAV->pACodecCtx->bit_rate;
- }
- sp_avcodec_string(pAV->acodec, sizeof(pAV->acodec), pAV->pACodecCtx, 0);
-
- // Find the decoder for the audio stream
- pAV->pACodec=sp_avcodec_find_decoder(pAV->pACodecCtx->codec_id);
- if(pAV->pACodec==NULL) {
- JoglCommon_throwNewRuntimeException(env, "Couldn't find audio codec %d, %s", pAV->pACodecCtx->codec_id, pAV->acodec);
- return;
- }
-
- // Open codec
- if(HAS_FUNC(sp_avcodec_open2)) {
- res = sp_avcodec_open2(pAV->pACodecCtx, pAV->pACodec, NULL);
- } else {
- res = sp_avcodec_open(pAV->pACodecCtx, pAV->pACodec);
- }
- if(res<0) {
- JoglCommon_throwNewRuntimeException(env, "Couldn't open audio codec %d, %s", pAV->pACodecCtx->codec_id, pAV->acodec);
- return;
- }
-
- // Allocate audio frames
- // FIXME: Libav Binary compatibility! JAU01
- pAV->aSampleRate = pAV->pACodecCtx->sample_rate;
- pAV->aChannels = pAV->pACodecCtx->channels;
- pAV->aFrameSize = pAV->pACodecCtx->frame_size;
- pAV->aSampleFmt = pAV->pACodecCtx->sample_fmt;
-
- pAV->aFrameCount = audioFrameCount;
- pAV->pAFrames = calloc(audioFrameCount, sizeof(AVFrame*));
- for(i=0; i<pAV->aFrameCount; i++) {
- pAV->pAFrames[i]=sp_avcodec_alloc_frame();
- if(pAV->pAFrames[i]==NULL) {
- JoglCommon_throwNewRuntimeException(env, "Couldn't alloc audio frame %d / %d", i, audioFrameCount);
- return;
- }
- }
- pAV->aFrameCurrent = 0;
- }
-
- if(0<=pAV->vid) {
- // Get a pointer to the codec context for the video stream
- // FIXME: Libav Binary compatibility! JAU01
- pAV->pVCodecCtx=pAV->pVStream->codec;
- #if 0
- pAV->pVCodecCtx->get_format = my_get_format;
- #endif
-
- if (pAV->pVCodecCtx->bit_rate) {
- // FIXME: Libav Binary compatibility! JAU01
- pAV->bps_video = pAV->pVCodecCtx->bit_rate;
- }
- sp_avcodec_string(pAV->vcodec, sizeof(pAV->vcodec), pAV->pVCodecCtx, 0);
-
- // Find the decoder for the video stream
- pAV->pVCodec=sp_avcodec_find_decoder(pAV->pVCodecCtx->codec_id);
- if(pAV->pVCodec==NULL) {
- JoglCommon_throwNewRuntimeException(env, "Couldn't find video codec %d, %s", pAV->pVCodecCtx->codec_id, pAV->vcodec);
- return;
- }
-
- // Open codec
- if(HAS_FUNC(sp_avcodec_open2)) {
- res = sp_avcodec_open2(pAV->pVCodecCtx, pAV->pVCodec, NULL);
- } else {
- res = sp_avcodec_open(pAV->pVCodecCtx, pAV->pVCodec);
- }
- if(res<0) {
- JoglCommon_throwNewRuntimeException(env, "Couldn't open video codec %d, %s", pAV->pVCodecCtx->codec_id, pAV->vcodec);
- return;
- }
-
- // Hack to correct wrong frame rates that seem to be generated by some codecs
- // FIXME: Libav Binary compatibility! JAU01
- if(pAV->pVCodecCtx->time_base.num>1000 && pAV->pVCodecCtx->time_base.den==1) {
- pAV->pVCodecCtx->time_base.den=1000;
- }
- // FIXME: Libav Binary compatibility! JAU01
- pAV->fps = my_av_q2f(pAV->pVStream->avg_frame_rate);
-
- // Allocate video frames
- // FIXME: Libav Binary compatibility! JAU01
- pAV->vPixFmt = pAV->pVCodecCtx->pix_fmt;
- {
- AVPixFmtDescriptor pixDesc = sp_av_pix_fmt_descriptors[pAV->vPixFmt];
- pAV->vBitsPerPixel = sp_av_get_bits_per_pixel(&pixDesc);
- pAV->vBufferPlanes = my_getPlaneCount(&pixDesc);
- }
- pAV->pVFrame=sp_avcodec_alloc_frame();
- if( pAV->pVFrame == NULL ) {
- JoglCommon_throwNewRuntimeException(env, "Couldn't alloc video frame");
- return;
- }
- res = sp_avcodec_default_get_buffer(pAV->pVCodecCtx, pAV->pVFrame);
- if(0==res) {
- const int32_t bytesPerPixel = ( pAV->vBitsPerPixel + 7 ) / 8 ;
- if(1 == pAV->vBufferPlanes) {
- pAV->vBytesPerPixelPerPlane = bytesPerPixel;
- } else {
- pAV->vBytesPerPixelPerPlane = 1;
- }
- for(i=0; i<3; i++) {
- // FIXME: Libav Binary compatibility! JAU01
- pAV->vLinesize[i] = pAV->pVFrame->linesize[i];
- pAV->vTexWidth[i] = pAV->vLinesize[i] / pAV->vBytesPerPixelPerPlane ;
- }
- sp_avcodec_default_release_buffer(pAV->pVCodecCtx, pAV->pVFrame);
- } else {
- JoglCommon_throwNewRuntimeException(env, "Couldn't peek video buffer dimension");
- return;
- }
- }
- pAV->vPTS=0;
- pAV->aPTS=0;
- _updateJavaAttributes(env, instance, pAV);
-}
-
-JNIEXPORT jint JNICALL Java_jogamp_opengl_util_av_impl_FFMPEGMediaPlayer_readNextPacket0
- (JNIEnv *env, jobject instance, jlong ptr, jlong jProcAddrGLTexSubImage2D, jint texTarget, jint texFmt, jint texType)
-{
- FFMPEGToolBasicAV_t *pAV = (FFMPEGToolBasicAV_t *)((void *)((intptr_t)ptr));
- PFNGLTEXSUBIMAGE2DPROC procAddrGLTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC) (intptr_t)jProcAddrGLTexSubImage2D;
-
- jint res = 0; // 1 - audio, 2 - video
- AVPacket packet;
- int frameFinished;
-
- if(sp_av_read_frame(pAV->pFormatCtx, &packet)>=0) {
- if(packet.stream_index==pAV->aid) {
- // Decode audio frame
- if(NULL == pAV->pAFrames) { // no audio registered
- sp_av_free_packet(&packet);
- return res;
- }
- AVFrame* pAFrameCurrent = pAV->pAFrames[pAV->aFrameCurrent];
- pAV->aFrameCurrent = ( pAV->aFrameCurrent + 1 ) % pAV->aFrameCount ;
- int new_packet = 1;
- int len1;
- int flush_complete = 0;
- while (packet.size > 0 || (!packet.data && new_packet)) {
- new_packet = 0;
- if (flush_complete) {
- break;
- }
- if(HAS_FUNC(sp_avcodec_decode_audio4)) {
- len1 = sp_avcodec_decode_audio4(pAV->pACodecCtx, pAFrameCurrent, &frameFinished, &packet);
- } else {
- #if 0
- len1 = sp_avcodec_decode_audio3(pAV->pACodecCtx, int16_t *samples, int *frame_size_ptr, &frameFinished, &packet);
- #endif
- JoglCommon_throwNewRuntimeException(env, "Unimplemented: FFMPEGMediaPlayer sp_avcodec_decode_audio3 fallback");
- return 0;
- }
- if (len1 < 0) {
- // if error, we skip the frame
- packet.size = 0;
- break;
- }
- packet.data += len1;
- packet.size -= len1;
-
- if (!frameFinished) {
- // stop sending empty packets if the decoder is finished
- if (!packet.data && pAV->pACodecCtx->codec->capabilities & CODEC_CAP_DELAY) {
- flush_complete = 1;
- }
- continue;
- }
-
- int data_size = 0;
- if(HAS_FUNC(sp_av_samples_get_buffer_size)) {
- data_size = sp_av_samples_get_buffer_size(NULL /* linesize, may be NULL */,
- pAV->aChannels,
- pAFrameCurrent->nb_samples,
- pAFrameCurrent->format,
- 1 /* align */);
- }
- int32_t pts = (int64_t) ( pAFrameCurrent->pkt_pts * (int64_t) 1000 * (int64_t) pAV->pAStream->time_base.num )
- / (int64_t) pAV->pAStream->time_base.den;
- #if 0
- printf("channels %d sample_rate %d \n", pAV->aChannels , pAV->aSampleRate);
- printf("data %d \n", pAV->aFrameSize);
- #endif
- pAV->aPTS += (int64_t) ( data_size * (int64_t) 1000 )
- / (int64_t) (2 * (int64_t) pAV->aChannels * (int64_t) pAV->aSampleRate);
- if( pAV->verbose ) {
- printf("A pts %d - %d\n", pts, pAV->aPTS);
- }
- if( NULL != env ) {
- jobject jSampleData = (*env)->NewDirectByteBuffer(env, pAFrameCurrent->data[0], data_size);
- (*env)->CallVoidMethod(env, instance, jni_mid_pushSound, jSampleData, data_size, pAV->aPTS);
- }
-
- res = 1;
- }
- } else if(packet.stream_index==pAV->vid) {
- // Decode video frame
- if(NULL == pAV->pVFrame) {
- sp_av_free_packet(&packet);
- return res;
- }
-
- int new_packet = 1;
- int len1;
- int flush_complete = 0;
- while (packet.size > 0 || (!packet.data && new_packet)) {
-
- new_packet = 0;
- if (flush_complete) {
- break;
- }
-
- len1 = sp_avcodec_decode_video2(pAV->pVCodecCtx, pAV->pVFrame, &frameFinished, &packet);
-
- if (len1 < 0) {
- // if error, we skip the frame
- packet.size = 0;
- break;
- }
- packet.data += len1;
- packet.size -= len1;
-
- if (!frameFinished) {
- // stop sending empty packets if the decoder is finished
- if (!packet.data && pAV->pVCodecCtx->codec->capabilities & CODEC_CAP_DELAY) {
- flush_complete = 1;
- }
- continue;
- }
-
- res = 2;
- // FIXME: Libav Binary compatibility! JAU01
- const AVRational time_base = pAV->pVStream->time_base;
- const int64_t pts = pAV->pVFrame->pkt_pts;
- if(AV_NOPTS_VALUE != pts) { // discard invalid PTS ..
- pAV->vPTS = (pts * (int64_t) 1000 * (int64_t) time_base.num) / (int64_t) time_base.den ;
-
- #if 0
- printf("PTS %d = %ld * ( ( 1000 * %ld ) / %ld ) '1000 * time_base', time_base = %lf\n",
- pAV->vPTS, pAV->pVFrame->pkt_pts, time_base.num, time_base.den, (time_base.num/(double)time_base.den));
- #endif
- }
-
- #if 0
- printf("tex2D codec %dx%d - frame %dx%d - width %d tex / %d linesize, pixfmt 0x%X, texType 0x%x, texTarget 0x%x\n",
- pAV->pVCodecCtx->width, pAV->pVCodecCtx->height,
- pAV->pVFrame->width, pAV->pVFrame->height, pAV->vTexWidth[0], pAV->pVFrame->linesize[0],
- texFmt, texType, texTarget);
- #endif
-
- // 1st plane or complete packed frame
- // FIXME: Libav Binary compatibility! JAU01
- procAddrGLTexSubImage2D(texTarget, 0,
- 0, 0,
- pAV->vTexWidth[0], pAV->pVCodecCtx->height,
- texFmt, texType, pAV->pVFrame->data[0]);
-
- if(pAV->vPixFmt == PIX_FMT_YUV420P) {
- // U plane
- // FIXME: Libav Binary compatibility! JAU01
- procAddrGLTexSubImage2D(texTarget, 0,
- pAV->pVCodecCtx->width, 0,
- pAV->vTexWidth[1], pAV->pVCodecCtx->height/2,
- texFmt, texType, pAV->pVFrame->data[1]);
- // V plane
- // FIXME: Libav Binary compatibility! JAU01
- procAddrGLTexSubImage2D(texTarget, 0,
- pAV->pVCodecCtx->width, pAV->pVCodecCtx->height/2,
- pAV->vTexWidth[2], pAV->pVCodecCtx->height/2,
- texFmt, texType, pAV->pVFrame->data[2]);
- } // FIXME: Add more planar formats !
- }
- }
-
- // Free the packet that was allocated by av_read_frame
- // This code cause a double free and have been commented out.
- // TODO: check what release the packets memory.
- // sp_av_free_packet(&packet);
- }
- return res;
-}
-
-JNIEXPORT jint JNICALL Java_jogamp_opengl_util_av_impl_FFMPEGMediaPlayer_seek0
- (JNIEnv *env, jobject instance, jlong ptr, jint pos1)
-{
- FFMPEGToolBasicAV_t *pAV = (FFMPEGToolBasicAV_t *)((void *)((intptr_t)ptr));
- int64_t pos0 = pAV->vPTS;
- int64_t pts0 = pAV->pVFrame->pkt_pts;
- int64_t pts1 = (int64_t) (pos1 * (int64_t) pAV->pVStream->time_base.den)
- / (1000 * (int64_t) pAV->pVStream->time_base.num);
- int flags = 0;
- if(pos1 < pos0) {
- flags |= AVSEEK_FLAG_BACKWARD;
- }
- fprintf(stderr, "SEEK: pre : u %ld, p %ld -> u %ld, p %ld\n", pos0, pts0, pos1, pts1);
- sp_av_seek_frame(pAV->pFormatCtx, pAV->vid, pts1, flags);
- pAV->vPTS = (int64_t) (pAV->pVFrame->pkt_pts * (int64_t) 1000 * (int64_t) pAV->pVStream->time_base.num)
- / (int64_t) pAV->pVStream->time_base.den;
- fprintf(stderr, "SEEK: post : u %ld, p %ld\n", pAV->vPTS, pAV->pVFrame->pkt_pts);
- return pAV->vPTS;
-}
-
-JNIEXPORT jint JNICALL Java_jogamp_opengl_util_av_impl_FFMPEGMediaPlayer_getVideoPTS0
- (JNIEnv *env, jobject instance, jlong ptr)
-{
- FFMPEGToolBasicAV_t *pAV = (FFMPEGToolBasicAV_t *)((void *)((intptr_t)ptr));
- return pAV->vPTS;
-}
-
-JNIEXPORT jint JNICALL Java_jogamp_opengl_util_av_impl_FFMPEGMediaPlayer_getAudioPTS0
- (JNIEnv *env, jobject instance, jlong ptr)
-{
- FFMPEGToolBasicAV_t *pAV = (FFMPEGToolBasicAV_t *)((void *)((intptr_t)ptr));
- return pAV->aPTS;
-}
-
diff --git a/src/jogl/native/macosx/MacOSXCustomCGLCode.c b/src/jogl/native/macosx/MacOSXCustomCGLCode.c
index f8b7a80..75896c3 100644
--- a/src/jogl/native/macosx/MacOSXCustomCGLCode.c
+++ b/src/jogl/native/macosx/MacOSXCustomCGLCode.c
@@ -2,7 +2,7 @@
#include <assert.h>
-#include </usr/include/machine/types.h>
+#include <machine/types.h>
#include "macosx-window-system.h"
void CGLQueryPixelFormat(CGLPixelFormatObj fmt, int* iattrs, int niattrs, int* ivalues) {
diff --git a/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m b/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m
index 046171e..75917d2 100644
--- a/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m
+++ b/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m
@@ -150,7 +150,7 @@ extern GLboolean glIsVertexArray (GLuint array);
@end
- at interface MyNSOpenGLLayer: NSOpenGLLayer <NWDedicatedSize>
+ at interface MyNSOpenGLLayer: NSOpenGLLayer <NWDedicatedFrame>
{
@private
GLfloat gl_texCoords[8];
@@ -166,8 +166,8 @@ extern GLboolean glIsVertexArray (GLuint array);
NSOpenGLPixelFormat* parentPixelFmt;
int texWidth;
int texHeight;
- volatile int dedicatedWidth;
- volatile int dedicatedHeight;
+ volatile Bool dedicatedFrameSet;
+ volatile CGRect dedicatedFrame;
volatile NSOpenGLPixelBuffer* pbuffer;
volatile GLuint textureID;
volatile NSOpenGLPixelBuffer* newPBuffer;
@@ -206,14 +206,14 @@ extern GLboolean glIsVertexArray (GLuint array);
- (Bool)isGLSourceValid;
- (void) setGLEnabled: (Bool) enable;
-- (Bool) validateTexSizeWithDedicatedSize;
+- (Bool) validateTexSize: (CGRect) lRect;
- (void) setTextureID: (int) _texID;
- (Bool) isSamePBuffer: (NSOpenGLPixelBuffer*) p;
- (void) setNewPBuffer: (NSOpenGLPixelBuffer*)p;
- (void) applyNewPBuffer;
-- (void)setDedicatedSize:(CGSize)size; // @NWDedicatedSize
+- (void)setDedicatedFrame:(CGRect)frame quirks:(int)quirks; // @NWDedicatedFrame
- (void) setFrame:(CGRect) frame;
- (id<CAAction>)actionForKey:(NSString *)key ;
- (NSOpenGLPixelFormat *)openGLPixelFormatForDisplayMask:(uint32_t)mask;
@@ -300,9 +300,9 @@ static const GLfloat gl_verts[] = {
timespec_now(&lastWaitTime);
shallDraw = NO;
isGLEnabled = YES;
- dedicatedWidth = _texWidth;
- dedicatedHeight = _texHeight;
- [self validateTexSizeWithDedicatedSize];
+ dedicatedFrameSet = NO;
+ dedicatedFrame = CGRectMake(0, 0, _texWidth, _texHeight);
+ [self validateTexSize: dedicatedFrame];
[self setTextureID: texID];
newPBuffer = NULL;
@@ -383,11 +383,16 @@ static const GLfloat gl_verts[] = {
isGLEnabled = enable;
}
-- (Bool) validateTexSizeWithDedicatedSize
+- (Bool) validateTexSize: (CGRect) lRect
{
- if( dedicatedHeight != texHeight || dedicatedWidth != texWidth ) {
- texWidth = dedicatedWidth;
- texHeight = dedicatedHeight;
+ const int lRectW = (int) (lRect.size.width + 0.5f);
+ const int lRectH = (int) (lRect.size.height + 0.5f);
+ Bool changed;
+
+ if( lRectH != texHeight || lRectW != texWidth ) {
+ texWidth = lRectW;
+ texHeight = lRectH;
+ changed = YES;
GLfloat texCoordWidth, texCoordHeight;
if(NULL != pbuffer) {
@@ -409,16 +414,16 @@ static const GLfloat gl_verts[] = {
gl_texCoords[5] = texCoordHeight;
gl_texCoords[4] = texCoordWidth;
gl_texCoords[6] = texCoordWidth;
-#ifdef VERBOSE_ON
- CGRect lRect = [self bounds];
- DBG_PRINT("MyNSOpenGLLayer::validateTexSize %p -> tex %dx%d, bounds: %lf/%lf %lfx%lf\n",
+ #ifdef VERBOSE_ON
+ DBG_PRINT("MyNSOpenGLLayer::validateTexSize %p -> tex %dx%d, bounds: %lf/%lf %lfx%lf (%dx%d), dedicatedFrame set:%d %lf/%lf %lfx%lf\n",
self, texWidth, texHeight,
- lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height);
-#endif
- return YES;
+ lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height, lRectW, lRectH,
+ dedicatedFrameSet, dedicatedFrame.origin.x, dedicatedFrame.origin.y, dedicatedFrame.size.width, dedicatedFrame.size.height);
+ #endif
} else {
- return NO;
+ changed = NO;
}
+ return changed;
}
- (void) setTextureID: (int) _texID
@@ -560,21 +565,31 @@ static const GLfloat gl_verts[] = {
return NULL != pbuffer || NULL != newPBuffer || 0 != textureID ;
}
-// @NWDedicatedSize
-- (void)setDedicatedSize:(CGSize)size {
- DBG_PRINT("MyNSOpenGLLayer::setDedicatedSize: %p, texSize %dx%d <- %lfx%lf\n",
- self, texWidth, texHeight, size.width, size.height);
-
- dedicatedWidth = size.width;
- dedicatedHeight = size.height;
+// @NWDedicatedFrame
+- (void)setDedicatedFrame:(CGRect)dFrame quirks:(int)quirks {
+ CGRect lRect = [self frame];
+ Bool dedicatedFramePosSet = 0 != ( NW_DEDICATEDFRAME_QUIRK_POSITION & quirks );
+ Bool dedicatedFrameSizeSet = 0 != ( NW_DEDICATEDFRAME_QUIRK_SIZE & quirks );
+ Bool dedicatedLayoutSet = 0 != ( NW_DEDICATEDFRAME_QUIRK_LAYOUT & quirks );
+ dedicatedFrameSet = dedicatedFramePosSet || dedicatedFrameSizeSet || dedicatedLayoutSet;
+ dedicatedFrame = dFrame;
- CGRect rect = CGRectMake(0, 0, dedicatedWidth, dedicatedHeight);
- [super setFrame: rect];
+ DBG_PRINT("MyNSOpenGLLayer::setDedicatedFrame: Quirks [%d, pos %d, size %d, lout %d], %p, texSize %dx%d, %lf/%lf %lfx%lf -> %lf/%lf %lfx%lf\n",
+ quirks, dedicatedFramePosSet, dedicatedFrameSizeSet, dedicatedLayoutSet, self, texWidth, texHeight,
+ lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height,
+ dFrame.origin.x, dFrame.origin.y, dFrame.size.width, dFrame.size.height);
+
+ if( dedicatedFrameSet ) {
+ [super setFrame: dedicatedFrame];
+ }
}
- (void) setFrame:(CGRect) frame {
- CGRect rect = CGRectMake(0, 0, dedicatedWidth, dedicatedHeight);
- [super setFrame: rect];
+ if( dedicatedFrameSet ) {
+ [super setFrame: dedicatedFrame];
+ } else {
+ [super setFrame: frame];
+ }
}
- (id<CAAction>)actionForKey:(NSString *)key
@@ -622,7 +637,7 @@ static const GLfloat gl_verts[] = {
GLenum textureTarget;
- Bool texSizeChanged = [self validateTexSizeWithDedicatedSize];
+ Bool texSizeChanged = [self validateTexSize: ( dedicatedFrameSet ? dedicatedFrame : [self bounds] ) ];
if( texSizeChanged ) {
[context update];
}
diff --git a/src/jogl/native/openmax/jogamp_opengl_util_av_impl_OMXGLMediaPlayer.c b/src/jogl/native/openmax/jogamp_opengl_util_av_impl_OMXGLMediaPlayer.c
index 964ac64..ec68a24 100644
--- a/src/jogl/native/openmax/jogamp_opengl_util_av_impl_OMXGLMediaPlayer.c
+++ b/src/jogl/native/openmax/jogamp_opengl_util_av_impl_OMXGLMediaPlayer.c
@@ -107,11 +107,11 @@ JNIEXPORT void JNICALL Java_jogamp_opengl_util_av_impl_OMXGLMediaPlayer__1setStr
}
JNIEXPORT void JNICALL Java_jogamp_opengl_util_av_impl_OMXGLMediaPlayer__1setStreamEGLImageTexture2D
- (JNIEnv *env, jobject instance, jlong ptr, jint i, jint tex, jlong image, jlong sync)
+ (JNIEnv *env, jobject instance, jlong ptr, jint tex, jlong image, jlong sync)
{
OMXToolBasicAV_t *pOMXAV = (OMXToolBasicAV_t *)((void *)((intptr_t)ptr));
if (pOMXAV != NULL) {
- OMXToolBasicAV_SetStreamEGLImageTexture2D( pOMXAV, i, (GLuint) tex,
+ OMXToolBasicAV_SetStreamEGLImageTexture2D( pOMXAV, (GLuint) tex,
(EGLImageKHR)(intptr_t)image,
(EGLSyncKHR)(intptr_t)sync);
}
diff --git a/src/jogl/native/openmax/omx_tool.c b/src/jogl/native/openmax/omx_tool.c
index 16c43f6..35d5cfa 100644
--- a/src/jogl/native/openmax/omx_tool.c
+++ b/src/jogl/native/openmax/omx_tool.c
@@ -1049,21 +1049,17 @@ void OMXToolBasicAV_SetStream(OMXToolBasicAV_t * pOMXAV, int vBufferNum, const K
DBG_PRINT( "SetStream X\n");
}
-void OMXToolBasicAV_SetStreamEGLImageTexture2D(OMXToolBasicAV_t * pOMXAV, KDint i, GLuint tex, EGLImageKHR image, EGLSyncKHR sync)
+void OMXToolBasicAV_SetStreamEGLImageTexture2D(OMXToolBasicAV_t * pOMXAV, GLuint tex, EGLImageKHR image, EGLSyncKHR sync)
{
if(NULL==pOMXAV) {
JoglCommon_throwNewRuntimeException(0, "OMX instance null\n");
return;
}
- DBG_PRINT( "SetStreamEGLImg %p #%d/%d t:%d i:%p s:%p..\n", pOMXAV, i, pOMXAV->vBufferNum, tex, image, sync);
- if(i<0||i>=pOMXAV->vBufferNum) {
- JoglCommon_throwNewRuntimeException(0, "Buffer index out of range: %d\n", i);
- return;
- }
+ DBG_PRINT( "SetStreamEGLImg %p count %d t:%d i:%p s:%p..\n", pOMXAV, pOMXAV->vBufferNum, tex, image, sync);
kdThreadMutexLock(pOMXAV->mutex);
{
- OMXToolImageBuffer_t *pBuf = &pOMXAV->buffers[i];
+ OMXToolImageBuffer_t *pBuf = &pOMXAV->buffers[0]; // FIXME: Move all sync/buffer handling to Java - Already done -> GLMediaPlayerImpl
pBuf->tex=tex;
pBuf->image=image;
pBuf->sync=sync;
@@ -1644,7 +1640,7 @@ int ModuleTest()
printf("6 eglGetError: 0x%x\n", eglGetError());
- if(OMXToolBasicAV_SetStreamEGLImageTexture2D(pOMXAV, i, tex, image, sync)) {
+ if(OMXToolBasicAV_SetStreamEGLImageTexture2D(pOMXAV, tex, image, sync)) {
return -1;
}
}
diff --git a/src/jogl/native/openmax/omx_tool.h b/src/jogl/native/openmax/omx_tool.h
index 414befc..022c56c 100644
--- a/src/jogl/native/openmax/omx_tool.h
+++ b/src/jogl/native/openmax/omx_tool.h
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <string.h>
+// FIXME: Move all sync/buffer handling to Java - Already done -> GLMediaPlayerImpl
#define EGLIMAGE_MAX_BUFFERS 4
extern int USE_OPENGL;
@@ -90,6 +91,7 @@ typedef struct {
KDThreadMutex * mutex;
KDThreadSem * flushSem;
+ // FIXME: Move all sync/buffer handling to Java - Already done -> GLMediaPlayerImpl
OMXToolImageBuffer_t buffers[EGLIMAGE_MAX_BUFFERS];
int vBufferNum;
int glPos;
@@ -118,7 +120,7 @@ KDint OMXToolBasicAV_SetState(OMXToolBasicAV_t * pOMXAV, OMX_STATETYPE state, KD
//
OMXToolBasicAV_t * OMXToolBasicAV_CreateInstance(EGLDisplay dpy); // #1
void OMXToolBasicAV_SetStream(OMXToolBasicAV_t * pOMXAV, int vBufferNum, const KDchar * stream); // #2
-void OMXToolBasicAV_SetStreamEGLImageTexture2D(OMXToolBasicAV_t * pOMXAV, KDint i, GLuint tex, EGLImageKHR image, EGLSyncKHR sync); // #3
+void OMXToolBasicAV_SetStreamEGLImageTexture2D(OMXToolBasicAV_t * pOMXAV, GLuint tex, EGLImageKHR image, EGLSyncKHR sync); // #3
void OMXToolBasicAV_ActivateStream(OMXToolBasicAV_t * pOMXAV); // #4
void OMXToolBasicAV_AttachVideoRenderer(OMXToolBasicAV_t * pOMXAV); // Stop, DetachVideoRenderer, SetEGLImageTexture2D .. before ..
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookMutableSize.java b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookMutableSize.java
index 22c95f3..c98bf54 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookMutableSize.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookMutableSize.java
@@ -29,11 +29,11 @@ public class DelegatedUpstreamSurfaceHookMutableSize extends UpstreamSurfaceHook
upstream.destroy(s);
}
}
-
+
@Override
public String toString() {
- return getClass().getSimpleName()+"[ "+ width + "x" + height + ", " + upstream + "]";
+ return getClass().getSimpleName()+"[ "+ width + "x" + height + ", " + upstream + "]";
}
-
+
}
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java
index 85e2458..1557f4e 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java
@@ -42,13 +42,13 @@ public class DelegatedUpstreamSurfaceHookWithSurfaceSize implements UpstreamSurf
@Override
public final int getHeight(ProxySurface s) {
return surface.getHeight();
- }
-
+ }
+
@Override
public String toString() {
- final String us_s = null != surface ? ( surface.getClass().getName() + ": 0x" + Long.toHexString(surface.getSurfaceHandle()) + " " +surface.getWidth() + "x" + surface.getHeight() ) : "nil";
+ final String us_s = null != surface ? ( surface.getClass().getName() + ": 0x" + Long.toHexString(surface.getSurfaceHandle()) + " " +surface.getWidth() + "x" + surface.getHeight() ) : "nil";
return getClass().getSimpleName()+"["+upstream+", "+us_s+"]";
}
-
+
}
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/MutableGraphicsConfiguration.java b/src/nativewindow/classes/com/jogamp/nativewindow/MutableGraphicsConfiguration.java
index eaad513..8b8ccb1 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/MutableGraphicsConfiguration.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/MutableGraphicsConfiguration.java
@@ -41,10 +41,10 @@ public class MutableGraphicsConfiguration extends DefaultGraphicsConfiguration {
public void setChosenCapabilities(CapabilitiesImmutable caps) {
super.setChosenCapabilities(caps);
}
-
+
@Override
public void setScreen(AbstractGraphicsScreen screen) {
super.setScreen(screen);
}
-
+
}
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowVersion.java b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowVersion.java
index 29f4964..a8dd916 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowVersion.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowVersion.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.common.GlueGenVersion;
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java
index 29c540a..5838c7a 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java
@@ -18,9 +18,9 @@ public class UpstreamSurfaceHookMutableSize implements UpstreamSurfaceHook.Mutab
@Override
public final void setSize(int width, int height) {
this.width = width;
- this.height = height;
+ this.height = height;
}
-
+
@Override
public final int getWidth(ProxySurface s) {
return width;
@@ -35,11 +35,11 @@ public class UpstreamSurfaceHookMutableSize implements UpstreamSurfaceHook.Mutab
@Override
public void destroy(ProxySurface s) { /* nop */ }
-
+
@Override
public String toString() {
- return getClass().getSimpleName()+"[ "+ width + "x" + height + "]";
+ return getClass().getSimpleName()+"[ "+ width + "x" + height + "]";
}
-
+
}
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsConfiguration.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsConfiguration.java
index 7e3d30a..aa9b876 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsConfiguration.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsConfiguration.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -57,7 +57,7 @@ public class AWTGraphicsConfiguration extends DefaultGraphicsConfiguration imple
private GraphicsConfiguration config;
AbstractGraphicsConfiguration encapsulated;
- public AWTGraphicsConfiguration(AWTGraphicsScreen screen,
+ public AWTGraphicsConfiguration(AWTGraphicsScreen screen,
CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested,
GraphicsConfiguration config, AbstractGraphicsConfiguration encapsulated) {
super(screen, capsChosen, capsRequested);
@@ -71,9 +71,9 @@ public class AWTGraphicsConfiguration extends DefaultGraphicsConfiguration imple
this.config = config;
this.encapsulated=null;
}
-
+
/**
- * @param capsChosen if null, <code>capsRequested</code> is copied and aligned
+ * @param capsChosen if null, <code>capsRequested</code> is copied and aligned
* with the graphics {@link Capabilities} of the AWT Component to produce the chosen {@link Capabilities}.
* Otherwise the <code>capsChosen</code> is used.
* @param capsRequested if null, default {@link Capabilities} are used, otherwise the given values.
@@ -81,7 +81,7 @@ public class AWTGraphicsConfiguration extends DefaultGraphicsConfiguration imple
public static AWTGraphicsConfiguration create(Component awtComp, CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested) {
final GraphicsConfiguration awtGfxConfig = awtComp.getGraphicsConfiguration();
if(null==awtGfxConfig) {
- throw new NativeWindowException("AWTGraphicsConfiguration.create: Null AWT GraphicsConfiguration @ "+awtComp);
+ throw new NativeWindowException("AWTGraphicsConfiguration.create: Null AWT GraphicsConfiguration @ "+awtComp);
}
final GraphicsDevice awtGraphicsDevice = awtGfxConfig.getDevice();
if(null==awtGraphicsDevice) {
@@ -109,10 +109,11 @@ public class AWTGraphicsConfiguration extends DefaultGraphicsConfiguration imple
}
// open access to superclass method
+ @Override
public void setChosenCapabilities(CapabilitiesImmutable capsChosen) {
super.setChosenCapabilities(capsChosen);
}
-
+
@Override
public Object clone() {
return super.clone();
@@ -171,7 +172,7 @@ public class AWTGraphicsConfiguration extends DefaultGraphicsConfiguration imple
public String toString() {
return getClass().getSimpleName()+"[" + getScreen() +
",\n\tchosen " + capabilitiesChosen+
- ",\n\trequested " + capabilitiesRequested+
+ ",\n\trequested " + capabilitiesRequested+
",\n\t" + config +
",\n\tencapsulated "+encapsulated+"]";
}
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsDevice.java
index 635e6d2..a7fa535 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsDevice.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsDevice.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 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
@@ -29,11 +29,11 @@
* 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.
*/
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsScreen.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsScreen.java
index f4ee06e..83d6efa 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsScreen.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTGraphicsScreen.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -87,6 +87,7 @@ public class AWTGraphicsScreen extends DefaultGraphicsScreen implements Cloneabl
return new AWTGraphicsScreen(AWTGraphicsDevice.createDefault());
}
+ @Override
public Object clone() {
return super.clone();
}
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTPrintLifecycle.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTPrintLifecycle.java
new file mode 100644
index 0000000..44163fc
--- /dev/null
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTPrintLifecycle.java
@@ -0,0 +1,175 @@
+/**
+ * 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.
+ */
+package com.jogamp.nativewindow.awt;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.print.PrinterJob;
+
+import jogamp.nativewindow.awt.AWTMisc;
+
+/**
+ * Interface describing print lifecycle to support AWT printing,
+ * e.g. on AWT {@link javax.media.opengl.GLAutoDrawable GLAutoDrawable}s.
+ * <a name="impl"><h5>Implementations</h5></a>
+ * <p>
+ * Implementing {@link javax.media.opengl.GLAutoDrawable GLAutoDrawable} classes based on AWT
+ * supporting {@link Component#print(Graphics)} shall implement this interface.
+ * </p>
+ * <a name="usage"><h5>Usage</h5></a>
+ * <p>
+ * Users attempting to print an AWT {@link Container} containing {@link AWTPrintLifecycle} elements
+ * shall consider decorating the {@link Container#printAll(Graphics)} call with<br>
+ * {@link #setupPrint(double, double, int, int, int) setupPrint(..)} and {@link #releasePrint()}
+ * on all {@link AWTPrintLifecycle} elements in the {@link Container}.<br>
+ * To minimize this burden, a user can use {@link Context#setupPrint(Container, double, double, int, int, int) Context.setupPrint(..)}:
+ * <pre>
+ * Container cont;
+ * double scaleGLMatXY = 72.0/glDPI;
+ * int numSamples = 0; // leave multisampling as-is
+ * PrinterJob job;
+ * ...
+ final AWTPrintLifecycle.Context ctx = AWTPrintLifecycle.Context.setupPrint(cont, scaleGLMatXY, scaleGLMatXY, numSamples);
+ try {
+ AWTEDTExecutor.singleton.invoke(true, new Runnable() {
+ public void run() {
+ try {
+ job.print();
+ } catch (PrinterException ex) {
+ ex.printStackTrace();
+ }
+ } });
+ } finally {
+ ctx.releasePrint();
+ }
+ *
+ * </pre>
+ * </p>
+ */
+public interface AWTPrintLifecycle {
+
+ public static final int DEFAULT_PRINT_TILE_SIZE = 1024;
+
+
+ /**
+ * Shall be called before {@link PrinterJob#print()}.
+ * <p>
+ * See <a href="#usage">Usage</a>.
+ * </p>
+ * @param scaleMatX {@link Graphics2D} {@link Graphics2D#scale(double, double) scaling factor}, i.e. rendering 1/scaleMatX * width pixels
+ * @param scaleMatY {@link Graphics2D} {@link Graphics2D#scale(double, double) scaling factor}, i.e. rendering 1/scaleMatY * height pixels
+ * @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.
+ */
+ void setupPrint(double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight);
+
+ /**
+ * Shall be called after {@link PrinterJob#print()}.
+ * <p>
+ * See <a href="#usage">Usage</a>.
+ * </p>
+ */
+ void releasePrint();
+
+ /**
+ * Convenient {@link AWTPrintLifecycle} context simplifying calling {@link AWTPrintLifecycle#setupPrint(double, double, int, int, int) setupPrint(..)}
+ * and {@link AWTPrintLifecycle#releasePrint()} on all {@link AWTPrintLifecycle} elements of a {@link Container}.
+ * <p>
+ * See <a href="#usage">Usage</a>.
+ * </p>
+ */
+ public static class Context {
+ /**
+ * <p>
+ * See <a href="#usage">Usage</a>.
+ * </p>
+ *
+ * @param c container to be traversed through to perform {@link AWTPrintLifecycle#setupPrint(double, double, int, int, int) setupPrint(..)} on all {@link AWTPrintLifecycle} elements.
+ * @param scaleMatX {@link Graphics2D} {@link Graphics2D#scale(double, double) scaling factor}, i.e. rendering 1/scaleMatX * width pixels
+ * @param scaleMatY {@link Graphics2D} {@link Graphics2D#scale(double, double) scaling factor}, i.e. rendering 1/scaleMatY * height pixels
+ * @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples
+ * @param tileWidth custom tile width for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
+ * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
+ * @return the context
+ */
+ public static Context setupPrint(Container c, double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight) {
+ final Context t = new Context(c, scaleMatX, scaleMatY, numSamples, tileWidth, tileHeight);
+ t.setupPrint(c);
+ return t;
+ }
+
+ /**
+ * <p>
+ * See <a href="#usage">Usage</a>.
+ * </p>
+ */
+ public void releasePrint() {
+ count = AWTMisc.performAction(cont, AWTPrintLifecycle.class, releaseAction);
+ }
+
+ /**
+ * @return count of performed actions of last {@link #setupPrint(Container, double, double, int, int, int) setupPrint(..)} or {@link #releasePrint()}.
+ */
+ public int getCount() { return count; }
+
+ private final Container cont;
+ private final double scaleMatX;
+ private final double scaleMatY;
+ private final int numSamples;
+ private final int tileWidth;
+ private final int tileHeight;
+ private int count;
+
+ private final AWTMisc.ComponentAction setupAction = new AWTMisc.ComponentAction() {
+ @Override
+ public void run(Component c) {
+ ((AWTPrintLifecycle)c).setupPrint(scaleMatX, scaleMatY, numSamples, tileWidth, tileHeight);
+ } };
+ private final AWTMisc.ComponentAction releaseAction = new AWTMisc.ComponentAction() {
+ @Override
+ public void run(Component c) {
+ ((AWTPrintLifecycle)c).releasePrint();
+ } };
+
+ private Context(Container c, double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight) {
+ this.cont = c;
+ this.scaleMatX = scaleMatX;
+ this.scaleMatY = scaleMatY;
+ this.numSamples = numSamples;
+ this.tileWidth = tileWidth;
+ this.tileHeight = tileHeight;
+ this.count = 0;
+ }
+ private void setupPrint(Container c) {
+ count = AWTMisc.performAction(c, AWTPrintLifecycle.class, setupAction);
+ }
+ }
+}
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java
index e499ff7..27275c6 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/AWTWindowClosingProtocol.java
@@ -78,7 +78,7 @@ public class AWTWindowClosingProtocol implements WindowClosingProtocol {
/**
* Adds this closing listener to the components Window if exist and only one time.
* <p>
- * If the closing listener is already added, and {@link IllegalStateException} is thrown.
+ * If the closing listener is already added, and {@link IllegalStateException} is thrown.
* </p>
*
* @return true if added, otherwise false.
@@ -119,6 +119,7 @@ public class AWTWindowClosingProtocol implements WindowClosingProtocol {
* otherwise return the AWT/Swing close operation value translated to
* a {@link WindowClosingProtocol} value .
*/
+ @Override
public final WindowClosingMode getDefaultCloseOperation() {
synchronized(closingListenerLock) {
if(defaultCloseOperationSetByUser) {
@@ -129,6 +130,7 @@ public class AWTWindowClosingProtocol implements WindowClosingProtocol {
return AWTMisc.getNWClosingOperation(comp);
}
+ @Override
public final WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) {
synchronized(closingListenerLock) {
final WindowClosingMode _op = defaultCloseOperation;
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/DirectDataBufferInt.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/DirectDataBufferInt.java
new file mode 100644
index 0000000..eeec663
--- /dev/null
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/DirectDataBufferInt.java
@@ -0,0 +1,297 @@
+/**
+ * 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.
+ */
+package com.jogamp.nativewindow.awt;
+
+import java.awt.Point;
+import java.awt.color.ColorSpace;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.DataBuffer;
+import java.awt.image.DirectColorModel;
+import java.awt.image.SampleModel;
+import java.awt.image.SinglePixelPackedSampleModel;
+import java.awt.image.WritableRaster;
+import java.nio.IntBuffer;
+import java.util.Hashtable;
+
+import com.jogamp.common.nio.Buffers;
+
+/**
+ * {@link DataBuffer} specialization using NIO direct buffer of type {@link DataBuffer#TYPE_INT} as storage.
+ */
+public final class DirectDataBufferInt extends DataBuffer {
+
+ public static class DirectWritableRaster extends WritableRaster {
+ protected DirectWritableRaster(SampleModel sampleModel, DirectDataBufferInt dataBuffer, Point origin) {
+ super(sampleModel, dataBuffer, origin);
+ }
+ }
+
+ public static class BufferedImageInt extends BufferedImage {
+ final int customImageType;
+ public BufferedImageInt (int customImageType, ColorModel cm, WritableRaster raster, Hashtable<?,?> properties) {
+ super(cm, raster, false /* isRasterPremultiplied */, properties);
+ this.customImageType = customImageType;
+ }
+
+ /**
+ * @return one of the custom image-type values {@link BufferedImage#TYPE_INT_ARGB TYPE_INT_ARGB},
+ * {@link BufferedImage#TYPE_INT_ARGB_PRE TYPE_INT_ARGB_PRE},
+ * {@link BufferedImage#TYPE_INT_RGB TYPE_INT_RGB} or {@link BufferedImage#TYPE_INT_BGR TYPE_INT_BGR}.
+ */
+ public int getCustomType() {
+ return customImageType;
+ }
+
+ @Override
+ public String toString() {
+ return "BufferedImageInt@"+Integer.toHexString(hashCode())
+ +": custom/internal type = "+customImageType+"/"+getType()
+ +" "+getColorModel()+" "+getRaster();
+ }
+ }
+
+ /**
+ * Creates a {@link BufferedImageInt} using a {@link DirectColorModel direct color model} in {@link ColorSpace#CS_sRGB sRGB color space}.<br>
+ * It uses a {@link DirectWritableRaster} utilizing {@link DirectDataBufferInt} storage.
+ * <p>
+ * Note that due to using the custom storage type {@link DirectDataBufferInt}, the resulting
+ * {@link BufferedImage}'s {@link BufferedImage#getType() image-type} is of {@link BufferedImage#TYPE_CUSTOM TYPE_CUSTOM}.
+ * We are not able to change this detail, since the AWT image implementation associates the {@link BufferedImage#getType() image-type}
+ * with a build-in storage-type.
+ * Use {@link BufferedImageInt#getCustomType()} to retrieve the custom image-type, which will return the <code>imageType</code>
+ * value passed here.
+ * </p>
+ *
+ * @param width
+ * @param height
+ * @param imageType one of {@link BufferedImage#TYPE_INT_ARGB TYPE_INT_ARGB}, {@link BufferedImage#TYPE_INT_ARGB_PRE TYPE_INT_ARGB_PRE},
+ * {@link BufferedImage#TYPE_INT_RGB TYPE_INT_RGB} or {@link BufferedImage#TYPE_INT_BGR TYPE_INT_BGR}.
+ * @param location origin, if <code>null</code> 0/0 is assumed.
+ * @param properties <code>Hashtable</code> of
+ * <code>String</code>/<code>Object</code> pairs. Used for {@link BufferedImage#getProperty(String)} etc.
+ * @return
+ */
+ public static BufferedImageInt createBufferedImage(int width, int height, int imageType, Point location, Hashtable<?,?> properties) {
+ final ColorSpace colorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB);
+ final int transferType = DataBuffer.TYPE_INT;
+ final int bpp, rmask, gmask, bmask, amask;
+ final boolean alphaPreMul;
+ switch( imageType ) {
+ case BufferedImage.TYPE_INT_ARGB:
+ bpp = 32;
+ rmask = 0x00ff0000;
+ gmask = 0x0000ff00;
+ bmask = 0x000000ff;
+ amask = 0xff000000;
+ alphaPreMul = false;
+ break;
+ case BufferedImage.TYPE_INT_ARGB_PRE:
+ bpp = 32;
+ rmask = 0x00ff0000;
+ gmask = 0x0000ff00;
+ bmask = 0x000000ff;
+ amask = 0xff000000;
+ alphaPreMul = true;
+ break;
+ case BufferedImage.TYPE_INT_RGB:
+ bpp = 24;
+ rmask = 0x00ff0000;
+ gmask = 0x0000ff00;
+ bmask = 0x000000ff;
+ amask = 0x0;
+ alphaPreMul = false;
+ break;
+ case BufferedImage.TYPE_INT_BGR:
+ bpp = 24;
+ rmask = 0x000000ff;
+ gmask = 0x0000ff00;
+ bmask = 0x00ff0000;
+ amask = 0x0;
+ alphaPreMul = false;
+ break;
+ default:
+ throw new IllegalArgumentException("Unsupported imageType, must be [INT_ARGB, INT_ARGB_PRE, INT_RGB, INT_BGR], has "+imageType);
+ }
+ final ColorModel colorModel = new DirectColorModel(colorSpace, bpp, rmask, gmask, bmask, amask, alphaPreMul, transferType);
+ final int[] bandMasks;
+ if ( 0 != amask ) {
+ bandMasks = new int[4];
+ bandMasks[3] = amask;
+ }
+ else {
+ bandMasks = new int[3];
+ }
+ bandMasks[0] = rmask;
+ bandMasks[1] = gmask;
+ bandMasks[2] = bmask;
+
+ final DirectDataBufferInt dataBuffer = new DirectDataBufferInt(width*height);
+ if( null == location ) {
+ location = new Point(0,0);
+ }
+ final SinglePixelPackedSampleModel sppsm = new SinglePixelPackedSampleModel(dataBuffer.getDataType(),
+ width, height, width /* scanLineStride */, bandMasks);
+ // IntegerComponentRasters must haveinteger DataBuffers:
+ // final WritableRaster raster = new IntegerInterleavedRaster(sppsm, dataBuffer, location);
+ // Not public:
+ // final WritableRaster raster = new SunWritableRaster(sppsm, dataBuffer, location);
+ final WritableRaster raster = new DirectWritableRaster(sppsm, dataBuffer, location);
+
+ return new BufferedImageInt(imageType, colorModel, raster, properties);
+ }
+
+ /** Default data bank. */
+ private IntBuffer data;
+
+ /** All data banks */
+ private IntBuffer bankdata[];
+
+ /**
+ * Constructs an nio integer-based {@link DataBuffer} with a single bank
+ * and the specified size.
+ *
+ * @param size The size of the {@link DataBuffer}.
+ */
+ public DirectDataBufferInt(int size) {
+ super(TYPE_INT, size);
+ data = Buffers.newDirectIntBuffer(size);
+ bankdata = new IntBuffer[1];
+ bankdata[0] = data;
+ }
+
+ /**
+ * Constructs an nio integer-based {@link DataBuffer} with the specified number of
+ * banks, all of which are the specified size.
+ *
+ * @param size The size of the banks in the {@link DataBuffer}.
+ * @param numBanks The number of banks in the a{@link DataBuffer}.
+ */
+ public DirectDataBufferInt(int size, int numBanks) {
+ super(TYPE_INT,size,numBanks);
+ bankdata = new IntBuffer[numBanks];
+ for (int i= 0; i < numBanks; i++) {
+ bankdata[i] = Buffers.newDirectIntBuffer(size);
+ }
+ data = bankdata[0];
+ }
+
+ /**
+ * Constructs an nio integer-based {@link DataBuffer} with a single bank using the
+ * specified array.
+ * <p>
+ * Only the first <code>size</code> elements should be used by accessors of
+ * this {@link DataBuffer}. <code>dataArray</code> must be large enough to
+ * hold <code>size</code> elements.
+ * </p>
+ *
+ * @param dataArray The integer array for the {@link DataBuffer}.
+ * @param size The size of the {@link DataBuffer} bank.
+ */
+ public DirectDataBufferInt(IntBuffer dataArray, int size) {
+ super(TYPE_INT,size);
+ data = dataArray;
+ bankdata = new IntBuffer[1];
+ bankdata[0] = data;
+ }
+
+ /**
+ * Returns the default (first) int data array in {@link DataBuffer}.
+ *
+ * @return The first integer data array.
+ */
+ public IntBuffer getData() {
+ return data;
+ }
+
+ /**
+ * Returns the data array for the specified bank.
+ *
+ * @param bank The bank whose data array you want to get.
+ * @return The data array for the specified bank.
+ */
+ public IntBuffer getData(int bank) {
+ return bankdata[bank];
+ }
+
+ /**
+ * Returns the requested data array element from the first (default) bank.
+ *
+ * @param i The data array element you want to get.
+ * @return The requested data array element as an integer.
+ * @see #setElem(int, int)
+ * @see #setElem(int, int, int)
+ */
+ @Override
+ public int getElem(int i) {
+ return data.get(i+offset);
+ }
+
+ /**
+ * Returns the requested data array element from the specified bank.
+ *
+ * @param bank The bank from which you want to get a data array element.
+ * @param i The data array element you want to get.
+ * @return The requested data array element as an integer.
+ * @see #setElem(int, int)
+ * @see #setElem(int, int, int)
+ */
+ @Override
+ public int getElem(int bank, int i) {
+ return bankdata[bank].get(i+offsets[bank]);
+ }
+
+ /**
+ * Sets the requested data array element in the first (default) bank
+ * to the specified value.
+ *
+ * @param i The data array element you want to set.
+ * @param val The integer value to which you want to set the data array element.
+ * @see #getElem(int)
+ * @see #getElem(int, int)
+ */
+ @Override
+ public void setElem(int i, int val) {
+ data.put(i+offset, val);
+ }
+
+ /**
+ * Sets the requested data array element in the specified bank
+ * to the integer value <code>i</code>.
+ * @param bank The bank in which you want to set the data array element.
+ * @param i The data array element you want to set.
+ * @param val The integer value to which you want to set the specified data array element.
+ * @see #getElem(int)
+ * @see #getElem(int, int)
+ */
+ @Override
+ public void setElem(int bank, int i, int val) {
+ bankdata[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 a71356b..a997376 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
@@ -37,15 +37,20 @@
package com.jogamp.nativewindow.awt;
+import com.jogamp.common.os.Platform;
import com.jogamp.common.util.locks.LockFactory;
import com.jogamp.common.util.locks.RecursiveLock;
import com.jogamp.nativewindow.MutableGraphicsConfiguration;
import java.awt.Component;
import java.awt.Container;
+import java.awt.Window;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
+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;
@@ -62,6 +67,7 @@ import javax.media.nativewindow.util.Rectangle;
import javax.media.nativewindow.util.RectangleImmutable;
import jogamp.nativewindow.SurfaceUpdatedHelper;
+import jogamp.nativewindow.awt.AWTMisc;
import jogamp.nativewindow.jawt.JAWT;
import jogamp.nativewindow.jawt.JAWTUtil;
import jogamp.nativewindow.jawt.JAWT_Rectangle;
@@ -73,10 +79,11 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
protected boolean shallUseOffscreenLayer = false;
// lifetime: forever
- protected Component component;
- private AWTGraphicsConfiguration config; // control access due to delegation
- private SurfaceUpdatedHelper surfaceUpdatedHelper = new SurfaceUpdatedHelper();
- private RecursiveLock surfaceLock = LockFactory.createRecursiveLock();
+ protected final Component component;
+ private final AWTGraphicsConfiguration config; // control access due to delegation
+ private final SurfaceUpdatedHelper surfaceUpdatedHelper = new SurfaceUpdatedHelper();
+ private final RecursiveLock surfaceLock = LockFactory.createRecursiveLock();
+ private final JAWTComponentListener jawtComponentListener;
// lifetime: valid after lock but may change with each 1st lock, purges after invalidate
private boolean isApplet;
@@ -103,41 +110,121 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
if(! ( config instanceof AWTGraphicsConfiguration ) ) {
throw new NativeWindowException("Error: AbstractGraphicsConfiguration is not an AWTGraphicsConfiguration: "+config);
}
+ this.component = (Component)comp;
this.config = (AWTGraphicsConfiguration) config;
- init((Component)comp);
- }
-
- private void init(Component windowObject) throws NativeWindowException {
+ this.jawtComponentListener = new JAWTComponentListener();
+ this.component.addComponentListener(jawtComponentListener);
+ this.component.addHierarchyListener(jawtComponentListener);
invalidate();
- this.component = windowObject;
this.isApplet = false;
this.offscreenSurfaceLayer = 0;
- this.component.addComponentListener(new ComponentListener() {
+ }
+ private class JAWTComponentListener implements ComponentListener, HierarchyListener {
+ private boolean localVisibility = component.isVisible();
+ private boolean globalVisibility = localVisibility;
+ private boolean visibilityPropagation = false;
+
+ private String id(Object obj) { return "0x"+Integer.toHexString(obj.hashCode()); }
+
+ private String s(ComponentEvent e) {
+ return "visible[local "+localVisibility+", global "+globalVisibility+", propag. "+visibilityPropagation+"],"+Platform.getNewline()+
+ " ** COMP "+id(e.getComponent())+": "+e.getComponent()+Platform.getNewline()+
+ " ** SOURCE "+id(e.getSource())+": "+e.getSource()+Platform.getNewline()+
+ " ** THIS "+component;
+ }
+ private String s(HierarchyEvent e) {
+ return "visible[local "+localVisibility+", global "+globalVisibility+", propag. "+visibilityPropagation+"], changeBits 0x"+Long.toHexString(e.getChangeFlags())+Platform.getNewline()+
+ " ** COMP "+id(e.getComponent())+": "+e.getComponent()+Platform.getNewline()+
+ " ** SOURCE "+id(e.getSource())+": "+e.getSource()+Platform.getNewline()+
+ " ** CHANGED "+id(e.getChanged())+": "+e.getChanged()+Platform.getNewline()+
+ " ** CHANGEDPARENT "+id(e.getChangedParent())+": "+e.getChangedParent()+Platform.getNewline()+
+ " ** THIS "+component;
+ }
+
@Override
public void componentResized(ComponentEvent e) {
- layoutSurfaceLayerIfEnabled();
+ if(DEBUG) {
+ System.err.println("JAWTWindow.componentResized: "+s(e));
+ }
+ layoutSurfaceLayerIfEnabled(globalVisibility && localVisibility);
}
@Override
public void componentMoved(ComponentEvent e) {
- layoutSurfaceLayerIfEnabled();
+ if(DEBUG) {
+ System.err.println("JAWTWindow.componentMoved: "+s(e));
+ }
+ layoutSurfaceLayerIfEnabled(globalVisibility && localVisibility);
}
@Override
public void componentShown(ComponentEvent e) {
- layoutSurfaceLayerIfEnabled();
+ if(DEBUG) {
+ System.err.println("JAWTWindow.componentShown: "+s(e));
+ }
+ layoutSurfaceLayerIfEnabled(globalVisibility && localVisibility);
}
@Override
- public void componentHidden(ComponentEvent e) { }
- });
+ public void componentHidden(ComponentEvent e) {
+ if(DEBUG) {
+ System.err.println("JAWTWindow.componentHidden: "+s(e));
+ }
+ layoutSurfaceLayerIfEnabled(globalVisibility && localVisibility);
+ }
+
+ @Override
+ public void hierarchyChanged(HierarchyEvent e) {
+ final long bits = e.getChangeFlags();
+ final java.awt.Component changed = e.getChanged();
+ if( 0 != ( java.awt.event.HierarchyEvent.DISPLAYABILITY_CHANGED & bits ) ) {
+ final boolean displayable = changed.isDisplayable();
+ final boolean propagateDisplayability = changed == component && ( displayable && localVisibility ) != component.isVisible();
+ if( propagateDisplayability ) {
+ // Propagate parent's displayability, i.e. 'removeNotify()' and 'addNotify()'
+ final boolean _visible = displayable && localVisibility;
+ visibilityPropagation = true;
+ globalVisibility = displayable;
+ if(DEBUG) {
+ System.err.println("JAWTWindow.hierarchyChanged DISPLAYABILITY_CHANGED (1): displayable "+displayable+" -> visible "+_visible+", "+s(e));
+ }
+ component.setVisible(_visible);
+ } else if(DEBUG) {
+ System.err.println("JAWTWindow.hierarchyChanged DISPLAYABILITY_CHANGED (x): displayable "+displayable+", "+s(e));
+ }
+ } else if( 0 != ( java.awt.event.HierarchyEvent.SHOWING_CHANGED & bits ) ) {
+ final boolean showing = changed.isShowing();
+ final boolean propagateVisibility = changed != component && ( showing && localVisibility ) != component.isVisible();
+ if( propagateVisibility ) {
+ // Propagate parent's visibility
+ final boolean _visible = showing && localVisibility;
+ visibilityPropagation = true;
+ globalVisibility = showing;
+ if(DEBUG) {
+ System.err.println("JAWTWindow.hierarchyChanged SHOWING_CHANGED (1): showing "+showing+" -> visible "+_visible+", "+s(e));
+ }
+ component.setVisible(_visible);
+ } else if( changed == component ) {
+ // Update component's local visibility state
+ if(!visibilityPropagation) {
+ localVisibility = showing;
+ }
+ visibilityPropagation = false;
+ if(DEBUG) {
+ System.err.println("JAWTWindow.hierarchyChanged SHOWING_CHANGED (0): showing "+showing+" -> visible "+(showing && localVisibility)+", "+s(e));
+ }
+ } else if(DEBUG) {
+ System.err.println("JAWTWindow.hierarchyChanged SHOWING_CHANGED (x): showing "+showing+" -> visible "+(showing && localVisibility)+", "+s(e));
+ }
+ }
+ }
}
protected synchronized void invalidate() {
if(DEBUG) {
System.err.println("JAWTWindow.invalidate() - "+Thread.currentThread().getName());
if( isSurfaceLayerAttached() ) {
- System.err.println("OffscreenSurfaceLayer still attached: 0x"+Long.toHexString(offscreenSurfaceLayer));
+ System.err.println("OffscreenSurfaceLayer still attached: 0x"+Long.toHexString(offscreenSurfaceLayer));
}
// Thread.dumpStack();
}
@@ -154,23 +241,17 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
protected final boolean updateBounds(JAWT_Rectangle jawtBounds) {
final Rectangle jb = new Rectangle(jawtBounds.getX(), jawtBounds.getY(), jawtBounds.getWidth(), jawtBounds.getHeight());
final boolean changed = !bounds.equals(jb);
-
+
if(changed) {
if(DEBUG) {
System.err.println("JAWTWindow.updateBounds: "+bounds+" -> "+jb);
// Thread.dumpStack();
}
- bounds.setX(jawtBounds.getX());
- bounds.setY(jawtBounds.getY());
- bounds.setWidth(jawtBounds.getWidth());
- bounds.setHeight(jawtBounds.getHeight());
-
+ bounds.set(jawtBounds.getX(), jawtBounds.getY(), jawtBounds.getWidth(), jawtBounds.getHeight());
+
if(component instanceof Container) {
- java.awt.Insets contInsets = ((Container)component).getInsets();
- insets.setLeftWidth(contInsets.left);
- insets.setRightWidth(contInsets.right);
- insets.setTopHeight(contInsets.top);
- insets.setBottomHeight(contInsets.bottom);
+ final java.awt.Insets contInsets = ((Container)component).getInsets();
+ insets.set(contInsets.left, contInsets.right, contInsets.top, contInsets.bottom);
}
}
return changed;
@@ -202,7 +283,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
//
// OffscreenLayerOption
//
-
+
@Override
public void setShallUseOffscreenLayer(boolean v) {
shallUseOffscreenLayer = v;
@@ -227,9 +308,6 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
if( !isOffscreenLayerSurfaceEnabled() ) {
throw new NativeWindowException("Not an offscreen layer surface");
}
- if(DEBUG) {
- System.err.println("JAWTWindow.attachSurfaceHandle: "+toHexString(layerHandle) + ", bounds "+bounds);
- }
attachSurfaceLayerImpl(layerHandle);
offscreenSurfaceLayer = layerHandle;
component.repaint();
@@ -242,24 +320,24 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
* Layout the offscreen layer according to the implementing class's constraints.
* <p>
* This method allows triggering a re-layout of the offscreen surface
- * in case the implementation requires it.
+ * in case the implementation requires it.
* </p>
- * <p>
+ * <p>
* Call this method if any parent or ancestor's layout has been changed,
* which could affects the layout of this surface.
* </p>
* @see #isOffscreenLayerSurfaceEnabled()
* @throws NativeWindowException if {@link #isOffscreenLayerSurfaceEnabled()} == false
*/
- protected void layoutSurfaceLayerImpl(long layerHandle, int width, int height) {}
-
- private final void layoutSurfaceLayerIfEnabled() throws NativeWindowException {
+ protected void layoutSurfaceLayerImpl(long layerHandle, boolean visible) {}
+
+ private final void layoutSurfaceLayerIfEnabled(boolean visible) throws NativeWindowException {
if( isOffscreenLayerSurfaceEnabled() && 0 != offscreenSurfaceLayer ) {
- layoutSurfaceLayerImpl(offscreenSurfaceLayer, getWidth(), getHeight());
+ layoutSurfaceLayerImpl(offscreenSurfaceLayer, visible);
}
}
-
-
+
+
@Override
public final void detachSurfaceLayer() throws NativeWindowException {
if( 0 == offscreenSurfaceLayer) {
@@ -277,35 +355,35 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
}
};
- /**
+ /**
* @param detachNotify Runnable to be called before native detachment
*/
protected void detachSurfaceLayerImpl(final long layerHandle, final Runnable detachNotify) {
throw new UnsupportedOperationException("offscreen layer not supported");
}
-
+
@Override
public final long getAttachedSurfaceLayer() {
return offscreenSurfaceLayer;
}
-
+
@Override
public final boolean isSurfaceLayerAttached() {
return 0 != offscreenSurfaceLayer;
}
-
+
@Override
public final void setChosenCapabilities(CapabilitiesImmutable caps) {
((MutableGraphicsConfiguration)getGraphicsConfiguration()).setChosenCapabilities(caps);
- getPrivateGraphicsConfiguration().setChosenCapabilities(caps);
+ getPrivateGraphicsConfiguration().setChosenCapabilities(caps);
}
-
+
@Override
public final RecursiveLock getLock() {
return surfaceLock;
}
-
+
//
// SurfaceUpdateListener
//
@@ -453,7 +531,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
public final AbstractGraphicsConfiguration getGraphicsConfiguration() {
return config.getNativeGraphicsConfiguration();
}
-
+
@Override
public final long getDisplayHandle() {
return getGraphicsConfiguration().getScreen().getDevice().getHandle();
@@ -471,7 +549,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
@Override
public final int getHeight() {
- return component.getHeight();
+ return component.getHeight();
}
//
@@ -483,7 +561,6 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
surfaceLock.lock();
try {
invalidate();
- component = null; // don't dispose the AWT component, since we are merely an immutable uplink
} finally {
surfaceLock.unlock();
}
@@ -533,7 +610,11 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
System.err.println("Warning: JAWT Lock hold, but not the AWT tree lock: "+this);
Thread.dumpStack();
}
- return getLocationOnScreenNonBlocking(storage, component);
+ if( null == storage ) {
+ storage = new Point();
+ }
+ getLocationOnScreenNonBlocking(storage, component);
+ return storage;
}
java.awt.Point awtLOS = component.getLocationOnScreen();
if(null!=storage) {
@@ -569,19 +650,33 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
}
protected abstract Point getLocationOnScreenNativeImpl(int x, int y);
- protected static Point getLocationOnScreenNonBlocking(Point storage, Component comp) {
- int x = 0;
- int y = 0;
+ protected static Component getLocationOnScreenNonBlocking(Point storage, Component comp) {
+ final java.awt.Insets insets = new java.awt.Insets(0, 0, 0, 0); // DEBUG
+ Component last = null;
while(null != comp) {
- x += comp.getX();
- y += comp.getY();
+ final int dx = comp.getX();
+ final int dy = comp.getY();
+ if( DEBUG ) {
+ final java.awt.Insets ins = AWTMisc.getInsets(comp, false);
+ if( null != ins ) {
+ insets.bottom += ins.bottom;
+ insets.top += ins.top;
+ insets.left += ins.left;
+ insets.right += ins.right;
+ }
+ System.err.print("LOS: "+storage+" + "+comp.getClass().getName()+"["+dx+"/"+dy+", vis "+comp.isVisible()+", ins "+ins+" -> "+insets+"] -> ");
+ }
+ storage.translate(dx, dy);
+ if( DEBUG ) {
+ System.err.println(storage);
+ }
+ last = comp;
+ if( comp instanceof Window ) { // top-level heavy-weight ?
+ break;
+ }
comp = comp.getParent();
}
- if(null!=storage) {
- storage.translate(x, y);
- return storage;
- }
- return new Point(x, y);
+ return last;
}
@Override
@@ -602,7 +697,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
}
return sb;
}
-
+
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -615,12 +710,8 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
", surfaceHandle "+toHexString(getSurfaceHandle())+
", bounds "+bounds+", insets "+insets
);
- if(null!=component) {
- sb.append(", pos "+getX()+"/"+getY()+", size "+getWidth()+"x"+getHeight()+
- ", visible "+component.isVisible());
- } else {
- sb.append(", component NULL");
- }
+ sb.append(", pos "+getX()+"/"+getY()+", size "+getWidth()+"x"+getHeight()+
+ ", visible "+component.isVisible());
sb.append(", lockedExt "+isSurfaceLockedByOtherThread()+
",\n\tconfig "+getPrivateGraphicsConfiguration()+
",\n\tawtComponent "+getAWTComponent()+
@@ -628,7 +719,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
return sb.toString();
}
-
+
protected final String toHexString(long l) {
return "0x"+Long.toHexString(l);
}
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java
index fb6d39b..c838149 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/egl/EGLGraphicsDevice.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. 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
@@ -45,7 +45,7 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
* <p>
* FIXME: This shall be removed when relocated EGL to the nativewindow package,
* since then it can be utilized directly.
- * </p>
+ * </p>
*/
public interface EGLDisplayLifecycleCallback {
/**
@@ -55,14 +55,14 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
* @return the initialized EGL display ID, or <code>0</code> if not successful
*/
public long eglGetAndInitDisplay(long[] nativeDisplayID);
-
+
/**
* Implementation should issue an <code>EGL.eglTerminate(eglDisplayHandle)</code> call.
* @param eglDisplayHandle
*/
void eglTerminate(long eglDisplayHandle);
}
-
+
/**
* Note that this is not an open connection, ie no native display handle exist.
* This constructor exist to setup a default device connection/unit.<br>
@@ -78,9 +78,9 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
this.nativeDisplayID[0] = nativeDisplayID;
this.eglLifecycleCallback = eglLifecycleCallback;
}
-
+
public long getNativeDisplayID() { return nativeDisplayID[0]; }
-
+
@Override
public Object clone() {
return super.clone();
@@ -100,7 +100,7 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
}
return false;
}
-
+
@Override
public boolean close() {
if(null != eglLifecycleCallback && 0 != handle) {
@@ -111,11 +111,11 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
}
return super.close();
}
-
+
@Override
public boolean isHandleOwner() {
return null != eglLifecycleCallback;
- }
+ }
@Override
public void clearHandleOwner() {
eglLifecycleCallback = null;
@@ -126,9 +126,9 @@ public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
}
@Override
protected Object setHandleOwnership(Object newOwnership) {
- final EGLDisplayLifecycleCallback oldOwnership = eglLifecycleCallback;
+ final EGLDisplayLifecycleCallback oldOwnership = eglLifecycleCallback;
eglLifecycleCallback = (EGLDisplayLifecycleCallback) newOwnership;
return oldOwnership;
- }
+ }
}
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/macosx/MacOSXGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/macosx/MacOSXGraphicsDevice.java
index 0dc788c..99ca006 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/macosx/MacOSXGraphicsDevice.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/macosx/MacOSXGraphicsDevice.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. 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
@@ -43,6 +43,7 @@ public class MacOSXGraphicsDevice extends DefaultGraphicsDevice implements Clone
super(NativeWindowFactory.TYPE_MACOSX, AbstractGraphicsDevice.DEFAULT_CONNECTION, unitID);
}
+ @Override
public Object clone() {
return super.clone();
}
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java
index 5c4fd82..361d61c 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/swt/SWTAccessor.java
@@ -54,28 +54,28 @@ import jogamp.nativewindow.x11.X11Lib;
public class SWTAccessor {
private static final boolean DEBUG = true;
-
+
private static final Field swt_control_handle;
private static final boolean swt_uses_long_handles;
-
- private static Object swt_osx_init = new Object();
+
+ private static Object swt_osx_init = new Object();
private static Field swt_osx_control_view = null;
private static Field swt_osx_view_id = null;
-
+
private static final String nwt;
private static final boolean isOSX;
private static final boolean isWindows;
private static final boolean isX11;
private static final boolean isX11GTK;
-
+
// X11/GTK, Windows/GDI, ..
private static final String str_handle = "handle";
-
+
// OSX/Cocoa
private static final String str_osx_view = "view"; // OSX
private static final String str_osx_id = "id"; // OSX
// static final String str_NSView = "org.eclipse.swt.internal.cocoa.NSView";
-
+
private static final Method swt_control_internal_new_GC;
private static final Method swt_control_internal_dispose_GC;
private static final String str_internal_new_GC = "internal_new_GC";
@@ -85,18 +85,18 @@ public class SWTAccessor {
public static final Class<?> OS_gtk_class;
private static final String str_OS_gtk_version = "GTK_VERSION";
public static final VersionNumber OS_gtk_version;
-
+
private static final Method OS_gtk_widget_realize;
private static final Method OS_gtk_widget_unrealize; // optional (removed in SWT 4.3)
private static final Method OS_GTK_WIDGET_WINDOW;
private static final Method OS_gtk_widget_get_window;
private static final Method OS_gdk_x11_drawable_get_xdisplay;
private static final Method OS_gdk_x11_display_get_xdisplay;
- private static final Method OS_gdk_window_get_display;
- private static final Method OS_gdk_x11_drawable_get_xid;
+ private static final Method OS_gdk_window_get_display;
+ private static final Method OS_gdk_x11_drawable_get_xid;
private static final Method OS_gdk_x11_window_get_xid;
private static final Method OS_gdk_window_set_back_pixmap;
-
+
private static final String str_gtk_widget_realize = "gtk_widget_realize";
private static final String str_gtk_widget_unrealize = "gtk_widget_unrealize";
private static final String str_GTK_WIDGET_WINDOW = "GTK_WIDGET_WINDOW";
@@ -107,11 +107,11 @@ public class SWTAccessor {
private static final String str_gdk_x11_drawable_get_xid = "gdk_x11_drawable_get_xid";
private static final String str_gdk_x11_window_get_xid = "gdk_x11_window_get_xid";
private static final String str_gdk_window_set_back_pixmap = "gdk_window_set_back_pixmap";
-
+
private static final VersionNumber GTK_VERSION_2_14_0 = new VersionNumber(2, 14, 0);
private static final VersionNumber GTK_VERSION_2_24_0 = new VersionNumber(2, 24, 0);
private static final VersionNumber GTK_VERSION_3_0_0 = new VersionNumber(3, 0, 0);
-
+
private static VersionNumber GTK_VERSION(int version) {
// return (major << 16) + (minor << 8) + micro;
final int micro = ( version ) & 0x0f;
@@ -119,20 +119,21 @@ public class SWTAccessor {
final int major = ( version >> 16 ) & 0x0f;
return new VersionNumber(major, minor, micro);
}
-
+
static {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
NativeWindowFactory.initSingleton(); // last resort ..
return null;
} } );
-
+
nwt = NativeWindowFactory.getNativeWindowType(false);
isOSX = NativeWindowFactory.TYPE_MACOSX == nwt;
isWindows = NativeWindowFactory.TYPE_WINDOWS == nwt;
isX11 = NativeWindowFactory.TYPE_X11 == nwt;
-
- Field f = null;
+
+ Field f = null;
if( !isOSX ) {
try {
f = Control.class.getField(str_handle);
@@ -141,7 +142,7 @@ public class SWTAccessor {
}
}
swt_control_handle = f; // maybe null !
-
+
boolean ulh;
if (null != swt_control_handle) {
ulh = swt_control_handle.getGenericType().toString().equals(long.class.toString());
@@ -151,7 +152,7 @@ public class SWTAccessor {
swt_uses_long_handles = ulh;
// System.err.println("SWT long handles: " + swt_uses_long_handles);
// System.err.println("Platform 64bit: "+Platform.is64Bit());
-
+
Method m=null;
try {
m = ReflectionUtil.getMethod(Control.class, str_internal_new_GC, new Class[] { GCData.class });
@@ -159,12 +160,12 @@ public class SWTAccessor {
throw new NativeWindowException(ex);
}
swt_control_internal_new_GC = m;
-
+
try {
if(swt_uses_long_handles) {
- m = Control.class.getDeclaredMethod(str_internal_dispose_GC, new Class[] { long.class, GCData.class });
+ m = Control.class.getDeclaredMethod(str_internal_dispose_GC, new Class[] { long.class, GCData.class });
} else {
- m = Control.class.getDeclaredMethod(str_internal_dispose_GC, new Class[] { int.class, GCData.class });
+ m = Control.class.getDeclaredMethod(str_internal_dispose_GC, new Class[] { int.class, GCData.class });
}
} catch (NoSuchMethodException ex) {
throw new NativeWindowException(ex);
@@ -181,7 +182,7 @@ public class SWTAccessor {
c = ReflectionUtil.getClass(str_OS_gtk_class, false, SWTAccessor.class.getClassLoader());
Field field_OS_gtk_version = c.getField(str_OS_gtk_version);
_gtk_version = GTK_VERSION(field_OS_gtk_version.getInt(null));
- m1 = c.getDeclaredMethod(str_gtk_widget_realize, handleType);
+ m1 = c.getDeclaredMethod(str_gtk_widget_realize, handleType);
if (_gtk_version.compareTo(GTK_VERSION_2_14_0) >= 0) {
m4 = c.getDeclaredMethod(str_gtk_widget_get_window, handleType);
} else {
@@ -189,9 +190,9 @@ public class SWTAccessor {
}
if (_gtk_version.compareTo(GTK_VERSION_2_24_0) >= 0) {
m6 = c.getDeclaredMethod(str_gdk_x11_display_get_xdisplay, handleType);
- m7 = c.getDeclaredMethod(str_gdk_window_get_display, handleType);
+ m7 = c.getDeclaredMethod(str_gdk_window_get_display, handleType);
} else {
- m5 = c.getDeclaredMethod(str_gdk_x11_drawable_get_xdisplay, handleType);
+ m5 = c.getDeclaredMethod(str_gdk_x11_drawable_get_xdisplay, handleType);
}
if (_gtk_version.compareTo(GTK_VERSION_3_0_0) >= 0) {
m9 = c.getDeclaredMethod(str_gdk_x11_window_get_xid, handleType);
@@ -200,7 +201,7 @@ public class SWTAccessor {
}
ma = c.getDeclaredMethod(str_gdk_window_set_back_pixmap, handleType, handleType, boolean.class);
} catch (Exception ex) { throw new NativeWindowException(ex); }
- // optional
+ // optional
try {
m2 = c.getDeclaredMethod(str_gtk_widget_unrealize, handleType);
} catch (Exception ex) { }
@@ -213,33 +214,33 @@ public class SWTAccessor {
OS_gtk_widget_get_window = m4;
OS_gdk_x11_drawable_get_xdisplay = m5;
OS_gdk_x11_display_get_xdisplay = m6;
- OS_gdk_window_get_display = m7;
+ OS_gdk_window_get_display = m7;
OS_gdk_x11_drawable_get_xid = m8;
OS_gdk_x11_window_get_xid = m9;
OS_gdk_window_set_back_pixmap = ma;
-
+
isX11GTK = isX11 && null != OS_gtk_class;
-
+
if(DEBUG) {
System.err.println("SWTAccessor.<init>: GTK Version: "+OS_gtk_version);
}
}
-
+
private static Number getIntOrLong(long arg) {
if(swt_uses_long_handles) {
return new Long(arg);
}
return new Integer((int) arg);
}
-
- private static void callStaticMethodL2V(Method m, long arg) {
+
+ private static void callStaticMethodL2V(Method m, long arg) {
ReflectionUtil.callMethod(null, m, new Object[] { getIntOrLong(arg) });
}
-
- private static void callStaticMethodLLZ2V(Method m, long arg0, long arg1, boolean arg3) {
+
+ private static void callStaticMethodLLZ2V(Method m, long arg0, long arg1, boolean arg3) {
ReflectionUtil.callMethod(null, m, new Object[] { getIntOrLong(arg0), getIntOrLong(arg1), Boolean.valueOf(arg3) });
}
-
+
private static long callStaticMethodL2L(Method m, long arg) {
Object o = ReflectionUtil.callMethod(null, m, new Object[] { getIntOrLong(arg) });
if(o instanceof Number) {
@@ -252,18 +253,18 @@ public class SWTAccessor {
//
// Public properties
//
-
+
public static boolean isUsingLongHandles() {
return swt_uses_long_handles;
}
public static boolean useX11GTK() { return isX11GTK; }
public static VersionNumber GTK_VERSION() { return OS_gtk_version; }
-
+
//
// Common GTK
//
-
+
public static long gdk_widget_get_window(long handle) {
final long window;
if (OS_gtk_version.compareTo(GTK_VERSION_2_14_0) >= 0) {
@@ -276,7 +277,7 @@ public class SWTAccessor {
}
return window;
}
-
+
public static long gdk_window_get_xdisplay(long window) {
final long xdisplay;
if (OS_gtk_version.compareTo(GTK_VERSION_2_24_0) >= 0) {
@@ -293,7 +294,7 @@ public class SWTAccessor {
}
return xdisplay;
}
-
+
public static long gdk_window_get_xwindow(long window) {
final long xWindow;
if (OS_gtk_version.compareTo(GTK_VERSION_3_0_0) >= 0) {
@@ -306,15 +307,15 @@ public class SWTAccessor {
}
return xWindow;
}
-
+
public static void gdk_window_set_back_pixmap(long window, long pixmap, boolean parent_relative) {
callStaticMethodLLZ2V(OS_gdk_window_set_back_pixmap, window, pixmap, parent_relative);
}
-
+
//
// Common any toolkit
//
-
+
/**
* @param swtControl the SWT Control to retrieve the native widget-handle from
* @return the native widget-handle
@@ -335,9 +336,9 @@ public class SWTAccessor {
}
} catch (Exception ex) {
throw new NativeWindowException(ex);
- }
+ }
}
- } else {
+ } else {
try {
h = swt_control_handle.getLong(swtControl);
} catch (Exception ex) {
@@ -350,31 +351,32 @@ public class SWTAccessor {
return h;
}
- public static void setRealized(final Control swtControl, final boolean realize)
- throws NativeWindowException
+ public static void setRealized(final Control swtControl, final boolean realize)
+ throws NativeWindowException
{
if(!realize && swtControl.isDisposed()) {
return;
}
final long handle = getHandle(swtControl);
-
+
if(null != OS_gtk_class) {
invoke(true, new Runnable() {
+ @Override
public void run() {
if(realize) {
callStaticMethodL2V(OS_gtk_widget_realize, handle);
} else if(null != OS_gtk_widget_unrealize) {
callStaticMethodL2V(OS_gtk_widget_unrealize, handle);
- }
+ }
}
});
}
}
-
+
/**
* @param swtControl the SWT Control to retrieve the native device handle from
* @return the AbstractGraphicsDevice w/ the native device handle
- * @throws NativeWindowException if the widget handle is null
+ * @throws NativeWindowException if the widget handle is null
* @throws UnsupportedOperationException if the windowing system is not supported
*/
public static AbstractGraphicsDevice getDevice(Control swtControl) throws NativeWindowException, UnsupportedOperationException {
@@ -391,7 +393,7 @@ public class SWTAccessor {
}
throw new UnsupportedOperationException("n/a for this windowing system: "+nwt);
}
-
+
/**
* @param device
* @param screen -1 is default screen of the given device, e.g. maybe 0 or determined by native API. >= 0 is specific screen
@@ -400,7 +402,7 @@ public class SWTAccessor {
public static AbstractGraphicsScreen getScreen(AbstractGraphicsDevice device, int screen) {
return NativeWindowFactory.createScreen(device, screen);
}
-
+
public static int getNativeVisualID(AbstractGraphicsDevice device, long windowHandle) {
if( isX11 ) {
return X11Lib.GetVisualIDFromWindow(device.getHandle(), windowHandle);
@@ -408,32 +410,33 @@ public class SWTAccessor {
if( isWindows || isOSX ) {
return VisualIDHolder.VID_UNDEFINED;
}
- throw new UnsupportedOperationException("n/a for this windowing system: "+nwt);
+ throw new UnsupportedOperationException("n/a for this windowing system: "+nwt);
}
-
+
/**
* @param swtControl the SWT Control to retrieve the native window handle from
* @return the native window handle
- * @throws NativeWindowException if the widget handle is null
+ * @throws NativeWindowException if the widget handle is null
* @throws UnsupportedOperationException if the windowing system is not supported
*/
public static long getWindowHandle(Control swtControl) throws NativeWindowException, UnsupportedOperationException {
- final long handle = getHandle(swtControl);
+ final long handle = getHandle(swtControl);
if(0 == handle) {
throw new NativeWindowException("Null SWT handle of SWT control "+swtControl);
}
if( isX11GTK ) {
- return gdk_window_get_xwindow( gdk_widget_get_window( handle ) );
+ return gdk_window_get_xwindow( gdk_widget_get_window( handle ) );
}
if( isWindows || isOSX ) {
return handle;
}
throw new UnsupportedOperationException("n/a for this windowing system: "+nwt);
}
-
+
public static long newGC(final Control swtControl, final GCData gcData) {
final Object[] o = new Object[1];
invoke(true, new Runnable() {
+ @Override
public void run() {
o[0] = ReflectionUtil.callMethod(swtControl, swt_control_internal_new_GC, new Object[] { gcData });
}
@@ -444,9 +447,10 @@ public class SWTAccessor {
throw new InternalError("SWT internal_new_GC did not return int or long but "+o[0].getClass());
}
}
-
+
public static void disposeGC(final Control swtControl, final long gc, final GCData gcData) {
invoke(true, new Runnable() {
+ @Override
public void run() {
if(swt_uses_long_handles) {
ReflectionUtil.callMethod(swtControl, swt_control_internal_dispose_GC, new Object[] { new Long(gc), gcData });
@@ -456,7 +460,7 @@ public class SWTAccessor {
}
});
}
-
+
/**
* Runs the specified action in an SWT compatible thread, which is:
* <ul>
@@ -468,7 +472,7 @@ public class SWTAccessor {
* <li>Linux, Windows, ..
* <ul>
* <li>Current thread.</li>
- * </ul></li>
+ * </ul></li>
* </ul>
* @see Platform#AWT_AVAILABLE
* @see Platform#getOSType()
@@ -479,9 +483,9 @@ public class SWTAccessor {
OSXUtil.RunOnMainThread(wait, runnable);
} else {
runnable.run();
- }
+ }
}
-
+
/**
* Runs the specified action on the SWT UI thread.
* <p>
@@ -492,56 +496,56 @@ public class SWTAccessor {
public static void invoke(org.eclipse.swt.widgets.Display display, boolean wait, Runnable runnable) {
if( display.isDisposed() || Thread.currentThread() == display.getThread() ) {
invoke(wait, runnable);
- } else if( wait ) {
+ } else if( wait ) {
display.syncExec(runnable);
} else {
display.asyncExec(runnable);
}
}
-
+
//
// Specific X11 GTK ChildWindow - Using plain X11 native parenting (works well)
//
-
+
public static long createCompatibleX11ChildWindow(AbstractGraphicsScreen screen, Control swtControl, int visualID, int width, int height) {
final long handle = getHandle(swtControl);
final long parentWindow = gdk_widget_get_window( handle );
gdk_window_set_back_pixmap (parentWindow, 0, false);
-
+
final long x11ParentHandle = gdk_window_get_xwindow(parentWindow);
final long x11WindowHandle = X11Lib.CreateWindow(x11ParentHandle, screen.getDevice().getHandle(), screen.getIndex(), visualID, width, height, true, true);
-
+
return x11WindowHandle;
}
-
+
public static void resizeX11Window(AbstractGraphicsDevice device, Rectangle clientArea, long x11Window) {
- X11Lib.SetWindowPosSize(device.getHandle(), x11Window, clientArea.x, clientArea.y, clientArea.width, clientArea.height);
+ X11Lib.SetWindowPosSize(device.getHandle(), x11Window, clientArea.x, clientArea.y, clientArea.width, clientArea.height);
}
public static void destroyX11Window(AbstractGraphicsDevice device, long x11Window) {
X11Lib.DestroyWindow(device.getHandle(), x11Window);
}
-
+
//
// Specific X11 SWT/GTK ChildWindow - Using SWT/GTK native parenting (buggy - sporadic resize flickering, sporadic drop of rendering)
//
// FIXME: Need to use reflection for 32bit access as well !
//
-
+
// public static final int GDK_WA_TYPE_HINT = 1 << 9;
// public static final int GDK_WA_VISUAL = 1 << 6;
-
+
public static long createCompatibleGDKChildWindow(Control swtControl, int visualID, int width, int height) {
return 0;
/**
final long handle = SWTAccessor.getHandle(swtControl);
final long parentWindow = gdk_widget_get_window( handle );
-
+
final long screen = OS.gdk_screen_get_default ();
final long gdkvisual = OS.gdk_x11_screen_lookup_visual (screen, visualID);
-
+
final GdkWindowAttr attrs = new GdkWindowAttr();
attrs.width = width > 0 ? width : 1;
- attrs.height = height > 0 ? height : 1;
+ attrs.height = height > 0 ? height : 1;
attrs.event_mask = OS.GDK_KEY_PRESS_MASK | OS.GDK_KEY_RELEASE_MASK |
OS.GDK_FOCUS_CHANGE_MASK | OS.GDK_POINTER_MOTION_MASK |
OS.GDK_BUTTON_PRESS_MASK | OS.GDK_BUTTON_RELEASE_MASK |
@@ -550,16 +554,16 @@ public class SWTAccessor {
OS.GDK_POINTER_MOTION_HINT_MASK;
attrs.window_type = OS.GDK_WINDOW_CHILD;
attrs.visual = gdkvisual;
-
+
final long childWindow = OS.gdk_window_new (parentWindow, attrs, OS.GDK_WA_VISUAL|GDK_WA_TYPE_HINT);
OS.gdk_window_set_user_data (childWindow, handle);
OS.gdk_window_set_back_pixmap (parentWindow, 0, false);
-
+
OS.gdk_window_show (childWindow);
OS.gdk_flush();
return childWindow; */
}
-
+
public static void showGDKWindow(long gdkWindow) {
/* OS.gdk_window_show (gdkWindow);
OS.gdk_flush(); */
@@ -576,8 +580,8 @@ public class SWTAccessor {
OS.gdk_window_resize (gdkWindow, clientArea.width, clientArea.height);
OS.gdk_flush(); */
}
-
+
public static void destroyGDKWindow(long gdkWindow) {
// OS.gdk_window_destroy (gdkWindow);
- }
+ }
}
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/windows/WindowsGraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/windows/WindowsGraphicsDevice.java
index 5cabdf1..6439827 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/windows/WindowsGraphicsDevice.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/windows/WindowsGraphicsDevice.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. 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
@@ -34,7 +34,7 @@ package com.jogamp.nativewindow.windows;
import javax.media.nativewindow.*;
-/**
+/**
* Encapsulates a graphics device on Windows platforms.<br>
*/
public class WindowsGraphicsDevice extends DefaultGraphicsDevice implements Cloneable {
@@ -47,6 +47,7 @@ public class WindowsGraphicsDevice extends DefaultGraphicsDevice implements Clon
super(NativeWindowFactory.TYPE_WINDOWS, connection, unitID);
}
+ @Override
public Object clone() {
return super.clone();
}
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsConfiguration.java b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsConfiguration.java
index 0d2914c..120c865 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsConfiguration.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsConfiguration.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -48,7 +48,7 @@ import jogamp.nativewindow.x11.XVisualInfo;
public class X11GraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable {
private XVisualInfo info;
- public X11GraphicsConfiguration(X11GraphicsScreen screen,
+ public X11GraphicsConfiguration(X11GraphicsScreen screen,
CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested,
XVisualInfo info) {
super(screen, capsChosen, capsRequested);
@@ -71,12 +71,12 @@ public class X11GraphicsConfiguration extends MutableGraphicsConfiguration imple
final public int getXVisualID() {
return (null!=info)?(int)info.getVisualid():0;
}
-
+
@Override
public String toString() {
return getClass().getSimpleName()+"["+getScreen()+", visualID 0x" + Long.toHexString(getXVisualID()) +
",\n\tchosen " + capabilitiesChosen+
- ",\n\trequested " + capabilitiesRequested+
+ ",\n\trequested " + capabilitiesRequested+
"]";
}
}
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java
index e630e01..40d212d 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsDevice.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -87,12 +87,12 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
handleOwner = owner;
isXineramaEnabled = X11Util.XineramaIsEnabled(this);
}
-
+
private static int getDefaultScreenImpl(long dpy) {
return X11Lib.DefaultScreen(dpy);
}
-
+
/**
* Returns the default screen number as referenced by the display connection, i.e. 'somewhere:0.1' -> 1
* <p>
@@ -110,7 +110,7 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
}
return ds;
}
-
+
public int getDefaultVisualID() {
final long display = getHandle();
if(0==display) {
@@ -118,11 +118,11 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
}
return X11Lib.DefaultVisualID(display, getDefaultScreenImpl(display));
}
-
+
public final boolean isXineramaEnabled() {
return isXineramaEnabled;
}
-
+
@Override
public Object clone() {
return super.clone();
@@ -142,7 +142,7 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
}
return false;
}
-
+
@Override
public boolean close() {
if(handleOwner && 0 != handle) {
@@ -153,11 +153,11 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
}
return super.close();
}
-
+
@Override
public boolean isHandleOwner() {
return handleOwner;
- }
+ }
@Override
public void clearHandleOwner() {
handleOwner = false;
@@ -168,8 +168,8 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
}
@Override
protected Object setHandleOwnership(Object newOwnership) {
- final Boolean oldOwnership = Boolean.valueOf(handleOwner);
+ final Boolean oldOwnership = Boolean.valueOf(handleOwner);
handleOwner = ((Boolean) newOwnership).booleanValue();
return oldOwnership;
- }
+ }
}
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsScreen.java b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsScreen.java
index 2ec6629..7009378 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsScreen.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/x11/X11GraphicsScreen.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -62,7 +62,8 @@ public class X11GraphicsScreen extends DefaultGraphicsScreen implements Cloneabl
// It still could be an AWT hold handle ..
return X11Lib.DefaultVisualID(getDevice().getHandle(), getIndex());
}
-
+
+ @Override
public Object clone() {
return super.clone();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java
index 4e45113..48f72e5 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsConfiguration.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -44,7 +44,7 @@ package javax.media.nativewindow;
pixel format in a toolkit-independent manner. */
public interface AbstractGraphicsConfiguration extends VisualIDHolder, Cloneable {
public Object clone();
-
+
/**
* Return the screen this graphics configuration is valid for
*/
diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
index ed305d4..31b6426 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2005 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -47,7 +47,7 @@ import jogamp.nativewindow.Debug;
*/
public interface AbstractGraphicsDevice extends Cloneable {
public static final boolean DEBUG = Debug.debug("GraphicsDevice");
-
+
/** Dummy connection value for a default connection where no native support for multiple devices is available */
public static String DEFAULT_CONNECTION = "decon";
@@ -58,7 +58,7 @@ public interface AbstractGraphicsDevice extends Cloneable {
public static int DEFAULT_UNIT = 0;
public Object clone();
-
+
/**
* Returns the type of the underlying subsystem, ie
* NativeWindowFactory.TYPE_KD, NativeWindowFactory.TYPE_X11, ..
@@ -96,7 +96,7 @@ public interface AbstractGraphicsDevice extends Cloneable {
* The unique ID may be used as a key for semantic device mapping.
* </p>
* <p>
- * The returned string object reference is unique using {@link String#intern()}
+ * The returned string object reference is unique using {@link String#intern()}
* and hence can be used as a key itself.
* </p>
*/
@@ -114,29 +114,29 @@ public interface AbstractGraphicsDevice extends Cloneable {
*/
public void lock();
- /**
+ /**
* Optionally unlocking the device, utilizing eg {@link javax.media.nativewindow.ToolkitLock#unlock()}.
* The lock implementation must be recursive.
- *
+ *
* @throws RuntimeException in case the lock is not acquired by this thread.
*/
public void unlock();
/**
- * @throws RuntimeException if current thread does not hold the lock
+ * @throws RuntimeException if current thread does not hold the lock
*/
public void validateLocked() throws RuntimeException;
-
- /**
+
+ /**
* Optionally [re]opening the device if handle is <code>null</code>.
* <p>
* The default implementation is a <code>NOP</code>.
* </p>
* <p>
- * Example implementations like {@link com.jogamp.nativewindow.x11.X11GraphicsDevice}
- * or {@link com.jogamp.nativewindow.egl.EGLGraphicsDevice}
+ * Example implementations like {@link com.jogamp.nativewindow.x11.X11GraphicsDevice}
+ * or {@link com.jogamp.nativewindow.egl.EGLGraphicsDevice}
* issue the native open operation in case handle is <code>null</code>.
- * </p>
+ * </p>
*
* @return true if the handle was <code>null</code> and opening was successful, otherwise false.
*/
@@ -148,19 +148,19 @@ public interface AbstractGraphicsDevice extends Cloneable {
* The default implementation {@link ToolkitLock#dispose() dispose} it's {@link ToolkitLock} and sets the handle to <code>null</code>.
* </p>
* <p>
- * Example implementations like {@link com.jogamp.nativewindow.x11.X11GraphicsDevice}
- * or {@link com.jogamp.nativewindow.egl.EGLGraphicsDevice}
+ * Example implementations like {@link com.jogamp.nativewindow.x11.X11GraphicsDevice}
+ * or {@link com.jogamp.nativewindow.egl.EGLGraphicsDevice}
* issue the native close operation or skip it depending on the {@link #isHandleOwner() handles's ownership}.
- * </p>
+ * </p>
*
* @return true if the handle was not <code>null</code> and closing was successful, otherwise false.
*/
public boolean close();
-
+
/**
* @return <code>true</code> if instance owns the handle to issue {@link #close()}, otherwise <code>false</code>.
*/
public boolean isHandleOwner();
-
+
public void clearHandleOwner();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java
index acb9807..da8f12f 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsScreen.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2005 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -45,7 +45,7 @@ package javax.media.nativewindow;
public interface AbstractGraphicsScreen extends Cloneable {
public Object clone();
-
+
/**
* Return the device this graphics configuration is valid for
*/
diff --git a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
index f2a8e23..9eed887 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
@@ -61,7 +61,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
// Switch for on- or offscreen
private boolean onscreen = true;
-
+
// offscreen bitmap mode
private boolean isBitmap = false;
@@ -74,7 +74,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
public Object cloneMutable() {
return clone();
}
-
+
@Override
public Object clone() {
try {
@@ -85,7 +85,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
}
/**
- * Copies all {@link Capabilities} values
+ * Copies all {@link Capabilities} values
* from <code>source</code> into this instance.
* @return this instance
*/
@@ -103,7 +103,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
transparentValueAlpha = other.getTransparentAlphaValue();
return this;
}
-
+
@Override
public int hashCode() {
// 31 * x == (x << 5) - x
@@ -150,15 +150,15 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
**/
@Override
public int compareTo(final CapabilitiesImmutable caps) {
- /**
+ /**
if ( ! ( o instanceof CapabilitiesImmutable ) ) {
Class<?> c = (null != o) ? o.getClass() : null ;
throw new ClassCastException("Not a CapabilitiesImmutable object, but " + c);
}
final CapabilitiesImmutable caps = (CapabilitiesImmutable) o; */
-
+
final int rgba = redBits * greenBits * blueBits * ( alphaBits + 1 );
-
+
final int xrgba = caps.getRedBits() * caps.getGreenBits() * caps.getBlueBits() * ( caps.getAlphaBits() + 1 );
if(rgba > xrgba) {
@@ -222,17 +222,17 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
return alphaBits;
}
- /**
+ /**
* Sets the number of bits requested for the color buffer's alpha
* component. On some systems only the color depth, which is the
* sum of the red, green, and blue bits, is considered.
* <p>
- * <b>Note:</b> If alpha bits are <code>zero</code>, they are set to <code>one</code>
+ * <b>Note:</b> If alpha bits are <code>zero</code>, they are set to <code>one</code>
* by {@link #setBackgroundOpaque(boolean)} and it's OpenGL specialization <code>GLCapabilities::setSampleBuffers(boolean)</code>.<br/>
* Ensure to call this method after the above to ensure a <code>zero</code> value.</br>
* The above automated settings takes into account, that the user calls this method to <i>request</i> alpha bits,
* not to <i>reflect</i> a current state. Nevertheless if this is the case - call it at last.
- * </p>
+ * </p>
*/
public void setAlphaBits(int alphaBits) {
this.alphaBits = alphaBits;
@@ -271,7 +271,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
* Defaults to true.
* </p>
* <p>
- * If requesting an offscreen surface without further selection of it's mode,
+ * If requesting an offscreen surface without further selection of it's mode,
* e.g. FBO, Pbuffer or {@link #setBitmap(boolean) bitmap},
* the implementation will choose the best available offscreen mode.
* </p>
@@ -304,12 +304,12 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
}
isBitmap = enable;
}
-
+
@Override
public boolean isBitmap() {
- return isBitmap;
+ return isBitmap;
}
-
+
@Override
public final int getTransparentRedValue() { return transparentValueRed; }
@@ -354,7 +354,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
public StringBuilder toString(StringBuilder sink) {
return toString(sink, true);
}
-
+
/** Returns a textual representation of this Capabilities
object. */
@Override
@@ -365,7 +365,7 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
msg.append("]");
return msg.toString();
}
-
+
/** Return a textual representation of this object's on/off screen state. Use the given StringBuilder [optional]. */
protected StringBuilder onoffScreenToString(StringBuilder sink) {
if(null == sink) {
@@ -381,19 +381,19 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
} else if(onscreen) {
sink.append("."); // no additional off-screen modes besides on-screen
} else {
- sink.append("auto-cfg"); // auto-config off-screen mode
+ sink.append("auto-cfg"); // auto-config off-screen mode
}
- sink.append("]");
-
+ sink.append("]");
+
return sink;
}
-
+
/** Element separator */
protected static final String ESEP = "/";
/** Component separator */
protected static final String CSEP = ", ";
-
- protected StringBuilder toString(StringBuilder sink, boolean withOnOffScreen) {
+
+ protected StringBuilder toString(StringBuilder sink, boolean withOnOffScreen) {
if(null == sink) {
sink = new StringBuilder();
}
@@ -409,6 +409,6 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
}
return sink;
}
-
+
protected final String toHexString(int val) { return Integer.toHexString(val); }
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java
index e1fdf49..1f4db79 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesChooser.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -58,7 +58,7 @@ public interface CapabilitiesChooser {
not necessarily required, that the chooser select that entry.
<P> <em>Note:</em> this method is called automatically by the
- {@link GraphicsConfigurationFactory#chooseGraphicsConfiguration} method
+ {@link GraphicsConfigurationFactory#chooseGraphicsConfiguration} method
when an instance of this class is passed in to it.
It should generally not be
invoked by users directly, unless it is desired to delegate the
diff --git a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java
index 85659f2..c496a15 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/CapabilitiesImmutable.java
@@ -70,12 +70,12 @@ public interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable, C
* Returns whether an opaque or translucent surface is requested, supported or chosen.
* <p>
* Default is true, i.e. opaque.
- * </p>
+ * </p>
*/
boolean isBackgroundOpaque();
/**
- * Returns whether an on- or offscreen surface is requested, available or chosen.
+ * Returns whether an on- or offscreen surface is requested, available or chosen.
* <p>
* Default is true, i.e. onscreen.
* </p>
@@ -83,7 +83,7 @@ public interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable, C
* Mind that an capabilities intance w/ <i>available</i> semantics
* may show onscreen, but also the offscreen modes FBO, Pbuffer or {@link #setBitmap(boolean) bitmap}.
* This is valid, since one native configuration maybe used for either functionality.
- * </p>
+ * </p>
*/
boolean isOnscreen();
@@ -97,7 +97,7 @@ public interface CapabilitiesImmutable extends VisualIDHolder, WriteCloneable, C
* </p>
*/
boolean isBitmap();
-
+
/**
* Gets the transparent red value for the frame buffer configuration. This
* value is undefined if; equals true.
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
index 4f07bca..77cbe29 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultCapabilitiesChooser.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -66,16 +66,17 @@ import jogamp.nativewindow.Debug;
*/
public class DefaultCapabilitiesChooser implements CapabilitiesChooser {
- private static final boolean DEBUG;
+ private static final boolean DEBUG;
static {
Debug.initSingleton();
DEBUG = Debug.isPropertyDefined("nativewindow.debug.CapabilitiesChooser", true);
}
-
+
private final static int NO_SCORE = -9999999;
private final static int COLOR_MISMATCH_PENALTY_SCALE = 36;
-
+
+ @Override
public int chooseCapabilities(final CapabilitiesImmutable desired,
final List<? extends CapabilitiesImmutable> available,
final int windowSystemRecommendedChoice) {
@@ -112,7 +113,7 @@ public class DefaultCapabilitiesChooser implements CapabilitiesChooser {
if (desired.isOnscreen() && !cur.isOnscreen()) {
continue; // requested onscreen, but n/a
}
-
+
int score = 0;
// Compute difference in color depth
score += (COLOR_MISMATCH_PENALTY_SCALE *
@@ -132,7 +133,7 @@ public class DefaultCapabilitiesChooser implements CapabilitiesChooser {
System.err.println(" ]");
}
- // Ready to select. Choose score closest to 0.
+ // Ready to select. Choose score closest to 0.
int scoreClosestToZero = NO_SCORE;
int chosenIndex = -1;
for (int i = 0; i < availnum; i++) {
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
index 6b23172..42d7f3a 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsConfiguration.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. 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
@@ -36,12 +36,12 @@ import jogamp.nativewindow.Debug;
public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphicsConfiguration {
protected static final boolean DEBUG = Debug.debug("GraphicsConfiguration");
-
+
private AbstractGraphicsScreen screen;
protected CapabilitiesImmutable capabilitiesChosen;
protected CapabilitiesImmutable capabilitiesRequested;
- public DefaultGraphicsConfiguration(AbstractGraphicsScreen screen,
+ public DefaultGraphicsConfiguration(AbstractGraphicsScreen screen,
CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested) {
if(null == screen) {
throw new IllegalArgumentException("Null screen");
@@ -69,18 +69,22 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
}
}
+ @Override
final public AbstractGraphicsScreen getScreen() {
return screen;
}
+ @Override
final public CapabilitiesImmutable getChosenCapabilities() {
return capabilitiesChosen;
}
+ @Override
final public CapabilitiesImmutable getRequestedCapabilities() {
return capabilitiesRequested;
}
+ @Override
public AbstractGraphicsConfiguration getNativeGraphicsConfiguration() {
return this;
}
@@ -89,7 +93,7 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
final public int getVisualID(VIDType type) throws NativeWindowException {
return capabilitiesChosen.getVisualID(type);
}
-
+
/**
* Set the capabilities to a new value.
*
@@ -119,7 +123,7 @@ public class DefaultGraphicsConfiguration implements Cloneable, AbstractGraphics
public String toString() {
return getClass().getSimpleName()+"[" + screen +
",\n\tchosen " + capabilitiesChosen+
- ",\n\trequested " + capabilitiesRequested+
+ ",\n\trequested " + capabilitiesRequested+
"]";
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
index 0bf5c29..d74954a 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -140,8 +140,8 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
public final void validateLocked() throws RuntimeException {
toolkitLock.validateLocked();
}
-
- /**
+
+ /**
* {@inheritDoc}
* <p>
* Locking is perfomed via delegation to {@link ToolkitLock#lock()}, {@link ToolkitLock#unlock()}.
@@ -154,7 +154,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
public final void unlock() {
toolkitLock.unlock();
}
-
+
@Override
public boolean open() {
return false;
@@ -174,11 +174,11 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
public boolean isHandleOwner() {
return false;
}
-
+
@Override
- public void clearHandleOwner() {
+ public void clearHandleOwner() {
}
-
+
@Override
public String toString() {
return getClass().getSimpleName()+"[type "+getType()+", connection "+getConnection()+", unitID "+getUnitID()+", handle 0x"+Long.toHexString(getHandle())+", owner "+isHandleOwner()+", "+toolkitLock+"]";
@@ -193,14 +193,14 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
handle = newHandle;
return oldHandle;
}
-
+
protected Object getHandleOwnership() {
return null;
}
protected Object setHandleOwnership(Object newOwnership) {
return null;
}
-
+
public static final void swapDeviceHandleAndOwnership(final DefaultGraphicsDevice aDevice1, final DefaultGraphicsDevice aDevice2) {
aDevice1.lock();
try {
@@ -219,7 +219,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
aDevice1.unlock();
}
}
-
+
/**
* Set the internal ToolkitLock, which is used within the
* {@link #lock()} and {@link #unlock()} implementation.
@@ -228,7 +228,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
* The current ToolkitLock is being locked/unlocked while swapping the reference,
* ensuring no concurrent access can occur during the swap.
* </p>
- *
+ *
* @param locker the ToolkitLock, if null, {@link jogamp.nativewindow.NullToolkitLock} is being used
* @return the previous ToolkitLock instance
*/
@@ -253,8 +253,8 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
return toolkitLock;
}
- /**
- * Returns a unique String object using {@link String#intern()} for the given arguments,
+ /**
+ * Returns a unique String object using {@link String#intern()} for the given arguments,
* which object reference itself can be used as a key.
*/
protected static String getUniqueID(String type, String connection, int unitID) {
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java
index 9fa58c7..4bd5489 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. 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
@@ -54,10 +54,12 @@ public class DefaultGraphicsScreen implements Cloneable, AbstractGraphicsScreen
}
}
+ @Override
public AbstractGraphicsDevice getDevice() {
return device;
}
-
+
+ @Override
public int getIndex() {
return idx;
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java
index 9694f24..c09e6ea 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008-2009 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
@@ -48,7 +48,7 @@ import java.util.Set;
/**
* Provides the mechanism by which the graphics configuration for a
- * window can be chosen before the window is created. The graphics
+ * window can be chosen before the window is created. The graphics
* configuration decides parameters related to hardware accelerated rendering such
* as the OpenGL pixel format. <br>
* On some window systems (EGL/OpenKODE and X11 in particular) it is necessary to
@@ -69,21 +69,23 @@ public abstract class GraphicsConfigurationFactory {
public final Class<?> deviceType;
public final Class<?> capsType;
private final int hash32;
-
+
public DeviceCapsType(Class<?> deviceType, Class<?> capsType) {
this.deviceType = deviceType;
this.capsType = capsType;
-
+
// 31 * x == (x << 5) - x
int hash32 = 31 + deviceType.hashCode();
hash32 = ((hash32 << 5) - hash32) + capsType.hashCode();
this.hash32 = hash32;
}
-
+
+ @Override
public final int hashCode() {
return hash32;
}
-
+
+ @Override
public final boolean equals(Object obj) {
if(this == obj) { return true; }
if (obj instanceof DeviceCapsType) {
@@ -92,18 +94,18 @@ public abstract class GraphicsConfigurationFactory {
}
return false;
}
-
+
@Override
public final String toString() {
return "DeviceCapsType["+deviceType.getName()+", "+capsType.getName()+"]";
}
-
+
}
-
+
private static final Map<DeviceCapsType, GraphicsConfigurationFactory> registeredFactories;
- private static final DeviceCapsType defaultDeviceCapsType;
+ private static final DeviceCapsType defaultDeviceCapsType;
static boolean initialized = false;
-
+
static {
DEBUG = Debug.debug("GraphicsConfiguration");
if(DEBUG) {
@@ -113,7 +115,7 @@ public abstract class GraphicsConfigurationFactory {
registeredFactories = Collections.synchronizedMap(new HashMap<DeviceCapsType, GraphicsConfigurationFactory>());
defaultDeviceCapsType = new DeviceCapsType(AbstractGraphicsDevice.class, CapabilitiesImmutable.class);
}
-
+
public static synchronized void initSingleton() {
if(!initialized) {
initialized = true;
@@ -121,31 +123,31 @@ public abstract class GraphicsConfigurationFactory {
if(DEBUG) {
System.err.println(Thread.currentThread().getName()+" - GraphicsConfigurationFactory.initSingleton()");
}
-
+
// Register the default no-op factory for arbitrary
// AbstractGraphicsDevice implementations, including
// AWTGraphicsDevice instances -- the OpenGL binding will take
// care of handling AWTGraphicsDevices on X11 platforms (as
// well as X11GraphicsDevices in non-AWT situations)
registerFactory(defaultDeviceCapsType.deviceType, defaultDeviceCapsType.capsType, new DefaultGraphicsConfigurationFactoryImpl());
-
+
if (NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true)) {
try {
- ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.X11GraphicsConfigurationFactory",
- "registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader());
+ ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.X11GraphicsConfigurationFactory",
+ "registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader());
} catch (Exception e) {
throw new RuntimeException(e);
}
if(NativeWindowFactory.isAWTAvailable()) {
try {
- ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.awt.X11AWTGraphicsConfigurationFactory",
- "registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader());
+ ReflectionUtil.callStaticMethod("jogamp.nativewindow.x11.awt.X11AWTGraphicsConfigurationFactory",
+ "registerFactory", null, null, GraphicsConfigurationFactory.class.getClassLoader());
} catch (Exception e) { /* n/a */ }
}
}
}
}
-
+
public static synchronized void shutdown() {
if(initialized) {
initialized = false;
@@ -155,7 +157,7 @@ public abstract class GraphicsConfigurationFactory {
registeredFactories.clear();
}
}
-
+
protected static String getThreadName() {
return Thread.currentThread().getName();
}
@@ -176,10 +178,10 @@ public abstract class GraphicsConfigurationFactory {
/**
* Returns the graphics configuration factory for use with the
* given device and capability.
- *
+ *
* @see #getFactory(Class, Class)
*/
- public static GraphicsConfigurationFactory getFactory(AbstractGraphicsDevice device, CapabilitiesImmutable caps) {
+ public static GraphicsConfigurationFactory getFactory(AbstractGraphicsDevice device, CapabilitiesImmutable caps) {
if (device == null) {
throw new IllegalArgumentException("null device");
}
@@ -195,7 +197,7 @@ public abstract class GraphicsConfigurationFactory {
* <p>
* Note: Registered device types maybe classes or interfaces, where capabilities types are interfaces only.
* </p>
- *
+ *
* <p>
* Pseudo code for finding a suitable factory is:
* <pre>
@@ -211,7 +213,7 @@ public abstract class GraphicsConfigurationFactory {
* @param deviceType the minimum capabilities class type accepted, must implement or extend {@link AbstractGraphicsDevice}
* @param capabilitiesType the minimum capabilities class type accepted, must implement or extend {@link CapabilitiesImmutable}
*
- * @throws IllegalArgumentException if the deviceType does not implement {@link AbstractGraphicsDevice} or
+ * @throws IllegalArgumentException if the deviceType does not implement {@link AbstractGraphicsDevice} or
* capabilitiesType does not implement {@link CapabilitiesImmutable}
*/
public static GraphicsConfigurationFactory getFactory(Class<?> deviceType, Class<?> capabilitiesType)
@@ -228,12 +230,12 @@ public abstract class GraphicsConfigurationFactory {
System.err.println("GraphicsConfigurationFactory.getFactory: "+deviceType.getName()+", "+capabilitiesType.getName());
dumpFactories();
}
-
- final List<Class<?>> deviceTypes = getAllAssignableClassesFrom(defaultDeviceCapsType.deviceType, deviceType, false);
+
+ final List<Class<?>> deviceTypes = getAllAssignableClassesFrom(defaultDeviceCapsType.deviceType, deviceType, false);
if(DEBUG) {
System.err.println("GraphicsConfigurationFactory.getFactory() deviceTypes: " + deviceTypes);
}
- final List<Class<?>> capabilitiesTypes = getAllAssignableClassesFrom(defaultDeviceCapsType.capsType, capabilitiesType, true);
+ final List<Class<?>> capabilitiesTypes = getAllAssignableClassesFrom(defaultDeviceCapsType.capsType, capabilitiesType, true);
if(DEBUG) {
System.err.println("GraphicsConfigurationFactory.getFactory() capabilitiesTypes: " + capabilitiesTypes);
}
@@ -259,7 +261,7 @@ public abstract class GraphicsConfigurationFactory {
return factory;
}
private static ArrayList<Class<?>> getAllAssignableClassesFrom(Class<?> superClassOrInterface, Class<?> fromClass, boolean interfacesOnly) {
- // Using a todo list avoiding a recursive loop!
+ // Using a todo list avoiding a recursive loop!
final ArrayList<Class<?>> inspectClasses = new ArrayList<Class<?>>();
final ArrayList<Class<?>> resolvedInterfaces = new ArrayList<Class<?>>();
inspectClasses.add(fromClass);
@@ -277,7 +279,7 @@ public abstract class GraphicsConfigurationFactory {
}
}
types.addAll(Arrays.asList(fromClass.getInterfaces()));
-
+
for(int i=0; i<types.size(); i++) {
final Class<?> iface = types.get(i);
if( superClassOrInterface.isAssignableFrom(iface) && !resolvedInterfaces.contains(iface) ) {
@@ -302,20 +304,20 @@ public abstract class GraphicsConfigurationFactory {
}
}
- /**
+ /**
* Registers a GraphicsConfigurationFactory handling
* the given graphics device and capability class.
* <p>
* This does not need to be called by end users, only implementors of new
* GraphicsConfigurationFactory subclasses.
* </p>
- *
+ *
* <p>
* Note: Registered device types maybe classes or interfaces, where capabilities types are interfaces only.
- * </p>
- *
+ * </p>
+ *
* <p>See {@link #getFactory(Class, Class)} for a description of the find algorithm.</p>
- *
+ *
* @param deviceType the minimum capabilities class type accepted, must implement or extend interface {@link AbstractGraphicsDevice}
* @param capabilitiesType the minimum capabilities class type accepted, must extend interface {@link CapabilitiesImmutable}
* @return the previous registered factory, or null if none
@@ -329,7 +331,7 @@ public abstract class GraphicsConfigurationFactory {
}
if (!(defaultDeviceCapsType.capsType.isAssignableFrom(capabilitiesType))) {
throw new IllegalArgumentException("Given capabilities class must implement CapabilitiesImmutable");
- }
+ }
final DeviceCapsType dct = new DeviceCapsType(abstractGraphicsDeviceImplementor, capabilitiesType);
final GraphicsConfigurationFactory prevFactory;
if(null == factory) {
@@ -352,7 +354,7 @@ public abstract class GraphicsConfigurationFactory {
* <P> Selects a graphics configuration on the specified graphics
* device compatible with the supplied {@link Capabilities}. Some
* platforms (e.g.: X11, EGL, KD) require the graphics configuration
- * to be specified when the native window is created.
+ * to be specified when the native window is created.
* These architectures have seperated their device, screen, window and drawable
* context and hence are capable of quering the capabilities for each screen.
* A fully established window is not required.</P>
@@ -360,7 +362,7 @@ public abstract class GraphicsConfigurationFactory {
* <P>Other platforms (e.g. Windows, MacOSX) don't offer the mentioned seperation
* and hence need a fully established window and it's drawable.
* Here the validation of the capabilities is performed later.
- * In this case, the AbstractGraphicsConfiguration implementation
+ * In this case, the AbstractGraphicsConfiguration implementation
* must allow an overwrite of the Capabilites, for example
* {@link DefaultGraphicsConfiguration#setChosenCapabilities DefaultGraphicsConfiguration.setChosenCapabilities(..)}.
* </P>
@@ -385,7 +387,7 @@ public abstract class GraphicsConfigurationFactory {
* @param capsRequested the original requested capabilities
* @param chooser the choosing implementation
* @param screen the referring Screen
- * @param nativeVisualID if not {@link VisualIDHolder#VID_UNDEFINED} it reflects a pre-chosen visualID of the native platform's windowing system.
+ * @param nativeVisualID if not {@link VisualIDHolder#VID_UNDEFINED} it reflects a pre-chosen visualID of the native platform's windowing system.
* @return the complete GraphicsConfiguration
*
* @throws IllegalArgumentException if the data type of the passed
diff --git a/src/nativewindow/classes/javax/media/nativewindow/MutableSurface.java b/src/nativewindow/classes/javax/media/nativewindow/MutableSurface.java
index ff53c81..a0db11a 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/MutableSurface.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/MutableSurface.java
@@ -31,12 +31,12 @@ package javax.media.nativewindow;
/**
* Provides a {@link NativeSurface} with a mutable <code>surfaceHandle</code>
* via {@link #setSurfaceHandle(long)}.
- *
+ *
* @see NativeSurface
*/
public interface MutableSurface extends NativeSurface {
- /**
+ /**
* Sets the surface handle which is created outside of this implementation.
*/
public void setSurfaceHandle(long surfaceHandle);
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java
index a89caec..a755b18 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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;
/** Provides low-level information required for
@@ -54,10 +54,10 @@ public interface NativeSurface extends SurfaceUpdatedListener {
* <p>
* The surface handle shall be valid after a successfull call,
* ie return a value other than {@link #LOCK_SURFACE_UNLOCKED} and {@link #LOCK_SURFACE_NOT_READY},
- * which is
- * <pre>
- * boolean ok = LOCK_SURFACE_NOT_READY < lockSurface();
- * </pre>
+ * which is
+ * <pre>
+ * boolean ok = LOCK_SURFACE_NOT_READY < lockSurface();
+ * </pre>
* </p>
* <p>
* The caller may need to take care of the result {@link #LOCK_SURFACE_CHANGED},
@@ -71,7 +71,7 @@ public interface NativeSurface extends SurfaceUpdatedListener {
* This call allows recursion from the same thread.
* </p>
* <p>
- * The implementation may want to aquire the
+ * The implementation may want to aquire the
* application level {@link com.jogamp.common.util.locks.RecursiveLock}
* first before proceeding with a native surface lock.
* </p>
@@ -115,7 +115,7 @@ public interface NativeSurface extends SurfaceUpdatedListener {
* </pre>
*/
public boolean isSurfaceLockedByOtherThread();
-
+
/**
* Return the locking owner's Thread, or null if not locked.
*/
@@ -123,15 +123,15 @@ public interface NativeSurface extends SurfaceUpdatedListener {
/**
* Provide a mechanism to utilize custom (pre-) swap surface
- * code. This method is called before the render toolkit (e.g. JOGL)
+ * code. This method is called before the render toolkit (e.g. JOGL)
* swaps the buffer/surface if double buffering is enabled.
- * <p>
+ * <p>
* The implementation may itself apply the swapping,
* in which case true shall be returned.
* </p>
*
* @return true if this method completed swapping the surface,
- * otherwise false, in which case eg the GLDrawable
+ * otherwise false, in which case eg the GLDrawable
* implementation has to swap the code.
*/
public boolean surfaceSwap();
@@ -153,13 +153,13 @@ public interface NativeSurface extends SurfaceUpdatedListener {
/** Remove the specified {@link SurfaceUpdatedListener} from the list. */
public void removeSurfaceUpdatedListener(SurfaceUpdatedListener l);
-
+
/**
* Returns the handle to the surface for this NativeSurface. <P>
- *
+ *
* The surface handle should be set/update by {@link #lockSurface()},
* where {@link #unlockSurface()} is not allowed to modify it.
- * After {@link #unlockSurface()} it is no more guaranteed
+ * After {@link #unlockSurface()} it is no more guaranteed
* that the surface handle is still valid.
*
* The surface handle shall reflect the platform one
@@ -195,16 +195,16 @@ public interface NativeSurface extends SurfaceUpdatedListener {
public AbstractGraphicsConfiguration getGraphicsConfiguration();
/**
- * Convenience: Get display handle from
+ * Convenience: Get display handle from
* AbstractGraphicsConfiguration . AbstractGraphicsScreen . AbstractGraphicsDevice
*/
public long getDisplayHandle();
/**
- * Convenience: Get display handle from
+ * Convenience: Get display handle from
* AbstractGraphicsConfiguration . AbstractGraphicsScreen
*/
public int getScreenIndex();
-
+
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java
index 593c1e7..0943c8c 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowException.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
index 07d1008..6962ce5 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008-2009 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
@@ -90,13 +90,13 @@ public abstract class NativeWindowFactory {
private static final String nativeWindowingTypePure; // canonical String via String.intern()
private static final String nativeWindowingTypeCustom; // canonical String via String.intern()
-
+
private static NativeWindowFactory defaultFactory;
private static Map<Class<?>, NativeWindowFactory> registeredFactories;
-
+
private static Class<?> nativeWindowClass;
private static boolean isAWTAvailable;
-
+
private static final String JAWTUtilClassName = "jogamp.nativewindow.jawt.JAWTUtil" ;
/** {@link jogamp.nativewindow.x11.X11Util} implements {@link ToolkitProperties}. */
private static final String X11UtilClassName = "jogamp.nativewindow.x11.X11Util";
@@ -104,16 +104,16 @@ public abstract class NativeWindowFactory {
private static final String OSXUtilClassName = "jogamp.nativewindow.macosx.OSXUtil";
/** {@link jogamp.nativewindow.windows.GDIUtil} implements {@link ToolkitProperties}. */
private static final String GDIClassName = "jogamp.nativewindow.windows.GDIUtil";
-
+
private static ToolkitLock jawtUtilJAWTToolkitLock;
-
+
private static boolean requiresToolkitLock;
private static boolean desktopHasThreadingIssues;
// Shutdown hook mechanism for the factory
private static volatile boolean isJVMShuttingDown = false;
private static final List<Runnable> customShutdownHooks = new ArrayList<Runnable>();
-
+
/** Creates a new NativeWindowFactory instance. End users do not
need to call this method. */
protected NativeWindowFactory() {
@@ -123,6 +123,7 @@ public abstract class NativeWindowFactory {
return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
private final File vcliblocation = new File(
"/opt/vc/lib/libbcm_host.so");
+ @Override
public Boolean run() {
if ( vcliblocation.isFile() ) {
return Boolean.TRUE;
@@ -139,10 +140,10 @@ public abstract class NativeWindowFactory {
case MACOS:
return TYPE_MACOSX;
case WINDOWS:
- return TYPE_WINDOWS;
+ return TYPE_WINDOWS;
case OPENKODE:
return TYPE_EGL;
-
+
case LINUX:
case FREEBSD:
case SUNOS:
@@ -158,26 +159,28 @@ public abstract class NativeWindowFactory {
static {
final boolean[] _DEBUG = new boolean[] { false };
final String[] _tmp = new String[] { null };
-
+
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
Platform.initSingleton(); // last resort ..
_DEBUG[0] = Debug.debug("NativeWindow");
_tmp[0] = Debug.getProperty("nativewindow.ws.name", true);
Runtime.getRuntime().addShutdownHook(
new Thread(new Runnable() {
+ @Override
public void run() {
NativeWindowFactory.shutdown(true);
- } }, "NativeWindowFactory_ShutdownHook" ) ) ;
+ } }, "NativeWindowFactory_ShutdownHook" ) ) ;
return null;
} } ) ;
-
+
DEBUG = _DEBUG[0];
if(DEBUG) {
System.err.println(Thread.currentThread().getName()+" - Info: NativeWindowFactory.<init>");
// Thread.dumpStack();
}
-
+
// Gather the windowing TK first
nativeWindowingTypePure = _getNativeWindowingType();
if(null==_tmp[0] || _tmp[0].length()==0) {
@@ -202,23 +205,23 @@ public abstract class NativeWindowFactory {
}
if( null != clazzName ) {
ReflectionUtil.callStaticMethod(clazzName, "initSingleton", null, null, cl );
-
+
final Boolean res1 = (Boolean) ReflectionUtil.callStaticMethod(clazzName, "requiresToolkitLock", null, null, cl);
requiresToolkitLock = res1.booleanValue();
final Boolean res2 = (Boolean) ReflectionUtil.callStaticMethod(clazzName, "hasThreadingIssues", null, null, cl);
desktopHasThreadingIssues = res2.booleanValue();
- } else {
+ } else {
requiresToolkitLock = false;
desktopHasThreadingIssues = false;
}
}
- /** Returns true if the JVM is shutting down, otherwise false. */
+ /** Returns true if the JVM is shutting down, otherwise false. */
public static final boolean isJVMShuttingDown() { return isJVMShuttingDown; }
-
- /**
+
+ /**
* Add a custom shutdown hook to be performed at JVM shutdown before shutting down NativeWindowFactory instance.
- *
+ *
* @param head if true add runnable at the start, otherwise at the end
* @param runnable runnable to be added.
*/
@@ -234,7 +237,7 @@ public abstract class NativeWindowFactory {
}
}
- /**
+ /**
* Cleanup resources at JVM shutdown
*/
public static synchronized void shutdown(boolean _isJVMShuttingDown) {
@@ -246,14 +249,14 @@ public abstract class NativeWindowFactory {
final int cshCount = customShutdownHooks.size();
for(int i=0; i < cshCount; i++) {
try {
- if( DEBUG ) {
+ if( DEBUG ) {
System.err.println("NativeWindowFactory.shutdown - customShutdownHook #"+(i+1)+"/"+cshCount);
}
customShutdownHooks.get(i).run();
} catch(Throwable t) {
System.err.println("NativeWindowFactory.shutdown: Catched "+t.getClass().getName()+" during customShutdownHook #"+(i+1)+"/"+cshCount);
- if( DEBUG ) {
- t.printStackTrace();
+ if( DEBUG ) {
+ t.printStackTrace();
}
}
}
@@ -262,7 +265,7 @@ public abstract class NativeWindowFactory {
if(DEBUG) {
System.err.println("NativeWindowFactory.shutdown(): Post customShutdownHook");
}
-
+
if(initialized) {
initialized = false;
if(null != registeredFactories) {
@@ -271,14 +274,14 @@ public abstract class NativeWindowFactory {
}
GraphicsConfigurationFactory.shutdown();
}
-
+
shutdownNativeImpl(NativeWindowFactory.class.getClassLoader()); // always re-shutdown
// SharedResourceToolkitLock.shutdown(DEBUG); // not used yet
if(DEBUG) {
System.err.println(Thread.currentThread().getName()+" - NativeWindowFactory.shutdown() END JVM Shutdown "+isJVMShuttingDown);
}
}
-
+
private static void shutdownNativeImpl(final ClassLoader cl) {
final String clazzName;
if( TYPE_X11 == nativeWindowingTypePure ) {
@@ -292,11 +295,11 @@ public abstract class NativeWindowFactory {
}
if( null != clazzName ) {
ReflectionUtil.callStaticMethod(clazzName, "shutdown", null, null, cl );
- }
+ }
}
-
+
/** Returns true if {@link #initSingleton()} has been called w/o subsequent {@link #shutdown(boolean)}. */
- public static synchronized boolean isInitialized() { return initialized; }
+ public static synchronized boolean isInitialized() { return initialized; }
/**
* Static one time initialization of this factory.<br>
@@ -316,8 +319,9 @@ public abstract class NativeWindowFactory {
if( Platform.AWT_AVAILABLE &&
ReflectionUtil.isClassAvailable("com.jogamp.nativewindow.awt.AWTGraphicsDevice", cl) ) {
-
+
Method[] jawtUtilMethods = AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
+ @Override
public Method[] run() {
try {
Class<?> _jawtUtilClass = Class.forName(JAWTUtilClassName, true, NativeWindowFactory.class.getClassLoader());
@@ -327,7 +331,7 @@ public abstract class NativeWindowFactory {
jawtUtilInitMethod.setAccessible(true);
Method jawtUtilGetJAWTToolkitLockMethod = _jawtUtilClass.getDeclaredMethod("getJAWTToolkitLock", new Class[]{});
jawtUtilGetJAWTToolkitLockMethod.setAccessible(true);
- return new Method[] { jawtUtilInitMethod, jawtUtilIsHeadlessMethod, jawtUtilGetJAWTToolkitLockMethod };
+ return new Method[] { jawtUtilInitMethod, jawtUtilIsHeadlessMethod, jawtUtilGetJAWTToolkitLockMethod };
} catch (Exception e) {
if(DEBUG) {
e.printStackTrace();
@@ -340,7 +344,7 @@ public abstract class NativeWindowFactory {
final Method jawtUtilInitMethod = jawtUtilMethods[0];
final Method jawtUtilIsHeadlessMethod = jawtUtilMethods[1];
final Method jawtUtilGetJAWTToolkitLockMethod = jawtUtilMethods[2];
-
+
ReflectionUtil.callMethod(null, jawtUtilInitMethod);
Object resO = ReflectionUtil.callMethod(null, jawtUtilIsHeadlessMethod);
@@ -351,21 +355,21 @@ public abstract class NativeWindowFactory {
} else {
throw new RuntimeException("JAWTUtil.isHeadlessMode() didn't return a Boolean");
}
- resO = ReflectionUtil.callMethod(null, jawtUtilGetJAWTToolkitLockMethod);
+ resO = ReflectionUtil.callMethod(null, jawtUtilGetJAWTToolkitLockMethod);
if(resO instanceof ToolkitLock) {
jawtUtilJAWTToolkitLock = (ToolkitLock) resO;
} else {
throw new RuntimeException("JAWTUtil.getJAWTToolkitLock() didn't return a ToolkitLock");
- }
+ }
}
}
-
+
// X11 initialization after possible AWT initialization
// This is performed post AWT initialization, allowing AWT to complete the same,
- // which may have been triggered before NativeWindow initialization.
- // This way behavior is more uniforms across configurations (Applet/RCP, applications, ..).
+ // which may have been triggered before NativeWindow initialization.
+ // This way behavior is more uniforms across configurations (Applet/RCP, applications, ..).
initSingletonNativeImpl(cl);
-
+
registeredFactories = Collections.synchronizedMap(new HashMap<Class<?>, NativeWindowFactory>());
// register our default factory -> NativeWindow
@@ -373,17 +377,17 @@ public abstract class NativeWindowFactory {
nativeWindowClass = javax.media.nativewindow.NativeWindow.class;
registerFactory(nativeWindowClass, factory);
defaultFactory = factory;
-
+
if ( isAWTAvailable ) {
// register either our default factory or (if exist) the X11/AWT one -> AWT Component
registerFactory(ReflectionUtil.getClass(ReflectionUtil.AWTNames.ComponentClass, false, cl), factory);
}
-
+
if(DEBUG) {
System.err.println("NativeWindowFactory requiresToolkitLock "+requiresToolkitLock+", desktopHasThreadingIssues "+desktopHasThreadingIssues);
System.err.println("NativeWindowFactory isAWTAvailable "+isAWTAvailable+", defaultFactory "+factory);
}
-
+
GraphicsConfigurationFactory.initSingleton();
}
}
@@ -392,20 +396,20 @@ public abstract class NativeWindowFactory {
public static boolean requiresToolkitLock() {
return requiresToolkitLock;
}
-
+
/** @return true if not headless, AWT Component and NativeWindow's AWT part available */
public static boolean isAWTAvailable() { return isAWTAvailable; }
/**
* @param useCustom if false return the native value, if true return a custom value if set, otherwise fallback to the native value.
- * @return the native window type, e.g. {@link #TYPE_X11}, which is canonical via {@link String#intern()}.
+ * @return the native window type, e.g. {@link #TYPE_X11}, which is canonical via {@link String#intern()}.
* Hence {@link String#equals(Object)} and <code>==</code> produce the same result.
*/
public static String getNativeWindowType(boolean useCustom) {
return useCustom?nativeWindowingTypeCustom:nativeWindowingTypePure;
}
- /** Don't know if we shall add this factory here ..
+ /** Don't know if we shall add this factory here ..
public static AbstractGraphicsDevice createGraphicsDevice(String type, String connection, int unitID, long handle, ToolkitLock locker) {
if(TYPE_EGL == type) {
return new
@@ -427,13 +431,13 @@ public abstract class NativeWindowFactory {
return defaultFactory;
}
- /**
+ /**
* Returns the AWT {@link ToolkitLock} (JAWT based) if {@link #isAWTAvailable}, otherwise null.
* <p>
* The JAWT based {@link ToolkitLock} also locks the global lock,
* which matters if the latter is required.
- * </p>
- */
+ * </p>
+ */
public static ToolkitLock getAWTToolkitLock() {
return jawtUtilJAWTToolkitLock;
}
@@ -441,7 +445,7 @@ public abstract class NativeWindowFactory {
public static ToolkitLock getNullToolkitLock() {
return NativeWindowFactoryImpl.getNullToolkitLock();
}
-
+
/**
* Provides the system default {@link ToolkitLock} for the default system windowing type.
* @see #getNativeWindowType(boolean)
@@ -486,7 +490,7 @@ public abstract class NativeWindowFactory {
}
return NativeWindowFactoryImpl.getNullToolkitLock();
}
-
+
/**
* @param device
* @param screen -1 is default screen of the given device, e.g. maybe 0 or determined by native API. >= 0 is specific screen
@@ -510,7 +514,7 @@ public abstract class NativeWindowFactory {
}
return new DefaultGraphicsScreen(device, screen);
}
-
+
/** Returns the appropriate NativeWindowFactory to handle window
objects of the given type. The windowClass might be {@link
NativeWindow NativeWindow}, in which case the client has
@@ -543,7 +547,7 @@ public abstract class NativeWindowFactory {
}
/** Converts the given window object and it's
- {@link AbstractGraphicsConfiguration AbstractGraphicsConfiguration} into a
+ {@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>
The object may be a component for a particular window toolkit, such as an AWT
@@ -554,7 +558,7 @@ public abstract class NativeWindowFactory {
NativeWindowFactory is responsible for handling objects from a
particular window toolkit. The built-in NativeWindowFactory
handles NativeWindow instances as well as AWT Components.<br>
-
+
@throws IllegalArgumentException if the given window object
could not be handled by any of the registered
NativeWindowFactory instances
@@ -573,22 +577,22 @@ public abstract class NativeWindowFactory {
NativeWindow. Implementors of concrete NativeWindowFactory
subclasses should override this method. */
protected abstract NativeWindow getNativeWindowImpl(Object winObj, AbstractGraphicsConfiguration config) throws IllegalArgumentException;
-
+
/**
* Returns the {@link OffscreenLayerSurface} instance of this {@link NativeSurface}.
* <p>
- * In case this surface is a {@link NativeWindow}, we traverse from the given surface
+ * In case this surface is a {@link NativeWindow}, we traverse from the given surface
* up to root until an implementation of {@link OffscreenLayerSurface} is found.
* In case <code>ifEnabled</code> is true, the surface must also implement {@link OffscreenLayerOption}
- * where {@link OffscreenLayerOption#isOffscreenLayerSurfaceEnabled()} is <code>true</code>.
+ * where {@link OffscreenLayerOption#isOffscreenLayerSurfaceEnabled()} is <code>true</code>.
* </p>
- *
+ *
* @param surface The surface to query.
- * @param ifEnabled If true, only return the enabled {@link OffscreenLayerSurface}, see {@link OffscreenLayerOption#isOffscreenLayerSurfaceEnabled()}.
+ * @param ifEnabled If true, only return the enabled {@link OffscreenLayerSurface}, see {@link OffscreenLayerOption#isOffscreenLayerSurfaceEnabled()}.
* @return
*/
public static OffscreenLayerSurface getOffscreenLayerSurface(NativeSurface surface, boolean ifEnabled) {
- if(surface instanceof OffscreenLayerSurface &&
+ if(surface instanceof OffscreenLayerSurface &&
( !ifEnabled || surface instanceof OffscreenLayerOption ) ) {
final OffscreenLayerSurface ols = (OffscreenLayerSurface) surface;
return ( !ifEnabled || ((OffscreenLayerOption)ols).isOffscreenLayerSurfaceEnabled() ) ? ols : null;
@@ -601,12 +605,12 @@ public abstract class NativeWindowFactory {
final OffscreenLayerSurface ols = (OffscreenLayerSurface) nw;
return ( !ifEnabled || ((OffscreenLayerOption)ols).isOffscreenLayerSurfaceEnabled() ) ? ols : null;
}
- nw = nw.getParent();
+ nw = nw.getParent();
}
}
- return null;
+ return null;
}
-
+
/**
* Returns true if the given visualID is valid for further processing, i.e. OpenGL usage,
* otherwise return false.
@@ -619,8 +623,8 @@ public abstract class NativeWindowFactory {
* </p>
*/
public static boolean isNativeVisualIDValidForProcessing(int visualID) {
- return NativeWindowFactory.TYPE_X11 != NativeWindowFactory.getNativeWindowType(false) ||
+ return NativeWindowFactory.TYPE_X11 != NativeWindowFactory.getNativeWindowType(false) ||
VisualIDHolder.VID_UNDEFINED != visualID ;
}
-
+
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerOption.java b/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerOption.java
index 12d30b3..1149689 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerOption.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerOption.java
@@ -32,30 +32,30 @@ package javax.media.nativewindow;
* within the implementation.
*/
public interface OffscreenLayerOption {
- /**
+ /**
* Request an offscreen layer, if supported.
* <p>
* Shall be called before the first {@link NativeWindow#lockSurface()},
* and hence before realization.
* </p>
- *
+ *
* @see #getShallUseOffscreenLayer()
- * @see #isOffscreenLayerSurfaceEnabled()
+ * @see #isOffscreenLayerSurfaceEnabled()
*/
public void setShallUseOffscreenLayer(boolean v);
/** Returns the property set by {@link #setShallUseOffscreenLayer(boolean)}. */
public boolean getShallUseOffscreenLayer();
- /**
+ /**
* Returns true if this instance uses an offscreen layer, otherwise false.
* <p>
* This instance is an offscreen layer, if {@link #setShallUseOffscreenLayer(boolean) setShallUseOffscreenLayer(true)}
* has been called before it's realization and first lock and the underlying implementation supports it.
* </p>
* The return value is undefined before issuing the first {@link NativeWindow#lockSurface()}.
- *
- * @see #setShallUseOffscreenLayer(boolean)
+ *
+ * @see #setShallUseOffscreenLayer(boolean)
*/
public boolean isOffscreenLayerSurfaceEnabled();
}
\ No newline at end of file
diff --git a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java b/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java
index 1826008..8681422 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/OffscreenLayerSurface.java
@@ -33,36 +33,36 @@ import com.jogamp.common.util.locks.RecursiveLock;
* Interface specifying the offscreen layer surface protocol.
*/
public interface OffscreenLayerSurface {
- /**
+ /**
* Attach the offscreen layer to this offscreen layer surface.
* <p>
* Implementation may realize all required resources at this point.
* </p>
- *
+ *
* @see #isOffscreenLayerSurfaceEnabled()
* @throws NativeWindowException if {@link #isOffscreenLayerSurfaceEnabled()} == false
*/
public void attachSurfaceLayer(final long layerHandle) throws NativeWindowException;
-
- /**
+
+ /**
* Detaches a previously attached offscreen layer from this offscreen layer surface.
* @see #attachSurfaceLayer(long)
* @see #isOffscreenLayerSurfaceEnabled()
- * @throws NativeWindowException if {@link #isOffscreenLayerSurfaceEnabled()} == false
+ * @throws NativeWindowException if {@link #isOffscreenLayerSurfaceEnabled()} == false
* or no surface layer is attached.
*/
public void detachSurfaceLayer() throws NativeWindowException;
-
+
/** Returns the attached surface layer or null if none is attached. */
public long getAttachedSurfaceLayer();
-
+
/** Returns true if a surface layer is attached, otherwise false. */
public boolean isSurfaceLayerAttached();
-
+
/** Sets the capabilities of this instance, allowing upstream API's to refine it, i.e. OpenGL related settings. */
public void setChosenCapabilities(CapabilitiesImmutable caps);
-
- /** Returns the recursive lock object of this surface, which synchronizes multithreaded access. */
+
+ /** Returns the recursive lock object of this surface, which synchronizes multithreaded access. */
public RecursiveLock getLock();
-
+
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java b/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java
index 15a8738..0af2bda 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/ProxySurface.java
@@ -33,44 +33,44 @@ import jogamp.nativewindow.Debug;
/**
* Provides a mutable {@link NativeSurface}, i.e. {@link MutableSurface}, while allowing an
* {@link UpstreamSurfaceHook} to influence the lifecycle and information.
- *
+ *
* @see UpstreamSurfaceHook
* @see MutableSurface
* @see NativeSurface
*/
-public interface ProxySurface extends MutableSurface {
+public interface ProxySurface extends MutableSurface {
public static final boolean DEBUG = Debug.debug("ProxySurface");
-
- /**
+
+ /**
* Implementation specific bit-value stating this {@link ProxySurface} owns the upstream's surface handle
* @see #addUpstreamOptionBits(int)
* @see #clearUpstreamOptionBits(int)
* @see #getUpstreamOptionBits()
- */
+ */
public static final int OPT_PROXY_OWNS_UPSTREAM_SURFACE = 1 << 6;
-
- /**
+
+ /**
* Implementation specific bit-value stating this {@link ProxySurface} owns the upstream's {@link AbstractGraphicsDevice}.
* @see #addUpstreamOptionBits(int)
* @see #clearUpstreamOptionBits(int)
* @see #getUpstreamOptionBits()
- */
+ */
public static final int OPT_PROXY_OWNS_UPSTREAM_DEVICE = 1 << 7;
-
- /**
+
+ /**
* Implementation specific bitvalue stating the upstream's {@link NativeSurface} is an invisible window, i.e. maybe incomplete.
* @see #addUpstreamOptionBits(int)
* @see #clearUpstreamOptionBits(int)
* @see #getUpstreamOptionBits()
- */
+ */
public static final int OPT_UPSTREAM_WINDOW_INVISIBLE = 1 << 8;
/** Allow redefining the AbstractGraphicsConfiguration */
- public void setGraphicsConfiguration(AbstractGraphicsConfiguration cfg);
+ public void setGraphicsConfiguration(AbstractGraphicsConfiguration cfg);
/**
* Return the upstream {@link NativeSurface} if used, otherwise <code>null</code>.
- * <p>
+ * <p>
* An upstream {@link NativeSurface} may backup this {@link ProxySurface} instance's representation,
* e.g. via a {@link #setUpstreamSurfaceHook(UpstreamSurfaceHook) set} {@link UpstreamSurfaceHook}.
* </p>
@@ -80,47 +80,48 @@ public interface ProxySurface extends MutableSurface {
* </p>
*/
public NativeSurface getUpstreamSurface();
-
+
/** Returns the {@link UpstreamSurfaceHook} if {@link #setUpstreamSurfaceHook(UpstreamSurfaceHook) set}, otherwise <code>null</code>. */
public UpstreamSurfaceHook getUpstreamSurfaceHook();
-
+
/**
* Sets the {@link UpstreamSurfaceHook} and returns the previous value.
*/
public void setUpstreamSurfaceHook(UpstreamSurfaceHook hook);
-
- /**
- * Enables or disables the {@link UpstreamSurfaceHook} lifecycle functions
+
+ /**
+ * Enables or disables the {@link UpstreamSurfaceHook} lifecycle functions
* {@link UpstreamSurfaceHook#create(ProxySurface)} and {@link UpstreamSurfaceHook#destroy(ProxySurface)}.
* <p>
* Use this for small code blocks where the native resources shall not change,
* i.e. resizing a derived (OpenGL) drawable.
- * </p>
+ * </p>
*/
public void enableUpstreamSurfaceHookLifecycle(boolean enable);
-
- /**
+
+ /**
* {@link UpstreamSurfaceHook#create(ProxySurface)} is being issued and the proxy surface/window handles shall be set.
- */
+ */
public void createNotify();
-
- /**
+
+ /**
* {@link UpstreamSurfaceHook#destroy(ProxySurface)} is being issued and all proxy surface/window handles shall be cleared.
- */
+ */
public void destroyNotify();
-
+
public StringBuilder getUpstreamOptionBits(StringBuilder sink);
public int getUpstreamOptionBits();
-
+
/** Returns <code>true</code> if the give bit-mask <code>v</code> is set in this instance upstream-option-bits, otherwise <code>false</code>.*/
public boolean containsUpstreamOptionBits(int v);
-
+
/** Add the given bit-mask to this instance upstream-option-bits using bit-or w/ <code>v</code>.*/
public void addUpstreamOptionBits(int v);
-
+
/** Clear the given bit-mask from this instance upstream-option-bits using bit-and w/ <code>~v</code>*/
public void clearUpstreamOptionBits(int v);
-
+
public StringBuilder toString(StringBuilder sink);
+ @Override
public String toString();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.java b/src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.java
index 0912b5a..de65a30 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/SurfaceUpdatedListener.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package javax.media.nativewindow;
diff --git a/src/nativewindow/classes/javax/media/nativewindow/ToolkitLock.java b/src/nativewindow/classes/javax/media/nativewindow/ToolkitLock.java
index eccfcfa..017b996 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/ToolkitLock.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/ToolkitLock.java
@@ -53,26 +53,26 @@ public interface ToolkitLock {
* @throws RuntimeException in case of a timeout
*/
public void lock();
-
+
/**
* Release the lock.
*
* @throws RuntimeException in case the lock is not acquired by this thread.
*/
public void unlock();
-
+
/**
- * @throws RuntimeException if current thread does not hold the lock
+ * @throws RuntimeException if current thread does not hold the lock
*/
public void validateLocked() throws RuntimeException;
-
- /**
+
+ /**
* Dispose this instance.
- * <p>
+ * <p>
* Shall be called when instance is no more required.
* </p>
* This allows implementations sharing a lock via resources
- * to decrease the reference counter.
+ * to decrease the reference counter.
*/
public void dispose();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java b/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java
index 6fe2e53..f08a6c9 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java
@@ -28,24 +28,24 @@
package javax.media.nativewindow;
-/**
- * Interface allowing upstream caller to pass lifecycle actions and size info
- * to a {@link ProxySurface} instance.
- */
+/**
+ * Interface allowing upstream caller to pass lifecycle actions and size info
+ * to a {@link ProxySurface} instance.
+ */
public interface UpstreamSurfaceHook {
/** called within {@link ProxySurface#createNotify()} within lock, before using surface. */
public void create(ProxySurface s);
/** called within {@link ProxySurface#destroyNotify()} within lock, before clearing fields. */
public void destroy(ProxySurface s);
- /** Returns the width of the upstream surface, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */
+ /** Returns the width of the upstream surface, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */
public int getWidth(ProxySurface s);
- /** Returns the height of the upstream surface, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */
+ /** Returns the height of the upstream surface, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */
public int getHeight(ProxySurface s);
-
+
/**
- * {@link UpstreamSurfaceHook} w/ mutable size, allowing it's {@link ProxySurface} user to resize.
- */
+ * {@link UpstreamSurfaceHook} w/ mutable size, allowing it's {@link ProxySurface} user to resize.
+ */
public interface MutableSize extends UpstreamSurfaceHook {
public void setSize(int width, int height);
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java b/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java
index 4f3d3ff..4ed79b1 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/VisualIDHolder.java
@@ -38,7 +38,7 @@ import java.util.Comparator;
* </p>
*/
public interface VisualIDHolder {
-
+
public enum VIDType {
// Generic Values
INTRINSIC(0), NATIVE(1),
@@ -47,19 +47,19 @@ public interface VisualIDHolder {
// X11 Values
X11_XVISUAL(20), X11_FBCONFIG(21),
// Windows Values
- WIN32_PFD(30);
-
+ WIN32_PFD(30);
+
public final int id;
VIDType(int id){
this.id = id;
}
- }
-
+ }
+
/**
* Returns the native visual ID of the given <code>type</code>
* if supported, or {@link #VID_UNDEFINED} if not supported.
- * <p>
+ * <p>
* Depending on the native windowing system, <code>type</code> is handled as follows:
* <ul>
* <li>X11 throws NativeWindowException on <code>EGL_CONFIG</code>, <code>WIN32_PFD</code>
@@ -76,7 +76,7 @@ public interface VisualIDHolder {
* <li><code>X11_XVISUAL</code>: <i>X11 XVisual ID</i></li>
* <li><code>X11_FBCONFIG</code>: <i>X11 FBConfig ID</i> or <code>VID_UNDEFINED</code></li>
* </ul></li>
- * <li>Windows/GL throws NativeWindowException on <code>EGL_CONFIG</code>, <code>X11_XVISUAL</code>, <code>X11_FBCONFIG</code>
+ * <li>Windows/GL throws NativeWindowException on <code>EGL_CONFIG</code>, <code>X11_XVISUAL</code>, <code>X11_FBCONFIG</code>
* <ul>
* <li><code>INTRINSIC</code>: <i>Win32 PIXELFORMATDESCRIPTOR ID</i></li>
* <li><code>NATIVE</code>: <i>Win32 PIXELFORMATDESCRIPTOR ID</i></li>
@@ -91,35 +91,36 @@ public interface VisualIDHolder {
* </ul>
* </p>
* Note: <code>INTRINSIC</code> and <code>NATIVE</code> are always handled,
- * but may result in {@link #VID_UNDEFINED}. The latter is true if
- * the native value are actually undefined or the corresponding object is not
+ * but may result in {@link #VID_UNDEFINED}. The latter is true if
+ * the native value are actually undefined or the corresponding object is not
* mapped to a native visual object.
- *
+ *
* @throws NativeWindowException if <code>type</code> is neither
* <code>INTRINSIC</code> nor <code>NATIVE</code>
- * and does not match the native implementation.
+ * and does not match the native implementation.
*/
int getVisualID(VIDType type) throws NativeWindowException ;
-
- /**
+
+ /**
* {@link #getVisualID(VIDType)} result indicating an undefined value,
* which could be cause by an unsupported query.
* <p>
* We assume the const value <code>0</code> doesn't reflect a valid native visual ID
* and is interpreted as <i>no value</i> on all platforms.
* This is currently true for Android, X11 and Windows.
- * </p>
+ * </p>
*/
static final int VID_UNDEFINED = 0;
-
+
/** Comparing {@link VIDType#NATIVE} */
public static class VIDComparator implements Comparator<VisualIDHolder> {
private VIDType type;
-
+
public VIDComparator(VIDType type) {
this.type = type;
}
-
+
+ @Override
public int compare(VisualIDHolder vid1, VisualIDHolder vid2) {
final int id1 = vid1.getVisualID(type);
final int id2 = vid2.getVisualID(type);
@@ -131,5 +132,5 @@ public interface VisualIDHolder {
}
return 0;
}
- }
+ }
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java b/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java
index 02f68f4..8570b78 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/WindowClosingProtocol.java
@@ -37,7 +37,7 @@ package javax.media.nativewindow;
* this protocol default behavior {@link WindowClosingMode#DISPOSE_ON_CLOSE DISPOSE_ON_CLOSE} shall be used.</p>
*/
public interface WindowClosingProtocol {
-
+
/**
* Window closing mode if triggered by toolkit close operation.
*/
@@ -47,7 +47,7 @@ public interface WindowClosingProtocol {
* This is the default behavior within an AWT environment.
*/
DO_NOTHING_ON_CLOSE,
-
+
/**
* Dispose resources on native window close operation.<br>
* This is the default behavior in case no underlying toolkit defines otherwise.
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java b/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java
index b524141..24ccc83 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/Dimension.java
@@ -4,14 +4,14 @@
*
* 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
@@ -21,12 +21,12 @@
* 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;
public class Dimension implements Cloneable, DimensionImmutable {
@@ -45,10 +45,12 @@ public class Dimension implements Cloneable, DimensionImmutable {
this.height=height;
}
+ @Override
public Object cloneMutable() {
return clone();
}
-
+
+ @Override
public Object clone() {
try {
return super.clone();
@@ -58,22 +60,26 @@ public class Dimension implements Cloneable, DimensionImmutable {
}
@Override
- public int getWidth() { return width; }
+ public final int getWidth() { return width; }
@Override
- public int getHeight() { return height; }
+ public final int getHeight() { return height; }
- public void setWidth(int width) {
+ public final void set(int width, int height) {
+ this.width = width;
+ this.height = height;
+ }
+ public final void setWidth(int width) {
this.width = width;
}
- public void setHeight(int height) {
+ public final void setHeight(int height) {
this.height = height;
}
- public Dimension scale(int s) {
+ public final Dimension scale(int s) {
width *= s;
height *= s;
return this;
}
- public Dimension add(Dimension pd) {
+ public final Dimension add(Dimension pd) {
width += pd.width ;
height += pd.height ;
return this;
@@ -81,14 +87,14 @@ public class Dimension implements Cloneable, DimensionImmutable {
@Override
public String toString() {
- return new String(width+" x "+height);
+ return width + " x " + height;
}
@Override
public int compareTo(final DimensionImmutable d) {
final int tsq = width*height;
final int xsq = d.getWidth()*d.getHeight();
-
+
if(tsq > xsq) {
return 1;
} else if(tsq < xsq) {
@@ -96,13 +102,13 @@ public class Dimension implements Cloneable, DimensionImmutable {
}
return 0;
}
-
+
@Override
public boolean equals(Object obj) {
if(this == obj) { return true; }
if (obj instanceof Dimension) {
Dimension p = (Dimension)obj;
- return height == p.height &&
+ return height == p.height &&
width == p.width ;
}
return false;
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/DimensionImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/util/DimensionImmutable.java
index 22bd3f4..e6cacf4 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/DimensionImmutable.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/DimensionImmutable.java
@@ -46,12 +46,12 @@ public interface DimensionImmutable extends WriteCloneable, Comparable<Dimension
/**
* <p>
* Compares square of size.
- * </p>
+ * </p>
* {@inheritDoc}
*/
@Override
public int compareTo(final DimensionImmutable d);
-
+
/**
* Checks whether two dimensions objects are equal. Two instances
* of <code>DimensionReadOnly</code> are equal if two components
@@ -59,8 +59,10 @@ public interface DimensionImmutable extends WriteCloneable, Comparable<Dimension
* @return <code>true</code> if the two dimensions are equal;
* otherwise <code>false</code>.
*/
+ @Override
boolean equals(Object obj);
+ @Override
int hashCode();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java b/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java
index f22668f..3644916 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,18 +20,18 @@
* 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;
public class Insets implements Cloneable, InsetsImmutable {
static final InsetsImmutable zeroInsets = new Insets();
public static final InsetsImmutable getZero() { return zeroInsets; }
-
+
int l, r, t, b;
public Insets() {
@@ -44,11 +44,13 @@ public class Insets implements Cloneable, InsetsImmutable {
this.t=top;
this.b=bottom;
}
-
+
+ @Override
public Object cloneMutable() {
return clone();
}
-
+
+ @Override
protected Object clone() {
try {
return super.clone();
@@ -70,11 +72,14 @@ public class Insets implements Cloneable, InsetsImmutable {
@Override
public final int getTotalHeight() { return t + b; }
- public void setLeftWidth(int left) { l = left; }
- public void setRightWidth(int right) { r = right; }
- public void setTopHeight(int top) { t = top; }
- public void setBottomHeight(int bottom) { b = bottom; }
-
+ public final void set(int left, int right, int top, int bottom) {
+ l = left; r = right; t = top; b = bottom;
+ }
+ public final void setLeftWidth(int left) { l = left; }
+ public final void setRightWidth(int right) { r = right; }
+ public final void setTopHeight(int top) { t = top; }
+ public final void setBottomHeight(int bottom) { b = bottom; }
+
@Override
public boolean equals(Object obj) {
if(this == obj) { return true; }
@@ -96,8 +101,9 @@ public class Insets implements Cloneable, InsetsImmutable {
return sum3 * (sum3 + 1)/2 + val2;
}
+ @Override
public String toString() {
- return new String("[ l "+l+", r "+r+" - t "+t+", b "+b+" - "+getTotalWidth()+"x"+getTotalHeight()+"]");
+ return "[ l "+l+", r "+r+" - t "+t+", b "+b+" - "+getTotalWidth()+"x"+getTotalHeight()+"]";
}
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java
index 075641e..8256068 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java
@@ -41,13 +41,13 @@ public interface InsetsImmutable extends WriteCloneable {
/** @return total width, ie. <code>left_width + right_width</code> */
int getTotalWidth();
-
+
/** @return top inset height */
int getTopHeight();
/** @return bottom inset height */
int getBottomHeight();
-
+
/** @return total height, ie. <code>top_height + bottom_height</code> */
int getTotalHeight();
@@ -59,8 +59,10 @@ public interface InsetsImmutable extends WriteCloneable {
* @return <code>true</code> if the two Insets are equal;
* otherwise <code>false</code>.
*/
+ @Override
boolean equals(Object obj);
+ @Override
int hashCode();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java b/src/nativewindow/classes/javax/media/nativewindow/util/Point.java
index a30d303..331c138 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/Point.java
@@ -42,10 +42,12 @@ public class Point implements Cloneable, PointImmutable {
this(0, 0);
}
+ @Override
public Object cloneMutable() {
return clone();
}
-
+
+ @Override
public Object clone() {
try {
return super.clone();
@@ -58,7 +60,7 @@ public class Point implements Cloneable, PointImmutable {
public int compareTo(final PointImmutable d) {
final int sq = x*y;
final int xsq = d.getX()*d.getY();
-
+
if(sq > xsq) {
return 1;
} else if(sq < xsq) {
@@ -66,7 +68,7 @@ public class Point implements Cloneable, PointImmutable {
}
return 0;
}
-
+
@Override
public boolean equals(Object obj) {
if(this == obj) { return true; }
@@ -95,29 +97,31 @@ public class Point implements Cloneable, PointImmutable {
return hash;
}
+ @Override
public String toString() {
- return new String( x + " / " + y );
+ return x + " / " + y;
}
- public void setX(int x) { this.x = x; }
- public void setY(int y) { this.y = y; }
+ public final void set(int x, int y) { this.x = x; this.y = y; }
+ public final void setX(int x) { this.x = x; }
+ public final void setY(int y) { this.y = y; }
- public Point translate(Point pd) {
+ public final Point translate(Point pd) {
x += pd.x ;
y += pd.y ;
return this;
}
- public Point translate(int dx, int dy) {
+ public final Point translate(int dx, int dy) {
x += dx ;
y += dy ;
return this;
}
- public Point scale(int sx, int sy) {
+ public final Point scale(int sx, int sy) {
x *= sx ;
y *= sy ;
return this;
}
-
+
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/PointImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/util/PointImmutable.java
index b00329b..08c628c 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/PointImmutable.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/PointImmutable.java
@@ -41,12 +41,12 @@ public interface PointImmutable extends WriteCloneable, Comparable<PointImmutabl
/**
* <p>
* Compares the square of the position.
- * </p>
+ * </p>
* {@inheritDoc}
*/
@Override
public int compareTo(final PointImmutable d);
-
+
/**
* Checks whether two points objects are equal. Two instances
* of <code>PointReadOnly</code> are equal if the two components
@@ -54,8 +54,10 @@ public interface PointImmutable extends WriteCloneable, Comparable<PointImmutabl
* @return <code>true</code> if the two points are equal;
* otherwise <code>false</code>.
*/
+ @Override
public boolean equals(Object obj);
+ @Override
public int hashCode();
-
+
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java b/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java
index 7576f4e..d0d8bfb 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/Rectangle.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.util.List;
@@ -46,11 +46,13 @@ public class Rectangle implements Cloneable, RectangleImmutable {
this.width=width;
this.height=height;
}
-
+
+ @Override
public Object cloneMutable() {
return clone();
}
-
+
+ @Override
protected Object clone() {
try {
return super.clone();
@@ -67,7 +69,13 @@ public class Rectangle implements Cloneable, RectangleImmutable {
public final int getWidth() { return width; }
@Override
public final int getHeight() { return height; }
-
+
+ public final void set(int x, int y, int width, int height) {
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
+ }
public final void setX(int x) { this.x = x; }
public final void setY(int y) { this.y = y; }
public final void setWidth(int width) { this.width = width; }
@@ -83,7 +91,7 @@ public class Rectangle implements Cloneable, RectangleImmutable {
final int y1 = Math.min(y, ry1);
final int x2 = Math.max(x + width, rx2);
final int y2 = Math.max(y + height, ry2);
- return new Rectangle(x1, y1, x2 - x1, y2 - y1);
+ return new Rectangle(x1, y1, x2 - x1, y2 - y1);
}
/**
* Calculates the union of the given rectangles, stores it in this instance and returns this instance.
@@ -100,13 +108,10 @@ public class Rectangle implements Cloneable, RectangleImmutable {
y1 = Math.min(y1, vp.getY());
y2 = Math.max(y2, vp.getY() + vp.getHeight());
}
- setX(x1);
- setY(y1);
- setWidth(x2 - x1);
- setHeight(y2 - y1);
+ set(x1, y1, x2 - x1, y2 - y1);
return this;
}
-
+
@Override
public final RectangleImmutable intersection(RectangleImmutable r) {
return intersection(r.getX(), r.getY(), r.getX() + r.getWidth(), r.getY() + r.getHeight());
@@ -141,13 +146,13 @@ public class Rectangle implements Cloneable, RectangleImmutable {
final float sqT = (float) ( width*height );
return sqI / sqT;
}
-
+
@Override
public int compareTo(final RectangleImmutable d) {
{
final int sq = width*height;
final int xsq = d.getWidth()*d.getHeight();
-
+
if(sq > xsq) {
return 1;
} else if(sq < xsq) {
@@ -157,7 +162,7 @@ public class Rectangle implements Cloneable, RectangleImmutable {
{
final int sq = x*y;
final int xsq = d.getX()*d.getY();
-
+
if(sq > xsq) {
return 1;
} else if(sq < xsq) {
@@ -166,7 +171,7 @@ public class Rectangle implements Cloneable, RectangleImmutable {
}
return 0;
}
-
+
@Override
public boolean equals(Object obj) {
if(this == obj) { return true; }
@@ -188,8 +193,9 @@ public class Rectangle implements Cloneable, RectangleImmutable {
return sum3 * (sum3 + 1)/2 + val2;
}
+ @Override
public String toString() {
- return new String("[ "+x+" / "+y+" "+width+" x "+height+" ]");
+ return "[ "+x+" / "+y+" "+width+" x "+height+" ]";
}
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/RectangleImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/util/RectangleImmutable.java
index 440d9e0..7ca92ff 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/RectangleImmutable.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/RectangleImmutable.java
@@ -49,7 +49,7 @@ public interface RectangleImmutable extends WriteCloneable, Comparable<Rectangle
RectangleImmutable intersection(RectangleImmutable r);
/** Returns the intersection of this rectangleand the given coordinates. */
RectangleImmutable intersection(final int rx1, final int ry1, final int rx2, final int ry2);
- /**
+ /**
* Returns the coverage of given rectangle w/ this this one, i.e. between <code>0.0</code> and <code>1.0</code>.
* <p>
* Coverage is computed by:
@@ -57,19 +57,19 @@ public interface RectangleImmutable extends WriteCloneable, Comparable<Rectangle
* isect = this.intersection(r);
* coverage = area( isect ) / area( this ) ;
* </pre>
- * </p>
+ * </p>
*/
float coverage(RectangleImmutable r);
-
+
/**
* <p>
* Compares square of size 1st, if equal the square of position.
- * </p>
+ * </p>
* {@inheritDoc}
*/
@Override
public int compareTo(final RectangleImmutable d);
-
+
/**
* Checks whether two rect objects are equal. Two instances
* of <code>Rectangle</code> are equal if the four integer values
@@ -78,8 +78,10 @@ public interface RectangleImmutable extends WriteCloneable, Comparable<Rectangle
* @return <code>true</code> if the two rectangles are equal;
* otherwise <code>false</code>.
*/
+ @Override
boolean equals(Object obj);
+ @Override
int hashCode();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java b/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java
index 3084816..7761973 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/SurfaceSize.java
@@ -4,14 +4,14 @@
*
* 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
@@ -21,15 +21,15 @@
* 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;
-/**
+/**
* Immutable SurfaceSize Class, consisting of it's read only components:<br>
* <ul>
* <li>{@link javax.media.nativewindow.util.DimensionImmutable} size in pixels</li>
@@ -56,14 +56,15 @@ public class SurfaceSize implements Comparable<SurfaceSize> {
return bitsPerPixel;
}
+ @Override
public final String toString() {
- return new String("[ "+resolution+" x "+bitsPerPixel+" bpp ]");
+ return "[ "+resolution+" x "+bitsPerPixel+" bpp ]";
}
/**
* <p>
* Compares {@link DimensionImmutable#compareTo(DimensionImmutable) resolution} 1st, if equal the bitsPerPixel.
- * </p>
+ * </p>
* {@inheritDoc}
*/
@Override
@@ -72,7 +73,7 @@ public class SurfaceSize implements Comparable<SurfaceSize> {
if( 0 != rres ) {
return rres;
}
- final int xbpp = ssz.getBitsPerPixel();
+ final int xbpp = ssz.getBitsPerPixel();
if(bitsPerPixel > xbpp) {
return 1;
} else if(bitsPerPixel < xbpp) {
@@ -80,7 +81,7 @@ public class SurfaceSize implements Comparable<SurfaceSize> {
}
return 0;
}
-
+
/**
* Checks whether two size objects are equal. Two instances
* of <code>SurfaceSize</code> are equal if the two components
@@ -89,6 +90,7 @@ public class SurfaceSize implements Comparable<SurfaceSize> {
* @return <code>true</code> if the two dimensions are equal;
* otherwise <code>false</code>.
*/
+ @Override
public final boolean equals(Object obj) {
if(this == obj) { return true; }
if (obj instanceof SurfaceSize) {
@@ -99,6 +101,7 @@ public class SurfaceSize implements Comparable<SurfaceSize> {
return false;
}
+ @Override
public final int hashCode() {
// 31 * x == (x << 5) - x
int hash = 31 + getResolution().hashCode();
diff --git a/src/nativewindow/classes/jogamp/nativewindow/Debug.java b/src/nativewindow/classes/jogamp/nativewindow/Debug.java
index c5e3163..b7197db 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/Debug.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/Debug.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -51,9 +51,10 @@ public class Debug extends PropertyAccess {
// Some common properties
private static final boolean verbose;
private static final boolean debugAll;
-
+
static {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
PropertyAccess.addTrustedPrefix("nativewindow.");
return null;
diff --git a/src/nativewindow/classes/jogamp/nativewindow/DefaultGraphicsConfigurationFactoryImpl.java b/src/nativewindow/classes/jogamp/nativewindow/DefaultGraphicsConfigurationFactoryImpl.java
index 52e9c83..8fb8192 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/DefaultGraphicsConfigurationFactoryImpl.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/DefaultGraphicsConfigurationFactoryImpl.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2009 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
@@ -36,6 +36,7 @@ package jogamp.nativewindow;
import javax.media.nativewindow.*;
public class DefaultGraphicsConfigurationFactoryImpl extends GraphicsConfigurationFactory {
+ @Override
protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl(
CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AbstractGraphicsScreen screen, int nativeVisualID) {
return new DefaultGraphicsConfiguration(screen, capsChosen, capsRequested);
diff --git a/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java
index c9f8308..cadef9b 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/GlobalToolkitLock.java
@@ -36,20 +36,20 @@ import com.jogamp.common.util.locks.RecursiveLock;
/**
* Implementing a global recursive {@link javax.media.nativewindow.ToolkitLock}.
* <p>
- * This is the last resort for unstable driver where multiple X11 display connections
+ * 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.
* </p>
*/
public class GlobalToolkitLock implements ToolkitLock {
private static final RecursiveLock globalLock = LockFactory.createRecursiveLock();
private static GlobalToolkitLock singleton = new GlobalToolkitLock();
-
+
public static final GlobalToolkitLock getSingleton() {
return singleton;
}
-
+
private GlobalToolkitLock() { }
-
+
@Override
public final void lock() {
globalLock.lock();
@@ -61,17 +61,18 @@ public class GlobalToolkitLock implements ToolkitLock {
if(TRACE_LOCK) { System.err.println("GlobalToolkitLock.unlock()"); }
globalLock.unlock(); // implicit lock validation
}
-
+
@Override
public final void validateLocked() throws RuntimeException {
globalLock.validateLocked();
}
-
+
@Override
public final void dispose() {
// nop
}
-
+
+ @Override
public String toString() {
return "GlobalToolkitLock[obj 0x"+Integer.toHexString(hashCode())+", isOwner "+globalLock.isOwner(Thread.currentThread())+", "+globalLock.toString()+"]";
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java b/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java
index 6c15f9a..e7eb137 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.nativewindow;
@@ -37,20 +37,17 @@ import com.jogamp.common.os.Platform;
import com.jogamp.common.util.cache.TempJarCache;
public class NWJNILibLoader extends JNILibLoaderBase {
-
- public static boolean loadNativeWindow(final String ossuffix) {
- return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
- public Boolean run() {
- Platform.initSingleton();
- final String libName = "nativewindow_"+ossuffix ;
- if(TempJarCache.isInitialized() && null == TempJarCache.findLibrary(libName)) {
- // either: [jogl-all.jar, jogl-all-noawt.jar, jogl-all-mobile.jar] -> jogl-all-natives-<os.and.arch>.jar
- // or: nativewindow-core.jar -> nativewindow-natives-<os.and.arch>.jar
- addNativeJarLibs(new Class<?>[] { NWJNILibLoader.class }, "-all", new String[] { "-noawt", "-mobile", "-core" } );
- }
- return new Boolean(loadLibrary(libName, false, NWJNILibLoader.class.getClassLoader()));
- }
- }).booleanValue();
- }
-
+ public static boolean loadNativeWindow(final String ossuffix) {
+ return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+ @Override
+ public Boolean run() {
+ Platform.initSingleton();
+ final String libName = "nativewindow_"+ossuffix ;
+ if(TempJarCache.isInitialized() && null == TempJarCache.findLibrary(libName)) {
+ JNILibLoaderBase.addNativeJarLibsJoglCfg(new Class<?>[] { NWJNILibLoader.class });
+ }
+ return Boolean.valueOf(loadLibrary(libName, false, NWJNILibLoader.class.getClassLoader()));
+ }
+ }).booleanValue();
+ }
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java b/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java
index a3a66b7..22ac3bd 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/NativeWindowFactoryImpl.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. 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
@@ -48,9 +48,10 @@ public class NativeWindowFactoryImpl extends NativeWindowFactory {
public static ToolkitLock getNullToolkitLock() {
return nullToolkitLock;
}
-
+
// This subclass of NativeWindowFactory handles the case of
// NativeWindows being passed in
+ @Override
protected NativeWindow getNativeWindowImpl(Object winObj, AbstractGraphicsConfiguration config) throws IllegalArgumentException {
if (winObj instanceof NativeWindow) {
// Use the NativeWindow directly
@@ -69,7 +70,7 @@ public class NativeWindowFactoryImpl extends NativeWindowFactory {
winObj.getClass().getName() + " is unsupported; expected " +
"javax.media.nativewindow.NativeWindow or "+AWTNames.ComponentClass);
}
-
+
private Constructor<?> nativeWindowConstructor = null;
private NativeWindow getAWTNativeWindow(Object winObj, AbstractGraphicsConfiguration config) {
@@ -93,7 +94,7 @@ public class NativeWindowFactoryImpl extends NativeWindowFactory {
}
nativeWindowConstructor = ReflectionUtil.getConstructor(
- windowClassName, new Class[] { Object.class, AbstractGraphicsConfiguration.class },
+ windowClassName, new Class[] { Object.class, AbstractGraphicsConfiguration.class },
getClass().getClassLoader());
} catch (Exception e) {
throw new IllegalArgumentException(e);
diff --git a/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java
index 5fc5fe3..bda2052 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/NullToolkitLock.java
@@ -38,7 +38,7 @@ import javax.media.nativewindow.ToolkitLock;
public class NullToolkitLock implements ToolkitLock {
/** Singleton via {@link NativeWindowFactoryImpl#getNullToolkitLock()} */
protected NullToolkitLock() { }
-
+
@Override
public final void lock() {
if(TRACE_LOCK) {
@@ -51,21 +51,22 @@ public class NullToolkitLock implements ToolkitLock {
public final void unlock() {
if(TRACE_LOCK) { System.err.println("NullToolkitLock.unlock()"); }
}
-
+
@Override
public final void validateLocked() throws RuntimeException {
if( NativeWindowFactory.requiresToolkitLock() ) {
throw new RuntimeException("NullToolkitLock does not lock, but locking is required.");
}
}
-
+
@Override
public final void dispose() {
// nop
}
-
+
+ @Override
public String toString() {
return "NullToolkitLock[]";
}
-
+
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java b/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java
index 56e3427..097fffe 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java
@@ -40,7 +40,7 @@ import javax.media.nativewindow.UpstreamSurfaceHook;
import com.jogamp.common.util.locks.LockFactory;
import com.jogamp.common.util.locks.RecursiveLock;
-public abstract class ProxySurfaceImpl implements ProxySurface {
+public abstract class ProxySurfaceImpl implements ProxySurface {
private final SurfaceUpdatedHelper surfaceUpdatedHelper = new SurfaceUpdatedHelper();
private AbstractGraphicsConfiguration config; // control access due to delegation
private UpstreamSurfaceHook upstream;
@@ -70,15 +70,15 @@ public abstract class ProxySurfaceImpl implements ProxySurface {
this.upstreamSurfaceHookLifecycleEnabled = true;
if(ownsDevice) {
addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_DEVICE );
- }
+ }
}
@Override
public NativeSurface getUpstreamSurface() { return null; }
-
+
@Override
public final UpstreamSurfaceHook getUpstreamSurfaceHook() { return upstream; }
-
+
@Override
public void setUpstreamSurfaceHook(UpstreamSurfaceHook hook) {
if(null == hook) {
@@ -86,14 +86,14 @@ public abstract class ProxySurfaceImpl implements ProxySurface {
}
upstream = hook;
}
-
+
@Override
public final void enableUpstreamSurfaceHookLifecycle(boolean enable) {
upstreamSurfaceHookLifecycleEnabled = enable;
}
-
+
@Override
- public void createNotify() {
+ public void createNotify() {
if(upstreamSurfaceHookLifecycleEnabled) {
upstream.create(this);
}
@@ -113,15 +113,15 @@ public abstract class ProxySurfaceImpl implements ProxySurface {
}
this.surfaceHandle_old = 0;
}
-
- /**
+
+ /**
* Must be overridden by implementations allowing having a {@link UpstreamSurfaceHook} being passed.
- * @see #destroyNotify()
+ * @see #destroyNotify()
*/
protected void invalidateImpl() {
- throw new InternalError("UpstreamSurfaceHook given, but required method not implemented.");
+ throw new InternalError("UpstreamSurfaceHook given, but required method not implemented.");
}
-
+
protected final AbstractGraphicsConfiguration getPrivateGraphicsConfiguration() {
return config;
}
@@ -140,7 +140,7 @@ public abstract class ProxySurfaceImpl implements ProxySurface {
public final void setGraphicsConfiguration(AbstractGraphicsConfiguration cfg) {
config = cfg;
}
-
+
@Override
public final int getScreenIndex() {
return getGraphicsConfiguration().getScreen().getIndex();
@@ -151,7 +151,7 @@ public abstract class ProxySurfaceImpl implements ProxySurface {
@Override
public abstract void setSurfaceHandle(long surfaceHandle);
-
+
@Override
public final int getWidth() {
return upstream.getWidth(this);
@@ -252,7 +252,8 @@ public abstract class ProxySurfaceImpl implements ProxySurface {
public final Thread getSurfaceLockOwner() {
return surfaceLock.getOwner();
}
-
+
+ @Override
public final StringBuilder getUpstreamOptionBits(StringBuilder sink) {
if(null == sink) {
sink = new StringBuilder();
@@ -284,21 +285,21 @@ public abstract class ProxySurfaceImpl implements ProxySurface {
sink.append(" ]");
return sink;
}
-
+
@Override
public final int getUpstreamOptionBits() { return implBitfield; }
-
+
@Override
public final boolean containsUpstreamOptionBits(int v) {
return v == ( implBitfield & v ) ;
}
-
+
@Override
public final void addUpstreamOptionBits(int v) { implBitfield |= v; }
-
+
@Override
public final void clearUpstreamOptionBits(int v) { implBitfield &= ~v; }
-
+
@Override
public StringBuilder toString(StringBuilder sink) {
if(null == sink) {
@@ -315,7 +316,7 @@ public abstract class ProxySurfaceImpl implements ProxySurface {
// append("\n, upstreamSurface "+getUpstreamSurface());
return sink;
}
-
+
@Override
public String toString() {
StringBuilder msg = new StringBuilder();
diff --git a/src/nativewindow/classes/jogamp/nativewindow/ResourceToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/ResourceToolkitLock.java
index 5b79de0..f1efb81 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/ResourceToolkitLock.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/ResourceToolkitLock.java
@@ -50,7 +50,7 @@ public class ResourceToolkitLock implements ToolkitLock {
private ResourceToolkitLock() {
this.lock = LockFactory.createRecursiveLock();
}
-
+
@Override
public final void lock() {
lock.lock();
@@ -62,17 +62,18 @@ public class ResourceToolkitLock implements ToolkitLock {
if(TRACE_LOCK) { System.err.println("ResourceToolkitLock.unlock()"); }
lock.unlock(); // implicit lock validation
}
-
+
@Override
public final void validateLocked() throws RuntimeException {
lock.validateLocked();
}
-
+
@Override
public final void dispose() {
// nop
}
-
+
+ @Override
public String toString() {
return "ResourceToolkitLock[obj 0x"+Integer.toHexString(hashCode())+", isOwner "+lock.isOwner(Thread.currentThread())+", "+lock.toString()+"]";
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java b/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java
index 94d12e6..7b74e1f 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/SharedResourceToolkitLock.java
@@ -54,8 +54,8 @@ public class SharedResourceToolkitLock implements ToolkitLock {
handle2Lock = new LongObjectHashMap();
handle2Lock.setKeyNotFoundValue(null);
}
-
- /**
+
+ /**
* @return number of unclosed EGL Displays.<br>
*/
public static int shutdown(boolean verbose) {
@@ -70,7 +70,7 @@ public class SharedResourceToolkitLock implements ToolkitLock {
}
return handle2Lock.size();
}
-
+
public static void dumpOpenDisplayConnections() {
System.err.println("SharedResourceToolkitLock: Open ResourceToolkitLock's: "+handle2Lock.size());
int i=0;
@@ -79,7 +79,7 @@ public class SharedResourceToolkitLock implements ToolkitLock {
System.err.println("SharedResourceToolkitLock: Open["+i+"]: "+e.value);
}
}
-
+
public static final SharedResourceToolkitLock get(long handle) {
SharedResourceToolkitLock res;
synchronized(handle2Lock) {
@@ -106,8 +106,8 @@ public class SharedResourceToolkitLock implements ToolkitLock {
this.handle = handle;
this.refCount = 0;
}
-
-
+
+
@Override
public final void lock() {
lock.lock();
@@ -119,12 +119,12 @@ public class SharedResourceToolkitLock implements ToolkitLock {
if(TRACE_LOCK) { System.err.println("SharedResourceToolkitLock.unlock()"); }
lock.unlock();
}
-
+
@Override
public final void validateLocked() throws RuntimeException {
lock.validateLocked();
}
-
+
@Override
public final void dispose() {
if(0 < refCount) { // volatile OK
@@ -141,7 +141,8 @@ public class SharedResourceToolkitLock implements ToolkitLock {
if(DEBUG || TRACE_LOCK) { System.err.println("SharedResourceToolkitLock.dispose() * NULL *: "+this); }
}
}
-
+
+ @Override
public String toString() {
return "SharedResourceToolkitLock[refCount "+refCount+", handle 0x"+Long.toHexString(handle)+", obj 0x"+Integer.toHexString(hashCode())+", isOwner "+lock.isOwner(Thread.currentThread())+", "+lock.toString()+"]";
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/SurfaceUpdatedHelper.java b/src/nativewindow/classes/jogamp/nativewindow/SurfaceUpdatedHelper.java
index 4f68c69..1e83232 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/SurfaceUpdatedHelper.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/SurfaceUpdatedHelper.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -39,27 +39,27 @@ public class SurfaceUpdatedHelper implements SurfaceUpdatedListener {
//
// Management Utils
- //
+ //
public int size() { return surfaceUpdatedListeners.size(); }
public SurfaceUpdatedListener get(int i) { return surfaceUpdatedListeners.get(i); }
-
+
//
// Implementation of NativeSurface SurfaceUpdatedListener methods
- //
-
+ //
+
public void addSurfaceUpdatedListener(SurfaceUpdatedListener l) {
addSurfaceUpdatedListener(-1, l);
}
- public void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l)
+ public void addSurfaceUpdatedListener(int index, SurfaceUpdatedListener l)
throws IndexOutOfBoundsException
{
if(l == null) {
return;
}
synchronized(surfaceUpdatedListenersLock) {
- if(0>index) {
- index = surfaceUpdatedListeners.size();
+ if(0>index) {
+ index = surfaceUpdatedListeners.size();
}
surfaceUpdatedListeners.add(index, l);
}
@@ -74,6 +74,7 @@ public class SurfaceUpdatedHelper implements SurfaceUpdatedListener {
}
}
+ @Override
public void surfaceUpdated(Object updater, NativeSurface ns, long when) {
synchronized(surfaceUpdatedListenersLock) {
for(int i = 0; i < surfaceUpdatedListeners.size(); i++ ) {
diff --git a/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java b/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java
index ed23def..47b3e63 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/ToolkitProperties.java
@@ -8,14 +8,14 @@ import javax.media.nativewindow.NativeWindowFactory;
* Implementation requires to provide static methods:
* <pre>
public static void initSingleton() {}
-
+
public static void shutdown() {}
-
+
public static boolean requiresToolkitLock() {}
-
+
public static boolean hasThreadingIssues() {}
* </pre>
- * Above static methods are invoked by {@link NativeWindowFactory#initSingleton()},
+ * Above static methods are invoked by {@link NativeWindowFactory#initSingleton()},
* or {@link NativeWindowFactory#shutdown()} via reflection.
* </p>
*/
@@ -25,23 +25,23 @@ public interface ToolkitProperties {
* Called by {@link NativeWindowFactory#initSingleton()}
*/
// void initSingleton();
-
- /**
+
+ /**
* Cleanup resources.
* <p>
* Called by {@link NativeWindowFactory#shutdown()}
* </p>
*/
// void shutdown();
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
*/
// boolean requiresToolkitLock();
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
*/
- // boolean hasThreadingIssues();
-
+ // boolean hasThreadingIssues();
+
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java
index e544bc6..f622db8 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java
@@ -35,13 +35,18 @@ import javax.media.nativewindow.UpstreamSurfaceHook;
import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize;
+/**
+ * Generic Surface implementation which wraps an existing window handle.
+ *
+ * @see ProxySurface
+ */
public class WrappedSurface extends ProxySurfaceImpl {
protected long surfaceHandle;
/**
* Utilizes a {@link UpstreamSurfaceHook.MutableSize} to hold the size information,
* which is being passed to the {@link ProxySurface} instance.
- *
+ *
* @param cfg the {@link AbstractGraphicsConfiguration} to be used
* @param handle the wrapped pre-existing native surface handle, maybe 0 if not yet determined
* @param initialWidth
@@ -54,7 +59,7 @@ public class WrappedSurface extends ProxySurfaceImpl {
super(cfg, new UpstreamSurfaceHookMutableSize(initialWidth, initialHeight), ownsDevice);
surfaceHandle=handle;
}
-
+
/**
* @param cfg the {@link AbstractGraphicsConfiguration} to be used
* @param handle the wrapped pre-existing native surface handle, maybe 0 if not yet determined
@@ -69,7 +74,7 @@ public class WrappedSurface extends ProxySurfaceImpl {
}
@Override
- protected void invalidateImpl() {
+ protected void invalidateImpl() {
surfaceHandle = 0;
}
@@ -82,7 +87,7 @@ public class WrappedSurface extends ProxySurfaceImpl {
public final void setSurfaceHandle(long surfaceHandle) {
this.surfaceHandle=surfaceHandle;
}
-
+
@Override
protected final int lockSurfaceImpl() {
return LOCK_SUCCESS;
diff --git a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java
index 66be82a..0fa5006 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/awt/AWTMisc.java
@@ -28,13 +28,16 @@
package jogamp.nativewindow.awt;
import java.awt.FocusTraversalPolicy;
+import java.awt.Insets;
import java.awt.Window;
import java.awt.Component;
import java.awt.Container;
import java.awt.Frame;
+
+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.swing.MenuSelectionManager;
@@ -70,16 +73,73 @@ public class AWTMisc {
}
/**
+ * Return insets of the component w/o traversing up to parent,
+ * i.e. trying Window and JComponent.
+ * <p>
+ * Exception is JRootPane.
+ * Return it's parent's Window component's insets if available,
+ * otherwise return JRootPane's insets.<br>
+ * This is due to <i>experience</i> that <i>some</i> JRootPane's
+ * do not expose valid insets value.
+ * </p>
+ * @param topLevelOnly if true only returns insets of top-level components, i.e. Window and JRootPanel,
+ * otherwise for JComponent as well.
+ */
+ public static Insets getInsets(Component c, boolean topLevelOnly) {
+ if( c instanceof Window ) {
+ return ((Window)c).getInsets();
+ }
+ if( c instanceof JRootPane ) {
+ final Window w = getWindow(c);
+ if( null != w ) {
+ return w.getInsets();
+ }
+ return ((JRootPane)c).getInsets();
+ }
+ if( !topLevelOnly && c instanceof JComponent ) {
+ return ((JComponent)c).getInsets();
+ }
+ return null;
+ }
+
+ public static interface ComponentAction {
+ /**
+ * @param c the component to perform the action on
+ */
+ public void run(Component c);
+ }
+
+ public static int performAction(Container c, Class<?> cType, ComponentAction action) {
+ int count = 0;
+ final int cc = c.getComponentCount();
+ for(int i=0; i<cc; i++) {
+ final Component e = c.getComponent(i);
+ if( e instanceof Container ) {
+ count += performAction((Container)e, cType, action);
+ } else if( cType.isInstance(e) ) {
+ action.run(e);
+ count++;
+ }
+ }
+ // we come at last ..
+ if( cType.isInstance(c) ) {
+ action.run(c);
+ count++;
+ }
+ return count;
+ }
+
+ /**
* Traverse to the next forward or backward component using the
* container's FocusTraversalPolicy.
- *
- * @param comp the assumed current focuse component
+ *
+ * @param comp the assumed current focuse component
* @param forward if true, returns the next focus component, otherwise the previous one.
* @return
*/
public static Component getNextFocus(Component comp, boolean forward) {
Container focusContainer = comp.getFocusCycleRootAncestor();
- while ( focusContainer != null &&
+ while ( focusContainer != null &&
( !focusContainer.isShowing() || !focusContainer.isFocusable() || !focusContainer.isEnabled() ) )
{
comp = focusContainer;
@@ -95,7 +155,7 @@ public class AWTMisc {
}
return next;
}
-
+
/**
* Issue this when your non AWT toolkit gains focus to clear AWT menu path
*/
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java
index f579da2..a5da414 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTJNILibLoader.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -47,15 +47,16 @@ import java.awt.Toolkit;
import java.security.AccessController;
import java.security.PrivilegedAction;
-public class JAWTJNILibLoader extends NWJNILibLoader {
+public class JAWTJNILibLoader extends NWJNILibLoader {
static {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
// Make sure that awt.dll is loaded before loading jawt.dll. Otherwise
// a Dialog with "awt.dll not found" might pop up.
// See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4481947.
Toolkit.getDefaultToolkit();
-
+
// Must pre-load JAWT on all non-Mac platforms to
// ensure references from jogl_awt shared object
// will succeed since JAWT shared object isn't in
@@ -74,9 +75,9 @@ public class JAWTJNILibLoader extends NWJNILibLoader {
}
});
}
-
+
public static void initSingleton() {
- // just exist to ensure static init has been run
+ // just exist to ensure static init has been run
}
-
+
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java
index 1f5d337..5a1d915 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,7 +29,7 @@
* 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.
@@ -63,13 +63,13 @@ public class JAWTUtil {
/** OSX JAWT version option to use CALayer */
public static final int JAWT_MACOSX_USE_CALAYER = 0x80000000;
-
+
/** OSX JAWT CALayer availability on Mac OS X >= 10.6 Update 4 (recommended) */
public static final VersionNumber JAWT_MacOSXCALayerMinVersion = new VersionNumber(10,6,4);
-
+
/** OSX JAWT CALayer required with Java >= 1.7.0 (implies OS X >= 10.7 */
- public static final VersionNumber JAWT_MacOSXCALayerRequiredForJavaVersion = new VersionNumber(1,7,0);
-
+ public static final VersionNumber JAWT_MacOSXCALayerRequiredForJavaVersion = Platform.Version17;
+
// See whether we're running in headless mode
private static final boolean headlessMode;
private static final JAWT jawtLockObject;
@@ -81,48 +81,165 @@ public class JAWTUtil {
private static final Method sunToolkitAWTLockMethod;
private static final Method sunToolkitAWTUnlockMethod;
private static final boolean hasSunToolkitAWTLock;
-
+
private static final RecursiveLock jawtLock;
private static final ToolkitLock jawtToolkitLock;
private static class PrivilegedDataBlob1 {
PrivilegedDataBlob1() {
ok = false;
- }
+ }
Method sunToolkitAWTLockMethod;
Method sunToolkitAWTUnlockMethod;
boolean ok;
}
-
+
/**
* Returns true if this platform's JAWT implementation supports offscreen layer.
*/
public static boolean isOffscreenLayerSupported() {
- return Platform.OS_TYPE == Platform.OSType.MACOS &&
- Platform.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0;
+ return Platform.OS_TYPE == Platform.OSType.MACOS &&
+ Platform.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0;
}
-
+
/**
* Returns true if this platform's JAWT implementation requires using offscreen layer.
*/
public static boolean isOffscreenLayerRequired() {
- return Platform.OS_TYPE == Platform.OSType.MACOS &&
- Platform.JAVA_VERSION_NUMBER.compareTo(JAWT_MacOSXCALayerRequiredForJavaVersion)>=0;
+ return Platform.OS_TYPE == Platform.OSType.MACOS &&
+ Platform.JAVA_VERSION_NUMBER.compareTo(JAWT_MacOSXCALayerRequiredForJavaVersion)>=0;
+ }
+
+ /**
+ * CALayer size needs to be set using the AWT component size.
+ * <p>
+ * AWT's super-calayer, i.e. the AWT's own component CALayer,
+ * does not layout our root-calayer in respect to this component's
+ * position and size, at least when resizing programmatically.
+ * </p>
+ * <p>
+ * As of today, this flag is enabled for all known AWT versions.
+ * </p>
+ * <p>
+ * Sync w/ NativeWindowProtocols.h
+ * </p>
+ */
+ public static final int JAWT_OSX_CALAYER_QUIRK_SIZE = 1 << 0;
+
+ /**
+ * CALayer position needs to be set to zero.
+ * <p>
+ * AWT's super-calayer, i.e. the AWT's own component CALayer,
+ * has a broken layout and needs it's sub-layers to be located at position 0/0.
+ * </p>
+ * <p>
+ * See <code>http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7172187</code>.
+ * </p>
+ * <p>
+ * Further more a re-layout seems to be required in this case,
+ * i.e. a programmatic forced resize +1 and it's inverted resize -1.
+ * </p>
+ * <p>
+ * This flag is enabled w/ AWT < 1.7.0_40.
+ * </p>
+ * <p>
+ * Sync w/ NativeWindowProtocols.h
+ * </p>
+ */
+ public static final int JAWT_OSX_CALAYER_QUIRK_POSITION = 1 << 1;
+
+ /**
+ * CALayer position needs to be derived from AWT position
+ * in relation to super CALayer.
+ * <p>
+ * AWT's super-calayer, i.e. the AWT top-container's CALayer,
+ * does not layout our root-calayer in respect to this component's
+ * position and size, at least when resizing programmatically.
+ * </p>
+ * <p>
+ * CALayer position has origin 0/0 at bottom/left,
+ * where AWT component has origin 0/0 at top/left.
+ * </p>
+ * <p>
+ * The super-calayer bounds exclude the frame's heavyweight border/insets.
+ * </p>
+ * <p>
+ * The super-calayer lies within the AWT top-container client space (content).
+ * </p>
+ * <p>
+ * Component's location in super-calayer:
+ * <pre>
+ p0 = c.locationOnScreen();
+ p0 -= c.getOutterComp.getPos();
+ p0 -= c.getOutterComp.getInsets();
+ * </pre>
+ * Where 'locationOnScreen()' is:
+ * <pre>
+ p0 = 0/0;
+ while( null != c ) {
+ p0 += c.getPos();
+ }
+ * </pre>
+ * </p>
+ * <p>
+ * This flags also sets {@link #JAWT_OSX_CALAYER_QUIRK_SIZE},
+ * i.e. they are related.
+ * </p>
+ * <p>
+ * As of today, this flag is enabled for w/ AWT >= 1.7.0_40.
+ * </p>
+ * <p>
+ * Sync w/ NativeWindowProtocols.h
+ * </p>
+ */
+ public static final int JAWT_OSX_CALAYER_QUIRK_LAYOUT = 1 << 2;
+
+ /**
+ * Returns bitfield of required JAWT OSX CALayer quirks to mediate AWT impl. bugs.
+ * <p>
+ * Returns zero, if platform is not {@link Platform.OSType#MACOS}
+ * or not supporting CALayer, i.e. OSX < 10.6.4.
+ * </p>
+ * <p>
+ * Otherwise includes
+ * <ul>
+ * <li>{@link #JAWT_OSX_CALAYER_QUIRK_SIZE} (always)</li>
+ * <li>{@link #JAWT_OSX_CALAYER_QUIRK_POSITION} if JVM < 1.7.0_40</li>
+ * <li>{@link #JAWT_OSX_CALAYER_QUIRK_LAYOUT} if JVM >= 1.7.0_40</li>
+ * </ul>
+ * </p>
+ */
+ public static int getOSXCALayerQuirks() {
+ int res = 0;
+ if( Platform.OS_TYPE == Platform.OSType.MACOS &&
+ Platform.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0 ) {
+
+ /** Knowing impl. all expose the SIZE bug */
+ res |= JAWT_OSX_CALAYER_QUIRK_SIZE;
+
+ final int c = Platform.JAVA_VERSION_NUMBER.compareTo(Platform.Version17);
+ if( c < 0 || c == 0 && Platform.JAVA_VERSION_UPDATE < 40 ) {
+ res |= JAWT_OSX_CALAYER_QUIRK_POSITION;
+ } else {
+ res |= JAWT_OSX_CALAYER_QUIRK_LAYOUT;
+ }
+ }
+ return res;
}
-
+
/**
* @param useOffscreenLayerIfAvailable
* @return
*/
public static JAWT getJAWT(boolean useOffscreenLayerIfAvailable) {
- final int jawt_version_flags = JAWTFactory.JAWT_VERSION_1_4;
+ final int jawt_version_flags = JAWTFactory.JAWT_VERSION_1_4;
JAWT jawt = JAWT.create();
-
+
// default queries
boolean tryOffscreenLayer;
boolean tryOnscreen;
int jawt_version_flags_offscreen = jawt_version_flags;
-
+
if(isOffscreenLayerRequired()) {
if(Platform.OS_TYPE == Platform.OSType.MACOS) {
if(Platform.OS_VERSION_NUMBER.compareTo(JAWTUtil.JAWT_MacOSXCALayerMinVersion) >= 0) {
@@ -146,11 +263,11 @@ public class JAWTUtil {
} else {
tryOffscreenLayer = false;
tryOnscreen = true;
- }
+ }
if(DEBUG) {
System.err.println("JAWTUtil.getJAWT(tryOffscreenLayer "+tryOffscreenLayer+", tryOnscreen "+tryOnscreen+")");
}
-
+
StringBuilder errsb = new StringBuilder();
if(tryOffscreenLayer) {
errsb.append("Offscreen 0x").append(Integer.toHexString(jawt_version_flags_offscreen));
@@ -165,15 +282,15 @@ public class JAWTUtil {
errsb.append("Onscreen 0x").append(Integer.toHexString(jawt_version_flags));
if( JAWT.getJAWT(jawt, jawt_version_flags) ) {
return jawt;
- }
+ }
}
throw new RuntimeException("Unable to initialize JAWT, trials: "+errsb.toString());
}
-
+
public static boolean isJAWTUsingOffscreenLayer(JAWT jawt) {
return 0 != ( jawt.getCachedVersion() & JAWTUtil.JAWT_MACOSX_USE_CALAYER );
}
-
+
static {
if(DEBUG) {
System.err.println("JAWTUtil initialization (JAWT/JNI/...");
@@ -202,10 +319,11 @@ public class JAWTUtil {
isQueueFlusherThread = m;
j2dExist = ok;
- PrivilegedDataBlob1 pdb1 = (PrivilegedDataBlob1) AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ PrivilegedDataBlob1 pdb1 = (PrivilegedDataBlob1) AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
PrivilegedDataBlob1 d = new PrivilegedDataBlob1();
- try {
+ try {
final Class<?> sunToolkitClass = Class.forName("sun.awt.SunToolkit");
d.sunToolkitAWTLockMethod = sunToolkitClass.getDeclaredMethod("awtLock", new Class[]{});
d.sunToolkitAWTLockMethod.setAccessible(true);
@@ -220,7 +338,7 @@ public class JAWTUtil {
});
sunToolkitAWTLockMethod = pdb1.sunToolkitAWTLockMethod;
sunToolkitAWTUnlockMethod = pdb1.sunToolkitAWTUnlockMethod;
-
+
boolean _hasSunToolkitAWTLock = false;
if ( pdb1.ok ) {
try {
@@ -234,10 +352,12 @@ public class JAWTUtil {
// hasSunToolkitAWTLock = false;
jawtLock = LockFactory.createRecursiveLock();
- jawtToolkitLock = new ToolkitLock() {
+ jawtToolkitLock = new ToolkitLock() {
+ @Override
public final void lock() {
JAWTUtil.lockToolkit();
- }
+ }
+ @Override
public final void unlock() {
JAWTUtil.unlockToolkit();
}
@@ -263,6 +383,7 @@ public class JAWTUtil {
} else {
final ArrayList<Map<?,?>> desktophintsBucket = new ArrayList<Map<?,?>>(1);
EventQueue.invokeAndWait(new Runnable() {
+ @Override
public void run() {
Map<?,?> _desktophints = (Map<?,?>)(Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints"));
if(null!=_desktophints) {
@@ -294,11 +415,11 @@ public class JAWTUtil {
public static void initSingleton() {
// just exist to ensure static init has been run
}
-
+
/**
* Called by {@link NativeWindowFactory#shutdown()}
*/
- public static void shutdown() {
+ public static void shutdown() {
}
public static boolean hasJava2D() {
@@ -326,7 +447,7 @@ public class JAWTUtil {
* which just uses AWT's global ReentrantLock.
* </p>
* <p>
- * AWT locking is wrapped through a recursive lock object.
+ * AWT locking is wrapped through a recursive lock object.
* </p>
*/
public static void lockToolkit() throws NativeWindowException {
@@ -354,11 +475,11 @@ public class JAWTUtil {
* which just uses AWT's global ReentrantLock.
* </p>
* <p>
- * AWT unlocking is wrapped through a recursive lock object.
+ * AWT unlocking is wrapped through a recursive lock object.
* </p>
*/
public static void unlockToolkit() {
- jawtLock.validateLocked();
+ jawtLock.validateLocked();
if(ToolkitLock.TRACE_LOCK) { System.err.println("JAWTUtil-ToolkitLock.unlock(): "+jawtLock); }
if( 1 == jawtLock.getHoldCount() ) {
if(!headlessMode && !isJava2DQueueFlusherThread()) {
@@ -375,14 +496,14 @@ public class JAWTUtil {
}
jawtLock.unlock();
}
-
+
public static final void validateLocked() throws RuntimeException {
jawtLock.validateLocked();
- }
+ }
public static ToolkitLock getJAWTToolkitLock() {
return jawtToolkitLock;
}
-
+
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWT_PlatformInfo.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWT_PlatformInfo.java
index 40d7b80..4f12d19 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWT_PlatformInfo.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWT_PlatformInfo.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java
index 080504a..8d46d80 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,17 +29,18 @@
* 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.nativewindow.jawt.macosx;
+import java.awt.Component;
import java.nio.Buffer;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -53,6 +54,8 @@ import javax.media.nativewindow.util.Point;
import com.jogamp.nativewindow.awt.JAWTWindow;
+import jogamp.nativewindow.Debug;
+import jogamp.nativewindow.awt.AWTMisc;
import jogamp.nativewindow.jawt.JAWT;
import jogamp.nativewindow.jawt.JAWTFactory;
import jogamp.nativewindow.jawt.JAWTUtil;
@@ -62,6 +65,14 @@ import jogamp.nativewindow.jawt.macosx.JAWT_MacOSXDrawingSurfaceInfo;
import jogamp.nativewindow.macosx.OSXUtil;
public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
+ /** May lead to deadlock, due to AWT pos comparison .. don't enable for Applets! */
+ private static final boolean DEBUG_CALAYER_POS_CRITICAL;
+
+ static {
+ Debug.initSingleton();
+ DEBUG_CALAYER_POS_CRITICAL = Debug.isPropertyDefined("nativewindow.debug.JAWT.OSXCALayerPos", true /* jnlpAlias */);
+ }
+
public MacOSXJAWTWindow(Object comp, AbstractGraphicsConfiguration config) {
super(comp, config);
if(DEBUG) {
@@ -86,6 +97,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
OSXUtil.DestroyNSWindow(windowHandle);
}
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
if( 0 != rootSurfaceLayer ) {
if( 0 != jawtSurfaceLayersHandle) {
@@ -100,42 +112,95 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
}
windowHandle=0;
}
-
+
@Override
protected void attachSurfaceLayerImpl(final long layerHandle) {
OSXUtil.RunOnMainThread(false, new Runnable() {
- public void run() {
- OSXUtil.AddCASublayer(rootSurfaceLayer, layerHandle, getWidth(), getHeight());
+ @Override
+ public void run() {
+ // AWT position is top-left w/ insets, where CALayer position is bottom/left from root CALayer w/o insets.
+ // Determine p0: components location on screen w/o insets.
+ // CALayer position will be determined in native code.
+ // See detailed description in {@link JAWTUtil#JAWT_OSX_CALAYER_QUIRK_LAYOUT}
+ final Point p0 = new Point();
+ final Component outterComp = getLocationOnScreenNonBlocking(p0, component);
+ final java.awt.Insets outterInsets = AWTMisc.getInsets(outterComp, true);
+ final Point p1 = (Point)p0.cloneMutable();
+ p1.translate(-outterComp.getX(), -outterComp.getY());
+ if( null != outterInsets ) {
+ p1.translate(-outterInsets.left, -outterInsets.top);
+ }
+
+ if( DEBUG_CALAYER_POS_CRITICAL ) {
+ final java.awt.Point pA0 = component.getLocationOnScreen();
+ final Point pA1 = new Point(pA0.x, pA0.y);
+ pA1.translate(-outterComp.getX(), -outterComp.getY());
+ if( null != outterInsets ) {
+ pA1.translate(-outterInsets.left, -outterInsets.top);
+ }
+ System.err.println("JAWTWindow.attachSurfaceLayerImpl: "+toHexString(layerHandle) + ", [ins "+outterInsets+"], pA "+pA0+" -> "+pA1+
+ ", p0 "+p0+" -> "+p1+", bounds "+bounds);
+ } else if( DEBUG ) {
+ System.err.println("JAWTWindow.attachSurfaceLayerImpl: "+toHexString(layerHandle) + ", [ins "+outterInsets+"], p0 "+p0+" -> "+p1+", bounds "+bounds);
+ }
+ OSXUtil.AddCASublayer(rootSurfaceLayer, layerHandle, p1.getX(), p1.getY(), getWidth(), getHeight(), JAWTUtil.getOSXCALayerQuirks());
} } );
}
-
+
@Override
- protected void layoutSurfaceLayerImpl(long layerHandle, int width, int height) {
- if(DEBUG) {
- System.err.println("JAWTWindow.layoutSurfaceLayerImpl: "+toHexString(layerHandle) + ", "+width+"x"+height+"; "+this);
+ protected void layoutSurfaceLayerImpl(long layerHandle, boolean visible) {
+ final int caLayerQuirks = JAWTUtil.getOSXCALayerQuirks();
+ // AWT position is top-left w/ insets, where CALayer position is bottom/left from root CALayer w/o insets.
+ // Determine p0: components location on screen w/o insets.
+ // CALayer position will be determined in native code.
+ // See detailed description in {@link JAWTUtil#JAWT_OSX_CALAYER_QUIRK_LAYOUT}
+ final Point p0 = new Point();
+ final Component outterComp = getLocationOnScreenNonBlocking(p0, component);
+ final java.awt.Insets outterInsets = AWTMisc.getInsets(outterComp, true);
+ final Point p1 = (Point)p0.cloneMutable();
+ p1.translate(-outterComp.getX(), -outterComp.getY());
+ if( null != outterInsets ) {
+ p1.translate(-outterInsets.left, -outterInsets.top);
}
- OSXUtil.FixCALayerLayout(rootSurfaceLayer, layerHandle, width, height);
+
+ if( DEBUG_CALAYER_POS_CRITICAL ) {
+ final java.awt.Point pA0 = component.getLocationOnScreen();
+ final Point pA1 = new Point(pA0.x, pA0.y);
+ pA1.translate(-outterComp.getX(), -outterComp.getY());
+ if( null != outterInsets ) {
+ pA1.translate(-outterInsets.left, -outterInsets.top);
+ }
+ System.err.println("JAWTWindow.layoutSurfaceLayerImpl: "+toHexString(layerHandle) + ", quirks "+caLayerQuirks+", visible "+visible+
+ ", [ins "+outterInsets+"], pA "+pA0+" -> "+pA1+
+ ", p0 "+p0+" -> "+p1+", bounds "+bounds);
+ } else if( DEBUG ) {
+ System.err.println("JAWTWindow.layoutSurfaceLayerImpl: "+toHexString(layerHandle) + ", quirks "+caLayerQuirks+", visible "+visible+
+ ", [ins "+outterInsets+"], p0 "+p0+" -> "+p1+", bounds "+bounds);
+ }
+ OSXUtil.FixCALayerLayout(rootSurfaceLayer, layerHandle, visible, p1.getX(), p1.getY(), getWidth(), getHeight(), caLayerQuirks);
}
-
+
@Override
protected void detachSurfaceLayerImpl(final long layerHandle, final Runnable detachNotify) {
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
detachNotify.run();
OSXUtil.RemoveCASublayer(rootSurfaceLayer, layerHandle);
} } );
}
-
+
@Override
public final long getWindowHandle() {
return windowHandle;
}
-
+
@Override
public final long getSurfaceHandle() {
return offscreenSurfaceDrawableSet ? offscreenSurfaceDrawable : drawable /* super.getSurfaceHandle() */ ;
}
-
+
+ @Override
public void setSurfaceHandle(long surfaceHandle) {
if( !isOffscreenLayerSurfaceEnabled() ) {
throw new java.lang.UnsupportedOperationException("Not using CALAYER");
@@ -147,11 +212,13 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
this.offscreenSurfaceDrawableSet = true;
}
+ @Override
protected JAWT fetchJAWTImpl() throws NativeWindowException {
// use offscreen if supported and [ applet or requested ]
return JAWTUtil.getJAWT(getShallUseOffscreenLayer() || isApplet());
}
-
+
+ @Override
protected int lockSurfaceImpl() throws NativeWindowException {
int ret = NativeWindow.LOCK_SURFACE_NOT_READY;
ds = getJAWT().GetDrawingSurface(component);
@@ -176,6 +243,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
}
if (firstLock) {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
dsi = ds.GetDrawingSurfaceInfo();
return null;
@@ -200,7 +268,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
return NativeWindow.LOCK_SURFACE_NOT_READY;
}
drawable = macosxdsi.getCocoaViewRef();
-
+
if (drawable == 0) {
unlockSurfaceImpl();
return NativeWindow.LOCK_SURFACE_NOT_READY;
@@ -212,9 +280,9 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
/**
* Only create a fake invisible NSWindow for the drawable handle
* to please frameworks requiring such (eg. NEWT).
- *
- * The actual surface/ca-layer shall be created/attached
- * by the upper framework (JOGL) since they require more information.
+ *
+ * The actual surface/ca-layer shall be created/attached
+ * by the upper framework (JOGL) since they require more information.
*/
String errMsg = null;
if(0 == drawable) {
@@ -237,12 +305,13 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
if(null == errMsg) {
jawtSurfaceLayersHandle = GetJAWTSurfaceLayersHandle0(dsi.getBuffer());
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
String errMsg = null;
- if(0 == rootSurfaceLayer && 0 != jawtSurfaceLayersHandle) {
- rootSurfaceLayer = OSXUtil.CreateCALayer(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight());
+ if(0 == rootSurfaceLayer && 0 != jawtSurfaceLayersHandle) {
+ rootSurfaceLayer = OSXUtil.CreateCALayer(bounds.getWidth(), bounds.getHeight());
if(0 == rootSurfaceLayer) {
- errMsg = "Could not create root CALayer";
+ errMsg = "Could not create root CALayer";
} else {
try {
SetJAWTRootSurfaceLayer0(jawtSurfaceLayersHandle, rootSurfaceLayer);
@@ -271,10 +340,11 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
}
ret = NativeWindow.LOCK_SUCCESS;
}
-
+
return ret;
}
-
+
+ @Override
protected void unlockSurfaceImpl() throws NativeWindowException {
if(null!=ds) {
if (null!=dsi) {
@@ -293,7 +363,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
System.err.println("MaxOSXJAWTWindow: 0x"+Integer.toHexString(this.hashCode())+" - thread: "+Thread.currentThread().getName());
dumpJAWTInfo();
}
-
+
/**
* {@inheritDoc}
* <p>
@@ -303,43 +373,48 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface {
* ..
* ds = getJAWT().GetDrawingSurface(component);
* due to a SIGSEGV.
- *
+ *
* Hence we have some threading / sync issues with the native JAWT implementation.
- * </p>
+ * </p>
*/
@Override
- public Point getLocationOnScreen(Point storage) {
- return getLocationOnScreenNonBlocking(storage, component);
- }
+ public Point getLocationOnScreen(Point storage) {
+ if( null == storage ) {
+ storage = new Point();
+ }
+ getLocationOnScreenNonBlocking(storage, component);
+ return storage;
+ }
+ @Override
protected Point getLocationOnScreenNativeImpl(final int x0, final int y0) { return null; }
-
-
+
+
private static native long GetJAWTSurfaceLayersHandle0(Buffer jawtDrawingSurfaceInfoBuffer);
-
- /**
+
+ /**
* Set the given root CALayer in the JAWT surface
- */
+ */
private static native void SetJAWTRootSurfaceLayer0(long jawtSurfaceLayersHandle, long caLayer);
-
- /**
+
+ /**
* Unset the given root CALayer in the JAWT surface, passing the NIO DrawingSurfaceInfo buffer
- */
+ */
private static native void UnsetJAWTRootSurfaceLayer0(long jawtSurfaceLayersHandle, long caLayer);
-
+
// Variables for lockSurface/unlockSurface
private JAWT_DrawingSurface ds;
private boolean dsLocked;
private JAWT_DrawingSurfaceInfo dsi;
private long jawtSurfaceLayersHandle;
-
+
private JAWT_MacOSXDrawingSurfaceInfo macosxdsi;
-
+
private volatile long rootSurfaceLayer = 0; // attached to the JAWT_SurfaceLayer
-
+
private long windowHandle = 0;
private long offscreenSurfaceDrawable = 0;
private boolean offscreenSurfaceDrawableSet = false;
-
+
// Workaround for instance of 4796548
private boolean firstLock = true;
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java
index 74dabb6..8b9dfab 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/Win32SunJDKReflection.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -65,6 +65,7 @@ public class Win32SunJDKReflection {
static {
AccessController.doPrivileged(new PrivilegedAction() {
+ @Override
public Object run() {
try {
win32GraphicsDeviceClass = Class.forName("sun.awt.Win32GraphicsDevice");
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java
index 905a313..54bdb34 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -60,14 +60,17 @@ public class WindowsJAWTWindow extends JAWTWindow {
super(comp, config);
}
+ @Override
protected void invalidateNative() {
windowHandle = 0;
}
+ @Override
protected JAWT fetchJAWTImpl() throws NativeWindowException {
return JAWTUtil.getJAWT(false); // no offscreen
}
-
+
+ @Override
protected int lockSurfaceImpl() throws NativeWindowException {
int ret = NativeWindow.LOCK_SUCCESS;
ds = getJAWT().GetDrawingSurface(component);
@@ -110,6 +113,7 @@ public class WindowsJAWTWindow extends JAWTWindow {
return ret;
}
+ @Override
protected void unlockSurfaceImpl() throws NativeWindowException {
drawable = 0; // invalid HDC
if(null!=ds) {
@@ -131,6 +135,7 @@ public class WindowsJAWTWindow extends JAWTWindow {
return windowHandle;
}
+ @Override
protected Point getLocationOnScreenNativeImpl(int x, int y) {
return GDIUtil.GetRelativeLocation( getWindowHandle(), 0 /*root win*/, x, y);
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java
index 2e5dc7f..4599b90 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,7 +29,7 @@
* 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.
@@ -57,12 +57,15 @@ public class X11JAWTWindow extends JAWTWindow {
super(comp, config);
}
+ @Override
protected void invalidateNative() { }
+ @Override
protected JAWT fetchJAWTImpl() throws NativeWindowException {
return JAWTUtil.getJAWT(false); // no offscreen
}
-
+
+ @Override
protected int lockSurfaceImpl() throws NativeWindowException {
int ret = NativeWindow.LOCK_SUCCESS;
ds = getJAWT().GetDrawingSurface(component);
@@ -104,6 +107,7 @@ public class X11JAWTWindow extends JAWTWindow {
return ret;
}
+ @Override
protected void unlockSurfaceImpl() throws NativeWindowException {
if(null!=ds) {
if (null!=dsi) {
@@ -119,15 +123,16 @@ public class X11JAWTWindow extends JAWTWindow {
x11dsi = null;
}
+ @Override
protected Point getLocationOnScreenNativeImpl(int x, int y) {
// surface is locked and hence the device
return X11Lib.GetRelativeLocation(getDisplayHandle(), getScreenIndex(), getWindowHandle(), 0 /*root win*/, x, y);
}
-
+
// Variables for lockSurface/unlockSurface
private JAWT_DrawingSurface ds;
private boolean dsLocked;
private JAWT_DrawingSurfaceInfo dsi;
private JAWT_X11DrawingSurfaceInfo x11dsi;
-
+
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java
index 27e0a5e..b2c3a93 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11SunJDKReflection.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -65,6 +65,7 @@ public class X11SunJDKReflection {
static {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
try {
x11GraphicsDeviceClass = Class.forName("sun.awt.X11GraphicsDevice");
diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java
index de3206c..b71af10 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java
@@ -9,12 +9,12 @@ import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize;
public class OSXDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize {
long nsWindow;
-
+
/**
- * @param width the initial width as returned by {@link NativeSurface#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)},
- * not the actual dummy surface width.
+ * @param width the initial width as returned by {@link NativeSurface#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)},
+ * not the actual dummy surface width.
* The latter is platform specific and small
- * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)},
+ * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)},
* not the actual dummy surface height,
* The latter is platform specific and small
*/
@@ -22,7 +22,7 @@ public class OSXDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize
super(width, height);
nsWindow = 0;
}
-
+
@Override
public final void create(ProxySurface s) {
if(0 == nsWindow && 0 == s.getSurfaceHandle()) {
@@ -35,11 +35,11 @@ public class OSXDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize
throw new NativeWindowException("Error NS view 0");
}
s.setSurfaceHandle(nsView);
- s.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
+ s.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
}
s.addUpstreamOptionBits(ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE);
}
-
+
@Override
public final void destroy(ProxySurface s) {
if( s.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) {
diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
index 1a90c09..bac07b8 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
@@ -41,9 +41,9 @@ import jogamp.nativewindow.NWJNILibLoader;
import jogamp.nativewindow.ToolkitProperties;
public class OSXUtil implements ToolkitProperties {
- private static boolean isInit = false;
+ private static boolean isInit = false;
private static final boolean DEBUG = Debug.debug("OSXUtil");
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
* @see ToolkitProperties
@@ -56,10 +56,10 @@ public class OSXUtil implements ToolkitProperties {
if(!NWJNILibLoader.loadNativeWindow("macosx")) {
throw new NativeWindowException("NativeWindow MacOSX native library load error.");
}
-
+
if( !initIDs0() ) {
throw new NativeWindowException("MacOSX: Could not initialized native stub");
- }
+ }
isInit = true;
}
}
@@ -69,27 +69,27 @@ public class OSXUtil implements ToolkitProperties {
* @see ToolkitProperties
*/
public static void shutdown() { }
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
* @see ToolkitProperties
*/
public static boolean requiresToolkitLock() { return false; }
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
* @see ToolkitProperties
*/
public static final boolean hasThreadingIssues() { return false; }
-
+
public static boolean isNSView(long object) {
return 0 != object ? isNSView0(object) : false;
}
-
+
public static boolean isNSWindow(long object) {
return 0 != object ? isNSWindow0(object) : false;
}
-
+
/**
* In case the <code>windowOrView</code> is top-level,
* you shall set <code>topLevel</code> to true where
@@ -108,21 +108,20 @@ public class OSXUtil implements ToolkitProperties {
* @param src_y
* @return the client position
*/
- public static Point GetLocationOnScreen(long windowOrView, boolean topLevel, int src_x, int src_y) {
+ public static Point GetLocationOnScreen(long windowOrView, boolean topLevel, int src_x, int src_y) {
final Point los = (Point) GetLocationOnScreen0(windowOrView, src_x, src_y);
if(topLevel) {
// top-level position -> client window position
final Insets insets = GetInsets(windowOrView);
- los.setX(los.getX() + insets.getLeftWidth());
- los.setY(los.getY() + insets.getTopHeight());
+ los.set(los.getX() + insets.getLeftWidth(), los.getY() + insets.getTopHeight());
}
return los;
}
-
+
public static Insets GetInsets(long windowOrView) {
return (Insets) GetInsets0(windowOrView);
}
-
+
public static long CreateNSWindow(int x, int y, int width, int height) {
return CreateNSWindow0(x, y, width, height);
}
@@ -135,21 +134,21 @@ public class OSXUtil implements ToolkitProperties {
public static long GetNSWindow(long nsView) {
return GetNSWindow0(nsView);
}
-
- /**
+
+ /**
* Create a CALayer suitable to act as a root CALayer.
* @see #DestroyCALayer(long)
- * @see #AddCASublayer(long, long)
+ * @see #AddCASublayer(long, long)
*/
- public static long CreateCALayer(final int x, final int y, final int width, final int height) {
- final long l = CreateCALayer0(x, y, width, height);
+ public static long CreateCALayer(final int width, final int height) {
+ final long l = CreateCALayer0(width, height);
if(DEBUG) {
System.err.println("OSXUtil.CreateCALayer: 0x"+Long.toHexString(l)+" - "+Thread.currentThread().getName());
}
return l;
}
-
- /**
+
+ /**
* Attach a sub CALayer to the root CALayer
* <p>
* Method will trigger a <code>display</code>
@@ -157,45 +156,48 @@ public class OSXUtil implements ToolkitProperties {
* </p>
* <p>
* Hence it is important that related resources are not locked <i>if</i>
- * they will be used for creation.
+ * they will be used for creation.
* </p>
- * @see #CreateCALayer(int, int, int, int)
+ * @param caLayerQuirks TODO
+ * @see #CreateCALayer(int, int)
* @see #RemoveCASublayer(long, long, boolean)
*/
- public static void AddCASublayer(final long rootCALayer, final long subCALayer, final int width, final int height) {
+ public static void AddCASublayer(final long rootCALayer, final long subCALayer, final int x, final int y, final int width, final int height, final int caLayerQuirks) {
if(0==rootCALayer || 0==subCALayer) {
throw new IllegalArgumentException("rootCALayer 0x"+Long.toHexString(rootCALayer)+", subCALayer 0x"+Long.toHexString(subCALayer));
}
if(DEBUG) {
- System.err.println("OSXUtil.AttachCALayer: 0x"+Long.toHexString(subCALayer)+" - "+Thread.currentThread().getName());
+ System.err.println("OSXUtil.AttachCALayer: caLayerQuirks "+caLayerQuirks+", 0x"+Long.toHexString(subCALayer)+" - "+Thread.currentThread().getName());
}
- AddCASublayer0(rootCALayer, subCALayer, width, height);
+ AddCASublayer0(rootCALayer, subCALayer, x, y, width, height, caLayerQuirks);
}
-
- /**
+
+ /**
* Fix root and sub CALayer position to 0/0 and size
* <p>
* If the sub CALayer implements the Objective-C NativeWindow protocol NWDedicatedSize (e.g. JOGL's MyNSOpenGLLayer),
- * the dedicated size is passed to the layer, which propagates it appropriately.
+ * the dedicated size is passed to the layer, which propagates it appropriately.
* </p>
* <p>
* On OSX/Java7 our root CALayer's frame position and size gets corrupted by its NSView,
* hence we have created the NWDedicatedSize protocol.
* </p>
- *
+ *
* @param rootCALayer the root surface layer, maybe null.
* @param subCALayer the client surface layer, maybe null.
+ * @param visible TODO
* @param width the expected width
* @param height the expected height
+ * @param caLayerQuirks TODO
*/
- public static void FixCALayerLayout(final long rootCALayer, final long subCALayer, final int width, final int height) {
+ public static void FixCALayerLayout(final long rootCALayer, final long subCALayer, final boolean visible, final int x, final int y, final int width, final int height, final int caLayerQuirks) {
if( 0==rootCALayer && 0==subCALayer ) {
return;
}
- FixCALayerLayout0(rootCALayer, subCALayer, width, height);
+ FixCALayerLayout0(rootCALayer, subCALayer, visible, x, y, width, height, caLayerQuirks);
}
-
- /**
+
+ /**
* Detach a sub CALayer from the root CALayer.
*/
public static void RemoveCASublayer(final long rootCALayer, final long subCALayer) {
@@ -207,11 +209,11 @@ public class OSXUtil implements ToolkitProperties {
}
RemoveCASublayer0(rootCALayer, subCALayer);
}
-
- /**
+
+ /**
* Destroy a CALayer.
- * @see #CreateCALayer(int, int, int, int)
- */
+ * @see #CreateCALayer(int, int)
+ */
public static void DestroyCALayer(final long caLayer) {
if(0==caLayer) {
throw new IllegalArgumentException("caLayer 0x"+Long.toHexString(caLayer));
@@ -221,13 +223,13 @@ public class OSXUtil implements ToolkitProperties {
}
DestroyCALayer0(caLayer);
}
-
+
/**
* Run on OSX UI main thread.
- * <p>
+ * <p>
* 'waitUntilDone' is implemented on Java site via lock/wait on {@link RunnableTask} to not freeze OSX main thread.
* </p>
- *
+ *
* @param waitUntilDone
* @param runnable
*/
@@ -236,10 +238,10 @@ public class OSXUtil implements ToolkitProperties {
runnable.run(); // don't leave the JVM
} else {
// Utilize Java side lock/wait and simply pass the Runnable async to OSX main thread,
- // otherwise we may freeze the OSX main thread.
+ // otherwise we may freeze the OSX main thread.
Throwable throwable = null;
final Object sync = new Object();
- final RunnableTask rt = new RunnableTask( runnable, waitUntilDone ? sync : null, true, waitUntilDone ? null : System.err );
+ final RunnableTask rt = new RunnableTask( runnable, waitUntilDone ? sync : null, true, waitUntilDone ? null : System.err );
synchronized(sync) {
RunOnMainThread0(rt);
if( waitUntilDone ) {
@@ -258,30 +260,30 @@ public class OSXUtil implements ToolkitProperties {
}
}
}
-
+
/**
- * Run later on current OSX thread.
- *
+ * Run later on ..
+ * @param onMain if true, run on main-thread, otherwise on the current OSX thread.
* @param runnable
* @param delay delay to run the runnable in milliseconds
*/
- public static void RunLater(Runnable runnable, int delay) {
- RunLater0(new RunnableTask( runnable, null, true, System.err ), delay);
+ public static void RunLater(boolean onMain, Runnable runnable, int delay) {
+ RunLater0(onMain, new RunnableTask( runnable, null, true, System.err ), delay);
}
-
- private static Runnable _nop = new Runnable() { public void run() {}; };
-
- /** Issues a {@link #RunOnMainThread(boolean, Runnable)} w/ an <i>NOP</i> runnable, while waiting until done. */
+
+ private static Runnable _nop = new Runnable() { @Override public void run() {}; };
+
+ /** Issues a {@link #RunOnMainThread(boolean, Runnable)} w/ an <i>NOP</i> runnable, while waiting until done. */
public static void WaitUntilFinish() {
RunOnMainThread(true, _nop);
}
-
+
/**
* Run on OSX UI main thread.
- * <p>
+ * <p>
* 'waitUntilDone' is implemented on Java site via lock/wait on {@link FunctionTask} to not freeze OSX main thread.
* </p>
- *
+ *
* @param waitUntilDone
* @param func
*/
@@ -290,10 +292,10 @@ public class OSXUtil implements ToolkitProperties {
return func.eval(args); // don't leave the JVM
} else {
// Utilize Java side lock/wait and simply pass the Runnable async to OSX main thread,
- // otherwise we may freeze the OSX main thread.
+ // otherwise we may freeze the OSX main thread.
Throwable throwable = null;
final Object sync = new Object();
- final FunctionTask<R,A> rt = new FunctionTask<R,A>( func, waitUntilDone ? sync : null, true, waitUntilDone ? null : System.err );
+ final FunctionTask<R,A> rt = new FunctionTask<R,A>( func, waitUntilDone ? sync : null, true, waitUntilDone ? null : System.err );
synchronized(sync) {
rt.setArgs(args);
RunOnMainThread0(rt);
@@ -314,20 +316,20 @@ public class OSXUtil implements ToolkitProperties {
return rt.getResult();
}
}
-
+
public static boolean IsMainThread() {
return IsMainThread0();
}
-
+
/** Returns the screen refresh rate in Hz. If unavailable, returns 60Hz. */
public static int GetScreenRefreshRate(int scrn_idx) {
return GetScreenRefreshRate0(scrn_idx);
}
-
+
/***
private static boolean isAWTEDTMainThreadInit = false;
private static boolean isAWTEDTMainThread;
-
+
public synchronized static boolean isAWTEDTMainThread() {
if(!isAWTEDTMainThreadInit) {
isAWTEDTMainThreadInit = true;
@@ -341,10 +343,10 @@ public class OSXUtil implements ToolkitProperties {
} else {
isAWTEDTMainThread = false;
}
- }
+ }
return isAWTEDTMainThread;
} */
-
+
private static native boolean initIDs0();
private static native boolean isNSView0(long object);
private static native boolean isNSWindow0(long object);
@@ -354,13 +356,13 @@ public class OSXUtil implements ToolkitProperties {
private static native void DestroyNSWindow0(long nsWindow);
private static native long GetNSView0(long nsWindow);
private static native long GetNSWindow0(long nsView);
- private static native long CreateCALayer0(int x, int y, int width, int height);
- private static native void AddCASublayer0(long rootCALayer, long subCALayer, int width, int height);
- private static native void FixCALayerLayout0(long rootCALayer, long subCALayer, int width, int height);
+ private static native long CreateCALayer0(int width, int height);
+ private static native void AddCASublayer0(long rootCALayer, long subCALayer, int x, int y, int width, int height, int caLayerQuirks);
+ private static native void FixCALayerLayout0(long rootCALayer, long subCALayer, boolean visible, int x, int y, int width, int height, int caLayerQuirks);
private static native void RemoveCASublayer0(long rootCALayer, long subCALayer);
private static native void DestroyCALayer0(long caLayer);
private static native void RunOnMainThread0(Runnable runnable);
- private static native void RunLater0(Runnable runnable, int delay);
+ private static native void RunLater0(boolean onMain, Runnable runnable, int delay);
private static native boolean IsMainThread0();
private static native int GetScreenRefreshRate0(int scrn_idx);
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java
index aa5f3da..e5de43c 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java
@@ -9,31 +9,31 @@ import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize;
public class GDIDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize {
/**
- * @param width the initial width as returned by {@link NativeSurface#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)},
- * not the actual dummy surface width.
+ * @param width the initial width as returned by {@link NativeSurface#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)},
+ * not the actual dummy surface width.
* The latter is platform specific and small
- * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)},
+ * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)},
* not the actual dummy surface height,
* The latter is platform specific and small
*/
public GDIDummyUpstreamSurfaceHook(int width, int height) {
super(width, height);
}
-
+
@Override
public final void create(ProxySurface s) {
final GDISurface ms = (GDISurface)s;
- if(0 == ms.getWindowHandle()) {
+ if(0 == ms.getWindowHandle()) {
final long windowHandle = GDIUtil.CreateDummyWindow(0, 0, 64, 64);
if(0 == windowHandle) {
throw new NativeWindowException("Error windowHandle 0, werr: "+GDI.GetLastError());
- }
+ }
ms.setWindowHandle(windowHandle);
- ms.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
+ ms.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
}
s.addUpstreamOptionBits(ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE);
}
-
+
@Override
public final void destroy(ProxySurface s) {
final GDISurface ms = (GDISurface)s;
@@ -46,5 +46,5 @@ public class GDIDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize
ms.setWindowHandle(0);
ms.clearUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
}
- }
+ }
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java
index 3db2b5f..3e07b2a 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java
@@ -43,6 +43,8 @@ import jogamp.nativewindow.windows.GDI;
* allowing the use of HDC via lockSurface()/unlockSurface() protocol.
* The latter will get and release the HDC.
* The size via getWidth()/getHeight() is invalid.
+ *
+ * @see ProxySurface
*/
public class GDISurface extends ProxySurfaceImpl {
protected long windowHandle;
@@ -63,20 +65,20 @@ public class GDISurface extends ProxySurfaceImpl {
}
@Override
- protected void invalidateImpl() {
+ protected void invalidateImpl() {
if(0 != surfaceHandle) {
throw new NativeWindowException("didn't release surface Handle: "+this);
}
windowHandle = 0;
// surfaceHandle = 0;
}
-
+
/**
* {@inheritDoc}
* <p>
- * Actually the window handle (HWND), since the surfaceHandle (HDC) is derived
+ * Actually the window handle (HWND), since the surfaceHandle (HDC) is derived
* from it at {@link #lockSurface()}.
- * </p>
+ * </p>
*/
@Override
public final void setSurfaceHandle(long surfaceHandle) {
@@ -84,7 +86,7 @@ public class GDISurface extends ProxySurfaceImpl {
}
/**
- * Sets the window handle (HWND).
+ * Sets the window handle (HWND).
*/
public final void setWindowHandle(long windowHandle) {
this.windowHandle = windowHandle;
@@ -116,7 +118,7 @@ public class GDISurface extends ProxySurfaceImpl {
final protected void unlockSurfaceImpl() {
if (0 != surfaceHandle) {
if(0 == GDI.ReleaseDC(windowHandle, surfaceHandle)) {
- throw new NativeWindowException("DC not released: "+this+", isWindow "+GDI.IsWindow(windowHandle)+", werr "+GDI.GetLastError()+", thread: "+Thread.currentThread().getName());
+ throw new NativeWindowException("DC not released: "+this+", isWindow "+GDI.IsWindow(windowHandle)+", werr "+GDI.GetLastError()+", thread: "+Thread.currentThread().getName());
}
surfaceHandle=0;
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java
index 00741a3..db61b1e 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java
@@ -37,11 +37,11 @@ import jogamp.nativewindow.ToolkitProperties;
public class GDIUtil implements ToolkitProperties {
private static final boolean DEBUG = Debug.debug("GDIUtil");
-
+
private static final String dummyWindowClassNameBase = "_dummyWindow_clazz" ;
private static RegisteredClassFactory dummyWindowClassFactory;
private static boolean isInit = false;
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
* @see ToolkitProperties
@@ -59,42 +59,42 @@ public class GDIUtil implements ToolkitProperties {
if( !initIDs0() ) {
throw new NativeWindowException("GDI: Could not initialized native stub");
}
- dummyWindowClassFactory = new RegisteredClassFactory(dummyWindowClassNameBase, getDummyWndProc0());
+ dummyWindowClassFactory = new RegisteredClassFactory(dummyWindowClassNameBase, getDummyWndProc0());
isInit = true;
}
}
}
}
-
+
/**
* Called by {@link NativeWindowFactory#shutdown()}
* @see ToolkitProperties
*/
- public static void shutdown() {
+ public static void shutdown() {
}
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
* @see ToolkitProperties
*/
public static boolean requiresToolkitLock() { return false; }
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
* @see ToolkitProperties
*/
public static final boolean hasThreadingIssues() { return false; }
-
+
private static RegisteredClass dummyWindowClass = null;
private static Object dummyWindowSync = new Object();
-
+
public static long CreateDummyWindow(int x, int y, int width, int height) {
synchronized(dummyWindowSync) {
dummyWindowClass = dummyWindowClassFactory.getSharedClass();
return CreateDummyWindow0(dummyWindowClass.getHInstance(), dummyWindowClass.getName(), dummyWindowClass.getName(), x, y, width, height);
}
}
-
+
public static boolean DestroyDummyWindow(long hwnd) {
boolean res;
synchronized(dummyWindowSync) {
@@ -106,27 +106,27 @@ public class GDIUtil implements ToolkitProperties {
}
return res;
}
-
+
public static Point GetRelativeLocation(long src_win, long dest_win, int src_x, int src_y) {
return (Point) GetRelativeLocation0(src_win, dest_win, src_x, src_y);
}
-
+
public static boolean IsUndecorated(long win) {
return IsUndecorated0(win);
}
-
+
public static boolean IsChild(long win) {
return IsChild0(win);
}
-
+
public static native boolean CreateWindowClass(long hInstance, String clazzName, long wndProc);
public static native boolean DestroyWindowClass(long hInstance, String className);
-
+
private static native boolean initIDs0();
- private static native long getDummyWndProc0();
+ private static native long getDummyWndProc0();
private static native Object GetRelativeLocation0(long src_win, long dest_win, int src_x, int src_y);
private static native boolean IsChild0(long win);
private static native boolean IsUndecorated0(long win);
-
- static native long CreateDummyWindow0(long hInstance, String className, String windowName, int x, int y, int width, int height);
+
+ static native long CreateDummyWindow0(long hInstance, String className, String windowName, int x, int y, int width, int height);
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java
index 949f5d0..976693e 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java
@@ -39,7 +39,7 @@ public class RegisteredClass {
/** Application handle, same as {@link RegisteredClassFactory#getHInstance()}. */
public final long getHInstance() { return hInstance; }
-
+
/** Unique Window Class Name */
public final String getName() { return className; }
diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java
index 0280b0d..e033a9f 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java
@@ -34,9 +34,9 @@ import javax.media.nativewindow.NativeWindowException;
public class RegisteredClassFactory {
private static final boolean DEBUG = Debug.debug("RegisteredClass");
- private static final ArrayList<RegisteredClassFactory> registeredFactories;
+ private static final ArrayList<RegisteredClassFactory> registeredFactories;
private static final long hInstance;
-
+
static {
hInstance = GDI.GetApplicationHandle();
if( 0 == hInstance ) {
@@ -44,7 +44,7 @@ public class RegisteredClassFactory {
}
registeredFactories = new ArrayList<RegisteredClassFactory>();
}
-
+
private String classBaseName;
private long wndProc;
@@ -52,9 +52,9 @@ public class RegisteredClassFactory {
private int classIter = 0;
private int sharedRefCount = 0;
private final Object sync = new Object();
-
+
/**
- * Release the {@link RegisteredClass} of all {@link RegisteredClassFactory}.
+ * Release the {@link RegisteredClass} of all {@link RegisteredClassFactory}.
*/
public static void shutdownSharedClasses() {
synchronized(registeredFactories) {
@@ -65,7 +65,7 @@ public class RegisteredClassFactory {
GDIUtil.DestroyWindowClass(rcf.sharedClass.getHInstance(), rcf.sharedClass.getName());
rcf.sharedClass = null;
rcf.sharedRefCount = 0;
- rcf.classIter = 0;
+ rcf.classIter = 0;
if(DEBUG) {
System.err.println("RegisteredClassFactory #"+j+"/"+registeredFactories.size()+" shutdownSharedClasses : "+rcf.sharedClass);
}
@@ -74,7 +74,7 @@ public class RegisteredClassFactory {
}
}
}
-
+
/** Application handle. */
public static long getHInstance() { return hInstance; }
@@ -94,7 +94,7 @@ public class RegisteredClassFactory {
}
String clazzName = null;
boolean registered = false;
- final int classIterMark = classIter - 1;
+ final int classIterMark = classIter - 1;
while ( !registered && classIterMark != classIter ) {
// Retry with next clazz name, this could happen if more than one JVM is running
clazzName = classBaseName + classIter;
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java
index 8278620..2c8ef64 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java
@@ -14,17 +14,17 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen;
public class X11DummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize {
/**
- * @param width the initial width as returned by {@link NativeSurface#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)},
- * not the actual dummy surface width.
+ * @param width the initial width as returned by {@link NativeSurface#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)},
+ * not the actual dummy surface width.
* The latter is platform specific and small
- * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)},
+ * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)},
* not the actual dummy surface height,
* The latter is platform specific and small
*/
public X11DummyUpstreamSurfaceHook(int width, int height) {
super(width, height);
}
-
+
@Override
public final void create(ProxySurface s) {
final X11GraphicsConfiguration cfg = (X11GraphicsConfiguration) s.getGraphicsConfiguration();
@@ -42,14 +42,14 @@ public class X11DummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize
throw new NativeWindowException("Creating dummy window failed w/ "+cfg);
}
s.setSurfaceHandle(windowHandle);
- s.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
+ s.addUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
}
s.addUpstreamOptionBits(ProxySurface.OPT_UPSTREAM_WINDOW_INVISIBLE);
} finally {
device.unlock();
}
}
-
+
@Override
public final void destroy(ProxySurface s) {
if( s.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) {
@@ -59,7 +59,7 @@ public class X11DummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize
}
device.lock();
try {
- X11Lib.DestroyWindow(device.getHandle(), s.getSurfaceHandle());
+ X11Lib.DestroyWindow(device.getHandle(), s.getSurfaceHandle());
s.setSurfaceHandle(0);
s.clearUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
} finally {
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java
index b11dd1d..6258632 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11GraphicsConfigurationFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -47,10 +47,11 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen;
public class X11GraphicsConfigurationFactory extends GraphicsConfigurationFactory {
public static void registerFactory() {
GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, CapabilitiesImmutable.class, new X11GraphicsConfigurationFactory());
- }
+ }
private X11GraphicsConfigurationFactory() {
}
-
+
+ @Override
protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl(
CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AbstractGraphicsScreen screen, int nativeVisualID)
throws IllegalArgumentException, NativeWindowException {
@@ -109,7 +110,7 @@ public class X11GraphicsConfigurationFactory extends GraphicsConfigurationFactor
XVisualInfo best=null;
int rdepth = capabilities.getRedBits() + capabilities.getGreenBits() + capabilities.getBlueBits() + capabilities.getAlphaBits();
for (int i = 0; vinfos!=null && i < num[0]; i++) {
- if ( best == null ||
+ if ( best == null ||
best.getDepth() < vinfos[i].getDepth() )
{
best = vinfos[i];
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
index 78e432b..02e4379 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11Util.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -54,16 +54,16 @@ import com.jogamp.nativewindow.x11.X11GraphicsDevice;
*/
public class X11Util implements ToolkitProperties {
public static final boolean DEBUG = Debug.debug("X11Util");
-
- /**
+
+ /**
* See Bug 515 - https://jogamp.org/bugzilla/show_bug.cgi?id=515
- * <p>
+ * <p>
* It is observed that ATI X11 drivers, eg.
- * <ul>
+ * <ul>
* <li>fglrx 8.78.6,</li>
* <li>fglrx 11.08/8.881 and </li>
* <li>fglrx 11.11/8.911</li>
- * </ul>
+ * </ul>
* are quite sensitive to multiple Display connections.
* </p>
* <p>
@@ -81,11 +81,11 @@ public class X11Util implements ToolkitProperties {
* </p>
* <p>
* With ATI X11 drivers all connections must be closed at JVM shutdown,
- * otherwise a SIGSEGV (after JVM safepoint) will be caused.
+ * otherwise a SIGSEGV (after JVM safepoint) will be caused.
* </p>
*/
public static final boolean ATI_HAS_XCLOSEDISPLAY_BUG = !Debug.isPropertyDefined("nativewindow.debug.X11Util.ATI_HAS_NO_XCLOSEDISPLAY_BUG", true);
-
+
/** See {@link #ATI_HAS_XCLOSEDISPLAY_BUG}. */
public static final boolean HAS_XCLOSEDISPLAY_BUG = Debug.isPropertyDefined("nativewindow.debug.X11Util.HAS_XCLOSEDISPLAY_BUG", true);
@@ -105,7 +105,7 @@ public class X11Util implements ToolkitProperties {
private static final Object setX11ErrorHandlerLock = new Object();
private static final String X11_EXTENSION_ATIFGLRXDRI = "ATIFGLRXDRI";
private static final String X11_EXTENSION_ATIFGLEXTENSION = "ATIFGLEXTENSION";
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
* @see ToolkitProperties
@@ -121,15 +121,15 @@ public class X11Util implements ToolkitProperties {
if(!NWJNILibLoader.loadNativeWindow("x11")) {
throw new NativeWindowException("NativeWindow X11 native library load error.");
}
-
+
final boolean isInitOK = initialize0( XERROR_STACKDUMP );
-
+
final boolean hasX11_EXTENSION_ATIFGLRXDRI, hasX11_EXTENSION_ATIFGLEXTENSION;
final long dpy = X11Lib.XOpenDisplay(PropertyAccess.getProperty("nativewindow.x11.display.default", true));
if(0 != dpy) {
if(XSYNC_ENABLED) {
X11Lib.XSynchronize(dpy, true);
- }
+ }
try {
nullDisplayName = X11Lib.XDisplayString(dpy);
hasX11_EXTENSION_ATIFGLRXDRI = X11Lib.QueryExtension(dpy, X11_EXTENSION_ATIFGLRXDRI);
@@ -147,7 +147,7 @@ public class X11Util implements ToolkitProperties {
if ( !markAllDisplaysUnclosable ) {
markAllDisplaysUnclosable = ( ATI_HAS_XCLOSEDISPLAY_BUG && isATIFGLRX ) || HAS_XCLOSEDISPLAY_BUG;
}
-
+
if(DEBUG) {
System.err.println("X11Util.initSingleton(): OK "+isInitOK+"]"+
",\n\t X11 Display(NULL) <"+nullDisplayName+">"+
@@ -164,17 +164,17 @@ public class X11Util implements ToolkitProperties {
}
}
}
-
+
// not exactly thread safe, but good enough for our purpose,
// which is to tag a NamedDisplay uncloseable after creation.
- private static Object globalLock = new Object();
+ private static Object globalLock = new Object();
private static LongObjectHashMap openDisplayMap = new LongObjectHashMap(); // handle -> name
private static List<NamedDisplay> openDisplayList = new ArrayList<NamedDisplay>(); // open, no close attempt
private static List<NamedDisplay> reusableDisplayList = new ArrayList<NamedDisplay>(); // close attempt, marked uncloseable, for reuse
private static List<NamedDisplay> pendingDisplayList = new ArrayList<NamedDisplay>(); // all open (close attempt or reusable) in creation order
private static final HashMap<String /* displayName */, Boolean> displayXineramaEnabledMap = new HashMap<String, Boolean>();
-
- /**
+
+ /**
* Cleanup resources.
* <p>
* Called by {@link NativeWindowFactory#shutdown()}
@@ -184,7 +184,7 @@ public class X11Util implements ToolkitProperties {
public static void shutdown() {
if(isInit) {
synchronized(X11Util.class) {
- if(isInit) {
+ if(isInit) {
final boolean isJVMShuttingDown = NativeWindowFactory.isJVMShuttingDown() ;
if( DEBUG ||
( ( openDisplayMap.size() > 0 || reusableDisplayList.size() > 0 || pendingDisplayList.size() > 0 ) &&
@@ -207,9 +207,9 @@ public class X11Util implements ToolkitProperties {
}
}
}
-
- // Only at JVM shutdown time, since AWT impl. seems to
- // dislike closing of X11 Display's (w/ ATI driver).
+
+ // Only at JVM shutdown time, since AWT impl. seems to
+ // dislike closing of X11 Display's (w/ ATI driver).
if( isJVMShuttingDown ) {
synchronized(globalLock) {
isInit = false;
@@ -226,7 +226,7 @@ public class X11Util implements ToolkitProperties {
}
}
}
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
* @see ToolkitProperties
@@ -234,15 +234,15 @@ public class X11Util implements ToolkitProperties {
public static final boolean requiresToolkitLock() {
return true; // JAWT locking: yes, instead of native X11 locking w use a recursive lock per display connection.
}
-
+
/**
* Called by {@link NativeWindowFactory#initSingleton()}
* @see ToolkitProperties
*/
public static final boolean hasThreadingIssues() {
- return hasThreadingIssues; // JOGL impl. may utilize special locking "somewhere"
+ return hasThreadingIssues; // JOGL impl. may utilize special locking "somewhere"
}
-
+
public static void setX11ErrorHandler(boolean onoff, boolean quiet) {
synchronized(setX11ErrorHandlerLock) {
setX11ErrorHandler0(onoff, quiet);
@@ -271,7 +271,7 @@ public class X11Util implements ToolkitProperties {
public static boolean getMarkAllDisplaysUnclosable() {
return markAllDisplaysUnclosable;
}
-
+
private X11Util() {}
public static class NamedDisplay {
@@ -300,10 +300,12 @@ public class X11Util implements ToolkitProperties {
}
}
+ @Override
public final int hashCode() {
return hash32;
}
-
+
+ @Override
public final boolean equals(Object obj) {
if(this == obj) { return true; }
if(obj instanceof NamedDisplay) {
@@ -311,10 +313,10 @@ public class X11Util implements ToolkitProperties {
}
return false;
}
-
+
public final void addRef() { refCount++; }
public final void removeRef() { refCount--; }
-
+
public final String getName() { return name; }
public final long getHandle() { return handle; }
public final int getRefCount() { return refCount; }
@@ -324,11 +326,6 @@ public class X11Util implements ToolkitProperties {
public final Throwable getCreationStack() { return creationStack; }
@Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- @Override
public String toString() {
return "NamedX11Display["+name+", 0x"+Long.toHexString(handle)+", refCount "+refCount+", unCloseable "+unCloseable+"]";
}
@@ -365,7 +362,7 @@ public class X11Util implements ToolkitProperties {
return openDisplayList.size();
}
}
-
+
public static void dumpOpenDisplayConnections() {
synchronized(globalLock) {
System.err.println("X11Util: Open X11 Display Connections: "+openDisplayList.size());
@@ -381,7 +378,7 @@ public class X11Util implements ToolkitProperties {
}
}
}
-
+
public static int getReusableDisplayConnectionNumber() {
synchronized(globalLock) {
return reusableDisplayList.size();
@@ -439,7 +436,7 @@ public class X11Util implements ToolkitProperties {
NamedDisplay namedDpy = null;
name = validateDisplayName(name);
boolean reused = false;
-
+
synchronized(globalLock) {
for(int i=0; i<reusableDisplayList.size(); i++) {
if(reusableDisplayList.get(i).getName().equals(name)) {
@@ -484,7 +481,7 @@ public class X11Util implements ToolkitProperties {
X11Util.dumpPendingDisplayConnections();
throw new RuntimeException("X11Util.Display: Display(0x"+Long.toHexString(handle)+") Mapping error: "+namedDpy+". Thread "+Thread.currentThread().getName());
}
-
+
namedDpy.removeRef();
if(!openDisplayList.remove(namedDpy)) { throw new RuntimeException("Internal: "+namedDpy); }
@@ -497,13 +494,13 @@ public class X11Util implements ToolkitProperties {
pendingDisplayList.remove(namedDpy);
} else {
// for reuse
- X11Lib.XSync(namedDpy.getHandle(), true); // flush output buffer and discard all events
+ X11Lib.XSync(namedDpy.getHandle(), true); // flush output buffer and discard all events
reusableDisplayList.add(namedDpy);
}
if(DEBUG) {
System.err.println("X11Util.Display: Closed (real: "+(!namedDpy.isUncloseable())+") "+namedDpy+". Thread "+Thread.currentThread().getName());
- }
+ }
}
}
@@ -513,7 +510,7 @@ public class X11Util implements ToolkitProperties {
}
}
- /**
+ /**
* @return If name is null, it returns the previous queried NULL display name,
* otherwise the name. */
public static String validateDisplayName(String name) {
@@ -537,7 +534,7 @@ public class X11Util implements ToolkitProperties {
long handle = X11Lib.XOpenDisplay(arg0);
if(XSYNC_ENABLED && 0 != handle) {
X11Lib.XSynchronize(handle, true);
- }
+ }
if(TRACE_DISPLAY_LIFECYCLE) {
System.err.println(Thread.currentThread()+" - X11Util.XOpenDisplay("+arg0+") 0x"+Long.toHexString(handle));
// Thread.dumpStack();
@@ -557,13 +554,13 @@ public class X11Util implements ToolkitProperties {
System.err.println("X11Util: Catched Exception:");
ex.printStackTrace();
}
- return res;
+ return res;
}
static volatile boolean XineramaFetched = false;
static long XineramaLibHandle = 0;
static long XineramaQueryFunc = 0;
-
+
public static boolean XineramaIsEnabled(X11GraphicsDevice device) {
if(null == device) {
throw new IllegalArgumentException("X11 Display device is NULL");
@@ -573,9 +570,9 @@ public class X11Util implements ToolkitProperties {
return XineramaIsEnabled(device.getHandle());
} finally {
device.unlock();
- }
+ }
}
-
+
public static boolean XineramaIsEnabled(long displayHandle) {
if( 0 == displayHandle ) {
throw new IllegalArgumentException("X11 Display handle is NULL");
@@ -616,10 +613,10 @@ public class X11Util implements ToolkitProperties {
}
return res;
}
-
+
private static final String getCurrentThreadName() { return Thread.currentThread().getName(); } // Callback for JNI
private static final void dumpStack() { Thread.dumpStack(); } // Callback for JNI
-
+
private static native boolean initialize0(boolean debug);
private static native void shutdown0();
private static native void setX11ErrorHandler0(boolean onoff, boolean quiet);
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java b/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java
index b152f0f..0620402 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/x11/awt/X11AWTGraphicsConfigurationFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -59,16 +59,17 @@ import jogamp.nativewindow.x11.X11Lib;
import jogamp.nativewindow.x11.X11Util;
public class X11AWTGraphicsConfigurationFactory extends GraphicsConfigurationFactory {
-
+
public static void registerFactory() {
GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.awt.AWTGraphicsDevice.class, CapabilitiesImmutable.class, new X11AWTGraphicsConfigurationFactory());
- }
+ }
private X11AWTGraphicsConfigurationFactory() {
}
+ @Override
protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl(
CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested,
- CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) {
+ CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) {
if (absScreen != null &&
!(absScreen instanceof AWTGraphicsScreen)) {
throw new IllegalArgumentException("This GraphicsConfigurationFactory accepts only AWTGraphicsScreen objects");
@@ -79,16 +80,16 @@ public class X11AWTGraphicsConfigurationFactory extends GraphicsConfigurationFac
return chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, (AWTGraphicsScreen)absScreen, nativeVisualID);
}
-
+
public static AWTGraphicsConfiguration chooseGraphicsConfigurationStatic(
CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested,
CapabilitiesChooser chooser, AWTGraphicsScreen awtScreen, int nativeVisualID) {
if(DEBUG) {
System.err.println("X11AWTGraphicsConfigurationFactory: got "+awtScreen);
}
-
+
final GraphicsDevice device = ((AWTGraphicsDevice)awtScreen.getDevice()).getGraphicsDevice();
-
+
final long displayHandleAWT = X11SunJDKReflection.graphicsDeviceGetDisplay(device);
final long displayHandle;
final boolean owner;
@@ -101,8 +102,8 @@ public class X11AWTGraphicsConfigurationFactory extends GraphicsConfigurationFac
} else {
/**
* Using the AWT display handle works fine with NVidia.
- * However we experienced different results w/ AMD drivers,
- * some work, but some behave erratic.
+ * However we experienced different results w/ AMD drivers,
+ * some work, but some behave erratic.
* I.e. hangs in XQueryExtension(..) via X11GraphicsScreen.
*/
final String displayName = X11Lib.XDisplayString(displayHandleAWT);
@@ -113,13 +114,13 @@ public class X11AWTGraphicsConfigurationFactory extends GraphicsConfigurationFac
}
}
// Global JAWT lock required - No X11 resource locking due to private display connection
- final ToolkitLock lock = NativeWindowFactory.getDefaultToolkitLock(NativeWindowFactory.TYPE_AWT);
- final X11GraphicsDevice x11Device = new X11GraphicsDevice(displayHandle, AbstractGraphicsDevice.DEFAULT_UNIT, lock, owner);
+ final ToolkitLock lock = NativeWindowFactory.getDefaultToolkitLock(NativeWindowFactory.TYPE_AWT);
+ final X11GraphicsDevice x11Device = new X11GraphicsDevice(displayHandle, AbstractGraphicsDevice.DEFAULT_UNIT, lock, owner);
final X11GraphicsScreen x11Screen = new X11GraphicsScreen(x11Device, awtScreen.getIndex());
if(DEBUG) {
System.err.println("X11AWTGraphicsConfigurationFactory: made "+x11Screen);
}
-
+
final GraphicsConfigurationFactory factory = GraphicsConfigurationFactory.getFactory(x11Device, capsChosen);
AbstractGraphicsConfiguration aConfig = factory.chooseGraphicsConfiguration(capsChosen, capsRequested, chooser, x11Screen, nativeVisualID);
if (aConfig == null) {
@@ -129,7 +130,7 @@ public class X11AWTGraphicsConfigurationFactory extends GraphicsConfigurationFac
System.err.println("X11AWTGraphicsConfigurationFactory: chosen config: "+aConfig);
// Thread.dumpStack();
}
-
+
//
// Match the X11/GL Visual with AWT:
// - choose a config AWT agnostic and then
@@ -137,7 +138,7 @@ public class X11AWTGraphicsConfigurationFactory extends GraphicsConfigurationFac
//
// The resulting GraphicsConfiguration has to be 'forced' on the AWT native peer,
// ie. returned by GLCanvas's getGraphicsConfiguration() befor call by super.addNotify().
- //
+ //
final GraphicsConfiguration[] configs = device.getConfigurations();
int visualID = aConfig.getVisualID(VIDType.NATIVE);
if(VisualIDHolder.VID_UNDEFINED != visualID) {
diff --git a/src/nativewindow/native/JAWT_DrawingSurfaceInfo.c b/src/nativewindow/native/JAWT_DrawingSurfaceInfo.c
index 2a66510..5c77b6d 100644
--- a/src/nativewindow/native/JAWT_DrawingSurfaceInfo.c
+++ b/src/nativewindow/native/JAWT_DrawingSurfaceInfo.c
@@ -43,7 +43,7 @@
#define PLATFORM_DSI_SIZE sizeof(JAWT_Win32DrawingSurfaceInfo)
#elif defined(linux) || defined(__sun) || defined(__FreeBSD__) || defined(_HPUX)
#define PLATFORM_DSI_SIZE sizeof(JAWT_X11DrawingSurfaceInfo)
-#elif defined(macosx)
+#elif defined(__APPLE__)
#define PLATFORM_DSI_SIZE sizeof(JAWT_MacOSXDrawingSurfaceInfo)
#else
ERROR: port JAWT_DrawingSurfaceInfo.c to your platform
diff --git a/src/nativewindow/native/macosx/NativeWindowProtocols.h b/src/nativewindow/native/macosx/NativeWindowProtocols.h
index b91a50d..98e864f 100644
--- a/src/nativewindow/native/macosx/NativeWindowProtocols.h
+++ b/src/nativewindow/native/macosx/NativeWindowProtocols.h
@@ -25,10 +25,34 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
+
+#ifndef NATIVEWINDOWPROTOCOLS_H
+#define NATIVEWINDOWPROTOCOLS_H 1
+/**
+ * CALayer size needs to be set using the AWT component size.
+ * See detailed description in JAWTUtil.java and sync w/ changed.
+ */
+#define NW_DEDICATEDFRAME_QUIRK_SIZE ( 1 << 0 )
+
+/**
+ * CALayer position needs to be set to zero.
+ * See detailed description in JAWTUtil.java and sync w/ changed.
+ */
+#define NW_DEDICATEDFRAME_QUIRK_POSITION ( 1 << 1 )
+
+/**
+ * CALayer position needs to be derived from AWT position.
+ * in relation to super CALayer.
+ * See detailed description in JAWTUtil.java and sync w/ changed.
+ */
+#define NW_DEDICATEDFRAME_QUIRK_LAYOUT ( 1 << 2 )
+
#import <Foundation/NSGeometry.h>
- at protocol NWDedicatedSize
-- (void)setDedicatedSize:(CGSize)size;
+ at protocol NWDedicatedFrame
+- (void)setDedicatedFrame:(CGRect)dFrame quirks:(int)quirks;
@end
+#endif /* NATIVEWINDOWPROTOCOLS_H_ */
+
diff --git a/src/nativewindow/native/macosx/OSXmisc.m b/src/nativewindow/native/macosx/OSXmisc.m
index 688ef79..6a7952e 100644
--- a/src/nativewindow/native/macosx/OSXmisc.m
+++ b/src/nativewindow/native/macosx/OSXmisc.m
@@ -333,6 +333,10 @@ JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_GetNSWindow0
*/
@interface MyCALayer: CALayer
{
+ at private
+ BOOL fixedFrameSet;
+ CGRect fixedFrame;
+ float visibleOpacity;
}
- (id)init;
#ifdef DBG_LIFECYCLE
@@ -341,6 +345,9 @@ JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_GetNSWindow0
- (void)dealloc;
#endif
- (id<CAAction>)actionForKey:(NSString *)key ;
+- (void)layoutSublayers;
+- (void)setFrame:(CGRect) frame;
+- (void)fixCALayerLayout: (CALayer*) subLayer visible:(BOOL)visible x:(jint)x y:(jint)y width:(jint)width height:(jint)height caLayerQuirks:(jint)caLayerQuirks force:(jboolean) force;
@end
@@ -350,6 +357,9 @@ JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_GetNSWindow0
{
DBG_PRINT("MyCALayer::init.0\n");
MyCALayer * o = [super init];
+ o->fixedFrameSet = 0;
+ o->fixedFrame = CGRectMake(0, 0, 0, 0);
+ o->visibleOpacity = 1.0;
DBG_PRINT("MyCALayer::init.X: new %p\n", o);
return o;
}
@@ -390,83 +400,186 @@ JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_GetNSWindow0
// return [super actionForKey: key];
}
+- (void)layoutSublayers
+{
+ if( fixedFrameSet ) {
+ NSArray* subs = [self sublayers];
+ if( NULL != subs ) {
+ CGRect rFrame = [self frame];
+ if( !CGRectEqualToRect(fixedFrame, rFrame) ) {
+ #ifdef VERBOSE
+ DBG_PRINT("CALayer::layoutSublayers.0: Root %p frame %lf/%lf %lfx%lf -> %lf/%lf %lfx%lf\n",
+ self,
+ rFrame.origin.x, rFrame.origin.y, rFrame.size.width, rFrame.size.height,
+ fixedFrame.origin.x, fixedFrame.origin.y, fixedFrame.size.width, fixedFrame.size.height);
+ #endif
+ [super setFrame: fixedFrame];
+ }
+ NSUInteger i = 0;
+ for(i=0; i<[subs count]; i++) {
+ CALayer* sub = [subs objectAtIndex: i];
+ CGRect sFrame = [sub frame];
+ CGRect sFrame2 = CGRectMake(0, 0, fixedFrame.size.width, fixedFrame.size.height);
+ if( !CGRectEqualToRect(sFrame2, sFrame) ) {
+ #ifdef VERBOSE
+ DBG_PRINT("CALayer::layoutSublayers.1: Sub[%d] %p frame %lf/%lf %lfx%lf -> %lf/%lf %lfx%lf\n",
+ (int)i, sub,
+ sFrame.origin.x, sFrame.origin.y, sFrame.size.width, sFrame.size.height,
+ sFrame2.origin.x, sFrame2.origin.y, sFrame2.size.width, sFrame2.size.height);
+ #endif
+ [sub setFrame: sFrame2];
+ }
+ #ifdef VERBOSE
+ DBG_PRINT("CALayer::layoutSublayers.X: Root %p . Sub[%d] %p : frame r: %lf/%lf %lfx%lf . s: %lf/%lf %lfx%lf\n",
+ self, (int)i, sub,
+ rFrame.origin.x, rFrame.origin.y, rFrame.size.width, rFrame.size.height,
+ sFrame.origin.x, sFrame.origin.y, sFrame.size.width, sFrame.size.height);
+ #endif
+ }
+ }
+ } else {
+ [super layoutSublayers];
+ }
+}
+
+- (void) setFrame:(CGRect) frame
+{
+ if( fixedFrameSet ) {
+ [super setFrame: fixedFrame];
+ } else {
+ [super setFrame: frame];
+ }
+}
+
+- (void)fixCALayerLayout: (CALayer*) subLayer visible:(BOOL)visible x:(jint)x y:(jint)y width:(jint)width height:(jint)height caLayerQuirks:(jint)caLayerQuirks force:(jboolean) force
+{
+ int loutQuirk = 0 != ( NW_DEDICATEDFRAME_QUIRK_LAYOUT & caLayerQuirks );
+ {
+ CALayer* superLayer = [self superlayer];
+ CGRect superFrame = [superLayer frame];
+ CGRect lFrame = [self frame];
+ if( visible ) {
+ // Opacity must be 0 to see through the disabled CALayer
+ [subLayer setOpacity: visibleOpacity];
+ [self setOpacity: visibleOpacity];
+ [self setHidden: NO];
+ [subLayer setHidden: NO];
+ } else {
+ [subLayer setHidden: YES];
+ [self setHidden: YES];
+ visibleOpacity = [self opacity];
+ [subLayer setOpacity: 0.0];
+ [self setOpacity: 0.0];
+ }
+ int posQuirk = 0 != ( NW_DEDICATEDFRAME_QUIRK_POSITION & caLayerQuirks ) && ( lFrame.origin.x!=0 || lFrame.origin.y!=0 );
+ int sizeQuirk = 0 != ( NW_DEDICATEDFRAME_QUIRK_SIZE & caLayerQuirks ) && ( lFrame.size.width!=width || lFrame.size.height!=height );
+ if( !posQuirk || loutQuirk ) {
+ // Use root layer position, sub-layer will be on 0/0,
+ // Given AWT position is location on screen w/o insets and top/left origin!
+ fixedFrame.origin.x = x;
+ fixedFrame.origin.y = superFrame.size.height - height - y; // AWT's position top/left -> bottom/left
+ posQuirk |= 8;
+ } else {
+ // Buggy super layer position, always use 0/0
+ fixedFrame.origin.x = 0;
+ fixedFrame.origin.y = 0;
+ }
+ if( !sizeQuirk ) {
+ fixedFrame.size.width = lFrame.size.width;
+ fixedFrame.size.height = lFrame.size.height;
+ } else {
+ fixedFrame.size.width = width;
+ fixedFrame.size.height = height;
+ }
+ DBG_PRINT("CALayer::FixCALayerLayout0.0: Quirks [%d, pos %d, size %d, lout %d], Super %p frame %lf/%lf %lfx%lf, Root %p frame %lf/%lf %lfx%lf, usr %d/%d %dx%d -> %lf/%lf %lfx%lf\n",
+ caLayerQuirks, posQuirk, sizeQuirk, loutQuirk,
+ superLayer, superFrame.origin.x, superFrame.origin.y, superFrame.size.width, superFrame.size.height,
+ self, lFrame.origin.x, lFrame.origin.y, lFrame.size.width, lFrame.size.height,
+ x, y, width, height, fixedFrame.origin.x, fixedFrame.origin.y, fixedFrame.size.width, fixedFrame.size.height);
+ if( posQuirk || sizeQuirk || loutQuirk ) {
+ fixedFrameSet = 1;
+ [super setFrame: fixedFrame];
+ }
+ }
+ if( NULL != subLayer ) {
+ CGRect lFrame = [subLayer frame];
+ int sizeQuirk = 0 != ( NW_DEDICATEDFRAME_QUIRK_SIZE & caLayerQuirks ) && ( lFrame.size.width!=width || lFrame.size.height!=height );
+ CGFloat _x, _y, _w, _h;
+ int posQuirk = 0 != ( NW_DEDICATEDFRAME_QUIRK_POSITION & caLayerQuirks ) && ( lFrame.origin.x!=0 || lFrame.origin.y!=0 );
+ // Sub rel. to used root layer
+ _x = 0;
+ _y = 0;
+ posQuirk |= 8;
+ if( !sizeQuirk ) {
+ _w = lFrame.size.width;
+ _h = lFrame.size.height;
+ } else {
+ _w = width;
+ _h = height;
+ }
+ DBG_PRINT("CALayer::FixCALayerLayout1.0: Quirks [%d, pos %d, size %d, lout %d], SubL %p frame %lf/%lf %lfx%lf, usr %dx%d -> %lf/%lf %lfx%lf\n",
+ caLayerQuirks, posQuirk, sizeQuirk, loutQuirk, subLayer, lFrame.origin.x, lFrame.origin.y, lFrame.size.width, lFrame.size.height,
+ width, height, _x, _y, _w, _h);
+ if( force || posQuirk || sizeQuirk || loutQuirk ) {
+ lFrame.origin.x = _x;
+ lFrame.origin.y = _y;
+ lFrame.size.width = _w;
+ lFrame.size.height = _h;
+ if( [subLayer conformsToProtocol:@protocol(NWDedicatedFrame)] ) {
+ CALayer <NWDedicatedFrame> * subLayerDS = (CALayer <NWDedicatedFrame> *) subLayer;
+ [subLayerDS setDedicatedFrame: lFrame quirks: caLayerQuirks];
+ } else {
+ [subLayer setFrame: lFrame];
+ }
+ }
+ }
+}
+
@end
/*
* Class: Java_jogamp_nativewindow_macosx_OSXUtil
* Method: CreateCALayer0
- * Signature: (IIII)J
+ * Signature: (II)J
*/
JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_CreateCALayer0
- (JNIEnv *env, jclass unused, jint x, jint y, jint width, jint height)
+ (JNIEnv *env, jclass unused, jint width, jint height)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
MyCALayer* layer = [[MyCALayer alloc] init];
- DBG_PRINT("CALayer::CreateCALayer.0: root %p %d/%d %dx%d (refcnt %d)\n", layer, (int)x, (int)y, (int)width, (int)height, (int)[layer retainCount]);
+ DBG_PRINT("CALayer::CreateCALayer.0: root %p 0/0 %dx%d (refcnt %d)\n", layer, (int)width, (int)height, (int)[layer retainCount]);
// avoid zero size
if(0 == width) { width = 32; }
if(0 == height) { height = 32; }
// initial dummy size !
- CGRect lRect = [layer frame];
- lRect.origin.x = x;
- lRect.origin.y = y;
- lRect.size.width = width;
- lRect.size.height = height;
- [layer setFrame: lRect];
+ CGRect lFrame = [layer frame];
+ lFrame.origin.x = 0;
+ lFrame.origin.y = 0;
+ lFrame.size.width = width;
+ lFrame.size.height = height;
+ [layer setFrame: lFrame];
// no animations for add/remove/swap sublayers etc
// doesn't work: [layer removeAnimationForKey: kCAOnOrderIn, kCAOnOrderOut, kCATransition]
[layer removeAllAnimations];
// [layer addAnimation:nil forKey:kCATransition];
[layer setAutoresizingMask: (kCALayerWidthSizable|kCALayerHeightSizable)];
[layer setNeedsDisplayOnBoundsChange: YES];
- DBG_PRINT("CALayer::CreateCALayer.1: root %p %lf/%lf %lfx%lf\n", layer, lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height);
+ DBG_PRINT("CALayer::CreateCALayer.1: root %p %lf/%lf %lfx%lf\n", layer, lFrame.origin.x, lFrame.origin.y, lFrame.size.width, lFrame.size.height);
[pool release];
DBG_PRINT("CALayer::CreateCALayer.X: root %p (refcnt %d)\n", layer, (int)[layer retainCount]);
return (jlong) ((intptr_t) layer);
}
-static void FixCALayerLayout0(MyCALayer* rootLayer, CALayer* subLayer, jint width, jint height) {
- if( NULL != rootLayer ) {
- CGRect lRect = [rootLayer frame];
- if(lRect.origin.x!=0 || lRect.origin.y!=0 || lRect.size.width!=width || lRect.size.height!=height) {
- DBG_PRINT("CALayer::FixCALayerLayout0.0: Root %p frame %lf/%lf %lfx%lf -> 0/0 %dx%d\n",
- rootLayer, lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height, (int)width, (int)height);
- lRect.origin.x = 0;
- lRect.origin.y = 0;
- lRect.size.width = width;
- lRect.size.height = height;
- [rootLayer setFrame: lRect];
- }
- }
- if( NULL != subLayer ) {
- CGRect lRect = [subLayer frame];
- if(lRect.origin.x!=0 || lRect.origin.y!=0 || lRect.size.width!=width || lRect.size.height!=height) {
- DBG_PRINT("CALayer::FixCALayerLayout0.0: SubL %p frame %lf/%lf %lfx%lf -> 0/0 %dx%d\n",
- subLayer, lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height, (int)width, (int)height);
- lRect.origin.x = 0;
- lRect.origin.y = 0;
- lRect.size.width = width;
- lRect.size.height = height;
- if( [subLayer conformsToProtocol:@protocol(NWDedicatedSize)] ) {
- CALayer <NWDedicatedSize> * subLayerDS = (CALayer <NWDedicatedSize> *) subLayer;
- [subLayerDS setDedicatedSize: lRect.size];
- } else {
- [subLayer setFrame: lRect];
- }
- }
- }
-}
-
/*
* Class: Java_jogamp_nativewindow_macosx_OSXUtil
* Method: AddCASublayer0
- * Signature: (JJII)V
+ * Signature: (JJIIIII)V
*/
JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_AddCASublayer0
- (JNIEnv *env, jclass unused, jlong rootCALayer, jlong subCALayer, jint width, jint height)
+ (JNIEnv *env, jclass unused, jlong rootCALayer, jlong subCALayer, jint x, jint y, jint width, jint height, jint caLayerQuirks)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
MyCALayer* rootLayer = (MyCALayer*) ((intptr_t) rootCALayer);
@@ -479,20 +592,10 @@ JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_AddCASublayer0
[subLayer retain]; // Pairs w/ RemoveCASublayer
CGRect lRectRoot = [rootLayer frame];
- DBG_PRINT("CALayer::AddCASublayer0.0: Origin %p frame0: %lf/%lf %lfx%lf\n",
- rootLayer, lRectRoot.origin.x, lRectRoot.origin.y, lRectRoot.size.width, lRectRoot.size.height);
- if(lRectRoot.origin.x!=0 || lRectRoot.origin.y!=0) {
- lRectRoot.origin.x = 0;
- lRectRoot.origin.y = 0;
- [rootLayer setFrame: lRectRoot];
- DBG_PRINT("CALayer::AddCASublayer0.1: Origin %p frame*: %lf/%lf %lfx%lf\n",
- rootLayer, lRectRoot.origin.x, lRectRoot.origin.y, lRectRoot.size.width, lRectRoot.size.height);
- }
- DBG_PRINT("CALayer::AddCASublayer0.2: root %p (refcnt %d) .sub %p %lf/%lf %lfx%lf (refcnt %d)\n",
- rootLayer, (int)[rootLayer retainCount],
- subLayer, lRectRoot.origin.x, lRectRoot.origin.y, lRectRoot.size.width, lRectRoot.size.height, (int)[subLayer retainCount]);
+ DBG_PRINT("CALayer::AddCASublayer0.0: Quirks %d, Root %p (refcnt %d), Sub %p (refcnt %d), frame0: %lf/%lf %lfx%lf\n",
+ caLayerQuirks, rootLayer, (int)[rootLayer retainCount], subLayer, (int)[subLayer retainCount],
+ lRectRoot.origin.x, lRectRoot.origin.y, lRectRoot.size.width, lRectRoot.size.height);
- // simple 1:1 layout !
[subLayer setFrame:lRectRoot];
[rootLayer addSublayer:subLayer];
@@ -507,7 +610,9 @@ JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_AddCASublayer0
[subLayer setAutoresizingMask: (kCALayerWidthSizable|kCALayerHeightSizable)];
[subLayer setNeedsDisplayOnBoundsChange: YES];
- FixCALayerLayout0(rootLayer, subLayer, width, height);
+ if( 0 != caLayerQuirks ) {
+ [rootLayer fixCALayerLayout: subLayer visible:1 x:x y:y width:width height:height caLayerQuirks:caLayerQuirks force:JNI_TRUE];
+ }
[CATransaction commit];
@@ -519,23 +624,28 @@ JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_AddCASublayer0
/*
* Class: Java_jogamp_nativewindow_macosx_OSXUtil
* Method: FixCALayerLayout0
- * Signature: (JJII)V
+ * Signature: (JJIII)V
*/
JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_FixCALayerLayout0
- (JNIEnv *env, jclass unused, jlong rootCALayer, jlong subCALayer, jint width, jint height)
+ (JNIEnv *env, jclass unused, jlong rootCALayer, jlong subCALayer, jboolean visible, jint x, jint y, jint width, jint height, jint caLayerQuirks)
{
- NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
- MyCALayer* rootLayer = (MyCALayer*) ((intptr_t) rootCALayer);
- CALayer* subLayer = (CALayer*) ((intptr_t) subCALayer);
+ if( 0 != caLayerQuirks ) {
+ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ MyCALayer* rootLayer = (MyCALayer*) ((intptr_t) rootCALayer);
+ if( NULL == rootLayer ) {
+ NativewindowCommon_throwNewRuntimeException(env, "Argument \"rootLayer\" is null");
+ }
+ CALayer* subLayer = (CALayer*) ((intptr_t) subCALayer);
- [CATransaction begin];
- [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
+ [CATransaction begin];
+ [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
- FixCALayerLayout0(rootLayer, subLayer, width, height);
+ [rootLayer fixCALayerLayout: subLayer visible:(BOOL)visible x:x y:y width:width height:height caLayerQuirks:caLayerQuirks force:JNI_FALSE];
- [CATransaction commit];
+ [CATransaction commit];
- [pool release];
+ [pool release];
+ }
}
/*
@@ -742,10 +852,13 @@ JNIEXPORT void JNICALL Java_jogamp_nativewindow_jawt_macosx_MacOSXJAWTWindow_Uns
static void RunOnThread (JNIEnv *env, jobject runnable, BOOL onMain, jint delayInMS)
{
- DBG_PRINT2( "RunOnThread0: isMainThread %d, NSApp %d, NSApp-isRunning %d, onMain %d, delay %dms\n",
- (int)([NSThread isMainThread]), (int)(NULL!=NSApp), (int)([NSApp isRunning]), (int)onMain, (int)delayInMS);
+ BOOL isMainThread = [NSThread isMainThread];
+ BOOL forkOnMain = onMain && ( NO == isMainThread || 0 < delayInMS );
+
+ DBG_PRINT2( "RunOnThread0: forkOnMain %d [onMain %d, delay %dms, isMainThread %d], NSApp %d, NSApp-isRunning %d\n",
+ (int)forkOnMain, (int)onMain, (int)delayInMS, (int)isMainThread, (int)(NULL!=NSApp), (int)([NSApp isRunning]));
- if ( !onMain || NO == [NSThread isMainThread] ) {
+ if ( forkOnMain ) {
jobject runnableObj = (*env)->NewGlobalRef(env, runnable);
JavaVM *jvmHandle = NULL;
@@ -797,17 +910,17 @@ JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_RunOnMainThread0
* Signature: (ZLjava/lang/Runnable;I)V
*/
JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_RunLater0
- (JNIEnv *env, jclass unused, jobject runnable, jint delay)
+ (JNIEnv *env, jclass unused, jboolean onMain, jobject runnable, jint delay)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
- RunOnThread (env, runnable, NO, delay);
+ RunOnThread (env, runnable, onMain ? YES : NO, delay);
[pool release];
}
/*
* Class: Java_jogamp_nativewindow_macosx_OSXUtil
* Method: IsMainThread0
- * Signature: (V)V
+ * Signature: (V)Z
*/
JNIEXPORT jboolean JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_IsMainThread0
(JNIEnv *env, jclass unused)
diff --git a/src/newt/classes/com/jogamp/newt/Display.java b/src/newt/classes/com/jogamp/newt/Display.java
index c618405..a0a0984 100644
--- a/src/newt/classes/com/jogamp/newt/Display.java
+++ b/src/newt/classes/com/jogamp/newt/Display.java
@@ -41,9 +41,11 @@ public abstract class Display {
public static final boolean DEBUG = Debug.debug("Display");
/** return precomputed hashCode from FQN {@link #getFQName()} */
+ @Override
public abstract int hashCode();
/** return true if obj is of type Display and both FQN {@link #getFQName()} equals */
+ @Override
public boolean equals(Object obj) {
if (this == obj) { return true; }
if (obj instanceof Display) {
@@ -78,7 +80,7 @@ public abstract class Display {
* Stop the running EDT in case this display is destroyed already.<br>
* @return true if EDT has been stopped (destroyed but running), otherwise false.
*/
- public abstract boolean validateEDT();
+ public abstract boolean validateEDTStopped();
/**
* @return true if the native display handle is valid and ready to operate,
@@ -114,9 +116,9 @@ public abstract class Display {
*/
public abstract int removeReference();
- /**
- * Return the {@link AbstractGraphicsDevice} used for depending resources lifecycle,
- * i.e. {@link Screen} and {@link Window}, as well as the event dispatching (EDT). */
+ /**
+ * Return the {@link AbstractGraphicsDevice} used for depending resources lifecycle,
+ * i.e. {@link Screen} and {@link Window}, as well as the event dispatching (EDT). */
public abstract AbstractGraphicsDevice getGraphicsDevice();
/**
@@ -136,8 +138,8 @@ public abstract class Display {
public abstract int getId();
/**
- * @return This display connection name as defined at creation time.
- * The display connection name is a technical platform specific detail, see {@link AbstractGraphicsDevice#getConnection()}.
+ * @return This display connection name as defined at creation time.
+ * The display connection name is a technical platform specific detail, see {@link AbstractGraphicsDevice#getConnection()}.
*
* @see AbstractGraphicsDevice#getConnection()
*/
@@ -154,11 +156,11 @@ public abstract class Display {
/**
* Sets a new {@link EDTUtil} and returns the previous one.
* <p>
- * If <code>usrEDTUtil</code> is <code>null</code>,
+ * If <code>usrEDTUtil</code> is <code>null</code>,
* the device's default EDTUtil is created and used.
* </p>
* <p>
- * If a previous one exists and it differs from <code>usrEDTUtil</code>,
+ * If a previous one exists and it differs from <code>usrEDTUtil</code>,
* it's being stopped, wait-until-idle.
* </p>
* <p>
@@ -167,7 +169,7 @@ public abstract class Display {
* </p>
*/
public abstract EDTUtil setEDTUtil(EDTUtil usrEDTUtil);
-
+
public abstract EDTUtil getEDTUtil();
/**
@@ -176,7 +178,7 @@ public abstract class Display {
public abstract boolean isEDTRunning();
public abstract void dispatchMessages();
-
+
// Global Displays
protected static final ArrayList<WeakReference<Display>> displayList = new ArrayList<WeakReference<Display>>();
protected static int displaysActive = 0;
@@ -193,12 +195,12 @@ public abstract class Display {
}
/**
- *
+ *
* @param type
* @param name
* @param fromIndex start index, then increasing until found or end of list
- * @paran shared if true, only shared instances are found, otherwise also exclusive
- * @return
+ * @paran shared if true, only shared instances are found, otherwise also exclusive
+ * @return
*/
public static Display getFirstDisplayOf(String type, String name, int fromIndex, boolean shared) {
return getDisplayOfImpl(type, name, fromIndex, 1, shared);
@@ -209,7 +211,7 @@ public abstract class Display {
* @param type
* @param name
* @param fromIndex start index, then decreasing until found or end of list. -1 is interpreted as size - 1.
- * @paran shared if true, only shared instances are found, otherwise also exclusive
+ * @paran shared if true, only shared instances are found, otherwise also exclusive
* @return
*/
public static Display getLastDisplayOf(String type, String name, int fromIndex, boolean shared) {
@@ -231,7 +233,7 @@ public abstract class Display {
} else {
if( display.getType().equals(type) &&
display.getName().equals(name) &&
- ( !shared || shared && !display.isExclusive() )
+ ( !shared || shared && !display.isExclusive() )
) {
return display;
}
@@ -241,7 +243,7 @@ public abstract class Display {
}
return null;
}
-
+
protected static void addDisplay2List(Display display) {
synchronized(displayList) {
// GC before add
@@ -256,7 +258,7 @@ public abstract class Display {
displayList.add(new WeakReference<Display>(display));
}
}
-
+
/** Returns the global display collection */
public static Collection<Display> getAllDisplays() {
ArrayList<Display> list;
diff --git a/src/newt/classes/com/jogamp/newt/MonitorDevice.java b/src/newt/classes/com/jogamp/newt/MonitorDevice.java
index 8bc7f40..28d9f53 100644
--- a/src/newt/classes/com/jogamp/newt/MonitorDevice.java
+++ b/src/newt/classes/com/jogamp/newt/MonitorDevice.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.newt;
import java.util.List;
@@ -36,7 +36,7 @@ import javax.media.nativewindow.util.RectangleImmutable;
import com.jogamp.common.util.ArrayHashSet;
-/**
+/**
* Visual output device, i.e. a CRT, LED ..consisting of it's components:<br>
* <ui>
* <li>Immutable
@@ -55,7 +55,7 @@ import com.jogamp.common.util.ArrayHashSet;
*/
public abstract class MonitorDevice {
protected final Screen screen; // backref
- protected final int nativeId; // unique monitor device ID
+ protected final int nativeId; // unique monitor device ID
protected final DimensionImmutable sizeMM; // in [mm]
protected final MonitorMode originalMode;
protected final ArrayHashSet<MonitorMode> supportedModes; // FIXME: May need to support mutable mode, i.e. adding modes on the fly!
@@ -73,20 +73,21 @@ public abstract class MonitorDevice {
this.viewport = viewport;
this.modeChanged = false;
}
-
+
/** Returns the {@link Screen} owning this monitor. */
public final Screen getScreen() {
return screen;
}
-
+
/**
- * Tests equality of two <code>MonitorDevice</code> objects
+ * Tests equality of two <code>MonitorDevice</code> objects
* by evaluating equality of it's components:<br>
* <ul>
* <li><code>nativeID</code></li>
* </ul>
* <br>
*/
+ @Override
public final boolean equals(Object obj) {
if (this == obj) { return true; }
if (obj instanceof MonitorDevice) {
@@ -102,13 +103,14 @@ public abstract class MonitorDevice {
* <li><code>nativeID</code></li>
* </ul>
*/
+ @Override
public final int hashCode() {
return nativeId;
}
-
+
/** @return the immutable unique native Id of this monitor device. */
public final int getId() { return nativeId; }
-
+
/**
* @return the immutable monitor size in millimeters.
*/
@@ -140,11 +142,11 @@ public abstract class MonitorDevice {
return supportedModes.getData();
}
- /** Returns the {@link RectangleImmutable rectangular} portion of the rotated virtual {@link Screen} size represented by this monitor. */
+ /** Returns the {@link RectangleImmutable rectangular} portion of the rotated virtual {@link Screen} size represented by this monitor. */
public final RectangleImmutable getViewport() {
return viewport;
}
-
+
/** Returns <code>true</code> if given coordinates are contained by this {@link #getViewport() viewport}, otherwise <code>false</code>. */
public final boolean contains(int x, int y) {
return x >= viewport.getX() &&
@@ -152,8 +154,8 @@ public abstract class MonitorDevice {
y >= viewport.getY() &&
y < viewport.getY() + viewport.getHeight() ;
}
-
- /**
+
+ /**
* Returns the coverage of given rectangle w/ this this {@link #getViewport() viewport}, i.e. between <code>0.0</code> and <code>1.0</code>.
* <p>
* Coverage is computed by:
@@ -161,12 +163,12 @@ public abstract class MonitorDevice {
* isect = viewport.intersection(r);
* coverage = area( isect ) / area( viewport ) ;
* </pre>
- * </p>
+ * </p>
*/
public final float coverage(RectangleImmutable r) {
return viewport.coverage(r);
}
-
+
/**
* Returns the union of the given monitor's {@link #getViewport() viewport}.
* @param result storage for result, will be returned
@@ -183,20 +185,17 @@ public abstract class MonitorDevice {
y1 = Math.min(y1, vp.getY());
y2 = Math.max(y2, vp.getY() + vp.getHeight());
}
- result.setX(x1);
- result.setY(y1);
- result.setWidth(x2 - x1);
- result.setHeight(y2 - y1);
+ result.set(x1, y1, x2 - x1, y2 - y1);
return result;
}
-
+
public final boolean isOriginalMode() {
return currentMode.hashCode() == originalMode.hashCode();
}
-
+
/**
* Returns <code>true</true> if the {@link MonitorMode}
- * has been changed programmatic via this API <i>only</i>, otherwise <code>false</code>.
+ * has been changed programmatic via this API <i>only</i>, otherwise <code>false</code>.
* <p>
* Note: We cannot guarantee that we won't interfere w/ another running
* application's screen mode change or vice versa.
@@ -205,7 +204,7 @@ public abstract class MonitorDevice {
public final boolean isModeChangedByUs() {
return modeChanged && !isOriginalMode();
}
-
+
/**
* Returns the cached current {@link MonitorMode} w/o native query.
* <p>
@@ -215,7 +214,7 @@ public abstract class MonitorDevice {
public final MonitorMode getCurrentMode() {
return currentMode;
}
-
+
/**
* Returns the current {@link MonitorMode} resulting from a native query.
* <p>
@@ -231,6 +230,7 @@ public abstract class MonitorDevice {
*/
public abstract boolean setCurrentMode(MonitorMode mode);
+ @Override
public String toString() {
return "Monitor[Id "+Display.toHexString(nativeId)+", "+sizeMM+" mm, viewport "+viewport+ ", 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 218cd8b..9690f18 100644
--- a/src/newt/classes/com/jogamp/newt/MonitorMode.java
+++ b/src/newt/classes/com/jogamp/newt/MonitorMode.java
@@ -37,7 +37,7 @@ import javax.media.nativewindow.util.SurfaceSize;
import com.jogamp.newt.util.MonitorModeUtil;
-/**
+/**
* Immutable MonitorMode Class, consisting of it's read only components:<br>
* <ul>
* <li>nativeId</li>
@@ -79,7 +79,7 @@ import com.jogamp.newt.util.MonitorModeUtil;
// Pick the monitor:
// Either the one used by a window ..
MonitorDevice monitor = window.getMainMonitor();
-
+
// Or arbitrary from the list ..
List<MonitorDevice> allMonitor = getMonitorDevices();
MonitorDevice monitor = allMonitor.get(0);
@@ -87,7 +87,7 @@ import com.jogamp.newt.util.MonitorModeUtil;
// Current and original modes ..
MonitorMode mmCurrent = monitor.queryCurrentMode();
MonitorMode mmOrig = monitor.getOriginalMode();
-
+
// Target resolution
Dimension res = new Dimension(800, 600);
@@ -102,7 +102,7 @@ import com.jogamp.newt.util.MonitorModeUtil;
monitorModes = MonitorModeUtil.filterByFlags(monitorModes, 0); // no interlace, double-scan etc
monitorModes = MonitorModeUtil.filterByRotation(monitorModes, rot);
monitorModes = MonitorModeUtil.filterByResolution(monitorModes, res);
- monitorModes = MonitorModeUtil.filterByRate(monitorModes, freq);
+ monitorModes = MonitorModeUtil.filterByRate(monitorModes, freq);
monitorModes = MonitorModeUtil.getHighestAvailableBpp(monitorModes);
// pick 1st one and set to current ..
@@ -111,20 +111,22 @@ import com.jogamp.newt.util.MonitorModeUtil;
* </pre>
*/
public class MonitorMode implements Comparable<MonitorMode> {
-
+
/** Comparator for 2 {@link MonitorMode}s, following comparison order as described in {@link MonitorMode#compareTo(MonitorMode)}, returning the ascending order. */
public static final Comparator<MonitorMode> monitorModeComparator = new Comparator<MonitorMode>() {
+ @Override
public int compare(MonitorMode mm1, MonitorMode mm2) {
return mm1.compareTo(mm2);
} };
-
+
/** Comparator for 2 {@link MonitorMode}s, following comparison order as described in {@link MonitorMode#compareTo(MonitorMode)}, returning the descending order. */
public static final Comparator<MonitorMode> monitorModeComparatorInv = new Comparator<MonitorMode>() {
+ @Override
public int compare(MonitorMode mm1, MonitorMode mm2) {
return mm2.compareTo(mm1);
} };
-
- /**
+
+ /**
* Immutable <i>surfaceSize, flags and refreshRate</i> Class, consisting of it's read only components:<br>
* <ul>
* <li>nativeId</li>
@@ -141,7 +143,7 @@ public class MonitorMode implements Comparable<MonitorMode> {
/** Vertical refresh rate */
public final float refreshRate;
public final int hashCode;
-
+
public SizeAndRRate(SurfaceSize surfaceSize, float refreshRate, int flags) {
if(null==surfaceSize) {
throw new IllegalArgumentException("surfaceSize must be set ("+surfaceSize+")");
@@ -151,11 +153,11 @@ public class MonitorMode implements Comparable<MonitorMode> {
this.refreshRate=refreshRate;
this.hashCode = getHashCode();
}
-
+
private final static String STR_INTERLACE = "Interlace";
private final static String STR_DOUBLESCAN = "DoubleScan";
private final static String STR_SEP = ", ";
-
+
public static final StringBuilder flags2String(int flags) {
final StringBuilder sb = new StringBuilder();
boolean sp = false;
@@ -172,14 +174,15 @@ public class MonitorMode implements Comparable<MonitorMode> {
}
return sb;
}
+ @Override
public final String toString() {
- return new String(surfaceSize+" @ "+refreshRate+" Hz, flags ["+flags2String(flags).toString()+"]");
+ return surfaceSize+" @ "+refreshRate+" Hz, flags ["+flags2String(flags).toString()+"]";
}
-
+
/**
* <p>
* Compares {@link SurfaceSize#compareTo(SurfaceSize) surfaceSize} 1st, then {@link #flags}, then {@link #refreshRate}.
- * </p>
+ * </p>
* <p>
* Flags are compared as follows:
* <pre>
@@ -196,7 +199,7 @@ public class MonitorMode implements Comparable<MonitorMode> {
final int rssz = surfaceSize.compareTo(sszr.surfaceSize);
if( 0 != rssz ) {
return rssz;
- }
+ }
final int tflags = 0 == flags ? Integer.MAX_VALUE : flags; // normalize NONE
final int xflags = 0 == sszr.flags ? Integer.MAX_VALUE : sszr.flags; // normalize NONE
if( tflags == xflags ) {
@@ -218,9 +221,9 @@ public class MonitorMode implements Comparable<MonitorMode> {
return 0;
}
}
-
+
/**
- * Tests equality of two {@link SizeAndRRate} objects
+ * Tests equality of two {@link SizeAndRRate} objects
* by evaluating equality of it's components:<br/>
* <ul>
* <li><code>surfaceSize</code></li>
@@ -228,6 +231,7 @@ public class MonitorMode implements Comparable<MonitorMode> {
* <li><code>flags</code></li>
* </ul>
*/
+ @Override
public final boolean equals(Object obj) {
if (this == obj) { return true; }
if (obj instanceof SizeAndRRate) {
@@ -238,7 +242,7 @@ public class MonitorMode implements Comparable<MonitorMode> {
}
return false;
}
-
+
/**
* Returns a combined hash code of it's elements:<br/>
* <ul>
@@ -247,18 +251,19 @@ public class MonitorMode implements Comparable<MonitorMode> {
* <li><code>refreshRate</code></li>
* </ul>
*/
+ @Override
public final int hashCode() {
return hashCode;
- }
+ }
private final int getHashCode() {
// 31 * x == (x << 5) - x
int hash = 31 + surfaceSize.hashCode();
hash = ((hash << 5) - hash) + flags;
hash = ((hash << 5) - hash) + (int)(refreshRate*100.0f);
return hash;
- }
+ }
}
-
+
/** zero rotation, compared to normal settings */
public static final int ROTATE_0 = 0;
@@ -270,15 +275,15 @@ public class MonitorMode implements Comparable<MonitorMode> {
/** 270 degrees CCW rotation */
public static final int ROTATE_270 = 270;
-
+
/** Frame is split into two fields. See {@link #getFlags()}. */
public static final int FLAG_INTERLACE = 1 << 0;
-
+
/** Lines are doubled. See {@link #getFlags()}. */
public static final int FLAG_DOUBLESCAN = 1 << 1;
/** The immutable native Id of this instance, which may not be unique. */
- private final int nativeId;
+ private final int nativeId;
private final SizeAndRRate sizeAndRRate;
private final int rotation;
private final int hashCode;
@@ -301,7 +306,7 @@ public class MonitorMode implements Comparable<MonitorMode> {
this.rotation = rotation;
this.hashCode = getHashCode();
}
-
+
/**
* Creates a user instance w/o {@link #getId() identity} to filter our matching modes w/ identity.
* <p>
@@ -314,16 +319,16 @@ public class MonitorMode implements Comparable<MonitorMode> {
*/
public MonitorMode(SurfaceSize surfaceSize, float refreshRate, int flags, int rotation) {
this(0, new SizeAndRRate(surfaceSize, refreshRate, flags), rotation);
- }
+ }
/** @return the immutable native Id of this mode, may not be unique, may be 0. */
public final int getId() { return nativeId; }
-
+
/** Returns the <i>surfaceSize and refreshRate</i> instance. */
- public final SizeAndRRate getSizeAndRRate() {
+ public final SizeAndRRate getSizeAndRRate() {
return sizeAndRRate;
}
-
+
/** Returns the unrotated {@link SurfaceSize} */
public final SurfaceSize getSurfaceSize() {
return sizeAndRRate.surfaceSize;
@@ -338,28 +343,29 @@ public class MonitorMode implements Comparable<MonitorMode> {
public final int getFlags() {
return sizeAndRRate.flags;
}
-
+
/** Returns the CCW rotation of this mode */
public final int getRotation() {
return rotation;
}
-
- /** Returns the rotated screen width,
+
+ /** Returns the rotated screen width,
* derived from <code>getMonitorMode().getSurfaceSize().getResolution()</code>
- * and <code>getRotation()</code>
+ * and <code>getRotation()</code>
*/
public final int getRotatedWidth() {
return getRotatedWH(true);
}
-
- /** Returns the rotated screen height,
+
+ /** Returns the rotated screen height,
* derived from <code>getMonitorMode().getSurfaceSize().getResolution()</code>
- * and <code>getRotation()</code>
+ * and <code>getRotation()</code>
*/
public final int getRotatedHeight() {
return getRotatedWH(false);
}
+ @Override
public final String toString() {
return "[Id "+Display.toHexString(nativeId)+", " + sizeAndRRate + ", " + rotation + " degr]";
}
@@ -367,9 +373,9 @@ public class MonitorMode implements Comparable<MonitorMode> {
/**
* <p>
* Compares {@link SizeAndRRate#compareTo(SizeAndRRate) sizeAndRRate} 1st, then {@link #rotation}.
- * </p>
+ * </p>
* <p>
- * Rotation is compared inverted, i.e. <code>360 - rotation</code>,
+ * Rotation is compared inverted, i.e. <code>360 - rotation</code>,
* so the lowest rotation reflects a higher value.
* </p>
* <p>
@@ -380,7 +386,7 @@ public class MonitorMode implements Comparable<MonitorMode> {
* <li>flags</li>
* <li>refresh rate</li>
* <li>rotation</li>
- * </ul>
+ * </ul>
* </p>
* {@inheritDoc}
*/
@@ -399,9 +405,9 @@ public class MonitorMode implements Comparable<MonitorMode> {
}
return 0;
}
-
+
/**
- * Tests equality of two {@link MonitorMode} objects
+ * Tests equality of two {@link MonitorMode} objects
* by evaluating equality of it's components:<br/>
* <ul>
* <li><code>nativeId</code></li>
@@ -409,6 +415,7 @@ public class MonitorMode implements Comparable<MonitorMode> {
* <li><code>rotation</code></li>
* </ul>
*/
+ @Override
public final boolean equals(Object obj) {
if (this == obj) { return true; }
if (obj instanceof MonitorMode) {
@@ -428,6 +435,7 @@ public class MonitorMode implements Comparable<MonitorMode> {
* <li><code>rotation</code></li>
* </ul>
*/
+ @Override
public final int hashCode() {
return hashCode;
}
@@ -438,7 +446,7 @@ public class MonitorMode implements Comparable<MonitorMode> {
hash = ((hash << 5) - hash) + getRotation();
return hash;
}
-
+
private final int getRotatedWH(boolean width) {
final DimensionImmutable d = sizeAndRRate.surfaceSize.getResolution();
final boolean swap = MonitorMode.ROTATE_90 == rotation || MonitorMode.ROTATE_270 == rotation ;
@@ -446,5 +454,5 @@ public class MonitorMode implements Comparable<MonitorMode> {
return d.getHeight();
}
return d.getWidth();
- }
+ }
}
diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java
index e66b2f6..5ae3f36 100644
--- a/src/newt/classes/com/jogamp/newt/NewtFactory.java
+++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package com.jogamp.newt;
@@ -53,16 +53,17 @@ public class NewtFactory {
public static final boolean DEBUG_IMPLEMENTATION = Debug.debug("Window");
public static final String DRIVER_DEFAULT_ROOT_PACKAGE = "jogamp.newt.driver";
-
+
static {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
NativeWindowFactory.initSingleton(); // last resort ..
-
+
// Work-around for initialization order problems on Mac OS X
// between native Newt and (apparently) Fmod
WindowImpl.init(NativeWindowFactory.getNativeWindowType(true));
-
+
return null;
} } );
}
@@ -75,7 +76,7 @@ public class NewtFactory {
clazzName = DRIVER_DEFAULT_ROOT_PACKAGE + packageName + "." + classBaseName ;
} else {
clazzName = packageName + "." + classBaseName ;
- }
+ }
try {
clazz = Class.forName(clazzName);
} catch (Throwable t) {
@@ -90,7 +91,7 @@ public class NewtFactory {
private static boolean useEDT = true;
- /**
+ /**
* Toggles the usage of an EventDispatchThread while creating a Display.<br>
* The default is enabled.<br>
* The EventDispatchThread is thread local to the Display instance.<br>
@@ -108,7 +109,7 @@ public class NewtFactory {
* Native creation is lazily done at usage, ie. {@link Display#addReference()}.
* </p>
* <p>
- * An already existing display connection of the same <code>name</code> will be reused.
+ * An already existing display connection of the same <code>name</code> will be reused.
* </p>
* @param name the display connection name which is a technical platform specific detail,
* see {@link AbstractGraphicsDevice#getConnection()}. Use <code>null</code> for default.
diff --git a/src/newt/classes/com/jogamp/newt/NewtVersion.java b/src/newt/classes/com/jogamp/newt/NewtVersion.java
index 9adb7aa..e70d63f 100644
--- a/src/newt/classes/com/jogamp/newt/NewtVersion.java
+++ b/src/newt/classes/com/jogamp/newt/NewtVersion.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.newt;
import com.jogamp.common.GlueGenVersion;
diff --git a/src/newt/classes/com/jogamp/newt/Screen.java b/src/newt/classes/com/jogamp/newt/Screen.java
index f56ee34..ef62ec9 100644
--- a/src/newt/classes/com/jogamp/newt/Screen.java
+++ b/src/newt/classes/com/jogamp/newt/Screen.java
@@ -39,7 +39,7 @@ import javax.media.nativewindow.NativeWindowException;
import javax.media.nativewindow.util.Rectangle;
import javax.media.nativewindow.util.RectangleImmutable;
-/**
+/**
* A screen may span multiple {@link MonitorDevice}s representing their combined virtual size.
*/
public abstract class Screen {
@@ -53,9 +53,11 @@ public abstract class Screen {
public static final boolean DEBUG = Debug.debug("Screen");
/** return precomputed hashCode from FQN {@link #getFQName()} */
+ @Override
public abstract int hashCode();
/** return true if obj is of type Display and both FQN {@link #getFQName()} equals */
+ @Override
public boolean equals(Object obj) {
if (this == obj) { return true; }
if (obj instanceof Screen) {
@@ -102,7 +104,7 @@ public abstract class Screen {
/**
* See {@link Display#addReference()}
- *
+ *
* @return number of references post operation
* @throws NativeWindowException if the native creation failed.
* @see #removeReference()
@@ -113,7 +115,7 @@ public abstract class Screen {
/**
* See {@link Display#removeReference()}
- *
+ *
* @return number of references post operation
* @see #addReference()
* @see #setDestroyWhenUnused(boolean)
@@ -132,12 +134,12 @@ public abstract class Screen {
* @return the x position of the virtual viewport's top-left origin.
*/
public abstract int getX();
-
+
/**
* @return the y position of the virtual viewport's top-left origin.
*/
public abstract int getY();
-
+
/**
* @return the <b>rotated</b> virtual viewport's width.
*/
@@ -152,19 +154,19 @@ public abstract class Screen {
* @return the <b>rotated</b> virtual viewport, i.e. origin and size.
*/
public abstract RectangleImmutable getViewport();
-
+
/**
* @return the associated Display
*/
public abstract Display getDisplay();
- /**
+ /**
* @return The screen fully qualified Screen name,
* which is a key of {@link com.jogamp.newt.Display#getFQName()} + {@link #getIndex()}.
*/
public abstract String getFQName();
- /**
+ /**
* Return a list of all {@link MonitorMode}s for all {@link MonitorDevice}s.
* <p>
* The list is ordered in descending order,
@@ -173,23 +175,23 @@ public abstract class Screen {
*/
public abstract List<MonitorMode> getMonitorModes();
- /**
+ /**
* Return a list of available {@link MonitorDevice}s.
*/
public abstract List<MonitorDevice> getMonitorDevices();
/**
- * Returns the {@link MonitorDevice} which {@link MonitorDevice#getViewport() viewport}
+ * Returns the {@link MonitorDevice} which {@link MonitorDevice#getViewport() viewport}
* {@link MonitorDevice#coverage(RectangleImmutable) covers} the given rectangle the most.
* <p>
- * If no coverage is detected the first {@link MonitorDevice} is returned.
+ * If no coverage is detected the first {@link MonitorDevice} is returned.
* </p>
*/
public final MonitorDevice getMainMonitor(RectangleImmutable r) {
MonitorDevice res = null;
float maxCoverage = Float.MIN_VALUE;
final List<MonitorDevice> monitors = getMonitorDevices();
- for(int i=monitors.size()-1; i>=0; i--) {
+ for(int i=monitors.size()-1; i>=0; i--) {
final MonitorDevice monitor = monitors.get(i);
final float coverage = monitor.coverage(r);
if( coverage > maxCoverage ) {
@@ -207,14 +209,14 @@ public abstract class Screen {
* Returns the union of all monitor's {@link MonitorDevice#getViewport() viewport}.
* <p>
* Should be equal to {@link #getX()}, {@link #getY()}, {@link #getWidth()} and {@link #getHeight()},
- * however, some native toolkits may choose a different virtual screen area.
+ * however, some native toolkits may choose a different virtual screen area.
* </p>
* @param result storage for result, will be returned
*/
public final Rectangle unionOfMonitorViewportSize(final Rectangle result) {
return MonitorDevice.unionOfViewports(result, getMonitorDevices());
}
-
+
/**
* @param sml {@link MonitorModeListener} to be added for {@link MonitorEvent}
*/
@@ -274,7 +276,7 @@ public abstract class Screen {
}
return null;
}
-
+
protected static void addScreen2List(Screen screen) {
synchronized(screenList) {
// GC before add
@@ -289,7 +291,7 @@ public abstract class Screen {
screenList.add(new WeakReference<Screen>(screen));
}
}
-
+
/** Returns the global screen collection */
public static Collection<Screen> getAllScreens() {
ArrayList<Screen> list;
@@ -308,7 +310,7 @@ public abstract class Screen {
}
return list;
}
-
+
public static int getActiveScreenNumber() {
synchronized(screenList) {
return screensActive;
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java
index f63c037..04eb07a 100644
--- a/src/newt/classes/com/jogamp/newt/Window.java
+++ b/src/newt/classes/com/jogamp/newt/Window.java
@@ -30,12 +30,14 @@ package com.jogamp.newt;
import java.util.List;
+import com.jogamp.newt.event.GestureHandler;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.event.WindowListener;
import com.jogamp.newt.event.KeyListener;
import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.InputEvent;
import com.jogamp.newt.event.MouseListener;
+
import jogamp.newt.Debug;
import jogamp.newt.WindowImpl;
@@ -56,8 +58,8 @@ import javax.media.nativewindow.util.RectangleImmutable;
* <li>... and more</li>
* </ul>
* <p>
- * One use case is {@link com.jogamp.newt.opengl.GLWindow}, which delegates
- * window operation to an instance of this interface while providing OpenGL
+ * One use case is {@link com.jogamp.newt.opengl.GLWindow}, which delegates
+ * window operation to an instance of this interface while providing OpenGL
* functionality.
* </p>
*/
@@ -88,14 +90,14 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
Screen getScreen();
/**
- * Returns the {@link MonitorDevice} which {@link MonitorDevice#getViewport() viewport}
+ * Returns the {@link MonitorDevice} which {@link MonitorDevice#getViewport() viewport}
* {@link MonitorDevice#coverage(RectangleImmutable) covers} this window the most.
* <p>
- * If no coverage is detected the first {@link MonitorDevice} is returned.
+ * If no coverage is detected the first {@link MonitorDevice} is returned.
* </p>
*/
MonitorDevice getMainMonitor();
-
+
/**
* Set the CapabilitiesChooser to help determine the native visual type.
*
@@ -127,7 +129,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
* Visibility is set to false.
* </p>
* <p>
- * Method sends out {@link WindowEvent#EVENT_WINDOW_DESTROY_NOTIFY pre-} and
+ * Method sends out {@link WindowEvent#EVENT_WINDOW_DESTROY_NOTIFY pre-} and
* {@link WindowEvent#EVENT_WINDOW_DESTROYED post-} destruction events
* to all of it's {@link WindowListener}.
* </p>
@@ -149,7 +151,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
* Set a custom action handling destruction issued by a {@link WindowImpl#windowDestroyNotify(boolean) toolkit triggered window destroy}
* replacing the default {@link #destroy()} action.
* <p>
- * The custom action shall call {@link #destroy()}
+ * The custom action shall call {@link #destroy()}
* but may perform further tasks before and after.
* </p>
*/
@@ -351,15 +353,32 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
* @param newParent The new parent NativeWindow. If null, this Window becomes a top level window.
*
* @return The issued reparent action type (strategy) as defined in Window.ReparentAction
+ * @see #reparentWindow(NativeWindow, int, int, boolean)
*/
ReparentOperation reparentWindow(NativeWindow newParent);
- ReparentOperation reparentWindow(NativeWindow newParent, boolean forceDestroyCreate);
+ /**
+ * Change this window's parent window.<br>
+ * <P>
+ * In case the old parent is not null and a Window,
+ * 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>
+ *
+ * @param newParent The new parent NativeWindow. If null, this Window becomes a top level window.
+ * @param x new top-level position, use -1 for default position.
+ * @param y new top-level position, use -1 for default position.
+ * @param forceDestroyCreate if true, uses re-creation strategy for reparenting, default is <code>false</code>.
+ *
+ * @return The issued reparent action type (strategy) as defined in Window.ReparentAction
+ * @see #reparentWindow(NativeWindow)
+ */
+ ReparentOperation reparentWindow(NativeWindow newParent, int x, int y, boolean forceDestroyCreate);
/**
* Enable or disable fullscreen mode for this window.
* <p>
- * Fullscreen mode is established on the {@link #getMainMonitor() main monitor}.
+ * Fullscreen mode is established on the {@link #getMainMonitor() main monitor}.
* </p>
* @param fullscreen enable or disable fullscreen mode
* @return success
@@ -374,14 +393,14 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
* <p>
* Disable fullscreen via {@link #setFullscreen(boolean)}.
* </p>
- * @param monitors if <code>null</code> fullscreen will be spanned across all {@link MonitorDevice}s,
+ * @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
* @see #setFullscreen(boolean)
* @see #isFullscreen()
*/
boolean setFullscreen(List<MonitorDevice> monitors);
-
+
boolean isFullscreen();
static interface FocusRunnable {
@@ -410,7 +429,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
* and to perform focus traversal with a 3rd party toolkit.
* </p>
* <p>
- * The {@link KeyListener} methods are not invoked for {@link KeyEvent#isAutoRepeat() auto-repeat} events.
+ * The {@link KeyListener} methods are not invoked for {@link KeyEvent#isAutoRepeat() auto-repeat} events.
* </p>
* @param l
*/
@@ -450,7 +469,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
/**
* Send a {@link WindowEvent} to all {@link WindowListener}.
- * @param eventType a {@link WindowEvent} type, e.g. {@link WindowEvent#EVENT_WINDOW_REPAINT}.
+ * @param eventType a {@link WindowEvent} type, e.g. {@link WindowEvent#EVENT_WINDOW_REPAINT}.
*/
public void sendWindowEvent(int eventType);
@@ -536,15 +555,12 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
//
/**
- *
- * Appends the given {@link com.jogamp.newt.event.MouseListener} to the end of
- * the list.
+ * Appends the given {@link MouseListener} to the end of the list.
*/
void addMouseListener(MouseListener l);
/**
- *
- * Inserts the given {@link com.jogamp.newt.event.MouseListener} at the
+ * Inserts the given {@link MouseListener} at the
* specified position in the list.<br>
*
* @param index Position where the listener will be inserted.
@@ -555,10 +571,61 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
*/
void addMouseListener(int index, MouseListener l);
+ /**
+ * Removes the given {@link MouseListener} from the list.
+ */
void removeMouseListener(MouseListener l);
+ /**
+ * Returns the {@link MouseListener} from the list at the given index.
+ */
MouseListener getMouseListener(int index);
+ /**
+ * Returns all {@link MouseListener}
+ */
MouseListener[] getMouseListeners();
+ /** Enable or disable default {@link GestureHandler}. Default is enabled. */
+ void setDefaultGesturesEnabled(boolean enable);
+ /** Return true if default {@link GestureHandler} are enabled. */
+ boolean areDefaultGesturesEnabled();
+ /**
+ * Appends the given {@link GestureHandler} to the end of the list.
+ */
+ void addGestureHandler(GestureHandler gh);
+ /**
+ * Inserts the given {@link GestureHandler} at the
+ * specified position in the list.<br>
+ *
+ * @param index Position where the listener will be inserted.
+ * Should be within (0 <= index && index <= size()).
+ * An index value of -1 is interpreted as the end of the list, size().
+ * @param l The listener object to be inserted
+ * @throws IndexOutOfBoundsException If the index is not within (0 <= index && index <= size()), or -1
+ */
+ void addGestureHandler(int index, GestureHandler gh);
+ /**
+ * Removes the given {@link GestureHandler} from the list.
+ */
+ void removeGestureHandler(GestureHandler gh);
+ /**
+ * Appends the given {@link GestureHandler.GestureListener} to the end of the list.
+ */
+ void addGestureListener(GestureHandler.GestureListener gl);
+ /**
+ * Inserts the given {@link GestureHandler.GestureListener} at the
+ * specified position in the list.<br>
+ *
+ * @param index Position where the listener will be inserted.
+ * Should be within (0 <= index && index <= size()).
+ * An index value of -1 is interpreted as the end of the list, size().
+ * @param l The listener object to be inserted
+ * @throws IndexOutOfBoundsException If the index is not within (0 <= index && index <= size()), or -1
+ */
+ void addGestureListener(int index, GestureHandler.GestureListener gl);
+ /**
+ * Removes the given {@link GestureHandler.GestureListener} from the list.
+ */
+ void removeGestureListener(GestureHandler.GestureListener gl);
}
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
index e4b5a25..70157fe 100644
--- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
+++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,21 +20,24 @@
* 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.newt.awt;
import java.awt.AWTKeyStroke;
import java.awt.Canvas;
import java.awt.Component;
+import java.awt.EventQueue;
import java.awt.Graphics;
+import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.KeyboardFocusManager;
+import java.awt.geom.NoninvertibleTransformException;
import java.beans.Beans;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -46,17 +49,24 @@ 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.GLDrawable;
+import javax.media.opengl.GLDrawableFactory;
import javax.swing.MenuSelectionManager;
import jogamp.nativewindow.awt.AWTMisc;
+import jogamp.nativewindow.jawt.JAWTUtil;
import jogamp.newt.Debug;
import jogamp.newt.WindowImpl;
import jogamp.newt.awt.NewtFactoryAWT;
import jogamp.newt.awt.event.AWTParentWindowAdapter;
import jogamp.newt.driver.DriverClearFocus;
+import jogamp.opengl.awt.AWTTilePainter;
-import com.jogamp.common.os.Platform;
import com.jogamp.common.util.awt.AWTEDTExecutor;
+import com.jogamp.nativewindow.awt.AWTPrintLifecycle;
import com.jogamp.nativewindow.awt.AWTWindowClosingProtocol;
import com.jogamp.nativewindow.awt.JAWTWindow;
import com.jogamp.newt.Display;
@@ -69,18 +79,20 @@ import com.jogamp.newt.event.WindowListener;
import com.jogamp.newt.event.awt.AWTAdapter;
import com.jogamp.newt.event.awt.AWTKeyAdapter;
import com.jogamp.newt.event.awt.AWTMouseAdapter;
+import com.jogamp.opengl.util.GLDrawableUtil;
+import com.jogamp.opengl.util.TileRenderer;
/**
* AWT {@link java.awt.Canvas Canvas} containing a NEWT {@link Window} using native parenting.
- *
+ *
* <h5><A NAME="java2dgl">Offscreen Layer Remarks</A></h5>
- *
+ *
* {@link OffscreenLayerOption#setShallUseOffscreenLayer(boolean) setShallUseOffscreenLayer(true)}
- * maybe called to use an offscreen drawable (FBO or PBuffer) allowing
+ * maybe called to use an offscreen drawable (FBO or PBuffer) allowing
* the underlying JAWT mechanism to composite the image, if supported.
*/
@SuppressWarnings("serial")
-public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProtocol, OffscreenLayerOption {
+public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProtocol, OffscreenLayerOption, AWTPrintLifecycle {
public static final boolean DEBUG = Debug.debug("Window");
private JAWTWindow jawtWindow = null;
@@ -92,18 +104,20 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
private AWTParentWindowAdapter awtAdapter = null;
private AWTAdapter awtMouseAdapter = null;
private AWTAdapter awtKeyAdapter = null;
-
- private AWTWindowClosingProtocol awtWindowClosingProtocol =
+
+ private final AWTWindowClosingProtocol awtWindowClosingProtocol =
new AWTWindowClosingProtocol(this, new Runnable() {
+ @Override
public void run() {
NewtCanvasAWT.this.destroyImpl(false /* removeNotify */, true /* windowClosing */);
}
}, new Runnable() {
+ @Override
public void run() {
if( newtChild != null ) {
newtChild.sendWindowEvent(WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY);
}
- }
+ }
} );
/**
@@ -135,37 +149,41 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
super(gc);
setNEWTChild(child);
}
-
+
+ @Override
public void setShallUseOffscreenLayer(boolean v) {
shallUseOffscreenLayer = v;
}
-
+
+ @Override
public final boolean getShallUseOffscreenLayer() {
- return shallUseOffscreenLayer;
+ return shallUseOffscreenLayer;
}
-
- public final boolean isOffscreenLayerSurfaceEnabled() {
+
+ @Override
+ public final boolean isOffscreenLayerSurfaceEnabled() {
return jawtWindow.isOffscreenLayerSurfaceEnabled();
}
-
- /**
- * Returns true if the AWT component is parented to an {@link java.applet.Applet},
- * otherwise false. This information is valid only after {@link #addNotify()} is issued,
- * ie. before adding the component to the AWT tree and make it visible.
+
+ /**
+ * Returns true if the AWT component is parented to an {@link java.applet.Applet},
+ * otherwise false. This information is valid only after {@link #addNotify()} is issued,
+ * ie. before adding the component to the AWT tree and make it visible.
*/
public boolean isApplet() {
return jawtWindow.isApplet();
}
boolean isParent() {
- return null!=newtChild && jawtWindow == newtChild.getParent();
+ return null!=newtChild && jawtWindow == newtChild.getParent();
}
-
+
boolean isFullscreen() {
return null != newtChild && newtChild.isFullscreen();
}
-
+
class FocusAction implements Window.FocusRunnable {
+ @Override
public boolean run() {
final boolean isParent = isParent();
final boolean isFullscreen = isFullscreen();
@@ -186,8 +204,8 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
return false; // NEWT shall proceed requesting the native focus
}
}
- private FocusAction focusAction = new FocusAction();
-
+ private final FocusAction focusAction = new FocusAction();
+
WindowListener clearAWTMenusOnNewtFocus = new WindowAdapter() {
@Override
public void windowResized(WindowEvent e) {
@@ -202,25 +220,27 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
};
class FocusTraversalKeyListener implements KeyListener {
+ @Override
public void keyPressed(KeyEvent e) {
if( isParent() && !isFullscreen() ) {
handleKey(e, false);
}
}
+ @Override
public void keyReleased(KeyEvent e) {
if( isParent() && !isFullscreen() ) {
handleKey(e, true);
}
}
-
- void handleKey(KeyEvent evt, boolean onRelease) {
+
+ void handleKey(KeyEvent evt, boolean onRelease) {
if(null == keyboardFocusManager) {
throw new InternalError("XXX");
}
final AWTKeyStroke ks = AWTKeyStroke.getAWTKeyStroke(evt.getKeyCode(), evt.getModifiers(), onRelease);
boolean suppress = false;
if(null != ks) {
- final Set<AWTKeyStroke> fwdKeys = keyboardFocusManager.getDefaultFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
+ final Set<AWTKeyStroke> fwdKeys = keyboardFocusManager.getDefaultFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
final Set<AWTKeyStroke> bwdKeys = keyboardFocusManager.getDefaultFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
if(fwdKeys.contains(ks)) {
final Component nextFocus = AWTMisc.getNextFocus(NewtCanvasAWT.this, true /* forward */);
@@ -241,33 +261,39 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
}
}
if(suppress) {
- evt.setConsumed(true);
+ evt.setConsumed(true);
}
if(DEBUG) {
System.err.println("NewtCanvasAWT.focusKey: XXX: "+ks);
}
}
}
- private final FocusTraversalKeyListener newtFocusTraversalKeyListener = new FocusTraversalKeyListener();
+ private final FocusTraversalKeyListener newtFocusTraversalKeyListener = new FocusTraversalKeyListener();
class FocusPropertyChangeListener implements PropertyChangeListener {
+ @Override
public void propertyChange(PropertyChangeEvent evt) {
final Object oldF = evt.getOldValue();
final Object newF = evt.getNewValue();
final boolean isParent = isParent();
- final boolean isFullscreen = isFullscreen();
+ final boolean isFullscreen = isFullscreen();
if(DEBUG) {
System.err.println("NewtCanvasAWT.FocusProperty: "+evt.getPropertyName()+", src "+evt.getSource()+", "+oldF+" -> "+newF+", isParent "+isParent+", isFS "+isFullscreen);
}
if(isParent && !isFullscreen) {
- if(oldF == NewtCanvasAWT.this && newF == null) {
+ if(newF == NewtCanvasAWT.this) {
+ if(DEBUG) {
+ System.err.println("NewtCanvasAWT.FocusProperty: AWT focus -> NEWT focus traversal");
+ }
+ requestFocusNEWTChild();
+ } else if(oldF == NewtCanvasAWT.this && newF == null) {
// focus traversal to NEWT - NOP
- if(DEBUG) {
- System.err.println("NewtCanvasAWT.FocusProperty: NEWT focus traversal");
+ if(DEBUG) {
+ System.err.println("NewtCanvasAWT.FocusProperty: NEWT focus");
}
} else if(null != newF && newF != NewtCanvasAWT.this) {
// focus traversal to another AWT component
- if(DEBUG) {
+ if(DEBUG) {
System.err.println("NewtCanvasAWT.FocusProperty: lost focus - clear focus");
}
if(newtChild.getDelegatedWindow() instanceof DriverClearFocus) {
@@ -275,22 +301,33 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
}
}
}
- }
+ }
}
private final FocusPropertyChangeListener focusPropertyChangeListener = new FocusPropertyChangeListener();
private volatile KeyboardFocusManager keyboardFocusManager = null;
- /**
+ private final void requestFocusNEWTChild() {
+ if(null!=newtChild) {
+ newtChild.setFocusAction(null);
+ if(isOnscreen) {
+ KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
+ }
+ newtChild.requestFocus();
+ newtChild.setFocusAction(focusAction);
+ }
+ }
+
+ /**
* Sets a new NEWT child, provoking reparenting.
* <p>
* A previously detached <code>newChild</code> will be released to top-level status
- * and made invisible.
+ * and made invisible.
* </p>
* <p>
- * Note: When switching NEWT child's, detaching the previous first via <code>setNEWTChild(null)</code>
- * produced much cleaner visual results.
+ * Note: When switching NEWT child's, detaching the previous first via <code>setNEWTChild(null)</code>
+ * produced much cleaner visual results.
* </p>
- * @return the previous attached newt child.
+ * @return the previous attached newt child.
*/
public Window setNEWTChild(Window newChild) {
final Window prevChild = newtChild;
@@ -308,17 +345,17 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
updateLayoutSize();
// will be done later at paint/display/..: attachNewtChild(cont);
-
+
return prevChild;
}
-
+
private final void updateLayoutSize() {
if( null != newtChild ) {
// use NEWT child's size for min/pref size!
java.awt.Dimension minSize = new java.awt.Dimension(newtChild.getWidth(), newtChild.getHeight());
setMinimumSize(minSize);
setPreferredSize(minSize);
- }
+ }
}
/** @return the current NEWT child */
@@ -329,11 +366,13 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
/** @return this AWT Canvas NativeWindow representation, may be null in case {@link #removeNotify()} has been called,
* or {@link #addNotify()} hasn't been called yet.*/
public NativeWindow getNativeWindow() { return jawtWindow; }
-
+
+ @Override
public WindowClosingMode getDefaultCloseOperation() {
return awtWindowClosingProtocol.getDefaultCloseOperation();
}
+ @Override
public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) {
return awtWindowClosingProtocol.setDefaultCloseOperation(op);
}
@@ -345,16 +384,16 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
} else {
// before native peer is valid: X11
disableBackgroundErase();
-
+
// creates the native peer
super.addNotify();
-
+
// after native peer is valid: Windows
disableBackgroundErase();
-
- jawtWindow = NewtFactoryAWT.getNativeWindow(this, null != newtChild ? newtChild.getRequestedCapabilities() : null);
+
+ jawtWindow = NewtFactoryAWT.getNativeWindow(this, null != newtChild ? newtChild.getRequestedCapabilities() : null);
jawtWindow.setShallUseOffscreenLayer(shallUseOffscreenLayer);
-
+
if(DEBUG) {
// if ( isShowing() == false ) -> Container was not visible yet.
// if ( isShowing() == true ) -> Container is already visible.
@@ -369,7 +408,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
@Override
public void removeNotify() {
awtWindowClosingProtocol.removeClosingListener();
-
+
if( Beans.isDesignTime() ) {
super.removeNotify();
} else {
@@ -391,7 +430,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
public final void destroy() {
destroyImpl(false /* removeNotify */, false /* windowClosing */);
}
-
+
private final void destroyImpl(boolean removeNotify, boolean windowClosing) {
if( null !=newtChild ) {
java.awt.Container cont = AWTMisc.getContainer(this);
@@ -399,7 +438,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
System.err.println("NewtCanvasAWT.destroy(removeNotify "+removeNotify+", windowClosing "+windowClosing+"): nw "+newtWinHandleToHexString(newtChild)+", from "+cont);
}
detachNewtChild(cont);
-
+
if( !removeNotify ) {
final Window cWin = newtChild;
final Window dWin = cWin.getDelegatedWindow();
@@ -409,17 +448,17 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
} else {
cWin.destroy();
}
- }
+ }
}
if( ( removeNotify || windowClosing ) && null!=jawtWindow ) {
NewtFactoryAWT.destroyNativeWindow(jawtWindow);
jawtWindow=null;
- }
+ }
}
-
+
@Override
public void paint(Graphics g) {
- if( validateComponent(true) ) {
+ if( validateComponent(true) && !printActive ) {
newtChild.windowRepaint(0, 0, getWidth(), getHeight());
}
}
@@ -441,49 +480,169 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
}
}
}
-
- private final void requestFocusNEWTChild() {
- if(null!=newtChild) {
- newtChild.setFocusAction(null);
- if(isOnscreen) {
- KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
- }
- newtChild.requestFocus();
- newtChild.setFocusAction(focusAction);
+
+ private volatile boolean printActive = false;
+ private GLAnimatorControl printAnimator = null;
+ private GLAutoDrawable printGLAD = null;
+ private AWTTilePainter printAWTTiles = null;
+
+ private final GLAutoDrawable getGLAD() {
+ if( null != newtChild && newtChild instanceof GLAutoDrawable ) {
+ return (GLAutoDrawable)newtChild;
}
+ return null;
}
@Override
- public void requestFocus() {
- super.requestFocus();
- requestFocusNEWTChild();
- }
+ public void setupPrint(double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight) {
+ printActive = true;
+ final int componentCount = isOpaque() ? 3 : 4;
+ final TileRenderer printRenderer = new TileRenderer();
+ printAWTTiles = new AWTTilePainter(printRenderer, componentCount, scaleMatX, scaleMatY, numSamples, tileWidth, tileHeight, DEBUG);
+ AWTEDTExecutor.singleton.invoke(getTreeLock(), true /* allowOnNonEDT */, true /* wait */, setupPrintOnEDT);
+ }
+ private final Runnable setupPrintOnEDT = new Runnable() {
+ @Override
+ public void run() {
+ if( !validateComponent(true) ) {
+ if(DEBUG) {
+ System.err.println(getThreadName()+": Info: NewtCanvasAWT setupPrint - skipped GL render, drawable not valid yet");
+ }
+ printActive = false;
+ return; // not yet available ..
+ }
+ if( !isVisible() ) {
+ if(DEBUG) {
+ System.err.println(getThreadName()+": Info: NewtCanvasAWT setupPrint - skipped GL render, drawable visible");
+ }
+ printActive = false;
+ return; // not yet available ..
+ }
+ final GLAutoDrawable glad = getGLAD();
+ if( null == glad ) {
+ if( DEBUG ) {
+ System.err.println("AWT print.setup exit, newtChild not a GLAutoDrawable: "+newtChild);
+ }
+ printActive = false;
+ return;
+ }
+ printAnimator = glad.getAnimator();
+ if( null != printAnimator ) {
+ printAnimator.remove(glad);
+ }
+ printGLAD = glad; // _not_ default, shall be replaced by offscreen GLAD
+ final GLCapabilities caps = (GLCapabilities)glad.getChosenGLCapabilities().cloneMutable();
+ final int printNumSamples = printAWTTiles.getNumSamples(caps);
+ GLDrawable printDrawable = printGLAD.getDelegatedDrawable();
+ final boolean reqNewGLADSamples = printNumSamples != caps.getNumSamples();
+ final boolean reqNewGLADSize = printAWTTiles.customTileWidth != -1 && printAWTTiles.customTileWidth != printDrawable.getWidth() ||
+ printAWTTiles.customTileHeight != -1 && printAWTTiles.customTileHeight != printDrawable.getHeight();
+ final boolean reqNewGLADOnscrn = caps.isOnscreen();
+
+ // It is desired to use a new offscreen GLAD, however Bug 830 forbids this for AA onscreen context.
+ // Bug 830: swapGLContextAndAllGLEventListener and onscreen MSAA w/ NV/GLX
+ final boolean reqNewGLAD = !caps.getSampleBuffers() && ( reqNewGLADOnscrn || reqNewGLADSamples || reqNewGLADSize );
+ if( DEBUG ) {
+ System.err.println("AWT print.setup: reqNewGLAD "+reqNewGLAD+"[ onscreen "+reqNewGLADOnscrn+", samples "+reqNewGLADSamples+", size "+reqNewGLADSize+"], "+
+ ", drawableSize "+printDrawable.getWidth()+"x"+printDrawable.getHeight()+
+ ", customTileSize "+printAWTTiles.customTileWidth+"x"+printAWTTiles.customTileHeight+
+ ", scaleMat "+printAWTTiles.scaleMatX+" x "+printAWTTiles.scaleMatY+
+ ", numSamples "+printAWTTiles.customNumSamples+" -> "+printNumSamples+", printAnimator "+printAnimator);
+ }
+ if( reqNewGLAD ) {
+ caps.setDoubleBuffered(false);
+ caps.setOnscreen(false);
+ if( printNumSamples != caps.getNumSamples() ) {
+ caps.setSampleBuffers(0 < printNumSamples);
+ caps.setNumSamples(printNumSamples);
+ }
+ final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
+ printGLAD = factory.createOffscreenAutoDrawable(null, caps, null,
+ printAWTTiles.customTileWidth != -1 ? printAWTTiles.customTileWidth : DEFAULT_PRINT_TILE_SIZE,
+ printAWTTiles.customTileHeight != -1 ? printAWTTiles.customTileHeight : DEFAULT_PRINT_TILE_SIZE);
+ GLDrawableUtil.swapGLContextAndAllGLEventListener(glad, printGLAD);
+ printDrawable = printGLAD.getDelegatedDrawable();
+ }
+ printAWTTiles.setIsGLOriented(printGLAD.isGLOriented());
+ printAWTTiles.renderer.setTileSize(printDrawable.getWidth(), printDrawable.getHeight(), 0);
+ printAWTTiles.renderer.attachAutoDrawable(printGLAD);
+ if( DEBUG ) {
+ System.err.println("AWT print.setup "+printAWTTiles);
+ System.err.println("AWT print.setup AA "+printNumSamples+", "+caps);
+ System.err.println("AWT print.setup printGLAD: "+printGLAD.getWidth()+"x"+printGLAD.getHeight()+", "+printGLAD);
+ System.err.println("AWT print.setup printDraw: "+printDrawable.getWidth()+"x"+printDrawable.getHeight()+", "+printDrawable);
+ }
+ }
+ };
@Override
- public boolean requestFocus(boolean temporary) {
- final boolean res = super.requestFocus(temporary);
- if(res) {
- requestFocusNEWTChild();
+ public void releasePrint() {
+ if( !printActive || null == printGLAD ) {
+ throw new IllegalStateException("setupPrint() not called");
}
- return res;
+ // sendReshape = false; // clear reshape flag
+ AWTEDTExecutor.singleton.invoke(getTreeLock(), true /* allowOnNonEDT */, true /* wait */, releasePrintOnEDT);
+ newtChild.sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout to listener
}
+ private final Runnable releasePrintOnEDT = new Runnable() {
+ @Override
+ public void run() {
+ if( DEBUG ) {
+ System.err.println("AWT print.release "+printAWTTiles);
+ }
+ final GLAutoDrawable glad = getGLAD();
+ printAWTTiles.dispose();
+ printAWTTiles= null;
+ if( printGLAD != glad ) {
+ GLDrawableUtil.swapGLContextAndAllGLEventListener(printGLAD, glad);
+ printGLAD.destroy();
+ }
+ printGLAD = null;
+ if( null != printAnimator ) {
+ printAnimator.add(glad);
+ printAnimator = null;
+ }
+ printActive = false;
+ }
+ };
@Override
- public boolean requestFocusInWindow() {
- final boolean res = super.requestFocusInWindow();
- if(res) {
- requestFocusNEWTChild();
+ public void print(Graphics graphics) {
+ if( !printActive || null == printGLAD ) {
+ throw new IllegalStateException("setupPrint() not called");
+ }
+ if(DEBUG && !EventQueue.isDispatchThread()) {
+ System.err.println(getThreadName()+": Warning: GLCanvas print - not called from AWT-EDT");
+ // we cannot dispatch print on AWT-EDT due to printing internal locking ..
}
- return res;
- }
- @Override
- public boolean requestFocusInWindow(boolean temporary) {
- final boolean res = super.requestFocusInWindow(temporary);
- if(res) {
- requestFocusNEWTChild();
+ final Graphics2D g2d = (Graphics2D)graphics;
+ try {
+ printAWTTiles.setupGraphics2DAndClipBounds(g2d, getWidth(), getHeight());
+ final TileRenderer tileRenderer = printAWTTiles.renderer;
+ if( DEBUG ) {
+ System.err.println("AWT print.0: "+tileRenderer);
+ }
+ if( !tileRenderer.eot() ) {
+ try {
+ do {
+ tileRenderer.display();
+ } while ( !tileRenderer.eot() );
+ if( DEBUG ) {
+ System.err.println("AWT print.1: "+printAWTTiles);
+ }
+ tileRenderer.reset();
+ } finally {
+ printAWTTiles.resetGraphics2D();
+ }
+ }
+ } catch (NoninvertibleTransformException nte) {
+ System.err.println("Catched: Inversion failed of: "+g2d.getTransform());
+ nte.printStackTrace();
+ }
+ if( DEBUG ) {
+ System.err.println("AWT print.X: "+printAWTTiles);
}
- return res;
}
private final boolean validateComponent(boolean attachNewtChild) {
@@ -496,14 +655,14 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
if( 0 >= getWidth() || 0 >= getHeight() ) {
return false;
}
-
+
if( attachNewtChild && !newtChildAttached && null != newtChild ) {
attachNewtChild();
}
return true;
}
-
+
private final void configureNewtChild(boolean attach) {
if(null!=awtAdapter) {
awtAdapter.removeFrom(this);
@@ -521,13 +680,13 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
keyboardFocusManager.removePropertyChangeListener("focusOwner", focusPropertyChangeListener);
keyboardFocusManager = null;
}
-
+
if( null != newtChild ) {
newtChild.setKeyboardFocusHandler(null);
if(attach) {
if(null == jawtWindow.getGraphicsConfiguration()) {
throw new InternalError("XXX");
- }
+ }
isOnscreen = jawtWindow.getGraphicsConfiguration().getChosenCapabilities().isOnscreen();
awtAdapter = (AWTParentWindowAdapter) new AWTParentWindowAdapter(jawtWindow, newtChild).addTo(this);
awtAdapter.removeWindowClosingFrom(this); // we utilize AWTWindowClosingProtocol triggered destruction!
@@ -583,18 +742,20 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
newtChild.setSize(w, h);
newtChild.reparentWindow(jawtWindow);
newtChild.addSurfaceUpdatedListener(jawtWindow);
- if( Platform.OSType.MACOS == Platform.getOSType() && jawtWindow.isOffscreenLayerSurfaceEnabled() ) {
+ if( jawtWindow.isOffscreenLayerSurfaceEnabled() &&
+ 0 != ( JAWTUtil.JAWT_OSX_CALAYER_QUIRK_POSITION & JAWTUtil.getOSXCALayerQuirks() ) ) {
AWTEDTExecutor.singleton.invoke(false, forceRelayout);
}
newtChild.setVisible(true);
configureNewtChild(true);
newtChild.sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout to listener
-
+
if(DEBUG) {
System.err.println("NewtCanvasAWT.attachNewtChild.X: win "+newtWinHandleToHexString(newtChild)+", EDTUtil: cur "+newtChild.getScreen().getDisplay().getEDTUtil()+", comp "+this);
}
}
private final Runnable forceRelayout = new Runnable() {
+ @Override
public void run() {
if(DEBUG) {
System.err.println("NewtCanvasAWT.forceRelayout.0");
@@ -609,7 +770,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
System.err.println("NewtCanvasAWT.forceRelayout.X");
}
} };
-
+
private final void detachNewtChild(java.awt.Container cont) {
if( null == newtChild || null == jawtWindow || !newtChildAttached ) {
return; // nop
@@ -623,14 +784,14 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
", cont "+cont);
}
- newtChild.removeSurfaceUpdatedListener(jawtWindow);
+ newtChild.removeSurfaceUpdatedListener(jawtWindow);
newtChildAttached = false;
newtChild.setFocusAction(null); // no AWT focus traversal ..
configureNewtChild(false);
newtChild.setVisible(false);
-
+
newtChild.reparentWindow(null); // will destroy context (offscreen -> onscreen) and implicit detachSurfaceLayer
-
+
if(DEBUG) {
System.err.println("NewtCanvasAWT.detachNewtChild.X: win "+newtWinHandleToHexString(newtChild)+", EDTUtil: cur "+newtChild.getScreen().getDisplay().getEDTUtil()+", comp "+this);
}
@@ -647,6 +808,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
if (!disableBackgroundEraseInitialized) {
try {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
try {
Class<?> clazz = getToolkit().getClass();
@@ -685,7 +847,9 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
}
}
}
-
+
+ protected static String getThreadName() { return Thread.currentThread().getName(); }
+
static String newtWinHandleToHexString(Window w) {
return null != w ? toHexString(w.getWindowHandle()) : "nil";
}
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 e8cd715..409f783 100644
--- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java
+++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java
@@ -42,16 +42,17 @@ import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLProfile;
-import com.jogamp.common.os.Platform;
+import jogamp.nativewindow.jawt.JAWTUtil;
+
import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.opengl.GLWindow;
-/**
+/**
* Simple GLEventListener deployment as an applet using JOGL. This demo must be
* referenced from a web page via an <applet> tag.
- *
+ *
* <p>
- * Example of an applet tag using GearsES2 within the applet area (normal case):
+ * Example of an applet tag using GearsES2 within the applet area (normal case):
* <pre>
<applet width=100 height=100>
<param name="java_arguments" value="-Dsun.java2d.noddraw=true">
@@ -64,9 +65,9 @@ import com.jogamp.newt.opengl.GLWindow;
</applet>Hello Gears !
* </pre>
* </p>
- *
+ *
* <p>
- * Example of an applet tag using GearsES2 in an undecorated, translucent, closeable and always-on-top window:
+ * Example of an applet tag using GearsES2 in an undecorated, translucent, closeable and always-on-top window:
* <pre>
<applet width=1 height=1>
<param name="java_arguments" value="-Dsun.java2d.noddraw=true">
@@ -94,13 +95,14 @@ import com.jogamp.newt.opengl.GLWindow;
@SuppressWarnings("serial")
public class JOGLNewtApplet1Run extends Applet {
public static final boolean DEBUG = JOGLNewtAppletBase.DEBUG;
-
+
GLWindow glWindow = null;
NewtCanvasAWT newtCanvasAWT = null;
JOGLNewtAppletBase base = null;
/** if valid glStandalone:=true (own window) ! */
- int glXd=Integer.MAX_VALUE, glYd=Integer.MAX_VALUE, glWidth=Integer.MAX_VALUE, glHeight=Integer.MAX_VALUE;
+ int glXd=Integer.MAX_VALUE, glYd=Integer.MAX_VALUE, glWidth=Integer.MAX_VALUE, glHeight=Integer.MAX_VALUE;
+ @Override
public void init() {
if(DEBUG) {
System.err.println("JOGLNewtApplet1Run.init() START");
@@ -134,7 +136,7 @@ public class JOGLNewtApplet1Run extends Applet {
glCloseable = JOGLNewtAppletBase.str2Bool(getParameter("gl_closeable"), glCloseable);
glOpaque = JOGLNewtAppletBase.str2Bool(getParameter("gl_opaque"), glOpaque);
glAlphaBits = JOGLNewtAppletBase.str2Int(getParameter("gl_alpha"), glAlphaBits);
- glNumMultisampleBuffer = JOGLNewtAppletBase.str2Int(getParameter("gl_multisamplebuffer"), glNumMultisampleBuffer);
+ glNumMultisampleBuffer = JOGLNewtAppletBase.str2Int(getParameter("gl_multisamplebuffer"), glNumMultisampleBuffer);
glXd = JOGLNewtAppletBase.str2Int(getParameter("gl_dx"), glXd);
glYd = JOGLNewtAppletBase.str2Int(getParameter("gl_dy"), glYd);
glWidth = JOGLNewtAppletBase.str2Int(getParameter("gl_width"), glWidth);
@@ -167,8 +169,8 @@ public class JOGLNewtApplet1Run extends Applet {
System.err.println("glNumMultisampleBuffer: "+glNumMultisampleBuffer);
System.err.println("glNoDefaultKeyListener: "+glNoDefaultKeyListener);
}
-
- base = new JOGLNewtAppletBase(glEventListenerClazzName,
+
+ base = new JOGLNewtAppletBase(glEventListenerClazzName,
glSwapInterval,
glNoDefaultKeyListener,
glCloseable,
@@ -222,6 +224,7 @@ public class JOGLNewtApplet1Run extends Applet {
}
}
+ @Override
public void start() {
if(DEBUG) {
System.err.println("JOGLNewtApplet1Run.start() START (isVisible "+isVisible()+", isDisplayable "+isDisplayable()+")");
@@ -251,7 +254,9 @@ public class JOGLNewtApplet1Run extends Applet {
System.err.println("GLWindow: "+glWindow);
}
base.start();
- if( null != newtCanvasAWT && Platform.OSType.MACOS == Platform.getOSType() && newtCanvasAWT.isOffscreenLayerSurfaceEnabled() ) {
+ if( null != newtCanvasAWT &&
+ newtCanvasAWT.isOffscreenLayerSurfaceEnabled() &&
+ 0 != ( JAWTUtil.JAWT_OSX_CALAYER_QUIRK_POSITION & JAWTUtil.getOSXCALayerQuirks() ) ) {
// force relayout
final int cW = newtCanvasAWT.getWidth();
final int cH = newtCanvasAWT.getHeight();
@@ -263,6 +268,7 @@ public class JOGLNewtApplet1Run extends Applet {
}
}
+ @Override
public void stop() {
if(DEBUG) {
System.err.println("JOGLNewtApplet1Run.stop() START");
@@ -273,6 +279,7 @@ public class JOGLNewtApplet1Run extends Applet {
}
}
+ @Override
public void destroy() {
if(DEBUG) {
System.err.println("JOGLNewtApplet1Run.destroy() START");
diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
index 25ddfad..d17d2e7 100644
--- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
+++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
@@ -33,6 +33,7 @@ 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;
@@ -56,7 +57,7 @@ import com.jogamp.opengl.util.Animator;
public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
public static final boolean DEBUG = Debug.debug("Applet");
-
+
String glEventListenerClazzName;
int glSwapInterval;
boolean noDefaultKeyListener;
@@ -70,13 +71,13 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
boolean isValid = false;
NativeWindow awtParent;
- public JOGLNewtAppletBase(String glEventListenerClazzName,
+ public JOGLNewtAppletBase(String glEventListenerClazzName,
int glSwapInterval,
boolean noDefaultKeyListener,
boolean glClosable,
boolean glDebug,
boolean glTrace) {
-
+
this.glEventListenerClazzName=glEventListenerClazzName;
this.glSwapInterval=glSwapInterval;
this.noDefaultKeyListener = noDefaultKeyListener;
@@ -111,6 +112,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
try {
final Class<?> clazz = AccessController.doPrivileged(new PrivilegedAction<Class<?>>() {
+ @Override
public Class<?> run() {
final ClassLoader cl = Thread.currentThread().getContextClassLoader();
Class<?> clazz = null;
@@ -168,13 +170,14 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
if(null == glWindow.getParent()) {
// we may be called directly by the native EDT
new Thread(new Runnable() {
+ @Override
public void run() {
if( glWindow.isNativeValid() ) {
glWindow.reparentWindow(awtParent);
}
}
- }).start();
- }
+ }).start();
+ }
}
} } );
@@ -202,7 +205,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
if(glEventListener instanceof KeyListener) {
glWindow.addKeyListener((KeyListener)glEventListener);
}
-
+
if(!noDefaultKeyListener) {
glWindow.addKeyListener(this);
}
@@ -215,7 +218,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
glAnimator.setThreadGroup(tg);
glAnimator.add(glWindow);
glAnimator.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, null);
-
+
} catch (Throwable t) {
throw new RuntimeException(t);
}
@@ -255,30 +258,34 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
// ***********************************************************************************
// ***********************************************************************************
+ @Override
public void init(GLAutoDrawable drawable) {
GL _gl = drawable.getGL();
if(glDebug) {
try {
_gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, _gl, null) );
- } catch (Exception e) {e.printStackTrace();}
+ } catch (Exception e) {e.printStackTrace();}
}
if(glTrace) {
try {
// Trace ..
_gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, _gl, new Object[] { System.err } ) );
- } catch (Exception e) {e.printStackTrace();}
+ } catch (Exception e) {e.printStackTrace();}
}
if(glSwapInterval>=0) {
_gl.setSwapInterval(glSwapInterval);
}
}
+ @Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
}
+ @Override
public void display(GLAutoDrawable drawable) {
}
+ @Override
public void dispose(GLAutoDrawable drawable) {
}
@@ -301,14 +308,24 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
if(null == glWindow.getParent()) {
glWindow.reparentWindow(awtParent);
} else {
- glWindow.reparentWindow(null);
+ final InsetsImmutable insets = glWindow.getInsets();
+ final int x, y;
+ if ( 0 >= insets.getTopHeight() ) {
+ // fail safe ..
+ x = 32;
+ y = 32;
+ } else {
+ x = insets.getLeftWidth();
+ y = insets.getTopHeight();
+ }
+ glWindow.reparentWindow(null, x, y, false /* forceDestroyCreate */);
glWindow.setDefaultCloseOperation( glClosable ? WindowClosingMode.DISPOSE_ON_CLOSE : WindowClosingMode.DO_NOTHING_ON_CLOSE );
}
}
}
-
+
@Override
- public void keyReleased(KeyEvent e) {
+ public void keyReleased(KeyEvent e) {
}
}
diff --git a/src/newt/classes/com/jogamp/newt/event/DoubleTapScrollGesture.java b/src/newt/classes/com/jogamp/newt/event/DoubleTapScrollGesture.java
new file mode 100644
index 0000000..edb2429
--- /dev/null
+++ b/src/newt/classes/com/jogamp/newt/event/DoubleTapScrollGesture.java
@@ -0,0 +1,347 @@
+/**
+ * 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.
+ */
+package com.jogamp.newt.event;
+
+import jogamp.newt.Debug;
+
+/**
+ * 2 pointer scroll/rotate gesture handler processing {@link MouseEvent}s
+ * while producing {@link MouseEvent#EVENT_MOUSE_WHEEL_MOVED} events if gesture is completed.
+ * <p>
+ * Criteria related to parameters:
+ * <pre>
+ * - doubleTapSlop (scaled in pixels):
+ * - Max 2 finger distance to start 'scroll' mode
+ * - Max. distance diff of current 2-pointer middle and initiated 2-pointer middle.
+ *
+ * - touchSlop (scaled in pixels):
+ * - Min. movement w/ 2 pointer within ScaledDoubleTapSlop starting 'scroll' mode
+ *
+ * - Avoid computation if not within gesture, especially for MOVE/DRAG
+ *
+ * - Only allow gesture to start with PRESS
+ *
+ * - Leave gesture completely with RELEASE of both/all fingers, or dist-diff exceeds doubleTapSlop
+ *
+ * - Tolerate temporary lift 1 of 2 pointer
+ *
+ * - Always validate pointer-id
+ * </pre>
+ * </p>
+ * Implementation uses a n-state to get detect gesture:
+ * <p>
+ * <table border="1">
+ * <tr><th>from</th> <th>to</th> <th>action</th></tr>
+ * <tr><td>NONE</td> <td>1PRESS</td> <td>1-pointer-pressed</td></tr>
+ * <tr><td>1PRESS</td> <td>2PRESS_T</td> <td>2-pointer-pressed within doubleTapSlope</td></tr>
+ * <tr><td>2PRESS_T</td> <td>SCROLL</td> <td>2-pointer dragged, dist-diff within doubleTapSlop and scrollLen >= scrollSlop</td></tr>
+ * <tr><td>2PRESS_C</td> <td>SCROLL</td> <td>2-pointer dragged, dist-diff within doubleTapSlop</td></tr>
+ * <tr><td>SCROLL</td> <td>SCROLL</td> <td>2-pointer dragged, dist-diff within doubleTapSlop</td></tr>
+ * </table>
+ * State ST_2PRESS_C merely exist to pick up gesture after one pointer has been lost temporarily.
+ * </p>
+ * <p>
+ * {@link #isWithinGesture()} returns gestureState >= 2PRESS_C
+ * </p>
+ */
+public class DoubleTapScrollGesture implements GestureHandler {
+ /** Scroll threshold in pixels (fallback), defaults to 16 pixels. Can be overriden by integer property <code>newt.event.scroll_slop_pixel</code>.*/
+ public static final int SCROLL_SLOP_PIXEL;
+ /** Two pointer 'double tap' slop in pixels (fallback), defaults to 104 pixels. Can be overriden by integer property <code>newt.event.double_tap_slop_pixel</code>.*/
+ public static final int DOUBLE_TAP_SLOP_PIXEL;
+
+ /** Scroll threshold in millimeter, defaults to 3 mm. Can be overriden by integer property <code>newt.event.scroll_slop_mm</code>.*/
+ public static final float SCROLL_SLOP_MM;
+ /** Two pointer 'double tap' slop in millimeter, defaults to 20 mm. Can be overriden by integer property <code>newt.event.double_tap_slop_mm</code>.*/
+ public static final float DOUBLE_TAP_SLOP_MM;
+
+ static {
+ Debug.initSingleton();
+
+ SCROLL_SLOP_PIXEL = Debug.getIntProperty("newt.event.scroll_slop_pixel", true, 16);
+ DOUBLE_TAP_SLOP_PIXEL = Debug.getIntProperty("newt.event.double_tap_slop_pixel", true, 104);
+ SCROLL_SLOP_MM = Debug.getIntProperty("newt.event.scroll_slop_mm", true, 3);
+ DOUBLE_TAP_SLOP_MM = Debug.getIntProperty("newt.event.double_tap_slop_mm", true, 20);
+ }
+
+ private static final int ST_NONE = 0;
+ private static final int ST_1PRESS = 1;
+ private static final int ST_2PRESS_T = 2;
+ private static final int ST_2PRESS_C = 3;
+ private static final int ST_SCROLL = 4;
+
+ private final int scrollSlop, scrollSlopSquare, doubleTapSlop, doubleTapSlopSquare;
+ private final float[] scrollDistance = new float[] { 0f, 0f };
+ private int[] pIds = new int[] { -1, -1 };
+ /** See class docu */
+ private int gestureState;
+ private int sqStartDist;
+ private int lastX, lastY;
+ private int pointerDownCount;
+ private MouseEvent hitGestureEvent;
+
+ private static final int getSquareDistance(float x1, float y1, float x2, float y2) {
+ final int deltaX = (int) x1 - (int) x2;
+ final int deltaY = (int) y1 - (int) y2;
+ return deltaX * deltaX + deltaY * deltaY;
+ }
+
+ private int gesturePointers(final MouseEvent e, final int excludeIndex) {
+ int j = 0;
+ for(int i=e.getPointerCount()-1; i>=0; i--) {
+ if( excludeIndex != i ) {
+ final int id = e.getPointerId(i);
+ if( pIds[0] == id || pIds[1] == id ) {
+ j++;
+ }
+ }
+ }
+ return j;
+ }
+
+ /**
+ * scaledScrollSlop < scaledDoubleTapSlop
+ * @param scaledScrollSlop Distance a pointer can wander before we think the user is scrolling in <i>pixels</i>.
+ * @param scaledDoubleTapSlop Distance in <i>pixels</i> between the first touch and second touch to still be considered a double tap.
+ */
+ public DoubleTapScrollGesture(int scaledScrollSlop, int scaledDoubleTapSlop) {
+ scrollSlop = scaledScrollSlop;
+ scrollSlopSquare = scaledScrollSlop * scaledScrollSlop;
+ doubleTapSlop = scaledDoubleTapSlop;
+ doubleTapSlopSquare = scaledDoubleTapSlop * scaledDoubleTapSlop;
+ pointerDownCount = 0;
+ clear(true);
+ if(DEBUG) {
+ System.err.println("DoubleTapScroll scrollSlop (scaled) "+scrollSlop);
+ System.err.println("DoubleTapScroll doubleTapSlop (scaled) "+doubleTapSlop);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "DoubleTapScroll[state "+gestureState+", in "+isWithinGesture()+", has "+(null!=hitGestureEvent)+", pc "+pointerDownCount+"]";
+ }
+
+ @Override
+ public void clear(boolean clearStarted) {
+ scrollDistance[0] = 0f;
+ scrollDistance[1] = 0f;
+ hitGestureEvent = null;
+ if( clearStarted ) {
+ gestureState = ST_NONE;
+ sqStartDist = 0;
+ pIds[0] = -1;
+ pIds[1] = -1;
+ lastX = 0;
+ lastY = 0;
+ }
+ }
+
+ @Override
+ public boolean isWithinGesture() {
+ return ST_2PRESS_C <= gestureState;
+ }
+
+ @Override
+ public boolean hasGesture() {
+ return null != hitGestureEvent;
+ }
+
+ @Override
+ public InputEvent getGestureEvent() {
+ if( null != hitGestureEvent ) {
+ final MouseEvent ge = hitGestureEvent;
+ int modifiers = ge.getModifiers();
+ final float[] rotationXYZ = ge.getRotation();
+ rotationXYZ[0] = scrollDistance[0] / scrollSlop;
+ rotationXYZ[1] = scrollDistance[1] / scrollSlop;
+ if( rotationXYZ[0]*rotationXYZ[0] > rotationXYZ[1]*rotationXYZ[1] ) {
+ // Horizontal scroll -> SHIFT
+ modifiers |= com.jogamp.newt.event.InputEvent.SHIFT_MASK;
+ }
+ return new MouseEvent(MouseEvent.EVENT_MOUSE_WHEEL_MOVED, ge.getSource(), ge.getWhen(), modifiers,
+ ge.getAllPointerTypes(), ge.getAllPointerIDs(),
+ ge.getAllX(), ge.getAllY(), ge.getAllPressures(), ge.getMaxPressure(),
+ ge.getButton(), ge.getClickCount(), rotationXYZ, scrollSlop);
+ }
+ return null;
+ }
+
+ public final float[] getScrollDistanceXY() {
+ return scrollDistance;
+ }
+
+ @Override
+ public boolean process(final InputEvent in) {
+ if( null != hitGestureEvent || !(in instanceof MouseEvent) ) {
+ return true;
+ }
+ final MouseEvent pe = (MouseEvent)in;
+ if( pe.getPointerType(0).getPointerClass() != MouseEvent.PointerClass.Onscreen ) {
+ return false;
+ }
+ pointerDownCount = pe.getPointerCount();
+ final int eventType = pe.getEventType();
+ final int x0 = pe.getX(0);
+ final int y0 = pe.getY(0);
+ switch ( eventType ) {
+ case MouseEvent.EVENT_MOUSE_PRESSED: {
+ int gPtr = 0;
+ if( ST_NONE == gestureState && 1 == pointerDownCount ) {
+ pIds[0] = pe.getPointerId(0);
+ pIds[1] = -1;
+ gestureState = ST_1PRESS;
+ } else if( ST_NONE < gestureState && 2 == pointerDownCount && 1 == gesturePointers(pe, 0) /* w/o pressed pointer */ ) {
+ final int x1 = pe.getX(1);
+ final int y1 = pe.getY(1);
+ final int xm = (x0+x1)/2;
+ final int ym = (y0+y1)/2;
+
+ if( ST_1PRESS == gestureState ) {
+ final int sqDist = getSquareDistance(x0, y0, x1, y1);
+ final boolean isDistWithinDoubleTapSlop = sqDist < doubleTapSlopSquare;
+ if( isDistWithinDoubleTapSlop ) {
+ // very first 2-finger touch-down
+ gPtr = 2;
+ pIds[0] = pe.getPointerId(0);
+ pIds[1] = pe.getPointerId(1);
+ lastX = xm;
+ lastY = ym;
+ sqStartDist = sqDist;
+ gestureState = ST_2PRESS_T;
+ }
+ if(DEBUG) {
+ final int dist = (int)Math.round(Math.sqrt(sqDist));
+ System.err.println(this+".pressed.1: dist "+dist+", gPtr "+gPtr+", distWithin2DTSlop "+isDistWithinDoubleTapSlop+", last "+lastX+"/"+lastY+", "+pe);
+ }
+ } else if( ST_2PRESS_C == gestureState ) { // pick up gesture after temp loosing one pointer
+ gPtr = gesturePointers(pe, -1);
+ if( 2 == gPtr ) {
+ // same pointers re-touch-down
+ lastX = xm;
+ lastY = ym;
+ } else {
+ // other 2 pointers .. should rarely happen!
+ clear(true);
+ }
+ }
+ }
+ if(DEBUG) {
+ System.err.println(this+".pressed: gPtr "+gPtr+", this "+lastX+"/"+lastY+", "+pe);
+ }
+ } break;
+
+ case MouseEvent.EVENT_MOUSE_RELEASED: {
+ pointerDownCount--; // lifted
+ final int gPtr = gesturePointers(pe, 0); // w/o lifted pointer
+ if ( 1 == gPtr ) {
+ // tolerate lifting 1 of 2 gesture pointers temporary
+ gestureState = ST_2PRESS_C;
+ } else if( 0 == gPtr ) {
+ // all lifted
+ clear(true);
+ }
+ if(DEBUG) {
+ System.err.println(this+".released: gPtr "+gPtr+", "+pe);
+ }
+ } break;
+
+ case MouseEvent.EVENT_MOUSE_DRAGGED: {
+ if( 2 == pointerDownCount && ST_1PRESS < gestureState ) {
+ final int gPtr = gesturePointers(pe, -1);
+ if( 2 == gPtr ) {
+ // same pointers
+ final int x1 = pe.getX(1);
+ final int y1 = pe.getY(1);
+ final int xm = (x0+x1)/2;
+ final int ym = (y0+y1)/2;
+ final int sqDist = getSquareDistance(x0, y0, x1, y1);
+ final boolean isDistDiffWithinDoubleTapSlop = Math.abs(sqDist - sqStartDist) <= doubleTapSlopSquare;
+ if( isDistDiffWithinDoubleTapSlop ) {
+ switch( gestureState ) {
+ case ST_2PRESS_T: {
+ final int sqScrollLen = getSquareDistance(lastX, lastY, xm, ym);
+ if( sqScrollLen > scrollSlopSquare ) { // min. scrolling threshold reached
+ gestureState = ST_SCROLL;
+ }
+ } break;
+
+ case ST_2PRESS_C:
+ gestureState = ST_SCROLL;
+ break;
+
+ case ST_SCROLL:
+ scrollDistance[0] = lastX - xm;
+ scrollDistance[1] = lastY - ym;
+ hitGestureEvent = pe;
+ break;
+ }
+ if(DEBUG) {
+ final boolean isDistWithinDoubleTapSlop = sqDist < doubleTapSlopSquare;
+ final int dist = (int)Math.round(Math.sqrt(sqDist));
+ final int sqScrollLen = getSquareDistance(lastX, lastY, xm, ym);
+ final int scrollLen = (int)Math.round(Math.sqrt(sqScrollLen));
+ System.err.println(this+".dragged.1: pDist "+dist+", scrollLen "+scrollLen+", gPtr "+gPtr+" ["+pIds[0]+", "+pIds[1]+"]"+
+ ", diffDistWithinTapSlop "+isDistDiffWithinDoubleTapSlop+
+ ", distWithin2DTSlop "+isDistWithinDoubleTapSlop+
+ ", this "+xm+"/"+ym+", last "+lastX+"/"+lastY+", d "+scrollDistance[0]+"/"+scrollDistance[1]);
+ }
+ } else {
+ // distance too big ..
+ if(DEBUG) {
+ final boolean isDistWithinDoubleTapSlop = sqDist < doubleTapSlopSquare;
+ final int dist = (int)Math.round(Math.sqrt(sqDist));
+ final int startDist = (int)Math.round(Math.sqrt(sqStartDist));
+ System.err.println(this+".dragged.X1: pDist "+dist+", distStart "+startDist+", gPtr "+gPtr+" ["+pIds[0]+", "+pIds[1]+"]"+
+ ", diffDistWithinTapSlop "+isDistDiffWithinDoubleTapSlop+
+ ", distWithin2DTSlop "+isDistWithinDoubleTapSlop+
+ ", this "+xm+"/"+ym+", last "+lastX+"/"+lastY+", d "+scrollDistance[0]+"/"+scrollDistance[1]);
+ }
+ clear(true);
+ }
+ if( ST_2PRESS_T < gestureState ) {
+ // state ST_2PRESS_T waits for min scroll threshold !
+ lastX = xm;
+ lastY = ym;
+ }
+ } else {
+ // other 2 pointers .. should rarely happen!
+ if(DEBUG) {
+ System.err.println(this+".dragged.X2: gPtr "+gPtr+" ["+pIds[0]+", "+pIds[1]+"]"+
+ ", last "+lastX+"/"+lastY+", d "+scrollDistance[0]+"/"+scrollDistance[1]);
+ }
+ clear(true);
+ }
+ }
+ } break;
+
+ default:
+ }
+ return null != hitGestureEvent;
+ }
+}
diff --git a/src/newt/classes/com/jogamp/newt/event/GestureHandler.java b/src/newt/classes/com/jogamp/newt/event/GestureHandler.java
new file mode 100644
index 0000000..2e98a8a
--- /dev/null
+++ b/src/newt/classes/com/jogamp/newt/event/GestureHandler.java
@@ -0,0 +1,143 @@
+/**
+ * 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.
+ */
+package com.jogamp.newt.event;
+
+import jogamp.newt.Debug;
+
+/**
+ * Generic gesture handler interface designed to allow pass-through
+ * filtering of {@link InputEvent}s.
+ * <p>
+ * To avoid negative impact on event processing,
+ * implementation shall restrict computation as much as possible
+ * and only within it's appropriate gesture states.
+ * </p>
+ * <p>
+ * To allow custom user events, other than the <i>normal</i> {@link InputEvent}s,
+ * a user may return a {@link GestureEvent} in it's implementation.
+ * </p>
+ */
+public interface GestureHandler {
+ public static final boolean DEBUG = Debug.debug("Window.MouseEvent");
+
+ /** A custom gesture event */
+ @SuppressWarnings("serial")
+ public static class GestureEvent extends InputEvent {
+ /** A gesture has been detected. */
+ public static final short EVENT_GESTURE_DETECTED = 400;
+
+ private final GestureHandler handler;
+
+ /**
+ * Creates a gesture event with default type {@link #EVENT_GESTURE_DETECTED}.
+ *
+ * @param source
+ * @param when
+ * @param modifiers
+ * @param handler
+ */
+ public GestureEvent(Object source, long when, int modifiers, GestureHandler handler) {
+ super(EVENT_GESTURE_DETECTED, source, when, modifiers);
+ this.handler = handler;
+ }
+
+ /**
+ * Creates a gesture event with custom <i>event_type</i> !
+ * @param event_type must lie within [400..599]
+ * @param source
+ * @param when
+ * @param modifiers
+ * @param handler
+ */
+ public GestureEvent(short event_type, Object source, long when, int modifiers, GestureHandler handler) {
+ super(event_type, source, when, modifiers);
+ this.handler = handler;
+ }
+
+ /** Return the {@link GestureHandler}, which produced the event. */
+ public final GestureHandler getHandler() { return handler; }
+ }
+
+ /**
+ * Listener for {@link GestureEvent}s.
+ *
+ * @see GestureEvent
+ */
+ public static interface GestureListener extends NEWTEventListener
+ {
+ /** {@link GestureHandler} {@link GestureHandler#hasGesture() has detected} the gesture. */
+ public void gestureDetected(GestureEvent gh);
+ }
+
+ /**
+ * Clears state of handler, i.e. resets all states incl. previous detected gesture.
+ * @param clearStarted if true, also clears {@link #isWithinGesture() started} state,
+ * otherwise stay within gesture - if appropriate.
+ * Staying within a gesture allows fluent continuous gesture sequence,
+ * e.g. for scrolling.
+ */
+ public void clear(boolean clearStarted);
+
+ /**
+ * Returns true if a previous {@link #process(InputEvent)} command produced a gesture,
+ * which has not been {@link #clear(boolean) cleared}.
+ * Otherwise returns false.
+ */
+ public boolean hasGesture();
+
+ /**
+ * Returns the corresponding {@link InputEvent} for the gesture as detected by
+ * a previous {@link #process(InputEvent)}, which has not been {@link #clear(boolean) cleared}.
+ * Otherwise returns null.
+ * <p>
+ * Only implemented for gestures mapping to {@link InputEvent}s.
+ * </p>
+ */
+ public InputEvent getGestureEvent();
+
+ /**
+ * Returns true if within a gesture as detected by a previous {@link #process(InputEvent)} command,
+ * which has not been {@link #clear(boolean) cleared}.
+ * Otherwise returns false.
+ */
+ public boolean isWithinGesture();
+
+ /**
+ * Process the given {@link InputEvent} and returns true if it produced the gesture.
+ * Otherwise returns false.
+ * <p>
+ * If a gesture was already detected previously and has not been cleared,
+ * method does not process the event and returns true.
+ * </p>
+ * <p>
+ * Besides validation of the event's details,
+ * the handler may also validate the {@link InputEvent.InputClass} and/or {@link InputEvent.InputType}.
+ * </p>
+ */
+ public boolean process(InputEvent e);
+}
diff --git a/src/newt/classes/com/jogamp/newt/event/InputEvent.java b/src/newt/classes/com/jogamp/newt/event/InputEvent.java
index b04ebc1..f29b632 100644
--- a/src/newt/classes/com/jogamp/newt/event/InputEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/InputEvent.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,22 +29,31 @@
* 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.
- *
+ *
*/
package com.jogamp.newt.event;
+import com.jogamp.common.util.IntBitfield;
import com.jogamp.newt.Window;
@SuppressWarnings("serial")
public abstract class InputEvent extends NEWTEvent
{
+ /** Interface marking class of input types */
+ public static interface InputClass {
+ }
+
+ /** Interface marking type of input devices */
+ public static interface InputType {
+ }
+
public static final int SHIFT_MASK = 1 << 0;
public static final int CTRL_MASK = 1 << 1;
public static final int META_MASK = 1 << 2;
public static final int ALT_MASK = 1 << 3;
public static final int ALT_GRAPH_MASK = 1 << 4;
-
+
public static final int BUTTON1_MASK = 1 << 5;
public static final int BUTTON2_MASK = 1 << 6;
public static final int BUTTON3_MASK = 1 << 7;
@@ -54,33 +63,34 @@ public abstract class InputEvent extends NEWTEvent
public static final int BUTTON7_MASK = 1 << 11;
public static final int BUTTON8_MASK = 1 << 12;
public static final int BUTTON9_MASK = 1 << 13;
-
- public static final int BUTTONLAST_MASK = 1 << 20; // 16
-
+
+ public static final int BUTTONLAST_MASK = 1 << 20; // 16 buttons
+ public static final int BUTTONALL_MASK = 0xffff << 5 ; // 16 buttons
+
/** Event is caused by auto-repeat. */
public static final int AUTOREPEAT_MASK = 1 << 29;
-
+
/** Pointer is confined, see {@link Window#confinePointer(boolean)}. */
public static final int CONFINED_MASK = 1 << 30;
-
+
/** Pointer is invisible, see {@link Window#setPointerVisible(boolean)}. */
public static final int INVISIBLE_MASK = 1 << 31;
- /**
+ /**
* Returns the corresponding button mask for the given button.
* <p>
- * In case the given button lies outside
- * of the valid range [{@link MouseEvent#BUTTON1} .. {@link MouseEvent#BUTTON_NUMBER}],
+ * In case the given button lies outside
+ * of the valid range [{@link MouseEvent#BUTTON1} .. {@link MouseEvent#BUTTON_COUNT}],
* null is returned.
* </p>
*/
public static final int getButtonMask(int button) {
- if( 0 < button && button <= MouseEvent.BUTTON_NUMBER ) {
+ if( 0 < button && button <= MouseEvent.BUTTON_COUNT ) {
return 1 << ( 4 + button ) ;
}
return 0;
}
-
+
protected InputEvent(short eventType, Object source, long when, int modifiers) {
super(eventType, source, when);
this.modifiers=modifiers;
@@ -118,11 +128,11 @@ public abstract class InputEvent extends NEWTEvent
public boolean isConfined() {
return (modifiers&CONFINED_MASK)!=0;
}
- /** {@link #getModifiers()} contains {@link #INVISIBLE_MASK}. Pointer is invisible, see {@link Window#setPointerVisible(boolean)}. */
+ /** {@link #getModifiers()} contains {@link #INVISIBLE_MASK}. Pointer is invisible, see {@link Window#setPointerVisible(boolean)}. */
public boolean isInvisible() {
return (modifiers&INVISIBLE_MASK)!=0;
}
-
+
public StringBuilder getModifiersString(StringBuilder sb) {
if(null == sb) {
sb = new StringBuilder();
@@ -131,46 +141,81 @@ public abstract class InputEvent extends NEWTEvent
boolean isFirst = true;
if(isShiftDown()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("shift"); }
if(isControlDown()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("ctrl"); }
- if(isMetaDown()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("meta"); }
+ if(isMetaDown()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("meta"); }
if(isAltDown()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("alt"); }
if(isAltGraphDown()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("altgr"); }
if(isAutoRepeat()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("repeat"); }
- for(int i=1; i<=MouseEvent.BUTTON_NUMBER; i++) {
+ for(int i=1; i<=MouseEvent.BUTTON_COUNT; i++) {
if(isButtonDown(i)) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("button").append(i); }
}
if(isConfined()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("confined"); }
if(isInvisible()) { if(!isFirst) { sb.append(", "); } isFirst = false; sb.append("invisible"); }
sb.append("]");
-
+
return sb;
}
/**
- * @return Array of pressed mouse buttons [{@link MouseEvent#BUTTON1} .. {@link MouseEvent#BUTTON6}].
+ * See also {@link MouseEvent}'s section about <i>Multiple-Pointer Events</i>.
+ * @return Array of pressed mouse buttons [{@link MouseEvent#BUTTON1} .. {@link MouseEvent#BUTTON6}].
* If none is down, the resulting array is of length 0.
*/
public final short[] getButtonsDown() {
- int len = 0;
- for(int i=1; i<=MouseEvent.BUTTON_NUMBER; i++) {
- if( isButtonDown(i) ) { len++; }
- }
-
- short[] res = new short[len];
+ final int len = getButtonDownCount();
+
+ final short[] res = new short[len];
int j = 0;
- for(int i=1; i<=MouseEvent.BUTTON_NUMBER; i++) {
+ for(int i=1; i<=MouseEvent.BUTTON_COUNT; i++) {
if( isButtonDown(i) ) { res[j++] = (short) ( ( MouseEvent.BUTTON1 - 1 ) + i ); }
}
return res;
}
+ /**
+ * See also {@link MouseEvent}'s section about <i>Multiple-Pointer Events</i>.
+ * @param button the button to test
+ * @return true if the given button is down
+ */
public final boolean isButtonDown(int button) {
return ( modifiers & getButtonMask(button) ) != 0;
}
-
+
+ /**
+ * Returns the number of pressed buttons by counting the set bits:
+ * <pre>
+ * getBitCount(modifiers & BUTTONALL_MASK);
+ * </pre>
+ * <p>
+ * See also {@link MouseEvent}'s section about <i>Multiple-Pointer Events</i>.
+ * </p>
+ * @see IntBitfield#getBitCount(int)
+ * @see #BUTTONALL_MASK
+ */
+ public final int getButtonDownCount() {
+ return IntBitfield.getBitCount(modifiers & BUTTONALL_MASK);
+ }
+
+ /**
+ * Returns true if at least one button is pressed, otherwise false:
+ * <pre>
+ * 0 != ( modifiers & BUTTONALL_MASK )
+ * </pre>
+ * <p>
+ * See also {@link MouseEvent}'s section about <i>Multiple-Pointer Events</i>.
+ * </p>
+ * @see IntBitfield#getBitCount(int)
+ * @see #BUTTONALL_MASK
+ */
+ public final boolean isAnyButtonDown() {
+ return 0 != ( modifiers & BUTTONALL_MASK );
+ }
+
+ @Override
public String toString() {
return toString(null).toString();
}
-
+
+ @Override
public StringBuilder toString(StringBuilder sb) {
if(null == sb) {
sb = new StringBuilder();
diff --git a/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java
index 42ebea7..5cef734 100644
--- a/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/KeyAdapter.java
@@ -4,14 +4,14 @@
*
* 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
@@ -21,18 +21,20 @@
* 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.newt.event;
public abstract class KeyAdapter implements KeyListener
{
+ @Override
public void keyPressed(KeyEvent e) {
}
+ @Override
public void keyReleased(KeyEvent e) {
}
}
diff --git a/src/newt/classes/com/jogamp/newt/event/KeyEvent.java b/src/newt/classes/com/jogamp/newt/event/KeyEvent.java
index 085f598..49aa4e0 100644
--- a/src/newt/classes/com/jogamp/newt/event/KeyEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/KeyEvent.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package com.jogamp.newt.event;
@@ -37,8 +37,8 @@ package com.jogamp.newt.event;
import com.jogamp.common.util.IntBitfield;
/**
- * <a name="eventDelivery"><h5>KeyEvent Delivery</h5></a>
- *
+ * <a name="eventDelivery"><h5>KeyEvent Delivery</h5></a>
+ *
* Key events are delivered in the following order:
* <p>
* <table border="0">
@@ -48,10 +48,10 @@ import com.jogamp.common.util.IntBitfield;
* </table>
* </p>
* In case the native platform does not
- * deliver keyboard events in the above order or skip events,
- * the NEWT driver will reorder and inject synthetic events if required.
+ * deliver keyboard events in the above order or skip events,
+ * the NEWT driver will reorder and inject synthetic events if required.
* <p>
- * Besides regular modifiers like {@link InputEvent#SHIFT_MASK} etc.,
+ * Besides regular modifiers like {@link InputEvent#SHIFT_MASK} etc.,
* the {@link InputEvent#AUTOREPEAT_MASK} bit is added if repetition is detected, following above constraints.
* </p>
* <p>
@@ -60,38 +60,38 @@ import com.jogamp.common.util.IntBitfield;
P = pressed, R = released
0 = normal, 1 = auto-repeat
- P(0), [ R(1), P(1), R(1), ..], R(0)
+ P(0), [ R(1), P(1), R(1), ..], R(0)
* </pre>
* The idea is if you mask out auto-repeat in your event listener
* you just get one long pressed P/R tuple for {@link #isPrintableKey() printable} and {@link #isActionKey() Action} keys.
* </p>
* <p>
- * {@link #isActionKey() Action} keys will produce {@link #EVENT_KEY_PRESSED pressed}
+ * {@link #isActionKey() Action} keys will produce {@link #EVENT_KEY_PRESSED pressed}
* and {@link #EVENT_KEY_RELEASED released} events including {@link #isAutoRepeat() auto-repeat}.
* </p>
* <p>
* {@link #isPrintableKey() Printable} keys will produce {@link #EVENT_KEY_PRESSED pressed} and {@link #EVENT_KEY_RELEASED released} events.
* </p>
* <p>
- * {@link #isModifierKey() Modifier} keys will produce {@link #EVENT_KEY_PRESSED pressed} and {@link #EVENT_KEY_RELEASED released} events
+ * {@link #isModifierKey() Modifier} keys will produce {@link #EVENT_KEY_PRESSED pressed} and {@link #EVENT_KEY_RELEASED released} events
* excluding {@link #isAutoRepeat() auto-repeat}.
* They will also influence subsequent event's {@link #getModifiers() modifier} bits while pressed.
* </p>
- *
+ *
* <a name="unicodeMapping"><h5>Unicode Mapping</h5></a>
* <p>
- * {@link #getKeyChar() Key-chars}, as well as
+ * {@link #getKeyChar() Key-chars}, as well as
* {@link #isPrintableKey() printable} {@link #getKeyCode() key-codes} and {@link #getKeySymbol() key-symbols}
- * use the UTF-16 unicode space w/o collision.
- *
+ * use the UTF-16 unicode space w/o collision.
+ *
* </p>
* <p>
- * Non-{@link #isPrintableKey() printable} {@link #getKeyCode() key-codes} and {@link #getKeySymbol() key-symbols},
+ * Non-{@link #isPrintableKey() printable} {@link #getKeyCode() key-codes} and {@link #getKeySymbol() key-symbols},
* i.e. {@link #isModifierKey() modifier-} and {@link #isActionKey() action-}keys,
* are mapped to unicode's control and private range and do not collide w/ {@link #isPrintableKey() printable} unicode values
* with the following exception.
* </p>
- *
+ *
* <a name="unicodeCollision"><h5>Unicode Collision</h5></a>
* <p>
* The following {@link #getKeyCode() Key-code}s and {@link #getKeySymbol() key-symbol}s collide w/ unicode space:<br/>
@@ -103,9 +103,9 @@ import com.jogamp.common.util.IntBitfield;
* <p>
* Collision was chosen for {@link #getKeyCode() Key-code} and {@link #getKeySymbol() key-symbol} mapping
* to allow a minimal code range, i.e. <code>[0..255]</code>.
- * The reduced code range in turn allows the implementation to utilize fast and small lookup tables,
- * e.g. to implement a key-press state tracker.
- * </p>
+ * The reduced code range in turn allows the implementation to utilize fast and small lookup tables,
+ * e.g. to implement a key-press state tracker.
+ * </p>
* <pre>
* http://www.utf8-chartable.de/unicode-utf8-table.pl
* http://www.unicode.org/Public/5.1.0/ucd/PropList.txt
@@ -136,7 +136,7 @@ public class KeyEvent extends InputEvent
}
}
flags = _flags;
-
+
//
// Validate flags
//
@@ -147,12 +147,12 @@ public class KeyEvent extends InputEvent
}
}
}
-
+
public static KeyEvent create(short eventType, Object source, long when, int modifiers, short keyCode, short keySym, char keyChar) {
return new KeyEvent(eventType, source, when, modifiers, keyCode, keySym, getModifierMask(keySym), keyChar);
}
- /**
+ /**
* Returns the <i>UTF-16</i> character reflecting the {@link #getKeySymbol() key symbol}
* incl. active {@link #isModifierKey() modifiers}.
* @see #getKeySymbol()
@@ -162,12 +162,12 @@ public class KeyEvent extends InputEvent
return keyChar;
}
- /**
+ /**
* Returns the virtual <i>key symbol</i> reflecting the current <i>keyboard layout</i>.
* <p>
* For {@link #isPrintableKey() printable keys}, the <i>key symbol</i> is the {@link #isModifierKey() unmodified}
- * representation of the UTF-16 {@link #getKeyChar() key char}.<br/>
- * E.g. symbol [{@link #VK_A}, 'A'] for char 'a'.
+ * representation of the UTF-16 {@link #getKeyChar() key char}.<br/>
+ * E.g. symbol [{@link #VK_A}, 'A'] for char 'a'.
* </p>
* @see #isPrintableKey()
* @see #getKeyChar()
@@ -176,18 +176,18 @@ public class KeyEvent extends InputEvent
public final short getKeySymbol() {
return keySym;
}
-
- /**
+
+ /**
* Returns the virtual <i>key code</i> using a fixed mapping to the <i>US keyboard layout</i>.
* <p>
- * In contrast to {@link #getKeySymbol() key symbol}, <i>key code</i>
- * uses a fixed <i>US keyboard layout</i> and therefore is keyboard layout independent.
+ * In contrast to {@link #getKeySymbol() key symbol}, <i>key code</i>
+ * uses a fixed <i>US keyboard layout</i> and therefore is keyboard layout independent.
* </p>
* <p>
- * E.g. <i>virtual key code</i> {@link #VK_Y} denotes the same physical key
- * regardless whether <i>keyboard layout</i> <code>QWERTY</code> or
+ * E.g. <i>virtual key code</i> {@link #VK_Y} denotes the same physical key
+ * regardless whether <i>keyboard layout</i> <code>QWERTY</code> or
* <code>QWERTZ</code> is active. The {@link #getKeySymbol() key symbol} of the former is
- * {@link #VK_Y}, where the latter produces {@link #VK_Y}.
+ * {@link #VK_Y}, where the latter produces {@link #VK_Y}.
* </p>
* @see #getKeyChar()
* @see #getKeySymbol()
@@ -196,10 +196,12 @@ public class KeyEvent extends InputEvent
return keyCode;
}
+ @Override
public final String toString() {
return toString(null).toString();
}
+ @Override
public final StringBuilder toString(StringBuilder sb) {
if(null == sb) {
sb = new StringBuilder();
@@ -228,9 +230,9 @@ public class KeyEvent extends InputEvent
}
return (short) keyChar;
}
-
- /**
- * Returns <code>true</code> if the given <code>virtualKey</code> represents a modifier key, otherwise <code>false</code>.
+
+ /**
+ * Returns <code>true</code> if the given <code>virtualKey</code> represents a modifier key, otherwise <code>false</code>.
* <p>
* A modifier key is one of {@link #VK_SHIFT}, {@link #VK_CONTROL}, {@link #VK_ALT}, {@link #VK_ALT_GRAPH}, {@link #VK_META}.
* </p>
@@ -247,10 +249,10 @@ public class KeyEvent extends InputEvent
return false;
}
}
-
+
/**
* If <code>vKey</code> is a {@link #isModifierKey() modifier key}, method returns the corresponding modifier mask,
- * otherwise 0.
+ * otherwise 0.
*/
public static int getModifierMask(short vKey) {
switch (vKey) {
@@ -266,10 +268,10 @@ public class KeyEvent extends InputEvent
}
return 0;
}
-
- /**
+
+ /**
* Returns <code>true</code> if {@link #getKeySymbol() key symbol} represents a modifier key,
- * otherwise <code>false</code>.
+ * otherwise <code>false</code>.
* <p>
* See {@link #isModifierKey(short)} for details.
* </p>
@@ -280,8 +282,8 @@ public class KeyEvent extends InputEvent
public final boolean isModifierKey() {
return 0 != ( F_MODIFIER_MASK & flags ) ;
}
-
- /**
+
+ /**
* Returns <code>true</code> if {@link #getKeySymbol() key symbol} represents a non-printable and
* non-{@link #isModifierKey(short) modifier} action key, otherwise <code>false</code>.
* <p>
@@ -289,12 +291,12 @@ public class KeyEvent extends InputEvent
* <code> A = U - ( P + M ) </code>
* </p>
* @see #isPrintableKey()
- * @see #isModifierKey()
+ * @see #isModifierKey()
*/
public final boolean isActionKey() {
return 0 != ( F_ACTION_MASK & flags ) ;
}
-
+
/**
* Returns <code>true</code> if given <code>uniChar</code> represents a printable character,
* i.e. a value other than {@link #VK_UNDEFINED} and not a control or non-printable private code.
@@ -307,7 +309,7 @@ public class KeyEvent extends InputEvent
* <p>
* Distinction of key character and virtual key code is made due to <a href="#unicodeCollision">unicode collision</a>.
* </p>
- *
+ *
* @param uniChar the UTF-16 unicode value, which maybe a virtual key code or key character.
* @param isKeyChar true if <code>uniChar</code> is a key character, otherwise a virtual key code
*/
@@ -333,9 +335,9 @@ public class KeyEvent extends InputEvent
return VK_UNDEFINED != uniChar;
}
- /**
- * Returns <code>true</code> if {@link #getKeySymbol() key symbol} and {@link #getKeyChar() key char}
- * represents a printable character, i.e. a value other than {@link #VK_UNDEFINED}
+ /**
+ * Returns <code>true</code> if {@link #getKeySymbol() key symbol} and {@link #getKeyChar() key char}
+ * represents a printable character, i.e. a value other than {@link #VK_UNDEFINED}
* and not a control or non-printable private code.
* <p>
* A printable character is neither a {@link #isModifierKey(short) modifier key}, nor an {@link #isActionKey(short) action key}.
@@ -347,7 +349,7 @@ public class KeyEvent extends InputEvent
public final boolean isPrintableKey() {
return 0 != ( F_PRINTABLE_MASK & flags ) ;
}
-
+
private final short keyCode;
private final short keySym;
private final char keyChar;
@@ -370,7 +372,7 @@ public class KeyEvent extends InputEvent
public static class NonPrintableRange {
/** min. unicode value, inclusive */
- public short min;
+ public short min;
/** max. unicode value, inclusive */
public short max;
/** true if valid for keyChar values as well, otherwise only valid for keyCode and keySym due to collision. */
@@ -381,7 +383,7 @@ public class KeyEvent extends InputEvent
this.inclKeyChar = inclKeyChar;
}
};
- /**
+ /**
* Non printable key ranges, currently fixed to an array of size 4.
* <p>
* Not included, queried upfront:
@@ -390,98 +392,98 @@ public class KeyEvent extends InputEvent
* <li>{@link #VK_TAB}</li>
* <li>{@link #VK_ENTER}</li>
* </ul>
- * </p>
+ * </p>
*/
- public final static NonPrintableRange[] nonPrintableKeys = {
+ public final static NonPrintableRange[] nonPrintableKeys = {
new NonPrintableRange( (short)0x0000, (short)0x001F, true ), // Unicode: Non printable controls: [0x00 - 0x1F], see exclusion above
new NonPrintableRange( (short)0x0061, (short)0x0078, false), // Small 'a' thru 'z' (0x61 - 0x7a) - Not used for keyCode / keySym - Re-used for Fn (collision)
- new NonPrintableRange( (short)0x008F, (short)0x009F, true ), // Unicode: Non printable controls: [0x7F - 0x9F], Numpad keys [0x7F - 0x8E] are printable!
+ new NonPrintableRange( (short)0x008F, (short)0x009F, true ), // Unicode: Non printable controls: [0x7F - 0x9F], Numpad keys [0x7F - 0x8E] are printable!
new NonPrintableRange( (short)0xE000, (short)0xF8FF, true ) // Unicode: Private 0xE000 - 0xF8FF (Marked Non-Printable)
};
-
+
//
// Unicode: Non printable controls: [0x00 - 0x1F]
//
-
+
/**
* This value, {@value}, is used to indicate that the keyCode is unknown.
*/
public static final short VK_UNDEFINED = (short) 0x0;
-
+
static final short VK_FREE01 = (short) 0x01;
-
+
/** Constant for the HOME function key. ASCII: Start Of Text. */
public static final short VK_HOME = (short) 0x02;
-
+
/** Constant for the END function key. ASCII: End Of Text. */
public static final short VK_END = (short) 0x03;
-
+
/** Constant for the END function key. ASCII: End Of Transmission. */
public static final short VK_FINAL = (short) 0x04;
/** Constant for the PRINT function key. ASCII: Enquiry. */
public static final short VK_PRINTSCREEN = (short) 0x05;
-
+
static final short VK_FREE06 = (short) 0x06;
static final short VK_FREE07 = (short) 0x07;
-
+
/** Constant for the BACK SPACE key "\b", matching ASCII. Printable! */
public static final short VK_BACK_SPACE = (short) 0x08;
-
+
/** Constant for the HORIZ TAB key "\t", matching ASCII. Printable! */
public static final short VK_TAB = (short) 0x09;
-
+
/** LINE_FEED "\n", matching ASCII, n/a on keyboard. */
static final short VK_FREE0A = (short) 0x0A;
-
+
/** Constant for the PAGE DOWN function key. ASCII: Vertical Tabulation. */
public static final short VK_PAGE_DOWN = (short) 0x0B;
-
+
/** Constant for the CLEAR key, i.e. FORM FEED, matching ASCII. */
public static final short VK_CLEAR = (short) 0x0C;
-
+
/** Constant for the ENTER key, i.e. CARRIAGE RETURN, matching ASCII. Printable! */
public static final short VK_ENTER = (short) 0x0D;
-
+
static final short VK_FREE0E = (short) 0x0E;
-
+
/** Constant for the CTRL function key. ASCII: shift-in. */
public static final short VK_SHIFT = (short) 0x0F;
/** Constant for the PAGE UP function key. ASCII: Data Link Escape. */
public static final short VK_PAGE_UP = (short) 0x10;
-
+
/** Constant for the CTRL function key. ASCII: device-ctrl-one. */
public static final short VK_CONTROL = (short) 0x11;
-
+
/** Constant for the left ALT function key. ASCII: device-ctrl-two. */
public static final short VK_ALT = (short) 0x12;
-
+
/** Constant for the ALT_GRAPH function key, i.e. right ALT key. ASCII: device-ctrl-three. */
public static final short VK_ALT_GRAPH = (short) 0x13;
-
+
/** Constant for the CAPS LOCK function key. ASCII: device-ctrl-four. */
public static final short VK_CAPS_LOCK = (short) 0x14;
-
+
static final short VK_FREE15 = (short) 0x15;
-
+
/** Constant for the PAUSE function key. ASCII: sync-idle. */
public static final short VK_PAUSE = (short) 0x16;
-
+
/** <b>scroll lock</b> key. ASCII: End Of Transmission Block. */
public static final short VK_SCROLL_LOCK = (short) 0x17;
-
+
/** Constant for the CANCEL function key. ASCII: Cancel. */
public static final short VK_CANCEL = (short) 0x18;
-
+
static final short VK_FREE19 = (short) 0x19;
-
+
/** Constant for the INSERT function key. ASCII: Substitute. */
public static final short VK_INSERT = (short) 0x1A;
-
+
/** Constant for the ESCAPE function key. ASCII: Escape. */
public static final short VK_ESCAPE = (short) 0x1B;
-
+
/** Constant for the Convert function key, Japanese "henkan". ASCII: File Separator. */
public static final short VK_CONVERT = (short) 0x1C;
@@ -496,48 +498,48 @@ public class KeyEvent extends InputEvent
//
// Unicode: Printable [0x20 - 0x7E]
- // NOTE: Collision of 'a' - 'x' [0x61 .. 0x78], used for keyCode/keySym Fn function keys
+ // NOTE: Collision of 'a' - 'x' [0x61 .. 0x78], used for keyCode/keySym Fn function keys
//
-
+
/** Constant for the SPACE function key. ASCII: SPACE. */
public static final short VK_SPACE = (short) 0x20;
-
+
/** Constant for the "!" key. */
public static final short VK_EXCLAMATION_MARK = (short) 0x21;
/** Constant for the """ key. */
public static final short VK_QUOTEDBL = (short) 0x22;
-
+
/** Constant for the "#" key. */
public static final short VK_NUMBER_SIGN = (short) 0x23;
/** Constant for the "$" key. */
public static final short VK_DOLLAR = (short) 0x24;
-
+
/** Constant for the "%" key. */
public static final short VK_PERCENT = (short) 0x25;
-
+
/** Constant for the "&" key. */
public static final short VK_AMPERSAND = (short) 0x26;
-
+
/** Constant for the "'" key. */
public static final short VK_QUOTE = (short) 0x27;
-
+
/** Constant for the "(" key. */
public static final short VK_LEFT_PARENTHESIS = (short) 0x28;
-
+
/** Constant for the ")" key. */
public static final short VK_RIGHT_PARENTHESIS = (short) 0x29;
-
+
/** Constant for the "*" key */
public static final short VK_ASTERISK = (short) 0x2A;
-
+
/** Constant for the "+" key. */
public static final short VK_PLUS = (short) 0x2B;
-
+
/** Constant for the comma key, "," */
public static final short VK_COMMA = (short) 0x2C;
-
+
/** Constant for the minus key, "-" */
public static final short VK_MINUS = (short) 0x2D;
@@ -582,13 +584,13 @@ public class KeyEvent extends InputEvent
/** Constant for the equals key, ">" */
public static final short VK_GREATER = (short) 0x3E;
-
+
/** Constant for the equals key, "?" */
public static final short VK_QUESTIONMARK = (short) 0x3F;
-
+
/** Constant for the equals key, "@" */
public static final short VK_AT = (short) 0x40;
-
+
/** VK_A thru VK_Z are the same as Capital UTF16/ASCII 'A' thru 'Z' (0x41 - 0x5A) */
public static final short VK_A = (short) 0x41;
/** See {@link #VK_A}. */
@@ -656,17 +658,17 @@ public class KeyEvent extends InputEvent
/** Constant for the "_" key */
public static final short VK_UNDERSCORE = (short) 0x5F;
-
+
/** Constant for the "`" key */
public static final short VK_BACK_QUOTE = (short) 0x60;
-
+
/** Small UTF/ASCII 'a' thru 'z' (0x61 - 0x7a) - Not used for keyCode / keySym. */
-
- /**
- * Constant for the F<i>n</i> function keys.
+
+ /**
+ * Constant for the F<i>n</i> function keys.
* <p>
* F1..F24, i.e. F<i>n</i>, are mapped from on <code>0x60+n</code> -> <code>[0x61 .. 0x78]</code>.
- * </p>
+ * </p>
* <p>
* <b>Warning:</b> The F<i>n</i> function keys <b>do collide</b> with unicode characters small 'a' thru 'x'!<br/>
* See <a href="#unicodeCollision">Unicode Collision</a> for details.
@@ -743,26 +745,26 @@ public class KeyEvent extends InputEvent
/** Constant for the F24 function key. See {@link #VK_F1}. */
public static final short VK_F24 = (short) ( 0x60+24 );
-
+
/** Constant for the "{" key */
public static final short VK_LEFT_BRACE = (short) 0x7B;
/** Constant for the "|" key */
public static final short VK_PIPE = (short) 0x7C;
/** Constant for the "}" key */
public static final short VK_RIGHT_BRACE = (short) 0x7D;
-
+
/** Constant for the "~" key, matching ASCII */
public static final short VK_TILDE = (short) 0x7E;
-
+
//
// Unicode: Non printable controls: [0x7F - 0x9F]
//
// Numpad keys [0x7F - 0x8E] are printable
//
-
+
/** Numeric keypad <b>decimal separator</b> key. Non printable UTF control. */
public static final short VK_SEPARATOR = (short) 0x7F;
-
+
/** Numeric keypad VK_NUMPAD0 thru VK_NUMPAD9 are mapped to UTF control (0x80 - 0x89). Non printable UTF control. */
public static final short VK_NUMPAD0 = (short) 0x80;
/** See {@link #VK_NUMPAD0}. */
@@ -783,28 +785,28 @@ public class KeyEvent extends InputEvent
public static final short VK_NUMPAD8 = (short) 0x88;
/** See {@link #VK_NUMPAD0}. */
public static final short VK_NUMPAD9 = (short) 0x89;
-
+
/** Numeric keypad <b>decimal separator</b> key. Non printable UTF control. */
public static final short VK_DECIMAL = (short) 0x8A;
-
+
/** Numeric keypad <b>add</b> key. Non printable UTF control. */
public static final short VK_ADD = (short) 0x8B;
/** Numeric keypad <b>subtract</b> key. Non printable UTF control. */
public static final short VK_SUBTRACT = (short) 0x8C;
-
+
/** Numeric keypad <b>multiply</b> key. Non printable UTF control. */
public static final short VK_MULTIPLY = (short) 0x8D;
-
+
/** Numeric keypad <b>divide</b> key. Non printable UTF control. */
public static final short VK_DIVIDE = (short) 0x8E;
-
+
/** Constant for the DEL key, matching ASCII. Non printable UTF control. */
public static final short VK_DELETE = (short) 0x93;
-
+
/** Numeric keypad <b>num lock</b> key. Non printable UTF control. */
public static final short VK_NUM_LOCK = (short) 0x94;
-
+
/** Constant for the cursor- or numerical-pad <b>left</b> arrow key. Non printable UTF control. */
public static final short VK_LEFT = (short) 0x95;
@@ -816,22 +818,22 @@ public class KeyEvent extends InputEvent
/** Constant for the cursor- or numerical pad <b>down</b> arrow key. Non printable UTF control. */
public static final short VK_DOWN = (short) 0x98;
-
+
/** Constant for the Context Menu key. Non printable UTF control. */
public static final short VK_CONTEXT_MENU = (short) 0x99;
/**
* Constant for the MS "Windows" function key.
- * It is used for both the left and right version of the key.
+ * It is used for both the left and right version of the key.
*/
public static final short VK_WINDOWS = (short) 0x9A;
/** Constant for the Meta function key. */
public static final short VK_META = (short) 0x9B;
-
+
/** Constant for the Help function key. */
public static final short VK_HELP = (short) 0x9C;
-
+
/** Constant for the Compose function key. */
public static final short VK_COMPOSE = (short) 0x9D;
@@ -840,21 +842,21 @@ public class KeyEvent extends InputEvent
/** Constant for the Stop function key. */
public static final short VK_STOP = (short) 0x9F;
-
+
//
// Unicode: Printable [0x00A0 - 0xDFFF]
//
-
+
/** Constant for the inverted exclamation mark key. */
public static final short VK_INVERTED_EXCLAMATION_MARK = (short) 0xA1;
-
+
/** Constant for the Euro currency sign key. */
public static final short VK_EURO_SIGN = (short) 0x20AC;
//
// Unicode: Private 0xE000 - 0xF8FF (Marked Non-Printable)
//
-
+
/* for Sun keyboards */
public static final short VK_CUT = (short) 0xF879;
public static final short VK_COPY = (short) 0xF87A;
@@ -871,7 +873,7 @@ public class KeyEvent extends InputEvent
*/
/* Japanese PC 106 keyboard: kanji. Japanese Solaris keyboard: nihongo */
public static final short VK_INPUT_METHOD_ON_OFF = (short) 0xF890;
-
+
/**
* Constant for the Code Input function key.
*/
diff --git a/src/newt/classes/com/jogamp/newt/event/KeyListener.java b/src/newt/classes/com/jogamp/newt/event/KeyListener.java
index b3927d8..4b16ab6 100644
--- a/src/newt/classes/com/jogamp/newt/event/KeyListener.java
+++ b/src/newt/classes/com/jogamp/newt/event/KeyListener.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,22 +29,22 @@
* 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.
- *
+ *
*/
package com.jogamp.newt.event;
/**
* Listener for {@link KeyEvent}s.
- *
+ *
* @see KeyEvent
*/
public interface KeyListener extends NEWTEventListener
{
/** A key has been {@link KeyEvent#EVENT_KEY_PRESSED pressed}, excluding {@link #isAutoRepeat() auto-repeat} {@link #isModifierKey() modifier} keys. See {@link KeyEvent}. */
public void keyPressed(KeyEvent e);
-
- /**
+
+ /**
* A key has been {@link KeyEvent#EVENT_KEY_RELEASED released}, excluding {@link #isAutoRepeat() auto-repeat} {@link #isModifierKey() modifier} keys. See {@link KeyEvent}.
* <p>
* To simulated the removed <code>keyTyped(KeyEvent e)</code> semantics,
@@ -52,9 +52,9 @@ public interface KeyListener extends NEWTEventListener
* <pre>
if( !e.isPrintableKey() || e.isAutoRepeat() ) {
return;
- }
+ }
* </pre>
- * </p>
+ * </p>
*/
public void keyReleased(KeyEvent e);
}
diff --git a/src/newt/classes/com/jogamp/newt/event/MonitorEvent.java b/src/newt/classes/com/jogamp/newt/event/MonitorEvent.java
index c47936a..03242e1 100644
--- a/src/newt/classes/com/jogamp/newt/event/MonitorEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/MonitorEvent.java
@@ -35,19 +35,19 @@ import com.jogamp.newt.MonitorMode;
public class MonitorEvent extends OutputEvent {
public static final short EVENT_MONITOR_MODE_CHANGE_NOTIFY = 600;
public static final short EVENT_MONITOR_MODE_CHANGED = 601;
-
+
private final MonitorMode mode;
-
+
public MonitorEvent (short eventType, MonitorDevice source, long when, MonitorMode mode) {
super(eventType, source, when);
this.mode = mode;
}
-
+
/** Returns the {@link #getSource() source}, which is a {@link MonitorDevice}. */
public final MonitorDevice getMonitor() { return (MonitorDevice)source; }
-
+
public final MonitorMode getMode() { return mode; }
-
+
public static String getEventTypeString(short type) {
switch(type) {
case EVENT_MONITOR_MODE_CHANGE_NOTIFY: return "EVENT_MONITOR_MODE_CHANGE_NOTIFY";
@@ -55,11 +55,13 @@ public class MonitorEvent extends OutputEvent {
default: return "unknown (" + type + ")";
}
}
-
+
+ @Override
public final String toString() {
return toString(null).toString();
}
+ @Override
public final StringBuilder toString(StringBuilder sb) {
if(null == sb) {
sb = new StringBuilder();
diff --git a/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java
index 3607ae6..98252fe 100644
--- a/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/MouseAdapter.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,30 +20,38 @@
* 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.newt.event;
public abstract class MouseAdapter implements MouseListener
{
+ @Override
public void mouseClicked(MouseEvent e) {
}
+ @Override
public void mouseEntered(MouseEvent e) {
}
+ @Override
public void mouseExited(MouseEvent e) {
}
+ @Override
public void mousePressed(MouseEvent e) {
}
+ @Override
public void mouseReleased(MouseEvent e) {
}
+ @Override
public void mouseMoved(MouseEvent e) {
}
+ @Override
public void mouseDragged(MouseEvent e) {
}
+ @Override
public void mouseWheelMoved(MouseEvent e) {
}
}
diff --git a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java
index 93bbcc0..635bdba 100644
--- a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package com.jogamp.newt.event;
@@ -37,39 +37,100 @@ package com.jogamp.newt.event;
/**
* Pointer event of type {@link PointerType}.
* <p>
- * In case an instance represents multi-touch events, i.e. {@link #getPointerCount()} is > 1,
- * the first data element represents the pointer which triggered the action if individual to one pointer.<br/>
+ * The historical misleading class name may change in the future to <code>PointerEvent</code>.
+ * </p>
+ * <p>
+ * http://www.w3.org/Submission/pointer-events/#pointerevent-interface
+ * </p>
+ * <a name="multiPtrEvent"><h5>Multiple-Pointer Events</h5></a>
+ * <p>
+ * In case an instance represents a multiple-pointer event, i.e. {@link #getPointerCount()} is > 1,
+ * the first data element of the multiple-pointer fields represents the pointer triggering this event.<br/>
* For example {@link #getX(int) e.getX(0)} at {@link #EVENT_MOUSE_PRESSED} returns the data of the pressed pointer, etc.
* </p>
+ * <p>
+ * A {@link #getButton() button value} of <code>0</code> denotes no button activity, i.e. {@link PointerType#Mouse} move.
+ * </p>
+ * <p>
+ * A {@link #getPointerId(int) pointer-ID} of -1 denotes no pointer/button activity, i.e. {@link PointerType#Mouse} move.
+ * </p>
+ * <p>
+ * {@link #getButton() Button values} are mapped from and to {@link #getPointerId(int) pointer-IDs} as follows:
+ * <code>
+ * getPointerId(0) == getButton() - 1
+ * </code>.
+ * </p>
+ * <p>
+ * If representing a multiple-pointer event, the {@link #getButton() button number} is mapped to the <i>first {@link #getPointerId(int) pointer ID}</i>
+ * triggering the event and the {@link InputEvent#BUTTON1_MASK button mask bits} in the {@link #getModifiers() modifiers}
+ * field represent the pressed pointer IDs.<br>
+ * Hence users can query the pressed button count as well as the pressed pointer count via {@link InputEvent#getButtonDownCount()}
+ * or use the simple query {@link InputEvent#isAnyButtonDown()}.
+ * </p>
*/
@SuppressWarnings("serial")
public class MouseEvent extends InputEvent
{
/** Class of pointer types */
- public static enum PointerClass{
+ public static enum PointerClass implements InputEvent.InputClass {
Offscreen, Onscreen, Undefined;
}
-
+
/** Type of pointer devices */
- public static enum PointerType{
- /** {@link PointerClass#Offscreen} mouse. */
+ public static enum PointerType implements InputEvent.InputType {
+ /** {@link PointerClass#Offscreen} mouse. Ordinal 0. */
Mouse(PointerClass.Offscreen),
- /** {@link PointerClass#Offscreen} touch pad, usually using fingers. */
+ /** {@link PointerClass#Offscreen} touch pad, usually using fingers. Ordinal 1. */
TouchPad(PointerClass.Offscreen),
- /** {@link PointerClass#Onscreen} touch screen, usually using fingers. */
+ /** {@link PointerClass#Onscreen} touch screen, usually using fingers. Ordinal 2. */
TouchScreen(PointerClass.Onscreen),
- /** {@link PointerClass#Onscreen} pen on screen ?. */
+ /** {@link PointerClass#Onscreen} pen usually on screen? Ordinal 3. FIXME*/
Pen(PointerClass.Onscreen),
+ /** {@link PointerClass#Undefined} ?. Ordinal 4. */
Undefined(PointerClass.Undefined);
-
+
public PointerClass getPointerClass() { return pc; }
-
+
+ /**
+ * Returns the matching PointerType value corresponding to the given PointerType's integer ordinal.
+ * <pre>
+ * given:
+ * ordinal = enumValue.ordinal()
+ * reverse:
+ * enumValue = EnumClass.values()[ordinal]
+ * </pre>
+ * @throws IllegalArgumentException if the given ordinal is out of range, i.e. not within [ 0 .. PointerType.values().length-1 ]
+ */
+ public static PointerType valueOf(int ordinal) throws IllegalArgumentException {
+ final PointerType[] all = PointerType.values();
+ if( 0 <= ordinal && ordinal < all.length ) {
+ return all[ordinal];
+ }
+ throw new IllegalArgumentException("Ordinal "+ordinal+" out of range of PointerType.values()[0.."+(all.length-1)+"]");
+ }
+
+ /**
+ * Returns the PointerType array of matching PointerType values corresponding to the given PointerType's integer ordinal values.
+ * <p>
+ * See {@link #valueOf(int)}.
+ * </p>
+ * @throws IllegalArgumentException if one of the given ordinal values is out of range, i.e. not within [ 0 .. PointerType.values().length-1 ]
+ */
+ public static PointerType[] valuesOf(int[] ordinals) throws IllegalArgumentException {
+ final int count = ordinals.length;
+ final PointerType[] types = new PointerType[count];
+ for(int i=count-1; i>=0; i--) {
+ types[i] = PointerType.valueOf(ordinals[i]);
+ }
+ return types;
+ }
+
private PointerType(PointerClass pc) {
this.pc = pc;
}
PointerClass pc;
}
-
+
/** ID for button 1, value <code>1</code> */
public static final short BUTTON1 = 1;
/** ID for button 2, value <code>2</code> */
@@ -88,11 +149,17 @@ public class MouseEvent extends InputEvent
public static final short BUTTON8 = 8;
/** ID for button 6, value <code>9</code> */
public static final short BUTTON9 = 9;
-
+
/** Maximum number of buttons, value <code>16</code> */
+ public static final short BUTTON_COUNT = 16;
+
+ /**
+ * Maximum number of buttons, value <code>16</code>.
+ * @deprecated Use {@link #BUTTON_COUNT} .. semantics.
+ */
public static final short BUTTON_NUMBER = 16;
- /** Returns the 3-axis XYZ rotation array by given rotation on Y axis or X axis (if SHIFT_MASK is given in mods). */
+ /** Returns the 3-axis XYZ rotation array by given rotation on Y axis or X axis (if SHIFT_MASK is given in mods). */
public static final float[] getRotationXYZ(final float rotationXorY, final int mods) {
final float[] rotationXYZ = new float[] { 0f, 0f, 0f };
if( 0 != ( mods & InputEvent.SHIFT_MASK ) ) {
@@ -102,40 +169,89 @@ public class MouseEvent extends InputEvent
}
return rotationXYZ;
}
-
- public static final short getClickTimeout() {
- return 300;
+
+ public static final short getClickTimeout() {
+ return 300;
}
-
- /** Constructor for tradition 1-pointer mouse events. */
+
+ /**
+ * Constructor for traditional one-pointer event.
+ *
+ * @param eventType
+ * @param source
+ * @param when
+ * @param modifiers
+ * @param x X-axis
+ * @param y Y-axis
+ * @param clickCount Mouse-button click-count
+ * @param button button number, e.g. [{@link #BUTTON1}..{@link #BUTTON_COUNT}-1].
+ * A button value of <code>0</code> denotes no button activity, i.e. {@link PointerType#Mouse} move.
+ * @param rotationXYZ Rotation of all axis
+ * @param rotationScale Rotation scale
+ */
public MouseEvent(short eventType, Object source, long when,
int modifiers, int x, int y, short clickCount, short button,
float[] rotationXYZ, float rotationScale)
{
- super(eventType, source, when, modifiers);
+ super(eventType, source, when, modifiers);
this.x = new int[]{x};
this.y = new int[]{y};
- this.pressure = constMousePressure;
+ switch(eventType) {
+ case EVENT_MOUSE_CLICKED:
+ case EVENT_MOUSE_PRESSED:
+ case EVENT_MOUSE_DRAGGED:
+ this.pressure = constMousePressure1;
+ break;
+ default:
+ this.pressure = constMousePressure0;
+ }
this.maxPressure= 1.0f;
- this.pointerIDs = constMousePointerIDs;
+ this.pointerID = new short[] { (short)(button - 1) };
this.clickCount=clickCount;
this.button=button;
this.rotationXYZ = rotationXYZ;
this.rotationScale = rotationScale;
- this.pointerTypes = constMousePointerTypes;
+ this.pointerType = constMousePointerTypes;
}
- /** Constructor for multi-touch pointer events. */
- public MouseEvent(short eventType, Object source, long when,
- int modifiers, int[] x, int[] y, float[] pressure, float maxPressure, PointerType pointerTypes[], short[] pointerids, short clickCount,
- short button, float[] rotationXYZ, float rotationScale)
+ /**
+ * Constructor for a multiple-pointer event.
+ * <p>
+ * First element of multiple-pointer arrays represents the pointer which triggered the event!
+ * </p>
+ * <p>
+ * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
+ * </p>
+ *
+ * @param eventType
+ * @param source
+ * @param when
+ * @param modifiers
+ * @param pointerType PointerType for each pointer (multiple pointer)
+ * @param pointerID Pointer ID for each pointer (multiple pointer). IDs start w/ 0 and are consecutive numbers.
+ * A pointer-ID of -1 may also denote no pointer/button activity, i.e. {@link PointerType#Mouse} move.
+ * @param x X-axis for each pointer (multiple pointer)
+ * @param y Y-axis for each pointer (multiple pointer)
+ * @param pressure Pressure for each pointer (multiple pointer)
+ * @param maxPressure Maximum pointer pressure for all pointer
+ * @param button Corresponding mouse-button
+ * @param clickCount Mouse-button click-count
+ * @param rotationXYZ Rotation of all axis
+ * @param rotationScale Rotation scale
+ */
+ public MouseEvent(short eventType, Object source, long when, int modifiers,
+ PointerType pointerType[], short[] pointerID,
+ int[] x, int[] y, float[] pressure, float maxPressure,
+ short button, short clickCount, float[] rotationXYZ, float rotationScale)
{
- super(eventType, source, when, modifiers);
+ super(eventType, source, when, modifiers);
this.x = x;
this.y = y;
- if(pointerids.length != pressure.length ||
- pointerids.length != x.length ||
- pointerids.length != y.length) {
+ final int pointerCount = pointerType.length;
+ if(pointerCount != pointerID.length ||
+ pointerCount != x.length ||
+ pointerCount != y.length ||
+ pointerCount != pressure.length) {
throw new IllegalArgumentException("All multiple pointer arrays must be of same size");
}
if( 0.0f >= maxPressure ) {
@@ -143,91 +259,184 @@ public class MouseEvent extends InputEvent
}
this.pressure = pressure;
this.maxPressure= maxPressure;
- this.pointerIDs = pointerids;
+ this.pointerID = pointerID;
this.clickCount=clickCount;
this.button=button;
this.rotationXYZ = rotationXYZ;
this.rotationScale = rotationScale;
- this.pointerTypes = pointerTypes;
+ this.pointerType = pointerType;
+ }
+
+ public MouseEvent createVariant(short newEventType) {
+ return new MouseEvent(newEventType, source, getWhen(), getModifiers(), pointerType, pointerID,
+ x, y, pressure, maxPressure, button, clickCount, rotationXYZ, rotationScale);
}
-
+
/**
+ * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
* @return the count of pointers involved in this event
*/
- public int getPointerCount() {
- return x.length;
+ public final int getPointerCount() {
+ return pointerType.length;
}
-
+
/**
- * @return the {@link PointerType} for the data at index.
- * return null if index not available.
+ * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
+ * @return the {@link PointerType} for the data at index or null if index not available.
*/
- public PointerType getPointerType(int index) {
- if(index >= pointerIDs.length) {
+ public final PointerType getPointerType(int index) {
+ if(0 > index || index >= pointerType.length) {
return null;
}
- return pointerTypes[index];
+ return pointerType[index];
+ }
+
+ /**
+ * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
+ * @return array of all {@link PointerType}s for all pointers
+ */
+ public final PointerType[] getAllPointerTypes() {
+ return pointerType;
}
-
+
/**
- * @return the pointer id for the data at index.
- * return -1 if index not available.
+ * Return the pointer id for the given index or -1 if index not available.
+ * <p>
+ * IDs start w/ 0 and are consecutive numbers.
+ * </p>
+ * <p>
+ * A pointer-ID of -1 may also denote no pointer/button activity, i.e. {@link PointerType#Mouse} move.
+ * </p>
+ * <p>
+ * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
+ * </p>
*/
- public short getPointerId(int index) {
- if(index >= pointerIDs.length) {
+ public final short getPointerId(int index) {
+ if(0 > index || index >= pointerID.length) {
return -1;
}
- return pointerIDs[index];
+ return pointerID[index];
+ }
+
+ /**
+ * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
+ * @return the pointer index for the given pointer id or -1 if id not available.
+ */
+ public final int getPointerIdx(short id) {
+ if( id >= 0 ) {
+ for(int i=pointerID.length-1; i>=0; i--) {
+ if( pointerID[i] == id ) {
+ return i;
+ }
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
+ * @return array of all pointer IDs for all pointers. IDs start w/ 0 and are consecutive numbers.
+ */
+ public final short[] getAllPointerIDs() {
+ return pointerID;
}
-
- public short getButton() {
+
+ /**
+ * Returns the button number, e.g. [{@link #BUTTON1}..{@link #BUTTON_COUNT}-1].
+ * <p>
+ * A button value of <code>0</code> denotes no button activity, i.e. {@link PointerType#Mouse} move.
+ * </p>
+ * <p>
+ * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
+ * </p>
+ */
+ public final short getButton() {
return button;
}
-
- public short getClickCount() {
+
+ public final short getClickCount() {
return clickCount;
}
- public int getX() {
+
+ public final int getX() {
return x[0];
}
-
- public int getY() {
+
+ public final int getY() {
return y[0];
}
- /**
+ /**
+ * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
* @param index pointer-index within [0 .. {@link #getPointerCount()}-1]
* @return X-Coord associated with the pointer-index.
* @see getPointerId(index)
*/
- public int getX(int index) {
+ public final int getX(int index) {
return x[index];
}
- /**
+ /**
+ * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
* @param index pointer-index within [0 .. {@link #getPointerCount()}-1]
* @return Y-Coord associated with the pointer-index.
* @see getPointerId(index)
*/
- public int getY(int index) {
+ public final int getY(int index) {
return y[index];
}
-
+
+ /**
+ * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
+ * @return array of all X-Coords for all pointers
+ */
+ public final int[] getAllX() {
+ return x;
+ }
+
+ /**
+ * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
+ * @return array of all Y-Coords for all pointers
+ */
+ public final int[] getAllY() {
+ return y;
+ }
+
/**
- * @param normalized if true, method returns the normalized pressure, i.e. <code>pressure / maxPressure</code>
+ * @param normalized if true, method returns the normalized pressure, i.e. <code>pressure / maxPressure</code>
* @return The pressure associated with the pointer-index 0.
* The value of zero is return if not available.
* @see #getMaxPressure()
*/
- public float getPressure(boolean normalized){
+ public final float getPressure(boolean normalized){
return normalized ? pressure[0] / maxPressure : pressure[0];
}
-
- /**
+
+ /**
+ * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
+ * @param index pointer-index within [0 .. {@link #getPointerCount()}-1]
+ * @param normalized if true, method returns the normalized pressure, i.e. <code>pressure / maxPressure</code>
+ * @return The pressure associated with the pointer-index.
+ * The value of zero is return if not available.
+ * @see #getMaxPressure()
+ */
+ public final float getPressure(int index, boolean normalized){
+ return normalized ? pressure[index] / maxPressure : pressure[index];
+ }
+
+ /**
+ * See details for <a href="#multiPtrEvent">multiple-pointer events</a>.
+ * @return array of all raw, un-normalized pressures for all pointers
+ */
+ public final float[] getAllPressures() {
+ return pressure;
+ }
+
+ /**
* Returns the maximum pressure known for the input device generating this event.
* <p>
* This value may be self calibrating on devices/OS, where no known maximum pressure is known.
- * Hence subsequent events may return a higher value.
+ * Hence subsequent events may return a higher value.
* </p>
* <p>
* Self calibrating maximum pressure is performed on:
@@ -236,39 +445,28 @@ public class MouseEvent extends InputEvent
* </ul>
* </p>
*/
- public float getMaxPressure() {
+ public final float getMaxPressure() {
return maxPressure;
}
-
- /**
- * @param index pointer-index within [0 .. {@link #getPointerCount()}-1]
- * @param normalized if true, method returns the normalized pressure, i.e. <code>pressure / maxPressure</code>
- * @return The pressure associated with the pointer-index.
- * The value of zero is return if not available.
- * @see #getMaxPressure()
- */
- public float getPressure(int index, boolean normalized){
- return normalized ? pressure[index] / maxPressure : pressure[index];
- }
-
+
/**
* Returns a 3-component float array filled with the values of the rotational axis
* in the following order: horizontal-, vertical- and z-axis.
- * <p>
+ * <p>
* A vertical rotation of <b>> 0.0f is up</b> and <b>< 0.0f is down</b>.
* </p>
* <p>
- * A horizontal rotation of <b>> 0.0f is left</b> and <b>< 0.0f is right</b>.
+ * A horizontal rotation of <b>> 0.0f is left</b> and <b>< 0.0f is right</b>.
* </p>
* <p>
- * A z-axis rotation of <b>> 0.0f is back</b> and <b>< 0.0f is front</b>.
+ * A z-axis rotation of <b>> 0.0f is back</b> and <b>< 0.0f is front</b>.
* </p>
* <p>
* <i>However</i>, on some OS this might be flipped due to the OS <i>default</i> behavior.
* The latter is true for OS X 10.7 (Lion) for example.
* </p>
* <p>
- * On PointerClass {@link PointerClass#Onscreen onscreen} devices, i.e. {@link PointerType#TouchScreen touch screens},
+ * On PointerClass {@link PointerClass#Onscreen onscreen} devices, i.e. {@link PointerType#TouchScreen touch screens},
* rotation events are usually produced by a 2-finger movement, where horizontal and vertical rotation values are filled.
* </p>
* <p>
@@ -277,13 +475,13 @@ public class MouseEvent extends InputEvent
* </p>
* <p>
* The {@link InputEvent#SHIFT_MASK} modifier is set in case <b>|horizontal| > |vertical|</b> value.<br/>
- * This can be utilized to implement only one 2d rotation direction, you may use {@link #isShiftDown()} to query it.
+ * This can be utilized to implement only one 2d rotation direction, you may use {@link #isShiftDown()} to query it.
* </p>
* <p>
* In case the pointer type is {@link PointerType#Mouse mouse},
* events are usually send in steps of one, ie. <i>-1.0f</i> and <i>1.0f</i>.
* Higher values may result due to fast scrolling.
- * Fractional values may result due to slow scrolling with high resolution devices.<br/>
+ * Fractional values may result due to slow scrolling with high resolution devices.<br/>
* Here the button number refers to the wheel number.
* </p>
* <p>
@@ -291,32 +489,34 @@ public class MouseEvent extends InputEvent
* see {@link #getRotationScale()} for semantics.
* </p>
*/
- public float[] getRotation() {
+ public final float[] getRotation() {
return rotationXYZ;
}
-
- /**
+
+ /**
* Returns the scale used to determine the {@link #getRotation() rotation value},
* which semantics depends on the {@link #getPointerType() pointer type's} {@link PointerClass}.
* <p>
* For {@link PointerClass#Offscreen}, the scale is usually <code>1.0f</code> and denominates
* an abstract value without association to a physical value.
- * </p>
+ * </p>
* <p>
* For {@link PointerClass#Onscreen}, the scale varies and denominates
- * the divisor of the distance the finger[s] have moved on the screen.
- * Hence <code>scale * rotation</code> reproduces the screen distance in pixels the finger[s] have moved.
- * </p>
+ * the divisor of the distance the finger[s] have moved on the screen.
+ * Hence <code>scale * rotation</code> reproduces the screen distance in pixels the finger[s] have moved.
+ * </p>
*/
- public float getRotationScale() {
+ public final float getRotationScale() {
return rotationScale;
}
-
- public String toString() {
+
+ @Override
+ public final String toString() {
return toString(null).toString();
}
- public StringBuilder toString(StringBuilder sb) {
+ @Override
+ public final StringBuilder toString(StringBuilder sb) {
if(null == sb) {
sb = new StringBuilder();
}
@@ -324,49 +524,70 @@ public class MouseEvent extends InputEvent
.append(", ").append(x).append("/").append(y)
.append(", button ").append(button).append(", count ")
.append(clickCount).append(", rotation [").append(rotationXYZ[0]).append(", ").append(rotationXYZ[1]).append(", ").append(rotationXYZ[2]).append("] * ").append(rotationScale);
- if(pointerIDs.length>0) {
- sb.append(", pointer<").append(pointerIDs.length).append(">[");
- for(int i=0; i<pointerIDs.length; i++) {
+ if(pointerID.length>0) {
+ sb.append(", pointer<").append(pointerID.length).append(">[");
+ for(int i=0; i<pointerID.length; i++) {
if(i>0) {
sb.append(", ");
}
- sb.append(pointerIDs[i]).append("/").append(pointerTypes[i]).append(": ")
+ sb.append(pointerID[i]).append("/").append(pointerType[i]).append(": ")
.append(x[i]).append("/").append(y[i]).append(", ")
.append("p[").append(pressure[i]).append("/").append(maxPressure).append("=").append(pressure[i]/maxPressure).append("]");
}
sb.append("]");
- }
+ }
sb.append(", ");
return super.toString(sb).append("]");
}
public static String getEventTypeString(short type) {
switch(type) {
- case EVENT_MOUSE_CLICKED: return "EVENT_MOUSE_CLICKED";
- case EVENT_MOUSE_ENTERED: return "EVENT_MOUSE_ENTERED";
- case EVENT_MOUSE_EXITED: return "EVENT_MOUSE_EXITED";
- case EVENT_MOUSE_PRESSED: return "EVENT_MOUSE_PRESSED";
- case EVENT_MOUSE_RELEASED: return "EVENT_MOUSE_RELEASED";
- case EVENT_MOUSE_MOVED: return "EVENT_MOUSE_MOVED";
- case EVENT_MOUSE_DRAGGED: return "EVENT_MOUSE_DRAGGED";
- case EVENT_MOUSE_WHEEL_MOVED: return "EVENT_MOUSE_WHEEL_MOVED";
- default: return "unknown (" + type + ")";
+ case EVENT_MOUSE_CLICKED: return "EVENT_MOUSE_CLICKED";
+ case EVENT_MOUSE_ENTERED: return "EVENT_MOUSE_ENTERED";
+ case EVENT_MOUSE_EXITED: return "EVENT_MOUSE_EXITED";
+ case EVENT_MOUSE_PRESSED: return "EVENT_MOUSE_PRESSED";
+ case EVENT_MOUSE_RELEASED: return "EVENT_MOUSE_RELEASED";
+ case EVENT_MOUSE_MOVED: return "EVENT_MOUSE_MOVED";
+ case EVENT_MOUSE_DRAGGED: return "EVENT_MOUSE_DRAGGED";
+ case EVENT_MOUSE_WHEEL_MOVED: return "EVENT_MOUSE_WHEEL_MOVED";
+ default: return "unknown (" + type + ")";
}
}
- private final int x[], y[];
+
+ /** PointerType for each pointer (multiple pointer) */
+ private final PointerType pointerType[];
+ /**
+ * Pointer-ID for each pointer (multiple pointer). IDs start w/ 0 and are consecutive numbers.
+ * <p>
+ * A pointer-ID of -1 may also denote no pointer/button activity, i.e. {@link PointerType#Mouse} move.
+ * </p>
+ */
+ private final short pointerID[];
+ /** X-axis for each pointer (multiple pointer) */
+ private final int x[];
+ /** Y-axis for each pointer (multiple pointer) */
+ private final int y[];
+ /** Pressure for each pointer (multiple pointer) */
+ private final float pressure[];
// private final short tiltX[], tiltY[]; // TODO: A generic way for pointer axis information, see Android MotionEvent!
- private final short clickCount, button;
+ private final short clickCount;
+ /**
+ * Returns the button number, e.g. [{@link #BUTTON1}..{@link #BUTTON_COUNT}-1].
+ * <p>
+ * A button value of <code>0</code> denotes no button activity, i.e. {@link PointerType#Mouse} move.
+ * </p>
+ */
+ private final short button;
+ /** Rotation around the X, Y and X axis */
private final float[] rotationXYZ;
+ /** Rotation scale */
private final float rotationScale;
- private final float pressure[];
private final float maxPressure;
- private final short pointerIDs[];
- private final PointerType pointerTypes[];
-
- private static final float[] constMousePressure = new float[]{0f};
- private static final short[] constMousePointerIDs = new short[]{0};
+
+ private static final float[] constMousePressure0 = new float[]{0f};
+ private static final float[] constMousePressure1 = new float[]{1f};
private static final PointerType[] constMousePointerTypes = new PointerType[] { PointerType.Mouse };
-
+
public static final short EVENT_MOUSE_CLICKED = 200;
public static final short EVENT_MOUSE_ENTERED = 201;
public static final short EVENT_MOUSE_EXITED = 202;
diff --git a/src/newt/classes/com/jogamp/newt/event/MouseListener.java b/src/newt/classes/com/jogamp/newt/event/MouseListener.java
index ce67960..5378080 100644
--- a/src/newt/classes/com/jogamp/newt/event/MouseListener.java
+++ b/src/newt/classes/com/jogamp/newt/event/MouseListener.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package com.jogamp.newt.event;
@@ -38,7 +38,7 @@ import com.jogamp.newt.event.MouseEvent.PointerType;
/**
* Listener for {@link MouseEvent}s.
- *
+ *
* @see MouseEvent
*/
public interface MouseListener extends NEWTEventListener
@@ -50,13 +50,13 @@ public interface MouseListener extends NEWTEventListener
public void mouseReleased(MouseEvent e);
public void mouseMoved(MouseEvent e);
public void mouseDragged(MouseEvent e);
-
+
/**
* Traditional event name originally produced by a {@link PointerType#Mouse mouse} pointer type.
* <p>
* Triggered for any rotational pointer events, see
- * {@link MouseEvent#getRotation()} and {@link MouseEvent#getRotationScale()}.
- * </p>
+ * {@link MouseEvent#getRotation()} and {@link MouseEvent#getRotationScale()}.
+ * </p>
*/
public void mouseWheelMoved(MouseEvent e);
}
diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java
index c1bc791..af800e6 100644
--- a/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/NEWTEvent.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package com.jogamp.newt.event;
@@ -44,12 +44,13 @@ package com.jogamp.newt.event;
* <li> WindowEvent <code>100..10x</code></li>
* <li> MouseEvent <code>200..20x</code></li>
* <li> KeyEvent <code>300..30x</code></li>
+ * <li> GestureEvent <code>400..5xx</code></li>
* <li> MonitorEvent <code>600..60x</code></li>
* </ul><br>
*/
@SuppressWarnings("serial")
public class NEWTEvent extends java.util.EventObject {
- /**
+ /**
* See {@link #setConsumed(boolean)} for description.
*/
public static final Object consumedTag = new Object();
@@ -77,11 +78,11 @@ public class NEWTEvent extends java.util.EventObject {
return when;
}
- /**
+ /**
* Attach the passed object to this event.<br>
* If an object was previously attached, it will be replaced.<br>
* Attachments to NEWT events allow users to pass on information
- * from one custom listener to another, ie custom listener to listener
+ * from one custom listener to another, ie custom listener to listener
* communication.
* @param attachment User application specific object
*/
@@ -89,14 +90,14 @@ public class NEWTEvent extends java.util.EventObject {
this.attachment = attachment;
}
- /**
+ /**
* @return The user application specific attachment, or null
*/
public final Object getAttachment() {
return attachment;
}
-
- /**
+
+ /**
* Returns <code>true</code> if this events has been {@link #setConsumed(boolean) consumed},
* otherwise <code>false</code>.
* @see #setConsumed(boolean)
@@ -104,8 +105,8 @@ public class NEWTEvent extends java.util.EventObject {
public final boolean isConsumed() {
return consumedTag == attachment;
}
-
- /**
+
+ /**
* If <code>consumed</code> is <code>true</code>, this event is marked as consumed,
* ie. the event will not be propagated any further to potential <i>other</i> event listener.
* Otherwise the event will be propagated to other event listener, the default.
@@ -129,7 +130,8 @@ public class NEWTEvent extends java.util.EventObject {
setAttachment( null );
}
}
-
+
+ @Override
public String toString() {
return toString(null).toString();
}
diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEventConsumer.java b/src/newt/classes/com/jogamp/newt/event/NEWTEventConsumer.java
index 6aa19e5..14fba67 100644
--- a/src/newt/classes/com/jogamp/newt/event/NEWTEventConsumer.java
+++ b/src/newt/classes/com/jogamp/newt/event/NEWTEventConsumer.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,18 +20,18 @@
* 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.newt.event;
public interface NEWTEventConsumer {
- /**
- * Consume the event
+ /**
+ * Consume the event
*
* @return true if the event has been consumed,
* otherwise it returns false for later propagation.
diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java b/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java
index fe224bb..7dd56ad 100644
--- a/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java
+++ b/src/newt/classes/com/jogamp/newt/event/NEWTEventFiFo.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.newt.event;
import java.util.LinkedList;
diff --git a/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java b/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java
index 6771365..f7ee3d7 100644
--- a/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java
+++ b/src/newt/classes/com/jogamp/newt/event/NEWTEventListener.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package com.jogamp.newt.event;
diff --git a/src/newt/classes/com/jogamp/newt/event/OutputEvent.java b/src/newt/classes/com/jogamp/newt/event/OutputEvent.java
index 86fa958..80c7780 100644
--- a/src/newt/classes/com/jogamp/newt/event/OutputEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/OutputEvent.java
@@ -39,7 +39,7 @@ public abstract class OutputEvent extends NEWTEvent
public String toString() {
return toString(null).toString();
}
-
+
public StringBuilder toString(StringBuilder sb) {
if(null == sb) {
sb = new StringBuilder();
diff --git a/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java b/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java
new file mode 100644
index 0000000..42f006f
--- /dev/null
+++ b/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java
@@ -0,0 +1,228 @@
+/**
+ * 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.
+ */
+package com.jogamp.newt.event;
+
+import javax.media.nativewindow.NativeSurface;
+
+import jogamp.newt.Debug;
+
+/**
+ * 2 pointer zoom, a.k.a. <i>pinch to zoom</i>, gesture handler processing {@link MouseEvent}s
+ * while producing {@link ZoomEvent}s if gesture is completed.
+ * <p>
+ * Zoom value lies within [0..2], with 1 as <i>1:1</i>.
+ * </p>
+ * <pre>
+ * - choosing the smallest surface edge (width/height -> x/y)
+ * - tolerating other fingers to be pressed and hence user to add functionality (scale, ..)
+ * </pre>
+ */
+public class PinchToZoomGesture implements GestureHandler {
+ public static final boolean DEBUG = Debug.debug("Window.MouseEvent");
+
+ /** A {@link GestureHandler.GestureEvent} denominating zoom. */
+ @SuppressWarnings("serial")
+ public static class ZoomEvent extends GestureEvent {
+ private final MouseEvent pe;
+ private final float zoom;
+ public ZoomEvent(Object source, long when, int modifiers, GestureHandler handler, MouseEvent pe, float zoom) {
+ super(source, when, modifiers, handler);
+ this.pe = pe;
+ this.zoom = zoom;
+ }
+ /** Triggering {@link MouseEvent} */
+ public final MouseEvent getTrigger() { return pe; }
+ /** Zoom value lies within [0..2], with 1 as <i>1:1</i>. */
+ public final float getZoom() { return zoom; }
+ }
+
+ private final NativeSurface surface;
+ private final boolean allowMorePointer;
+ private float zoom;
+ private int zoomLastEdgeDist;
+ private boolean zoomFirstTouch;
+ private boolean zoomMode;
+ private ZoomEvent zoomEvent;
+ private final short[] pIds = new short[] { -1, -1 };
+
+ /**
+ * @param surface the {@link NativeSurface}, which size is used to compute the relative zoom factor
+ * @param allowMorePointer if false, allow only 2 pressed pointers (safe and recommended), otherwise accept other pointer to be pressed.
+ */
+ public PinchToZoomGesture(NativeSurface surface, boolean allowMorePointer) {
+ clear(true);
+ this.surface = surface;
+ this.allowMorePointer = allowMorePointer;
+ this.zoom = 1f;
+ }
+
+ @Override
+ public String toString() {
+ return "PinchZoom[1stTouch "+zoomFirstTouch+", in "+isWithinGesture()+", has "+(null!=zoomEvent)+", zoom "+zoom+"]";
+ }
+
+ private int gesturePointers(final MouseEvent e, final int excludeIndex) {
+ int j = 0;
+ for(int i=e.getPointerCount()-1; i>=0; i--) {
+ if( excludeIndex != i ) {
+ final int id = e.getPointerId(i);
+ if( pIds[0] == id || pIds[1] == id ) {
+ j++;
+ }
+ }
+ }
+ return j;
+ }
+
+ @Override
+ public void clear(boolean clearStarted) {
+ zoomEvent = null;
+ if( clearStarted ) {
+ zoomLastEdgeDist = 0;
+ zoomFirstTouch = true;
+ zoomMode = false;
+ pIds[0] = -1;
+ pIds[1] = -1;
+ }
+ }
+
+ @Override
+ public boolean isWithinGesture() {
+ return zoomMode;
+ }
+
+ @Override
+ public boolean hasGesture() {
+ return null != zoomEvent;
+ }
+
+ @Override
+ public InputEvent getGestureEvent() {
+ return zoomEvent;
+ }
+
+ /** Zoom value lies within [0..2], with 1 as <i>1:1</i>. */
+ public final float getZoom() {
+ return zoom;
+ }
+ /** Set zoom value within [0..2], with 1 as <i>1:1</i>. */
+ public final void setZoom(float zoom) {
+ this.zoom=zoom;
+ }
+
+ @Override
+ public boolean process(final InputEvent in) {
+ if( null != zoomEvent || !(in instanceof MouseEvent) ) {
+ return true;
+ }
+ final MouseEvent pe = (MouseEvent)in;
+ final int pointerDownCount = pe.getPointerCount();
+
+ if( pe.getPointerType(0).getPointerClass() != MouseEvent.PointerClass.Onscreen ||
+ ( !allowMorePointer && pointerDownCount > 2 ) ) {
+ return false;
+ }
+
+ final int eventType = pe.getEventType();
+ final boolean useY = surface.getWidth() >= surface.getHeight(); // use smallest dimension
+ switch ( eventType ) {
+ case MouseEvent.EVENT_MOUSE_PRESSED: {
+ if( 1 == pointerDownCount ) {
+ pIds[0] = pe.getPointerId(0);
+ pIds[1] = -1;
+ } else if ( 2 <= pointerDownCount ) { // && 1 == gesturePointers(pe, 0) /* w/o pressed pointer */) {
+ pIds[0] = pe.getPointerId(0);
+ pIds[1] = pe.getPointerId(1);
+ }
+ if(DEBUG) {
+ System.err.println("XXX1: id0 "+pIds[0]+" -> idx0 "+0+", id1 "+pIds[1]+" -> idx1 "+1);
+ System.err.println(this+".pressed: down "+pointerDownCount+", gPtr "+gesturePointers(pe, -1)+", event "+pe);
+ }
+ } break;
+
+ case MouseEvent.EVENT_MOUSE_RELEASED: {
+ final int gPtr = gesturePointers(pe, 0); // w/o lifted pointer
+ if ( 1 == gPtr ) {
+ zoomFirstTouch = true;
+ zoomMode = false;
+ } else if( 0 == gPtr ) {
+ // all lifted
+ clear(true);
+ }
+ if(DEBUG) {
+ System.err.println(this+".released: down "+pointerDownCount+", gPtr "+gPtr+", event "+pe);
+ }
+ } break;
+
+ case MouseEvent.EVENT_MOUSE_DRAGGED: {
+ if( 2 <= pointerDownCount ) {
+ final int gPtr = gesturePointers(pe, -1);
+ if( 2 == gPtr ) {
+ // same pointers
+ final int p0Idx = pe.getPointerIdx(pIds[0]);
+ final int p1Idx = pe.getPointerIdx(pIds[1]);
+ if( 0 <= p0Idx && 0 <= p1Idx ) {
+ final int edge0 = useY ? pe.getY(p0Idx) : pe.getX(p0Idx);
+ final int edge1 = useY ? pe.getY(p1Idx) : pe.getX(p1Idx);
+ // Diff. 1:1 Zoom: finger-distance to screen-coord
+ if(zoomFirstTouch) {
+ zoomLastEdgeDist = Math.abs(edge0-edge1);
+ zoomFirstTouch=false;
+ zoomMode = true;
+ } else if( zoomMode ) {
+ final int d = Math.abs(edge0-edge1);
+ final int dd = d - zoomLastEdgeDist;
+ final float screenEdge = useY ? surface.getHeight() : surface.getWidth();
+ final float incr = dd / screenEdge; // [-1..1]
+ if(DEBUG) {
+ System.err.println("XXX2: id0 "+pIds[0]+" -> idx0 "+p0Idx+", id1 "+pIds[1]+" -> idx1 "+p1Idx);
+ System.err.println("XXX3: d "+d+", ld "+zoomLastEdgeDist+", dd "+dd+", screen "+screenEdge+" -> incr "+incr+", zoom "+zoom+" -> "+(zoom+incr));
+ }
+ zoom += incr;
+ // clip value
+ if( 2f < zoom ) {
+ zoom = 2f;
+ } else if( 0 > zoom ) {
+ zoom = 0;
+ }
+ zoomLastEdgeDist = d;
+ zoomEvent = new ZoomEvent(pe.getSource(), pe.getWhen(), pe.getModifiers(), this, pe, zoom);
+ }
+ }
+ }
+ if(DEBUG) {
+ System.err.println(this+".dragged: down "+pointerDownCount+", gPtr "+gPtr+", event "+pe);
+ }
+ }
+ } break;
+
+ default:
+ }
+ return null != zoomEvent;
+ }
+}
diff --git a/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java
index 629dc50..bbc1709 100644
--- a/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/TraceKeyAdapter.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.newt.event;
public class TraceKeyAdapter implements KeyListener {
@@ -40,10 +40,12 @@ public class TraceKeyAdapter implements KeyListener {
this.downstream = downstream;
}
+ @Override
public void keyPressed(KeyEvent e) {
System.err.println(e);
if(null!=downstream) { downstream.keyPressed(e); }
}
+ @Override
public void keyReleased(KeyEvent e) {
System.err.println(e);
if(null!=downstream) { downstream.keyReleased(e); }
diff --git a/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java
index 14ee633..db83760 100644
--- a/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/TraceMouseAdapter.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.newt.event;
public class TraceMouseAdapter implements MouseListener {
@@ -40,34 +40,42 @@ public class TraceMouseAdapter implements MouseListener {
this.downstream = downstream;
}
+ @Override
public void mouseClicked(MouseEvent e) {
System.err.println(e);
if(null!=downstream) { downstream.mouseClicked(e); }
}
+ @Override
public void mouseEntered(MouseEvent e) {
System.err.println(e);
if(null!=downstream) { downstream.mouseEntered(e); }
}
+ @Override
public void mouseExited(MouseEvent e) {
System.err.println(e);
if(null!=downstream) { downstream.mouseExited(e); }
}
+ @Override
public void mousePressed(MouseEvent e) {
System.err.println(e);
if(null!=downstream) { downstream.mousePressed(e); }
}
+ @Override
public void mouseReleased(MouseEvent e) {
System.err.println(e);
if(null!=downstream) { downstream.mouseReleased(e); }
}
+ @Override
public void mouseMoved(MouseEvent e) {
System.err.println(e);
if(null!=downstream) { downstream.mouseMoved(e); }
}
+ @Override
public void mouseDragged(MouseEvent e) {
System.err.println(e);
if(null!=downstream) { downstream.mouseDragged(e); }
}
+ @Override
public void mouseWheelMoved(MouseEvent e) {
System.err.println(e);
if(null!=downstream) { downstream.mouseWheelMoved(e); }
diff --git a/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java
index 8542820..7b844f0 100644
--- a/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/TraceWindowAdapter.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.newt.event;
public class TraceWindowAdapter implements WindowListener {
@@ -40,30 +40,37 @@ public class TraceWindowAdapter implements WindowListener {
this.downstream = downstream;
}
+ @Override
public void windowResized(WindowEvent e) {
System.err.println(e);
if(null!=downstream) { downstream.windowResized(e); }
}
+ @Override
public void windowMoved(WindowEvent e) {
System.err.println(e);
if(null!=downstream) { downstream.windowMoved(e); }
}
+ @Override
public void windowDestroyNotify(WindowEvent e) {
System.err.println(e);
if(null!=downstream) { downstream.windowDestroyNotify(e); }
}
+ @Override
public void windowDestroyed(WindowEvent e) {
System.err.println(e);
if(null!=downstream) { downstream.windowDestroyed(e); }
}
+ @Override
public void windowGainedFocus(WindowEvent e) {
System.err.println(e);
if(null!=downstream) { downstream.windowGainedFocus(e); }
}
+ @Override
public void windowLostFocus(WindowEvent e) {
System.err.println(e);
if(null!=downstream) { downstream.windowLostFocus(e); }
}
+ @Override
public void windowRepaint(WindowUpdateEvent e) {
System.err.println(e);
if(null!=downstream) { downstream.windowRepaint(e); }
diff --git a/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java
index b9e487e..ccc6274 100644
--- a/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/WindowAdapter.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,28 +20,35 @@
* 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.newt.event;
public abstract class WindowAdapter implements WindowListener
{
+ @Override
public void windowResized(WindowEvent e) {
}
+ @Override
public void windowMoved(WindowEvent e) {
}
+ @Override
public void windowDestroyNotify(WindowEvent e) {
}
+ @Override
public void windowDestroyed(WindowEvent e) {
}
+ @Override
public void windowGainedFocus(WindowEvent e) {
}
+ @Override
public void windowLostFocus(WindowEvent e) {
}
+ @Override
public void windowRepaint(WindowUpdateEvent e) {
}
}
diff --git a/src/newt/classes/com/jogamp/newt/event/WindowEvent.java b/src/newt/classes/com/jogamp/newt/event/WindowEvent.java
index 24b3b38..2841fd0 100644
--- a/src/newt/classes/com/jogamp/newt/event/WindowEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/WindowEvent.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package com.jogamp.newt.event;
@@ -42,7 +42,7 @@ package com.jogamp.newt.event;
@SuppressWarnings("serial")
public class WindowEvent extends NEWTEvent {
public static final short EVENT_WINDOW_RESIZED = 100;
- public static final short EVENT_WINDOW_MOVED = 101;
+ public static final short EVENT_WINDOW_MOVED = 101;
public static final short EVENT_WINDOW_DESTROY_NOTIFY = 102;
public static final short EVENT_WINDOW_GAINED_FOCUS = 103;
public static final short EVENT_WINDOW_LOST_FOCUS = 104;
@@ -65,11 +65,13 @@ public class WindowEvent extends NEWTEvent {
default: return "unknown (" + type + ")";
}
}
-
+
+ @Override
public String toString() {
return toString(null).toString();
}
+ @Override
public StringBuilder toString(StringBuilder sb) {
if(null == sb) {
sb = new StringBuilder();
diff --git a/src/newt/classes/com/jogamp/newt/event/WindowListener.java b/src/newt/classes/com/jogamp/newt/event/WindowListener.java
index dde1825..e097edf 100644
--- a/src/newt/classes/com/jogamp/newt/event/WindowListener.java
+++ b/src/newt/classes/com/jogamp/newt/event/WindowListener.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package com.jogamp.newt.event;
@@ -44,17 +44,17 @@ public interface WindowListener extends NEWTEventListener {
/** Window has been moved. */
public void windowMoved(WindowEvent e);
- /**
+ /**
* Window destruction has been requested.
* <p>
* Depending on the {@link WindowClosingProtocol#getDefaultCloseOperation() default close operation},
* the window maybe destroyed or not.
* </p>
- * In case the window will be destroyed (see above), release of resources is recommended.
+ * In case the window will be destroyed (see above), release of resources is recommended.
**/
public void windowDestroyNotify(WindowEvent e);
- /**
+ /**
* Window has been destroyed.
*/
public void windowDestroyed(WindowEvent e);
diff --git a/src/newt/classes/com/jogamp/newt/event/WindowUpdateEvent.java b/src/newt/classes/com/jogamp/newt/event/WindowUpdateEvent.java
index a0f6e2c..9044517 100644
--- a/src/newt/classes/com/jogamp/newt/event/WindowUpdateEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/WindowUpdateEvent.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.newt.event;
import javax.media.nativewindow.util.Rectangle;
@@ -44,10 +44,12 @@ public class WindowUpdateEvent extends WindowEvent {
return bounds;
}
+ @Override
public String toString() {
return toString(null).toString();
}
+ @Override
public StringBuilder toString(StringBuilder sb) {
if(null == sb) {
sb = new StringBuilder();
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 6de2eee..e3bf184 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.newt.event.awt;
import jogamp.newt.Debug;
@@ -48,10 +48,10 @@ import jogamp.newt.Debug;
* Common:<br>
* <pre>
// your demo/render code
- javax.media.opengl.GLEvenListener demo1 = new javax.media.opengl.GLEvenListener() { ... } ;
+ javax.media.opengl.GLEvenListener demo1 = new javax.media.opengl.GLEvenListener() { ... } ;
// your AWT agnostic NEWT mouse listener code
- com.jogamp.newt.event.MouseListener mouseListener = new com.jogamp.newt.event.MouseAdapter() { ... } ;
+ com.jogamp.newt.event.MouseListener mouseListener = new com.jogamp.newt.event.MouseAdapter() { ... } ;
* </pre> </p>
* <p>
* Default NEWT use case, without using the AWTAdapter:<br>
@@ -96,7 +96,7 @@ import jogamp.newt.Debug;
<br>
new AWTMouseAdapter(mouseListener, glWindow).addTo(comp);<br>
* </pre> </p>
- *
+ *
* Last but not least, the AWTAdapter maybe used as a general AWT event forwarder to NEWT.<br>
*
* <p>
@@ -108,7 +108,7 @@ import jogamp.newt.Debug;
<br>
new AWTMouseAdapter(glWindow).addTo(comp); // forward all AWT events to glWindow, as NEWT events<br>
* </pre> </p>
- *
+ *
* @see #attachTo
*/
public abstract class AWTAdapter implements java.util.EventListener
@@ -118,7 +118,7 @@ public abstract class AWTAdapter implements java.util.EventListener
com.jogamp.newt.event.NEWTEventListener newtListener;
com.jogamp.newt.Window newtWindow;
- /**
+ /**
* Simply wrap aroung a NEWT EventListener, exposed as an AWT EventListener.<br>
* The NEWT EventListener will be called when an event happens.<br>
*/
@@ -130,7 +130,7 @@ public abstract class AWTAdapter implements java.util.EventListener
this.newtWindow = null;
}
- /**
+ /**
* Wrap aroung a NEWT EventListener, exposed as an AWT EventListener,<br>
* where the given NEWT Window impersonates as the event's source.
* The NEWT EventListener will be called when an event happens.<br>
@@ -146,7 +146,7 @@ public abstract class AWTAdapter implements java.util.EventListener
this.newtWindow = newtProxy;
}
- /**
+ /**
* Create a pipeline adapter, AWT EventListener.<br>
* Once attached to an AWT component, it sends the converted AWT events to the NEWT downstream window.<br>
* This is only supported with EDT enabled!
@@ -162,15 +162,15 @@ public abstract class AWTAdapter implements java.util.EventListener
}
}
- public final com.jogamp.newt.Window getNewtWindow() {
- return newtWindow;
+ public final com.jogamp.newt.Window getNewtWindow() {
+ return newtWindow;
}
-
+
public final com.jogamp.newt.event.NEWTEventListener getNewtEventListener() {
- return newtListener;
+ return newtListener;
}
-
- /**
+
+ /**
* Due to the fact that some NEWT {@link com.jogamp.newt.event.NEWTEventListener}
* are mapped to more than one {@link java.util.EventListener},
* this method is for your convenience to use this Adapter as a listener for all types.<br>
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 bef2e5d..f6f11b8 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,18 +20,18 @@
* 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.newt.event.awt;
import jogamp.newt.awt.event.AWTNewtEventFactory;
/**
- * AWT:
+ * AWT:
* printable: PRESSED (t0), TYPED (t0), RELEASED (t1)
* non-printable: PRESSED (t0), RELEASED (t1)
*/
@@ -49,11 +49,13 @@ public class AWTKeyAdapter extends AWTAdapter implements java.awt.event.KeyListe
super(downstream);
}
+ @Override
public AWTAdapter addTo(java.awt.Component awtComponent) {
awtComponent.addKeyListener(this);
return this;
}
+ @Override
public AWTAdapter removeFrom(java.awt.Component awtComponent) {
awtComponent.removeKeyListener(this);
return this;
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 115743a..73a02c9 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,17 +20,17 @@
* 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.newt.event.awt;
import jogamp.newt.awt.event.AWTNewtEventFactory;
-public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseListener,
+public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseListener,
java.awt.event.MouseMotionListener,
java.awt.event.MouseWheelListener
{
@@ -46,6 +46,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
super(downstream);
}
+ @Override
public AWTAdapter addTo(java.awt.Component awtComponent) {
awtComponent.addMouseListener(this);
awtComponent.addMouseMotionListener(this);
@@ -53,6 +54,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
return this;
}
+ @Override
public AWTAdapter removeFrom(java.awt.Component awtComponent) {
awtComponent.removeMouseListener(this);
awtComponent.removeMouseMotionListener(this);
@@ -60,6 +62,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
return this;
}
+ @Override
public void mouseClicked(java.awt.event.MouseEvent e) {
com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
if(null!=newtListener) {
@@ -69,6 +72,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
}
}
+ @Override
public void mouseEntered(java.awt.event.MouseEvent e) {
com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
if(null!=newtListener) {
@@ -78,6 +82,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
}
}
+ @Override
public void mouseExited(java.awt.event.MouseEvent e) {
com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
if(null!=newtListener) {
@@ -87,6 +92,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
}
}
+ @Override
public void mousePressed(java.awt.event.MouseEvent e) {
com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
if(null!=newtListener) {
@@ -96,6 +102,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
}
}
+ @Override
public void mouseReleased(java.awt.event.MouseEvent e) {
com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
if(null!=newtListener) {
@@ -105,6 +112,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
}
}
+ @Override
public void mouseDragged(java.awt.event.MouseEvent e) {
com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
if(null!=newtListener) {
@@ -114,6 +122,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
}
}
+ @Override
public void mouseMoved(java.awt.event.MouseEvent e) {
com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
if(null!=newtListener) {
@@ -123,6 +132,7 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL
}
}
+ @Override
public void mouseWheelMoved(java.awt.event.MouseWheelEvent e) {
com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow);
if(null!=newtListener) {
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 e91bb2f..8a9a2a4 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,20 +20,20 @@
* 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.newt.event.awt;
import java.awt.Dimension;
import jogamp.newt.awt.event.AWTNewtEventFactory;
-public class AWTWindowAdapter
- extends AWTAdapter
+public class AWTWindowAdapter
+ extends AWTAdapter
implements java.awt.event.ComponentListener, java.awt.event.WindowListener, java.awt.event.FocusListener
{
WindowClosingListener windowClosingListener;
@@ -50,6 +50,7 @@ public class AWTWindowAdapter
super(downstream);
}
+ @Override
public AWTAdapter addTo(java.awt.Component awtComponent) {
java.awt.Window win = getWindow(awtComponent);
awtComponent.addComponentListener(this);
@@ -63,17 +64,18 @@ public class AWTWindowAdapter
if(awtComponent instanceof java.awt.Window) {
((java.awt.Window)awtComponent).addWindowListener(this);
}
- return this;
+ return this;
}
-
+
public AWTAdapter removeWindowClosingFrom(java.awt.Component awtComponent) {
java.awt.Window win = getWindow(awtComponent);
if( null != win && null != windowClosingListener ) {
win.removeWindowListener(windowClosingListener);
}
- return this;
+ return this;
}
-
+
+ @Override
public AWTAdapter removeFrom(java.awt.Component awtComponent) {
awtComponent.removeFocusListener(this);
awtComponent.removeComponentListener(this);
@@ -94,6 +96,7 @@ public class AWTWindowAdapter
return null;
}
+ @Override
public void focusGained(java.awt.event.FocusEvent e) {
com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
if(DEBUG_IMPLEMENTATION) {
@@ -106,6 +109,7 @@ public class AWTWindowAdapter
}
}
+ @Override
public void focusLost(java.awt.event.FocusEvent e) {
com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
if(DEBUG_IMPLEMENTATION) {
@@ -118,6 +122,7 @@ public class AWTWindowAdapter
}
}
+ @Override
public void componentResized(java.awt.event.ComponentEvent e) {
com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
if(DEBUG_IMPLEMENTATION) {
@@ -142,6 +147,7 @@ public class AWTWindowAdapter
}
}
+ @Override
public void componentMoved(java.awt.event.ComponentEvent e) {
com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
if(DEBUG_IMPLEMENTATION) {
@@ -154,6 +160,7 @@ public class AWTWindowAdapter
}
}
+ @Override
public void componentShown(java.awt.event.ComponentEvent e) {
final java.awt.Component comp = e.getComponent();
if(DEBUG_IMPLEMENTATION) {
@@ -171,6 +178,7 @@ public class AWTWindowAdapter
}*/
}
+ @Override
public void componentHidden(java.awt.event.ComponentEvent e) {
final java.awt.Component comp = e.getComponent();
if(DEBUG_IMPLEMENTATION) {
@@ -188,6 +196,7 @@ public class AWTWindowAdapter
}*/
}
+ @Override
public void windowActivated(java.awt.event.WindowEvent e) {
com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
if(null!=newtListener) {
@@ -197,10 +206,13 @@ public class AWTWindowAdapter
}
}
+ @Override
public void windowClosed(java.awt.event.WindowEvent e) { }
+ @Override
public void windowClosing(java.awt.event.WindowEvent e) { }
+ @Override
public void windowDeactivated(java.awt.event.WindowEvent e) {
com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
if(null!=newtListener) {
@@ -210,13 +222,17 @@ public class AWTWindowAdapter
}
}
+ @Override
public void windowDeiconified(java.awt.event.WindowEvent e) { }
+ @Override
public void windowIconified(java.awt.event.WindowEvent e) { }
+ @Override
public void windowOpened(java.awt.event.WindowEvent e) { }
class WindowClosingListener implements java.awt.event.WindowListener {
+ @Override
public void windowClosing(java.awt.event.WindowEvent e) {
com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
if(null!=newtListener) {
@@ -225,7 +241,8 @@ public class AWTWindowAdapter
enqueueEvent(true, event);
}
}
- public void windowClosed(java.awt.event.WindowEvent e) {
+ @Override
+ public void windowClosed(java.awt.event.WindowEvent e) {
com.jogamp.newt.event.WindowEvent event = AWTNewtEventFactory.createWindowEvent(e, newtWindow);
if(null!=newtListener) {
((com.jogamp.newt.event.WindowListener)newtListener).windowDestroyed(event);
@@ -234,10 +251,15 @@ public class AWTWindowAdapter
}
}
+ @Override
public void windowActivated(java.awt.event.WindowEvent e) { }
+ @Override
public void windowDeactivated(java.awt.event.WindowEvent e) { }
+ @Override
public void windowDeiconified(java.awt.event.WindowEvent e) { }
+ @Override
public void windowIconified(java.awt.event.WindowEvent e) { }
+ @Override
public void windowOpened(java.awt.event.WindowEvent e) { }
}
}
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index e85d67d..4f259fe 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -63,6 +63,7 @@ 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 jogamp.newt.WindowImpl;
import jogamp.opengl.GLAutoDrawableBase;
@@ -76,10 +77,12 @@ import com.jogamp.newt.MonitorDevice;
import com.jogamp.newt.NewtFactory;
import com.jogamp.newt.Screen;
import com.jogamp.newt.Window;
+import com.jogamp.newt.event.GestureHandler;
import com.jogamp.newt.event.KeyListener;
import com.jogamp.newt.event.MouseListener;
import com.jogamp.newt.event.NEWTEvent;
import com.jogamp.newt.event.NEWTEventConsumer;
+import com.jogamp.newt.event.NEWTEventListener;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.event.WindowListener;
@@ -96,12 +99,12 @@ import com.jogamp.opengl.GLStateKeeper;
* </P>
* <P>
* This implementation does not make the OpenGL context current<br>
- * before calling the various input EventListener callbacks, ie {@link com.jogamp.newt.event.MouseListener} etc.<br>
+ * before calling the various input EventListener callbacks, ie {@link MouseListener} etc.<br>
* This design decision is made in favor of a more performant and simplified
* implementation. Also the event dispatcher shall be implemented OpenGL agnostic.<br>
- * To be able to use OpenGL commands from within such input {@link com.jogamp.newt.event.NEWTEventListener},<br>
- * you can inject {@link javax.media.opengl.GLRunnable} objects
- * via {@link #invoke(boolean, javax.media.opengl.GLRunnable)} to the OpenGL command stream.<br>
+ * To be able to use OpenGL commands from within such input {@link NEWTEventListener},<br>
+ * you can inject {@link GLRunnable} objects
+ * via {@link #invoke(boolean, GLRunnable)} to the OpenGL command stream.<br>
* </p>
*/
public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Window, NEWTEventConsumer, FPSCounter {
@@ -114,6 +117,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
super(null, null, false /* always handle device lifecycle ourselves */);
this.window = (WindowImpl) window;
this.window.setWindowDestroyNotifyAction( new Runnable() {
+ @Override
public void run() {
defaultWindowDestroyNotifyOp();
} } );
@@ -124,7 +128,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
}
@Override
- public void windowResized(WindowEvent e) {
+ public void windowResized(WindowEvent e) {
defaultWindowResizedOp(getWidth(), getHeight());
}
@@ -136,7 +140,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
public final Object getUpstreamWidget() {
return window;
}
-
+
/**
* Creates a new GLWindow attaching a new Window referencing a
* new default Screen and default Display with the given GLCapabilities.
@@ -215,7 +219,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
@Override
public final CapabilitiesImmutable getChosenCapabilities() {
final GLDrawable _drawable = drawable;
- return null != _drawable ? _drawable.getChosenGLCapabilities() : window.getChosenCapabilities();
+ return null != _drawable ? _drawable.getChosenGLCapabilities() : window.getChosenCapabilities();
}
@Override
@@ -336,7 +340,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
public final int getY() {
return window.getY();
}
-
+
@Override
public final int getWidth() {
return window.getWidth();
@@ -346,7 +350,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
public final int getHeight() {
return window.getHeight();
}
-
+
@Override
public final void setPosition(int x, int y) {
window.setPosition(x, y);
@@ -360,7 +364,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
public final boolean setFullscreen(boolean fullscreen) {
return window.setFullscreen(fullscreen);
}
-
+
@Override
public boolean setFullscreen(List<MonitorDevice> monitors) {
return window.setFullscreen(monitors);
@@ -388,8 +392,8 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
}
@Override
- public final ReparentOperation reparentWindow(NativeWindow newParent, boolean forceDestroyCreate) {
- return window.reparentWindow(newParent, forceDestroyCreate);
+ public final ReparentOperation reparentWindow(NativeWindow newParent, int x, int y, boolean forceDestroyCreate) {
+ return window.reparentWindow(newParent, x, y, forceDestroyCreate);
}
@Override
@@ -415,7 +419,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
public void setWindowDestroyNotifyAction(Runnable r) {
window.setWindowDestroyNotifyAction(r);
}
-
+
@Override
public final void setVisible(boolean visible) {
window.setVisible(visible);
@@ -447,7 +451,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
public void preserveGLStateAtDestroy(boolean value) {
GLWindow.this.preserveGLStateAtDestroy(value);
}
-
+
@Override
public synchronized void destroyActionPreLock() {
// nop
@@ -461,7 +465,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
//Exception e1 = new Exception(msg);
//e1.printStackTrace();
}
-
+
destroyImplInLock();
if(Window.DEBUG_IMPLEMENTATION) {
@@ -490,26 +494,29 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
} else {
t0 = 0;
}
-
+
if (null == drawable && visible && 0 != window.getWindowHandle() && 0<getWidth()*getHeight()) {
if( ( null != context ) ) {
throw new InternalError("GLWindow.LifecycleHook.setVisiblePost: "+WindowImpl.getThreadName()+" - Null drawable, but valid context - "+GLWindow.this);
}
- final NativeSurface ns;
- {
- final NativeSurface wrapped_ns = window.getWrappedSurface();
- ns = null != wrapped_ns ? wrapped_ns : window;
- }
- final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) ns.getGraphicsConfiguration().getChosenCapabilities();
- if(null==factory) {
- factory = GLDrawableFactory.getFactory(glCaps.getGLProfile());
- }
- drawable = (GLDrawableImpl) factory.createGLDrawable(ns);
- drawable.setRealized(true);
-
- if( !GLWindow.this.pushGLEventListenerState() ) {
- context = (GLContextImpl) drawable.createContext(sharedContext);
- context.setContextCreationFlags(additionalCtxCreationFlags);
+ final GLContext[] shareWith = { null };
+ if( !helper.isSharedGLContextPending(shareWith) ) {
+ final NativeSurface ns;
+ {
+ final NativeSurface wrapped_ns = window.getWrappedSurface();
+ ns = null != wrapped_ns ? wrapped_ns : window;
+ }
+ final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) ns.getGraphicsConfiguration().getChosenCapabilities();
+ if(null==factory) {
+ factory = GLDrawableFactory.getFactory(glCaps.getGLProfile());
+ }
+ drawable = (GLDrawableImpl) factory.createGLDrawable(ns);
+ drawable.setRealized(true);
+
+ if( !GLWindow.this.restoreGLEventListenerState() ) {
+ context = (GLContextImpl) drawable.createContext(shareWith[0]);
+ context.setContextCreationFlags(additionalCtxCreationFlags);
+ }
}
}
if(Window.DEBUG_IMPLEMENTATION) {
@@ -535,7 +542,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
savedAnimator.resume();
}
}
-
+
@SuppressWarnings("deprecation")
@Override
public void shutdownRenderingAction() {
@@ -546,11 +553,16 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
anim.stop(); // on anim thread, non-blocking
} else {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
if( anim.isAnimating() && null != animThread ) {
try {
animThread.stop();
} catch(Throwable t) {
+ if( DEBUG ) {
+ System.err.println("Catched "+t.getClass().getName()+": "+t.getMessage());
+ t.printStackTrace();
+ }
}
}
return null;
@@ -564,24 +576,10 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
// OpenGL-related methods and state
//
- private GLContext sharedContext = null;
-
@Override
protected final RecursiveLock getLock() {
return window.getLock();
}
-
- /**
- * Specifies an {@link javax.media.opengl.GLContext OpenGL context} to share with.<br>
- * At native creation, {@link #setVisible(boolean) setVisible(true)},
- * a {@link javax.media.opengl.GLDrawable drawable} and {@link javax.media.opengl.GLContext context} is created besides the native Window itself,<br>
- * hence you shall set the shared context before.
- *
- * @param sharedContext The OpenGL context shared by this GLWindow's one
- */
- public void setSharedContext(GLContext sharedContext) {
- this.sharedContext = sharedContext;
- }
@Override
public void display() {
@@ -612,7 +610,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
setVisible(true);
}
}
-
+
/**
* {@inheritDoc}
* <p>
@@ -636,7 +634,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
public final void swapBuffers() throws GLException {
defaultSwapBuffers();
}
-
+
//----------------------------------------------------------------------
// NEWTEventConsumer
//
@@ -768,6 +766,39 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
return window.getMouseListeners();
}
+ @Override
+ public void setDefaultGesturesEnabled(boolean enable) {
+ window.setDefaultGesturesEnabled(enable);
+ }
+ @Override
+ public boolean areDefaultGesturesEnabled() {
+ return window.areDefaultGesturesEnabled();
+ }
+ @Override
+ public final void addGestureHandler(GestureHandler gh) {
+ window.addGestureHandler(gh);
+ }
+ @Override
+ public final void addGestureHandler(int index, GestureHandler gh) {
+ window.addGestureHandler(index, gh);
+ }
+ @Override
+ public final void removeGestureHandler(GestureHandler gh) {
+ window.removeGestureHandler(gh);
+ }
+ @Override
+ public final void addGestureListener(GestureHandler.GestureListener gl) {
+ window.addGestureListener(-1, gl);
+ }
+ @Override
+ public final void addGestureListener(int index, GestureHandler.GestureListener gl) {
+ window.addGestureListener(index, gl);
+ }
+ @Override
+ public final void removeGestureListener(GestureHandler.GestureListener gl) {
+ window.removeGestureListener(gl);
+ }
+
//----------------------------------------------------------------------
// NativeWindow completion
//
@@ -853,7 +884,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
_forceGL3 = true;
} else if(args[i].equals("-gl4es3")) {
_forceGL4ES3 = true;
- }
+ }
}
}
forceES2 = _forceES2;
@@ -865,7 +896,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
System.err.println("forceES3 "+forceES3);
System.err.println("forceGL3 "+forceGL3);
System.err.println("forceGL4ES3 "+forceGL4ES3);
-
+
System.err.println(VersionUtil.getPlatformInfo());
System.err.println(GlueGenVersion.getInstance());
System.err.println(JoglVersion.getInstance());
diff --git a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
index 47dfca0..e63a535 100644
--- a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
+++ b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -71,9 +71,9 @@ import com.jogamp.newt.util.EDTUtil;
public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
private static final boolean DEBUG = Debug.debug("Window");
private static final boolean isOSX = NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false);
-
- private final AbstractGraphicsScreen screen;
-
+
+ private final AbstractGraphicsScreen screen;
+
private WindowClosingMode newtChildCloseOp = WindowClosingMode.DISPOSE_ON_CLOSE;
private volatile Rectangle clientArea;
@@ -82,45 +82,46 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
private volatile boolean newtChildReady = false; // ready if SWTEDTUtil is set and newtChild parented
private volatile boolean postSetSize = false; // pending resize
- /**
- * Creates an instance using {@link #NewtCanvasSWT(Composite, int, Window)}
+ /**
+ * Creates an instance using {@link #NewtCanvasSWT(Composite, int, Window)}
* on the SWT thread.
- *
+ *
* <p>
* Note: The NEWT child {@link Display}'s {@link EDTUtil} is being set to an SWT conform implementation
- * via {@link Display#setEDTUtil(EDTUtil)}.
+ * via {@link Display#setEDTUtil(EDTUtil)}.
* </p>
- *
+ *
* @param parent the SWT composite
- * @param style additional styles to SWT#NO_BACKGROUND
- * @param child optional preassigned {@link #Window}, maybe null
+ * @param style additional styles to SWT#NO_BACKGROUND
+ * @param child optional preassigned {@link #Window}, maybe null
* @return a new instance
*/
public static NewtCanvasSWT create(final Composite parent, final int style, final Window child) {
- final NewtCanvasSWT[] res = new NewtCanvasSWT[] { null };
+ final NewtCanvasSWT[] res = new NewtCanvasSWT[] { null };
parent.getDisplay().syncExec( new Runnable() {
+ @Override
public void run() {
res[0] = new NewtCanvasSWT( parent, style, child);
}
});
return res[0];
}
-
+
/**
* Instantiates a NewtCanvas with a NEWT child.
- *
+ *
* <p>
* Note: The NEWT child {@link Display}'s {@link EDTUtil} is being set to an SWT conform implementation
- * via {@link Display#setEDTUtil(EDTUtil)}.
+ * via {@link Display#setEDTUtil(EDTUtil)}.
* </p>
- *
+ *
* @param parent the SWT composite
- * @param style additional styles to SWT#NO_BACKGROUND
- * @param child optional preassigned {@link #Window}, maybe null
+ * @param style additional styles to SWT#NO_BACKGROUND
+ * @param child optional preassigned {@link #Window}, maybe null
*/
public NewtCanvasSWT(final Composite parent, final int style, Window child) {
super(parent, style | SWT.NO_BACKGROUND);
-
+
SWTAccessor.setRealized(this, true);
clientArea = getClientArea();
@@ -128,7 +129,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
final AbstractGraphicsDevice device = SWTAccessor.getDevice(this);
screen = SWTAccessor.getScreen(device, -1 /* default */);
nativeWindow = null;
-
+
if(null != child) {
setNEWTChild(child);
}
@@ -161,12 +162,12 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
addListener (SWT.Paint, listener);
addListener (SWT.Dispose, listener);
}
-
+
/** assumes nativeWindow == null ! */
protected final boolean validateNative() {
updateSizeCheck();
final Rectangle nClientArea = clientArea;
- if(0 >= nClientArea.width || 0 >= nClientArea.height) {
+ if(0 >= nClientArea.width || 0 >= nClientArea.height) {
return false;
}
screen.getDevice().open();
@@ -177,9 +178,9 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
final boolean visualIDValid = NativeWindowFactory.isNativeVisualIDValidForProcessing(visualID);
if(DEBUG) {
System.err.println("NewtCanvasSWT.validateNative() windowHandle 0x"+Long.toHexString(nativeWindowHandle)+", visualID 0x"+Integer.toHexString(visualID)+", valid "+visualIDValid);
- }
+ }
if( visualIDValid ) {
- /* Get the nativewindow-Graphics Device associated with this control (which is determined by the parent Composite).
+ /* Get the nativewindow-Graphics Device associated with this control (which is determined by the parent Composite).
* Note: SWT is owner of the native handle, hence no closing operation will be a NOP. */
final CapabilitiesImmutable caps = new Capabilities();
final GraphicsConfigurationFactory factory = GraphicsConfigurationFactory.getFactory(screen.getDevice(), caps);
@@ -187,7 +188,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
if(DEBUG) {
System.err.println("NewtCanvasSWT.validateNative() factory: "+factory+", windowHandle 0x"+Long.toHexString(nativeWindowHandle)+", visualID 0x"+Integer.toHexString(visualID)+", chosen config: "+config);
// Thread.dumpStack();
- }
+ }
if (null == config) {
throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this);
}
@@ -198,11 +199,11 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
return null != nativeWindow;
}
-
+
protected final void updateSizeCheck() {
final Rectangle oClientArea = clientArea;
final Rectangle nClientArea = getClientArea();
- if ( nClientArea != null &&
+ if ( nClientArea != null &&
( nClientArea.width != oClientArea.width || nClientArea.height != oClientArea.height )
) {
clientArea = nClientArea; // write back new value
@@ -217,12 +218,12 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
}
}
}
-
+
@Override
public void update() {
// don't paint background etc .. nop avoids flickering
}
-
+
/**
* Destroys this resource:
* <ul>
@@ -248,44 +249,46 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
}
screen.getDevice().close();
nativeWindow = null;
- super.dispose();
+ super.dispose();
}
-
+
/** @return this SWT Canvas NativeWindow representation, may be null in case it has not been realized. */
public NativeWindow getNativeWindow() { return nativeWindow; }
-
+
+ @Override
public WindowClosingMode getDefaultCloseOperation() {
return newtChildCloseOp; // TODO: implement ?!
}
+ @Override
public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) {
return newtChildCloseOp = op; // TODO: implement ?!
}
boolean isParent() {
- return null!=newtChild ;
+ return null!=newtChild ;
}
boolean isFullscreen() {
return null != newtChild && newtChild.isFullscreen();
}
- /**
+ /**
* Sets a new NEWT child, provoking reparenting.
* <p>
* A previously detached <code>newChild</code> will be released to top-level status
- * and made invisible.
+ * and made invisible.
* </p>
* <p>
- * Note: When switching NEWT child's, detaching the previous first via <code>setNEWTChild(null)</code>
- * produced much cleaner visual results.
+ * Note: When switching NEWT child's, detaching the previous first via <code>setNEWTChild(null)</code>
+ * produced much cleaner visual results.
* </p>
* <p>
* Note: The NEWT child {@link Display}'s {@link EDTUtil} is being set to an SWT conform implementation
- * via {@link Display#setEDTUtil(EDTUtil)}.
+ * via {@link Display#setEDTUtil(EDTUtil)}.
* </p>
- * @return the previous attached newt child.
+ * @return the previous attached newt child.
*/
public Window setNEWTChild(final Window newChild) {
final Window prevChild = newtChild;
@@ -302,14 +305,14 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
if(null != nativeWindow && null != newChild) {
reparentWindow( true );
}
- return prevChild;
+ return prevChild;
}
-
+
/** @return the current NEWT child */
public Window getNEWTChild() {
return newtChild;
}
-
+
@Override
public boolean setParent(Composite parent) {
return super.setParent(parent);
@@ -319,11 +322,11 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
newtChildReady = attach;
if( null != newtChild ) {
newtChild.setKeyboardFocusHandler(null);
- if(attach) {
- newtChildCloseOp = newtChild.setDefaultCloseOperation(WindowClosingMode.DO_NOTHING_ON_CLOSE);
+ if(attach) {
+ newtChildCloseOp = newtChild.setDefaultCloseOperation(WindowClosingMode.DO_NOTHING_ON_CLOSE);
} else {
newtChild.setFocusAction(null);
- newtChild.setDefaultCloseOperation(newtChildCloseOp);
+ newtChild.setDefaultCloseOperation(newtChildCloseOp);
}
}
}
@@ -335,28 +338,28 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
if(DEBUG) {
System.err.println("NewtCanvasSWT.reparentWindow.0: add="+add+", win "+newtWinHandleToHexString(newtChild)+", EDTUtil: cur "+newtChild.getScreen().getDisplay().getEDTUtil());
}
-
+
newtChild.setFocusAction(null); // no AWT focus traversal ..
if(add) {
updateSizeCheck();
final int w = clientArea.width;
final int h = clientArea.height;
-
+
// set SWT EDT and start it
{
final Display newtDisplay = newtChild.getScreen().getDisplay();
final EDTUtil edtUtil = new SWTEDTUtil(newtDisplay, getDisplay());
- edtUtil.restart();
+ edtUtil.start();
newtDisplay.setEDTUtil( edtUtil );
}
-
- newtChild.setSize(w, h);
+
+ newtChild.setSize(w, h);
newtChild.reparentWindow(nativeWindow);
newtChild.setVisible(true);
- configureNewtChild(true);
+ configureNewtChild(true);
newtChild.sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout to listener
-
- // force this SWT Canvas to be focus-able,
+
+ // force this SWT Canvas to be focus-able,
// since it is completely covered by the newtChild (z-order).
setEnabled(true);
} else {
@@ -375,19 +378,19 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
newtChild.requestFocus();
}
}
-
+
@Override
public boolean forceFocus() {
final boolean res = NewtCanvasSWT.super.forceFocus();
requestFocusNEWTChild();
- return res;
+ return res;
}
-
+
private class SWTNativeWindow implements NativeWindow {
private final AbstractGraphicsConfiguration config;
private final long nativeWindowHandle;
private final InsetsImmutable insets; // only required to allow proper client position calculation on OSX
-
+
public SWTNativeWindow(AbstractGraphicsConfiguration config, long nativeWindowHandle) {
this.config = config;
this.nativeWindowHandle = nativeWindowHandle;
@@ -397,7 +400,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
this.insets = new Insets(0, 0, 0, 0);
}
}
-
+
@Override
public int lockSurface() throws NativeWindowException, RuntimeException {
return NativeSurface.LOCK_SUCCESS;
@@ -432,7 +435,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
public void removeSurfaceUpdatedListener(SurfaceUpdatedListener l) { }
@Override
- public long getSurfaceHandle() {
+ public long getSurfaceHandle() {
return 0;
}
@@ -462,7 +465,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
}
@Override
- public void surfaceUpdated(Object updater, NativeSurface ns, long when) { }
+ public void surfaceUpdated(Object updater, NativeSurface ns, long when) { }
@Override
public void destroy() { }
@@ -497,8 +500,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
if( isOSX ) {
final Point los = OSXUtil.GetLocationOnScreen(nativeWindowHandle, false, 0, 0);
// top-level position -> client window position
- los.setX(los.getX() + insets.getLeftWidth());
- los.setY(los.getY() + insets.getTopHeight());
+ los.set(los.getX() + insets.getLeftWidth(), los.getY() + insets.getTopHeight());
if(null!=point) {
return point.translate(los);
} else {
@@ -507,7 +509,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
} else {
// client position on 'normal' windowing systems is 0/0
if(null == point) {
- point = new Point(0, 0);
+ point = new Point(0, 0);
}
return point;
}
@@ -516,7 +518,7 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
@Override
public boolean hasFocus() {
return isFocusControl();
- }
+ }
};
static String newtWinHandleToHexString(Window w) {
diff --git a/src/newt/classes/com/jogamp/newt/util/EDTUtil.java b/src/newt/classes/com/jogamp/newt/util/EDTUtil.java
index e86df20..582dc3e 100644
--- a/src/newt/classes/com/jogamp/newt/util/EDTUtil.java
+++ b/src/newt/classes/com/jogamp/newt/util/EDTUtil.java
@@ -63,30 +63,30 @@ public interface EDTUtil {
* @param ms poll period in milliseconds
*/
public void setPollPeriod(long ms);
-
+
/**
- * Starts or restarts the EDT.
+ * Starts the EDT after it's creation or after {@link #invokeStop(boolean, Runnable) stopping}.
* <p>
- * If the EDT is running, it must be stopped first via {@link #invokeStop(boolean, Runnable)}
- * and the caller should wait until it's stopped via {@link #waitUntilStopped()}.
+ * If the EDT is running, it must be {@link #invokeStop(boolean, Runnable) stopped} first
+ * and the caller should wait {@link #waitUntilStopped() until it's stopped}.
* </p>
- *
+ *
* @return true if EDT has been successfully restarted, otherwise false
* @throws IllegalStateException if EDT is running and not subject to be stopped, i.e. {@link #isRunning()} returns true
- *
+ *
* @see #invokeStop(boolean, java.lang.Runnable)
* @see #waitUntilStopped()
*/
- public boolean restart() throws IllegalStateException;
+ public boolean start() throws IllegalStateException;
/**
* Returns true if the current thread is the event dispatch thread (EDT).
* <p>
- * The EDT is the platform specific thread dispatching toolkit-events
+ * The EDT is the platform specific thread dispatching toolkit-events
* and executing toolkit-tasks enqueued via {@link #invoke(boolean, Runnable)}.
* </p>
* <p>
- * Usually it is the same thread as used to dequeue informal {@link NEWTEvent}s (NEDT), see {@link #isCurrentThreadNEDT()},
+ * Usually it is the same thread as used to dequeue informal {@link NEWTEvent}s (NEDT), see {@link #isCurrentThreadNEDT()},
* however, this may differ, e.g. SWT and AWT implementation.
* </p>
*/
@@ -95,28 +95,28 @@ public interface EDTUtil {
/**
* Returns true if the current thread is the internal NEWT event dequeue thread (NEDT).
* <p>
- * The NEDT is the NEWT thread used to dequeue informal {@link NEWTEvent}s enqueued internally
+ * The NEDT is the NEWT thread used to dequeue informal {@link NEWTEvent}s enqueued internally
* via {@link DisplayImpl#enqueueEvent(boolean, NEWTEvent)}.
* </p>
* <p>
- * Usually it is the same thread as the EDT, see {@link #isCurrentThreadEDT()},
+ * Usually it is the same thread as the EDT, see {@link #isCurrentThreadEDT()},
* however, this may differ, e.g. SWT and AWT implementation.
* </p>
*/
public boolean isCurrentThreadNEDT();
-
+
/**
* Returns <code>true</code> if either {@link #isCurrentThreadEDT()} or {@link #isCurrentThreadNEDT()} is <code>true</code>,
* otherwise <code>false</code>.
*/
public boolean isCurrentThreadEDTorNEDT();
-
+
/**
* @return True if EDT is running and not subject to be stopped.
*/
public boolean isRunning();
- /**
+ /**
* Append the final task to the EDT task queue,
* signals EDT to stop.
* <p>
@@ -130,25 +130,25 @@ public interface EDTUtil {
* <li>All previous queued tasks will be finished.</li>
* <li>No new tasks are allowed, an Exception is thrown.</li>
* <li>Can be issued from within EDT, ie from within an enqueued task.</li>
- * <li>{@link #restart()} may follow immediately, ie creating a new EDT</li>
+ * <li>{@link #start()} may follow immediately, ie creating a new EDT</li>
* </ul>
* </p>
- * @return true if <code>task</code> has been executed or queued for later execution, otherwise false
+ * @return true if <code>task</code> has been executed or queued for later execution, otherwise false
*/
public boolean invokeStop(boolean wait, Runnable finalTask);
- /**
+ /**
* Appends task to the EDT task queue if current thread is not EDT,
- * otherwise execute task immediately.
+ * otherwise execute task immediately.
* <p>
* Wait until execution is finished if <code>wait == true</code>.
* </p>
* Can be issued from within EDT, ie from within an enqueued task.<br>
- * @return true if <code>task</code> has been executed or queued for later execution, otherwise false
+ * @return true if <code>task</code> has been executed or queued for later execution, otherwise false
*/
public boolean invoke(boolean wait, Runnable task);
- /**
+ /**
* Wait until the EDT task queue is empty.<br>
* The last task may still be in execution when this method returns.
* @return true if waited for idle, otherwise false, i.e. in case of current thread is EDT or NEDT
diff --git a/src/newt/classes/com/jogamp/newt/util/MainThread.java b/src/newt/classes/com/jogamp/newt/util/MainThread.java
index 5e79e9b..049320b 100644
--- a/src/newt/classes/com/jogamp/newt/util/MainThread.java
+++ b/src/newt/classes/com/jogamp/newt/util/MainThread.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2009 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
@@ -29,7 +29,7 @@
* 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.
@@ -54,13 +54,13 @@ import jogamp.newt.NEWTJNILibLoader;
* NEWT Utility class MainThread<P>
*
* <p>
- * FIXME: Update this documentation!
+ * FIXME: Update this documentation!
* This class just provides a main-thread utility, forking of a main java class
* on another thread while being able to continue doing platform specific things
* on the main-thread. The latter is essential for eg. MacOSX, where we continue
* to run NSApp.run().
* </p>
- *
+ *
* This class provides a startup singleton <i>main thread</i>,
* from which a new thread with the users main class is launched.<br>
*
@@ -72,17 +72,17 @@ import jogamp.newt.NEWTJNILibLoader;
* use a NEWT multithreaded application with window handling within the different threads,
* even on these restricted platforms.<br>
*
- * To support your NEWT Window platform,
+ * To support your NEWT Window platform,
* you have to pass your <i>main thread</i> actions to {@link #invoke invoke(..)},
* have a look at the {@link jogamp.newt.driver.macosx.WindowDriver NEWT Mac OSX Window} driver implementation.<br>
- * <i>TODO</i>: Some hardcoded dependencies exist in this implementation,
+ * <i>TODO</i>: Some hardcoded dependencies exist in this implementation,
* where you have to patch this code or factor it out. <P>
- *
+ *
* If your platform is not Mac OS X, but you want to test your code without modifying
* this class, you have to set the system property <code>newt.MainThread.force</code> to <code>true</code>.<P>
*
* The code is compatible with all other platform, which support multithreaded windowing handling.
- * Since those platforms won't trigger the <i>main thread</i> serialization, the main method
+ * Since those platforms won't trigger the <i>main thread</i> serialization, the main method
* will be simply executed, in case you haven't set <code>newt.MainThread.force</code> to <code>true</code>.<P>
*
* Test case on Mac OS X (or any other platform):
@@ -96,35 +96,35 @@ public class MainThread {
private static final Platform.OSType osType;
private static final boolean isMacOSX;
private static final ThreadGroup rootThreadGroup;
-
+
/** if true, use the main thread EDT, otherwise AWT's EDT */
public static final boolean HINT_USE_MAIN_THREAD;
-
+
static {
NativeWindowFactory.initSingleton();
NEWTJNILibLoader.loadNEWT();
- HINT_USE_MAIN_THREAD = !NativeWindowFactory.isAWTAvailable() ||
+ HINT_USE_MAIN_THREAD = !NativeWindowFactory.isAWTAvailable() ||
Debug.getBooleanProperty("newt.MainThread.force", true);
osType = Platform.getOSType();
isMacOSX = osType == Platform.OSType.MACOS;
rootThreadGroup = getRootThreadGroup();
}
-
+
public static boolean useMainThread = false;
-
+
protected static final boolean DEBUG = Debug.debug("MainThread");
private static final MainThread singletonMainThread = new MainThread(); // one singleton MainThread
-
+
private static final ThreadGroup getRootThreadGroup() {
ThreadGroup rootGroup = Thread.currentThread( ).getThreadGroup( );
ThreadGroup parentGroup;
while ( ( parentGroup = rootGroup.getParent() ) != null ) {
rootGroup = parentGroup;
}
- return rootGroup;
+ return rootGroup;
}
-
+
private static final Thread[] getAllThreads(int[] count) {
int tn;
Thread[] threads = new Thread[ rootThreadGroup.activeCount() ];
@@ -149,17 +149,17 @@ public class MainThread {
t.printStackTrace();
}
}
- return res;
+ return res;
}
private static final int getNonDaemonThreadCount(List<Thread> ignoreThreads) {
int res = 0;
int[] tn = { 0 };
Thread[] threads = getAllThreads(tn);
-
+
for(int i = tn[0] - 1; i >= 0; i--) {
final Thread thread = threads[i];
try {
- if(thread.isAlive() && !thread.isDaemon() && !ignoreThreads.contains(thread)) {
+ if(thread.isAlive() && !thread.isDaemon() && !ignoreThreads.contains(thread)) {
res++;
if(DEBUG) System.err.println("MainAction.run(): non daemon thread: "+thread);
}
@@ -167,9 +167,9 @@ public class MainThread {
t.printStackTrace();
}
}
- return res;
+ return res;
}
-
+
static class UserApp extends Thread {
private final String mainClassNameShort;
private final String mainClassName;
@@ -181,7 +181,7 @@ public class MainThread {
super();
this.mainClassName=mainClassName;
this.mainClassArgs=mainClassArgs;
-
+
final Class<?> mainClass = ReflectionUtil.getClass(mainClassName, true, getClass().getClassLoader());
if(null==mainClass) {
throw new ClassNotFoundException("MainAction couldn't find main class "+mainClassName);
@@ -192,7 +192,7 @@ public class MainThread {
setName(getName()+"-UserApp-"+mainClassNameShort);
setDaemon(false);
-
+
if(DEBUG) System.err.println("MainAction(): instantiated: "+getName()+", is daemon "+isDaemon()+", main-class: "+mainClass.getName());
}
@@ -230,32 +230,32 @@ public class MainThread {
if(isMacOSX) {
try {
if(DEBUG) {
- System.err.println("MainAction.main(): "+Thread.currentThread()+" MainAction fin - stopNSApp.0");
+ System.err.println("MainAction.main(): "+Thread.currentThread()+" MainAction fin - stopNSApp.0");
}
- ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "stopNSApplication",
+ ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "stopNSApplication",
null, null, MainThread.class.getClassLoader());
if(DEBUG) {
- System.err.println("MainAction.main(): "+Thread.currentThread()+" MainAction fin - stopNSApp.X");
+ System.err.println("MainAction.main(): "+Thread.currentThread()+" MainAction fin - stopNSApp.X");
}
} catch (Exception e) {
e.printStackTrace();
}
} else {
if(DEBUG) System.err.println("MainAction.run(): "+Thread.currentThread().getName()+" MainAction fin - System.exit(0)");
- System.exit(0);
- }
+ System.exit(0);
+ }
}
}
}
private static UserApp mainAction;
- /** Your new java application main entry, which pipelines your application
- * @throws ClassNotFoundException
- * @throws NoSuchMethodException
+ /** Your new java application main entry, which pipelines your application
+ * @throws ClassNotFoundException
+ * @throws NoSuchMethodException
* @throws SecurityException */
public static void main(String[] args) throws SecurityException, NoSuchMethodException, ClassNotFoundException {
final Thread cur = Thread.currentThread();
-
+
useMainThread = HINT_USE_MAIN_THREAD;
if(DEBUG) {
@@ -268,7 +268,7 @@ public class MainThread {
if(!useMainThread && !NativeWindowFactory.isAWTAvailable()) {
throw new RuntimeException("!USE_MAIN_THREAD and no AWT available");
}
-
+
if(args.length==0) {
return;
}
@@ -282,7 +282,7 @@ public class MainThread {
mainAction = new UserApp(mainClassName, mainClassArgs);
if(isMacOSX) {
- ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "initSingleton",
+ ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "initSingleton",
null, null, MainThread.class.getClassLoader());
}
@@ -290,24 +290,24 @@ public class MainThread {
try {
cur.setName(cur.getName()+"-MainThread");
} catch (Exception e) {}
-
+
// dispatch user's main thread ..
mainAction.start();
-
+
if(isMacOSX) {
try {
if(DEBUG) {
- System.err.println("MainThread.main(): "+cur.getName()+"- runNSApp");
+ System.err.println("MainThread.main(): "+cur.getName()+"- runNSApp");
}
- ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "runNSApplication",
+ ReflectionUtil.callStaticMethod(MACOSXDisplayClassName, "runNSApplication",
null, null, MainThread.class.getClassLoader());
} catch (Exception e) {
e.printStackTrace();
}
- }
- if(DEBUG) { System.err.println("MainThread - wait until last non daemon thread ends ..."); }
+ }
+ if(DEBUG) { System.err.println("MainThread - wait until last non daemon thread ends ..."); }
} else {
- // run user's main in this thread
+ // run user's main in this thread
mainAction.run();
}
}
diff --git a/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java b/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java
index c30b427..fdd7985 100644
--- a/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java
+++ b/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java
@@ -42,7 +42,7 @@ import javax.media.nativewindow.util.SurfaceSize;
* filters etc.
*/
public class MonitorModeUtil {
-
+
public static int getIndex(List<MonitorMode> monitorModes, MonitorMode search) {
return monitorModes.indexOf(search);
}
@@ -69,7 +69,7 @@ public class MonitorModeUtil {
}
return null;
}
-
+
/** Sort the given {@link MonitorMode} collection w/ {@link MonitorMode#compareTo(MonitorMode)} function. */
public static void sort(List<MonitorMode> monitorModes, boolean ascendingOrder) {
if( ascendingOrder ) {
@@ -78,9 +78,9 @@ public class MonitorModeUtil {
Collections.sort(monitorModes, MonitorMode.monitorModeComparatorInv);
}
}
-
+
/**
- *
+ *
* @param monitorModes
* @param surfaceSize
* @return modes with exact {@link SurfaceSize}. May return zero sized list for non.
@@ -99,7 +99,7 @@ public class MonitorModeUtil {
}
/**
- *
+ *
* @param monitorModes
* @param rotation
* @return modes with exact rotation. May return zero sized list for non.
@@ -118,7 +118,7 @@ public class MonitorModeUtil {
}
/**
- *
+ *
* @param monitorModes
* @param bitsPerPixel
* @return modes with exact bpp. May return zero sized list for non.
@@ -137,7 +137,7 @@ public class MonitorModeUtil {
}
/**
- *
+ *
* @param monitorModes
* @param flags
* @return modes with exact flags. May return zero sized list for non.
@@ -165,7 +165,7 @@ public class MonitorModeUtil {
if( null!=monitorModes && monitorModes.size()>0 ) {
final int resolution_sq = resolution.getHeight()*resolution.getWidth();
int mode_dsq=Integer.MAX_VALUE, mode_dsq_idx=0;
-
+
for (int i=0; null!=monitorModes && i<monitorModes.size(); i++) {
final MonitorMode mode = monitorModes.get(i);
final DimensionImmutable res = mode.getSurfaceSize().getResolution();
@@ -236,7 +236,7 @@ public class MonitorModeUtil {
}
/**
- *
+ *
* @param monitorModes
* @return modes with highest available refresh rate. May return zero sized list for non.
*/
diff --git a/src/newt/classes/jogamp/newt/Debug.java b/src/newt/classes/jogamp/newt/Debug.java
index 4b0a982..7ef2d7f 100644
--- a/src/newt/classes/jogamp/newt/Debug.java
+++ b/src/newt/classes/jogamp/newt/Debug.java
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -51,14 +51,15 @@ public class Debug extends PropertyAccess {
// Some common properties
private static final boolean verbose;
private static final boolean debugAll;
-
+
static {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
PropertyAccess.addTrustedPrefix("newt.");
return null;
} } );
-
+
verbose = isPropertyDefined("newt.verbose", true);
debugAll = isPropertyDefined("newt.debug", true);
if (verbose) {
diff --git a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java b/src/newt/classes/jogamp/newt/DefaultEDTUtil.java
index a229a05..f33b474 100644
--- a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java
+++ b/src/newt/classes/jogamp/newt/DefaultEDTUtil.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2009 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
@@ -29,7 +29,7 @@
* 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.
@@ -38,6 +38,7 @@
package jogamp.newt;
import java.util.ArrayList;
+
import javax.media.nativewindow.NativeWindowException;
import jogamp.common.util.locks.LockDebugUtil;
@@ -50,7 +51,7 @@ public class DefaultEDTUtil implements EDTUtil {
public static final boolean DEBUG = Debug.debug("EDT");
private final Object edtLock = new Object(); // locking the EDT start/stop state
- private final ThreadGroup threadGroup;
+ private /* final */ ThreadGroup threadGroup;
private final String name;
private final Runnable dispatchMessages;
private NEDT edt = null;
@@ -74,9 +75,9 @@ public class DefaultEDTUtil implements EDTUtil {
final public void setPollPeriod(long ms) {
pollPeriod = ms;
}
-
+
@Override
- public final boolean restart() throws IllegalStateException {
+ public final boolean start() throws IllegalStateException {
synchronized(edtLock) {
if( edt.isRunning() ) {
throw new IllegalStateException("EDT still running and not subject to stop. Curr "+Thread.currentThread().getName()+", EDT "+edt.getName()+", isRunning "+edt.isRunning+", shouldStop "+edt.shouldStop);
@@ -88,6 +89,10 @@ public class DefaultEDTUtil implements EDTUtil {
System.err.println(Thread.currentThread()+": Default-EDT reset - edt: "+edt);
}
if( edt.getState() != Thread.State.NEW ) {
+ if( null != threadGroup && threadGroup.isDestroyed() ) {
+ // best thing we can do is to use this thread's TG
+ threadGroup = Thread.currentThread().getThreadGroup();
+ }
edt = new NEDT(threadGroup, name);
edt.setDaemon(true); // don't stop JVM from shutdown ..
}
@@ -112,7 +117,7 @@ public class DefaultEDTUtil implements EDTUtil {
public final boolean isCurrentThreadEDT() {
return edt == Thread.currentThread(); // EDT == NEDT
}
-
+
@Override
public final boolean isCurrentThreadNEDT() {
return edt == Thread.currentThread(); // EDT == NEDT
@@ -121,8 +126,8 @@ public class DefaultEDTUtil implements EDTUtil {
@Override
public final boolean isCurrentThreadEDTorNEDT() {
return edt == Thread.currentThread(); // EDT == NEDT
- }
-
+ }
+
@Override
public final boolean isRunning() {
return edt.isRunning() ;
@@ -130,6 +135,10 @@ public class DefaultEDTUtil implements EDTUtil {
@Override
public final boolean invokeStop(boolean wait, Runnable task) {
+ if(DEBUG) {
+ System.err.println(Thread.currentThread()+": Default-EDT.invokeStop wait "+wait);
+ Thread.dumpStack();
+ }
return invokeImpl(wait, task, true);
}
@@ -140,9 +149,9 @@ public class DefaultEDTUtil implements EDTUtil {
private static Runnable nullTask = new Runnable() {
@Override
- public void run() { }
+ public void run() { }
};
-
+
private final boolean invokeImpl(boolean wait, Runnable task, boolean stop) {
Throwable throwable = null;
RunnableTask rTask = null;
@@ -192,7 +201,7 @@ public class DefaultEDTUtil implements EDTUtil {
synchronized(edt.tasks) {
rTask = new RunnableTask(task,
wait ? rTaskLock : null,
- true /* always catch and report Exceptions, don't disturb EDT */,
+ true /* always catch and report Exceptions, don't disturb EDT */,
wait ? null : System.err);
if(stop) {
rTask.setAttachment(new Boolean(true)); // mark final task, will imply shouldStop:=true
@@ -296,8 +305,8 @@ public class DefaultEDTUtil implements EDTUtil {
throw new InternalError("XXX");
}
}
-
- /**
+
+ /**
* Utilizing locking only on tasks and its execution,
* not for event dispatching.
*/
@@ -306,7 +315,7 @@ public class DefaultEDTUtil implements EDTUtil {
if(DEBUG) {
System.err.println(getName()+": Default-EDT run() START "+ getName());
}
- if(Lock.DEBUG) {
+ if(Lock.DEBUG) {
validateNoRecursiveLocksHold();
}
RuntimeException error = null;
@@ -359,7 +368,7 @@ public class DefaultEDTUtil implements EDTUtil {
} finally {
if(DEBUG) {
RunnableTask rt = ( tasks.size() > 0 ) ? tasks.get(0) : null ;
- System.err.println(getName()+": Default-EDT run() END "+ getName()+", tasks: "+tasks.size()+", "+rt+", "+error);
+ System.err.println(getName()+": Default-EDT run() END "+ getName()+", tasks: "+tasks.size()+", "+rt+", "+error);
}
synchronized(edtLock) {
isRunning = false;
diff --git a/src/newt/classes/jogamp/newt/DisplayImpl.java b/src/newt/classes/jogamp/newt/DisplayImpl.java
index 8f792b2..0c29d77 100644
--- a/src/newt/classes/jogamp/newt/DisplayImpl.java
+++ b/src/newt/classes/jogamp/newt/DisplayImpl.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt;
@@ -53,6 +53,7 @@ public abstract class DisplayImpl extends Display {
static {
NativeWindowFactory.addCustomShutdownHook(true /* head */, new Runnable() {
+ @Override
public void run() {
WindowImpl.shutdownAll();
ScreenImpl.shutdownAll();
@@ -60,16 +61,16 @@ public abstract class DisplayImpl extends Display {
}
});
}
-
+
/** Ensure static init has been run. */
/* pp */static void initSingleton() { }
-
- private static Class<?> getDisplayClass(String type)
- throws ClassNotFoundException
+
+ private static Class<?> getDisplayClass(String type)
+ throws ClassNotFoundException
{
final Class<?> displayClass = NewtFactory.getCustomClass(type, "DisplayDriver");
if(null==displayClass) {
- throw new ClassNotFoundException("Failed to find NEWT Display Class <"+type+".DisplayDriver>");
+ throw new ClassNotFoundException("Failed to find NEWT Display Class <"+type+".DisplayDriver>");
}
return displayClass;
}
@@ -100,7 +101,7 @@ public abstract class DisplayImpl extends Display {
display.setEDTUtil( display.edtUtil ); // device's default if EDT is used, or null
Display.addDisplay2List(display);
}
-
+
if(DEBUG) {
System.err.println("Display.create() NEW: "+display+" "+getThreadName());
}
@@ -109,7 +110,7 @@ public abstract class DisplayImpl extends Display {
throw new RuntimeException(e);
}
}
-
+
@Override
public boolean equals(Object obj) {
if (obj == null) {
@@ -147,6 +148,7 @@ public abstract class DisplayImpl extends Display {
final DisplayImpl f_dpy = this;
try {
runOnEDTIfAvail(true, new Runnable() {
+ @Override
public void run() {
f_dpy.createNativeImpl();
}});
@@ -168,9 +170,9 @@ public abstract class DisplayImpl extends Display {
protected EDTUtil createEDTUtil() {
final EDTUtil def;
if(NewtFactory.useEDT()) {
- def = new DefaultEDTUtil(Thread.currentThread().getThreadGroup(), "Display-"+getFQName(), dispatchMessagesRunnable);
+ def = new DefaultEDTUtil(Thread.currentThread().getThreadGroup(), "Display-"+getFQName(), dispatchMessagesRunnable);
if(DEBUG) {
- System.err.println("Display.createNative("+getFQName()+") Create EDTUtil: "+def.getClass().getName());
+ System.err.println("Display.createEDTUtil("+getFQName()+"): "+def.getClass().getName());
}
} else {
def = null;
@@ -181,21 +183,18 @@ public abstract class DisplayImpl extends Display {
@Override
public synchronized EDTUtil setEDTUtil(final EDTUtil usrEDTUtil) {
final EDTUtil oldEDTUtil = edtUtil;
- final EDTUtil newEDTUtil;
if( null != usrEDTUtil && usrEDTUtil == oldEDTUtil ) {
if( DEBUG ) {
System.err.println("Display.setEDTUtil: "+usrEDTUtil+" - keep!");
}
- newEDTUtil = oldEDTUtil;
- } else {
- if(DEBUG) {
- final String msg = ( null == usrEDTUtil ) ? "default" : "custom";
- System.err.println("Display.setEDTUtil("+msg+"): "+oldEDTUtil+" -> "+usrEDTUtil);
- }
- stopEDT( oldEDTUtil, null );
- newEDTUtil = ( null == usrEDTUtil ) ? createEDTUtil() : usrEDTUtil;
+ return oldEDTUtil;
+ }
+ if(DEBUG) {
+ final String msg = ( null == usrEDTUtil ) ? "default" : "custom";
+ System.err.println("Display.setEDTUtil("+msg+"): "+oldEDTUtil+" -> "+usrEDTUtil);
}
- edtUtil = newEDTUtil;
+ stopEDT( oldEDTUtil, null );
+ edtUtil = ( null == usrEDTUtil ) ? createEDTUtil() : usrEDTUtil;
return oldEDTUtil;
}
@@ -224,31 +223,31 @@ public abstract class DisplayImpl extends Display {
public void runOnEDTIfAvail(boolean wait, final Runnable task) {
final EDTUtil _edtUtil = edtUtil;
- if( null != _edtUtil && !_edtUtil.isCurrentThreadEDT() ) {
- if( !_edtUtil.isRunning() ) { // start EDT if not running yet
- synchronized( this ) {
- if( !_edtUtil.isRunning() ) { // // volatile dbl-checked-locking OK
- _edtUtil.restart();
- if( DEBUG ) {
- System.err.println("Info: EDT started "+Thread.currentThread().getName()+", "+this);
- Thread.dumpStack();
- }
+ if( !_edtUtil.isRunning() ) { // start EDT if not running yet
+ synchronized( this ) {
+ if( !_edtUtil.isRunning() ) { // // volatile dbl-checked-locking OK
+ if( DEBUG ) {
+ System.err.println("Info: EDT start "+Thread.currentThread().getName()+", "+this);
+ Thread.dumpStack();
}
+ _edtUtil.start();
}
}
- if( !_edtUtil.invoke(wait, task) ) {
- if( DEBUG ) {
- System.err.println("Warning: invoke(wait "+wait+", ..) on EDT failed .. invoke on current thread "+Thread.currentThread().getName());
- Thread.dumpStack();
- }
- task.run();
+ }
+ if( !_edtUtil.isCurrentThreadEDT() ) {
+ if( _edtUtil.invoke(wait, task) ) {
+ return; // done
+ }
+ if( DEBUG ) {
+ System.err.println("Warning: invoke(wait "+wait+", ..) on EDT failed .. invoke on current thread "+Thread.currentThread().getName());
+ Thread.dumpStack();
}
- } else {
- task.run();
}
+ task.run();
}
- public boolean validateEDT() {
+ @Override
+ public boolean validateEDTStopped() {
if( 0==refCount && null == aDevice ) {
final EDTUtil _edtUtil = edtUtil;
if( null != _edtUtil && _edtUtil.isRunning() ) {
@@ -275,12 +274,13 @@ public abstract class DisplayImpl extends Display {
if(DEBUG) {
System.err.println("Display.destroy(): "+this+", active "+displaysActive+" "+getThreadName());
}
- }
+ }
final DisplayImpl f_dpy = this;
final AbstractGraphicsDevice f_aDevice = aDevice;
aDevice = null;
refCount=0;
stopEDT( edtUtil, new Runnable() { // blocks!
+ @Override
public void run() {
if ( null != f_aDevice ) {
f_dpy.closeNativeImpl(f_aDevice);
@@ -291,10 +291,10 @@ public abstract class DisplayImpl extends Display {
dumpDisplayList("Display.destroy("+getFQName()+") END");
}
}
-
+
/** May be utilized at a shutdown hook, impl. does not block. */
/* pp */ static final void shutdownAll() {
- final int dCount = displayList.size();
+ final int dCount = displayList.size();
if(DEBUG) {
dumpDisplayList("Display.shutdownAll "+dCount+" instances, on thread "+getThreadName());
}
@@ -310,8 +310,9 @@ public abstract class DisplayImpl extends Display {
final EDTUtil edtUtil = d.getEDTUtil();
final AbstractGraphicsDevice f_aDevice = d.aDevice;
d.aDevice = null;
- d.refCount=0;
+ d.refCount=0;
final Runnable closeNativeTask = new Runnable() {
+ @Override
public void run() {
if ( null != d.getGraphicsDevice() ) {
d.closeNativeImpl(f_aDevice);
@@ -333,6 +334,7 @@ public abstract class DisplayImpl extends Display {
}
}
+ @Override
public synchronized final int addReference() {
if(DEBUG) {
System.err.println("Display.addReference() ("+DisplayImpl.getThreadName()+"): "+refCount+" -> "+(refCount+1));
@@ -347,6 +349,7 @@ public abstract class DisplayImpl extends Display {
}
+ @Override
public synchronized final int removeReference() {
if(DEBUG) {
System.err.println("Display.removeReference() ("+DisplayImpl.getThreadName()+"): "+refCount+" -> "+(refCount-1));
@@ -359,6 +362,7 @@ public abstract class DisplayImpl extends Display {
return refCount;
}
+ @Override
public synchronized final int getReferenceCount() {
return refCount;
}
@@ -385,7 +389,7 @@ public abstract class DisplayImpl extends Display {
public final String getFQName() {
return fqname;
}
-
+
@Override
public final boolean isExclusive() {
return exclusive;
@@ -442,7 +446,7 @@ public abstract class DisplayImpl extends Display {
@Override
public String toString() {
final EDTUtil _edtUtil = edtUtil;
- final boolean _edtUtilRunning = ( null != _edtUtil ) ? _edtUtil.isRunning() : false;
+ final boolean _edtUtilRunning = ( null != _edtUtil ) ? _edtUtil.isRunning() : false;
return "NEWT-Display["+getFQName()+", excl "+exclusive+", refCount "+refCount+", hasEDT "+(null!=_edtUtil)+", edtRunning "+_edtUtilRunning+", "+aDevice+"]";
}
@@ -454,13 +458,14 @@ public abstract class DisplayImpl extends Display {
private volatile boolean haveEvents = false;
final protected Runnable dispatchMessagesRunnable = new Runnable() {
+ @Override
public void run() {
DisplayImpl.this.dispatchMessages();
} };
final void dispatchMessage(final NEWTEvent event) {
- try {
- final Object source = event.getSource();
+ try {
+ final Object source = event.getSource();
if(source instanceof NEWTEventConsumer) {
final NEWTEventConsumer consumer = (NEWTEventConsumer) source ;
if(!consumer.consumeEvent(event)) {
@@ -480,10 +485,10 @@ public abstract class DisplayImpl extends Display {
throw re;
}
}
-
+
final void dispatchMessage(final NEWTEventTask eventTask) {
final NEWTEvent event = eventTask.get();
- try {
+ try {
if(null == event) {
// Ooops ?
System.err.println("Warning: event of eventTask is NULL");
@@ -499,15 +504,15 @@ public abstract class DisplayImpl extends Display {
throw re;
}
}
- eventTask.notifyCaller();
+ eventTask.notifyCaller();
}
-
+
@Override
public void dispatchMessages() {
// System.err.println("Display.dispatchMessages() 0 "+this+" "+getThreadName());
- if(0==refCount || // no screens
+ if(0==refCount || // no screens
null==getGraphicsDevice() // no native device
- )
+ )
{
return;
}
@@ -545,13 +550,13 @@ public abstract class DisplayImpl extends Display {
}
return;
}
-
+
// can't wait if we are on EDT or NEDT -> consume right away
if(wait && _edtUtil.isCurrentThreadEDTorNEDT() ) {
dispatchMessage(e);
return;
}
-
+
final Object lock = new Object();
final NEWTEventTask eTask = new NEWTEventTask(e, wait?lock:null);
synchronized(lock) {
@@ -569,13 +574,13 @@ public abstract class DisplayImpl extends Display {
if( null != eTask.getException() ) {
throw eTask.getException();
}
- }
+ }
}
}
public interface DisplayRunnable<T> {
T run(long dpy);
- }
+ }
public static final <T> T runWithLockedDevice(AbstractGraphicsDevice device, DisplayRunnable<T> action) {
T res;
device.lock();
@@ -593,7 +598,7 @@ public abstract class DisplayImpl extends Display {
}
return runWithLockedDevice(device, action);
}
-
+
protected volatile EDTUtil edtUtil = null;
protected int id;
protected String name;
diff --git a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java
index 43d5585..9e10879 100644
--- a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java
+++ b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.newt;
import javax.media.nativewindow.util.DimensionImmutable;
@@ -41,7 +41,7 @@ public class MonitorDeviceImpl extends MonitorDevice {
public MonitorDeviceImpl(ScreenImpl screen, int nativeId, DimensionImmutable sizeMM, Rectangle viewport, MonitorMode currentMode, ArrayHashSet<MonitorMode> supportedModes) {
super(screen, nativeId, sizeMM, viewport, currentMode, supportedModes);
}
-
+
@Override
public final MonitorMode queryCurrentMode() {
final ScreenImpl screenImpl = (ScreenImpl)screen;
@@ -54,7 +54,7 @@ public class MonitorDeviceImpl extends MonitorDevice {
}
MonitorMode mmU = supportedModes.get(mm0); // unified instance
if( null == mmU ) {
- // add new mode avoiding exception!
+ // add new mode avoiding exception!
mmU = sms.getMonitorModes().getOrAdd(mm0);
mmU = supportedModes.getOrAdd(mmU);
if( Screen.DEBUG ) {
@@ -89,21 +89,21 @@ public class MonitorDeviceImpl extends MonitorDevice {
if( mmU.equals( mmC ) ) {
if(Screen.DEBUG) {
System.err.println("Screen.setCurrentMode: 0.0 is-current (skip) "+mmU+" == "+mmC);
- }
+ }
return true;
}
final long tStart;
if(Screen.DEBUG) {
- tStart = System.currentTimeMillis();
+ tStart = System.currentTimeMillis();
} else {
tStart = 0;
}
-
+
sms.fireMonitorModeChangeNotify(this, mmU);
if(Screen.DEBUG) {
System.err.println("Screen.setCurrentMode ("+(System.currentTimeMillis()-tStart)+"ms): fireModeChangeNotify() "+mmU);
}
-
+
boolean success = screenImpl.setCurrentMonitorModeImpl(this, mmU);
if(success) {
if(Screen.DEBUG) {
@@ -135,13 +135,13 @@ public class MonitorDeviceImpl extends MonitorDevice {
private final void setCurrentModeValue(MonitorMode currentMode) {
this.currentMode = currentMode;
}
-
+
/* pp */ final void setViewportValue(Rectangle viewport) {
this.viewport = viewport;
}
-
+
/* pp */ ArrayHashSet<MonitorMode> getSupportedModesImpl() {
return supportedModes;
}
-
+
}
diff --git a/src/newt/classes/jogamp/newt/MonitorModeProps.java b/src/newt/classes/jogamp/newt/MonitorModeProps.java
index 820807e..9d8f491 100644
--- a/src/newt/classes/jogamp/newt/MonitorModeProps.java
+++ b/src/newt/classes/jogamp/newt/MonitorModeProps.java
@@ -54,12 +54,12 @@ public class MonitorModeProps {
* 1: bpp
*/
public static final int NUM_SURFACE_SIZE_PROPERTIES = 1;
-
+
/** WARNING: must be synchronized with ScreenMode.h, native implementation
* 2: refresh-rate (Hz*100), flags
*/
public static final int NUM_SIZEANDRATE_PROPERTIES = 2;
-
+
/** WARNING: must be synchronized with ScreenMode.h, native implementation
* 2: id, rotation
*/
@@ -69,7 +69,7 @@ public class MonitorModeProps {
* count + all the above
*/
public static final int NUM_MONITOR_MODE_PROPERTIES_ALL = 8;
-
+
public static final int IDX_MONITOR_MODE_BPP = 1 // count
+ MonitorModeProps.NUM_RESOLUTION_PROPERTIES
;
@@ -79,7 +79,7 @@ public class MonitorModeProps {
+ MonitorModeProps.NUM_SIZEANDRATE_PROPERTIES
+ 1 // id of MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES
;
-
+
/** WARNING: must be synchronized with ScreenMode.h, native implementation
* 10: count + id, ScreenSizeMM[width, height], rotated Viewport[x, y, width, height], currentMonitorModeId, rotation, supportedModeId+
*/
@@ -89,15 +89,15 @@ public class MonitorModeProps {
+ 1 // native mode
+ MonitorModeProps.NUM_RESOLUTION_PROPERTIES // sizeMM
;
-
+
public static class Cache {
public final ArrayHashSet<DimensionImmutable> resolutions = new ArrayHashSet<DimensionImmutable>();
public final ArrayHashSet<SurfaceSize> surfaceSizes = new ArrayHashSet<SurfaceSize>();
- public final ArrayHashSet<MonitorMode.SizeAndRRate> sizeAndRates = new ArrayHashSet<MonitorMode.SizeAndRRate>();
+ public final ArrayHashSet<MonitorMode.SizeAndRRate> sizeAndRates = new ArrayHashSet<MonitorMode.SizeAndRRate>();
public final ArrayHashSet<MonitorMode> monitorModes = new ArrayHashSet<MonitorMode>();
public final ArrayHashSet<MonitorDevice> monitorDevices = new ArrayHashSet<MonitorDevice>();
}
-
+
/** WARNING: must be synchronized with ScreenMode.h, native implementation */
private static DimensionImmutable streamInResolution(int[] resolutionProperties, int offset) {
Dimension resolution = new Dimension(resolutionProperties[offset++], resolutionProperties[offset++]);
@@ -116,7 +116,7 @@ public class MonitorModeProps {
final int flags = sizeAndRRateProperties[offset++];
return new MonitorMode.SizeAndRRate(surfaceSize, refreshRate, flags);
}
-
+
/** WARNING: must be synchronized with ScreenMode.h, native implementation */
private static MonitorMode streamInMonitorMode0(MonitorMode.SizeAndRRate sizeAndRate, int[] modeProperties, int offset) {
final int id = modeProperties[offset++];
@@ -161,7 +161,7 @@ public class MonitorModeProps {
if(null!=cache) {
sizeAndRate = cache.sizeAndRates.getOrAdd(sizeAndRate);
}
-
+
MonitorMode monitorMode = MonitorModeProps.streamInMonitorMode0(sizeAndRate, modeProperties, offset);
if(null!=cache) {
monitorMode = cache.monitorModes.getOrAdd(monitorMode);
@@ -193,12 +193,12 @@ public class MonitorModeProps {
}
return data;
}
-
- /**
+
+ /**
* WARNING: must be synchronized with ScreenMode.h, native implementation
* <p>
* Note: This variant only works for impl. w/ a unique mode key pair <i>modeId, rotation</i>.
- * </p>
+ * </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
@@ -218,7 +218,7 @@ public class MonitorModeProps {
if(count > monitorProperties.length-offset) {
throw new RuntimeException("properties array too short (count), should be >= "+count+", is "+(monitorProperties.length-offset));
}
- final int limit = offset + count;
+ final int limit = offset + count;
offset++;
final List<MonitorMode> allMonitorModes = cache.monitorModes.getData();
final int id = monitorProperties[offset++];
@@ -252,7 +252,7 @@ public class MonitorModeProps {
monitor_idx[0] = _monitorIdx;
}
return monitorDevice;
- }
+ }
private static MonitorMode getByNativeIdAndRotation(List<MonitorMode> monitorModes, int modeId, int rotation) {
if( null!=monitorModes && monitorModes.size()>0 ) {
for (int i=0; i<monitorModes.size(); i++) {
@@ -264,12 +264,12 @@ public class MonitorModeProps {
}
return null;
}
-
- /**
+
+ /**
* WARNING: must be synchronized with ScreenMode.h, native implementation
* <p>
* 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.
+ * 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}.
@@ -310,7 +310,7 @@ public class MonitorModeProps {
}
return monitorDevice;
}
-
+
/** WARNING: must be synchronized with ScreenMode.h, native implementation */
public static int[] streamOutMonitorDevice (MonitorDevice monitorDevice) {
// min 11: count, id, ScreenSizeMM[width, height], Viewport[x, y, width, height], currentMonitorModeId, rotation, supportedModeId+
@@ -339,7 +339,7 @@ public class MonitorModeProps {
}
return data;
}
-
+
public final void swapRotatePair(int rotation, int[] pairs, int offset, int numPairs) {
if( MonitorMode.ROTATE_0 == rotation || MonitorMode.ROTATE_180 == rotation ) {
// nop
@@ -347,9 +347,9 @@ public class MonitorModeProps {
}
for(int i=0; i<numPairs; i++, offset+=2) {
final int tmp = pairs[offset];
- pairs[offset] = pairs[offset+1];
+ pairs[offset] = pairs[offset+1];
pairs[offset+1] = tmp;
}
- }
-
+ }
+
}
diff --git a/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java b/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java
index bc0eb75..9364ada 100644
--- a/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java
+++ b/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. 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
@@ -28,11 +28,11 @@
* 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.
*/
@@ -49,22 +49,17 @@ import com.jogamp.common.os.Platform;
import com.jogamp.common.util.cache.TempJarCache;
public class NEWTJNILibLoader extends JNILibLoaderBase {
-
- public static void loadNEWT() {
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- Platform.initSingleton();
- final String libName = "newt";
- if(TempJarCache.isInitialized() && null == TempJarCache.findLibrary(libName)) {
- // either: [jogl-all.jar, jogl-all-noawt.jar, jogl-all-mobile.jar] -> jogl-all-natives-<os.and.arch>.jar
- // or: nativewindow-core.jar -> nativewindow-natives-<os.and.arch>.jar,
- // newt-core.jar -> newt-natives-<os.and.arch>.jar
- JNILibLoaderBase.addNativeJarLibs(new Class<?>[] { NWJNILibLoader.class, NEWTJNILibLoader.class }, "-all", new String[] { "-noawt", "-mobile", "-core" } );
- }
- loadLibrary(libName, false, NEWTJNILibLoader.class.getClassLoader());
- return null;
- }
- });
- }
-
+ public static boolean loadNEWT() {
+ return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+ @Override
+ public Boolean run() {
+ Platform.initSingleton();
+ final String libName = "newt";
+ if(TempJarCache.isInitialized() && null == TempJarCache.findLibrary(libName)) {
+ JNILibLoaderBase.addNativeJarLibsJoglCfg(new Class<?>[] { NWJNILibLoader.class, NEWTJNILibLoader.class });
+ }
+ return Boolean.valueOf(loadLibrary(libName, false, NEWTJNILibLoader.class.getClassLoader()));
+ }
+ }).booleanValue();
+ }
}
diff --git a/src/newt/classes/jogamp/newt/OffscreenWindow.java b/src/newt/classes/jogamp/newt/OffscreenWindow.java
index 911d371..2478b1e 100644
--- a/src/newt/classes/jogamp/newt/OffscreenWindow.java
+++ b/src/newt/classes/jogamp/newt/OffscreenWindow.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt;
@@ -50,13 +50,14 @@ import com.jogamp.newt.MonitorDevice;
public class OffscreenWindow extends WindowImpl implements MutableSurface {
long surfaceHandle;
-
+
public OffscreenWindow() {
surfaceHandle = 0;
}
static long nextWindowHandle = 0x100; // start here - a marker
+ @Override
protected void createNativeImpl() {
if(capsRequested.isOnscreen()) {
throw new NativeWindowException("Capabilities is onscreen");
@@ -72,9 +73,10 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface {
synchronized(OffscreenWindow.class) {
setWindowHandle(nextWindowHandle++);
}
- visibleChanged(false, true);
+ visibleChanged(false, true);
}
+ @Override
protected void closeNativeImpl() {
// nop
}
@@ -85,6 +87,7 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface {
surfaceHandle = 0;
}
+ @Override
public void setSurfaceHandle(long handle) {
surfaceHandle = handle ;
}
@@ -92,8 +95,9 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface {
@Override
public long getSurfaceHandle() {
return surfaceHandle;
- }
+ }
+ @Override
protected void requestFocusImpl(boolean reparented) {
}
@@ -101,7 +105,7 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface {
public void setPosition(int x, int y) {
// nop
}
-
+
@Override
public boolean setFullscreen(boolean fullscreen) {
return false; // nop
@@ -112,7 +116,8 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface {
return false; // nop
}
-
+
+ @Override
protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) {
sizeChanged(false, width, height, false);
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
@@ -132,19 +137,20 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface {
@Override
public Point getLocationOnScreen(Point storage) {
if(null!=storage) {
- storage.setX(0);
- storage.setY(0);
+ storage.set(0, 0);
return storage;
}
return new Point(0,0);
}
-
+
+ @Override
protected Point getLocationOnScreenImpl(int x, int y) {
return new Point(x,y);
}
-
+
+ @Override
protected void updateInsetsImpl(Insets insets) {
- // nop ..
+ // nop ..
}
}
diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java
index 5ffa2eb..d7e6c64 100644
--- a/src/newt/classes/jogamp/newt/ScreenImpl.java
+++ b/src/newt/classes/jogamp/newt/ScreenImpl.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt;
@@ -56,7 +56,7 @@ import com.jogamp.newt.util.MonitorModeUtil;
public abstract class ScreenImpl extends Screen implements MonitorModeListener {
protected static final boolean DEBUG_TEST_SCREENMODE_DISABLED;
-
+
static {
Debug.initSingleton();
DEBUG_TEST_SCREENMODE_DISABLED = Debug.isPropertyDefined("newt.test.Screen.disableScreenMode", true);
@@ -67,14 +67,14 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
public static final int default_sm_heightmm = 324;
public static final int default_sm_rate = 60;
public static final int default_sm_rotation = 0;
-
+
static {
DisplayImpl.initSingleton();
}
-
+
/** Ensure static init has been run. */
/* pp */static void initSingleton() { }
-
+
protected DisplayImpl display;
protected int screen_idx;
protected String fqname;
@@ -85,14 +85,14 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
protected static Dimension usrSize = null; // property values: newt.ws.swidth and newt.ws.sheight
protected static volatile boolean usrSizeQueried = false;
private ArrayList<MonitorModeListener> refMonitorModeListener = new ArrayList<MonitorModeListener>();
-
+
private long tCreated; // creationTime
- private static Class<?> getScreenClass(String type) throws ClassNotFoundException
+ private static Class<?> getScreenClass(String type) throws ClassNotFoundException
{
final Class<?> screenClass = NewtFactory.getCustomClass(type, "ScreenDriver");
if(null==screenClass) {
- throw new ClassNotFoundException("Failed to find NEWT Screen Class <"+type+".ScreenDriver>");
+ throw new ClassNotFoundException("Failed to find NEWT Screen Class <"+type+".ScreenDriver>");
}
return screenClass;
}
@@ -104,7 +104,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
if(!usrSizeQueried) {
usrSizeQueried = true;
final int w = Debug.getIntProperty("newt.ws.swidth", true, 0);
- final int h = Debug.getIntProperty("newt.ws.sheight", true, 0);
+ final int h = Debug.getIntProperty("newt.ws.sheight", true, 0);
if(w>0 && h>0) {
usrSize = new Dimension(w, h);
System.err.println("User screen size "+usrSize);
@@ -135,7 +135,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
System.err.println("Screen.create() NEW: "+screen+" "+Display.getThreadName());
}
return screen;
- }
+ }
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -167,16 +167,16 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
@Override
public synchronized final void createNative()
throws NativeWindowException
- {
+ {
if(null == aScreen) {
if(DEBUG) {
tCreated = System.nanoTime();
System.err.println("Screen.createNative() START ("+DisplayImpl.getThreadName()+", "+this+")");
} else {
tCreated = 0;
- }
+ }
display.addReference();
-
+
createNativeImpl();
if(null == aScreen) {
throw new NativeWindowException("Screen.createNative() failed to instanciate an AbstractGraphicsScreen");
@@ -249,7 +249,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
protected abstract void createNativeImpl();
protected abstract void closeNativeImpl();
-
+
/**
* Returns the validated screen index, which is either the passed <code>idx</code>
* value or <code>0</code>.
@@ -258,23 +258,23 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
* </p>
*/
protected abstract int validateScreenIndex(int idx);
-
+
/**
* Stores the virtual origin and virtual <b>rotated</b> screen size.
* <p>
- * This method is called after the MonitorMode has been set or changed,
+ * This method is called after the MonitorMode has been set or changed,
* hence you may utilize it.
* </p>
* <p>
* Default implementation uses the union of all monitor's viewport,
- * calculated via {@link #unionOfMonitorViewportSize()}.
+ * calculated via {@link #unionOfMonitorViewportSize()}.
* </p>
* @param vOriginSize storage for result
*/
- protected void calcVirtualScreenOriginAndSize(final Rectangle vOriginSize) {
+ protected void calcVirtualScreenOriginAndSize(final Rectangle vOriginSize) {
unionOfMonitorViewportSize(vOriginSize);
}
-
+
@Override
public final String getFQName() {
return fqname;
@@ -285,10 +285,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
*/
protected void updateVirtualScreenOriginAndSize() {
if(null != usrSize ) {
- vOriginSize.setX(0);
- vOriginSize.setY(0);
- vOriginSize.setWidth(usrSize.getWidth());
- vOriginSize.setHeight(usrSize.getHeight());
+ vOriginSize.set(0, 0, usrSize.getWidth(), usrSize.getHeight());
if(DEBUG) {
System.err.println("Update user virtual screen viewport @ "+Thread.currentThread().getName()+": "+vOriginSize);
}
@@ -338,15 +335,15 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
}
//
- // MonitorDevice and MonitorMode
+ // MonitorDevice and MonitorMode
//
-
+
/**
* To be implemented by the native specification.<br>
* Is called within a thread safe environment.<br>
* Is called only to collect the {@link MonitorMode}s and {@link MonitorDevice}s, usually at startup setting up modes.<br>
* <br>
- * <b>WARNING</b>: must be synchronized with
+ * <b>WARNING</b>: must be synchronized with
* <ul>
* <li>{@link MonitorModeProps#NUM_SCREEN_MODE_PROPERTIES} and </li>
* <li>{@link MonitorModeProps#MIN_MONITOR_DEVICE_PROPERTIES}</li>
@@ -359,19 +356,19 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
* @param cache memory pool caching the result
*/
protected abstract void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache);
-
+
protected Rectangle getNativeMonitorDeviceViewportImpl(MonitorDevice monitor) { return null; }
-
+
/**
* To be implemented by the native specification.<br>
* Is called within a thread safe environment.<br>
* <p>
- * Implementation shall not unify the result w/ monitor's supported modes or a locally
+ * Implementation shall not unify the result w/ monitor's supported modes or a locally
* saved {@link MonitorModeProps.Cache}, since caller will perform such tasks.
* </p>
*/
protected abstract MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor);
-
+
/**
* To be implemented by the native specification.<br>
* Is called within a thread safe environment.<br>
@@ -381,13 +378,13 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
@Override
public final List<MonitorMode> getMonitorModes() {
final ScreenMonitorState sms = getScreenMonitorStatus(false);
- return null != sms ? sms.getMonitorModes().getData() : null;
+ return null != sms ? sms.getMonitorModes().getData() : null;
}
-
+
@Override
public final List<MonitorDevice> getMonitorDevices() {
final ScreenMonitorState sms = getScreenMonitorStatus(false);
- return null != sms ? sms.getMonitorDevices().getData() : null;
+ return null != sms ? sms.getMonitorDevices().getData() : null;
}
final ScreenMonitorState getScreenMonitorStatus(boolean throwException) {
@@ -398,7 +395,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
}
return res;
}
-
+
@Override
public void monitorModeChangeNotify(MonitorEvent me) {
if(DEBUG) {
@@ -420,9 +417,9 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
if( null != newViewport ) {
monitor.setViewportValue(newViewport);
}
- }
+ }
}
-
+
@Override
public void monitorModeChanged(MonitorEvent me, boolean success) {
if(success) {
@@ -446,9 +443,9 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
public synchronized final void removeMonitorModeListener(MonitorModeListener sml) {
refMonitorModeListener.remove(sml);
}
-
+
/**
- *
+ *
* @param cache optional ..
* @param modeId
* @return
@@ -471,7 +468,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
}
/**
- *
+ *
* @param cache mandatory !
* @param monitorId
* @param currentMode
@@ -496,7 +493,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
}
return MonitorModeProps.streamInMonitorDevice(null, cache, this, props, 0);
}
-
+
/**
* Utilizes {@link #getCurrentMonitorModeImpl()}, if the latter returns null it uses
* the current screen size and dummy values.
@@ -533,7 +530,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
sms = ScreenMonitorState.getScreenMonitorState(this.getFQName());
if(null==sms) {
final MonitorModeProps.Cache cache = new MonitorModeProps.Cache();
- if( 0 >= collectNativeMonitorModes(cache) ) {
+ if( 0 >= collectNativeMonitorModes(cache) ) {
updateVirtualScreenOriginAndSize();
vScrnSizeUpdated = true;
final MonitorMode mode = getVirtualMonitorMode(cache, 0);
@@ -560,7 +557,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
System.err.println("["+i+"]["+j+"]: "+iMode.next());
}
}
- }
+ }
sms = new ScreenMonitorState(cache.monitorDevices, cache.monitorModes);
ScreenMonitorState.mapScreenMonitorState(this.getFQName(), sms);
}
@@ -583,7 +580,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
* Collects {@link MonitorDevice}s and {@link MonitorMode}s within the given cache.
* </p>
*/
- private final int collectNativeMonitorModes(MonitorModeProps.Cache cache) {
+ private final int collectNativeMonitorModes(MonitorModeProps.Cache cache) {
if(!DEBUG_TEST_SCREENMODE_DISABLED) {
collectNativeMonitorModesAndDevicesImpl(cache);
}
@@ -642,12 +639,12 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
} finally {
sms.unlock();
}
- }
+ }
} finally {
ScreenMonitorState.unlockScreenMonitorState();
}
}
-
+
private final void shutdown() {
ScreenMonitorState sms = ScreenMonitorState.getScreenMonitorStateUnlocked(getFQName());
if(null != sms) {
@@ -664,11 +661,11 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
}
}
ScreenMonitorState.unmapScreenMonitorStateUnlocked(getFQName());
- }
+ }
}
-
+
/** pp */ static final void shutdownAll() {
- final int sCount = screenList.size();
+ final int sCount = screenList.size();
if(DEBUG) {
System.err.println("Screen.shutdownAll "+sCount+" instances, on thread "+Display.getThreadName());
}
diff --git a/src/newt/classes/jogamp/newt/ScreenMonitorState.java b/src/newt/classes/jogamp/newt/ScreenMonitorState.java
index 66e75be..01e6cfe 100644
--- a/src/newt/classes/jogamp/newt/ScreenMonitorState.java
+++ b/src/newt/classes/jogamp/newt/ScreenMonitorState.java
@@ -42,7 +42,7 @@ import java.util.HashMap;
public class ScreenMonitorState {
private static boolean DEBUG = Screen.DEBUG;
-
+
private final RecursiveLock lock = LockFactory.createRecursiveLock();
private final ArrayHashSet<MonitorDevice> allMonitors;
private final ArrayHashSet<MonitorMode> allMonitorModes;
@@ -105,21 +105,21 @@ public class ScreenMonitorState {
protected static void unlockScreenMonitorState() {
screen2ScreenMonitorState.unlock();
}
-
+
public ScreenMonitorState(ArrayHashSet<MonitorDevice> allMonitors,
ArrayHashSet<MonitorMode> allMonitorModes) {
- this.allMonitors = allMonitors;
+ this.allMonitors = allMonitors;
this.allMonitorModes = allMonitorModes;
}
- protected ArrayHashSet<MonitorDevice> getMonitorDevices() {
+ protected ArrayHashSet<MonitorDevice> getMonitorDevices() {
return allMonitors;
}
-
- protected ArrayHashSet<MonitorMode> getMonitorModes() {
+
+ protected ArrayHashSet<MonitorMode> getMonitorModes() {
return allMonitorModes;
}
-
+
protected final int addListener(MonitorModeListener l) {
lock();
try {
@@ -151,14 +151,14 @@ public class ScreenMonitorState {
protected final MonitorDevice getMonitor(MonitorDevice monitor) {
return allMonitors.get(monitor);
}
-
+
protected final void validateMonitor(MonitorDevice monitor) {
final MonitorDevice md = allMonitors.get(monitor);
if( null == md ) {
throw new InternalError("Monitor unknown: "+monitor);
}
}
-
+
protected final void fireMonitorModeChangeNotify(MonitorDevice monitor, MonitorMode desiredMode) {
lock();
try {
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index caa461e..5102fd2 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt;
@@ -39,6 +39,7 @@ import java.util.List;
import java.lang.ref.WeakReference;
import java.lang.reflect.Method;
+import com.jogamp.common.util.ArrayHashSet;
import com.jogamp.common.util.IntBitfield;
import com.jogamp.common.util.ReflectionUtil;
import com.jogamp.newt.MonitorDevice;
@@ -48,6 +49,8 @@ import com.jogamp.newt.Screen;
import com.jogamp.newt.Window;
import com.jogamp.common.util.locks.LockFactory;
import com.jogamp.common.util.locks.RecursiveLock;
+import com.jogamp.newt.event.DoubleTapScrollGesture;
+import com.jogamp.newt.event.GestureHandler;
import com.jogamp.newt.event.InputEvent;
import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.KeyListener;
@@ -60,6 +63,7 @@ import com.jogamp.newt.event.MonitorModeListener;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.event.WindowListener;
import com.jogamp.newt.event.WindowUpdateEvent;
+import com.jogamp.newt.event.MouseEvent.PointerType;
import javax.media.nativewindow.AbstractGraphicsConfiguration;
import javax.media.nativewindow.AbstractGraphicsDevice;
@@ -71,6 +75,7 @@ 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.DimensionImmutable;
import javax.media.nativewindow.util.Insets;
import javax.media.nativewindow.util.InsetsImmutable;
import javax.media.nativewindow.util.Point;
@@ -82,19 +87,19 @@ import jogamp.nativewindow.SurfaceUpdatedHelper;
public abstract class WindowImpl implements Window, NEWTEventConsumer
{
public static final boolean DEBUG_TEST_REPARENT_INCOMPATIBLE;
-
+
static {
Debug.initSingleton();
DEBUG_TEST_REPARENT_INCOMPATIBLE = Debug.isPropertyDefined("newt.test.Window.reparent.incompatible", true);
-
+
ScreenImpl.initSingleton();
}
-
- protected static final ArrayList<WeakReference<WindowImpl>> windowList = new ArrayList<WeakReference<WindowImpl>>();
-
+
+ protected static final ArrayList<WeakReference<WindowImpl>> windowList = new ArrayList<WeakReference<WindowImpl>>();
+
/** Maybe utilized at a shutdown hook, impl. does not block. */
public static final void shutdownAll() {
- final int wCount = windowList.size();
+ final int wCount = windowList.size();
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.shutdownAll "+wCount+" instances, on thread "+getThreadName());
}
@@ -127,23 +132,25 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
}
-
+
/** Timeout of queued events (repaint and resize) */
- static final long QUEUED_EVENT_TO = 1200; // ms
+ static final long QUEUED_EVENT_TO = 1200; // ms
+
+ private static final PointerType[] constMousePointerTypes = new PointerType[] { PointerType.Mouse };
//
// Volatile: Multithread Mutable Access
- //
+ //
private volatile long windowHandle = 0; // lifecycle critical
private volatile boolean visible = false; // lifecycle critical
- private volatile boolean hasFocus = false;
+ private volatile boolean hasFocus = false;
private volatile int width = 128, height = 128; // client-area size w/o insets, default: may be overwritten by user
private volatile int x = 64, y = 64; // client-area pos w/o insets
private volatile Insets insets = new Insets(); // insets of decoration (if top-level && decorated)
-
+
private RecursiveLock windowLock = LockFactory.createRecursiveLock(); // Window instance wide lock
private int surfaceLockCount = 0; // surface lock recursion count
-
+
private ScreenImpl screen; // never null after create - may change reference though (reparent)
private boolean screenReferenceAdded = false;
private NativeWindow parentWindow = null;
@@ -154,9 +161,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private boolean fullscreen = false, brokenFocusChange = false;
private List<MonitorDevice> fullscreenMonitors = null;
private boolean fullscreenUseMainMonitor = true;
- private boolean fullscreenUseSpanningMode = true; // spanning mode: fake full screen, only on certain platforms
private boolean autoPosition = true; // default: true (allow WM to choose top-level position, if not set by user)
-
+
private int nfs_width, nfs_height, nfs_x, nfs_y; // non fullscreen client-area size/pos w/o insets
private NativeWindow nfs_parent = null; // non fullscreen parent, in case explicit reparenting is performed (offscreen)
private String title = "Newt Window";
@@ -172,17 +178,65 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private KeyListener keyboardFocusHandler = null;
private SurfaceUpdatedHelper surfaceUpdatedHelper = new SurfaceUpdatedHelper();
-
+
private Object childWindowsLock = new Object();
private ArrayList<NativeWindow> childWindows = new ArrayList<NativeWindow>();
private ArrayList<MouseListener> mouseListeners = new ArrayList<MouseListener>();
- private short mouseButtonPressed = (short)0; // current pressed mouse button number
- private int mouseButtonModMask = 0; // current pressed mouse button modifier mask
- private long lastMousePressed = 0; // last time when a mouse button was pressed
- private short lastMouseClickCount = (short)0; // last mouse button click count
- private boolean mouseInWindow = false;// mouse entered window - is inside the window (may be synthetic)
- private Point lastMousePosition = new Point();
+
+ /** from event passing: {@link WindowImpl#consumePointerEvent(MouseEvent)}. */
+ private static class PointerState0 {
+ /** mouse entered window - is inside the window (may be synthetic) */
+ boolean insideWindow = false;
+
+ /** last time when a mouse button was pressed */
+ long lastButtonPressTime = 0;
+
+ void clearButton() {
+ lastButtonPressTime = 0;
+ }
+ }
+ private PointerState0 pState0 = new PointerState0();
+
+ /** from direct input: {@link WindowImpl#doPointerEvent(boolean, boolean, int[], short, int, int, boolean, short[], int[], int[], float[], float, float[], float)}. */
+ private static class PointerState1 extends PointerState0 {
+ /** current pressed mouse button number */
+ short buttonPressed = (short)0;
+ /** current pressed mouse button modifier mask */
+ int buttonPressedMask = 0;
+ /** last mouse button click count */
+ short lastButtonClickCount = (short)0;
+
+ @Override
+ final void clearButton() {
+ super.clearButton();
+ lastButtonPressTime = 0;
+ lastButtonClickCount = (short)0;
+ buttonPressed = 0;
+ buttonPressedMask = 0;
+ }
+
+ /** last pointer-move position for 8 touch-down pointers */
+ final Point[] movePositions = new Point[] {
+ new Point(), new Point(), new Point(), new Point(),
+ new Point(), new Point(), new Point(), new Point() };
+ final Point getMovePosition(int id) {
+ if( 0 <= id && id < movePositions.length ) {
+ return movePositions[id];
+ }
+ return null;
+ }
+ }
+ private PointerState1 pState1 = new PointerState1();
+
+ /** pointer names -> pointer ID (consecutive index, starting w/ 0) */
+ private final ArrayHashSet<Integer> pName2pID = new ArrayHashSet<Integer>();
+
+ private boolean defaultGestureHandlerEnabled = true;
+ private DoubleTapScrollGesture gesture2PtrTouchScroll = null;
+ private ArrayList<GestureHandler> pointerGestureHandler = new ArrayList<GestureHandler>();
+
+ private ArrayList<GestureHandler.GestureListener> gestureListeners = new ArrayList<GestureHandler.GestureListener>();
private ArrayList<KeyListener> keyListeners = new ArrayList<KeyListener>();
@@ -214,7 +268,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
{
final Class<?> windowClass = NewtFactory.getCustomClass(type, "WindowDriver");
if(null==windowClass) {
- throw new ClassNotFoundException("Failed to find NEWT Window Class <"+type+".WindowDriver>");
+ throw new ClassNotFoundException("Failed to find NEWT Window Class <"+type+".WindowDriver>");
}
return windowClass;
}
@@ -240,7 +294,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
throw new NativeWindowException(t);
}
}
-
+
public static WindowImpl create(Object[] cstrArguments, Screen screen, CapabilitiesImmutable caps) {
try {
Class<?> windowClass = getWindowClass(screen.getDisplay().getType());
@@ -273,15 +327,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
fullscreen = false;
fullscreenMonitors = null;
fullscreenUseMainMonitor = true;
- fullscreenUseSpanningMode = false;
hasFocus = false;
parentWindowHandle = 0;
}
-
+
protected final void setGraphicsConfiguration(AbstractGraphicsConfiguration cfg) {
config = cfg;
}
-
+
public static interface LifecycleHook {
/**
* Reset of internal state counter, ie totalFrames, etc.
@@ -289,8 +342,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
*/
public abstract void resetCounter();
- /**
- * Invoked after Window setVisible,
+ /**
+ * Invoked after Window setVisible,
* allows allocating resources depending on the native Window.
* Called from EDT while window is locked.
*/
@@ -302,9 +355,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @param value <code>true</code> to set the one-shot preservation if supported, otherwise clears it.
*/
void preserveGLStateAtDestroy(boolean value);
-
- /**
- * Invoked before Window destroy action,
+
+ /**
+ * Invoked before Window destroy action,
* allows releasing of resources depending on the native Window.<br>
* Surface not locked yet.<br>
* Called not necessarily from EDT.
@@ -336,12 +389,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @see #pauseRenderingAction()
*/
void resumeRenderingAction();
-
+
/**
* Shutdown rendering action (thread) abnormally.
* <p>
* Should be called only at shutdown, if necessary.
- * </p>
+ * </p>
*/
void shutdownRenderingAction();
}
@@ -354,14 +407,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
} else {
tStart = 0;
}
-
- if( null != parentWindow &&
+
+ if( null != parentWindow &&
NativeSurface.LOCK_SURFACE_NOT_READY >= parentWindow.lockSurface() ) {
throw new NativeWindowException("Parent surface lock: not ready: "+parentWindow);
}
-
+
// child window: position defaults to 0/0, no auto position, no negative position
- if( null != parentWindow && ( autoPosition || 0>getX() || 0>getY() ) ) {
+ if( null != parentWindow && ( autoPosition || 0>getX() || 0>getY() ) ) {
definePosition(0, 0);
}
boolean postParentlockFocus = false;
@@ -416,7 +469,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
if(postParentlockFocus) {
// harmonize focus behavior for all platforms: focus on creation
- requestFocusInt(isFullscreen() /* skipFocusAction */);
+ requestFocusInt(isFullscreen() /* skipFocusAction if fullscreen */);
((DisplayImpl) screen.getDisplay()).dispatchMessagesNative(); // status up2date
}
if(DEBUG_IMPLEMENTATION) {
@@ -484,12 +537,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private Object closingListenerLock = new Object();
private WindowClosingMode defaultCloseOperation = WindowClosingMode.DISPOSE_ON_CLOSE;
+ @Override
public WindowClosingMode getDefaultCloseOperation() {
synchronized (closingListenerLock) {
return defaultCloseOperation;
}
}
+ @Override
public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) {
synchronized (closingListenerLock) {
WindowClosingMode _op = defaultCloseOperation;
@@ -504,28 +559,28 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
/**
* Notifies the driver impl. that the instantiation is finished,
- * ie. instance created and all fields set.
+ * ie. instance created and all fields set.
*/
protected void instantiationFinished() {
// nop
}
-
+
protected boolean canCreateNativeImpl() {
return true; // default: always able to be created
}
-
- /**
+
+ /**
* The native implementation must set the native windowHandle.<br>
*
* <p>
* The implementation shall respect the states {@link #isAlwaysOnTop()}/{@link #FLAG_IS_ALWAYSONTOP} and
* {@link #isUndecorated()}/{@link #FLAG_IS_UNDECORATED}, ie. the created window shall reflect those settings.
* </p>
- *
+ *
* <p>
* The implementation should invoke the referenced java state callbacks
* to notify this Java object of state changes.</p>
- *
+ *
* @see #windowDestroyNotify(boolean)
* @see #focusChanged(boolean, boolean)
* @see #visibleChanged(boolean, boolean)
@@ -537,16 +592,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
protected abstract void closeNativeImpl();
- /**
+ /**
* Async request which shall be performed within {@link #TIMEOUT_NATIVEWINDOW}.
* <p>
- * If if <code>force == false</code> the native implementation
+ * If if <code>force == false</code> the native implementation
* may only request focus if not yet owner.</p>
* <p>
* {@link #focusChanged(boolean, boolean)} should be called
- * to notify about the focus traversal.
- * </p>
- *
+ * to notify about the focus traversal.
+ * </p>
+ *
* @param force if true, bypass {@link #focusChanged(boolean, boolean)} and force focus request
*/
protected abstract void requestFocusImpl(boolean force);
@@ -556,7 +611,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public static final int FLAG_CHANGE_FULLSCREEN = 1 << 2;
public static final int FLAG_CHANGE_ALWAYSONTOP = 1 << 3;
public static final int FLAG_CHANGE_VISIBILITY = 1 << 4;
-
+
public static final int FLAG_HAS_PARENT = 1 << 8;
public static final int FLAG_IS_UNDECORATED = 1 << 9;
public static final int FLAG_IS_FULLSCREEN = 1 << 10;
@@ -567,12 +622,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
/**
* The native implementation should invoke the referenced java state callbacks
* to notify this Java object of state changes.
- *
+ *
* <p>
* Implementations shall set x/y to 0, in case it's negative. This could happen due
* to insets and positioning a decorated window to 0/0, which would place the frame
* outside of the screen.</p>
- *
+ *
* @param x client-area position, or <0 if unchanged
* @param y client-area position, or <0 if unchanged
* @param width client-area size, or <=0 if unchanged
@@ -583,12 +638,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @see #positionChanged(boolean,int, int)
*/
protected abstract boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags);
-
- /**
+
+ /**
* Tests whether a single reconfigure flag is supported by implementation.
* <p>
* Default is all but {@link #FLAG_IS_FULLSCREEN_SPAN}
- * </p>
+ * </p>
*/
protected boolean isReconfigureFlagSupported(int changeFlags) {
return 0 == ( changeFlags & FLAG_IS_FULLSCREEN_SPAN );
@@ -604,14 +659,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
protected static String getReconfigureFlagsAsString(StringBuilder sb, int flags) {
if(null == sb) { sb = new StringBuilder(); }
sb.append("[");
-
+
if( 0 != ( FLAG_CHANGE_PARENTING & flags) ) {
sb.append("*");
}
sb.append("PARENT_");
sb.append(0 != ( FLAG_HAS_PARENT & flags));
sb.append(", ");
-
+
if( 0 != ( FLAG_CHANGE_FULLSCREEN & flags) ) {
sb.append("*");
}
@@ -627,24 +682,24 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
sb.append("UNDECOR_");
sb.append(0 != ( FLAG_IS_UNDECORATED & flags));
sb.append(", ");
-
+
if( 0 != ( FLAG_CHANGE_ALWAYSONTOP & flags) ) {
sb.append("*");
}
sb.append("ALWAYSONTOP_");
sb.append(0 != ( FLAG_IS_ALWAYSONTOP & flags));
sb.append(", ");
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
sb.append("*");
}
sb.append("VISIBLE_");
sb.append(0 != ( FLAG_IS_VISIBLE & flags));
-
+
sb.append("]");
return sb.toString();
}
-
+
protected void setTitleImpl(String title) {}
/**
@@ -661,11 +716,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* @return if not null, the screen location of the given coordinates
*/
protected abstract Point getLocationOnScreenImpl(int x, int y);
-
+
/** Triggered by user via {@link #getInsets()}.<br>
- * Implementations may implement this hook to update the insets.<br>
+ * Implementations may implement this hook to update the insets.<br>
* However, they may prefer the event driven path via {@link #insetsChanged(boolean, int, int, int, int)}.
- *
+ *
* @see #getInsets()
* @see #insetsChanged(boolean, int, int, int, int)
*/
@@ -674,7 +729,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
protected boolean setPointerVisibleImpl(boolean pointerVisible) { return false; }
protected boolean confinePointerImpl(boolean confine) { return false; }
protected void warpPointerImpl(int x, int y) { }
-
+
//----------------------------------------------------------------------
// NativeSurface
//
@@ -739,7 +794,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public final RecursiveLock getLock() {
return windowLock;
}
-
+
@Override
public long getSurfaceHandle() {
return windowHandle; // default: return window handle
@@ -758,7 +813,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
@Override
public final long getDisplayHandle() {
return config.getNativeGraphicsConfiguration().getScreen().getDevice().getHandle();
- }
+ }
@Override
public final int getScreenIndex() {
@@ -827,19 +882,19 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public final Screen getScreen() {
return screen;
}
-
+
@Override
public final MonitorDevice getMainMonitor() {
return screen.getMainMonitor(new Rectangle(getX(), getY(), getWidth(), getHeight()));
}
-
+
protected final void setVisibleImpl(boolean visible, int x, int y, int width, int height) {
- reconfigureWindowImpl(x, y, width, height, getReconfigureFlags(FLAG_CHANGE_VISIBILITY, visible));
- }
+ reconfigureWindowImpl(x, y, width, height, getReconfigureFlags(FLAG_CHANGE_VISIBILITY, visible));
+ }
final void setVisibleActionImpl(boolean visible) {
boolean nativeWindowCreated = false;
boolean madeVisible = false;
-
+
final RecursiveLock _lock = windowLock;
_lock.lock();
try {
@@ -859,7 +914,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
madeVisible = nativeWindowCreated;
}
// always flag visible, allowing a retry ..
- WindowImpl.this.visible = true;
+ WindowImpl.this.visible = true;
} else if(WindowImpl.this.visible != visible) {
if(isNativeValid()) {
setVisibleImpl(visible, getX(), getY(), getWidth(), getHeight());
@@ -904,6 +959,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
this.visible = visible;
}
+ @Override
public final void run() {
setVisibleActionImpl(visible);
}
@@ -913,14 +969,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window setVisible: START ("+getThreadName()+") "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible: "+this.visible+" -> "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+(null!=parentWindow));
}
- runOnEDTIfAvail(wait, new VisibleAction(visible));
+ runOnEDTIfAvail(wait, new VisibleAction(visible));
}
@Override
public void setVisible(boolean visible) {
setVisible(true, visible);
}
-
+
private class SetSizeAction implements Runnable {
int width, height;
boolean disregardFS;
@@ -931,6 +987,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
this.disregardFS = disregardFS;
}
+ @Override
public final void run() {
final RecursiveLock _lock = windowLock;
_lock.lock();
@@ -972,17 +1029,18 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private void setFullscreenSize(int width, int height) {
runOnEDTIfAvail(true, new SetSizeAction(width, height, true));
- }
+ }
@Override
public void setSize(int width, int height) {
runOnEDTIfAvail(true, new SetSizeAction(width, height, false));
- }
+ }
@Override
public void setTopLevelSize(int width, int height) {
setSize(width - getInsets().getTotalWidth(), height - getInsets().getTotalHeight());
}
private class DestroyAction implements Runnable {
+ @Override
public final void run() {
boolean animatorPaused = false;
if(null!=lifecycleHook) {
@@ -997,10 +1055,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window DestroyAction() hasScreen "+(null != screen)+", isNativeValid "+isNativeValid()+" - "+getThreadName());
}
-
+
// send synced destroy-notify notification
sendWindowEvent(WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY);
-
+
// Childs first ..
synchronized(childWindowsLock) {
if(childWindows.size()>0) {
@@ -1035,7 +1093,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
removeScreenReference();
Display dpy = screen.getDisplay();
if(null != dpy) {
- dpy.validateEDT();
+ dpy.validateEDTStopped();
}
// send synced destroyed notification
@@ -1051,7 +1109,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
fullscreen = false;
fullscreenMonitors = null;
fullscreenUseMainMonitor = true;
- fullscreenUseSpanningMode = false;
hasFocus = false;
parentWindowHandle = 0;
@@ -1060,30 +1117,30 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(animatorPaused) {
lifecycleHook.resumeRenderingAction();
}
-
+
// these refs shall be kept alive - resurrection via setVisible(true)
/**
if(null!=parentWindow && parentWindow instanceof Window) {
((Window)parentWindow).removeChild(WindowImpl.this);
- }
+ }
childWindows = null;
surfaceUpdatedListeners = null;
mouseListeners = null;
keyListeners = null;
capsRequested = null;
lifecycleHook = null;
-
- screen = null;
+
+ screen = null;
windowListeners = null;
parentWindow = null;
- */
+ */
}
}
private final DestroyAction destroyAction = new DestroyAction();
@Override
public void destroy() {
- visible = false; // Immediately mark synchronized visibility flag, avoiding possible recreation
+ visible = false; // Immediately mark synchronized visibility flag, avoiding possible recreation
runOnEDTIfAvail(true, destroyAction);
}
@@ -1093,15 +1150,15 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
destroy();
}
-
+
/**
* @param cWin child window, must not be null
* @param pWin parent window, may be null
- * @return true if at least one of both window's configurations is offscreen
+ * @return true if at least one of both window's configurations is offscreen
*/
protected static boolean isOffscreenInstance(NativeWindow cWin, NativeWindow pWin) {
boolean ofs = false;
- final AbstractGraphicsConfiguration cWinCfg = cWin.getGraphicsConfiguration();
+ final AbstractGraphicsConfiguration cWinCfg = cWin.getGraphicsConfiguration();
if( null != cWinCfg ) {
ofs = !cWinCfg.getChosenCapabilities().isOnscreen();
}
@@ -1113,14 +1170,17 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
return ofs;
}
-
+
private class ReparentAction implements Runnable {
- NativeWindow newParentWindow;
+ final NativeWindow newParentWindow;
+ final int topLevelX, topLevelY;
boolean forceDestroyCreate;
ReparentOperation operation;
- private ReparentAction(NativeWindow newParentWindow, boolean forceDestroyCreate) {
+ private ReparentAction(NativeWindow newParentWindow, int topLevelX, int topLevelY, boolean forceDestroyCreate) {
this.newParentWindow = newParentWindow;
+ this.topLevelX = topLevelX;
+ this.topLevelY = topLevelY;
this.forceDestroyCreate = forceDestroyCreate | DEBUG_TEST_REPARENT_INCOMPATIBLE;
this.operation = ReparentOperation.ACTION_INVALID; // ensure it's set
}
@@ -1133,7 +1193,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
removeScreenReference();
screen = newScreen;
}
-
+
+ @Override
public final void run() {
boolean animatorPaused = false;
if(null!=lifecycleHook) {
@@ -1144,15 +1205,18 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
lifecycleHook.resumeRenderingAction();
}
}
-
+
private void reparent() {
// mirror pos/size so native change notification can get overwritten
- int x = getX();
- int y = getY();
- int width = getWidth();
- int height = getHeight();
+ final int oldX = getX();
+ final int oldY = getY();
+ final int oldWidth = getWidth();
+ final int oldHeight = getHeight();
+ final int x, y;
+ int width = oldWidth;
+ int height = oldHeight;
boolean wasVisible;
-
+
final RecursiveLock _lock = windowLock;
_lock.lock();
try {
@@ -1160,7 +1224,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// force recreation if offscreen, since it may become onscreen
forceDestroyCreate |= isOffscreenInstance(WindowImpl.this, newParentWindow);
}
-
+
wasVisible = isVisible();
Window newParentWindowNEWT = null;
@@ -1171,10 +1235,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
long newParentWindowHandle = 0 ;
if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window.reparent: START ("+getThreadName()+") valid "+isNativeValid()+", windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)+", visible "+wasVisible+", old parentWindow: "+Display.hashCodeNullSafe(parentWindow)+", new parentWindow: "+Display.hashCodeNullSafe(newParentWindow)+", forceDestroyCreate "+forceDestroyCreate+", "+x+"/"+y+" "+width+"x"+height);
+ System.err.println("Window.reparent: START ("+getThreadName()+") valid "+isNativeValid()+", windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)+", visible "+wasVisible+", old parentWindow: "+Display.hashCodeNullSafe(parentWindow)+", new parentWindow: "+Display.hashCodeNullSafe(newParentWindow)+", forceDestroyCreate "+forceDestroyCreate);
}
if(null!=newParentWindow) {
+ // REPARENT TO CHILD WINDOW
+
// reset position to 0/0 within parent space
x = 0;
y = 0;
@@ -1219,7 +1285,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
operation = ReparentOperation.ACTION_NATIVE_CREATION_PENDING;
}
} else if ( forceDestroyCreate || !NewtFactory.isScreenCompatible(newParentWindow, screen) ) {
- // Destroy this window, may create a new compatible Screen/Display, while trying to preserve resources if becoming visible again.
+ // Destroy this window, may create a new compatible Screen/Display, while trying to preserve resources if becoming visible again.
destroy( wasVisible );
if(null!=newParentWindowNEWT) {
setScreen( (ScreenImpl) newParentWindowNEWT.getScreen() );
@@ -1236,12 +1302,19 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
operation = ReparentOperation.ACTION_NOP;
}
} else {
- if( null != parentWindow ) {
+ // REPARENT TO TOP-LEVEL WINDOW
+ if( 0 <= topLevelX && 0 <= topLevelY ) {
+ x = topLevelX;
+ y = topLevelY;
+ } else if( null != parentWindow ) {
// child -> top
// put client to current parent+child position
final Point p = getLocationOnScreen(null);
x = p.getX();
y = p.getY();
+ } else {
+ x = oldX;
+ y = oldY;
}
// Case: Top Window
@@ -1268,15 +1341,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
throw new NativeWindowException("Internal Error: reparentAction not set");
}
- if( ReparentOperation.ACTION_NOP == operation ) {
- if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window.reparent: NO CHANGE ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+" new parentWindowHandle "+toHexString(newParentWindowHandle)+", visible "+wasVisible);
- }
- return;
+ if(DEBUG_IMPLEMENTATION) {
+ System.err.println("Window.reparent: ACTION ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+" new parentWindowHandle "+toHexString(newParentWindowHandle)+", reparentAction "+operation+", pos/size "+x+"/"+y+" "+width+"x"+height+", visible "+wasVisible);
}
- if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window.reparent: ACTION ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+" new parentWindowHandle "+toHexString(newParentWindowHandle)+", reparentAction "+operation+", visible "+wasVisible);
+ if( ReparentOperation.ACTION_NOP == operation ) {
+ return;
}
// rearrange window tree
@@ -1288,19 +1358,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
((Window)parentWindow).addChild(WindowImpl.this);
}
- if( ReparentOperation.ACTION_NATIVE_CREATION_PENDING == operation ) {
- // make size and position persistent for proper recreation
- definePosition(x, y);
- defineSize(width, height);
- return;
- }
-
if( ReparentOperation.ACTION_NATIVE_REPARENTING == operation ) {
final DisplayImpl display = (DisplayImpl) screen.getDisplay();
display.dispatchMessagesNative(); // status up2date
- if(wasVisible) {
- setVisibleImpl(false, x, y, width, height);
+ // TOP -> CLIENT: !visible first (fixes X11 unsuccessful return to parent window)
+ if( null != parentWindow && wasVisible && NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true) ) {
+ setVisibleImpl(false, oldX, oldY, oldWidth, oldHeight);
WindowImpl.this.waitForVisible(false, false);
// FIXME: Some composite WM behave slacky .. give 'em chance to change state -> invisible,
// even though we do exactly that (KDE+Composite)
@@ -1340,19 +1404,22 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
ok = WindowImpl.this.waitForSize(width, height, false, TIMEOUT_NATIVEWINDOW);
}
if(ok) {
- requestFocusInt(false /* skipFocusAction */);
- display.dispatchMessagesNative(); // status up2date
+ ok = WindowImpl.this.waitForPosition(true, x, y, TIMEOUT_NATIVEWINDOW);
+ }
+ if(ok) {
+ requestFocusInt( 0 == parentWindowHandle /* skipFocusAction if top-level */);
+ display.dispatchMessagesNative(); // status up2date
}
}
}
if(!ok || !wasVisible) {
- // make size and position persistent manual,
+ // make size and position persistent manual,
// since we don't have a WM feedback (invisible or recreation)
definePosition(x, y);
defineSize(width, height);
}
-
+
if(!ok) {
// native reparent failed -> try creation, while trying to preserve resources if becoming visible again.
if(DEBUG_IMPLEMENTATION) {
@@ -1361,10 +1428,18 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
destroy( wasVisible );
operation = ReparentOperation.ACTION_NATIVE_CREATION ;
}
+ } else {
+ // Case
+ // ACTION_NATIVE_CREATION
+ // ACTION_NATIVE_CREATION_PENDING;
+
+ // make size and position persistent for proper [re]creation
+ definePosition(x, y);
+ defineSize(width, height);
}
-
+
if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window.reparentWindow: END-1 ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight());
+ System.err.println("Window.reparent: END-1 ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight());
}
} finally {
if(null!=lifecycleHook) {
@@ -1383,25 +1458,27 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// This may run on the new Display/Screen connection, hence a new EDT task
runOnEDTIfAvail(true, reparentActionRecreate);
break;
-
+
default:
}
}
if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window.reparentWindow: END-X ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight());
+ System.err.println("Window.reparent: END-X ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight());
}
}
}
private class ReparentActionRecreate implements Runnable {
+ @Override
public final void run() {
final RecursiveLock _lock = windowLock;
_lock.lock();
try {
if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window.reparentWindow: ReparentActionRecreate ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+Display.hashCodeNullSafe(parentWindow));
+ System.err.println("Window.reparent: ReparentActionRecreate ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+Display.hashCodeNullSafe(parentWindow));
}
- setVisible(true); // native creation
+ setVisibleActionImpl(true); // native creation
+ requestFocusInt( 0 == parentWindowHandle /* skipFocusAction if top-level */);
} finally {
_lock.unlock();
}
@@ -1411,11 +1488,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
@Override
public final ReparentOperation reparentWindow(NativeWindow newParent) {
- return reparentWindow(newParent, false);
+ return reparentWindow(newParent, -1, -1, false);
}
- public ReparentOperation reparentWindow(NativeWindow newParent, boolean forceDestroyCreate) {
- final ReparentAction reparentAction = new ReparentAction(newParent, forceDestroyCreate);
+ @Override
+ public ReparentOperation reparentWindow(NativeWindow newParent, int x, int y, boolean forceDestroyCreate) {
+ final ReparentAction reparentAction = new ReparentAction(newParent, x, y, forceDestroyCreate);
runOnEDTIfAvail(true, reparentAction);
return reparentAction.getOp();
}
@@ -1444,6 +1522,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
this.undecorated = undecorated;
}
+ @Override
public final void run() {
final RecursiveLock _lock = windowLock;
_lock.lock();
@@ -1489,6 +1568,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
this.alwaysOnTop = alwaysOnTop;
}
+ @Override
public final void run() {
final RecursiveLock _lock = windowLock;
_lock.lock();
@@ -1496,7 +1576,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(WindowImpl.this.alwaysOnTop != alwaysOnTop) {
// set current state
WindowImpl.this.alwaysOnTop = alwaysOnTop;
-
+
if( isNativeValid() ) {
// Mirror pos/size so native change notification can get overwritten
final int x = getX();
@@ -1521,12 +1601,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public final void setAlwaysOnTop(boolean value) {
runOnEDTIfAvail(true, new AlwaysOnTopAction(value));
}
-
+
@Override
public final boolean isAlwaysOnTop() {
return alwaysOnTop;
}
-
+
@Override
public String getTitle() {
return title;
@@ -1554,7 +1634,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
setVal = setPointerVisibleImpl(pointerVisible);
}
if(setVal) {
- this.pointerVisible = pointerVisible;
+ this.pointerVisible = pointerVisible;
}
}
}
@@ -1562,7 +1642,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public boolean isPointerConfined() {
return pointerConfined;
}
-
+
@Override
public void confinePointer(boolean confine) {
if(this.pointerConfined != confine) {
@@ -1582,18 +1662,18 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
if(setVal) {
- this.pointerConfined = confine;
+ this.pointerConfined = confine;
}
- }
+ }
}
-
+
@Override
public void warpPointer(int x, int y) {
if(0 != getWindowHandle()) {
warpPointerImpl(x, y);
}
}
-
+
@Override
public final InsetsImmutable getInsets() {
if(isUndecorated()) {
@@ -1602,7 +1682,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
updateInsetsImpl(insets);
return insets;
}
-
+
@Override
public final int getWidth() {
return width;
@@ -1624,8 +1704,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
protected final boolean autoPosition() { return autoPosition; }
-
- /** Sets the position fields {@link #x} and {@link #y} to the given values and {@link #autoPosition} to false. */
+
+ /** Sets the position fields {@link #x} and {@link #y} to the given values and {@link #autoPosition} to false. */
protected final void definePosition(int x, int y) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("definePosition: "+this.x+"/"+this.y+" -> "+x+"/"+y);
@@ -1635,7 +1715,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
this.x = x; this.y = y;
}
- /** Sets the size fields {@link #width} and {@link #height} to the given values. */
+ /** Sets the size fields {@link #width} and {@link #height} to the given values. */
protected final void defineSize(int width, int height) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("defineSize: "+this.width+"x"+this.height+" -> "+width+"x"+height);
@@ -1643,7 +1723,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
this.width = width; this.height = height;
}
-
+
@Override
public final boolean isVisible() {
return visible;
@@ -1662,7 +1742,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public final Window getDelegatedWindow() {
return this;
}
-
+
//----------------------------------------------------------------------
// WindowImpl
//
@@ -1685,8 +1765,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
return old;
}
- /**
- * If this Window actually wraps a {@link NativeSurface} from another instance or toolkit,
+ /**
+ * If this Window actually wraps a {@link NativeSurface} from another instance or toolkit,
* it will return such reference. Otherwise returns null.
*/
public NativeSurface getWrappedSurface() {
@@ -1698,13 +1778,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
windowDestroyNotifyAction = r;
}
- /**
- * Returns the non delegated {@link AbstractGraphicsConfiguration},
+ /**
+ * Returns the non delegated {@link AbstractGraphicsConfiguration},
* see {@link #getGraphicsConfiguration()}. */
public final AbstractGraphicsConfiguration getPrivateGraphicsConfiguration() {
return config;
}
-
+
protected final long getParentWindowHandle() {
return isFullscreen() ? 0 : parentWindowHandle;
}
@@ -1738,6 +1818,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
for (int i = 0; i < mouseListeners.size(); i++ ) {
sb.append(mouseListeners.get(i)+", ");
}
+ sb.append("], PointerGestures default "+defaultGestureHandlerEnabled+", custom "+pointerGestureHandler.size()+" [");
+ for (int i = 0; i < pointerGestureHandler.size(); i++ ) {
+ sb.append(pointerGestureHandler.get(i)+", ");
+ }
sb.append("], KeyListeners num "+keyListeners.size()+" [");
for (int i = 0; i < keyListeners.size(); i++ ) {
sb.append(keyListeners.get(i)+", ");
@@ -1760,6 +1844,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
private final Runnable requestFocusAction = new Runnable() {
+ @Override
public final void run() {
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.RequestFocusAction: force 0 - ("+getThreadName()+"): "+hasFocus+" -> true - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle));
@@ -1768,6 +1853,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
};
private final Runnable requestFocusActionForced = new Runnable() {
+ @Override
public final void run() {
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.RequestFocusAction: force 1 - ("+getThreadName()+"): "+hasFocus+" -> true - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle));
@@ -1790,7 +1876,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public void requestFocus(boolean wait) {
requestFocus(wait /* wait */, false /* skipFocusAction */, brokenFocusChange /* force */);
}
-
+
private void requestFocus(boolean wait, boolean skipFocusAction, boolean force) {
if( isNativeValid() &&
( force || !hasFocus() ) &&
@@ -1798,22 +1884,22 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
runOnEDTIfAvail(wait, force ? requestFocusActionForced : requestFocusAction);
}
}
-
+
/** Internally forcing request focus on current thread */
private void requestFocusInt(boolean skipFocusAction) {
if( skipFocusAction || !focusAction() ) {
if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window.RequestFocusInt: forcing - ("+getThreadName()+"): "+hasFocus+" -> true - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle));
+ System.err.println("Window.RequestFocusInt: forcing - ("+getThreadName()+"): skipFocusAction "+skipFocusAction+", focus "+hasFocus+" -> true - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle));
}
requestFocusImpl(true);
- }
+ }
}
-
+
@Override
public void setFocusAction(FocusRunnable focusAction) {
this.focusAction = focusAction;
}
-
+
private boolean focusAction() {
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.focusAction() START - "+getThreadName()+", focusAction: "+focusAction+" - windowHandle "+toHexString(getWindowHandle()));
@@ -1829,16 +1915,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
return res;
}
-
+
protected void setBrokenFocusChange(boolean v) {
brokenFocusChange = v;
}
-
+
@Override
public void setKeyboardFocusHandler(KeyListener l) {
keyboardFocusHandler = l;
}
-
+
private class SetPositionAction implements Runnable {
int x, y;
@@ -1847,6 +1933,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
this.y = y;
}
+ @Override
public final void run() {
final RecursiveLock _lock = windowLock;
_lock.lock();
@@ -1858,7 +1945,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(isNativeValid()) {
// this.x/this.y will be set by sizeChanged, triggered by windowing event system
reconfigureWindowImpl(x, y, getWidth(), getHeight(), getReconfigureFlags(0, isVisible()));
-
+
// Wait until custom position is reached within tolerances
waitForPosition(true, x, y, Window.TIMEOUT_NATIVEWINDOW);
} else {
@@ -1876,16 +1963,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
autoPosition = false;
runOnEDTIfAvail(true, new SetPositionAction(x, y));
}
-
+
@Override
public void setTopLevelPosition(int x, int y) {
setPosition(x + getInsets().getLeftWidth(), y + getInsets().getTopHeight());
}
-
+
private class FullScreenAction implements Runnable {
boolean fullscreen;
- private boolean init(boolean fullscreen) {
+ private boolean init(boolean fullscreen) {
if(isNativeValid()) {
this.fullscreen = fullscreen;
return isFullscreen() != fullscreen;
@@ -1893,9 +1980,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
WindowImpl.this.fullscreen = fullscreen; // set current state for createNative(..)
return false;
}
- }
+ }
public boolean fsOn() { return fullscreen; }
+ @Override
public final void run() {
final RecursiveLock _lock = windowLock;
_lock.lock();
@@ -1903,8 +1991,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// set current state
WindowImpl.this.fullscreen = fullscreen;
+ final int oldX = getX();
+ final int oldY = getY();
+ final int oldWidth = getWidth();
+ final int oldHeight = getHeight();
+
int x,y,w,h;
-
+
final RectangleImmutable sviewport = screen.getViewport();
final RectangleImmutable viewport;
final int fs_span_flag;
@@ -1920,23 +2013,20 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
viewport = MonitorDevice.unionOfViewports(new Rectangle(), fullscreenMonitors);
if( isReconfigureFlagSupported(FLAG_IS_FULLSCREEN_SPAN) &&
( fullscreenMonitors.size() > 1 || sviewport.compareTo(viewport) > 0 ) ) {
- fullscreenUseSpanningMode = true;
fs_span_flag = FLAG_IS_FULLSCREEN_SPAN;
} else {
- fullscreenUseSpanningMode = false;
fs_span_flag = 0;
}
- nfs_x = getX();
- nfs_y = getY();
- nfs_width = getWidth();
- nfs_height = getHeight();
- x = viewport.getX();
+ nfs_x = oldX;
+ nfs_y = oldY;
+ nfs_width = oldWidth;
+ nfs_height = oldHeight;
+ x = viewport.getX();
y = viewport.getY();
w = viewport.getWidth();
h = viewport.getHeight();
} else {
fullscreenUseMainMonitor = true;
- fullscreenUseSpanningMode = false;
fullscreenMonitors = null;
fs_span_flag = 0;
viewport = null;
@@ -1944,12 +2034,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
y = nfs_y;
w = nfs_width;
h = nfs_height;
-
+
if(null!=parentWindow) {
// reset position to 0/0 within parent space
x = 0;
y = 0;
-
+
// refit if size is bigger than parent
if( w > parentWindow.getWidth() ) {
w = parentWindow.getWidth();
@@ -1962,16 +2052,25 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window fs: "+fullscreen+" "+x+"/"+y+" "+w+"x"+h+", "+isUndecorated()+
", virtl-screenSize: "+sviewport+", monitorsViewport "+viewport+
- ", spanning "+fullscreenUseSpanningMode+" @ "+Thread.currentThread().getName());
+ ", spanning "+(0!=fs_span_flag)+" @ "+Thread.currentThread().getName());
}
final DisplayImpl display = (DisplayImpl) screen.getDisplay();
display.dispatchMessagesNative(); // status up2date
final boolean wasVisible = isVisible();
-
+
// Lock parentWindow only during reparenting (attempt)
final NativeWindow parentWindowLocked;
if( null != parentWindow ) {
+ // fullscreen off: !visible first (fixes X11 unsuccessful return to parent window)
+ if( !fullscreen && wasVisible && NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true) ) {
+ setVisibleImpl(false, oldX, oldY, oldWidth, oldHeight);
+ WindowImpl.this.waitForVisible(false, false);
+ // FIXME: Some composite WM behave slacky .. give 'em chance to change state -> invisible,
+ // even though we do exactly that (KDE+Composite)
+ try { Thread.sleep(100); } catch (InterruptedException e) { }
+ display.dispatchMessagesNative(); // status up2date
+ }
parentWindowLocked = parentWindow;
if( NativeSurface.LOCK_SURFACE_NOT_READY >= parentWindowLocked.lockSurface() ) {
throw new NativeWindowException("Parent surface lock: not ready: "+parentWindow);
@@ -1980,23 +2079,31 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
parentWindowLocked = null;
}
try {
- reconfigureWindowImpl(x, y, w, h,
- getReconfigureFlags( ( ( null != parentWindowLocked ) ? FLAG_CHANGE_PARENTING : 0 ) |
- fs_span_flag | FLAG_CHANGE_FULLSCREEN | FLAG_CHANGE_DECORATION, wasVisible) );
+ reconfigureWindowImpl(x, y, w, h,
+ getReconfigureFlags( ( ( null != parentWindowLocked ) ? FLAG_CHANGE_PARENTING : 0 ) |
+ fs_span_flag | FLAG_CHANGE_FULLSCREEN | FLAG_CHANGE_DECORATION, isVisible()) );
} finally {
if(null!=parentWindowLocked) {
parentWindowLocked.unlockSurface();
}
}
display.dispatchMessagesNative(); // status up2date
-
+
if(wasVisible) {
setVisibleImpl(true, x, y, w, h);
- WindowImpl.this.waitForVisible(true, false);
- display.dispatchMessagesNative(); // status up2date
- WindowImpl.this.waitForSize(w, h, false, TIMEOUT_NATIVEWINDOW);
+ boolean ok = 0 <= WindowImpl.this.waitForVisible(true, false);
+ if(ok) {
+ ok = WindowImpl.this.waitForSize(w, h, false, TIMEOUT_NATIVEWINDOW);
+ }
+ if(ok && !fullscreen) {
+ ok = WindowImpl.this.waitForPosition(true, x, y, TIMEOUT_NATIVEWINDOW);
+ }
+ if(ok) {
+ requestFocusInt(fullscreen /* skipFocusAction if fullscreen */);
+ display.dispatchMessagesNative(); // status up2date
+ }
if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window fs done: " + WindowImpl.this);
+ System.err.println("Window fs done: ok " + ok + ", " + WindowImpl.this);
}
}
} finally {
@@ -2005,50 +2112,45 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); // trigger a resize/relayout and repaint to listener
}
}
- private final FullScreenAction fullScreenAction = new FullScreenAction();
+ private final FullScreenAction fullScreenAction = new FullScreenAction();
@Override
public boolean setFullscreen(boolean fullscreen) {
return setFullscreenImpl(fullscreen, true, null);
}
-
+
@Override
public boolean setFullscreen(List<MonitorDevice> monitors) {
return setFullscreenImpl(true, false, monitors);
}
-
+
private boolean setFullscreenImpl(boolean fullscreen, boolean useMainMonitor, List<MonitorDevice> monitors) {
synchronized(fullScreenAction) {
fullscreenMonitors = monitors;
fullscreenUseMainMonitor = useMainMonitor;
- fullscreenUseSpanningMode = false;
if( fullScreenAction.init(fullscreen) ) {
- if(fullScreenAction.fsOn() && isOffscreenInstance(WindowImpl.this, parentWindow)) {
+ if(fullScreenAction.fsOn() && isOffscreenInstance(WindowImpl.this, parentWindow)) {
// enable fullscreen on offscreen instance
if(null != parentWindow) {
nfs_parent = parentWindow;
- reparentWindow(null, true);
+ reparentWindow(null, -1, -1, true /* forceDestroyCreate */);
} else {
throw new InternalError("Offscreen instance w/o parent unhandled");
}
}
-
+
runOnEDTIfAvail(true, fullScreenAction);
-
+
if(!fullScreenAction.fsOn() && null != nfs_parent) {
// disable fullscreen on offscreen instance
- reparentWindow(nfs_parent, true);
+ reparentWindow(nfs_parent, -1, -1, true /* forceDestroyCreate */);
nfs_parent = null;
}
-
- if( fullscreen && isVisible() ) { // force focus on fullscreen
- requestFocus(true /* wait */, true /* skipFocusAction */, true /* force */);
- }
}
- return this.fullscreen;
+ return this.fullscreen;
}
}
-
+
private class MonitorModeListenerImpl implements MonitorModeListener {
boolean animatorPaused = false;
boolean hadFocus = false;
@@ -2056,6 +2158,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
List<MonitorDevice> _fullscreenMonitors = null;
boolean _fullscreenUseMainMonitor = true;
+ @Override
public void monitorModeChangeNotify(MonitorEvent me) {
hadFocus = hasFocus();
if(DEBUG_IMPLEMENTATION) {
@@ -2076,6 +2179,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
+ @Override
public void monitorModeChanged(MonitorEvent me, boolean success) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.monitorModeChanged: hadFocus "+hadFocus+", "+me+", success: "+success+" @ "+Thread.currentThread().getName());
@@ -2136,10 +2240,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private final MonitorModeListenerImpl monitorModeListenerImpl = new MonitorModeListenerImpl();
-
//----------------------------------------------------------------------
// Child Window Management
- //
+ //
@Override
public final boolean removeChild(NativeWindow win) {
@@ -2182,7 +2285,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
@Override
- public boolean consumeEvent(NEWTEvent e) {
+ public final boolean consumeEvent(NEWTEvent e) {
switch(e.getEventType()) {
// special repaint treatment
case WindowEvent.EVENT_WINDOW_REPAINT:
@@ -2195,7 +2298,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.consumeEvent: REPAINT "+Thread.currentThread().getName()+" - queued "+e+", discard-to "+discardTO);
// Thread.dumpStack();
- }
+ }
return discardTO; // discardTO:=true -> consumed
}
return true;
@@ -2223,7 +2326,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
} else if(e instanceof KeyEvent) {
consumeKeyEvent((KeyEvent)e);
} else if(e instanceof MouseEvent) {
- consumeMouseEvent((MouseEvent)e);
+ consumePointerEvent((MouseEvent)e);
} else {
throw new NativeWindowException("Unexpected NEWTEvent type " + e);
}
@@ -2256,17 +2359,22 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
//
// MouseListener/Event Support
//
+
+ //
+ // Native MouseEvents pre-processed to be enqueued or consumed directly
+ //
+
public final void sendMouseEvent(short eventType, int modifiers,
int x, int y, short button, float rotation) {
- doMouseEvent(false, false, eventType, modifiers, x, y, button, rotation);
+ doMouseEvent(false, false, eventType, modifiers, x, y, button, MouseEvent.getRotationXYZ(rotation, modifiers), 1f);
}
public final void enqueueMouseEvent(boolean wait, short eventType, int modifiers,
int x, int y, short button, float rotation) {
- doMouseEvent(true, wait, eventType, modifiers, x, y, button, rotation);
+ doMouseEvent(true, wait, eventType, modifiers, x, y, button, MouseEvent.getRotationXYZ(rotation, modifiers), 1f);
}
protected final void doMouseEvent(boolean enqueue, boolean wait, short eventType, int modifiers,
int x, int y, short button, float rotation) {
- this.doMouseEvent(enqueue, wait, eventType, modifiers, x, y, button, MouseEvent.getRotationXYZ(rotation, modifiers), 1f);
+ doMouseEvent(enqueue, wait, eventType, modifiers, x, y, button, MouseEvent.getRotationXYZ(rotation, modifiers), 1f);
}
/**
public final void sendMouseEvent(short eventType, int modifiers,
@@ -2277,59 +2385,219 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
int x, int y, short button, float[] rotationXYZ, float rotationScale) {
doMouseEvent(true, wait, eventType, modifiers, x, y, button, rotationXYZ, rotationScale);
} */
+
+ /**
+ * Send mouse event (one-pointer) either to be directly consumed or to be enqueued
+ *
+ * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued},
+ * otherwise {@link #consumeEvent(NEWTEvent) consumed} directly.
+ * @param wait if true wait until {@link #consumeEvent(NEWTEvent) consumed}.
+ */
protected void doMouseEvent(boolean enqueue, boolean wait, short eventType, int modifiers,
- int x, int y, short button, float[] rotationXYZ, float rotationScale) {
- if( eventType == MouseEvent.EVENT_MOUSE_ENTERED || eventType == MouseEvent.EVENT_MOUSE_EXITED ) {
- if( eventType == MouseEvent.EVENT_MOUSE_EXITED && x==-1 && y==-1 ) {
- x = lastMousePosition.getX();
- y = lastMousePosition.getY();
- }
- // clip coordinates to window dimension
- x = Math.min(Math.max(x, 0), getWidth()-1);
- y = Math.min(Math.max(y, 0), getHeight()-1);
- mouseInWindow = eventType == MouseEvent.EVENT_MOUSE_ENTERED;
- // clear states
- lastMousePressed = 0;
- lastMouseClickCount = (short)0;
- mouseButtonPressed = 0;
- mouseButtonModMask = 0;
- }
- if( x < 0 || y < 0 || x >= getWidth() || y >= getHeight() ) {
- return; // .. invalid ..
+ int x, int y, short button, final float[] rotationXYZ, float rotationScale) {
+ if( 0 > button || button > MouseEvent.BUTTON_COUNT ) {
+ throw new NativeWindowException("Invalid mouse button number" + button);
}
- if(DEBUG_MOUSE_EVENT) {
- System.err.println("doMouseEvent: enqueue "+enqueue+", wait "+wait+", "+MouseEvent.getEventTypeString(eventType)+
- ", mod "+modifiers+", pos "+x+"/"+y+", button "+button+", lastMousePosition: "+lastMousePosition);
+ doPointerEvent(enqueue, wait, constMousePointerTypes, eventType, modifiers,
+ 0 /*actionIdx*/, new short[] { (short)(button-1) },
+ new int[]{x}, new int[]{y}, new float[]{0f} /*pressure*/,
+ 1f /*maxPressure*/, rotationXYZ, rotationScale);
+ }
+
+ /**
+ * Send multiple-pointer event either to be directly consumed or to be enqueued
+ * <p>
+ * The index for the element of multiple-pointer arrays represents the pointer which triggered the event
+ * is passed via <i>actionIdx</i>.
+ * </p>
+ * <p>
+ * The given pointer names, <code>pNames</code>, are mapped to consecutive pointer IDs starting w/ 0
+ * using a hash-map if <code>normalPNames</code> is <code>false</code>.
+ * Otherwise a simple <code>int</code> to <code>short</code> type cast is performed.
+ * </p>
+ *
+ * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued},
+ * otherwise {@link #consumeEvent(NEWTEvent) consumed} directly.
+ * @param wait if true wait until {@link #consumeEvent(NEWTEvent) consumed}.
+ * @param pTypes {@link MouseEvent.PointerType} for each pointer (multiple pointer)
+ * @param eventType
+ * @param modifiers
+ * @param actionIdx index of multiple-pointer arrays representing the pointer which triggered the event
+ * @param normalPNames see pName below.
+ * @param pNames Pointer name for each pointer (multiple pointer).
+ * We assume consecutive pointer names starting w/ 0 if <code>normalPIDs</code> is <code>true</code>.
+ * Otherwise we hash-map the values during state pressed to retrieve the normal ID.
+ * @param pX X-axis for each pointer (multiple pointer)
+ * @param pY Y-axis for each pointer (multiple pointer)
+ * @param pPressure Pressure for each pointer (multiple pointer)
+ * @param maxPressure Maximum pointer pressure for all pointer
+ */
+ public final void doPointerEvent(boolean enqueue, boolean wait,
+ final PointerType[] pTypes, short eventType, int modifiers,
+ int actionIdx, boolean normalPNames, final int[] pNames,
+ final int[] pX, final int[] pY, float[] pPressure,
+ float maxPressure, final float[] rotationXYZ, final float rotationScale) {
+ final int pCount = pNames.length;
+ final short[] pIDs = new short[pCount];
+ for(int i=0; i<pCount; i++) {
+ if( !normalPNames ) {
+ // hash map int name -> short idx
+ final int sz0 = pName2pID.size();
+ final Integer pNameI1 = pName2pID.getOrAdd(Integer.valueOf(pNames[i]));
+ final short pID = (short)pName2pID.indexOf(pNameI1);
+ pIDs[i] = pID;
+ if(DEBUG_MOUSE_EVENT) {
+ final int sz1 = pName2pID.size();
+ if( sz0 != sz1 ) {
+ System.err.println("PointerName2ID[sz "+sz1+"]: Map "+pNameI1+" == "+pID);
+ }
+ }
+ if( MouseEvent.EVENT_MOUSE_RELEASED == eventType ) {
+ pName2pID.remove(pNameI1);
+ if(DEBUG_MOUSE_EVENT) {
+ System.err.println("PointerName2ID[sz "+pName2pID.size()+"]: Unmap "+pNameI1+" == "+pID);
+ }
+ }
+ } else {
+ // simple type cast
+ pIDs[i] = (short)pNames[i];
+ }
}
+ doPointerEvent(enqueue, wait, pTypes, eventType, modifiers, actionIdx, pIDs,
+ pX, pY, pPressure, maxPressure, rotationXYZ, rotationScale);
+ }
+
+ /**
+ * Send multiple-pointer event either to be directly consumed or to be enqueued
+ * <p>
+ * The index for the element of multiple-pointer arrays represents the pointer which triggered the event
+ * is passed via <i>actionIdx</i>.
+ * </p>
+ *
+ * @param enqueue if true, event will be {@link #enqueueEvent(boolean, NEWTEvent) enqueued},
+ * otherwise {@link #consumeEvent(NEWTEvent) consumed} directly.
+ * @param wait if true wait until {@link #consumeEvent(NEWTEvent) consumed}.
+ * @param pTypes {@link MouseEvent.PointerType} for each pointer (multiple pointer)
+ * @param eventType
+ * @param modifiers
+ * @param pActionIdx index of multiple-pointer arrays representing the pointer which triggered the event
+ * @param pID Pointer ID for each pointer (multiple pointer). We assume consecutive pointerIDs starting w/ 0.
+ * A pointer-ID of -1 may also denote no pointer/button activity, i.e. {@link PointerType#Mouse} move.
+ * @param pX X-axis for each pointer (multiple pointer)
+ * @param pY Y-axis for each pointer (multiple pointer)
+ * @param pPressure Pressure for each pointer (multiple pointer)
+ * @param maxPressure Maximum pointer pressure for all pointer
+ */
+ public final void doPointerEvent(boolean enqueue, boolean wait,
+ final PointerType[] pTypes, short eventType, int modifiers,
+ int pActionIdx, final short[] pID, final int[] pX, final int[] pY, final float[] pPressure,
+ float maxPressure, final float[] rotationXYZ, float rotationScale) {
final long when = System.currentTimeMillis();
- MouseEvent eEntered = null;
- if(eventType == MouseEvent.EVENT_MOUSE_MOVED) {
- if(!mouseInWindow) {
- mouseInWindow = true;
- eEntered = new MouseEvent(MouseEvent.EVENT_MOUSE_ENTERED, this, when,
- modifiers, x, y, (short)0, (short)0, rotationXYZ, rotationScale);
- // clear states
- lastMousePressed = 0;
- lastMouseClickCount = (short)0;
- mouseButtonPressed = 0;
- mouseButtonModMask = 0;
- } else if( lastMousePosition.getX() == x && lastMousePosition.getY()==y ) {
- if(DEBUG_MOUSE_EVENT) {
- System.err.println("doMouseEvent: skip EVENT_MOUSE_MOVED w/ same position: "+lastMousePosition);
+ final int pCount = pTypes.length;
+
+ if( 0 > pActionIdx || pActionIdx >= pCount) {
+ throw new IllegalArgumentException("actionIdx out of bounds [0.."+(pCount-1)+"]");
+ }
+ if( 0 < pActionIdx ) {
+ // swap values to make idx 0 the triggering pointer
+ {
+ final PointerType aType = pTypes[pActionIdx];
+ pTypes[pActionIdx] = pTypes[0];
+ pTypes[0] = aType;
+ }
+ {
+ final short s = pID[pActionIdx];
+ pID[pActionIdx] = pID[0];
+ pID[0] = s;
+ }
+ {
+ int s = pX[pActionIdx];
+ pX[pActionIdx] = pX[0];
+ pX[0] = s;
+ s = pY[pActionIdx];
+ pY[pActionIdx] = pY[0];
+ pY[0] = s;
+ }
+ {
+ final float aPress = pPressure[pActionIdx];
+ pPressure[pActionIdx] = pPressure[0];
+ pPressure[0] = aPress;
+ }
+ }
+ final short id = pID[0];
+ final short button;
+ {
+ final int b = id + 1;
+ if( 0 <= b && b <= com.jogamp.newt.event.MouseEvent.BUTTON_COUNT ) { // we allow id==-1 -> button==0 for no button, i.e. mouse move
+ button = (short)b;
+ } else {
+ button = com.jogamp.newt.event.MouseEvent.BUTTON1;
+ }
+ }
+
+ //
+ // - Determine ENTERED/EXITED state
+ // - Remove redundant move/drag events
+ // - Reset states if applicable
+ //
+ int x = pX[0];
+ int y = pY[0];
+ final Point movePositionP0 = pState1.getMovePosition(id);
+ switch( eventType ) {
+ case MouseEvent.EVENT_MOUSE_EXITED:
+ if( null != movePositionP0 ) {
+ if( x==-1 && y==-1 ) {
+ x = movePositionP0.getX();
+ y = movePositionP0.getY();
+ }
+ movePositionP0.set(0, 0);
+ }
+ // Fall through intended!
+
+ case MouseEvent.EVENT_MOUSE_ENTERED:
+ // clip coordinates to window dimension
+ x = Math.min(Math.max(x, 0), getWidth()-1);
+ y = Math.min(Math.max(y, 0), getHeight()-1);
+ pState1.insideWindow = eventType == MouseEvent.EVENT_MOUSE_ENTERED;
+ pState1.clearButton();
+ break;
+
+ case MouseEvent.EVENT_MOUSE_MOVED:
+ case MouseEvent.EVENT_MOUSE_DRAGGED:
+ if( null != movePositionP0 ) {
+ if( pState1.insideWindow && movePositionP0.getX() == x && movePositionP0.getY() == y ) {
+ if(DEBUG_MOUSE_EVENT) {
+ System.err.println("doPointerEvent: skip "+MouseEvent.getEventTypeString(eventType)+" w/ same position: "+movePositionP0);
+ }
+ return; // skip same position
+ }
+ movePositionP0.set(x, y);
+ }
+
+ // Fall through intended !
+
+ default:
+ if(!pState1.insideWindow) {
+ pState1.insideWindow = true;
+ pState1.clearButton();
}
- return; // skip same position
+ }
+
+ if( x < 0 || y < 0 || x >= getWidth() || y >= getHeight() ) {
+ if(DEBUG_MOUSE_EVENT) {
+ System.err.println("doPointerEvent: drop: "+MouseEvent.getEventTypeString(eventType)+
+ ", mod "+modifiers+", pos "+x+"/"+y+", button "+button+", lastMousePosition: "+movePositionP0);
}
- lastMousePosition.setX(x);
- lastMousePosition.setY(y);
+ return; // .. invalid ..
}
- if( 0 > button || button > MouseEvent.BUTTON_NUMBER ) {
- throw new NativeWindowException("Invalid mouse button number" + button);
+ if(DEBUG_MOUSE_EVENT) {
+ System.err.println("doPointerEvent: enqueue "+enqueue+", wait "+wait+", "+MouseEvent.getEventTypeString(eventType)+
+ ", mod "+modifiers+", pos "+x+"/"+y+", button "+button+", lastMousePosition: "+movePositionP0);
}
- modifiers |= InputEvent.getButtonMask(button); // Always add current button to modifier mask (Bug 571)
- modifiers |= mouseButtonModMask; // Always add currently pressed mouse buttons to modifier mask
- MouseEvent eClicked = null;
- MouseEvent e = null;
+ final int buttonMask = InputEvent.getButtonMask(button);
+ modifiers |= buttonMask; // Always add current button to modifier mask (Bug 571)
+ modifiers |= pState1.buttonPressedMask; // Always add currently pressed mouse buttons to modifier mask
if( isPointerConfined() ) {
modifiers |= InputEvent.CONFINED_MASK;
@@ -2337,79 +2605,102 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if( !isPointerVisible() ) {
modifiers |= InputEvent.INVISIBLE_MASK;
}
-
- if( MouseEvent.EVENT_MOUSE_PRESSED == eventType ) {
- if( when - lastMousePressed < MouseEvent.getClickTimeout() ) {
- lastMouseClickCount++;
- } else {
- lastMouseClickCount=(short)1;
- }
- lastMousePressed = when;
- mouseButtonPressed = button;
- mouseButtonModMask |= MouseEvent.getButtonMask(button);
- e = new MouseEvent(eventType, this, when,
- modifiers, x, y, lastMouseClickCount, button, rotationXYZ, rotationScale);
- } else if( MouseEvent.EVENT_MOUSE_RELEASED == eventType ) {
- e = new MouseEvent(eventType, this, when,
- modifiers, x, y, lastMouseClickCount, button, rotationXYZ, rotationScale);
- if( when - lastMousePressed < MouseEvent.getClickTimeout() ) {
- eClicked = new MouseEvent(MouseEvent.EVENT_MOUSE_CLICKED, this, when,
- modifiers, x, y, lastMouseClickCount, button, rotationXYZ, rotationScale);
- } else {
- lastMouseClickCount = (short)0;
- lastMousePressed = 0;
- }
- mouseButtonPressed = 0;
- mouseButtonModMask &= ~MouseEvent.getButtonMask(button);
- } else if( MouseEvent.EVENT_MOUSE_MOVED == eventType ) {
- if ( mouseButtonPressed > 0 ) {
- e = new MouseEvent(MouseEvent.EVENT_MOUSE_DRAGGED, this, when,
- modifiers, x, y, (short)1, mouseButtonPressed, rotationXYZ, rotationScale);
- } else {
- e = new MouseEvent(eventType, this, when,
- modifiers, x, y, (short)0, button, rotationXYZ, rotationScale);
- }
- } else if( MouseEvent.EVENT_MOUSE_WHEEL_MOVED == eventType ) {
- e = new MouseEvent(eventType, this, when, modifiers, x, y, (short)0, button, rotationXYZ, rotationScale);
- } else {
- e = new MouseEvent(eventType, this, when, modifiers, x, y, (short)0, button, rotationXYZ, rotationScale);
- }
- if( null != eEntered ) {
- if(DEBUG_MOUSE_EVENT) {
- System.err.println("doMouseEvent: synthesized MOUSE_ENTERED event: "+eEntered);
- }
- doEvent(enqueue, wait, eEntered);
+
+ pX[0] = x;
+ pY[0] = y;
+
+ //
+ // - Determine CLICK COUNT
+ // - Ignore sent CLICKED
+ // - Track buttonPressed incl. buttonPressedMask
+ // - Fix MOVED/DRAGGED event
+ //
+ final MouseEvent e;
+ switch( eventType ) {
+ case MouseEvent.EVENT_MOUSE_CLICKED:
+ e = null;
+ break;
+
+ case MouseEvent.EVENT_MOUSE_PRESSED:
+ if( 0 >= pPressure[0] ) {
+ pPressure[0] = maxPressure;
+ }
+ pState1.buttonPressedMask |= buttonMask;
+ if( 1 == pCount ) {
+ if( when - pState1.lastButtonPressTime < MouseEvent.getClickTimeout() ) {
+ pState1.lastButtonClickCount++;
+ } else {
+ pState1.lastButtonClickCount=(short)1;
+ }
+ pState1.lastButtonPressTime = when;
+ pState1.buttonPressed = button;
+ e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
+ pX, pY, pPressure, maxPressure, button, pState1.lastButtonClickCount, rotationXYZ, rotationScale);
+ } else {
+ e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
+ pX, pY, pPressure, maxPressure, button, (short)1, rotationXYZ, rotationScale);
+ }
+ break;
+ case MouseEvent.EVENT_MOUSE_RELEASED:
+ if( 1 == pCount ) {
+ e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
+ pX, pY, pPressure, maxPressure, button, pState1.lastButtonClickCount, rotationXYZ, rotationScale);
+ if( when - pState1.lastButtonPressTime >= MouseEvent.getClickTimeout() ) {
+ pState1.lastButtonClickCount = (short)0;
+ pState1.lastButtonPressTime = 0;
+ }
+ pState1.buttonPressed = 0;
+ } else {
+ e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
+ pX, pY, pPressure, maxPressure, button, (short)1, rotationXYZ, rotationScale);
+ }
+ pState1.buttonPressedMask &= ~buttonMask;
+ if( null != movePositionP0 ) {
+ movePositionP0.set(0, 0);
+ }
+ break;
+ case MouseEvent.EVENT_MOUSE_MOVED:
+ if ( 0 != pState1.buttonPressedMask ) { // any button or pointer move -> drag
+ e = new MouseEvent(MouseEvent.EVENT_MOUSE_DRAGGED, this, when, modifiers, pTypes, pID,
+ pX, pY, pPressure, maxPressure, pState1.buttonPressed, (short)1, rotationXYZ, rotationScale);
+ } else {
+ e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
+ pX, pY, pPressure, maxPressure, button, (short)0, rotationXYZ, rotationScale);
+ }
+ break;
+ case MouseEvent.EVENT_MOUSE_DRAGGED:
+ if( 0 >= pPressure[0] ) {
+ pPressure[0] = maxPressure;
+ }
+ // Fall through intended!
+ default:
+ e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID,
+ pX, pY, pPressure, maxPressure, button, (short)0, rotationXYZ, rotationScale);
}
doEvent(enqueue, wait, e); // actual mouse event
- if( null != eClicked ) {
- if(DEBUG_MOUSE_EVENT) {
- System.err.println("doMouseEvent: synthesized MOUSE_CLICKED event: "+eClicked);
- }
- doEvent(enqueue, wait, eClicked);
- }
}
@Override
- public void addMouseListener(MouseListener l) {
+ public final void addMouseListener(MouseListener l) {
addMouseListener(-1, l);
}
@Override
- public void addMouseListener(int index, MouseListener l) {
+ public final void addMouseListener(int index, MouseListener l) {
if(l == null) {
return;
}
@SuppressWarnings("unchecked")
ArrayList<MouseListener> clonedListeners = (ArrayList<MouseListener>) mouseListeners.clone();
- if(0>index) {
- index = clonedListeners.size();
+ if(0>index) {
+ index = clonedListeners.size();
}
clonedListeners.add(index, l);
mouseListeners = clonedListeners;
}
@Override
- public void removeMouseListener(MouseListener l) {
+ public final void removeMouseListener(MouseListener l) {
if (l == null) {
return;
}
@@ -2420,24 +2711,262 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
@Override
- public MouseListener getMouseListener(int index) {
+ public final MouseListener getMouseListener(int index) {
@SuppressWarnings("unchecked")
ArrayList<MouseListener> clonedListeners = (ArrayList<MouseListener>) mouseListeners.clone();
- if(0>index) {
- index = clonedListeners.size()-1;
+ if(0>index) {
+ index = clonedListeners.size()-1;
}
return clonedListeners.get(index);
}
@Override
- public MouseListener[] getMouseListeners() {
+ public final MouseListener[] getMouseListeners() {
return mouseListeners.toArray(new MouseListener[mouseListeners.size()]);
}
- protected void consumeMouseEvent(MouseEvent e) {
+ @Override
+ public final void setDefaultGesturesEnabled(boolean enable) {
+ defaultGestureHandlerEnabled = enable;
+ }
+ @Override
+ public final boolean areDefaultGesturesEnabled() {
+ return defaultGestureHandlerEnabled;
+ }
+
+ @Override
+ public final void addGestureHandler(GestureHandler gh) {
+ addGestureHandler(-1, gh);
+ }
+ @Override
+ public final void addGestureHandler(int index, GestureHandler gh) {
+ if(gh == null) {
+ return;
+ }
+ @SuppressWarnings("unchecked")
+ ArrayList<GestureHandler> cloned = (ArrayList<GestureHandler>) pointerGestureHandler.clone();
+ if(0>index) {
+ index = cloned.size();
+ }
+ cloned.add(index, gh);
+ pointerGestureHandler = cloned;
+ }
+ @Override
+ public final void removeGestureHandler(GestureHandler gh) {
+ if (gh == null) {
+ return;
+ }
+ @SuppressWarnings("unchecked")
+ ArrayList<GestureHandler> cloned = (ArrayList<GestureHandler>) pointerGestureHandler.clone();
+ cloned.remove(gh);
+ pointerGestureHandler = cloned;
+ }
+ @Override
+ public final void addGestureListener(GestureHandler.GestureListener gl) {
+ addGestureListener(-1, gl);
+ }
+ @Override
+ public final void addGestureListener(int index, GestureHandler.GestureListener gl) {
+ if(gl == null) {
+ return;
+ }
+ @SuppressWarnings("unchecked")
+ ArrayList<GestureHandler.GestureListener> cloned = (ArrayList<GestureHandler.GestureListener>) gestureListeners.clone();
+ if(0>index) {
+ index = cloned.size();
+ }
+ cloned.add(index, gl);
+ gestureListeners = cloned;
+ }
+ @Override
+ public final void removeGestureListener(GestureHandler.GestureListener gl) {
+ if (gl == null) {
+ return;
+ }
+ @SuppressWarnings("unchecked")
+ ArrayList<GestureHandler.GestureListener> cloned = (ArrayList<GestureHandler.GestureListener>) gestureListeners.clone();
+ cloned.remove(gl);
+ gestureListeners= cloned;
+ }
+
+ private static int step(int lower, int edge, int value) {
+ return value < edge ? lower : value;
+ }
+
+ /**
+ * Consume the {@link MouseEvent}, i.e.
+ * <pre>
+ * - validate
+ * - handle gestures
+ * - synthesize events if applicable (like gestures)
+ * - dispatch event to listener
+ * </pre>
+ */
+ protected void consumePointerEvent(MouseEvent pe) {
+ int x = pe.getX();
+ int y = pe.getY();
+
if(DEBUG_MOUSE_EVENT) {
- System.err.println("consumeMouseEvent: event: "+e);
+ System.err.println("consumePointerEvent.in: "+pe);
+ }
+
+ //
+ // - Determine ENTERED/EXITED state
+ // - Synthesize ENTERED event
+ // - Reset states if applicable
+ //
+ final long when = pe.getWhen();
+ int eventType = pe.getEventType();
+ final MouseEvent eEntered;
+ switch( eventType ) {
+ case MouseEvent.EVENT_MOUSE_EXITED:
+ case MouseEvent.EVENT_MOUSE_ENTERED:
+ // clip coordinates to window dimension
+ x = Math.min(Math.max(x, 0), getWidth()-1);
+ y = Math.min(Math.max(y, 0), getHeight()-1);
+ pState0.insideWindow = eventType == MouseEvent.EVENT_MOUSE_ENTERED;
+ pState0.clearButton();
+ eEntered = null;
+ break;
+
+ default:
+ if(!pState0.insideWindow) {
+ pState0.insideWindow = true;
+ pState0.clearButton();
+ eEntered = pe.createVariant(MouseEvent.EVENT_MOUSE_ENTERED);
+ } else {
+ eEntered = null;
+ }
+ }
+ if( null != eEntered ) {
+ if(DEBUG_MOUSE_EVENT) {
+ System.err.println("consumePointerEvent.send.0: "+eEntered);
+ }
+ dispatchMouseEvent(eEntered);
+ } else if( x < 0 || y < 0 || x >= getWidth() || y >= getHeight() ) {
+ if(DEBUG_MOUSE_EVENT) {
+ System.err.println("consumePointerEvent.drop: "+pe);
+ }
+ return; // .. invalid ..
+ }
+
+ //
+ // Handle Default Gestures
+ //
+ if( defaultGestureHandlerEnabled &&
+ pe.getPointerType(0).getPointerClass() == MouseEvent.PointerClass.Onscreen )
+ {
+ if( null == gesture2PtrTouchScroll ) {
+ final int scaledScrollSlop;
+ final int scaledDoubleTapSlop;
+ final MonitorDevice monitor = getMainMonitor();
+ if ( null != monitor ) {
+ final DimensionImmutable mm = monitor.getSizeMM();
+ final float pixWPerMM = (float)monitor.getCurrentMode().getRotatedWidth() / (float)mm.getWidth();
+ final float pixHPerMM = (float)monitor.getCurrentMode().getRotatedHeight() / (float)mm.getHeight();
+ final float pixPerMM = Math.min(pixHPerMM, pixWPerMM);
+ scaledScrollSlop = Math.round(DoubleTapScrollGesture.SCROLL_SLOP_MM * pixPerMM);
+ scaledDoubleTapSlop = Math.round(DoubleTapScrollGesture.DOUBLE_TAP_SLOP_MM * pixPerMM);
+ if(DEBUG_MOUSE_EVENT) {
+ System.err.println("consumePointerEvent.gscroll: scrollSlop "+scaledScrollSlop+", doubleTapSlop "+scaledDoubleTapSlop+", pixPerMM "+pixPerMM+", "+monitor);
+ }
+ } else {
+ scaledScrollSlop = DoubleTapScrollGesture.SCROLL_SLOP_PIXEL;
+ scaledDoubleTapSlop = DoubleTapScrollGesture.DOUBLE_TAP_SLOP_PIXEL;
+ }
+ gesture2PtrTouchScroll = new DoubleTapScrollGesture(step(DoubleTapScrollGesture.SCROLL_SLOP_PIXEL, DoubleTapScrollGesture.SCROLL_SLOP_PIXEL/2, scaledScrollSlop),
+ step(DoubleTapScrollGesture.DOUBLE_TAP_SLOP_PIXEL, DoubleTapScrollGesture.DOUBLE_TAP_SLOP_PIXEL/2, scaledDoubleTapSlop));
+ }
+ if( gesture2PtrTouchScroll.process(pe) ) {
+ pe = (MouseEvent) gesture2PtrTouchScroll.getGestureEvent();
+ gesture2PtrTouchScroll.clear(false);
+ if(DEBUG_MOUSE_EVENT) {
+ System.err.println("consumePointerEvent.gscroll: "+pe);
+ }
+ dispatchMouseEvent(pe);
+ return;
+ }
+ if( gesture2PtrTouchScroll.isWithinGesture() ) {
+ return; // within gesture .. need more input ..
+ }
+ }
+ //
+ // Handle Custom Gestures
+ //
+ {
+ final int pointerGestureHandlerCount = pointerGestureHandler.size();
+ if( pointerGestureHandlerCount > 0 ) {
+ boolean withinGesture = false;
+ for(int i = 0; !pe.isConsumed() && i < pointerGestureHandlerCount; i++ ) {
+ final GestureHandler gh = pointerGestureHandler.get(i);
+ if( gh.process(pe) ) {
+ final InputEvent ieG = gh.getGestureEvent();
+ gh.clear(false);
+ if( ieG instanceof MouseEvent ) {
+ dispatchMouseEvent((MouseEvent)ieG);
+ } else if( ieG instanceof GestureHandler.GestureEvent) {
+ final GestureHandler.GestureEvent ge = (GestureHandler.GestureEvent) ieG;
+ for(int j = 0; !ge.isConsumed() && j < gestureListeners.size(); j++ ) {
+ gestureListeners.get(j).gestureDetected(ge);
+ }
+ }
+ return;
+ }
+ withinGesture |= gh.isWithinGesture();
+ }
+ if( withinGesture ) {
+ return;
+ }
+ }
+ }
+
+ //
+ // - Synthesize mouse CLICKED
+ // - Ignore sent CLICKED
+ //
+ final MouseEvent eClicked;
+ switch( eventType ) {
+ case MouseEvent.EVENT_MOUSE_PRESSED:
+ if( 1 == pe.getPointerCount() ) {
+ pState0.lastButtonPressTime = when;
+ }
+ eClicked = null;
+ break;
+ case MouseEvent.EVENT_MOUSE_RELEASED:
+ if( 1 == pe.getPointerCount() && when - pState0.lastButtonPressTime < MouseEvent.getClickTimeout() ) {
+ eClicked = pe.createVariant(MouseEvent.EVENT_MOUSE_CLICKED);
+ } else {
+ eClicked = null;
+ pState0.lastButtonPressTime = 0;
+ }
+ break;
+ case MouseEvent.EVENT_MOUSE_CLICKED:
+ // ignore - synthesized here ..
+ if(DEBUG_MOUSE_EVENT) {
+ System.err.println("consumePointerEvent: drop recv'ed (synth here) "+pe);
+ }
+ pe = null;
+ eClicked = null;
+ break;
+ default:
+ eClicked = null;
}
+
+ if( null != pe ) {
+ if(DEBUG_MOUSE_EVENT) {
+ System.err.println("consumePointerEvent.send.1: "+pe);
+ }
+ dispatchMouseEvent(pe); // actual mouse event
+ }
+ if( null != eClicked ) {
+ if(DEBUG_MOUSE_EVENT) {
+ System.err.println("consumePointerEvent.send.2: "+eClicked);
+ }
+ dispatchMouseEvent(eClicked);
+ }
+ }
+
+ private final void dispatchMouseEvent(MouseEvent e) {
for(int i = 0; !e.isConsumed() && i < mouseListeners.size(); i++ ) {
MouseListener l = mouseListeners.get(i);
switch(e.getEventType()) {
@@ -2476,15 +3005,15 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
//
private static final int keyTrackingRange = 255;
private final IntBitfield keyPressedState = new IntBitfield( keyTrackingRange + 1 );
-
+
protected final boolean isKeyCodeTracked(final short keyCode) {
return ( 0xFFFF & (int)keyCode ) <= keyTrackingRange;
}
-
+
/**
* @param keyCode the keyCode to set pressed state
* @param pressed true if pressed, otherwise false
- * @return the previus pressed value
+ * @return the previus pressed value
*/
protected final boolean setKeyPressed(short keyCode, boolean pressed) {
final int v = 0xFFFF & (int)keyCode;
@@ -2495,7 +3024,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
/**
* @param keyCode the keyCode to test pressed state
- * @return true if pressed, otherwise false
+ * @return true if pressed, otherwise false
*/
protected final boolean isKeyPressed(short keyCode) {
final int v = 0xFFFF & (int)keyCode;
@@ -2504,22 +3033,22 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
return false;
}
-
+
public void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
// Always add currently pressed mouse buttons to modifier mask
- consumeKeyEvent( KeyEvent.create(eventType, this, System.currentTimeMillis(), modifiers | mouseButtonModMask, keyCode, keySym, keyChar) );
+ consumeKeyEvent( KeyEvent.create(eventType, this, System.currentTimeMillis(), modifiers | pState1.buttonPressedMask, keyCode, keySym, keyChar) );
}
public void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
// Always add currently pressed mouse buttons to modifier mask
- enqueueEvent(wait, KeyEvent.create(eventType, this, System.currentTimeMillis(), modifiers | mouseButtonModMask, keyCode, keySym, keyChar) );
+ enqueueEvent(wait, KeyEvent.create(eventType, this, System.currentTimeMillis(), modifiers | pState1.buttonPressedMask, keyCode, keySym, keyChar) );
}
-
+
@Override
public final void setKeyboardVisible(boolean visible) {
if(isNativeValid()) {
// We don't skip the impl. if it seems that there is no state change,
- // since we cannot assume the impl. reliably gives us it's current state.
+ // since we cannot assume the impl. reliably gives us it's current state.
final boolean ok = setKeyboardVisibleImpl(visible);
if(DEBUG_IMPLEMENTATION || DEBUG_KEY_EVENT) {
System.err.println("setKeyboardVisible(native): visible "+keyboardVisible+" -- op[visible:"+visible +", ok "+ok+"] -> "+(visible && ok));
@@ -2533,13 +3062,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public final boolean isKeyboardVisible() {
return keyboardVisible;
}
- /**
+ /**
* Returns <code>true</code> if operation was successful, otherwise <code>false</code>.
* <p>
* We assume that a failed invisible operation is due to an already invisible keyboard,
- * hence even if an invisible operation failed, the keyboard is considered invisible!
- * </p>
- */
+ * hence even if an invisible operation failed, the keyboard is considered invisible!
+ * </p>
+ */
protected boolean setKeyboardVisibleImpl(boolean visible) {
return false; // nop
}
@@ -2553,7 +3082,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
protected boolean keyboardVisible = false;
-
+
@Override
public void addKeyListener(KeyListener l) {
addKeyListener(-1, l);
@@ -2566,7 +3095,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
@SuppressWarnings("unchecked")
ArrayList<KeyListener> clonedListeners = (ArrayList<KeyListener>) keyListeners.clone();
- if(0>index) {
+ if(0>index) {
index = clonedListeners.size();
}
clonedListeners.add(index, l);
@@ -2588,7 +3117,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public KeyListener getKeyListener(int index) {
@SuppressWarnings("unchecked")
ArrayList<KeyListener> clonedListeners = (ArrayList<KeyListener>) keyListeners.clone();
- if(0>index) {
+ if(0>index) {
index = clonedListeners.size()-1;
}
return clonedListeners.get(index);
@@ -2612,7 +3141,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
return e.isConsumed();
}
-
+
protected void consumeKeyEvent(KeyEvent e) {
boolean consumedE = false;
if( null != keyboardFocusHandler && !e.isAutoRepeat() ) {
@@ -2651,7 +3180,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
@Override
- public void addWindowListener(int index, WindowListener l)
+ public void addWindowListener(int index, WindowListener l)
throws IndexOutOfBoundsException
{
if(l == null) {
@@ -2659,8 +3188,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
@SuppressWarnings("unchecked")
ArrayList<WindowListener> clonedListeners = (ArrayList<WindowListener>) windowListeners.clone();
- if(0>index) {
- index = clonedListeners.size();
+ if(0>index) {
+ index = clonedListeners.size();
}
clonedListeners.add(index, l);
windowListeners = clonedListeners;
@@ -2681,8 +3210,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
public WindowListener getWindowListener(int index) {
@SuppressWarnings("unchecked")
ArrayList<WindowListener> clonedListeners = (ArrayList<WindowListener>) windowListeners.clone();
- if(0>index) {
- index = clonedListeners.size()-1;
+ if(0>index) {
+ index = clonedListeners.size()-1;
}
return clonedListeners.get(index);
}
@@ -2721,7 +3250,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
l.windowRepaint((WindowUpdateEvent)e);
break;
default:
- throw
+ throw
new NativeWindowException("Unexpected window event type "
+ e.getEventType());
}
@@ -2735,7 +3264,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
System.err.println("Window.focusChanged: ("+getThreadName()+"): (defer: "+defer+") "+this.hasFocus+" -> "+focusGained+" - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle));
}
hasFocus = focusGained;
- final int evt = focusGained ? WindowEvent.EVENT_WINDOW_GAINED_FOCUS : WindowEvent.EVENT_WINDOW_LOST_FOCUS ;
+ final int evt = focusGained ? WindowEvent.EVENT_WINDOW_GAINED_FOCUS : WindowEvent.EVENT_WINDOW_LOST_FOCUS ;
if(!defer) {
sendWindowEvent(evt);
} else {
@@ -2743,7 +3272,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
}
-
+
/** Triggered by implementation's WM events to update the visibility state. */
protected void visibleChanged(boolean defer, boolean visible) {
if(this.visible != visible) {
@@ -2769,7 +3298,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
display.dispatchMessagesNative(); // status up2date
}
if(this.visible != visible) {
- final String msg = "Visibility not reached as requested within "+timeOut+"ms : requested "+visible+", is "+this.visible;
+ final String msg = "Visibility not reached as requested within "+timeOut+"ms : requested "+visible+", is "+this.visible;
if(failFast) {
throw new NativeWindowException(msg);
} else if (DEBUG_IMPLEMENTATION) {
@@ -2784,7 +3313,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
- /** Triggered by implementation's WM events to update the client-area size w/o insets/decorations. */
+ /** Triggered by implementation's WM events to update the client-area size w/o insets/decorations. */
protected void sizeChanged(boolean defer, int newWidth, int newHeight, boolean force) {
if(force || getWidth() != newWidth || getHeight() != newHeight) {
if(DEBUG_IMPLEMENTATION) {
@@ -2803,7 +3332,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
}
-
+
private boolean waitForSize(int w, int h, boolean failFast, long timeOut) {
final DisplayImpl display = (DisplayImpl) screen.getDisplay();
display.dispatchMessagesNative(); // status up2date
@@ -2825,8 +3354,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
return true;
}
}
-
- /** Triggered by implementation's WM events to update the position. */
+
+ /** Triggered by implementation's WM events to update the position. */
protected void positionChanged(boolean defer, int newX, int newY) {
if ( getX() != newX || getY() != newY ) {
if(DEBUG_IMPLEMENTATION) {
@@ -2839,7 +3368,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
enqueueWindowEvent(false, WindowEvent.EVENT_WINDOW_MOVED);
}
} else {
- autoPosition = false; // ensure it's off even w/ same position
+ autoPosition = false; // ensure it's off even w/ same position
}
}
@@ -2883,10 +3412,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
return ok;
}
-
+
/**
- * Triggered by implementation's WM events to update the insets.
- *
+ * Triggered by implementation's WM events to update the insets.
+ *
* @see #getInsets()
* @see #updateInsetsImpl(Insets)
*/
@@ -2896,23 +3425,20 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.insetsChanged: skip insets change for undecoration mode");
}
- } else if ( (left != insets.getLeftWidth() || right != insets.getRightWidth() ||
+ } else if ( (left != insets.getLeftWidth() || right != insets.getRightWidth() ||
top != insets.getTopHeight() || bottom != insets.getBottomHeight() )
) {
- insets.setLeftWidth(left);
- insets.setRightWidth(right);
- insets.setTopHeight(top);
- insets.setBottomHeight(bottom);
+ insets.set(left, right, top, bottom);
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.insetsChanged: (defer: "+defer+") "+insets);
}
}
}
}
-
+
/**
* Triggered by implementation's WM events or programmatic while respecting {@link #getDefaultCloseOperation()}.
- *
+ *
* @param force if true, overrides {@link #setDefaultCloseOperation(WindowClosingMode)} with {@link WindowClosingProtocol#DISPOSE_ON_CLOSE}
* and hence force destruction. Otherwise is follows the user settings.
* @return true if this window is no more valid and hence has been destroyed, otherwise false.
@@ -2924,9 +3450,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
System.err.println("Window.windowDestroyNotify(isNativeValid: "+isNativeValid()+", force: "+force+", mode "+defMode+" -> "+mode+") "+getThreadName()+": "+this);
// Thread.dumpStack();
}
-
+
final boolean destroyed;
-
+
if( isNativeValid() ) {
if( WindowClosingMode.DISPOSE_ON_CLOSE == mode ) {
if(force) {
@@ -2947,7 +3473,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// send synced destroy notifications
sendWindowEvent(WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY);
}
-
+
destroyed = !isNativeValid();
} else {
destroyed = true;
@@ -2955,19 +3481,19 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.windowDestroyNotify(isNativeValid: "+isNativeValid()+", force: "+force+", mode "+mode+") END "+getThreadName()+": destroyed "+destroyed+", "+this);
- }
-
+ }
+
return destroyed;
}
@Override
public void windowRepaint(int x, int y, int width, int height) {
- windowRepaint(false, x, y, width, height);
+ windowRepaint(false, x, y, width, height);
}
-
+
/**
* Triggered by implementation's WM events to update the content
- */
+ */
protected void windowRepaint(boolean defer, int x, int y, int width, int height) {
width = ( 0 >= width ) ? getWidth() : width;
height = ( 0 >= height ) ? getHeight() : height;
@@ -3032,7 +3558,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
protected final void shouldNotCallThis() {
throw new NativeWindowException("Should not call this");
}
-
+
public static String getThreadName() {
return Display.getThreadName();
}
diff --git a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java
index 861a6d6..2ba5b34 100644
--- a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java
+++ b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.newt.awt;
import javax.media.nativewindow.AbstractGraphicsConfiguration;
@@ -76,12 +76,12 @@ public class NewtFactoryAWT extends NewtFactory {
}
return (JAWTWindow)nw;
}
-
+
public static void destroyNativeWindow(JAWTWindow jawtWindow) {
final AbstractGraphicsConfiguration config = jawtWindow.getGraphicsConfiguration();
jawtWindow.destroy();
- config.getScreen().getDevice().close();
+ config.getScreen().getDevice().close();
}
-
+
}
diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java
index 1e15070..0ee3cc0 100644
--- a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java
+++ b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,26 +20,26 @@
* 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.newt.awt.event;
import com.jogamp.newt.event.MouseEvent;
/**
*
- * <a name="AWTEventModifierMapping"><h5>AWT Event Modifier Mapping</h5></a>
+ * <a name="AWTEventModifierMapping"><h5>AWT Event Modifier Mapping</h5></a>
* <pre>
Modifier AWT Constant AWT Bit AWT Ex NEWT Constant NEWT Bit
------------- ------------------------------- ------- ------ ------------------------- --------
- Shift Event.SHIFT_MASK 0
- Ctrl Event.CTRL_MASK 1
- Meta Event.META_MASK 2
- Alt Event.ALT_MASK 3
+ Shift Event.SHIFT_MASK 0
+ Ctrl Event.CTRL_MASK 1
+ Meta Event.META_MASK 2
+ Alt Event.ALT_MASK 3
Button1 InputEvent.BUTTON1_MASK 4
Button2 InputEvent.BUTTON2_MASK 3
Button3 InputEvent.BUTTON3_MASK 2
@@ -88,11 +88,11 @@ public class AWTNewtEventFactory {
Method _getMaskForButtonMethod = null;
try {
_getMaskForButtonMethod = ReflectionUtil.getMethod(java.awt.event.InputEvent.class, "getMaskForButton", int.class);
- } catch(Throwable t) {}
+ } catch(Throwable t) {}
getMaskForButtonMethod = _getMaskForButtonMethod;
} */
-
- awtButtonDownMasks = new int[com.jogamp.newt.event.MouseEvent.BUTTON_NUMBER] ; // java.awt.MouseInfo.getNumberOfButtons() ;
+
+ awtButtonDownMasks = new int[com.jogamp.newt.event.MouseEvent.BUTTON_COUNT] ; // java.awt.MouseInfo.getNumberOfButtons() ;
for (int n = 0 ; n < awtButtonDownMasks.length ; ++n) {
awtButtonDownMasks[n] = getAWTButtonDownMaskImpl(n+1);
}
@@ -112,12 +112,12 @@ public class AWTNewtEventFactory {
case java.awt.event.WindowEvent.WINDOW_LOST_FOCUS: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_LOST_FOCUS;
case java.awt.event.FocusEvent.FOCUS_LOST: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_LOST_FOCUS;
// n/a case java.awt.event.WindowEvent.WINDOW_STATE_CHANGED: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_STATE_CHANGED;
-
+
case java.awt.event.ComponentEvent.COMPONENT_MOVED: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_MOVED;
case java.awt.event.ComponentEvent.COMPONENT_RESIZED: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_RESIZED;
// n/a case java.awt.event.ComponentEvent.COMPONENT_SHOWN: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_SHOWN;
// n/a case java.awt.event.ComponentEvent.COMPONENT_HIDDEN: return com.jogamp.newt.event.WindowEvent.EVENT_WINDOW_HIDDEN;
-
+
case java.awt.event.MouseEvent.MOUSE_CLICKED: return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_CLICKED;
case java.awt.event.MouseEvent.MOUSE_PRESSED: return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_PRESSED;
case java.awt.event.MouseEvent.MOUSE_RELEASED: return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_RELEASED;
@@ -126,17 +126,17 @@ public class AWTNewtEventFactory {
case java.awt.event.MouseEvent.MOUSE_EXITED: return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_EXITED;
case java.awt.event.MouseEvent.MOUSE_DRAGGED: return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_DRAGGED;
case java.awt.event.MouseEvent.MOUSE_WHEEL: return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_WHEEL_MOVED;
-
+
case java.awt.event.KeyEvent.KEY_PRESSED: return com.jogamp.newt.event.KeyEvent.EVENT_KEY_PRESSED;
case java.awt.event.KeyEvent.KEY_RELEASED: return com.jogamp.newt.event.KeyEvent.EVENT_KEY_RELEASED;
}
return (short)0;
}
-
+
private static int getAWTButtonDownMaskImpl(int button) {
/**
* java.awt.event.InputEvent.getMaskForButton(button);
- *
+ *
if(null != getMaskForButtonMethod) {
Object r=null;
try {
@@ -153,20 +153,20 @@ public class AWTNewtEventFactory {
case 2 : m = java.awt.event.InputEvent.BUTTON2_DOWN_MASK; break; // 1<<11
case 3 : m = java.awt.event.InputEvent.BUTTON3_DOWN_MASK; break; // 1<<12
default:
- if( button <= com.jogamp.newt.event.MouseEvent.BUTTON_NUMBER ) {
+ if( button <= com.jogamp.newt.event.MouseEvent.BUTTON_COUNT ) {
m = 1 << ( 10 + button ) ; // b4 = 1<<14, b5 = 1<<15, etc
} else {
m = 0;
- }
+ }
}
return m;
}
-
+
/**
* <p>
* See <a href="#AWTEventModifierMapping"> AWT event modifier mapping details</a>.
* </p>
- *
+ *
* @param button
* @return
*/
@@ -175,42 +175,42 @@ public class AWTNewtEventFactory {
return awtButtonDownMasks[button-1];
} else {
return 0;
- }
+ }
}
-
+
public static final short awtButton2Newt(int awtButton) {
- if( 0 < awtButton && awtButton <= com.jogamp.newt.event.MouseEvent.BUTTON_NUMBER ) {
+ if( 0 < awtButton && awtButton <= com.jogamp.newt.event.MouseEvent.BUTTON_COUNT ) {
return (short)awtButton;
} else {
return (short)0;
}
}
-
+
/**
* Converts the specified set of AWT event modifiers and extended event
* modifiers to the equivalent NEWT event modifiers.
- *
+ *
* <p>
* See <a href="#AWTEventModifierMapping"> AWT event modifier mapping details</a>.
* </p>
- *
+ *
* @param awtMods
* The AWT event modifiers.
- *
+ *
* @param awtModsEx
* The AWT extended event modifiers.
* AWT passes mouse button specific bits here and are the preferred way check the mouse button state.
*/
public static final int awtModifiers2Newt(final int awtMods, final int awtModsEx) {
int newtMods = 0;
-
+
/** Redundant old modifiers ..
if ((awtMods & java.awt.event.InputEvent.SHIFT_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.SHIFT_MASK;
if ((awtMods & java.awt.event.InputEvent.CTRL_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.CTRL_MASK;
if ((awtMods & java.awt.event.InputEvent.META_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.META_MASK;
if ((awtMods & java.awt.event.InputEvent.ALT_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.ALT_MASK;
if ((awtMods & java.awt.event.InputEvent.ALT_GRAPH_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.ALT_GRAPH_MASK; */
-
+
if ((awtModsEx & java.awt.event.InputEvent.SHIFT_DOWN_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.SHIFT_MASK;
if ((awtModsEx & java.awt.event.InputEvent.CTRL_DOWN_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.CTRL_MASK;
if ((awtModsEx & java.awt.event.InputEvent.META_DOWN_MASK) != 0) newtMods |= com.jogamp.newt.event.InputEvent.META_MASK;
@@ -221,7 +221,7 @@ public class AWTNewtEventFactory {
// being ignored intentionally. The AWT docs say that the
// BUTTON1_DOWN_MASK etc bits in the extended modifiers are
// the preferred place to check current button state.
-
+
if( 0 != awtModsEx ) {
for (int n = 0 ; n < awtButtonDownMasks.length ; ++n) {
if ( (awtModsEx & awtButtonDownMasks[n]) != 0 ) {
@@ -232,7 +232,7 @@ public class AWTNewtEventFactory {
return newtMods;
}
-
+
public static short awtKeyCode2NewtKeyCode(final int awtKeyCode) {
final short defNEWTKeyCode = (short)awtKeyCode;
switch (awtKeyCode) {
@@ -371,7 +371,7 @@ public class AWTNewtEventFactory {
case java.awt.event.KeyEvent.VK_MULTIPLY : return com.jogamp.newt.event.KeyEvent.VK_MULTIPLY;
case java.awt.event.KeyEvent.VK_DIVIDE : return com.jogamp.newt.event.KeyEvent.VK_DIVIDE;
case java.awt.event.KeyEvent.VK_NUM_LOCK : return com.jogamp.newt.event.KeyEvent.VK_NUM_LOCK;
- case java.awt.event.KeyEvent.VK_KP_LEFT : /** Fall through intended .. */
+ case java.awt.event.KeyEvent.VK_KP_LEFT : /** Fall through intended .. */
case java.awt.event.KeyEvent.VK_LEFT : return com.jogamp.newt.event.KeyEvent.VK_LEFT;
case java.awt.event.KeyEvent.VK_KP_UP : /** Fall through intended .. */
case java.awt.event.KeyEvent.VK_UP : return com.jogamp.newt.event.KeyEvent.VK_UP;
@@ -381,7 +381,7 @@ public class AWTNewtEventFactory {
case java.awt.event.KeyEvent.VK_DOWN : return com.jogamp.newt.event.KeyEvent.VK_DOWN;
case java.awt.event.KeyEvent.VK_CONTEXT_MENU : return com.jogamp.newt.event.KeyEvent.VK_CONTEXT_MENU;
case java.awt.event.KeyEvent.VK_WINDOWS : return com.jogamp.newt.event.KeyEvent.VK_WINDOWS;
- case java.awt.event.KeyEvent.VK_META : return com.jogamp.newt.event.KeyEvent.VK_META;
+ case java.awt.event.KeyEvent.VK_META : return com.jogamp.newt.event.KeyEvent.VK_META;
case java.awt.event.KeyEvent.VK_HELP : return com.jogamp.newt.event.KeyEvent.VK_HELP;
case java.awt.event.KeyEvent.VK_COMPOSE : return com.jogamp.newt.event.KeyEvent.VK_COMPOSE;
case java.awt.event.KeyEvent.VK_BEGIN : return com.jogamp.newt.event.KeyEvent.VK_BEGIN;
@@ -558,7 +558,7 @@ public class AWTNewtEventFactory {
case com.jogamp.newt.event.KeyEvent.VK_DOWN : return java.awt.event.KeyEvent.VK_DOWN;
case com.jogamp.newt.event.KeyEvent.VK_CONTEXT_MENU : return java.awt.event.KeyEvent.VK_CONTEXT_MENU;
case com.jogamp.newt.event.KeyEvent.VK_WINDOWS : return java.awt.event.KeyEvent.VK_WINDOWS;
- case com.jogamp.newt.event.KeyEvent.VK_META : return java.awt.event.KeyEvent.VK_META;
+ case com.jogamp.newt.event.KeyEvent.VK_META : return java.awt.event.KeyEvent.VK_META;
case com.jogamp.newt.event.KeyEvent.VK_HELP : return java.awt.event.KeyEvent.VK_HELP;
case com.jogamp.newt.event.KeyEvent.VK_COMPOSE : return java.awt.event.KeyEvent.VK_COMPOSE;
case com.jogamp.newt.event.KeyEvent.VK_BEGIN : return java.awt.event.KeyEvent.VK_BEGIN;
@@ -636,7 +636,7 @@ public class AWTNewtEventFactory {
}
return new com.jogamp.newt.event.MouseEvent(
newtType, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, event.getWhen(),
- mods, event.getX(), event.getY(), (short)event.getClickCount(),
+ mods, event.getX(), event.getY(), (short)event.getClickCount(),
newtButton, MouseEvent.getRotationXYZ(rotation, mods), 1f);
}
return null; // no mapping ..
@@ -650,11 +650,11 @@ public class AWTNewtEventFactory {
if( (short)0 != newtType ) {
final short newtKeyCode = awtKeyCode2NewtKeyCode( event.getKeyCode() );
return com.jogamp.newt.event.KeyEvent.create(
- newtType, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, event.getWhen(),
- awtModifiers2Newt(event.getModifiers(), event.getModifiersEx()),
+ newtType, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, event.getWhen(),
+ awtModifiers2Newt(event.getModifiers(), event.getModifiersEx()),
newtKeyCode, newtKeyCode, event.getKeyChar());
}
return null; // no mapping ..
}
-
+
}
diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java
index fa494ad..4bcb0fc 100644
--- a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java
+++ b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.newt.awt.event;
import java.awt.KeyboardFocusManager;
@@ -45,22 +45,25 @@ import com.jogamp.newt.event.awt.AWTWindowAdapter;
public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt.event.HierarchyListener
{
NativeWindow downstreamParent;
-
+
public AWTParentWindowAdapter(NativeWindow downstreamParent, com.jogamp.newt.Window downstream) {
super(downstream);
this.downstreamParent = downstreamParent;
}
+ @Override
public AWTAdapter addTo(java.awt.Component awtComponent) {
awtComponent.addHierarchyListener(this);
return super.addTo(awtComponent);
}
+ @Override
public AWTAdapter removeFrom(java.awt.Component awtComponent) {
awtComponent.removeHierarchyListener(this);
return super.removeFrom(awtComponent);
}
+ @Override
public void focusGained(java.awt.event.FocusEvent e) {
// forward focus to NEWT child
final com.jogamp.newt.Window newtChild = getNewtWindow();
@@ -78,12 +81,14 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt
}
}
+ @Override
public void focusLost(java.awt.event.FocusEvent e) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("AWT: focusLost: "+ e);
}
}
+ @Override
public void componentResized(java.awt.event.ComponentEvent e) {
// Need to resize the NEWT child window
// the resized event will be send via the native window feedback.
@@ -93,6 +98,7 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt
}
final Window newtWindow = getNewtWindow();
newtWindow.runOnEDTIfAvail(false, new Runnable() {
+ @Override
public void run() {
int cw = comp.getWidth();
int ch = comp.getHeight();
@@ -109,40 +115,45 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt
}});
}
+ @Override
public void componentMoved(java.awt.event.ComponentEvent e) {
if(DEBUG_IMPLEMENTATION) {
- System.err.println("AWT: componentMoved: "+e);
+ System.err.println("AWT: componentMoved: "+e);
}
final Window newtWindow = getNewtWindow();
if(newtWindow.getDelegatedWindow() instanceof DriverUpdatePosition) {
((DriverUpdatePosition)newtWindow.getDelegatedWindow()).updatePosition(0, 0);
- }
+ }
}
+ @Override
public void windowActivated(java.awt.event.WindowEvent e) {
// no propagation to NEWT child window
}
+ @Override
public void windowDeactivated(java.awt.event.WindowEvent e) {
// no propagation to NEWT child window
}
+ @Override
public void hierarchyChanged(java.awt.event.HierarchyEvent e) {
if( null == getNewtEventListener() ) {
long bits = e.getChangeFlags();
- final java.awt.Component changed = e.getChanged();
+ final java.awt.Component changed = e.getChanged();
if( 0 != ( java.awt.event.HierarchyEvent.SHOWING_CHANGED & bits ) ) {
final boolean showing = changed.isShowing();
if(DEBUG_IMPLEMENTATION) {
System.err.println("AWT: hierarchyChanged SHOWING_CHANGED: showing "+showing+", "+changed+", source "+e.getComponent());
}
getNewtWindow().runOnEDTIfAvail(false, new Runnable() {
+ @Override
public void run() {
if(getNewtWindow().isVisible() != showing) {
getNewtWindow().setVisible(showing);
}
}});
- }
+ }
if(DEBUG_IMPLEMENTATION) {
if( 0 != ( java.awt.event.HierarchyEvent.DISPLAYABILITY_CHANGED & bits ) ) {
final boolean displayability = changed.isDisplayable();
diff --git a/src/newt/classes/jogamp/newt/driver/DriverClearFocus.java b/src/newt/classes/jogamp/newt/driver/DriverClearFocus.java
index 0a824e8..0ff86fe 100644
--- a/src/newt/classes/jogamp/newt/driver/DriverClearFocus.java
+++ b/src/newt/classes/jogamp/newt/driver/DriverClearFocus.java
@@ -1,10 +1,10 @@
package jogamp.newt.driver;
-/**
+/**
* Interface tagging driver requirement of clearing the focus.
* <p>
- * Some drivers require a programmatic {@link #clearFocus()} when traversing the focus.
- * </p>
+ * Some drivers require a programmatic {@link #clearFocus()} when traversing the focus.
+ * </p>
*/
public interface DriverClearFocus {
/** Programmatic clear the focus */
diff --git a/src/newt/classes/jogamp/newt/driver/DriverUpdatePosition.java b/src/newt/classes/jogamp/newt/driver/DriverUpdatePosition.java
index 2ec3271..e5f9b6a 100644
--- a/src/newt/classes/jogamp/newt/driver/DriverUpdatePosition.java
+++ b/src/newt/classes/jogamp/newt/driver/DriverUpdatePosition.java
@@ -1,14 +1,14 @@
package jogamp.newt.driver;
-/**
+/**
* Interface tagging driver requirement of absolute positioning, ie. depend on parent position.
*/
public interface DriverUpdatePosition {
- /**
+ /**
* Programmatic update the top-left corner
* of the client area relative to it's parent.
- *
- * @param x x-component
+ *
+ * @param x x-component
* @param y y-component
**/
void updatePosition(int x, int y);
diff --git a/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java
index cc35ff7..6623720 100644
--- a/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -61,35 +61,35 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
@Override
protected int validateScreenIndex(int idx) {
- return 0; // FIXME: only one screen available ?
+ return 0; // FIXME: only one screen available ?
}
-
+
private final MonitorMode getModeImpl(final Cache cache, final android.view.Display aDisplay, DisplayMetrics outMetrics, int modeIdx, int screenSizeNRot, int nrot) {
final int[] props = new int[MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL];
int i = 0;
props[i++] = MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL;
i = getScreenSize(outMetrics, screenSizeNRot, props, i); // width, height
- i = getBpp(aDisplay, props, i); // bpp
+ i = getBpp(aDisplay, props, i); // bpp
props[i++] = (int) ( aDisplay.getRefreshRate() * 100.0f ); // Hz * 100
props[i++] = 0; // flags
props[i++] = modeIdx; // modeId;
props[i++] = nrot;
return MonitorModeProps.streamInMonitorMode(null, cache, props, 0);
}
-
+
@Override
protected void collectNativeMonitorModesAndDevicesImpl(Cache cache) {
// FIXME: Multi Monitor Implementation missing [for newer Android version ?]
-
+
final Context ctx = jogamp.common.os.android.StaticContext.getContext();
final WindowManager wmgr = (WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE);
final DisplayMetrics outMetrics = new DisplayMetrics();
final android.view.Display aDisplay = wmgr.getDefaultDisplay();
aDisplay.getMetrics(outMetrics);
-
+
final int arot = aDisplay.getRotation();
final int nrot = androidRotation2NewtRotation(arot);
-
+
final int modeIdx=0; // no native modeId in use - use 0
MonitorMode currentMode = null;
for(int r=0; r<4; r++) { // for all rotations
@@ -98,7 +98,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
if( nrot == nrot_i ) {
currentMode = mode;
}
- }
+ }
final int[] props = new int[MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES - 1 - MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES];
int i = 0;
@@ -109,17 +109,17 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
props[i++] = 0; // rotated viewport y
props[i++] = outMetrics.widthPixels; // rotated viewport width
props[i++] = outMetrics.heightPixels; // rotated viewport height
- MonitorModeProps.streamInMonitorDevice(null, cache, this, cache.monitorModes, currentMode, props, 0);
+ MonitorModeProps.streamInMonitorDevice(null, cache, this, cache.monitorModes, currentMode, props, 0);
}
@Override
- protected MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor) {
+ protected MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor) {
final Context ctx = jogamp.common.os.android.StaticContext.getContext();
final WindowManager wmgr = (WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE);
final DisplayMetrics outMetrics = new DisplayMetrics();
final android.view.Display aDisplay = wmgr.getDefaultDisplay();
aDisplay.getMetrics(outMetrics);
-
+
final int currNRot = androidRotation2NewtRotation(aDisplay.getRotation());
return getModeImpl(null, aDisplay, outMetrics, 0, currNRot, currNRot);
}
@@ -128,7 +128,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
protected boolean setCurrentMonitorModeImpl(MonitorDevice monitor, MonitorMode mode) {
return false;
}
-
+
//----------------------------------------------------------------------
// Internals only
//
@@ -151,7 +151,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
props[offset++] = outMetrics.heightPixels;
}
return offset;
- }
+ }
static int getBpp(android.view.Display aDisplay, int[] props, int offset) {
int bpp;
switch(aDisplay.getPixelFormat()) {
@@ -162,18 +162,28 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
case PixelFormat.RGBA_5551: bpp=16; break;
case PixelFormat.RGBA_4444: bpp=16; break;
case PixelFormat.RGB_332: bpp= 8; break;
- default: bpp=32;
- }
- props[offset++] = bpp;
+ default: bpp=32;
+ }
+ props[offset++] = bpp;
return offset;
}
static int getScreenSizeMM(DisplayMetrics outMetrics, int[] props, int offset) {
- final float iw = (float) outMetrics.widthPixels / outMetrics.xdpi;
- final float ih = (float) outMetrics.heightPixels / outMetrics.xdpi;
+ final float inW = outMetrics.widthPixels / outMetrics.xdpi;
+ final float inH = outMetrics.heightPixels / outMetrics.ydpi;
final float mmpi = 25.4f;
- props[offset++] = (int) ((iw * mmpi)+0.5);
- props[offset++] = (int) ((ih * mmpi)+0.5);
+ final float mmW = inW * mmpi;
+ final float mmH = inH * mmpi;
+ if( DEBUG ) {
+ System.err.println("Screen A screen "+outMetrics.widthPixels+" x "+outMetrics.heightPixels);
+ System.err.println("Screen A xy dpi "+outMetrics.xdpi+" x "+outMetrics.ydpi);
+ System.err.println("Screen A densityDPI "+outMetrics.densityDpi);
+ System.err.println("Screen A density "+outMetrics.density);
+ System.err.println("Screen N xy inch "+inW+" x "+inH);
+ System.err.println("Screen N xy mm "+mmW+" x "+mmH);
+ }
+ props[offset++] = Math.round(mmW);
+ props[offset++] = Math.round(mmH);
return offset;
- }
+ }
}
diff --git a/src/newt/classes/jogamp/newt/driver/android/event/AndroidNewtEventFactory.java b/src/newt/classes/jogamp/newt/driver/android/event/AndroidNewtEventFactory.java
index 364a348..e5d667f 100644
--- a/src/newt/classes/jogamp/newt/driver/android/event/AndroidNewtEventFactory.java
+++ b/src/newt/classes/jogamp/newt/driver/android/event/AndroidNewtEventFactory.java
@@ -33,6 +33,7 @@ import android.view.MotionEvent;
import com.jogamp.common.os.AndroidVersion;
import com.jogamp.newt.event.InputEvent;
+import com.jogamp.newt.event.MouseEvent;
import com.jogamp.newt.event.NEWTEvent;
public class AndroidNewtEventFactory {
@@ -59,19 +60,16 @@ public class AndroidNewtEventFactory {
private static final short aMotionEventType2Newt(int aType) {
switch( aType ) {
case android.view.MotionEvent.ACTION_DOWN:
+ case android.view.MotionEvent.ACTION_POINTER_DOWN:
return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_PRESSED;
case android.view.MotionEvent.ACTION_UP:
+ case android.view.MotionEvent.ACTION_POINTER_UP:
+ case android.view.MotionEvent.ACTION_CANCEL:
return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_RELEASED;
case android.view.MotionEvent.ACTION_MOVE:
return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_DRAGGED;
- case android.view.MotionEvent.ACTION_CANCEL:
- return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_RELEASED;
case android.view.MotionEvent.ACTION_OUTSIDE:
return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_MOVED;
- case android.view.MotionEvent.ACTION_POINTER_DOWN:
- return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_PRESSED;
- case android.view.MotionEvent.ACTION_POINTER_UP:
- return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_RELEASED;
// case ACTION_HOVER_MOVE
case ACTION_SCROLL: // API Level 12 !
return com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_WHEEL_MOVED;
@@ -244,36 +242,34 @@ public class AndroidNewtEventFactory {
return maxPressure;
}
- private final int touchSlop, touchSlopSquare, doubleTapSlop, doubleTapSlopSquare;
-
+ private final int touchSlop;
public AndroidNewtEventFactory(android.content.Context context, android.os.Handler handler) {
final android.view.ViewConfiguration configuration = android.view.ViewConfiguration.get(context);
touchSlop = configuration.getScaledTouchSlop();
- touchSlopSquare = touchSlop * touchSlop;
- doubleTapSlop = configuration.getScaledDoubleTapSlop();
- doubleTapSlopSquare = doubleTapSlop * doubleTapSlop;
+ final int doubleTapSlop = configuration.getScaledDoubleTapSlop();
if(DEBUG_MOUSE_EVENT) {
- System.err.println("GestureListener touchSlop (scaled) "+touchSlop);
- System.err.println("GestureListener doubleTapSlop (scaled) "+doubleTapSlop);
- }
+ System.err.println("AndroidNewtEventFactory scrollSlop (scaled) "+touchSlop);
+ System.err.println("AndroidNewtEventFactory doubleTapSlop (scaled) "+doubleTapSlop);
+ }
}
- private static void collectPointerData(MotionEvent e, int eIdx, int dIdx, final int[] x, final int[] y, final float[] pressure, short[] pointerIds, final com.jogamp.newt.event.MouseEvent.PointerType[] pointerTypes) {
- x[dIdx] = (int)e.getX(eIdx);
- y[dIdx] = (int)e.getY(eIdx);
- pressure[dIdx] = e.getPressure(eIdx);
- pointerIds[dIdx] = (short)e.getPointerId(eIdx);
- if( pressure[dIdx] > maxPressure ) {
- maxPressure = pressure[dIdx];
+ private static void collectPointerData(MotionEvent e, int idx, final int[] x, final int[] y, final float[] pressure,
+ final short[] pointerIds, final MouseEvent.PointerType[] pointerTypes) {
+ x[idx] = (int)e.getX(idx);
+ y[idx] = (int)e.getY(idx);
+ pressure[idx] = e.getPressure(idx);
+ pointerIds[idx] = (short)e.getPointerId(idx);
+ if( pressure[idx] > maxPressure ) {
+ maxPressure = pressure[idx];
}
- pointerTypes[dIdx] = aToolType2PointerType( e.getToolType(eIdx) );
+ pointerTypes[idx] = aToolType2PointerType( e.getToolType(idx) );
if(DEBUG_MOUSE_EVENT) {
- System.err.println("createMouseEvent: ptr-data["+eIdx+" -> "+dIdx+"] "+x[dIdx]+"/"+y[dIdx]+", pressure "+pressure[dIdx]+", id "+pointerIds[dIdx]+", type "+pointerTypes[dIdx]);
+ System.err.println("createMouseEvent: ptr-data["+idx+"] "+x[idx]+"/"+y[idx]+", pressure "+pressure[idx]+", id "+pointerIds[idx]+", type "+pointerTypes[idx]);
}
}
- public com.jogamp.newt.event.MouseEvent[] createMouseEvents(boolean isOnTouchEvent,
- android.view.MotionEvent event, com.jogamp.newt.Window newtSource) {
+ public boolean sendPointerEvent(boolean enqueue, boolean wait, boolean setFocusOnDown, boolean isOnTouchEvent,
+ android.view.MotionEvent event, jogamp.newt.driver.android.WindowDriver newtSource) {
if(DEBUG_MOUSE_EVENT) {
System.err.println("createMouseEvent: isOnTouchEvent "+isOnTouchEvent+", "+event);
}
@@ -285,67 +281,16 @@ public class AndroidNewtEventFactory {
//
// Prefilter Android Event (Gesture, ..) and determine final type
//
- final int aType;
- final short nType;
+ final int aType = event.getActionMasked();
+ final short nType = aMotionEventType2Newt(aType);
final float rotationScale = touchSlop;
final float[] rotationXYZ = new float[] { 0f, 0f, 0f };
- int rotationSource = 0; // 1 - Gesture, 2 - ACTION_SCROLL
- {
- final int aType0 = event.getActionMasked();
- if( isOnTouchEvent ) {
- switch ( aType0 ) {
- case MotionEvent.ACTION_DOWN:
- case MotionEvent.ACTION_POINTER_DOWN:
- gesture2FingerScrl.onDown(event);
- break;
- case MotionEvent.ACTION_UP:
- case MotionEvent.ACTION_POINTER_UP:
- gesture2FingerScrl.onUp(event);
- break;
- case MotionEvent.ACTION_MOVE:
- gesture2FingerScrl.onMove(event);
- break;
- }
- }
-
- if( gesture2FingerScrl.gestureStarted() ) {
- if( gesture2FingerScrl.hasGesture(true) ) {
- final float[] rot = gesture2FingerScrl.getScrollDistanceXY();
- rotationXYZ[0] = rot[0] / rotationScale;
- rotationXYZ[1] = rot[1] / rotationScale;
- aType = ACTION_SCROLL; // 8
- rotationSource = 1;
- } else {
- return new com.jogamp.newt.event.MouseEvent[0]; // skip, but cont. sending events
- }
- } else {
- aType = aType0;
- }
- nType = aMotionEventType2Newt(aType);
- }
if( (short)0 != nType ) {
- final short clickCount = 1;
int modifiers = 0;
- if( 0 == rotationSource && AndroidVersion.SDK_INT >= 12 && ACTION_SCROLL == aType ) { // API Level 12
- rotationXYZ[0] = event.getAxisValue(android.view.MotionEvent.AXIS_X) / rotationScale;
- rotationXYZ[1] = event.getAxisValue(android.view.MotionEvent.AXIS_Y) / rotationScale;
- rotationSource = 2;
- }
-
- if( 0 != rotationSource ) {
- if( rotationXYZ[0]*rotationXYZ[0] > rotationXYZ[1]*rotationXYZ[1] ) {
- // Horizontal
- modifiers |= com.jogamp.newt.event.InputEvent.SHIFT_MASK;
- }
- if(DEBUG_MOUSE_EVENT) {
- System.err.println("createMouseEvent: Gesture2FingerScrl Scroll "+rotationXYZ[0]+"/"+rotationXYZ[1]+", "+rotationScale+", mods "+modifiers+", source "+rotationSource);
- }
- }
-
//
- // Determine newt-button and whether dedicated pointer is pressed
+ // Determine SDK 12 SCROLL, newt-button and whether dedicated pointer is pressed
//
final int pIndex;
final short button;
@@ -354,13 +299,29 @@ public class AndroidNewtEventFactory {
case android.view.MotionEvent.ACTION_POINTER_UP: {
pIndex = event.getActionIndex();
final int b = event.getPointerId(pIndex) + 1; // FIXME: Assumption that Pointer-ID starts w/ 0 !
- if( com.jogamp.newt.event.MouseEvent.BUTTON1 <= b && b <= com.jogamp.newt.event.MouseEvent.BUTTON_NUMBER ) {
+ if( com.jogamp.newt.event.MouseEvent.BUTTON1 <= b && b <= com.jogamp.newt.event.MouseEvent.BUTTON_COUNT ) {
button = (short)b;
} else {
button = com.jogamp.newt.event.MouseEvent.BUTTON1;
}
}
break;
+
+ case ACTION_SCROLL:
+ if( AndroidVersion.SDK_INT >= 12 ) { // API Level 12
+ rotationXYZ[0] = event.getAxisValue(android.view.MotionEvent.AXIS_X) / rotationScale;
+ rotationXYZ[1] = event.getAxisValue(android.view.MotionEvent.AXIS_Y) / rotationScale;
+
+ if( rotationXYZ[0]*rotationXYZ[0] > rotationXYZ[1]*rotationXYZ[1] ) {
+ // Horizontal
+ modifiers |= com.jogamp.newt.event.InputEvent.SHIFT_MASK;
+ }
+ if(DEBUG_MOUSE_EVENT) {
+ System.err.println("createMouseEvent: SDK-12 Scroll "+rotationXYZ[0]+"/"+rotationXYZ[1]+", "+rotationScale+", mods "+modifiers);
+ }
+ }
+ // Fall through intended!
+
default: {
pIndex = 0;
button = com.jogamp.newt.event.MouseEvent.BUTTON1;
@@ -368,6 +329,15 @@ public class AndroidNewtEventFactory {
}
final int pCount = event.getPointerCount(); // all
+ switch( aType ) {
+ case android.view.MotionEvent.ACTION_DOWN:
+ case android.view.MotionEvent.ACTION_POINTER_DOWN:
+ modifiers |= InputEvent.getButtonMask(button);
+ if( setFocusOnDown ) {
+ newtSource.focusChanged(false, true);
+ }
+ }
+
//
// Collect common data
//
@@ -375,229 +345,20 @@ public class AndroidNewtEventFactory {
final int[] y = new int[pCount];
final float[] pressure = new float[pCount];
final short[] pointerIds = new short[pCount];
- final com.jogamp.newt.event.MouseEvent.PointerType[] pointerTypes = new com.jogamp.newt.event.MouseEvent.PointerType[pCount];
+ final MouseEvent.PointerType[] pointerTypes = new MouseEvent.PointerType[pCount];
if( 0 < pCount ) {
if(DEBUG_MOUSE_EVENT) {
- System.err.println("createMouseEvent: collect ptr-data [0.."+(pCount-1)+", count "+pCount+", action "+pIndex+"], aType "+aType+", button "+button+", twoFingerScrollGesture "+gesture2FingerScrl);
+ System.err.println("createMouseEvent: collect ptr-data [0.."+(pCount-1)+", count "+pCount+", action "+pIndex+"], aType "+aType+", button "+button);
}
- int j = 0;
- // Always put action-pointer data at index 0
- collectPointerData(event, pIndex, j++, x, y, pressure, pointerIds, pointerTypes);
for(int i=0; i < pCount; i++) {
- if( pIndex != i ) {
- collectPointerData(event, i, j++, x, y, pressure, pointerIds, pointerTypes);
- }
- }
- }
-
- if(null!=newtSource) {
- if(newtSource.isPointerConfined()) {
- modifiers |= InputEvent.CONFINED_MASK;
- }
- if(!newtSource.isPointerVisible()) {
- modifiers |= InputEvent.INVISIBLE_MASK;
- }
- }
-
- final Object src = (null==newtSource)?null:(Object)newtSource;
- final long unixTime = System.currentTimeMillis() + ( event.getEventTime() - android.os.SystemClock.uptimeMillis() );
-
- final com.jogamp.newt.event.MouseEvent me1 = new com.jogamp.newt.event.MouseEvent(
- nType, src, unixTime,
- modifiers, x, y, pressure, maxPressure, pointerTypes, pointerIds,
- clickCount, button, rotationXYZ, rotationScale);
-
- if( com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_RELEASED == nType ) {
- return new com.jogamp.newt.event.MouseEvent[] { me1,
- new com.jogamp.newt.event.MouseEvent(
- com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_CLICKED,
- src, unixTime, modifiers, x, y, pressure, maxPressure, pointerTypes, pointerIds,
- clickCount, button, rotationXYZ, rotationScale) };
- } else {
- return new com.jogamp.newt.event.MouseEvent[] { me1 };
- }
- }
- return null; // no mapping ..
- }
-
- static interface GestureHandler {
- /**
- * Returns true if last on* command produced a gesture, otherwise false.
- * @param clear if true, method clears the gesture flag.
- */
- public boolean hasGesture(boolean clear);
- /** Returns true if the gesture has started */
- public boolean gestureStarted();
- /** Returns distance of the last consecutive double-tab scrolling. */
- public float[] getScrollDistanceXY();
- public void onDown(android.view.MotionEvent e);
- public void onUp(android.view.MotionEvent e);
- public void onMove(android.view.MotionEvent e);
- }
-
- /**
- * Criteria related to Android parameter:
- * - ScaledDoubleTapSlop:
- * - Max 2 finger distance to start 'scroll' mode
- *
- * - ScaledTouchSlop:
- * - Min. movement w/ 2 pointer withing ScaledDoubleTapSlop starting 'scroll' mode
- * - Max. distance growth in respect to initiated 2-finger distance.
- *
- * - Tolerate temporary lift of 1/2 pointer
- *
- * - Always validate pointer-id
- */
- private final GestureHandler gesture2FingerScrl = new GestureHandler() {
- private final float[] scrollDistance = new float[] { 0f, 0f };
- private int[] pIds = new int[] { -1, -1 };
- private int startDist = -1;
- private float downY = 0;
- private float downX = 0;
- private float lastY = 0;
- private float lastX = 0;
- private int pointerDownCount = 0;
- private boolean withinGesture = false;
- private boolean hasGesture = false;
-
- public String toString() {
- return "Gesture2FingerScrl[in "+withinGesture+", has "+hasGesture+", pc "+pointerDownCount+"]";
- }
-
- private void clear() {
- downX = 0f;
- downY = 0f;
- lastX = 0f;
- lastY = 0f;
- startDist = -1;
- withinGesture = false;
- hasGesture = false;
- pIds[0] = -1;
- pIds[1] = -1;
- }
-
- private final int getSquareDistance(float x1, float y1, float x2, float y2) {
- final int deltaX = (int) x1 - (int) x2;
- final int deltaY = (int) y1 - (int) y2;
- return deltaX * deltaX + deltaY * deltaY;
- }
-
- private int gesturePointers(final android.view.MotionEvent e, final int excludeIndex) {
- int j = 0;
- for(int i=e.getPointerCount()-1; i>=0; i--) {
- if( excludeIndex != i ) {
- final int id = e.getPointerId(i);
- if( pIds[0] == id || pIds[1] == id ) {
- j++;
- }
+ collectPointerData(event, i, x, y, pressure, pointerIds, pointerTypes);
}
}
- return j;
- }
-
- @Override
- public boolean gestureStarted() {
- return 0 <= startDist && withinGesture;
- }
-
- @Override
- public boolean hasGesture(boolean clear) {
- final boolean r = hasGesture;
- if( clear ) {
- hasGesture = false;
- }
- return r;
- }
-
- @Override
- public final float[] getScrollDistanceXY() {
- return scrollDistance;
+ newtSource.doPointerEvent(enqueue, wait, pointerTypes, nType, modifiers,
+ pIndex, pointerIds, x, y, pressure, maxPressure, rotationXYZ, rotationScale);
+ return true;
}
-
- @Override
- public void onDown(android.view.MotionEvent e) {
- pointerDownCount = e.getPointerCount();
- final int gPtr = gesturePointers(e, -1);
- if( 2 <= gPtr ) { // pick-up dLast coordinate to cont. gesture after temp loosing 1/2 pointers
- lastX = e.getX(0);
- lastY = e.getY(0);
- }
- if(DEBUG_MOUSE_EVENT) {
- System.err.println(this+".onDown: gPtr "+gPtr+", "+e);
- }
- }
-
- @Override
- public void onUp(android.view.MotionEvent e) {
- pointerDownCount = e.getPointerCount();
- final int gPtr = gesturePointers(e, e.getActionIndex()); // w/o lifted pointer
- if( 1 > gPtr ) { // tolerate lifting 1/2 gesture pointers temporary
- clear();
- }
- pointerDownCount--; // lifted now!
- if(DEBUG_MOUSE_EVENT) {
- System.err.println(this+".onUp: gPtr "+gPtr+", "+e);
- }
- }
-
- @Override
- public void onMove(android.view.MotionEvent e) {
- pointerDownCount = e.getPointerCount();
- if( 2 <= pointerDownCount ) {
- final float x0 = e.getX(0);
- final float y0 = e.getY(0);
- final int sqDist = getSquareDistance(x0, y0, e.getX(1), e.getY(1));
- final boolean isDistWithinDoubleTapSlop = sqDist < doubleTapSlopSquare;
- final int dist = (int)Math.sqrt(sqDist);
- if( !withinGesture ) {
- int gPtr = 0;
- if( isDistWithinDoubleTapSlop ) {
- if( 0 > startDist ) {
- gPtr = 2;
- pIds[0] = e.getPointerId(0);
- pIds[1] = e.getPointerId(1);
- downX = x0;
- downY = y0;
- lastX = x0;
- lastY = y0;
- startDist = dist;
- } else {
- gPtr = gesturePointers(e, -1);
- if( 2 <= gPtr ) {
- final int dX = (int) (x0 - downX);
- final int dY = (int) (y0 - downY);
- final int d = (dX * dX) + (dY * dY);
- withinGesture = d > touchSlopSquare;
- }
- }
- }
- if(DEBUG_MOUSE_EVENT) {
- final double dX = x0 - downX;
- final double dY = y0 - downY;
- final double d = Math.sqrt( (dX * dX) + (dY * dY) );
- System.err.println(this+".onMove.0: mDist "+d+", pStartDist "+dist+", gPtr "+gPtr+", distWithin2DTSlop "+isDistWithinDoubleTapSlop+", dLast "+lastX+"/"+lastY+", "+e);
- }
- }
- if( withinGesture ) {
- final int gPtr = gesturePointers(e, -1);
- final boolean isDistGrowthWithinTouchSlop = dist - startDist <= touchSlop;
- if( 2 > gPtr || !isDistGrowthWithinTouchSlop ) {
- clear();
- } else {
- scrollDistance[0] = lastX - x0;
- scrollDistance[1] = lastY - y0;
- lastX = x0;
- lastY = y0;
- hasGesture = true;
- }
- if(DEBUG_MOUSE_EVENT) {
- System.err.println(this+".onMove.1: pStartDist "+startDist+", pDist "+dist+", gPtr "+gPtr+" ["+pIds[0]+", "+pIds[1]+"]"+
- ", distWithin2DTSlop "+isDistWithinDoubleTapSlop+", distGrowthWithinTSlop "+isDistGrowthWithinTouchSlop+
- ", dLast "+lastX+"/"+lastY+", d "+scrollDistance[0]+"/"+scrollDistance[1]+", "+e);
- }
- }
- }
- }
- };
+ return false; // no mapping ..
+ }
}
diff --git a/src/newt/classes/jogamp/newt/driver/android/event/AndroidNewtEventTranslator.java b/src/newt/classes/jogamp/newt/driver/android/event/AndroidNewtEventTranslator.java
index 9373586..5a4743f 100644
--- a/src/newt/classes/jogamp/newt/driver/android/event/AndroidNewtEventTranslator.java
+++ b/src/newt/classes/jogamp/newt/driver/android/event/AndroidNewtEventTranslator.java
@@ -13,13 +13,10 @@ public class AndroidNewtEventTranslator implements View.OnKeyListener, View.OnTo
}
private final boolean processTouchMotionEvents(View v, android.view.MotionEvent event, boolean isOnTouchEvent) {
- final com.jogamp.newt.event.MouseEvent[] newtEvents = factory.createMouseEvents(isOnTouchEvent, event, newtWindow);
- if(null != newtEvents) {
- newtWindow.focusChanged(false, true);
- for(int i=0; i<newtEvents.length; i++) {
- newtWindow.enqueueEvent(false, newtEvents[i]);
- }
- try { Thread.sleep((long) (1000.0F/30.0F)); }
+ final boolean eventSent = factory.sendPointerEvent(true /*enqueue*/, false /*wait*/, true /*setFocusOnDown*/,
+ isOnTouchEvent, event, newtWindow);
+ if( eventSent ) {
+ try { Thread.sleep((long) (100.0F/3.0F)); } // 33 ms - FIXME ??
catch(InterruptedException e) { }
return true; // consumed/handled, further interest in events
}
diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java b/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java
index 9a16321..f7722c9 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.awt;
@@ -100,13 +100,14 @@ public class AWTCanvas extends Canvas {
@Override
public void paint(Graphics g) {
}
-
+
public boolean hasDeviceChanged() {
boolean res = displayConfigChanged;
displayConfigChanged=false;
return res;
}
+ @Override
public void addNotify() {
/**
@@ -154,12 +155,13 @@ public class AWTCanvas extends Canvas {
public NativeWindow getNativeWindow() {
final JAWTWindow _jawtWindow = jawtWindow;
return (null != _jawtWindow) ? _jawtWindow : null;
- }
-
+ }
+
public boolean isOffscreenLayerSurfaceEnabled() {
- return null != jawtWindow ? jawtWindow.isOffscreenLayerSurfaceEnabled() : false;
+ return null != jawtWindow ? jawtWindow.isOffscreenLayerSurfaceEnabled() : false;
}
-
+
+ @Override
public void removeNotify() {
try {
dispose();
@@ -188,19 +190,20 @@ public class AWTCanvas extends Canvas {
}
}
}
-
+
private String getThreadName() { return Thread.currentThread().getName(); }
/**
* Overridden to choose a GraphicsConfiguration on a parent container's
* GraphicsDevice because both devices
*/
+ @Override
public GraphicsConfiguration getGraphicsConfiguration() {
/*
* Workaround for problems with Xinerama and java.awt.Component.checkGD
* when adding to a container on a different graphics device than the
* one that this Canvas is associated with.
- *
+ *
* GC will be null unless:
* - A native peer has assigned it. This means we have a native
* peer, and are already comitted to a graphics configuration.
@@ -214,7 +217,7 @@ public class AWTCanvas extends Canvas {
* chosen is only non-null on platforms where the GLDrawableFactory
* returns a non-null GraphicsConfiguration (in the GLCanvas
* constructor).
- *
+ *
* if gc is from this Canvas' native peer then it should equal chosen,
* otherwise it is from an ancestor component that this Canvas is being
* added to, and we go into this block.
@@ -224,21 +227,21 @@ public class AWTCanvas extends Canvas {
* Check for compatibility with gc. If they differ by only the
* device then return a new GCconfig with the super-class' GDevice
* (and presumably the same visual ID in Xinerama).
- *
+ *
*/
if (!chosen.getDevice().getIDstring().equals(gc.getDevice().getIDstring())) {
/*
* Here we select a GraphicsConfiguration on the alternate
* device that is presumably identical to the chosen
* configuration, but on the other device.
- *
+ *
* Should really check to ensure that we select a configuration
* with the same X visual ID for Xinerama screens, otherwise the
* GLDrawable may have the wrong visual ID (I don't think this
* ever gets updated). May need to add a method to
* X11GLDrawableFactory to do this in a platform specific
* manner.
- *
+ *
* However, on platforms where we can actually get into this
* block, both devices should have the same visual list, and the
* same configuration should be selected here.
@@ -265,7 +268,7 @@ public class AWTCanvas extends Canvas {
chosen = compatible;
if( !config.getChosenCapabilities().equals(awtConfig.getChosenCapabilities())) {
displayConfigChanged=true;
- }
+ }
awtConfig = config;
}
}
@@ -275,7 +278,7 @@ public class AWTCanvas extends Canvas {
* return the GC that was selected in the constructor (and might
* cause an exception in Component.checkGD when adding to a
* container, but in this case that would be the desired behavior).
- *
+ *
*/
return chosen;
} else if (gc == null) {
@@ -299,7 +302,7 @@ public class AWTCanvas extends Canvas {
CapabilitiesImmutable capsRequested,
CapabilitiesChooser chooser,
GraphicsDevice device) {
- final AbstractGraphicsScreen aScreen = null != device ?
+ final AbstractGraphicsScreen aScreen = null != device ?
AWTGraphicsScreen.createScreenDevice(device, AbstractGraphicsDevice.DEFAULT_UNIT):
AWTGraphicsScreen.createDefault();
AWTGraphicsConfiguration config = (AWTGraphicsConfiguration)
@@ -324,6 +327,7 @@ public class AWTCanvas extends Canvas {
if (!disableBackgroundEraseInitialized) {
try {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ @Override
public Object run() {
try {
Class<?> clazz = getToolkit().getClass();
diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java
index 80c72c0..4a71933 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java
@@ -40,9 +40,9 @@ import jogamp.newt.Debug;
public class AWTEDTUtil implements EDTUtil {
public static final boolean DEBUG = Debug.debug("EDT");
-
+
private final Object edtLock = new Object(); // locking the EDT start/stop state
- private final ThreadGroup threadGroup;
+ private final ThreadGroup threadGroup;
private final String name;
private final Runnable dispatchMessages;
private NEDT nedt = null;
@@ -66,9 +66,9 @@ public class AWTEDTUtil implements EDTUtil {
final public void setPollPeriod(long ms) {
pollPeriod = ms;
}
-
+
@Override
- public final boolean restart() throws IllegalStateException {
+ public final boolean start() throws IllegalStateException {
synchronized(edtLock) {
if( nedt.isRunning() ) {
throw new IllegalStateException("EDT still running and not subject to stop. Curr "+Thread.currentThread().getName()+", NEDT "+nedt.getName()+", isRunning "+nedt.isRunning+", shouldStop "+nedt.shouldStop+", on AWT-EDT "+EventQueue.isDispatchThread());
@@ -107,12 +107,12 @@ public class AWTEDTUtil implements EDTUtil {
public final boolean isCurrentThreadNEDT() {
return nedt == Thread.currentThread();
}
-
+
@Override
public final boolean isCurrentThreadEDTorNEDT() {
- return EventQueue.isDispatchThread() || nedt == Thread.currentThread();
+ return EventQueue.isDispatchThread() || nedt == Thread.currentThread();
}
-
+
@Override
final public boolean isRunning() {
return nedt.isRunning() ;
@@ -127,12 +127,12 @@ public class AWTEDTUtil implements EDTUtil {
public final boolean invoke(boolean wait, Runnable task) {
return invokeImpl(wait, task, false);
}
-
+
private static Runnable nullTask = new Runnable() {
@Override
- public void run() { }
+ public void run() { }
};
-
+
private final boolean invokeImpl(boolean wait, Runnable task, boolean stop) {
Throwable throwable = null;
RunnableTask rTask = null;
@@ -145,7 +145,7 @@ public class AWTEDTUtil implements EDTUtil {
if(DEBUG) {
Thread.dumpStack();
}
- return false;
+ return false;
}
if( isCurrentThreadEDT() ) {
if(null != task) {
@@ -181,7 +181,7 @@ public class AWTEDTUtil implements EDTUtil {
if(null != task) {
rTask = new RunnableTask(task,
wait ? rTaskLock : null,
- true /* always catch and report Exceptions, don't disturb EDT */,
+ true /* always catch and report Exceptions, don't disturb EDT */,
wait ? null : System.err);
AWTEDTExecutor.singleton.invoke(false, rTask);
}
@@ -205,7 +205,7 @@ public class AWTEDTUtil implements EDTUtil {
}
return true;
}
- }
+ }
@Override
final public boolean waitUntilIdle() {
@@ -218,6 +218,7 @@ public class AWTEDTUtil implements EDTUtil {
}
try {
AWTEDTExecutor.singleton.invoke(true, new Runnable() {
+ @Override
public void run() { }
});
} catch (Exception e) { }
@@ -241,7 +242,7 @@ public class AWTEDTUtil implements EDTUtil {
}
}
}
-
+
class NEDT extends Thread {
volatile boolean shouldStop = false;
volatile boolean isRunning = false;
@@ -261,7 +262,7 @@ public class AWTEDTUtil implements EDTUtil {
super.start();
}
- /**
+ /**
* Utilizing locking only on tasks and its execution,
* not for event dispatching.
*/
@@ -302,7 +303,7 @@ public class AWTEDTUtil implements EDTUtil {
}
} finally {
if(DEBUG) {
- System.err.println(getName()+": AWT-EDT run() END "+ getName()+", "+error);
+ System.err.println(getName()+": AWT-EDT run() END "+ getName()+", "+error);
}
synchronized(edtLock) {
isRunning = false;
@@ -317,7 +318,7 @@ public class AWTEDTUtil implements EDTUtil {
} // finally
} // run()
} // EventDispatchThread
-
+
}
diff --git a/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java
index 30449f9..d9a4a48 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.awt;
@@ -46,6 +46,7 @@ public class DisplayDriver extends DisplayImpl {
public DisplayDriver() {
}
+ @Override
protected void createNativeImpl() {
aDevice = AWTGraphicsDevice.createDefault();
}
@@ -54,10 +55,11 @@ public class DisplayDriver extends DisplayImpl {
aDevice = d;
}
+ @Override
protected EDTUtil createEDTUtil() {
final EDTUtil def;
if(NewtFactory.useEDT()) {
- def = new AWTEDTUtil(Thread.currentThread().getThreadGroup(), "AWTDisplay-"+getFQName(), dispatchMessagesRunnable);
+ def = new AWTEDTUtil(Thread.currentThread().getThreadGroup(), "AWTDisplay-"+getFQName(), dispatchMessagesRunnable);
if(DEBUG) {
System.err.println("Display.createNative("+getFQName()+") Create EDTUtil: "+def.getClass().getName());
}
@@ -67,10 +69,12 @@ public class DisplayDriver extends DisplayImpl {
return def;
}
- protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
+ @Override
+ protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
aDevice.close();
}
+ @Override
protected void dispatchMessagesNative() { /* nop */ }
}
diff --git a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java
index 126143e..a435670 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java
@@ -1,21 +1,21 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. 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
@@ -28,7 +28,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.awt;
@@ -49,6 +49,7 @@ public class ScreenDriver extends ScreenImpl {
public ScreenDriver() {
}
+ @Override
protected void createNativeImpl() {
aScreen = new AWTGraphicsScreen((AWTGraphicsDevice)display.getGraphicsDevice());
}
@@ -65,11 +66,13 @@ public class ScreenDriver extends ScreenImpl {
super.updateVirtualScreenOriginAndSize();
}
+ @Override
protected void closeNativeImpl() { }
-
+
+ @Override
protected int validateScreenIndex(int idx) {
- return idx; // pass through ...
- }
+ return idx; // pass through ...
+ }
private static MonitorMode getModeProps(Cache cache, DisplayMode mode) {
int rate = mode.getRefreshRate();
@@ -90,16 +93,16 @@ public class ScreenDriver extends ScreenImpl {
props[i++] = 0; // flags
props[i++] = 0; // mode_idx
props[i++] = 0; // rotation
- return MonitorModeProps.streamInMonitorMode(null, cache, props, 0);
+ return MonitorModeProps.streamInMonitorMode(null, cache, props, 0);
}
-
+
@Override
protected void collectNativeMonitorModesAndDevicesImpl(Cache cache) {
final GraphicsDevice awtGD = ((AWTGraphicsDevice)getDisplay().getGraphicsDevice()).getGraphicsDevice();
final DisplayMode[] awtModes = awtGD.getDisplayModes();
for(int i=0; i<awtModes.length; i++) {
getModeProps(cache, awtModes[i]);
- }
+ }
final MonitorMode currentMode = getModeProps(cache, awtGD.getDisplayMode());
int[] props = new int[MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES - 1 - MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES];
@@ -116,7 +119,7 @@ public class ScreenDriver extends ScreenImpl {
}
@Override
- protected MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor) {
+ protected MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor) {
return null;
}
@@ -124,5 +127,5 @@ public class ScreenDriver extends ScreenImpl {
protected boolean setCurrentMonitorModeImpl(MonitorDevice monitor, MonitorMode mode) {
return false;
}
-
+
}
diff --git a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java
index c45a5ae..9854524 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.awt;
@@ -86,6 +86,7 @@ public class WindowDriver extends WindowImpl {
private Frame awtFrame = null;
private AWTCanvas awtCanvas;
+ @Override
protected void requestFocusImpl(boolean reparented) {
awtContainer.requestFocus();
}
@@ -97,6 +98,7 @@ public class WindowDriver extends WindowImpl {
}
}
+ @Override
protected void createNativeImpl() {
if(0!=getParentWindowHandle()) {
throw new RuntimeException("Window parenting not supported in AWT, use AWTWindow(Frame) cstr for wrapping instead");
@@ -109,37 +111,38 @@ public class WindowDriver extends WindowImpl {
} else {
owningFrame=false;
defineSize(awtContainer.getWidth(), awtContainer.getHeight());
- definePosition(awtContainer.getX(), awtContainer.getY());
+ definePosition(awtContainer.getX(), awtContainer.getY());
}
if(null!=awtFrame) {
awtFrame.setTitle(getTitle());
}
awtContainer.setLayout(new BorderLayout());
-
+
if( null == awtCanvas ) {
awtCanvas = new AWTCanvas(capsRequested, WindowDriver.this.capabilitiesChooser);
// canvas.addComponentListener(listener);
awtContainer.add(awtCanvas, BorderLayout.CENTER);
-
+
// via EDT ..
new AWTMouseAdapter(this).addTo(awtCanvas); // fwd all AWT Mouse events to here
new AWTKeyAdapter(this).addTo(awtCanvas); // fwd all AWT Key events to here
-
+
// direct w/o EDT
new AWTWindowAdapter(new LocalWindowListener(), this).addTo(awtCanvas); // fwd all AWT Window events to here
}
reconfigureWindowImpl(getX(), getY(), getWidth(), getHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY | FLAG_CHANGE_DECORATION, true));
// throws exception if failed ..
-
+
final NativeWindow nw = awtCanvas.getNativeWindow();
if( null != nw ) {
- setGraphicsConfiguration( awtCanvas.getAWTGraphicsConfiguration() );
+ setGraphicsConfiguration( awtCanvas.getAWTGraphicsConfiguration() );
setWindowHandle( nw.getWindowHandle() );
}
}
+ @Override
protected void closeNativeImpl() {
setWindowHandle(0);
if(null!=awtContainer) {
@@ -153,7 +156,7 @@ public class WindowDriver extends WindowImpl {
owningFrame=false;
}
awtCanvas = null;
- awtFrame = null;
+ awtFrame = null;
awtContainer = null;
}
@@ -166,22 +169,20 @@ public class WindowDriver extends WindowImpl {
throw new NativeWindowException("Error Device change null GraphicsConfiguration: "+this);
}
setGraphicsConfiguration(cfg);
-
+
// propagate new info ..
((ScreenDriver)getScreen()).setAWTGraphicsScreen((AWTGraphicsScreen)cfg.getScreen());
((DisplayDriver)getScreen().getDisplay()).setAWTGraphicsDevice((AWTGraphicsDevice)cfg.getScreen().getDevice());
-
+
((ScreenDriver)getScreen()).updateVirtualScreenOriginAndSize();
}
return res;
}
+ @Override
protected void updateInsetsImpl(javax.media.nativewindow.util.Insets insets) {
- Insets contInsets = awtContainer.getInsets();
- insets.setLeftWidth(contInsets.left);
- insets.setRightWidth(contInsets.right);
- insets.setTopHeight(contInsets.top);
- insets.setBottomHeight(contInsets.bottom);
+ final Insets contInsets = awtContainer.getInsets();
+ insets.set(contInsets.left, contInsets.right, contInsets.top, contInsets.bottom);
}
private void setCanvasSizeImpl(int width, int height) {
@@ -216,7 +217,8 @@ public class WindowDriver extends WindowImpl {
awtCanvas.invalidate();
awtContainer.validate();
}
-
+
+ @Override
protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("AWTWindow reconfig: "+x+"/"+y+" "+width+"x"+height+", "+
@@ -231,7 +233,7 @@ public class WindowDriver extends WindowImpl {
}
}
}
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
if( 0 != ( FLAG_IS_VISIBLE & flags) ) {
setCanvasSizeImpl(width, height);
@@ -247,15 +249,15 @@ public class WindowDriver extends WindowImpl {
}
}
defineSize(width, height); // we are on AWT-EDT .. change values immediately
-
+
if( awtContainer.getX() != x || awtContainer.getY() != y ) {
awtContainer.setLocation(x, y);
}
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
if( 0 != ( FLAG_IS_VISIBLE & flags ) ) {
if( !hasDeviceChanged() ) {
- // oops ??
+ // oops ??
final AWTGraphicsConfiguration cfg = awtCanvas.getAWTGraphicsConfiguration();
if(null == cfg) {
throw new NativeWindowException("Error: !hasDeviceChanged && null == GraphicsConfiguration: "+this);
@@ -265,22 +267,23 @@ public class WindowDriver extends WindowImpl {
}
visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
-
+
return true;
}
+ @Override
protected Point getLocationOnScreenImpl(int x, int y) {
java.awt.Point ap = awtCanvas.getLocationOnScreen();
ap.translate(x, y);
return new Point((int)(ap.getX()+0.5),(int)(ap.getY()+0.5));
}
-
+
@Override
public NativeSurface getWrappedSurface() {
return ( null != awtCanvas ) ? awtCanvas.getNativeWindow() : null;
}
- class LocalWindowListener implements com.jogamp.newt.event.WindowListener {
+ class LocalWindowListener implements com.jogamp.newt.event.WindowListener {
@Override
public void windowMoved(com.jogamp.newt.event.WindowEvent e) {
if(null!=awtContainer) {
@@ -307,11 +310,11 @@ public class WindowDriver extends WindowImpl {
}
@Override
public void windowGainedFocus(WindowEvent e) {
- WindowDriver.this.focusChanged(false, true);
+ WindowDriver.this.focusChanged(false, true);
}
@Override
public void windowLostFocus(WindowEvent e) {
- WindowDriver.this.focusChanged(false, false);
+ WindowDriver.this.focusChanged(false, false);
}
@Override
public void windowRepaint(WindowUpdateEvent e) {
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 112be2b..9da671d 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.bcm.egl;
@@ -61,6 +61,7 @@ public class DisplayDriver extends jogamp.newt.DisplayImpl {
public DisplayDriver() {
}
+ @Override
protected void createNativeImpl() {
final long handle = CreateDisplay(ScreenDriver.fixedWidth, ScreenDriver.fixedHeight);
if (handle == EGL.EGL_NO_DISPLAY) {
@@ -69,6 +70,7 @@ public class DisplayDriver extends jogamp.newt.DisplayImpl {
aDevice = new EGLGraphicsDevice(EGL.EGL_DEFAULT_DISPLAY, handle, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT, null);
}
+ @Override
protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
if (aDevice.getHandle() != EGL.EGL_NO_DISPLAY) {
DestroyDisplay(aDevice.getHandle());
@@ -76,6 +78,7 @@ public class DisplayDriver extends jogamp.newt.DisplayImpl {
aDevice.close();
}
+ @Override
protected void dispatchMessagesNative() {
// n/a .. DispatchMessages();
}
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 afaedff..d323155 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.bcm.egl;
@@ -53,16 +53,19 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
public ScreenDriver() {
}
+ @Override
protected void createNativeImpl() {
aScreen = new DefaultGraphicsScreen(getDisplay().getGraphicsDevice(), screen_idx);
}
+ @Override
protected void closeNativeImpl() { }
+ @Override
protected int validateScreenIndex(int idx) {
- return 0; // only one screen available
+ return 0; // only one screen available
}
-
+
@Override
protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) {
int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ];
@@ -99,14 +102,12 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
protected boolean setCurrentMonitorModeImpl(final MonitorDevice monitor, final MonitorMode mode) {
return false;
}
-
+
+ @Override
protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) {
- vOriginSize.setX(0);
- vOriginSize.setY(0);
- vOriginSize.setWidth(fixedWidth); // FIXME
- vOriginSize.setHeight(fixedHeight); // FIXME
+ vOriginSize.set(0, 0, fixedWidth, fixedHeight); // FIXME
}
-
+
//----------------------------------------------------------------------
// Internals only
//
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 49d3d98..39f168e 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.bcm.egl;
@@ -52,11 +52,12 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
public WindowDriver() {
}
+ @Override
protected void createNativeImpl() {
if(0!=getParentWindowHandle()) {
throw new RuntimeException("Window parenting not supported (yet)");
}
- // query a good configuration, however chose the final one by the native queried egl-cfg-id
+ // query a good configuration, however chose the final one by the native queried egl-cfg-id
// after creation at {@link #windowCreated(int, int, int)}.
final AbstractGraphicsConfiguration cfg = GraphicsConfigurationFactory.getFactory(getScreen().getDisplay().getGraphicsDevice(), capsRequested).chooseGraphicsConfiguration(
capsRequested, capsRequested, capabilitiesChooser, getScreen().getGraphicsScreen(), VisualIDHolder.VID_UNDEFINED);
@@ -72,12 +73,14 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
}
}
+ @Override
protected void closeNativeImpl() {
if(0!=windowHandleClose) {
CloseWindow(getDisplayHandle(), windowHandleClose);
}
}
+ @Override
protected void requestFocusImpl(boolean reparented) { }
protected void setSizeImpl(int width, int height) {
@@ -89,8 +92,9 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
}
}
- protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) {
- if(0!=getWindowHandle()) {
+ @Override
+ protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) {
+ if(0!=getWindowHandle()) {
if(0 != ( FLAG_CHANGE_FULLSCREEN & flags)) {
if( 0 != ( FLAG_IS_FULLSCREEN & flags) ) {
// n/a in BroadcomEGL
@@ -110,19 +114,21 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
if(x>=0 || y>=0) {
System.err.println("BCEGL Window.setPositionImpl n/a in BroadcomEGL");
}
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
return true;
}
+ @Override
protected Point getLocationOnScreenImpl(int x, int y) {
return new Point(x,y);
}
+ @Override
protected void updateInsetsImpl(Insets insets) {
- // nop ..
+ // nop ..
}
@Override
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 4872a90..d8d93f1 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -59,20 +59,23 @@ public class DisplayDriver extends DisplayImpl {
public DisplayDriver() {
}
+ @Override
protected void createNativeImpl() {
// FIXME: map name to EGL_*_DISPLAY
aDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(EGL.EGL_DEFAULT_DISPLAY, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT);
}
+ @Override
protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
aDevice.close();
}
+ @Override
protected void dispatchMessagesNative() {
DispatchMessages();
}
- protected static native boolean initIDs();
+ protected static native boolean initIDs();
private native void DispatchMessages();
}
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 f7973de..dc2a845 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -45,17 +45,20 @@ public class ScreenDriver extends ScreenImpl {
public ScreenDriver() {
}
+ @Override
protected void createNativeImpl() {
aScreen = new DefaultGraphicsScreen(getDisplay().getGraphicsDevice(), screen_idx);
initNative();
}
+ @Override
protected void closeNativeImpl() { }
+ @Override
protected int validateScreenIndex(int idx) {
- return 0; // only one screen available
- }
-
+ return 0; // only one screen available
+ }
+
@Override
protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) {
int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ];
@@ -92,23 +95,20 @@ public class ScreenDriver extends ScreenImpl {
protected boolean setCurrentMonitorModeImpl(final MonitorDevice monitor, final MonitorMode mode) {
return false;
}
-
+
@Override
protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) {
- vOriginSize.setX(0);
- vOriginSize.setY(0);
- vOriginSize.setWidth(cachedWidth);
- vOriginSize.setHeight(cachedHeight);
+ vOriginSize.set(0, 0, cachedWidth, cachedHeight);
}
-
+
/** Called from {@link #initNative()}. */
protected void setScreenSize(int width, int height) {
cachedWidth = width;
cachedHeight = height;
}
-
+
private static int cachedWidth = 0;
- private static int cachedHeight = 0;
+ private static int cachedHeight = 0;
protected static native boolean initIDs();
protected native void initNative();
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 e820439..4d49777 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -55,6 +55,7 @@ public class WindowDriver extends WindowImpl {
public WindowDriver() {
}
+ @Override
protected void createNativeImpl() {
if(0!=getParentWindowHandle()) {
throw new RuntimeException("Window parenting not supported (yet)");
@@ -65,7 +66,7 @@ public class WindowDriver extends WindowImpl {
final EGLGraphicsDevice aDevice = (EGLGraphicsDevice) aScreen.getDevice();
final EGLGraphicsDevice eglDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(aDevice.getNativeDisplayID(), aDevice.getConnection(), aDevice.getUnitID());
final DefaultGraphicsScreen eglScreen = new DefaultGraphicsScreen(eglDevice, aScreen.getIndex());
-
+
final AbstractGraphicsConfiguration cfg = GraphicsConfigurationFactory.getFactory(getScreen().getDisplay().getGraphicsDevice(), capsRequested).chooseGraphicsConfiguration(
capsRequested, capsRequested, capabilitiesChooser, eglScreen, VisualIDHolder.VID_UNDEFINED);
if (null == cfg) {
@@ -89,33 +90,36 @@ public class WindowDriver extends WindowImpl {
windowHandleClose = nativeWindowHandle;
addWindowListener(LinuxMouseTracker.getSingleton());
addWindowListener(LinuxEventDeviceTracker.getSingleton());
- focusChanged(false, true);
+ focusChanged(false, true);
}
+ @Override
protected void closeNativeImpl() {
final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) getGraphicsConfiguration().getScreen().getDevice();
-
+
removeWindowListener(LinuxMouseTracker.getSingleton());
removeWindowListener(LinuxEventDeviceTracker.getSingleton());
-
+
if(0!=windowHandleClose) {
CloseWindow(windowHandleClose, windowUserData);
windowUserData=0;
}
-
+
eglDevice.close();
}
- protected void requestFocusImpl(boolean reparented) {
+ @Override
+ protected void requestFocusImpl(boolean reparented) {
focusChanged(false, true);
}
+ @Override
protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) {
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
setVisible0(nativeWindowHandle, 0 != ( FLAG_IS_VISIBLE & flags));
visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
-
+
if(0!=nativeWindowHandle) {
if(0 != ( FLAG_CHANGE_FULLSCREEN & flags)) {
final boolean fs = 0 != ( FLAG_IS_FULLSCREEN & flags) ;
@@ -135,22 +139,24 @@ public class WindowDriver extends WindowImpl {
System.err.println("setPosition n/a in KD");
}
}
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
-
+
return true;
}
+ @Override
protected Point getLocationOnScreenImpl(int x, int y) {
return new Point(x,y);
}
+ @Override
protected void updateInsetsImpl(Insets insets) {
- // nop ..
+ // nop ..
}
-
+
//----------------------------------------------------------------------
// Internals only
//
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 ee93eb9..cc43554 100644
--- a/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.intel.gdl;
@@ -59,6 +59,7 @@ public class DisplayDriver extends jogamp.newt.DisplayImpl {
public DisplayDriver() {
}
+ @Override
protected void createNativeImpl() {
synchronized(DisplayDriver.class) {
if(0==initCounter) {
@@ -72,6 +73,7 @@ public class DisplayDriver extends jogamp.newt.DisplayImpl {
aDevice = new DefaultGraphicsDevice(NativeWindowFactory.TYPE_DEFAULT, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT, displayHandle);
}
+ @Override
protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
if(0==displayHandle) {
throw new NativeWindowException("displayHandle null; initCnt "+initCounter);
@@ -87,6 +89,7 @@ public class DisplayDriver extends jogamp.newt.DisplayImpl {
aDevice.close();
}
+ @Override
protected void dispatchMessagesNative() {
if(0!=displayHandle) {
DispatchMessages(displayHandle, focusedWindow);
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 4c47eb0..44802e3 100644
--- a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.intel.gdl;
@@ -53,18 +53,21 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
public ScreenDriver() {
}
+ @Override
protected void createNativeImpl() {
AbstractGraphicsDevice adevice = getDisplay().getGraphicsDevice();
GetScreenInfo(adevice.getHandle(), screen_idx);
aScreen = new DefaultGraphicsScreen(adevice, screen_idx);
}
+ @Override
protected void closeNativeImpl() { }
+ @Override
protected int validateScreenIndex(int idx) {
- return 0; // only one screen available
+ return 0; // only one screen available
}
-
+
@Override
protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) {
int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ];
@@ -101,14 +104,12 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
protected boolean setCurrentMonitorModeImpl(final MonitorDevice monitor, final MonitorMode mode) {
return false;
}
-
+
+ @Override
protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) {
- vOriginSize.setX(0);
- vOriginSize.setY(0);
- vOriginSize.setWidth(cachedWidth);
- vOriginSize.setHeight(cachedHeight);
+ vOriginSize.set(0, 0, cachedWidth, cachedHeight);
}
-
+
//----------------------------------------------------------------------
// Internals only
//
@@ -121,7 +122,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
cachedWidth = width;
cachedHeight = height;
}
-
+
private static int cachedWidth = 0;
private static int cachedHeight = 0;
}
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 98335f1..0e96c65 100644
--- a/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.intel.gdl;
@@ -48,6 +48,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
static long nextWindowHandle = 1;
+ @Override
protected void createNativeImpl() {
if(0!=getParentWindowHandle()) {
throw new NativeWindowException("GDL Window does not support window parenting");
@@ -72,6 +73,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
}
}
+ @Override
protected void closeNativeImpl() {
if(0!=surfaceHandle) {
synchronized(WindowDriver.class) {
@@ -82,6 +84,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
}
}
+ @Override
protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) {
ScreenDriver screen = (ScreenDriver) getScreen();
@@ -108,10 +111,11 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
}
visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
-
+
return true;
}
+ @Override
protected void requestFocusImpl(boolean reparented) {
((DisplayDriver)getScreen().getDisplay()).setFocus(this);
}
@@ -121,14 +125,16 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
return surfaceHandle;
}
+ @Override
protected Point getLocationOnScreenImpl(int x, int y) {
return new Point(x,y);
}
+ @Override
protected void updateInsetsImpl(Insets insets) {
- // nop ..
+ // nop ..
}
-
+
//----------------------------------------------------------------------
// Internals only
//
diff --git a/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java
index 3cd72e9..929688b 100644
--- a/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.kd;
@@ -59,15 +59,18 @@ public class DisplayDriver extends DisplayImpl {
public DisplayDriver() {
}
+ @Override
protected void createNativeImpl() {
// FIXME: map name to EGL_*_DISPLAY
aDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(EGL.EGL_DEFAULT_DISPLAY, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT);
}
+ @Override
protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
aDevice.close();
}
+ @Override
protected void dispatchMessagesNative() {
DispatchMessages();
}
diff --git a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java
index dc87c3c..9ebe262 100644
--- a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.kd;
@@ -51,16 +51,19 @@ public class ScreenDriver extends ScreenImpl {
public ScreenDriver() {
}
+ @Override
protected void createNativeImpl() {
aScreen = new DefaultGraphicsScreen(getDisplay().getGraphicsDevice(), screen_idx);
}
+ @Override
protected void closeNativeImpl() { }
+ @Override
protected int validateScreenIndex(int idx) {
- return 0; // only one screen available
- }
-
+ return 0; // only one screen available
+ }
+
@Override
protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) {
int[] props = new int[ MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL ];
@@ -97,19 +100,17 @@ public class ScreenDriver extends ScreenImpl {
protected boolean setCurrentMonitorModeImpl(final MonitorDevice monitor, final MonitorMode mode) {
return false;
}
-
+
+ @Override
protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) {
- vOriginSize.setX(0);
- vOriginSize.setY(0);
- vOriginSize.setWidth(cachedWidth);
- vOriginSize.setHeight(cachedHeight);
+ vOriginSize.set(0, 0, cachedWidth, cachedHeight);
}
-
+
protected void sizeChanged(int w, int h) {
cachedWidth = w;
cachedHeight = h;
}
-
+
private static int cachedWidth = 0;
- private static int cachedHeight = 0;
+ private static int cachedHeight = 0;
}
diff --git a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java
index c733a3e..158e6ab 100644
--- a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.kd;
@@ -56,6 +56,7 @@ public class WindowDriver extends WindowImpl {
public WindowDriver() {
}
+ @Override
protected void createNativeImpl() {
if(0!=getParentWindowHandle()) {
throw new RuntimeException("Window parenting not supported (yet)");
@@ -83,6 +84,7 @@ public class WindowDriver extends WindowImpl {
windowHandleClose = eglWindowHandle;
}
+ @Override
protected void closeNativeImpl() {
if(0!=windowHandleClose) {
CloseWindow(windowHandleClose, windowUserData);
@@ -90,14 +92,16 @@ public class WindowDriver extends WindowImpl {
}
}
+ @Override
protected void requestFocusImpl(boolean reparented) { }
+ @Override
protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) {
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
setVisible0(eglWindowHandle, 0 != ( FLAG_IS_VISIBLE & flags));
visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
-
+
if(0!=eglWindowHandle) {
if(0 != ( FLAG_CHANGE_FULLSCREEN & flags)) {
final boolean fs = 0 != ( FLAG_IS_FULLSCREEN & flags) ;
@@ -117,22 +121,24 @@ public class WindowDriver extends WindowImpl {
System.err.println("setPosition n/a in KD");
}
}
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
-
+
return true;
}
+ @Override
protected Point getLocationOnScreenImpl(int x, int y) {
return new Point(x,y);
}
+ @Override
protected void updateInsetsImpl(Insets insets) {
- // nop ..
+ // nop ..
}
-
+
//----------------------------------------------------------------------
// Internals only
//
diff --git a/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java b/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java
index e68b91d..b7c86a2 100644
--- a/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java
+++ b/src/newt/classes/jogamp/newt/driver/linux/LinuxEventDeviceTracker.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -126,7 +126,7 @@ public class LinuxEventDeviceTracker implements WindowListener {
try {
while(true) {
Thread.sleep(1000);
- }
+ }
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -186,7 +186,7 @@ public class LinuxEventDeviceTracker implements WindowListener {
/**
* The Linux input event interface.
* http://www.kernel.org/doc/Documentation/input/input.txt
- *
+ *
* struct input_event {
* struct timeval time;
* unsigned short type;
@@ -262,7 +262,7 @@ public class LinuxEventDeviceTracker implements WindowListener {
break;
case 1: // EV_KEY
keyCode = LinuxEVKey2NewtVKey(code); // The device independent code.
- keyChar = NewtVKey2Unicode(keyCode, modifiers); // The printable character w/ key modifiers.
+ keyChar = NewtVKey2Unicode(keyCode, modifiers); // The printable character w/ key modifiers.
if(Window.DEBUG_KEY_EVENT) {
System.out.println("[EV_KEY: [time "+timeSeconds+":"+timeSecondFraction+"] type "+type+" / code "+code+" = value "+value);
}
@@ -946,7 +946,7 @@ public class LinuxEventDeviceTracker implements WindowListener {
case 248: // mic mute
break; // FIXME
- default:
+ default:
}
if(Window.DEBUG_KEY_EVENT) {
diff --git a/src/newt/classes/jogamp/newt/driver/linux/LinuxMouseTracker.java b/src/newt/classes/jogamp/newt/driver/linux/LinuxMouseTracker.java
index 0d6278b..1e314b7 100644
--- a/src/newt/classes/jogamp/newt/driver/linux/LinuxMouseTracker.java
+++ b/src/newt/classes/jogamp/newt/driver/linux/LinuxMouseTracker.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -48,16 +48,16 @@ import com.jogamp.newt.event.WindowUpdateEvent;
* within it's own polling thread.
*/
public class LinuxMouseTracker implements WindowListener {
-
+
private static final LinuxMouseTracker lmt;
-
+
static {
lmt = new LinuxMouseTracker();
final Thread t = new Thread(lmt.mouseDevicePoller, "NEWT-LinuxMouseTracker");
t.setDaemon(true);
t.start();
}
-
+
public static LinuxMouseTracker getSingleton() {
return lmt;
}
@@ -71,7 +71,7 @@ public class LinuxMouseTracker implements WindowListener {
private short old_buttonDown = 0;
private WindowImpl focusedWindow = null;
private MouseDevicePoller mouseDevicePoller = new MouseDevicePoller();
-
+
@Override
public void windowResized(WindowEvent e) { }
@@ -107,7 +107,7 @@ public class LinuxMouseTracker implements WindowListener {
@Override
public void windowRepaint(WindowUpdateEvent e) { }
-
+
class MouseDevicePoller implements Runnable {
@Override
public void run() {
@@ -150,17 +150,17 @@ public class LinuxMouseTracker implements WindowListener {
yo=(b[0]&128)>0;
xd=b[1];
yd=b[2];
-
+
x+=xd;
y-=yd;
-
+
if(x<0) {
x=0;
}
if(y<0) {
y=0;
}
-
+
buttonDown = 0;
if(lb) {
buttonDown = MouseEvent.BUTTON1;
@@ -171,7 +171,7 @@ public class LinuxMouseTracker implements WindowListener {
if(rb) {
buttonDown = MouseEvent.BUTTON3;
}
-
+
if(null != focusedWindow) {
if( x >= focusedWindow.getScreen().getWidth() ) {
x = focusedWindow.getScreen().getWidth() - 1;
@@ -179,31 +179,31 @@ public class LinuxMouseTracker implements WindowListener {
if( y >= focusedWindow.getScreen().getHeight() ) {
y = focusedWindow.getScreen().getHeight() - 1;
}
- int wx = x - focusedWindow.getX(), wy = y - focusedWindow.getY();
-
+ int wx = x - focusedWindow.getX(), wy = y - focusedWindow.getY();
+
if(old_x != x || old_y != y) {
// mouse moved
- focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_MOVED, 0, wx, wy, (short)0, 0 );
+ focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_MOVED, 0, wx, wy, (short)0, 0 );
}
-
+
if(old_buttonDown != buttonDown) {
// press/release
if( 0 != buttonDown ) {
- focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_PRESSED, 0, wx, wy, buttonDown, 0 );
+ focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_PRESSED, 0, wx, wy, buttonDown, 0 );
} else {
- focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_RELEASED, 0, wx, wy, old_buttonDown, 0 );
+ focusedWindow.sendMouseEvent(MouseEvent.EVENT_MOUSE_RELEASED, 0, wx, wy, old_buttonDown, 0 );
}
- }
+ }
} else {
if(Window.DEBUG_MOUSE_EVENT) {
System.out.println(x+"/"+y+", hs="+hs+",vs="+vs+",lb="+lb+",rb="+rb+",mb="+mb+",xo="+xo+",yo="+yo+"xd="+xd+",yd="+yd);
}
}
-
+
old_x = x;
old_y = y;
old_buttonDown = buttonDown;
-
+
}
if(null != fis) {
try {
@@ -214,5 +214,5 @@ public class LinuxMouseTracker implements WindowListener {
}
}
}
- }
+ }
}
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java
index a99bc4f..c44685d 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2012 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.macosx;
@@ -60,19 +60,22 @@ public class DisplayDriver extends DisplayImpl {
public static void initSingleton() {
// just exist to ensure static init has been run
}
-
+
public DisplayDriver() {
}
+ @Override
protected void dispatchMessagesNative() {
// nop
}
-
+
+ @Override
protected void createNativeImpl() {
aDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
}
- protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
+ @Override
+ protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
aDevice.close();
}
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/MacKeyUtil.java b/src/newt/classes/jogamp/newt/driver/macosx/MacKeyUtil.java
index baa94fa..a89150d 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/MacKeyUtil.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/MacKeyUtil.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -30,7 +30,7 @@ package jogamp.newt.driver.macosx;
import com.jogamp.newt.event.KeyEvent;
public class MacKeyUtil {
-
+
//
// KeyCodes (Layout Dependent)
//
@@ -64,17 +64,17 @@ public class MacKeyUtil {
private static final short kVK_ANSI_8 = 0x1C;
private static final short kVK_ANSI_0 = 0x1D;
private static final short kVK_ANSI_RightBracket = 0x1E;
- private static final short kVK_ANSI_O = 0x1F;
+ private static final short kVK_ANSI_O = 0x1F;
private static final short kVK_ANSI_U = 0x20;
private static final short kVK_ANSI_LeftBracket = 0x21;
private static final short kVK_ANSI_I = 0x22;
private static final short kVK_ANSI_P = 0x23;
private static final short kVK_ANSI_L = 0x25;
private static final short kVK_ANSI_J = 0x26;
- private static final short kVK_ANSI_Quote = 0x27;
+ private static final short kVK_ANSI_Quote = 0x27;
private static final short kVK_ANSI_K = 0x28;
private static final short kVK_ANSI_Semicolon = 0x29;
- private static final short kVK_ANSI_Backslash = 0x2A;
+ private static final short kVK_ANSI_Backslash = 0x2A;
private static final short kVK_ANSI_Comma = 0x2B;
private static final short kVK_ANSI_Slash = 0x2C;
private static final short kVK_ANSI_N = 0x2D;
@@ -99,7 +99,7 @@ public class MacKeyUtil {
private static final short kVK_ANSI_Keypad7 = 0x59;
private static final short kVK_ANSI_Keypad8 = 0x5B;
private static final short kVK_ANSI_Keypad9 = 0x5C;
-
+
//
// KeyCodes (Layout Independent)
//
@@ -150,7 +150,7 @@ public class MacKeyUtil {
private static final short kVK_RightArrow = 0x7C;
private static final short kVK_DownArrow = 0x7D;
private static final short kVK_UpArrow = 0x7E;
-
+
//
// Key constants handled differently on Mac OS X than other platforms
//
@@ -230,8 +230,8 @@ public class MacKeyUtil {
private static final char NSHelpFunctionKey = 0xF746;
private static final char NSModeSwitchFunctionKey = 0xF747;
*/
-
- static short validateKeyCode(short keyCode, char keyChar) {
+
+ static short validateKeyCode(short keyCode, char keyChar) {
// OS X Virtual Keycodes
switch(keyCode) {
//
@@ -267,17 +267,17 @@ public class MacKeyUtil {
case kVK_ANSI_8: return KeyEvent.VK_8;
case kVK_ANSI_0: return KeyEvent.VK_0;
case kVK_ANSI_RightBracket: return KeyEvent.VK_CLOSE_BRACKET;
- case kVK_ANSI_O: return KeyEvent.VK_O;
+ case kVK_ANSI_O: return KeyEvent.VK_O;
case kVK_ANSI_U: return KeyEvent.VK_U;
case kVK_ANSI_LeftBracket: return KeyEvent.VK_OPEN_BRACKET;
case kVK_ANSI_I: return KeyEvent.VK_I;
case kVK_ANSI_P: return KeyEvent.VK_P;
case kVK_ANSI_L: return KeyEvent.VK_L;
case kVK_ANSI_J: return KeyEvent.VK_J;
- case kVK_ANSI_Quote: return KeyEvent.VK_QUOTE;
+ case kVK_ANSI_Quote: return KeyEvent.VK_QUOTE;
case kVK_ANSI_K: return KeyEvent.VK_K;
case kVK_ANSI_Semicolon: return KeyEvent.VK_SEMICOLON;
- case kVK_ANSI_Backslash: return KeyEvent.VK_BACK_SLASH;
+ case kVK_ANSI_Backslash: return KeyEvent.VK_BACK_SLASH;
case kVK_ANSI_Comma: return KeyEvent.VK_COMMA;
case kVK_ANSI_Slash: return KeyEvent.VK_SLASH;
case kVK_ANSI_N: return KeyEvent.VK_N;
@@ -302,7 +302,7 @@ public class MacKeyUtil {
case kVK_ANSI_Keypad7: return KeyEvent.VK_7;
case kVK_ANSI_Keypad8: return KeyEvent.VK_8;
case kVK_ANSI_Keypad9: return KeyEvent.VK_9;
-
+
//
// KeyCodes (Layout Independent)
//
@@ -321,7 +321,7 @@ public class MacKeyUtil {
case kVK_RightControl: return KeyEvent.VK_CONTROL;
// case kVK_Function: return KeyEvent.VK_F;
case kVK_F17: return KeyEvent.VK_F17;
- // case kVK_VolumeUp:
+ // case kVK_VolumeUp:
// case kVK_VolumeDown:
// case kVK_Mute:
case kVK_F18: return KeyEvent.VK_F18;
@@ -354,7 +354,7 @@ public class MacKeyUtil {
case kVK_DownArrow: return KeyEvent.VK_DOWN;
case kVK_UpArrow: return KeyEvent.VK_UP;
}
-
+
switch (keyChar) {
case NSUpArrowFunctionKey: return KeyEvent.VK_UP;
case NSDownArrowFunctionKey: return KeyEvent.VK_DOWN;
@@ -422,5 +422,5 @@ public class MacKeyUtil {
}
return (short) keyChar; // let's hope for the best (compatibility of keyChar/keyCode's)
- }
+ }
}
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java
index a3bb267..4f3cc69 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2011 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.macosx;
@@ -44,7 +44,7 @@ import com.jogamp.newt.MonitorDevice;
import com.jogamp.newt.MonitorMode;
public class ScreenDriver extends ScreenImpl {
-
+
static {
DisplayDriver.initSingleton();
}
@@ -52,10 +52,12 @@ public class ScreenDriver extends ScreenImpl {
public ScreenDriver() {
}
+ @Override
protected void createNativeImpl() {
aScreen = new DefaultGraphicsScreen(getDisplay().getGraphicsDevice(), screen_idx);
}
+ @Override
protected void closeNativeImpl() { }
private MonitorMode getMonitorModeImpl(MonitorModeProps.Cache cache, int crt_idx, int mode_idx) {
@@ -68,7 +70,7 @@ public class ScreenDriver extends ScreenImpl {
}
return res;
}
-
+
@Override
protected final void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache) {
int crtIdx = 0;
@@ -85,16 +87,16 @@ public class ScreenDriver extends ScreenImpl {
final MonitorMode currentMode = getMonitorModeImpl(cache, crtIdx, -1);
if ( null == currentMode ) {
throw new InternalError("Could not gather current mode of device "+crtIdx+", but gathered "+modeIdx+" modes");
- }
+ }
final int[] monitorProps = getMonitorProps0(crtIdx);
if ( null == monitorProps ) {
throw new InternalError("Could not gather device "+crtIdx+", but gathered "+modeIdx+" modes");
- }
+ }
// merge monitor-props + supported modes
MonitorModeProps.streamInMonitorDevice(null, cache, this, supportedModes, currentMode, monitorProps, 0);
-
+
// next monitor, 1st mode
- supportedModes= new ArrayHashSet<MonitorMode>();
+ supportedModes= new ArrayHashSet<MonitorMode>();
crtIdx++;
modeIdx=0;
} else {
@@ -108,16 +110,17 @@ public class ScreenDriver extends ScreenImpl {
protected MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor) {
return getMonitorModeImpl(null, monitor.getId(), -1);
}
-
+
@Override
protected boolean setCurrentMonitorModeImpl(MonitorDevice monitor, MonitorMode mode) {
return setMonitorMode0(monitor.getId(), mode.getId(), mode.getRotation());
}
-
+
+ @Override
protected int validateScreenIndex(int idx) {
- return 0; // big-desktop w/ multiple monitor attached, only one screen available
+ return 0; // big-desktop w/ multiple monitor attached, only one screen available
}
-
+
private native int[] getMonitorProps0(int crt_idx);
private native int[] getMonitorMode0(int crt_index, int mode_idx);
private native boolean setMonitorMode0(int crt_index, int nativeId, int rot);
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
index 6aebf04..7db3e2a 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.macosx;
@@ -53,14 +53,14 @@ import com.jogamp.newt.event.InputEvent;
import com.jogamp.newt.event.KeyEvent;
public class WindowDriver extends WindowImpl implements MutableSurface, DriverClearFocus, DriverUpdatePosition {
-
+
static {
DisplayDriver.initSingleton();
}
public WindowDriver() {
}
-
+
@Override
protected void createNativeImpl() {
final AbstractGraphicsConfiguration cfg = GraphicsConfigurationFactory.getFactory(getScreen().getDisplay().getGraphicsDevice(), capsRequested).chooseGraphicsConfiguration(
@@ -69,7 +69,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this);
}
setGraphicsConfiguration(cfg);
- reconfigureWindowImpl(getX(), getY(), getWidth(), getHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY, true));
+ reconfigureWindowImpl(getX(), getY(), getWidth(), getHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY, true));
if (0 == getWindowHandle()) {
throw new NativeWindowException("Error creating window");
}
@@ -79,7 +79,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
protected void closeNativeImpl() {
try {
if(DEBUG_IMPLEMENTATION) { System.err.println("MacWindow.CloseAction "+Thread.currentThread().getName()); }
- final long handle = getWindowHandle();
+ final long handle = getWindowHandle();
visibleChanged(true, false);
setWindowHandle(0);
surfaceHandle = 0;
@@ -87,21 +87,22 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
isOffscreenInstance = false;
if (0 != handle) {
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
close0( handle );
} } );
}
} catch (Throwable t) {
- if(DEBUG_IMPLEMENTATION) {
+ if(DEBUG_IMPLEMENTATION) {
Exception e = new Exception("Warning: closeNative failed - "+Thread.currentThread().getName(), t);
e.printStackTrace();
}
}
}
-
+
@Override
protected int lockSurfaceImpl() {
- /**
+ /**
* if( isOffscreenInstance ) {
* return LOCK_SUCCESS;
* }
@@ -116,7 +117,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
@Override
protected void unlockSurfaceImpl() {
- /**
+ /**
* if( isOffscreenInstance ) {
* return;
* }
@@ -129,7 +130,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
}
}
}
-
+
@Override
public final long getSurfaceHandle() {
return 0 != sscSurfaceHandle ? sscSurfaceHandle : surfaceHandle;
@@ -144,31 +145,37 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
if (isNativeValid()) {
if (0 != sscSurfaceHandle) {
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
orderOut0( 0 != getParentWindowHandle() ? getParentWindowHandle() : getWindowHandle() );
} } );
- } /** this is done by recreation!
+ } /** this is done by recreation!
else if (isVisible()){
OSXUtil.RunOnMainThread(false, new Runnable() {
public void run() {
orderFront0( 0!=getParentWindowHandle() ? getParentWindowHandle() : getWindowHandle() );
} } );
} */
- }
+ }
}
@Override
protected void setTitleImpl(final String title) {
- OSXUtil.RunOnMainThread(false, new Runnable() {
- public void run() {
- setTitle0(getWindowHandle(), title);
- } } );
+ OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
+ public void run() {
+ setTitle0(getWindowHandle(), title);
+ } } );
}
@Override
protected void requestFocusImpl(final boolean force) {
+ if(DEBUG_IMPLEMENTATION) {
+ System.err.println("MacWindow: requestFocusImpl(), isOffscreenInstance "+isOffscreenInstance);
+ }
if(!isOffscreenInstance) {
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
requestFocus0(getWindowHandle(), force);
} } );
@@ -176,7 +183,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
focusChanged(false, true);
}
}
-
+
@Override
public final void clearFocus() {
if(DEBUG_IMPLEMENTATION) {
@@ -184,6 +191,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
}
if(!isOffscreenInstance) {
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
resignFocus0(getWindowHandle());
} } );
@@ -191,9 +199,9 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
focusChanged(false, false);
}
}
-
+
private boolean useParent(NativeWindow parent) { return null != parent && 0 != parent.getWindowHandle(); }
-
+
@Override
public void updatePosition(int x, int y) {
final long handle = getWindowHandle();
@@ -206,14 +214,15 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
System.err.println("MacWindow: updatePosition() parent["+useParent+" "+pX+"/"+pY+"] "+x+"/"+y+" -> "+x+"/"+y+" rel-client-pos, "+p0S+" screen-client-pos");
}
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
setWindowClientTopLeftPoint0(handle, p0S.getX(), p0S.getY(), isVisible());
} } );
// no native event (fullscreen, some reparenting)
positionChanged(true, x, y);
}
- }
-
+ }
+
@Override
protected void sizeChanged(boolean defer, int newWidth, int newHeight, boolean force) {
final long handle = getWindowHandle();
@@ -227,6 +236,7 @@ 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, new Runnable() {
+ @Override
public void run() {
setWindowClientTopLeftPoint0(getWindowHandle(), p0S.getX(), p0S.getY(), isVisible());
} } );
@@ -234,7 +244,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
}
super.sizeChanged(defer, newWidth, newHeight, force);
}
-
+
@Override
protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, int flags) {
final boolean _isOffscreenInstance = isOffscreenInstance(this, this.getParent());
@@ -247,11 +257,11 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
final boolean useParent = useParent(parent);
if( useParent ) {
pClientLevelOnSreen = getLocationOnScreenImpl(x, y, parent, useParent);
- } else {
+ } else {
pClientLevelOnSreen = new Point(x, y);
}
}
-
+
if(DEBUG_IMPLEMENTATION) {
final AbstractGraphicsConfiguration cWinCfg = this.getGraphicsConfiguration();
final NativeWindow pWin = getParent();
@@ -266,12 +276,13 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
"\n\t, "+getReconfigureFlagsAsString(null, flags));
// Thread.dumpStack();
}
-
+
final boolean setVisible = 0 != ( FLAG_IS_VISIBLE & flags);
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) && !setVisible ) {
if ( !isOffscreenInstance ) {
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
orderOut0(getWindowHandle());
visibleChanged(true, false);
@@ -287,13 +298,14 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
if(isOffscreenInstance) {
createWindow(true, 0 != getWindowHandle(), pClientLevelOnSreen, 64, 64, false, setVisible, false);
} else {
- createWindow(false, 0 != getWindowHandle(), pClientLevelOnSreen, width, height,
+ createWindow(false, 0 != getWindowHandle(), pClientLevelOnSreen, width, height,
0 != ( FLAG_IS_FULLSCREEN & flags), setVisible, 0 != ( FLAG_IS_ALWAYSONTOP & flags));
}
} else {
- if( width>0 && height>0 ) {
+ if( width>0 && height>0 ) {
if( !isOffscreenInstance ) {
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
setWindowClientTopLeftPointAndSize0(getWindowHandle(), pClientLevelOnSreen.getX(), pClientLevelOnSreen.getY(), width, height, setVisible);
} } );
@@ -303,8 +315,9 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
sizeChanged(true, width, height, false);
}
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) && setVisible ) {
- if( !isOffscreenInstance ) {
+ if( !isOffscreenInstance ) {
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
orderFront0(getWindowHandle());
visibleChanged(true, true);
@@ -318,7 +331,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
}
}
if(DEBUG_IMPLEMENTATION) {
- System.err.println("MacWindow reconfig.X: clientPos "+pClientLevelOnSreen+", "+width+"x"+height+" -> clientPos "+getLocationOnScreenImpl(0, 0)+", insets: "+getInsets());
+ System.err.println("MacWindow reconfig.X: clientPos "+pClientLevelOnSreen+", "+width+"x"+height+" -> clientPos "+getLocationOnScreenImpl(0, 0)+", insets: "+getInsets());
}
return true;
}
@@ -329,28 +342,28 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
final boolean useParent = useParent(parent);
return getLocationOnScreenImpl(x, y, parent, useParent);
}
-
+
private Point getLocationOnScreenImpl(final int x, final int y, final NativeWindow parent, final boolean useParent) {
if( !useParent && !isOffscreenInstance && 0 != surfaceHandle) {
return OSXUtil.GetLocationOnScreen(surfaceHandle, true, x, y);
}
-
+
final Point p = new Point(x, y);
if( useParent ) {
p.translate( parent.getLocationOnScreen(null) );
}
return p;
}
-
+
@Override
protected void updateInsetsImpl(Insets insets) {
// nop - using event driven insetsChange(..)
}
-
+
/** Callback for native screen position change event of the client area. */
- protected void screenPositionChanged(boolean defer, int newX, int newY) {
+ protected void screenPositionChanged(boolean defer, int newX, int newY) {
// passed coordinates are in screen position of the client area
- if(getWindowHandle()!=0) {
+ if(getWindowHandle()!=0) {
final NativeWindow parent = getParent();
if( null == parent || isOffscreenInstance ) {
if(DEBUG_IMPLEMENTATION) {
@@ -359,7 +372,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
positionChanged(defer, newX, newY);
} else {
// screen position -> rel child window position
- Point absPos = new Point(newX, newY);
+ Point absPos = new Point(newX, newY);
Point parentOnScreen = parent.getLocationOnScreen(null);
absPos.translate( parentOnScreen.scale(-1, -1) );
if(DEBUG_IMPLEMENTATION) {
@@ -371,10 +384,10 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
System.err.println("MacWindow.positionChanged.2 (Screen Pos - IGN): ("+getThreadName()+"): (defer: "+defer+") "+getX()+"/"+getY()+" -> "+newX+"/"+newY);
}
}
-
+
@Override
protected boolean setPointerVisibleImpl(final boolean pointerVisible) {
- if( !isOffscreenInstance ) {
+ if( !isOffscreenInstance ) {
return setPointerVisible0(getWindowHandle(), hasFocus(), pointerVisible);
} // else may need offscreen solution ? FIXME
return false;
@@ -382,29 +395,29 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
@Override
protected boolean confinePointerImpl(final boolean confine) {
- if( !isOffscreenInstance ) {
+ if( !isOffscreenInstance ) {
return confinePointer0(getWindowHandle(), confine);
} // else may need offscreen solution ? FIXME
return false;
}
-
+
@Override
protected void warpPointerImpl(final int x, final int y) {
- if( !isOffscreenInstance ) {
+ if( !isOffscreenInstance ) {
warpPointer0(getWindowHandle(), x, y);
} // else may need offscreen solution ? FIXME
}
-
+
@Override
public final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
throw new InternalError("XXX: Adapt Java Code to Native Code Changes");
}
-
+
@Override
public final void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short _keyCode, short _keySym, char keyChar) {
- throw new InternalError("XXX: Adapt Java Code to Native Code Changes");
+ throw new InternalError("XXX: Adapt Java Code to Native Code Changes");
}
-
+
protected final void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short _keyCode, char keyChar, char keySymChar) {
// Note that we send the key char for the key code on this
// platform -- we do not get any useful key codes out of the system
@@ -414,15 +427,17 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
short _keySym = KeyEvent.NULL_CHAR != keySymChar ? KeyEvent.utf16ToVKey(keySymChar) : KeyEvent.VK_UNDEFINED;
keySym = KeyEvent.VK_UNDEFINED != _keySym ? _keySym : keyCode;
}
- /* {
+ /**
+ {
final boolean isModifierKeyCode = KeyEvent.isModifierKey(keyCode);
System.err.println("*** handleKeyEvent: event "+KeyEvent.getEventTypeString(eventType)+
", keyCode 0x"+Integer.toHexString(_keyCode)+" -> 0x"+Integer.toHexString(keyCode)+
", keySymChar '"+keySymChar+"', 0x"+Integer.toHexString(keySymChar)+" -> 0x"+Integer.toHexString(keySym)+
", mods "+toHexString(modifiers)+
- ", was: pressed "+isKeyPressed(keyCode)+", isModifierKeyCode "+isModifierKeyCode);
+ ", was: pressed "+isKeyPressed(keyCode)+", isModifierKeyCode "+isModifierKeyCode+
+ ", nativeValid "+isNativeValid()+", isOffscreen "+isOffscreenInstance);
} */
-
+
// OSX delivery order is PRESSED (t0), RELEASED (t1) and TYPED (t2) -> NEWT order: PRESSED (t0) and RELEASED (t1)
// Auto-Repeat: OSX delivers only PRESSED, inject auto-repeat RELEASE key _before_ PRESSED
switch(eventType) {
@@ -446,45 +461,47 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
//----------------------------------------------------------------------
// Internals only
- //
-
- private void createWindow(final boolean offscreenInstance, final boolean recreate,
- final PointImmutable pS, final int width, final int height,
+ //
+
+ private void createWindow(final boolean offscreenInstance, final boolean recreate,
+ final PointImmutable pS, final int width, final int height,
final boolean fullscreen, final boolean visible, final boolean alwaysOnTop) {
+ final long parentWinHandle = getParentWindowHandle();
+ final long preWinHandle = getWindowHandle();
+
if(DEBUG_IMPLEMENTATION) {
System.err.println("MacWindow.createWindow on thread "+Thread.currentThread().getName()+
": offscreen "+offscreenInstance+", recreate "+recreate+
", pS "+pS+", "+width+"x"+height+", fullscreen "+fullscreen+", visible "+visible+
- ", alwaysOnTop "+alwaysOnTop);
+ ", alwaysOnTop "+alwaysOnTop+", preWinHandle "+toHexString(preWinHandle)+", parentWin "+toHexString(parentWinHandle)+
+ ", surfaceHandle "+toHexString(surfaceHandle));
// Thread.dumpStack();
}
try {
- final long parentWin = getParentWindowHandle();
- if( 0 != getWindowHandle() ) {
- final long thisWin = getWindowHandle();
+ if( 0 != preWinHandle ) {
setWindowHandle(0);
-
if( 0 == surfaceHandle ) {
throw new NativeWindowException("Internal Error - create w/ window, but no Newt NSView");
- }
+ }
OSXUtil.RunOnMainThread(false, new Runnable() {
+ @Override
public void run() {
- changeContentView0(parentWin, thisWin, 0);
- close0( thisWin );
+ changeContentView0(parentWinHandle, preWinHandle, 0);
+ close0( preWinHandle );
} } );
} else {
if( 0 != surfaceHandle ) {
throw new NativeWindowException("Internal Error - create w/o window, but has Newt NSView");
- }
+ }
surfaceHandle = createView0(pS.getX(), pS.getY(), width, height, fullscreen);
if( 0 == surfaceHandle ) {
throw new NativeWindowException("Could not create native view "+Thread.currentThread().getName()+" "+this);
}
}
-
- final long newWin = createWindow0( pS.getX(), pS.getY(), width, height, fullscreen,
+
+ final long newWin = createWindow0( pS.getX(), pS.getY(), width, height, fullscreen,
( isUndecorated() || offscreenInstance ) ? NSBorderlessWindowMask :
NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask,
NSBackingStoreBuffered, surfaceHandle);
@@ -492,15 +509,16 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
throw new NativeWindowException("Could not create native window "+Thread.currentThread().getName()+" "+this);
}
setWindowHandle( newWin );
-
+
final boolean isOpaque = getGraphicsConfiguration().getChosenCapabilities().isBackgroundOpaque() && !offscreenInstance;
- // Non blocking initialization on main-thread!
- OSXUtil.RunOnMainThread(false, new Runnable() {
+ // Blocking initialization on main-thread!
+ OSXUtil.RunOnMainThread(true, new Runnable() {
+ @Override
public void run() {
- initWindow0( parentWin, newWin, pS.getX(), pS.getY(), width, height,
+ initWindow0( parentWinHandle, newWin, pS.getX(), pS.getY(), width, height,
isOpaque, fullscreen, visible && !offscreenInstance, surfaceHandle);
if( offscreenInstance ) {
- orderOut0(0!=parentWin ? parentWin : newWin);
+ orderOut0(0!=parentWinHandle ? parentWinHandle : newWin);
} else {
setTitle0(newWin, getTitle());
setAlwaysOnTop0(getWindowHandle(), alwaysOnTop);
@@ -511,7 +529,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
ie.printStackTrace();
}
}
-
+
protected static native boolean initIDs0();
private native long createView0(int x, int y, int w, int h, boolean fullscreen);
private native long createWindow0(int x, int y, int w, int h, boolean fullscreen, int windowStyle, int backingStoreType, long view);
@@ -537,7 +555,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
private native void changeContentView0(long parentWindowOrView, long window, long view);
/** Must be called on Main-Thread */
private native void setWindowClientTopLeftPointAndSize0(long window, int x, int y, int w, int h, boolean display);
- /** Must be called on Main-Thread */
+ /** Must be called on Main-Thread */
private native void setWindowClientTopLeftPoint0(long window, int x, int y, boolean display);
/** Must be called on Main-Thread */
private native void setAlwaysOnTop0(long window, boolean atop);
@@ -545,7 +563,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
private static native boolean setPointerVisible0(long windowHandle, boolean hasFocus, boolean visible);
private static native boolean confinePointer0(long windowHandle, boolean confine);
private static native void warpPointer0(long windowHandle, int x, int y);
-
+
// Window styles
private static final int NSBorderlessWindowMask = 0;
private static final int NSTitledWindowMask = 1 << 0;
@@ -561,5 +579,5 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
private volatile long surfaceHandle = 0;
private long sscSurfaceHandle = 0;
private boolean isOffscreenInstance = false;
-
+
}
diff --git a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java
index 595d5e9..d8ff7ec 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.windows;
@@ -52,10 +52,10 @@ public class DisplayDriver extends DisplayImpl {
NEWTJNILibLoader.loadNEWT();
sharedClassFactory = new RegisteredClassFactory(newtClassBaseName, WindowDriver.getNewtWndProc0());
-
+
if (!WindowDriver.initIDs0(RegisteredClassFactory.getHInstance())) {
throw new NativeWindowException("Failed to initialize WindowsWindow jmethodIDs");
- }
+ }
}
public static void initSingleton() {
@@ -71,16 +71,19 @@ public class DisplayDriver extends DisplayImpl {
public DisplayDriver() {
}
+ @Override
protected void createNativeImpl() {
sharedClass = sharedClassFactory.getSharedClass();
aDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
}
- protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
+ @Override
+ protected void closeNativeImpl(AbstractGraphicsDevice aDevice) {
sharedClassFactory.releaseSharedClass();
aDevice.close();
}
+ @Override
protected void dispatchMessagesNative() {
DispatchMessages0();
}
diff --git a/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java
index 3428296..e789b99 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.windows;
@@ -60,7 +60,7 @@ public class ScreenDriver extends ScreenImpl {
protected void createNativeImpl() {
aScreen = new DefaultGraphicsScreen(getDisplay().getGraphicsDevice(), screen_idx);
}
-
+
@Override
protected void closeNativeImpl() {
}
@@ -71,7 +71,7 @@ public class ScreenDriver extends ScreenImpl {
private final String getActiveMonitorName(String adapterName, int monitor_idx) {
return getActiveMonitorName0(adapterName, monitor_idx);
}
-
+
private final MonitorMode getMonitorModeImpl(MonitorModeProps.Cache cache, String adapterName, int crtModeIdx) {
if( null == adapterName ) {
return null;
@@ -107,7 +107,7 @@ public class ScreenDriver extends ScreenImpl {
final int[] monitorProps = getMonitorDevice0(adapterName, crtIdx);
// merge monitor-props + supported modes
MonitorModeProps.streamInMonitorDevice(null, cache, this, supportedModes, currentMode, monitorProps, 0);
-
+
// next monitor, 1st mode
supportedModes= new ArrayHashSet<MonitorMode>();
}
@@ -116,7 +116,7 @@ public class ScreenDriver extends ScreenImpl {
adapterName = getAdapterName(crtIdx);
}
}
-
+
@Override
protected Rectangle getNativeMonitorDeviceViewportImpl(MonitorDevice monitor) {
final String adapterName = getAdapterName(monitor.getId());
@@ -135,7 +135,7 @@ public class ScreenDriver extends ScreenImpl {
protected MonitorMode queryCurrentMonitorModeImpl(MonitorDevice monitor) {
return getMonitorModeImpl(null, getAdapterName(monitor.getId()), -1);
}
-
+
@Override
protected boolean setCurrentMonitorModeImpl(MonitorDevice monitor, MonitorMode mode) {
return setMonitorMode0(monitor.getId(),
@@ -150,17 +150,14 @@ public class ScreenDriver extends ScreenImpl {
@Override
protected int validateScreenIndex(int idx) {
- return 0; // big-desktop w/ multiple monitor attached, only one screen available
+ return 0; // big-desktop w/ multiple monitor attached, only one screen available
}
-
+
@Override
protected void calcVirtualScreenOriginAndSize(Rectangle vOriginSize) {
- vOriginSize.setX(getVirtualOriginX0());
- vOriginSize.setY(getVirtualOriginY0());
- vOriginSize.setWidth(getVirtualWidthImpl0());
- vOriginSize.setHeight(getVirtualHeightImpl0());
+ vOriginSize.set(getVirtualOriginX0(), getVirtualOriginY0(), getVirtualWidthImpl0(), getVirtualHeightImpl0());
}
-
+
// Native calls
private native int getVirtualOriginX0();
private native int getVirtualOriginY0();
diff --git a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
index 393445d..6e8ac3e 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.windows;
@@ -46,10 +46,12 @@ import javax.media.nativewindow.util.Insets;
import javax.media.nativewindow.util.InsetsImmutable;
import javax.media.nativewindow.util.Point;
+import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.VersionNumber;
import com.jogamp.newt.event.InputEvent;
import com.jogamp.newt.event.KeyEvent;
-import com.jogamp.newt.event.MouseAdapter;
import com.jogamp.newt.event.MouseEvent;
+import com.jogamp.newt.event.MouseEvent.PointerType;
public class WindowDriver extends WindowImpl {
@@ -72,26 +74,26 @@ public class WindowDriver extends WindowImpl {
}
final long hWnd = getWindowHandle();
hdc = GDI.GetDC(hWnd);
-
+
// return ( 0 == hdc ) ? LOCK_SURFACE_NOT_READY : ( hdc_old != hdc ) ? LOCK_SURFACE_CHANGED : LOCK_SUCCESS ;
- if( 0 == hdc ) {
+ if( 0 == hdc ) {
return LOCK_SURFACE_NOT_READY;
- }
+ }
hmon = MonitorFromWindow0(hWnd);
-
+
// Let's not trigger on HDC change, GLDrawableImpl.'s destroy/create is a nop here anyways.
// FIXME: Validate against EGL surface creation: ANGLE uses HWND -> fine!
- return LOCK_SUCCESS;
-
+ return LOCK_SUCCESS;
+
/**
if( hdc_old == hdc ) {
return LOCK_SUCCESS;
}
- if(DEBUG_IMPLEMENTATION) {
+ if(DEBUG_IMPLEMENTATION) {
System.err.println("WindowsWindow: surface change "+toHexString(hdc_old)+" -> "+toHexString(hdc));
// Thread.dumpStack();
}
- return LOCK_SURFACE_CHANGED; */
+ return LOCK_SURFACE_CHANGED; */
}
@Override
@@ -125,6 +127,7 @@ public class WindowDriver extends WindowImpl {
return false;
}
+ @Override
protected void createNativeImpl() {
final ScreenDriver screen = (ScreenDriver) getScreen();
final DisplayDriver display = (DisplayDriver) screen.getDisplay();
@@ -134,37 +137,34 @@ public class WindowDriver extends WindowImpl {
throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this);
}
setGraphicsConfiguration(cfg);
- final int flags = getReconfigureFlags(0, true) &
+ final VersionNumber winVer = Platform.getOSVersionNumber();
+ final int flags = getReconfigureFlags(0, true) &
( FLAG_IS_ALWAYSONTOP | FLAG_IS_UNDECORATED ) ;
final long _windowHandle = CreateWindow0(DisplayDriver.getHInstance(), display.getWindowClassName(), display.getWindowClassName(),
- getParentWindowHandle(), getX(), getY(), getWidth(), getHeight(), autoPosition(), flags);
+ winVer.getMajor(), winVer.getMinor(),
+ getParentWindowHandle(), getX(), getY(), getWidth(), getHeight(), autoPosition(), flags);
if ( 0 == _windowHandle ) {
throw new NativeWindowException("Error creating window");
}
setWindowHandle(_windowHandle);
windowHandleClose = _windowHandle;
- addMouseListener(mouseTracker);
-
+
if(DEBUG_IMPLEMENTATION) {
Exception e = new Exception("Info: Window new window handle "+Thread.currentThread().getName()+
" (Parent HWND "+toHexString(getParentWindowHandle())+
") : HWND "+toHexString(_windowHandle)+", "+Thread.currentThread());
e.printStackTrace();
}
- }
- private MouseAdapter mouseTracker = new MouseAdapter() {
- public void mouseEntered(MouseEvent e) {
- WindowDriver.trackPointerLeave0(WindowDriver.this.getWindowHandle());
- }
- };
+ }
+ @Override
protected void closeNativeImpl() {
if(windowHandleClose != 0) {
if (hdc != 0) {
try {
GDI.ReleaseDC(windowHandleClose, hdc);
} catch (Throwable t) {
- if(DEBUG_IMPLEMENTATION) {
+ if(DEBUG_IMPLEMENTATION) {
Exception e = new Exception("Warning: closeNativeImpl failed - "+Thread.currentThread().getName(), t);
e.printStackTrace();
}
@@ -185,19 +185,20 @@ public class WindowDriver extends WindowImpl {
hdc_old = 0;
}
+ @Override
protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("WindowsWindow reconfig: "+x+"/"+y+" "+width+"x"+height+", "+
getReconfigureFlagsAsString(null, flags));
}
-
+
if(0 == ( FLAG_IS_UNDECORATED & flags)) {
final InsetsImmutable i = getInsets();
-
+
// client position -> top-level window position
x -= i.getLeftWidth() ;
y -= i.getTopHeight() ;
-
+
if(0<width && 0<height) {
// client size -> top-level window size
width += i.getTotalWidth();
@@ -205,13 +206,14 @@ public class WindowDriver extends WindowImpl {
}
}
reconfigureWindow0( getParentWindowHandle(), getWindowHandle(), x, y, width, height, flags);
-
+
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
- visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
+ visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
return true;
}
+ @Override
protected void requestFocusImpl(boolean force) {
requestFocus0(getWindowHandle(), force);
}
@@ -224,8 +226,9 @@ public class WindowDriver extends WindowImpl {
@Override
protected boolean setPointerVisibleImpl(final boolean pointerVisible) {
final boolean[] res = new boolean[] { false };
-
+
this.runOnEDTIfAvail(true, new Runnable() {
+ @Override
public void run() {
res[0] = setPointerVisible0(getWindowHandle(), pointerVisible);
}
@@ -236,20 +239,22 @@ public class WindowDriver extends WindowImpl {
@Override
protected boolean confinePointerImpl(final boolean confine) {
final Boolean[] res = new Boolean[] { Boolean.FALSE };
-
+
this.runOnEDTIfAvail(true, new Runnable() {
+ @Override
public void run() {
final Point p0 = getLocationOnScreenImpl(0, 0);
- res[0] = Boolean.valueOf(confinePointer0(getWindowHandle(), confine,
+ res[0] = Boolean.valueOf(confinePointer0(getWindowHandle(), confine,
p0.getX(), p0.getY(), p0.getX()+getWidth(), p0.getY()+getHeight()));
}
});
return res[0].booleanValue();
}
-
+
@Override
- protected void warpPointerImpl(final int x, final int y) {
+ protected void warpPointerImpl(final int x, final int y) {
this.runOnEDTIfAvail(true, new Runnable() {
+ @Override
public void run() {
final Point sPos = getLocationOnScreenImpl(x, y);
warpPointer0(getWindowHandle(), sPos.getX(), sPos.getY());
@@ -257,17 +262,46 @@ public class WindowDriver extends WindowImpl {
});
return;
}
-
+
+ @Override
protected Point getLocationOnScreenImpl(int x, int y) {
return GDIUtil.GetRelativeLocation( getWindowHandle(), 0 /*root win*/, x, y);
}
+ @Override
protected void updateInsetsImpl(Insets insets) {
- // nop - using event driven insetsChange(..)
+ // nop - using event driven insetsChange(..)
}
-
+
+ //
+ // PointerEvent Handling
+ //
+ /**
+ * Send multiple-pointer {@link MouseEvent.PointerType#TouchScreen} event to be directly consumed
+ * <p>
+ * Assumes non normal pointer names and rotation/scroll will be determined by a gesture handler.
+ * </p>
+ * <p>
+ * See {@link #doPointerEvent(boolean, boolean, PointerType[], short, int, int, boolean, int[], int[], int[], float[], float, float[], float)}
+ * for details.
+ * </p>
+ */
+ public final void sendTouchScreenEvent(short eventType, int modifiers,
+ int pActionIdx, int[] pNames,
+ int[] pX, int[] pY, float[] pPressure, float maxPressure) {
+ final int pCount = pNames.length;
+ final MouseEvent.PointerType[] pTypes = new MouseEvent.PointerType[pCount];
+ for(int i=pCount-1; i>=0; i--) { pTypes[i] = PointerType.TouchScreen; }
+ doPointerEvent(false /*enqueue*/, false /*wait*/,
+ pTypes, eventType, modifiers, pActionIdx, false /*normalPNames*/, pNames,
+ pX, pY, pPressure, maxPressure, new float[] { 0f, 0f, 0f} /*rotationXYZ*/, 1f/*rotationScale*/);
+ }
+
+ //
+ // KeyEvent Handling
+ //
private short repeatedKey = KeyEvent.VK_UNDEFINED;
-
+
private final boolean handlePressTypedAutoRepeat(boolean isModifierKey, int modifiers, short keyCode, short keySym, char keyChar) {
if( setKeyPressed(keyCode, true) ) {
// AR: Key was already pressed: Either [enter | within] AR mode
@@ -283,18 +317,18 @@ public class WindowDriver extends WindowImpl {
super.sendKeyEvent(KeyEvent.EVENT_KEY_RELEASED, modifiers, keyCode, keySym, keyChar);
}
return true;
- }
+ }
return false;
}
-
+
@Override
public final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
final boolean isModifierKey = KeyEvent.isModifierKey(keySym);
// System.err.println("*** sendKeyEvent: event "+KeyEvent.getEventTypeString(eventType)+", keyCode "+toHexString(keyCode)+", keyChar <"+keyChar+">, mods "+toHexString(modifiers)+
// ", isKeyCodeTracked "+isKeyCodeTracked(keyCode)+", was: pressed "+isKeyPressed(keyCode)+", printableKey "+KeyEvent.isPrintableKey(keyCode, false)+" [modifierKey "+isModifierKey+"] - "+System.currentTimeMillis());
-
+
// Reorder: WINDOWS delivery order is PRESSED (t0), TYPED (t0) and RELEASED (t1) -> NEWT order: PRESSED (t0) and RELEASED (t1)
- // Auto-Repeat: WINDOWS delivers only PRESSED (t0) and TYPED (t0).
+ // Auto-Repeat: WINDOWS delivers only PRESSED (t0) and TYPED (t0).
switch(eventType) {
case KeyEvent.EVENT_KEY_RELEASED:
if( isKeyCodeTracked(keyCode) ) {
@@ -314,21 +348,20 @@ public class WindowDriver extends WindowImpl {
break;
}
}
-
+
@Override
public final void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
throw new InternalError("XXX: Adapt Java Code to Native Code Changes");
}
-
+
//----------------------------------------------------------------------
// Internals only
//
protected static native long getNewtWndProc0();
protected static native boolean initIDs0(long hInstance);
- private native long CreateWindow0(long hInstance, String wndClassName, String wndName,
- long parentWindowHandle,
- int x, int y, int width, int height, boolean autoPosition, int flags);
+ private native long CreateWindow0(long hInstance, String wndClassName, String wndName, int winMajor, int winMinor,
+ long parentWindowHandle, int x, int y, int width, int height, boolean autoPosition, int flags);
private native long MonitorFromWindow0(long windowHandle);
private native void reconfigureWindow0(long parentWindowHandle, long windowHandle,
int x, int y, int width, int height, int flags);
@@ -337,6 +370,5 @@ public class WindowDriver extends WindowImpl {
private static native boolean setPointerVisible0(long windowHandle, boolean visible);
private static native boolean confinePointer0(long windowHandle, boolean grab, int l, int t, int r, int b);
- private static native void warpPointer0(long windowHandle, int x, int y);
- private static native void trackPointerLeave0(long windowHandle);
+ private static native void warpPointer0(long windowHandle, int x, int y);
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java
index d911483..5048397 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.x11;
@@ -63,6 +63,7 @@ public class DisplayDriver extends DisplayImpl {
public DisplayDriver() {
}
+ @Override
public String validateDisplayName(String name, long handle) {
return X11Util.validateDisplayName(name, handle);
}
@@ -72,6 +73,7 @@ public class DisplayDriver extends DisplayImpl {
*
* We use a private non-shared X11 Display instance for EDT window operations and one for exposed animation, eg. OpenGL.
*/
+ @Override
protected void createNativeImpl() {
X11Util.setX11ErrorHandler(true, DEBUG ? false : true); // make sure X11 error handler is set
long handle = X11Util.openDisplay(name);
@@ -83,7 +85,7 @@ public class DisplayDriver extends DisplayImpl {
CompleteDisplay0(aDevice.getHandle());
} catch(RuntimeException e) {
closeNativeImpl(aDevice);
- throw e;
+ throw e;
}
}
@@ -114,14 +116,14 @@ public class DisplayDriver extends DisplayImpl {
protected long getJavaObjectAtom() { return javaObjectAtom; }
protected long getWindowDeleteAtom() { return windowDeleteAtom; }
// protected long getKbdHandle() { return kbdHandle; } // XKB disabled for now
-
- /** Returns <code>null</code> if !{@link #isNativeValid()}, otherwise the Boolean value of {@link X11GraphicsDevice#isXineramaEnabled()}. */
+
+ /** Returns <code>null</code> if !{@link #isNativeValid()}, otherwise the Boolean value of {@link X11GraphicsDevice#isXineramaEnabled()}. */
protected Boolean isXineramaEnabled() { return isNativeValid() ? Boolean.valueOf(((X11GraphicsDevice)aDevice).isXineramaEnabled()) : null; }
-
+
//----------------------------------------------------------------------
// Internals only
//
-
+
private static native boolean initIDs0(boolean debug);
private native void CompleteDisplay0(long handle);
@@ -137,10 +139,10 @@ public class DisplayDriver extends DisplayImpl {
/** X11 Window delete atom marker used on EDT */
private long windowDeleteAtom;
-
+
/** X11 Window java object property used on EDT */
- private long javaObjectAtom;
-
+ private long javaObjectAtom;
+
/** X11 Keyboard handle used on EDT */
// private long kbdHandle; // XKB disabled for now
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR.java b/src/newt/classes/jogamp/newt/driver/x11/RandR.java
index e39a6c6..8b065d1 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/RandR.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/RandR.java
@@ -38,18 +38,18 @@ import com.jogamp.newt.MonitorDevice;
import com.jogamp.newt.MonitorMode;
public interface RandR {
- public static final VersionNumber version110 = new VersionNumber(1, 1, 0);
+ public static final VersionNumber version110 = new VersionNumber(1, 1, 0);
public static final VersionNumber version130 = new VersionNumber(1, 3, 0);
public static final VersionNumber version140 = new VersionNumber(1, 4, 0);
VersionNumber getVersion();
-
+
void dumpInfo(final long dpy, final int screen_idx);
-
+
/**
- * Encapsulate initial device query allowing caching of internal data structures.
+ * Encapsulate initial device query allowing caching of internal data structures.
* Methods covered:
- * <ul>
+ * <ul>
* <li>{@link #getMonitorDeviceCount(long, ScreenDriver)}</li>
* <li>{@link #getAvailableRotations(long, ScreenDriver, int)}</li>
* <li>{@link #getMonitorModeProps(long, ScreenDriver, int)}</li>
@@ -57,7 +57,7 @@ public interface RandR {
* <li>{@link #getMonitorDeviceProps(long, ScreenDriver, List, int, MonitorMode)}</li>
* </ul>
* <p>
- * Above methods may be called w/o begin/end, in which case no
+ * Above methods may be called w/o begin/end, in which case no
* internal data structures can be cached:
* </p>
* @param dpy TODO
@@ -66,11 +66,11 @@ public interface RandR {
*/
boolean beginInitialQuery(long dpy, ScreenDriver screen);
void endInitialQuery(long dpy, ScreenDriver screen);
-
+
int getMonitorDeviceCount(final long dpy, final ScreenDriver screen);
int[] getAvailableRotations(final long dpy, final ScreenDriver screen, final int crt_idx);
/**
- *
+ *
* @param dpy
* @param screen
* @param mode_idx w/o indexing rotation
@@ -80,7 +80,7 @@ public interface RandR {
int[] getMonitorDeviceProps(final long dpy, final ScreenDriver screen, MonitorModeProps.Cache cache, final int crt_idx);
int[] getMonitorDeviceViewport(final long dpy, final ScreenDriver screen, final int crt_idx);
int[] getCurrentMonitorModeProps(final long dpy, final ScreenDriver screen, final int crt_idx);
- boolean setCurrentMonitorMode(final long dpy, final ScreenDriver screen, MonitorDevice monitor, final MonitorMode mode);
-
- public void updateScreenViewport(final long dpy, final ScreenDriver screen, RectangleImmutable viewport);
+ boolean setCurrentMonitorMode(final long dpy, final ScreenDriver screen, MonitorDevice monitor, final MonitorMode mode);
+
+ public void updateScreenViewport(final long dpy, final ScreenDriver screen, RectangleImmutable viewport);
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR11.java b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java
index 877607f..6c22a3f 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/RandR11.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java
@@ -38,8 +38,8 @@ import com.jogamp.newt.MonitorMode;
class RandR11 implements RandR {
private static final boolean DEBUG = ScreenDriver.DEBUG;
-
- RandR11() {
+
+ RandR11() {
}
@Override
@@ -51,13 +51,13 @@ class RandR11 implements RandR {
public void dumpInfo(final long dpy, final int screen_idx) {
// NOP
}
-
+
private int widthMM=0, heightMM=0;
private int modeCount = 0;
private int resolutionCount = 0;
private int[][] nrates = null; // [nres_number][nrate_number]
private int[] idx_rate = null, idx_res = null;
-
+
@Override
public boolean beginInitialQuery(long dpy, ScreenDriver screen) {
// initialize iterators and static data
@@ -76,11 +76,11 @@ class RandR11 implements RandR {
return false;
}
}
-
+
for(int nresIdx=0; nresIdx < resolutionCount; nresIdx++) {
modeCount += nrates[nresIdx].length;
}
-
+
idx_rate = new int[modeCount];
idx_res = new int[modeCount];
@@ -94,23 +94,23 @@ class RandR11 implements RandR {
}
return true;
}
-
+
@Override
public void endInitialQuery(long dpy, ScreenDriver screen) {
idx_rate=null;
- idx_res=null;
- nrates=null;
+ idx_res=null;
+ nrates=null;
}
-
+
@Override
public int getMonitorDeviceCount(final long dpy, final ScreenDriver screen) {
return 1;
}
-
+
@Override
public int[] getAvailableRotations(final long dpy, final ScreenDriver screen, final int crt_idx) {
if( 0 < crt_idx ) {
- // RandR11 only supports 1 CRT
+ // RandR11 only supports 1 CRT
return null;
}
final int screen_idx = screen.getIndex();
@@ -120,17 +120,17 @@ class RandR11 implements RandR {
}
return availRotations;
}
-
+
@Override
public int[] getMonitorModeProps(final long dpy, final ScreenDriver screen, final int mode_idx) {
if( mode_idx >= modeCount ) {
return null;
- }
+ }
final int screen_idx = screen.getIndex();
-
+
final int nres_index = idx_res[mode_idx];
final int nrate_index = idx_rate[mode_idx];
-
+
final int[] res = getScreenResolution0(dpy, screen_idx, nres_index);
if(null==res || 0==res.length) {
return null;
@@ -144,7 +144,7 @@ class RandR11 implements RandR {
if( res[3] > heightMM ) {
heightMM = res[3];
}
-
+
int rate = nrates[nres_index][nrate_index];
if(0>=rate) {
rate = ScreenImpl.default_sm_rate;
@@ -166,13 +166,13 @@ class RandR11 implements RandR {
if( MonitorModeProps.NUM_MONITOR_MODE_PROPERTIES_ALL != i ) {
throw new InternalError("XX");
}
- return props;
+ return props;
}
-
+
@Override
public int[] getMonitorDeviceProps(final long dpy, final ScreenDriver screen, final MonitorModeProps.Cache cache, final int crt_idx) {
if( 0 < crt_idx ) {
- // RandR11 only supports 1 CRT
+ // RandR11 only supports 1 CRT
return null;
}
final int[] currentModeProps = getCurrentMonitorModeProps(dpy, screen, crt_idx);
@@ -194,15 +194,15 @@ class RandR11 implements RandR {
props[i++] = currentMode.getId(); // current mode id
props[i++] = currentMode.getRotation();
for(int j=0; j<allModesCount; j++) {
- props[i++] = cache.monitorModes.get(j).getId();
+ props[i++] = cache.monitorModes.get(j).getId();
}
return props;
}
-
+
@Override
public int[] getMonitorDeviceViewport(final long dpy, final ScreenDriver screen, final int crt_idx) {
if( 0 < crt_idx ) {
- // RandR11 only supports 1 CRT
+ // RandR11 only supports 1 CRT
return null;
}
final int screen_idx = screen.getIndex();
@@ -212,7 +212,7 @@ class RandR11 implements RandR {
}
int[] res;
final int nres_idx;
- try {
+ try {
int resNumber = getNumScreenResolutions0(dpy, screen_idx);
if(0==resNumber) {
return null;
@@ -241,13 +241,13 @@ class RandR11 implements RandR {
props[i++] = 0;
props[i++] = res[0]; // width
props[i++] = res[1]; // height
- return props;
+ return props;
}
-
+
@Override
public int[] getCurrentMonitorModeProps(final long dpy, final ScreenDriver screen, final int crt_idx) {
if( 0 < crt_idx ) {
- // RandR11 only supports 1 CRT
+ // RandR11 only supports 1 CRT
return null;
}
final int screen_idx = screen.getIndex();
@@ -258,7 +258,7 @@ class RandR11 implements RandR {
int[] res;
int rate, rot;
final int nres_idx;
- try {
+ try {
int resNumber = getNumScreenResolutions0(dpy, screen_idx);
if(0==resNumber) {
return null;
@@ -318,7 +318,7 @@ class RandR11 implements RandR {
final int resId = mode.getId();
if(0>resId || resId>=resolutionCount) {
throw new RuntimeException("Invalid resolution index: ! 0 < "+resId+" < "+resolutionCount+", "+monitor+", "+mode);
- }
+ }
final int f = (int)mode.getRefreshRate(); // simply cut-off, orig is int
final int r = mode.getRotation();
@@ -335,11 +335,11 @@ class RandR11 implements RandR {
}
return done;
}
-
+
@Override
public final void updateScreenViewport(final long dpy, final ScreenDriver screen, RectangleImmutable viewport) {
// nop
- }
+ }
/** @return int[] { rot1, .. } */
private static native int[] getAvailableScreenRotations0(long display, int screen_index);
@@ -353,7 +353,7 @@ class RandR11 implements RandR {
private static native long getScreenConfiguration0(long display, int screen_index);
private static native void freeScreenConfiguration0(long screenConfiguration);
-
+
private static native int getCurrentScreenResolutionIndex0(long screenConfiguration);
private static native int getCurrentScreenRate0(long screenConfiguration);
private static native int getCurrentScreenRotation0(long screenConfiguration);
@@ -361,5 +361,5 @@ class RandR11 implements RandR {
/** needs own Display connection for XRANDR event handling */
private static native boolean setCurrentScreenModeStart0(long display, int screen_index, long screenConfiguration, int mode_index, int freq, int rot);
private static native boolean setCurrentScreenModePollEnd0(long display, int screen_index, int mode_index, int freq, int rot);
-
+
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR13.java b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java
index ac83fc5..a08741d 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/RandR13.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java
@@ -43,19 +43,19 @@ import com.jogamp.newt.MonitorMode;
* <pre>
* MonitorMode.id == XRR mode-id (not index)
* MonitorDevice.id == XRR monitor-idx (not id)
- * </pre>
+ * </pre>
*/
class RandR13 implements RandR {
private static final boolean DEBUG = ScreenDriver.DEBUG;
-
- RandR13() {
+
+ RandR13() {
}
-
+
@Override
public final VersionNumber getVersion() {
return version130;
}
-
+
@Override
public void dumpInfo(final long dpy, final int screen_idx) {
long screenResources = getScreenResources0(dpy, screen_idx);
@@ -66,12 +66,12 @@ class RandR13 implements RandR {
dumpInfo0(dpy, screen_idx, screenResources);
} finally {
freeScreenResources0(screenResources);
- }
+ }
}
-
+
long sessionScreenResources = 0;
IntLongHashMap crtInfoHandleMap = null;
-
+
@Override
public boolean beginInitialQuery(long dpy, ScreenDriver screen) {
final int screen_idx = screen.getIndex();
@@ -84,7 +84,7 @@ class RandR13 implements RandR {
return false;
}
}
-
+
@Override
public void endInitialQuery(long dpy, ScreenDriver screen) {
if( null != crtInfoHandleMap ) {
@@ -100,7 +100,7 @@ class RandR13 implements RandR {
sessionScreenResources = 0;
}
}
-
+
private final long getScreenResourceHandle(final long dpy, final int screen_idx) {
if( 0 != sessionScreenResources ) {
return sessionScreenResources;
@@ -112,7 +112,7 @@ class RandR13 implements RandR {
freeScreenResources0( screenResourceHandle );
}
}
-
+
private final long getMonitorInfoHandle(final long dpy, final int screen_idx, long screenResources, final int monitor_idx) {
if( null != crtInfoHandleMap ) {
long h = crtInfoHandleMap.get(monitor_idx);
@@ -129,8 +129,8 @@ class RandR13 implements RandR {
if( null == crtInfoHandleMap ) {
freeMonitorInfoHandle0(monitorInfoHandle);
}
- }
-
+ }
+
@Override
public int getMonitorDeviceCount(final long dpy, final ScreenDriver screen) {
final int screen_idx = screen.getIndex();
@@ -141,7 +141,7 @@ class RandR13 implements RandR {
releaseScreenResourceHandle(screenResources);
}
}
-
+
@Override
public int[] getAvailableRotations(final long dpy, final ScreenDriver screen, final int crt_idx) {
final int screen_idx = screen.getIndex();
@@ -152,7 +152,7 @@ class RandR13 implements RandR {
final int[] availRotations = getAvailableRotations0(monitorInfo);
if(null==availRotations || 0==availRotations.length) {
return null;
- }
+ }
return availRotations;
} finally {
releaseMonitorInfoHandle(monitorInfo);
@@ -161,7 +161,7 @@ class RandR13 implements RandR {
releaseScreenResourceHandle(screenResources);
}
}
-
+
@Override
public int[] getMonitorModeProps(final long dpy, final ScreenDriver screen, final int mode_idx) {
final int screen_idx = screen.getIndex();
@@ -172,7 +172,7 @@ class RandR13 implements RandR {
releaseScreenResourceHandle(screenResources);
}
}
-
+
@Override
public int[] getMonitorDeviceProps(final long dpy, final ScreenDriver screen, MonitorModeProps.Cache cache, final int crt_idx) {
final int screen_idx = screen.getIndex();
@@ -188,9 +188,9 @@ class RandR13 implements RandR {
releaseScreenResourceHandle(screenResources);
}
}
-
+
@Override
- public int[] getMonitorDeviceViewport(final long dpy, final ScreenDriver screen, final int crt_idx) {
+ public int[] getMonitorDeviceViewport(final long dpy, final ScreenDriver screen, final int crt_idx) {
final int screen_idx = screen.getIndex();
final long screenResources = getScreenResourceHandle(dpy, screen_idx);
try {
@@ -204,7 +204,7 @@ class RandR13 implements RandR {
releaseScreenResourceHandle(screenResources);
}
}
-
+
@Override
public int[] getCurrentMonitorModeProps(final long dpy, final ScreenDriver screen, final int crt_idx) {
final int screen_idx = screen.getIndex();
@@ -220,7 +220,7 @@ class RandR13 implements RandR {
releaseScreenResourceHandle(screenResources);
}
}
-
+
@Override
public boolean setCurrentMonitorMode(final long dpy, final ScreenDriver screen, MonitorDevice monitor, final MonitorMode mode) {
final int screen_idx = screen.getIndex();
@@ -229,7 +229,7 @@ class RandR13 implements RandR {
try {
final long monitorInfo = getMonitorInfoHandle(dpy, screen_idx, screenResources, monitor.getId());
try {
- res = setMonitorMode0(dpy, screenResources, monitorInfo, monitor.getId(), mode.getId(), mode.getRotation(),
+ res = setMonitorMode0(dpy, screenResources, monitorInfo, monitor.getId(), mode.getId(), mode.getRotation(),
-1, -1); // no fixed position!
} finally {
releaseMonitorInfoHandle(monitorInfo);
@@ -239,36 +239,36 @@ class RandR13 implements RandR {
}
return res;
}
-
+
@Override
public final void updateScreenViewport(final long dpy, final ScreenDriver screen, final RectangleImmutable viewport) {
final int screen_idx = screen.getIndex();
final long screenResources = getScreenResourceHandle(dpy, screen_idx);
try {
- setScreenViewport0(dpy, screen_idx, screenResources, viewport.getX(), viewport.getY(), viewport.getWidth(), viewport.getHeight());
+ setScreenViewport0(dpy, screen_idx, screenResources, viewport.getX(), viewport.getY(), viewport.getWidth(), viewport.getHeight());
} finally {
dumpInfo0(dpy, screen_idx, screenResources);
releaseScreenResourceHandle(screenResources);
}
}
-
+
private static native long getScreenResources0(long display, int screen_index);
private static native void freeScreenResources0(long screenResources);
private static native void dumpInfo0(long display, int screen_index, long screenResources);
-
+
private static native int getMonitorDeviceCount0(long screenResources);
-
+
private static native long getMonitorInfoHandle0(long display, int screen_index, long screenResources, int monitor_index);
private static native void freeMonitorInfoHandle0(long monitorInfoHandle);
-
+
private static native int[] getAvailableRotations0(long monitorInfo);
private static native int[] getMonitorViewport0(long monitorInfo);
private static native int[] getMonitorCurrentMode0(long monitorInfo);
-
+
private static native int[] getMonitorMode0(long screenResources, int mode_index);
private static native int[] getMonitorCurrentMode0(long screenResources, long monitorInfo);
private static native int[] getMonitorDevice0(long display, long screenResources, long monitorInfo, int monitor_idx);
-
+
private static native boolean setMonitorMode0(long display, long screenResources, long monitorInfo, int monitor_idx, int mode_id, int rotation, int x, int y);
private static native boolean setScreenViewport0(long display, int screen_index, long screenResources, int x, int y, int width, int height);
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
index f37556d..bef7f60 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.x11;
@@ -54,19 +54,19 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen;
import com.jogamp.newt.MonitorDevice;
import com.jogamp.newt.MonitorMode;
-public class ScreenDriver extends ScreenImpl {
+public class ScreenDriver extends ScreenImpl {
protected static final boolean DEBUG_TEST_RANDR13_DISABLED;
-
+
static {
Debug.initSingleton();
DEBUG_TEST_RANDR13_DISABLED = Debug.isPropertyDefined("newt.test.Screen.disableRandR13", true);
-
+
DisplayDriver.initSingleton();
}
/** Ensure static init has been run. */
/* pp */static void initSingleton() { }
-
+
public ScreenDriver() {
}
@@ -74,14 +74,15 @@ public class ScreenDriver extends ScreenImpl {
protected void createNativeImpl() {
// validate screen index
Long handle = runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Long>() {
- public Long run(long dpy) {
+ @Override
+ public Long run(long dpy) {
return new Long(GetScreen0(dpy, screen_idx));
} } );
if (handle.longValue() == 0) {
throw new RuntimeException("Error creating screen: " + screen_idx);
}
- final X11GraphicsDevice x11dev = (X11GraphicsDevice) getDisplay().getGraphicsDevice();
- final long dpy = x11dev.getHandle();
+ final X11GraphicsDevice x11dev = (X11GraphicsDevice) getDisplay().getGraphicsDevice();
+ final long dpy = x11dev.getHandle();
aScreen = new X11GraphicsScreen(x11dev, screen_idx);
{
int v[] = getRandRVersion0(dpy);
@@ -118,7 +119,7 @@ public class ScreenDriver extends ScreenImpl {
if( rAndR.beginInitialQuery(device.getHandle(), this) ) {
try {
final int crtCount = rAndR.getMonitorDeviceCount(device.getHandle(), this);
-
+
// Gather all available rotations
final ArrayHashSet<Integer> availableRotations = new ArrayHashSet<Integer>();
for(int i = 0; i < crtCount; i++) {
@@ -129,7 +130,7 @@ public class ScreenDriver extends ScreenImpl {
availableRotations.addAll(rotationList);
}
}
-
+
// collect all modes, while injecting all available rotations
{
int modeIdx = 0;
@@ -147,8 +148,8 @@ public class ScreenDriver extends ScreenImpl {
if( cache.monitorModes.size() > 0 ) {
for(int i = 0; i < crtCount; i++) {
final int[] monitorProps = rAndR.getMonitorDeviceProps(device.getHandle(), this, cache, i);
- if( null != monitorProps &&
- MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES <= monitorProps[0] && // Enabled ? I.e. contains active modes ?
+ 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);
}
@@ -174,12 +175,13 @@ public class ScreenDriver extends ScreenImpl {
device.unlock();
}
}
-
+
@Override
protected MonitorMode queryCurrentMonitorModeImpl(final MonitorDevice monitor) {
if( null == rAndR ) { return null; }
-
+
return runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<MonitorMode>() {
+ @Override
public MonitorMode run(long dpy) {
final int[] currentModeProps = rAndR.getCurrentMonitorModeProps(dpy, ScreenDriver.this, monitor.getId());
return MonitorModeProps.streamInMonitorMode(null, null, currentModeProps, 0);
@@ -189,14 +191,15 @@ public class ScreenDriver extends ScreenImpl {
@Override
protected boolean setCurrentMonitorModeImpl(final MonitorDevice monitor, final MonitorMode mode) {
if( null == rAndR ) { return false; }
-
+
final long t0 = System.currentTimeMillis();
boolean done = runWithOptTempDisplayHandle( new DisplayImpl.DisplayRunnable<Boolean>() {
+ @Override
public Boolean run(long dpy) {
return Boolean.valueOf( rAndR.setCurrentMonitorMode(dpy, ScreenDriver.this, monitor, mode) );
- }
+ }
}).booleanValue();
-
+
if(DEBUG || !done) {
System.err.println("X11Screen.setCurrentMonitorModeImpl: TO ("+SCREEN_MODE_CHANGE_TIMEOUT+") reached: "+
(System.currentTimeMillis()-t0)+"ms; "+monitor.getCurrentMode()+" -> "+mode);
@@ -205,10 +208,11 @@ public class ScreenDriver extends ScreenImpl {
}
private DisplayImpl.DisplayRunnable<Boolean> xineramaEnabledQueryWithTemp = new DisplayImpl.DisplayRunnable<Boolean>() {
- public Boolean run(long dpy) {
- return new Boolean(X11Util.XineramaIsEnabled(dpy));
+ @Override
+ public Boolean run(long dpy) {
+ return new Boolean(X11Util.XineramaIsEnabled(dpy));
} };
-
+
@Override
protected int validateScreenIndex(final int idx) {
final DisplayDriver x11Display = (DisplayDriver) getDisplay();
@@ -219,7 +223,7 @@ public class ScreenDriver extends ScreenImpl {
return runWithTempDisplayHandle( xineramaEnabledQueryWithTemp ).booleanValue() ? 0 : idx;
}
}
-
+
@Override
protected void calcVirtualScreenOriginAndSize(final Rectangle vOriginSize) {
final RectangleImmutable ov = (RectangleImmutable) getViewport().cloneMutable();
@@ -236,28 +240,26 @@ public class ScreenDriver extends ScreenImpl {
} } );
} else */ {
runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() {
+ @Override
public Object run(long dpy) {
- vOriginSize.setX(0);
- vOriginSize.setY(0);
- vOriginSize.setWidth(getWidth0(dpy, screen_idx));
- vOriginSize.setHeight(getHeight0(dpy, screen_idx));
+ vOriginSize.set(0, 0, getWidth0(dpy, screen_idx), getHeight0(dpy, screen_idx));
return null;
} } );
if( DEBUG ) {
System.err.println("X11Screen.calcVirtualScreenOriginAndSize: Querying X11: "+ov+" -> "+vOriginSize);
}
}
- }
-
+ }
+
//----------------------------------------------------------------------
// Internals only
- //
+ //
private final <T> T runWithLockedDisplayDevice(DisplayRunnable<T> action) {
return display.runWithLockedDisplayDevice(action);
}
-
+
private final <T> T runWithTempDisplayHandle(DisplayRunnable<T> action) {
- final long displayHandle = X11Util.openDisplay(display.getName());
+ final long displayHandle = X11Util.openDisplay(display.getName());
if(0 == displayHandle) {
throw new RuntimeException("null device");
}
@@ -269,7 +271,7 @@ public class ScreenDriver extends ScreenImpl {
}
return res;
}
-
+
private final <T> T runWithOptTempDisplayHandle(DisplayRunnable<T> action) {
if( null != rAndR && rAndR.getVersion().compareTo(RandR.version130) >= 0 ) {
return display.runWithLockedDisplayDevice(action);
@@ -277,12 +279,12 @@ public class ScreenDriver extends ScreenImpl {
return runWithTempDisplayHandle(action);
}
}
-
+
private static native long GetScreen0(long dpy, int scrn_idx);
private static native int getWidth0(long display, int scrn_idx);
private static native int getHeight0(long display, int scrn_idx);
-
+
private static native int[] getRandRVersion0(long display);
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
index 4786ea0..5e1f7a6 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2008 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
@@ -29,7 +29,7 @@
* 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.
- *
+ *
*/
package jogamp.newt.driver.x11;
@@ -57,7 +57,7 @@ public class WindowDriver extends WindowImpl {
private static final int X11_WHEEL_ONE_DOWN_BUTTON = 5;
private static final int X11_WHEEL_TWO_UP_BUTTON = 6;
private static final int X11_WHEEL_TWO_DOWN_BUTTON = 7;
-
+
static {
ScreenDriver.initSingleton();
}
@@ -70,21 +70,21 @@ public class WindowDriver extends WindowImpl {
final ScreenDriver screen = (ScreenDriver) getScreen();
final DisplayDriver display = (DisplayDriver) screen.getDisplay();
final AbstractGraphicsDevice edtDevice = display.getGraphicsDevice();
-
- // Decoupled X11 Device/Screen allowing X11 display lock-free off-thread rendering
+
+ // Decoupled X11 Device/Screen allowing X11 display lock-free off-thread rendering
final long renderDeviceHandle = X11Util.openDisplay(edtDevice.getConnection());
if( 0 == renderDeviceHandle ) {
throw new RuntimeException("Error creating display(GfxCfg/Render): "+edtDevice.getConnection());
}
renderDevice = new X11GraphicsDevice(renderDeviceHandle, AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */);
final AbstractGraphicsScreen renderScreen = new X11GraphicsScreen(renderDevice, screen.getIndex());
-
+
final GraphicsConfigurationFactory factory = GraphicsConfigurationFactory.getFactory(display.getGraphicsDevice(), capsRequested);
final AbstractGraphicsConfiguration cfg = factory.chooseGraphicsConfiguration(
capsRequested, capsRequested, capabilitiesChooser, renderScreen, VisualIDHolder.VID_UNDEFINED);
if(DEBUG_IMPLEMENTATION) {
System.err.println("X11Window.createNativeImpl() factory: "+factory+", chosen config: "+cfg);
- }
+ }
if (null == cfg) {
throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this);
}
@@ -93,13 +93,13 @@ public class WindowDriver extends WindowImpl {
throw new NativeWindowException("Chosen Configuration w/o native visual ID: "+cfg);
}
setGraphicsConfiguration(cfg);
- final int flags = getReconfigureFlags(0, true) &
+ final int flags = getReconfigureFlags(0, true) &
( FLAG_IS_ALWAYSONTOP | FLAG_IS_UNDECORATED ) ;
edtDevice.lock();
- try {
+ try {
setWindowHandle(CreateWindow0(getParentWindowHandle(),
- edtDevice.getHandle(), screen.getIndex(), visualID,
- display.getJavaObjectAtom(), display.getWindowDeleteAtom(),
+ edtDevice.getHandle(), screen.getIndex(), visualID,
+ display.getJavaObjectAtom(), display.getWindowDeleteAtom(),
getX(), getY(), getWidth(), getHeight(), autoPosition(), flags));
} finally {
edtDevice.unlock();
@@ -117,10 +117,10 @@ public class WindowDriver extends WindowImpl {
final AbstractGraphicsDevice edtDevice = display.getGraphicsDevice();
edtDevice.lock();
try {
- CloseWindow0(edtDevice.getHandle(), windowHandleClose,
+ CloseWindow0(edtDevice.getHandle(), windowHandleClose,
display.getJavaObjectAtom(), display.getWindowDeleteAtom() /* , display.getKbdHandle() */); // XKB disabled for now
} catch (Throwable t) {
- if(DEBUG_IMPLEMENTATION) {
+ if(DEBUG_IMPLEMENTATION) {
Exception e = new Exception("Warning: closeNativeImpl failed - "+Thread.currentThread().getName(), t);
e.printStackTrace();
}
@@ -135,7 +135,7 @@ public class WindowDriver extends WindowImpl {
}
}
- /**
+ /**
* <p>
* X11 Window supports {@link #FLAG_IS_FULLSCREEN_SPAN}
* </p>
@@ -145,7 +145,7 @@ public class WindowDriver extends WindowImpl {
protected boolean isReconfigureFlagSupported(int changeFlags) {
return true; // all flags!
}
-
+
@Override
protected boolean reconfigureWindowImpl(final int x, final int y, final int width, final int height, int flags) {
if(DEBUG_IMPLEMENTATION) {
@@ -153,8 +153,8 @@ public class WindowDriver extends WindowImpl {
}
final int _x, _y;
if(0 == ( FLAG_IS_UNDECORATED & flags)) {
- final InsetsImmutable i = getInsets();
-
+ final InsetsImmutable i = getInsets();
+
// client position -> top-level window position
_x = x - i.getLeftWidth() ;
_y = y - i.getTopHeight() ;
@@ -163,7 +163,7 @@ public class WindowDriver extends WindowImpl {
_y = y;
}
if( 0 != ( FLAG_CHANGE_FULLSCREEN & flags ) ) {
- if( 0 != ( FLAG_IS_FULLSCREEN & flags) && 0 != ( FLAG_IS_FULLSCREEN_SPAN & flags) && 0 == ( FLAG_IS_ALWAYSONTOP & flags) ) {
+ if( 0 != ( FLAG_IS_FULLSCREEN & flags) && 0 == ( FLAG_IS_ALWAYSONTOP & flags) ) {
tempFSAlwaysOnTop = true;
flags |= FLAG_IS_ALWAYSONTOP;
if(DEBUG_IMPLEMENTATION) {
@@ -176,8 +176,9 @@ public class WindowDriver extends WindowImpl {
final int fflags = flags;
final DisplayDriver display = (DisplayDriver) getScreen().getDisplay();
runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() {
+ @Override
public Object run(long dpy) {
- reconfigureWindow0( dpy, getScreenIndex(),
+ reconfigureWindow0( dpy, getScreenIndex(),
getParentWindowHandle(), getWindowHandle(), display.getWindowDeleteAtom(),
_x, _y, width, height, fflags);
return null;
@@ -202,27 +203,29 @@ public class WindowDriver extends WindowImpl {
}
final DisplayDriver display = (DisplayDriver) getScreen().getDisplay();
runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() {
+ @Override
public Object run(long dpy) {
reconfigureWindow0( dpy, getScreenIndex(),
getParentWindowHandle(), getWindowHandle(), display.getWindowDeleteAtom(),
- getX(), getY(), getWidth(), getHeight(), flags);
+ getX(), getY(), getWidth(), getHeight(), flags);
return null;
}
});
}
super.focusChanged(defer, focusGained);
}
-
+
protected void reparentNotify(long newParentWindowHandle) {
if(DEBUG_IMPLEMENTATION) {
final long p0 = getParentWindowHandle();
System.err.println("Window.reparentNotify ("+getThreadName()+"): "+toHexString(p0)+" -> "+toHexString(newParentWindowHandle));
}
}
-
+
@Override
- protected void requestFocusImpl(final boolean force) {
+ protected void requestFocusImpl(final boolean force) {
runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() {
+ @Override
public Object run(long dpy) {
requestFocus0(dpy, getWindowHandle(), force);
return null;
@@ -233,16 +236,18 @@ public class WindowDriver extends WindowImpl {
@Override
protected void setTitleImpl(final String title) {
runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() {
+ @Override
public Object run(long dpy) {
setTitle0(dpy, getWindowHandle(), title);
return null;
}
});
}
-
+
@Override
protected boolean setPointerVisibleImpl(final boolean pointerVisible) {
return runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Boolean>() {
+ @Override
public Boolean run(long dpy) {
return Boolean.valueOf(setPointerVisible0(dpy, getWindowHandle(), pointerVisible));
}
@@ -252,25 +257,28 @@ public class WindowDriver extends WindowImpl {
@Override
protected boolean confinePointerImpl(final boolean confine) {
return runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Boolean>() {
+ @Override
public Boolean run(long dpy) {
return Boolean.valueOf(confinePointer0(dpy, getWindowHandle(), confine));
}
}).booleanValue();
}
-
+
@Override
protected void warpPointerImpl(final int x, final int y) {
runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Object>() {
+ @Override
public Object run(long dpy) {
warpPointer0(dpy, getWindowHandle(), x, y);
return null;
}
});
}
-
+
@Override
protected Point getLocationOnScreenImpl(final int x, final int y) {
return runWithLockedDisplayDevice( new DisplayImpl.DisplayRunnable<Point>() {
+ @Override
public Point run(long dpy) {
return X11Lib.GetRelativeLocation(dpy, getScreenIndex(), getWindowHandle(), 0 /*root win*/, x, y);
}
@@ -279,9 +287,9 @@ public class WindowDriver extends WindowImpl {
@Override
protected void updateInsetsImpl(Insets insets) {
- // nop - using event driven insetsChange(..)
+ // nop - using event driven insetsChange(..)
}
-
+
@Override
protected final void doMouseEvent(boolean enqueue, boolean wait, short eventType, int modifiers,
int x, int y, short button, float[] rotationXYZ, float rotationScale) {
@@ -321,34 +329,34 @@ public class WindowDriver extends WindowImpl {
rotationXYZ[0] = -1;
modifiers |= InputEvent.SHIFT_MASK;
break;
- }
+ }
break;
}
super.doMouseEvent(enqueue, wait, eventType, modifiers, x, y, button, rotationXYZ, rotationScale);
}
-
+
/** Called by native TK */
protected final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar0, String keyString) {
// handleKeyEvent(true, false, eventType, modifiers, keyCode, keyChar);
final boolean isModifierKey = KeyEvent.isModifierKey(keyCode);
final boolean isAutoRepeat = 0 != ( KeyEvent.AUTOREPEAT_MASK & modifiers );
- final char keyChar = ( null != keyString ) ? keyString.charAt(0) : keyChar0;
+ final char keyChar = ( null != keyString ) ? keyString.charAt(0) : keyChar0;
// System.err.println("*** sendKeyEvent: event "+KeyEvent.getEventTypeString(eventType)+", keyCode "+toHexString(keyCode)+", keyChar <"+keyChar0+">/<"+keyChar+">, keyString "+keyString+", mods "+toHexString(modifiers)+
// ", isKeyCodeTracked "+isKeyCodeTracked(keyCode)+", was: pressed "+isKeyPressed(keyCode)+", repeat "+isAutoRepeat+", [modifierKey "+isModifierKey+"] - "+System.currentTimeMillis());
-
+
if( !isAutoRepeat || !isModifierKey ) { // ! ( isModifierKey && isAutoRepeat )
switch(eventType) {
case KeyEvent.EVENT_KEY_PRESSED:
super.sendKeyEvent(KeyEvent.EVENT_KEY_PRESSED, modifiers, keyCode, keySym, keyChar);
break;
-
+
case KeyEvent.EVENT_KEY_RELEASED:
super.sendKeyEvent(KeyEvent.EVENT_KEY_RELEASED, modifiers, keyCode, keySym, keyChar);
break;
}
}
}
-
+
@Override
public final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
throw new InternalError("XXX: Adapt Java Code to Native Code Changes");
@@ -357,33 +365,33 @@ public class WindowDriver extends WindowImpl {
public final void enqueueKeyEvent(boolean wait, short eventType, int modifiers, short keyCode, short keySym, char keyChar) {
throw new InternalError("XXX: Adapt Java Code to Native Code Changes");
}
-
+
//----------------------------------------------------------------------
// 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 final <T> T runWithLockedDisplayDevice(DisplayRunnable<T> action) {
return ((DisplayDriver) getScreen().getDisplay()).runWithLockedDisplayDevice(action);
}
protected static native boolean initIDs0();
-
- private native long CreateWindow0(long parentWindowHandle, long display, int screen_index,
- int visualID, long javaObjectAtom, long windowDeleteAtom,
- int x, int y, int width, int height, boolean autoPosition, int flags);
+
+ private native long CreateWindow0(long parentWindowHandle, long display, int screen_index,
+ int visualID, long javaObjectAtom, long windowDeleteAtom,
+ int x, int y, int width, int height, boolean autoPosition, int flags);
private native void CloseWindow0(long display, long windowHandle, long javaObjectAtom, long windowDeleteAtom /*, long kbdHandle*/ ); // XKB disabled for now
private native void reconfigureWindow0(long display, int screen_index, long parentWindowHandle, long windowHandle,
- long windowDeleteAtom, int x, int y, int width, int height, int flags);
+ long windowDeleteAtom, int x, int y, int width, int height, int flags);
private native void requestFocus0(long display, long windowHandle, boolean force);
-
+
private static native void setTitle0(long display, long windowHandle, String title);
private static native long getParentWindow0(long display, long windowHandle);
private static native boolean setPointerVisible0(long display, long windowHandle, boolean visible);
private static native boolean confinePointer0(long display, long windowHandle, boolean grab);
private static native void warpPointer0(long display, long windowHandle, int x, int y);
-
+
private long windowHandleClose;
private X11GraphicsDevice renderDevice;
}
diff --git a/src/newt/classes/jogamp/newt/event/NEWTEventTask.java b/src/newt/classes/jogamp/newt/event/NEWTEventTask.java
index 93d5e2f..38a4342 100644
--- a/src/newt/classes/jogamp/newt/event/NEWTEventTask.java
+++ b/src/newt/classes/jogamp/newt/event/NEWTEventTask.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.newt.event;
import com.jogamp.newt.event.NEWTEvent;
diff --git a/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java b/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java
index d465620..db89690 100644
--- a/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java
+++ b/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java
@@ -40,20 +40,21 @@ import com.jogamp.newt.util.EDTUtil;
*/
public class SWTEDTUtil implements EDTUtil {
public static final boolean DEBUG = Debug.debug("EDT");
-
+
private final Object edtLock = new Object(); // locking the EDT start/stop state
- private final ThreadGroup threadGroup;
+ private final ThreadGroup threadGroup;
private final String name;
private final Runnable dispatchMessages;
private final org.eclipse.swt.widgets.Display swtDisplay;
private NEDT nedt = null;
private int start_iter=0;
private static long pollPeriod = EDTUtil.defaultEDTPollPeriod;
-
+
public SWTEDTUtil(final com.jogamp.newt.Display newtDisplay, org.eclipse.swt.widgets.Display swtDisplay) {
this.threadGroup = Thread.currentThread().getThreadGroup();
this.name=Thread.currentThread().getName()+"-SWTDisplay-"+newtDisplay.getFQName()+"-EDT-";
this.dispatchMessages = new Runnable() {
+ @Override
public void run() {
((jogamp.newt.DisplayImpl) newtDisplay).dispatchMessages();
} };
@@ -61,11 +62,11 @@ public class SWTEDTUtil implements EDTUtil {
this.nedt = new NEDT(threadGroup, name);
this.nedt.setDaemon(true); // don't stop JVM from shutdown ..
}
-
+
public final org.eclipse.swt.widgets.Display getDisplay() {
return swtDisplay;
}
-
+
@Override
public long getPollPeriod() {
return pollPeriod;
@@ -77,7 +78,7 @@ public class SWTEDTUtil implements EDTUtil {
}
@Override
- public final boolean restart() throws IllegalStateException {
+ public final boolean start() throws IllegalStateException {
final boolean swtDisposed = swtDisplay.isDisposed();
synchronized(edtLock) {
if( nedt.isRunning() ) {
@@ -116,7 +117,7 @@ public class SWTEDTUtil implements EDTUtil {
}
nedt.start();
}
-
+
@Override
public boolean isCurrentThreadEDT() {
return !swtDisplay.isDisposed() && swtDisplay.getThread() == Thread.currentThread();
@@ -126,18 +127,18 @@ public class SWTEDTUtil implements EDTUtil {
public final boolean isCurrentThreadNEDT() {
return nedt == Thread.currentThread();
}
-
+
@Override
public final boolean isCurrentThreadEDTorNEDT() {
final Thread ct = Thread.currentThread();
return ( !swtDisplay.isDisposed() && ct == swtDisplay.getThread() ) || ct == nedt ;
}
-
+
@Override
public boolean isRunning() {
return nedt.isRunning();
}
-
+
@Override
public final boolean invokeStop(boolean wait, Runnable task) {
return invokeImpl(wait, task, true);
@@ -147,12 +148,12 @@ public class SWTEDTUtil implements EDTUtil {
public final boolean invoke(boolean wait, Runnable task) {
return invokeImpl(wait, task, false);
}
-
+
private static Runnable nullTask = new Runnable() {
@Override
- public void run() { }
+ public void run() { }
};
-
+
private final boolean invokeImpl(boolean wait, Runnable task, boolean stop) {
Throwable throwable = null;
RunnableTask rTask = null;
@@ -165,12 +166,12 @@ public class SWTEDTUtil implements EDTUtil {
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();
}
- return false;
+ return false;
}
if( swtDisplay.isDisposed() ) {
stop = true;
}
-
+
if( isCurrentThreadEDT() ) {
if(null != task) {
task.run();
@@ -179,7 +180,7 @@ public class SWTEDTUtil implements EDTUtil {
if( stop ) {
nedt.shouldStop = true;
}
- } else {
+ } else {
if( !nedt.isRunning && !swtDisplay.isDisposed() ) {
if( null != task ) {
if( stop ) {
@@ -210,11 +211,11 @@ public class SWTEDTUtil implements EDTUtil {
return false;
}
}
-
+
if( null != task ) {
rTask = new RunnableTask(task,
wait ? rTaskLock : null,
- true /* always catch and report Exceptions, don't disturb EDT */,
+ true /* always catch and report Exceptions, don't disturb EDT */,
wait ? null : System.err);
swtDisplay.asyncExec(rTask);
}
@@ -238,7 +239,7 @@ public class SWTEDTUtil implements EDTUtil {
}
return true;
}
- }
+ }
@Override
final public boolean waitUntilIdle() {
@@ -252,6 +253,7 @@ public class SWTEDTUtil implements EDTUtil {
}
try {
swtDisplay.syncExec(new Runnable() {
+ @Override
public void run() { }
});
} catch (Exception e) { }
@@ -278,7 +280,7 @@ public class SWTEDTUtil implements EDTUtil {
}
}
}
-
+
class NEDT extends Thread {
volatile boolean shouldStop = false;
volatile boolean isRunning = false;
@@ -298,7 +300,7 @@ public class SWTEDTUtil implements EDTUtil {
super.start();
}
- /**
+ /**
* Utilizing locking only on tasks and its execution,
* not for event dispatching.
*/
@@ -315,7 +317,7 @@ public class SWTEDTUtil implements EDTUtil {
// EDT invoke thread is SWT-EDT,
// hence dispatching is required to run on SWT-EDT as well.
// Otherwise a deadlock may happen due to dispatched event's
- // triggering a locking action.
+ // triggering a locking action.
if ( !swtDisplay.isDisposed() ) {
swtDisplay.syncExec(dispatchMessages);
} else {
@@ -343,7 +345,7 @@ public class SWTEDTUtil implements EDTUtil {
}
} finally {
if(DEBUG) {
- System.err.println(getName()+": SWT-EDT run() END "+ getName()+", "+error);
+ System.err.println(getName()+": SWT-EDT run() END "+ getName()+", "+error);
}
synchronized(edtLock) {
isRunning = false;
@@ -358,5 +360,5 @@ public class SWTEDTUtil implements EDTUtil {
} // finally
} // run()
} // EventDispatchThread
-
+
}
diff --git a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java
index 3782a11..b5c45c1 100644
--- a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java
+++ b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.newt.swt.event;
import org.eclipse.swt.SWT;
@@ -206,7 +206,7 @@ public class SWTNewtEventFactory {
}
return res;
}
-
+
public static final com.jogamp.newt.event.MouseEvent createMouseEvent(org.eclipse.swt.widgets.Event event, Object source) {
switch(event.type) {
case SWT.MouseDown:
@@ -229,7 +229,7 @@ public class SWTNewtEventFactory {
}
int mods = swtModifiers2Newt(event.stateMask, true);
-
+
if( source instanceof com.jogamp.newt.Window) {
final com.jogamp.newt.Window newtSource = (com.jogamp.newt.Window)source;
if(newtSource.isPointerConfined()) {
@@ -239,7 +239,7 @@ public class SWTNewtEventFactory {
mods |= InputEvent.INVISIBLE_MASK;
}
}
-
+
return new com.jogamp.newt.event.MouseEvent(
type, (null==source)?(Object)event.data:source, (0xFFFFFFFFL & (long)event.time),
mods, event.x, event.y, (short)event.count, (short)event.button, MouseEvent.getRotationXYZ(rotation, mods), 1f);
@@ -260,32 +260,32 @@ public class SWTNewtEventFactory {
final short newtKeyCode = swtKeyCode2NewtKeyCode( event.keyCode );
return com.jogamp.newt.event.KeyEvent.create(
type, (null==source)?(Object)event.data:source, (0xFFFFFFFFL & (long)event.time),
- swtModifiers2Newt(event.stateMask, false),
+ swtModifiers2Newt(event.stateMask, false),
newtKeyCode, newtKeyCode, event.character);
}
return null; // no mapping ..
}
-
+
//
//
//
-
+
short dragButtonDown = 0;
-
+
public SWTNewtEventFactory() {
resetButtonsDown();
}
-
+
final void resetButtonsDown() {
dragButtonDown = 0;
}
-
+
public final boolean dispatchMouseEvent(org.eclipse.swt.widgets.Event event, Object source, com.jogamp.newt.event.MouseListener l) {
com.jogamp.newt.event.MouseEvent res = createMouseEvent(event, source);
if(null != res) {
if(null != l) {
switch(event.type) {
- case SWT.MouseDown:
+ case SWT.MouseDown:
dragButtonDown = (short) event.button;
l.mousePressed(res); break;
case SWT.MouseUp:
@@ -293,7 +293,7 @@ public class SWTNewtEventFactory {
l.mouseReleased(res);
{
final com.jogamp.newt.event.MouseEvent res2 = new com.jogamp.newt.event.MouseEvent(
- com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_CLICKED,
+ com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_CLICKED,
res.getSource(),
res.getWhen(), res.getModifiers(),
res.getX(), res.getY(), res.getClickCount(),
@@ -304,7 +304,7 @@ public class SWTNewtEventFactory {
case SWT.MouseMove:
if( 0 < dragButtonDown ) {
final com.jogamp.newt.event.MouseEvent res2 = new com.jogamp.newt.event.MouseEvent(
- com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_DRAGGED,
+ com.jogamp.newt.event.MouseEvent.EVENT_MOUSE_DRAGGED,
res.getSource(),
res.getWhen(), res.getModifiers(),
res.getX(), res.getY(), res.getClickCount(),
@@ -315,14 +315,14 @@ public class SWTNewtEventFactory {
}
break;
case SWT.MouseEnter:
- l.mouseEntered(res);
+ l.mouseEntered(res);
break;
case SWT.MouseExit:
resetButtonsDown();
- l.mouseExited(res);
+ l.mouseExited(res);
break;
case SWT.MouseVerticalWheel:
- l.mouseWheelMoved(res);
+ l.mouseWheelMoved(res);
break;
}
}
@@ -337,7 +337,7 @@ public class SWTNewtEventFactory {
if(null != l) {
switch(event.type) {
case SWT.KeyDown:
- l.keyPressed(res);
+ l.keyPressed(res);
break;
case SWT.KeyUp:
l.keyReleased(res);
@@ -347,9 +347,9 @@ public class SWTNewtEventFactory {
return true;
}
return false;
- }
-
- public final void attachDispatchListener(final org.eclipse.swt.widgets.Control ctrl, final Object source,
+ }
+
+ public final void attachDispatchListener(final org.eclipse.swt.widgets.Control ctrl, final Object source,
final com.jogamp.newt.event.MouseListener ml,
final com.jogamp.newt.event.KeyListener kl) {
final Listener listener = new Listener () {
diff --git a/src/newt/native/MacWindow.m b/src/newt/native/MacWindow.m
index 1c7064a..f0ed170 100644
--- a/src/newt/native/MacWindow.m
+++ b/src/newt/native/MacWindow.m
@@ -716,8 +716,15 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_initWindow0
rectWin = NSMakeRect(x, y, w, h);
}
- [myWindow setReleasedWhenClosed: YES]; // default
+ [myWindow setReleasedWhenClosed: NO]; // We control NSWindow destruction!
[myWindow setPreservesContentDuringLiveResize: NO];
+NS_DURING
+ if ( [myWindow respondsToSelector:@selector(setRestorable:)] ) {
+ // Available >= 10.7 - Removes restauration 'feature', really close
+ [myWindow setRestorable: NO];
+ }
+NS_HANDLER
+NS_ENDHANDLER
NSObject* nsParentObj = (NSObject*) ((intptr_t) parent);
NSWindow* parentWindow = NULL;
@@ -764,27 +771,27 @@ NS_ENDHANDLER
// specify we want mouse-moved events
[myWindow setAcceptsMouseMovedEvents:YES];
- DBG_PRINT( "initWindow0.%d - %p,%d view %p,%d, isVisible %d\n",
- dbgIdx++, myWindow, getRetainCount(myWindow), myView, getRetainCount(myView), [myWindow isVisible]);
+ DBG_PRINT( "initWindow0.%d - %p view %p, isVisible %d\n",
+ dbgIdx++, myWindow, myView, [myWindow isVisible]);
// Set the content view
changeContentView(env, jthis, parentView, myWindow, myView, NO);
- DBG_PRINT( "initWindow0.%d - %p,%d view %p,%d, isVisible %d\n",
- dbgIdx++, myWindow, getRetainCount(myWindow), myView, getRetainCount(myView), [myWindow isVisible]);
+ DBG_PRINT( "initWindow0.%d - %p view %p, isVisible %d\n",
+ dbgIdx++, myWindow, myView, [myWindow isVisible]);
if(NULL!=parentWindow) {
[myWindow attachToParent: parentWindow];
}
- DBG_PRINT( "initWindow0.%d - %p,%d view %p,%d, isVisible %d, visible %d\n",
- dbgIdx++, myWindow, getRetainCount(myWindow), myView, getRetainCount(myView), [myWindow isVisible], visible);
+ DBG_PRINT( "initWindow0.%d - %p view %p, isVisible %d, visible %d\n",
+ dbgIdx++, myWindow, myView, [myWindow isVisible], visible);
// Immediately re-position this window based on an upper-left coordinate system
setWindowClientTopLeftPointAndSize(myWindow, x, y, w, h, NO);
- DBG_PRINT( "initWindow0.%d - %p,%d view %p,%d, isVisible %d\n",
- dbgIdx++, myWindow, getRetainCount(myWindow), myView, getRetainCount(myView), [myWindow isVisible]);
+ DBG_PRINT( "initWindow0.%d - %p view %p, isVisible %d\n",
+ dbgIdx++, myWindow, myView, [myWindow isVisible]);
NS_DURING
// concurrent view rendering
@@ -793,8 +800,8 @@ NS_DURING
[myWindow setAllowsConcurrentViewDrawing: YES];
}
- DBG_PRINT( "initWindow0.%d - %p,%d view %p,%d, isVisible %d\n",
- dbgIdx++, myWindow, getRetainCount(myWindow), myView, getRetainCount(myView), [myWindow isVisible]);
+ DBG_PRINT( "initWindow0.%d - %p view %p, isVisible %d\n",
+ dbgIdx++, myWindow, myView, [myWindow isVisible]);
if ( [myView respondsToSelector:@selector(setCanDrawConcurrently:)] ) {
[myView setCanDrawConcurrently: YES];
@@ -802,16 +809,16 @@ NS_DURING
NS_HANDLER
NS_ENDHANDLER
- DBG_PRINT( "initWindow0.%d - %p,%d view %p,%d, isVisible %d\n",
- dbgIdx++, myWindow, getRetainCount(myWindow), myView, getRetainCount(myView), [myWindow isVisible]);
+ DBG_PRINT( "initWindow0.%d - %p view %p, isVisible %d\n",
+ dbgIdx++, myWindow, myView, [myWindow isVisible]);
// visible on front
if( visible ) {
[myWindow orderFront: myWindow];
}
- DBG_PRINT( "initWindow0.%d - %p,%d view %p,%d, isVisible %d\n",
- dbgIdx++, myWindow, getRetainCount(myWindow), myView, getRetainCount(myView), [myWindow isVisible]);
+ DBG_PRINT( "initWindow0.%d - %p view %p, isVisible %d\n",
+ dbgIdx++, myWindow, myView, [myWindow isVisible]);
// force surface creation
// [myView lockFocus];
@@ -831,16 +838,18 @@ NS_ENDHANDLER
// right mouse button down events
[myView setNextResponder: myWindow];
- DBG_PRINT( "initWindow0.X - %p (this), %p (parent): new window: %p, view %p,%d\n",
- (void*)(intptr_t)jthis, (void*)(intptr_t)parent, myWindow, myView, getRetainCount(myView));
+ DBG_PRINT( "initWindow0.%d - %p (this), %p (parent): new window: %p, view %p\n",
+ dbgIdx++, (void*)(intptr_t)jthis, (void*)(intptr_t)parent, myWindow, myView);
[myView setDestroyNotifySent: false];
setJavaWindowObject(env, jthis, myView, YES);
- DBG_PRINT( "initWindow0.X - %p (this), %p (parent): new window: %p, view %p,%d\n",
- (void*)(intptr_t)jthis, (void*)(intptr_t)parent, myWindow, myView, getRetainCount(myView));
+ DBG_PRINT( "initWindow0.%d - %p (this), %p (parent): new window: %p, view %p\n",
+ dbgIdx++, (void*)(intptr_t)jthis, (void*)(intptr_t)parent, myWindow, myView);
[pool release];
+ DBG_PRINT( "initWindow0.X - %p (this), %p (parent): new window: %p, view %p\n",
+ (void*)(intptr_t)jthis, (void*)(intptr_t)parent, myWindow, myView);
}
/**
@@ -855,16 +864,36 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_close0
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NewtMacWindow* mWin = (NewtMacWindow*) ((intptr_t) window);
+ if( NULL == mWin ) {
+ DBG_PRINT( "windowClose.0 - NULL NEWT win - abort\n");
+ return;
+ }
+ BOOL isNSWin = [mWin isKindOfClass:[NSWindow class]];
+ BOOL isNewtWin = [mWin isKindOfClass:[NewtMacWindow class]];
+ NSWindow *pWin = [mWin parentWindow];
+ DBG_PRINT( "windowClose.0 - %p [isNSWindow %d, isNewtWin %d], parent %p\n", mWin, isNSWin, isNewtWin, pWin);
+ if( !isNewtWin ) {
+ DBG_PRINT( "windowClose.0 - Not a NEWT win - abort\n");
+ return;
+ }
NewtView* mView = (NewtView *)[mWin contentView];
- NSWindow* pWin = [mWin parentWindow];
- BOOL destroyNotifySent = (NULL != mView) ? [mView getDestroyNotifySent] : false;
+ BOOL destroyNotifySent, isNSView, isNewtView;
+ if( NULL != mView ) {
+ isNSView = [mView isKindOfClass:[NSView class]];
+ isNewtView = [mView isKindOfClass:[NewtView class]];
+ destroyNotifySent = isNewtView ? [mView getDestroyNotifySent] : false;
+ } else {
+ isNSView = false;
+ isNewtView = false;
+ destroyNotifySent = false;
+ }
- DBG_PRINT( "windowClose.0 - %p,%d, destroyNotifySent %d, view %p,%d, parent %p\n",
- mWin, getRetainCount(mWin), destroyNotifySent, mView, getRetainCount(mView), pWin);
+ DBG_PRINT( "windowClose.0 - %p, destroyNotifySent %d, view %p [isNSView %d, isNewtView %d], parent %p\n",
+ mWin, destroyNotifySent, mView, isNSView, isNewtView, pWin);
[mWin setRealized: NO];
- if(NULL!=mView) {
+ if( isNewtView ) {
// cleanup view
[mView setDestroyNotifySent: true];
setJavaWindowObject(env, NULL, mView, NO);
@@ -892,14 +921,9 @@ NS_ENDHANDLER
}
[mWin orderOut: mWin];
- DBG_PRINT( "windowClose.1 - %p,%d view %p,%d, parent %p\n",
- mWin, getRetainCount(mWin), mView, getRetainCount(mView), pWin);
+ DBG_PRINT( "windowClose.1 - %p view %p, parent %p\n", mWin, mView, pWin);
- // Only release window, if release is not yet in process.
- // E.g. destroyNotifySent:=true set by NewtMacWindow::windowWillClose(), i.e. window-close was clicked.
- if(!destroyNotifySent) {
- [mWin release];
- }
+ [mWin release];
DBG_PRINT( "windowClose.Xp\n");
@@ -953,7 +977,6 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_requestFocus0
#ifdef VERBOSE_ON
BOOL hasFocus = [mWin isKeyWindow];
#endif
-
DBG_PRINT( "requestFocus - window: %p, force %d, hasFocus %d (START)\n", mWin, force, hasFocus);
[mWin makeFirstResponder: nil];
diff --git a/src/newt/native/NewtMacWindow.m b/src/newt/native/NewtMacWindow.m
index 35d3ffb..686e5d2 100644
--- a/src/newt/native/NewtMacWindow.m
+++ b/src/newt/native/NewtMacWindow.m
@@ -730,9 +730,14 @@ static jint mods2JavaMods(NSUInteger mods)
}
int shallBeDetached = 0;
JavaVM *jvmHandle = [view getJVMHandle];
- JNIEnv* env = NewtCommon_GetJNIEnv(jvmHandle, [view getJVMVersion], 1 /* asDaemon */, &shallBeDetached);
+ JNIEnv* env;
+ if( NULL != jvmHandle ) {
+ env = NewtCommon_GetJNIEnv(jvmHandle, [view getJVMVersion], 1 /* asDaemon */, &shallBeDetached);
+ } else {
+ env = NULL;
+ }
if(NULL==env) {
- DBG_PRINT("sendKeyEvent: null JNIEnv\n");
+ DBG_PRINT("sendKeyEvent: JVM %p JNIEnv %p\n", jvmHandle, env);
return;
}
@@ -781,9 +786,14 @@ static jint mods2JavaMods(NSUInteger mods)
}
int shallBeDetached = 0;
JavaVM *jvmHandle = [view getJVMHandle];
- JNIEnv* env = NewtCommon_GetJNIEnv(jvmHandle, [view getJVMVersion], 1 /* asDaemon */, &shallBeDetached);
+ JNIEnv* env;
+ if( NULL != jvmHandle ) {
+ env = NewtCommon_GetJNIEnv(jvmHandle, [view getJVMVersion], 1 /* asDaemon */, &shallBeDetached);
+ } else {
+ env = NULL;
+ }
if(NULL==env) {
- DBG_PRINT("sendMouseEvent: null JNIEnv\n");
+ DBG_PRINT("sendMouseEvent: JVM %p JNIEnv %p\n", jvmHandle, env);
return;
}
jint javaMods[] = { 0 } ;
@@ -851,9 +861,14 @@ static jint mods2JavaMods(NSUInteger mods)
}
int shallBeDetached = 0;
JavaVM *jvmHandle = [view getJVMHandle];
- JNIEnv* env = NewtCommon_GetJNIEnv(jvmHandle, [view getJVMVersion], 1 /* asDaemon */, &shallBeDetached);
+ JNIEnv* env;
+ if( NULL != jvmHandle ) {
+ env = NewtCommon_GetJNIEnv(jvmHandle, [view getJVMVersion], 1 /* asDaemon */, &shallBeDetached);
+ } else {
+ env = NULL;
+ }
if(NULL==env) {
- DBG_PRINT("focusChanged: null JNIEnv\n");
+ DBG_PRINT("focusChanged: JVM %p JNIEnv %p\n", jvmHandle, env);
return;
}
@@ -1049,7 +1064,9 @@ static jint mods2JavaMods(NSUInteger mods)
javaWindowObject = [view getJavaWindowObject];
if (javaWindowObject != NULL) {
jvmHandle = [view getJVMHandle];
- env = NewtCommon_GetJNIEnv(jvmHandle, [view getJVMVersion], 1 /* asDaemon */, &shallBeDetached);
+ if( NULL != jvmHandle ) {
+ env = NewtCommon_GetJNIEnv(jvmHandle, [view getJVMVersion], 1 /* asDaemon */, &shallBeDetached);
+ }
}
}
@@ -1084,9 +1101,14 @@ static jint mods2JavaMods(NSUInteger mods)
}
int shallBeDetached = 0;
JavaVM *jvmHandle = [view getJVMHandle];
- JNIEnv* env = NewtCommon_GetJNIEnv(jvmHandle, [view getJVMVersion], 1 /* asDaemon */, &shallBeDetached);
+ JNIEnv* env;
+ if( NULL != jvmHandle ) {
+ env = NewtCommon_GetJNIEnv(jvmHandle, [view getJVMVersion], 1 /* asDaemon */, &shallBeDetached);
+ } else {
+ env = NULL;
+ }
if(NULL==env) {
- DBG_PRINT("windowDidMove: null JNIEnv\n");
+ DBG_PRINT("windowDidMove: JVM %p JNIEnv %p\n", jvmHandle, env);
return;
}
@@ -1131,9 +1153,19 @@ static jint mods2JavaMods(NSUInteger mods)
}
int shallBeDetached = 0;
JavaVM *jvmHandle = [view getJVMHandle];
- JNIEnv* env = NewtCommon_GetJNIEnv(jvmHandle, [view getJVMVersion], 1 /* asDaemon */, &shallBeDetached);
+ JNIEnv* env = NULL;
+NS_DURING
+ if( NULL != jvmHandle ) {
+ env = NewtCommon_GetJNIEnv(jvmHandle, [view getJVMVersion], 1 /* asDaemon */, &shallBeDetached);
+ }
+NS_HANDLER
+ jvmHandle = NULL;
+ env = NULL;
+ [view setJVMHandle: NULL];
+ DBG_PRINT("windowWillClose: JVMHandler Exception\n");
+NS_ENDHANDLER
+ DBG_PRINT("windowWillClose: JVM %p JNIEnv %p\n", jvmHandle, env);
if(NULL==env) {
- DBG_PRINT("windowWillClose: null JNIEnv\n");
return NO;
}
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c
index 4ef2459..a19efbc 100644
--- a/src/newt/native/WindowsWindow.c
+++ b/src/newt/native/WindowsWindow.c
@@ -32,6 +32,16 @@
*
*/
+//
+// Min. required version Windows 7 (For WM_TOUCH)
+//
+#if WINVER < 0x0601
+#error WINVER must be >= 0x0601
+#endif
+#if _WIN32_WINNT < 0x0601
+#error _WIN32_WINNT must be >= 0x0601
+#endif
+
#include <Windows.h>
#include <Windowsx.h>
#include <tchar.h>
@@ -86,6 +96,13 @@
#define WH_MOUSE_LL 14
#endif
+#ifndef WM_TOUCH
+#define WM_TOUCH 0x0240
+#endif
+#ifndef TOUCH_COORD_TO_PIXEL
+#define TOUCH_COORD_TO_PIXEL(l) (l/100)
+#endif
+
#ifndef MONITOR_DEFAULTTONULL
#define MONITOR_DEFAULTTONULL 0
#endif
@@ -136,6 +153,7 @@ static jmethodID visibleChangedID = NULL;
static jmethodID windowDestroyNotifyID = NULL;
static jmethodID windowRepaintID = NULL;
static jmethodID sendMouseEventID = NULL;
+static jmethodID sendTouchScreenEventID = NULL;
static jmethodID sendKeyEventID = NULL;
static jmethodID requestFocusID = NULL;
@@ -144,8 +162,16 @@ static RECT* UpdateInsets(JNIEnv *env, jobject window, HWND hwnd);
typedef struct {
JNIEnv* jenv;
jobject jinstance;
+ /* client size width */
+ int width;
+ /* client size height */
+ int height;
/** Tristate: -1 HIDE, 0 NOP, 1 SHOW */
int setPointerVisible;
+ int mouseInside;
+ int touchDownCount;
+ int touchDownLastUp; // mitigate LBUTTONUP after last TOUCH lift
+ int supportsMTouch;
} WindowUserData;
typedef struct {
@@ -544,14 +570,22 @@ static void NewtWindows_requestFocus (JNIEnv *env, jobject window, HWND hwnd, jb
DBG_PRINT("*** WindowsWindow: requestFocus.XX\n");
}
-static BOOL NewtWindows_trackPointerLeave(HWND hwnd) {
+static void NewtWindows_trackPointerLeave(HWND hwnd) {
TRACKMOUSEEVENT tme;
memset(&tme, 0, sizeof(TRACKMOUSEEVENT));
tme.cbSize = sizeof(TRACKMOUSEEVENT);
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = hwnd;
tme.dwHoverTime = 0; // we don't use TME_HOVER
- return TrackMouseEvent(&tme);
+ BOOL ok = TrackMouseEvent(&tme);
+ DBG_PRINT( "*** WindowsWindow: trackPointerLeave: %d\n", ok);
+ #ifdef VERBOSE_ON
+ if(!ok) {
+ int lastError = (int) GetLastError();
+ DBG_PRINT( "*** WindowsWindow: trackPointerLeave: lastError 0x%X %d\n", lastError, lastError);
+ }
+ #endif
+ (void)ok;
}
#if 0
@@ -676,11 +710,11 @@ static RECT* UpdateInsets(JNIEnv *env, jobject window, HWND hwnd)
#endif
-static void WmSize(JNIEnv *env, jobject window, HWND wnd, UINT type)
+static void WmSize(JNIEnv *env, WindowUserData * wud, HWND wnd, UINT type)
{
RECT rc;
- int w, h;
BOOL isVisible = IsWindowVisible(wnd);
+ jobject window = wud->jinstance;
if (type == SIZE_MINIMIZED) {
// TODO: deal with minimized window sizing
@@ -693,12 +727,12 @@ static void WmSize(JNIEnv *env, jobject window, HWND wnd, UINT type)
GetClientRect(wnd, &rc);
// we report back the dimensions of the client area
- w = (int) ( rc.right - rc.left );
- h = (int) ( rc.bottom - rc.top );
+ wud->width = (int) ( rc.right - rc.left );
+ wud->height = (int) ( rc.bottom - rc.top );
- DBG_PRINT("*** WindowsWindow: WmSize window %p, %dx%d, visible %d\n", (void*)wnd, w, h, isVisible);
+ DBG_PRINT("*** WindowsWindow: WmSize window %p, %dx%d, visible %d\n", (void*)wnd, wud->width, wud->height, isVisible);
- (*env)->CallVoidMethod(env, window, sizeChangedID, JNI_FALSE, w, h, JNI_FALSE);
+ (*env)->CallVoidMethod(env, window, sizeChangedID, JNI_FALSE, wud->width, wud->height, JNI_FALSE);
}
#ifdef TEST_MOUSE_HOOKS
@@ -792,6 +826,39 @@ static BOOL SafeShowCursor(BOOL show) {
return b;
}
+static void sendTouchScreenEvent(JNIEnv *env, jobject window,
+ short eventType, int modifiers, int actionIdx,
+ int count, jint* pointerNames, jint* x, jint* y, jfloat* pressure, float maxPressure) {
+ jintArray jNames = (*env)->NewIntArray(env, count);
+ if (jNames == NULL) {
+ NewtCommon_throwNewRuntimeException(env, "Could not allocate int array (names) of size %d", count);
+ }
+ (*env)->SetIntArrayRegion(env, jNames, 0, count, pointerNames);
+
+ jintArray jX = (*env)->NewIntArray(env, count);
+ if (jX == NULL) {
+ NewtCommon_throwNewRuntimeException(env, "Could not allocate int array (x) of size %d", count);
+ }
+ (*env)->SetIntArrayRegion(env, jX, 0, count, x);
+
+ jintArray jY = (*env)->NewIntArray(env, count);
+ if (jY == NULL) {
+ NewtCommon_throwNewRuntimeException(env, "Could not allocate int array (y) of size %d", count);
+ }
+ (*env)->SetIntArrayRegion(env, jY, 0, count, y);
+
+ jfloatArray jPressure = (*env)->NewFloatArray(env, count);
+ if (jPressure == NULL) {
+ NewtCommon_throwNewRuntimeException(env, "Could not allocate float array (pressure) of size %d", count);
+ }
+ (*env)->SetFloatArrayRegion(env, jPressure, 0, count, pressure);
+
+ (*env)->CallVoidMethod(env, window, sendTouchScreenEventID,
+ (jshort)eventType, (jint)modifiers, (jint)actionIdx,
+ jNames, jX, jY, jPressure, (jfloat)maxPressure);
+}
+
+
static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lParam) {
LRESULT res = 0;
int useDefWindowProc = 0;
@@ -885,7 +952,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
break;
case WM_SIZE:
- WmSize(env, window, wnd, (UINT)wParam);
+ WmSize(env, wud, wnd, (UINT)wParam);
break;
case WM_SETTINGCHANGE:
@@ -899,83 +966,138 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
break;
- case WM_LBUTTONDOWN:
- DBG_PRINT("*** WindowsWindow: LBUTTONDOWN\n");
- (*env)->CallVoidMethod(env, window, requestFocusID, JNI_FALSE);
- (*env)->CallVoidMethod(env, window, sendMouseEventID,
- (jshort) EVENT_MOUSE_PRESSED,
- GetModifiers( 0 ),
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- (jshort) 1, (jfloat) 0.0f);
- useDefWindowProc = 1;
+ case WM_LBUTTONDOWN: {
+ DBG_PRINT("*** WindowsWindow: WM_LBUTTONDOWN %d/%d [%dx%d] inside %d, tDown [c %d, lastUp %d]\n",
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ wud->width, wud->height, wud->mouseInside, wud->touchDownCount, wud->touchDownLastUp);
+ if( 0 == wud->touchDownLastUp && 0 == wud->touchDownCount ) {
+ wud->mouseInside = 1;
+ (*env)->CallVoidMethod(env, window, requestFocusID, JNI_FALSE);
+ (*env)->CallVoidMethod(env, window, sendMouseEventID,
+ (jshort) EVENT_MOUSE_PRESSED,
+ GetModifiers( 0 ),
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ (jshort) 1, (jfloat) 0.0f);
+ useDefWindowProc = 1;
+ }
+ }
break;
- case WM_LBUTTONUP:
- (*env)->CallVoidMethod(env, window, sendMouseEventID,
- (jshort) EVENT_MOUSE_RELEASED,
- GetModifiers( 0 ),
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- (jshort) 1, (jfloat) 0.0f);
- useDefWindowProc = 1;
+ case WM_LBUTTONUP: {
+ DBG_PRINT("*** WindowsWindow: WM_LBUTTONUP %d/%d [%dx%d] inside %d, tDown [c %d, lastUp %d]\n",
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ wud->width, wud->height, wud->mouseInside, wud->touchDownCount, wud->touchDownLastUp);
+ if( 0 < wud->touchDownLastUp ) {
+ // mitigate LBUTTONUP after last TOUCH lift
+ wud->touchDownLastUp = 0;
+ } else if( 0 == wud->touchDownCount ) {
+ wud->mouseInside = 1;
+ (*env)->CallVoidMethod(env, window, sendMouseEventID,
+ (jshort) EVENT_MOUSE_RELEASED,
+ GetModifiers( 0 ),
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ (jshort) 1, (jfloat) 0.0f);
+ useDefWindowProc = 1;
+ }
+ }
break;
- case WM_MBUTTONDOWN:
- DBG_PRINT("*** WindowsWindow: MBUTTONDOWN\n");
- (*env)->CallVoidMethod(env, window, requestFocusID, JNI_FALSE);
- (*env)->CallVoidMethod(env, window, sendMouseEventID,
- (jshort) EVENT_MOUSE_PRESSED,
- GetModifiers( 0 ),
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- (jshort) 2, (jfloat) 0.0f);
- useDefWindowProc = 1;
+ case WM_MBUTTONDOWN: {
+ DBG_PRINT("*** WindowsWindow: WM_MBUTTONDOWN %d/%d [%dx%d] inside %d, tDown [c %d, lastUp %d]\n",
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ wud->width, wud->height, wud->mouseInside, wud->touchDownCount, wud->touchDownLastUp);
+ if( 0 == wud->touchDownCount ) {
+ wud->mouseInside = 1;
+ (*env)->CallVoidMethod(env, window, requestFocusID, JNI_FALSE);
+ (*env)->CallVoidMethod(env, window, sendMouseEventID,
+ (jshort) EVENT_MOUSE_PRESSED,
+ GetModifiers( 0 ),
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ (jshort) 2, (jfloat) 0.0f);
+ useDefWindowProc = 1;
+ }
+ }
break;
- case WM_MBUTTONUP:
- (*env)->CallVoidMethod(env, window, sendMouseEventID,
- (jshort) EVENT_MOUSE_RELEASED,
- GetModifiers( 0 ),
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- (jshort) 2, (jfloat) 0.0f);
- useDefWindowProc = 1;
+ case WM_MBUTTONUP: {
+ DBG_PRINT("*** WindowsWindow: WM_MBUTTONUP %d/%d [%dx%d] inside %d, tDown [c %d, lastUp %d]\n",
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ wud->width, wud->height, wud->mouseInside, wud->touchDownCount, wud->touchDownLastUp);
+ if( 0 == wud->touchDownCount ) {
+ wud->mouseInside = 1;
+ (*env)->CallVoidMethod(env, window, sendMouseEventID,
+ (jshort) EVENT_MOUSE_RELEASED,
+ GetModifiers( 0 ),
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ (jshort) 2, (jfloat) 0.0f);
+ useDefWindowProc = 1;
+ }
+ }
break;
- case WM_RBUTTONDOWN:
- DBG_PRINT("*** WindowsWindow: RBUTTONDOWN\n");
- (*env)->CallVoidMethod(env, window, requestFocusID, JNI_FALSE);
- (*env)->CallVoidMethod(env, window, sendMouseEventID,
- (jshort) EVENT_MOUSE_PRESSED,
- GetModifiers( 0 ),
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- (jshort) 3, (jfloat) 0.0f);
- useDefWindowProc = 1;
+ case WM_RBUTTONDOWN: {
+ DBG_PRINT("*** WindowsWindow: WM_RBUTTONDOWN %d/%d [%dx%d] inside %d, tDown [c %d, lastUp %d]\n",
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ wud->width, wud->height, wud->mouseInside, wud->touchDownCount, wud->touchDownLastUp);
+ if( 0 == wud->touchDownCount ) {
+ wud->mouseInside = 1;
+ (*env)->CallVoidMethod(env, window, requestFocusID, JNI_FALSE);
+ (*env)->CallVoidMethod(env, window, sendMouseEventID,
+ (jshort) EVENT_MOUSE_PRESSED,
+ GetModifiers( 0 ),
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ (jshort) 3, (jfloat) 0.0f);
+ useDefWindowProc = 1;
+ }
+ }
break;
- case WM_RBUTTONUP:
- (*env)->CallVoidMethod(env, window, sendMouseEventID,
- (jshort) EVENT_MOUSE_RELEASED,
- GetModifiers( 0 ),
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- (jshort) 3, (jfloat) 0.0f);
- useDefWindowProc = 1;
+ case WM_RBUTTONUP: {
+ DBG_PRINT("*** WindowsWindow: WM_RBUTTONUP %d/%d [%dx%d] inside %d, tDown [c %d, lastUp %d]\n",
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ wud->width, wud->height, wud->mouseInside, wud->touchDownCount, wud->touchDownLastUp);
+ if( 0 == wud->touchDownCount ) {
+ wud->mouseInside = 1;
+ (*env)->CallVoidMethod(env, window, sendMouseEventID,
+ (jshort) EVENT_MOUSE_RELEASED,
+ GetModifiers( 0 ),
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ (jshort) 3, (jfloat) 0.0f);
+ useDefWindowProc = 1;
+ }
+ }
break;
- case WM_MOUSEMOVE:
- // DBG_PRINT("*** WindowsWindow: WM_MOUSEMOVE %d/%d\n", (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam));
- (*env)->CallVoidMethod(env, window, sendMouseEventID,
- (jshort) EVENT_MOUSE_MOVED,
- GetModifiers( 0 ),
- (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
- (jshort) 0, (jfloat) 0.0f);
- useDefWindowProc = 1;
+ case WM_MOUSEMOVE: {
+ DBG_PRINT("*** WindowsWindow: WM_MOUSEMOVE %d/%d [%dx%d] inside %d, tDown [c %d, lastUp %d]\n",
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ wud->width, wud->height, wud->mouseInside, wud->touchDownCount, wud->touchDownLastUp);
+ if( 0 == wud->touchDownLastUp && 0 == wud->touchDownCount ) {
+ wud->mouseInside = 1;
+ NewtWindows_trackPointerLeave(wnd);
+ (*env)->CallVoidMethod(env, window, sendMouseEventID,
+ (jshort) EVENT_MOUSE_MOVED,
+ GetModifiers( 0 ),
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ (jshort) 0, (jfloat) 0.0f);
+ }
+ useDefWindowProc = 1;
+ }
break;
- case WM_MOUSELEAVE:
- DBG_PRINT("*** WindowsWindow: WM_MOUSELEAVE\n");
- (*env)->CallVoidMethod(env, window, sendMouseEventID,
- (jshort) EVENT_MOUSE_EXITED,
- 0,
- (jint) -1, (jint) -1, // fake
- (jshort) 0, (jfloat) 0.0f);
- useDefWindowProc = 1;
+ case WM_MOUSELEAVE: {
+ DBG_PRINT("*** WindowsWindow: WM_MOUSELEAVE %d/%d [%dx%d] inside %d, tDown [c %d, lastUp %d]\n",
+ (jint) GET_X_LPARAM(lParam), (jint) GET_Y_LPARAM(lParam),
+ wud->width, wud->height, wud->mouseInside, wud->touchDownCount, wud->touchDownLastUp);
+ if( 0 == wud->touchDownCount ) {
+ wud->mouseInside = 0;
+ (*env)->CallVoidMethod(env, window, sendMouseEventID,
+ (jshort) EVENT_MOUSE_EXITED,
+ 0,
+ (jint) -1, (jint) -1, // fake
+ (jshort) 0, (jfloat) 0.0f);
+ useDefWindowProc = 1;
+ }
+ }
break;
// Java synthesizes EVENT_MOUSE_ENTERED
@@ -1036,6 +1158,133 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
break;
}
+ case WM_TOUCH: if( wud->supportsMTouch ) {
+ UINT cInputs = LOWORD(wParam);
+ // DBG_PRINT("*** WindowsWindow: WM_TOUCH window %p, cInputs %d\n", wnd, cInputs);
+ HTOUCHINPUT hTouch = (HTOUCHINPUT)lParam;
+ PTOUCHINPUT pInputs = (PTOUCHINPUT) calloc(cInputs, sizeof(TOUCHINPUT));
+ if (NULL != pInputs) {
+ if (GetTouchInputInfo(hTouch, cInputs, pInputs, sizeof(TOUCHINPUT))) {
+ UINT i;
+ short eventType[cInputs];
+ jint modifiers = GetModifiers( 0 );
+ jint actionIdx = -1;
+ jint pointerNames[cInputs];
+ jint x[cInputs], y[cInputs];
+ jfloat pressure[cInputs];
+ jfloat maxPressure = 1.0F; // FIXME: n/a on windows ?
+ int allPInside = 0 < cInputs;
+ int sendFocus = 0;
+
+ for (i=0; i < cInputs; i++) {
+ PTOUCHINPUT pTi = & pInputs[i];
+ POINT eventPt;
+ int isDown = pTi->dwFlags & TOUCHEVENTF_DOWN;
+ int isUp = pTi->dwFlags & TOUCHEVENTF_UP;
+ int isMove = pTi->dwFlags & TOUCHEVENTF_MOVE;
+
+ int isPrim = pTi->dwFlags & TOUCHEVENTF_PRIMARY;
+ int isNoCoalesc = pTi->dwFlags & TOUCHEVENTF_NOCOALESCE;
+ int isPInside;
+
+ #ifdef VERBOSE_ON
+ const char * touchAction;
+ if( isDown ) {
+ touchAction = "down";
+ } else if( isUp ) {
+ touchAction = "_up_";
+ } else if( isMove ) {
+ touchAction = "move";
+ } else {
+ touchAction = "undf";
+ }
+ #endif
+
+ pointerNames[i] = (jint)pTi->dwID;
+ eventPt.x = TOUCH_COORD_TO_PIXEL(pTi->x);
+ eventPt.y = TOUCH_COORD_TO_PIXEL(pTi->y);
+ ScreenToClient(wnd, &eventPt);
+
+ isPInside = 0 <= eventPt.x && 0 <= eventPt.y && eventPt.x < wud->width && eventPt.y < wud->height;
+ allPInside &= isPInside;
+
+ x[i] = (jint)eventPt.x;
+ y[i] = (jint)eventPt.y;
+ pressure[i] = 1.0F; // FIXME: n/a on windows ?
+ if(isDown) {
+ sendFocus = 0 == wud->touchDownCount;
+ eventType[i] = (jshort) EVENT_MOUSE_PRESSED;
+ wud->touchDownCount++;
+ wud->touchDownLastUp = 0;
+ } else if(isUp) {
+ eventType[i] = (jshort) EVENT_MOUSE_RELEASED;
+ wud->touchDownCount--;
+ // mitigate LBUTTONUP after last TOUCH lift
+ wud->touchDownLastUp = 0 == wud->touchDownCount;
+ } else if(isMove) {
+ eventType[i] = (jshort) EVENT_MOUSE_MOVED;
+ wud->touchDownLastUp = 0;
+ } else {
+ eventType[i] = (jshort) 0;
+ }
+ if(isPrim) {
+ actionIdx = (jint)i;
+ }
+
+ #ifdef VERBOSE_ON
+ DBG_PRINT("*** WindowsWindow: WM_TOUCH[%d/%d].%s name 0x%x, prim %d, nocoalsc %d, %d/%d [%dx%d] inside [%d/%d], tDown [c %d, lastUp %d]\n",
+ (i+1), cInputs, touchAction, (int)(pTi->dwID), isPrim, isNoCoalesc, x[i], y[i], wud->width, wud->height,
+ isPInside, allPInside, wud->touchDownCount, wud->touchDownLastUp);
+ #endif
+ }
+ wud->mouseInside = allPInside;
+ if( sendFocus && allPInside ) {
+ (*env)->CallVoidMethod(env, window, requestFocusID, JNI_FALSE);
+ }
+ int sentCount = 0, updownCount=0, moveCount=0;
+ // Primary first, if available!
+ if( 0 <= actionIdx && allPInside ) {
+ sendTouchScreenEvent(env, window, eventType[actionIdx], modifiers, actionIdx,
+ cInputs, pointerNames, x, y, pressure, maxPressure);
+ sentCount++;
+ }
+ // 1 Move second ..
+ for (i=0; i < cInputs; i++) {
+ short et = eventType[i];
+ if( (jshort) EVENT_MOUSE_MOVED == et ) {
+ if( i != actionIdx && 0 == moveCount && allPInside ) {
+ sendTouchScreenEvent(env, window, et, modifiers, i,
+ cInputs, pointerNames, x, y, pressure, maxPressure);
+ sentCount++;
+ }
+ moveCount++;
+ }
+ }
+ // Up and downs last
+ for (i=0; i < cInputs; i++) {
+ short et = eventType[i];
+ if( (jshort) EVENT_MOUSE_MOVED != et ) {
+ if( i != actionIdx && allPInside ) {
+ sendTouchScreenEvent(env, window, et, modifiers, i,
+ cInputs, pointerNames, x, y, pressure, maxPressure);
+ sentCount++;
+ }
+ updownCount++;
+ }
+ }
+ DBG_PRINT("*** WindowsWindow: WM_TOUCH.summary pCount %d, prim %d, updown %d, move %d, sent %d, inside %d, tDown [c %d, lastUp %d]\n",
+ cInputs, actionIdx, updownCount, moveCount, sentCount, wud->mouseInside, wud->touchDownCount, wud->touchDownLastUp);
+
+ // Message processed - close it
+ CloseTouchInputHandle(hTouch);
+ } else {
+ useDefWindowProc = 1;
+ }
+ free(pInputs);
+ }
+ break;
+ }
+
case WM_SETFOCUS:
DBG_PRINT("*** WindowsWindow: WM_SETFOCUS window %p, lost %p\n", wnd, (HWND)wParam);
(*env)->CallVoidMethod(env, window, focusChangedID, JNI_FALSE, JNI_TRUE);
@@ -1043,9 +1292,16 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
break;
case WM_KILLFOCUS:
- DBG_PRINT("*** WindowsWindow: WM_KILLFOCUS window %p, received %p\n", wnd, (HWND)wParam);
- (*env)->CallVoidMethod(env, window, focusChangedID, JNI_FALSE, JNI_FALSE);
- useDefWindowProc = 1;
+ DBG_PRINT("*** WindowsWindow: WM_KILLFOCUS window %p, received %p, inside %d, tDown %d\n",
+ wnd, (HWND)wParam, wud->mouseInside, wud->touchDownCount);
+ if( wud->touchDownCount == 0 ) {
+ wud->mouseInside=0;
+ (*env)->CallVoidMethod(env, window, focusChangedID, JNI_FALSE, JNI_FALSE);
+ useDefWindowProc = 1;
+ } else {
+ // quick focus .. we had it already, are enabled ..
+ SetFocus(wnd);// Sets Keyboard Focus To Window (activates parent window if exist, or this window)
+ }
break;
case WM_SHOWWINDOW:
@@ -1060,7 +1316,6 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
case WM_PAINT: {
RECT r;
- useDefWindowProc = 0;
if (GetUpdateRect(wnd, &r, FALSE /* do not erase background */)) {
// clear the whole client area and issue repaint for it, w/o looping through erase background
ValidateRect(wnd, NULL); // clear all!
@@ -1075,7 +1330,6 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
case WM_ERASEBKGND:
// ignore erase background
(*env)->CallVoidMethod(env, window, windowRepaintID, JNI_FALSE, 0, 0, -1, -1);
- useDefWindowProc = 0;
res = 1; // return 1 == done, OpenGL, etc .. erases the background, hence we claim to have just done this
break;
case WM_SETCURSOR :
@@ -1089,7 +1343,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, WPARAM wParam, LPARAM lP
useDefWindowProc = visibilityChangeSuccessful ? 1 : 0;
DBG_PRINT("*** WindowsWindow: WM_SETCURSOR requested visibility: %d success: %d\n", wud->setPointerVisible, visibilityChangeSuccessful);
wud->setPointerVisible = 0;
- useDefWindowProc = 0; // own signal, consumed
+ // own signal, consumed
} else {
useDefWindowProc = 1; // NOP for us, allow parent to act
}
@@ -1545,6 +1799,7 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_windows_WindowDriver_initIDs0
windowDestroyNotifyID = (*env)->GetMethodID(env, clazz, "windowDestroyNotify", "(Z)Z");
windowRepaintID = (*env)->GetMethodID(env, clazz, "windowRepaint", "(ZIIII)V");
sendMouseEventID = (*env)->GetMethodID(env, clazz, "sendMouseEvent", "(SIIISF)V");
+ sendTouchScreenEventID = (*env)->GetMethodID(env, clazz, "sendTouchScreenEvent", "(SII[I[I[I[FF)V");
sendKeyEventID = (*env)->GetMethodID(env, clazz, "sendKeyEvent", "(SISSC)V");
requestFocusID = (*env)->GetMethodID(env, clazz, "requestFocus", "(Z)V");
@@ -1556,6 +1811,7 @@ JNIEXPORT jboolean JNICALL Java_jogamp_newt_driver_windows_WindowDriver_initIDs0
windowDestroyNotifyID == NULL ||
windowRepaintID == NULL ||
sendMouseEventID == NULL ||
+ sendTouchScreenEventID == NULL ||
sendKeyEventID == NULL ||
requestFocusID == NULL) {
return JNI_FALSE;
@@ -1615,9 +1871,8 @@ static void NewtWindow_setVisiblePosSize(HWND hwnd, BOOL atop, BOOL visible,
*/
JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_windows_WindowDriver_CreateWindow0
(JNIEnv *env, jobject obj,
- jlong hInstance, jstring jWndClassName, jstring jWndName,
- jlong parent,
- jint jx, jint jy, jint defaultWidth, jint defaultHeight, jboolean autoPosition, jint flags)
+ jlong hInstance, jstring jWndClassName, jstring jWndName, jint winMajor, jint winMinor,
+ jlong parent, jint jx, jint jy, jint defaultWidth, jint defaultHeight, jboolean autoPosition, jint flags)
{
HWND parentWindow = (HWND) (intptr_t) parent;
const TCHAR* wndClassName = NULL;
@@ -1659,8 +1914,8 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_windows_WindowDriver_CreateWindo
(HINSTANCE) (intptr_t) hInstance,
NULL);
- DBG_PRINT("*** WindowsWindow: CreateWindow thread 0x%X, parent %p, window %p, %d/%d %dx%d, undeco %d, alwaysOnTop %d, autoPosition %d\n",
- (int)GetCurrentThreadId(), parentWindow, window, x, y, width, height,
+ DBG_PRINT("*** WindowsWindow: CreateWindow thread 0x%X, win %d.%d parent %p, window %p, %d/%d %dx%d, undeco %d, alwaysOnTop %d, autoPosition %d\n",
+ (int)GetCurrentThreadId(), winMajor, winMinor, parentWindow, window, x, y, width, height,
TST_FLAG_IS_UNDECORATED(flags), TST_FLAG_IS_ALWAYSONTOP(flags), autoPosition);
if (NULL == window) {
@@ -1671,7 +1926,25 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_windows_WindowDriver_CreateWindo
WindowUserData * wud = (WindowUserData *) malloc(sizeof(WindowUserData));
wud->jinstance = (*env)->NewGlobalRef(env, obj);
wud->jenv = env;
+ wud->width = width;
+ wud->height = height;
wud->setPointerVisible = 0;
+ wud->mouseInside = 0;
+ wud->touchDownCount = 0;
+ wud->touchDownLastUp = 0;
+ wud->supportsMTouch = 0;
+ if ( winMajor > 6 || ( winMajor == 6 && winMinor >= 1 ) ) {
+ int value = GetSystemMetrics(SM_DIGITIZER);
+ if (value & NID_READY) { /* ready */
+ if (value & NID_MULTI_INPUT) { /* multitouch */
+ wud->supportsMTouch = 1;
+ }
+ if (value & NID_INTEGRATED_TOUCH) { /* Integrated touch */
+ }
+ }
+ }
+ DBG_PRINT("*** WindowsWindow: CreateWindow supportsMTouch %d\n", wud->supportsMTouch);
+
#if !defined(__MINGW64__) && ( defined(UNDER_CE) || _MSC_VER <= 1200 )
SetWindowLong(window, GWL_USERDATA, (intptr_t) wud);
#else
@@ -1704,6 +1977,9 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_windows_WindowDriver_CreateWindo
NewtWindow_setVisiblePosSize(window, TST_FLAG_IS_ALWAYSONTOP(flags), TRUE, x, y, width, height);
}
+ if( wud->supportsMTouch ) {
+ RegisterTouchWindow(window, 0);
+ }
}
#ifdef UNICODE
@@ -1930,23 +2206,3 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_windows_WindowDriver_warpPointer0
SetCursorPos(x, y);
}
-/*
- * Class: Java_jogamp_newt_driver_windows_WindowDriver
- * Method: trackPointerLeave0
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_jogamp_newt_driver_windows_WindowDriver_trackPointerLeave0
- (JNIEnv *env, jclass clazz, jlong window)
-{
- HWND hwnd = (HWND) (intptr_t) window;
- BOOL ok = NewtWindows_trackPointerLeave(hwnd);
- DBG_PRINT( "*** WindowsWindow: trackMouseLeave0: %d\n", ok);
- #ifdef VERBOSE_ON
- if(!ok) {
- int lastError = (int) GetLastError();
- DBG_PRINT( "*** WindowsWindow: trackMouseLeave0: lastError 0x%X %d\n", lastError, lastError);
- }
- #endif
- (void)ok;
-}
-
diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c
index e6e300d..f195c56 100644
--- a/src/newt/native/X11Window.c
+++ b/src/newt/native/X11Window.c
@@ -817,11 +817,15 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_WindowDriver_reconfigureWindo
if( TST_FLAG_IS_VISIBLE(flags) ) {
DBG_PRINT( "X11: reconfigureWindow0 VISIBLE ON\n");
XMapRaised(dpy, w);
+ XSync(dpy, False);
+ // WM may disregard pos/size XConfigureWindow requests for invisible windows!
+ DBG_PRINT( "X11: reconfigureWindow0 setPosSize.2 %d/%d %dx%d\n", x, y, width, height);
+ NewtWindows_setPosSize(dpy, w, x, y, width, height);
} else {
DBG_PRINT( "X11: reconfigureWindow0 VISIBLE OFF\n");
XUnmapWindow(dpy, w);
+ XSync(dpy, False);
}
- XSync(dpy, False);
}
if( fsEWMHFlags && ( ( TST_FLAG_CHANGE_FULLSCREEN(flags) && TST_FLAG_IS_FULLSCREEN(flags) ) ||
diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0.java
index 3e61e50..ec8fa10 100644
--- a/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0.java
+++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0.java
@@ -28,6 +28,9 @@
package com.jogamp.opengl.test.android;
import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URLConnection;
import java.util.Arrays;
@@ -44,6 +47,10 @@ import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube;
import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.util.av.GLMediaPlayer;
+import com.jogamp.opengl.util.av.GLMediaPlayer.GLMediaEventListener;
+import com.jogamp.opengl.util.av.GLMediaPlayer.StreamException;
+import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame;
import android.os.Bundle;
import android.util.Log;
@@ -54,7 +61,7 @@ public class MovieCubeActivity0 extends NewtBaseActivity {
MouseAdapter showKeyboardMouseListener = new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
- if( e.getPointerCount() == 4 && e.getPressure(true) > 0.7f ) {
+ if( e.getPointerCount() == 4 && e.getPressure(0, true) > 0.7f ) {
((com.jogamp.newt.Window) e.getSource()).setKeyboardVisible(true);
}
}
@@ -64,12 +71,12 @@ public class MovieCubeActivity0 extends NewtBaseActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- String[] urls0 = new String[] {
+ String[] streamLocs = new String[] {
System.getProperty("jnlp.media0_url2"),
System.getProperty("jnlp.media0_url1"),
System.getProperty("jnlp.media0_url0") };
- final URLConnection urlConnection0 = getResource(urls0, 0);
- if(null == urlConnection0) { throw new RuntimeException("no media reachable: "+Arrays.asList(urls0)); }
+ final URI streamLoc = getURI(streamLocs, 0, false);
+ if(null == streamLoc) { throw new RuntimeException("no media reachable: "+Arrays.asList(streamLocs)); }
// also initializes JOGL
final GLCapabilities capsMain = new GLCapabilities(GLProfile.getGL2ES2());
@@ -81,21 +88,42 @@ public class MovieCubeActivity0 extends NewtBaseActivity {
scrn.addReference();
try {
- final Animator animator = new Animator();
+ final Animator anim = new Animator();
// Main
- final MovieCube demoMain = new MovieCube(urlConnection0, -2.3f, 0f, 0f);
final GLWindow glWindowMain = GLWindow.create(scrn, capsMain);
glWindowMain.setFullscreen(true);
setContentView(getWindow(), glWindowMain);
- glWindowMain.addMouseListener(showKeyboardMouseListener);
- glWindowMain.addGLEventListener(demoMain);
- animator.add(glWindowMain);
+ anim.add(glWindowMain);
glWindowMain.setVisible(true);
+ glWindowMain.addMouseListener(showKeyboardMouseListener);
- // animator.setUpdateFPSFrames(60, System.err);
- animator.setUpdateFPSFrames(-1, null);
- animator.resetFPSCounter();
+ final MovieCube demoMain = new MovieCube(-2.3f, 0f, 0f);
+ final GLMediaPlayer mPlayer = demoMain.getGLMediaPlayer();
+ mPlayer.addEventListener(new GLMediaEventListener() {
+ @Override
+ public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) {
+ }
+
+ @Override
+ public void attributesChanged(final GLMediaPlayer mp, int event_mask, long when) {
+ System.err.println("MovieCubeActivity0 AttributesChanges: events_mask 0x"+Integer.toHexString(event_mask)+", when "+when);
+ System.err.println("MovieCubeActivity0 State: "+mp);
+ if( 0 != ( GLMediaEventListener.EVENT_CHANGE_INIT & event_mask ) ) {
+ glWindowMain.addGLEventListener(demoMain);
+ anim.setUpdateFPSFrames(60, System.err);
+ anim.resetFPSCounter();
+ }
+ if( 0 != ( ( GLMediaEventListener.EVENT_CHANGE_ERR | GLMediaEventListener.EVENT_CHANGE_EOS ) & event_mask ) ) {
+ final StreamException se = mPlayer.getStreamException();
+ if( null != se ) {
+ se.printStackTrace();
+ }
+ getActivity().finish();
+ }
+ }
+ });
+ demoMain.initStream(streamLoc, GLMediaPlayer.STREAM_ID_AUTO, GLMediaPlayer.STREAM_ID_AUTO, 0);
} catch (IOException e) {
e.printStackTrace();
}
@@ -105,14 +133,32 @@ public class MovieCubeActivity0 extends NewtBaseActivity {
Log.d(TAG, "onCreate - X");
}
- static URLConnection getResource(String path[], int off) {
- URLConnection uc = null;
- for(int i=off; null==uc && i<path.length; i++) {
+ static URI getURI(String path[], int off, boolean checkAvail) {
+ URI uri = null;
+ for(int i=off; null==uri && i<path.length; i++) {
if(null != path[i] && path[i].length()>0) {
- uc = IOUtil.getResource(path[i], null);
- Log.d(TAG, "Stream: <"+path[i]+">: "+(null!=uc));
+ if( checkAvail ) {
+ final URLConnection uc = IOUtil.getResource(path[i], null);
+ if( null != uc ) {
+ try {
+ uri = uc.getURL().toURI();
+ } catch (URISyntaxException e) {
+ uri = null;
+ }
+ if( uc instanceof HttpURLConnection ) {
+ ((HttpURLConnection)uc).disconnect();
+ }
+ }
+ } else {
+ try {
+ uri = new URI(path[i]);
+ } catch (URISyntaxException e) {
+ uri = null;
+ }
+ }
+ Log.d(TAG, "Stream: <"+path[i]+">: "+(null!=uri));
}
}
- return uc;
+ return uri;
}
}
diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1a.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1a.java
new file mode 100644
index 0000000..cd71499
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1a.java
@@ -0,0 +1,87 @@
+/**
+ * Copyright 2012 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.android;
+
+import java.util.Arrays;
+import java.util.List;
+
+import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties;
+
+public class MovieCubeActivityLauncher1a extends LauncherUtil.BaseActivityLauncher {
+
+ static String demo = "com.jogamp.opengl.test.android.MovieCubeActivity0";
+ static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" };
+ static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" };
+
+ @Override
+ public void init() {
+ final OrderedProperties props = getProperties();
+ props.setProperty("jnlp.media0_url2", "camera:/0");
+ props.setProperty("jnlp.media0_url1", "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4");
+ props.setProperty("jnlp.media0_url0", "file:///mnt/sdcard/Movies/BigBuckBunny_320x180.mp4");
+ props.setProperty("jnlp.media1_url0", "http://archive.org/download/ElephantsDream/ed_1024_512kb.mp4");
+ // props.setProperty("jogamp.debug.JNILibLoader", "true");
+ // props.setProperty("jogamp.debug.NativeLibrary", "true");
+ // props.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
+ // props.setProperty("jogamp.debug.IOUtil", "true");
+ // props.setProperty("jogamp.debug.Lock", "true");
+ // props.setProperty("jogamp.debug.Lock.TraceLock", "true");
+ // props.setProperty("nativewindow.debug", "all");
+ // props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
+ // props.setProperty("jogl.debug", "all");
+ // props.setProperty("jogl.debug.GLProfile", "true");
+ // props.setProperty("jogl.debug.GLDrawable", "true");
+ // props.setProperty("jogl.debug.GLContext", "true");
+ props.setProperty("jogl.debug.GLSLCode", "true");
+ props.setProperty("jogl.debug.GLMediaPlayer", "true");
+ // props.setProperty("jogl.debug.CapabilitiesChooser", "true");
+ // props.setProperty("jogl.debug.GLSLState", "true");
+ // props.setProperty("jogl.debug.DebugGL", "true");
+ // props.setProperty("jogl.debug.TraceGL", "true");
+ // props.setProperty("newt.debug", "all");
+ // props.setProperty("newt.debug.Window", "true");
+ // props.setProperty("newt.debug.Window.MouseEvent", "true");
+ // props.setProperty("newt.debug.Window.KeyEvent", "true");
+ // props.setProperty("jogamp.debug.IOUtil", "true");
+ }
+
+ @Override
+ public String getActivityName() {
+ return demo;
+ }
+
+ @Override
+ public List<String> getSysPackages() {
+ return Arrays.asList(sys_pkgs);
+ }
+
+ @Override
+ public List<String> getUsrPackages() {
+ return Arrays.asList(usr_pkgs);
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1b.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1b.java
new file mode 100644
index 0000000..d6261b1
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivityLauncher1b.java
@@ -0,0 +1,87 @@
+/**
+ * Copyright 2012 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.android;
+
+import java.util.Arrays;
+import java.util.List;
+
+import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties;
+
+public class MovieCubeActivityLauncher1b extends LauncherUtil.BaseActivityLauncher {
+
+ static String demo = "com.jogamp.opengl.test.android.MovieCubeActivity0";
+ static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" };
+ static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" };
+
+ @Override
+ public void init() {
+ final OrderedProperties props = getProperties();
+ props.setProperty("jnlp.media0_url2", "camera:/1");
+ props.setProperty("jnlp.media0_url1", "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4");
+ props.setProperty("jnlp.media0_url0", "file:///mnt/sdcard/Movies/BigBuckBunny_320x180.mp4");
+ props.setProperty("jnlp.media1_url0", "http://archive.org/download/ElephantsDream/ed_1024_512kb.mp4");
+ // props.setProperty("jogamp.debug.JNILibLoader", "true");
+ // props.setProperty("jogamp.debug.NativeLibrary", "true");
+ // props.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
+ // props.setProperty("jogamp.debug.IOUtil", "true");
+ // props.setProperty("jogamp.debug.Lock", "true");
+ // props.setProperty("jogamp.debug.Lock.TraceLock", "true");
+ // props.setProperty("nativewindow.debug", "all");
+ // props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
+ // props.setProperty("jogl.debug", "all");
+ // props.setProperty("jogl.debug.GLProfile", "true");
+ // props.setProperty("jogl.debug.GLDrawable", "true");
+ // props.setProperty("jogl.debug.GLContext", "true");
+ props.setProperty("jogl.debug.GLSLCode", "true");
+ props.setProperty("jogl.debug.GLMediaPlayer", "true");
+ // props.setProperty("jogl.debug.CapabilitiesChooser", "true");
+ // props.setProperty("jogl.debug.GLSLState", "true");
+ // props.setProperty("jogl.debug.DebugGL", "true");
+ // props.setProperty("jogl.debug.TraceGL", "true");
+ // props.setProperty("newt.debug", "all");
+ // props.setProperty("newt.debug.Window", "true");
+ // props.setProperty("newt.debug.Window.MouseEvent", "true");
+ // props.setProperty("newt.debug.Window.KeyEvent", "true");
+ // props.setProperty("jogamp.debug.IOUtil", "true");
+ }
+
+ @Override
+ public String getActivityName() {
+ return demo;
+ }
+
+ @Override
+ public List<String> getSysPackages() {
+ return Arrays.asList(sys_pkgs);
+ }
+
+ @Override
+ public List<String> getUsrPackages() {
+ return Arrays.asList(usr_pkgs);
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity0.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity0.java
index bcff3d5..b5a9ce5 100644
--- a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity0.java
+++ b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity0.java
@@ -27,7 +27,9 @@
*/
package com.jogamp.opengl.test.android;
-import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URLConnection;
import java.util.Arrays;
@@ -45,6 +47,10 @@ import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple;
import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.util.av.GLMediaPlayer;
+import com.jogamp.opengl.util.av.GLMediaPlayer.GLMediaEventListener;
+import com.jogamp.opengl.util.av.GLMediaPlayer.StreamException;
+import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame;
import android.os.Bundle;
import android.util.Log;
@@ -64,12 +70,12 @@ public class MovieSimpleActivity0 extends NewtBaseActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- String[] urls0 = new String[] {
+ final String[] streamLocs = new String[] {
System.getProperty("jnlp.media0_url2"),
System.getProperty("jnlp.media0_url1"),
System.getProperty("jnlp.media0_url0") };
- final URLConnection urlConnection0 = getResource(urls0, 0);
- if(null == urlConnection0) { throw new RuntimeException("no media reachable: "+Arrays.asList(urls0)); }
+ final URI streamLoc = getURI(streamLocs, 0, false);
+ if(null == streamLoc) { throw new RuntimeException("no media reachable: "+Arrays.asList(streamLocs)); }
// also initializes JOGL
final GLCapabilities capsMain = new GLCapabilities(GLProfile.getGL2ES2());
@@ -80,39 +86,73 @@ public class MovieSimpleActivity0 extends NewtBaseActivity {
final com.jogamp.newt.Screen scrn = NewtFactory.createScreen(dpy, 0);
scrn.addReference();
- try {
- final Animator animator = new Animator();
-
- // Main
- final MovieSimple demoMain = new MovieSimple(urlConnection0);
- demoMain.setScaleOrig(true);
- final GLWindow glWindowMain = GLWindow.create(scrn, capsMain);
- glWindowMain.setFullscreen(true);
- setContentView(getWindow(), glWindowMain);
- glWindowMain.addGLEventListener(demoMain);
- animator.add(glWindowMain);
- glWindowMain.setVisible(true);
-
- animator.setUpdateFPSFrames(60, System.err);
- // animator.setUpdateFPSFrames(-1, null);
- animator.resetFPSCounter();
- } catch (IOException e) {
- e.printStackTrace();
- }
+ final Animator anim = new Animator();
+
+ // Main
+ final GLWindow glWindowMain = GLWindow.create(scrn, capsMain);
+ glWindowMain.setFullscreen(true);
+ setContentView(getWindow(), glWindowMain);
+ anim.add(glWindowMain);
+ glWindowMain.setVisible(true);
+
+ final MovieSimple demoMain = new MovieSimple(null);
+ demoMain.setScaleOrig(true);
+ final GLMediaPlayer mPlayer = demoMain.getGLMediaPlayer();
+ mPlayer.addEventListener( new GLMediaPlayer.GLMediaEventListener() {
+ @Override
+ public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) { }
+
+ @Override
+ public void attributesChanged(GLMediaPlayer mp, int event_mask, long when) {
+ System.err.println("MovieSimpleActivity0 AttributesChanges: events_mask 0x"+Integer.toHexString(event_mask)+", when "+when);
+ System.err.println("MovieSimpleActivity0 State: "+mp);
+ if( 0 != ( GLMediaEventListener.EVENT_CHANGE_INIT & event_mask ) ) {
+ glWindowMain.addGLEventListener(demoMain);
+ anim.setUpdateFPSFrames(60, System.err);
+ anim.resetFPSCounter();
+ }
+ if( 0 != ( ( GLMediaEventListener.EVENT_CHANGE_ERR | GLMediaEventListener.EVENT_CHANGE_EOS ) & event_mask ) ) {
+ final StreamException se = mPlayer.getStreamException();
+ if( null != se ) {
+ se.printStackTrace();
+ }
+ getActivity().finish();
+ }
+ }
+ });
+ demoMain.initStream(streamLoc, GLMediaPlayer.STREAM_ID_AUTO, GLMediaPlayer.STREAM_ID_AUTO, 0);
scrn.removeReference();
Log.d(TAG, "onCreate - X");
}
- static URLConnection getResource(String path[], int off) {
- URLConnection uc = null;
- for(int i=off; null==uc && i<path.length; i++) {
+ static URI getURI(String path[], int off, boolean checkAvail) {
+ URI uri = null;
+ for(int i=off; null==uri && i<path.length; i++) {
if(null != path[i] && path[i].length()>0) {
- uc = IOUtil.getResource(path[i], null);
- Log.d(TAG, "Stream: <"+path[i]+">: "+(null!=uc));
+ if( checkAvail ) {
+ final URLConnection uc = IOUtil.getResource(path[i], null);
+ if( null != uc ) {
+ try {
+ uri = uc.getURL().toURI();
+ } catch (URISyntaxException e) {
+ uri = null;
+ }
+ if( uc instanceof HttpURLConnection ) {
+ ((HttpURLConnection)uc).disconnect();
+ }
+ }
+ } else {
+ try {
+ uri = new URI(path[i]);
+ } catch (URISyntaxException e) {
+ uri = null;
+ }
+ }
+ Log.d(TAG, "Stream: <"+path[i]+">: "+(null!=uri));
}
}
- return uc;
+ return uri;
}
}
diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity1.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity1.java
index cb0fd07..e54300d 100644
--- a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity1.java
+++ b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity1.java
@@ -27,7 +27,9 @@
*/
package com.jogamp.opengl.test.android;
-import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URLConnection;
import java.util.Arrays;
@@ -48,6 +50,9 @@ import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.av.GLMediaPlayer;
+import com.jogamp.opengl.util.av.GLMediaPlayer.GLMediaEventListener;
+import com.jogamp.opengl.util.av.GLMediaPlayer.StreamException;
+import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame;
import android.os.Bundle;
import android.util.Log;
@@ -74,22 +79,22 @@ public class MovieSimpleActivity1 extends NewtBaseActivity {
final boolean mPlayerSharedHUD = mPlayerHUD && Boolean.valueOf(System.getProperty("jnlp.mplayer.hud.shared"));
Log.d(TAG, "onCreate - 0 - mPlayerLocal "+mPlayerLocal+", mPlayerNoScale "+mPlayerNoZoom+", mPlayerHUD "+mPlayerHUD+", mPlayerSharedHUD "+mPlayerSharedHUD);
- String[] urls0 = new String[] {
+ String[] streamLocs = new String[] {
System.getProperty("jnlp.media0_url2"),
System.getProperty("jnlp.media0_url1"),
System.getProperty("jnlp.media0_url0") };
- final URLConnection urlConnection0 = getResource(urls0, mPlayerLocal ? 2 : 0);
- if(null == urlConnection0) { throw new RuntimeException("no media reachable: "+Arrays.asList(urls0)); }
+ final URI streamLoc0 = getURI(streamLocs, mPlayerLocal ? 2 : 0, false);
+ if(null == streamLoc0) { throw new RuntimeException("no media reachable: "+Arrays.asList(streamLocs)); }
- final URLConnection urlConnection1;
+ final URI streamLoc1;
{
- URLConnection _urlConnection1 = null;
+ URI _streamLoc1 = null;
if(mPlayerHUD && !mPlayerSharedHUD) {
String[] urls1 = new String[] { System.getProperty("jnlp.media1_url0") };
- _urlConnection1 = getResource(urls1, 0);
+ _streamLoc1 = getURI(urls1, 0, false);
}
- if(null == _urlConnection1) { _urlConnection1 = urlConnection0; }
- urlConnection1 = _urlConnection1;
+ if(null == _streamLoc1) { _streamLoc1 = streamLoc0; }
+ streamLoc1 = _streamLoc1;
}
setTransparencyTheme();
@@ -107,82 +112,117 @@ public class MovieSimpleActivity1 extends NewtBaseActivity {
final com.jogamp.newt.Screen scrn = NewtFactory.createScreen(dpy, 0);
scrn.addReference();
- try {
- final Animator animator = new Animator();
-
- // Main
- final MovieSimple demoMain = new MovieSimple(urlConnection0);
- if(mPlayerHUD) {
- demoMain.setEffects(MovieSimple.EFFECT_GRADIENT_BOTTOM2TOP);
- demoMain.setTransparency(0.9f);
- }
- demoMain.setScaleOrig(mPlayerNoZoom);
- final GLWindow glWindowMain = GLWindow.create(scrn, capsMain);
- {
- final int padding = mPlayerHUD ? 32 : 0;
- final android.view.View androidView = ((jogamp.newt.driver.android.WindowDriver)glWindowMain.getDelegatedWindow()).getAndroidView();
- glWindowMain.setSize(scrn.getWidth()-padding, scrn.getHeight()-padding);
- glWindowMain.setUndecorated(true);
- // setContentView(getWindow(), glWindowMain);
- viewGroup.addView(androidView, new android.widget.FrameLayout.LayoutParams(glWindowMain.getWidth(), glWindowMain.getHeight(), Gravity.BOTTOM|Gravity.RIGHT));
- registerNEWTWindow(glWindowMain);
+ final Animator anim = new Animator();
+
+ // Main
+ final GLWindow glWindowMain = GLWindow.create(scrn, capsMain);
+ {
+ final int padding = mPlayerHUD ? 32 : 0;
+ final android.view.View androidView = ((jogamp.newt.driver.android.WindowDriver)glWindowMain.getDelegatedWindow()).getAndroidView();
+ glWindowMain.setSize(scrn.getWidth()-padding, scrn.getHeight()-padding);
+ glWindowMain.setUndecorated(true);
+ // setContentView(getWindow(), glWindowMain);
+ viewGroup.addView(androidView, new android.widget.FrameLayout.LayoutParams(glWindowMain.getWidth(), glWindowMain.getHeight(), Gravity.BOTTOM|Gravity.RIGHT));
+ registerNEWTWindow(glWindowMain);
+ }
+ anim.add(glWindowMain);
+ glWindowMain.setVisible(true);
+
+ final MovieSimple demoMain = new MovieSimple(null);
+ final GLMediaPlayer mPlayerMain = demoMain.getGLMediaPlayer();
+ if(mPlayerHUD) {
+ demoMain.setEffects(MovieSimple.EFFECT_GRADIENT_BOTTOM2TOP);
+ demoMain.setTransparency(0.9f);
+ }
+ demoMain.setScaleOrig(mPlayerNoZoom);
+ mPlayerMain.addEventListener( new GLMediaPlayer.GLMediaEventListener() {
+ @Override
+ public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) { }
+
+ @Override
+ public void attributesChanged(GLMediaPlayer mp, int event_mask, long when) {
+ System.err.println("MovieSimpleActivity1 AttributesChanges: events_mask 0x"+Integer.toHexString(event_mask)+", when "+when);
+ System.err.println("MovieSimpleActivity1 State: "+mp);
+ if( 0 != ( GLMediaEventListener.EVENT_CHANGE_INIT & event_mask ) ) {
+ glWindowMain.addGLEventListener(demoMain);
+ anim.setUpdateFPSFrames(60, System.err);
+ anim.resetFPSCounter();
+ }
+ if( 0 != ( ( GLMediaEventListener.EVENT_CHANGE_ERR | GLMediaEventListener.EVENT_CHANGE_EOS ) & event_mask ) ) {
+ final StreamException se = mPlayerMain.getStreamException();
+ if( null != se ) {
+ se.printStackTrace();
+ }
+ getActivity().finish();
+ }
}
-
- glWindowMain.addGLEventListener(demoMain);
- animator.add(glWindowMain);
- glWindowMain.setVisible(true);
-
- if(mPlayerHUD) {
- final GLMediaPlayer sharedPlayer = mPlayerSharedHUD ? demoMain.getGLMediaPlayer() : null;
- final GLCapabilities capsHUD = new GLCapabilities(GLProfile.getGL2ES2());
- capsHUD.setBackgroundOpaque(false);
- final GLWindow glWindowHUD = GLWindow.create(scrn, capsHUD);
- glWindowMain.invoke(false, new GLRunnable() {
- @Override
- public boolean run(GLAutoDrawable drawable) {
- int x2 = scrn.getX();
- int y2 = scrn.getY();
- int w2 = scrn.getWidth()/3;
- int h2 = scrn.getHeight()/3;
- if(null != sharedPlayer) {
- if(0 < sharedPlayer.getWidth() && sharedPlayer.getWidth()<scrn.getWidth()/2 &&
- 0 < sharedPlayer.getHeight() && sharedPlayer.getHeight()<scrn.getHeight()/2) {
- w2 = sharedPlayer.getWidth();
- h2 = sharedPlayer.getHeight();
- }
- glWindowHUD.setSharedContext(glWindowMain.getContext());
- glWindowHUD.addGLEventListener(new MovieSimple(sharedPlayer));
- } else {
- try {
- glWindowHUD.addGLEventListener(new MovieSimple(urlConnection1));
- } catch (IOException e) {
- e.printStackTrace();
+ });
+ demoMain.initStream(streamLoc0, GLMediaPlayer.STREAM_ID_AUTO, GLMediaPlayer.STREAM_ID_AUTO, 0);
+
+ if(mPlayerHUD) {
+ final GLMediaPlayer mPlayerShared = mPlayerSharedHUD ? mPlayerMain : null;
+ final GLCapabilities capsHUD = new GLCapabilities(GLProfile.getGL2ES2());
+ capsHUD.setBackgroundOpaque(false);
+ final GLWindow glWindowHUD = GLWindow.create(scrn, capsHUD);
+ glWindowMain.invoke(false, new GLRunnable() {
+ @Override
+ public boolean run(GLAutoDrawable drawable) {
+ final GLMediaPlayer mPlayerSub;
+ final MovieSimple demoHUD;
+ int x2 = scrn.getX();
+ int y2 = scrn.getY();
+ int w2 = scrn.getWidth()/3;
+ int h2 = scrn.getHeight()/3;
+ if(null != mPlayerShared) {
+ if(0 < mPlayerShared.getWidth() && mPlayerShared.getWidth()<scrn.getWidth()/2 &&
+ 0 < mPlayerShared.getHeight() && mPlayerShared.getHeight()<scrn.getHeight()/2) {
+ w2 = mPlayerShared.getWidth();
+ h2 = mPlayerShared.getHeight();
+ }
+ glWindowHUD.setSharedContext(glWindowMain.getContext());
+ demoHUD = new MovieSimple(mPlayerShared);
+ mPlayerSub = mPlayerShared;
+ } else {
+ demoHUD = new MovieSimple(null);
+ mPlayerSub = demoHUD.getGLMediaPlayer();
+ }
+ mPlayerSub.addEventListener( new GLMediaPlayer.GLMediaEventListener() {
+ @Override
+ public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) { }
+
+ @Override
+ public void attributesChanged(GLMediaPlayer mp, int event_mask, long when) {
+ if( 0 != ( GLMediaEventListener.EVENT_CHANGE_INIT & event_mask ) ) {
+ glWindowHUD.addGLEventListener(demoHUD);
+ }
+ if( 0 != ( ( GLMediaEventListener.EVENT_CHANGE_ERR | GLMediaEventListener.EVENT_CHANGE_EOS ) & event_mask ) ) {
+ final StreamException se = mPlayerMain.getStreamException();
+ if( null != se ) {
+ se.printStackTrace();
+ }
+ getActivity().finish();
}
- }
- glWindowHUD.setPosition(x2, y2);
- glWindowHUD.setSize(w2, h2);
- System.err.println("HUD: "+mPlayerHUD);
- System.err.println("HUD: "+w2+"x"+h2);
- glWindowHUD.addMouseListener(toFrontMouseListener);
+ }
+ });
+ demoHUD.initStream(streamLoc1, GLMediaPlayer.STREAM_ID_AUTO, GLMediaPlayer.STREAM_ID_AUTO, 0);
+
+ glWindowHUD.setPosition(x2, y2);
+ glWindowHUD.setSize(w2, h2);
+ System.err.println("HUD: "+mPlayerHUD);
+ System.err.println("HUD: "+w2+"x"+h2);
+ glWindowHUD.addMouseListener(toFrontMouseListener);
- viewGroup.post(new Runnable() {
- public void run() {
- final android.view.View androidView = ((jogamp.newt.driver.android.WindowDriver)glWindowHUD.getDelegatedWindow()).getAndroidView();
- // addContentView(getWindow(), glWindowHUD, new android.view.ViewGroup.LayoutParams(glWindowHUD.getWidth(), glWindowHUD.getHeight()));
- viewGroup.addView(androidView, new android.widget.FrameLayout.LayoutParams(glWindowHUD.getWidth(), glWindowHUD.getHeight(), Gravity.TOP|Gravity.LEFT));
- registerNEWTWindow(glWindowHUD);
- animator.add(glWindowHUD);
- glWindowHUD.setVisible(true);
- } } );
- return true;
- } } );
- }
-
- animator.setUpdateFPSFrames(60, System.err);
- // animator.setUpdateFPSFrames(-1, null);
- animator.resetFPSCounter();
- } catch (IOException e) {
- e.printStackTrace();
+ viewGroup.post(new Runnable() {
+ public void run() {
+ final android.view.View androidView = ((jogamp.newt.driver.android.WindowDriver)glWindowHUD.getDelegatedWindow()).getAndroidView();
+ // addContentView(getWindow(), glWindowHUD, new android.view.ViewGroup.LayoutParams(glWindowHUD.getWidth(), glWindowHUD.getHeight()));
+ viewGroup.addView(androidView, new android.widget.FrameLayout.LayoutParams(glWindowHUD.getWidth(), glWindowHUD.getHeight(), Gravity.TOP|Gravity.LEFT));
+ registerNEWTWindow(glWindowHUD);
+ anim.add(glWindowHUD);
+ glWindowHUD.setVisible(true);
+ } } );
+ return true;
+ } } );
}
scrn.removeReference();
@@ -190,14 +230,32 @@ public class MovieSimpleActivity1 extends NewtBaseActivity {
Log.d(TAG, "onCreate - X");
}
- static URLConnection getResource(String path[], int off) {
- URLConnection uc = null;
- for(int i=off; null==uc && i<path.length; i++) {
+ static URI getURI(String path[], int off, boolean checkAvail) {
+ URI uri = null;
+ for(int i=off; null==uri && i<path.length; i++) {
if(null != path[i] && path[i].length()>0) {
- uc = IOUtil.getResource(path[i], null);
- Log.d(TAG, "Stream: <"+path[i]+">: "+(null!=uc));
+ if( checkAvail ) {
+ final URLConnection uc = IOUtil.getResource(path[i], null);
+ if( null != uc ) {
+ try {
+ uri = uc.getURL().toURI();
+ } catch (URISyntaxException e) {
+ uri = null;
+ }
+ if( uc instanceof HttpURLConnection ) {
+ ((HttpURLConnection)uc).disconnect();
+ }
+ }
+ } else {
+ try {
+ uri = new URI(path[i]);
+ } catch (URISyntaxException e) {
+ uri = null;
+ }
+ }
+ Log.d(TAG, "Stream: <"+path[i]+">: "+(null!=uri));
}
}
- return uc;
+ return uri;
}
}
diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00a.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00a.java
deleted file mode 100644
index de4238f..0000000
--- a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00a.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * Copyright 2012 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.android;
-
-import java.util.Arrays;
-import java.util.List;
-
-import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties;
-
-public class MovieSimpleActivityLauncher00a 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[] usr_pkgs = new String[] { "com.jogamp.opengl.test" };
-
- @Override
- public void init() {
- final OrderedProperties props = getProperties();
- props.setProperty("jnlp.mplayer.nozoom", "true");
- props.setProperty("jnlp.mplayer.hud", "false");
- props.setProperty("jnlp.mplayer.hud.shared", "false");
- // props.setProperty("jnlp.media0_url2", "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_640x360.m4v");
- props.setProperty("jnlp.media0_url2", "");
- props.setProperty("jnlp.media0_url1", "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4");
- props.setProperty("jnlp.media0_url0", "file:///mnt/sdcard/Movies/BigBuckBunny_320x180.mp4");
- props.setProperty("jnlp.media1_url0", "http://archive.org/download/ElephantsDream/ed_1024_512kb.mp4");
- // props.setProperty("jogamp.debug.JNILibLoader", "true");
- // props.setProperty("jogamp.debug.NativeLibrary", "true");
- // props.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
- // props.setProperty("jogamp.debug.IOUtil", "true");
- // props.setProperty("nativewindow.debug", "all");
- props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
- // props.setProperty("jogl.debug", "all");
- // props.setProperty("jogl.debug.GLProfile", "true");
- props.setProperty("jogl.debug.GLDrawable", "true");
- props.setProperty("jogl.debug.GLContext", "true");
- props.setProperty("jogl.debug.GLSLCode", "true");
- // props.setProperty("jogl.debug.CapabilitiesChooser", "true");
- // props.setProperty("jogl.debug.GLSLState", "true");
- // props.setProperty("jogl.debug.DebugGL", "true");
- // props.setProperty("jogl.debug.TraceGL", "true");
- // props.setProperty("newt.debug", "all");
- // props.setProperty("newt.debug.Window", "true");
- // props.setProperty("newt.debug.Window.MouseEvent", "true");
- // props.setProperty("newt.debug.Window.KeyEvent", "true");
- props.setProperty("jogamp.debug.IOUtil", "true");
- }
-
- @Override
- public String getActivityName() {
- return demo;
- }
- @Override
- public List<String> getSysPackages() {
- return Arrays.asList(sys_pkgs);
- }
-
- @Override
- public List<String> getUsrPackages() {
- return Arrays.asList(usr_pkgs);
- }
-}
diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00b.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00b.java
index 3decf39..af53433 100644
--- a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00b.java
+++ b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00b.java
@@ -45,8 +45,8 @@ public class MovieSimpleActivityLauncher00b extends LauncherUtil.BaseActivityLau
props.setProperty("jnlp.mplayer.hud", "false");
props.setProperty("jnlp.mplayer.hud.shared", "false");
// props.setProperty("jnlp.media0_url2", "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_640x360.m4v");
- props.setProperty("jnlp.media0_url2", "");
- props.setProperty("jnlp.media0_url1", "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4");
+ props.setProperty("jnlp.media0_url2", "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4");
+ props.setProperty("jnlp.media0_url1", "http://video.webmfiles.org/big-buck-bunny_trailer.webm");
props.setProperty("jnlp.media0_url0", "file:///mnt/sdcard/Movies/BigBuckBunny_320x180.mp4");
props.setProperty("jnlp.media1_url0", "http://archive.org/download/ElephantsDream/ed_1024_512kb.mp4");
// props.setProperty("jogamp.debug.JNILibLoader", "true");
diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00c.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00c.java
new file mode 100644
index 0000000..0800baf
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivityLauncher00c.java
@@ -0,0 +1,86 @@
+/**
+ * Copyright 2012 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.android;
+
+import java.util.Arrays;
+import java.util.List;
+
+import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties;
+
+public class MovieSimpleActivityLauncher00c 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[] usr_pkgs = new String[] { "com.jogamp.opengl.test" };
+
+ @Override
+ public void init() {
+ final OrderedProperties props = getProperties();
+ props.setProperty("jnlp.mplayer.nozoom", "false");
+ props.setProperty("jnlp.mplayer.hud", "false");
+ props.setProperty("jnlp.mplayer.hud.shared", "false");
+ props.setProperty("jnlp.media0_url2", "camera:/0");
+ props.setProperty("jnlp.media0_url1", "http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4");
+ props.setProperty("jnlp.media0_url0", "file:///mnt/sdcard/Movies/BigBuckBunny_320x180.mp4");
+ // props.setProperty("jogamp.debug.JNILibLoader", "true");
+ // props.setProperty("jogamp.debug.NativeLibrary", "true");
+ // props.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
+ // props.setProperty("jogamp.debug.IOUtil", "true");
+ // props.setProperty("nativewindow.debug", "all");
+ // props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
+ // props.setProperty("jogl.debug", "all");
+ // props.setProperty("jogl.debug.GLProfile", "true");
+ // props.setProperty("jogl.debug.GLDrawable", "true");
+ // props.setProperty("jogl.debug.GLContext", "true");
+ props.setProperty("jogl.debug.GLSLCode", "true");
+ props.setProperty("jogl.debug.GLMediaPlayer", "true");
+ // props.setProperty("jogl.debug.CapabilitiesChooser", "true");
+ // props.setProperty("jogl.debug.GLSLState", "true");
+ // props.setProperty("jogl.debug.DebugGL", "true");
+ // props.setProperty("jogl.debug.TraceGL", "true");
+ // props.setProperty("newt.debug", "all");
+ // props.setProperty("newt.debug.Window", "true");
+ // props.setProperty("newt.debug.Window.MouseEvent", "true");
+ // props.setProperty("newt.debug.Window.KeyEvent", "true");
+ // props.setProperty("jogamp.debug.IOUtil", "true");
+ }
+
+ @Override
+ public String getActivityName() {
+ return demo;
+ }
+ @Override
+ public List<String> getSysPackages() {
+ return Arrays.asList(sys_pkgs);
+ }
+
+ @Override
+ public List<String> getUsrPackages() {
+ return Arrays.asList(usr_pkgs);
+ }
+}
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 a661694..e9609ca 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java
@@ -38,6 +38,8 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.os.Platform;
import com.jogamp.graph.curve.Region;
@@ -51,6 +53,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.glsl.ShaderState;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestRegionRendererNEWT01 extends UITestCase {
public static void main(String args[]) throws IOException {
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 b594fab..f675e42 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java
@@ -45,6 +45,8 @@ import javax.media.opengl.GLRunnable;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.graph.curve.opengl.RenderState;
import com.jogamp.graph.curve.opengl.TextRenderer;
@@ -58,6 +60,7 @@ import com.jogamp.opengl.util.GLReadBufferUtil;
import com.jogamp.opengl.util.glsl.ShaderState;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestTextRendererNEWT00 extends UITestCase {
static final boolean DEBUG = false;
static final boolean TRACE = false;
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 ea02e93..75a672a 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java
@@ -39,6 +39,8 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.os.Platform;
import com.jogamp.graph.curve.Region;
@@ -52,6 +54,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.glsl.ShaderState;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestTextRendererNEWT01 extends UITestCase {
static final boolean DEBUG = false;
static final boolean TRACE = false;
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 eb2c7bf..bfa942c 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java
@@ -38,6 +38,8 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.graph.curve.opengl.RenderState;
import com.jogamp.graph.curve.opengl.TextRenderer;
@@ -50,6 +52,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.glsl.ShaderState;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestTextRendererNEWT10 extends UITestCase {
static final boolean DEBUG = false;
static final boolean TRACE = false;
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 89de086..d8506a0 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
@@ -3,6 +3,8 @@ package com.jogamp.opengl.test.junit.jogl.acore;
import jogamp.nativewindow.x11.X11Util;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import javax.media.nativewindow.NativeWindowFactory;
import javax.media.opengl.GLCapabilities;
@@ -14,6 +16,7 @@ import java.awt.Frame;
/**
* Tests the closing the device of GLCanvas in JOGL
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestAWTCloseX11DisplayBug565 {
@Test
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 d96a49b..3e54bcd 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
@@ -49,11 +49,14 @@ import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
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;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestAddRemove01GLCanvasSwingAWT extends UITestCase {
static long durationPerTest = 100;
static int addRemoveCount = 15;
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 8b44748..be8dd3d 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
@@ -49,6 +49,8 @@ import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.opengl.GLWindow;
@@ -56,6 +58,7 @@ 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;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestAddRemove02GLWindowNewtCanvasAWT extends UITestCase {
static long durationPerTest = 50;
static int addRemoveCount = 15;
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 981b14a..d994754 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
@@ -38,12 +38,15 @@ import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.opengl.GLWindow;
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;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestAddRemove03GLWindowNEWT extends UITestCase {
static long durationPerTest = 50;
static int addRemoveCount = 15;
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 7b85291..d61ac9a 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
@@ -37,6 +37,8 @@ import jogamp.opengl.GLContextImpl;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
@@ -53,6 +55,7 @@ import com.jogamp.opengl.util.Animator;
*
* <https://jogamp.org/bugzilla/show_bug.cgi?id=669>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug669RecursiveGLContext01NEWT extends UITestCase {
@Test(timeout=5000)
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 104355a..d831016 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
@@ -34,6 +34,8 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
@@ -51,6 +53,7 @@ import com.jogamp.opengl.util.Animator;
*
* <https://jogamp.org/bugzilla/show_bug.cgi?id=669>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug669RecursiveGLContext02NEWT extends UITestCase {
@Test(timeout=5000)
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug692GL3VAO.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug692GL3VAO.java
deleted file mode 100644
index de5db0a..0000000
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug692GL3VAO.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/**
- * 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.
- */
-package com.jogamp.opengl.test.junit.jogl.acore;
-
-import java.io.IOException;
-import java.nio.FloatBuffer;
-import java.nio.ShortBuffer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.media.opengl.DebugGL3;
-import javax.media.opengl.GL3;
-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 junit.framework.Assert;
-
-import org.junit.Test;
-
-import com.jogamp.common.nio.Buffers;
-import com.jogamp.newt.opengl.GLWindow;
-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 com.jogamp.opengl.util.Animator;
-import com.jogamp.opengl.util.GLBuffers;
-
-/**
- * Test Vertex Array Object (VAO) Usage.
- * <p>
- * testGL3() tests VAO alone, i.e. w/o VBO enable/disabling.
- * </p>
- * <p>
- * testGL3bc() tests VAO and VBO while alternating between both methods.
- * </p>
- */
-public class TestBug692GL3VAO extends UITestCase {
- static long duration = 500; // ms
-
- static class GL3VAODemo implements GLEventListener {
- /** Different modes of displaying the geometry */
- public enum Mode {
- /** Traditional one without using VAO */
- NON_VAO {
- @Override
- void display(GL3VAODemo t, GL3 gl) {
- t.displayNonVAO(gl);
- }
- },
-
- /** Using VAOs throws [incorrectly as of JOGL 2.0rc11] a GLException */
- VAO_NORMAL {
- @Override
- void display(GL3VAODemo t, GL3 gl) {
- t.displayVAONormal(gl);
- }
- };
-
- abstract void display(GL3VAODemo t, GL3 gl);
- }
-
- private final Mode[] allModes;
- private Mode currentMode;
- private int currentModeIdx;
-
- public GL3VAODemo(Mode[] modes) {
- allModes = modes;
- currentMode = allModes[0];
- currentModeIdx = 0;
- }
-
- private final static float[] vertexData = new float[]{
- 0.0f, 0.75f, 0.0f, 1,0,0,
- -0.5f, -0.75f, 0.0f, 0,1,0,
- 0.9f, -0.75f, 0.0f, 0,0,1
- };
-
- private int ibo = -1;
- private int vbo = -1;
- private int vertID = -1;
- private int fragID = -1;
- private int progID = -1;
-
- private int vaoNormal = -1;
-
- private static int createShader(final GL3 gl, int type,
- final String[] srcLines){
- int shaderID = gl.glCreateShader(type);
- assert shaderID > 0;
- int[] lengths = new int[srcLines.length];
- for (int i = 0; i < srcLines.length; i++) {
- lengths[i] = srcLines[i].length();
- }
- gl.glShaderSource(shaderID, srcLines.length, srcLines, lengths, 0);
- gl.glCompileShader(shaderID);
- return shaderID;
- }
-
- private void initBuffers(GL3 gl) {
- // IDs for 2 buffers
- int[] buffArray = new int[2];
- gl.glGenBuffers(buffArray.length, buffArray, 0);
- vbo = buffArray[0];
- assert vbo > 0;
-
- // Bind buffer and upload data
- gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, vbo);
- FloatBuffer buffer = GLBuffers.newDirectFloatBuffer(vertexData);
- assert buffer.remaining() == vertexData.length;
- gl.glBufferData(GL3.GL_ARRAY_BUFFER, vertexData.length * Buffers.SIZEOF_FLOAT,
- buffer, GL3.GL_STATIC_DRAW);
- gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, 0);
-
- // Buffer with the 3 indices required for one triangle
- ibo = buffArray[1];
- assert ibo > 0;
- final short[] indices = new short[]{0, 1, 2};
- ShortBuffer shortBuffer = GLBuffers.newDirectShortBuffer(indices);
- assert shortBuffer.remaining() == indices.length;
- gl.glBindBuffer(GL3.GL_ELEMENT_ARRAY_BUFFER, ibo);
- gl.glBufferData(GL3.GL_ELEMENT_ARRAY_BUFFER,indices.length*Buffers.SIZEOF_SHORT,
- shortBuffer, GL3.GL_STATIC_DRAW);
- gl.glBindBuffer(GL3.GL_ELEMENT_ARRAY_BUFFER, 0);
- }
- private void initShaders(GL3 gl) {
- final String[] vertSrc = new String[]{
- "#version 150\n",
- "in vec4 vPosition;\n",
- "in vec4 vColor;\n",
- "out vec4 pColor;\n",
- "void main() {\n",
- " pColor = vColor;\n",
- " gl_Position = vPosition;\n",
- "}\n"
- };
- vertID = createShader(gl, GL3.GL_VERTEX_SHADER, vertSrc);
-
- final String[] fragSrc = new String[]{
- "#version 150\n",
- "in vec4 pColor;\n",
- "void main() {\n",
- " gl_FragColor = pColor;\n",
- "}\n"
- };
- fragID = createShader(gl, GL3.GL_FRAGMENT_SHADER, fragSrc);
-
- // We're done with the compiler
- gl.glReleaseShaderCompiler();
-
- progID = gl.glCreateProgram();
- assert progID > 0;
- gl.glAttachShader(progID, vertID);
- gl.glAttachShader(progID, fragID);
- gl.glLinkProgram(progID);
- gl.glValidateProgram(progID);
- }
-
- private int initVAO(GL3 gl) {
- int[] buff = new int[1];
- gl.glGenVertexArrays(1, buff, 0);
- int vao = buff[0];
- Assert.assertTrue("Invalid VAO: "+vao, vao > 0);
-
-
- gl.glUseProgram(progID);
- final int posLoc = gl.glGetAttribLocation(progID, "vPosition");
- final int colorLoc = gl.glGetAttribLocation(progID, "vColor");
- gl.glUseProgram(0);
-
- gl.glBindVertexArray(vao);
- gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, vbo);
- gl.glBindBuffer(GL3.GL_ELEMENT_ARRAY_BUFFER, ibo);
-
- gl.glEnableVertexAttribArray(posLoc);
- gl.glEnableVertexAttribArray(colorLoc);
-
- final int stride = 6 * Buffers.SIZEOF_FLOAT;
- final int cOff = 3 * Buffers.SIZEOF_FLOAT;
- gl.glVertexAttribPointer(posLoc, 3, GL3.GL_FLOAT, false, stride, 0L);
- gl.glVertexAttribPointer(colorLoc,3, GL3.GL_FLOAT, false, stride, cOff);
-
- gl.glBindVertexArray(0);
- return vao;
- }
-
- @Override
- public void init(GLAutoDrawable drawable) {
- drawable.setGL(new DebugGL3(drawable.getGL().getGL3()));
-
- final GL3 gl = drawable.getGL().getGL3();
- gl.glEnable(GL3.GL_DEPTH_TEST);
- gl.glDisable(GL3.GL_CULL_FACE);
- initBuffers(gl);
- initShaders(gl);
-
- vaoNormal = initVAO(gl);
-
- gl.setSwapInterval(1);
- }
-
- @Override
- public void dispose(GLAutoDrawable drawable) {
- final GL3 gl = drawable.getGL().getGL3();
- gl.glDeleteBuffers(2, new int[]{vbo, ibo}, 0);
- gl.glDetachShader(progID, fragID);
- gl.glDetachShader(progID, vertID);
- gl.glDeleteProgram(progID);
- gl.glDeleteShader(fragID);
- gl.glDeleteShader(vertID);
- }
-
- private void displayNonVAO(final GL3 gl) {
- final int posLoc = gl.glGetAttribLocation(progID, "vPosition");
- final int colorLoc = gl.glGetAttribLocation(progID, "vColor");
- gl.glEnableVertexAttribArray(posLoc);
- gl.glEnableVertexAttribArray(colorLoc);
-
- gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, vbo);
- final int stride = 6 * Buffers.SIZEOF_FLOAT;
- final int cOff = 3 * Buffers.SIZEOF_FLOAT;
- gl.glVertexAttribPointer(posLoc, 3, GL3.GL_FLOAT, false, stride, 0L);
- gl.glVertexAttribPointer(colorLoc,3, GL3.GL_FLOAT, false, stride, cOff);
- gl.glBindBuffer(GL3.GL_ELEMENT_ARRAY_BUFFER, ibo);
- gl.glDrawElements(GL3.GL_TRIANGLES, 3, GL3.GL_UNSIGNED_SHORT, 0L);
-
- gl.glDisableVertexAttribArray(posLoc);
- gl.glDisableVertexAttribArray(colorLoc);
- gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, 0);
- gl.glBindBuffer(GL3.GL_ELEMENT_ARRAY_BUFFER, 0);
- }
-
- private void displayVAONormal(final GL3 gl) {
- try {
- gl.glBindVertexArray(vaoNormal);
- gl.glDrawElements(GL3.GL_TRIANGLES, 3, GL3.GL_UNSIGNED_SHORT, 0L);
- gl.glBindVertexArray(0);
- } catch (GLException ex) {
- Logger.getLogger(TestBug692GL3VAO.class.getName()).log(Level.SEVERE,null,ex);
- }
- }
-
- @Override
- public void display(GLAutoDrawable drawable) {
- final GL3 gl = drawable.getGL().getGL3();
- float color = ((float) currentMode.ordinal() + 1) / (Mode.values().length + 2);
- gl.glClearColor(color, color, color, 0);
- gl.glClear(GL3.GL_COLOR_BUFFER_BIT | GL3.GL_DEPTH_BUFFER_BIT);
- gl.glUseProgram(progID);
- final Mode newMode;
- {
- currentModeIdx = ( currentModeIdx + 1 ) % allModes.length;
- newMode = allModes[ currentModeIdx ];
- }
- if (newMode != currentMode) {
- currentMode = newMode;
- System.out.println("Display mode: " + currentMode);
- }
- currentMode.display(this, gl);
- gl.glUseProgram(0);
- }
-
- @Override
- public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {
- }
- }
-
- private void testImpl(GLProfile profile, GL3VAODemo.Mode[] modes) throws InterruptedException {
- final GLCapabilities capabilities = new GLCapabilities(profile);
- final GLWindow glWindow = GLWindow.create(capabilities);
- glWindow.setSize(512, 512);
-
- Animator anim = new Animator(glWindow);
-
- QuitAdapter quitAdapter = new QuitAdapter();
- glWindow.addKeyListener(quitAdapter);
- glWindow.addWindowListener(quitAdapter);
-
- final GL3VAODemo vaoTest = new GL3VAODemo(modes);
- glWindow.addGLEventListener(vaoTest);
- glWindow.setVisible(true);
- anim.start();
-
- final long t0 = System.currentTimeMillis();
- long t1 = t0;
- while(!quitAdapter.shouldQuit() && t1-t0<duration) {
- Thread.sleep(100);
- t1 = System.currentTimeMillis();
- }
-
- anim.stop();
- glWindow.destroy();
- }
-
- //@Test
- public void testGL3() throws GLException, InterruptedException {
- if( ! GLProfile.isAvailable(GLProfile.GL3) ) {
- System.err.println("GL3 n/a");
- return;
- }
- GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.VAO_NORMAL };
- testImpl(GLProfile.get(GLProfile.GL3), modes);
- }
-
- @Test
- public void testGL3bc() throws GLException, InterruptedException {
- if( ! GLProfile.isAvailable(GLProfile.GL3bc) ) {
- System.err.println("GL3bc n/a");
- return;
- }
- GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.VAO_NORMAL, GL3VAODemo.Mode.NON_VAO };
- testImpl(GLProfile.get(GLProfile.GL3bc), modes);
- }
-
- public static void main(String args[]) throws IOException {
- for(int i=0; i<args.length; i++) {
- if(args[i].equals("-time")) {
- duration = MiscUtils.atoi(args[++i], (int)duration);
- }
- }
- String tstname = TestBug692GL3VAO.class.getName();
- org.junit.runner.JUnitCore.main(tstname);
- }
-
-}
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
new file mode 100644
index 0000000..5337b64
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug692GL3VAONEWT.java
@@ -0,0 +1,442 @@
+/**
+ * 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.
+ */
+package com.jogamp.opengl.test.junit.jogl.acore;
+
+import java.io.IOException;
+import java.nio.FloatBuffer;
+import java.nio.ShortBuffer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+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 org.junit.Assert;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.common.nio.Buffers;
+import com.jogamp.newt.opengl.GLWindow;
+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 com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.util.GLBuffers;
+
+/**
+ * Test Vertex Array Object (VAO) Usage and BufferStateTracker
+ * <p>
+ * All combinations of CPU_SRC, VBO_ONLY and VBO_VAO are tested
+ * and validate the fix for Bug 692, i.e. <https://jogamp.org/bugzilla/show_bug.cgi?id=692>.
+ * </p>
+ * <p>
+ * Test order is important!
+ * </p>
+ * <p>
+ * Note that VAO initialization does unbind the VBO .. since otherwise they are still bound
+ * and the CPU_SRC test will fail!<br/>
+ * The OpenGL spec does not mention that unbinding a VAO will also unbind the bound VBOs
+ * during their setup.<br/>
+ * Local tests here on NV and AMD proprietary driver resulted in <i>no ourput image</i>
+ * when not unbinding said VBOs before the CPU_SRC tests.<br/>
+ * Hence Bug 692 Comment 5 is invalid, i.e. <https://jogamp.org/bugzilla/show_bug.cgi?id=692#c5>,
+ * and we should throw an exception to give users a hint!
+ * </p>
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestBug692GL3VAONEWT extends UITestCase {
+ static long duration = 500; // ms
+
+ static class GL3VAODemo implements GLEventListener {
+ /** Different modes of displaying the geometry */
+ public enum Mode {
+ CPU_SRC {
+ @Override
+ void display(GL3VAODemo t, GL3bc gl) {
+ t.displayCPUSourcing(gl);
+ }
+ },
+
+ /** Traditional one without using VAO */
+ VBO_ONLY {
+ @Override
+ void display(GL3VAODemo t, GL3bc gl) {
+ t.displayVBOOnly(gl);
+ }
+ },
+
+ /** Using VAOs throws [incorrectly as of JOGL 2.0rc11] a GLException */
+ VBO_VAO {
+ @Override
+ void display(GL3VAODemo t, GL3bc gl) {
+ t.displayVBOVAO(gl);
+ }
+ };
+
+ abstract void display(GL3VAODemo t, GL3bc gl);
+ }
+
+ private final Mode[] allModes;
+ private Mode currentMode;
+ private int currentModeIdx;
+
+ public GL3VAODemo(Mode[] modes) {
+ allModes = modes;
+ currentMode = allModes[0];
+ currentModeIdx = 0;
+ }
+
+ private final static float[] vertexColorData = new float[]{
+ 0.0f, 0.75f, 0.0f, 1,0,0,
+ -0.5f, -0.75f, 0.0f, 0,1,0,
+ 0.9f, -0.75f, 0.0f, 0,0,1
+ };
+ private final FloatBuffer vertexColorDataBuffer = GLBuffers.newDirectFloatBuffer(vertexColorData);
+
+ private final short[] indices = new short[]{0, 1, 2};
+ private final ShortBuffer indicesBuffer = GLBuffers.newDirectShortBuffer(indices);
+
+
+ private int ibo = -1;
+ private int vbo = -1;
+ private int vertID = -1;
+ private int fragID = -1;
+ private int progID = -1;
+
+ private int vao = -1;
+
+ private static int createShader(final GL3 gl, int type,
+ final String[] srcLines){
+ int shaderID = gl.glCreateShader(type);
+ assert shaderID > 0;
+ int[] lengths = new int[srcLines.length];
+ for (int i = 0; i < srcLines.length; i++) {
+ lengths[i] = srcLines[i].length();
+ }
+ gl.glShaderSource(shaderID, srcLines.length, srcLines, lengths, 0);
+ gl.glCompileShader(shaderID);
+ return shaderID;
+ }
+
+ private void initBuffers(GL3 gl) {
+ // IDs for 2 buffers
+ int[] buffArray = new int[2];
+ gl.glGenBuffers(buffArray.length, buffArray, 0);
+ vbo = buffArray[0];
+ assert vbo > 0;
+
+ // Bind buffer and upload data
+ gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, vbo);
+ gl.glBufferData(GL3.GL_ARRAY_BUFFER, vertexColorData.length * Buffers.SIZEOF_FLOAT,
+ vertexColorDataBuffer, GL3.GL_STATIC_DRAW);
+ gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, 0);
+
+ // Buffer with the 3 indices required for one triangle
+ ibo = buffArray[1];
+ assert ibo > 0;
+ gl.glBindBuffer(GL3.GL_ELEMENT_ARRAY_BUFFER, ibo);
+ gl.glBufferData(GL3.GL_ELEMENT_ARRAY_BUFFER,indices.length*Buffers.SIZEOF_SHORT,
+ indicesBuffer, GL3.GL_STATIC_DRAW);
+ gl.glBindBuffer(GL3.GL_ELEMENT_ARRAY_BUFFER, 0);
+ }
+ private void initShaders(GL3 gl) {
+ final String[] vertSrc = new String[]{
+ "#version 150\n",
+ "in vec4 vPosition;\n",
+ "in vec4 vColor;\n",
+ "out vec4 pColor;\n",
+ "void main() {\n",
+ " pColor = vColor;\n",
+ " gl_Position = vPosition;\n",
+ "}\n"
+ };
+ vertID = createShader(gl, GL3.GL_VERTEX_SHADER, vertSrc);
+
+ final String[] fragSrc = new String[]{
+ "#version 150\n",
+ "in vec4 pColor;\n",
+ "void main() {\n",
+ " gl_FragColor = pColor;\n",
+ "}\n"
+ };
+ fragID = createShader(gl, GL3.GL_FRAGMENT_SHADER, fragSrc);
+
+ // We're done with the compiler
+ gl.glReleaseShaderCompiler();
+
+ progID = gl.glCreateProgram();
+ assert progID > 0;
+ gl.glAttachShader(progID, vertID);
+ gl.glAttachShader(progID, fragID);
+ gl.glLinkProgram(progID);
+ gl.glValidateProgram(progID);
+ }
+
+ private int initVAO(GL3 gl) {
+ int[] buff = new int[1];
+ gl.glGenVertexArrays(1, buff, 0);
+ int vao = buff[0];
+ Assert.assertTrue("Invalid VAO: "+vao, vao > 0);
+
+
+ gl.glUseProgram(progID);
+ final int posLoc = gl.glGetAttribLocation(progID, "vPosition");
+ final int colorLoc = gl.glGetAttribLocation(progID, "vColor");
+ gl.glUseProgram(0);
+
+ gl.glBindVertexArray(vao);
+ gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, vbo);
+ gl.glBindBuffer(GL3.GL_ELEMENT_ARRAY_BUFFER, ibo);
+
+ gl.glEnableVertexAttribArray(posLoc);
+ gl.glEnableVertexAttribArray(colorLoc);
+
+ final int stride = 6 * Buffers.SIZEOF_FLOAT;
+ final int cOff = 3 * Buffers.SIZEOF_FLOAT;
+ gl.glVertexAttribPointer(posLoc, 3, GL3.GL_FLOAT, false, stride, 0L);
+ gl.glVertexAttribPointer(colorLoc,3, GL3.GL_FLOAT, false, stride, cOff);
+
+ gl.glBindVertexArray(0);
+ // See class documentation above!
+ gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, 0);
+ gl.glBindBuffer(GL3.GL_ELEMENT_ARRAY_BUFFER, 0);
+ return vao;
+ }
+
+ @Override
+ public void init(GLAutoDrawable drawable) {
+ final GL3 gl = drawable.getGL().getGL3();
+ gl.glEnable(GL3.GL_DEPTH_TEST);
+ gl.glDisable(GL3.GL_CULL_FACE);
+ initBuffers(gl);
+ initShaders(gl);
+
+ vao = initVAO(gl);
+
+ gl.setSwapInterval(1);
+ }
+
+ @Override
+ public void dispose(GLAutoDrawable drawable) {
+ final GL3 gl = drawable.getGL().getGL3();
+ gl.glDeleteBuffers(2, new int[]{vbo, ibo}, 0);
+ gl.glDetachShader(progID, fragID);
+ gl.glDetachShader(progID, vertID);
+ gl.glDeleteProgram(progID);
+ gl.glDeleteShader(fragID);
+ gl.glDeleteShader(vertID);
+ }
+
+ private void displayCPUSourcing(final GL3bc gl) {
+ final int posLoc = gl.glGetAttribLocation(progID, "vPosition");
+ final int colorLoc = gl.glGetAttribLocation(progID, "vColor");
+ gl.glEnableVertexAttribArray(posLoc);
+ gl.glEnableVertexAttribArray(colorLoc);
+
+ final int stride = 6 * Buffers.SIZEOF_FLOAT;
+ // final int cOff = 3 * Buffers.SIZEOF_FLOAT;
+ gl.glVertexAttribPointer(posLoc, 3, GL3.GL_FLOAT, false, stride, vertexColorDataBuffer);
+ vertexColorDataBuffer.position(3); // move to cOff
+ gl.glVertexAttribPointer(colorLoc,3, GL3.GL_FLOAT, false, stride, vertexColorDataBuffer);
+ vertexColorDataBuffer.position(0); // rewind cOff
+
+ gl.glDrawElements(GL3.GL_TRIANGLES, 3, GL3.GL_UNSIGNED_SHORT, indicesBuffer);
+
+ gl.glDisableVertexAttribArray(posLoc);
+ gl.glDisableVertexAttribArray(colorLoc);
+ }
+
+ private void displayVBOOnly(final GL3 gl) {
+ final int posLoc = gl.glGetAttribLocation(progID, "vPosition");
+ final int colorLoc = gl.glGetAttribLocation(progID, "vColor");
+ gl.glEnableVertexAttribArray(posLoc);
+ gl.glEnableVertexAttribArray(colorLoc);
+
+ gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, vbo);
+ final int stride = 6 * Buffers.SIZEOF_FLOAT;
+ final int cOff = 3 * Buffers.SIZEOF_FLOAT;
+ gl.glVertexAttribPointer(posLoc, 3, GL3.GL_FLOAT, false, stride, 0L);
+ gl.glVertexAttribPointer(colorLoc,3, GL3.GL_FLOAT, false, stride, cOff);
+ gl.glBindBuffer(GL3.GL_ELEMENT_ARRAY_BUFFER, ibo);
+ gl.glDrawElements(GL3.GL_TRIANGLES, 3, GL3.GL_UNSIGNED_SHORT, 0L);
+
+ gl.glDisableVertexAttribArray(posLoc);
+ gl.glDisableVertexAttribArray(colorLoc);
+ gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, 0);
+ gl.glBindBuffer(GL3.GL_ELEMENT_ARRAY_BUFFER, 0);
+ }
+
+ private void displayVBOVAO(final GL3 gl) {
+ try {
+ gl.glBindVertexArray(vao);
+ gl.glDrawElements(GL3.GL_TRIANGLES, 3, GL3.GL_UNSIGNED_SHORT, 0L);
+ gl.glBindVertexArray(0);
+ } catch (GLException ex) {
+ Logger.getLogger(TestBug692GL3VAONEWT.class.getName()).log(Level.SEVERE,null,ex);
+ }
+ }
+
+ @Override
+ public void display(GLAutoDrawable drawable) {
+ final GL3bc gl = drawable.getGL().getGL3bc();
+ float color = ((float) currentMode.ordinal() + 1) / (Mode.values().length + 2);
+ gl.glClearColor(color, color, color, 0);
+ gl.glClear(GL3.GL_COLOR_BUFFER_BIT | GL3.GL_DEPTH_BUFFER_BIT);
+ gl.glUseProgram(progID);
+ final Mode newMode;
+ {
+ currentModeIdx = ( currentModeIdx + 1 ) % allModes.length;
+ newMode = allModes[ currentModeIdx ];
+ }
+ if (newMode != currentMode) {
+ currentMode = newMode;
+ System.out.println("Display mode: " + currentMode);
+ }
+ currentMode.display(this, gl);
+ gl.glUseProgram(0);
+ }
+
+ @Override
+ public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {
+ }
+ }
+
+ private void testImpl(GLProfile profile, GL3VAODemo.Mode[] modes) throws InterruptedException {
+ final GLCapabilities capabilities = new GLCapabilities(profile);
+ final GLWindow glWindow = GLWindow.create(capabilities);
+ glWindow.setSize(512, 512);
+
+ Animator anim = new Animator(glWindow);
+
+ QuitAdapter quitAdapter = new QuitAdapter();
+ glWindow.addKeyListener(quitAdapter);
+ glWindow.addWindowListener(quitAdapter);
+
+ final GL3VAODemo vaoTest = new GL3VAODemo(modes);
+ glWindow.addGLEventListener(vaoTest);
+ glWindow.setVisible(true);
+ anim.start();
+
+ final long t0 = System.currentTimeMillis();
+ long t1 = t0;
+ while(!quitAdapter.shouldQuit() && t1-t0<duration) {
+ Thread.sleep(100);
+ t1 = System.currentTimeMillis();
+ }
+
+ anim.stop();
+ glWindow.destroy();
+ }
+
+ @Test
+ public void test01CPUSource() throws GLException, InterruptedException {
+ if( ! GLProfile.isAvailable(GLProfile.GL3bc) ) {
+ System.err.println("GL3bc n/a");
+ return;
+ }
+ GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.CPU_SRC };
+ testImpl(GLProfile.get(GLProfile.GL3bc), modes);
+ }
+
+ @Test
+ public void test02VBOOnly() throws GLException, InterruptedException {
+ if( ! GLProfile.isAvailable(GLProfile.GL3bc) ) {
+ System.err.println("GL3bc n/a");
+ return;
+ }
+ GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.VBO_ONLY };
+ testImpl(GLProfile.get(GLProfile.GL3bc), modes);
+ }
+
+ @Test
+ public void test03VBOVAO() throws GLException, InterruptedException {
+ if( ! GLProfile.isAvailable(GLProfile.GL3bc) ) {
+ System.err.println("GL3bc n/a");
+ return;
+ }
+ GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.VBO_VAO };
+ testImpl(GLProfile.get(GLProfile.GL3bc), modes);
+ }
+
+ @Test
+ public void test12CPUSourceAndVBOOnly() throws GLException, InterruptedException {
+ if( ! GLProfile.isAvailable(GLProfile.GL3bc) ) {
+ System.err.println("GL3bc n/a");
+ return;
+ }
+ GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.CPU_SRC, GL3VAODemo.Mode.VBO_ONLY };
+ testImpl(GLProfile.get(GLProfile.GL3bc), modes);
+ }
+
+ @Test
+ public void test13CPUSourceAndVBOVAO() throws GLException, InterruptedException {
+ if( ! GLProfile.isAvailable(GLProfile.GL3bc) ) {
+ System.err.println("GL3bc n/a");
+ return;
+ }
+ GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.CPU_SRC, GL3VAODemo.Mode.VBO_VAO };
+ testImpl(GLProfile.get(GLProfile.GL3bc), modes);
+ }
+
+ @Test
+ public void test23VBOOnlyAndVBOVAO() throws GLException, InterruptedException {
+ if( ! GLProfile.isAvailable(GLProfile.GL3bc) ) {
+ System.err.println("GL3bc n/a");
+ return;
+ }
+ GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.VBO_ONLY, GL3VAODemo.Mode.VBO_VAO };
+ testImpl(GLProfile.get(GLProfile.GL3bc), modes);
+ }
+
+ @Test
+ public void test88AllModes() throws GLException, InterruptedException {
+ if( ! GLProfile.isAvailable(GLProfile.GL3bc) ) {
+ System.err.println("GL3bc n/a");
+ return;
+ }
+ GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.CPU_SRC, GL3VAODemo.Mode.VBO_ONLY, GL3VAODemo.Mode.VBO_VAO };
+ testImpl(GLProfile.get(GLProfile.GL3bc), modes);
+ }
+
+ public static void main(String args[]) throws IOException {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ duration = MiscUtils.atoi(args[++i], (int)duration);
+ }
+ }
+ String tstname = TestBug692GL3VAONEWT.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
+
+}
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
new file mode 100644
index 0000000..388c579
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestCPUSourcingAPINEWT.java
@@ -0,0 +1,225 @@
+/**
+ * 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.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.acore;
+
+import java.nio.FloatBuffer;
+import java.nio.ShortBuffer;
+
+import com.jogamp.common.nio.Buffers;
+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.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 org.junit.Assert;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestCPUSourcingAPINEWT extends UITestCase {
+ static long duration = 500; // ms
+
+ static class Demo implements GLEventListener {
+ private final static float[] vertexColorData = new float[]{
+ 0.0f, 0.75f, 0.0f, 1,0,0,
+ -0.5f, -0.75f, 0.0f, 0,1,0,
+ 0.9f, -0.75f, 0.0f, 0,0,1
+ };
+ private final FloatBuffer vertexColorDataBuffer = GLBuffers.newDirectFloatBuffer(vertexColorData);
+
+ private final short[] indices = new short[]{0, 1, 2};
+ private final ShortBuffer indicesBuffer = GLBuffers.newDirectShortBuffer(indices);
+
+
+ private int vertID = -1;
+ private int fragID = -1;
+ private int progID = -1;
+
+ private static int createShader(final GL2ES2 gl, int type,
+ final String[] srcLines){
+ int shaderID = gl.glCreateShader(type);
+ assert shaderID > 0;
+ int[] lengths = new int[srcLines.length];
+ for (int i = 0; i < srcLines.length; i++) {
+ lengths[i] = srcLines[i].length();
+ }
+ gl.glShaderSource(shaderID, srcLines.length, srcLines, lengths, 0);
+ gl.glCompileShader(shaderID);
+ return shaderID;
+ }
+
+ private void initShaders(GL2ES2 gl) {
+ final String[] vertSrc = new String[]{
+ "#version 150\n",
+ "in vec4 vPosition;\n",
+ "in vec4 vColor;\n",
+ "out vec4 pColor;\n",
+ "void main() {\n",
+ " pColor = vColor;\n",
+ " gl_Position = vPosition;\n",
+ "}\n"
+ };
+ vertID = createShader(gl, GL2ES2.GL_VERTEX_SHADER, vertSrc);
+
+ final String[] fragSrc = new String[]{
+ "#version 150\n",
+ "in vec4 pColor;\n",
+ "void main() {\n",
+ " gl_FragColor = pColor;\n",
+ "}\n"
+ };
+ fragID = createShader(gl, GL2ES2.GL_FRAGMENT_SHADER, fragSrc);
+
+ // We're done with the compiler
+ gl.glReleaseShaderCompiler();
+
+ progID = gl.glCreateProgram();
+ assert progID > 0;
+ gl.glAttachShader(progID, vertID);
+ gl.glAttachShader(progID, fragID);
+ gl.glLinkProgram(progID);
+ gl.glValidateProgram(progID);
+ }
+
+ @Override
+ public void init(GLAutoDrawable drawable) {
+ final GL2ES2 gl = drawable.getGL().getGL2ES2();
+ gl.glEnable(GL2ES2.GL_DEPTH_TEST);
+ gl.glDisable(GL2ES2.GL_CULL_FACE);
+ initShaders(gl);
+
+ gl.setSwapInterval(1);
+ }
+
+ @Override
+ public void dispose(GLAutoDrawable drawable) {
+ final GL2ES2 gl = drawable.getGL().getGL2ES2();
+ gl.glDetachShader(progID, fragID);
+ gl.glDetachShader(progID, vertID);
+ gl.glDeleteProgram(progID);
+ gl.glDeleteShader(fragID);
+ gl.glDeleteShader(vertID);
+ }
+
+ private void displayCPUSourcing(final GL2 gl) {
+ final int posLoc = gl.glGetAttribLocation(progID, "vPosition");
+ final int colorLoc = gl.glGetAttribLocation(progID, "vColor");
+ gl.glEnableVertexAttribArray(posLoc);
+ gl.glEnableVertexAttribArray(colorLoc);
+
+ final int stride = 6 * Buffers.SIZEOF_FLOAT;
+ // final int cOff = 3 * Buffers.SIZEOF_FLOAT;
+ gl.glVertexAttribPointer(posLoc, 3, GL2ES2.GL_FLOAT, false, stride, vertexColorDataBuffer);
+ vertexColorDataBuffer.position(3); // move to cOff
+ gl.glVertexAttribPointer(colorLoc,3, GL2ES2.GL_FLOAT, false, stride, vertexColorDataBuffer);
+ vertexColorDataBuffer.position(0); // rewind cOff
+
+ gl.glDrawElements(GL2ES2.GL_TRIANGLES, 3, GL2ES2.GL_UNSIGNED_SHORT, indicesBuffer);
+
+ gl.glDisableVertexAttribArray(posLoc);
+ gl.glDisableVertexAttribArray(colorLoc);
+ }
+
+ @Override
+ public void display(GLAutoDrawable drawable) {
+ final GL2ES2 gl = drawable.getGL().getGL2ES2();
+ gl.glClearColor(0x44, 0x44, 0x44, 0);
+ gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT);
+ gl.glUseProgram(progID);
+
+ // Hard casting is of course invalid!
+ // But we need to 'fake' compatibility mode to trigger CPU-sourcing w/ GL3 core
+ displayCPUSourcing((GL2) gl);
+
+ gl.glUseProgram(0);
+ }
+
+ @Override
+ public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {
+ }
+ }
+
+ private void testImpl(GLProfile profile) throws InterruptedException {
+ final GLCapabilities capabilities = new GLCapabilities(profile);
+ GLDrawableFactory factory = GLDrawableFactory.getFactory(profile);
+ GLOffscreenAutoDrawable glad = factory.createOffscreenAutoDrawable(null, capabilities, null, 512, 512);
+
+ final Demo vaoTest = new Demo();
+ glad.addGLEventListener(vaoTest);
+ glad.display();
+
+ glad.destroy();
+ }
+
+ @Test
+ public void test01GL2CPUSource() throws GLException, InterruptedException {
+ if( ! GLProfile.isAvailable(GLProfile.GL2) ) {
+ System.err.println("GL2 n/a");
+ return;
+ }
+ testImpl(GLProfile.get(GLProfile.GL2));
+ }
+
+ @Test
+ public void test02GL3CPUSource() throws GLException, InterruptedException {
+ final GLProfile glp = GLProfile.getMaxProgrammableCore(true);
+ if( !glp.isGL3ES3() && !glp.isGL2ES2() ) {
+ System.err.println("No GL core profile available, got "+glp);
+ return;
+ }
+ GLException exp = null;
+ try {
+ testImpl(glp);
+ } catch(GLException gle) {
+ exp = gle;
+ System.err.println("Expected Exception: "+exp.getMessage());
+ }
+ Assert.assertNotNull("Excpected GLException missing due to CPU Sourcing w/ GL3 core context", exp);
+ }
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ duration = MiscUtils.atol(args[i], duration);
+ }
+ }
+ org.junit.runner.JUnitCore.main(TestCPUSourcingAPINEWT.class.getName());
+ }
+}
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 4341513..1548c08 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -41,10 +41,13 @@ import jogamp.nativewindow.jawt.JAWTUtil;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.util.RunnableTask;
import com.jogamp.opengl.test.junit.util.UITestCase;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestFBOAutoDrawableDeadlockAWT extends UITestCase {
static GLProfile glp;
static int width, height;
@@ -58,12 +61,8 @@ public class TestFBOAutoDrawableDeadlockAWT extends UITestCase {
}
protected void runTestGL( GLCapabilities caps ) throws InterruptedException, InvocationTargetException {
- final GLOffscreenAutoDrawable fbod = GLDrawableFactory.getFactory(caps.getGLProfile()).createOffscreenAutoDrawable(
- null,
- caps, new DefaultGLCapabilitiesChooser(),
- 512, 512,
- null
- );
+ final GLOffscreenAutoDrawable fbod = GLDrawableFactory.getFactory(caps.getGLProfile()).createOffscreenAutoDrawable(
+ null, caps, new DefaultGLCapabilitiesChooser(), 512, 512);
final boolean[] done = {false};
final Runnable pbufferCreationAction = new Runnable() {
@@ -74,30 +73,30 @@ public class TestFBOAutoDrawableDeadlockAWT extends UITestCase {
System.err.println("AA.X");
}
};
-
+
EventQueue.invokeAndWait(new Runnable() {
public void run() {
Assert.assertTrue(EventQueue.isDispatchThread());
JAWTUtil.lockToolkit();
try {
- final RunnableTask rTask = new RunnableTask(pbufferCreationAction, new Object(), false, null);
+ final RunnableTask rTask = new RunnableTask(pbufferCreationAction, new Object(), false, null);
System.err.println("BB.0: "+rTask.getSyncObject());
synchronized (rTask.getSyncObject()) {
System.err.println("BB.1: "+rTask.getSyncObject());
- new Thread(rTask, Thread.currentThread().getName()+"-Pbuffer_Creation").start();
+ new Thread(rTask, Thread.currentThread().getName()+"-Pbuffer_Creation").start();
try {
System.err.println("BB.2");
rTask.getSyncObject().wait();
System.err.println("BB.3");
} catch (InterruptedException e) {
throw new RuntimeException(e);
- }
+ }
System.err.println("BB.X");
}
} finally {
JAWTUtil.unlockToolkit();
}
- }
+ }
});
Assert.assertTrue(done[0]);
fbod.destroy();
@@ -125,4 +124,4 @@ public class TestFBOAutoDrawableDeadlockAWT extends UITestCase {
}
org.junit.runner.JUnitCore.main( TestFBOAutoDrawableDeadlockAWT.class.getName() );
}
-}
+}
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 2dc547f..cc06136 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.acore;
import java.io.IOException;
@@ -41,6 +41,8 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.opengl.FBObject;
import com.jogamp.opengl.test.junit.jogl.demos.es2.FBOMix2DemosES2;
@@ -50,52 +52,53 @@ import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
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}.
+ * 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}.
* <p>
- * The created {@link GLOffscreenAutoDrawable.FBO} is being used to run the {@link GLEventListener}.
+ * The created {@link GLOffscreenAutoDrawable.FBO} is being used to run the {@link GLEventListener}.
* </p>
* <p>
* Extensive FBO reconfiguration (size and sample buffer count) and validation are performed.
- * </p>
+ * </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestFBOAutoDrawableFactoryNEWT extends UITestCase {
-
+
static final int widthStep = 800/4;
static final int heightStep = 600/4;
volatile int szStep = 2;
-
+
interface MyGLEventListener extends GLEventListener {
void setMakeSnapshot();
}
-
+
@Test
- public void testGL2ES2_Demo1_SingleBuffer_Normal() throws InterruptedException {
+ public void testGL2ES2_Demo1_SingleBuffer_Normal() throws InterruptedException {
final GLProfile glp = GLProfile.getGL2ES2();
final GLCapabilities caps = new GLCapabilities(glp);
caps.setDoubleBuffered(false);
testGLFBODrawableImpl(caps, new GearsES2(0));
}
-
+
@Test
- public void testGL2ES2_Demo1_DoubleBuffer_Normal() throws InterruptedException {
+ public void testGL2ES2_Demo1_DoubleBuffer_Normal() throws InterruptedException {
final GLProfile glp = GLProfile.getGL2ES2();
final GLCapabilities caps = new GLCapabilities(glp);
caps.setDoubleBuffered(true); // default
testGLFBODrawableImpl(caps, new GearsES2(0));
}
-
+
@Test
- public void testGL2ES2_Demo2MSAA4() throws InterruptedException {
+ public void testGL2ES2_Demo2MSAA4() throws InterruptedException {
final GLProfile glp = GLProfile.getGL2ES2();
final GLCapabilities caps = new GLCapabilities(glp);
caps.setSampleBuffers(true);
caps.setNumSamples(4);
testGLFBODrawableImpl(caps, new MultisampleDemoES2(true));
}
-
+
@Test
- public void testGL2ES2_FBODemoMSAA4() throws InterruptedException {
+ public void testGL2ES2_FBODemoMSAA4() throws InterruptedException {
final GLProfile glp = GLProfile.getGL2ES2();
final FBOMix2DemosES2 demo = new FBOMix2DemosES2(0);
demo.setDoRotation(false);
@@ -104,9 +107,9 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase {
caps.setNumSamples(4);
testGLFBODrawableImpl(caps, demo);
}
-
+
@Test
- public void testEGLES2_Demo0Normal() throws InterruptedException {
+ public void testEGLES2_Demo0Normal() throws InterruptedException {
if( GLProfile.isAvailable(GLProfile.GLES2) ) {
final GLProfile glp = GLProfile.get(GLProfile.GLES2);
final GLCapabilities caps = new GLCapabilities(glp);
@@ -115,9 +118,9 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase {
System.err.println("EGL ES2 n/a");
}
}
-
+
@Test
- public void testEGLES2_Demo0MSAA4() throws InterruptedException {
+ public void testEGLES2_Demo0MSAA4() throws InterruptedException {
if( GLProfile.isAvailable(GLProfile.GLES2) ) {
final GLProfile glp = GLProfile.get(GLProfile.GLES2);
final GLCapabilities caps = new GLCapabilities(glp);
@@ -133,71 +136,71 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase {
caps.setFBO(true);
final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
final GLOffscreenAutoDrawable.FBO glad = (GLOffscreenAutoDrawable.FBO)
- factory.createOffscreenAutoDrawable(null, caps, null, widthStep*szStep, heightStep*szStep, null);
+ factory.createOffscreenAutoDrawable(null, caps, null, widthStep*szStep, heightStep*szStep);
Assert.assertNotNull(glad);
-
+
System.out.println("Realized GLAD: "+glad);
System.out.println("Realized GLAD: "+glad.getChosenGLCapabilities());
Assert.assertTrue("FBO drawable is initialized before ctx creation", !glad.isInitialized());
-
+
glad.display(); // initial display incl. init!
{
final GLContext context = glad.getContext();
Assert.assertNotNull(context);
Assert.assertTrue(context.isCreated());
}
- Assert.assertTrue("FBO drawable is not initialized after ctx creation", glad.isInitialized());
-
+ Assert.assertTrue("FBO drawable is not initialized after ctx creation", glad.isInitialized());
+
//
// FBO incl. MSAA is fully initialized now
//
-
+
final GLCapabilitiesImmutable chosenCaps = glad.getChosenGLCapabilities();
System.out.println("Init GLAD: "+glad);
System.out.println("Init GLAD: "+chosenCaps);
-
+
final FBObject fboFront = glad.getFBObject(GL.GL_FRONT);
final FBObject fboBack = glad.getFBObject(GL.GL_BACK);
-
+
System.out.println("Init front FBO: "+fboFront);
System.out.println("Init back FBO: "+fboBack);
-
+
Assert.assertTrue("FBO drawable is not initialized before ctx creation", glad.isInitialized());
Assert.assertTrue("FBO Front is not initialized before ctx creation", fboFront.isInitialized());
Assert.assertTrue("FBO Back is not initialized before ctx creation", fboBack.isInitialized());
-
+
if( chosenCaps.getDoubleBuffered() ) {
Assert.assertTrue("FBO are equal: "+fboFront+" == "+fboBack, !fboFront.equals(fboBack));
Assert.assertNotSame(fboFront, fboBack);
} else {
Assert.assertTrue("FBO are not equal: "+fboFront+" != "+fboBack, fboFront.equals(fboBack));
- Assert.assertSame(fboFront, fboBack);
+ Assert.assertSame(fboFront, fboBack);
}
-
+
final FBObject.TextureAttachment texAttachA, texAttachB;
-
+
texAttachA = glad.getTextureBuffer(GL.GL_FRONT);
if(0==glad.getNumSamples()) {
texAttachB = glad.getTextureBuffer(GL.GL_BACK);
} else {
texAttachB = null;
}
-
+
final FBObject.Colorbuffer colorA, colorB;
final FBObject.RenderAttachment depthA, depthB;
-
+
colorA = fboFront.getColorbuffer(0);
Assert.assertNotNull(colorA);
colorB = fboBack.getColorbuffer(0);
Assert.assertNotNull(colorB);
-
+
depthA = fboFront.getDepthAttachment();
Assert.assertNotNull(depthA);
depthB = fboBack.getDepthAttachment();
Assert.assertNotNull(depthB);
glad.display(); // SWAP_ODD
-
+
if( chosenCaps.getDoubleBuffered() ) {
// double buffer or MSAA
Assert.assertTrue("Color attachments are equal: "+colorB+" == "+colorA, !colorB.equals(colorA));
@@ -211,16 +214,16 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase {
Assert.assertEquals(depthA, depthB);
Assert.assertSame(depthA, depthB);
}
-
+
Assert.assertEquals(texAttachA, colorA);
Assert.assertSame(texAttachA, colorA);
if(0==glad.getNumSamples()) {
Assert.assertEquals(texAttachB, colorB);
- Assert.assertSame(texAttachB, colorB);
+ Assert.assertSame(texAttachB, colorB);
}
if( chosenCaps.getNumSamples() > 0 ) {
- // MSAA
+ // MSAA
FBObject _fboFront = glad.getFBObject(GL.GL_FRONT);
FBObject _fboBack = glad.getFBObject(GL.GL_BACK);
Assert.assertTrue("FBO are not equal: "+fboFront+" != "+_fboFront, fboFront.equals(_fboFront));
@@ -248,22 +251,22 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase {
Assert.assertTrue("FBO are not equal: "+fboFront+" != "+_fboBack, fboFront.equals(_fboBack));
Assert.assertSame(fboFront, _fboBack);
}
-
+
glad.addGLEventListener(demo);
-
+
final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener();
glad.addGLEventListener(snapshotGLEventListener);
-
+
glad.display(); // - SWAP_EVEN
// 1 - szStep = 2
snapshotGLEventListener.setMakeSnapshot();
glad.display(); // - SWAP_ODD
-
+
// 2, 3 (resize + display)
szStep = 1;
glad.setSize(widthStep*szStep, heightStep*szStep); // SWAP_EVEN
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display(); // - SWAP_ODD
@@ -280,34 +283,34 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase {
Assert.assertSame(fboFront, _fboFront);
Assert.assertEquals(fboBack, _fboBack);
Assert.assertSame(fboBack, _fboBack);
-
+
FBObject.Colorbuffer _color = _fboFront.getColorbuffer(0);
Assert.assertNotNull(_color);
Assert.assertEquals(colorA, _color);
Assert.assertSame(colorA, _color);
-
+
FBObject.RenderAttachment _depth = _fboFront.getDepthAttachment();
System.err.println("Resize1.oldDepth "+depthA);
System.err.println("Resize1.newDepth "+_depth);
Assert.assertNotNull(_depth);
-
+
Assert.assertEquals(depthA, _depth);
Assert.assertSame(depthA, _depth);
_depth = _fboBack.getDepthAttachment();
Assert.assertNotNull(_depth);
Assert.assertEquals(depthB, _depth);
Assert.assertSame(depthB, _depth);
-
+
_color = _fboFront.getColorbuffer(colorA);
Assert.assertNotNull(_color);
Assert.assertEquals(colorA, _color);
Assert.assertSame(colorA, _color);
}
-
+
// 4, 5 (resize + display)
szStep = 4;
glad.setSize(widthStep*szStep, heightStep*szStep); // SWAP_ODD
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display(); // - SWAP_EVEN
@@ -327,47 +330,47 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase {
} else {
// single or MSAA
Assert.assertEquals(fboFront, _fboFront);
- Assert.assertEquals(fboBack, _fboBack);
+ Assert.assertEquals(fboBack, _fboBack);
}
-
+
FBObject.Colorbuffer _color = fboBack.getColorbuffer(0);
Assert.assertNotNull(_color);
Assert.assertEquals(colorB, _color);
Assert.assertSame(colorB, _color);
-
+
FBObject.RenderAttachment _depth = fboBack.getDepthAttachment();
- Assert.assertNotNull(_depth); // MSAA back w/ depth
+ Assert.assertNotNull(_depth); // MSAA back w/ depth
Assert.assertEquals(depthB, _depth);
Assert.assertSame(depthB, _depth);
-
+
_depth = fboFront.getDepthAttachment();
Assert.assertNotNull(_depth);
Assert.assertEquals(depthA, _depth);
Assert.assertSame(depthA, _depth);
-
+
_color = fboBack.getColorbuffer(colorB);
Assert.assertNotNull(_color);
Assert.assertEquals(colorB, _color);
Assert.assertSame(colorB, _color);
}
-
+
// 6 + 7 (samples + display)
glad.setNumSamples(glad.getGL(), chosenCaps.getNumSamples() > 0 ? 0 : 4); // triggers repaint
snapshotGLEventListener.setMakeSnapshot();
glad.display(); // actual screenshot
-
+
// 8, 9 (resize + samples + display)
szStep = 3;
glad.setSize(widthStep*szStep, heightStep*szStep);
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
-
+
glad.destroy();
System.out.println("Fin: "+glad);
}
-
+
public static void main(String args[]) throws IOException {
org.junit.runner.JUnitCore.main(TestFBOAutoDrawableFactoryNEWT.class.getName());
}
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 387e152..7ec8715 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
@@ -55,7 +55,10 @@ import javax.media.opengl.GLUniformData;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestFBOMRTNEWT01 extends UITestCase {
static long durationPerTest = 10*40*2; // ms
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 87d4df3..42f7ba6 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
@@ -57,7 +57,10 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestFBOMix2DemosES2NEWT extends UITestCase {
static long duration = 500; // ms
static int swapInterval = 1;
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 19e57c9..51dd9df 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.acore;
import java.io.BufferedReader;
@@ -64,12 +64,14 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+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}.
+ * 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}.
* <p>
- * The created {@link GLOffscreenAutoDrawable.FBO} is being used to run the {@link GLEventListener}.
+ * The created {@link GLOffscreenAutoDrawable.FBO} is being used to run the {@link GLEventListener}.
* </p>
* <p>
* This test simulates shared off-thread GL context / texture usage,
@@ -79,7 +81,7 @@ import org.junit.Test;
* <ul>
* <li>2 {@link GLOffscreenAutoDrawable.FBO} double buffered
* <ul>
- * <li>each with their own {@link GLContext}, which is shares the {@link GLWindow} one (see below)</li>
+ * <li>each with their own {@link GLContext}, which is shares the {@link GLWindow} one (see below)</li>
* <li>both run within one {@link FPSAnimator} @ 30fps</li>
* <li>produce a texture</li>
* <li>notify the onscreen renderer about new textureID (swapping double buffer)</li>
@@ -89,17 +91,18 @@ import org.junit.Test;
* <li>shares it's {@link GLContext} w/ above FBOs</li>
* <li>running within one {@link Animator} at v-sync</li>
* <li>uses the shared FBO textures and blends them onscreen</li>
- * </ul></li>
- * </ul>
- * </p>
+ * </ul></li>
+ * </ul>
+ * </p>
*/
-public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase {
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase {
static long duration = 500; // ms
static int swapInterval = 1;
static boolean showFPS = false;
static boolean forceES2 = false;
static boolean mainRun = false;
-
+
@AfterClass
public static void releaseClass() {
}
@@ -107,37 +110,38 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase {
protected void runTestGL(GLCapabilitiesImmutable caps) throws InterruptedException {
final GLReadBufferUtil screenshot = new GLReadBufferUtil(false, false);
System.err.println("requested: vsync "+swapInterval+", "+caps);
-
+
final GLWindow glWindow = GLWindow.create(caps);
Assert.assertNotNull(glWindow);
glWindow.setTitle("Gears NEWT Test (translucent "+!caps.isBackgroundOpaque()+"), swapInterval "+swapInterval);
if(mainRun) {
- glWindow.setSize(512, 512);
+ glWindow.setSize(512, 512);
} else {
glWindow.setSize(256, 256);
}
// eager initialization of context
glWindow.setVisible(true);
- glWindow.display();
+ glWindow.display();
final int fbod1_texUnit = 0;
final int fbod2_texUnit = 1;
-
+
final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
GLCapabilities fbodCaps = (GLCapabilities) caps.cloneMutable();
// fbodCaps.setDoubleBuffered(false);
-
+
final Mix2TexturesES2 mixerDemo = new Mix2TexturesES2(1, fbod1_texUnit, fbod2_texUnit);
- // FBOD1
+ // FBOD1
final GLOffscreenAutoDrawable.FBO fbod1 = (GLOffscreenAutoDrawable.FBO)
- factory.createOffscreenAutoDrawable(null, fbodCaps, null, glWindow.getWidth(), glWindow.getHeight(), glWindow.getContext());
+ factory.createOffscreenAutoDrawable(null, fbodCaps, null, glWindow.getWidth(), glWindow.getHeight());
+ fbod1.setSharedAutoDrawable(glWindow);
fbod1.setUpstreamWidget(glWindow); // connect the real GLWindow (mouse/key) to offscreen!
fbod1.setTextureUnit(fbod1_texUnit);
{
GearsES2 demo0 = new GearsES2(-1);
fbod1.addGLEventListener(demo0);
- fbod1.addGLEventListener(new GLFinishOnDisplay());
+ fbod1.addGLEventListener(new GLFinishOnDisplay());
demo0.setIgnoreFocus(true);
}
fbod1.getNativeSurface().addSurfaceUpdatedListener(new SurfaceUpdatedListener() {
@@ -148,13 +152,14 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase {
fbod1.display(); // init
System.err.println("FBOD1 "+fbod1);
Assert.assertTrue(fbod1.isInitialized());
-
+
// FBOD2
final GLOffscreenAutoDrawable.FBO fbod2 = (GLOffscreenAutoDrawable.FBO)
- factory.createOffscreenAutoDrawable(null, fbodCaps, null, glWindow.getWidth(), glWindow.getHeight(), glWindow.getContext());
+ factory.createOffscreenAutoDrawable(null, fbodCaps, null, glWindow.getWidth(), glWindow.getHeight());
+ fbod2.setSharedAutoDrawable(glWindow);
fbod2.setTextureUnit(fbod2_texUnit);
fbod2.addGLEventListener(new RedSquareES2(-1));
- fbod2.addGLEventListener(new GLFinishOnDisplay());
+ fbod2.addGLEventListener(new GLFinishOnDisplay());
fbod2.getNativeSurface().addSurfaceUpdatedListener(new SurfaceUpdatedListener() {
@Override
public void surfaceUpdated(Object updater, NativeSurface ns, long when) {
@@ -167,7 +172,7 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase {
// preinit texIDs
mixerDemo.setTexID0(fbod1.getTextureBuffer(GL.GL_FRONT).getName());
mixerDemo.setTexID1(fbod2.getTextureBuffer(GL.GL_FRONT).getName());
-
+
glWindow.addGLEventListener(mixerDemo);
glWindow.addGLEventListener(new GLEventListener() {
int i=0, c=0;
@@ -175,39 +180,39 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase {
public void dispose(GLAutoDrawable drawable) {}
public void display(GLAutoDrawable drawable) {
if(mainRun) return;
-
+
final int dw = drawable.getWidth();
final int dh = drawable.getHeight();
c++;
-
+
if(dw<800) {
System.err.println("XXX: "+dw+"x"+dh+", c "+c);
if(8 == c) {
- snapshot(i++, "msaa"+fbod1.getNumSamples(), drawable.getGL(), screenshot, TextureIO.PNG, null);
+ snapshot(i++, "msaa"+fbod1.getNumSamples(), drawable.getGL(), screenshot, TextureIO.PNG, null);
}
if(9 == c) {
c=0;
- new Thread() {
+ new Thread() {
@Override
public void run() {
glWindow.setSize(dw+256, dh+256);
- } }.start();
+ } }.start();
}
}
}
- public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
fbod1.setSize(width, height);
fbod2.setSize(width, height);
}
});
-
+
final FPSAnimator animator0 = new FPSAnimator(30);
animator0.add(fbod1);
animator0.add(fbod2);
-
+
final Animator animator1 = new Animator();
animator1.add(glWindow);
-
+
QuitAdapter quitAdapter = new QuitAdapter();
//glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
@@ -221,22 +226,22 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase {
}
public void windowMoved(WindowEvent e) {
System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight());
- }
+ }
});
-
+
animator0.start();
animator1.start();
// glWindow.setSkipContextReleaseThread(animator.getThread());
glWindow.setVisible(true);
-
+
System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities());
System.err.println("GL chosen: "+glWindow.getChosenCapabilities());
System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets());
-
+
animator0.setUpdateFPSFrames(30, showFPS ? System.err : null);
animator1.setUpdateFPSFrames(60, showFPS ? System.err : null);
-
+
while(!quitAdapter.shouldQuit() && animator1.isAnimating() && animator1.getTotalFPSDuration()<duration) {
Thread.sleep(100);
}
@@ -244,14 +249,14 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase {
animator0.stop();
Assert.assertFalse(animator0.isAnimating());
Assert.assertFalse(animator0.isStarted());
-
+
animator1.stop();
Assert.assertFalse(animator1.isAnimating());
Assert.assertFalse(animator1.isStarted());
-
+
fbod1.destroy();
fbod2.destroy();
-
+
glWindow.destroy();
Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
}
@@ -260,14 +265,14 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase {
public void test01() throws InterruptedException {
GLCapabilities caps = new GLCapabilities(forceES2 ? GLProfile.get(GLProfile.GLES2) : GLProfile.getGL2ES2());
caps.setAlphaBits(1);
- runTestGL(caps);
+ runTestGL(caps);
}
-
- public static void main(String args[]) throws IOException {
+
+ public static void main(String args[]) throws IOException {
boolean waitForKey = false;
-
+
mainRun = true;
-
+
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
i++;
@@ -285,7 +290,7 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase {
mainRun = false;
}
}
-
+
System.err.println("swapInterval "+swapInterval);
System.err.println("forceES2 "+forceES2);
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 acd46f5..3c6c61f 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.acore;
import java.io.BufferedReader;
@@ -62,12 +62,14 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+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}.
+ * 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}.
* <p>
- * The created {@link GLOffscreenAutoDrawable.FBO} is being used to run the {@link GLEventListener}.
+ * The created {@link GLOffscreenAutoDrawable.FBO} is being used to run the {@link GLEventListener}.
* </p>
* <p>
* This test simulates shared on-thread GL context / texture usage,
@@ -77,7 +79,7 @@ import org.junit.Test;
* <ul>
* <li>1 {@link GLOffscreenAutoDrawable.FBO} double buffered
* <ul>
- * <liwith its own {@link GLContext}, which is shares the {@link GLWindow} one (see below)</li>
+ * <liwith its own {@link GLContext}, which is shares the {@link GLWindow} one (see below)</li>
* <li>running within common {@link Animator} @ 60fps</li>
* <li>produce a texture</li>
* <li>notify the onscreen renderer about new textureID (swapping double buffer)</li>
@@ -87,17 +89,18 @@ import org.junit.Test;
* <li>shares it's {@link GLContext} w/ above FBO</li>
* <li>running within common {@link Animator} @ 60fps</li>
* <li>uses the shared FBO texture and draws it onscreen</li>
- * </ul></li>
- * </ul>
- * </p>
+ * </ul></li>
+ * </ul>
+ * </p>
*/
-public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase {
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase {
static long duration = 500; // ms
static int swapInterval = 1;
static boolean showFPS = false;
static boolean forceES2 = false;
static boolean mainRun = false;
-
+
@AfterClass
public static void releaseClass() {
}
@@ -105,30 +108,31 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase {
protected void runTestGL(GLCapabilitiesImmutable caps) throws InterruptedException {
final GLReadBufferUtil screenshot = new GLReadBufferUtil(false, false);
System.err.println("requested: vsync "+swapInterval+", "+caps);
-
+
final GLWindow glWindow = GLWindow.create(caps);
Assert.assertNotNull(glWindow);
glWindow.setTitle("Gears NEWT Test (translucent "+!caps.isBackgroundOpaque()+"), swapInterval "+swapInterval);
if(mainRun) {
- glWindow.setSize(512, 512);
+ glWindow.setSize(512, 512);
} else {
glWindow.setSize(256, 256);
}
// eager initialization of context
glWindow.setVisible(true);
- glWindow.display();
+ glWindow.display();
final int fbod1_texUnit = 0;
-
+
final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
GLCapabilities fbodCaps = (GLCapabilities) caps.cloneMutable();
// fbodCaps.setDoubleBuffered(false);
-
+
final Mix2TexturesES2 mixerDemo = new Mix2TexturesES2(1, fbod1_texUnit, 0);
- // FBOD1
+ // FBOD1
final GLOffscreenAutoDrawable.FBO fbod1 = (GLOffscreenAutoDrawable.FBO)
- factory.createOffscreenAutoDrawable(null, fbodCaps, null, glWindow.getWidth(), glWindow.getHeight(), glWindow.getContext());
+ factory.createOffscreenAutoDrawable(null, fbodCaps, null, glWindow.getWidth(), glWindow.getHeight());
+ fbod1.setSharedAutoDrawable(glWindow);
fbod1.setUpstreamWidget(glWindow); // connect the real GLWindow (mouse/key) to offscreen!
fbod1.setTextureUnit(fbod1_texUnit);
{
@@ -145,10 +149,10 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase {
fbod1.display(); // init
System.err.println("FBOD1 "+fbod1);
Assert.assertTrue(fbod1.isInitialized());
-
+
// preinit texIDs
mixerDemo.setTexID0(fbod1.getTextureBuffer(GL.GL_FRONT).getName());
-
+
glWindow.addWindowListener(new WindowAdapter() {
@Override
public void windowResized(WindowEvent e) {
@@ -162,33 +166,33 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase {
public void dispose(GLAutoDrawable drawable) {}
public void display(GLAutoDrawable drawable) {
if(mainRun) return;
-
+
final int dw = drawable.getWidth();
final int dh = drawable.getHeight();
c++;
-
+
if(dw<800) {
System.err.println("XXX: "+dw+"x"+dh+", c "+c);
if(8 == c) {
- snapshot(i++, "msaa"+fbod1.getNumSamples(), drawable.getGL(), screenshot, TextureIO.PNG, null);
+ snapshot(i++, "msaa"+fbod1.getNumSamples(), drawable.getGL(), screenshot, TextureIO.PNG, null);
}
if(9 == c) {
c=0;
- new Thread() {
+ new Thread() {
@Override
public void run() {
glWindow.setSize(dw+256, dh+256);
- } }.start();
+ } }.start();
}
}
}
- public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { }
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { }
});
-
+
final Animator animator1 = new Animator();
animator1.add(fbod1);
animator1.add(glWindow);
-
+
QuitAdapter quitAdapter = new QuitAdapter();
//glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
@@ -202,20 +206,20 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase {
}
public void windowMoved(WindowEvent e) {
System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight());
- }
+ }
});
-
+
animator1.start();
// glWindow.setSkipContextReleaseThread(animator.getThread());
glWindow.setVisible(true);
-
+
System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities());
System.err.println("GL chosen: "+glWindow.getChosenCapabilities());
System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets());
-
+
animator1.setUpdateFPSFrames(60, showFPS ? System.err : null);
-
+
while(!quitAdapter.shouldQuit() && animator1.isAnimating() && animator1.getTotalFPSDuration()<duration) {
Thread.sleep(100);
}
@@ -223,9 +227,9 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase {
animator1.stop();
Assert.assertFalse(animator1.isAnimating());
Assert.assertFalse(animator1.isStarted());
-
+
fbod1.destroy();
-
+
glWindow.destroy();
Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
}
@@ -234,14 +238,14 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase {
public void test01() throws InterruptedException {
GLCapabilities caps = new GLCapabilities(forceES2 ? GLProfile.get(GLProfile.GLES2) : GLProfile.getGL2ES2());
caps.setAlphaBits(1);
- runTestGL(caps);
+ runTestGL(caps);
}
-
- public static void main(String args[]) throws IOException {
+
+ public static void main(String args[]) throws IOException {
boolean waitForKey = false;
-
+
mainRun = true;
-
+
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
i++;
@@ -259,7 +263,7 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase {
mainRun = false;
}
}
-
+
System.err.println("swapInterval "+swapInterval);
System.err.println("forceES2 "+forceES2);
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 2729d6a..91bae16 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.acore;
import java.io.IOException;
@@ -40,6 +40,8 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.NewtFactory;
import com.jogamp.newt.Window;
@@ -57,24 +59,25 @@ import com.jogamp.opengl.util.Animator;
/**
* Test using a NEWT {@link Window} for onscreen case.
* <p>
- * Creates a {@link GLDrawable} using the
+ * Creates a {@link GLDrawable} using the
* {@link GLDrawableFactory#createGLDrawable(javax.media.nativewindow.NativeSurface) factory model}.
* The {@link GLContext} is derived {@link GLDrawable#createContext(GLContext) from the drawable}.
* </p>
* <p>
* Finally a {@link GLAutoDrawableDelegate} is created with the just created {@link GLDrawable} and {@link GLContext}.
- * It is being used to run the {@link GLEventListener}.
- * </p>
+ * It is being used to run the {@link GLEventListener}.
+ * </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLAutoDrawableDelegateNEWT extends UITestCase {
static long duration = 500; // ms
-
+
void doTest(GLCapabilitiesImmutable reqGLCaps, GLEventListener demo) throws InterruptedException {
final GLDrawableFactory factory = GLDrawableFactory.getFactory(reqGLCaps.getGLProfile());
-
+
//
// Create native windowing resources .. X11/Win/OSX
- //
+ //
final Window window = NewtFactory.createWindow(reqGLCaps);
Assert.assertNotNull(window);
window.setSize(640, 400);
@@ -82,24 +85,24 @@ public class TestGLAutoDrawableDelegateNEWT extends UITestCase {
Assert.assertTrue(AWTRobotUtil.waitForVisible(window, true));
Assert.assertTrue(AWTRobotUtil.waitForRealized(window, true));
System.out.println("Window: "+window.getClass().getName());
-
+
final GLDrawable drawable = factory.createGLDrawable(window);
Assert.assertNotNull(drawable);
drawable.setRealized(true);
-
- final GLAutoDrawableDelegate glad = new GLAutoDrawableDelegate(drawable, drawable.createContext(null), window, false, null) {
+
+ final GLAutoDrawableDelegate glad = new GLAutoDrawableDelegate(drawable, null, window, false, null) {
@Override
protected void destroyImplInLock() {
super.destroyImplInLock(); // destroys drawable/context
window.destroy(); // destroys the actual window, incl. the device
}
};
-
+
window.setWindowDestroyNotifyAction( new Runnable() {
public void run() {
glad.windowDestroyNotifyOp();
} } );
-
+
window.addWindowListener(new WindowAdapter() {
@Override
public void windowRepaint(WindowUpdateEvent e) {
@@ -113,13 +116,13 @@ public class TestGLAutoDrawableDelegateNEWT extends UITestCase {
});
glad.addGLEventListener(demo);
-
+
QuitAdapter quitAdapter = new QuitAdapter();
//glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
//glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter));
window.addKeyListener(quitAdapter);
window.addWindowListener(quitAdapter);
-
+
Animator animator = new Animator();
animator.setUpdateFPSFrames(60, System.err);
animator.setModeBits(false, Animator.MODE_EXPECT_AWT_RENDERING_THREAD);
@@ -127,17 +130,17 @@ public class TestGLAutoDrawableDelegateNEWT extends UITestCase {
animator.start();
Assert.assertTrue(animator.isStarted());
Assert.assertTrue(animator.isAnimating());
-
+
while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
Thread.sleep(100);
- }
+ }
System.out.println("Fin start ...");
-
+
animator.stop();
Assert.assertFalse(animator.isAnimating());
Assert.assertFalse(animator.isStarted());
glad.destroy();
- System.out.println("Fin Drawable: "+drawable);
+ System.out.println("Fin Drawable: "+drawable);
System.out.println("Fin Window: "+window);
}
@@ -146,7 +149,7 @@ public class TestGLAutoDrawableDelegateNEWT extends UITestCase {
final GLCapabilities reqGLCaps = new GLCapabilities( GLProfile.getGL2ES2() );
doTest(reqGLCaps, new GearsES2(1));
}
-
+
public static void main(String args[]) throws IOException {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
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 6fc4902..3d49a0d 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
@@ -43,6 +43,8 @@ import jogamp.opengl.GLGraphicsConfigurationUtil;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.NewtFactory;
import com.jogamp.newt.Window;
@@ -68,6 +70,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
* It is being used to run the {@link GLEventListener}.
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLAutoDrawableDelegateOnOffscrnCapsNEWT extends UITestCase {
static final int widthStep = 800/4;
static final int heightStep = 600/4;
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 adef9ed..a5799a6 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.acore;
import java.io.IOException;
@@ -43,6 +43,8 @@ import jogamp.opengl.GLGraphicsConfigurationUtil;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.opengl.JoglVersion;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
@@ -50,12 +52,13 @@ import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
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}.
+ * Toolkit agnostic {@link GLOffscreenAutoDrawable} tests using the
+ * {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}.
* <p>
- * The created {@link GLOffscreenAutoDrawable} is being used to run the {@link GLEventListener}.
- * </p>
+ * The created {@link GLOffscreenAutoDrawable} is being used to run the {@link GLEventListener}.
+ * </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
static final int widthStep = 800/4;
static final int heightStep = 600/4;
@@ -68,7 +71,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
}
return new GLCapabilities(GLProfile.get(profile));
}
-
+
void doTest(GLCapabilitiesImmutable reqGLCaps, GLEventListener demo) throws InterruptedException {
System.out.println("Requested GL Caps: "+reqGLCaps);
final GLDrawableFactory factory = GLDrawableFactory.getFactory(reqGLCaps.getGLProfile());
@@ -76,15 +79,15 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
System.out.println("Expected GL Caps: "+expGLCaps);
//
- // Create native OpenGL resources .. XGL/WGL/CGL ..
+ // Create native OpenGL resources .. XGL/WGL/CGL ..
// equivalent to GLAutoDrawable methods: setVisible(true)
//
- final GLOffscreenAutoDrawable glad = factory.createOffscreenAutoDrawable(null, reqGLCaps, null, widthStep*szStep, heightStep*szStep, null);
-
+ final GLOffscreenAutoDrawable glad = factory.createOffscreenAutoDrawable(null, reqGLCaps, null, widthStep*szStep, heightStep*szStep);
+
Assert.assertNotNull(glad);
- System.out.println("Drawable Pre-GL(0): "+glad.getClass().getName()+", "+glad.getNativeSurface().getClass().getName());
+ System.out.println("Drawable Pre-GL(0): "+glad.getClass().getName()+", "+glad.getNativeSurface().getClass().getName());
Assert.assertTrue(glad.isRealized());
-
+
// Check caps of NativeWindow config w/o GL
final CapabilitiesImmutable chosenCaps = glad.getChosenGLCapabilities();
System.out.println("Drawable Caps Pre_GL : "+chosenCaps);
@@ -92,7 +95,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
Assert.assertTrue(chosenCaps.getGreenBits()>4);
Assert.assertTrue(chosenCaps.getBlueBits()>4);
Assert.assertTrue(chosenCaps.getRedBits()>4);
-
+
glad.display(); // force native context creation
// Check caps of GLDrawable after realization
@@ -110,45 +113,45 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
Assert.assertEquals(expGLCaps.isFBO(), chosenGLCaps.isFBO());
Assert.assertEquals(expGLCaps.isPBuffer(), chosenGLCaps.isPBuffer());
Assert.assertEquals(expGLCaps.isBitmap(), chosenGLCaps.isBitmap());
- /** Single/Double buffer cannot be checked since result may vary ..
+ /** Single/Double buffer cannot be checked since result may vary ..
if(chosenGLCaps.isOnscreen() || chosenGLCaps.isFBO()) {
// dbl buffer may be disabled w/ offscreen pbuffer and bitmap
Assert.assertEquals(expGLCaps.getDoubleBuffered(), chosenGLCaps.getDoubleBuffered());
- } */
+ } */
glad.addGLEventListener(demo);
-
+
final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener();
glad.addGLEventListener(snapshotGLEventListener);
-
+
glad.display(); // initial resize/display
-
+
// 1 - szStep = 2
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
-
+
// 2, 3 (resize + display)
szStep = 1;
glad.setSize(widthStep*szStep, heightStep*szStep);
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
-
+
// 4, 5 (resize + display)
szStep = 4;
glad.setSize(widthStep*szStep, heightStep*szStep);
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
-
+
Thread.sleep(50);
-
+
glad.destroy();
- System.out.println("Fin Drawable: "+glad);
+ System.out.println("Fin Drawable: "+glad);
}
@Test
@@ -161,8 +164,8 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
if(null != f) {
System.err.println(JoglVersion.getDefaultOpenGLInfo(f.getDefaultDevice(), null, true).toString());
}
- }
-
+ }
+
@Test
public void testES2OffScreenAutoDblBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
@@ -179,7 +182,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setFBO(true);
doTest(reqGLCaps, new GearsES2(1));
}
-
+
@Test
public void testES2OffScreenFBOSglBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
@@ -188,8 +191,8 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setFBO(true);
reqGLCaps.setDoubleBuffered(false);
doTest(reqGLCaps, new GearsES2(1));
- }
-
+ }
+
@Test
public void testES2OffScreenFBODblBufStencil() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
@@ -199,7 +202,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setStencilBits(1);
doTest(reqGLCaps, new GearsES2(1));
}
-
+
@Test
public void testES2OffScreenFBODblBufMSAA() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
@@ -209,8 +212,8 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new GearsES2(1));
- }
-
+ }
+
@Test
public void testES2OffScreenFBODblBufStencilMSAA() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
@@ -221,8 +224,8 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new GearsES2(1));
- }
-
+ }
+
@Test
public void testES2OffScreenPbufferDblBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
@@ -230,8 +233,8 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setOnscreen(false);
reqGLCaps.setPBuffer(true);
doTest(reqGLCaps, new GearsES2(1));
- }
-
+ }
+
@Test
public void testES2OffScreenPbufferSglBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
@@ -241,7 +244,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setDoubleBuffered(false);
doTest(reqGLCaps, new GearsES2(1));
}
-
+
// Might be reduced to !stencil
@Test
public void testES2OffScreenPbufferDblBufStencil() throws InterruptedException {
@@ -252,7 +255,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setStencilBits(1);
doTest(reqGLCaps, new GearsES2(1));
}
-
+
// Might be reduced to !MSAA
@Test
public void testES2OffScreenPbufferDblBufMSAA() throws InterruptedException {
@@ -263,8 +266,8 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new GearsES2(1));
- }
-
+ }
+
// Might be reduced to !stencil && !MSAA
@Test
public void testES2OffScreenPbufferDblBufStencilMSAA() throws InterruptedException {
@@ -276,9 +279,9 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new GearsES2(1));
- }
+ }
- /** NOT Implemented:
+ /** NOT Implemented:
// Might be reduced to !double-buff
@Test
public void testES2OffScreenBitmapDblBuf() throws InterruptedException {
@@ -288,7 +291,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setBitmap(true);
doTest(reqGLCaps, new Gears(1));
}
-
+
@Test
public void testES2OffScreenBitmapSglBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2);
@@ -298,7 +301,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setDoubleBuffered(false);
doTest(reqGLCaps, new Gears(1));
}
-
+
// Might be reduced to !stencil
@Test
public void testES2OffScreenBitmapDblBufStencil() throws InterruptedException {
@@ -309,7 +312,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setStencilBits(1);
doTest(reqGLCaps, new GearsES2(1));
}
-
+
// Might be reduced to !MSAA
@Test
public void testES2OffScreenBitmapDblBufMSAA() throws InterruptedException {
@@ -320,8 +323,8 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new GearsES2(1));
- }
-
+ }
+
// Might be reduced to !stencil && !MSAA
@Test
public void testES2OffScreenBitmapDblBufStencilMSAA() throws InterruptedException {
@@ -334,7 +337,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new GearsES2(1));
} */
-
+
public static void main(String args[]) throws IOException {
org.junit.runner.JUnitCore.main(TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.class.getName());
}
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 80e56f8..09e2113 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.acore;
import java.io.IOException;
@@ -43,6 +43,8 @@ import jogamp.opengl.GLGraphicsConfigurationUtil;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.opengl.JoglVersion;
import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
@@ -50,12 +52,13 @@ import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
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}.
+ * Toolkit agnostic {@link GLOffscreenAutoDrawable} tests using the
+ * {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}.
* <p>
- * The created {@link GLOffscreenAutoDrawable} is being used to run the {@link GLEventListener}.
- * </p>
+ * The created {@link GLOffscreenAutoDrawable} is being used to run the {@link GLEventListener}.
+ * </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
static final int widthStep = 800/4;
static final int heightStep = 600/4;
@@ -68,7 +71,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
}
return new GLCapabilities(GLProfile.get(profile));
}
-
+
void doTest(GLCapabilitiesImmutable reqGLCaps, GLEventListener demo) throws InterruptedException {
System.out.println("Requested GL Caps: "+reqGLCaps);
final GLDrawableFactory factory = GLDrawableFactory.getFactory(reqGLCaps.getGLProfile());
@@ -76,15 +79,15 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
System.out.println("Expected GL Caps: "+expGLCaps);
//
- // Create native OpenGL resources .. XGL/WGL/CGL ..
+ // Create native OpenGL resources .. XGL/WGL/CGL ..
// equivalent to GLAutoDrawable methods: setVisible(true)
//
- final GLOffscreenAutoDrawable glad = factory.createOffscreenAutoDrawable(null, reqGLCaps, null, widthStep*szStep, heightStep*szStep, null);
-
+ final GLOffscreenAutoDrawable glad = factory.createOffscreenAutoDrawable(null, reqGLCaps, null, widthStep*szStep, heightStep*szStep);
+
Assert.assertNotNull(glad);
- System.out.println("Drawable Pre-GL(0): "+glad.getClass().getName()+", "+glad.getNativeSurface().getClass().getName());
+ System.out.println("Drawable Pre-GL(0): "+glad.getClass().getName()+", "+glad.getNativeSurface().getClass().getName());
Assert.assertTrue(glad.isRealized());
-
+
// Check caps of NativeWindow config w/o GL
final CapabilitiesImmutable chosenCaps = glad.getChosenGLCapabilities();
System.out.println("Drawable Caps Pre_GL : "+chosenCaps);
@@ -92,7 +95,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
Assert.assertTrue(chosenCaps.getGreenBits()>4);
Assert.assertTrue(chosenCaps.getBlueBits()>4);
Assert.assertTrue(chosenCaps.getRedBits()>4);
-
+
glad.display(); // force native context creation
// Check caps of GLDrawable after realization
@@ -110,45 +113,45 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
Assert.assertEquals(expGLCaps.isFBO(), chosenGLCaps.isFBO());
Assert.assertEquals(expGLCaps.isPBuffer(), chosenGLCaps.isPBuffer());
Assert.assertEquals(expGLCaps.isBitmap(), chosenGLCaps.isBitmap());
- /** Single/Double buffer cannot be checked since result may vary ..
+ /** Single/Double buffer cannot be checked since result may vary ..
if(chosenGLCaps.isOnscreen() || chosenGLCaps.isFBO()) {
// dbl buffer may be disabled w/ offscreen pbuffer and bitmap
Assert.assertEquals(expGLCaps.getDoubleBuffered(), chosenGLCaps.getDoubleBuffered());
- } */
+ } */
glad.addGLEventListener(demo);
-
+
final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener();
glad.addGLEventListener(snapshotGLEventListener);
-
+
glad.display(); // initial resize/display
-
+
// 1 - szStep = 2
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
-
+
// 2, 3 (resize + display)
szStep = 1;
glad.setSize(widthStep*szStep, heightStep*szStep);
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
-
+
// 4, 5 (resize + display)
szStep = 4;
glad.setSize(widthStep*szStep, heightStep*szStep);
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
-
+
Thread.sleep(50);
-
+
glad.destroy();
- System.out.println("Fin Drawable: "+glad);
+ System.out.println("Fin Drawable: "+glad);
}
@Test
@@ -161,8 +164,8 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
if(null != f) {
System.err.println(JoglVersion.getDefaultOpenGLInfo(f.getDefaultDevice(), null, true).toString());
}
- }
-
+ }
+
@Test
public void testGL2OffScreenAutoDblBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -179,7 +182,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setFBO(true);
doTest(reqGLCaps, new Gears(1));
}
-
+
@Test
public void testGL2OffScreenFBOSglBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -188,8 +191,8 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setFBO(true);
reqGLCaps.setDoubleBuffered(false);
doTest(reqGLCaps, new Gears(1));
- }
-
+ }
+
@Test
public void testGL2OffScreenFBODblBufStencil() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -199,7 +202,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setStencilBits(1);
doTest(reqGLCaps, new Gears(1));
}
-
+
@Test
public void testGL2OffScreenFBODblBufMSAA() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -209,8 +212,8 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new Gears(1));
- }
-
+ }
+
@Test
public void testGL2OffScreenFBODblBufStencilMSAA() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -221,8 +224,8 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new Gears(1));
- }
-
+ }
+
@Test
public void testGL2OffScreenPbufferDblBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -230,8 +233,8 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setOnscreen(false);
reqGLCaps.setPBuffer(true);
doTest(reqGLCaps, new Gears(1));
- }
-
+ }
+
@Test
public void testGL2OffScreenPbufferSglBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -241,8 +244,8 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setDoubleBuffered(false);
doTest(reqGLCaps, new Gears(1));
}
-
- // Might be reduced to !stencil
+
+ // Might be reduced to !stencil
@Test
public void testGL2OffScreenPbufferDblBufStencil() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -252,7 +255,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setStencilBits(1);
doTest(reqGLCaps, new Gears(1));
}
-
+
// Might be reduced to !MSAA
@Test
public void testGL2OffScreenPbufferDblBufMSAA() throws InterruptedException {
@@ -263,8 +266,8 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new Gears(1));
- }
-
+ }
+
// Might be reduced to !stencil && !MSAA
@Test
public void testGL2OffScreenPbufferDblBufStencilMSAA() throws InterruptedException {
@@ -276,9 +279,9 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new Gears(1));
- }
-
-
+ }
+
+
// Might be reduced to !double-buff
@Test
public void testGL2OffScreenBitmapDblBuf() throws InterruptedException {
@@ -288,7 +291,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setBitmap(true);
doTest(reqGLCaps, new Gears(1));
}
-
+
@Test
public void testGL2OffScreenBitmapDblBufRGBA8881() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -301,7 +304,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setBitmap(true);
doTest(reqGLCaps, new Gears(1));
}
-
+
@Test
public void testGL2OffScreenBitmapDblBufRGB555() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -314,7 +317,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setBitmap(true);
doTest(reqGLCaps, new Gears(1));
}
-
+
@Test
public void testGL2OffScreenBitmapDblBufRGBA5551() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -327,7 +330,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setBitmap(true);
doTest(reqGLCaps, new Gears(1));
}
-
+
@Test
public void testGL2OffScreenBitmapSglBuf() throws InterruptedException {
final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2);
@@ -337,7 +340,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setDoubleBuffered(false);
doTest(reqGLCaps, new Gears(1));
}
-
+
// Might be reduced to !stencil
@Test
public void testGL2OffScreenBitmapDblBufStencil() throws InterruptedException {
@@ -348,7 +351,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setStencilBits(1);
doTest(reqGLCaps, new Gears(1));
}
-
+
// Might be reduced to !MSAA
@Test
public void testGL2OffScreenBitmapDblBufMSAA() throws InterruptedException {
@@ -359,8 +362,8 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new Gears(1));
- }
-
+ }
+
// Might be reduced to !stencil && !MSAA
@Test
public void testGL2OffScreenBitmapDblBufStencilMSAA() throws InterruptedException {
@@ -372,8 +375,8 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new Gears(1));
- }
-
+ }
+
public static void main(String args[]) throws IOException {
org.junit.runner.JUnitCore.main(TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.class.getName());
}
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 746b8e1..f35f8c8 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.acore;
import java.io.IOException;
@@ -43,6 +43,8 @@ import jogamp.opengl.GLGraphicsConfigurationUtil;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.opengl.JoglVersion;
import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
@@ -50,12 +52,13 @@ import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
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}.
+ * Toolkit agnostic {@link GLOffscreenAutoDrawable} tests using the
+ * {@link GLDrawableFactory#createOffscreenAutoDrawable(javax.media.nativewindow.AbstractGraphicsDevice, GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, int, int, GLContext) factory model}.
* <p>
- * The created {@link GLOffscreenAutoDrawable} is being used to run the {@link GLEventListener}.
- * </p>
+ * The created {@link GLOffscreenAutoDrawable} is being used to run the {@link GLEventListener}.
+ * </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase {
static final int widthStep = 800/4;
static final int heightStep = 600/4;
@@ -68,15 +71,15 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase {
System.out.println("Expected GL Caps: "+expGLCaps);
//
- // Create native OpenGL resources .. XGL/WGL/CGL ..
+ // Create native OpenGL resources .. XGL/WGL/CGL ..
// equivalent to GLAutoDrawable methods: setVisible(true)
//
- final GLOffscreenAutoDrawable glad = factory.createOffscreenAutoDrawable(null, reqGLCaps, null, widthStep*szStep, heightStep*szStep, null);
-
+ final GLOffscreenAutoDrawable glad = factory.createOffscreenAutoDrawable(null, reqGLCaps, null, widthStep*szStep, heightStep*szStep);
+
Assert.assertNotNull(glad);
- System.out.println("Drawable Pre-GL(0): "+glad.getClass().getName()+", "+glad.getNativeSurface().getClass().getName());
+ System.out.println("Drawable Pre-GL(0): "+glad.getClass().getName()+", "+glad.getNativeSurface().getClass().getName());
Assert.assertTrue(glad.isRealized());
-
+
// Check caps of NativeWindow config w/o GL
final CapabilitiesImmutable chosenCaps = glad.getChosenGLCapabilities();
System.out.println("Drawable Caps Pre_GL : "+chosenCaps);
@@ -84,7 +87,7 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase {
Assert.assertTrue(chosenCaps.getGreenBits()>4);
Assert.assertTrue(chosenCaps.getBlueBits()>4);
Assert.assertTrue(chosenCaps.getRedBits()>4);
-
+
glad.display(); // force native context creation
// Check caps of GLDrawable after realization
@@ -102,45 +105,45 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase {
Assert.assertEquals(expGLCaps.isFBO(), chosenGLCaps.isFBO());
Assert.assertEquals(expGLCaps.isPBuffer(), chosenGLCaps.isPBuffer());
Assert.assertEquals(expGLCaps.isBitmap(), chosenGLCaps.isBitmap());
- /** Single/Double buffer cannot be checked since result may vary ..
+ /** Single/Double buffer cannot be checked since result may vary ..
if(chosenGLCaps.isOnscreen() || chosenGLCaps.isFBO()) {
// dbl buffer may be disabled w/ offscreen pbuffer and bitmap
Assert.assertEquals(expGLCaps.getDoubleBuffered(), chosenGLCaps.getDoubleBuffered());
- } */
+ } */
glad.addGLEventListener(demo);
-
+
final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener();
glad.addGLEventListener(snapshotGLEventListener);
-
+
glad.display(); // initial resize/display
-
+
// 1 - szStep = 2
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
-
+
// 2, 3 (resize + display)
szStep = 1;
glad.setSize(widthStep*szStep, heightStep*szStep);
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
-
+
// 4, 5 (resize + display)
szStep = 4;
glad.setSize(widthStep*szStep, heightStep*szStep);
- Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
-
+
Thread.sleep(50);
-
+
glad.destroy();
- System.out.println("Fin Drawable: "+glad);
+ System.out.println("Fin Drawable: "+glad);
}
@Test
@@ -153,8 +156,8 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase {
if(null != f) {
System.err.println(JoglVersion.getDefaultOpenGLInfo(f.getDefaultDevice(), null, true).toString());
}
- }
-
+ }
+
// Might be reduced to !double-buff
@Test
public void testGL2OffScreenBitmapDblBuf() throws InterruptedException {
@@ -163,7 +166,7 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase {
reqGLCaps.setBitmap(true);
doTest(reqGLCaps, new Gears(1));
}
-
+
// Might be reduced to !MSAA
@Test
public void testGL2OffScreenBitmapDblBufMSAA() throws InterruptedException {
@@ -173,8 +176,8 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase {
reqGLCaps.setSampleBuffers(true);
reqGLCaps.setNumSamples(4);
doTest(reqGLCaps, new Gears(1));
- }
-
+ }
+
public static void main(String args[]) throws IOException {
org.junit.runner.JUnitCore.main(TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.class.getName());
}
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 2df1d3c..ab64b5d 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
@@ -49,6 +49,8 @@ import jogamp.opengl.GLGraphicsConfigurationUtil;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.opengl.JoglVersion;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
@@ -58,6 +60,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
/**
* Tests using an AWT {@link GLCanvas} {@link GLAutoDrawable auto drawable} for on- and offscreen cases.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT extends UITestCase {
static final int widthStep = 800/4;
static final int heightStep = 600/4;
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 0a60566..9332b0f 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
@@ -44,6 +44,8 @@ import jogamp.opengl.GLGraphicsConfigurationUtil;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.JoglVersion;
@@ -58,6 +60,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
* The NEWT {@link GLAutoDrawable} is being used to run the {@link GLEventListener}.
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT extends UITestCase {
static final int widthStep = 800/4;
static final int heightStep = 600/4;
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 f4999c0..ae5dc61 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
@@ -50,6 +50,8 @@ import jogamp.opengl.GLGraphicsConfigurationUtil;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.opengl.GLWindow;
@@ -64,6 +66,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
* The NEWT {@link GLAutoDrawable} is being used to run the {@link GLEventListener}.
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT extends UITestCase {
static final int widthStep = 800/4;
static final int heightStep = 600/4;
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 b3516d6..c64bb38 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
@@ -37,11 +37,14 @@ import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLProfile;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.util.UITestCase;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLContextSurfaceLockNEWT extends UITestCase {
static final int demoSize = 64;
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 629a613..f0950fb 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
@@ -42,6 +42,8 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.Display;
import com.jogamp.newt.NewtFactory;
@@ -49,6 +51,7 @@ import com.jogamp.newt.Screen;
import com.jogamp.newt.Window;
import com.jogamp.opengl.test.junit.util.UITestCase;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLDebug00NEWT extends UITestCase {
static String dbgTstMsg0 = "Hello World";
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 5cace1e..76bf330 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
@@ -41,10 +41,13 @@ import javax.media.opengl.GLRunnable;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.util.UITestCase;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLDebug01NEWT extends UITestCase {
static String dbgTstMsg0 = "Hello World";
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 d4f3fec..4bc8e7e 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.acore;
import java.util.Collections;
@@ -42,16 +42,19 @@ import javax.media.opengl.GLProfile;
import jogamp.opengl.GLDrawableFactoryImpl;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLExtensionQueryOffscreen {
-
+
public static void main(String[] args) {
TestGLExtensionQueryOffscreen instance = new TestGLExtensionQueryOffscreen();
instance.testJogl2ExtensionCheck1();
instance.testJogl2ExtensionCheck2();
}
- /**
+ /**
* @deprecated This test uses a non public API in jogamp.opengl.* and hence is not recommended
*/
@Test
@@ -71,13 +74,13 @@ public class TestGLExtensionQueryOffscreen {
System.out.println("SharedContext: "+sharedContext);
System.out.println("SharedContext: "+setExtensions);
}
-
+
@Test
public void testJogl2ExtensionCheck2() {
final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
- final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
- final GLOffscreenAutoDrawable drawable = factory.createOffscreenAutoDrawable(null, caps, null, 256, 256, null);
-
+ final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
+ final GLOffscreenAutoDrawable drawable = factory.createOffscreenAutoDrawable(null, caps, null, 256, 256);
+ drawable.display(); // trigger context creation ..
final GLContext context = drawable.getContext();
context.makeCurrent();
String extensions;
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 9251120..5efe21e 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
@@ -44,6 +44,8 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* Some GL state values are broken w/ Mesa 9.0 w/ multiple different context.
@@ -57,6 +59,7 @@ import org.junit.Test;
* </p>
* <https://jogamp.org/bugzilla/show_bug.cgi?id=651>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLMesaBug651NEWT extends UITestCase {
static int width, height;
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 25b0b93..b11a6f9 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
@@ -10,6 +10,8 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.JoglVersion;
@@ -27,6 +29,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
* </p>
* <https://jogamp.org/bugzilla/show_bug.cgi?id=658>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLMesaBug658NEWT extends UITestCase {
@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 692a318..7d3a7b8 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
@@ -42,7 +42,10 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLPointsNEWT extends UITestCase {
static int width, height;
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 19402c9..df182c5 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,27 +20,48 @@
* 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.acore;
import java.io.IOException;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import javax.media.opengl.*;
+import com.jogamp.common.os.Platform;
+import com.jogamp.opengl.JoglVersion;
import com.jogamp.opengl.test.junit.util.UITestCase;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLProfile00NEWT extends UITestCase {
@Test
public void testInitSingleton() throws InterruptedException {
GLProfile.initSingleton();
+ System.err.println("Desktop");
+ GLDrawableFactory desktopFactory = GLDrawableFactory.getDesktopFactory();
+ if( null != desktopFactory ) {
+ System.err.println(JoglVersion.getDefaultOpenGLInfo(desktopFactory.getDefaultDevice(), null, false));
+ System.err.println(Platform.getNewline()+Platform.getNewline()+Platform.getNewline());
+ } else {
+ System.err.println("\tNULL");
+ }
+
+ System.err.println("EGL");
+ GLDrawableFactory eglFactory = GLDrawableFactory.getEGLFactory();
+ if( null != eglFactory ) {
+ System.err.println(JoglVersion.getDefaultOpenGLInfo(eglFactory.getDefaultDevice(), null, false));
+ } else {
+ System.err.println("\tNULL");
+ }
}
public static void main(String args[]) throws IOException {
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 47edf53..462934c 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
@@ -32,6 +32,8 @@ import java.io.IOException;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import javax.media.opengl.*;
@@ -44,6 +46,7 @@ import com.jogamp.opengl.JoglVersion;
import com.jogamp.newt.opengl.*;
import com.jogamp.newt.*;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLProfile01NEWT extends UITestCase {
@Test
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLVersionParsing00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLVersionParsing00NEWT.java
index a39e68a..7ae49fe 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLVersionParsing00NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLVersionParsing00NEWT.java
@@ -32,12 +32,15 @@ import java.io.IOException;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import jogamp.opengl.GLVersionNumber;
import com.jogamp.common.util.VersionNumberString;
import com.jogamp.opengl.test.junit.util.UITestCase;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLVersionParsing00NEWT extends UITestCase {
public static final String[] glVersionStrings00 = new String[] {
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 6080343..93713c7 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
@@ -36,6 +36,7 @@ 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;
@@ -44,7 +45,10 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGPUMemSec01NEWT extends UITestCase {
static String hexString(int i) {
return "0x"+Integer.toHexString(i);
@@ -277,8 +281,8 @@ public class TestGPUMemSec01NEWT extends UITestCase {
@Test
public void testReadPixelsGL2GL3_640x480xRGBxUB() throws InterruptedException {
GLProfile glp = GLProfile.getGL2ES2();
- if(!glp.isGL2GL3()) {
- System.err.println("GL2GL3 n/a skip test");
+ if(!glp.isGL2ES3()) {
+ System.err.println("GL2ES3 n/a skip test");
return;
}
final int width = 640;
@@ -301,8 +305,8 @@ public class TestGPUMemSec01NEWT extends UITestCase {
@Test
public void testReadPixelsGL2GL3_99x100xRGBxUB() throws InterruptedException {
GLProfile glp = GLProfile.getGL2ES2();
- if(!glp.isGL2GL3()) {
- System.err.println("GL2GL3 n/a skip test");
+ if(!glp.isGL2ES3()) {
+ System.err.println("GL2ES3 n/a skip test");
return;
}
final int wwidth = 640;
@@ -327,8 +331,8 @@ public class TestGPUMemSec01NEWT extends UITestCase {
@Test
public void testReadPixelsGL2GL3_640x480xREDxUB() throws InterruptedException {
GLProfile glp = GLProfile.getGL2ES2();
- if(!glp.isGL2GL3()) {
- System.err.println("GL2GL3 n/a skip test");
+ if(!glp.isGL2ES3()) {
+ System.err.println("GL2ES3 n/a skip test");
return;
}
final int width = 640;
@@ -340,7 +344,7 @@ public class TestGPUMemSec01NEWT extends UITestCase {
final GL2GL3 gl = winctx.context.getGL().getGL2GL3();
// 2 x too small - 0 x alignment
- Assert.assertEquals(2, readPixelsCheck(gl, GL2GL3.GL_RED, GL.GL_UNSIGNED_BYTE, 1, width, height));
+ Assert.assertEquals(2, readPixelsCheck(gl, GL2ES2.GL_RED, GL.GL_UNSIGNED_BYTE, 1, width, height));
drawable.swapBuffers();
Thread.sleep(50);
@@ -351,8 +355,8 @@ public class TestGPUMemSec01NEWT extends UITestCase {
@Test
public void testReadPixelsGL2GL3_102x100xREDxUB() throws InterruptedException {
GLProfile glp = GLProfile.getGL2ES2();
- if(!glp.isGL2GL3()) {
- System.err.println("GL2GL3 n/a skip test");
+ if(!glp.isGL2ES3()) {
+ System.err.println("GL2ES3 n/a skip test");
return;
}
int wwidth = 640;
@@ -366,7 +370,7 @@ public class TestGPUMemSec01NEWT extends UITestCase {
final GL2GL3 gl = winctx.context.getGL().getGL2GL3();
// 2 x too small - 2 x alignment
- Assert.assertEquals(4, readPixelsCheck(gl, GL2GL3.GL_RED, GL.GL_UNSIGNED_BYTE, 1, rwidth, rheight));
+ Assert.assertEquals(4, readPixelsCheck(gl, GL2ES2.GL_RED, GL.GL_UNSIGNED_BYTE, 1, rwidth, rheight));
drawable.swapBuffers();
Thread.sleep(50);
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 f8e0aff..3933000 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
@@ -31,6 +31,8 @@ package com.jogamp.opengl.test.junit.jogl.acore;
import java.io.IOException;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.os.Platform;
@@ -41,6 +43,7 @@ import com.jogamp.common.os.Platform;
* perform lifecycle actions (window creation etc) with locking.
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestInitConcurrent01NEWT extends InitConcurrentBaseNEWT {
@Test(timeout=180000) // TO 3 min
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 dfb7326..67b3cef 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
@@ -31,6 +31,8 @@ package com.jogamp.opengl.test.junit.jogl.acore;
import java.io.IOException;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.os.Platform;
@@ -41,6 +43,7 @@ import com.jogamp.common.os.Platform;
* perform lifecycle actions (window creation etc) w/o locking.
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestInitConcurrent02NEWT extends InitConcurrentBaseNEWT {
static boolean mainRun = false;
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 5523ce5..5c60d09 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
@@ -33,9 +33,12 @@ import java.io.IOException;
import javax.media.opengl.awt.GLCanvas;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.opengl.test.junit.util.UITestCase;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestMainVersionGLCanvasAWT extends UITestCase {
@Test
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLWindowNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLWindowNEWT.java
index 24ba59b..85de65e 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLWindowNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLWindowNEWT.java
@@ -30,11 +30,14 @@ package com.jogamp.opengl.test.junit.jogl.acore;
import java.io.IOException;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.JoglVersion;
import com.jogamp.opengl.test.junit.util.UITestCase;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestMainVersionGLWindowNEWT extends UITestCase {
private static String[] args = null;
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 158c2aa..8fee790 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
@@ -42,11 +42,14 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
*
* @author Luz, et.al.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestMapBufferRead01NEWT extends UITestCase {
static final boolean DEBUG = false;
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 c1b7464..83e55b7 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
@@ -3,6 +3,8 @@ package com.jogamp.opengl.test.junit.jogl.acore;
import jogamp.nativewindow.x11.X11Util;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.opengl.GLWindow;
@@ -19,6 +21,7 @@ import javax.media.opengl.GLProfile;
* Tests the closing the device of GLWindow and GLPBuffer in JOGL
*/
@SuppressWarnings("deprecation")
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestNEWTCloseX11DisplayBug565 {
@Test
@@ -27,16 +30,16 @@ public class TestNEWTCloseX11DisplayBug565 {
try {
for ( int j = 0; j < 10; j++ ) {
final int open0;
- if(NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(false)) {
+ if(NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(false)) {
open0 = X11Util.getOpenDisplayConnectionNumber();
} else {
open0 = 0;
}
-
+
GLCapabilitiesImmutable caps = new GLCapabilities( GLProfile.getDefault( ) );
-
+
GLWindow window = GLWindow.create(caps);
- window.setTitle("NEWT Resource X11 Leak - #" + j );
+ window.setTitle("NEWT Resource X11 Leak - #" + j );
window.setSize( 128, 128 );
window.setVisible(true);
window.display();
@@ -66,7 +69,7 @@ public class TestNEWTCloseX11DisplayBug565 {
try {
for ( int j = 0; j < 10; j++ ) {
final int open0;
- if(NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(false)) {
+ if(NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(false)) {
open0 = X11Util.getOpenDisplayConnectionNumber();
} else {
open0 = 0;
@@ -108,7 +111,7 @@ public class TestNEWTCloseX11DisplayBug565 {
try {
for ( int j = 0; j < 10; j++ ) {
final int open0;
- if(NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(false)) {
+ if(NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(false)) {
open0 = X11Util.getOpenDisplayConnectionNumber();
} else {
open0 = 0;
@@ -118,13 +121,7 @@ public class TestNEWTCloseX11DisplayBug565 {
GLOffscreenAutoDrawable buffer = GLDrawableFactory.getFactory( glp ).createOffscreenAutoDrawable(
- null,
- caps,
- new DefaultGLCapabilitiesChooser(),
- 256,
- 256,
- null
- );
+ null, caps, new DefaultGLCapabilitiesChooser(), 256, 256);
buffer.display();
buffer.destroy();
@@ -143,10 +140,10 @@ public class TestNEWTCloseX11DisplayBug565 {
Assert.fail(e.getMessage());
}
}
-
+
public static void main(String args[]) {
org.junit.runner.JUnitCore.main(TestNEWTCloseX11DisplayBug565.class.getName());
}
-
+
}
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 54f9943..e41f22a 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
@@ -44,7 +44,10 @@ import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestNVSwapGroupNEWT extends UITestCase {
static GLProfile glp;
static GLCapabilities caps;
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 8cc0942..c93e54e 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
@@ -47,6 +47,8 @@ import jogamp.nativewindow.jawt.JAWTUtil;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.os.Platform;
import com.jogamp.newt.Window;
@@ -57,6 +59,7 @@ import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestOffscreenLayer01GLCanvasAWT extends UITestCase {
static boolean singleBuffer = false;
static boolean useMSAA = false;
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 2236f4b..5335d85 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
@@ -46,6 +46,8 @@ import jogamp.nativewindow.jawt.JAWTUtil;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.Window;
import com.jogamp.newt.awt.NewtCanvasAWT;
@@ -57,6 +59,7 @@ import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestOffscreenLayer02NewtCanvasAWT extends UITestCase {
static boolean singleBuffer = false;
static boolean useMSAA = false;
@@ -159,7 +162,7 @@ public class TestOffscreenLayer02NewtCanvasAWT extends UITestCase {
}
setDemoFields(demo1, glWindow1, false);
glWindow1.addGLEventListener(demo1);
- glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1));
+ glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1, null));
frame1.setSize(frameSize0);
setupFrameAndShow(frame1, newtCanvasAWT1);
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 8684ab1..a1f0d33 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
@@ -41,11 +41,14 @@ import jogamp.nativewindow.jawt.JAWTUtil;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.util.RunnableTask;
import com.jogamp.opengl.test.junit.util.UITestCase;
@SuppressWarnings("deprecation")
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestPBufferDeadlockAWT extends UITestCase {
static GLProfile glp;
static int width, height;
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 67b70e1..77657f6 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.acore;
import javax.media.opengl.GLCapabilities;
@@ -47,7 +47,10 @@ import org.junit.Assert;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestSharedContextListAWT extends UITestCase {
static GLProfile glp;
static GLCapabilities caps;
@@ -70,7 +73,7 @@ public class TestSharedContextListAWT extends UITestCase {
}
private void initShared() {
- sharedDrawable = GLDrawableFactory.getFactory(glp).createOffscreenAutoDrawable(null, caps, null, width, height, null);
+ sharedDrawable = GLDrawableFactory.getFactory(glp).createOffscreenAutoDrawable(null, caps, null, width, height);
Assert.assertNotNull(sharedDrawable);
sharedGears = new Gears();
Assert.assertNotNull(sharedGears);
@@ -83,8 +86,8 @@ public class TestSharedContextListAWT extends UITestCase {
Assert.assertNotNull(sharedDrawable);
sharedDrawable.destroy();
}
-
- protected void setFrameTitle(final Frame f, final boolean useShared)
+
+ protected void setFrameTitle(final Frame f, final boolean useShared)
throws InterruptedException, InvocationTargetException {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
@@ -96,12 +99,13 @@ public class TestSharedContextListAWT extends UITestCase {
protected GLCanvas runTestGL(final Frame frame, final Animator animator, final int x, final int y, final boolean useShared, final boolean vsync)
throws InterruptedException, InvocationTargetException
{
- final GLCanvas glCanvas = new GLCanvas(caps, useShared ? sharedDrawable.getContext() : null);
+ final GLCanvas glCanvas = new GLCanvas(caps);
Assert.assertNotNull(glCanvas);
+ glCanvas.setSharedAutoDrawable(sharedDrawable);
frame.add(glCanvas);
frame.setLocation(x, y);
frame.setSize(width, height);
-
+
Gears gears = new Gears(vsync ? 1 : 0);
if(useShared) {
gears.setGears(sharedGears.getGear1(), sharedGears.getGear2(), sharedGears.getGear3());
@@ -130,22 +134,22 @@ public class TestSharedContextListAWT extends UITestCase {
final GLCanvas glc1 = runTestGL(f1, animator, 0, 0, true, false);
int x0 = f1.getX();
int y0 = f1.getY();
-
- final GLCanvas glc2 = runTestGL(f2, animator,
+
+ final GLCanvas glc2 = runTestGL(f2, animator,
x0+width,
- y0+0,
+ y0+0,
true, false);
-
- final GLCanvas glc3 = runTestGL(f3, animator,
- x0+0,
- y0+height,
+
+ final GLCanvas glc3 = runTestGL(f3, animator,
+ x0+0,
+ y0+height,
false, true);
setFrameTitle(f1, true);
setFrameTitle(f2, true);
setFrameTitle(f3, false);
-
- animator.setUpdateFPSFrames(1, null);
+
+ animator.setUpdateFPSFrames(1, null);
animator.start();
while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
Thread.sleep(100);
@@ -169,8 +173,8 @@ public class TestSharedContextListAWT extends UITestCase {
} catch( Throwable throwable ) {
throwable.printStackTrace();
Assume.assumeNoException( throwable );
- }
-
+ }
+
releaseShared();
}
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 78c8fd0..09173fb 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.acore;
import java.io.IOException;
@@ -46,7 +46,10 @@ import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestSharedContextListNEWT extends UITestCase {
static GLProfile glp;
static GLCapabilities caps;
@@ -69,7 +72,7 @@ public class TestSharedContextListNEWT extends UITestCase {
}
private void initShared() {
- sharedDrawable = GLDrawableFactory.getFactory(glp).createOffscreenAutoDrawable(null, caps, null, width, height, null);
+ sharedDrawable = GLDrawableFactory.getFactory(glp).createOffscreenAutoDrawable(null, caps, null, width, height);
Assert.assertNotNull(sharedDrawable);
sharedGears = new Gears();
Assert.assertNotNull(sharedGears);
@@ -116,11 +119,11 @@ public class TestSharedContextListNEWT extends UITestCase {
Animator animator = new Animator();
GLWindow f1 = runTestGL(animator, 0, 0, true, false);
InsetsImmutable insets = f1.getInsets();
- GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(),
+ GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(),
f1.getY()+0, true, false);
- GLWindow f3 = runTestGL(animator, f1.getX()+0,
+ GLWindow f3 = runTestGL(animator, f1.getX()+0,
f1.getY()+height+insets.getTotalHeight(), false, true);
- animator.setUpdateFPSFrames(1, null);
+ animator.setUpdateFPSFrames(1, null);
animator.start();
while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
Thread.sleep(100);
@@ -148,7 +151,7 @@ public class TestSharedContextListNEWT extends UITestCase {
/**
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
System.err.println("Press enter to continue");
- System.err.println(stdin.readLine()); */
+ System.err.println(stdin.readLine()); */
org.junit.runner.JUnitCore.main(TestSharedContextListNEWT.class.getName());
}
}
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 7893c51..967c94e 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
@@ -44,7 +44,10 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestSharedContextListNEWT2 extends UITestCase {
static GLProfile glp;
static GLCapabilities caps;
@@ -115,12 +118,13 @@ public class TestSharedContextListNEWT2 extends UITestCase {
@Test(timeout=10000)
public void test01() throws InterruptedException {
initShared();
- GLWindow f1 = runTestGL(new Animator(), 0, 0, true, false);
- InsetsImmutable insets = f1.getInsets();
- GLWindow f2 = runTestGL(new Animator(), f1.getX()+width+insets.getTotalWidth(),
- f1.getY()+0, true, false);
- GLWindow f3 = runTestGL(new Animator(), f1.getX()+0,
- f1.getY()+height+insets.getTotalHeight(), true, false);
+
+ final GLWindow f1 = runTestGL(new Animator(), 0, 0, true, false);
+ final InsetsImmutable insets = f1.getInsets();
+ final GLWindow f2 = runTestGL(new Animator(), f1.getX()+width+insets.getTotalWidth(),
+ f1.getY()+0, true, false);
+ final GLWindow f3 = runTestGL(new Animator(), f1.getX()+0,
+ f1.getY()+height+insets.getTotalHeight(), true, false);
try {
Thread.sleep(duration);
@@ -131,6 +135,10 @@ public class TestSharedContextListNEWT2 extends UITestCase {
f1.destroy();
f2.destroy();
f3.destroy();
+
+ // f1.getAnimator().stop();
+ // f2.getAnimator().stop();
+ // f3.getAnimator().stop();
releaseShared();
}
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 fbea81a..ff98d6f 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.acore;
import java.awt.Component;
@@ -36,9 +36,12 @@ import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
+import java.util.HashSet;
+import java.util.Set;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
+import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilities;
@@ -62,6 +65,8 @@ import javax.swing.event.ChangeListener;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.nio.Buffers;
import com.jogamp.newt.awt.NewtCanvasAWT;
@@ -75,12 +80,14 @@ import com.jogamp.opengl.util.GLBuffers;
/**
* TestSharedContextNewtAWTBug523
- *
+ *
* Opens a single JFrame with two OpenGL windows and sliders to adjust the view orientation.
*
* Each window renders a red triangle and a blue triangle.
* The red triangle is rendered using glBegin / glVertex / glEnd.
- * The blue triangle is rendered using vertex buffer objects bound to a vertex array object.
+ * The blue triangle is rendered using vertex buffer objects.
+ *
+ * VAO's are not used to allow testing on OSX GL2 context!
*
* If static useNewt is true, then those windows are GLWindow objects in a NewtCanvasAWT.
* If static useNewt is false, then those windows are GLCanvas objects.
@@ -89,17 +96,18 @@ import com.jogamp.opengl.util.GLBuffers;
* so that they share the vertex buffer and array objects and display lists.
* If shareContext is false, then the two OpenGL windows each have their own context, and the blue
* triangle fails to render in one of the windows.
- *
+ *
* The four test cases run through the four combinations of useNewt and shareContext.
- *
- * Similar test cases are {@link TestSharedContextListNEWT}, {@link TestSharedContextListAWT},
- * {@link TestSharedContextVBOES2NEWT} and {@link TestSharedContextVBOES1NEWT}.
- *
+ *
+ * Similar test cases are {@link TestSharedContextListNEWT}, {@link TestSharedContextListAWT},
+ * {@link TestSharedContextVBOES2NEWT1} and {@link TestSharedContextVBOES1NEWT}.
+ *
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestSharedContextNewtAWTBug523 extends UITestCase {
static long durationPerTest = 1000;
-
+
// counters for instances of event listener TwoTriangles
// private static int instanceCounter;
private static int initializationCounter;
@@ -108,13 +116,11 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
// The main thread waits twice on this semaphore to ensure both canvases have finished cleaning up.
private static Semaphore disposalCompleteSemaphore = new Semaphore(0);
- // Buffer objects can be shared across shared OpenGL context.
+ // Buffer objects can be shared across shared OpenGL context.
// If we run with sharedContext, then the tests will use these shared buffer objects,
// otherwise each event listener allocates its own buffer objects.
- private static int [] sharedVertexBufferObjects = {0};
- private static int [] sharedIndexBufferObjects = {0};
- private static FloatBuffer sharedVertexBuffer;
- private static IntBuffer sharedIndexBuffer;
+ private static volatile int[] sharedVertexBufferObjects = {0};
+ private static volatile int[] sharedIndexBufferObjects = {0};
@BeforeClass
public static void initClass() {
@@ -122,12 +128,15 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
setTestSupported(false);
}
}
-
+
static private GLOffscreenAutoDrawable initShared(GLCapabilities caps) {
- final GLOffscreenAutoDrawable sharedDrawable = GLDrawableFactory.getFactory(caps.getGLProfile()).createOffscreenAutoDrawable(null, caps, null, 64, 64, null);
+ final GLOffscreenAutoDrawable sharedDrawable = GLDrawableFactory.getFactory(caps.getGLProfile()).createOffscreenAutoDrawable(null, caps, null, 64, 64);
Assert.assertNotNull(sharedDrawable);
// init and render one frame, which will setup the Gears display lists
sharedDrawable.display();
+ final GLContext ctx = sharedDrawable.getContext();
+ Assert.assertNotNull("Shared drawable's ctx is null", ctx);
+ Assert.assertTrue("Shared drawable's ctx is not created", ctx.isCreated());
return sharedDrawable;
}
@@ -136,34 +145,58 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
sharedDrawable.destroy();
}
}
-
+
// inner class that implements the event listener
static class TwoTriangles implements GLEventListener {
boolean useShared;
int canvasWidth;
int canvasHeight;
- private float boundsRadius = 2f;
+ private final float boundsRadius = 2f;
private float viewDistance;
private float viewDistanceFactor = 1.0f;
private float xAxisRotation;
private float yAxisRotation;
- private float viewFovDegrees = 15f;
-
- // vertex array objects cannot be shared across open gl canvases;
- //
- // However, display lists can be shared across GLCanvas instances (if those canvases are initialized with the same GLContext),
- // including a display list created in one context that uses a VAO.
- private int [] vertexArrayObjects = {0};
+ private final float viewFovDegrees = 15f;
// Buffer objects can be shared across canvas instances, if those canvases are initialized with the same GLContext.
// If we run with sharedBufferObjects true, then the tests will use these shared buffer objects.
// If we run with sharedBufferObjects false, then each event listener allocates its own buffer objects.
- private int [] privateVertexBufferObjects = {0};
- private int [] privateIndexBufferObjects = {0};
- private FloatBuffer privateVertexBuffer;
- private IntBuffer privateIndexBuffer;
-
+ private final int [] privateVertexBufferObjects = {0};
+ private final int [] privateIndexBufferObjects = {0};
+
+ public static int createVertexBuffer(GL2 gl2) {
+ final FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(18);
+ vertexBuffer.put(new float[]{
+ 1.0f, -0.5f, 0f, // vertex 1
+ 0f, 0f, 1f, // normal 1
+ 1.5f, -0.5f, 0f, // vertex 2
+ 0f, 0f, 1f, // normal 2
+ 1.0f, 0.5f, 0f, // vertex 3
+ 0f, 0f, 1f // normal 3
+ });
+ vertexBuffer.position(0);
+
+ final int[] vbo = { 0 };
+ gl2.glGenBuffers(1, vbo, 0);
+ gl2.glBindBuffer(GL2.GL_ARRAY_BUFFER, vbo[0]);
+ gl2.glBufferData(GL2.GL_ARRAY_BUFFER, vertexBuffer.capacity() * Buffers.SIZEOF_FLOAT, vertexBuffer, GL2.GL_STATIC_DRAW);
+ gl2.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0);
+ return vbo[0];
+ }
+ public static int createVertexIndexBuffer(GL2 gl2) {
+ final IntBuffer indexBuffer = GLBuffers.newDirectIntBuffer(3);
+ indexBuffer.put(new int[]{0, 1, 2});
+ indexBuffer.position(0);
+
+ final int[] vbo = { 0 };
+ gl2.glGenBuffers(1, vbo, 0);
+ gl2.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, vbo[0]);
+ gl2.glBufferData(GL2.GL_ELEMENT_ARRAY_BUFFER, indexBuffer.capacity() * Buffers.SIZEOF_INT, indexBuffer, GL2.GL_STATIC_DRAW);
+ gl2.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, 0);
+ return vbo[0];
+ }
+
TwoTriangles (int canvasWidth, int canvasHeight, boolean useShared) {
// instanceNum = instanceCounter++;
this.canvasWidth = canvasWidth;
@@ -196,49 +229,29 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
gl2.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
// the first instance of TwoTriangles initializes the shared buffer objects;
- // synchronizing to deal with potential liveness issues if the data is intialized from one thread and used on another
+ // synchronizing to deal with potential liveness issues if the data is initialized from one thread and used on another
synchronized (this) {
- gl2.glGenVertexArrays(1, vertexArrayObjects, 0);
-
- gl2.glBindVertexArray(vertexArrayObjects[0]);
-
- // use either the shared or private vertex buffers, as
+ // use either the shared or private vertex buffers, as
int [] vertexBufferObjects;
int [] indexBufferObjects;
- FloatBuffer vertexBuffer;
- IntBuffer indexBuffer;
//
if (useShared) {
+ System.err.println("Using shared VBOs on slave 0x"+Integer.toHexString(hashCode()));
vertexBufferObjects = sharedVertexBufferObjects;
indexBufferObjects = sharedIndexBufferObjects;
- vertexBuffer = sharedVertexBuffer;
- indexBuffer = sharedIndexBuffer;
} else {
+ System.err.println("Using local VBOs on slave 0x"+Integer.toHexString(hashCode()));
vertexBufferObjects = privateVertexBufferObjects;
indexBufferObjects = privateIndexBufferObjects;
- vertexBuffer = privateVertexBuffer;
- indexBuffer = privateIndexBuffer;
}
-
+
// if buffer sharing is enabled, then the first of the two event listeners to be
// initialized will allocate the buffers, and the other will re-use the allocated one
if (vertexBufferObjects[0] == 0) {
- vertexBuffer = GLBuffers.newDirectFloatBuffer(18);
- vertexBuffer.put(new float[]{
- 1.0f, -0.5f, 0f, // vertex 1
- 0f, 0f, 1f, // normal 1
- 1.5f, -0.5f, 0f, // vertex 2
- 0f, 0f, 1f, // normal 2
- 1.0f, 0.5f, 0f, // vertex 3
- 0f, 0f, 1f // normal 3
- });
- vertexBuffer.position(0);
-
- gl2.glGenBuffers(1, vertexBufferObjects, 0);
- gl2.glBindBuffer(GL2.GL_ARRAY_BUFFER, vertexBufferObjects[0]);
- gl2.glBufferData(GL2.GL_ARRAY_BUFFER, vertexBuffer.capacity() * Buffers.SIZEOF_FLOAT, vertexBuffer, GL2.GL_STATIC_DRAW);
+ System.err.println("Creating vertex VBO on slave 0x"+Integer.toHexString(hashCode()));
+ vertexBufferObjects[0] = createVertexBuffer(gl2);
}
-
+
// A check in the case that buffer sharing is enabled but context sharing is not enabled -- in that
// case, the buffer objects are not shareable, and the blue triangle cannot be rendereds.
// Furthermore, although the calls to bind and draw elements do not cause an error from glGetError
@@ -253,24 +266,22 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
//
gl2.glEnableClientState(GL2.GL_NORMAL_ARRAY);
gl2.glNormalPointer(GL2.GL_FLOAT, 6 * GLBuffers.SIZEOF_FLOAT, 3 * GLBuffers.SIZEOF_FLOAT);
+ } else {
+ System.err.println("Vertex VBO is not a buffer on slave 0x"+Integer.toHexString(hashCode()));
}
if (indexBufferObjects[0] == 0) {
- indexBuffer = GLBuffers.newDirectIntBuffer(3);
- indexBuffer.put(new int[]{0, 1, 2});
- indexBuffer.position(0);
-
- gl2.glGenBuffers(1, indexBufferObjects, 0);
- gl2.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, indexBufferObjects[0]);
- gl2.glBufferData(GL2.GL_ELEMENT_ARRAY_BUFFER, indexBuffer.capacity() * Buffers.SIZEOF_INT, indexBuffer, GL2.GL_STATIC_DRAW);
+ System.err.println("Creating index VBO on slave 0x"+Integer.toHexString(hashCode()));
+ indexBufferObjects[0] = createVertexIndexBuffer(gl2);
}
- // again, a check in the case that buffer sharing is enabled but context sharing is not enabled
+ // again, a check in the case that buffer sharing is enabled but context sharing is not enabled
if (gl2.glIsBuffer(indexBufferObjects[0])) {
gl2.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, indexBufferObjects[0]);
+ } else {
+ System.err.println("Index VBO is not a buffer on slave 0x"+Integer.toHexString(hashCode()));
}
- gl2.glBindVertexArray(0);
gl2.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, 0);
gl2.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0);
gl2.glDisableClientState(GL2.GL_VERTEX_ARRAY);
@@ -291,13 +302,9 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
GL2 gl2 = drawable.getGL().getGL2();
- gl2.glDeleteVertexArrays(1, vertexArrayObjects, 0);
- vertexArrayObjects[0] = 0;
- logAnyErrorCodes(gl2, "display");
-
- // release shared resources
+ // release shared resources
if (initializationCounter == 0 || !useShared) {
- // use either the shared or private vertex buffers, as
+ // use either the shared or private vertex buffers, as
int [] vertexBufferObjects;
int [] indexBufferObjects;
if (useShared) {
@@ -309,10 +316,11 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
}
gl2.glDeleteBuffers(1, vertexBufferObjects, 0);
+ logAnyErrorCodes(this, gl2, "dispose.2");
gl2.glDeleteBuffers(1, indexBufferObjects, 0);
+ logAnyErrorCodes(this, gl2, "dispose.3");
vertexBufferObjects[0] = 0;
indexBufferObjects[0] = 0;
- logAnyErrorCodes(gl2, "display");
}
// release the main thread once for each disposal
@@ -327,7 +335,7 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
// wait until all instances are initialized before attempting to draw using the
// vertex array object, because the buffers are allocated in init and when the
- // buffers are shared, we need to ensure that they are allocated before trying to use thems
+ // buffers are shared, we need to ensure that they are allocated before trying to use them
synchronized (this) {
if (initializationCounter != 2) {
return;
@@ -337,6 +345,8 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
GL2 gl2 = drawable.getGL().getGL2();
GLU glu = new GLU();
+ logAnyErrorCodes(this, gl2, "display.0");
+
// Clear the drawing area
gl2.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
@@ -361,6 +371,8 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
gl2.glDisable(GL2.GL_CULL_FACE);
gl2.glEnable(GL2.GL_DEPTH_TEST);
+ logAnyErrorCodes(this, gl2, "display.1");
+
// draw the triangles
drawTwoTriangles(gl2);
@@ -370,7 +382,7 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
// Flush all drawing operations to the graphics card
gl2.glFlush();
- logAnyErrorCodes(gl2, "display");
+ logAnyErrorCodes(this, gl2, "display.X");
}
public void drawTwoTriangles(GL2 gl2) {
@@ -386,13 +398,15 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
gl2.glNormal3d(0, 0, 1);
gl2.glEnd();
+ logAnyErrorCodes(this, gl2, "drawTwoTriangles.1");
+
// draw the blue triangle using a vertex array object, sharing the vertex and index buffer objects across
// contexts; if context sharing is not initialized, then one window will simply have to live without a blue triangle
//
- // synchronizing to deal with potential liveness issues if the data is intialized from one
+ // synchronizing to deal with potential liveness issues if the data is initialized from one
// thread and used on another
- boolean vaoBound = false;
- // use either the shared or private vertex buffers, as
+ boolean vboBound = false;
+ // use either the shared or private vertex buffers, as
int [] vertexBufferObjects;
int [] indexBufferObjects;
synchronized (this) {
@@ -404,44 +418,65 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
indexBufferObjects = privateIndexBufferObjects;
}
} // synchronized (this)
-
+
// A check in the case that buffer sharing is enabled but context sharing is not enabled -- in that
// case, the buffer objects are not shareable, and the blue triangle cannot be rendereds.
// Furthermore, although the calls to bind and draw elements do not cause an error from glGetError
// when this check is removed, true blue triangle is not rendered anyways, and more importantly,
// I found that with my system glDrawElements causes a runtime exception 50% of the time. Executing the binds
// to unshareable buffers sets up glDrawElements for unpredictable crashes -- sometimes it does, sometimes not.
- if (gl2.glIsVertexArray(vertexArrayObjects[0]) &&
- gl2.glIsBuffer(indexBufferObjects[0]) && gl2.glIsBuffer(vertexBufferObjects[0])) {
- gl2.glBindVertexArray(vertexArrayObjects[0]);
+ final boolean isVBO1 = gl2.glIsBuffer(indexBufferObjects[0]);
+ final boolean isVBO2 = gl2.glIsBuffer(vertexBufferObjects[0]);
+ final boolean useVBO = isVBO1 && isVBO2;
+ if ( useVBO ) {
+ gl2.glBindBuffer(GL2.GL_ARRAY_BUFFER, vertexBufferObjects[0]);
gl2.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, indexBufferObjects[0]);
- vaoBound = true;
+
+ gl2.glEnableClientState(GL2.GL_VERTEX_ARRAY);
+ // gl2.glVertexPointer(3, GL2.GL_FLOAT, 6 * GLBuffers.SIZEOF_FLOAT, 0);
+ gl2.glEnableClientState(GL2.GL_NORMAL_ARRAY);
+ // gl2.glNormalPointer(GL2.GL_FLOAT, 6 * GLBuffers.SIZEOF_FLOAT, 3 * GLBuffers.SIZEOF_FLOAT);
+ vboBound = true;
}
-
- logAnyErrorCodes(gl2, "drawTwoTriangles");
+ // System.err.println("XXX VBO bound "+vboBound+"[ vbo1 "+isVBO1+", vbo2 "+isVBO2+"]");
- if (vaoBound) {
+ logAnyErrorCodes(this, gl2, "drawTwoTriangles.2");
+
+ if (vboBound) {
gl2.glColor3f(0f, 0f, 1f);
gl2.glDrawElements(GL2.GL_TRIANGLES, 3, GL2.GL_UNSIGNED_INT, 0);
- gl2.glBindVertexArray(0);
+ gl2.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0);
gl2.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, 0);
- }
+ gl2.glDisableClientState(GL2.GL_VERTEX_ARRAY);
+ gl2.glDisableClientState(GL2.GL_NORMAL_ARRAY);
+ }
+
+ logAnyErrorCodes(this, gl2, "drawTwoTriangles.3");
}
public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
}
-
+
} // inner class TwoTriangles
- public static void logAnyErrorCodes(GL2 gl2, String prefix) {
- int glError = gl2.glGetError();
- while (glError != GL2.GL_NO_ERROR) {
- System.err.println(prefix + ", OpenGL error: 0x" + Integer.toHexString(glError));
- glError = gl2.glGetError();
+ private static final Set<String> errorSet = new HashSet<String>();
+
+ public static void logAnyErrorCodes(Object obj, GL gl, String prefix) {
+ final int glError = gl.glGetError();
+ if(glError != GL.GL_NO_ERROR) {
+ 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();
+ }
}
- int status = gl2.glCheckFramebufferStatus(GL2.GL_FRAMEBUFFER);
- if (status != GL2.GL_FRAMEBUFFER_COMPLETE) {
- System.err.println(prefix + ", glCheckFramebufferStatus: 0x" + Integer.toHexString(status));
+ final int status = gl.glCheckFramebufferStatus(GL.GL_FRAMEBUFFER);
+ if (status != GL.GL_FRAMEBUFFER_COMPLETE) {
+ 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();
+ }
}
}
@@ -483,22 +518,22 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
}
@Test
- public void testContextSharingCreateVisibleDestroy1() throws InterruptedException, InvocationTargetException {
+ public void test01UseAWTNotShared() throws InterruptedException, InvocationTargetException {
testContextSharingCreateVisibleDestroy(false, false);
}
@Test
- public void testContextSharingCreateVisibleDestroy2() throws InterruptedException, InvocationTargetException {
+ public void test02UseAWTSharedContext() throws InterruptedException, InvocationTargetException {
testContextSharingCreateVisibleDestroy(false, true);
}
@Test
- public void testContextSharingCreateVisibleDestroy3() throws InterruptedException, InvocationTargetException {
+ public void test10UseNEWTNotShared() throws InterruptedException, InvocationTargetException {
testContextSharingCreateVisibleDestroy(true, false);
}
@Test
- public void testContextSharingCreateVisibleDestroy4() throws InterruptedException, InvocationTargetException {
+ public void test11UseNEWTSharedContext() throws InterruptedException, InvocationTargetException {
testContextSharingCreateVisibleDestroy(true, true);
}
@@ -519,15 +554,12 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
glCapabilities.setNumSamples(4);
final GLOffscreenAutoDrawable sharedDrawable;
- final GLContext sharedContext;
if(shareContext) {
sharedDrawable = initShared(glCapabilities);
- sharedContext = sharedDrawable.getContext();
} else {
sharedDrawable = null;
- sharedContext = null;
}
-
+
final TwoTriangles eventListener1 = new TwoTriangles(640, 480, shareContext);
final TwoTriangles eventListener2 = new TwoTriangles(320, 480, shareContext);
@@ -538,12 +570,17 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
if (useNewt) {
GLWindow glWindow1 = GLWindow.create(glCapabilities);
- glWindow1.setSharedContext(sharedContext);
+ if(shareContext) {
+ glWindow1.setSharedAutoDrawable(sharedDrawable);
+ }
NewtCanvasAWT newtCanvasAWT1 = new NewtCanvasAWT(glWindow1);
newtCanvasAWT1.setPreferredSize(new Dimension(eventListener1.canvasWidth, eventListener1.canvasHeight));
glWindow1.addGLEventListener(eventListener1);
//
GLWindow glWindow2 = GLWindow.create(glCapabilities);
+ if(shareContext) {
+ glWindow2.setSharedAutoDrawable(sharedDrawable);
+ }
NewtCanvasAWT newtCanvasAWT2 = new NewtCanvasAWT(glWindow2);
newtCanvasAWT2.setPreferredSize(new Dimension(eventListener2.canvasWidth, eventListener2.canvasHeight));
glWindow2.addGLEventListener(eventListener2);
@@ -560,8 +597,10 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
final GLCanvas canvas2;
if (shareContext) {
- canvas1 = new GLCanvas(glCapabilities, sharedContext);
- canvas2 = new GLCanvas(glCapabilities, sharedContext);
+ canvas1 = new GLCanvas(glCapabilities);
+ canvas1.setSharedAutoDrawable(sharedDrawable);
+ canvas2 = new GLCanvas(glCapabilities);
+ canvas2.setSharedAutoDrawable(sharedDrawable);
} else {
canvas1 = new GLCanvas(glCapabilities);
canvas2 = new GLCanvas(glCapabilities);
@@ -619,8 +658,8 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
viewDistanceFactorSlider.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
- eventListener1.setViewDistanceFactor((float) viewDistanceFactorSlider.getValue() / 10.0f);
- eventListener2.setViewDistanceFactor((float) viewDistanceFactorSlider.getValue() / 10.0f);
+ eventListener1.setViewDistanceFactor(viewDistanceFactorSlider.getValue() / 10.0f);
+ eventListener2.setViewDistanceFactor(viewDistanceFactorSlider.getValue() / 10.0f);
}
});
JLabel viewDistanceFactorLabel = new JLabel("View Distance Factor");
@@ -750,7 +789,7 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
}
Assert.assertEquals(true, disposalSuccesses == 2);
-
+
releaseShared(sharedDrawable);
}
@@ -768,9 +807,9 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
if (++i < args.length) {
durationPerTest = atoi(args[i]);
}
- }
+ }
}
-
+
String testname = TestSharedContextNewtAWTBug523.class.getName();
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
testname,
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 6f108d8..0f4f8fc 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,36 +20,61 @@
* 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.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.GLOffscreenAutoDrawable;
import javax.media.opengl.GLProfile;
-import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.GLAutoDrawableDelegate;
+import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.jogl.demos.es1.GearsES1;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+/**
+ * Sharing the VBO of 3 GearsES1 instances, each in their own GLWindow.
+ * <p>
+ * This is achieved by creating a <i>master</i> GLContext to an offscreen invisible GLAutoDrawable,
+ * which is then shared by the 3 GLContext of the three GLWindow instances.
+ * </p>
+ * <p>
+ * The original VBO is created by attaching a GearsES1 instance to
+ * the <i>master</i> GLAutoDrawable and initializing it.
+ * </p>
+ * <p>
+ * Above method allows random creation of all GLWindow instances.
+ * </p>
+ * <p>
+ * One animator is being used, hence the GLWindow, GLDrawable and GLContext
+ * creation of all 3 GLWindows is sequential.
+ * </p>
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestSharedContextVBOES1NEWT extends UITestCase {
static GLProfile glp;
static GLCapabilities caps;
static int width, height;
- GLOffscreenAutoDrawable sharedDrawable;
+ GLAutoDrawable sharedDrawable;
GearsES1 sharedGears;
@BeforeClass
@@ -66,14 +91,22 @@ public class TestSharedContextVBOES1NEWT extends UITestCase {
}
}
- private void initShared() {
- sharedDrawable = GLDrawableFactory.getFactory(glp).createOffscreenAutoDrawable(null, caps, null, width, height, null);
+ private void initShared() throws InterruptedException {
+ GLDrawable dummyDrawable = GLDrawableFactory.getFactory(glp).createDummyDrawable(null, true /* createNewDevice */, caps, null);
+ dummyDrawable.setRealized(true);
+ sharedDrawable = new GLAutoDrawableDelegate(dummyDrawable, null, null, true /*ownDevice*/, null) { };
Assert.assertNotNull(sharedDrawable);
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(sharedDrawable, true));
+
sharedGears = new GearsES1();
Assert.assertNotNull(sharedGears);
sharedDrawable.addGLEventListener(sharedGears);
// init and render one frame, which will setup the Gears display lists
sharedDrawable.display();
+ final GLContext ctxM = sharedDrawable.getContext();
+ Assert.assertTrue("Master ctx not created", AWTRobotUtil.waitForContextCreated(sharedDrawable, true));
+ Assert.assertTrue("Master Ctx is shared before shared creation", !ctxM.isShared());
+ Assert.assertTrue("Master Gears is shared", !sharedGears.usesSharedGears());
}
private void releaseShared() {
@@ -84,6 +117,7 @@ public class TestSharedContextVBOES1NEWT extends UITestCase {
protected GLWindow runTestGL(Animator animator, int x, int y, boolean useShared, boolean vsync) throws InterruptedException {
GLWindow glWindow = GLWindow.create(caps);
Assert.assertNotNull(glWindow);
+ glWindow.setPosition(x, y);
glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared "+useShared);
if(useShared) {
glWindow.setSharedContext(sharedDrawable.getContext());
@@ -93,7 +127,7 @@ public class TestSharedContextVBOES1NEWT extends UITestCase {
GearsES1 gears = new GearsES1(vsync ? 1 : 0);
if(useShared) {
- gears.setGears(sharedGears.getGear1(), sharedGears.getGear2(), sharedGears.getGear3());
+ gears.setSharedGearsObjects(sharedGears.getGear1(), sharedGears.getGear2(), sharedGears.getGear3());
}
glWindow.addGLEventListener(gears);
@@ -102,9 +136,17 @@ public class TestSharedContextVBOES1NEWT extends UITestCase {
glWindow.setVisible(true);
Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true));
-
- glWindow.setPosition(x, y);
-
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(glWindow, true));
+
+ System.err.println("Master Context: ");
+ MiscUtils.dumpSharedGLContext(sharedDrawable.getContext());
+ System.err.println("New Context: ");
+ MiscUtils.dumpSharedGLContext(glWindow.getContext());
+ if( useShared ) {
+ Assert.assertEquals("Master Context not shared as expected", true, sharedDrawable.getContext().isShared());
+ }
+ Assert.assertEquals("New Context not shared as expected", useShared, glWindow.getContext().isShared());
+ Assert.assertEquals("Gears is not shared as expected", useShared, gears.usesSharedGears());
return glWindow;
}
@@ -114,11 +156,11 @@ public class TestSharedContextVBOES1NEWT extends UITestCase {
Animator animator = new Animator();
GLWindow f1 = runTestGL(animator, 0, 0, true, false);
InsetsImmutable insets = f1.getInsets();
- GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(),
+ GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(),
f1.getY()+0, true, false);
- GLWindow f3 = runTestGL(animator, f1.getX()+0,
- f1.getY()+height+insets.getTotalHeight(), false, true);
- animator.setUpdateFPSFrames(1, null);
+ GLWindow f3 = runTestGL(animator, f1.getX()+0,
+ f1.getY()+height+insets.getTotalHeight(), false, true);
+ animator.setUpdateFPSFrames(1, null);
animator.start();
while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
Thread.sleep(100);
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
new file mode 100644
index 0000000..3b576fa
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3.java
@@ -0,0 +1,413 @@
+/**
+ * Copyright 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:
+ *
+ * 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.acore;
+
+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.util.Animator;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+/**
+ * Sharing the VBO of 3 GearsES2 instances, each in their own AWT GLCanvas.
+ * <p>
+ * This is achieved by using the 1st GLCanvas as the <i>master</i>
+ * and using the build-in blocking mechanism to postpone creation
+ * of the 2nd and 3rd GLCanvas until the 1st GLCanvas's GLContext becomes created.
+ * </p>
+ * <p>
+ * Above method allows random creation of the 1st GLCanvas, which triggers
+ * creation of the <i>dependent</i> other GLCanvas sharing it's GLContext.
+ * </p>
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestSharedContextVBOES2AWT3 extends UITestCase {
+ static GLProfile glp;
+ static GLCapabilities caps;
+ static int width, height;
+
+ @BeforeClass
+ public static void initClass() {
+ if(GLProfile.isAvailable(GLProfile.GL2ES2)) {
+ glp = GLProfile.get(GLProfile.GL2ES2);
+ Assert.assertNotNull(glp);
+ caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ width = 256;
+ height = 256;
+ } else {
+ setTestSupported(false);
+ }
+ }
+
+ protected GLCanvas createGLCanvas(final Frame frame, int x, int y, GearsES2 gears) throws InterruptedException {
+ final GLCanvas glCanvas = new GLCanvas(caps);
+ Assert.assertNotNull(glCanvas);
+ glCanvas.addGLEventListener(gears);
+ frame.add(glCanvas);
+ frame.setLocation(x, y);
+ frame.setSize(width, height);
+ frame.setTitle("AWT GLCanvas Shared Gears Test: "+x+"/"+y+" shared true");
+ return glCanvas;
+ }
+
+ @Test
+ public void test01SyncedOneAnimatorCleanDtorOrder() throws InterruptedException, InvocationTargetException {
+ syncedOneAnimator(true);
+ }
+
+ @Test
+ public void test02SyncedOneAnimatorDirtyDtorOrder() throws InterruptedException, InvocationTargetException {
+ syncedOneAnimator(false);
+ }
+
+ public void syncedOneAnimator(final boolean destroyCleanOrder) throws InterruptedException, InvocationTargetException {
+ final Frame f1 = new Frame();
+ final Animator animator = new Animator();
+ final GearsES2 g1 = new GearsES2(0);
+ final GLCanvas c1 = createGLCanvas(f1, 0, 0, g1);
+ animator.add(c1);
+
+ final Frame f2 = new Frame();
+ final GearsES2 g2 = new GearsES2(0);
+ g2.setSharedGears(g1);
+ final GLCanvas c2 = createGLCanvas(f2, f1.getX()+width,
+ f1.getY()+0, g2);
+ c2.setSharedAutoDrawable(c1);
+ animator.add(c2);
+
+ final Frame f3 = new Frame();
+ final GearsES2 g3 = new GearsES2(0);
+ g3.setSharedGears(g1);
+ final GLCanvas c3 = createGLCanvas(f3, f1.getX()+0,
+ f1.getY()+height, g3);
+ c3.setSharedAutoDrawable(c1);
+ animator.add(c3);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ f2.setVisible(true); // shall wait until f1 is ready
+ f1.setVisible(true); // master ..
+ f3.setVisible(true); // shall wait until f1 is ready
+ } } );
+ animator.start(); // kicks off GLContext .. and hence gears of f2 + f3 completion
+
+ Thread.sleep(1000/60*10); // wait ~10 frames giving a chance to create (blocking until master share is valid)
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
+ Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true));
+ Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true));
+ Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
+
+ final GLContext ctx1 = c1.getContext();
+ final GLContext ctx2 = c2.getContext();
+ final GLContext ctx3 = c3.getContext();
+ {
+ final List<GLContext> ctx1Shares = ctx1.getCreatedShares();
+ final List<GLContext> ctx2Shares = ctx2.getCreatedShares();
+ final List<GLContext> ctx3Shares = ctx3.getCreatedShares();
+ System.err.println("XXX-C-3.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-C-3.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+ System.err.println("XXX-C-3.3:");
+ MiscUtils.dumpSharedGLContext(ctx3);
+
+ Assert.assertTrue("Ctx1 is not shared", ctx1.isShared());
+ Assert.assertTrue("Ctx2 is not shared", ctx2.isShared());
+ Assert.assertTrue("Ctx3 is not shared", ctx3.isShared());
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 2, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 2, ctx2Shares.size());
+ Assert.assertEquals("Ctx3 has unexpected number of created shares", 2, ctx3Shares.size());
+ }
+
+ Assert.assertTrue("Gears1 is shared", !g1.usesSharedGears());
+ Assert.assertTrue("Gears2 is not shared", g2.usesSharedGears());
+ Assert.assertTrue("Gears3 is not shared", g3.usesSharedGears());
+
+ try {
+ Thread.sleep(duration);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ // Stopped animator allows native windowing system 'repaint' event
+ // to trigger GLAD 'display'
+ animator.stop();
+ Assert.assertEquals(false, animator.isAnimating());
+
+ if( destroyCleanOrder ) {
+ System.err.println("XXX Destroy in clean order NOW");
+ } else {
+ System.err.println("XXX Destroy in creation order NOW - Driver Impl. Ma trigger driver Bug i.e. not postponing GL ctx destruction after releasing all refs.");
+ }
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ try {
+ if( destroyCleanOrder ) {
+ f3.dispose();
+ } else {
+ f1.dispose();
+ }
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }});
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ try {
+ if( destroyCleanOrder ) {
+ f2.dispose();
+ } else {
+ f2.dispose();
+ }
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }});
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ try {
+ if( destroyCleanOrder ) {
+ f1.dispose();
+ } else {
+ f3.dispose();
+ }
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }});
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false));
+ }
+
+ @Test
+ public void test11AsyncEachAnimatorCleanDtorOrder() throws InterruptedException, InvocationTargetException {
+ syncedOneAnimator(true);
+ }
+
+ @Test
+ public void test12AsyncEachAnimatorDirtyDtorOrder() throws InterruptedException, InvocationTargetException {
+ asyncEachOneAnimator(false);
+ }
+
+ public void asyncEachOneAnimator(final boolean destroyCleanOrder) throws InterruptedException, InvocationTargetException {
+ final Frame f1 = new Frame();
+ final Animator a1 = new Animator();
+ final GearsES2 g1 = new GearsES2(0);
+ final GLCanvas c1 = createGLCanvas(f1, 0, 0, g1);
+ a1.add(c1);
+ a1.start();
+ // f1.setVisible(true); // we do this post f2 .. to test pending creation!
+
+ final Frame f2 = new Frame();
+ final Animator a2 = new Animator();
+ final GearsES2 g2 = new GearsES2(0);
+ g2.setSharedGears(g1);
+ final GLCanvas c2 = createGLCanvas(f2, f1.getX()+width, f1.getY()+0, g2);
+ c2.setSharedAutoDrawable(c1);
+ a2.add(c2);
+ a2.start();
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ f2.setVisible(true);
+ } } );
+
+ Thread.sleep(200); // wait a while ..
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ f1.setVisible(true); // test pending creation of f2
+ } } );
+
+ final Frame f3 = new Frame();
+ final Animator a3 = new Animator();
+ final GearsES2 g3 = new GearsES2(0);
+ g3.setSharedGears(g1);
+ final GLCanvas c3 = createGLCanvas(f3, f1.getX()+0, f1.getY()+height, g3);
+ c3.setSharedAutoDrawable(c1);
+ a3.add(c3);
+ a3.start();
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ f3.setVisible(true);
+ } } );
+
+ Thread.sleep(1000/60*10); // wait ~10 frames giving a chance to create (blocking until master share is valid)
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
+ Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true));
+ Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true));
+ Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
+
+ final GLContext ctx1 = c1.getContext();
+ final GLContext ctx2 = c2.getContext();
+ final GLContext ctx3 = c3.getContext();
+ {
+ final List<GLContext> ctx1Shares = ctx1.getCreatedShares();
+ final List<GLContext> ctx2Shares = ctx2.getCreatedShares();
+ final List<GLContext> ctx3Shares = ctx3.getCreatedShares();
+ System.err.println("XXX-C-3.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-C-3.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+ System.err.println("XXX-C-3.3:");
+ MiscUtils.dumpSharedGLContext(ctx3);
+
+ Assert.assertTrue("Ctx1 is not shared", ctx1.isShared());
+ Assert.assertTrue("Ctx2 is not shared", ctx2.isShared());
+ Assert.assertTrue("Ctx3 is not shared", ctx3.isShared());
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 2, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 2, ctx2Shares.size());
+ Assert.assertEquals("Ctx3 has unexpected number of created shares", 2, ctx3Shares.size());
+ }
+
+ Assert.assertTrue("Gears1 is shared", !g1.usesSharedGears());
+ Assert.assertTrue("Gears2 is not shared", g2.usesSharedGears());
+ Assert.assertTrue("Gears3 is not shared", g3.usesSharedGears());
+
+ try {
+ Thread.sleep(duration);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ // Stopped animator allows native windowing system 'repaint' event
+ // to trigger GLAD 'display'
+ a1.stop();
+ Assert.assertEquals(false, a1.isAnimating());
+ a2.stop();
+ Assert.assertEquals(false, a2.isAnimating());
+ a3.stop();
+ Assert.assertEquals(false, a3.isAnimating());
+
+ if( destroyCleanOrder ) {
+ System.err.println("XXX Destroy in clean order NOW");
+ } else {
+ System.err.println("XXX Destroy in creation order NOW - Driver Impl. Ma trigger driver Bug i.e. not postponing GL ctx destruction after releasing all refs.");
+ }
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ try {
+ if( destroyCleanOrder ) {
+ f3.dispose();
+ } else {
+ f1.dispose();
+ }
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }});
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ try {
+ if( destroyCleanOrder ) {
+ f2.dispose();
+ } else {
+ f2.dispose();
+ }
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }});
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ try {
+ if( destroyCleanOrder ) {
+ f1.dispose();
+ } else {
+ f3.dispose();
+ }
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }});
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false));
+ }
+
+ static long duration = 1000; // ms
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ try {
+ duration = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ }
+ }
+ /**
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ System.err.println("Press enter to continue");
+ System.err.println(stdin.readLine()); */
+ org.junit.runner.JUnitCore.main(TestSharedContextVBOES2AWT3.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..d4079e3
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3b.java
@@ -0,0 +1,329 @@
+/**
+ * Copyright 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:
+ *
+ * 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.acore;
+
+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.util.Animator;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+/**
+ * Sharing the VBO of 3 GearsES2 instances, each in their own AWT GLJPanel.
+ * <p>
+ * This is achieved by using the 1st GLJPanel as the <i>master</i>
+ * and using the build-in blocking mechanism to postpone creation
+ * of the 2nd and 3rd GLJPanel until the 1st GLJPanel 's GLContext becomes created.
+ * </p>
+ * <p>
+ * Above method allows random creation of the 1st GLJPanel, which triggers
+ * creation of the <i>dependent</i> other GLJPanel sharing it's GLContext.
+ * </p>
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestSharedContextVBOES2AWT3b extends UITestCase {
+ static GLProfile glp;
+ static GLCapabilities caps;
+ static int width, height;
+
+ @BeforeClass
+ public static void initClass() {
+ if(GLProfile.isAvailable(GLProfile.GL2ES2)) {
+ glp = GLProfile.get(GLProfile.GL2ES2);
+ Assert.assertNotNull(glp);
+ caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ width = 256;
+ height = 256;
+ } else {
+ setTestSupported(false);
+ }
+ }
+
+ protected GLJPanel createGLJPanel(final Frame frame, int x, int y, GearsES2 gears) throws InterruptedException {
+ final GLJPanel glCanvas = new GLJPanel(caps);
+ Assert.assertNotNull(glCanvas);
+ glCanvas.addGLEventListener(gears);
+ frame.add(glCanvas);
+ frame.setLocation(x, y);
+ frame.setSize(width, height);
+ frame.setTitle("AWT GLJPanel Shared Gears Test: "+x+"/"+y+" shared true");
+ return glCanvas;
+ }
+
+ @Test
+ public void test01SyncedOneAnimator() throws InterruptedException, InvocationTargetException {
+ final Frame f1 = new Frame();
+ final Animator animator = new Animator();
+ final GearsES2 g1 = new GearsES2(0);
+ final GLJPanel c1 = createGLJPanel(f1, 0, 0, g1);
+ animator.add(c1);
+
+ final Frame f2 = new Frame();
+ final GearsES2 g2 = new GearsES2(0);
+ g2.setSharedGears(g1);
+ final GLJPanel c2 = createGLJPanel(f2, f1.getX()+width,
+ f1.getY()+0, g2);
+ c2.setSharedAutoDrawable(c1);
+ animator.add(c2);
+
+ final Frame f3 = new Frame();
+ final GearsES2 g3 = new GearsES2(0);
+ g3.setSharedGears(g1);
+ final GLJPanel c3 = createGLJPanel(f3, f1.getX()+0,
+ f1.getY()+height, g3);
+ c3.setSharedAutoDrawable(c1);
+ animator.add(c3);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ f2.setVisible(true); // shall wait until f1 is ready
+ f1.setVisible(true); // master ..
+ f3.setVisible(true); // shall wait until f1 is ready
+ } } );
+ animator.start(); // kicks off GLContext .. and hence gears of f2 + f3 completion
+
+ Thread.sleep(1000/60*10); // wait ~10 frames giving a chance to create (blocking until master share is valid)
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
+ Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true));
+ Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true));
+ Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
+
+ final GLContext ctx1 = c1.getContext();
+ final GLContext ctx2 = c2.getContext();
+ final GLContext ctx3 = c3.getContext();
+ {
+ final List<GLContext> ctx1Shares = ctx1.getCreatedShares();
+ final List<GLContext> ctx2Shares = ctx2.getCreatedShares();
+ final List<GLContext> ctx3Shares = ctx3.getCreatedShares();
+ System.err.println("XXX-C-3.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-C-3.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+ System.err.println("XXX-C-3.3:");
+ MiscUtils.dumpSharedGLContext(ctx3);
+
+ Assert.assertTrue("Ctx1 is not shared", ctx1.isShared());
+ Assert.assertTrue("Ctx2 is not shared", ctx2.isShared());
+ Assert.assertTrue("Ctx3 is not shared", ctx3.isShared());
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 2, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 2, ctx2Shares.size());
+ Assert.assertEquals("Ctx3 has unexpected number of created shares", 2, ctx3Shares.size());
+ }
+
+ Assert.assertTrue("Gears1 is shared", !g1.usesSharedGears());
+ Assert.assertTrue("Gears2 is not shared", g2.usesSharedGears());
+ Assert.assertTrue("Gears3 is not shared", g3.usesSharedGears());
+
+ try {
+ Thread.sleep(duration);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ // Stopped animator allows native windowing system 'repaint' event
+ // to trigger GLAD 'display'
+ animator.stop();
+ Assert.assertEquals(false, animator.isAnimating());
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ try {
+ f3.dispose();
+ f2.dispose();
+ f1.dispose();
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }});
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false));
+ }
+
+ @Test
+ public void test02AsyncEachAnimator() throws InterruptedException, InvocationTargetException {
+ final Frame f1 = new Frame();
+ final Animator a1 = new Animator();
+ final GearsES2 g1 = new GearsES2(0);
+ final GLJPanel c1 = createGLJPanel(f1, 0, 0, g1);
+ a1.add(c1);
+ a1.start();
+ // f1.setVisible(true); // we do this post f2 .. to test pending creation!
+
+ final Frame f2 = new Frame();
+ final Animator a2 = new Animator();
+ final GearsES2 g2 = new GearsES2(0);
+ g2.setSharedGears(g1);
+ final GLJPanel c2 = createGLJPanel(f2, f1.getX()+width, f1.getY()+0, g2);
+ c2.setSharedAutoDrawable(c1);
+ a2.add(c2);
+ a2.start();
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ f2.setVisible(true);
+ } } );
+
+ Thread.sleep(200); // wait a while ..
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ f1.setVisible(true); // test pending creation of f2
+ } } );
+
+ final Frame f3 = new Frame();
+ final Animator a3 = new Animator();
+ final GearsES2 g3 = new GearsES2(0);
+ g3.setSharedGears(g1);
+ final GLJPanel c3 = createGLJPanel(f3, f1.getX()+0, f1.getY()+height, g3);
+ c3.setSharedAutoDrawable(c1);
+ a3.add(c3);
+ a3.start();
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ f3.setVisible(true);
+ } } );
+
+ Thread.sleep(1000/60*10); // wait ~10 frames giving a chance to create (blocking until master share is valid)
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
+ Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true));
+ Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true));
+ Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
+
+ final GLContext ctx1 = c1.getContext();
+ final GLContext ctx2 = c2.getContext();
+ final GLContext ctx3 = c3.getContext();
+ {
+ final List<GLContext> ctx1Shares = ctx1.getCreatedShares();
+ final List<GLContext> ctx2Shares = ctx2.getCreatedShares();
+ final List<GLContext> ctx3Shares = ctx3.getCreatedShares();
+ System.err.println("XXX-C-3.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-C-3.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+ System.err.println("XXX-C-3.3:");
+ MiscUtils.dumpSharedGLContext(ctx3);
+
+ Assert.assertTrue("Ctx1 is not shared", ctx1.isShared());
+ Assert.assertTrue("Ctx2 is not shared", ctx2.isShared());
+ Assert.assertTrue("Ctx3 is not shared", ctx3.isShared());
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 2, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 2, ctx2Shares.size());
+ Assert.assertEquals("Ctx3 has unexpected number of created shares", 2, ctx3Shares.size());
+ }
+
+ Assert.assertTrue("Gears1 is shared", !g1.usesSharedGears());
+ Assert.assertTrue("Gears2 is not shared", g2.usesSharedGears());
+ Assert.assertTrue("Gears3 is not shared", g3.usesSharedGears());
+
+ try {
+ Thread.sleep(duration);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ // Stopped animator allows native windowing system 'repaint' event
+ // to trigger GLAD 'display'
+ a1.stop();
+ Assert.assertEquals(false, a1.isAnimating());
+ a2.stop();
+ Assert.assertEquals(false, a2.isAnimating());
+ a3.stop();
+ Assert.assertEquals(false, a3.isAnimating());
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ try {
+ f3.dispose();
+ f2.dispose();
+ f1.dispose();
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ }});
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false));
+ }
+
+ static long duration = 1000; // ms
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ try {
+ duration = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ }
+ }
+ /**
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ System.err.println("Press enter to continue");
+ System.err.println(stdin.readLine()); */
+ org.junit.runner.JUnitCore.main(TestSharedContextVBOES2AWT3b.class.getName());
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT.java
deleted file mode 100644
index 4aa977a..0000000
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/**
- * Copyright 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:
- *
- * 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.acore;
-
-import com.jogamp.common.os.Platform;
-import com.jogamp.common.util.VersionNumber;
-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.GLDrawableFactory;
-import javax.media.opengl.GLProfile;
-import com.jogamp.opengl.util.Animator;
-
-import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
-import com.jogamp.opengl.test.junit.util.UITestCase;
-import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
-
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class TestSharedContextVBOES2NEWT extends UITestCase {
- static GLProfile glp;
- static GLCapabilities caps;
- static int width, height;
- GLAutoDrawable sharedDrawable;
- GearsES2 sharedGears;
-
- @BeforeClass
- public static void initClass() {
- if(GLProfile.isAvailable(GLProfile.GL2ES2)) {
- glp = GLProfile.get(GLProfile.GL2ES2);
- Assert.assertNotNull(glp);
- caps = new GLCapabilities(glp);
- Assert.assertNotNull(caps);
- width = 256;
- height = 256;
- } else {
- setTestSupported(false);
- }
- }
-
- private void initShared(boolean onscreen) {
- if(onscreen) {
- GLWindow glWindow = GLWindow.create(caps);
- Assert.assertNotNull(glWindow);
- glWindow.setSize(width, height);
- glWindow.setVisible(true);
- sharedDrawable = glWindow;
- } else {
- sharedDrawable = GLDrawableFactory.getFactory(glp).createOffscreenAutoDrawable(null, caps, null, width, height, null);
- }
- Assert.assertNotNull(sharedDrawable);
- sharedGears = new GearsES2();
- Assert.assertNotNull(sharedGears);
- sharedDrawable.addGLEventListener(sharedGears);
- // init and render one frame, which will setup the Gears display lists
- sharedDrawable.display();
- }
-
- private void releaseShared() {
- Assert.assertNotNull(sharedDrawable);
- sharedDrawable.destroy();
- sharedDrawable = null;
- }
-
- protected GLWindow runTestGL(Animator animator, int x, int y, boolean useShared, boolean vsync) throws InterruptedException {
- GLWindow glWindow = GLWindow.create(caps);
- Assert.assertNotNull(glWindow);
- glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared "+useShared);
- if(useShared) {
- glWindow.setSharedContext(sharedDrawable.getContext());
- }
-
- glWindow.setSize(width, height);
-
- GearsES2 gears = new GearsES2(vsync ? 1 : 0);
- if(useShared) {
- gears.setGears(sharedGears.getGear1(), sharedGears.getGear2(), sharedGears.getGear3());
- }
- glWindow.addGLEventListener(gears);
-
- animator.add(glWindow);
- animator.start();
- glWindow.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true));
-
- glWindow.setPosition(x, y);
-
- return glWindow;
- }
-
- @Test
- public void testCommonAnimatorSharedOnscreen() throws InterruptedException {
- initShared(true);
- Animator animator = new Animator();
- GLWindow f1 = runTestGL(animator, 0, 0, true, false);
- InsetsImmutable insets = f1.getInsets();
- GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(),
- f1.getY()+0, true, false);
- GLWindow f3 = runTestGL(animator, f1.getX()+0,
- f1.getY()+height+insets.getTotalHeight(), true, false);
- try {
- Thread.sleep(duration);
- } catch(Exception e) {
- e.printStackTrace();
- }
- animator.stop();
-
- f1.destroy();
- f2.destroy();
- f3.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
-
- releaseShared();
- }
-
- @Test
- public void testCommonAnimatorSharedOffscreen() throws InterruptedException {
- initShared(false);
- Animator animator = new Animator();
- GLWindow f1 = runTestGL(animator, 0, 0, true, false);
- InsetsImmutable insets = f1.getInsets();
- GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(),
- f1.getY()+0, true, false);
- GLWindow f3 = runTestGL(animator, f1.getX()+0,
- f1.getY()+height+insets.getTotalHeight(), true, false);
- try {
- Thread.sleep(duration);
- } catch(Exception e) {
- e.printStackTrace();
- }
- animator.stop();
-
- f1.destroy();
- f2.destroy();
- f3.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
-
- releaseShared();
- }
-
- @Test
- public void testEachWithAnimatorSharedOffscreen() throws InterruptedException {
- VersionNumber osx1070 = new VersionNumber(10,7,0);
- if( Platform.getOSType() == Platform.OSType.MACOS && Platform.getOSVersionNumber().compareTo(osx1070) > 0 ) {
- // instable on OSX .. driver/OS bug when multi threading (3 animator)
- System.err.println("Shared context w/ 3 context each running in there own thread is instable here on OSX 10.7.4/NVidia,");
- System.err.println("SIGSEGV @ glDrawArrays / glBindBuffer .. any shared VBO.");
- System.err.println("Seems to run fine on 10.6.8/NVidia.");
- return;
- }
- initShared(false);
- Animator animator1 = new Animator();
- Animator animator2 = new Animator();
- Animator animator3 = new Animator();
- GLWindow f1 = runTestGL(animator1, 0, 0, true, false);
- InsetsImmutable insets = f1.getInsets();
- GLWindow f2 = runTestGL(animator2, f1.getX()+width+insets.getTotalWidth(),
- f1.getY()+0, true, false);
- GLWindow f3 = runTestGL(animator3, f1.getX()+0,
- f1.getY()+height+insets.getTotalHeight(), true, false);
-
- try {
- Thread.sleep(duration);
- } catch(Exception e) {
- e.printStackTrace();
- }
- animator1.stop();
- animator2.stop();
- animator3.stop();
-
- f1.destroy();
- f2.destroy();
- f3.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
-
- releaseShared();
- }
-
- static long duration = 2000; // ms
-
- public static void main(String args[]) {
- for(int i=0; i<args.length; i++) {
- if(args[i].equals("-time")) {
- i++;
- try {
- duration = Integer.parseInt(args[i]);
- } catch (Exception ex) { ex.printStackTrace(); }
- }
- }
- /**
- BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
- System.err.println("Press enter to continue");
- System.err.println(stdin.readLine()); */
- org.junit.runner.JUnitCore.main(TestSharedContextVBOES2NEWT.class.getName());
- }
-}
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
new file mode 100644
index 0000000..a8c069f
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java
@@ -0,0 +1,270 @@
+/**
+ * Copyright 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:
+ *
+ * 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.acore;
+
+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.opengl.util.Animator;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+/**
+ * Sharing the VBO of 3 GearsES2 instances, each in their own GLWindow.
+ * <p>
+ * This is achieved by relying on the sequential creation
+ * of the 3 GLWindows with their GLDrawable and GLContext.
+ * </p>
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestSharedContextVBOES2NEWT0 extends UITestCase {
+ static GLProfile glp;
+ static GLCapabilities caps;
+ static int width, height;
+
+ @BeforeClass
+ public static void initClass() {
+ if(GLProfile.isAvailable(GLProfile.GL2ES2)) {
+ glp = GLProfile.get(GLProfile.GL2ES2);
+ Assert.assertNotNull(glp);
+ caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ width = 256;
+ height = 256;
+ } else {
+ setTestSupported(false);
+ }
+ }
+
+ protected GLWindow runTestGL(Animator animator, int x, int y, GearsES2 gears, GLContext sharedContext) throws InterruptedException {
+ final boolean useShared = null != sharedContext;
+ GLWindow glWindow = GLWindow.create(caps);
+ Assert.assertNotNull(glWindow);
+ glWindow.setPosition(x, y);
+ glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared "+useShared);
+ if(useShared) {
+ glWindow.setSharedContext(sharedContext);
+ }
+ glWindow.setSize(width, height);
+ glWindow.addGLEventListener(gears);
+
+ animator.add(glWindow);
+ glWindow.setVisible(true);
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true));
+ glWindow.display();
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(glWindow, true));
+ Assert.assertTrue("Gears not initialized", gears.waitForInit(true));
+
+ return glWindow;
+ }
+
+ @Test
+ public void testCommonAnimatorShared() throws InterruptedException {
+ final Animator animator = new Animator();
+
+ //
+ // 1st
+ //
+ final GearsES2 g1 = new GearsES2(0);
+ final GLWindow f1 = runTestGL(animator, 0, 0, g1, null);
+ final GLContext ctx1 = f1.getContext();
+ Assert.assertTrue("Ctx is shared before shared creation", !ctx1.isShared());
+ final InsetsImmutable insets = f1.getInsets();
+
+ System.err.println("XXX-C-2.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+
+ //
+ // 2nd
+ //
+ final GearsES2 g2 = new GearsES2(0);
+ g2.setSharedGearsObjects(g1.getGear1(), g1.getGear2(), g1.getGear3());
+ final GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(),
+ f1.getY()+0, g2, f1.getContext());
+ final GLContext ctx2 = f2.getContext();
+ Assert.assertTrue("Ctx1 is not shared", ctx1.isShared());
+ Assert.assertTrue("Ctx2 is not shared", ctx2.isShared());
+
+ {
+ final List<GLContext> ctx1Shares = ctx1.getCreatedShares();
+ final List<GLContext> ctx2Shares = ctx2.getCreatedShares();
+ System.err.println("XXX-C-2.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-C-2.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 1, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 1, ctx2Shares.size());
+ }
+
+ //
+ // 3rd
+ //
+ final GearsES2 g3 = new GearsES2(0);
+ g3.setSharedGearsObjects(g1.getGear1(), g1.getGear2(), g1.getGear3());
+ final GLWindow f3 = runTestGL(animator, f1.getX()+0,
+ f1.getY()+height+insets.getTotalHeight(), g3, f1.getContext());
+
+ final GLContext ctx3 = f3.getContext();
+ Assert.assertTrue("Ctx1 is not shared", ctx1.isShared());
+ Assert.assertTrue("Ctx2 is not shared", ctx2.isShared());
+ Assert.assertTrue("Ctx3 is not shared", ctx3.isShared());
+
+ {
+ final List<GLContext> ctx1Shares = ctx1.getCreatedShares();
+ final List<GLContext> ctx2Shares = ctx2.getCreatedShares();
+ final List<GLContext> ctx3Shares = ctx3.getCreatedShares();
+ System.err.println("XXX-C-3.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-C-3.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+ System.err.println("XXX-C-3.3:");
+ MiscUtils.dumpSharedGLContext(ctx3);
+
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 2, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 2, ctx2Shares.size());
+ Assert.assertEquals("Ctx3 has unexpected number of created shares", 2, ctx3Shares.size());
+ }
+
+ Assert.assertTrue("Gears1 is shared", !g1.usesSharedGears());
+ Assert.assertTrue("Gears2 is not shared", g2.usesSharedGears());
+ Assert.assertTrue("Gears3 is not shared", g3.usesSharedGears());
+
+ animator.start();
+
+ try {
+ Thread.sleep(duration);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ animator.stop();
+
+ f1.destroy();
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false));
+ {
+ final List<GLContext> ctx1Shares = ctx1.getCreatedShares();
+ final List<GLContext> ctx2Shares = ctx2.getCreatedShares();
+ final List<GLContext> ctx3Shares = ctx3.getCreatedShares();
+ System.err.println("XXX-D-2.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-D-2.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+ System.err.println("XXX-D-2.3:");
+ MiscUtils.dumpSharedGLContext(ctx3);
+
+ Assert.assertTrue("Ctx1 is not shared", ctx1.isShared());
+ Assert.assertTrue("Ctx2 is not shared", ctx2.isShared());
+ Assert.assertTrue("Ctx3 is not shared", ctx3.isShared());
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 2, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 1, ctx2Shares.size());
+ Assert.assertEquals("Ctx3 has unexpected number of created shares", 1, ctx3Shares.size());
+ }
+
+ f2.destroy();
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false));
+ {
+ final List<GLContext> ctx1Shares = ctx1.getCreatedShares();
+ final List<GLContext> ctx2Shares = ctx2.getCreatedShares();
+ final List<GLContext> ctx3Shares = ctx3.getCreatedShares();
+ System.err.println("XXX-D-1.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-D-1.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+ System.err.println("XXX-D-1.3:");
+ MiscUtils.dumpSharedGLContext(ctx3);
+
+ Assert.assertTrue("Ctx1 is not shared", ctx1.isShared());
+ Assert.assertTrue("Ctx2 is not shared", ctx2.isShared());
+ Assert.assertTrue("Ctx3 is not shared", ctx3.isShared());
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 1, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 1, ctx2Shares.size());
+ Assert.assertEquals("Ctx3 has unexpected number of created shares", 0, ctx3Shares.size());
+ }
+
+ f3.destroy();
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false));
+ {
+ final List<GLContext> ctx1Shares = ctx1.getCreatedShares();
+ final List<GLContext> ctx2Shares = ctx2.getCreatedShares();
+ final List<GLContext> ctx3Shares = ctx3.getCreatedShares();
+ System.err.println("XXX-D-0.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-D-0.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+ System.err.println("XXX-D-0.3:");
+ MiscUtils.dumpSharedGLContext(ctx3);
+
+ Assert.assertTrue("Ctx1 is shared", !ctx1.isShared());
+ Assert.assertTrue("Ctx2 is shared", !ctx2.isShared());
+ Assert.assertTrue("Ctx3 is shared", !ctx3.isShared());
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 0, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 0, ctx2Shares.size());
+ Assert.assertEquals("Ctx3 has unexpected number of created shares", 0, ctx3Shares.size());
+ }
+ }
+
+ static long duration = 1000; // ms
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ try {
+ duration = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ }
+ }
+ /**
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ System.err.println("Press enter to continue");
+ System.err.println(stdin.readLine()); */
+ org.junit.runner.JUnitCore.main(TestSharedContextVBOES2NEWT0.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..7051bac
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java
@@ -0,0 +1,293 @@
+/**
+ * Copyright 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:
+ *
+ * 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.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.opengl.util.Animator;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+/**
+ * Sharing the VBO of 3 GearsES2 instances, each in their own GLWindow.
+ * <p>
+ * This is achieved by creating a <i>master</i> GLContext to an offscreen invisible GLAutoDrawable,
+ * which is then shared by the 3 GLContext of the three GLWindow instances.
+ * </p>
+ * <p>
+ * The original VBO is created by attaching a GearsES2 instance to
+ * the <i>master</i> GLAutoDrawable and initializing it.
+ * </p>
+ * <p>
+ * Above method allows random creation of all GLWindow instances.
+ * </p>
+ * <p>
+ * One tests uses only one animator, where the GLWindow, GLDrawable and GLContext
+ * creation of all 3 GLWindows is sequential.
+ * </p>
+ * <p>
+ * Another tests uses 3 animator, one for each GLWindow,
+ * where the GLWindow, GLDrawable and GLContext creation
+ * of all 3 GLWindows is <i>random</i>.
+ * This fact benefits from the <i>master</i> GLContext/GLAutoDrawable,
+ * since it is guaranteed it exist and is realized at the time of the <i>shared</i>
+ * GLWindow creation.
+ * </p>
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestSharedContextVBOES2NEWT1 extends UITestCase {
+ static GLProfile glp;
+ static GLCapabilities caps;
+ static int width, height;
+ GLAutoDrawable sharedDrawable;
+ GearsES2 sharedGears;
+
+ @BeforeClass
+ public static void initClass() {
+ if(GLProfile.isAvailable(GLProfile.GL2ES2)) {
+ glp = GLProfile.get(GLProfile.GL2ES2);
+ Assert.assertNotNull(glp);
+ caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ width = 256;
+ height = 256;
+ } else {
+ setTestSupported(false);
+ }
+ }
+
+ private void initShared(boolean onscreen) throws InterruptedException {
+ if(onscreen) {
+ GLWindow glWindow = GLWindow.create(caps);
+ Assert.assertNotNull(glWindow);
+ glWindow.setSize(width, height);
+ glWindow.setVisible(true);
+ sharedDrawable = glWindow;
+ } else {
+ sharedDrawable = GLDrawableFactory.getFactory(glp).createDummyAutoDrawable(null, true /* createNewDevice */, caps, null);
+ }
+ Assert.assertNotNull(sharedDrawable);
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(sharedDrawable, true));
+
+ sharedGears = new GearsES2();
+ Assert.assertNotNull(sharedGears);
+ sharedDrawable.addGLEventListener(sharedGears);
+ // init and render one frame, which will setup the Gears display lists
+ sharedDrawable.display();
+ final GLContext ctxM = sharedDrawable.getContext();
+ Assert.assertTrue("Master ctx not created", AWTRobotUtil.waitForContextCreated(sharedDrawable, true));
+ Assert.assertTrue("Master Ctx is shared before shared creation", !ctxM.isShared());
+ Assert.assertTrue("Master Gears not initialized", sharedGears.waitForInit(true));
+ System.err.println("Master Gears Init done: "+sharedGears);
+ Assert.assertTrue("Master Gears is shared", !sharedGears.usesSharedGears());
+ }
+
+ private void releaseShared() {
+ Assert.assertNotNull(sharedDrawable);
+ sharedDrawable.destroy();
+ sharedDrawable = null;
+ }
+
+ protected GLWindow runTestGL(Animator animator, int x, int y, boolean useShared, boolean vsync) throws InterruptedException {
+ GLWindow glWindow = GLWindow.create(caps);
+ Assert.assertNotNull(glWindow);
+ glWindow.setPosition(x, y);
+ glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared "+useShared);
+ if(useShared) {
+ glWindow.setSharedContext(sharedDrawable.getContext());
+ }
+
+ glWindow.setSize(width, height);
+
+ GearsES2 gears = new GearsES2(vsync ? 1 : 0);
+ if(useShared) {
+ gears.setSharedGearsObjects(sharedGears.getGear1(), sharedGears.getGear2(), sharedGears.getGear3());
+ }
+ glWindow.addGLEventListener(gears);
+
+ animator.add(glWindow);
+ animator.start();
+ glWindow.setVisible(true);
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(glWindow, true));
+
+ System.err.println("Master Context: ");
+ MiscUtils.dumpSharedGLContext(sharedDrawable.getContext());
+ System.err.println("New Context: ");
+ MiscUtils.dumpSharedGLContext(glWindow.getContext());
+ if( useShared ) {
+ Assert.assertEquals("Master Context not shared as expected", true, sharedDrawable.getContext().isShared());
+ }
+ Assert.assertEquals("New Context not shared as expected", useShared, glWindow.getContext().isShared());
+
+ Assert.assertTrue("Gears not initialized", gears.waitForInit(true));
+ System.err.println("Slave Gears Init done: "+gears);
+ Assert.assertEquals("Gears is not shared as expected", useShared, gears.usesSharedGears());
+
+ return glWindow;
+ }
+
+ @Test
+ public void test01CommonAnimatorSharedOnscreen() throws InterruptedException {
+ initShared(true);
+ Animator animator = new Animator();
+ GLWindow f1 = runTestGL(animator, 0, 0, true, false);
+ InsetsImmutable insets = f1.getInsets();
+ GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(),
+ f1.getY()+0, true, false);
+ GLWindow f3 = runTestGL(animator, f1.getX()+0,
+ f1.getY()+height+insets.getTotalHeight(), true, false);
+ try {
+ Thread.sleep(duration);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ animator.stop();
+
+ f1.destroy();
+ f2.destroy();
+ f3.destroy();
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false));
+
+ releaseShared();
+ }
+
+ @Test
+ public void test02CommonAnimatorSharedOffscreen() throws InterruptedException {
+ initShared(false);
+ Animator animator = new Animator();
+ GLWindow f1 = runTestGL(animator, 0, 0, true, false);
+ InsetsImmutable insets = f1.getInsets();
+ GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(),
+ f1.getY()+0, true, false);
+ GLWindow f3 = runTestGL(animator, f1.getX()+0,
+ f1.getY()+height+insets.getTotalHeight(), true, false);
+ try {
+ Thread.sleep(duration);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ animator.stop();
+
+ f1.destroy();
+ f2.destroy();
+ f3.destroy();
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false));
+
+ releaseShared();
+ }
+
+ @Test
+ public void test03EachWithAnimatorSharedOffscreen() throws InterruptedException {
+ initShared(false);
+ Animator animator1 = new Animator();
+ Animator animator2 = new Animator();
+ Animator animator3 = new Animator();
+ GLWindow f1 = runTestGL(animator1, 0, 0, true, false);
+ InsetsImmutable insets = f1.getInsets();
+ GLWindow f2 = runTestGL(animator2, f1.getX()+width+insets.getTotalWidth(),
+ f1.getY()+0, true, false);
+ GLWindow f3 = runTestGL(animator3, f1.getX()+0,
+ f1.getY()+height+insets.getTotalHeight(), true, false);
+
+ try {
+ Thread.sleep(duration);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ animator1.stop();
+ animator2.stop();
+ animator3.stop();
+
+ f1.destroy();
+ f2.destroy();
+ f3.destroy();
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false));
+
+ releaseShared();
+ }
+
+ static long duration = 1000; // ms
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ try {
+ duration = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ }
+ }
+ /**
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ System.err.println("Press enter to continue");
+ System.err.println(stdin.readLine()); */
+ org.junit.runner.JUnitCore.main(TestSharedContextVBOES2NEWT1.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..e8e4cc7
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java
@@ -0,0 +1,356 @@
+/**
+ * Copyright 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:
+ *
+ * 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.acore;
+
+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 javax.media.opengl.GLRunnable;
+
+import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+/**
+ * Sharing the VBO of 3 GearsES2 instances, each in their own GLWindow.
+ * <p>
+ * This is achieved by using the 1st GLWindow's GLContext as the <i>master</i>
+ * and manually triggering creation of the 2nd and 3rd GLWindow when the 1st GLWindow's
+ * GLContext becomes created. The trigger is performed by simply
+ * inserting a GLRunnable in the 1st GLWindow, which makes the other visible.
+ * </p>
+ * <p>
+ * Above method allows random creation of the 1st GLWindow, which triggers
+ * creation of the <i>dependent</i> other GLWindow sharing it's GLContext.
+ * </p>
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestSharedContextVBOES2NEWT2 extends UITestCase {
+ static GLProfile glp;
+ static GLCapabilities caps;
+ static int width, height;
+
+ @BeforeClass
+ public static void initClass() {
+ if(GLProfile.isAvailable(GLProfile.GL2ES2)) {
+ glp = GLProfile.get(GLProfile.GL2ES2);
+ Assert.assertNotNull(glp);
+ caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ width = 256;
+ height = 256;
+ } else {
+ setTestSupported(false);
+ }
+ }
+
+ protected GLWindow createGLWindow(int x, int y, GearsES2 gears) throws InterruptedException {
+ GLWindow glWindow = GLWindow.create(caps);
+ Assert.assertNotNull(glWindow);
+ glWindow.setPosition(x, y);
+ glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared true");
+ glWindow.setSize(width, height);
+ glWindow.addGLEventListener(gears);
+
+ return glWindow;
+ }
+
+ @Test
+ public void test01SyncedOneAnimatorCleanDtorOrder() throws InterruptedException {
+ syncedOneAnimator(true);
+ }
+
+ @Test
+ public void test02SyncedOneAnimatorDirtyDtorOrder() throws InterruptedException {
+ syncedOneAnimator(false);
+ }
+
+ public void syncedOneAnimator(boolean destroyCleanOrder) throws InterruptedException {
+ final Animator animator = new Animator();
+ final GearsES2 g1 = new GearsES2(0);
+ final GLWindow f1 = createGLWindow(0, 0, g1);
+ animator.add(f1);
+ InsetsImmutable insets = f1.getInsets();
+
+ final GearsES2 g2 = new GearsES2(0);
+ g2.setSharedGears(g1);
+ final GLWindow f2 = createGLWindow(f1.getX()+width+insets.getTotalWidth(),
+ f1.getY()+0, g2);
+ animator.add(f2);
+
+ final GearsES2 g3 = new GearsES2(0);
+ g3.setSharedGears(g1);
+ final GLWindow f3 = createGLWindow(f1.getX()+0,
+ f1.getY()+height+insets.getTotalHeight(), g3);
+ animator.add(f3);
+
+ // f1's shared GLContext is ready !
+ f1.invoke(false, new GLRunnable() {
+ @Override
+ public boolean run(GLAutoDrawable drawable) {
+ final GLContext ctx1 = f1.getContext();
+ Assert.assertTrue("Ctx is shared before shared creation", !ctx1.isShared());
+ f2.setSharedContext(ctx1);
+ f2.setVisible(true);
+ f2.display(); // kick off GLContext ..
+ f3.setSharedContext(ctx1);
+ f3.setVisible(true);
+ f3.display(); // kick off GLContext ..
+ return true;
+ }
+ });
+
+ f1.setVisible(true);
+ f1.display(); // kick off GLContext .. and hence f2 + f3 creation
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, true));
+ Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, true));
+ Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, true));
+ Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
+
+ animator.start(); // post start animator, otherwise display will be suppressed
+
+ final GLContext ctx1 = f1.getContext();
+ final GLContext ctx2 = f2.getContext();
+ final GLContext ctx3 = f3.getContext();
+ {
+ final List<GLContext> ctx1Shares = ctx1.getCreatedShares();
+ final List<GLContext> ctx2Shares = ctx2.getCreatedShares();
+ final List<GLContext> ctx3Shares = ctx3.getCreatedShares();
+ System.err.println("XXX-C-3.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-C-3.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+ System.err.println("XXX-C-3.3:");
+ MiscUtils.dumpSharedGLContext(ctx3);
+
+ Assert.assertTrue("Ctx1 is not shared", ctx1.isShared());
+ Assert.assertTrue("Ctx2 is not shared", ctx2.isShared());
+ Assert.assertTrue("Ctx3 is not shared", ctx3.isShared());
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 2, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 2, ctx2Shares.size());
+ Assert.assertEquals("Ctx3 has unexpected number of created shares", 2, ctx3Shares.size());
+ }
+
+ Assert.assertTrue("Gears1 is shared", !g1.usesSharedGears());
+ Assert.assertTrue("Gears2 is not shared", g2.usesSharedGears());
+ Assert.assertTrue("Gears3 is not shared", g3.usesSharedGears());
+
+ try {
+ Thread.sleep(duration);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ animator.stop();
+ Assert.assertEquals(false, animator.isAnimating());
+
+ if( destroyCleanOrder ) {
+ System.err.println("XXX Destroy in clean order NOW");
+ f3.destroy();
+ f2.destroy();
+ f1.destroy();
+ } else {
+ System.err.println("XXX Destroy in creation order NOW - Driver Impl. May trigger driver Bug i.e. not postponing GL ctx destruction after releasing all refs.");
+ f1.destroy();
+ f2.destroy();
+ f3.destroy();
+ }
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
+ }
+
+ @Test
+ public void test11AsyncEachAnimatorCleanDtorOrder() throws InterruptedException {
+ asyncEachAnimator(true);
+ }
+
+ @Test
+ public void test12AsyncEachAnimatorDirtyDtorOrder() throws InterruptedException {
+ asyncEachAnimator(false);
+ }
+
+ public void asyncEachAnimator(boolean destroyCleanOrder) throws InterruptedException {
+ final Animator a1 = new Animator();
+ final GearsES2 g1 = new GearsES2(0);
+ final GLWindow f1 = createGLWindow(0, 0, g1);
+ a1.add(f1);
+ a1.start();
+ f1.setVisible(true);
+
+ InsetsImmutable insets = f1.getInsets();
+
+ final Animator a2 = new Animator();
+ final GearsES2 g2 = new GearsES2(0);
+ g2.setSharedGears(g1);
+ final GLWindow f2 = createGLWindow(f1.getX()+width+insets.getTotalWidth(),
+ f1.getY()+0, g2);
+ a2.add(f2);
+ a2.start();
+
+ final Animator a3 = new Animator();
+ final GearsES2 g3 = new GearsES2(0);
+ g3.setSharedGears(g1);
+ final GLWindow f3 = createGLWindow(f1.getX()+0,
+ f1.getY()+height+insets.getTotalHeight(), g3);
+ a3.add(f3);
+ a3.start();
+
+ // f1's shared GLContext is ready !
+ f1.invoke(false, new GLRunnable() {
+ @Override
+ public boolean run(GLAutoDrawable drawable) {
+ final GLContext ctx1 = f1.getContext();
+ Assert.assertTrue("Ctx is shared before shared creation", !ctx1.isShared());
+ f2.setSharedContext(ctx1);
+ f2.setVisible(true);
+ f3.setSharedContext(ctx1);
+ f3.setVisible(true);
+ return true;
+ }
+ });
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, true));
+ Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, true));
+ Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, true));
+ Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
+
+ final GLContext ctx1 = f1.getContext();
+ final GLContext ctx2 = f2.getContext();
+ final GLContext ctx3 = f3.getContext();
+ {
+ final List<GLContext> ctx1Shares = ctx1.getCreatedShares();
+ final List<GLContext> ctx2Shares = ctx2.getCreatedShares();
+ final List<GLContext> ctx3Shares = ctx3.getCreatedShares();
+ System.err.println("XXX-C-3.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-C-3.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+ System.err.println("XXX-C-3.3:");
+ MiscUtils.dumpSharedGLContext(ctx3);
+
+ Assert.assertTrue("Ctx1 is not shared", ctx1.isShared());
+ Assert.assertTrue("Ctx2 is not shared", ctx2.isShared());
+ Assert.assertTrue("Ctx3 is not shared", ctx3.isShared());
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 2, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 2, ctx2Shares.size());
+ Assert.assertEquals("Ctx3 has unexpected number of created shares", 2, ctx3Shares.size());
+ }
+
+ Assert.assertTrue("Gears1 is shared", !g1.usesSharedGears());
+ Assert.assertTrue("Gears2 is not shared", g2.usesSharedGears());
+ Assert.assertTrue("Gears3 is not shared", g3.usesSharedGears());
+
+ try {
+ Thread.sleep(duration);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ // Stopped animator allows native windowing system 'repaint' event
+ // to trigger GLAD 'display'
+ a1.stop();
+ Assert.assertEquals(false, a1.isAnimating());
+ a2.stop();
+ Assert.assertEquals(false, a2.isAnimating());
+ a3.stop();
+ Assert.assertEquals(false, a3.isAnimating());
+
+ if( destroyCleanOrder ) {
+ System.err.println("XXX Destroy in clean order NOW");
+ f3.destroy();
+ f2.destroy();
+ f1.destroy();
+ } else {
+ System.err.println("XXX Destroy in creation order NOW - Driver Impl. May trigger driver Bug i.e. not postponing GL ctx destruction after releasing all refs.");
+ f1.destroy();
+ f2.destroy();
+ f3.destroy();
+ }
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
+ }
+
+ static long duration = 1000; // ms
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ try {
+ duration = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ }
+ }
+ /**
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ System.err.println("Press enter to continue");
+ System.err.println(stdin.readLine()); */
+ org.junit.runner.JUnitCore.main(TestSharedContextVBOES2NEWT2.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..c94ae11
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java
@@ -0,0 +1,338 @@
+/**
+ * Copyright 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:
+ *
+ * 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.acore;
+
+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.opengl.util.Animator;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+/**
+ * Sharing the VBO of 3 GearsES2 instances, each in their own GLWindow.
+ * <p>
+ * This is achieved by using the 1st GLWindow as the <i>master</i>
+ * and using the build-in blocking mechanism to postpone creation
+ * of the 2nd and 3rd GLWindow until the 1st GLWindow's GLContext becomes created.
+ * </p>
+ * <p>
+ * Above method allows random creation of the 1st GLWindow, which triggers
+ * creation of the <i>dependent</i> other GLWindow sharing it's GLContext.
+ * </p>
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestSharedContextVBOES2NEWT3 extends UITestCase {
+ static GLProfile glp;
+ static GLCapabilities caps;
+ static int width, height;
+
+ @BeforeClass
+ public static void initClass() {
+ if(GLProfile.isAvailable(GLProfile.GL2ES2)) {
+ glp = GLProfile.get(GLProfile.GL2ES2);
+ Assert.assertNotNull(glp);
+ caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ width = 256;
+ height = 256;
+ } else {
+ setTestSupported(false);
+ }
+ }
+
+ protected GLWindow createGLWindow(int x, int y, GearsES2 gears) throws InterruptedException {
+ GLWindow glWindow = GLWindow.create(caps);
+ Assert.assertNotNull(glWindow);
+ glWindow.setPosition(x, y);
+ glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared true");
+ glWindow.setSize(width, height);
+ glWindow.addGLEventListener(gears);
+
+ return glWindow;
+ }
+
+ @Test
+ public void test01SyncedOneAnimatorCleanDtorOrder() throws InterruptedException {
+ syncedOneAnimator(true);
+ }
+
+ @Test
+ public void test02SyncedOneAnimatorDirtyDtorOrder() throws InterruptedException {
+ syncedOneAnimator(false);
+ }
+
+ public void syncedOneAnimator(boolean destroyCleanOrder) throws InterruptedException {
+ final Animator animator = new Animator();
+ final GearsES2 g1 = new GearsES2(0);
+ final GLWindow f1 = createGLWindow(0, 0, g1);
+ animator.add(f1);
+ InsetsImmutable insets = f1.getInsets();
+
+ final GearsES2 g2 = new GearsES2(0);
+ g2.setSharedGears(g1);
+ final GLWindow f2 = createGLWindow(f1.getX()+width+insets.getTotalWidth(),
+ f1.getY()+0, g2);
+ f2.setSharedAutoDrawable(f1);
+ animator.add(f2);
+
+ final GearsES2 g3 = new GearsES2(0);
+ g3.setSharedGears(g1);
+ final GLWindow f3 = createGLWindow(f1.getX()+0,
+ f1.getY()+height+insets.getTotalHeight(), g3);
+ f3.setSharedAutoDrawable(f1);
+ animator.add(f3);
+
+ f2.setVisible(true); // shall wait until f1 is ready
+ f1.setVisible(true); // master ..
+ f3.setVisible(true); // shall wait until f1 is ready
+ animator.start(); // kicks off GLContext .. and hence gears of f2 + f3 completion
+
+ Thread.sleep(1000/60*10); // wait ~10 frames giving a chance to create (blocking until master share is valid)
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, true));
+ Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, true));
+ Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, true));
+ Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
+
+ final GLContext ctx1 = f1.getContext();
+ final GLContext ctx2 = f2.getContext();
+ final GLContext ctx3 = f3.getContext();
+ {
+ final List<GLContext> ctx1Shares = ctx1.getCreatedShares();
+ final List<GLContext> ctx2Shares = ctx2.getCreatedShares();
+ final List<GLContext> ctx3Shares = ctx3.getCreatedShares();
+ System.err.println("XXX-C-3.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-C-3.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+ System.err.println("XXX-C-3.3:");
+ MiscUtils.dumpSharedGLContext(ctx3);
+
+ Assert.assertTrue("Ctx1 is not shared", ctx1.isShared());
+ Assert.assertTrue("Ctx2 is not shared", ctx2.isShared());
+ Assert.assertTrue("Ctx3 is not shared", ctx3.isShared());
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 2, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 2, ctx2Shares.size());
+ Assert.assertEquals("Ctx3 has unexpected number of created shares", 2, ctx3Shares.size());
+ }
+
+ Assert.assertTrue("Gears1 is shared", !g1.usesSharedGears());
+ Assert.assertTrue("Gears2 is not shared", g2.usesSharedGears());
+ Assert.assertTrue("Gears3 is not shared", g3.usesSharedGears());
+
+ try {
+ Thread.sleep(duration);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ // Stopped animator allows native windowing system 'repaint' event
+ // to trigger GLAD 'display'
+ animator.stop();
+ Assert.assertEquals(false, animator.isAnimating());
+
+ if( destroyCleanOrder ) {
+ System.err.println("XXX Destroy in clean order NOW");
+ f3.destroy();
+ f2.destroy();
+ f1.destroy();
+ } else {
+ System.err.println("XXX Destroy in creation order NOW - Driver Impl. Ma trigger driver Bug i.e. not postponing GL ctx destruction after releasing all refs.");
+ f1.destroy();
+ f2.destroy();
+ f3.destroy();
+ }
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
+ }
+
+ @Test
+ public void test11ASyncEachAnimatorCleanDtorOrder() throws InterruptedException {
+ asyncEachAnimator(true);
+ }
+
+ @Test
+ public void test12AsyncEachAnimatorDirtyDtorOrder() throws InterruptedException {
+ asyncEachAnimator(false);
+ }
+
+ public void asyncEachAnimator(boolean destroyCleanOrder) throws InterruptedException {
+ final Animator a1 = new Animator();
+ final GearsES2 g1 = new GearsES2(0);
+ final GLWindow f1 = createGLWindow(0, 0, g1);
+ a1.add(f1);
+ a1.start();
+ // f1.setVisible(true); // we do this post f2 .. to test pending creation!
+
+ InsetsImmutable insets = f1.getInsets();
+
+ final Animator a2 = new Animator();
+ final GearsES2 g2 = new GearsES2(0);
+ g2.setSharedGears(g1);
+ final GLWindow f2 = createGLWindow(f1.getX()+width+insets.getTotalWidth(),
+ f1.getY()+0, g2);
+ f2.setSharedAutoDrawable(f1);
+ a2.add(f2);
+ a2.start();
+ f2.setVisible(true);
+
+ f1.setVisible(true); // test pending creation of f2
+
+ final Animator a3 = new Animator();
+ final GearsES2 g3 = new GearsES2(0);
+ g3.setSharedGears(g1);
+ final GLWindow f3 = createGLWindow(f1.getX()+0,
+ f1.getY()+height+insets.getTotalHeight(), g3);
+ f3.setSharedAutoDrawable(f1);
+ a3.add(f3);
+ a3.start();
+ f3.setVisible(true);
+
+ Thread.sleep(1000/60*10); // wait ~10 frames giving a chance to create (blocking until master share is valid)
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, true));
+ Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, true));
+ Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, true));
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, true));
+ Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
+
+ final GLContext ctx1 = f1.getContext();
+ final GLContext ctx2 = f2.getContext();
+ final GLContext ctx3 = f3.getContext();
+ {
+ final List<GLContext> ctx1Shares = ctx1.getCreatedShares();
+ final List<GLContext> ctx2Shares = ctx2.getCreatedShares();
+ final List<GLContext> ctx3Shares = ctx3.getCreatedShares();
+ System.err.println("XXX-C-3.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-C-3.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+ System.err.println("XXX-C-3.3:");
+ MiscUtils.dumpSharedGLContext(ctx3);
+
+ Assert.assertTrue("Ctx1 is not shared", ctx1.isShared());
+ Assert.assertTrue("Ctx2 is not shared", ctx2.isShared());
+ Assert.assertTrue("Ctx3 is not shared", ctx3.isShared());
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 2, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 2, ctx2Shares.size());
+ Assert.assertEquals("Ctx3 has unexpected number of created shares", 2, ctx3Shares.size());
+ }
+
+ Assert.assertTrue("Gears1 is shared", !g1.usesSharedGears());
+ Assert.assertTrue("Gears2 is not shared", g2.usesSharedGears());
+ Assert.assertTrue("Gears3 is not shared", g3.usesSharedGears());
+
+ try {
+ Thread.sleep(duration);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ // Stopped animator allows native windowing system 'repaint' event
+ // to trigger GLAD 'display'
+ a1.stop();
+ Assert.assertEquals(false, a1.isAnimating());
+ a2.stop();
+ Assert.assertEquals(false, a2.isAnimating());
+ a3.stop();
+ Assert.assertEquals(false, a3.isAnimating());
+
+ if( destroyCleanOrder ) {
+ System.err.println("XXX Destroy in clean order NOW");
+ f3.destroy();
+ f2.destroy();
+ f1.destroy();
+ } else {
+ System.err.println("XXX Destroy in creation order NOW - Driver Impl. May trigger driver Bug i.e. not postponing GL ctx destruction after releasing all refs.");
+ f1.destroy();
+ f2.destroy();
+ f3.destroy();
+ }
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
+ }
+
+ static long duration = 1000; // ms
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ try {
+ duration = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ }
+ }
+ /**
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ System.err.println("Press enter to continue");
+ System.err.println(stdin.readLine()); */
+ org.junit.runner.JUnitCore.main(TestSharedContextVBOES2NEWT3.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..9ccfd39
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2SWT3.java
@@ -0,0 +1,375 @@
+/**
+ * Copyright 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:
+ *
+ * 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.acore;
+
+import java.util.List;
+
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLContext;
+import javax.media.opengl.GLProfile;
+
+import com.jogamp.nativewindow.swt.SWTAccessor;
+import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.swt.GLCanvas;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+/**
+ * Sharing the VBO of 3 GearsES2 instances, each in their own SWT GLCanvas.
+ * <p>
+ * This is achieved by using the 1st GLCanvas as the <i>master</i>
+ * and using the build-in blocking mechanism to postpone creation
+ * of the 2nd and 3rd GLCanvas until the 1st GLCanvas's GLContext becomes created.
+ * </p>
+ * <p>
+ * Above method allows random creation of the 1st GLCanvas <b>in theory</b>, which triggers
+ * creation of the <i>dependent</i> other GLCanvas sharing it's GLContext.<br>
+ * However, since this test may perform on the <i>main thread</i> we have
+ * to initialize all in order, since otherwise the <i>test main thread</i>
+ * itself blocks SWT GLCanvas creation ..
+ * </p>
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestSharedContextVBOES2SWT3 extends UITestCase {
+ static GLProfile glp;
+ static GLCapabilities caps;
+ static int width, height;
+
+ @BeforeClass
+ public static void initClass() {
+ if(GLProfile.isAvailable(GLProfile.GL2ES2)) {
+ glp = GLProfile.get(GLProfile.GL2ES2);
+ Assert.assertNotNull(glp);
+ caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ width = 256;
+ height = 256;
+ } else {
+ setTestSupported(false);
+ }
+ }
+
+ Display display = null;
+ Shell shell1 = null;
+ Composite composite1 = null;
+ Shell shell2 = null;
+ Composite composite2 = null;
+ Shell shell3 = null;
+ Composite composite3 = null;
+
+ @Before
+ public void init() {
+ SWTAccessor.invoke(true, new Runnable() {
+ public void run() {
+ display = new Display();
+ Assert.assertNotNull( display );
+ }});
+ display.syncExec(new Runnable() {
+ public void run() {
+ shell1 = new Shell( display );
+ shell1.setLayout( new FillLayout() );
+ composite1 = new Composite( shell1, SWT.NO_BACKGROUND );
+ composite1.setLayout( new FillLayout() );
+
+ shell2 = new Shell( display );
+ shell2.setLayout( new FillLayout() );
+ composite2 = new Composite( shell2, SWT.NO_BACKGROUND );
+ composite2.setLayout( new FillLayout() );
+
+ shell3 = new Shell( display );
+ shell3.setLayout( new FillLayout() );
+ composite3 = new Composite( shell3, SWT.NO_BACKGROUND );
+ composite3.setLayout( new FillLayout() );
+ }});
+ }
+
+ @After
+ public void release() {
+ Assert.assertNotNull( display );
+ Assert.assertNotNull( shell1 );
+ Assert.assertNotNull( composite1 );
+ Assert.assertNotNull( shell2 );
+ Assert.assertNotNull( composite2 );
+ Assert.assertNotNull( shell3 );
+ Assert.assertNotNull( composite3 );
+ try {
+ display.syncExec(new Runnable() {
+ public void run() {
+ composite3.dispose();
+ shell3.dispose();
+ composite2.dispose();
+ shell2.dispose();
+ composite1.dispose();
+ shell1.dispose();
+ }});
+ SWTAccessor.invoke(true, new Runnable() {
+ public void run() {
+ display.dispose();
+ }});
+ }
+ catch( Throwable throwable ) {
+ throwable.printStackTrace();
+ Assume.assumeNoException( throwable );
+ }
+ display = null;
+ shell1 = null;
+ composite1 = null;
+ shell2 = null;
+ composite2 = null;
+ shell3 = null;
+ composite3 = null;
+ }
+
+ protected GLCanvas createGLCanvas(final Shell shell, final Composite composite, final int x, final int y, GearsES2 gears) throws InterruptedException {
+ final GLCanvas glCanvas = GLCanvas.create( composite, 0, caps, null);
+ Assert.assertNotNull( glCanvas );
+ glCanvas.addGLEventListener(gears);
+ display.syncExec(new Runnable() {
+ public void run() {
+ shell.setText("SWT GLCanvas Shared Gears Test");
+ shell.setSize( width, height);
+ shell.setLocation(x, y);
+ } } );
+ return glCanvas;
+ }
+
+ @Test
+ public void test01SyncedOneAnimator() throws InterruptedException {
+ final Animator animator = new Animator();
+ final GearsES2 g1 = new GearsES2(0);
+ final GLCanvas c1 = createGLCanvas(shell1, composite1, 0, 0, g1);
+ animator.add(c1);
+
+ final GearsES2 g2 = new GearsES2(0);
+ g2.setSharedGears(g1);
+ final GLCanvas c2 = createGLCanvas(shell2, composite2, 0+width, 0+0, g2);
+ c2.setSharedAutoDrawable(c1);
+ animator.add(c2);
+
+ final GearsES2 g3 = new GearsES2(0);
+ g3.setSharedGears(g1);
+ final GLCanvas c3 = createGLCanvas(shell3, composite3, 0, height, g3);
+ c3.setSharedAutoDrawable(c1);
+ animator.add(c3);
+
+ display.syncExec(new Runnable() {
+ public void run() {
+ shell1.open(); // master ..
+ shell2.open(); // shall wait until f1 is ready
+ shell3.open(); // shall wait until f1 is ready
+ } } );
+ animator.start(); // kicks off GLContext .. and hence gears of f2 + f3 completion
+
+ Thread.sleep(1000/60*10); // wait ~10 frames giving a chance to create (blocking until master share is valid)
+
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
+ Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true));
+ Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true));
+ Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
+
+ final GLContext ctx1 = c1.getContext();
+ final GLContext ctx2 = c2.getContext();
+ final GLContext ctx3 = c3.getContext();
+ {
+ final List<GLContext> ctx1Shares = ctx1.getCreatedShares();
+ final List<GLContext> ctx2Shares = ctx2.getCreatedShares();
+ final List<GLContext> ctx3Shares = ctx3.getCreatedShares();
+ System.err.println("XXX-C-3.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-C-3.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+ System.err.println("XXX-C-3.3:");
+ MiscUtils.dumpSharedGLContext(ctx3);
+
+ Assert.assertTrue("Ctx1 is not shared", ctx1.isShared());
+ Assert.assertTrue("Ctx2 is not shared", ctx2.isShared());
+ Assert.assertTrue("Ctx3 is not shared", ctx3.isShared());
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 2, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 2, ctx2Shares.size());
+ Assert.assertEquals("Ctx3 has unexpected number of created shares", 2, ctx3Shares.size());
+ }
+
+ Assert.assertTrue("Gears1 is shared", !g1.usesSharedGears());
+ Assert.assertTrue("Gears2 is not shared", g2.usesSharedGears());
+ Assert.assertTrue("Gears3 is not shared", g3.usesSharedGears());
+
+ try {
+ Thread.sleep(duration);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ // Stopped animator allows native windowing system 'repaint' event
+ // to trigger GLAD 'display'
+ animator.stop();
+ Assert.assertEquals(false, animator.isAnimating());
+
+ display.syncExec(new Runnable() {
+ public void run() {
+ c3.dispose();
+ c2.dispose();
+ c1.dispose();
+ } } );
+ }
+
+ @Test
+ public void test02AsyncEachAnimator() throws InterruptedException {
+ final Animator a1 = new Animator();
+ final GearsES2 g1 = new GearsES2(0);
+ final GLCanvas c1 = createGLCanvas(shell1, composite1, 0, 0, g1);
+ a1.add(c1);
+ display.syncExec(new Runnable() {
+ public void run() {
+ shell1.open();
+ } } );
+ a1.start();
+
+
+ Thread.sleep(1000/60*10); // wait ~10 frames giving a chance to create (blocking until master share is valid)
+
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
+ Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
+
+ final Animator a2 = new Animator();
+ final GearsES2 g2 = new GearsES2(0);
+ g2.setSharedGears(g1);
+ final GLCanvas c2 = createGLCanvas(shell2, composite2, width, 0, g2);
+ c2.setSharedAutoDrawable(c1);
+ a2.add(c2);
+ display.syncExec(new Runnable() {
+ public void run() {
+ shell2.open();
+ } } );
+ a2.start();
+
+ Thread.sleep(200); // wait a while ..
+
+ final Animator a3 = new Animator();
+ final GearsES2 g3 = new GearsES2(0);
+ g3.setSharedGears(g1);
+ final GLCanvas c3 = createGLCanvas(shell3, composite3, 0, height, g3);
+ c3.setSharedAutoDrawable(c1);
+ a3.add(c3);
+ display.syncExec(new Runnable() {
+ public void run() {
+ shell3.open();
+ } } );
+ a3.start();
+
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true));
+ Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
+
+ Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true));
+ Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
+
+ final GLContext ctx1 = c1.getContext();
+ final GLContext ctx2 = c2.getContext();
+ final GLContext ctx3 = c3.getContext();
+ {
+ final List<GLContext> ctx1Shares = ctx1.getCreatedShares();
+ final List<GLContext> ctx2Shares = ctx2.getCreatedShares();
+ final List<GLContext> ctx3Shares = ctx3.getCreatedShares();
+ System.err.println("XXX-C-3.1:");
+ MiscUtils.dumpSharedGLContext(ctx1);
+ System.err.println("XXX-C-3.2:");
+ MiscUtils.dumpSharedGLContext(ctx2);
+ System.err.println("XXX-C-3.3:");
+ MiscUtils.dumpSharedGLContext(ctx3);
+
+ Assert.assertTrue("Ctx1 is not shared", ctx1.isShared());
+ Assert.assertTrue("Ctx2 is not shared", ctx2.isShared());
+ Assert.assertTrue("Ctx3 is not shared", ctx3.isShared());
+ Assert.assertEquals("Ctx1 has unexpected number of created shares", 2, ctx1Shares.size());
+ Assert.assertEquals("Ctx2 has unexpected number of created shares", 2, ctx2Shares.size());
+ Assert.assertEquals("Ctx3 has unexpected number of created shares", 2, ctx3Shares.size());
+ }
+
+ Assert.assertTrue("Gears1 is shared", !g1.usesSharedGears());
+ Assert.assertTrue("Gears2 is not shared", g2.usesSharedGears());
+ Assert.assertTrue("Gears3 is not shared", g3.usesSharedGears());
+
+ try {
+ Thread.sleep(duration);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ // Stopped animator allows native windowing system 'repaint' event
+ // to trigger GLAD 'display'
+ a1.stop();
+ Assert.assertEquals(false, a1.isAnimating());
+ a2.stop();
+ Assert.assertEquals(false, a2.isAnimating());
+ a3.stop();
+ Assert.assertEquals(false, a3.isAnimating());
+
+ display.syncExec(new Runnable() {
+ public void run() {
+ c3.dispose();
+ c2.dispose();
+ c1.dispose();
+ } } );
+ }
+
+ static long duration = 1000; // ms
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ try {
+ duration = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ }
+ }
+ /**
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ System.err.println("Press enter to continue");
+ System.err.println(stdin.readLine()); */
+ org.junit.runner.JUnitCore.main(TestSharedContextVBOES2SWT3.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..d6a6f7b
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextWithJTabbedPaneAWT.java
@@ -0,0 +1,264 @@
+/**
+ * Copyright (C) 2013 United States Government as represented by the Administrator of the
+ * National Aeronautics and Space Administration.
+ * All Rights Reserved.
+ *
+ * Copyright 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:
+ *
+ * 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.acore;
+
+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.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+import javax.swing.SwingUtilities;
+import javax.swing.WindowConstants;
+
+import org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.common.nio.Buffers;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestSharedContextWithJTabbedPaneAWT extends UITestCase {
+
+ static class DemoInstance {
+ protected static GLCapabilities getCaps() {
+ GLCapabilities caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true));
+
+ caps.setAlphaBits(8);
+ caps.setRedBits(8);
+ caps.setGreenBits(8);
+ caps.setBlueBits(8);
+ caps.setDepthBits(24);
+ caps.setDoubleBuffered(true);
+
+ return caps;
+ }
+
+ int[] bufferId;
+
+ @SuppressWarnings("serial")
+ class SharedGLPanel extends JPanel implements GLEventListener {
+ final GLCanvas canvas;
+ final boolean shared;
+
+ public SharedGLPanel(GLCanvas shareWith, int width, int height) {
+ GLContext sharedCtx = shareWith != null ? shareWith.getContext() : null;
+ System.err.println("XXX WWPanel: shareWith "+shareWith+", sharedCtx "+sharedCtx);
+ canvas = new GLCanvas(getCaps()); // same caps for 1st and 2nd shared ctx !
+ if( null != shareWith) {
+ canvas.setSharedAutoDrawable(shareWith);
+ shared = true;
+ } else {
+ shared = false;
+ }
+ canvas.setSize(new java.awt.Dimension(width, height));
+
+ setLayout(new BorderLayout(5, 5));
+ add(canvas, BorderLayout.CENTER);
+ setOpaque(false);
+
+ canvas.addGLEventListener(this);
+ }
+
+ @Override
+ public void init(GLAutoDrawable glAutoDrawable) {
+ if (!shared) {
+ Assert.assertNull("Buffer is set, but instance is share master", bufferId);
+ makeVBO(glAutoDrawable);
+ System.err.println("XXX Create Buffer "+bufferId[0]);
+ } else {
+ Assert.assertNotNull("Buffer is not set, but instance is share slave", bufferId);
+ Assert.assertTrue("Context is not shared", glAutoDrawable.getContext().isShared());
+ System.err.println("XXX Reuse Buffer "+bufferId[0]);
+ }
+ final GL2 gl = glAutoDrawable.getGL().getGL2();
+ if( shared ) {
+ gl.glColor3f(1, 1, 1);
+ gl.glClearColor(0.3f, 0.3f, 0.3f, 1f);
+ } else {
+ gl.glColor3f(0, 0, 0);
+ gl.glClearColor(1f, 1f, 1f, 1f);
+ }
+ gl.glShadeModel(GL2.GL_FLAT);
+ }
+
+ @Override
+ public void dispose(GLAutoDrawable glAutoDrawable) {}
+
+ @Override
+ public void display(GLAutoDrawable glAutoDrawable) {
+ final GL2 gl = glAutoDrawable.getGL().getGL2();
+
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
+
+ gl.glEnableClientState(GL2.GL_VERTEX_ARRAY);
+ gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, bufferId[0]);
+ gl.glVertexPointer(3, GL2.GL_FLOAT, 0, 0);
+ gl.glDrawArrays(GL2.GL_LINES, 0, 2);
+ }
+
+ @Override
+ public void reshape(GLAutoDrawable glAutoDrawable, int i, int i1, int i2, int i3) {
+ int w = getWidth();
+ int h = getHeight();
+
+ final GL2 gl = glAutoDrawable.getGL().getGL2();
+
+ gl.glViewport(0, 0, w, h);
+ gl.glMatrixMode(GL2.GL_PROJECTION);
+ gl.glLoadIdentity();
+ gl.glOrtho(0, 1, 0, 1, -1, 1);
+ gl.glMatrixMode(GL2.GL_MODELVIEW);
+ gl.glLoadIdentity();
+ }
+ }
+
+ protected void makeVBO(GLAutoDrawable drawable) {
+ GL2 gl = drawable.getGL().getGL2();
+
+ bufferId = new int[1];
+ gl.glGenBuffers(1, bufferId, 0);
+ gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, bufferId[0]);
+
+ FloatBuffer vertices = Buffers.newDirectFloatBuffer(6);
+ vertices.put(0).put(0).put(0);
+ vertices.put(1).put(1).put(0);
+ gl.glBufferData(GL2.GL_ARRAY_BUFFER, vertices.capacity() * 4, vertices.rewind(), GL2.GL_STATIC_DRAW);
+ }
+
+ public JTabbedPane tabbedPanel;
+
+ public DemoInstance(JFrame f) {
+ try
+ {
+ GLProfile.initSingleton(); // Lets have init debug messages above below marker
+ System.err.println("XXX START DEMO XXX");
+
+ // Create the application frame and the tabbed pane and add the pane to the frame.
+ tabbedPanel = new JTabbedPane();
+ f.add(tabbedPanel, BorderLayout.CENTER);
+
+ // Create two World Windows that share resources.
+ SharedGLPanel wwpA = new SharedGLPanel(null, 600, 600);
+ SharedGLPanel wwpB = new SharedGLPanel(wwpA.canvas, wwpA.getWidth(), wwpA.getHeight());
+
+ tabbedPanel.add(wwpA, "Window A");
+ tabbedPanel.add(wwpB, "Window B");
+
+ // Add the card panel to the frame.
+ f.add(tabbedPanel, BorderLayout.CENTER);
+
+ // Position and display the frame.
+ f.setTitle("Multi-Window Tabbed Pane");
+ f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+ f.pack();
+ f.setResizable(true);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ static long durationPerTest = 500*4; // ms
+ static boolean manual = false;
+
+ @Test
+ public void test01() throws InterruptedException, InvocationTargetException {
+ final JFrame f = new JFrame();
+ f.setTitle("Shared GLContext AWT GLCanvas JTabbedPane");
+ final DemoInstance demo = new DemoInstance(f);
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ System.err.println("XXX SetVisible XXX");
+ f.setVisible(true);
+ } });
+
+ if(manual) {
+ for(long w=durationPerTest; w>0; w-=100) {
+ Thread.sleep(100);
+ }
+ } else {
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ demo.tabbedPanel.setSelectedIndex(0);
+ }});
+ Thread.sleep(durationPerTest/4);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ demo.tabbedPanel.setSelectedIndex(1);
+ }});
+ Thread.sleep(durationPerTest/4);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ demo.tabbedPanel.setSelectedIndex(0);
+ }});
+ Thread.sleep(durationPerTest/4);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ demo.tabbedPanel.setSelectedIndex(1);
+ }});
+ Thread.sleep(durationPerTest/4);
+ }
+
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ System.err.println("XXX SetVisible XXX");
+ f.dispose();
+ } });
+ }
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ durationPerTest = MiscUtils.atoi(args[++i], (int)durationPerTest);
+ } else if(args[i].equals("-manual")) {
+ manual = true;
+ }
+ }
+ org.junit.runner.JUnitCore.main(TestSharedContextWithJTabbedPaneAWT.class.getName());
+ }
+}
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 afcf51e..4e2e913 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
@@ -38,11 +38,14 @@ import javax.media.opengl.awt.GLCanvas;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestShutdownCompleteAWT extends UITestCase {
static long duration = 300; // ms
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 f376cd6..881d6c8 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
@@ -37,6 +37,8 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.JoglVersion;
@@ -44,6 +46,7 @@ import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestShutdownCompleteNEWT extends UITestCase {
static long duration = 300; // ms
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 a2c6204..fca2beb 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
@@ -36,6 +36,8 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.jogl.demos.es1.RedSquareES1;
@@ -51,6 +53,7 @@ import com.jogamp.opengl.util.Animator;
* DISPLAY environment variable.
*
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestX11DefaultDisplay extends UITestCase {
static long duration = 500; // ms
static int width = 512, height = 512;
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 3a03b05..4980e85 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
@@ -50,10 +50,13 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* ExclusiveContextThread base implementation to test correctness of the ExclusiveContext feature _and_ AnimatorBase.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public abstract class ExclusiveContextBase00 extends UITestCase {
static boolean testExclusiveWithAWT = false;
static final int durationParts = 9;
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 387f6b7..5608fe2 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
@@ -42,6 +42,8 @@ import javax.media.opengl.awt.GLCanvas;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.VersionNumber;
@@ -49,6 +51,7 @@ import com.jogamp.common.util.VersionNumber;
/**
* ExclusiveContextThread base implementation to test correctness of the ExclusiveContext feature _and_ AnimatorBase with AWT.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public abstract class ExclusiveContextBase00AWT extends ExclusiveContextBase00 {
static Thread awtEDT;
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 43b1e14..3f2de01 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
@@ -39,10 +39,13 @@ import javax.media.opengl.GLCapabilitiesImmutable;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* ExclusiveContextThread base implementation to test correctness of the ExclusiveContext feature _and_ AnimatorBase with NEWT.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public abstract class ExclusiveContextBase00NEWT extends ExclusiveContextBase00 {
static Display dpy;
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 dc99e49..5166227 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
@@ -49,11 +49,14 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
+import org.junit.FixMethodOrder;
import org.junit.Test;
+import org.junit.runners.MethodSorters;
/**
* ExclusiveContextThread base implementation to test performance impact of the ExclusiveContext feature with AnimatorBase.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public abstract class ExclusiveContextBase10 extends UITestCase {
static boolean testExclusiveWithAWT = false;
static long duration = 1400;
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 fcccafa..237479e 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
@@ -42,6 +42,8 @@ import javax.media.opengl.awt.GLCanvas;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.VersionNumber;
@@ -49,6 +51,7 @@ import com.jogamp.common.util.VersionNumber;
/**
* ExclusiveContextThread base implementation to test performance impact of the ExclusiveContext feature with AnimatorBase and AWT.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public abstract class ExclusiveContextBase10AWT extends ExclusiveContextBase10 {
static Thread awtEDT;
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 94a32e2..fc8cad0 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
@@ -39,10 +39,13 @@ import javax.media.opengl.GLCapabilitiesImmutable;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* ExclusiveContextThread base implementation to test performance impact of the ExclusiveContext feature with AnimatorBase and NEWT.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public abstract class ExclusiveContextBase10NEWT extends ExclusiveContextBase10 {
static Display dpy;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext01VSyncAnimAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext01VSyncAnimAWT.java
index 25554a8..038e078 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext01VSyncAnimAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext01VSyncAnimAWT.java
@@ -35,9 +35,13 @@ import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.AnimatorBase;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
/**
* ExclusiveContextThread VSync Animator to test correctness of the ExclusiveContext feature _and_ Animator with AWT.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestExclusiveContext01VSyncAnimAWT extends ExclusiveContextBase00AWT {
@Override
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext01VSyncAnimNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext01VSyncAnimNEWT.java
index 3ea2704..d523479 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext01VSyncAnimNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext01VSyncAnimNEWT.java
@@ -34,10 +34,13 @@ import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.AnimatorBase;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* ExclusiveContextThread VSync Animator to test correctness of the ExclusiveContext feature _and_ Animator with NEWT.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestExclusiveContext01VSyncAnimNEWT extends ExclusiveContextBase00NEWT {
@Override
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext02FPSAnimAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext02FPSAnimAWT.java
index a91f7e1..f6697c6 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext02FPSAnimAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext02FPSAnimAWT.java
@@ -34,10 +34,13 @@ import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.util.AnimatorBase;
import com.jogamp.opengl.util.FPSAnimator;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* ExclusiveContextThread FPS Animator to test correctness of the ExclusiveContext feature _and_ FPSAnimator with AWT.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestExclusiveContext02FPSAnimAWT extends ExclusiveContextBase00AWT {
@Override
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext02FPSAnimNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext02FPSAnimNEWT.java
index c83bfd2..33819c8 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext02FPSAnimNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext02FPSAnimNEWT.java
@@ -34,10 +34,13 @@ import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.util.AnimatorBase;
import com.jogamp.opengl.util.FPSAnimator;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* ExclusiveContextThread FPS Animator to test correctness of the ExclusiveContext feature _and_ FPSAnimator with NEWT.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestExclusiveContext02FPSAnimNEWT extends ExclusiveContextBase00NEWT {
@Override
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext11VSyncAnimNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext11VSyncAnimNEWT.java
index 7caab62..5067d6c 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext11VSyncAnimNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext11VSyncAnimNEWT.java
@@ -34,9 +34,13 @@ import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.AnimatorBase;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
/**
* ExclusiveContextThread base implementation to test performance impact of the ExclusiveContext feature with Animator and NEWT.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestExclusiveContext11VSyncAnimNEWT extends ExclusiveContextBase10NEWT {
@Override
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext12FPSAnimNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext12FPSAnimNEWT.java
index 798d09b..993b67e 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext12FPSAnimNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext12FPSAnimNEWT.java
@@ -34,10 +34,13 @@ import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.util.AnimatorBase;
import com.jogamp.opengl.util.FPSAnimator;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* ExclusiveContextThread base implementation to test performance impact of the ExclusiveContext feature with FPSAnimator and NEWT.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestExclusiveContext12FPSAnimNEWT extends ExclusiveContextBase10NEWT {
@Override
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase.java
index 905cbcf..8c9d6c2 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.acore.glels;
import java.awt.Dimension;
@@ -57,11 +57,11 @@ import org.junit.BeforeClass;
/**
* Test re-association of GLContext/GLDrawables,
- * here GLContext's survival of GLDrawable destruction
+ * here GLContext's survival of GLDrawable destruction
* and reuse w/ new or recreated GLDrawable.
* <p>
- * Test utilizes {@link GLEventListenerState} for preserving the
- * GLAutoDrawable state, i.e. GLContext, all GLEventListener
+ * Test utilizes {@link GLEventListenerState} for preserving the
+ * GLAutoDrawable state, i.e. GLContext, all GLEventListener
* and the GLAnimatorControl association.
* </p>
* <p>
@@ -70,7 +70,7 @@ import org.junit.BeforeClass;
*/
public abstract class GLContextDrawableSwitchBase extends UITestCase {
static protected enum GLADType { GLCanvasOnscreen, GLCanvasOffscreen, GLWindow, GLOffscreen };
-
+
// default period for 1 GLAD cycle
static long duration = 1000; // ms
@@ -83,7 +83,7 @@ public abstract class GLContextDrawableSwitchBase extends UITestCase {
}
return new GLCapabilities(GLProfile.get(profile));
}
-
+
@BeforeClass
public static void initClass() {
width = 256;
@@ -101,37 +101,37 @@ public abstract class GLContextDrawableSwitchBase extends UITestCase {
} catch( Throwable throwable ) {
throwable.printStackTrace();
Assume.assumeNoException( throwable );
- }
+ }
}
-
+
static void setFrameVisible(final Frame frame) throws InterruptedException {
try {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.pack();
- frame.setVisible(true);
- }});
+ frame.setVisible(true);
+ }});
} catch( Throwable throwable ) {
throwable.printStackTrace();
Assume.assumeNoException( throwable );
}
}
-
+
static void destroyFrame(final Frame frame) throws InterruptedException {
try {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.dispose();
- }});
+ }});
} catch( Throwable throwable ) {
throwable.printStackTrace();
Assume.assumeNoException( throwable );
- }
+ }
}
-
+
private GLOffscreenAutoDrawable createGLOffscreenAutoDrawable(GLCapabilities caps, int width, int height) throws InterruptedException {
final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
- return factory.createOffscreenAutoDrawable(null, caps, null, width, height, null);
+ return factory.createOffscreenAutoDrawable(null, caps, null, width, height);
}
protected static boolean validateOnOffscreenLayer(GLADType gladType1, GLADType gladType2) {
@@ -150,37 +150,37 @@ public abstract class GLContextDrawableSwitchBase extends UITestCase {
}
return true;
}
-
- protected void testGLADOneLifecycle(Screen screen, GLCapabilities caps, GLADType gladType, int width,
+
+ protected void testGLADOneLifecycle(Screen screen, GLCapabilities caps, GLADType gladType, int width,
int height, GLEventListenerCounter glelTracker,
- SnapshotGLEventListener snapshotGLEventListener, final GLEventListenerState glelsIn, final GLEventListenerState glelsOut[], GLAnimatorControl animator)
+ SnapshotGLEventListener snapshotGLEventListener, final GLEventListenerState glelsIn, final GLEventListenerState glelsOut[], GLAnimatorControl animator)
throws InterruptedException {
-
+
System.err.println("GLAD Lifecycle.0 "+gladType+", restoring "+((null!=glelsIn)?true:false)+", preserving "+((null!=glelsOut)?true:false));
final Frame frame;
final GLAutoDrawable glad;
- if( GLADType.GLCanvasOnscreen == gladType ) {
+ if( GLADType.GLCanvasOnscreen == gladType ) {
if( jogamp.nativewindow.jawt.JAWTUtil.isOffscreenLayerRequired() ) {
throw new InternalError("Platform requires offscreen rendering, but onscreen requested: "+gladType);
}
frame = new Frame("AWT GLCanvas");
-
+
glad = new GLCanvas(caps);
setGLCanvasSize((GLCanvas)glad, new Dimension(width, height));
frame.add((GLCanvas)glad);
- } else if( GLADType.GLCanvasOffscreen == gladType ) {
+ } else if( GLADType.GLCanvasOffscreen == gladType ) {
if( !jogamp.nativewindow.jawt.JAWTUtil.isOffscreenLayerSupported() ) {
throw new InternalError("Platform doesn't support offscreen rendering: "+gladType);
}
frame = new Frame("AWT GLCanvas");
-
+
glad = new GLCanvas(caps);
((GLCanvas)glad).setShallUseOffscreenLayer(true);
setGLCanvasSize((GLCanvas)glad, new Dimension(width, height));
frame.add((GLCanvas)glad);
} else if( GLADType.GLWindow == gladType ) {
frame = null;
-
+
if( null != screen ) {
glad = GLWindow.create(screen, caps);
} else {
@@ -190,60 +190,60 @@ public abstract class GLContextDrawableSwitchBase extends UITestCase {
((GLWindow)glad).setSize(width, height);
} else if( GLADType.GLOffscreen == gladType ) {
frame = null;
-
+
glad = this.createGLOffscreenAutoDrawable(caps, width, height);
} else {
throw new InternalError("Unsupported: "+gladType);
}
-
+
if( null == glelsIn ) {
if( null != animator ) {
animator.add(glad);
}
glad.addGLEventListener(glelTracker);
glad.addGLEventListener(new GearsES2(1));
- glad.addGLEventListener(snapshotGLEventListener);
+ glad.addGLEventListener(snapshotGLEventListener);
}
snapshotGLEventListener.setMakeSnapshot();
-
- if( GLADType.GLCanvasOnscreen == gladType || GLADType.GLCanvasOffscreen == gladType ) {
- setFrameVisible(frame);
+
+ if( GLADType.GLCanvasOnscreen == gladType || GLADType.GLCanvasOffscreen == gladType ) {
+ setFrameVisible(frame);
Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
} else if( GLADType.GLWindow == gladType ) {
((GLWindow)glad).setVisible(true);
- }
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glad, true));
+ }
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glad, true));
Assert.assertNotNull(glad.getContext());
Assert.assertTrue(glad.isRealized());
-
+
if( null != glelsIn ) {
Assert.assertEquals(0, glad.getGLEventListenerCount());
System.err.println(".. restoring.0");
- glelsIn.moveTo(glad);
+ glelsIn.moveTo(glad);
System.err.println(".. restoring.X");
-
+
Assert.assertEquals(1, glelTracker.initCount);
Assert.assertTrue(1 <= glelTracker.reshapeCount);
Assert.assertTrue(1 <= glelTracker.displayCount);
Assert.assertEquals(0, glelTracker.disposeCount);
Assert.assertEquals(3, glad.getGLEventListenerCount());
-
+
Assert.assertEquals(glelsIn.context, glad.getContext());
Assert.assertEquals(glelsIn.listenerCount(), glad.getGLEventListenerCount());
Assert.assertEquals(glelsIn.context.getGLReadDrawable(), glad.getDelegatedDrawable());
Assert.assertEquals(glelsIn.context.getGLDrawable(), glad.getDelegatedDrawable());
Assert.assertEquals(false, glelsIn.isOwner());
}
-
- for (int wait=0; wait<AWTRobotUtil.POLL_DIVIDER &&
+
+ for (int wait=0; wait<AWTRobotUtil.POLL_DIVIDER &&
( 1 > glelTracker.initCount || 1 > glelTracker.reshapeCount || 1 > glelTracker.displayCount );
wait++) {
Thread.sleep(AWTRobotUtil.TIME_SLICE);
}
-
+
final long t0 = System.currentTimeMillis();
long t1 = t0;
-
+
while( ( t1 - t0 ) < duration ) {
Thread.sleep(100);
t1 = System.currentTimeMillis();
@@ -253,13 +253,13 @@ public abstract class GLContextDrawableSwitchBase extends UITestCase {
Assert.assertTrue(1 <= glelTracker.reshapeCount);
Assert.assertTrue(1 <= glelTracker.displayCount);
Assert.assertEquals(0, glelTracker.disposeCount);
-
+
if( null != glelsOut ) {
final GLContext context1 = glad.getContext();
System.err.println(".. preserving.0");
glelsOut[0] = GLEventListenerState.moveFrom(glad);
System.err.println(".. preserving.X");
-
+
Assert.assertEquals(context1, glelsOut[0].context);
Assert.assertNull(context1.getGLReadDrawable());
Assert.assertNull(context1.getGLDrawable());
@@ -276,8 +276,8 @@ public abstract class GLContextDrawableSwitchBase extends UITestCase {
} else if( GLADType.GLOffscreen == gladType ) {
glad.destroy();
}
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glad, false));
-
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glad, false));
+
Assert.assertEquals(1, glelTracker.initCount);
Assert.assertTrue(1 <= glelTracker.reshapeCount);
Assert.assertTrue(1 <= glelTracker.displayCount);
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 3599258..24eefe7 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
@@ -44,6 +44,8 @@ import com.jogamp.opengl.test.junit.util.GLEventListenerCounter;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* Tests Bug 722
@@ -51,6 +53,7 @@ import org.junit.Test;
* See Bug 722 - https://jogamp.org/bugzilla/show_bug.cgi?id=722.
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug722GLContextDrawableSwitchNewt2AWT extends GLContextDrawableSwitchBase {
static int loops = 10;
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 5f2b9fb..633d9de 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
@@ -58,11 +58,14 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* Test re-association (switching) of GLContext/GLDrawables,
* i.e. ctx1/draw1, ctx2/draw2 -> ctx1/draw2, ctx2/draw1.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLContextDrawableSwitch01NEWT extends UITestCase {
static int width, height;
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
new file mode 100644
index 0000000..316199d
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch02AWT.java
@@ -0,0 +1,192 @@
+/**
+ * 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.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.acore.glels;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.io.IOException;
+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.GLCapabilities;
+import javax.media.opengl.GLDrawableFactory;
+import javax.media.opengl.GLProfile;
+import javax.media.opengl.awt.GLCanvas;
+
+import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.util.GLDrawableUtil;
+
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+/**
+ * Test re-association (switching) of GLContext/GLDrawables,
+ * from GLCanvas to an GLOffscreenAutoDrawable and back.
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestGLContextDrawableSwitch02AWT extends UITestCase {
+ static int width, height;
+
+ static GLCapabilities getCaps(String profile) {
+ if( !GLProfile.isAvailable(profile) ) {
+ System.err.println("Profile "+profile+" n/a");
+ return null;
+ }
+ return new GLCapabilities(GLProfile.get(profile));
+ }
+
+ @BeforeClass
+ public static void initClass() {
+ width = 256;
+ height = 256;
+ }
+
+ private GLAutoDrawable createGLAutoDrawable(final Frame frame, GLCapabilities caps, int width, int height) throws InterruptedException, InvocationTargetException {
+ final GLAutoDrawable glad;
+ if( caps.isOnscreen() ) {
+ GLCanvas glCanvas = new GLCanvas(caps);
+ Assert.assertNotNull(glCanvas);
+ Dimension glc_sz = new Dimension(width, height);
+ glCanvas.setMinimumSize(glc_sz);
+ glCanvas.setPreferredSize(glc_sz);
+ glCanvas.setSize(glc_sz);
+ glad = glCanvas;
+
+ frame.setLayout(new BorderLayout());
+ frame.add(glCanvas, BorderLayout.CENTER);
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.pack();
+ frame.setVisible(true);
+ }});
+
+ } else {
+ final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
+ glad = factory.createOffscreenAutoDrawable(null, caps, null, width, height);
+ Assert.assertNotNull(glad);
+ }
+ return glad;
+ }
+
+ @Test(timeout=30000)
+ public void testSwitch2AWTGLCanvas2OffscreenGL2ES2() throws InterruptedException, InvocationTargetException {
+ final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2);
+ if(null == reqGLCaps) return;
+ testSwitch2AWTGLCanvas2OffscreenImpl(reqGLCaps);
+ }
+
+ private void testSwitch2AWTGLCanvas2OffscreenImpl(GLCapabilities capsOnscreen) throws InterruptedException, InvocationTargetException {
+ final GLCapabilities capsOffscreen = (GLCapabilities) capsOnscreen.clone();
+ capsOffscreen.setOnscreen(false);
+
+ final QuitAdapter quitAdapter = new QuitAdapter();
+
+ final Frame frame = new Frame("Gears AWT Test");
+ Assert.assertNotNull(frame);
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+
+ GLAutoDrawable glCanvas = createGLAutoDrawable(frame, capsOnscreen, width, height);
+
+ final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener();
+ GearsES2 gears = new GearsES2(1);
+ glCanvas.addGLEventListener(gears);
+ glCanvas.addGLEventListener(snapshotGLEventListener);
+ snapshotGLEventListener.setMakeSnapshot();
+
+ Animator animator = new Animator();
+ animator.add(glCanvas);
+ animator.start();
+
+ int s = 0;
+ long t0 = System.currentTimeMillis();
+ long t1 = t0;
+
+ GLAutoDrawable glOffscreen = createGLAutoDrawable(null, capsOffscreen, width, height);
+ while( !quitAdapter.shouldQuit() && ( t1 - t0 ) < duration ) {
+ if( ( t1 - t0 ) / period > s) {
+ s++;
+ System.err.println(s+" - switch - START "+ ( t1 - t0 ));
+
+ // switch context _and_ the demo synchronously
+ GLDrawableUtil.swapGLContextAndAllGLEventListener(glCanvas, glOffscreen);
+ snapshotGLEventListener.setMakeSnapshot();
+
+ System.err.println(s+" - switch - END "+ ( t1 - t0 ));
+ }
+ Thread.sleep(100);
+ t1 = System.currentTimeMillis();
+ }
+
+ animator.stop();
+ // glCanvas.destroy();
+ glOffscreen.destroy();
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ final Frame _frame = frame;
+ _frame.dispose();
+ }});
+ }
+
+ // default timing for 2 switches
+ static long duration = 2900; // ms
+ static long period = 1000; // ms
+
+ public static void main(String args[]) throws IOException {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ try {
+ duration = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ } else if(args[i].equals("-period")) {
+ i++;
+ try {
+ period = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ }
+ }
+ /**
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ System.err.println("Press enter to continue");
+ System.err.println(stdin.readLine()); */
+ org.junit.runner.JUnitCore.main(TestGLContextDrawableSwitch02AWT.class.getName());
+ }
+}
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 2bba76e..4225cd9 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
@@ -58,6 +58,8 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* Test re-association of GLContext/GLDrawables,
@@ -75,6 +77,7 @@ import org.junit.Test;
* See Bug 665 - https://jogamp.org/bugzilla/show_bug.cgi?id=665.
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLContextDrawableSwitch10NEWT extends UITestCase {
// default period for 1 GLAD cycle
static long duration = 1000; // ms
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 a3f3ffb..e5f61a4 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
@@ -40,6 +40,8 @@ import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.test.junit.util.GLEventListenerCounter;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* Test re-association of GLContext/GLDrawables,
@@ -57,6 +59,7 @@ import org.junit.Test;
* See Bug 665 - https://jogamp.org/bugzilla/show_bug.cgi?id=665.
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLContextDrawableSwitch11NewtAWT extends GLContextDrawableSwitchBase {
@Test(timeout=30000)
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 95e895d..d17d899 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
@@ -41,6 +41,8 @@ import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.test.junit.util.GLEventListenerCounter;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* Test re-association of GLContext/GLDrawables,
@@ -58,6 +60,7 @@ import org.junit.Test;
* See Bug 665 - https://jogamp.org/bugzilla/show_bug.cgi?id=665.
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLContextDrawableSwitch12AWT extends GLContextDrawableSwitchBase {
@Test(timeout=30000)
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch21Newt2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch21Newt2AWT.java
index d337570..2b0f43d 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch21Newt2AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch21Newt2AWT.java
@@ -44,6 +44,8 @@ import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.test.junit.util.GLEventListenerCounter;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* Test re-association of GLContext/GLDrawables,
@@ -70,6 +72,7 @@ import org.junit.Test;
* to avoid such re-usage worksaround this problem.
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLContextDrawableSwitch21Newt2AWT extends GLContextDrawableSwitchBase {
@Test(timeout=30000)
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 d444f02..6152fb1 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
@@ -42,8 +42,11 @@ import org.junit.Assert;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestAWT01GLn extends UITestCase {
@BeforeClass
public static void startup() {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT02WindowClosing.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT02WindowClosing.java
index 6c0bc77..349674e 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT02WindowClosing.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT02WindowClosing.java
@@ -36,7 +36,10 @@ import java.awt.event.*;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestAWT02WindowClosing extends UITestCase {
static long durationPerTest = 200; // ms
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 49ad1c9..7282687 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
@@ -46,8 +46,11 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.After;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestAWT03GLCanvasRecreate01 extends UITestCase {
static long durationPerTest = 1000; // ms
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWTCardLayoutAnimatorStartStopBug532.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWTCardLayoutAnimatorStartStopBug532.java
index 1237fc9..d757d95 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWTCardLayoutAnimatorStartStopBug532.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWTCardLayoutAnimatorStartStopBug532.java
@@ -19,6 +19,8 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.util.MiscUtils;
@@ -26,6 +28,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.FPSAnimator;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestAWTCardLayoutAnimatorStartStopBug532 extends UITestCase {
static final String LABEL = "Label";
static final String CANVAS = "GLCanvas";
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 c89ce43..00e14b0 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
@@ -34,7 +34,10 @@ import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLCanvas;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug460GLCanvasNPEAWT {
public static void main(String[] args) {
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 56e3084..96ec8ab 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -31,7 +31,7 @@ package com.jogamp.opengl.test.junit.jogl.awt;
import java.awt.Container;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
-
+
import java.awt.image.BufferedImage;
import java.lang.reflect.InvocationTargetException;
@@ -49,6 +49,8 @@ import javax.swing.JLabel;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
@@ -60,16 +62,17 @@ import com.jogamp.opengl.util.awt.AWTGLReadBufferUtil;
*
* @author Wade Walker (from code sample provided by Owen Dimond)
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug461FBOSupersamplingSwingAWT extends UITestCase implements GLEventListener {
static long durationPerTest = 500;
JFrame jframe;
GLOffscreenAutoDrawable offScreenBuffer;
AWTGLReadBufferUtil awtGLReadBufferUtil;
-
+
private void render(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
Assert.assertNotNull(gl);
- gl.glClear(GL.GL_COLOR_BUFFER_BIT);
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT);
// draw a triangle filling the window
gl.glBegin(GL.GL_TRIANGLES);
@@ -81,7 +84,7 @@ public class TestBug461FBOSupersamplingSwingAWT extends UITestCase implements GL
gl.glVertex2d(1, -1);
gl.glEnd();
}
-
+
/* @Override */
public void init(GLAutoDrawable drawable) {
awtGLReadBufferUtil = new AWTGLReadBufferUtil(drawable.getGLProfile(), false);
@@ -89,16 +92,16 @@ public class TestBug461FBOSupersamplingSwingAWT extends UITestCase implements GL
/* @Override */
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
- }
-
+ }
+
/* @Override */
- public void display(GLAutoDrawable drawable) {
+ public void display(GLAutoDrawable drawable) {
render(offScreenBuffer);
// BufferedImage outputImage = com.jogamp.opengl.util.awt.Screenshot.readToBufferedImage(200, 200, false);
BufferedImage outputImage = awtGLReadBufferUtil.readPixelsToBufferedImage(drawable.getGL(), 0, 0, 200, 200, true /* awtOrientation */);
Assert.assertNotNull(outputImage);
ImageIcon imageIcon = new ImageIcon(outputImage);
- final JLabel imageLabel = new JLabel(imageIcon);
+ final JLabel imageLabel = new JLabel(imageIcon);
try {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
@@ -113,7 +116,7 @@ public class TestBug461FBOSupersamplingSwingAWT extends UITestCase implements GL
}
/* @Override */
- public void dispose(GLAutoDrawable drawable) {
+ public void dispose(GLAutoDrawable drawable) {
try {
awtGLReadBufferUtil.dispose(drawable.getGL());
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
@@ -138,29 +141,29 @@ public class TestBug461FBOSupersamplingSwingAWT extends UITestCase implements GL
GLProfile glp = GLProfile.get(GLProfile.GL2);
Assert.assertNotNull(glp);
-
+
GLDrawableFactory fac = GLDrawableFactory.getFactory(glp);
Assert.assertNotNull(fac);
-
+
Assert.assertTrue( fac.canCreateGLPbuffer(GLProfile.getDefaultDevice(), glp) );
-
+
GLCapabilities glCap = new GLCapabilities(glp);
Assert.assertNotNull(glCap);
-
- // COMMENTING OUT THIS LINE FIXES THE ISSUE.
+
+ // COMMENTING OUT THIS LINE FIXES THE ISSUE.
// Setting this in JOGL1 works. Thus this is a JOGL2 issue.
glCap.setSampleBuffers(true);
-
+
// Without line below, there is an error on Windows.
// glCap.setDoubleBuffered(false); // implicit double buffer -> MSAA + FBO
-
+
// Needed for drop shadows
glCap.setStencilBits(1);
//makes a new buffer
- offScreenBuffer = fac.createOffscreenAutoDrawable(GLProfile.getDefaultDevice(), glCap, null, 200, 200, null);
+ offScreenBuffer = fac.createOffscreenAutoDrawable(GLProfile.getDefaultDevice(), glCap, null, 200, 200);
Assert.assertNotNull(offScreenBuffer);
- offScreenBuffer.addGLEventListener(this);
+ offScreenBuffer.addGLEventListener(this);
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
jframe.setSize( 300, 300);
@@ -168,7 +171,7 @@ public class TestBug461FBOSupersamplingSwingAWT extends UITestCase implements GL
}});
offScreenBuffer.display(); // read from front buffer due to FBO+MSAA -> double-buffer
offScreenBuffer.display(); // now we have prev. image in front buffer to be read out
-
+
Thread.sleep(durationPerTest);
offScreenBuffer.destroy();
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 bda1a29..a1abbe2 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
@@ -48,6 +48,8 @@ import javax.swing.JLabel;
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;
@@ -58,6 +60,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
* @author Wade Walker (from code sample provided by Owen Dimond)
*/
@SuppressWarnings("deprecation")
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug461PBufferSupersamplingSwingAWT extends UITestCase implements GLEventListener {
JFrame jframe;
GLPbuffer offScreenBuffer;
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 e68ddb4..51eb222 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
@@ -46,6 +46,8 @@ import java.awt.Window;
import javax.swing.JFrame;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import static org.junit.Assume.*;
import static javax.swing.SwingUtilities.*;
@@ -54,6 +56,7 @@ import static javax.swing.SwingUtilities.*;
* Tests context creation + display on various kinds of Window implementations.
* @author Michael Bien, et. al.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug551AWT extends UITestCase {
static void checkGraphicsEnvironment() {
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 ea8fe07..2343360 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.awt;
import java.awt.Dimension;
@@ -38,10 +38,11 @@ import javax.media.opengl.awt.GLCanvas;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
-import junit.framework.Assert;
-
+import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
@@ -50,16 +51,17 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
/**
* Test realize GLCanvas and setVisible(true) AWT-Frames on AWT-EDT and on current thread (non AWT-EDT)
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug572AWT extends UITestCase {
static long durationPerTest = 150; // ms
-
+
static class Cleanup implements Runnable {
Window window;
-
+
public Cleanup(Window w) {
window = w;
}
-
+
public void run() {
System.err.println("cleaning up...");
window.setVisible(false);
@@ -72,10 +74,10 @@ public class TestBug572AWT extends UITestCase {
window.dispose();
}
}
-
+
private void testRealizeGLCanvas(final boolean onAWTEDT, final boolean setFrameSize) throws InterruptedException, InvocationTargetException {
final Window window = new JFrame(this.getSimpleTestName(" - "));
- final GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2());
+ final GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2());
final GLCanvas glCanvas = new GLCanvas(caps);
final SnapshotGLEventListener snapshooter = new SnapshotGLEventListener();
snapshooter.setMakeSnapshotAlways(true);
@@ -92,7 +94,7 @@ public class TestBug572AWT extends UITestCase {
if( setFrameSize ) {
window.setSize(512, 512);
window.validate();
- } else {
+ } else {
Dimension size = new Dimension(512, 512);
glCanvas.setPreferredSize(size);
glCanvas.setMinimumSize(size);
@@ -106,42 +108,42 @@ public class TestBug572AWT extends UITestCase {
} else {
// trigger realization on non AWT-EDT, realization will happen at a later time ..
realizeAction.run();
-
+
// Wait until it's displayable after issuing initial setVisible(true) on current thread (non AWT-EDT)!
Assert.assertTrue("GLCanvas didn't become visible", AWTRobotUtil.waitForVisible(glCanvas, true));
- Assert.assertTrue("GLCanvas didn't become realized", AWTRobotUtil.waitForRealized(glCanvas, true)); // implies displayable
+ Assert.assertTrue("GLCanvas didn't become realized", AWTRobotUtil.waitForRealized(glCanvas, true)); // implies displayable
}
-
+
System.err.println("XXXX-0 "+glCanvas.getDelegatedDrawable().isRealized()+", "+glCanvas);
-
+
Assert.assertTrue("GLCanvas didn't become displayable", glCanvas.isDisplayable());
Assert.assertTrue("GLCanvas didn't become realized", glCanvas.isRealized());
-
+
// The AWT-EDT reshape/repaint events happen offthread later ..
System.err.println("XXXX-1 reshapeCount "+snapshooter.getReshapeCount());
System.err.println("XXXX-1 displayCount "+snapshooter.getDisplayCount());
-
+
// Wait unitl AWT-EDT has issued reshape/repaint
for (int wait=0; wait<AWTRobotUtil.POLL_DIVIDER &&
- ( 0 == snapshooter.getReshapeCount() || 0 == snapshooter.getDisplayCount() );
+ ( 0 == snapshooter.getReshapeCount() || 0 == snapshooter.getDisplayCount() );
wait++) {
Thread.sleep(AWTRobotUtil.TIME_SLICE);
}
System.err.println("XXXX-2 reshapeCount "+snapshooter.getReshapeCount());
System.err.println("XXXX-2 displayCount "+snapshooter.getDisplayCount());
-
+
Assert.assertTrue("GLCanvas didn't reshape", snapshooter.getReshapeCount()>0);
Assert.assertTrue("GLCanvas didn't display", snapshooter.getDisplayCount()>0);
-
+
Thread.sleep(durationPerTest);
-
+
// After initial 'setVisible(true)' all AWT manipulation needs to be done
// via the AWT EDT, according to the AWT spec.
// AWT / Swing on EDT..
SwingUtilities.invokeAndWait(new Cleanup(window));
}
-
+
@Test(timeout = 10000) // 10s timeout
public void test01RealizeGLCanvasOnAWTEDTUseFrameSize() throws InterruptedException, InvocationTargetException {
testRealizeGLCanvas(true, true);
@@ -151,7 +153,7 @@ public class TestBug572AWT extends UITestCase {
public void test02RealizeGLCanvasOnAWTEDTUseGLCanvasSize() throws InterruptedException, InvocationTargetException {
testRealizeGLCanvas(true, false);
}
-
+
@Test(timeout = 10000) // 10s timeout
public void test11RealizeGLCanvasOnMainTUseFrameSize() throws InterruptedException, InvocationTargetException {
testRealizeGLCanvas(false, true);
@@ -161,7 +163,7 @@ public class TestBug572AWT extends UITestCase {
public void test12RealizeGLCanvasOnMainTUseGLCanvasSize() throws InterruptedException, InvocationTargetException {
testRealizeGLCanvas(false, false);
}
-
+
public static void main(String args[]) {
org.junit.runner.JUnitCore.main(TestBug572AWT.class.getName());
}
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 b6a7639..d8e781d 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
@@ -7,6 +7,8 @@ import java.io.File;
import javax.media.opengl.GLProfile;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.os.Platform;
import com.jogamp.opengl.test.junit.util.UITestCase;
@@ -24,6 +26,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
* Since Windows XP is out of life .. we may not care ..
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug611AWT extends UITestCase {
@Test
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 8b88a86..57210a9 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
@@ -25,6 +25,8 @@ import javax.swing.WindowConstants;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.util.ReflectionUtil;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
@@ -42,6 +44,7 @@ import com.jogamp.opengl.util.FPSAnimator;
* See Bug 586
* See git commit '8df12ca151dfc577c90b485d4ebfe491b88e55aa'.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug642JSplitPaneMixHwLw01AWT extends UITestCase {
static long durationPerTest = 500;
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 d59bc22..91da73e 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
@@ -51,12 +51,15 @@ import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
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 com.jogamp.opengl.util.Animator;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug664GLCanvasSetVisibleSwingAWT extends UITestCase {
static long durationPerTest = 500;
static boolean shallUseOffscreenFBOLayer = false;
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 0c09753..3363fdd 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.awt;
import java.awt.BorderLayout;
@@ -40,35 +40,37 @@ import javax.media.opengl.awt.GLCanvas;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
-import junit.framework.Assert;
-
+import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
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;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug675BeansInDesignTimeAWT extends UITestCase {
static boolean waitForKey = false;
static long durationPerTest = 200;
-
+
@Test
public void test01() throws InterruptedException, InvocationTargetException {
Beans.setDesignTime(true);
-
- final GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2());
+
+ final GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2());
final GLCanvas glCanvas = new GLCanvas(caps);
final Dimension preferredGLSize = new Dimension(400,200);
glCanvas.setPreferredSize(preferredGLSize);
glCanvas.setMinimumSize(preferredGLSize);
glCanvas.setSize(preferredGLSize);
-
+
glCanvas.addGLEventListener(new GearsES2());
final Window window = new JFrame(this.getSimpleTestName(" - "));
window.setLayout(new BorderLayout());
window.add(glCanvas, BorderLayout.CENTER);
-
+
// trigger realization on AWT-EDT, otherwise it won't immediatly ..
SwingUtilities.invokeAndWait(new Runnable() {
@Override
@@ -76,22 +78,22 @@ public class TestBug675BeansInDesignTimeAWT extends UITestCase {
window.pack();
window.validate();
window.setVisible(true);
- }
+ }
} );
-
+
// Immediately displayable after issuing initial setVisible(true) on AWT-EDT!
Assert.assertTrue("GLCanvas didn't become displayable", glCanvas.isDisplayable());
if( !Beans.isDesignTime() ) {
Assert.assertTrue("GLCanvas didn't become realized", glCanvas.isRealized());
}
-
+
Thread.sleep(durationPerTest);
-
+
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
window.dispose();
- }
+ }
} );
}
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
new file mode 100644
index 0000000..f28a034
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816JTabbedPanelVisibilityB849B878AWT.java
@@ -0,0 +1,175 @@
+/**
+ * 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.
+ */
+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 javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+import javax.swing.SwingUtilities;
+
+import org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+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.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+/**
+ * AWT JFrame w/ JTabbedPanel, Moving GLCanvas between it's tabs while selecting.
+ * <p>
+ * Validates bugs:
+ * <ul>
+ * <li>Bug 816: OSX CALayer Positioning Bug</li>
+ * <li>Bug 729: OSX CALayer shall honor the Component's visibility state</li>
+ * <li>Bug 849: AWT GLAutoDrawables (JAWTWindow) shall honor it's parent visibility state</li>
+ * <li>Bug 878: JAWTWindow's HierarchyListener doesn't set component visible (again) on 'addNotify(..)' - GLCanvas in JtabbedPane disappear</li>
+ * </ul>
+ * </p>
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestBug816JTabbedPanelVisibilityB849B878AWT extends UITestCase {
+
+ static long durationPerTest = 500*4; // ms
+ static boolean manual = false;
+
+ @Test
+ public void test() throws InterruptedException, InvocationTargetException {
+ final JFrame frame = new JFrame("TestBug816OSXCALayerPos03dBug878AWT");
+
+ final JPanel panel1 = new javax.swing.JPanel();
+ final JPanel panel2 = new javax.swing.JPanel();
+
+ panel1.setLayout(new BorderLayout());
+ panel2.setLayout(new BorderLayout());
+
+ GLProfile profile = GLProfile.get(GLProfile.GL2ES2);
+ GLCapabilities glCapabilities = new GLCapabilities(profile);
+ final GLCanvas glCanvas = new GLCanvas(glCapabilities);
+ glCanvas.setSize(new java.awt.Dimension(640, 480));
+ glCanvas.addGLEventListener(new GearsES2(1));
+ panel1.add(glCanvas, BorderLayout.CENTER);
+
+ final JTabbedPane tabbedPanel = new JTabbedPane();
+ tabbedPanel.addTab("tab1", panel1);
+ tabbedPanel.addTab("tab2", panel2);
+
+ tabbedPanel.addChangeListener(new javax.swing.event.ChangeListener() {
+ @Override
+ public void stateChanged(javax.swing.event.ChangeEvent evt) {
+ if (tabbedPanel.getSelectedIndex() == 0) {
+ dumpGLCanvasStats(glCanvas);
+ panel1.add(glCanvas, BorderLayout.CENTER);
+ dumpGLCanvasStats(glCanvas);
+ } else {
+ System.err.println("XXXX Add GLCanvas Panel1("+id(panel1)+" -> Panel2("+id(panel2)+") START");
+ dumpGLCanvasStats(glCanvas);
+ panel2.add(glCanvas, BorderLayout.CENTER);
+ dumpGLCanvasStats(glCanvas);
+ }
+ }
+ });
+
+ frame.setContentPane(tabbedPanel);
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.pack();
+ System.err.println("XXX SetVisible ON XXX GLCanvas on Panel1("+id(panel1)+")");
+ frame.setVisible(true);
+ }});
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true));
+ dumpGLCanvasStats(glCanvas);
+
+ if(manual) {
+ for(long w=durationPerTest; w>0; w-=100) {
+ Thread.sleep(100);
+ }
+ } else {
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ System.err.println("XXXX Add GLCanvas Panel2("+id(panel2)+") -> Panel1("+id(panel1)+" START");
+ tabbedPanel.setSelectedIndex(0);
+ }});
+ Thread.sleep(durationPerTest/4);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ System.err.println("XXXX Add GLCanvas Panel1("+id(panel1)+" -> Panel2("+id(panel2)+") START");
+ tabbedPanel.setSelectedIndex(1);
+ }});
+ Thread.sleep(durationPerTest/4);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ System.err.println("XXXX Add GLCanvas Panel2("+id(panel2)+") -> Panel1("+id(panel1)+" START");
+ tabbedPanel.setSelectedIndex(0);
+ }});
+ Thread.sleep(durationPerTest/4);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ System.err.println("XXXX Add GLCanvas Panel1("+id(panel1)+" -> Panel2("+id(panel2)+") START");
+ tabbedPanel.setSelectedIndex(1);
+ }});
+ Thread.sleep(durationPerTest/4);
+ }
+
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ System.err.println("XXX SetVisible OFF XXX");
+ frame.dispose();
+ } });
+ }
+
+ private static String id(Object obj) { return "0x"+Integer.toHexString(obj.hashCode()); }
+
+ static void dumpGLCanvasStats(GLCanvas glCanvas) {
+ System.err.println("XXXX GLCanvas: comp "+glCanvas+", visible "+glCanvas.isVisible()+", showing "+glCanvas.isShowing()+
+ ", displayable "+glCanvas.isDisplayable()+", "+glCanvas.getWidth()+"x"+glCanvas.getHeight());
+ }
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ durationPerTest = MiscUtils.atoi(args[++i], (int)durationPerTest);
+ } else if(args[i].equals("-manual")) {
+ manual = true;
+ }
+ }
+ org.junit.runner.JUnitCore.main(TestBug816JTabbedPanelVisibilityB849B878AWT.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..fade6c3
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java
@@ -0,0 +1,486 @@
+/**
+ * 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.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.awt;
+
+import javax.media.opengl.*;
+
+import com.jogamp.opengl.util.Animator;
+
+import javax.media.opengl.awt.GLCanvas;
+import javax.swing.BoundedRangeModel;
+import javax.swing.BoxLayout;
+import javax.swing.JFrame;
+import javax.swing.JScrollBar;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+import javax.swing.ScrollPaneConstants;
+
+import com.jogamp.common.util.awt.AWTEDTExecutor;
+import com.jogamp.newt.event.awt.AWTWindowAdapter;
+import com.jogamp.newt.event.TraceWindowAdapter;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
+
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.GridLayout;
+import java.lang.reflect.InvocationTargetException;
+
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.BeforeClass;
+import org.junit.AfterClass;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+/**
+ * Bug 816: OSX CALayer Positioning Bug.
+ * <p>
+ * Diff. OSX CALayer positioning w/ java6, [7uxx..7u40[, and >= 7u40
+ * </p>
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestBug816OSXCALayerPos01AWT extends UITestCase {
+ public enum FrameLayout { None, Flow, DoubleBorderCenterSurrounded, Box, Split };
+
+ static long duration = 1600; // ms
+ static int width, height;
+
+ static boolean forceES2 = false;
+ static boolean forceGL3 = false;
+ static int swapInterval = 1;
+ static java.awt.Dimension rwsize;
+
+ @BeforeClass
+ public static void initClass() {
+ width = 640;
+ height = 480;
+ rwsize = new Dimension(800, 600);
+ }
+
+ @AfterClass
+ public static void releaseClass() {
+ }
+
+ static void setComponentSize(final Frame frame, final Component comp1, final java.awt.Dimension new_sz1, final Component comp2, final java.awt.Dimension new_sz2) {
+ try {
+ AWTEDTExecutor.singleton.invoke(true /* wait */, new Runnable() {
+ public void run() {
+ comp1.setMinimumSize(new_sz1);
+ comp1.setPreferredSize(new_sz1);
+ comp1.setSize(new_sz1);
+ if( null != comp2 ) {
+ comp2.setMinimumSize(new_sz2);
+ comp2.setPreferredSize(new_sz2);
+ comp2.setSize(new_sz2);
+ }
+ if( null != frame ) {
+ frame.pack();
+ }
+ } } );
+ } catch( Throwable throwable ) {
+ throwable.printStackTrace();
+ Assume.assumeNoException( throwable );
+ }
+ }
+ static void setFrameSize(final Frame frame, final boolean frameLayout, final java.awt.Dimension new_sz) {
+ try {
+ AWTEDTExecutor.singleton.invoke(true /* wait */, new Runnable() {
+ public void run() {
+ frame.setSize(new_sz);
+ if( frameLayout ) {
+ frame.validate();
+ }
+ } } );
+ } catch( Throwable throwable ) {
+ throwable.printStackTrace();
+ Assume.assumeNoException( throwable );
+ }
+ }
+
+ protected void runTestGL(GLCapabilities caps, FrameLayout frameLayout, final boolean twoCanvas, final boolean resizeByComp) throws InterruptedException, InvocationTargetException {
+ final JFrame frame = new JFrame("Bug816: "+this.getTestMethodName());
+ Assert.assertNotNull(frame);
+ final Container framePane = frame.getContentPane();
+
+ final GLCanvas glCanvas1 = new GLCanvas(caps);
+ Assert.assertNotNull(glCanvas1);
+ final GLCanvas glCanvas2;
+ if( twoCanvas ) {
+ glCanvas2 = new GLCanvas(caps);
+ Assert.assertNotNull(glCanvas2);
+ } else {
+ glCanvas2 = null;
+ }
+
+ final Dimension glcDim = new Dimension(width/2, height);
+ final Dimension frameDim = new Dimension(twoCanvas ? width + 64: width/2 + 64, height + 64);
+
+ setComponentSize(null, glCanvas1, glcDim, glCanvas2, glcDim);
+
+ switch( frameLayout) {
+ case None: {
+ framePane.add(glCanvas1);
+ }
+ break;
+ case Flow: {
+ final Container c = new Container();
+ c.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
+ c.add(glCanvas1);
+ if( twoCanvas ) {
+ c.add(glCanvas2);
+ }
+ framePane.add(c);
+ }
+ break;
+ case DoubleBorderCenterSurrounded: {
+ final Container c = new Container();
+ c.setLayout(new BorderLayout());
+ c.add(new Button("north"), BorderLayout.NORTH);
+ c.add(new Button("south"), BorderLayout.SOUTH);
+ c.add(new Button("east"), BorderLayout.EAST);
+ c.add(new Button("west"), BorderLayout.WEST);
+ if( twoCanvas ) {
+ final Container c2 = new Container();
+ c2.setLayout(new GridLayout(1, 2));
+ c2.add(glCanvas1);
+ c2.add(glCanvas2);
+ c.add(c2, BorderLayout.CENTER);
+ } else {
+ c.add(glCanvas1, BorderLayout.CENTER);
+ }
+ framePane.setLayout(new BorderLayout());
+ framePane.add(new Button("NORTH"), BorderLayout.NORTH);
+ framePane.add(new Button("SOUTH"), BorderLayout.SOUTH);
+ framePane.add(new Button("EAST"), BorderLayout.EAST);
+ framePane.add(new Button("WEST"), BorderLayout.WEST);
+ framePane.add(c, BorderLayout.CENTER);
+ }
+ break;
+ case Box: {
+ final Container c = new Container();
+ c.setLayout(new BoxLayout(c, BoxLayout.X_AXIS));
+ c.add(glCanvas1);
+ if( twoCanvas ) {
+ c.add(glCanvas2);
+ }
+ framePane.add(c);
+ }
+ break;
+ case Split: {
+ Dimension sbDim = new Dimension(16, 16);
+ JScrollPane vsp = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
+ {
+ JScrollBar vsb = vsp.getVerticalScrollBar();
+ vsb.setPreferredSize(sbDim);
+ BoundedRangeModel model = vsb.getModel();
+ model.setMinimum(0);
+ model.setMaximum(100);
+ model.setValue(50);
+ model.setExtent(1);
+ vsb.setEnabled(true);
+ }
+ JScrollPane hsp = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
+ {
+ JScrollBar hsb = hsp.getHorizontalScrollBar();
+ hsb.setPreferredSize(sbDim);
+ BoundedRangeModel model = hsb.getModel();
+ model.setMinimum(0);
+ model.setMaximum(100);
+ model.setValue(50);
+ model.setExtent(1);
+ hsb.setEnabled(true);
+ }
+ JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true,
+ twoCanvas ? glCanvas2 : vsp, glCanvas1 );
+ horizontalSplitPane.setResizeWeight(0.5);
+ JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
+ true, horizontalSplitPane, hsp);
+ verticalSplitPane.setResizeWeight(0.5);
+ framePane.add(verticalSplitPane);
+ }
+ break;
+ }
+ final GearsES2 demo1 = new GearsES2(swapInterval);
+ glCanvas1.addGLEventListener(demo1);
+ if( twoCanvas ) {
+ final RedSquareES2 demo2 = new RedSquareES2(swapInterval);
+ glCanvas2.addGLEventListener(demo2);
+ }
+
+ final Animator animator = new Animator();
+ animator.add(glCanvas1);
+ if( twoCanvas ) {
+ animator.add(glCanvas2);
+ }
+ QuitAdapter quitAdapter = new QuitAdapter();
+
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ if( resizeByComp ) {
+ frame.pack();
+ } else {
+ setFrameSize(frame, true, frameDim);
+ }
+ frame.setVisible(true);
+ }});
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
+ if( twoCanvas ) {
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas2, true));
+ }
+
+ animator.start();
+ Assert.assertTrue(animator.isStarted());
+ Assert.assertTrue(animator.isAnimating());
+ animator.setUpdateFPSFrames(60, System.err);
+
+ System.err.println("canvas1 pos/siz: "+glCanvas1.getX()+"/"+glCanvas1.getY()+" "+glCanvas1.getWidth()+"x"+glCanvas1.getHeight());
+ if( twoCanvas ) {
+ System.err.println("canvas2 pos/siz: "+glCanvas2.getX()+"/"+glCanvas2.getY()+" "+glCanvas2.getWidth()+"x"+glCanvas2.getHeight());
+ }
+
+ Thread.sleep(Math.max(1000, duration/2));
+ final Dimension compRSizeHalf = new Dimension(rwsize.width/2, rwsize.height);
+ final Dimension frameRSizeHalf = new Dimension(twoCanvas ? rwsize.width + 64: rwsize.width/2 + 64, rwsize.height + 64);
+ if( resizeByComp ) {
+ setComponentSize(frame, glCanvas1, compRSizeHalf, glCanvas2, compRSizeHalf);
+ } else {
+ setFrameSize(frame, true, frameRSizeHalf);
+ }
+ System.err.println("resize canvas1 pos/siz: "+glCanvas1.getX()+"/"+glCanvas1.getY()+" "+glCanvas1.getWidth()+"x"+glCanvas1.getHeight());
+ if( twoCanvas ) {
+ System.err.println("resize canvas2 pos/siz: "+glCanvas2.getX()+"/"+glCanvas2.getY()+" "+glCanvas2.getWidth()+"x"+glCanvas2.getHeight());
+ }
+
+ final long t0 = System.currentTimeMillis();
+ long t1 = t0;
+ while(!quitAdapter.shouldQuit() && t1 - t0 < duration) {
+ Thread.sleep(100);
+ t1 = System.currentTimeMillis();
+ }
+
+ Assert.assertNotNull(frame);
+ Assert.assertNotNull(glCanvas1);
+ if( twoCanvas ) {
+ Assert.assertNotNull(glCanvas2);
+ } else {
+ Assert.assertNull(glCanvas2);
+ }
+
+ Assert.assertNotNull(animator);
+ animator.stop();
+ Assert.assertFalse(animator.isAnimating());
+ Assert.assertFalse(animator.isStarted());
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setVisible(false);
+ }});
+ Assert.assertEquals(false, frame.isVisible());
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.remove(glCanvas1);
+ if( twoCanvas ) {
+ frame.remove(glCanvas2);
+ }
+ frame.dispose();
+ }});
+ }
+
+ static GLProfile getGLP() {
+ return GLProfile.getMaxProgrammableCore(true);
+ }
+
+ @Test
+ public void test00_Compo_None_One() throws InterruptedException, InvocationTargetException {
+ if( testNum != -1 && testNum != 0 ) { return ; }
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+ runTestGL(caps, FrameLayout.None, false /* twoCanvas */, true /* resizeByComp */);
+ }
+
+ @Test
+ public void test01_Compo_Flow_One() throws InterruptedException, InvocationTargetException {
+ if( testNum != -1 && testNum != 1 ) { return ; }
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+ runTestGL(caps, FrameLayout.Flow, false /* twoCanvas */, true /* resizeByComp */);
+ }
+
+ @Test
+ public void test02_Compo_DblBrd_One() throws InterruptedException, InvocationTargetException {
+ if( testNum != -1 && testNum != 2 ) { return ; }
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+ runTestGL(caps, FrameLayout.DoubleBorderCenterSurrounded, false /* twoCanvas */, true /* resizeByComp */);
+ }
+
+ @Test
+ public void test03_Compo_Box_One() throws InterruptedException, InvocationTargetException {
+ if( testNum != -1 && testNum != 3 ) { return ; }
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+ runTestGL(caps, FrameLayout.Box, false /* twoCanvas */, true /* resizeByComp */);
+ }
+
+ @Test
+ public void test04_Compo_Split_One() throws InterruptedException, InvocationTargetException {
+ if( testNum != -1 && testNum != 4 ) { return ; }
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+ runTestGL(caps, FrameLayout.Split, false /* twoCanvas */, true /* resizeByComp */);
+ }
+
+ @Test
+ public void test05_Compo_Flow_Two() throws InterruptedException, InvocationTargetException {
+ if( testNum != -1 && testNum != 5 ) { return ; }
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+ runTestGL(caps, FrameLayout.Flow, true/* twoCanvas */, true /* resizeByComp */);
+ }
+
+ @Test
+ public void test06_Compo_DblBrd_Two() throws InterruptedException, InvocationTargetException {
+ if( testNum != -1 && testNum != 6 ) { return ; }
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+ runTestGL(caps, FrameLayout.DoubleBorderCenterSurrounded, true/* twoCanvas */, true /* resizeByComp */);
+ }
+
+ @Test
+ public void test07_Compo_Box_Two() throws InterruptedException, InvocationTargetException {
+ if( testNum != -1 && testNum != 7 ) { return ; }
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+ runTestGL(caps, FrameLayout.Box, true/* twoCanvas */, true /* resizeByComp */);
+ }
+
+ @Test
+ public void test08_Compo_Split_Two() throws InterruptedException, InvocationTargetException {
+ if( testNum != -1 && testNum != 8 ) { return ; }
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+ runTestGL(caps, FrameLayout.Split, true/* twoCanvas */, true /* resizeByComp */);
+ }
+
+ @Test
+ public void test10_Frame_None_One() throws InterruptedException, InvocationTargetException {
+ if( testNum != -1 && testNum != 10 ) { return ; }
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+ runTestGL(caps, FrameLayout.None, false /* twoCanvas */, false /* resizeByComp */);
+ }
+
+ @Test
+ public void test11_Frame_Flow_One() throws InterruptedException, InvocationTargetException {
+ if( testNum != -1 && testNum != 11 ) { return ; }
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+ runTestGL(caps, FrameLayout.Flow, false /* twoCanvas */, false /* resizeByComp */);
+ }
+
+ @Test
+ public void test12_Frame_DblBrd_One() throws InterruptedException, InvocationTargetException {
+ if( testNum != -1 && testNum != 12 ) { return ; }
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+ runTestGL(caps, FrameLayout.DoubleBorderCenterSurrounded, false /* twoCanvas */, false /* resizeByComp */);
+ }
+
+ @Test
+ public void test13_Frame_Box_One() throws InterruptedException, InvocationTargetException {
+ if( testNum != -1 && testNum != 13 ) { return ; }
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+ runTestGL(caps, FrameLayout.Box, false /* twoCanvas */, false /* resizeByComp */);
+ }
+
+ @Test
+ public void test14_Frame_Split_One() throws InterruptedException, InvocationTargetException {
+ if( testNum != -1 && testNum != 14) { return ; }
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+ runTestGL(caps, FrameLayout.Split, false /* twoCanvas */, false /* resizeByComp */);
+ }
+
+ @Test
+ public void test15_Frame_Flow_Two() throws InterruptedException, InvocationTargetException {
+ if( testNum != -1 && testNum != 15 ) { return ; }
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+ runTestGL(caps, FrameLayout.Flow, true/* twoCanvas */, false /* resizeByComp */);
+ }
+
+ @Test
+ public void test16_Frame_DblBrd_Two() throws InterruptedException, InvocationTargetException {
+ if( testNum != -1 && testNum != 16 ) { return ; }
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+ runTestGL(caps, FrameLayout.DoubleBorderCenterSurrounded, true/* twoCanvas */, false /* resizeByComp */);
+ }
+
+ @Test
+ public void test17_Frame_Box_Two() throws InterruptedException, InvocationTargetException {
+ if( testNum != -1 && testNum != 17 ) { return ; }
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+ runTestGL(caps, FrameLayout.Box, true/* twoCanvas */, false /* resizeByComp */);
+ }
+
+ @Test
+ public void test18_Frame_Split_Two() throws InterruptedException, InvocationTargetException {
+ if( testNum != -1 && testNum != 18 ) { return ; }
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+ runTestGL(caps, FrameLayout.Split, true/* twoCanvas */, false /* resizeByComp */);
+ }
+
+ static int testNum = -1;
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ duration = MiscUtils.atol(args[i], duration);
+ } else if(args[i].equals("-test")) {
+ i++;
+ testNum = MiscUtils.atoi(args[i], 0);
+ } else if(args[i].equals("-es2")) {
+ forceES2 = true;
+ } else if(args[i].equals("-gl3")) {
+ forceGL3 = true;
+ } else if(args[i].equals("-vsync")) {
+ i++;
+ swapInterval = MiscUtils.atoi(args[i], swapInterval);
+ }
+ }
+
+ System.err.println("resize "+rwsize);
+ System.err.println("forceES2 "+forceES2);
+ System.err.println("forceGL3 "+forceGL3);
+ System.err.println("swapInterval "+swapInterval);
+
+ org.junit.runner.JUnitCore.main(TestBug816OSXCALayerPos01AWT.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..0739564
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java
@@ -0,0 +1,153 @@
+/**
+ * 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.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.awt;
+
+import javax.media.opengl.*;
+
+import com.jogamp.opengl.util.Animator;
+
+import javax.media.opengl.awt.GLCanvas;
+import javax.swing.JFrame;
+import javax.swing.JRootPane;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+
+import com.jogamp.newt.event.awt.AWTWindowAdapter;
+import com.jogamp.newt.event.TraceWindowAdapter;
+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.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+/**
+ * Bug 816: OSX CALayer Positioning Bug - Swing JFrame w/ 2 JRootPanes and 2 JSplitPanes
+ * <p>
+ * Diff. OSX CALayer positioning w/ java6, [7uxx..7u40[, and >= 7u40
+ * </p>
+ * <p>
+ * See also {@link com.jogamp.opengl.test.junit.jogl.demos.es2.awt.Bug816AppletOSXCALayerPos03b}
+ * </p>
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestBug816OSXCALayerPos02AWT extends UITestCase {
+ static long duration = 1600; // ms
+ static int width=640, height=480;
+
+ @Test
+ public void test() throws InterruptedException, InvocationTargetException {
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+
+ final JFrame frame = new JFrame("TestBug816OSXCALayerPos02AWT");
+ Assert.assertNotNull(frame);
+
+ final GLCanvas glCanvas1 = new GLCanvas(caps);
+ Assert.assertNotNull(glCanvas1);
+ glCanvas1.addGLEventListener(new GearsES2(1));
+
+ final Animator animator = new Animator();
+ animator.add(glCanvas1);
+ QuitAdapter quitAdapter = new QuitAdapter();
+
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+
+ // Build a GUI where the canvas 3D is located at top right of the frame
+ // and can be resized with split panes dividers
+ JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
+ true, new JScrollPane(), glCanvas1);
+ verticalSplitPane.setResizeWeight(0.5);
+ JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
+ true, new JScrollPane(), verticalSplitPane);
+ horizontalSplitPane.setResizeWeight(0.5);
+ JRootPane intermediateRootPane = new JRootPane();
+ intermediateRootPane.setContentPane(horizontalSplitPane);
+ frame.add(intermediateRootPane);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setSize(width, height);
+ frame.setVisible(true);
+ }});
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
+
+ animator.start();
+ Assert.assertTrue(animator.isStarted());
+ Assert.assertTrue(animator.isAnimating());
+ animator.setUpdateFPSFrames(60, System.err);
+
+ final long t0 = System.currentTimeMillis();
+ long t1 = t0;
+ while(!quitAdapter.shouldQuit() && t1 - t0 < duration) {
+ Thread.sleep(100);
+ t1 = System.currentTimeMillis();
+ }
+
+ Assert.assertNotNull(frame);
+ Assert.assertNotNull(glCanvas1);
+
+ Assert.assertNotNull(animator);
+ animator.stop();
+ Assert.assertFalse(animator.isAnimating());
+ Assert.assertFalse(animator.isStarted());
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setVisible(false);
+ }});
+ Assert.assertEquals(false, frame.isVisible());
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.remove(glCanvas1);
+ frame.dispose();
+ }});
+ }
+
+ static GLProfile getGLP() {
+ return GLProfile.getMaxProgrammableCore(true);
+ }
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ duration = MiscUtils.atol(args[i], duration);
+ }
+ }
+
+ org.junit.runner.JUnitCore.main(TestBug816OSXCALayerPos02AWT.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..7df6d04
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java
@@ -0,0 +1,165 @@
+/**
+ * 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.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.awt;
+
+import java.awt.BorderLayout;
+import java.awt.Checkbox;
+import java.awt.Frame;
+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 org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.newt.event.TraceWindowAdapter;
+import com.jogamp.newt.event.awt.AWTWindowAdapter;
+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.MiscUtils;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.Animator;
+
+/**
+ * AWT Frame BorderLayout w/ Checkbox North, GLCanvas Center.
+ * <p>
+ * Checkbox toggles GLCanvas visibility state.
+ * </p>
+ * <p>
+ * Validates bugs:
+ * <ul>
+ * <li>Bug 816: OSX CALayer Positioning Bug</li>
+ * <li>Bug 729: OSX CALayer shall honor the Component's visibility state</li>
+ * </ul>
+ * </p>
+ * <p>
+ * Diff. OSX CALayer positioning w/ java6, [7uxx..7u40[, and >= 7u40
+ * </p>
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestBug816OSXCALayerPos03aB729AWT extends UITestCase {
+ static long duration = 1600; // ms
+ static int width=640, height=480;
+
+ @Test
+ public void test() throws InterruptedException, InvocationTargetException {
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+
+ final Frame frame = new Frame("TestBug816OSXCALayerPos03aAWT");
+ Assert.assertNotNull(frame);
+
+ final GLCanvas glCanvas1 = new GLCanvas(caps);
+ Assert.assertNotNull(glCanvas1);
+ glCanvas1.addGLEventListener(new GearsES2(1));
+
+ final Animator animator = new Animator();
+ animator.add(glCanvas1);
+ QuitAdapter quitAdapter = new QuitAdapter();
+
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+
+ // Create a check box that hides / shows canvas
+ final Checkbox checkbox = new Checkbox("Visible canvas", true);
+ checkbox.addItemListener(new ItemListener() {
+ public void itemStateChanged(ItemEvent ev) {
+ glCanvas1.setVisible(checkbox.getState());
+ System.out.println("Canvas visible: "+glCanvas1.isVisible());
+ if( glCanvas1.isVisible() ) {
+ frame.validate(); // take care of resized frame while hidden
+ }
+ }
+ });
+
+ // Build a GUI that displays canvas and check box
+ frame.setLayout(new BorderLayout());
+ frame.add(glCanvas1, BorderLayout.CENTER);
+ frame.add(checkbox, BorderLayout.NORTH);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setSize(width, height);
+ frame.setVisible(true);
+ }});
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
+
+ animator.start();
+ Assert.assertTrue(animator.isStarted());
+ Assert.assertTrue(animator.isAnimating());
+ animator.setUpdateFPSFrames(60, System.err);
+
+ final long t0 = System.currentTimeMillis();
+ long t1 = t0;
+ while(!quitAdapter.shouldQuit() && t1 - t0 < duration) {
+ Thread.sleep(100);
+ t1 = System.currentTimeMillis();
+ }
+
+ Assert.assertNotNull(frame);
+ Assert.assertNotNull(glCanvas1);
+
+ Assert.assertNotNull(animator);
+ animator.stop();
+ Assert.assertFalse(animator.isAnimating());
+ Assert.assertFalse(animator.isStarted());
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setVisible(false);
+ }});
+ Assert.assertEquals(false, frame.isVisible());
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.remove(glCanvas1);
+ frame.dispose();
+ }});
+ }
+
+ static GLProfile getGLP() {
+ return GLProfile.getMaxProgrammableCore(true);
+ }
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ duration = MiscUtils.atol(args[i], duration);
+ }
+ }
+
+ org.junit.runner.JUnitCore.main(TestBug816OSXCALayerPos03aB729AWT.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..210113d
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java
@@ -0,0 +1,171 @@
+/**
+ * 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.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.awt;
+
+import java.awt.BorderLayout;
+import java.awt.Checkbox;
+import java.awt.Frame;
+import java.awt.GridLayout;
+import java.awt.Panel;
+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 org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.newt.event.TraceWindowAdapter;
+import com.jogamp.newt.event.awt.AWTWindowAdapter;
+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.MiscUtils;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.Animator;
+
+/**
+ * AWT Frame BorderLayout w/ Checkbox North, Panel.GLCanvas Center.
+ * <p>
+ * Checkbox toggles GLCanvas's parent panel's visibility state.
+ * </p>
+ * <p>
+ * Validates bugs:
+ * <ul>
+ * <li>Bug 816: OSX CALayer Positioning Bug</li>
+ * <li>Bug 729: OSX CALayer shall honor the Component's visibility state</li>
+ * <li>Bug 849: AWT GLAutoDrawables (JAWTWindow) shall honor it's parent visibility state</li>
+ * </ul>
+ * </p>
+ * <p>
+ * Diff. OSX CALayer positioning w/ java6, [7uxx..7u40[, and >= 7u40
+ * </p>
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestBug816OSXCALayerPos03bB849AWT extends UITestCase {
+ static long duration = 1600; // ms
+ static int width=640, height=480;
+
+ @Test
+ public void test() throws InterruptedException, InvocationTargetException {
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+
+ final Frame frame = new Frame("TestBug816OSXCALayerPos03bAWT");
+ Assert.assertNotNull(frame);
+
+ final GLCanvas glCanvas1 = new GLCanvas(caps);
+ Assert.assertNotNull(glCanvas1);
+ glCanvas1.addGLEventListener(new GearsES2(1));
+ // Put it in a panel
+ final Panel panel = new Panel(new GridLayout(1, 1));
+ panel.add(glCanvas1);
+
+ final Animator animator = new Animator();
+ animator.add(glCanvas1);
+ QuitAdapter quitAdapter = new QuitAdapter();
+
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+
+ // Create a check box that hides / shows canvas
+ final Checkbox checkbox = new Checkbox("Visible canvas", true);
+ checkbox.addItemListener(new ItemListener() {
+ public void itemStateChanged(ItemEvent ev) {
+ panel.setVisible(checkbox.getState());
+ System.out.println("Visible: [panel "+panel.isVisible()+", canvas "+glCanvas1.isVisible()+"]; Displayable: [panel "+panel.isDisplayable()+", canvas "+glCanvas1.isDisplayable()+"]");
+ if( panel.isVisible() ) {
+ frame.validate(); // take care of resized frame while hidden
+ }
+ }
+ });
+
+ // Build a GUI that displays canvas and check box
+ frame.setLayout(new BorderLayout());
+ frame.add(panel, BorderLayout.CENTER);
+ frame.add(checkbox, BorderLayout.NORTH);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setSize(width, height);
+ frame.setVisible(true);
+ }});
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
+
+ animator.start();
+ Assert.assertTrue(animator.isStarted());
+ Assert.assertTrue(animator.isAnimating());
+ animator.setUpdateFPSFrames(60, System.err);
+
+ final long t0 = System.currentTimeMillis();
+ long t1 = t0;
+ while(!quitAdapter.shouldQuit() && t1 - t0 < duration) {
+ Thread.sleep(100);
+ t1 = System.currentTimeMillis();
+ }
+
+ Assert.assertNotNull(frame);
+ Assert.assertNotNull(glCanvas1);
+
+ Assert.assertNotNull(animator);
+ animator.stop();
+ Assert.assertFalse(animator.isAnimating());
+ Assert.assertFalse(animator.isStarted());
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setVisible(false);
+ }});
+ Assert.assertEquals(false, frame.isVisible());
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.remove(panel);
+ frame.dispose();
+ }});
+ }
+
+ static GLProfile getGLP() {
+ return GLProfile.getMaxProgrammableCore(true);
+ }
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ duration = MiscUtils.atol(args[i], duration);
+ }
+ }
+
+ org.junit.runner.JUnitCore.main(TestBug816OSXCALayerPos03bB849AWT.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..54d20b7
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java
@@ -0,0 +1,173 @@
+/**
+ * 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.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.awt;
+
+import java.awt.BorderLayout;
+import java.awt.Container;
+import java.awt.GridLayout;
+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 javax.swing.JCheckBox;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+
+import org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.newt.event.TraceWindowAdapter;
+import com.jogamp.newt.event.awt.AWTWindowAdapter;
+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.MiscUtils;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.Animator;
+
+/**
+ * AWT JFrame BorderLayout w/ Checkbox North, JPanel.GLCanvas Center.
+ * <p>
+ * Checkbox toggles GLCanvas's parent jpanel's visibility state.
+ * </p>
+ * <p>
+ * Validates bugs:
+ * <ul>
+ * <li>Bug 816: OSX CALayer Positioning Bug</li>
+ * <li>Bug 729: OSX CALayer shall honor the Component's visibility state</li>
+ * <li>Bug 849: AWT GLAutoDrawables (JAWTWindow) shall honor it's parent visibility state</li>
+ * </ul>
+ * </p>
+ * <p>
+ * Diff. OSX CALayer positioning w/ java6, [7uxx..7u40[, and >= 7u40
+ * </p>
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestBug816OSXCALayerPos03cB849AWT extends UITestCase {
+ static long duration = 1600; // ms
+ static int width=640, height=480;
+
+ @Test
+ public void test() throws InterruptedException, InvocationTargetException {
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+
+ final JFrame frame = new JFrame("TestBug816OSXCALayerPos03cAWT");
+ Assert.assertNotNull(frame);
+ final Container framePane = frame.getContentPane();
+
+ final GLCanvas glCanvas1 = new GLCanvas(caps);
+ Assert.assertNotNull(glCanvas1);
+ glCanvas1.addGLEventListener(new GearsES2(1));
+ // Put it in a panel
+ final JPanel panel = new JPanel(new GridLayout(1, 1));
+ panel.add(glCanvas1);
+
+ final Animator animator = new Animator();
+ animator.add(glCanvas1);
+ QuitAdapter quitAdapter = new QuitAdapter();
+
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+
+ // Create a check box that hides / shows canvas
+ final JCheckBox checkbox = new JCheckBox("Visible canvas", true);
+ checkbox.addItemListener(new ItemListener() {
+ public void itemStateChanged(ItemEvent ev) {
+ panel.setVisible(checkbox.getSelectedObjects()!=null);
+ System.out.println("Visible: [panel "+panel.isVisible()+", canvas "+glCanvas1.isVisible()+"]; Displayable: [panel "+panel.isDisplayable()+", canvas "+glCanvas1.isDisplayable()+"]");
+ if( panel.isVisible() ) {
+ frame.validate(); // take care of resized frame while hidden
+ }
+ }
+ });
+
+ // Build a GUI that displays canvas and check box
+ framePane.setLayout(new BorderLayout());
+ framePane.add(panel, BorderLayout.CENTER);
+ framePane.add(checkbox, BorderLayout.NORTH);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setSize(width, height);
+ frame.setVisible(true);
+ }});
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
+
+ animator.start();
+ Assert.assertTrue(animator.isStarted());
+ Assert.assertTrue(animator.isAnimating());
+ animator.setUpdateFPSFrames(60, System.err);
+
+ final long t0 = System.currentTimeMillis();
+ long t1 = t0;
+ while(!quitAdapter.shouldQuit() && t1 - t0 < duration) {
+ Thread.sleep(100);
+ t1 = System.currentTimeMillis();
+ }
+
+ Assert.assertNotNull(frame);
+ Assert.assertNotNull(glCanvas1);
+
+ Assert.assertNotNull(animator);
+ animator.stop();
+ Assert.assertFalse(animator.isAnimating());
+ Assert.assertFalse(animator.isStarted());
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setVisible(false);
+ }});
+ Assert.assertEquals(false, frame.isVisible());
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ framePane.remove(panel);
+ frame.dispose();
+ }});
+ }
+
+ static GLProfile getGLP() {
+ return GLProfile.getMaxProgrammableCore(true);
+ }
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ duration = MiscUtils.atol(args[i], duration);
+ }
+ }
+
+ org.junit.runner.JUnitCore.main(TestBug816OSXCALayerPos03cB849AWT.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..b558b16
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04aAWT.java
@@ -0,0 +1,152 @@
+/**
+ * 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.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.awt;
+
+import java.awt.BorderLayout;
+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 org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.newt.event.TraceWindowAdapter;
+import com.jogamp.newt.event.awt.AWTWindowAdapter;
+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.MiscUtils;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.Animator;
+
+/**
+ * Bug 816: OSX CALayer Positioning Bug - AWT Frame w/ (top-level) Dialog child containing the GLCanvas
+ * <p>
+ * Diff. OSX CALayer positioning w/ java6, [7uxx..7u40[, and >= 7u40
+ * </p>
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestBug816OSXCALayerPos04aAWT extends UITestCase {
+ static long duration = 1600; // ms
+ static int width=640, height=480;
+
+ @Test
+ public void test() throws InterruptedException, InvocationTargetException {
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+
+ final Frame frame = new Frame("TestBug816OSXCALayerPos04aAWT");
+ Assert.assertNotNull(frame);
+
+ final GLCanvas glCanvas1 = new GLCanvas(caps);
+ Assert.assertNotNull(glCanvas1);
+ glCanvas1.addGLEventListener(new GearsES2(1));
+
+ final Animator animator = new Animator();
+ animator.add(glCanvas1);
+ QuitAdapter quitAdapter = new QuitAdapter();
+
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+
+ // Display the canvas 3D in a dialog child of a frame
+ frame.setSize(400, 400);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setLocation(100, 100);
+ frame.setSize(width, height);
+ frame.setVisible(true);
+ }});
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
+
+ final Dialog dialog = new Dialog(frame, "Bug 816 AWT Top-Level Dialog");
+ dialog.setLayout(new BorderLayout());
+ dialog.add(glCanvas1, BorderLayout.CENTER);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ dialog.setLocation(200, 200);
+ dialog.setSize(width/2, height/2);
+ dialog.setVisible(true);
+ }});
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(dialog, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
+
+ animator.start();
+ Assert.assertTrue(animator.isStarted());
+ Assert.assertTrue(animator.isAnimating());
+ animator.setUpdateFPSFrames(60, System.err);
+
+ final long t0 = System.currentTimeMillis();
+ long t1 = t0;
+ while(!quitAdapter.shouldQuit() && t1 - t0 < duration) {
+ Thread.sleep(100);
+ t1 = System.currentTimeMillis();
+ }
+
+ Assert.assertNotNull(frame);
+ Assert.assertNotNull(glCanvas1);
+
+ Assert.assertNotNull(animator);
+ animator.stop();
+ Assert.assertFalse(animator.isAnimating());
+ Assert.assertFalse(animator.isStarted());
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setVisible(false);
+ }});
+ Assert.assertEquals(false, frame.isVisible());
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.remove(glCanvas1);
+ frame.dispose();
+ }});
+ }
+
+ static GLProfile getGLP() {
+ return GLProfile.getMaxProgrammableCore(true);
+ }
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ duration = MiscUtils.atol(args[i], duration);
+ }
+ }
+
+ org.junit.runner.JUnitCore.main(TestBug816OSXCALayerPos04aAWT.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..b502dbd
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04bAWT.java
@@ -0,0 +1,152 @@
+/**
+ * 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.
+ */
+
+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 javax.swing.JDialog;
+import javax.swing.JFrame;
+
+import org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.newt.event.TraceWindowAdapter;
+import com.jogamp.newt.event.awt.AWTWindowAdapter;
+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.MiscUtils;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.Animator;
+
+/**
+ * Bug 816: OSX CALayer Positioning Bug - AWT JFrame w/ JDialog child containing the GLCanvas
+ * <p>
+ * Diff. OSX CALayer positioning w/ java6, [7uxx..7u40[, and >= 7u40
+ * </p>
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestBug816OSXCALayerPos04bAWT extends UITestCase {
+ static long duration = 1600; // ms
+ static int width=640, height=480;
+
+ @Test
+ public void test() throws InterruptedException, InvocationTargetException {
+ final GLCapabilities caps = new GLCapabilities(getGLP());
+
+ final JFrame frame = new JFrame("TestBug816OSXCALayerPos04bAWT");
+ Assert.assertNotNull(frame);
+
+ final GLCanvas glCanvas1 = new GLCanvas(caps);
+ Assert.assertNotNull(glCanvas1);
+ glCanvas1.addGLEventListener(new GearsES2(1));
+
+ final Animator animator = new Animator();
+ animator.add(glCanvas1);
+ QuitAdapter quitAdapter = new QuitAdapter();
+
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+
+ // Display the canvas 3D in a dialog child of a frame
+ frame.setSize(400, 400);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setLocation(100, 100);
+ frame.setSize(width, height);
+ frame.setVisible(true);
+ }});
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
+
+ final JDialog dialog = new JDialog(frame, "Bug 816 AWT Top-Level JDialog");
+ dialog.setLayout(new BorderLayout());
+ dialog.add(glCanvas1, BorderLayout.CENTER);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ dialog.setLocation(200, 200);
+ dialog.setSize(width/2, height/2);
+ dialog.setVisible(true);
+ }});
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(dialog, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
+
+ animator.start();
+ Assert.assertTrue(animator.isStarted());
+ Assert.assertTrue(animator.isAnimating());
+ animator.setUpdateFPSFrames(60, System.err);
+
+ final long t0 = System.currentTimeMillis();
+ long t1 = t0;
+ while(!quitAdapter.shouldQuit() && t1 - t0 < duration) {
+ Thread.sleep(100);
+ t1 = System.currentTimeMillis();
+ }
+
+ Assert.assertNotNull(frame);
+ Assert.assertNotNull(glCanvas1);
+
+ Assert.assertNotNull(animator);
+ animator.stop();
+ Assert.assertFalse(animator.isAnimating());
+ Assert.assertFalse(animator.isStarted());
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setVisible(false);
+ }});
+ Assert.assertEquals(false, frame.isVisible());
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.remove(glCanvas1);
+ frame.dispose();
+ }});
+ }
+
+ static GLProfile getGLP() {
+ return GLProfile.getMaxProgrammableCore(true);
+ }
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ duration = MiscUtils.atol(args[i], duration);
+ }
+ }
+
+ org.junit.runner.JUnitCore.main(TestBug816OSXCALayerPos04bAWT.class.getName());
+ }
+}
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 f026fa2..4623046 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
@@ -47,8 +47,11 @@ import java.awt.Insets;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLCanvasAWTActionDeadlock00AWT extends UITestCase {
static long durationPerTest = 1000; // ms
static final int width = 512;
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 0bcde2b..ba06f91 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
@@ -57,6 +57,8 @@ import java.lang.reflect.InvocationTargetException;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* BUG on OSX/CALayer w/ Java6:
@@ -76,6 +78,7 @@ import org.junit.Test;
* Users shall make sure all mutable AWT calls are performed on the EDT, even before 1st setVisible(true) !
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLCanvasAWTActionDeadlock01AWT extends UITestCase {
static long durationPerTest = 1000; // ms
static final int width = 512;
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 289c624..2587f8d 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
@@ -52,6 +52,8 @@ import javax.media.opengl.awt.GLCanvas;
import org.junit.Assume;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.VersionNumber;
@@ -82,6 +84,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
* Users shall make sure all mutable AWT calls are performed on the EDT, even before 1st setVisible(true) !
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase {
static int framesPerTest = 240; // frames
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
new file mode 100644
index 0000000..2d4c6da
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelTextureStateAWT.java
@@ -0,0 +1,282 @@
+/**
+ * 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.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.awt;
+
+
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.TextureDraw02ES2ListenerFBO;
+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 javax.swing.JFrame;
+
+import com.jogamp.opengl.util.texture.TextureIO;
+import com.jogamp.opengl.util.texture.TextureState;
+import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.util.GLReadBufferUtil;
+
+import java.awt.Dimension;
+
+import java.io.IOException;
+
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+/**
+ * Unit test for bug 826, test {@link GLJPanel}'s {@link TextureState} save and restore.
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestGLJPanelTextureStateAWT extends UITestCase {
+ static boolean showFPS = false;
+ static long duration = 100; // ms
+
+ @BeforeClass
+ public static void initClass() {
+ }
+
+ public void testImpl(final boolean keepTextureBound, final int texUnit)
+ throws InterruptedException, IOException
+ {
+ final GLReadBufferUtil screenshot = new GLReadBufferUtil(true, false);
+ GLProfile glp;
+ if(GLProfile.isAvailable(GLProfile.GL2ES2)) {
+ glp = GLProfile.getGL2ES2();
+ } else {
+ System.err.println(getSimpleTestName(".")+": GLProfile n/a");
+ return;
+ }
+ final GLCapabilities caps = new GLCapabilities(glp);
+
+ final GLJPanel glc = new GLJPanel(caps);
+ Dimension glc_sz = new Dimension(800, 400);
+ glc.setMinimumSize(glc_sz);
+ glc.setPreferredSize(glc_sz);
+ final JFrame frame = new JFrame("TestGLJPanelTextureStateAWT");
+ Assert.assertNotNull(frame);
+ frame.getContentPane().add(glc);
+
+ final TextureDraw02ES2ListenerFBO gle0;
+ {
+ final GearsES2 gle0sub = new GearsES2( 0 );
+ // gle1sub.setClearBuffers(false);
+ gle0 = new TextureDraw02ES2ListenerFBO(gle0sub, 1, texUnit ) ;
+ }
+ gle0.setKeepTextureBound(keepTextureBound);
+ gle0.setClearBuffers(false);
+
+ final RedSquareES2 gle1 = new RedSquareES2( 1 ) ;
+ gle1.setClearBuffers(false);
+
+ glc.addGLEventListener(new GLEventListener() {
+ int gle0X, gle0Y, gle0W, gle0H;
+ int gle1X, gle1Y, gle1W, gle1H;
+ int tX, tY, tW, tH;
+ int shot = 0;
+
+ void setupTex(GL gl) {
+ // Note: FBObject uses diff defaults, i.e.: GL_NEAREST and GL_CLAMP_TO_EDGE
+ if( keepTextureBound ) {
+ gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
+ gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);
+ gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT);
+ gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT);
+ }
+ }
+
+ @Override
+ public void init(GLAutoDrawable drawable) {
+ // Initialize w/ arbitrary values !
+ GL2ES2 gl = drawable.getGL().getGL2ES2();
+ gl.glActiveTexture(GL.GL_TEXTURE0 + 1);
+ gl.glBindTexture(GL.GL_TEXTURE_2D, 0);
+ gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
+ gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
+ gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT);
+ gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT);
+ gl.glActiveTexture(GL.GL_TEXTURE0 + 0);
+ gl.glBindTexture(GL.GL_TEXTURE_2D, 0);
+ gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
+ gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
+ gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT);
+ gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT);
+
+ gle0.init(drawable);
+ gle1.init(drawable);
+ setupTex(gl);
+ }
+
+ @Override
+ public void dispose(GLAutoDrawable drawable) {
+ gle0.dispose(drawable);
+ gle1.dispose(drawable);
+ }
+ @Override
+ public void display(GLAutoDrawable drawable) {
+ GL2ES2 gl = drawable.getGL().getGL2ES2();
+
+ gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
+
+ // restore viewport test
+ final int[] viewport = new int[] { 0, 0, 0, 0 };
+ gl.glGetIntegerv(GL.GL_VIEWPORT, viewport, 0);
+ if( gle0X != viewport[0] || gle0Y != viewport[1] || gle0W != viewport[2] || gle0H != viewport[3] ) {
+ final String msg = "Expected "+viewport[0]+"/"+viewport[1]+" "+viewport[2]+"x"+viewport[3]+
+ ", actual "+gle0X+"/"+gle0Y+" "+gle0W+"x"+gle0H;
+ Assert.assertTrue("Viewport not restored: "+msg, false);
+ }
+
+ // gl.glViewport(gle0X, gle0Y, gle0W, gle0H); // restore viewport test
+ gle0.display(drawable);
+
+ gl.glViewport(gle1X, gle1Y, gle1W, gle1H);
+ gle1.display(drawable);
+
+ shot++;
+ if( 4 == shot ) {
+ gl.glViewport(tX, tY, tW, tH);
+ snapshot(0, null, drawable.getGL(), screenshot, TextureIO.PNG, null);
+ }
+
+ gl.glViewport(gle0X, gle0Y, gle0W, gle0H); // restore viewport test
+
+ final TextureState ts = new TextureState(drawable.getGL(), GL.GL_TEXTURE_2D);
+ // System.err.println("XXX: "+ts);
+ Assert.assertEquals("Texture unit changed", GL.GL_TEXTURE0+texUnit, ts.getUnit());
+ if( keepTextureBound ) {
+ Assert.assertEquals("Texture mag-filter changed", GL.GL_LINEAR, ts.getMagFilter());
+ Assert.assertEquals("Texture mag-filter changed", GL.GL_LINEAR, ts.getMinFilter());
+ Assert.assertEquals("Texture wrap-s changed", GL.GL_REPEAT, ts.getWrapS());
+ Assert.assertEquals("Texture wrap-t changed", GL.GL_REPEAT, ts.getWrapT());
+ }
+ }
+ final int border = 5;
+ @Override
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ gle0X = x + border;
+ gle0Y = y;
+ gle0W = width/2 - 2*border;
+ gle0H = height;
+
+ gle1X = gle0X + gle0W + 2*border;
+ gle1Y = y;
+ gle1W = width/2 - 2*border;
+ gle1H = height;
+
+ tX = x;
+ tY = y;
+ tW = width;
+ tH = height;
+
+ GL2ES2 gl = drawable.getGL().getGL2ES2();
+ gl.glViewport(gle0X, gle0Y, gle0W, gle0H);
+ gle0.reshape(drawable, gle0X, gle0Y, gle0W, gle0H);
+
+ gl.glViewport(gle1X, gle1Y, gle1W, gle1H);
+ gle1.reshape(drawable, gle1X, gle1Y, gle1W, gle1H);
+
+ gl.glViewport(gle0X, gle0Y, gle0W, gle0H); // restore viewport test
+
+ if( keepTextureBound ) {
+ setupTex(gl);
+ }
+ }
+ });
+
+ Animator animator = new Animator(glc);
+ animator.setUpdateFPSFrames(60, showFPS ? System.err : null);
+ QuitAdapter quitAdapter = new QuitAdapter();
+ new com.jogamp.newt.event.awt.AWTKeyAdapter(quitAdapter).addTo(glc);
+ new com.jogamp.newt.event.awt.AWTWindowAdapter(quitAdapter).addTo(glc);
+ try {
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.pack();
+ frame.setVisible(true);
+ }});
+ } catch( Throwable throwable ) {
+ throwable.printStackTrace();
+ Assume.assumeNoException( throwable );
+ }
+ animator.start();
+
+ while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
+ Thread.sleep(100);
+ }
+
+ animator.stop();
+ try {
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setVisible(false);
+ frame.remove(glc);
+ frame.dispose();
+ }});
+ } catch( Throwable throwable ) {
+ throwable.printStackTrace();
+ Assume.assumeNoException( throwable );
+ }
+ }
+
+ @Test
+ public void test01_texUnit0_keepTex0_ES2() throws InterruptedException, IOException {
+ testImpl(false /* keepTextureBound */, 0 /* texUnit */);
+ }
+ @Test
+ public void test02_texUnit0_keepTex1_ES2() throws InterruptedException, IOException {
+ testImpl(true /* keepTextureBound */, 0 /* texUnit */);
+ }
+ @Test
+ public void test03_texUnit1_keepTex1_ES2() throws InterruptedException, IOException {
+ testImpl(true /* keepTextureBound */, 1 /* texUnit */);
+ }
+
+ public static void main(String args[]) throws IOException {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ duration = MiscUtils.atol(args[i], duration);
+ }
+ }
+ org.junit.runner.JUnitCore.main(TestGLJPanelTextureStateAWT.class.getName());
+ }
+}
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 74e5d6c..3f8b76a 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
@@ -42,8 +42,11 @@ import java.lang.reflect.InvocationTargetException;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestIsRealizedConcurrency01AWT extends UITestCase {
static long durationPerTest = 500; // ms
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 991f4ac..28fb79c 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
@@ -21,6 +21,8 @@ import javax.swing.WindowConstants;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.util.ReflectionUtil;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
@@ -40,6 +42,7 @@ import com.jogamp.opengl.util.Animator;
* </p>
* See git commit '8df12ca151dfc577c90b485d4ebfe491b88e55aa'.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestJScrollPaneMixHwLw01AWT extends UITestCase {
static long durationPerTest = 500;
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 007df9f..ccdaf6e 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
@@ -45,6 +45,8 @@ import javax.swing.JFrame;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import static org.junit.Assume.*;
import static javax.swing.SwingUtilities.*;
@@ -53,6 +55,7 @@ import static javax.swing.SwingUtilities.*;
* Tests context creation + display on various kinds of Window implementations.
* @author Michael Bien, et. al.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestSwingAWT01GLn extends UITestCase {
private Window[] windows;
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 ffe3bb3..066e5fe 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
@@ -44,6 +44,8 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.After;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/*
* Unit tests for Bug464
@@ -61,6 +63,7 @@ import org.junit.Test;
* TestTextRendererTraceGL2Mock01
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestAWTTextRendererUseVertexArrayBug464 extends UITestCase {
static GLProfile glp;
static GLCapabilities caps;
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 b949bc3..e87c344 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -45,29 +45,31 @@ import com.jogamp.opengl.util.texture.TextureIO;
import java.awt.image.BufferedImage;
-import junit.framework.Assert;
-
+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;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug605FlippedImageAWT extends UITestCase {
class FlippedImageTest implements GLEventListener {
public void display(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
-
+
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT | GL.GL_STENCIL_BUFFER_BIT | GL2.GL_ACCUM_BUFFER_BIT );
-
+
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity();
-
+
// red below
gl.glColor3f(1, 0, 0);
gl.glRectf(-1, -1, 1, 0);
-
+
// green above
gl.glColor3f(0, 1, 0);
gl.glRectf(-1, 0, 1, 1);
@@ -77,12 +79,12 @@ public class TestBug605FlippedImageAWT extends UITestCase {
if(caps.getAccumGreenBits() > 0) {
gl.glAccum(GL2.GL_ACCUM, 1.0f);
gl.glAccum(GL2.GL_RETURN, 1.0f);
- }
+ }
gl.glFinish();
-
+
final int width = drawable.getWidth();
final int height = drawable.getHeight();
-
+
final String fname = getSnapshotFilename(0, null, caps, width, height, false, TextureIO.PNG, null);
try {
Screenshot.writeToFile(new File(fname), width, height, false);
@@ -90,83 +92,83 @@ public class TestBug605FlippedImageAWT extends UITestCase {
throw e;
} catch (IOException e) {
throw new GLException(e);
- }
+ }
testFlipped(width, height);
}
-
+
public void init(GLAutoDrawable drawable) {
final GL gl = drawable.getGL();
System.err.println("GL_RENDERER: "+gl.glGetString(GL.GL_RENDERER));
System.err.println("GL_VERSION: "+gl.glGetString(GL.GL_VERSION));
- }
- public void reshape(GLAutoDrawable glDrawable, int x, int y, int w, int h) {}
- public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {}
+ }
+ public void reshape(GLAutoDrawable glDrawable, int x, int y, int w, int h) {}
+ public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {}
public void dispose(GLAutoDrawable drawable) {}
}
-
+
static final int green = 0x0000ff00; // above
static final int red = 0x00ff0000; // below
private void testFlipped(int width, int height) {
// Default origin 0/0 is lower left corner, so is the memory layout
- // However AWT origin 0/0 is upper left corner
+ // However AWT origin 0/0 is upper left corner
final BufferedImage image = Screenshot.readToBufferedImage(width, height);
-
+
final int below = image.getRGB(0, height-1) & 0x00ffffff;
System.err.println("below: 0x"+Integer.toHexString(below));
-
+
final int above = image.getRGB(0, 0) & 0x00ffffff;
System.err.println("above: 0x"+Integer.toHexString(above));
-
+
if (above == green && below == red) {
System.out.println("Image right side up");
} else if (above == red && below == green) {
Assert.assertTrue("Image is flipped", false);
} else {
Assert.assertTrue("Error in test", false);
- }
+ }
}
-
+
private void test(GLCapabilitiesImmutable caps) {
-
+
final GLDrawableFactory glFactory = GLDrawableFactory.getFactory(caps.getGLProfile());
- final GLAutoDrawable glad = glFactory.createOffscreenAutoDrawable(null, caps, null, 256, 256, null);
+ final GLAutoDrawable glad = glFactory.createOffscreenAutoDrawable(null, caps, null, 256, 256);
final FlippedImageTest tglel = new FlippedImageTest();
glad.addGLEventListener(tglel);
-
+
// 1 frame incl. snapshot to memory & file
glad.display();
System.err.println("XXX "+glad.getChosenGLCapabilities());
System.err.println("XXX "+glad.getContext().getGLVersion());
-
- glad.destroy();
+
+ glad.destroy();
}
-
+
@Test
public void test01DefaultFBO() {
final GLProfile glp = GLProfile.get(GLProfile.GL2);
final GLCapabilities caps = new GLCapabilities(glp);
- caps.setFBO(true);
- test(caps);
+ caps.setFBO(true);
+ test(caps);
}
-
+
@Test
public void test01StencilFBO() {
final GLProfile glp = GLProfile.get(GLProfile.GL2);
final GLCapabilities caps = new GLCapabilities(glp);
caps.setStencilBits(8);
- caps.setFBO(true);
- test(caps);
+ caps.setFBO(true);
+ test(caps);
}
-
+
@Test
public void test01DefaultPBuffer() {
final GLProfile glp = GLProfile.get(GLProfile.GL2);
final GLCapabilities caps = new GLCapabilities(glp);
- caps.setPBuffer(true);
- test(caps);
+ caps.setPBuffer(true);
+ test(caps);
}
-
+
@Test
public void test01AccumStencilPBuffer() {
final GLProfile glp = GLProfile.get(GLProfile.GL2);
@@ -175,10 +177,10 @@ public class TestBug605FlippedImageAWT extends UITestCase {
caps.setAccumGreenBits(16);
caps.setAccumBlueBits(16);
caps.setStencilBits(8);
- caps.setPBuffer(true);
- test(caps);
+ caps.setPBuffer(true);
+ test(caps);
}
-
+
public static void main(String[] args) {
org.junit.runner.JUnitCore.main(TestBug605FlippedImageAWT.class.getName());
}
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 dc1d528..28fcb98 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -38,126 +38,128 @@ import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLProfile;
-import junit.framework.Assert;
-
+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;
import com.jogamp.opengl.util.GLReadBufferUtil;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug605FlippedImageNEWT extends UITestCase {
static class FlippedImageTest implements GLEventListener {
public void display(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
-
+
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT | GL.GL_STENCIL_BUFFER_BIT | GL2.GL_ACCUM_BUFFER_BIT );
-
+
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity();
-
+
// red below
gl.glColor3f(1, 0, 0);
gl.glRectf(-1, -1, 1, 0);
-
+
// green above
gl.glColor3f(0, 1, 0);
gl.glRectf(-1, 0, 1, 1);
gl.glFinish();
-
+
final GLCapabilitiesImmutable caps = drawable.getChosenGLCapabilities();
if(caps.getAccumGreenBits() > 0) {
gl.glAccum(GL2.GL_ACCUM, 1.0f);
gl.glAccum(GL2.GL_RETURN, 1.0f);
- }
+ }
gl.glFinish();
}
-
+
public void init(GLAutoDrawable drawable) {
final GL gl = drawable.getGL();
System.err.println("GL_RENDERER: "+gl.glGetString(GL.GL_RENDERER));
System.err.println("GL_VERSION: "+gl.glGetString(GL.GL_VERSION));
- }
- public void reshape(GLAutoDrawable glDrawable, int x, int y, int w, int h) {}
- public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {}
+ }
+ public void reshape(GLAutoDrawable glDrawable, int x, int y, int w, int h) {}
+ public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {}
public void dispose(GLAutoDrawable drawable) {}
}
-
+
static final int green = 0x0000ff00; // above
static final int red = 0x00ff0000; // below
private int getRGB(ByteBuffer bb, int o) {
- return ( (int)bb.get(o+0) & 0x000000ff ) << 16 |
- ( (int)bb.get(o+1) & 0x000000ff ) << 8 |
- ( (int)bb.get(o+2) & 0x000000ff );
+ return ( bb.get(o+0) & 0x000000ff ) << 16 |
+ ( bb.get(o+1) & 0x000000ff ) << 8 |
+ ( bb.get(o+2) & 0x000000ff );
}
-
+
private void testFlipped(ByteBuffer bb, int width, int height, int comp) {
// Default origin 0/0 is lower left corner, so is the memory layout
-
+
// x=0, y=0: RGB -> _RGB [high-byte .. low-byte]
final int below = getRGB(bb, 0);
System.err.println("below: 0x"+Integer.toHexString(below));
-
+
// x=0, y=height-1: RGB -> _RGB [high-byte .. low-byte]
final int above= getRGB(bb, ( height - 1 ) * ( width * comp ));
System.err.println("above: 0x"+Integer.toHexString(above));
-
+
if (above == green && below == red) {
System.out.println("Image right side up");
} else if (above == red && below == green) {
Assert.assertTrue("Image is flipped", false);
} else {
Assert.assertTrue("Error in test", false);
- }
+ }
}
-
+
private void test(GLCapabilitiesImmutable caps) {
final GLReadBufferUtil rbu = new GLReadBufferUtil(false, false);
final GLDrawableFactory glFactory = GLDrawableFactory.getFactory(caps.getGLProfile());
- final GLAutoDrawable glad = glFactory.createOffscreenAutoDrawable(null, caps, null, 256, 256, null);
+ final GLAutoDrawable glad = glFactory.createOffscreenAutoDrawable(null, caps, null, 256, 256);
final FlippedImageTest tglel = new FlippedImageTest();
glad.addGLEventListener(tglel);
final SnapshotGLEventListener snap = new SnapshotGLEventListener(rbu);
glad.addGLEventListener(snap);
- snap.setMakeSnapshotAlways(true);
-
+ snap.setMakeSnapshotAlways(true);
+
// 1 frame incl. snapshot to memory & file
glad.display();
System.err.println("XXX "+glad.getChosenGLCapabilities());
System.err.println("XXX "+glad.getContext().getGLVersion());
- testFlipped((ByteBuffer)rbu.getPixelBuffer().buffer, glad.getWidth(), glad.getHeight(), 3);
-
- glad.destroy();
+ testFlipped((ByteBuffer)rbu.getPixelBuffer().buffer, glad.getWidth(), glad.getHeight(), 3);
+
+ glad.destroy();
}
-
+
@Test
public void test01DefaultFBO() {
final GLProfile glp = GLProfile.get(GLProfile.GL2);
final GLCapabilities caps = new GLCapabilities(glp);
- caps.setFBO(true);
- test(caps);
+ caps.setFBO(true);
+ test(caps);
}
-
+
@Test
public void test01StencilFBO() {
final GLProfile glp = GLProfile.get(GLProfile.GL2);
final GLCapabilities caps = new GLCapabilities(glp);
caps.setStencilBits(8);
- caps.setFBO(true);
- test(caps);
+ caps.setFBO(true);
+ test(caps);
}
-
+
@Test
public void test01DefaultPBuffer() {
final GLProfile glp = GLProfile.get(GLProfile.GL2);
final GLCapabilities caps = new GLCapabilities(glp);
- caps.setPBuffer(true);
- test(caps);
+ caps.setPBuffer(true);
+ test(caps);
}
-
+
@Test
public void test01AccumStencilPBuffer() {
final GLProfile glp = GLProfile.get(GLProfile.GL2);
@@ -166,10 +168,10 @@ public class TestBug605FlippedImageNEWT extends UITestCase {
caps.setAccumGreenBits(16);
caps.setAccumBlueBits(16);
caps.setStencilBits(8);
- caps.setPBuffer(true);
- test(caps);
+ caps.setPBuffer(true);
+ test(caps);
}
-
+
public static void main(String[] args) {
org.junit.runner.JUnitCore.main(TestBug605FlippedImageNEWT.class.getName());
}
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 2083671..ba93dcd 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
@@ -1,22 +1,22 @@
/*
* 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
@@ -29,11 +29,11 @@
* 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.
*/
@@ -58,8 +58,11 @@ import com.jogamp.opengl.util.GLReadBufferUtil;
import com.jogamp.opengl.util.texture.TextureIO;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestMultisampleES1AWT extends UITestCase {
static long durationPerTest = 60; // ms
private GLCanvas canvas;
@@ -101,7 +104,7 @@ public class TestMultisampleES1AWT extends UITestCase {
caps.setNumSamples(reqSamples);
}
- canvas = new GLCanvas(caps, chooser, null, null);
+ canvas = new GLCanvas(caps, chooser, null);
canvas.addGLEventListener(new MultisampleDemoES1(reqSamples>0?true:false));
canvas.addGLEventListener(new GLEventListener() {
int displayCount = 0;
@@ -112,7 +115,7 @@ public class TestMultisampleES1AWT extends UITestCase {
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { }
});
-
+
final Frame frame = new Frame("Multi Samples "+reqSamples);
frame.setLayout(new BorderLayout());
canvas.setSize(512, 512);
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 bc4ee55..cf30c50 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
@@ -47,6 +47,8 @@ import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLProfile;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.jogl.demos.es1.MultisampleDemoES1;
@@ -55,6 +57,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.GLReadBufferUtil;
import com.jogamp.opengl.util.texture.TextureIO;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestMultisampleES1NEWT extends UITestCase {
static long durationPerTest = 60; // ms
private GLWindow window;
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 f3d320d..008568f 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
@@ -47,6 +47,8 @@ import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLProfile;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.jogl.demos.es2.MultisampleDemoES2;
@@ -55,6 +57,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.GLReadBufferUtil;
import com.jogamp.opengl.util.texture.TextureIO;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestMultisampleES2NEWT extends UITestCase {
static long durationPerTest = 60; // ms
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 6d8270a..7ba6b09 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
@@ -50,12 +50,15 @@ import javax.media.opengl.awt.GLCanvas;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.util.ReflectionUtil;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestTranslucencyAWT extends UITestCase {
static Dimension size;
static long durationPerTest = 400;
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 f184873..8d65fde 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
@@ -45,7 +45,10 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestTranslucencyNEWT extends UITestCase {
static GLProfile glp;
static int width, height;
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 82dd707..9526df2 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
@@ -7,10 +7,10 @@
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@@ -37,7 +37,7 @@ public abstract class GearsObject {
public static final FloatBuffer blue = Buffers.newDirectFloatBuffer( new float[] { 0.2f, 0.2f, 1.0f, 0.7f } );
public static final float M_PI = (float)Math.PI;
- public final FloatBuffer gearColor;
+ public final FloatBuffer gearColor;
public GLArrayDataServer frontFace;
public GLArrayDataServer frontSide;
public GLArrayDataServer backFace;
@@ -49,7 +49,28 @@ public abstract class GearsObject {
public abstract GLArrayDataServer createInterleaved(int comps, int dataType, boolean normalized, int initialSize, int vboUsage);
public abstract void addInterleavedVertexAndNormalArrays(GLArrayDataServer array, int components);
public abstract void draw(GL gl, float x, float y, float angle);
-
+
+ private GLArrayDataServer createInterleavedClone(GLArrayDataServer ads) {
+ final GLArrayDataServer n = new GLArrayDataServer(ads);
+ n.setInterleavedOffset(0);
+ return n;
+ }
+
+ private void init(GL gl, GLArrayDataServer array) {
+ array.enableBuffer(gl, true);
+ array.enableBuffer(gl, false);
+ }
+
+ /** Init VBO and data .. */
+ public final void init(GL gl) {
+ init(gl, frontFace);
+ init(gl, frontSide);
+ init(gl, backFace);
+ init(gl, backSide);
+ init(gl, outwardFace);
+ init(gl, insideRadiusCyl);
+ }
+
public void destroy(GL gl) {
if(!isShared) {
// could be already destroyed by shared configuration
@@ -77,21 +98,27 @@ public abstract class GearsObject {
backFace=null;
backSide=null;
outwardFace=null;
- insideRadiusCyl=null;
+ insideRadiusCyl=null;
isShared = false;
}
-
+
public GearsObject ( GearsObject shared ) {
isShared = true;
- frontFace = shared.frontFace;
- frontSide = shared.frontSide;
- backFace = shared.backFace;
- backSide = shared.backSide;
- outwardFace = shared.outwardFace;
- insideRadiusCyl = shared.insideRadiusCyl;
+ frontFace = createInterleavedClone(shared.frontFace);
+ addInterleavedVertexAndNormalArrays(frontFace, 3);
+ backFace = createInterleavedClone(shared.backFace);
+ addInterleavedVertexAndNormalArrays(backFace, 3);
+ frontSide = createInterleavedClone(shared.frontSide);
+ addInterleavedVertexAndNormalArrays(frontSide, 3);
+ backSide= createInterleavedClone(shared.backSide);
+ addInterleavedVertexAndNormalArrays(backSide, 3);
+ outwardFace = createInterleavedClone(shared.outwardFace);
+ addInterleavedVertexAndNormalArrays(outwardFace, 3);
+ insideRadiusCyl = createInterleavedClone(shared.insideRadiusCyl);
+ addInterleavedVertexAndNormalArrays(insideRadiusCyl, 3);
gearColor = shared.gearColor;
}
-
+
public GearsObject (
FloatBuffer gearColor,
float inner_radius,
@@ -100,7 +127,7 @@ public abstract class GearsObject {
int teeth,
float tooth_depth)
{
- final float dz = width * 0.5f;
+ final float dz = width * 0.5f;
int i;
float r0, r1, r2;
float angle, da;
@@ -112,7 +139,7 @@ public abstract class GearsObject {
this.isShared = false;
this.gearColor = gearColor;
-
+
r0 = inner_radius;
r1 = outer_radius - tooth_depth / 2.0f;
r2 = outer_radius + tooth_depth / 2.0f;
@@ -121,7 +148,7 @@ public abstract class GearsObject {
s[4] = 0; // sin(0f)
c[4] = 1; // cos(0f)
-
+
final int vboUsage = GL.GL_STATIC_DRAW;
frontFace = createInterleaved(6, GL.GL_FLOAT, false, 4*teeth+2, vboUsage);
@@ -143,45 +170,45 @@ public abstract class GearsObject {
sincos(angle + da * 1f, s, 1, c, 1);
sincos(angle + da * 2f, s, 2, c, 2);
sincos(angle + da * 3f, s, 3, c, 3);
-
+
/* front */
normal[0] = 0.0f;
normal[1] = 0.0f;
normal[2] = 1.0f;
-
+
/* front face - GL.GL_TRIANGLE_STRIP */
vert(frontFace, r0 * c[0], r0 * s[0], dz, normal);
vert(frontFace, r1 * c[0], r1 * s[0], dz, normal);
vert(frontFace, r0 * c[0], r0 * s[0], dz, normal);
vert(frontFace, r1 * c[3], r1 * s[3], dz, normal);
-
+
/* front sides of teeth - GL.GL_TRIANGLES */
vert(frontSide, r1 * c[0], r1 * s[0], dz, normal);
- vert(frontSide, r2 * c[1], r2 * s[1], dz, normal);
+ vert(frontSide, r2 * c[1], r2 * s[1], dz, normal);
vert(frontSide, r2 * c[2], r2 * s[2], dz, normal);
vert(frontSide, r1 * c[0], r1 * s[0], dz, normal);
- vert(frontSide, r2 * c[2], r2 * s[2], dz, normal);
+ vert(frontSide, r2 * c[2], r2 * s[2], dz, normal);
vert(frontSide, r1 * c[3], r1 * s[3], dz, normal);
-
+
/* back */
normal[0] = 0.0f;
normal[1] = 0.0f;
normal[2] = -1.0f;
-
+
/* back face - GL.GL_TRIANGLE_STRIP */
vert(backFace, r1 * c[0], r1 * s[0], -dz, normal);
vert(backFace, r0 * c[0], r0 * s[0], -dz, normal);
vert(backFace, r1 * c[3], r1 * s[3], -dz, normal);
vert(backFace, r0 * c[0], r0 * s[0], -dz, normal);
-
+
/* back sides of teeth - GL.GL_TRIANGLES*/
vert(backSide, r1 * c[3], r1 * s[3], -dz, normal);
vert(backSide, r2 * c[2], r2 * s[2], -dz, normal);
vert(backSide, r2 * c[1], r2 * s[1], -dz, normal);
vert(backSide, r1 * c[3], r1 * s[3], -dz, normal);
- vert(backSide, r2 * c[1], r2 * s[1], -dz, normal);
+ vert(backSide, r2 * c[1], r2 * s[1], -dz, normal);
vert(backSide, r1 * c[0], r1 * s[0], -dz, normal);
-
+
/* outward faces of teeth */
u = r2 * c[1] - r1 * c[0];
v = r2 * s[1] - r1 * s[0];
@@ -207,7 +234,7 @@ public abstract class GearsObject {
normal[0] = ( r1 * s[3] - r2 * s[2] );
normal[1] = ( r1 * c[3] - r2 * c[2] ) * -1.0f ;
vert(outwardFace, r2 * c[2], r2 * s[2], dz, normal);
- vert(outwardFace, r2 * c[2], r2 * s[2], -dz, normal);
+ vert(outwardFace, r2 * c[2], r2 * s[2], -dz, normal);
vert(outwardFace, r1 * c[3], r1 * s[3], dz, normal);
vert(outwardFace, r1 * c[3], r1 * s[3], -dz, normal);
@@ -217,7 +244,7 @@ public abstract class GearsObject {
vert(outwardFace, r1 * c[3], r1 * s[3], -dz, normal);
vert(outwardFace, r1 * c[0], r1 * s[0], dz, normal);
vert(outwardFace, r1 * c[0], r1 * s[0], -dz, normal);
-
+
/* inside radius cylinder */
normal[0] = c[0] * -1.0f;
normal[1] = s[0] * -1.0f;
@@ -232,16 +259,16 @@ public abstract class GearsObject {
vert(frontFace, r0 * c[4], r0 * s[4], dz, normal);
vert(frontFace, r1 * c[4], r1 * s[4], dz, normal);
frontFace.seal(true);
-
+
/* finish back face */
- normal[2] = -1.0f;
+ normal[2] = -1.0f;
vert(backFace, r1 * c[4], r1 * s[4], -dz, normal);
vert(backFace, r0 * c[4], r0 * s[4], -dz, normal);
backFace.seal(true);
-
+
backSide.seal(true);
frontSide.seal(true);
-
+
/* finish outward face */
sincos(da * 1f, s, 1, c, 1);
u = r2 * c[1] - r1 * c[4];
@@ -253,7 +280,7 @@ public abstract class GearsObject {
normal[1] = -u;
normal[2] = 0.0f;
vert(outwardFace, r1 * c[4], r1 * s[4], dz, normal);
- vert(outwardFace, r1 * c[4], r1 * s[4], -dz, normal);
+ vert(outwardFace, r1 * c[4], r1 * s[4], -dz, normal);
outwardFace.seal(true);
/* finish inside radius cylinder */
@@ -265,6 +292,15 @@ public abstract class GearsObject {
insideRadiusCyl.seal(true);
}
+ @Override
+ public String toString() {
+ final int ffVBO = null != frontFace ? frontFace.getVBOName() : 0;
+ final int fsVBO = null != frontSide ? frontSide.getVBOName() : 0;
+ final int bfVBO = null != backFace ? backFace.getVBOName() : 0;
+ final int bsVBO = null != backSide ? backSide.getVBOName() : 0;
+ return "GearsObj[0x"+Integer.toHexString(hashCode())+", vbo ff "+ffVBO+", fs "+fsVBO+", bf "+bfVBO+", bs "+bsVBO+"]";
+ }
+
static void vert(GLArrayDataServer array, float x, float y, float z, float n[]) {
array.putf(x);
array.putf(y);
@@ -273,7 +309,7 @@ public abstract class GearsObject {
array.putf(n[1]);
array.putf(n[2]);
}
-
+
static void sincos(float x, float sin[], int sinIdx, float cos[], int cosIdx) {
sin[sinIdx] = (float) Math.sin(x);
cos[cosIdx] = (float) Math.cos(x);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureDraw01Accessor.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureDraw01Accessor.java
index b9ac9fa..7283a20 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureDraw01Accessor.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureDraw01Accessor.java
@@ -31,5 +31,6 @@ package com.jogamp.opengl.test.junit.jogl.demos;
import com.jogamp.opengl.util.texture.Texture;
public interface TextureDraw01Accessor {
+ public void setKeepTextureBound(boolean v);
public Texture getTexture();
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureSequenceDemo01.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureSequenceDemo01.java
index 6fd47e6..ab3899a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureSequenceDemo01.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureSequenceDemo01.java
@@ -77,7 +77,7 @@ public class TextureSequenceDemo01 implements TextureSequence {
}
@Override
- public TextureSequence.TextureFrame getNextTexture(GL gl, boolean blocking) throws IllegalStateException {
+ public TextureSequence.TextureFrame getNextTexture(GL gl) throws IllegalStateException {
return frame;
}
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 63e8995..9f191d3 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
@@ -7,10 +7,10 @@
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@@ -55,16 +55,18 @@ public class GearsES1 implements GLEventListener {
private boolean forceFFPEmu = false;
private boolean debug = false ;
private boolean trace = false ;
-
+
private final float pos[] = { 5.0f, 5.0f, 10.0f, 0.0f };
- private float view_rotx = 20.0f, view_roty = 30.0f, view_rotz = 0.0f;
+ private float view_rotx = 20.0f, view_roty = 30.0f;
+ private final float view_rotz = 0.0f;
private GearsObject gear1=null, gear2=null, gear3=null;
private FloatBuffer gear1Color=GearsObject.red, gear2Color=GearsObject.green, gear3Color=GearsObject.blue;
+ private volatile boolean usesSharedGears = false;
private float angle = 0.0f;
- private int swapInterval;
- private MouseListener gearsMouse = new GearsMouseAdapter();
- private KeyListener gearsKeys = new GearsKeyAdapter();
+ private final int swapInterval;
+ private final MouseListener gearsMouse = new GearsMouseAdapter();
+ private final KeyListener gearsKeys = new GearsKeyAdapter();
private int prevMouseX, prevMouseY;
@@ -76,21 +78,21 @@ public class GearsES1 implements GLEventListener {
public GearsES1() {
this.swapInterval = 1;
}
-
+
public void setForceFFPEmu(boolean forceFFPEmu, boolean verboseFFPEmu, boolean debugFFPEmu, boolean traceFFPEmu) {
this.forceFFPEmu = forceFFPEmu;
this.verboseFFPEmu = verboseFFPEmu;
this.debugFFPEmu = debugFFPEmu;
this.traceFFPEmu = traceFFPEmu;
}
-
+
public void setGearsColors(FloatBuffer gear1Color, FloatBuffer gear2Color, FloatBuffer gear3Color) {
this.gear1Color = gear1Color;
this.gear2Color = gear2Color;
this.gear3Color = gear3Color;
}
-
- public void setGears(GearsObject g1, GearsObject g2, GearsObject g3) {
+
+ public void setSharedGearsObjects(GearsObject g1, GearsObject g2, GearsObject g3) {
gear1 = g1;
gear2 = g2;
gear3 = g3;
@@ -110,15 +112,17 @@ public class GearsES1 implements GLEventListener {
* @return gear3
*/
public GearsObject getGear3() { return gear3; }
-
+
+ public boolean usesSharedGears() { return usesSharedGears; }
+
public void init(GLAutoDrawable drawable) {
System.err.println(Thread.currentThread()+" GearsES1.init ...");
-
+
// Use debug pipeline
// drawable.setGL(new DebugGL(drawable.getGL()));
GL _gl = drawable.getGL();
-
+
if(debugFFPEmu) {
// Debug ..
_gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES2.class, _gl, null) );
@@ -130,12 +134,12 @@ public class GearsES1 implements GLEventListener {
trace = false;
}
GL2ES1 gl = FixedFuncUtil.wrapFixedFuncEmul(_gl, ShaderSelectionMode.AUTO, null, forceFFPEmu, verboseFFPEmu);
-
+
if(debug) {
try {
// Debug ..
gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES1.class, gl, null) );
- } catch (Exception e) {e.printStackTrace();}
+ } catch (Exception e) {e.printStackTrace();}
}
if(trace) {
try {
@@ -143,7 +147,7 @@ public class GearsES1 implements GLEventListener {
gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES1.class, gl, new Object[] { System.err } ) );
} catch (Exception e) {e.printStackTrace();}
}
-
+
System.err.println("GearsES1 init on "+Thread.currentThread());
System.err.println("Chosen GLCapabilities: " + drawable.getChosenGLCapabilities());
System.err.println("INIT GL IS: " + gl.getClass().getName());
@@ -154,33 +158,39 @@ public class GearsES1 implements GLEventListener {
gl.glEnable(GL2ES1.GL_LIGHTING);
gl.glEnable(GL2ES1.GL_LIGHT0);
gl.glEnable(GL2ES1.GL_DEPTH_TEST);
-
+
/* make the gears */
if(null == gear1) {
gear1 = new GearsObjectES1(gear1Color, 1.0f, 4.0f, 1.0f, 20, 0.7f);
+ gear1.init(gl);
System.err.println("gear1 created: "+gear1);
} else {
+ usesSharedGears = true;
System.err.println("gear1 reused: "+gear1);
}
-
+
if(null == gear2) {
gear2 = new GearsObjectES1(gear2Color, 0.5f, 2.0f, 2.0f, 10, 0.7f);
+ gear2.init(gl);
System.err.println("gear2 created: "+gear2);
} else {
+ usesSharedGears = true;
System.err.println("gear2 reused: "+gear2);
}
-
+
if(null == gear3) {
gear3 = new GearsObjectES1(gear3Color, 1.3f, 2.0f, 0.5f, 10, 0.7f);
+ gear3.init(gl);
System.err.println("gear3 created: "+gear3);
} else {
+ usesSharedGears = true;
System.err.println("gear3 reused: "+gear3);
}
-
+
gl.glEnable(GL2ES1.GL_NORMALIZE);
-
+
final Object upstreamWidget = drawable.getUpstreamWidget();
- if (upstreamWidget instanceof Window) {
+ if (upstreamWidget instanceof Window) {
final Window window = (Window) upstreamWidget;
window.addMouseListener(gearsMouse);
window.addKeyListener(gearsKeys);
@@ -191,7 +201,7 @@ public class GearsES1 implements GLEventListener {
}
System.err.println(Thread.currentThread()+" GearsES1.init FIN");
}
-
+
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
System.err.println(Thread.currentThread()+" GearsES1.reshape "+x+"/"+y+" "+width+"x"+height+", swapInterval "+swapInterval);
GL2ES1 gl = drawable.getGL().getGL2ES1();
@@ -217,7 +227,7 @@ public class GearsES1 implements GLEventListener {
public void dispose(GLAutoDrawable drawable) {
System.err.println(Thread.currentThread()+" GearsES1.dispose ... ");
final Object upstreamWidget = drawable.getUpstreamWidget();
- if (upstreamWidget instanceof Window) {
+ if (upstreamWidget instanceof Window) {
final Window window = (Window) upstreamWidget;
window.removeMouseListener(gearsMouse);
window.removeKeyListener(gearsKeys);
@@ -232,7 +242,7 @@ public class GearsES1 implements GLEventListener {
System.err.println(Thread.currentThread()+" GearsES1.dispose FIN");
}
- public void display(GLAutoDrawable drawable) {
+ public void display(GLAutoDrawable drawable) {
// Turn the gears' teeth
angle += 2.0f;
@@ -251,10 +261,10 @@ public class GearsES1 implements GLEventListener {
} else {
gl.glClearColor(0.2f, 0.2f, 0.2f, 0.0f);
}
-
+
// Special handling for the case where the GLJPanel is translucent
// and wants to be composited with other Java 2D content
- if (GLProfile.isAWTAvailable() &&
+ if (GLProfile.isAWTAvailable() &&
(drawable instanceof javax.media.opengl.awt.GLJPanel) &&
!((javax.media.opengl.awt.GLJPanel) drawable).isOpaque() &&
((javax.media.opengl.awt.GLJPanel) drawable).shouldPreserveColorBufferIfTranslucent()) {
@@ -264,25 +274,25 @@ public class GearsES1 implements GLEventListener {
}
gl.glNormal3f(0.0f, 0.0f, 1.0f);
-
+
// Rotate the entire assembly of gears based on how the user
// dragged the mouse around
gl.glPushMatrix();
gl.glRotatef(view_rotx, 1.0f, 0.0f, 0.0f);
gl.glRotatef(view_roty, 0.0f, 1.0f, 0.0f);
gl.glRotatef(view_rotz, 0.0f, 0.0f, 1.0f);
-
- gear1.draw(gl, -3.0f, -2.0f, angle);
- gear2.draw(gl, 3.1f, -2.0f, -2.0f * angle - 9.0f);
+
+ gear1.draw(gl, -3.0f, -2.0f, angle);
+ gear2.draw(gl, 3.1f, -2.0f, -2.0f * angle - 9.0f);
gear3.draw(gl, -3.1f, 4.2f, -2.0f * angle - 25.0f);
-
+
// Remember that every push needs a pop; this one is paired with
// rotating the entire gear assembly
gl.glPopMatrix();
}
-
- class GearsKeyAdapter extends KeyAdapter {
+
+ class GearsKeyAdapter extends KeyAdapter {
public void keyPressed(KeyEvent e) {
int kc = e.getKeyCode();
if(KeyEvent.VK_LEFT == kc) {
@@ -296,16 +306,16 @@ public class GearsES1 implements GLEventListener {
}
}
}
-
+
class GearsMouseAdapter extends MouseAdapter {
public void mousePressed(MouseEvent e) {
prevMouseX = e.getX();
prevMouseY = e.getY();
}
-
+
public void mouseReleased(MouseEvent e) {
}
-
+
public void mouseDragged(MouseEvent e) {
int x = e.getX();
int y = e.getY();
@@ -324,7 +334,7 @@ public class GearsES1 implements GLEventListener {
}
float thetaY = 360.0f * ( (float)(x-prevMouseX)/(float)width);
float thetaX = 360.0f * ( (float)(prevMouseY-y)/(float)height);
-
+
prevMouseX = x;
prevMouseY = y;
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 89e4697..fb9251e 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
@@ -7,10 +7,10 @@
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@@ -26,7 +26,6 @@ import javax.media.opengl.GL;
import javax.media.opengl.GL2ES1;
import javax.media.opengl.fixedfunc.GLPointerFunc;
-
import com.jogamp.opengl.test.junit.jogl.demos.GearsObject;
import com.jogamp.opengl.util.GLArrayDataServer;
@@ -45,7 +44,7 @@ public class GearsObjectES1 extends GearsObject {
public GLArrayDataServer createInterleaved(int comps, int dataType, boolean normalized, int initialSize, int vboUsage) {
return GLArrayDataServer.createFixedInterleaved(comps, dataType, normalized, initialSize, vboUsage);
}
-
+
@Override
public void addInterleavedVertexAndNormalArrays(GLArrayDataServer array, int components) {
array.addFixedSubArray(GLPointerFunc.GL_VERTEX_ARRAY, components, GL.GL_ARRAY_BUFFER);
@@ -53,27 +52,29 @@ public class GearsObjectES1 extends GearsObject {
}
private void draw(GL2ES1 gl, GLArrayDataServer array, int mode) {
- array.enableBuffer(gl, true);
- gl.glDrawArrays(mode, 0, array.getElementCount());
- array.enableBuffer(gl, false);
+ if( !isShared || gl.glIsBuffer(array.getVBOName()) ) {
+ array.enableBuffer(gl, true);
+ gl.glDrawArrays(mode, 0, array.getElementCount());
+ array.enableBuffer(gl, false);
+ }
}
@Override
public void draw(GL _gl, float x, float y, float angle) {
- GL2ES1 gl = _gl.getGL2ES1();
+ GL2ES1 gl = _gl.getGL2ES1();
gl.glPushMatrix();
gl.glTranslatef(x, y, 0f);
gl.glRotatef(angle, 0f, 0f, 1f);
gl.glMaterialfv(GL2ES1.GL_FRONT_AND_BACK, GL2ES1.GL_AMBIENT_AND_DIFFUSE, gearColor);
-
+
gl.glShadeModel(GL2ES1.GL_FLAT);
draw(gl, frontFace, GL.GL_TRIANGLE_STRIP);
draw(gl, frontSide, GL.GL_TRIANGLES);
draw(gl, backFace, GL.GL_TRIANGLE_STRIP);
draw(gl, backSide, GL.GL_TRIANGLES);
draw(gl, outwardFace, GL.GL_TRIANGLE_STRIP);
- gl.glShadeModel(GL2ES1.GL_SMOOTH);
+ gl.glShadeModel(GL2ES1.GL_SMOOTH);
draw(gl, insideRadiusCyl, GL.GL_TRIANGLE_STRIP);
gl.glPopMatrix();
- }
+ }
}
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 3b5ba1c..811e918 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
@@ -1,15 +1,18 @@
package com.jogamp.opengl.test.junit.jogl.demos.es1;
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.JoglVersion;
+import com.jogamp.opengl.util.TileRendererBase;
import com.jogamp.opengl.util.glsl.fixedfunc.*;
-public class RedSquareES1 implements GLEventListener {
+public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRendererListener {
public static boolean oneThread = false;
public static boolean useAnimator = false;
@@ -20,6 +23,10 @@ public class RedSquareES1 implements GLEventListener {
private boolean debug = false ;
private boolean trace = false ;
private int swapInterval = 0;
+ private float aspect = 1.0f;
+ private boolean doRotate = true;
+ private TileRendererBase tileRendererInUse = null;
+ private boolean doRotateBeforePrinting;
long startTime = 0;
long curTime = 0;
@@ -32,6 +39,27 @@ public class RedSquareES1 implements GLEventListener {
this.swapInterval = 1;
}
+ @Override
+ public void addTileRendererNotify(TileRendererBase tr) {
+ tileRendererInUse = tr;
+ doRotateBeforePrinting = doRotate;
+ setDoRotation(false);
+ }
+ @Override
+ public void removeTileRendererNotify(TileRendererBase tr) {
+ tileRendererInUse = null;
+ setDoRotation(doRotateBeforePrinting);
+ }
+ @Override
+ public void startTileRendering(TileRendererBase tr) {
+ System.err.println("RedSquareES1.startTileRendering: "+tr);
+ }
+ @Override
+ public void endTileRendering(TileRendererBase tr) {
+ System.err.println("RedSquareES1.endTileRendering: "+tr);
+ }
+
+ public void setDoRotation(boolean rotate) { this.doRotate = rotate; }
public void setForceFFPEmu(boolean forceFFPEmu, boolean verboseFFPEmu, boolean debugFFPEmu, boolean traceFFPEmu) {
this.forceFFPEmu = forceFFPEmu;
this.verboseFFPEmu = verboseFFPEmu;
@@ -49,6 +77,7 @@ public class RedSquareES1 implements GLEventListener {
private FloatBuffer colors;
private FloatBuffer vertices;
+ @Override
public void init(GLAutoDrawable drawable) {
System.err.println(Thread.currentThread()+" RedSquareES1.init ...");
GL _gl = drawable.getGL();
@@ -100,7 +129,6 @@ public class RedSquareES1 implements GLEventListener {
gl.glColorPointer(4, GL.GL_FLOAT, 0, colors);
// OpenGL Render Settings
- gl.glClearColor(0, 0, 0, 1);
gl.glEnable(GL.GL_DEPTH_TEST);
startTime = System.currentTimeMillis();
@@ -108,39 +136,76 @@ public class RedSquareES1 implements GLEventListener {
System.err.println(Thread.currentThread()+" RedSquareES1.init FIN");
}
- public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
- System.err.println(Thread.currentThread()+" RedSquareES1.reshape "+x+"/"+y+" "+width+"x"+height+", swapInterval "+swapInterval);
- GL2ES1 gl = drawable.getGL().getGL2ES1();
- gl.setSwapInterval(swapInterval);
+ @Override
+ public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) {
+ final GL2ES1 gl = glad.getGL().getGL2ES1();
+ if(-1 != swapInterval) {
+ gl.setSwapInterval(swapInterval);
+ }
+ reshapeImpl(gl, x, y, width, height, width, height);
+ }
+
+ @Override
+ public void reshapeTile(TileRendererBase tr,
+ int tileX, int tileY, int tileWidth, int tileHeight,
+ int imageWidth, int imageHeight) {
+ final GL2ES1 gl = tr.getAttachedDrawable().getGL().getGL2ES1();
+ gl.setSwapInterval(0);
+ reshapeImpl(gl, tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight);
+ }
+
+ void reshapeImpl(GL2ES1 gl, int tileX, int tileY, int tileWidth, int tileHeight, int imageWidth, int imageHeight) {
+ System.err.println(Thread.currentThread()+" RedSquareES1.reshape "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", tileRendererInUse "+tileRendererInUse);
// Set location in front of camera
gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
gl.glLoadIdentity();
- gluPerspective(gl, 45.0f, (float)width / (float)height, 1.0f, 100.0f);
+
+ // compute projection parameters 'normal' perspective
+ final float fovy=45f;
+ final float aspect2 = ( (float) imageWidth / (float) imageHeight ) / aspect;
+ final float zNear=1f;
+ final float zFar=100f;
+
+ // compute projection parameters 'normal' frustum
+ final float top=(float)Math.tan(fovy*((float)Math.PI)/360.0f)*zNear;
+ final float bottom=-1.0f*top;
+ final float left=aspect2*bottom;
+ final float right=aspect2*top;
+ final float w = right - left;
+ final float h = top - bottom;
+
+ // compute projection parameters 'tiled'
+ final float l = left + tileX * w / imageWidth;
+ final float r = l + tileWidth * w / imageWidth;
+ final float b = bottom + tileY * h / imageHeight;
+ final float t = b + tileHeight * h / imageHeight;
+
+ gl.glFrustumf(l, r, b, t, zNear, zFar);
// gl.glOrthof(-4.0f, 4.0f, -4.0f, 4.0f, 1.0f, 100.0f);
System.err.println(Thread.currentThread()+" RedSquareES1.reshape FIN");
}
- void gluPerspective(GL2ES1 gl, final float fovy, final float aspect, final float zNear, final float zFar) {
- float top=(float)Math.tan(fovy*((float)Math.PI)/360.0f)*zNear;
- float bottom=-1.0f*top;
- float left=aspect*bottom;
- float right=aspect*top;
- gl.glFrustumf(left, right, bottom, top, zNear, zFar);
- }
-
+ @Override
public void display(GLAutoDrawable drawable) {
curTime = System.currentTimeMillis();
GL2ES1 gl = drawable.getGL().getGL2ES1();
+ if( null != tileRendererInUse ) {
+ gl.glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
+ } else {
+ gl.glClearColor(0, 0, 0, 0);
+ }
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
// One rotation every four seconds
gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glTranslatef(0, 0, -10);
- float ang = ((float) (curTime - startTime) * 360.0f) / 4000.0f;
- gl.glRotatef(ang, 0, 0, 1);
- gl.glRotatef(ang, 0, 1, 0);
+ if(doRotate) {
+ float ang = ((float) (curTime - startTime) * 360.0f) / 4000.0f;
+ gl.glRotatef(ang, 0, 0, 1);
+ gl.glRotatef(ang, 0, 1, 0);
+ }
// Draw a square
gl.glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
@@ -150,6 +215,7 @@ public class RedSquareES1 implements GLEventListener {
gl.glDisableClientState(GLPointerFunc.GL_COLOR_ARRAY);
}
+ @Override
public void dispose(GLAutoDrawable drawable) {
System.err.println(Thread.currentThread()+" RedSquareES1.dispose ... ");
GL2ES1 gl = drawable.getGL().getGL2ES1();
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 34fa79b..8abb0cc 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
@@ -46,7 +46,10 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGearsES1NEWT extends UITestCase {
static int width, height;
static boolean forceES2 = false;
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 84be7c6..c12ef95 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
@@ -43,7 +43,10 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestOlympicES1NEWT extends UITestCase {
static int width, height;
static boolean forceES2 = false;
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 478195c..200936f 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
@@ -45,7 +45,10 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestRedSquareES1NEWT extends UITestCase {
static int width, height;
static boolean forceES2 = false;
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 75a25e2..3d7db04 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
@@ -7,10 +7,10 @@
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@@ -22,17 +22,22 @@ package com.jogamp.opengl.test.junit.jogl.demos.es2;
import com.jogamp.common.nio.Buffers;
import com.jogamp.newt.Window;
+import com.jogamp.newt.event.GestureHandler;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.KeyListener;
import com.jogamp.newt.event.MouseEvent;
import com.jogamp.newt.event.MouseListener;
+import com.jogamp.newt.event.PinchToZoomGesture;
+import com.jogamp.newt.event.GestureHandler.GestureEvent;
import com.jogamp.opengl.JoglVersion;
import com.jogamp.opengl.test.junit.jogl.demos.GearsObject;
import com.jogamp.opengl.util.PMVMatrix;
+import com.jogamp.opengl.util.TileRendererBase;
import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.glsl.ShaderState;
+
import java.nio.FloatBuffer;
import javax.media.nativewindow.NativeWindow;
@@ -48,30 +53,39 @@ import javax.media.opengl.GLUniformData;
* GearsES2.java <BR>
* @author Brian Paul (converted to Java by Ron Cemer and Sven Gothel) <P>
*/
-public class GearsES2 implements GLEventListener {
+public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererListener {
private final FloatBuffer lightPos = Buffers.newDirectFloatBuffer( new float[] { 5.0f, 5.0f, 10.0f } );
-
+
private ShaderState st = null;
private PMVMatrix pmvMatrix = null;
private GLUniformData pmvMatrixUniform = null;
private GLUniformData colorU = null;
- private float view_rotx = 20.0f, view_roty = 30.0f, view_rotz = 0.0f;
+ private float view_rotx = 20.0f, view_roty = 30.0f;
+
+ private final float view_rotz = 0.0f;
private float panX = 0.0f, panY = 0.0f, panZ=0.0f;
- private int drawableHeight = 1;
- private GearsObjectES2 gear1=null, gear2=null, gear3=null;
+ private volatile GearsObjectES2 gear1=null, gear2=null, gear3=null;
+ private GearsES2 sharedGears = null;
+ private volatile boolean usesSharedGears = false;
private FloatBuffer gear1Color=GearsObject.red, gear2Color=GearsObject.green, gear3Color=GearsObject.blue;
private float angle = 0.0f;
private int swapInterval = 0;
private boolean pmvUseBackingArray = true; // the default for PMVMatrix now, since it's faster
// private MouseListener gearsMouse = new TraceMouseAdapter(new GearsMouseAdapter());
- public MouseListener gearsMouse = new GearsMouseAdapter();
+ public MouseListener gearsMouse = new GearsMouseAdapter();
public KeyListener gearsKeys = new GearsKeyAdapter();
+ private TileRendererBase tileRendererInUse = null;
+ private boolean doRotateBeforePrinting;
private boolean doRotate = true;
private boolean ignoreFocus = false;
private float[] clearColor = null;
private boolean clearBuffers = true;
private boolean verbose = true;
+ private volatile boolean isInit = false;
+
+ private PinchToZoomGesture pinchToZoomGesture = null;
+
public GearsES2(int swapInterval) {
this.swapInterval = swapInterval;
@@ -81,32 +95,56 @@ public class GearsES2 implements GLEventListener {
this.swapInterval = 1;
}
+ @Override
+ public void addTileRendererNotify(TileRendererBase tr) {
+ tileRendererInUse = tr;
+ doRotateBeforePrinting = doRotate;
+ setDoRotation(false);
+ }
+ @Override
+ public void removeTileRendererNotify(TileRendererBase tr) {
+ tileRendererInUse = null;
+ setDoRotation(doRotateBeforePrinting);
+ }
+ @Override
+ public void startTileRendering(TileRendererBase tr) {
+ System.err.println("GearsES2.startTileRendering: "+sid()+""+tr);
+ }
+ @Override
+ public void endTileRendering(TileRendererBase tr) {
+ System.err.println("GearsES2.endTileRendering: "+sid()+""+tr);
+ }
+
public void setIgnoreFocus(boolean v) { ignoreFocus = v; }
public void setDoRotation(boolean rotate) { this.doRotate = rotate; }
public void setClearBuffers(boolean v) { clearBuffers = v; }
public void setVerbose(boolean v) { verbose = v; }
-
+
public void setPMVUseBackingArray(boolean pmvUseBackingArray) {
this.pmvUseBackingArray = pmvUseBackingArray;
}
-
+
/** float[4] */
public void setClearColor(float[] clearColor) {
- this.clearColor = clearColor;
+ this.clearColor = clearColor;
}
-
+
public void setGearsColors(FloatBuffer gear1Color, FloatBuffer gear2Color, FloatBuffer gear3Color) {
this.gear1Color = gear1Color;
this.gear2Color = gear2Color;
this.gear3Color = gear3Color;
}
-
- public void setGears(GearsObjectES2 g1, GearsObjectES2 g2, GearsObjectES2 g3) {
+
+ public void setSharedGearsObjects(GearsObjectES2 g1, GearsObjectES2 g2, GearsObjectES2 g3) {
gear1 = g1;
gear2 = g2;
gear3 = g3;
}
+ public void setSharedGears(GearsES2 shared) {
+ sharedGears = shared;
+ }
+
/**
* @return gear1
*/
@@ -122,24 +160,48 @@ public class GearsES2 implements GLEventListener {
*/
public GearsObjectES2 getGear3() { return gear3; }
+ public boolean usesSharedGears() { return usesSharedGears; }
+ private static final int TIME_OUT = 2000; // 2s
+ private static final int POLL_DIVIDER = 20; // TO/20
+ private static final int TIME_SLICE = TIME_OUT / POLL_DIVIDER ;
+
+ /**
+ * @return True if this GLEventListener became initialized within TIME_OUT 2s
+ */
+ public boolean waitForInit(boolean initialized) throws InterruptedException {
+ int wait;
+ for (wait=0; wait<POLL_DIVIDER && initialized != isInit ; wait++) {
+ Thread.sleep(TIME_SLICE);
+ }
+ return wait<POLL_DIVIDER;
+ }
+
+ private final String sid() { return "0x"+Integer.toHexString(hashCode()); }
+
+ @Override
public void init(GLAutoDrawable drawable) {
- System.err.println(Thread.currentThread()+" GearsES2.init ...");
- final GL2ES2 gl = drawable.getGL().getGL2ES2();
+ if(null != sharedGears && !sharedGears.isInit() ) {
+ System.err.println(Thread.currentThread()+" GearsES2.init "+sid()+": pending shared Gears .. re-init later XXXXX");
+ drawable.setGLEventListenerInitState(this, false);
+ return;
+ }
+ System.err.println(Thread.currentThread()+" GearsES2.init "+sid()+": tileRendererInUse "+tileRendererInUse);
+ final GL2ES2 gl = drawable.getGL().getGL2ES2();
if(verbose) {
- System.err.println("GearsES2 init on "+Thread.currentThread());
+ System.err.println("GearsES2 init "+sid()+" on "+Thread.currentThread());
System.err.println("Chosen GLCapabilities: " + drawable.getChosenGLCapabilities());
System.err.println("INIT GL IS: " + gl.getClass().getName());
System.err.println(JoglVersion.getGLStrings(gl, null, false).toString());
- }
+ }
if( !gl.hasGLSL() ) {
System.err.println("No GLSL available, no rendering.");
return;
}
gl.glEnable(GL.GL_DEPTH_TEST);
-
+
st = new ShaderState();
// st.setVerbose(true);
final ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(), "shader",
@@ -154,7 +216,7 @@ public class GearsES2 implements GLEventListener {
st.attachShaderProgram(gl, sp0, true);
// Use debug pipeline
// drawable.setGL(new DebugGL(drawable.getGL()));
-
+
pmvMatrix = new PMVMatrix(pmvUseBackingArray);
st.attachObject("pmvMatrix", pmvMatrix);
pmvMatrixUniform = new GLUniformData("pmvMatrix", 4, 4, pmvMatrix.glGetPMvMvitMatrixf()); // P, Mv, Mvi and Mvit
@@ -169,101 +231,183 @@ public class GearsES2 implements GLEventListener {
st.ownUniform(colorU);
st.uniform(gl, colorU);
- if(null == gear1) {
- gear1 = new GearsObjectES2(st, gear1Color, 1.0f, 4.0f, 1.0f, 20, 0.7f, pmvMatrix, pmvMatrixUniform, colorU);
- if(verbose) {
- System.err.println("gear1 created: "+gear1);
- }
- } else {
- gear1 = new GearsObjectES2(gear1, st, pmvMatrix, pmvMatrixUniform, colorU);
- if(verbose) {
- System.err.println("gear1 reused: "+gear1);
- }
- }
-
- if(null == gear2) {
- gear2 = new GearsObjectES2(st, gear2Color, 0.5f, 2.0f, 2.0f, 10, 0.7f, pmvMatrix, pmvMatrixUniform, colorU);
- if(verbose) {
- System.err.println("gear2 created: "+gear2);
- }
+ if( null != sharedGears ) {
+ gear1 = new GearsObjectES2(sharedGears.getGear1(), st, pmvMatrix, pmvMatrixUniform, colorU);
+ gear2 = new GearsObjectES2(sharedGears.getGear2(), st, pmvMatrix, pmvMatrixUniform, colorU);
+ gear3 = new GearsObjectES2(sharedGears.getGear3(), st, pmvMatrix, pmvMatrixUniform, colorU);
+ usesSharedGears = true;
+ if(verbose) {
+ System.err.println("gear1 "+sid()+" created w/ share: "+sharedGears.getGear1()+" -> "+gear1);
+ System.err.println("gear2 "+sid()+" created w/ share: "+sharedGears.getGear2()+" -> "+gear2);
+ System.err.println("gear3 "+sid()+" created w/ share: "+sharedGears.getGear3()+" -> "+gear3);
+ }
} else {
- gear2 = new GearsObjectES2(gear2, st, pmvMatrix, pmvMatrixUniform, colorU);
- if(verbose) {
- System.err.println("gear2 reused: "+gear2);
+ if(null == gear1) {
+ gear1 = new GearsObjectES2(st, gear1Color, 1.0f, 4.0f, 1.0f, 20, 0.7f, pmvMatrix, pmvMatrixUniform, colorU);
+ gear1.init(gl);
+ if(verbose) {
+ System.err.println("gear1 "+sid()+" created: "+gear1);
+ }
+ } else {
+ final GearsObjectES2 _gear1 = gear1;
+ gear1 = new GearsObjectES2(_gear1, st, pmvMatrix, pmvMatrixUniform, colorU);
+ usesSharedGears = true;
+ if(verbose) {
+ System.err.println("gear1 "+sid()+" created w/ share: "+_gear1+" -> "+gear1);
+ }
}
- }
-
- if(null == gear3) {
- gear3 = new GearsObjectES2(st, gear3Color, 1.3f, 2.0f, 0.5f, 10, 0.7f, pmvMatrix, pmvMatrixUniform, colorU);
- if(verbose) {
- System.err.println("gear3 created: "+gear3);
+
+ if(null == gear2) {
+ gear2 = new GearsObjectES2(st, gear2Color, 0.5f, 2.0f, 2.0f, 10, 0.7f, pmvMatrix, pmvMatrixUniform, colorU);
+ gear2.init(gl);
+ if(verbose) {
+ System.err.println("gear2 "+sid()+" created: "+gear2);
+ }
+ } else {
+ final GearsObjectES2 _gear2 = gear2;
+ gear2 = new GearsObjectES2(_gear2, st, pmvMatrix, pmvMatrixUniform, colorU);
+ usesSharedGears = true;
+ if(verbose) {
+ System.err.println("gear2 "+sid()+" created w/ share: "+_gear2+" -> "+gear2);
+ }
}
- } else {
- gear3 = new GearsObjectES2(gear3, st, pmvMatrix, pmvMatrixUniform, colorU);
- if(verbose) {
- System.err.println("gear3 reused: "+gear3);
+
+ if(null == gear3) {
+ gear3 = new GearsObjectES2(st, gear3Color, 1.3f, 2.0f, 0.5f, 10, 0.7f, pmvMatrix, pmvMatrixUniform, colorU);
+ gear3.init(gl);
+ if(verbose) {
+ System.err.println("gear3 "+sid()+" created: "+gear2);
+ }
+ } else {
+ final GearsObjectES2 _gear3 = gear3;
+ gear3 = new GearsObjectES2(_gear3, st, pmvMatrix, pmvMatrixUniform, colorU);
+ usesSharedGears = true;
+ if(verbose) {
+ System.err.println("gear3 "+sid()+" created w/ share: "+_gear3+" -> "+gear3);
+ }
}
}
-
+
final Object upstreamWidget = drawable.getUpstreamWidget();
if (upstreamWidget instanceof Window) {
final Window window = (Window) upstreamWidget;
window.addMouseListener(gearsMouse);
window.addKeyListener(gearsKeys);
+ window.addGestureListener(pinchToZoomListener);
+ pinchToZoomGesture = new PinchToZoomGesture(drawable.getNativeSurface(), false);
+ window.addGestureHandler(pinchToZoomGesture);
} else if (GLProfile.isAWTAvailable() && upstreamWidget instanceof java.awt.Component) {
final java.awt.Component comp = (java.awt.Component) upstreamWidget;
new com.jogamp.newt.event.awt.AWTMouseAdapter(gearsMouse).addTo(comp);
new com.jogamp.newt.event.awt.AWTKeyAdapter(gearsKeys).addTo(comp);
}
+
st.useProgram(gl, false);
-
- System.err.println(Thread.currentThread()+" GearsES2.init FIN");
+
+ gl.glFinish(); // make sure .. for shared context (impacts OSX 10.9)
+
+ isInit = true;
+ System.err.println(Thread.currentThread()+" GearsES2.init "+sid()+" FIN "+this);
}
- public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
- System.err.println(Thread.currentThread()+" GearsES2.reshape "+x+"/"+y+" "+width+"x"+height+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(drawable.getHandle()));
-
- drawableHeight = height;
-
- // Thread.dumpStack();
- final GL2ES2 gl = drawable.getGL().getGL2ES2();
+ public final boolean isInit() { return isInit; }
+ private final GestureHandler.GestureListener pinchToZoomListener = new GestureHandler.GestureListener() {
+ @Override
+ public void gestureDetected(GestureEvent gh) {
+ final PinchToZoomGesture.ZoomEvent ze = (PinchToZoomGesture.ZoomEvent) gh;
+ final float zoom = ze.getZoom(); // * ( ze.getTrigger().getPointerCount() - 1 ); <- too much ..
+ panZ = zoom * 30f - 30f; // [0 .. 2] -> [-30f .. 30f]
+ }
+ };
+
+ @Override
+ public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) {
+ if( !isInit ) { return; }
+ final GL2ES2 gl = glad.getGL().getGL2ES2();
if(-1 != swapInterval) {
- gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
+ gl.setSwapInterval(swapInterval);
}
+ reshapeImpl(gl, x, y, width, height, width, height);
+ }
+
+ @Override
+ public void reshapeTile(TileRendererBase tr,
+ int tileX, int tileY, int tileWidth, int tileHeight,
+ int imageWidth, int imageHeight) {
+ if( !isInit ) { return; }
+ final GL2ES2 gl = tr.getAttachedDrawable().getGL().getGL2ES2();
+ gl.setSwapInterval(0);
+ reshapeImpl(gl, tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight);
+ }
+
+ void reshapeImpl(GL2ES2 gl, int tileX, int tileY, int tileWidth, int tileHeight, int imageWidth, int imageHeight) {
+ final boolean msaa = gl.getContext().getGLDrawable().getChosenGLCapabilities().getSampleBuffers();
+ System.err.println(Thread.currentThread()+" GearsES2.reshape "+sid()+" "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", msaa "+msaa+", tileRendererInUse "+tileRendererInUse);
+
if( !gl.hasGLSL() ) {
return;
}
-
+
st.useProgram(gl, true);
pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
-
- if(height>width) {
- float h = (float)height / (float)width;
- pmvMatrix.glFrustumf(-1.0f, 1.0f, -h, h, 5.0f, 200.0f);
+
+ // compute projection parameters 'normal'
+ float left, right, bottom, top;
+ if( imageHeight > imageWidth ) {
+ float a = (float)imageHeight / (float)imageWidth;
+ left = -1.0f;
+ right = 1.0f;
+ bottom = -a;
+ top = a;
} else {
- float h = (float)width / (float)height;
- pmvMatrix.glFrustumf(-h, h, -1.0f, 1.0f, 5.0f, 200.0f);
+ float a = (float)imageWidth / (float)imageHeight;
+ left = -a;
+ right = a;
+ bottom = -1.0f;
+ top = 1.0f;
}
+ final float w = right - left;
+ final float h = top - bottom;
+
+ // compute projection parameters 'tiled'
+ final float l = left + tileX * w / imageWidth;
+ final float r = l + tileWidth * w / imageWidth;
+ final float b = bottom + tileY * h / imageHeight;
+ final float t = b + tileHeight * h / imageHeight;
+
+ final float _w = r - l;
+ final float _h = t - b;
+ if(verbose) {
+ System.err.println(">> angle "+sid()+" "+angle+", [l "+left+", r "+right+", b "+bottom+", t "+top+"] "+w+"x"+h+" -> [l "+l+", r "+r+", b "+b+", t "+t+"] "+_w+"x"+_h);
+ }
+
+ pmvMatrix.glFrustumf(l, r, b, t, 5.0f, 200.0f);
pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0.0f, 0.0f, -40.0f);
st.uniform(gl, pmvMatrixUniform);
st.useProgram(gl, false);
-
+
// System.err.println(Thread.currentThread()+" GearsES2.reshape FIN");
}
// private boolean useAndroidDebug = false;
+ @Override
public void dispose(GLAutoDrawable drawable) {
- System.err.println(Thread.currentThread()+" GearsES2.dispose ... ");
+ if( !isInit ) { return; }
+ isInit = false;
+ System.err.println(Thread.currentThread()+" GearsES2.dispose "+sid()+": tileRendererInUse "+tileRendererInUse);
final Object upstreamWidget = drawable.getUpstreamWidget();
- if (upstreamWidget instanceof Window) {
+ if (upstreamWidget instanceof Window) {
final Window window = (Window) upstreamWidget;
window.removeMouseListener(gearsMouse);
window.removeKeyListener(gearsKeys);
+ window.removeGestureHandler(pinchToZoomGesture);
+ pinchToZoomGesture = null;
+ window.removeGestureListener(pinchToZoomListener);
}
final GL2ES2 gl = drawable.getGL().getGL2ES2();
if( !gl.hasGLSL() ) {
@@ -275,19 +419,22 @@ public class GearsES2 implements GLEventListener {
gear2.destroy(gl);
gear2 = null;
gear3.destroy(gl);
- gear3 = null;
+ gear3 = null;
pmvMatrix = null;
- colorU = null;
+ colorU = null;
st.destroy(gl);
st = null;
-
- System.err.println(Thread.currentThread()+" GearsES2.dispose FIN");
+
+ System.err.println(Thread.currentThread()+" GearsES2.dispose "+sid()+" FIN");
}
+ @Override
public void display(GLAutoDrawable drawable) {
+ if( !isInit ) { return; }
+ if(null != sharedGears && !sharedGears.isInit() ) { return; }
GLAnimatorControl anim = drawable.getAnimator();
if( verbose && ( null == anim || !anim.isAnimating() ) ) {
- System.err.println(Thread.currentThread()+" GearsES2.display "+drawable.getWidth()+"x"+drawable.getHeight()+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(drawable.getHandle()));
+ System.err.println(Thread.currentThread()+" GearsES2.display "+sid()+" "+drawable.getWidth()+"x"+drawable.getHeight()+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(drawable.getHandle()));
}
// Turn the gears' teeth
if(doRotate) {
@@ -304,10 +451,12 @@ public class GearsES2 implements GLEventListener {
} else {
hasFocus = true;
}
-
+
if( clearBuffers ) {
if( null != clearColor ) {
gl.glClearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);
+ } else if( null != tileRendererInUse ) {
+ gl.glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
} else if( ignoreFocus || hasFocus ) {
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
} else {
@@ -315,7 +464,7 @@ public class GearsES2 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() &&
+ if (GLProfile.isAWTAvailable() &&
(drawable instanceof javax.media.opengl.awt.GLJPanel) &&
!((javax.media.opengl.awt.GLJPanel) drawable).isOpaque() &&
((javax.media.opengl.awt.GLJPanel) drawable).shouldPreserveColorBufferIfTranslucent()) {
@@ -323,13 +472,13 @@ public class GearsES2 implements GLEventListener {
} else {
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
}
- }
+ }
if( !gl.hasGLSL() ) {
return;
}
gl.glEnable(GL.GL_CULL_FACE);
-
+
st.useProgram(gl, true);
pmvMatrix.glPushMatrix();
pmvMatrix.glTranslatef(panX, panY, panZ);
@@ -339,20 +488,25 @@ public class GearsES2 implements GLEventListener {
gear1.draw(gl, -3.0f, -2.0f, 1f * angle - 0f);
gear2.draw(gl, 3.1f, -2.0f, -2f * angle - 9.0f);
- gear3.draw(gl, -3.1f, 4.2f, -2f * angle - 25.0f);
+ gear3.draw(gl, -3.1f, 4.2f, -2f * angle - 25.0f);
pmvMatrix.glPopMatrix();
st.useProgram(gl, false);
-
+
gl.glDisable(GL.GL_CULL_FACE);
}
-
+
+ @Override
+ public String toString() {
+ return "GearsES2[obj "+sid()+" isInit "+isInit+", usesShared "+usesSharedGears+", 1 "+gear1+", 2 "+gear2+", 3 "+gear3+"]";
+ }
+
boolean confinedFixedCenter = false;
-
+
public void setConfinedFixedCenter(boolean v) {
confinedFixedCenter = v;
}
-
- class GearsKeyAdapter extends KeyAdapter {
+
+ class GearsKeyAdapter extends KeyAdapter {
public void keyPressed(KeyEvent e) {
int kc = e.getKeyCode();
if(KeyEvent.VK_LEFT == kc) {
@@ -367,72 +521,9 @@ public class GearsES2 implements GLEventListener {
}
}
- interface GestureHandler {
- /** Returns true if within the gesture */
- public boolean isWithinGesture();
- /** Returns true if within the gesture */
- public boolean onReleased(MouseEvent e);
- /** Returns true if within the gesture */
- public boolean onDragged(MouseEvent e);
- }
- final GestureHandler gesture2PtrZoom = new GestureHandler() {
- private int zoomLastYDist;
- private boolean zoomFirstTouch = true;
- private boolean zoomMode = false;
-
- @Override
- public boolean isWithinGesture() {
- return zoomMode;
- }
-
- @Override
- public boolean onReleased(MouseEvent e) {
- if( zoomMode && e.getPointerCount()==1 ) {
- zoomFirstTouch = true;
- zoomMode = false;
- System.err.println("panZ.X: "+e);
- }
- return zoomMode;
- }
-
- @Override
- public boolean onDragged(MouseEvent e) {
- if( e.getPointerCount() >=2 ) {
- // 2 pointers zoom .. [ -15 .. 15 ], range 30
- /**
- // Simple 1:1 Zoom: finger-distance to screen-coord
- final int dy = Math.abs(e.getY(0)-e.getY(1));
- float scale = (float)dy / (float)drawableHeight;
- panZ = 30f * scale - 15f;
- System.err.println("panZ: scale "+scale+" ["+dy+"/"+drawableHeight+"] -> "+panZ);
- */
- // Diff. 1:1 Zoom: finger-distance to screen-coord
- if(zoomFirstTouch) {
- zoomLastYDist = Math.abs(e.getY(0)-e.getY(1));
- zoomFirstTouch=false;
- zoomMode = true;
- System.err.println("panZ: 1st pinch "+zoomLastYDist+", "+e);
- } else if( zoomMode ) {
- final int dy = Math.abs(e.getY(0)-e.getY(1));
- final int ddy = dy - zoomLastYDist;
-
- final float incr = ( (float)ddy / (float)drawableHeight ) * 15.0f;
- panZ += incr;
- if( e.getPointerCount() > 2 ) {
- panZ += incr;
- }
- System.err.println("panZ.1: ddy "+ddy+", incr "+incr+" ["+dy+"/"+drawableHeight+"], dblZoom "+(e.getPointerCount() > 2)+" -> "+panZ);
-
- zoomLastYDist = dy;
- }
- }
- return zoomMode;
- }
- };
-
class GearsMouseAdapter implements MouseListener{
private int prevMouseX, prevMouseY;
-
+
@Override
public void mouseClicked(MouseEvent e) {
}
@@ -454,53 +545,46 @@ public class GearsES2 implements GLEventListener {
panZ += incr;
System.err.println("panZ.2: incr "+incr+", dblZoom "+e.isShiftDown()+" -> "+panZ);
} else {
- // panning
+ // panning
panX -= rot[0]; // positive -> left
panY += rot[1]; // positive -> up
}
}
-
+
public void mousePressed(MouseEvent e) {
- if( !gesture2PtrZoom.isWithinGesture() ) {
- if( e.getPointerCount()==1 ) {
- prevMouseX = e.getX();
- prevMouseY = e.getY();
- } else if( e.getPointerCount() == 4 ) {
- final Object src = e.getSource();
- if( e.getPressure(true) > 0.7f && src instanceof Window) { // show Keyboard
- ((Window) src).setKeyboardVisible(true);
- }
+ if( e.getPointerCount()==1 ) {
+ prevMouseX = e.getX();
+ prevMouseY = e.getY();
+ } else if( e.getPointerCount() == 4 ) {
+ final Object src = e.getSource();
+ if( e.getPressure(0, true) > 0.7f && src instanceof Window) { // show Keyboard
+ ((Window) src).setKeyboardVisible(true);
}
}
}
public void mouseReleased(MouseEvent e) {
- gesture2PtrZoom.onReleased(e);
}
public void mouseMoved(MouseEvent e) {
- if( !gesture2PtrZoom.isWithinGesture() && e.getPointerCount()==1 ) {
- if( e.isConfined() ) {
- navigate(e);
- } else {
- // track prev. position so we don't have 'jumps'
- // in case we move to confined navigation.
- prevMouseX = e.getX();
- prevMouseY = e.getY();
- }
+ if( e.isConfined() ) {
+ navigate(e);
+ } else {
+ // track prev. position so we don't have 'jumps'
+ // in case we move to confined navigation.
+ prevMouseX = e.getX();
+ prevMouseY = e.getY();
}
}
-
+
public void mouseDragged(MouseEvent e) {
- if( !gesture2PtrZoom.onDragged(e) && e.getPointerCount()==1 ) {
- navigate(e);
- }
+ navigate(e);
}
-
+
private void navigate(MouseEvent e) {
int x = e.getX();
int y = e.getY();
-
+
int width, height;
Object source = e.getSource();
Window window = null;
@@ -518,12 +602,12 @@ public class GearsES2 implements GLEventListener {
height=comp.getHeight();
} else {
throw new RuntimeException("Event source neither Window nor Component: "+source);
- }
+ }
final float thetaY = 360.0f * ( (float)(x-prevMouseX)/(float)width);
final float thetaX = 360.0f * ( (float)(prevMouseY-y)/(float)height);
view_rotx += thetaX;
view_roty += thetaY;
- if(e.isConfined() && confinedFixedCenter && null!=window) {
+ if(e.isConfined() && confinedFixedCenter && null!=window) {
x=window.getWidth()/2;
y=window.getHeight()/2;
window.warpPointer(x, y);
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 c5f5f7a..f3367ad 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
@@ -7,10 +7,10 @@
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
@@ -40,12 +40,12 @@ public class GearsObjectES2 extends GearsObject {
final GLUniformData pmvMatrixUniform;
final GLUniformData colorUniform;
final ShaderState st;
-
+
public GearsObjectES2(ShaderState st, FloatBuffer gearColor, float inner_radius, float outer_radius,
float width, int teeth,
- float tooth_depth,
+ float tooth_depth,
PMVMatrix pmvMatrix,
- GLUniformData pmvMatrixUniform, GLUniformData colorUniform)
+ GLUniformData pmvMatrixUniform, GLUniformData colorUniform)
{
super(gearColor, inner_radius, outer_radius, width, teeth, tooth_depth);
this.pmvMatrix = pmvMatrix;
@@ -56,9 +56,9 @@ public class GearsObjectES2 extends GearsObject {
}
public GearsObjectES2(GearsObjectES2 shared,
- ShaderState st,
+ ShaderState st,
PMVMatrix pmvMatrix,
- GLUniformData pmvMatrixUniform, GLUniformData colorUniform)
+ GLUniformData pmvMatrixUniform, GLUniformData colorUniform)
{
super(shared);
this.pmvMatrix = pmvMatrix;
@@ -67,31 +67,34 @@ public class GearsObjectES2 extends GearsObject {
this.st = st;
associate(st);
}
-
+
private void associate(ShaderState st) {
frontFace.associate(st, true);
frontSide.associate(st, true);
backFace.associate(st, true);
backSide.associate(st, true);
outwardFace.associate(st, true);
- insideRadiusCyl.associate(st, true);
+ insideRadiusCyl.associate(st, true);
}
@Override
public GLArrayDataServer createInterleaved(int comps, int dataType, boolean normalized, int initialSize, int vboUsage) {
return GLArrayDataServer.createGLSLInterleaved(comps, dataType, normalized, initialSize, vboUsage);
}
-
+
@Override
public void addInterleavedVertexAndNormalArrays(GLArrayDataServer array, int components) {
array.addGLSLSubArray("vertices", components, GL.GL_ARRAY_BUFFER);
array.addGLSLSubArray("normals", components, GL.GL_ARRAY_BUFFER);
}
- private void draw(GL2ES2 gl, GLArrayDataServer array, int mode) {
- array.enableBuffer(gl, true);
- gl.glDrawArrays(mode, 0, array.getElementCount());
- array.enableBuffer(gl, false);
+ private void draw(GL2ES2 gl, GLArrayDataServer array, int mode, int face) {
+ if( !isShared || gl.glIsBuffer(array.getVBOName()) ) {
+ array.enableBuffer(gl, true);
+ // System.err.println("XXX Draw face "+face+" of "+this);
+ gl.glDrawArrays(mode, 0, array.getElementCount());
+ array.enableBuffer(gl, false);
+ }
}
@Override
@@ -109,13 +112,13 @@ public class GearsObjectES2 extends GearsObject {
colorUniform.setData(gearColor);
st.uniform(gl, colorUniform);
- draw(gl, frontFace, GL.GL_TRIANGLE_STRIP);
- draw(gl, frontSide, GL.GL_TRIANGLES);
- draw(gl, backFace, GL.GL_TRIANGLE_STRIP);
- draw(gl, backSide, GL.GL_TRIANGLES);
- draw(gl, outwardFace, GL.GL_TRIANGLE_STRIP);
- draw(gl, insideRadiusCyl, GL.GL_TRIANGLE_STRIP);
-
+ draw(gl, frontFace, GL.GL_TRIANGLE_STRIP, 0);
+ draw(gl, frontSide, GL.GL_TRIANGLES, 1);
+ draw(gl, backFace, GL.GL_TRIANGLE_STRIP, 2);
+ draw(gl, backSide, GL.GL_TRIANGLES, 3);
+ draw(gl, outwardFace, GL.GL_TRIANGLE_STRIP, 4);
+ draw(gl, insideRadiusCyl, GL.GL_TRIANGLE_STRIP, 5);
+
pmvMatrix.glPopMatrix();
- }
+ }
}
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 1ba4d12..715a97d 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
@@ -30,16 +30,18 @@ package com.jogamp.opengl.test.junit.jogl.demos.es2;
import com.jogamp.opengl.JoglVersion;
import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.PMVMatrix;
+import com.jogamp.opengl.util.TileRendererBase;
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;
-public class RedSquareES2 implements GLEventListener {
+public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRendererListener {
private ShaderState st;
private PMVMatrix pmvMatrix;
private GLUniformData pmvMatrixUniform;
@@ -50,6 +52,8 @@ public class RedSquareES2 implements GLEventListener {
private float aspect = 1.0f;
private boolean doRotate = true;
private boolean clearBuffers = true;
+ private TileRendererBase tileRendererInUse = null;
+ private boolean doRotateBeforePrinting;
public RedSquareES2(int swapInterval) {
this.swapInterval = swapInterval;
@@ -59,12 +63,33 @@ public class RedSquareES2 implements GLEventListener {
this.swapInterval = 1;
}
+ @Override
+ public void addTileRendererNotify(TileRendererBase tr) {
+ tileRendererInUse = tr;
+ doRotateBeforePrinting = doRotate;
+ setDoRotation(false);
+ }
+ @Override
+ public void removeTileRendererNotify(TileRendererBase tr) {
+ tileRendererInUse = null;
+ setDoRotation(doRotateBeforePrinting);
+ }
+ @Override
+ public void startTileRendering(TileRendererBase tr) {
+ System.err.println("RedSquareES2.startTileRendering: "+tr);
+ }
+ @Override
+ public void endTileRendering(TileRendererBase tr) {
+ System.err.println("RedSquareES2.endTileRendering: "+tr);
+ }
+
public void setAspect(float aspect) { this.aspect = aspect; }
public void setDoRotation(boolean rotate) { this.doRotate = rotate; }
public void setClearBuffers(boolean v) { clearBuffers = v; }
+ @Override
public void init(GLAutoDrawable glad) {
- System.err.println(Thread.currentThread()+" RedSquareES2.init ...");
+ System.err.println(Thread.currentThread()+" RedSquareES2.init: tileRendererInUse "+tileRendererInUse);
final GL2ES2 gl = glad.getGL().getGL2ES2();
System.err.println("RedSquareES2 init on "+Thread.currentThread());
@@ -126,12 +151,17 @@ public class RedSquareES2 implements GLEventListener {
System.err.println(Thread.currentThread()+" RedSquareES2.init FIN");
}
+ @Override
public void display(GLAutoDrawable glad) {
long t1 = System.currentTimeMillis();
final GL2ES2 gl = glad.getGL().getGL2ES2();
if( clearBuffers ) {
- gl.glClearColor(0, 0, 0, 0);
+ if( null != tileRendererInUse ) {
+ gl.glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
+ } else {
+ gl.glClearColor(0, 0, 0, 0);
+ }
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
}
if( !gl.hasGLSL() ) {
@@ -158,23 +188,57 @@ public class RedSquareES2 implements GLEventListener {
st.useProgram(gl, false);
}
+ @Override
public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) {
- System.err.println(Thread.currentThread()+" RedSquareES2.reshape "+x+"/"+y+" "+width+"x"+height+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(glad.getHandle()));
- // Thread.dumpStack();
final GL2ES2 gl = glad.getGL().getGL2ES2();
+ if(-1 != swapInterval) {
+ gl.setSwapInterval(swapInterval);
+ }
+ reshapeImpl(gl, x, y, width, height, width, height);
+ }
+
+ @Override
+ public void reshapeTile(TileRendererBase tr,
+ int tileX, int tileY, int tileWidth, int tileHeight,
+ int imageWidth, int imageHeight) {
+ final GL2ES2 gl = tr.getAttachedDrawable().getGL().getGL2ES2();
+ gl.setSwapInterval(0);
+ reshapeImpl(gl, tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight);
+ }
+
+ void reshapeImpl(GL2ES2 gl, int tileX, int tileY, int tileWidth, int tileHeight, int imageWidth, int imageHeight) {
+ System.err.println(Thread.currentThread()+" RedSquareES2.reshape "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", tileRendererInUse "+tileRendererInUse);
+ // Thread.dumpStack();
if( !gl.hasGLSL() ) {
return;
}
- if(-1 != swapInterval) {
- gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
- }
-
st.useProgram(gl, true);
// Set location in front of camera
pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
- pmvMatrix.gluPerspective(45.0F, ( (float) width / (float) height ) / aspect, 1.0F, 100.0F);
+
+ // compute projection parameters 'normal' perspective
+ final float fovy=45f;
+ final float aspect2 = ( (float) imageWidth / (float) imageHeight ) / aspect;
+ final float zNear=1f;
+ final float zFar=100f;
+
+ // compute projection parameters 'normal' frustum
+ final float top=(float)Math.tan(fovy*((float)Math.PI)/360.0f)*zNear;
+ final float bottom=-1.0f*top;
+ final float left=aspect2*bottom;
+ final float right=aspect2*top;
+ final float w = right - left;
+ final float h = top - bottom;
+
+ // compute projection parameters 'tiled'
+ final float l = left + tileX * w / imageWidth;
+ final float r = l + tileWidth * w / imageWidth;
+ final float b = bottom + tileY * h / imageHeight;
+ final float t = b + tileHeight * h / imageHeight;
+
+ pmvMatrix.glFrustumf(l, r, b, t, zNear, zFar);
//pmvMatrix.glOrthof(-4.0f, 4.0f, -4.0f, 4.0f, 1.0f, 100.0f);
st.uniform(gl, pmvMatrixUniform);
st.useProgram(gl, false);
@@ -182,8 +246,9 @@ public class RedSquareES2 implements GLEventListener {
System.err.println(Thread.currentThread()+" RedSquareES2.reshape FIN");
}
+ @Override
public void dispose(GLAutoDrawable glad) {
- System.err.println(Thread.currentThread()+" RedSquareES2.dispose ... ");
+ System.err.println(Thread.currentThread()+" RedSquareES2.dispose: tileRendererInUse "+tileRendererInUse);
final GL2ES2 gl = glad.getGL().getGL2ES2();
if( !gl.hasGLSL() ) {
return;
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 55d0a47..8aa3a00 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
@@ -51,6 +51,8 @@ import javax.media.opengl.fixedfunc.GLMatrixFunc;
public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01Accessor {
TextureData textureData;
Texture texture;
+ int textureUnit;
+ boolean keepTextureBound;
ShaderState st;
PMVMatrix pmvMatrix;
@@ -58,14 +60,45 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A
GLArrayDataServer interleavedVBO;
float[] clearColor = new float[] { 1.0f, 1.0f, 1.0f, 1.0f };
- public TextureDraw01ES2Listener(TextureData td) {
+ /**
+ *
+ * @param td
+ * @param textureUnit of range [0..]
+ */
+ public TextureDraw01ES2Listener(TextureData td, int textureUnit) {
this.textureData = td;
+ this.textureUnit = textureUnit;
+ this.keepTextureBound = false;
}
public void setClearColor(float[] clearColor) {
this.clearColor = clearColor;
}
+ @Override
+ public void setKeepTextureBound(boolean v) {
+ this.keepTextureBound = v;
+ }
+ @Override
+ public Texture getTexture( ) {
+ return this.texture;
+ }
+
+ /**
+ public void setTextureData(GL gl, TextureData textureData ) {
+ if(null!=texture) {
+ texture.disable(gl);
+ texture.destroy(gl);
+ }
+ if(null!=this.textureData) {
+ this.textureData.destroy();
+ }
+ this.textureData = textureData;
+ this.texture = TextureIO.newTexture(this.textureData);
+
+ // fix VBO !
+ } */
+
static final String shaderBasename = "texture01_xxx";
private void initShader(GL2ES2 gl, boolean use_program) {
@@ -90,6 +123,7 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A
st.attachShaderProgram(gl, sp, use_program);
}
+ @Override
public void init(GLAutoDrawable glad) {
if(null!=textureData) {
this.texture = TextureIO.newTexture(glad.getGL(), textureData);
@@ -110,7 +144,7 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A
if(!st.uniform(gl, pmvMatrixUniform)) {
throw new GLException("Error setting PMVMatrix in shader: "+st);
}
- if(!st.uniform(gl, new GLUniformData("mgl_ActiveTexture", 0))) {
+ if(!st.uniform(gl, new GLUniformData("mgl_ActiveTexture", textureUnit))) {
throw new GLException("Error setting mgl_ActiveTexture in shader: "+st);
}
@@ -140,33 +174,19 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A
// OpenGL Render Settings
gl.glClearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);
gl.glEnable(GL2ES2.GL_DEPTH_TEST);
- st.useProgram(gl, false);
- }
-
- public Texture getTexture( ) {
- return this.texture;
- }
-
- /**
- public void setTextureData(GL gl, TextureData textureData ) {
- if(null!=texture) {
- texture.disable(gl);
- texture.destroy(gl);
- }
- if(null!=this.textureData) {
- this.textureData.destroy();
- }
- this.textureData = textureData;
- this.texture = TextureIO.newTexture(this.textureData);
- // fix VBO !
- } */
+ if( keepTextureBound && null != texture ) {
+ gl.glActiveTexture(GL.GL_TEXTURE0 + textureUnit);
+ texture.enable(gl);
+ texture.bind(gl);
+ }
+ st.useProgram(gl, false);
+ }
+ @Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
GL2ES2 gl = drawable.getGL().getGL2ES2();
- gl.glViewport(0, 0, width, height);
-
// Clear background to white
gl.glClearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);
if(null != st) {
@@ -183,6 +203,7 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A
}
}
+ @Override
public void dispose(GLAutoDrawable drawable) {
GL2ES2 gl = drawable.getGL().getGL2ES2();
if(null!=texture) {
@@ -200,6 +221,7 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A
st=null;
}
+ @Override
public void display(GLAutoDrawable drawable) {
GL2ES2 gl = drawable.getGL().getGL2ES2();
@@ -207,13 +229,17 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A
st.useProgram(gl, true);
interleavedVBO.enableBuffer(gl, true);
- gl.glActiveTexture(GL.GL_TEXTURE0);
- texture.enable(gl);
- texture.bind(gl);
+ if( !keepTextureBound && null != texture ) {
+ gl.glActiveTexture(GL.GL_TEXTURE0 + textureUnit);
+ texture.enable(gl);
+ texture.bind(gl);
+ }
gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4);
- texture.disable(gl);
+ if( !keepTextureBound && null != texture ) {
+ texture.disable(gl);
+ }
interleavedVBO.enableBuffer(gl, false);
st.useProgram(gl, false);
}
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
new file mode 100644
index 0000000..aac0080
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java
@@ -0,0 +1,285 @@
+/**
+ * Copyright (C) 2011 JogAmp Community. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+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.FBObject;
+import com.jogamp.opengl.FBObject.TextureAttachment;
+import com.jogamp.opengl.FBObject.Attachment.Type;
+import com.jogamp.opengl.util.GLArrayDataServer;
+import com.jogamp.opengl.util.PMVMatrix;
+import com.jogamp.opengl.util.glsl.ShaderCode;
+import com.jogamp.opengl.util.glsl.ShaderProgram;
+import com.jogamp.opengl.util.glsl.ShaderState;
+
+public class TextureDraw02ES2ListenerFBO implements GLEventListener {
+ private final GLEventListener demo;
+ private final int swapInterval;
+ private boolean clearBuffers = true;
+ private int numSamples;
+ int textureUnit;
+ boolean keepTextureBound;
+
+ private final ShaderState st;
+ private final PMVMatrix pmvMatrix;
+
+ private final FBObject fbo0;
+
+ private TextureAttachment fbo0Tex;
+
+ private ShaderProgram sp0;
+ private GLUniformData pmvMatrixUniform;
+ private GLArrayDataServer interleavedVBO;
+ private GLUniformData texUnit0;
+
+ public TextureDraw02ES2ListenerFBO(GLEventListener demo, int swapInterval, int textureUnit) {
+ this.demo = demo;
+ this.swapInterval = swapInterval;
+ this.textureUnit = textureUnit;
+ this.keepTextureBound = false;
+
+ st = new ShaderState();
+ // st.setVerbose(true);
+ pmvMatrix = new PMVMatrix();
+
+ fbo0 = new FBObject();
+
+ numSamples = 0;
+ }
+
+ public void setClearBuffers(boolean v) { clearBuffers = v; }
+
+ public void setKeepTextureBound(boolean v) {
+ this.keepTextureBound = v;
+ }
+ public void setMSAA(int numSamples) {
+ this.numSamples=numSamples;
+ }
+ public int getMSAA() { return numSamples; }
+
+ @Override
+ public void init(GLAutoDrawable drawable) {
+ final GL2ES2 gl = drawable.getGL().getGL2ES2();
+
+ demo.init(drawable);
+
+ final ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, TextureDraw02ES2ListenerFBO.class, "shader",
+ "shader/bin", "texture01_xxx", true);
+ final ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, TextureDraw02ES2ListenerFBO.class, "shader",
+ "shader/bin", "texture02_xxx", true);
+ vp0.defaultShaderCustomization(gl, true, true);
+ fp0.defaultShaderCustomization(gl, true, true);
+
+ sp0 = new ShaderProgram();
+ sp0.add(gl, vp0, System.err);
+ sp0.add(gl, fp0, System.err);
+ st.attachShaderProgram(gl, sp0, true);
+
+ pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf());
+ st.ownUniform(pmvMatrixUniform);
+ st.uniform(gl, pmvMatrixUniform);
+
+ interleavedVBO = GLArrayDataServer.createGLSLInterleaved(3+4+2, GL.GL_FLOAT, false, 3*4, GL.GL_STATIC_DRAW);
+ {
+ interleavedVBO.addGLSLSubArray("mgl_Vertex", 3, GL.GL_ARRAY_BUFFER);
+ interleavedVBO.addGLSLSubArray("mgl_Color", 4, GL.GL_ARRAY_BUFFER);
+ //interleavedVBO.addGLSLSubArray("mgl_Normal", 3, GL.GL_ARRAY_BUFFER);
+ interleavedVBO.addGLSLSubArray("mgl_MultiTexCoord", 2, GL.GL_ARRAY_BUFFER);
+
+ FloatBuffer ib = (FloatBuffer)interleavedVBO.getBuffer();
+
+ for(int i=0; i<4; i++) {
+ ib.put(s_quadVertices, i*3, 3);
+ ib.put(s_quadColors, i*4, 4);
+ //ib.put(s_cubeNormals, i*3, 3);
+ ib.put(s_quadTexCoords, i*2, 2);
+ }
+ }
+ interleavedVBO.seal(gl, true);
+ interleavedVBO.enableBuffer(gl, false);
+ st.ownAttribute(interleavedVBO, true);
+
+ texUnit0 = new GLUniformData("mgl_Texture0", textureUnit);
+ st.ownUniform(texUnit0);
+ st.uniform(gl, texUnit0);
+
+ st.useProgram(gl, false);
+
+ gl.glEnable(GL2ES2.GL_DEPTH_TEST);
+ }
+
+ private void initFBOs(GL gl, int width, int height) {
+ // remove all texture attachments, since MSAA uses just color-render-buffer
+ // and non-MSAA uses texture2d-buffer
+ fbo0.detachAllColorbuffer(gl);
+
+ fbo0.reset(gl, width, height, numSamples, false);
+ numSamples = fbo0.getNumSamples();
+
+ if(numSamples>0) {
+ fbo0.attachColorbuffer(gl, 0, true);
+ fbo0.resetSamplingSink(gl);
+ fbo0Tex = fbo0.getSamplingSink();
+ } else {
+ fbo0Tex = fbo0.attachTexture2D(gl, 0, true);
+ }
+ numSamples=fbo0.getNumSamples();
+ fbo0.attachRenderbuffer(gl, Type.DEPTH, 24);
+ fbo0.unbind(gl);
+ }
+
+ private void resetFBOs(GL gl, int width, int height) {
+ fbo0.reset(gl, width, height, numSamples, true);
+ numSamples = fbo0.getNumSamples();
+ if(numSamples>0) {
+ fbo0Tex = fbo0.getSamplingSink();
+ } else {
+ fbo0Tex = (TextureAttachment) fbo0.getColorbuffer(0);
+ }
+ }
+
+ @Override
+ public void dispose(GLAutoDrawable drawable) {
+ final GL2ES2 gl = drawable.getGL().getGL2ES2();
+ demo.dispose(drawable);
+ fbo0.destroy(gl);
+ st.destroy(gl);
+
+ fbo0Tex = null;
+ sp0 = null;
+ pmvMatrixUniform = null;
+ interleavedVBO = null;
+ }
+
+ @Override
+ public void display(GLAutoDrawable drawable) {
+ final GL2ES2 gl = drawable.getGL().getGL2ES2();
+
+ if( fbo0.getNumSamples() != numSamples ) {
+ System.err.println("**** NumSamples: "+fbo0.getNumSamples()+" -> "+numSamples);
+ resetFBOs(gl, drawable.getWidth(), drawable.getHeight());
+ }
+
+ if(0 < numSamples) {
+ gl.glEnable(GL.GL_MULTISAMPLE);
+ }
+
+ fbo0.bind(gl);
+ demo.display(drawable);
+ fbo0.unbind(gl);
+
+ st.useProgram(gl, true);
+ if( clearBuffers ) {
+ gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
+ }
+
+ if( !keepTextureBound ) {
+ gl.glActiveTexture(GL.GL_TEXTURE0 + texUnit0.intValue());
+ fbo0.use(gl, fbo0Tex);
+ if( !gl.isGLcore() ) {
+ gl.glEnable(GL.GL_TEXTURE_2D);
+ }
+ }
+ gl.glActiveTexture(GL.GL_TEXTURE0 + texUnit0.intValue());
+ interleavedVBO.enableBuffer(gl, true);
+
+ gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4);
+
+ interleavedVBO.enableBuffer(gl, false);
+
+ if( !keepTextureBound ) {
+ fbo0.unuse(gl);
+ }
+
+ st.useProgram(gl, false);
+ }
+
+ @Override
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ final GL2ES2 gl = drawable.getGL().getGL2ES2();
+
+ if(-1 != swapInterval) {
+ gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
+ }
+
+ if( !fbo0.isInitialized() ) {
+ System.err.println("**** Reshape.Init: "+width+"x"+height);
+ initFBOs(gl, width, height);
+ } else {
+ System.err.println("**** Reshape.Reset: "+width+"x"+height);
+ if( keepTextureBound ) {
+ fbo0.unuse(gl);
+ }
+ resetFBOs(gl, width, height);
+ }
+
+ fbo0.bind(gl);
+ demo.reshape(drawable, x, y, width, height);
+ fbo0.unbind(gl);
+
+ if( keepTextureBound ) {
+ gl.glActiveTexture(GL.GL_TEXTURE0 + texUnit0.intValue());
+ fbo0.use(gl, fbo0Tex);
+ if( !gl.isGLcore() ) {
+ gl.glEnable(GL.GL_TEXTURE_2D);
+ }
+ }
+
+ pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+ pmvMatrix.glLoadIdentity();
+ pmvMatrix.glOrthof(-1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 10.0f);
+
+ pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
+ pmvMatrix.glLoadIdentity();
+
+ st.useProgram(gl, true);
+ st.uniform(gl, pmvMatrixUniform);
+ st.useProgram(gl, false);
+
+ }
+
+ private static final float[] s_quadVertices = {
+ -1f, -1f, 0f, // LB
+ 1f, -1f, 0f, // RB
+ -1f, 1f, 0f, // LT
+ 1f, 1f, 0f // RT
+ };
+ private static final float[] s_quadColors = {
+ 1f, 1f, 1f, 1f,
+ 1f, 1f, 1f, 1f,
+ 1f, 1f, 1f, 1f,
+ 1f, 1f, 1f, 1f };
+ private static final float[] s_quadTexCoords = {
+ 0f, 0f, // LB
+ 1f, 0f, // RB
+ 0f, 1f, // LT
+ 1f, 1f // RT
+ };
+}
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 20c28c3..e38b9c6 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
@@ -52,6 +52,7 @@ import com.jogamp.opengl.util.glsl.ShaderState;
import com.jogamp.opengl.util.texture.Texture;
import com.jogamp.opengl.util.texture.TextureCoords;
import com.jogamp.opengl.util.texture.TextureSequence;
+import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame;
public class TextureSequenceCubeES2 implements GLEventListener {
public TextureSequenceCubeES2 (TextureSequence texSource, boolean innerCube, float zoom0, float rotx, float roty) {
@@ -136,7 +137,7 @@ public class TextureSequenceCubeES2 implements GLEventListener {
}
}
public void mouseWheelMoved(MouseEvent e) {
- System.err.println("XXX "+e);
+ // System.err.println("XXX "+e);
if( !e.isShiftDown() ) {
final float o = zoom;
final float d = e.getRotation()[1]/10f; // vertical: wheel
@@ -188,7 +189,11 @@ public class TextureSequenceCubeES2 implements GLEventListener {
public void init(GLAutoDrawable drawable) {
GL2ES2 gl = drawable.getGL().getGL2ES2();
System.err.println(JoglVersion.getGLInfo(gl, null));
- final Texture tex= texSeq.getLastTexture().getTexture();
+ final TextureFrame frame = texSeq.getLastTexture();
+ if( null == frame ) {
+ return;
+ }
+ final Texture tex= frame.getTexture();
final boolean useExternalTexture = GLES2.GL_TEXTURE_EXTERNAL_OES == tex.getTarget();
if(useExternalTexture && !gl.isExtensionAvailable("GL_OES_EGL_image_external")) {
@@ -315,39 +320,51 @@ public class TextureSequenceCubeES2 implements GLEventListener {
private void reshapePMV(int width, int height) {
- pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
- pmvMatrix.glLoadIdentity();
- if(!innerCube) {
- pmvMatrix.gluPerspective(45.0f, (float)width / (float)height, 1f, 10.0f);
- nearPlaneNormalized = 1f/(100f-1f);
- } else {
- pmvMatrix.glOrthof(-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 10.0f);
- nearPlaneNormalized = 0f;
+ if(null != pmvMatrix) {
+ pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+ pmvMatrix.glLoadIdentity();
+ if(!innerCube) {
+ pmvMatrix.gluPerspective(45.0f, (float)width / (float)height, 1f, 10.0f);
+ nearPlaneNormalized = 1f/(100f-1f);
+ } else {
+ pmvMatrix.glOrthof(-1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 10.0f);
+ nearPlaneNormalized = 0f;
+ }
+ System.err.println("XXX0: Perspective nearPlaneNormalized: "+nearPlaneNormalized);
+
+ pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
+ pmvMatrix.glLoadIdentity();
+ pmvMatrix.glTranslatef(0, 0, zoom);
}
- System.err.println("XXX0: Perspective nearPlaneNormalized: "+nearPlaneNormalized);
-
- pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
- pmvMatrix.glLoadIdentity();
- pmvMatrix.glTranslatef(0, 0, zoom);
}
+ @Override
public void dispose(GLAutoDrawable drawable) {
GL2ES2 gl = drawable.getGL().getGL2ES2();
texSeq = null;
pmvMatrixUniform = null;
- pmvMatrix.destroy();
- pmvMatrix=null;
- st.destroy(gl);
- st=null;
+ if( null != pmvMatrix ) {
+ pmvMatrix.destroy();
+ pmvMatrix=null;
+ }
+ if( null != st ) {
+ st.destroy(gl);
+ st=null;
+ }
}
+ @Override
public void display(GLAutoDrawable drawable) {
GL2ES2 gl = drawable.getGL().getGL2ES2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
-
+
+ if( null == st ) {
+ return;
+ }
+
st.useProgram(gl, true);
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
@@ -360,7 +377,7 @@ public class TextureSequenceCubeES2 implements GLEventListener {
interleavedVBO.enableBuffer(gl, true);
Texture tex = null;
if(null!=texSeq) {
- final TextureSequence.TextureFrame texFrame = texSeq.getNextTexture(gl, true);
+ final TextureSequence.TextureFrame texFrame = texSeq.getNextTexture(gl);
if(null != texFrame) {
tex = texFrame.getTexture();
gl.glActiveTexture(GL.GL_TEXTURE0+texSeq.getTextureUnit());
@@ -379,9 +396,6 @@ public class TextureSequenceCubeES2 implements GLEventListener {
st.useProgram(gl, false);
}
- public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
- }
-
static final float[] light_position = { -50.f, 50.f, 50.f, 0.f };
static final float[] light_ambient = { 0.125f, 0.125f, 0.125f, 1.f };
static final float[] light_diffuse = { 1.0f, 1.0f, 1.0f, 1.f };
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 921710f..a7636fc 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
@@ -1,44 +1,36 @@
-/*
- * Copyright (c) 2008 Sun Microsystems, Inc. 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.
- *
+/**
+ * Copyright 2012 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.demos.es2.av;
-import java.io.BufferedReader;
import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
import javax.media.opengl.GL2ES2;
import javax.media.opengl.GLAutoDrawable;
@@ -57,188 +49,343 @@ import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.JoglVersion;
import com.jogamp.opengl.test.junit.jogl.demos.es2.TextureSequenceCubeES2;
import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.av.GLMediaPlayer;
import com.jogamp.opengl.util.av.GLMediaPlayer.GLMediaEventListener;
+import com.jogamp.opengl.util.av.GLMediaPlayer.StreamException;
import com.jogamp.opengl.util.av.GLMediaPlayerFactory;
+import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame;
-public class MovieCube implements GLEventListener, GLMediaEventListener {
- static boolean waitForKey = false;
- final URLConnection stream;
- final float zoom0, rotx, roty;
- TextureSequenceCubeES2 cube=null;
- GLMediaPlayer mPlayer=null;
-
- public MovieCube() throws IOException {
- this(new URL("http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4").openConnection(),
- -2.3f, 0f, 0f);
+/**
+ * Simple cube movie player w/ aspect ration true projection on a cube.
+ */
+public class MovieCube implements GLEventListener {
+ private static boolean waitForKey = false;
+ private final float zoom0, rotx, roty;
+ private TextureSequenceCubeES2 cube=null;
+ private GLMediaPlayer mPlayer=null;
+ private int swapInterval = 1;
+ private long lastPerfPos = 0;
+ private volatile boolean resetGLState = false;
+
+ /** Blender's Big Buck Bunny Trailer: 24f 640p VP8, Vorbis 44100Hz mono, WebM/Matroska Stream. */
+ public static final URI defURI;
+ static {
+ URI _defURI = null;
+ try {
+ _defURI = new URI("http://video.webmfiles.org/big-buck-bunny_trailer.webm");
+ } catch (URISyntaxException e) {
+ e.printStackTrace();
+ }
+ defURI = _defURI;
}
-
- public MovieCube(URLConnection stream, float zoom0, float rotx, float roty) throws IOException {
- this.stream = stream;
+
+ /**
+ * Default constructor which also issues {@link #initStream(URI, int, int, int)} w/ default values
+ * and polls until the {@link GLMediaPlayer} is {@link GLMediaPlayer.State#Initialized}.
+ * If {@link GLMediaEventListener#EVENT_CHANGE_EOS} is reached, the stream is started over again.
+ * <p>
+ * This default constructor is merely useful for some <i>drop-in</i> test, e.g. using an applet.
+ * </p>
+ */
+ public MovieCube() throws IOException, URISyntaxException {
+ this(-2.3f, 0f, 0f);
+
+ mPlayer.addEventListener(new GLMediaEventListener() {
+ @Override
+ public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) { }
+
+ @Override
+ public void attributesChanged(final GLMediaPlayer mp, int event_mask, long when) {
+ System.err.println("MovieCube AttributesChanges: events_mask 0x"+Integer.toHexString(event_mask)+", when "+when);
+ System.err.println("MovieCube State: "+mp);
+ if( 0 != ( GLMediaEventListener.EVENT_CHANGE_SIZE & event_mask ) ) {
+ resetGLState();
+ }
+ if( 0 != ( GLMediaEventListener.EVENT_CHANGE_EOS & event_mask ) ) {
+ // loop for-ever ..
+ mPlayer.seek(0);
+ mPlayer.play();
+ }
+ }
+ });
+ initStream(defURI, GLMediaPlayer.STREAM_ID_AUTO, GLMediaPlayer.STREAM_ID_AUTO, GLMediaPlayer.TEXTURE_COUNT_DEFAULT);
+ StreamException se = null;
+ while( null == se && GLMediaPlayer.State.Initialized != mPlayer.getState() ) {
+ try {
+ Thread.sleep(16);
+ } catch (InterruptedException e) { }
+ se = mPlayer.getStreamException();
+ }
+ if( null != se ) {
+ se.printStackTrace();
+ throw new RuntimeException(se);
+ }
+ }
+
+ /** Custom constructor, user needs to issue {@link #initStream(URI, int, int, int)} afterwards. */
+ public MovieCube(float zoom0, float rotx, float roty) throws IOException {
this.zoom0 = zoom0;
this.rotx = rotx;
this.roty = roty;
+ mPlayer = GLMediaPlayerFactory.createDefault();
+ }
+
+ public void initStream(URI streamLoc, int vid, int aid, int textureCount) {
+ mPlayer.initStream(streamLoc, vid, aid, textureCount);
+ System.out.println("pC.1b "+mPlayer);
+ }
+
+ public void setSwapInterval(int v) { this.swapInterval = v; }
+
+ public GLMediaPlayer getGLMediaPlayer() { return mPlayer; }
+
+ public void resetGLState() {
+ resetGLState = true;
}
private final KeyListener keyAction = new KeyAdapter() {
public void keyReleased(KeyEvent e) {
- if( !e.isPrintableKey() || e.isAutoRepeat() ) {
+ if( e.isAutoRepeat() ) {
return;
- }
+ }
System.err.println("MC "+e);
- int pts0 = mPlayer.getCurrentPosition();
+ int pts0 = mPlayer.getVideoPTS();
int pts1 = 0;
switch(e.getKeyCode()) {
- case KeyEvent.VK_3:
case KeyEvent.VK_RIGHT: pts1 = pts0 + 1000; break;
- case KeyEvent.VK_4:
case KeyEvent.VK_UP: pts1 = pts0 + 10000; break;
- case KeyEvent.VK_2:
+ case KeyEvent.VK_PAGE_UP: pts1 = pts0 + 30000; break;
case KeyEvent.VK_LEFT: pts1 = pts0 - 1000; break;
- case KeyEvent.VK_1:
case KeyEvent.VK_DOWN: pts1 = pts0 - 10000; break;
+ case KeyEvent.VK_PAGE_DOWN: pts1 = pts0 - 30000; break;
case KeyEvent.VK_ESCAPE:
- case KeyEvent.VK_DELETE:
+ case KeyEvent.VK_HOME:
case KeyEvent.VK_BACK_SPACE: {
mPlayer.seek(0);
- mPlayer.setPlaySpeed(1.0f);
- mPlayer.start();
break;
}
case KeyEvent.VK_SPACE: {
if(GLMediaPlayer.State.Paused == mPlayer.getState()) {
- mPlayer.start();
+ mPlayer.play();
} else {
- mPlayer.pause();
+ mPlayer.pause(false);
}
break;
}
- case KeyEvent.VK_S: mPlayer.setPlaySpeed(mPlayer.getPlaySpeed()/2.0f); break;
- case KeyEvent.VK_F: mPlayer.setPlaySpeed(mPlayer.getPlaySpeed()*2.0f); break;
+ case KeyEvent.VK_MULTIPLY:
+ mPlayer.setPlaySpeed(1.0f);
+ break;
+ case KeyEvent.VK_SUBTRACT: {
+ float playSpeed = mPlayer.getPlaySpeed();
+ if( e.isShiftDown() ) {
+ playSpeed /= 2.0f;
+ } else {
+ playSpeed -= 0.1f;
+ }
+ mPlayer.setPlaySpeed(playSpeed);
+ } break;
+ case KeyEvent.VK_ADD: {
+ float playSpeed = mPlayer.getPlaySpeed();
+ if( e.isShiftDown() ) {
+ playSpeed *= 2.0f;
+ } else {
+ playSpeed += 0.1f;
+ }
+ mPlayer.setPlaySpeed(playSpeed);
+ } break;
+ case KeyEvent.VK_M: {
+ float audioVolume = mPlayer.getAudioVolume();
+ if( audioVolume > 0.5f ) {
+ audioVolume = 0f;
+ } else {
+ audioVolume = 1f;
+ }
+ mPlayer.setAudioVolume(audioVolume);
+ } break;
}
-
+
if( 0 != pts1 ) {
mPlayer.seek(pts1);
}
- }
+ }
};
-
- @Override
- public void attributesChanges(GLMediaPlayer mp, int event_mask, long when) {
- System.out.println("attributesChanges: "+mp+", 0x"+Integer.toHexString(event_mask)+", when "+when);
- }
@Override
- public void newFrameAvailable(GLMediaPlayer mp, long when) {
- // System.out.println("newFrameAvailable: "+mp+", when "+when);
- }
-
public void init(GLAutoDrawable drawable) {
+ if(null == mPlayer) {
+ throw new InternalError("mPlayer null");
+ }
+ if( GLMediaPlayer.State.Uninitialized == mPlayer.getState() ) {
+ throw new IllegalStateException("mPlayer in uninitialized state: "+mPlayer);
+ }
+ if( GLMediaPlayer.STREAM_ID_NONE == mPlayer.getVID() ) {
+ // throw new IllegalStateException("mPlayer has no VID/stream selected: "+mPlayer);
+ }
+ resetGLState = false;
+
GL2ES2 gl = drawable.getGL().getGL2ES2();
System.err.println(JoglVersion.getGLInfo(gl, null));
- mPlayer = GLMediaPlayerFactory.createDefault();
- mPlayer.addEventListener(this);
- cube = new TextureSequenceCubeES2(mPlayer, false, zoom0, rotx, roty);
-
+ cube = new TextureSequenceCubeES2(mPlayer, false, zoom0, rotx, roty);
+
if(waitForKey) {
- BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
- System.err.println("Press enter to continue");
- try {
- System.err.println(stdin.readLine());
- } catch (IOException e) { }
+ UITestCase.waitForKey("Init>");
}
- try {
- System.out.println("p0 "+mPlayer);
- mPlayer.initGLStream(gl, stream);
- System.out.println("p1 "+mPlayer);
- } catch (Exception e) {
- e.printStackTrace();
- if(null != mPlayer) {
- mPlayer.destroy(gl);
- mPlayer = null;
+
+ if( GLMediaPlayer.State.Initialized == mPlayer.getState() ) {
+ try {
+ mPlayer.initGL(gl);
+ } catch (Exception e) {
+ e.printStackTrace();
+ if(null != mPlayer) {
+ mPlayer.destroy(gl);
+ mPlayer = null;
+ }
+ throw new GLException(e);
}
- throw new GLException(e);
}
-
cube.init(drawable);
- mPlayer.start();
+ mPlayer.play();
+ System.out.println("play.0 "+mPlayer);
boolean added;
final Object upstreamWidget = drawable.getUpstreamWidget();
- if (upstreamWidget instanceof Window) {
+ if (upstreamWidget instanceof Window) {
final Window window = (Window) upstreamWidget;
window.addKeyListener(keyAction);
added = true;
- } else { added = false; }
+ } else { added = false; }
System.err.println("MC.init: kl-added "+added+", "+drawable.getClass().getName());
}
+ @Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ final GL2ES2 gl = drawable.getGL().getGL2ES2();
+ if(-1 != swapInterval) {
+ gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
+ }
if(null == mPlayer) { return; }
cube.reshape(drawable, x, y, width, height);
}
+ @Override
public void dispose(GLAutoDrawable drawable) {
System.err.println(Thread.currentThread()+" MovieCube.dispose ... ");
+ disposeImpl(drawable, true);
+ }
+
+ private void disposeImpl(GLAutoDrawable drawable, boolean disposePlayer) {
if(null == mPlayer) { return; }
- mPlayer.stop();
- GL2ES2 gl = drawable.getGL().getGL2ES2();
- mPlayer.destroy(gl);
- mPlayer=null;
+ final Object upstreamWidget = drawable.getUpstreamWidget();
+ if (upstreamWidget instanceof Window) {
+ final Window window = (Window) upstreamWidget;
+ window.removeKeyListener(keyAction);
+ }
+ final GL2ES2 gl = drawable.getGL().getGL2ES2();
+ if( disposePlayer ) {
+ mPlayer.destroy(gl);
+ mPlayer=null;
+ }
cube.dispose(drawable);
cube=null;
}
+
+ @Override
public void display(GLAutoDrawable drawable) {
if(null == mPlayer) { return; }
+
+ if( resetGLState ) {
+ resetGLState = false;
+ System.err.println("XXX resetGLState");
+ disposeImpl(drawable, false);
+ init(drawable);
+ reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight());
+ }
+
+ final long currentPos = System.currentTimeMillis();
+ if( currentPos - lastPerfPos > 2000 ) {
+ System.err.println( mPlayer.getPerfString() );
+ lastPerfPos = currentPos;
+ }
cube.display(drawable);
}
- public void displayChanged(javax.media.opengl.GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
- }
-
- public static void main(String[] args) throws MalformedURLException, IOException, InterruptedException {
+ public static void main(String[] args) throws IOException, InterruptedException, URISyntaxException {
+ int swapInterval = 1;
int width = 510;
int height = 300;
- System.err.println("TexCubeES2.run()");
+ int textureCount = GLMediaPlayer.TEXTURE_COUNT_DEFAULT; // default - threaded
boolean forceES2 = false;
boolean forceES3 = false;
boolean forceGL3 = false;
boolean forceGLDef = false;
-
- String url_s="http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4";
- for(int i=0; i<args.length; i++) {
- if(args[i].equals("-width")) {
- i++;
- width = MiscUtils.atoi(args[i], width);
- } else if(args[i].equals("-height")) {
- i++;
- height = MiscUtils.atoi(args[i], height);
- } else if(args[i].equals("-url")) {
- i++;
- url_s = args[i];
- } 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("-gldef")) {
- forceGLDef = true;
- } else if(args[i].equals("-wait")) {
- waitForKey = true;
+ int vid = GLMediaPlayer.STREAM_ID_AUTO;
+ int aid = GLMediaPlayer.STREAM_ID_AUTO;
+ final boolean origSize;
+
+ String url_s=null;
+ {
+ boolean _origSize = false;
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-vid")) {
+ i++;
+ vid = MiscUtils.atoi(args[i], vid);
+ } else if(args[i].equals("-aid")) {
+ i++;
+ aid = MiscUtils.atoi(args[i], aid);
+ } else if(args[i].equals("-width")) {
+ i++;
+ width = MiscUtils.atoi(args[i], width);
+ } else if(args[i].equals("-height")) {
+ i++;
+ height = MiscUtils.atoi(args[i], height);
+ } else if(args[i].equals("-osize")) {
+ _origSize = true;
+ } else if(args[i].equals("-textureCount")) {
+ i++;
+ textureCount = MiscUtils.atoi(args[i], textureCount);
+ } else if(args[i].equals("-url")) {
+ i++;
+ url_s = args[i];
+ } 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("-gldef")) {
+ forceGLDef = true;
+ } else if(args[i].equals("-vsync")) {
+ i++;
+ swapInterval = MiscUtils.atoi(args[i], swapInterval);
+ } else if(args[i].equals("-wait")) {
+ waitForKey = true;
+ }
}
+ origSize = _origSize;
}
+ final URI streamLoc;
+ if( null == url_s ) {
+ streamLoc = defURI;
+ } else {
+ streamLoc = new URI(url_s);
+ }
+ System.err.println("stream "+streamLoc);
+ System.err.println("vid "+vid+", aid "+aid);
+ System.err.println("textureCount "+textureCount);
System.err.println("forceES2 "+forceES2);
System.err.println("forceES3 "+forceES3);
System.err.println("forceGL3 "+forceGL3);
System.err.println("forceGLDef "+forceGLDef);
-
- final MovieCube mc = new MovieCube(new URL(url_s).openConnection(), -2.3f, 0f, 0f);
-
+ System.err.println("swapInterval "+swapInterval);
+
+ final MovieCube mc = new MovieCube(-2.3f, 0f, 0f);
+ mc.setSwapInterval(swapInterval);
+
final GLProfile glp;
if(forceGLDef) {
glp = GLProfile.getDefault();
@@ -250,23 +397,53 @@ public class MovieCube implements GLEventListener, GLMediaEventListener {
glp = GLProfile.get(GLProfile.GLES2);
} else {
glp = GLProfile.getGL2ES2();
- }
+ }
System.err.println("GLProfile: "+glp);
final GLWindow window = GLWindow.create(new GLCapabilities(glp));
- // Size OpenGL to Video Surface
- window.setSize(width, height);
- window.setFullscreen(false);
- window.setSize(width, height);
- window.addGLEventListener(mc);
final Animator anim = new Animator(window);
window.addWindowListener(new WindowAdapter() {
public void windowDestroyed(WindowEvent e) {
anim.stop();
- }
+ }
});
- // anim.setUpdateFPSFrames(60, System.err);
- anim.start();
+ window.setSize(width, height);
window.setVisible(true);
+ anim.start();
+
+ mc.mPlayer.addEventListener(new GLMediaEventListener() {
+ @Override
+ public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) {
+ }
+
+ @Override
+ public void attributesChanged(final GLMediaPlayer mp, int event_mask, long when) {
+ System.err.println("MovieCube AttributesChanges: events_mask 0x"+Integer.toHexString(event_mask)+", when "+when);
+ System.err.println("MovieCube State: "+mp);
+ if( 0 != ( GLMediaEventListener.EVENT_CHANGE_SIZE & event_mask ) ) {
+ if( origSize ) {
+ window.setSize(mp.getWidth(), mp.getHeight());
+ }
+ // window.disposeGLEventListener(ms, false /* remove */ );
+ mc.resetGLState();
+ }
+ if( 0 != ( GLMediaEventListener.EVENT_CHANGE_INIT & event_mask ) ) {
+ window.addGLEventListener(mc);
+ anim.setUpdateFPSFrames(60, System.err);
+ anim.resetFPSCounter();
+ }
+ if( 0 != ( ( GLMediaEventListener.EVENT_CHANGE_ERR | GLMediaEventListener.EVENT_CHANGE_EOS ) & event_mask ) ) {
+ final StreamException se = mc.mPlayer.getStreamException();
+ if( null != se ) {
+ se.printStackTrace();
+ }
+ new Thread() {
+ public void run() {
+ window.destroy();
+ } }.start();
+ }
+ }
+ });
+ mc.initStream(streamLoc, vid, aid, textureCount);
}
}
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 7e0dcd9..d29381f 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
@@ -29,9 +29,8 @@
package com.jogamp.opengl.test.junit.jogl.demos.es2.av;
import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.nio.FloatBuffer;
import javax.media.opengl.GL;
@@ -46,6 +45,9 @@ import javax.media.opengl.GLUniformData;
import javax.media.opengl.fixedfunc.GLMatrixFunc;
import com.jogamp.newt.Window;
+import com.jogamp.newt.event.KeyAdapter;
+import com.jogamp.newt.event.KeyEvent;
+import com.jogamp.newt.event.KeyListener;
import com.jogamp.newt.event.MouseAdapter;
import com.jogamp.newt.event.MouseEvent;
import com.jogamp.newt.event.MouseListener;
@@ -54,11 +56,13 @@ import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.JoglVersion;
import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.opengl.util.av.GLMediaPlayer;
import com.jogamp.opengl.util.av.GLMediaPlayer.GLMediaEventListener;
+import com.jogamp.opengl.util.av.GLMediaPlayer.StreamException;
import com.jogamp.opengl.util.av.GLMediaPlayerFactory;
import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
@@ -66,8 +70,17 @@ import com.jogamp.opengl.util.glsl.ShaderState;
import com.jogamp.opengl.util.texture.Texture;
import com.jogamp.opengl.util.texture.TextureCoords;
import com.jogamp.opengl.util.texture.TextureSequence;
+import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame;
-public class MovieSimple implements GLEventListener, GLMediaEventListener {
+/**
+ * Simple planar movie player w/ orthogonal 1:1 projection.
+ */
+public class MovieSimple implements GLEventListener {
+ public static final int EFFECT_NORMAL = 0;
+ public static final int EFFECT_GRADIENT_BOTTOM2TOP = 1<<1;
+ public static final int EFFECT_TRANSPARENT = 1<<3;
+
+ private static boolean waitForKey = false;
private int winWidth, winHeight;
private int prevMouseX; // , prevMouseY;
private int rotate = 0;
@@ -79,36 +92,40 @@ public class MovieSimple implements GLEventListener, GLMediaEventListener {
private long startTime;
private int effects = EFFECT_NORMAL;
private float alpha = 1.0f;
-
- public static final int EFFECT_NORMAL = 0;
- public static final int EFFECT_GRADIENT_BOTTOM2TOP = 1<<1;
- public static final int EFFECT_TRANSPARENT = 1<<3;
-
- /** defaults to true */
- public void setOrthoProjection(boolean v) { orthoProjection=v; }
- public boolean getOrthoProjection() { return orthoProjection; }
+ private int swapInterval = 1;
+
+ private GLMediaPlayer mPlayer;
+ private boolean mPlayerShared;
+ private boolean mPlayerScaleOrig;
+ private float[] verts = null;
+ private GLArrayDataServer interleavedVBO;
+ private volatile boolean resetGLState = false;
+
+ private ShaderState st;
+ private PMVMatrix pmvMatrix;
+ private GLUniformData pmvMatrixUniform;
+ private static final String shaderBasename = "texsequence_xxx";
+ private static final String myTextureLookupName = "myTexture2D";
+
+ /** Blender's Big Buck Bunny Trailer: 24f 640p VP8, Vorbis 44100Hz mono, WebM/Matroska Stream. */
+ public static final URI defURI;
+ static {
+ URI _defURI = null;
+ try {
+ _defURI = new URI("http://video.webmfiles.org/big-buck-bunny_trailer.webm");
+ } catch (URISyntaxException e) {
+ e.printStackTrace();
+ }
+ defURI = _defURI;
+ }
- public boolean hasEffect(int e) { return 0 != ( effects & e ) ; }
- public void setEffects(int e) { effects = e; };
- public void setTransparency(float alpha) {
- this.effects |= EFFECT_TRANSPARENT;
- this.alpha = alpha;
- }
-
- GLMediaPlayer mPlayer;
- URLConnection stream = null;
- boolean mPlayerExternal;
- boolean mPlayerShared;
- boolean mPlayerScaleOrig;
- GLArrayDataServer interleavedVBO;
-
private final MouseListener mouseAction = new MouseAdapter() {
public void mousePressed(MouseEvent e) {
if(e.getY()<=winHeight/2 && null!=mPlayer && 1 == e.getClickCount()) {
if(GLMediaPlayer.State.Playing == mPlayer.getState()) {
- mPlayer.pause();
+ mPlayer.pause(false);
} else {
- mPlayer.start();
+ mPlayer.play();
}
}
}
@@ -129,9 +146,9 @@ public class MovieSimple implements GLEventListener, GLMediaEventListener {
if(y>winHeight/2) {
final float dp = (float)(x-prevMouseX)/(float)winWidth;
- mPlayer.seek(mPlayer.getCurrentPosition() + (int) (mPlayer.getDuration() * dp));
+ mPlayer.seek(mPlayer.getVideoPTS() + (int) (mPlayer.getDuration() * dp));
} else {
- mPlayer.start();
+ mPlayer.play();
rotate = 1;
zoom = zoom1;
}
@@ -147,62 +164,155 @@ public class MovieSimple implements GLEventListener, GLMediaEventListener {
}
};
- public MovieSimple(URLConnection stream) throws IOException {
- mPlayerScaleOrig = false;
- mPlayerShared = false;
- mPlayerExternal = false;
- mPlayer = GLMediaPlayerFactory.createDefault();
- mPlayer.addEventListener(this);
- this.stream = stream;
- System.out.println("pC.1 "+mPlayer);
+ private final KeyListener keyAction = new KeyAdapter() {
+ public void keyReleased(KeyEvent e) {
+ if( e.isAutoRepeat() ) {
+ return;
+ }
+ System.err.println("MC "+e);
+ int pts0 = mPlayer.getVideoPTS();
+ int pts1 = 0;
+ switch(e.getKeyCode()) {
+ case KeyEvent.VK_RIGHT: pts1 = pts0 + 1000; break;
+ case KeyEvent.VK_UP: pts1 = pts0 + 10000; break;
+ case KeyEvent.VK_PAGE_UP: pts1 = pts0 + 30000; break;
+ case KeyEvent.VK_LEFT: pts1 = pts0 - 1000; break;
+ case KeyEvent.VK_DOWN: pts1 = pts0 - 10000; break;
+ case KeyEvent.VK_PAGE_DOWN: pts1 = pts0 - 30000; break;
+ case KeyEvent.VK_ESCAPE:
+ case KeyEvent.VK_HOME:
+ case KeyEvent.VK_BACK_SPACE: {
+ mPlayer.seek(0);
+ break;
+ }
+ case KeyEvent.VK_SPACE: {
+ if(GLMediaPlayer.State.Paused == mPlayer.getState()) {
+ mPlayer.play();
+ } else {
+ mPlayer.pause(false);
+ }
+ break;
+ }
+ case KeyEvent.VK_MULTIPLY:
+ mPlayer.setPlaySpeed(1.0f);
+ break;
+ case KeyEvent.VK_SUBTRACT: {
+ float playSpeed = mPlayer.getPlaySpeed();
+ if( e.isShiftDown() ) {
+ playSpeed /= 2.0f;
+ } else {
+ playSpeed -= 0.1f;
+ }
+ mPlayer.setPlaySpeed(playSpeed);
+ } break;
+ case KeyEvent.VK_ADD: {
+ float playSpeed = mPlayer.getPlaySpeed();
+ if( e.isShiftDown() ) {
+ playSpeed *= 2.0f;
+ } else {
+ playSpeed += 0.1f;
+ }
+ mPlayer.setPlaySpeed(playSpeed);
+ } break;
+ case KeyEvent.VK_M: {
+ float audioVolume = mPlayer.getAudioVolume();
+ if( audioVolume > 0.5f ) {
+ audioVolume = 0f;
+ } else {
+ audioVolume = 1f;
+ }
+ mPlayer.setAudioVolume(audioVolume);
+ } break;
+ }
+
+ if( 0 != pts1 ) {
+ mPlayer.seek(pts1);
+ }
+ }
+ };
+
+ /**
+ * Default constructor which also issues {@link #initStream(URI, int, int, int)} w/ default values
+ * and polls until the {@link GLMediaPlayer} is {@link GLMediaPlayer.State#Initialized}.
+ * If {@link GLMediaEventListener#EVENT_CHANGE_EOS} is reached, the stream is started over again.
+ * <p>
+ * This default constructor is merely useful for some <i>drop-in</i> test, e.g. using an applet.
+ * </p>
+ */
+ public MovieSimple() {
+ this(null);
+
+ mPlayer.addEventListener(new GLMediaEventListener() {
+ @Override
+ public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) { }
+
+ @Override
+ public void attributesChanged(final GLMediaPlayer mp, int event_mask, long when) {
+ System.err.println("MovieCube AttributesChanges: events_mask 0x"+Integer.toHexString(event_mask)+", when "+when);
+ System.err.println("MovieCube State: "+mp);
+ if( 0 != ( GLMediaEventListener.EVENT_CHANGE_SIZE & event_mask ) ) {
+ resetGLState();
+ }
+ if( 0 != ( GLMediaEventListener.EVENT_CHANGE_EOS & event_mask ) ) {
+ // loop for-ever ..
+ mPlayer.seek(0);
+ mPlayer.play();
+ }
+ }
+ });
+ initStream(defURI, GLMediaPlayer.STREAM_ID_AUTO, GLMediaPlayer.STREAM_ID_AUTO, 3 /* textureCount */);
+ StreamException se = null;
+ while( null == se && GLMediaPlayer.State.Initialized != mPlayer.getState() ) {
+ try {
+ Thread.sleep(16);
+ } catch (InterruptedException e) { }
+ se = mPlayer.getStreamException();
+ }
+ if( null != se ) {
+ se.printStackTrace();
+ throw new RuntimeException(se);
+ }
}
+ /** Custom constructor, user needs to issue {@link #initStream(URI, int, int, int)} afterwards. */
public MovieSimple(GLMediaPlayer sharedMediaPlayer) throws IllegalStateException {
- mPlayerScaleOrig = false;
- mPlayerShared = true;
- mPlayerExternal = true;
mPlayer = sharedMediaPlayer;
- mPlayer.addEventListener(this);
- this.stream = null;
- System.out.println("pC.2 shared "+mPlayerShared+", "+mPlayer);
+ mPlayerScaleOrig = false;
+ mPlayerShared = null != mPlayer;
+ if( !mPlayerShared ) {
+ mPlayer = GLMediaPlayerFactory.createDefault();
+ }
+ System.out.println("pC.1a shared "+mPlayerShared+", "+mPlayer);
+ }
+
+ public void initStream(URI streamLoc, int vid, int aid, int textureCount) {
+ mPlayer.initStream(streamLoc, vid, aid, textureCount);
+ System.out.println("pC.1b "+mPlayer);
}
+ public void setSwapInterval(int v) { this.swapInterval = v; }
+
public GLMediaPlayer getGLMediaPlayer() { return mPlayer; }
public void setScaleOrig(boolean v) {
mPlayerScaleOrig = v;
}
- @Override
- public void attributesChanges(GLMediaPlayer mp, int event_mask, long when) {
- System.out.println("attributesChanges: "+mp+", 0x"+Integer.toHexString(event_mask)+", when "+when);
- }
-
- @Override
- public void newFrameAvailable(GLMediaPlayer mp, long when) {
- // System.out.println("newFrameAvailable: "+mp+", when "+when);
- }
-
- public void start() {
- if(null!=mPlayer) {
- mPlayer.start();
- System.out.println("pStart "+mPlayer);
- }
- }
+ /** defaults to true */
+ public void setOrthoProjection(boolean v) { orthoProjection=v; }
+ public boolean getOrthoProjection() { return orthoProjection; }
+
+ public boolean hasEffect(int e) { return 0 != ( effects & e ) ; }
+ public void setEffects(int e) { effects = e; };
+ public void setTransparency(float alpha) {
+ this.effects |= EFFECT_TRANSPARENT;
+ this.alpha = alpha;
+ }
- public void stop() {
- if(null!=mPlayer) {
- mPlayer.stop();
- System.out.println("pStop "+mPlayer);
- }
+ public void resetGLState() {
+ resetGLState = true;
}
- ShaderState st;
- PMVMatrix pmvMatrix;
- GLUniformData pmvMatrixUniform;
- static final String shaderBasename = "texsequence_xxx";
- static final String myTextureLookupName = "myTexture2D";
-
private void initShader(GL2ES2 gl) {
// Create & Compile the shader objects
ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, MovieSimple.class,
@@ -237,7 +347,19 @@ public class MovieSimple implements GLEventListener, GLMediaEventListener {
st.attachShaderProgram(gl, sp, false);
}
+ @Override
public void init(GLAutoDrawable drawable) {
+ if(null == mPlayer) {
+ throw new InternalError("mPlayer null");
+ }
+ if( GLMediaPlayer.State.Uninitialized == mPlayer.getState() ) {
+ throw new IllegalStateException("mPlayer in uninitialized state: "+mPlayer);
+ }
+ if( GLMediaPlayer.STREAM_ID_NONE == mPlayer.getVID() ) {
+ throw new IllegalStateException("mPlayer has no VID/stream selected: "+mPlayer);
+ }
+ resetGLState = false;
+
zoom0 = orthoProjection ? 0f : -2.5f;
zoom1 = orthoProjection ? 0f : -5f;
zoom = zoom0;
@@ -247,15 +369,22 @@ public class MovieSimple implements GLEventListener, GLMediaEventListener {
System.err.println("Alpha: "+alpha+", opaque "+drawable.getChosenGLCapabilities().isBackgroundOpaque()+
", "+drawable.getClass().getName()+", "+drawable);
+ if(waitForKey) {
+ UITestCase.waitForKey("Init>");
+ }
final Texture tex;
boolean useExternalTexture = false;
try {
System.out.println("p0 "+mPlayer+", shared "+mPlayerShared);
- if(!mPlayerShared) {
- mPlayer.initGLStream(gl, stream);
+ if(!mPlayerShared && GLMediaPlayer.State.Initialized == mPlayer.getState() ) {
+ mPlayer.initGL(gl);
}
- tex = mPlayer.getLastTexture().getTexture();
System.out.println("p1 "+mPlayer+", shared "+mPlayerShared);
+ final TextureFrame frame = mPlayer.getLastTexture();
+ if( null == frame ) {
+ throw new InternalError("XXX: "+mPlayer);
+ }
+ tex = mPlayer.getLastTexture().getTexture();
useExternalTexture = GLES2.GL_TEXTURE_EXTERNAL_OES == tex.getTarget();
if(useExternalTexture && !gl.isExtensionAvailable("GL_OES_EGL_image_external")) {
throw new GLException("GL_OES_EGL_image_external requested but not available");
@@ -263,7 +392,8 @@ public class MovieSimple implements GLEventListener, GLMediaEventListener {
if(!mPlayerShared) {
mPlayer.setTextureMinMagFilter( new int[] { GL.GL_NEAREST, GL.GL_LINEAR } );
}
- } catch (Exception glex) {
+ } catch (Exception glex) {
+ glex.printStackTrace();
if(!mPlayerShared && null != mPlayer) {
mPlayer.destroy(gl);
mPlayer = null;
@@ -293,7 +423,6 @@ public class MovieSimple implements GLEventListener, GLMediaEventListener {
float mHeight = mPlayer.getHeight();
float mAspect = mWidth/mHeight;
System.err.println("XXX0: mov aspect: "+mAspect);
- float[] verts;
float xs, ys;
if(orthoProjection) {
if(mPlayerScaleOrig && mWidth < dWidth && mHeight < dHeight) {
@@ -321,20 +450,53 @@ public class MovieSimple implements GLEventListener, GLMediaEventListener {
System.err.println("XXX0: win LB: "+winLB[0]+", "+winLB[1]+", "+winLB[2]);
System.err.println("XXX0: win RT: "+winRT[0]+", "+winRT[1]+", "+winRT[2]);
}
- final float ss = 1f, ts = 1f; // scale tex-coord
interleavedVBO = GLArrayDataServer.createGLSLInterleaved(3+4+2, GL.GL_FLOAT, false, 3*4, GL.GL_STATIC_DRAW);
{
interleavedVBO.addGLSLSubArray("mgl_Vertex", 3, GL.GL_ARRAY_BUFFER);
interleavedVBO.addGLSLSubArray("mgl_Color", 4, GL.GL_ARRAY_BUFFER);
- interleavedVBO.addGLSLSubArray("mgl_MultiTexCoord", 2, GL.GL_ARRAY_BUFFER);
-
+ interleavedVBO.addGLSLSubArray("mgl_MultiTexCoord", 2, GL.GL_ARRAY_BUFFER);
+ }
+ updateInterleavedVBO(gl, tex);
+
+ st.ownAttribute(interleavedVBO, true);
+ gl.glClearColor(0.3f, 0.3f, 0.3f, 0.3f);
+
+ gl.glEnable(GL2ES2.GL_DEPTH_TEST);
+
+ st.useProgram(gl, false);
+
+ // Let's show the completed shader state ..
+ System.out.println("iVBO: "+interleavedVBO);
+ System.out.println(st);
+
+ if(!mPlayerShared) {
+ mPlayer.play();
+ System.out.println("play.0 "+mPlayer);
+ }
+ startTime = System.currentTimeMillis();
+
+ final Object upstreamWidget = drawable.getUpstreamWidget();
+ if (upstreamWidget instanceof Window) {
+ final Window window = (Window) upstreamWidget;
+ window.addMouseListener(mouseAction);
+ window.addKeyListener(keyAction);
+ winWidth = window.getWidth();
+ winHeight = window.getHeight();
+ }
+ }
+
+ protected void updateInterleavedVBO(GL gl, Texture tex) {
+ final float ss = 1f, ts = 1f; // scale tex-coord
+ final boolean wasEnabled = interleavedVBO.enabled();
+ interleavedVBO.seal(gl, false);
+ interleavedVBO.rewind();
+ {
final FloatBuffer ib = (FloatBuffer)interleavedVBO.getBuffer();
- final TextureCoords tc = tex.getImageTexCoords();
- final float aspect = tex.getAspectRatio();
- System.err.println("XXX0: tex aspect: "+aspect);
+ final TextureCoords tc = tex.getImageTexCoords();
+ System.err.println("XXX0: "+tc);
+ System.err.println("XXX0: tex aspect: "+tex.getAspectRatio());
System.err.println("XXX0: tex y-flip: "+tex.getMustFlipVertically());
- System.err.println("XXX0: "+tex.getImageTexCoords());
// left-bottom
ib.put(verts[0]); ib.put(verts[1]); ib.put(verts[2]);
@@ -373,42 +535,23 @@ public class MovieSimple implements GLEventListener, GLMediaEventListener {
ib.put( tc.right() *ss); ib.put( tc.top() *ts);
}
interleavedVBO.seal(gl, true);
- interleavedVBO.enableBuffer(gl, false);
- st.ownAttribute(interleavedVBO, true);
- gl.glClearColor(0.3f, 0.3f, 0.3f, 0.3f);
-
- gl.glEnable(GL2ES2.GL_DEPTH_TEST);
-
- st.useProgram(gl, false);
-
- // Let's show the completed shader state ..
- System.out.println("iVBO: "+interleavedVBO);
- System.out.println(st);
-
- if(null!=mPlayer) {
- start();
- System.out.println("p2 "+mPlayer);
- }
-
- startTime = System.currentTimeMillis();
-
- final Object upstreamWidget = drawable.getUpstreamWidget();
- if (upstreamWidget instanceof Window) {
- final Window window = (Window) upstreamWidget;
- window.addMouseListener(mouseAction);
- winWidth = window.getWidth();
- winHeight = window.getHeight();
+ if( !wasEnabled ) {
+ interleavedVBO.enableBuffer(gl, false);
}
}
+ @Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ final GL2ES2 gl = drawable.getGL().getGL2ES2();
+ if(-1 != swapInterval) {
+ gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
+ }
if(null == mPlayer) { return; }
winWidth = width;
winHeight = height;
if(null != st) {
reshapePMV(width, height);
- GL2ES2 gl = drawable.getGL().getGL2ES2();
st.useProgram(gl, true);
st.uniform(gl, pmvMatrixUniform);
st.useProgram(gl, false);
@@ -436,34 +579,69 @@ public class MovieSimple implements GLEventListener, GLMediaEventListener {
pmvMatrix.glTranslatef(0, 0, zoom0);
}
+ @Override
public void dispose(GLAutoDrawable drawable) {
+ disposeImpl(drawable, true);
+ }
+
+ private void disposeImpl(GLAutoDrawable drawable, boolean disposePlayer) {
if(null == mPlayer) { return; }
- stop();
- System.out.println("pD.1 "+mPlayer);
+ final Object upstreamWidget = drawable.getUpstreamWidget();
+ if (upstreamWidget instanceof Window) {
+ final Window window = (Window) upstreamWidget;
+ window.removeMouseListener(mouseAction);
+ window.removeKeyListener(keyAction);
+ }
- GL2ES2 gl = drawable.getGL().getGL2ES2();
-
- mPlayer.removeEventListener(this);
- if(!mPlayerExternal) {
- mPlayer.destroy(gl);
+ System.out.println("pD.1 "+mPlayer+", disposePlayer "+disposePlayer);
+ GL2ES2 gl = drawable.getGL().getGL2ES2();
+ if( disposePlayer ) {
+ if(!mPlayerShared) {
+ mPlayer.destroy(gl);
+ }
+ System.out.println("pD.X "+mPlayer);
+ mPlayer=null;
}
- System.out.println("pD.X "+mPlayer);
- mPlayer=null;
pmvMatrixUniform = null;
- pmvMatrix.destroy();
- pmvMatrix=null;
- st.destroy(gl);
- st=null;
+ if(null != pmvMatrix) {
+ pmvMatrix.destroy();
+ pmvMatrix=null;
+ }
+ if(null != st) {
+ st.destroy(gl);
+ st=null;
+ }
}
+ long lastPerfPos = 0;
+
+ @Override
public void display(GLAutoDrawable drawable) {
if(null == mPlayer) { return; }
+ if( resetGLState ) {
+ resetGLState = false;
+ System.err.println("XXX resetGLState");
+ disposeImpl(drawable, false);
+ init(drawable);
+ reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight());
+ }
+
+ final long currentPos = System.currentTimeMillis();
+ if( currentPos - lastPerfPos > 2000 ) {
+ System.err.println( mPlayer.getPerfString() );
+ lastPerfPos = currentPos;
+ }
+
GL2ES2 gl = drawable.getGL().getGL2ES2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
+ if(null == st) {
+ return;
+ }
+
st.useProgram(gl, true);
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
@@ -483,7 +661,7 @@ public class MovieSimple implements GLEventListener, GLMediaEventListener {
if(mPlayerShared) {
texFrame=mPlayer.getLastTexture();
} else {
- texFrame=mPlayer.getNextTexture(gl, true);
+ texFrame=mPlayer.getNextTexture(gl);
}
if(null != texFrame) {
tex = texFrame.getTexture();
@@ -500,12 +678,11 @@ public class MovieSimple implements GLEventListener, GLMediaEventListener {
st.useProgram(gl, false);
}
- public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
- }
-
- public static void main(String[] args) throws IOException, MalformedURLException {
+ public static void main(String[] args) throws IOException, URISyntaxException {
+ int swapInterval = 1;
int width = 640;
int height = 600;
+ int textureCount = 3; // default - threaded
boolean ortho = true;
boolean zoom = false;
@@ -513,38 +690,72 @@ public class MovieSimple implements GLEventListener, GLMediaEventListener {
boolean forceES3 = false;
boolean forceGL3 = false;
boolean forceGLDef = false;
+ int vid = GLMediaPlayer.STREAM_ID_AUTO;
+ int aid = GLMediaPlayer.STREAM_ID_AUTO;
+ final boolean origSize;
- String url_s="http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4";
- for(int i=0; i<args.length; i++) {
- if(args[i].equals("-width")) {
- i++;
- width = MiscUtils.atoi(args[i], width);
- } else if(args[i].equals("-height")) {
- i++;
- height = MiscUtils.atoi(args[i], height);
- } 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("-gldef")) {
- forceGLDef = true;
- } else if(args[i].equals("-projection")) {
- ortho=false;
- } else if(args[i].equals("-zoom")) {
- zoom=true;
- } else if(args[i].equals("-url")) {
- i++;
- url_s = args[i];
+ String url_s=null;
+ {
+ boolean _origSize = false;
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-vid")) {
+ i++;
+ vid = MiscUtils.atoi(args[i], vid);
+ } else if(args[i].equals("-aid")) {
+ i++;
+ aid = MiscUtils.atoi(args[i], aid);
+ } else if(args[i].equals("-width")) {
+ i++;
+ width = MiscUtils.atoi(args[i], width);
+ } else if(args[i].equals("-height")) {
+ i++;
+ height = MiscUtils.atoi(args[i], height);
+ } else if(args[i].equals("-osize")) {
+ _origSize = true;
+ } else if(args[i].equals("-textureCount")) {
+ i++;
+ textureCount = MiscUtils.atoi(args[i], textureCount);
+ } 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("-gldef")) {
+ forceGLDef = true;
+ } else if(args[i].equals("-vsync")) {
+ i++;
+ swapInterval = MiscUtils.atoi(args[i], swapInterval);
+ } else if(args[i].equals("-projection")) {
+ ortho=false;
+ } else if(args[i].equals("-zoom")) {
+ zoom=true;
+ } else if(args[i].equals("-url")) {
+ i++;
+ url_s = args[i];
+ } else if(args[i].equals("-wait")) {
+ waitForKey = true;
+ }
}
+ origSize = _origSize;
}
+ final URI streamLoc;
+ if( null == url_s ) {
+ streamLoc = defURI;
+ } else {
+ streamLoc = new URI(url_s);
+ }
+ System.err.println("stream "+streamLoc);
+ System.err.println("vid "+vid+", aid "+aid);
+ System.err.println("textureCount "+textureCount);
System.err.println("forceES2 "+forceES2);
System.err.println("forceES3 "+forceES3);
System.err.println("forceGL3 "+forceGL3);
System.err.println("forceGLDef "+forceGLDef);
+ System.err.println("swapInterval "+swapInterval);
- final MovieSimple ms = new MovieSimple(new URL(url_s).openConnection());
+ final MovieSimple ms = new MovieSimple(null);
+ ms.setSwapInterval(swapInterval);
ms.setScaleOrig(!zoom);
ms.setOrthoProjection(ortho);
@@ -563,19 +774,67 @@ public class MovieSimple implements GLEventListener, GLMediaEventListener {
}
System.err.println("GLProfile: "+glp);
GLCapabilities caps = new GLCapabilities(glp);
- GLWindow window = GLWindow.create(caps);
-
- window.addGLEventListener(ms);
-
- window.setSize(width, height);
- window.setVisible(true);
+ final GLWindow window = GLWindow.create(caps);
final Animator anim = new Animator(window);
- anim.start();
window.addWindowListener(new WindowAdapter() {
public void windowDestroyed(WindowEvent e) {
anim.stop();
}
});
+ window.setSize(width, height);
+ window.setVisible(true);
+ anim.start();
+
+ ms.mPlayer.addEventListener(new GLMediaEventListener() {
+ void destroyWindow() {
+ new Thread() {
+ public void run() {
+ window.destroy();
+ } }.start();
+ }
+
+ @Override
+ public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) {
+ }
+
+ @Override
+ public void attributesChanged(final GLMediaPlayer mp, int event_mask, long when) {
+ System.err.println("MovieSimple AttributesChanges: events_mask 0x"+Integer.toHexString(event_mask)+", when "+when);
+ System.err.println("MovieSimple State: "+mp);
+ if( 0 != ( GLMediaEventListener.EVENT_CHANGE_SIZE & event_mask ) ) {
+ if( origSize ) {
+ window.setSize(mp.getWidth(), mp.getHeight());
+ }
+ // window.disposeGLEventListener(ms, false /* remove */ );
+ ms.resetGLState();
+ }
+ if( 0 != ( GLMediaEventListener.EVENT_CHANGE_INIT & event_mask ) ) {
+ if( GLMediaPlayer.STREAM_ID_NONE != ms.mPlayer.getVID() ) {
+ window.addGLEventListener(ms);
+ anim.setUpdateFPSFrames(60, System.err);
+ anim.resetFPSCounter();
+ } else {
+ try {
+ ms.mPlayer.initGL(null);
+ } catch (Exception e) {
+ e.printStackTrace();
+ destroyWindow();
+ return;
+ }
+ ms.mPlayer.play();
+ System.out.println("play.1 "+ms.mPlayer);
+ }
+ }
+ if( 0 != ( ( GLMediaEventListener.EVENT_CHANGE_ERR | GLMediaEventListener.EVENT_CHANGE_EOS ) & event_mask ) ) {
+ final StreamException se = ms.mPlayer.getStreamException();
+ if( null != se ) {
+ se.printStackTrace();
+ }
+ destroyWindow();
+ }
+ }
+ });
+ ms.initStream(streamLoc, vid, aid, textureCount);
} catch (Throwable t) {
t.printStackTrace();
}
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
new file mode 100644
index 0000000..4cecd90
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas01.java
@@ -0,0 +1,134 @@
+/**
+ * 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.
+ */
+package com.jogamp.opengl.test.junit.jogl.demos.es2.awt;
+
+import java.applet.Applet;
+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 javax.swing.JFrame;
+import javax.swing.JPanel;
+
+/**
+ * Bug 816: OSX CALayer Positioning Bug.
+ * <p>
+ * Diff. OSX CALayer positioning w/ java6, [7uxx..7u40[, and >= 7u40
+ * </p>
+ * <p>
+ * Test simply positions a GLCanvas via setBounds(..) within it's Applet.
+ * </p>
+ */
+ at SuppressWarnings("serial")
+public class Bug816AppletGLCanvas01 extends Applet implements GLEventListener {
+
+ public Bug816AppletGLCanvas01() {
+ }
+
+ public static JFrame frame;
+ public static JPanel appletHolder;
+ public static boolean isApplet = true;
+
+ static public void main(String args[]) {
+ Applet myApplet = null;
+ isApplet = false;
+
+ myApplet = new Bug816AppletGLCanvas01();
+ appletStarter(myApplet, "Bug861AppletGLCanvasTest01", 800, 600);
+ }
+
+ static public void appletStarter(final Applet des, String frameName, int width, int height) {
+ appletHolder = new JPanel();
+ if (frame != null) {
+ frame.dispose();
+ frame = null;
+ }
+ frame = new JFrame(frameName);
+ frame.setVisible(false);
+ frame.getContentPane().add(appletHolder);
+
+ appletHolder.setLayout(null);
+ des.setBounds(0, 0, width, height);
+ appletHolder.add(des);
+
+ frame.setVisible(true);
+ int frameBorderSize = appletHolder.getLocationOnScreen().x - frame.getLocationOnScreen().x;
+ int titleBarHeight = appletHolder.getLocationOnScreen().y - frame.getLocationOnScreen().y;
+ int frameWidth = width + 2 * frameBorderSize;
+ int frameHeight = height + titleBarHeight + frameBorderSize;
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.setSize(frameWidth, frameHeight);
+ frame.setVisible(true);
+ des.init();
+ frame.addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {
+ System.exit(0);
+ }
+ });
+ }
+
+ public void init() {
+ initOpenGLAWT();
+ }
+
+ public void initOpenGLAWT() {
+ setBackground(Color.gray);
+ setLayout(null);
+
+ GLProfile glp = GLProfile.getDefault();
+ GLCapabilities caps = new GLCapabilities(glp);
+ GLCanvas canvas = new GLCanvas((GLCapabilitiesImmutable) caps);
+ canvas.setBounds(50, 50, 200, 450);
+ canvas.addGLEventListener(this);
+ add(canvas);
+ }
+
+ public void init(GLAutoDrawable gLAutoDrawable) {
+ GL gl = gLAutoDrawable.getGL();
+ gl.glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT);
+ gLAutoDrawable.swapBuffers();
+ }
+
+ public void dispose(GLAutoDrawable glad) {
+ }
+
+ public void display(GLAutoDrawable glad) {
+ }
+
+ public void reshape(GLAutoDrawable glad, int i, int i1, int i2, int i3) {
+ }
+
+}
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
new file mode 100644
index 0000000..3bbb423
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas02a.java
@@ -0,0 +1,89 @@
+/**
+ * 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.
+ */
+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 javax.swing.BoxLayout;
+
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.util.Animator;
+
+/**
+ * Bug 816: OSX CALayer Positioning Bug.
+ * <p>
+ * Diff. OSX CALayer positioning w/ java6, [7uxx..7u40[, and >= 7u40
+ * </p>
+ * <p>
+ * Test uses a box layout within the Applet.
+ * </p>
+ */
+ at SuppressWarnings("serial")
+public class Bug816AppletGLCanvas02a extends Applet {
+ GLAnimatorControl animator;
+ boolean added = false;
+
+ @Override
+ public void init() {
+ System.err.println("GearsApplet: init() - begin [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ animator = new Animator();
+ new BoxLayout(this, BoxLayout.X_AXIS);
+ setSize(664, 364);
+ add(createCanvas());
+ add(createCanvas());
+ System.err.println("GearsApplet: init() - end [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ }
+
+ private GLCanvas createCanvas() {
+ GLCanvas canvas = new GLCanvas();
+ canvas.addGLEventListener(new GearsES2(1));
+ canvas.setSize(300, 300);
+ animator.add(canvas);
+ return canvas;
+ }
+
+ String currentThreadName() {
+ return Thread.currentThread().getName();
+ }
+
+ @Override
+ public void start() {
+ System.err.println("GearsApplet: start() - begin [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ animator.start();
+ animator.setUpdateFPSFrames(60, System.err);
+ System.err.println("GearsApplet: start() - end [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ }
+
+ @Override
+ public void stop() {
+ System.err.println("GearsApplet: stop() - [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ animator.stop();
+ }
+}
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
new file mode 100644
index 0000000..87a7ea4
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas02b.java
@@ -0,0 +1,89 @@
+/**
+ * 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.
+ */
+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.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.util.Animator;
+
+/**
+ * Bug 816: OSX CALayer Positioning Bug.
+ * <p>
+ * Diff. OSX CALayer positioning w/ java6, [7uxx..7u40[, and >= 7u40
+ * </p>
+ * <p>
+ * Test uses a grid layout within the Applet.
+ * </p>
+ */
+ at SuppressWarnings("serial")
+public class Bug816AppletGLCanvas02b extends Applet {
+ GLAnimatorControl animator;
+ boolean added = false;
+
+ @Override
+ public void init() {
+ System.err.println("GearsApplet: init() - begin [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ animator = new Animator();
+ this.setLayout(new GridLayout(1, 2));
+ setSize(664, 364);
+ add(createCanvas());
+ add(createCanvas());
+ System.err.println("GearsApplet: init() - end [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ }
+
+ private GLCanvas createCanvas() {
+ GLCanvas canvas = new GLCanvas();
+ canvas.addGLEventListener(new GearsES2(1));
+ canvas.setSize(300, 300);
+ animator.add(canvas);
+ return canvas;
+ }
+
+ String currentThreadName() {
+ return Thread.currentThread().getName();
+ }
+
+ @Override
+ public void start() {
+ System.err.println("GearsApplet: start() - begin [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ animator.start();
+ animator.setUpdateFPSFrames(60, System.err);
+ System.err.println("GearsApplet: start() - end [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ }
+
+ @Override
+ public void stop() {
+ System.err.println("GearsApplet: stop() - [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ animator.stop();
+ }
+}
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
new file mode 100644
index 0000000..a0ce938
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletOSXCALayerPos03a.java
@@ -0,0 +1,102 @@
+/**
+ * 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.
+ */
+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 javax.swing.JRootPane;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.util.Animator;
+
+/**
+ * Bug 816: OSX CALayer Positioning Bug - AWT Applet w/ 1 JRootPane and 2 JSplitPanes
+ * <p>
+ * Diff. OSX CALayer positioning w/ java6, [7uxx..7u40[, and >= 7u40
+ * </p>
+ * <p>
+ * See also {@link com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos02AWT}
+ * </p>
+ * Bug persists in browser (Firefox, Safari) and not in appletviewer!
+ */
+ at SuppressWarnings("serial")
+public class Bug816AppletOSXCALayerPos03a extends Applet {
+ GLAnimatorControl animator;
+ boolean added = false;
+
+ @Override
+ public void init() {
+ System.err.println("GearsApplet: init() - begin [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ GLProfile glp = GLProfile.getDefault();
+ final GLCapabilities caps = new GLCapabilities(glp);
+ final GLCanvas glCanvas1 = new GLCanvas(caps);
+ glCanvas1.addGLEventListener(new GearsES2(1));
+
+ animator = new Animator();
+ animator.add(glCanvas1);
+ setLayout(new BorderLayout());
+
+ // Build a GUI where the canvas 3D is located at top right of the frame
+ // and can be resized with split panes dividers
+ JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
+ true, new JScrollPane(), glCanvas1);
+ verticalSplitPane.setResizeWeight(0.5);
+ JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
+ true, new JScrollPane(), verticalSplitPane);
+ horizontalSplitPane.setResizeWeight(0.5);
+ JRootPane intermediateRootPane = new JRootPane();
+ intermediateRootPane.setContentPane(horizontalSplitPane);
+ add(intermediateRootPane, BorderLayout.CENTER);
+ System.err.println("GearsApplet: init() - end [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ }
+
+ String currentThreadName() {
+ return Thread.currentThread().getName();
+ }
+
+ @Override
+ public void start() {
+ System.err.println("GearsApplet: start() - begin [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ animator.start();
+ animator.setUpdateFPSFrames(60, System.err);
+ System.err.println("GearsApplet: start() - end [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ }
+
+ @Override
+ public void stop() {
+ System.err.println("GearsApplet: stop() - [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ animator.stop();
+ }
+}
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
new file mode 100644
index 0000000..48dac25
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletOSXCALayerPos03b.java
@@ -0,0 +1,101 @@
+/**
+ * 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.
+ */
+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 javax.swing.JApplet;
+import javax.swing.JRootPane;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.util.Animator;
+
+/**
+ * Bug 816: OSX CALayer Positioning Bug - Swing JApplet w/ 2 JRootPanes and 2 JSplitPanes
+ * <p>
+ * Diff. OSX CALayer positioning w/ java6, [7uxx..7u40[, and >= 7u40
+ * </p>
+ * <p>
+ * See also {@link com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos02AWT}
+ * </p>
+ * Bug persists in browser (Firefox, Safari) and not in appletviewer!
+ */
+ at SuppressWarnings("serial")
+public class Bug816AppletOSXCALayerPos03b extends JApplet {
+ GLAnimatorControl animator;
+ boolean added = false;
+
+ @Override
+ public void init() {
+ System.err.println("GearsApplet: init() - begin [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ GLProfile glp = GLProfile.getDefault();
+ final GLCapabilities caps = new GLCapabilities(glp);
+ final GLCanvas glCanvas1 = new GLCanvas(caps);
+ glCanvas1.addGLEventListener(new GearsES2(1));
+
+ animator = new Animator();
+ animator.add(glCanvas1);
+ setSize(640, 480);
+
+ // Build a GUI where the canvas 3D is located at top right of the frame
+ // and can be resized with split panes dividers
+ JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
+ true, new JScrollPane(), glCanvas1);
+ verticalSplitPane.setResizeWeight(0.5);
+ JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
+ true, new JScrollPane(), verticalSplitPane);
+ horizontalSplitPane.setResizeWeight(0.5);
+ JRootPane intermediateRootPane = new JRootPane();
+ intermediateRootPane.setContentPane(horizontalSplitPane);
+ intermediateRootPane.setSize(640, 480);
+ this.add(intermediateRootPane);
+ System.err.println("GearsApplet: init() - end [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ }
+
+ String currentThreadName() {
+ return Thread.currentThread().getName();
+ }
+
+ @Override
+ public void start() {
+ System.err.println("GearsApplet: start() - begin [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ animator.start();
+ animator.setUpdateFPSFrames(60, System.err);
+ System.err.println("GearsApplet: start() - end [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ }
+
+ @Override
+ public void stop() {
+ System.err.println("GearsApplet: stop() - [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ animator.stop();
+ }
+}
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
new file mode 100644
index 0000000..89e31cf
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug848AppletGLCanvas01.java
@@ -0,0 +1,94 @@
+/**
+ * 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.
+ */
+package com.jogamp.opengl.test.junit.jogl.demos.es2.awt;
+
+import java.applet.Applet;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.media.opengl.GLAnimatorControl;
+import javax.media.opengl.awt.GLCanvas;
+import javax.swing.BoxLayout;
+
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.util.Animator;
+
+/**
+ * Bug 848: Applet on OSX w/ CALayer and 2 or more GLCanvas may 'crash'.
+ * <p>
+ * Test uses 2x3 GLCanvas in a box layout within the Applet.
+ * </p>
+ */
+ at SuppressWarnings("serial")
+public class Bug848AppletGLCanvas01 extends Applet {
+ private List<GLAnimatorControl> animators = new ArrayList<GLAnimatorControl>(2);
+
+ @Override
+ public void init() {
+ System.err.println("GearsApplet: init() - begin [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ new BoxLayout(this, BoxLayout.X_AXIS);
+ setSize(1024, 664);
+ add(createCanvas());
+ add(createCanvas());
+ add(createCanvas());
+ add(createCanvas());
+ add(createCanvas());
+ add(createCanvas());
+ System.err.println("GearsApplet: init() - end [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ }
+
+ private GLCanvas createCanvas() {
+ GLCanvas canvas = new GLCanvas();
+ canvas.addGLEventListener(new GearsES2(1));
+ canvas.setSize(300, 300);
+ animators.add(new Animator(canvas));
+ return canvas;
+ }
+
+ String currentThreadName() {
+ return Thread.currentThread().getName();
+ }
+
+ @Override
+ public void start() {
+ System.err.println("GearsApplet: start() - begin [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ for (GLAnimatorControl control : animators) {
+ control.start();
+ control.setUpdateFPSFrames(60, System.err);
+ }
+ System.err.println("GearsApplet: start() - end [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ }
+
+ @Override
+ public void stop() {
+ System.err.println("GearsApplet: stop() - [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName());
+ for (GLAnimatorControl control : animators) {
+ control.stop();
+ }
+ }
+}
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 d47017f..58600da 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
@@ -63,7 +63,10 @@ import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGearsES2AWT extends UITestCase {
public enum FrameLayout { None, TextOnBottom, BorderCenterSurrounded, DoubleBorderCenterSurrounded };
public enum ResizeBy { Component, Frame };
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 e3be7b8..3a9cf8f 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
@@ -44,6 +44,8 @@ import org.junit.Assert;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.event.TraceKeyAdapter;
import com.jogamp.newt.event.TraceWindowAdapter;
@@ -56,6 +58,7 @@ import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.FPSAnimator;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGearsES2GLJPanelAWT extends UITestCase {
static Dimension wsize, rwsize=null;
static boolean forceES2 = false;
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 4668603..e48fc78 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
@@ -53,6 +53,8 @@ import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.nio.Buffers;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
@@ -63,6 +65,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.FPSAnimator;
import com.jogamp.opengl.util.awt.AWTGLPixelBuffer.SingleAWTGLPixelBufferProvider;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGearsES2GLJPanelsAWT extends UITestCase {
static int demoCount = 4;
static boolean jOpaque = false; // flicker-less w/o opaque, opaque leads to overdraw w/ mixed clipRects -> flicker - due to JComponent _paintImmediately(..) (?)
@@ -95,7 +98,7 @@ public class TestGearsES2GLJPanelsAWT extends UITestCase {
}
if( initSingleBuffer ) {
- singleAWTGLPixelBufferProvider = new SingleAWTGLPixelBufferProvider( glp.isGL2GL3() /* allowRowStride */);
+ singleAWTGLPixelBufferProvider = new SingleAWTGLPixelBufferProvider( glp.isGL2ES3() /* allowRowStride */);
singleAWTGLPixelBufferProvider.initSingleton(4, 600, 600, 1, true);
} 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 25e6f5c..6c48853 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
@@ -45,11 +45,14 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* @see com.jogamp.opengl.test.junit.jogl.demos.es2.ElektronenMultiplizierer
* @author Dominik Ströhlein (DemoscenePassivist), et.al.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestElektronenMultipliziererNEWT extends UITestCase {
static final int width = 640, height = 480;
@@ -67,8 +70,8 @@ public class TestElektronenMultipliziererNEWT extends UITestCase {
@BeforeClass
public static void initClass() {
GLProfile glp = GLProfile.getDefault();
- if( ! ( glp.isHardwareRasterizer() && glp.isGL2GL3() ) ) {
- // Sorry .. mobile is too slow for this one.
+ if( ! ( glp.isHardwareRasterizer() && glp.isGL2ES3() ) ) {
+ // Sorry .. mobile ES2 is too slow for this one.
setTestSupported(false);
return;
}
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 1a049c7..b54a2cd 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.demos.es2.newt;
import java.io.IOException;
@@ -49,6 +49,7 @@ import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import javax.media.nativewindow.NativeWindowFactory;
import javax.media.nativewindow.util.Dimension;
import javax.media.nativewindow.util.Point;
import javax.media.nativewindow.util.PointImmutable;
@@ -65,8 +66,11 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
-public class TestGearsES2NEWT extends UITestCase {
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestGearsES2NEWT extends UITestCase {
static int screenIdx = 0;
static PointImmutable wpos;
static DimensionImmutable wsize, rwsize=null;
@@ -88,12 +92,13 @@ public class TestGearsES2NEWT extends UITestCase {
static boolean forceES2 = false;
static boolean forceES3 = false;
static boolean forceGL3 = false;
+ static boolean forceGL2 = false;
static boolean mainRun = false;
static boolean exclusiveContext = false;
static boolean useAnimator = true;
static enum SysExit { none, testExit, testError, displayExit, displayError };
static SysExit sysExit = SysExit.none;
-
+
@BeforeClass
public static void initClass() {
if(null == wsize) {
@@ -125,7 +130,7 @@ public class TestGearsES2NEWT extends UITestCase {
final GearsES2 demo = new GearsES2(swapInterval);
demo.setPMVUseBackingArray(pmvUseBackingArray);
glWindow.addGLEventListener(demo);
-
+
final SnapshotGLEventListener snap = new SnapshotGLEventListener();
glWindow.addGLEventListener(snap);
if(waitForKey) {
@@ -150,7 +155,7 @@ public class TestGearsES2NEWT extends UITestCase {
animator.setModeBits(false, Animator.MODE_EXPECT_AWT_RENDERING_THREAD);
animator.setExclusiveContext(exclusiveContext);
}
-
+
QuitAdapter quitAdapter = new QuitAdapter();
//glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
//glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter));
@@ -163,9 +168,9 @@ public class TestGearsES2NEWT extends UITestCase {
}
public void windowMoved(WindowEvent e) {
System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight());
- }
+ }
});
-
+
glWindow.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(final KeyEvent e) {
@@ -262,8 +267,10 @@ public class TestGearsES2NEWT extends UITestCase {
});
glWindow.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
- glWindow.setFullscreen(!glWindow.isFullscreen());
- System.err.println("setFullscreen: "+glWindow.isFullscreen());
+ if(e.getClickCount() == 2 && e.getPointerCount() == 1) {
+ glWindow.setFullscreen(!glWindow.isFullscreen());
+ System.err.println("setFullscreen: "+glWindow.isFullscreen());
+ }
}
});
@@ -293,7 +300,7 @@ public class TestGearsES2NEWT extends UITestCase {
throw new Error("test error send from GLEventListener");
} else if ( SysExit.displayExit == sysExit ) {
System.err.println("exit(0) send from GLEventListener");
- System.exit(0);
+ System.exit(0);
}
}
} else {
@@ -301,29 +308,29 @@ public class TestGearsES2NEWT extends UITestCase {
}
}
@Override
- public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { }
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { }
});
}
-
+
glWindow.setVisible(true);
if( useAnimator ) {
animator.setUpdateFPSFrames(60, showFPS ? System.err : null);
}
-
+
System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities());
System.err.println("GL chosen: "+glWindow.getChosenCapabilities());
System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets());
-
+
snap.setMakeSnapshot();
if( null != rwsize ) {
- Thread.sleep(500); // 500ms delay
+ Thread.sleep(500); // 500ms delay
glWindow.setSize(rwsize.getWidth(), rwsize.getHeight());
System.err.println("window resize pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets());
}
-
+
snap.setMakeSnapshot();
-
+
final long t0 = System.currentTimeMillis();
long t1 = t0;
while(!quitAdapter.shouldQuit() && t1-t0<duration) {
@@ -335,7 +342,7 @@ public class TestGearsES2NEWT extends UITestCase {
throw new Error("test error send from test thread");
} else if ( SysExit.testExit == sysExit ) {
System.err.println("exit(0) send from test thread");
- System.exit(0);
+ System.exit(0);
}
}
}
@@ -349,7 +356,9 @@ public class TestGearsES2NEWT extends UITestCase {
}
Assert.assertEquals(null, glWindow.getExclusiveContextThread());
glWindow.destroy();
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
+ if( NativeWindowFactory.isAWTAvailable() ) {
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
+ }
}
@Test
@@ -363,13 +372,15 @@ public class TestGearsES2NEWT extends UITestCase {
glp = GLProfile.get(GLProfile.GLES3);
} else if(forceES2) {
glp = GLProfile.get(GLProfile.GLES2);
+ } else if(forceGL2) {
+ glp = GLProfile.get(GLProfile.GL2);
} else {
glp = GLProfile.getGL2ES2();
}
final GLCapabilities caps = new GLCapabilities( glp );
caps.setBackgroundOpaque(opaque);
if(-1 < forceAlpha) {
- caps.setAlphaBits(forceAlpha);
+ caps.setAlphaBits(forceAlpha);
}
runTestGL(caps, undecorated);
if(loop_shutdown) {
@@ -381,7 +392,7 @@ public class TestGearsES2NEWT extends UITestCase {
@Test
public void test02_GLES2() throws InterruptedException {
if(mainRun) return;
-
+
if( !GLProfile.isAvailable(GLProfile.GLES2) ) {
System.err.println("GLES2 n/a");
return;
@@ -390,11 +401,11 @@ public class TestGearsES2NEWT extends UITestCase {
final GLCapabilities caps = new GLCapabilities( glp );
runTestGL(caps, undecorated);
}
-
+
@Test
public void test03_GL3() throws InterruptedException {
if(mainRun) return;
-
+
if( !GLProfile.isAvailable(GLProfile.GL3) ) {
System.err.println("GL3 n/a");
return;
@@ -403,13 +414,13 @@ public class TestGearsES2NEWT extends UITestCase {
final GLCapabilities caps = new GLCapabilities( glp );
runTestGL(caps, undecorated);
}
-
+
public static void main(String args[]) throws IOException {
mainRun = true;
-
+
int x=0, y=0, w=640, h=480, rw=-1, rh=-1;
boolean usePos = false;
-
+
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
i++;
@@ -440,6 +451,8 @@ public class TestGearsES2NEWT extends UITestCase {
forceES3 = true;
} else if(args[i].equals("-gl3")) {
forceGL3 = true;
+ } else if(args[i].equals("-gl2")) {
+ forceGL2 = true;
} else if(args[i].equals("-wait")) {
waitForKey = true;
} else if(args[i].equals("-mouseInvisible")) {
@@ -485,7 +498,7 @@ public class TestGearsES2NEWT extends UITestCase {
if( 0 < rw && 0 < rh ) {
rwsize = new Dimension(rw, rh);
}
-
+
if(usePos) {
wpos = new Point(x, y);
}
@@ -494,11 +507,11 @@ public class TestGearsES2NEWT extends UITestCase {
System.err.println("resize "+rwsize);
System.err.println("screen "+screenIdx);
System.err.println("translucent "+(!opaque));
- System.err.println("forceAlpha "+forceAlpha);
+ System.err.println("forceAlpha "+forceAlpha);
System.err.println("undecorated "+undecorated);
System.err.println("atop "+alwaysOnTop);
System.err.println("fullscreen "+fullscreen);
- System.err.println("pmvDirect "+(!pmvUseBackingArray));
+ System.err.println("pmvDirect "+(!pmvUseBackingArray));
System.err.println("mouseVisible "+mouseVisible);
System.err.println("mouseConfined "+mouseConfined);
System.err.println("loops "+loops);
@@ -506,10 +519,11 @@ public class TestGearsES2NEWT extends UITestCase {
System.err.println("forceES2 "+forceES2);
System.err.println("forceES3 "+forceES3);
System.err.println("forceGL3 "+forceGL3);
+ System.err.println("forceGL2 "+forceGL2);
System.err.println("swapInterval "+swapInterval);
System.err.println("exclusiveContext "+exclusiveContext);
System.err.println("useAnimator "+useAnimator);
- System.err.println("sysExitWithin "+sysExit);
+ System.err.println("sysExitWithin "+sysExit);
if(waitForKey) {
UITestCase.waitForKey("Start");
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 f12f02c..5d091bb 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
@@ -42,8 +42,6 @@ import com.jogamp.newt.Display;
import com.jogamp.newt.NewtFactory;
import com.jogamp.newt.Screen;
import com.jogamp.newt.awt.NewtCanvasAWT;
-import com.jogamp.newt.event.KeyAdapter;
-import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.opengl.GLWindow;
@@ -51,17 +49,14 @@ import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
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 com.jogamp.opengl.test.junit.newt.parenting.NewtAWTReparentingKeyAdapter;
import javax.media.nativewindow.util.Dimension;
-import javax.media.nativewindow.util.InsetsImmutable;
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;
@@ -72,7 +67,10 @@ import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGearsES2NewtCanvasAWT extends UITestCase {
public enum FrameLayout { None, TextOnBottom, BorderBottom, BorderBottom2, BorderCenter, BorderCenterSurrounded, DoubleBorderCenterSurrounded };
public enum ResizeBy { GLWindow, Component, Frame };
@@ -268,50 +266,8 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase {
}
});
- glWindow.addKeyListener(new KeyAdapter() {
- public void keyReleased(KeyEvent e) {
- if( !e.isPrintableKey() || e.isAutoRepeat() ) {
- return;
- }
- if(e.getKeyChar()=='f') {
- quitAdapter.enable(false);
- new Thread() {
- public void run() {
- final Thread t = glWindow.setExclusiveContextThread(null);
- System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
- glWindow.setFullscreen(!glWindow.isFullscreen());
- System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
- glWindow.setExclusiveContextThread(t);
- quitAdapter.clear();
- quitAdapter.enable(true);
- } }.start();
- } else if(e.getKeyChar()=='r') {
- quitAdapter.enable(false);
- if(glWindow.getParent()==null) {
- System.err.println("XXX glWin to home");
- glWindow.reparentWindow(newtCanvasAWT.getNativeWindow());
- } else {
- final InsetsImmutable nInsets = glWindow.getInsets();
- java.awt.Insets aInsets = frame.getInsets();
- System.err.println("XXX glWin to TOP - insets " + nInsets + ", " + aInsets);
- glWindow.reparentWindow(null);
- int dx, dy;
- if(nInsets.getTotalHeight()==0) {
- dx = aInsets.left;
- dy = aInsets.top;
- } else {
- dx = nInsets.getLeftWidth();
- dy = nInsets.getTopHeight();
- }
- glWindow.setPosition(frame.getX()+frame.getWidth()+dx, frame.getY()+dy);
- }
- glWindow.requestFocus();
- quitAdapter.clear();
- quitAdapter.enable(true);
- }
- }
- });
-
+ glWindow.addKeyListener(new NewtAWTReparentingKeyAdapter(frame, newtCanvasAWT, glWindow, quitAdapter));
+
if( useAnimator ) {
animator.add(glWindow);
animator.start();
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 7a93faa..9b2db6b 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
@@ -69,7 +69,10 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGearsES2NewtCanvasSWT extends UITestCase {
static int screenIdx = 0;
static PointImmutable wpos;
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 281ee54..50a5de1 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
@@ -43,7 +43,10 @@ import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestLandscapeES2NEWT extends UITestCase {
static int width = 500, height = 290;
static int swapInterval = 1;
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 72357dc..adc2b23 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
@@ -36,30 +36,28 @@ import com.jogamp.newt.Display;
import com.jogamp.newt.NewtFactory;
import com.jogamp.newt.Screen;
import com.jogamp.newt.awt.NewtCanvasAWT;
-import com.jogamp.newt.event.KeyAdapter;
-import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
-
import com.jogamp.opengl.util.Animator;
-
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.InsetsImmutable;
import javax.media.nativewindow.util.DimensionImmutable;
-
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLCapabilitiesImmutable;
import javax.media.opengl.GLProfile;
import javax.swing.SwingUtilities;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestLandscapeES2NewtCanvasAWT extends UITestCase {
static DimensionImmutable wsize = new Dimension(500, 290);
@@ -116,50 +114,8 @@ public class TestLandscapeES2NewtCanvasAWT extends UITestCase {
}
});
- glWindow.addKeyListener(new KeyAdapter() {
- public void keyReleased(KeyEvent e) {
- if( !e.isPrintableKey() || e.isAutoRepeat() ) {
- return;
- }
- if(e.getKeyChar()=='f') {
- quitAdapter.enable(false);
- new Thread() {
- public void run() {
- final Thread t = glWindow.setExclusiveContextThread(null);
- System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
- glWindow.setFullscreen(!glWindow.isFullscreen());
- System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
- glWindow.setExclusiveContextThread(t);
- quitAdapter.clear();
- quitAdapter.enable(true);
- } }.start();
- } else if(e.getKeyChar()=='r') {
- quitAdapter.enable(false);
- if(glWindow.getParent()==null) {
- System.err.println("XXX glWin to home");
- glWindow.reparentWindow(newtCanvasAWT.getNativeWindow());
- } else {
- final InsetsImmutable nInsets = glWindow.getInsets();
- java.awt.Insets aInsets = frame.getInsets();
- System.err.println("XXX glWin to TOP - insets " + nInsets + ", " + aInsets);
- glWindow.reparentWindow(null);
- int dx, dy;
- if(nInsets.getTotalHeight()==0) {
- dx = aInsets.left;
- dy = aInsets.top;
- } else {
- dx = nInsets.getLeftWidth();
- dy = nInsets.getTopHeight();
- }
- glWindow.setPosition(frame.getX()+frame.getWidth()+dx, frame.getY()+dy);
- }
- glWindow.requestFocus();
- quitAdapter.clear();
- quitAdapter.enable(true);
- }
- }
- });
-
+ glWindow.addKeyListener(new NewtAWTReparentingKeyAdapter(frame, newtCanvasAWT, glWindow, quitAdapter));
+
if( useAnimator ) {
animator.add(glWindow);
animator.start();
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 b880c2f..69879dd 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
@@ -35,12 +35,12 @@ import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
-import com.jogamp.opengl.test.junit.util.UITestCase.SnapshotGLEventListener;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
+import javax.media.nativewindow.NativeWindowFactory;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;
@@ -48,7 +48,10 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestRedSquareES2NEWT extends UITestCase {
static int width, height;
static int loops = 1;
@@ -130,7 +133,9 @@ public class TestRedSquareES2NEWT extends UITestCase {
Assert.assertFalse(animator.isAnimating());
Assert.assertFalse(animator.isStarted());
glWindow.destroy();
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
+ if( NativeWindowFactory.isAWTAvailable() ) {
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
+ }
}
@Test
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 008349d..b6463ac 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.demos.es2.swt;
import java.io.IOException;
@@ -61,8 +61,11 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
-public class TestGearsES2SWT extends UITestCase {
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestGearsES2SWT extends UITestCase {
static int screenIdx = 0;
static PointImmutable wpos;
static DimensionImmutable wsize, rwsize=null;
@@ -80,7 +83,7 @@ public class TestGearsES2SWT extends UITestCase {
static boolean forceGL3 = false;
static boolean mainRun = false;
static boolean exclusiveContext = false;
-
+
@BeforeClass
public static void initClass() {
if(null == wsize) {
@@ -95,16 +98,16 @@ public class TestGearsES2SWT extends UITestCase {
Display display = null;
Shell shell = null;
Composite composite = null;
-
+
@Before
public void init() {
SWTAccessor.invoke(true, new Runnable() {
- public void run() {
+ public void run() {
display = new Display();
Assert.assertNotNull( display );
}});
display.syncExec(new Runnable() {
- public void run() {
+ public void run() {
shell = new Shell( display );
Assert.assertNotNull( shell );
shell.setLayout( new FillLayout() );
@@ -138,21 +141,21 @@ public class TestGearsES2SWT extends UITestCase {
shell = null;
composite = null;
}
-
+
protected void runTestGL(GLCapabilitiesImmutable caps) throws InterruptedException, InvocationTargetException {
System.err.println("requested: vsync "+swapInterval+", "+caps);
-
- final GLCanvas canvas = GLCanvas.create( composite, 0, caps, null, null);
+
+ final GLCanvas canvas = GLCanvas.create( composite, 0, caps, null);
Assert.assertNotNull( canvas );
-
+
final GearsES2 demo = new GearsES2(swapInterval);
demo.setPMVUseBackingArray(pmvUseBackingArray);
canvas.addGLEventListener(demo);
-
+
Animator animator = new Animator();
animator.setModeBits(false, Animator.MODE_EXPECT_AWT_RENDERING_THREAD);
animator.setExclusiveContext(exclusiveContext);
-
+
animator.add(canvas);
animator.start();
Assert.assertTrue(animator.isStarted());
@@ -169,9 +172,9 @@ public class TestGearsES2SWT extends UITestCase {
shell.open();
}
});
-
+
animator.setUpdateFPSFrames(60, showFPS ? System.err : null);
-
+
while(animator.isAnimating() && !canvas.isRealized() && animator.getTotalFPSDuration()<duration) {
if( !display.readAndDispatch() ) {
// blocks on linux .. display.sleep();
@@ -181,7 +184,7 @@ public class TestGearsES2SWT extends UITestCase {
System.err.println("NW chosen: "+canvas.getDelegatedDrawable().getChosenGLCapabilities());
System.err.println("GL chosen: "+canvas.getChosenGLCapabilities());
System.err.println("window pos/siz: "+canvas.getLocation()+" "+canvas.getWidth()+"x"+canvas.getHeight());
-
+
if( null != rwsize ) {
for(int i=0; i<50; i++) { // 500 ms dispatched delay
if( !display.readAndDispatch() ) {
@@ -196,7 +199,7 @@ public class TestGearsES2SWT extends UITestCase {
});
System.err.println("window resize pos/siz: "+canvas.getLocation()+" "+canvas.getWidth()+"x"+canvas.getHeight());
}
-
+
while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
if( !display.readAndDispatch() ) {
// blocks on linux .. display.sleep();
@@ -209,7 +212,7 @@ public class TestGearsES2SWT extends UITestCase {
Assert.assertFalse(animator.isAnimating());
Assert.assertFalse(animator.isStarted());
Assert.assertEquals(null, canvas.getExclusiveContextThread());
-
+
display.syncExec(new Runnable() {
public void run() {
canvas.dispose();
@@ -231,7 +234,7 @@ public class TestGearsES2SWT extends UITestCase {
final GLCapabilities caps = new GLCapabilities( glp );
caps.setBackgroundOpaque(opaque);
if(-1 < forceAlpha) {
- caps.setAlphaBits(forceAlpha);
+ caps.setAlphaBits(forceAlpha);
}
runTestGL(caps);
if(loop_shutdown) {
@@ -243,7 +246,7 @@ public class TestGearsES2SWT extends UITestCase {
@Test
public void test02GL3() throws InterruptedException, InvocationTargetException {
if(mainRun) return;
-
+
if( !GLProfile.isAvailable(GLProfile.GL3) ) {
System.err.println("GL3 n/a");
return;
@@ -252,13 +255,13 @@ public class TestGearsES2SWT extends UITestCase {
final GLCapabilities caps = new GLCapabilities( glp );
runTestGL(caps);
}
-
+
public static void main(String args[]) throws IOException {
mainRun = true;
-
+
int x=0, y=0, w=640, h=480, rw=-1, rh=-1;
boolean usePos = false;
-
+
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
i++;
@@ -317,7 +320,7 @@ public class TestGearsES2SWT extends UITestCase {
if( 0 < rw && 0 < rh ) {
rwsize = new Dimension(rw, rh);
}
-
+
if(usePos) {
wpos = new Point(x, y);
}
@@ -326,9 +329,9 @@ public class TestGearsES2SWT extends UITestCase {
System.err.println("resize "+rwsize);
System.err.println("screen "+screenIdx);
System.err.println("translucent "+(!opaque));
- System.err.println("forceAlpha "+forceAlpha);
+ System.err.println("forceAlpha "+forceAlpha);
System.err.println("fullscreen "+fullscreen);
- System.err.println("pmvDirect "+(!pmvUseBackingArray));
+ System.err.println("pmvDirect "+(!pmvUseBackingArray));
System.err.println("loops "+loops);
System.err.println("loop shutdown "+loop_shutdown);
System.err.println("forceES2 "+forceES2);
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 020c5c6..031d6a1 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,6 +1,7 @@
package com.jogamp.opengl.test.junit.jogl.demos.gl2;
+import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
@@ -17,6 +18,7 @@ import com.jogamp.newt.event.MouseListener;
import com.jogamp.newt.event.awt.AWTKeyAdapter;
import com.jogamp.newt.event.awt.AWTMouseAdapter;
import com.jogamp.opengl.JoglVersion;
+import com.jogamp.opengl.util.TileRendererBase;
/**
* Gears.java <BR>
@@ -24,15 +26,18 @@ import com.jogamp.opengl.JoglVersion;
*
* This version is equal to Brian Paul's version 1.2 1999/10/21
*/
-
-public class Gears implements GLEventListener {
+public class Gears implements GLEventListener, TileRendererBase.TileRendererListener {
private float view_rotx = 20.0f, view_roty = 30.0f, view_rotz = 0.0f;
private int gear1=0, gear2=0, gear3=0;
private float angle = 0.0f;
+ private boolean doRotate = true;
private int swapInterval;
private MouseListener gearsMouse = new GearsMouseAdapter();
private KeyListener gearsKeys = new GearsKeyAdapter();
-
+ private TileRendererBase tileRendererInUse = null;
+ private boolean doRotateBeforePrinting;
+ private boolean verbose = true;
+
// private boolean mouseRButtonDown = false;
private int prevMouseX, prevMouseY;
@@ -44,6 +49,29 @@ public class Gears implements GLEventListener {
this.swapInterval = 1;
}
+ @Override
+ public void addTileRendererNotify(TileRendererBase tr) {
+ tileRendererInUse = tr;
+ doRotateBeforePrinting = doRotate;
+ setDoRotation(false);
+ }
+ @Override
+ public void removeTileRendererNotify(TileRendererBase tr) {
+ tileRendererInUse = null;
+ setDoRotation(doRotateBeforePrinting);
+ }
+ @Override
+ public void startTileRendering(TileRendererBase tr) {
+ System.err.println("Gears.startTileRendering: "+tr);
+ }
+ @Override
+ public void endTileRendering(TileRendererBase tr) {
+ System.err.println("Gears.endTileRendering: "+tr);
+ }
+
+ public void setDoRotation(boolean rotate) { doRotate = rotate; }
+ public void setVerbose(boolean v) { verbose = v; }
+
public void setGears(int g1, int g2, int g3) {
gear1 = g1;
gear2 = g2;
@@ -65,19 +93,38 @@ public class Gears implements GLEventListener {
*/
public int getGear3() { return gear3; }
+ @Override
public void init(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
- System.err.println("GearsGL2 init on "+Thread.currentThread());
- System.err.println("Chosen GLCapabilities: " + drawable.getChosenGLCapabilities());
- System.err.println("INIT GL IS: " + gl.getClass().getName());
- System.err.println(JoglVersion.getGLStrings(gl, null, false).toString());
+ init(gl);
+
+ final Object upstreamWidget = drawable.getUpstreamWidget();
+ if (upstreamWidget instanceof Window) {
+ final Window window = (Window) upstreamWidget;
+ window.addMouseListener(gearsMouse);
+ window.addKeyListener(gearsKeys);
+ } else if (GLProfile.isAWTAvailable() && upstreamWidget instanceof java.awt.Component) {
+ final java.awt.Component comp = (java.awt.Component) upstreamWidget;
+ new AWTMouseAdapter(gearsMouse).addTo(comp);
+ new AWTKeyAdapter(gearsKeys).addTo(comp);
+ }
+ }
+ public void init(GL2 gl) {
float pos[] = { 5.0f, 5.0f, 10.0f, 0.0f };
float red[] = { 0.8f, 0.1f, 0.0f, 0.7f };
float green[] = { 0.0f, 0.8f, 0.2f, 0.7f };
float blue[] = { 0.2f, 0.2f, 1.0f, 0.7f };
+ System.err.println(Thread.currentThread()+" Gears.init: tileRendererInUse "+tileRendererInUse);
+ if(verbose) {
+ System.err.println("GearsES2 init on "+Thread.currentThread());
+ System.err.println("Chosen GLCapabilities: " + gl.getContext().getGLDrawable().getChosenGLCapabilities());
+ System.err.println("INIT GL IS: " + gl.getClass().getName());
+ System.err.println(JoglVersion.getGLStrings(gl, null, false).toString());
+ }
+
gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, pos, 0);
gl.glEnable(GL2.GL_CULL_FACE);
gl.glEnable(GL2.GL_LIGHTING);
@@ -119,42 +166,81 @@ public class Gears implements GLEventListener {
}
gl.glEnable(GL2.GL_NORMALIZE);
-
- final Object upstreamWidget = drawable.getUpstreamWidget();
- if (upstreamWidget instanceof Window) {
- final Window window = (Window) upstreamWidget;
- window.addMouseListener(gearsMouse);
- window.addKeyListener(gearsKeys);
- } else if (GLProfile.isAWTAvailable() && upstreamWidget instanceof java.awt.Component) {
- final java.awt.Component comp = (java.awt.Component) upstreamWidget;
- new AWTMouseAdapter(gearsMouse).addTo(comp);
- new AWTKeyAdapter(gearsKeys).addTo(comp);
- }
}
-
- public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
- System.err.println("Gears: Reshape "+x+"/"+y+" "+width+"x"+height);
- GL2 gl = drawable.getGL().getGL2();
+
+ @Override
+ public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) {
+ final GL2 gl = glad.getGL().getGL2();
+ if(-1 != swapInterval) {
+ gl.setSwapInterval(swapInterval);
+ }
+ reshape(gl, x, y, width, height, width, height);
+ }
+
+ @Override
+ public void reshapeTile(TileRendererBase tr,
+ int tileX, int tileY, int tileWidth, int tileHeight,
+ int imageWidth, int imageHeight) {
+ final GL2 gl = tr.getAttachedDrawable().getGL().getGL2();
+ gl.setSwapInterval(0);
+ reshape(gl, tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight);
+ }
- gl.setSwapInterval(swapInterval);
+ public void reshape(GL2 gl, int tileX, int tileY, int tileWidth, int tileHeight, int imageWidth, int imageHeight) {
+ final boolean msaa = gl.getContext().getGLDrawable().getChosenGLCapabilities().getSampleBuffers();
+ System.err.println(Thread.currentThread()+" Gears.reshape "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", msaa "+msaa+", tileRendererInUse "+tileRendererInUse);
+ if( msaa ) {
+ gl.glEnable(GL.GL_MULTISAMPLE);
+ }
+
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();
- if(height>width) {
- float h = (float)height / (float)width;
- gl.glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f);
+
+ // compute projection parameters 'normal'
+ float left, right, bottom, top;
+ if( imageHeight > imageWidth ) {
+ float a = (float)imageHeight / (float)imageWidth;
+ left = -1.0f;
+ right = 1.0f;
+ bottom = -a;
+ top = a;
} else {
- float h = (float)width / (float)height;
- gl.glFrustum(-h, h, -1.0f, 1.0f, 5.0f, 60.0f);
+ float a = (float)imageWidth / (float)imageHeight;
+ left = -a;
+ right = a;
+ bottom = -1.0f;
+ top = 1.0f;
+ }
+ final float w = right - left;
+ final float h = top - bottom;
+
+ // compute projection parameters 'tiled'
+ final float l = left + tileX * w / imageWidth;
+ final float r = l + tileWidth * w / imageWidth;
+ final float b = bottom + tileY * h / imageHeight;
+ final float t = b + tileHeight * h / imageHeight;
+
+ final float _w = r - l;
+ final float _h = t - b;
+ if(verbose) {
+ System.err.println(">> angle "+angle+", [l "+left+", r "+right+", b "+bottom+", t "+top+"] "+w+"x"+h+" -> [l "+l+", r "+r+", b "+b+", t "+t+"] "+_w+"x"+_h);
}
- gl.glMatrixMode(GL2.GL_MODELVIEW);
+ gl.glFrustum(l, r, b, t, 5.0f, 60.0f);
+
+ gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glTranslatef(0.0f, 0.0f, -40.0f);
+
+ if( msaa ) {
+ gl.glDisable(GL.GL_MULTISAMPLE);
+ }
}
+ @Override
public void dispose(GLAutoDrawable drawable) {
- System.err.println("Gears: Dispose");
+ System.err.println(Thread.currentThread()+" Gears.dispose: tileRendererInUse "+tileRendererInUse);
try {
final Object upstreamWidget = drawable.getUpstreamWidget();
if (upstreamWidget instanceof Window) {
@@ -166,14 +252,21 @@ public class Gears implements GLEventListener {
setGears(0, 0, 0);
}
+ @Override
public void display(GLAutoDrawable drawable) {
- // Turn the gears' teeth
- angle += 2.0f;
-
// Get the GL corresponding to the drawable we are animating
GL2 gl = drawable.getGL().getGL2();
+ final boolean msaa = gl.getContext().getGLDrawable().getChosenGLCapabilities().getSampleBuffers();
- gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ if( msaa ) {
+ gl.glEnable(GL.GL_MULTISAMPLE);
+ }
+
+ if( null == tileRendererInUse ) {
+ gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ } else {
+ gl.glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
+ }
// Special handling for the case where the GLJPanel is translucent
// and wants to be composited with other Java 2D content
@@ -185,7 +278,32 @@ public class Gears implements GLEventListener {
} else {
gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
}
-
+ displayImpl(gl);
+ if( msaa ) {
+ gl.glDisable(GL.GL_MULTISAMPLE);
+ }
+ }
+ public void display(GL2 gl) {
+ final boolean msaa = gl.getContext().getGLDrawable().getChosenGLCapabilities().getSampleBuffers();
+ if( msaa ) {
+ gl.glEnable(GL.GL_MULTISAMPLE);
+ }
+ if( null == tileRendererInUse ) {
+ gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ } else {
+ gl.glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
+ }
+ gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
+ displayImpl(gl);
+ if( msaa ) {
+ gl.glDisable(GL.GL_MULTISAMPLE);
+ }
+ }
+ private void displayImpl(GL2 gl) {
+ if( doRotate ) {
+ // Turn the gears' teeth
+ angle += 2.0f;
+ }
// Rotate the entire assembly of gears based on how the user
// dragged the mouse around
gl.glPushMatrix();
@@ -216,7 +334,7 @@ public class Gears implements GLEventListener {
// Remember that every push needs a pop; this one is paired with
// rotating the entire gear assembly
- gl.glPopMatrix();
+ gl.glPopMatrix();
}
public static void gear(GL2 gl,
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 af30c26..fb8e6bf 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
@@ -43,21 +43,35 @@ public class TextureDraw01GL2Listener implements GLEventListener, TextureDraw01A
private GLU glu = new GLU();
private TextureData textureData;
private Texture texture;
+ boolean keepTextureBound;
public TextureDraw01GL2Listener(TextureData td) {
this.textureData = td;
+ this.keepTextureBound = false;
}
+ @Override
+ public void setKeepTextureBound(boolean v) {
+ this.keepTextureBound = v;
+ }
+ @Override
+ public Texture getTexture( ) {
+ return this.texture;
+ }
+
+ @Override
public void init(GLAutoDrawable drawable) {
+ GL2 gl = drawable.getGL().getGL2();
if(null!=textureData) {
this.texture = TextureIO.newTexture(drawable.getGL(), textureData);
+ if( keepTextureBound ) {
+ texture.enable(gl);
+ texture.bind(gl);
+ }
}
}
- public Texture getTexture( ) {
- return this.texture;
- }
-
+ @Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
GL2 gl = drawable.getGL().getGL2();
gl.glMatrixMode(GL2ES1.GL_PROJECTION);
@@ -67,6 +81,7 @@ public class TextureDraw01GL2Listener implements GLEventListener, TextureDraw01A
gl.glLoadIdentity();
}
+ @Override
public void dispose(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
if(null!=texture) {
@@ -78,13 +93,16 @@ public class TextureDraw01GL2Listener implements GLEventListener, TextureDraw01A
}
}
+ @Override
public void display(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
// draw one quad with the texture
if(null!=texture) {
- texture.enable(gl);
- texture.bind(gl);
+ if( !keepTextureBound ) {
+ texture.enable(gl);
+ texture.bind(gl);
+ }
gl.glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_REPLACE);
TextureCoords coords = texture.getImageTexCoords();
gl.glBegin(GL2.GL_QUADS);
@@ -97,7 +115,9 @@ public class TextureDraw01GL2Listener implements GLEventListener, TextureDraw01A
gl.glTexCoord2f(coords.left(), coords.top());
gl.glVertex3f(0, 1, 0);
gl.glEnd();
- texture.disable(gl);
+ if( !keepTextureBound ) {
+ texture.disable(gl);
+ }
}
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/Bug818GLJPanelApplet.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/Bug818GLJPanelApplet.java
new file mode 100644
index 0000000..7e3d78b
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/Bug818GLJPanelApplet.java
@@ -0,0 +1,306 @@
+/**
+ * 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.
+ */
+package com.jogamp.opengl.test.junit.jogl.demos.gl2.awt;
+
+import java.awt.Dimension;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.InputStream;
+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.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.swing.JApplet;
+import javax.swing.JPanel;
+import javax.swing.JFrame;
+
+import com.jogamp.common.util.VersionUtil;
+import com.jogamp.opengl.JoglVersion;
+import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.util.texture.Texture;
+import com.jogamp.opengl.util.texture.TextureIO;
+
+/**
+ * Bug 818: OSX GLJPanel Crash
+ * <pre>
+ * - NVIDIA GeForce GT 330M
+ * - GL_VENDOR: "NVIDIA Corporation"
+ * - GL_RENDERER: "NVIDIA GeForce GT 330M OpenGL Engine"
+ * - GL_VERSION: "2.1 NVIDIA-8.12.47 310.40.00.05f01"
+ * - Mac OSX 10.6.8
+ * </pre>
+ */
+public class Bug818GLJPanelApplet extends JApplet {
+
+ private static final long serialVersionUID = 1L;
+
+ private Animator animatorCanvas;
+
+ private Animator animatorPanel;
+
+ public static JFrame frame;
+ public static JPanel appletHolder;
+ public static boolean isApplet = true;
+
+ static public void main(String args[]) {
+ isApplet = false;
+
+ final JApplet myApplet = new Bug818GLJPanelApplet();
+
+ appletHolder = new JPanel();
+
+ frame = new JFrame("Bug818GLJPanelApplet");
+ frame.getContentPane().add(myApplet);
+
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.addWindowListener(new WindowAdapter() {
+ public void windowClosing(WindowEvent e) {
+ System.exit(0);
+ }
+ });
+
+ try {
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ myApplet.init();
+ frame.validate();
+ frame.pack();
+ frame.setVisible(true);
+ } } );
+ } catch( Throwable throwable ) {
+ throwable.printStackTrace();
+ }
+
+ myApplet.start();
+ }
+
+
+ @Override
+ public void init() {
+
+ final JPanel panel = new JPanel();
+ setContentPane(panel);
+
+ final GLCanvas glCanvas = new GLCanvas();
+ glCanvas.addGLEventListener(new JOGLQuad(true));
+ animatorCanvas = new Animator(glCanvas);
+ glCanvas.setPreferredSize(new Dimension(300, 300));
+ panel.add(glCanvas);
+
+ final GLJPanel gljPanel = new GLJPanel();
+ gljPanel.addGLEventListener(new JOGLQuad(false));
+ animatorPanel = new Animator(gljPanel);
+ gljPanel.setPreferredSize(new Dimension(300, 300));
+ panel.add(gljPanel);
+ }
+
+ @Override
+ public void start() {
+
+ animatorCanvas.start();
+ animatorCanvas.setUpdateFPSFrames(60, System.err);
+ animatorPanel.start();
+ animatorPanel.setUpdateFPSFrames(60, System.err);
+ }
+
+ @Override
+ public void stop() {
+
+ animatorCanvas.stop();
+ animatorPanel.stop();
+ }
+
+ @Override
+ public void destroy() {}
+
+ /**
+ * Self-contained example (within a single class only to keep it simple) displaying a rotating quad
+ */
+ static class JOGLQuad implements GLEventListener {
+
+ private static final float[] VERTEX_DATA = {
+ -1.0f, 1.0f, 0.0f, // Top Left
+ 1.0f, 1.0f, 0.0f, // Top Right
+ 1.0f, -1.0f, 0.0f, // Bottom Right
+ -1.0f, -1.0f, 0.0f // Bottom Left
+ };
+
+ private static final float[] TEXCOORD_DATA = {
+ 0.0f, 1.0f, // Top Left
+ 1.0f, 1.0f, // Top Right
+ 1.0f, 0.0f, // Bottom Right
+ 0.0f, 0.0f // Bottom Left
+ };
+
+ private FloatBuffer vertexBuf;
+
+ private FloatBuffer texCoordBuf;
+
+ private int vertexVBO;
+
+ private int texCoordVBO;
+
+ private float rotateT = 0.0f;
+
+ private boolean canvas;
+
+ private Texture texture;
+
+ JOGLQuad(boolean canvas) {
+
+ this.canvas = canvas;
+
+ ByteBuffer bb = ByteBuffer.allocateDirect(VERTEX_DATA.length * 4);
+ bb.order(ByteOrder.nativeOrder());
+ vertexBuf = bb.asFloatBuffer();
+ vertexBuf.put(VERTEX_DATA);
+ vertexBuf.rewind();
+
+ bb = ByteBuffer.allocateDirect(TEXCOORD_DATA.length * 4);
+ bb.order(ByteOrder.nativeOrder());
+ texCoordBuf = bb.asFloatBuffer();
+ texCoordBuf.put(TEXCOORD_DATA);
+ texCoordBuf.rewind();
+ }
+
+ @Override
+ public void init(GLAutoDrawable glDrawable) {
+
+ final GL2 gl = glDrawable.getGL().getGL2();
+
+ System.err.println(VersionUtil.getPlatformInfo());
+ System.err.println(JoglVersion.getGLInfo(gl, null, false /* withCapabilitiesAndExtensionInfo */).toString());
+
+ gl.glShadeModel(GLLightingFunc.GL_SMOOTH);
+ gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ gl.glClearDepth(1.0f);
+ gl.glEnable(GL.GL_DEPTH_TEST);
+ gl.glDepthFunc(GL.GL_LEQUAL);
+ gl.glHint(GL2ES1.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
+
+ int[] tmp = new int[2];
+ gl.glGenBuffers(tmp.length, tmp, 0);
+ vertexVBO = tmp[0];
+ texCoordVBO = tmp[1];
+
+ gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, vertexVBO);
+ gl.glBufferData(GL2.GL_ARRAY_BUFFER, VERTEX_DATA.length * 4, vertexBuf, GL2.GL_STATIC_DRAW);
+ gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, texCoordVBO);
+ gl.glBufferData(GL2.GL_ARRAY_BUFFER, TEXCOORD_DATA.length * 4, texCoordBuf, GL2.GL_STATIC_DRAW);
+ gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0);
+
+ try {
+ InputStream stream = getClass().getClassLoader().getResourceAsStream("com/jogamp/opengl/test/junit/jogl/util/texture/test-ntscN_3-01-160x90-90pct-yuv444-base.jpg");
+ texture = TextureIO.newTexture(stream, true, TextureIO.JPG);
+ } catch (Exception exc) {
+ exc.printStackTrace(System.err);
+ }
+ }
+
+ @Override
+ public void dispose(GLAutoDrawable drawable) {
+
+ final GL2 gl = drawable.getGL().getGL2();
+ int[] tmp = new int[] {vertexVBO, texCoordVBO};
+ gl.glGenBuffers(tmp.length, tmp, 0);
+ }
+
+ @Override
+ public void reshape(GLAutoDrawable gLDrawable, int x, int y, int width, int height) {
+
+ final GL2 gl = gLDrawable.getGL().getGL2();
+ final float aspect = (float) width / (float) height;
+ gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+ gl.glLoadIdentity();
+ final float fh = 0.5f;
+ final float fw = fh * aspect;
+ gl.glFrustumf(-fw, fw, -fh, fh, 1.0f, 1000.0f);
+ gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
+ gl.glLoadIdentity();
+ }
+
+ @Override
+ public void display(GLAutoDrawable gLDrawable) {
+
+ final GL2 gl = gLDrawable.getGL().getGL2();
+
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
+ gl.glLoadIdentity();
+ gl.glTranslatef(0.0f, 0.0f, -5.0f);
+
+ // rotate about the three axes
+ gl.glRotatef(rotateT, 1.0f, 0.0f, 0.0f);
+ gl.glRotatef(rotateT, 0.0f, 1.0f, 0.0f);
+ gl.glRotatef(rotateT, 0.0f, 0.0f, 1.0f);
+
+ // set the color of the quad
+ if (canvas) {
+ gl.glColor3f(0.2f, 1.0f, 1.0f);
+ } else {
+ gl.glColor3f(1.0f, 0.2f, 0.2f);
+ }
+
+ if (texture != null) {
+ texture.bind(gl);
+ texture.enable(gl);
+ } else {
+ System.err.println("no texture");
+ }
+
+ // Draw A Quad
+ gl.glEnableClientState(GL2.GL_VERTEX_ARRAY);
+ gl.glEnableClientState(GL2.GL_TEXTURE_COORD_ARRAY);
+ gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, vertexVBO);
+ gl.glVertexPointer(3, GL2.GL_FLOAT, 0, 0);
+ gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, texCoordVBO);
+ gl.glTexCoordPointer(2, GL2.GL_FLOAT, 0, 0);
+ gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0);
+ gl.glDrawArrays(GL2.GL_QUADS, 0, 4);
+ gl.glDisableClientState(GL2.GL_TEXTURE_COORD_ARRAY);
+ gl.glDisableClientState(GL2.GL_VERTEX_ARRAY);
+
+ if (texture != null) {
+ texture.disable(gl);
+ }
+
+ // increasing rotation for the next iteration
+ rotateT += 0.2f;
+ }
+
+ }
+}
+
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 aaf995e..0a8c406 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
@@ -50,6 +50,8 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* Test for bug 450, which causes the right part of the frame to be black
@@ -61,6 +63,7 @@ import org.junit.Test;
*
* @author Wade Walker (adapted from TestGearsGLJPanelAWT)
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLJPanelAWTBug450 extends UITestCase {
static GLProfile glp;
static int width, height;
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 528762a..24a6d57 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
@@ -52,11 +52,15 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGearsAWT extends UITestCase {
static GLProfile glp;
static int width, height;
static boolean waitForKey = false;
+ static int msaaCount = 0;
@BeforeClass
public static void initClass() {
@@ -129,6 +133,10 @@ public class TestGearsAWT extends UITestCase {
@Test
public void test01() throws InterruptedException, InvocationTargetException {
GLCapabilities caps = new GLCapabilities(glp);
+ if( msaaCount > 0 ) {
+ caps.setSampleBuffers(true);
+ caps.setNumSamples(msaaCount);
+ }
runTestGL(caps);
}
@@ -141,9 +149,14 @@ public class TestGearsAWT extends UITestCase {
try {
duration = Integer.parseInt(args[i]);
} catch (Exception ex) { ex.printStackTrace(); }
+ } else if(args[i].equals("-msaa")) {
+ i++;
+ try {
+ msaaCount = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
} else if(args[i].equals("-wait")) {
waitForKey = true;
- }
+ }
}
if(waitForKey) {
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
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 22df331..66b9e4a 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
@@ -50,7 +50,10 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGearsAWTAnalyzeBug455 extends UITestCase {
static long duration = 500; // ms
static boolean waitForKey = false; // for manual profiling
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 02e44e7..5de08c7 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
@@ -53,7 +53,10 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGearsGLJPanelAWT extends UITestCase {
static GLProfile glp;
static int width, height;
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 3c33a48..a513425 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
@@ -45,7 +45,10 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGearsNEWT extends UITestCase {
static GLProfile glp;
static int width, height;
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 0b907d5..84e6670 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
@@ -46,7 +46,10 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGearsNewtAWTWrapper extends UITestCase {
static GLProfile glp;
static int width, height;
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 ddde837..5a22fc7 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
@@ -43,7 +43,10 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestTeapotNEWT extends UITestCase {
static GLProfile glp;
static int width, height;
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 71c0ae7..8e582bd 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
@@ -34,6 +34,8 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.jogl.demos.gl3.GeomShader01TextureGL3;
@@ -45,6 +47,7 @@ import com.jogamp.opengl.util.Animator;
/**
* Test Geometry shader demo GeomShader01TextureGL3
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGeomShader01TextureGL3NEWT extends UITestCase {
static long duration = 500; // ms
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 98acea6..c240731 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
@@ -47,11 +47,14 @@ import javax.media.opengl.GLUniformData;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* Testing different vertex attribute (VA) data sets on one shader
* and shader state in general.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLSLShaderState01NEWT extends UITestCase {
static long durationPerTest = 10; // ms
static boolean firstUIActionOnProcess = false;
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 bd0e77e..eb5a3fc 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
@@ -47,11 +47,14 @@ import javax.media.opengl.GLUniformData;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* Testing different vertex attribute (VA) data sets on one shader
* and shader state in general.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLSLShaderState02NEWT extends UITestCase {
static long durationPerTest = 10; // ms
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 dde7252..9a70a08 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
@@ -39,6 +39,8 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.util.Animator;
@@ -48,6 +50,7 @@ import com.jogamp.opengl.test.junit.util.MiscUtils;
import java.io.IOException;
import javax.media.opengl.GL2ES2;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLSLSimple01NEWT extends UITestCase {
static long durationPerTest = 100; // ms
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 658e3e7..360f4e8 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
@@ -53,7 +53,10 @@ import javax.media.opengl.GLUniformData;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestRulerNEWT01 extends UITestCase {
static long durationPerTest = 10; // ms
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 4d87843..f26927a 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
@@ -44,11 +44,14 @@ import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* Duplicates bug 459, where a vertex shader won't compile when 8 bits of stencil are requested.
* This bug is Windows-only; it works on Mac OS X and CentOS.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestShaderCompilationBug459AWT extends UITestCase {
static int width, height;
static long duration = 500; // ms
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 3be0897..bbfe1dd 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
@@ -15,6 +15,8 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.opengl.util.glsl.ShaderUtil;
@@ -24,6 +26,7 @@ import java.io.IOException;
* Bug 'Function glTransformFeedbackVaryings incorrectly passes argument'
* http://jogamp.org/bugzilla/show_bug.cgi?id=407
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestTransformFeedbackVaryingsBug407NEWT extends UITestCase {
private static final boolean debugGL = true;
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
new file mode 100644
index 0000000..b9e64e1
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug365TextureGenerateMipMaps.java
@@ -0,0 +1,270 @@
+package com.jogamp.opengl.test.junit.jogl.glu;
+
+import java.nio.ByteBuffer;
+
+import javax.media.opengl.GL2;
+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 org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import jogamp.opengl.glu.mipmap.Mipmap;
+import jogamp.opengl.glu.mipmap.ScaleInternal;
+
+import com.jogamp.common.nio.Buffers;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.texture.Texture;
+import com.jogamp.opengl.util.texture.TextureData;
+import com.jogamp.opengl.util.texture.TextureIO;
+
+/**
+ * This test creates a {@link Texture} from {@link TextureData} of various pixel formats
+ * and pixel types with auto generate mipmaps set to {@code true}.
+ * <br></br>
+ * Bug Reference: https://jogamp.org/bugzilla/show_bug.cgi?id=365
+ * <br></br>
+ * The bug pertains to mipmap generation from a Texture and exists in {@link ScaleInternal}
+ * where a {@link java.nio.BufferUnderflowException} is thrown.
+ * <br></br>
+ * <ul>This suite of test cases test:
+ * <li>{@link ScaleInternal#scale_internal_ubyte(int, int, int, ByteBuffer, int, int, ByteBuffer, int, int, int)}</li>
+ * <li>{@link ScaleInternal#scale_internal_byte(int, int, int, ByteBuffer, int, int, ByteBuffer, int, int, int)}</li>
+ * <li>{@link ScaleInternal#scale_internal_ushort(int, int, int, ByteBuffer, int, int, java.nio.ShortBuffer, int, int, int, boolean)}</li>
+ * <li>{@link ScaleInternal#scale_internal_short(int, int, int, ByteBuffer, int, int, java.nio.ShortBuffer, int, int, int, boolean)}</li>
+ * <li>{@link ScaleInternal#scale_internal_uint(int, int, int, ByteBuffer, int, int, java.nio.IntBuffer, int, int, int, boolean)}</li>
+ * <li>{@link ScaleInternal#scale_internal_int(int, int, int, ByteBuffer, int, int, java.nio.IntBuffer, int, int, int, boolean)}</li>
+ * <li>{@link ScaleInternal#scale_internal_float(int, int, int, ByteBuffer, int, int, java.nio.FloatBuffer, int, int, int, boolean)}</li>
+ * </ul>
+ *
+ * @author Michael Esemplare, et.al.
+ *
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestBug365TextureGenerateMipMaps extends UITestCase {
+ static GLOffscreenAutoDrawable drawable;
+
+ @BeforeClass
+ public static void setup() throws Throwable {
+ // disableNPOT
+ System.setProperty("jogl.texture.nonpot", "true");
+ try {
+ setUpOffscreenAutoDrawable();
+ } catch (Throwable t) {
+ throw t;
+ }
+ }
+
+ @AfterClass
+ public static void teardown() {
+ tearDownOffscreenAutoDrawable();
+ }
+
+ private static void setUpOffscreenAutoDrawable() throws Throwable {
+ GLProfile glp = GLProfile.getDefault();
+ GLCapabilities caps = new GLCapabilities(glp);
+
+ GLDrawableFactory factory = GLDrawableFactory.getFactory(glp);
+
+ // Make a drawable to get an offscreen context
+ drawable = factory.createOffscreenAutoDrawable(null, caps, null, 2, 2);
+ drawable.display(); // trigger context creation
+ GLContext glContext = drawable.getContext();
+ try {
+ Assert.assertTrue("Could not make context current", GLContext.CONTEXT_NOT_CURRENT < glContext.makeCurrent());
+ } catch (Throwable t) {
+ tearDownOffscreenAutoDrawable();
+ throw t;
+ }
+ }
+
+ private static void tearDownOffscreenAutoDrawable() {
+ if(drawable != null) {
+ drawable.getContext().release();
+ drawable.destroy();
+ drawable = null;
+ }
+ }
+
+ private static void testTextureMipMapGeneration(int width, int height, int pixelFormat, int pixelType) {
+ int internalFormat = pixelFormat;
+ int border = 0;
+ boolean mipmap = true;
+ boolean dataIsCompressed = false;
+ boolean mustFlipVertically = false;
+
+ int memReq = Mipmap.image_size( width, height, pixelFormat, pixelType );
+ ByteBuffer buffer = Buffers.newDirectByteBuffer( memReq );
+
+ TextureData data = new TextureData(drawable.getGLProfile(),
+ internalFormat,
+ width,
+ height,
+ border,
+ pixelFormat,
+ pixelType,
+ mipmap,
+ dataIsCompressed,
+ mustFlipVertically,
+ buffer,
+ null);
+
+ Texture texture = TextureIO.newTexture(drawable.getGL(), data);
+ // Cleanup
+ texture.destroy(drawable.getGL());
+ data.destroy();
+ buffer.clear();
+ buffer = null;
+ }
+
+ @Test
+ public void test00_MipMap_ScaleInternal_RGB_UBYTE () {
+ int width = 1;
+ int height = 7;
+ int pixelFormat = GL2.GL_RGB;
+ int pixelType = GL2.GL_UNSIGNED_BYTE;
+
+ testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
+ }
+
+ @Test
+ public void test01_MipMap_ScaleInternal_RGBA_UBYTE () {
+ int width = 1;
+ int height = 7;
+ int pixelFormat = GL2.GL_RGBA;
+ int pixelType = GL2.GL_UNSIGNED_BYTE;
+
+ testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
+ }
+
+ @Test
+ public void test02_MipMap_ScaleInternal_RGB_BYTE () {
+ int width = 1;
+ int height = 7;
+ int pixelFormat = GL2.GL_RGB;
+ int pixelType = GL2.GL_BYTE;
+
+ testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
+ }
+
+ @Test
+ public void test03_MipMap_ScaleInternal_RGBA_BYTE () {
+ int width = 1;
+ int height = 7;
+ int pixelFormat = GL2.GL_RGBA;
+ int pixelType = GL2.GL_BYTE;
+
+ testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
+ }
+
+ @Test
+ public void test04_MipMap_ScaleInternal_RGB_USHORT () {
+ int width = 1;
+ int height = 7;
+ int pixelFormat = GL2.GL_RGB;
+ int pixelType = GL2.GL_UNSIGNED_SHORT;
+
+ testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
+ }
+
+ @Test
+ public void test05_MipMap_ScaleInternal_RGBA_USHORT () {
+ int width = 1;
+ int height = 7;
+ int pixelFormat = GL2.GL_RGBA;
+ int pixelType = GL2.GL_UNSIGNED_SHORT;
+
+ testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
+ }
+
+ @Test
+ public void test06_MipMap_ScaleInternal_RGB_SHORT () {
+ int width = 1;
+ int height = 7;
+ int pixelFormat = GL2.GL_RGB;
+ int pixelType = GL2.GL_SHORT;
+
+ testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
+ }
+
+ @Test
+ public void test07_MipMap_ScaleInternal_RGBA_SHORT () {
+ int width = 1;
+ int height = 7;
+ int pixelFormat = GL2.GL_RGBA;
+ int pixelType = GL2.GL_SHORT;
+
+ testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
+ }
+
+ @Test
+ public void test08_MipMap_ScaleInternal_RGB_UINT () {
+ int width = 1;
+ int height = 7;
+ int pixelFormat = GL2.GL_RGB;
+ int pixelType = GL2.GL_UNSIGNED_INT;
+
+ testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
+ }
+
+ @Test
+ public void test09_MipMap_ScaleInternal_RGBA_UINT () {
+ int width = 1;
+ int height = 7;
+ int pixelFormat = GL2.GL_RGBA;
+ int pixelType = GL2.GL_UNSIGNED_INT;
+
+ testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
+ }
+
+ @Test
+ public void test10_MipMap_ScaleInternal_RGB_INT () {
+ int width = 1;
+ int height = 7;
+ int pixelFormat = GL2.GL_RGB;
+ int pixelType = GL2.GL_INT;
+
+ testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
+ }
+
+ @Test
+ public void test11_MipMap_ScaleInternal_RGBA_INT () {
+ int width = 1;
+ int height = 7;
+ int pixelFormat = GL2.GL_RGBA;
+ int pixelType = GL2.GL_INT;
+
+ testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
+ }
+
+ @Test
+ public void test12_MipMap_ScaleInternal_RGB_FLOAT () {
+ int width = 1;
+ int height = 7;
+ int pixelFormat = GL2.GL_RGB;
+ int pixelType = GL2.GL_FLOAT;
+
+ testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
+ }
+
+ @Test
+ public void test13_MipMap_ScaleInternal_RGBA_FLOAT () {
+ int width = 1;
+ int height = 7;
+ int pixelFormat = GL2.GL_RGBA;
+ int pixelType = GL2.GL_FLOAT;
+
+ testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
+ }
+
+ public static void main(String[] args) {
+ org.junit.runner.JUnitCore.main(TestBug365TextureGenerateMipMaps.class.getName());
+ }
+}
\ No newline at end of file
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 3f122ac..e5690a0 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
@@ -41,6 +41,8 @@ import javax.media.opengl.glu.gl2es1.GLUgl2es1;
import org.junit.Assume;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.opengl.test.junit.util.UITestCase;
@@ -52,6 +54,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
* was in JOGL 1) solves the problem.
* @author Wade Walker
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug463ScaleImageMemoryAWT extends UITestCase implements GLEventListener {
/* @Override */
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 d3bcce1..ca5b089 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
@@ -41,6 +41,8 @@ import javax.media.opengl.glu.GLU;
import org.junit.Assume;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.nio.Buffers;
import com.jogamp.opengl.test.junit.util.UITestCase;
@@ -51,6 +53,7 @@ import com.jogamp.opengl.util.GLPixelStorageModes;
* Demonstrates how to use {@link GLBuffers#sizeof(GL, int[], int, int, int, int, int, boolean)}
* to determine the unpack buffer size for {@link GLU#gluScaleImage(int, int, int, int, java.nio.Buffer, int, int, int, java.nio.Buffer)}.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug694ScaleImageUnpackBufferSizeAWT extends UITestCase implements GLEventListener {
/* @Override */
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestBinary16NOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestBinary16NOUI.java
new file mode 100644
index 0000000..8f56c13
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestBinary16NOUI.java
@@ -0,0 +1,715 @@
+/**
+ * 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.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.math;
+
+import org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.opengl.math.Binary16;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public final class TestBinary16NOUI extends UITestCase /* due to hardship on machine, we want to run this test exclusively! */
+{
+ static int stepping = 1;
+ static boolean verbose = false;
+
+ /**
+ * Exponents in the range [-15, 16] are encoded and decoded correctly.
+ */
+
+ @SuppressWarnings("static-method") @Test public void testExponentIdentity()
+ {
+ System.out.println("-- Exponent identities");
+ for (int e = -15; e <= 16; ++e) {
+ final char p = Binary16.packSetExponentUnbiasedUnchecked(e);
+ final int u = Binary16.unpackGetExponentUnbiased(p);
+ if( verbose ) {
+ System.out.println("e: " + e +", p: "+Integer.toHexString(p)+", u: "+u);
+ }
+ Assert.assertEquals(e, u);
+ }
+ }
+
+ /**
+ * Infinities are infinite.
+ */
+
+ @SuppressWarnings("static-method") @Test public void testInfinite()
+ {
+ Assert.assertTrue(Binary16.isInfinite(Binary16.POSITIVE_INFINITY));
+ Assert.assertTrue(Binary16.isInfinite(Binary16.NEGATIVE_INFINITY));
+ Assert.assertFalse(Binary16.isInfinite(Binary16.exampleNaN()));
+
+ for (int i = 0; i <= 65535; i+=stepping) {
+ Assert.assertFalse(Binary16.isInfinite(Binary16.packDouble(i)));
+ }
+ }
+
+ /**
+ * The unencoded exponent of infinity is 16.
+ */
+
+ @SuppressWarnings("static-method") @Test public void testInfinityExponent()
+ {
+ Assert.assertEquals(
+ 16,
+ Binary16.unpackGetExponentUnbiased(Binary16.POSITIVE_INFINITY));
+ }
+
+ /**
+ * The unencoded exponent of infinity is 16.
+ */
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testInfinityNegativeExponent()
+ {
+ Assert.assertEquals(
+ 16,
+ Binary16.unpackGetExponentUnbiased(Binary16.NEGATIVE_INFINITY));
+ }
+
+ /**
+ * The sign of negative infinity is 1.
+ */
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testInfinityNegativeSign()
+ {
+ Assert
+ .assertEquals(1, Binary16.unpackGetSign(Binary16.NEGATIVE_INFINITY));
+ }
+
+ /**
+ * The significand of infinity is 0.
+ */
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testInfinityNegativeSignificand()
+ {
+ Assert.assertEquals(
+ 0,
+ Binary16.unpackGetSignificand(Binary16.NEGATIVE_INFINITY));
+ }
+
+ /**
+ * The sign of positive infinity is 0.
+ */
+
+ @SuppressWarnings("static-method") @Test public void testInfinitySign()
+ {
+ Assert
+ .assertEquals(0, Binary16.unpackGetSign(Binary16.POSITIVE_INFINITY));
+ }
+
+ /**
+ * The significand of infinity is 0.
+ */
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testInfinitySignificand()
+ {
+ Assert.assertEquals(
+ 0,
+ Binary16.unpackGetSignificand(Binary16.POSITIVE_INFINITY));
+ }
+
+ /**
+ * NaN is NaN.
+ */
+
+ @SuppressWarnings("static-method") @Test public void testNaN()
+ {
+ final int n =
+ Binary16.packSetExponentUnbiasedUnchecked(16)
+ | Binary16.packSetSignificandUnchecked(1);
+ final char c = (char) n;
+ Assert.assertEquals(16, Binary16.unpackGetExponentUnbiased(c));
+ Assert.assertEquals(1, Binary16.unpackGetSignificand(c));
+ Assert.assertEquals(
+ 16,
+ Binary16.unpackGetExponentUnbiased(Binary16.exampleNaN()));
+ Assert.assertEquals(
+ 1,
+ Binary16.unpackGetSignificand(Binary16.exampleNaN()));
+ Assert.assertTrue(Binary16.isNaN(c));
+ Assert.assertTrue(Binary16.isNaN(Binary16.exampleNaN()));
+ }
+
+ /**
+ * Packing NaN results in NaN.
+ */
+
+ @SuppressWarnings("static-method") @Test public void testPackDoubleNaN()
+ {
+ final double k = Double.NaN;
+ final char r = Binary16.packDouble(k);
+ Assert.assertTrue(Binary16.isNaN(r));
+ }
+
+ /**
+ * Packing negative infinity results in negative infinity.
+ */
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testPackDoubleNegativeInfinity()
+ {
+ Assert.assertTrue(Binary16.NEGATIVE_INFINITY == Binary16
+ .packDouble(Double.NEGATIVE_INFINITY));
+ }
+
+ /**
+ * Packing negative zero results in negative zero.
+ */
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testPackDoubleNegativeZero()
+ {
+ Assert.assertTrue(Binary16.NEGATIVE_ZERO == Binary16.packDouble(-0.0));
+ }
+
+ /**
+ * Packing positive infinity results in positive infinity.
+ */
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testPackDoublePositiveInfinity()
+ {
+ Assert.assertTrue(Binary16.POSITIVE_INFINITY == Binary16
+ .packDouble(Double.POSITIVE_INFINITY));
+ }
+
+ /**
+ * Packing positive zero results in positive zero.
+ */
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testPackDoublePositiveZero()
+ {
+ Assert.assertTrue(Binary16.POSITIVE_ZERO == Binary16.packDouble(0.0));
+ }
+
+ /**
+ * Integers in the range [0, 65520] should be representable.
+ */
+
+ @SuppressWarnings({ "static-method", "boxing" }) @Test public
+ void
+ testPackDoubleUnpackFloat()
+ {
+ for (int i = 0; i <= 65536; i+=stepping) {
+ final double in = i;
+ final char packed = Binary16.packDouble(in);
+ final float r = Binary16.unpackFloat(packed);
+ if( verbose ) {
+ System.out.println(String.format(
+ "packed: 0x%04x 0b%s in: %f unpacked: %f",
+ (int) packed,
+ Binary16.toRawBinaryString(packed),
+ in,
+ r));
+ }
+
+ if (i <= 2048) {
+ Assert.assertEquals(in, r, 0.0);
+ }
+ if ((i > 2048) && (i <= 4096)) {
+ Assert.assertTrue((r % 2) == 0);
+ }
+ if ((i > 4096) && (i <= 8192)) {
+ Assert.assertTrue((r % 4) == 0);
+ }
+ if ((i > 8192) && (i <= 16384)) {
+ Assert.assertTrue((r % 8) == 0);
+ }
+ if ((i > 16384) && (i <= 32768)) {
+ Assert.assertTrue((r % 16) == 0);
+ }
+ if ((i > 32768) && (i < 65536)) {
+ Assert.assertTrue((r % 32) == 0);
+ }
+ if (i == 65536) {
+ Assert.assertTrue(Double.isInfinite(r));
+ }
+ }
+ }
+
+ /**
+ * Integers in the range [0, 65520] should be representable.
+ */
+
+ @SuppressWarnings({ "static-method", "boxing" }) @Test public
+ void
+ testPackFloatDoubleEquivalent()
+ {
+ for (int i = 0; i <= 65536; i+=stepping) {
+ final float f_in = i;
+ final double d_in = i;
+ final char pf = Binary16.packFloat(f_in);
+ final char pd = Binary16.packDouble(d_in);
+
+ if( verbose ) {
+ System.out.println("i: " + i);
+ System.out.println(String.format(
+ "pack_f: 0x%04x 0b%s",
+ (int) pf,
+ Binary16.toRawBinaryString(pf)));
+ System.out.println(String.format(
+ "pack_d: 0x%04x 0b%s",
+ (int) pd,
+ Binary16.toRawBinaryString(pd)));
+ }
+
+ Assert.assertEquals(pf, pd);
+ }
+ }
+
+ /**
+ * Packing NaN results in NaN.
+ */
+
+ @SuppressWarnings("static-method") @Test public void testPackFloatNaN()
+ {
+ final float k = Float.NaN;
+ final char r = Binary16.packFloat(k);
+ Assert.assertTrue(Binary16.isNaN(r));
+ }
+
+ /**
+ * Packing negative infinity results in negative infinity.
+ */
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testPackFloatNegativeInfinity()
+ {
+ Assert.assertTrue(Binary16.NEGATIVE_INFINITY == Binary16
+ .packFloat(Float.NEGATIVE_INFINITY));
+ }
+
+ /**
+ * Packing negative zero results in negative zero.
+ */
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testPackFloatNegativeZero()
+ {
+ Assert.assertTrue(Binary16.NEGATIVE_ZERO == Binary16.packFloat(-0.0f));
+ }
+
+ /**
+ * Packing positive infinity results in positive infinity.
+ */
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testPackFloatPositiveInfinity()
+ {
+ Assert.assertTrue(Binary16.POSITIVE_INFINITY == Binary16
+ .packFloat(Float.POSITIVE_INFINITY));
+ }
+
+ /**
+ * Packing positive zero results in positive zero.
+ */
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testPackFloatPositiveZero()
+ {
+ Assert.assertTrue(Binary16.POSITIVE_ZERO == Binary16.packFloat(0.0f));
+ }
+
+ /**
+ * Integers in the range [0, 65520] should be representable.
+ */
+
+ @SuppressWarnings({ "static-method", "boxing" }) @Test public
+ void
+ testPackFloatUnpackDouble()
+ {
+ for (int i = 0; i <= 65536; i+=stepping) {
+ final float in = i;
+ final char packed = Binary16.packFloat(in);
+ final double r = Binary16.unpackDouble(packed);
+ if( verbose ) {
+ System.out.println(String.format(
+ "packed: 0x%04x 0b%s in: %f unpacked: %f",
+ (int) packed,
+ Binary16.toRawBinaryString(packed),
+ in,
+ r));
+ }
+
+ if (i <= 2048) {
+ Assert.assertEquals(in, r, 0.0);
+ }
+ if ((i > 2048) && (i <= 4096)) {
+ Assert.assertTrue((r % 2) == 0);
+ }
+ if ((i > 4096) && (i <= 8192)) {
+ Assert.assertTrue((r % 4) == 0);
+ }
+ if ((i > 8192) && (i <= 16384)) {
+ Assert.assertTrue((r % 8) == 0);
+ }
+ if ((i > 16384) && (i <= 32768)) {
+ Assert.assertTrue((r % 16) == 0);
+ }
+ if ((i > 32768) && (i < 65536)) {
+ Assert.assertTrue((r % 32) == 0);
+ }
+ if (i == 65536) {
+ Assert.assertTrue(Double.isInfinite(r));
+ }
+ }
+ }
+
+ /**
+ * Integers in the range [0, 65520] should be representable.
+ */
+
+ @SuppressWarnings({ "static-method", "boxing" }) @Test public
+ void
+ testPackUnpackDouble()
+ {
+ for (int i = 0; i <= 65536; i+=stepping) {
+ final double in = i;
+ final char packed = Binary16.packDouble(in);
+ final double r = Binary16.unpackDouble(packed);
+ if( verbose ) {
+ System.out.println(String.format(
+ "packed: 0x%04x 0b%s in: %f unpacked: %f",
+ (int) packed,
+ Binary16.toRawBinaryString(packed),
+ in,
+ r));
+ }
+
+ if (i <= 2048) {
+ Assert.assertEquals(in, r, 0.0);
+ }
+ if ((i > 2048) && (i <= 4096)) {
+ Assert.assertTrue((r % 2) == 0);
+ }
+ if ((i > 4096) && (i <= 8192)) {
+ Assert.assertTrue((r % 4) == 0);
+ }
+ if ((i > 8192) && (i <= 16384)) {
+ Assert.assertTrue((r % 8) == 0);
+ }
+ if ((i > 16384) && (i <= 32768)) {
+ Assert.assertTrue((r % 16) == 0);
+ }
+ if ((i > 32768) && (i < 65536)) {
+ Assert.assertTrue((r % 32) == 0);
+ }
+ if (i == 65536) {
+ Assert.assertTrue(Double.isInfinite(r));
+ }
+ }
+ }
+
+ /**
+ * Integers in the range [0, 65520] should be representable.
+ */
+
+ @SuppressWarnings({ "static-method", "boxing" }) @Test public
+ void
+ testPackUnpackFloat()
+ {
+ for (int i = 0; i <= 65536; i+=stepping) {
+ final float in = i;
+ final char packed = Binary16.packFloat(in);
+ final float r = Binary16.unpackFloat(packed);
+ if( verbose ) {
+ System.out.println(String.format(
+ "packed: 0x%04x 0b%s in: %f unpacked: %f",
+ (int) packed,
+ Binary16.toRawBinaryString(packed),
+ in,
+ r));
+ }
+ if (i <= 2048) {
+ Assert.assertEquals(in, r, 0.0);
+ }
+ if ((i > 2048) && (i <= 4096)) {
+ Assert.assertTrue((r % 2) == 0);
+ }
+ if ((i > 4096) && (i <= 8192)) {
+ Assert.assertTrue((r % 4) == 0);
+ }
+ if ((i > 8192) && (i <= 16384)) {
+ Assert.assertTrue((r % 8) == 0);
+ }
+ if ((i > 16384) && (i <= 32768)) {
+ Assert.assertTrue((r % 16) == 0);
+ }
+ if ((i > 32768) && (i < 65536)) {
+ Assert.assertTrue((r % 32) == 0);
+ }
+ if (i == 65536) {
+ Assert.assertTrue(Float.isInfinite(r));
+ }
+ }
+ }
+
+ /**
+ * Signs in the range [0, 1] are encoded and decoded correctly.
+ */
+
+ @SuppressWarnings("static-method") @Test public void testSignIdentity()
+ {
+ System.out.println("-- Sign identities");
+ for (int e = 0; e <= 1; ++e) {
+ final char p = Binary16.packSetSignUnchecked(e);
+ final int u = Binary16.unpackGetSign(p);
+ if( verbose ) {
+ System.out.println("e: " + e +", p: "+Integer.toHexString(p)+", u: "+u);
+ }
+ Assert.assertEquals(e, u);
+ }
+ }
+
+ /**
+ * Significands in the range [0, 1023] are encoded and decoded correctly.
+ */
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testSignificandIdentity()
+ {
+ System.out.println("-- Significand identities");
+ for (int e = 0; e <= 1023; ++e) {
+ final char p = Binary16.packSetSignificandUnchecked(e);
+ final int u = Binary16.unpackGetSignificand(p);
+ if( verbose ) {
+ System.out.println("e: " + e +", p: "+Integer.toHexString(p)+", u: "+u);
+ }
+ Assert.assertEquals(e, u);
+ }
+ }
+
+ /**
+ * Unpacking NaN results in NaN.
+ */
+
+ @SuppressWarnings("static-method") @Test public void testUnpackDoubleNaN()
+ {
+ final double k = Binary16.unpackDouble(Binary16.exampleNaN());
+ Assert.assertTrue(Double.isNaN(k));
+ }
+
+ /**
+ * Unpacking negative infinity results in negative infinity.
+ */
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testUnpackDoubleNegativeInfinity()
+ {
+ Assert.assertTrue(Double.NEGATIVE_INFINITY == Binary16
+ .unpackDouble(Binary16.NEGATIVE_INFINITY));
+ }
+
+ /**
+ * Unpacking negative zero results in negative zero.
+ */
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testUnpackDoubleNegativeZero()
+ {
+ Assert.assertTrue(-0.0 == Binary16.unpackDouble(Binary16.NEGATIVE_ZERO));
+ }
+
+ /**
+ * Unpacking 1.0 results in 1.0.
+ */
+
+ @SuppressWarnings({ "static-method", "boxing" }) @Test public
+ void
+ testUnpackDoubleOne()
+ {
+ final char one = 0x3C00;
+ final double r = Binary16.unpackDouble(one);
+ System.out.println(String.format("0x%04x -> %f", (int) one, r));
+ Assert.assertEquals(r, 1.0, 0.0);
+ }
+
+ /**
+ * Unpacking -1.0 results in -1.0.
+ */
+
+ @SuppressWarnings({ "static-method", "boxing" }) @Test public
+ void
+ testUnpackDoubleOneNegative()
+ {
+ final char one = 0xBC00;
+ final double r = Binary16.unpackDouble(one);
+ System.out.println(String.format("0x%04x -> %f", (int) one, r));
+ Assert.assertEquals(r, -1.0, 0.0);
+ }
+
+ /**
+ * Unpacking positive infinity results in positive infinity.
+ */
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testUnpackDoublePositiveInfinity()
+ {
+ Assert.assertTrue(Double.POSITIVE_INFINITY == Binary16
+ .unpackDouble(Binary16.POSITIVE_INFINITY));
+ }
+
+ /**
+ * Unpacking positive zero results in positive zero.
+ */
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testUnpackDoublePositiveZero()
+ {
+ Assert.assertTrue(0.0 == Binary16.unpackDouble(Binary16.POSITIVE_ZERO));
+ }
+
+ /**
+ * Unpacking 2.0 results in 2.0.
+ */
+
+ @SuppressWarnings({ "static-method", "boxing" }) @Test public
+ void
+ testUnpackDoubleTwo()
+ {
+ final char one = 0x4000;
+ final double r = Binary16.unpackDouble(one);
+ System.out.println(String.format("%04x -> %f", (int) one, r));
+ Assert.assertEquals(r, 2.0, 0.0);
+ }
+
+ /**
+ * Unpacking -2.0 results in -2.0.
+ */
+
+ @SuppressWarnings({ "static-method", "boxing" }) @Test public
+ void
+ testUnpackDoubleTwoNegative()
+ {
+ final char one = 0xC000;
+ final double r = Binary16.unpackDouble(one);
+ System.out.println(String.format("%04x -> %f", (int) one, r));
+ Assert.assertEquals(r, -2.0, 0.0);
+ }
+
+ /**
+ * Unpacking NaN results in NaN.
+ */
+
+ @SuppressWarnings("static-method") @Test public void testUnpackFloatNaN()
+ {
+ final float k = Binary16.unpackFloat(Binary16.exampleNaN());
+ Assert.assertTrue(Float.isNaN(k));
+ }
+
+ /**
+ * Unpacking negative infinity results in negative infinity.
+ */
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testUnpackFloatNegativeInfinity()
+ {
+ Assert.assertTrue(Float.NEGATIVE_INFINITY == Binary16
+ .unpackFloat(Binary16.NEGATIVE_INFINITY));
+ }
+
+ /**
+ * Unpacking negative zero results in negative zero.
+ */
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testUnpackFloatNegativeZero()
+ {
+ Assert.assertTrue(-0.0 == Binary16.unpackFloat(Binary16.NEGATIVE_ZERO));
+ }
+
+ /**
+ * Unpacking 1.0 results in 1.0.
+ */
+
+ @SuppressWarnings({ "static-method", "boxing" }) @Test public
+ void
+ testUnpackFloatOne()
+ {
+ final char one = 0x3C00;
+ final float r = Binary16.unpackFloat(one);
+ System.out.println(String.format("0x%04x -> %f", (int) one, r));
+ Assert.assertEquals(r, 1.0, 0.0);
+ }
+
+ /**
+ * Unpacking -1.0 results in -1.0.
+ */
+
+ @SuppressWarnings({ "static-method", "boxing" }) @Test public
+ void
+ testUnpackFloatOneNegative()
+ {
+ final char one = 0xBC00;
+ final float r = Binary16.unpackFloat(one);
+ System.out.println(String.format("0x%04x -> %f", (int) one, r));
+ Assert.assertEquals(r, -1.0, 0.0);
+ }
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-stepping")) {
+ stepping = MiscUtils.atoi(args[++i], stepping);
+ } else if(args[i].equals("-verbose")) {
+ verbose = true;
+ }
+ }
+ org.junit.runner.JUnitCore.main(TestBinary16NOUI.class.getName());
+ }
+
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestBinary32NOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestBinary32NOUI.java
new file mode 100644
index 0000000..d2a9a92
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestBinary32NOUI.java
@@ -0,0 +1,93 @@
+/**
+ * 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.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.math;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.jogamp.opengl.math.Binary32;
+
+public class TestBinary32NOUI
+{
+ @SuppressWarnings("static-method") @Test public void testInfinityExponent()
+ {
+ Assert.assertEquals(
+ 128,
+ Binary32.unpackGetExponentUnbiased(Float.POSITIVE_INFINITY));
+ }
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testInfinityNegativeExponent()
+ {
+ Assert.assertEquals(
+ 128,
+ Binary32.unpackGetExponentUnbiased(Float.NEGATIVE_INFINITY));
+ }
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testInfinityNegativeSign()
+ {
+ Assert.assertEquals(1, Binary32.unpackGetSign(Float.NEGATIVE_INFINITY));
+ }
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testInfinityNegativeSignificand()
+ {
+ Assert.assertEquals(
+ 0,
+ Binary32.unpackGetSignificand(Float.NEGATIVE_INFINITY));
+ }
+
+ @SuppressWarnings("static-method") @Test public void testInfinitySign()
+ {
+ Assert.assertEquals(0, Binary32.unpackGetSign(Float.POSITIVE_INFINITY));
+ }
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testInfinitySignificand()
+ {
+ Assert.assertEquals(
+ 0,
+ Binary32.unpackGetSignificand(Float.POSITIVE_INFINITY));
+ }
+
+ @SuppressWarnings("static-method") @Test public void testNaNExponent()
+ {
+ Assert.assertEquals(128, Binary32.unpackGetExponentUnbiased(Float.NaN));
+ }
+
+ @SuppressWarnings("static-method") @Test public void testNaNSignificand()
+ {
+ Assert.assertTrue(Binary32.unpackGetSignificand(Float.NaN) > 0);
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestBinary64NOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestBinary64NOUI.java
new file mode 100644
index 0000000..f16ea2b
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestBinary64NOUI.java
@@ -0,0 +1,93 @@
+/**
+ * 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.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.math;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.jogamp.opengl.math.Binary64;
+
+public class TestBinary64NOUI
+{
+ @SuppressWarnings("static-method") @Test public void testInfinityExponent()
+ {
+ Assert.assertEquals(
+ 1024,
+ Binary64.unpackGetExponentUnbiased(Double.POSITIVE_INFINITY));
+ }
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testInfinityNegativeExponent()
+ {
+ Assert.assertEquals(
+ 1024,
+ Binary64.unpackGetExponentUnbiased(Double.NEGATIVE_INFINITY));
+ }
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testInfinityNegativeSign()
+ {
+ Assert.assertEquals(1, Binary64.unpackGetSign(Double.NEGATIVE_INFINITY));
+ }
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testInfinityNegativeSignificand()
+ {
+ Assert.assertEquals(
+ 0,
+ Binary64.unpackGetSignificand(Double.NEGATIVE_INFINITY));
+ }
+
+ @SuppressWarnings("static-method") @Test public void testInfinitySign()
+ {
+ Assert.assertEquals(0, Binary64.unpackGetSign(Double.POSITIVE_INFINITY));
+ }
+
+ @SuppressWarnings("static-method") @Test public
+ void
+ testInfinitySignificand()
+ {
+ Assert.assertEquals(
+ 0,
+ Binary64.unpackGetSignificand(Double.POSITIVE_INFINITY));
+ }
+
+ @SuppressWarnings("static-method") @Test public void testNaNExponent()
+ {
+ Assert.assertEquals(1024, Binary64.unpackGetExponentUnbiased(Double.NaN));
+ }
+
+ @SuppressWarnings("static-method") @Test public void testNaNSignificand()
+ {
+ Assert.assertTrue(Binary64.unpackGetSignificand(Double.NaN) > 0);
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil01MatrixMatrixMultNOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil01MatrixMatrixMultNOUI.java
index 83a1be4..3f22fec 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil01MatrixMatrixMultNOUI.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil01MatrixMatrixMultNOUI.java
@@ -30,9 +30,12 @@ package com.jogamp.opengl.test.junit.jogl.math;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.opengl.math.FloatUtil;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestFloatUtil01MatrixMatrixMultNOUI {
final float[] m1 = new float[]{ 1, 3, 4, 0,
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 32861f7..db40dad 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
@@ -32,10 +32,13 @@ import javax.media.opengl.glu.GLU;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* @author Julien Gouesse
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGluUnprojectDoubleNOUI {
@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 9951500..0f9a45f 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
@@ -32,7 +32,10 @@ import javax.media.opengl.glu.GLU;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGluUnprojectFloatNOUI {
@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 3d9bfed..fa18abd 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
@@ -42,6 +42,8 @@ import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.os.Platform;
import com.jogamp.opengl.math.FloatUtil;
@@ -50,6 +52,7 @@ import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.PMVMatrix;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestPMVMatrix01NEWT extends UITestCase {
static final float epsilon = 0.00001f;
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 0c66ad2..2c3a6f3 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
@@ -29,7 +29,9 @@
package com.jogamp.opengl.test.junit.jogl.math;
import org.junit.Before;
-import org.junit.Test;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.opengl.util.PMVMatrix;
@@ -41,6 +43,7 @@ import static org.junit.Assert.assertArrayEquals;
/**
* @author Thomas De Bodt
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestPMVMatrix02NOUI {
private PMVMatrix fMat;
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 81242ce..df14916 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
@@ -9,7 +9,10 @@ import com.jogamp.opengl.util.PMVMatrix;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestPMVMatrix03NOUI {
static final float epsilon = 0.00001f;
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 d8a2e78..2f5fb26 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
@@ -68,7 +68,10 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase {
static long durationPerTest = 150; // ms
static Robot robot;
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 f1408d3..3f0dae6 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
@@ -38,6 +38,8 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import javax.media.opengl.*;
@@ -45,6 +47,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
import java.io.IOException;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestOffscreen01GLPBufferNEWT extends UITestCase {
static GLProfile glpDefault;
static GLDrawableFactory glDrawableFactory;
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 0701d88..72cb7a5 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
@@ -36,6 +36,8 @@ import com.jogamp.newt.Window;
import com.jogamp.newt.opengl.GLWindow;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import javax.media.opengl.*;
@@ -47,6 +49,7 @@ import java.io.IOException;
* Using ES1 GL demo, since pixmap might not be hw accelerated,
* hence it is possible to not have GLSL.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestOffscreen02BitmapNEWT extends UITestCase {
static final int width = 640, height = 480;
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 f8fbe72..87d4daf 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -39,8 +39,12 @@ import org.eclipse.swt.layout.FillLayout ;
import org.eclipse.swt.widgets.Composite ;
import org.eclipse.swt.widgets.Display ;
import org.eclipse.swt.widgets.Shell ;
+
+import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import javax.media.opengl.GL ;
import javax.media.opengl.GL2 ;
@@ -49,8 +53,6 @@ import javax.media.opengl.GLCapabilities ;
import javax.media.opengl.GLEventListener ;
import javax.media.opengl.GLProfile;
-import junit.framework.Assert;
-
import com.jogamp.nativewindow.swt.SWTAccessor;
import com.jogamp.newt.NewtFactory;
import com.jogamp.newt.event.KeyAdapter;
@@ -64,64 +66,65 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
////////////////////////////////////////////////////////////////////////////////
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
-
+
static int duration = 500;
-
+
static class BigFlashingX implements GLEventListener
- {
+ {
float r = 0f, g = 0f, b = 0f;
-
+
public void init( GLAutoDrawable drawable )
{
GL2 gl = drawable.getGL().getGL2() ;
-
+
gl.glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ) ;
-
+
gl.glEnable( GL.GL_LINE_SMOOTH ) ;
gl.glEnable( GL.GL_BLEND ) ;
gl.glBlendFunc( GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA ) ;
}
-
+
public void reshape( GLAutoDrawable drawable, int x, int y, int width, int height )
{
- // System.err.println( ">>>>>>>> reshape " + x + ", " + y + ", " + width + ", " +height ) ;
+ // System.err.println( ">>>>>>>> reshape " + x + ", " + y + ", " + width + ", " +height ) ;
GL2 gl = drawable.getGL().getGL2() ;
-
+
gl.glViewport( 0, 0, width, height ) ;
-
+
gl.glMatrixMode( GL2.GL_PROJECTION ) ;
gl.glLoadIdentity() ;
gl.glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 ) ;
-
+
gl.glMatrixMode( GL2.GL_MODELVIEW ) ;
gl.glLoadIdentity() ;
}
-
+
public void display( GLAutoDrawable drawable )
{
- // System.err.println( ">>>> display" ) ;
+ // System.err.println( ">>>> display" ) ;
GL2 gl = drawable.getGL().getGL2() ;
-
+
// Sven: I could have been seeing things, but it seemed that if this
// glClear is in here twice it seems aggravates the problem. Not
// sure why other than it just takes longer, but this is pretty
// fast operation.
gl.glClear( GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT ) ;
gl.glClear( GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT ) ;
-
+
gl.glColor4f( r, g, b, 1.0f ) ;
-
+
gl.glBegin( GL.GL_LINES ) ;
{
gl.glVertex2f( -1.0f, 1.0f ) ;
gl.glVertex2f( 1.0f, -1.0f ) ;
-
+
gl.glVertex2f( -1.0f, -1.0f ) ;
gl.glVertex2f( 1.0f, 1.0f ) ;
}
gl.glEnd() ;
-
+
if(r<1f) {
r+=0.1f;
} else if(g<1f) {
@@ -134,25 +137,25 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
b = 0f;
}
}
-
+
public void dispose( GLAutoDrawable drawable )
{
}
}
-
+
////////////////////////////////////////////////////////////////////////////////
-
+
static class ResizeThread extends Thread {
volatile boolean shallStop = false;
- private Shell _shell ;
+ private final Shell _shell ;
private int _n ;
-
+
public ResizeThread( Shell shell )
{
super();
_shell = shell ;
}
-
+
final Runnable resizeAction = new Runnable() {
public void run()
{
@@ -169,10 +172,10 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
} catch (Exception e0) {
e0.printStackTrace();
Assert.assertTrue("Deadlock @ setSize: "+e0, false);
- }
+ }
++_n ;
} };
-
+
public void run()
{
// The problem was originally observed by grabbing the lower right
@@ -182,11 +185,11 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
//
// This loop simulates rapid resizing by the user by toggling
// the shell back-and-forth between two sizes.
-
+
System.err.println("[R-0 shallStop "+shallStop+", disposed "+_shell.isDisposed()+"]");
-
+
final Display display = _shell.getDisplay();
-
+
while( !shallStop && !_shell.isDisposed() )
{
try
@@ -194,8 +197,8 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
System.err.println("[R-n shallStop "+shallStop+", disposed "+_shell.isDisposed()+"]");
display.asyncExec( resizeAction );
display.wake();
-
- Thread.sleep( 50L ) ;
+
+ Thread.sleep( 50L ) ;
} catch( InterruptedException e ) {
break ;
}
@@ -203,26 +206,26 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
System.err.println("*R-Exit* shallStop "+shallStop+", disposed "+_shell.isDisposed());
}
}
-
+
////////////////////////////////////////////////////////////////////////////////
-
+
static class KeyfireThread extends Thread
{
volatile boolean shallStop = false;
Display _display;
Robot _robot;
int _n = 0;
-
+
public KeyfireThread(Robot robot, Display display)
{
_robot = robot;
_display = display;
}
-
+
public void run()
{
System.err.println("[K-0]");
-
+
while( !shallStop )
{
try {
@@ -242,26 +245,26 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
System.err.println("*K-Exit*");
}
}
-
+
////////////////////////////////////////////////////////////////////////////////
-
+
private volatile boolean shallStop = false;
-
+
static class SWT_DSC {
volatile Display display;
volatile Shell shell;
volatile Composite composite;
volatile com.jogamp.newt.Display swtNewtDisplay = null;
-
+
public void init() {
SWTAccessor.invoke(true, new Runnable() {
- public void run() {
+ public void run() {
display = new Display();
Assert.assertNotNull( display );
}});
-
+
display.syncExec(new Runnable() {
- public void run() {
+ public void run() {
shell = new Shell( display );
Assert.assertNotNull( shell );
shell.setLayout( new FillLayout() );
@@ -271,7 +274,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
}});
swtNewtDisplay = NewtFactory.createDisplay(null, false); // no-reuse
}
-
+
public void dispose() {
Assert.assertNotNull( display );
Assert.assertNotNull( shell );
@@ -294,17 +297,17 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
swtNewtDisplay = null;
display = null;
shell = null;
- composite = null;
+ composite = null;
}
}
-
+
@Test
public void test() throws InterruptedException, AWTException, InvocationTargetException {
final Robot robot = new Robot();
-
+
final SWT_DSC dsc = new SWT_DSC();
dsc.init();
-
+
final GLWindow glWindow;
{
final GLProfile gl2Profile = GLProfile.get( GLProfile.GL2 ) ;
@@ -317,38 +320,38 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
public void keyReleased(com.jogamp.newt.event.KeyEvent e) {
if( !e.isPrintableKey() || e.isAutoRepeat() ) {
return;
- }
+ }
System.err.print(".");
- glWindow.display();
- }
+ glWindow.display();
+ }
});
NewtCanvasSWT.create( dsc.composite, 0, glWindow ) ;
}
-
+
dsc.display.syncExec( new Runnable() {
public void run() {
dsc.shell.setText( "NewtCanvasSWT Resize Bug Demo" ) ;
dsc.shell.setSize( 400, 450 ) ;
dsc.shell.open() ;
} } );
-
+
AWTRobotUtil.requestFocus(robot, glWindow, false);
AWTRobotUtil.setMouseToClientLocation(robot, glWindow, 50, 50);
shallStop = false;
-
+
final ResizeThread resizer;
{
resizer = new ResizeThread( dsc.shell ) ;
resizer.start() ;
}
-
+
final KeyfireThread keyfire;
{
keyfire = new KeyfireThread( robot, dsc.display ) ;
keyfire.start() ;
}
-
+
{
final Thread t = new Thread(new Runnable() {
@Override
@@ -374,7 +377,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
t.setDaemon(true);
t.start();
}
-
+
try {
while( !shallStop && !dsc.display.isDisposed() ) {
dsc.display.syncExec( new Runnable() {
@@ -391,12 +394,12 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
e0.printStackTrace();
Assert.assertTrue("Deadlock @ dispatch: "+e0, false);
}
-
+
// canvas is disposed implicit, due to it's disposed listener !
-
+
dsc.dispose();
}
-
+
public static void main( String[] args ) {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
@@ -404,7 +407,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
}
}
System.out.println("durationPerTest: "+duration);
- org.junit.runner.JUnitCore.main(TestNewtCanvasSWTBug628ResizeDeadlockAWT.class.getName());
+ org.junit.runner.JUnitCore.main(TestNewtCanvasSWTBug628ResizeDeadlockAWT.class.getName());
}
-
+
}
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 7acc645..bcb4629 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
@@ -46,6 +46,8 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.After;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.nativewindow.swt.SWTAccessor;
import com.jogamp.newt.NewtFactory;
@@ -73,6 +75,7 @@ import com.jogamp.opengl.util.texture.TextureIO;
* SWT running on Mac OSX, i.e. to enforce UI action on the main thread.
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestNewtCanvasSWTGLn extends UITestCase {
static int duration = 250;
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 ee5dc7f..7cc19a7 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
@@ -51,6 +51,8 @@ import org.junit.Assert;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.os.Platform;
import com.jogamp.nativewindow.swt.SWTAccessor;
@@ -63,6 +65,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
* the SWT_AWT bridge.
* @author Wade Walker, et.al.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestSWTAccessor03AWTGLn extends UITestCase {
static int duration = 250;
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 4d279b3..fd6d370 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -37,8 +37,12 @@ import org.eclipse.swt.layout.FillLayout ;
import org.eclipse.swt.widgets.Composite ;
import org.eclipse.swt.widgets.Display ;
import org.eclipse.swt.widgets.Shell ;
+
+import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilities ;
@@ -46,7 +50,6 @@ import javax.media.opengl.GLProfile;
import jogamp.newt.swt.SWTEDTUtil;
import jogamp.newt.swt.event.SWTNewtEventFactory;
-import junit.framework.Assert;
import com.jogamp.nativewindow.swt.SWTAccessor;
import com.jogamp.newt.NewtFactory;
@@ -62,13 +65,14 @@ import com.jogamp.opengl.util.Animator;
////////////////////////////////////////////////////////////////////////////////
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestSWTBug643AsyncExec extends UITestCase {
-
+
static int duration = 500;
static boolean useAnimator = false;
-
+
////////////////////////////////////////////////////////////////////////////////
-
+
static void resetSWTAndNEWTEDTCounter() {
synchronized(swtCountSync) {
swtCount=0;
@@ -100,43 +104,43 @@ public class TestSWTBug643AsyncExec extends UITestCase {
}
}
static Object swtCountSync = new Object();
- static int swtCount = 0;
+ static int swtCount = 0;
static Object edtCountSync = new Object();
- static int edtCount = 0;
-
+ static int edtCount = 0;
+
////////////////////////////////////////////////////////////////////////////////
-
+
static class AsyncExecEDTFeederThread extends Thread {
volatile boolean shallStop = false;
- private Display swtDisplay ;
- private jogamp.newt.DisplayImpl newtDisplay;
+ private final Display swtDisplay ;
+ private final jogamp.newt.DisplayImpl newtDisplay;
private int swtN, newtN ;
-
+
public AsyncExecEDTFeederThread( Display swtDisplay, com.jogamp.newt.Display newtDisplay )
{
super();
this.swtDisplay = swtDisplay ;
this.newtDisplay = (jogamp.newt.DisplayImpl)newtDisplay;
}
-
+
final Runnable swtAsyncAction = new Runnable() {
public void run()
{
++swtN ; incrSWTCount();
System.err.println("[SWT A-i shallStop "+shallStop+"]: Counter[loc "+swtN+", glob: "+getSWTCount()+"]");
} };
-
+
final Runnable newtAsyncAction = new Runnable() {
public void run()
{
++newtN ; incrNEWTCount();
System.err.println("[NEWT A-i shallStop "+shallStop+"]: Counter[loc "+newtN+", glob: "+getNEWTCount()+"]");
} };
-
+
public void run()
{
System.err.println("[A-0 shallStop "+shallStop+"]");
-
+
while( !shallStop && !swtDisplay.isDisposed() )
{
try
@@ -148,7 +152,7 @@ public class TestSWTBug643AsyncExec extends UITestCase {
// only perform async exec on valid and already running NEWT EDT!
newtDisplay.runOnEDTIfAvail(false, newtAsyncAction);
}
- Thread.sleep( 50L ) ;
+ Thread.sleep( 50L ) ;
} catch( InterruptedException e ) {
break ;
}
@@ -156,34 +160,34 @@ public class TestSWTBug643AsyncExec extends UITestCase {
System.err.println("*R-Exit* shallStop "+shallStop);
}
}
-
+
////////////////////////////////////////////////////////////////////////////////
-
+
private volatile boolean shallStop = false;
-
+
static class SWT_DSC {
Display display;
Shell shell;
Composite composite;
-
+
public void init() {
SWTAccessor.invoke(true, new Runnable() {
- public void run() {
+ public void run() {
display = new Display();
Assert.assertNotNull( display );
}});
-
+
display.syncExec(new Runnable() {
- public void run() {
+ public void run() {
shell = new Shell( display );
Assert.assertNotNull( shell );
shell.setLayout( new FillLayout() );
composite = new Composite( shell, SWT.NO_BACKGROUND );
composite.setLayout( new FillLayout() );
Assert.assertNotNull( composite );
- }});
+ }});
}
-
+
public void dispose() {
Assert.assertNotNull( display );
Assert.assertNotNull( shell );
@@ -205,32 +209,32 @@ public class TestSWTBug643AsyncExec extends UITestCase {
}
display = null;
shell = null;
- composite = null;
+ composite = null;
}
}
-
+
private void testImpl(boolean useJOGLGLCanvas, boolean useNewtCanvasSWT, boolean glWindowPreVisible) throws InterruptedException, InvocationTargetException {
resetSWTAndNEWTEDTCounter();
-
+
final SWT_DSC dsc = new SWT_DSC();
dsc.init();
-
+
final com.jogamp.newt.Display newtDisplay;
{
final GLProfile gl2Profile = GLProfile.get( GLProfile.GL2 ) ;
final GLCapabilities caps = new GLCapabilities( gl2Profile ) ;
-
+
final GLAutoDrawable glad;
if( useJOGLGLCanvas ) {
final GearsES2 demo = new GearsES2();
- final GLCanvas glc = GLCanvas.create(dsc.composite, 0, caps, null, null);
+ final GLCanvas glc = GLCanvas.create(dsc.composite, 0, caps, null);
final SWTNewtEventFactory swtNewtEventFactory = new SWTNewtEventFactory();
swtNewtEventFactory.attachDispatchListener(glc, glc, demo.gearsMouse, demo.gearsKeys);
glc.addGLEventListener( demo ) ;
- glad = glc;
- newtDisplay = null;
+ glad = glc;
+ newtDisplay = null;
} else if( useNewtCanvasSWT ) {
- newtDisplay = NewtFactory.createDisplay(null, false); // no-reuse
+ newtDisplay = NewtFactory.createDisplay(null, false); // no-reuse
com.jogamp.newt.Screen screen = NewtFactory.createScreen(newtDisplay, 0);
final GLWindow glWindow = GLWindow.create( screen, caps ) ;
glWindow.addGLEventListener( new GearsES2() ) ;
@@ -238,10 +242,10 @@ public class TestSWTBug643AsyncExec extends UITestCase {
newtDisplay.setEDTUtil(new SWTEDTUtil(newtDisplay, dsc.display)); // Especially Windows requires creation access via same thread!
glWindow.setVisible(true);
AWTRobotUtil.waitForRealized(glWindow, true);
- Thread.sleep(120); // let it render a bit, before consumed by SWT
+ Thread.sleep(120); // let it render a bit, before consumed by SWT
}
glad = glWindow;
- NewtCanvasSWT.create( dsc.composite, 0, glWindow ) ;
+ NewtCanvasSWT.create( dsc.composite, 0, glWindow ) ;
} else {
throw new InternalError("XXX");
}
@@ -250,7 +254,7 @@ public class TestSWTBug643AsyncExec extends UITestCase {
animator.start();
}
}
-
+
System.err.println("**** Pre Shell Open");
dsc.display.syncExec( new Runnable() {
public void run() {
@@ -261,15 +265,15 @@ public class TestSWTBug643AsyncExec extends UITestCase {
System.err.println("**** Post Shell Open");
shallStop = false;
-
+
final int[] counterBeforeExit = new int[] { 0 /* SWT */, 0 /* NEWT */ };
-
+
final AsyncExecEDTFeederThread asyncExecFeeder;
{
asyncExecFeeder = new AsyncExecEDTFeederThread(dsc.display, newtDisplay) ;
asyncExecFeeder.start() ;
}
-
+
{
final Thread t = new Thread(new Runnable() {
@Override
@@ -277,7 +281,7 @@ public class TestSWTBug643AsyncExec extends UITestCase {
try {
Thread.sleep(duration);
} catch (InterruptedException e) {}
-
+
counterBeforeExit[0] = getSWTCount();
counterBeforeExit[1] = getNEWTCount();
asyncExecFeeder.shallStop = true;
@@ -291,9 +295,9 @@ public class TestSWTBug643AsyncExec extends UITestCase {
t.setDaemon(true);
t.start();
}
-
+
try {
- final Display d = dsc.display;
+ final Display d = dsc.display;
while( !shallStop && !d.isDisposed() ) {
if( !d.readAndDispatch() && !shallStop ) {
// blocks on linux .. dsc.display.sleep();
@@ -304,11 +308,11 @@ public class TestSWTBug643AsyncExec extends UITestCase {
e0.printStackTrace();
Assert.assertTrue("Deadlock @ dispatch: "+e0, false);
}
-
+
// canvas is disposed implicit, due to it's disposed listener !
-
+
dsc.dispose();
-
+
System.err.println("EDT Counter before exit: SWT " + counterBeforeExit[0] + ", NEWT "+counterBeforeExit[1]);
Assert.assertTrue("SWT EDT Counter not greater zero before dispose!", 0 < counterBeforeExit[0]);
if( null != newtDisplay ) {
@@ -320,17 +324,17 @@ public class TestSWTBug643AsyncExec extends UITestCase {
public void test01JOGLGLCanvas() throws InterruptedException, InvocationTargetException {
testImpl(true /* useJOGLGLCanvas */, false /* useNewtCanvasSWT */, false /* glWindowPreVisible */);
}
-
+
@Test
public void test02NewtCanvasSWTSimple() throws InterruptedException, InvocationTargetException {
testImpl(false /* useJOGLGLCanvas */, true /* useNewtCanvasSWT */, false /* glWindowPreVisible */);
}
-
+
@Test
public void test02NewtCanvasSWTPreVisible() throws InterruptedException, InvocationTargetException {
testImpl(false /* useJOGLGLCanvas */, true /* useNewtCanvasSWT */, true /* glWindowPreVisible */);
}
-
+
public static void main( String[] args ) {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
@@ -340,7 +344,7 @@ public class TestSWTBug643AsyncExec extends UITestCase {
}
}
System.out.println("durationPerTest: "+duration);
- org.junit.runner.JUnitCore.main(TestSWTBug643AsyncExec.class.getName());
+ org.junit.runner.JUnitCore.main(TestSWTBug643AsyncExec.class.getName());
}
-
+
}
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 0bd47c9..b0acbed 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
@@ -52,6 +52,8 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.After;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.nativewindow.swt.SWTAccessor;
import com.jogamp.opengl.test.junit.jogl.demos.es1.OneTriangle;
@@ -64,6 +66,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
* </p>
* @author Wade Walker, et.al.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestSWTEclipseGLCanvas01GLn extends UITestCase {
static int duration = 250;
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 1822d2e..b38bf0c 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.swt;
import javax.media.opengl.GLAutoDrawable;
@@ -46,6 +46,8 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.After;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.nativewindow.swt.SWTAccessor;
import com.jogamp.opengl.swt.GLCanvas;
@@ -58,22 +60,23 @@ import com.jogamp.opengl.util.texture.TextureIO;
/**
* Tests that a basic SWT app can open without crashing under different GL profiles.
- * <p>
+ * <p>
* Uses JOGL's new SWT GLCanvas,
* which allows utilizing custom GLCapability settings,
* independent from the already instantiated SWT visual.
* </p>
* <p>
- * Note that {@link SWTAccessor#invoke(boolean, Runnable)} is still used to comply w/
+ * Note that {@link SWTAccessor#invoke(boolean, Runnable)} is still used to comply w/
* SWT running on Mac OSX, i.e. to enforce UI action on the main thread.
* </p>
* @author Wade Walker, et al.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestSWTJOGLGLCanvas01GLn extends UITestCase {
static int duration = 250;
static boolean doAnimation = true;
-
+
static final int iwidth = 640;
static final int iheight = 480;
@@ -89,12 +92,12 @@ public class TestSWTJOGLGLCanvas01GLn extends UITestCase {
@Before
public void init() {
SWTAccessor.invoke(true, new Runnable() {
- public void run() {
+ public void run() {
display = new Display();
Assert.assertNotNull( display );
}});
display.syncExec(new Runnable() {
- public void run() {
+ public void run() {
shell = new Shell( display );
Assert.assertNotNull( shell );
shell.setLayout( new FillLayout() );
@@ -131,14 +134,14 @@ public class TestSWTJOGLGLCanvas01GLn extends UITestCase {
protected void runTestAGL( GLCapabilitiesImmutable caps, GLEventListener demo ) throws InterruptedException {
final GLReadBufferUtil screenshot = new GLReadBufferUtil(false, false);
-
- final GLCanvas canvas = GLCanvas.create( composite, 0, caps, null, null);
+
+ final GLCanvas canvas = GLCanvas.create( composite, 0, caps, null);
Assert.assertNotNull( canvas );
canvas.addGLEventListener( demo );
canvas.addGLEventListener(new GLEventListener() {
int displayCount = 0;
- public void init(final GLAutoDrawable drawable) { }
+ public void init(final GLAutoDrawable drawable) { }
public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { }
public void display(final GLAutoDrawable drawable) {
if(displayCount < 3) {
@@ -146,21 +149,21 @@ public class TestSWTJOGLGLCanvas01GLn extends UITestCase {
}
}
public void dispose(final GLAutoDrawable drawable) { }
- });
-
+ });
+
display.syncExec(new Runnable() {
public void run() {
shell.setText( getSimpleTestName(".") );
shell.setSize( 640, 480 );
shell.open();
} } );
-
+
Animator anim = new Animator();
if(doAnimation) {
anim.add(canvas);
anim.start();
- }
-
+ }
+
long lStartTime = System.currentTimeMillis();
long lEndTime = lStartTime + duration;
try {
@@ -174,9 +177,9 @@ public class TestSWTJOGLGLCanvas01GLn extends UITestCase {
throwable.printStackTrace();
Assume.assumeNoException( throwable );
}
-
+
anim.stop();
-
+
display.syncExec(new Runnable() {
public void run() {
canvas.dispose();
@@ -195,7 +198,7 @@ public class TestSWTJOGLGLCanvas01GLn extends UITestCase {
caps.setNumSamples(2);
runTestAGL( caps, new MultisampleDemoES2(true) );
}
-
+
static int atoi(String a) {
int i=0;
try {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/OffscreenPrintable.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/OffscreenPrintable.java
new file mode 100644
index 0000000..78fdde3
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/OffscreenPrintable.java
@@ -0,0 +1,182 @@
+/**
+ * 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.
+ */
+package com.jogamp.opengl.test.junit.jogl.tile;
+
+import java.awt.Container;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Insets;
+import java.awt.RenderingHints;
+import java.awt.image.BufferedImage;
+import java.awt.print.PageFormat;
+import java.awt.print.Paper;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+import java.io.File;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+
+import com.jogamp.common.util.awt.AWTEDTExecutor;
+import com.jogamp.nativewindow.awt.DirectDataBufferInt;
+import com.jogamp.opengl.util.TileRenderer;
+
+/**
+ * {@link Printable} implementation using NIO {@link DirectDataBufferInt} {@link BufferedImage}
+ * for offscreen rendered printing.
+ *
+ * @see OnscreenPrintable
+ * @see PrintableBase
+ */
+public class OffscreenPrintable extends PrintableBase implements Printable {
+
+ public final int imageType;
+ public final String pngFilename;
+
+ /**
+ *
+ * @param job
+ * @param printContainer
+ * @param printDPI
+ * @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples
+ * @param tileWidth custom tile width for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
+ * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
+ * @param imageType AWT BufferedImage type (must be one of the integer types)
+ * @param pngFilename TODO
+ */
+ public OffscreenPrintable(PrinterJob job, Container printContainer, int printDPI, int numSamples, int tileWidth, int tileHeight, int imageType, String pngFilename) {
+ super(job, printContainer, printDPI, numSamples, tileWidth, tileHeight);
+ this.imageType = imageType;
+ this.pngFilename = pngFilename;
+ }
+
+ @Override
+ public int print(Graphics g, PageFormat pf, int page) throws PrinterException {
+ if (page > 0) { // We have only one page, and 'page' is zero-based
+ return NO_SUCH_PAGE;
+ }
+
+ lockPrinting.lock();
+ try {
+ final Paper paper = pf.getPaper();
+ final double paperWWidthInch = paper.getWidth() / 72.0;
+ final double paperWHeightInch = paper.getHeight() / 72.0;
+ final double paperIWidthInch = paper.getImageableWidth() / 72.0;
+ final double paperIHeightInch = paper.getImageableHeight() / 72.0;
+ final double paperWWidthMM = paperWWidthInch * MM_PER_INCH;
+ final double paperWHeightMM = paperWHeightInch * MM_PER_INCH;
+ final double paperIWidthMM = paperIWidthInch * MM_PER_INCH;
+ final double paperIHeightMM = paperIHeightInch * MM_PER_INCH;
+
+ final double pfWWidthInch = pf.getWidth() / 72.0;
+ final double pfWHeightInch = pf.getHeight() / 72.0;
+ final double pfIWidthInch = pf.getImageableWidth() / 72.0;
+ final double pfIHeightInch = pf.getImageableHeight() / 72.0;
+ final double pfWWidthMM = pfWWidthInch * MM_PER_INCH;
+ final double pfWHeightMM = pfWHeightInch * MM_PER_INCH;
+ final double pfIWidthMM = pfIWidthInch * MM_PER_INCH;
+ final double pfIHeightMM = pfIHeightInch * MM_PER_INCH;
+
+ System.err.println("PF: Paper whole size "+
+ Math.round(paperWWidthMM)+" x "+Math.round(paperWHeightMM)+" mm, "+
+ Math.round(paperWWidthInch)+" x "+Math.round(paperWHeightInch)+" inch");
+
+ System.err.println("PF: Paper image size "+paper.getImageableX()+" / "+paper.getImageableY()+" "+
+ Math.round(paperIWidthMM)+" x "+Math.round(paperIHeightMM)+" mm, "+
+ Math.round(paperIWidthInch)+" x "+Math.round(paperIHeightInch)+" inch, "+
+ Math.round(paper.getImageableWidth())+"x"+Math.round(paper.getImageableHeight())+" 72dpi dots");
+
+ System.err.println("PF: Page whole size "+
+ Math.round(pfWWidthMM)+" x "+Math.round(pfWHeightMM)+" mm, "+
+ Math.round(pfWWidthInch)+" x "+Math.round(pfWHeightInch)+" inch");
+
+ System.err.println("PF: Page image size "+pf.getImageableX()+" / "+pf.getImageableY()+" "+
+ Math.round(pfIWidthMM)+" x "+Math.round(pfIHeightMM)+" mm, "+
+ Math.round(pfIWidthInch)+" x "+Math.round(pfIHeightInch)+" inch, "+
+ Math.round(pf.getImageableWidth())+"x"+Math.round(pf.getImageableHeight())+" 72dpi dots");
+
+ System.err.println("PF: Page orientation "+pf.getOrientation());
+
+ /**
+ * See: 'Scaling of Frame and GL content' in Class description!
+ * Note: Frame size contains the frame border (i.e. insets)!
+ */
+ final Insets frameInsets = cont.getInsets();
+ final int frameWidth = cont.getWidth();
+ final int frameHeight= cont.getHeight();
+ final double scaleGraphics = dpi / 72.0;
+ final int frameSWidth = (int) ( frameWidth * scaleGraphics );
+ final int frameSHeight = (int) ( frameHeight * scaleGraphics );
+ final double scaleComp72;
+ {
+ final double sx = pf.getImageableWidth() / (double)frameSWidth;
+ final double sy = pf.getImageableHeight() / (double)frameSHeight;
+ scaleComp72 = Math.min(sx, sy);
+ }
+
+ System.err.println("PRINT.offscrn thread "+Thread.currentThread().getName());
+ System.err.println("PRINT.offscrn DPI: scaleGraphics "+scaleGraphics+", scaleComp72 "+scaleComp72);
+ System.err.println("PRINT.offscrn DPI: frame: border "+frameInsets+", size "+frameWidth+"x"+frameHeight+
+ " -> scaled "+frameSWidth+ "x" + frameSHeight);
+
+ final BufferedImage image = DirectDataBufferInt.createBufferedImage(frameSWidth, frameSHeight, imageType, null /* location */, null /* properties */);
+ {
+ System.err.println("PRINT.offscrn image "+image);
+ final Graphics2D g2d = (Graphics2D) image.getGraphics();
+ g2d.setClip(0, 0, frameSWidth, frameSHeight);
+ g2d.scale(scaleGraphics, scaleGraphics);
+ // g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+ AWTEDTExecutor.singleton.invoke(true, new Runnable() {
+ public void run() {
+ cont.printAll(g2d);
+ }
+ });
+ }
+ if( null != pngFilename ) {
+ final File fout = new File(pngFilename);
+ try {
+ ImageIO.write(image, "png", fout);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ final Graphics2D g2d = (Graphics2D)g;
+ g2d.translate(pf.getImageableX(), pf.getImageableY());
+ g2d.scale(scaleComp72, scaleComp72);
+ g2d.drawImage(image, 0, 0, image.getWidth(), image.getHeight(), null); // Null ImageObserver since image data is ready.
+
+ /* tell the caller that this page is part of the printed document */
+ return PAGE_EXISTS;
+ } finally {
+ lockPrinting.unlock();
+ }
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/OnscreenPrintable.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/OnscreenPrintable.java
new file mode 100644
index 0000000..6f73ef2
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/OnscreenPrintable.java
@@ -0,0 +1,165 @@
+/**
+ * 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.
+ */
+package com.jogamp.opengl.test.junit.jogl.tile;
+
+import java.awt.Container;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Insets;
+import java.awt.RenderingHints;
+import java.awt.print.PageFormat;
+import java.awt.print.Paper;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+
+import com.jogamp.common.util.awt.AWTEDTExecutor;
+import com.jogamp.opengl.util.TileRenderer;
+
+/**
+ * <h5>Scaling of Frame and GL content</h5>
+ * <p>
+ * We fit the frame into the imageable area with for 72 dpi,
+ * assuming that is the default AWT painting density.
+ * </p>
+ * <p>
+ * The frame borders are considered.
+ * </p>
+ * <p>
+ * The frame's scale factor is used for the graphics print matrix
+ * of the overall print-job, hence no frame resize is required.
+ * </p>
+ * <p>
+ * The GL scale factor 'scaleGLMatXY', 72dpi/glDPI, is passed to the GL object
+ * which locally scales the print matrix and renders the scene with 1/scaleGLMatXY pixels.
+ * </p>
+ */
+public class OnscreenPrintable extends PrintableBase implements Printable {
+
+ /**
+ *
+ * @param job
+ * @param printContainer
+ * @param printDPI
+ * @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples
+ * @param tileWidth custom tile width for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
+ * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
+ */
+ public OnscreenPrintable(PrinterJob job, Container printContainer, int printDPI, int numSamples, int tileWidth, int tileHeight) {
+ super(job, printContainer, printDPI, numSamples, tileWidth, tileHeight);
+ }
+
+
+ @Override
+ public int print(Graphics g, PageFormat pf, int page) throws PrinterException {
+ if (page > 0) { // We have only one page, and 'page' is zero-based
+ return NO_SUCH_PAGE;
+ }
+
+ lockPrinting.lock();
+ try {
+ final Paper paper = pf.getPaper();
+ final double paperWWidthInch = paper.getWidth() / 72.0;
+ final double paperWHeightInch = paper.getHeight() / 72.0;
+ final double paperIWidthInch = paper.getImageableWidth() / 72.0;
+ final double paperIHeightInch = paper.getImageableHeight() / 72.0;
+ final double paperWWidthMM = paperWWidthInch * MM_PER_INCH;
+ final double paperWHeightMM = paperWHeightInch * MM_PER_INCH;
+ final double paperIWidthMM = paperIWidthInch * MM_PER_INCH;
+ final double paperIHeightMM = paperIHeightInch * MM_PER_INCH;
+
+ final double pfWWidthInch = pf.getWidth() / 72.0;
+ final double pfWHeightInch = pf.getHeight() / 72.0;
+ final double pfIWidthInch = pf.getImageableWidth() / 72.0;
+ final double pfIHeightInch = pf.getImageableHeight() / 72.0;
+ final double pfWWidthMM = pfWWidthInch * MM_PER_INCH;
+ final double pfWHeightMM = pfWHeightInch * MM_PER_INCH;
+ final double pfIWidthMM = pfIWidthInch * MM_PER_INCH;
+ final double pfIHeightMM = pfIHeightInch * MM_PER_INCH;
+
+ System.err.println("PF: Paper whole size "+
+ Math.round(paperWWidthMM)+" x "+Math.round(paperWHeightMM)+" mm, "+
+ Math.round(paperWWidthInch)+" x "+Math.round(paperWHeightInch)+" inch");
+
+ System.err.println("PF: Paper image size "+paper.getImageableX()+" / "+paper.getImageableY()+" "+
+ Math.round(paperIWidthMM)+" x "+Math.round(paperIHeightMM)+" mm, "+
+ Math.round(paperIWidthInch)+" x "+Math.round(paperIHeightInch)+" inch, "+
+ Math.round(paper.getImageableWidth())+"x"+Math.round(paper.getImageableHeight())+" 72dpi dots");
+
+ System.err.println("PF: Page whole size "+
+ Math.round(pfWWidthMM)+" x "+Math.round(pfWHeightMM)+" mm, "+
+ Math.round(pfWWidthInch)+" x "+Math.round(pfWHeightInch)+" inch");
+
+ System.err.println("PF: Page image size "+pf.getImageableX()+" / "+pf.getImageableY()+" "+
+ Math.round(pfIWidthMM)+" x "+Math.round(pfIHeightMM)+" mm, "+
+ Math.round(pfIWidthInch)+" x "+Math.round(pfIHeightInch)+" inch, "+
+ Math.round(pf.getImageableWidth())+"x"+Math.round(pf.getImageableHeight())+" 72dpi dots");
+
+ System.err.println("PF: Page orientation "+pf.getOrientation());
+
+ /**
+ * See: 'Scaling of Frame and GL content' in Class description!
+ * Note: Frame size contains the frame border (i.e. insets)!
+ */
+ final Insets frameInsets = cont.getInsets();
+ final int frameWidth = cont.getWidth();
+ final int frameHeight= cont.getHeight();
+ final double scaleGraphics = dpi / 72.0;
+ final int frameSWidth = (int) ( frameWidth * scaleGraphics );
+ final int frameSHeight = (int) ( frameHeight * scaleGraphics );
+ final double scaleComp72;
+ {
+ final double sx = pf.getImageableWidth() / (double)frameWidth;
+ final double sy = pf.getImageableHeight() / (double)frameHeight;
+ scaleComp72 = Math.min(sx, sy);
+ }
+ System.err.println("PRINT.onscrn thread "+Thread.currentThread().getName());
+ System.err.println("PRINT.onscrn DPI: scaleGraphics "+scaleGraphics+", scaleComp72 "+scaleComp72);
+ System.err.println("PRINT.onscrn DPI: frame: border "+frameInsets+", size "+frameWidth+"x"+frameHeight+
+ " -> scaled "+frameSWidth+ "x" + frameSHeight);
+
+ final Graphics2D g2d = (Graphics2D)g;
+ System.err.println("PRINT at.pre: "+g2d.getTransform());
+ g2d.translate(pf.getImageableX(), pf.getImageableY());
+ g2d.scale(scaleComp72, scaleComp72); // WARNING: Produces rounding artifacts due to diff scale-factor of AWT/GL comps !!!
+ // g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+
+ AWTEDTExecutor.singleton.invoke(true, new Runnable() {
+ public void run() {
+ cont.printAll(g2d);
+ }
+ });
+
+ /* tell the caller that this page is part of the printed document */
+ return PAGE_EXISTS;
+ } finally {
+ lockPrinting.unlock();
+ }
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/PrintableBase.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/PrintableBase.java
new file mode 100644
index 0000000..dd9de60
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/PrintableBase.java
@@ -0,0 +1,88 @@
+/**
+ * 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.
+ */
+package com.jogamp.opengl.test.junit.jogl.tile;
+
+import java.awt.Container;
+import java.awt.print.Printable;
+import java.awt.print.PrinterJob;
+
+import com.jogamp.common.util.locks.LockFactory;
+import com.jogamp.common.util.locks.RecursiveLock;
+import com.jogamp.opengl.util.TileRenderer;
+
+/**
+ * Base {@link Printable} implementation class.
+ *
+ * <h5>Virtual printer driver</h5>
+ * <p>
+ * Note, on OSX you might need to setup a dummy printer, i.e. <i>print to file</i>.<br>
+ * As root:
+ * <pre>
+ cupsctl FileDevice=Yes
+ killall -HUP cupsd
+ mkdir /data/lp
+ chown USER /data/lp
+ chmod ugo+rwx /data/lp
+ lpadmin -p lprint -E -v file:/data/lp/out.ps -P /Library/Printers/PPDs/Contents/Resources/HP\ LaserJet\ 4\ Plus.gz
+ * </pre>
+ */
+public abstract class PrintableBase implements Printable {
+
+ public static final double MM_PER_INCH = 25.4;
+
+ public final PrinterJob job;
+ public final Container cont;
+ public final int dpi;
+ public final int numSamples;
+ public final int tileWidth, tileHeight;
+ protected final RecursiveLock lockPrinting = LockFactory.createRecursiveLock();
+
+ /**
+ *
+ * @param job
+ * @param printContainer
+ * @param printDPI
+ * @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples
+ * @param tileWidth custom tile width for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
+ * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
+ */
+ public PrintableBase(PrinterJob job, Container printContainer, int printDPI, int numSamples, int tileWidth, int tileHeight) {
+ this.job = job;
+ this.cont = printContainer;
+ this.dpi = printDPI;
+ this.numSamples = numSamples;
+ this.tileWidth = tileWidth;
+ this.tileHeight = tileHeight;
+ }
+
+ /** Wait for idle .. simply acquiring all locks and releasing them. */
+ public void waitUntilIdle() {
+ lockPrinting.lock();
+ lockPrinting.unlock();
+ }
+}
\ No newline at end of file
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
new file mode 100644
index 0000000..16c1b33
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java
@@ -0,0 +1,193 @@
+/**
+ * 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.
+ */
+package com.jogamp.opengl.test.junit.jogl.tile;
+
+import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.GLPixelBuffer;
+import com.jogamp.opengl.util.RandomTileRenderer;
+import com.jogamp.opengl.util.TileRendererBase;
+import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes;
+import com.jogamp.opengl.util.texture.TextureData;
+import com.jogamp.opengl.util.texture.TextureIO;
+
+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 org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+/**
+ * Demos offscreen {@link GLAutoDrawable} being used for
+ * {@link RandomTileRenderer} rendering to produce a PNG file.
+ * <p>
+ * {@link RandomTileRenderer} is being kicked off from the main thread.
+ * </p>
+ * <p>
+ * {@link RandomTileRenderer} buffer allocation is performed
+ * within the pre {@link GLEventListener}
+ * set via {@link TileRendererBase#setGLEventListener(GLEventListener, GLEventListener)}
+ * on the main thread.
+ * </p>
+ * <p>
+ * At tile rendering finish, the viewport and
+ * and the original {@link GLEventListener}'s PMV matrix as well.
+ * The latter is done by calling it's {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape} method.
+ * </p>
+*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestRandomTiledRendering2GL2NEWT extends UITestCase {
+ static long duration = 500; // ms
+
+ @Test
+ public void test01_aa0() throws IOException, InterruptedException, InvocationTargetException {
+ doTest(0);
+ }
+ @Test
+ public void test02_aa8() throws IOException, InterruptedException, InvocationTargetException {
+ doTest(8);
+ }
+
+ void doTest(int msaaCount) throws IOException, InterruptedException, InvocationTargetException {
+ final GLCapabilities caps = new GLCapabilities(null);
+ caps.setDoubleBuffered(true);
+ if( msaaCount > 0 ) {
+ caps.setSampleBuffers(true);
+ caps.setNumSamples(msaaCount);
+ }
+
+ final int maxTileSize = 64;
+ final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
+ final GLOffscreenAutoDrawable glad = factory.createOffscreenAutoDrawable(null, caps, null, maxTileSize, maxTileSize);
+
+ final Gears gears = new Gears();
+ glad.addGLEventListener( gears );
+
+ // Fix the image size for now
+ final int imageWidth = 256 * 6;
+ final int imageHeight = 256 * 4;
+
+ final String filename = this.getSnapshotFilename(0, "-tile", glad.getChosenGLCapabilities(), imageWidth, imageHeight, false, TextureIO.PNG, null);
+ final File file = new File(filename);
+
+ // Initialize the tile rendering library
+ final RandomTileRenderer renderer = new RandomTileRenderer();
+ renderer.attachAutoDrawable(glad);
+ renderer.setImageSize(imageWidth, imageHeight);
+
+ final GLPixelBuffer.GLPixelBufferProvider pixelBufferProvider = GLPixelBuffer.defaultProviderWithRowStride;
+ final boolean[] flipVertically = { false };
+
+ final GLEventListener preTileGLEL = new GLEventListener() {
+ @Override
+ public void init(GLAutoDrawable drawable) {
+ final GL gl = drawable.getGL();
+ GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, 3);
+ GLPixelBuffer pixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, imageWidth, imageHeight, 1, true, 0);
+ renderer.setImageBuffer(pixelBuffer);
+ if( drawable.isGLOriented() ) {
+ flipVertically[0] = false;
+ } else {
+ flipVertically[0] = true;
+ }
+ }
+ @Override
+ public void dispose(GLAutoDrawable drawable) {}
+ @Override
+ public void display(GLAutoDrawable drawable) {}
+ @Override
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {}
+ };
+ renderer.setGLEventListener(preTileGLEL, null);
+
+ final int w = maxTileSize, h = maxTileSize;
+ int dx = 0, dy = 0;
+ while( dx+w <= imageWidth && dy+h <= imageHeight ) {
+ renderer.display(dx, dy, w, h);
+ dx+=w+w/2;
+ if( dx + w > imageWidth ) {
+ dx = 0;
+ dy+=h+h/2;
+ }
+ }
+
+ renderer.detachAutoDrawable();
+
+ // Restore viewport and Gear's PMV matrix
+ // .. even though we close the demo, this is for documentation!
+ glad.invoke(true, new GLRunnable() {
+ @Override
+ public boolean run(GLAutoDrawable drawable) {
+ drawable.getGL().glViewport(0, 0, drawable.getWidth(), drawable.getHeight());
+ gears.reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight());
+ return false;
+ }
+ });
+
+ glad.destroy();
+
+ final GLPixelBuffer imageBuffer = renderer.getImageBuffer();
+ imageBuffer.clear(); // full size available
+ System.err.println("XXX2: "+imageBuffer);
+ final TextureData textureData = new TextureData(
+ caps.getGLProfile(),
+ 0 /* internalFormat */,
+ imageWidth, imageHeight,
+ 0,
+ imageBuffer.pixelAttributes,
+ false, false,
+ flipVertically[0],
+ imageBuffer.buffer,
+ null /* Flusher */);
+ System.err.println("XXX3: "+textureData.getPixelFormat()+", "+textureData.getPixelAttributes());
+
+ TextureIO.write(textureData, file);
+ }
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ try {
+ duration = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ }
+ }
+ org.junit.runner.JUnitCore.main(TestRandomTiledRendering2GL2NEWT.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..7d3f1f6
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java
@@ -0,0 +1,261 @@
+/**
+ * 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.
+ */
+package com.jogamp.opengl.test.junit.jogl.tile;
+
+import com.jogamp.newt.event.TraceKeyAdapter;
+import com.jogamp.newt.event.TraceWindowAdapter;
+import com.jogamp.newt.event.awt.AWTKeyAdapter;
+import com.jogamp.newt.event.awt.AWTWindowAdapter;
+import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.util.GLPixelBuffer;
+import com.jogamp.opengl.util.RandomTileRenderer;
+import com.jogamp.opengl.util.TileRendererBase;
+import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes;
+import com.jogamp.opengl.util.texture.TextureData;
+import com.jogamp.opengl.util.texture.TextureIO;
+
+import java.awt.Dimension;
+import java.awt.Frame;
+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 org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+/**
+ * Demos an onscreen AWT {@link GLCanvas} being used for
+ * {@link RandomTileRenderer} rendering to produce a PNG file.
+ * <p>
+ * {@link RandomTileRenderer} is being kicked off from the main thread.
+ * </p>
+ * <p>
+ * {@link RandomTileRenderer} setup and finishing is performed
+ * within the pre- and post {@link GLEventListener}
+ * set via {@link TileRendererBase#setGLEventListener(GLEventListener, GLEventListener)}
+ * on the animation thread.
+ * </p>
+ * <p>
+ * At tile rendering finish, the viewport and
+ * and the original {@link GLEventListener}'s PMV matrix as well.
+ * The latter is done by calling it's {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape} method.
+ * </p>
+ */
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestRandomTiledRendering3GL2AWT extends UITestCase {
+ static long duration = 3500; // ms
+ static int width = 512;
+ static int height = 512;
+
+ @Test
+ public void test01_aa0() throws IOException, InterruptedException, InvocationTargetException {
+ doTest(0);
+ }
+ @Test
+ public void test02_aa8() throws IOException, InterruptedException, InvocationTargetException {
+ doTest(8);
+ }
+
+ void doTest(int msaaCount) throws IOException, InterruptedException, InvocationTargetException {
+ final GLCapabilities caps = new GLCapabilities(null);
+ if( msaaCount > 0 ) {
+ caps.setSampleBuffers(true);
+ caps.setNumSamples(msaaCount);
+ }
+
+ final Frame frame = new Frame("Gears AWT Test");
+ Assert.assertNotNull(frame);
+
+ final GLCanvas glad = new GLCanvas(caps);
+ Assert.assertNotNull(glad);
+ Dimension glc_sz = new Dimension(width, height);
+ glad.setMinimumSize(glc_sz);
+ glad.setPreferredSize(glc_sz);
+ glad.setSize(glc_sz);
+ frame.add(glad);
+
+ final Gears gears = new Gears();
+ glad.addGLEventListener( gears );
+
+ final Animator animator = new Animator(glad);
+ final QuitAdapter quitAdapter = new QuitAdapter();
+
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glad);
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+
+ // Fix the image size for now
+ final int maxTileSize = 64;
+ final int imageWidth = 256 * 6;
+ final int imageHeight = 256 * 4;
+
+ // Initialize the tile rendering library
+ final RandomTileRenderer renderer = new RandomTileRenderer();
+ renderer.setImageSize(imageWidth, imageHeight);
+ final GLPixelBuffer.GLPixelBufferProvider pixelBufferProvider = GLPixelBuffer.defaultProviderWithRowStride;
+ final boolean[] flipVertically = { false };
+ final boolean[] rendererActive = { true };
+
+ final GLEventListener preTileGLEL = new GLEventListener() {
+ final int w = maxTileSize, h = maxTileSize;
+ int dx = 0, dy = 0;
+
+ @Override
+ public void init(GLAutoDrawable drawable) {
+ final GL gl = drawable.getGL();
+ GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, 3);
+ GLPixelBuffer pixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, imageWidth, imageHeight, 1, true, 0);
+ renderer.setImageBuffer(pixelBuffer);
+ if( drawable.isGLOriented() ) {
+ flipVertically[0] = false;
+ } else {
+ flipVertically[0] = true;
+ }
+ System.err.println("XXX pre-init: "+renderer);
+ }
+ @Override
+ public void dispose(GLAutoDrawable drawable) {}
+ @Override
+ public void display(GLAutoDrawable drawable) {
+ if( dx+w <= imageWidth && dy+h <= imageHeight ) {
+ renderer.setTileRect(dx, dy, w, h);
+ dx+=w+w/2;
+ if( dx + w > imageWidth ) {
+ dx = 0;
+ dy+=h+h/2;
+ }
+ } else if( rendererActive[0] ) {
+ rendererActive[0] = false;
+ }
+ System.err.println("XXX pre-display: "+renderer);
+ }
+ @Override
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {}
+ };
+ final GLEventListener postTileGLEL = new GLEventListener() {
+ @Override
+ public void init(GLAutoDrawable drawable) {}
+ @Override
+ public void dispose(GLAutoDrawable drawable) {}
+ @Override
+ public void display(GLAutoDrawable drawable) {
+ if( !rendererActive[0] ) {
+ final GLPixelBuffer imageBuffer = renderer.getImageBuffer();
+ imageBuffer.clear(); // full size available
+ System.err.println("XXX !active -> save");
+ System.err.println("XXX post-display: "+renderer);
+ final TextureData textureData = new TextureData(
+ caps.getGLProfile(),
+ 0 /* internalFormat */,
+ imageWidth, imageHeight,
+ 0,
+ imageBuffer.pixelAttributes,
+ false, false,
+ flipVertically[0],
+ imageBuffer.buffer,
+ null /* Flusher */);
+ try {
+ final String filename = getSnapshotFilename(0, "-tile", glad.getChosenGLCapabilities(), imageWidth, imageHeight, false, TextureIO.PNG, null);
+ final File file = new File(filename);
+ TextureIO.write(textureData, file);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ renderer.detachAutoDrawable();
+ System.err.println("XXX post-display detached: "+renderer);
+ drawable.getGL().glViewport(0, 0, drawable.getWidth(), drawable.getHeight());
+ glad.getGLEventListener(0).reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight());
+ }
+ }
+ @Override
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {}
+ };
+ renderer.setGLEventListener(preTileGLEL, postTileGLEL);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.pack();
+ frame.setVisible(true);
+ }});
+ animator.setUpdateFPSFrames(60, System.err);
+ animator.start();
+
+ boolean signalTileRenderer = true;
+
+ while(!quitAdapter.shouldQuit() && animator.isAnimating() &&
+ ( rendererActive[0] || animator.getTotalFPSDuration()<duration ) )
+ {
+ if( signalTileRenderer && animator.getTotalFPSDuration() > 90 ) {
+ signalTileRenderer = false;
+ // tile rendering !
+ System.err.println("XXX START TILE RENDERING");
+ renderer.attachAutoDrawable(glad);
+ }
+ Thread.sleep(100);
+ }
+
+ Assert.assertNotNull(frame);
+ Assert.assertNotNull(glad);
+ Assert.assertNotNull(animator);
+
+ animator.stop();
+ Assert.assertEquals(false, animator.isAnimating());
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setVisible(false);
+ }});
+ Assert.assertEquals(false, frame.isVisible());
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.remove(glad);
+ frame.dispose();
+ }});
+ }
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ try {
+ duration = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ }
+ }
+ org.junit.runner.JUnitCore.main(TestRandomTiledRendering3GL2AWT.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..30e0ba4
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java
@@ -0,0 +1,279 @@
+/**
+ * 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.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.tile;
+
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Label;
+import java.awt.Panel;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.image.BufferedImage;
+import java.awt.print.PageFormat;
+import java.io.BufferedReader;
+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 org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.newt.event.TraceKeyAdapter;
+import com.jogamp.newt.event.TraceWindowAdapter;
+import com.jogamp.newt.event.awt.AWTKeyAdapter;
+import com.jogamp.newt.event.awt.AWTWindowAdapter;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
+import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
+import com.jogamp.opengl.util.Animator;
+
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase {
+
+ static boolean waitForKey = false;
+ /** only when run manually .. */
+ static boolean allow600dpi = false;
+ static GLProfile glp;
+ static int width, height;
+
+ @BeforeClass
+ public static void initClass() {
+ if(GLProfile.isAvailable(GLProfile.GL2)) {
+ glp = GLProfile.get(GLProfile.GL2);
+ Assert.assertNotNull(glp);
+ width = 640;
+ height = 480;
+ } else {
+ setTestSupported(false);
+ }
+ // Runtime.getRuntime().traceInstructions(true);
+ // Runtime.getRuntime().traceMethodCalls(true);
+ }
+
+ @AfterClass
+ public static void releaseClass() {
+ }
+
+ protected void runTestGL(GLCapabilities caps) throws InterruptedException, InvocationTargetException {
+ final Dimension glc_sz = new Dimension(width/2, height);
+ final GLCanvas glCanvas1 = new GLCanvas(caps);
+ Assert.assertNotNull(glCanvas1);
+ glCanvas1.setMinimumSize(glc_sz);
+ glCanvas1.setPreferredSize(glc_sz);
+ glCanvas1.setSize(glc_sz);
+ glCanvas1.addGLEventListener(new Gears());
+
+ final GLCanvas glCanvas2 = new GLCanvas(caps);
+ Assert.assertNotNull(glCanvas2);
+ glCanvas2.setMinimumSize(glc_sz);
+ glCanvas2.setPreferredSize(glc_sz);
+ glCanvas2.setSize(glc_sz);
+ glCanvas2.addGLEventListener(new RedSquareES2());
+
+ final Panel demoPanel = new Panel();
+ demoPanel.add(glCanvas1);
+ demoPanel.add(glCanvas2);
+
+ final Frame frame = new Frame("AWT Print");
+ Assert.assertNotNull(frame);
+
+ final ActionListener print72DPIAction = new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ doPrintManual(frame, 72, 0, -1, -1);
+ } };
+ final ActionListener print300DPIAction = new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ doPrintManual(frame, 300, -1, -1, -1);
+ } };
+ final ActionListener print600DPIAction = new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ doPrintManual(frame, 600, -1, -1, -1);
+ } };
+ final Button print72DPIButton = new Button("72dpi");
+ print72DPIButton.addActionListener(print72DPIAction);
+ final Button print300DPIButton = new Button("300dpi");
+ print300DPIButton.addActionListener(print300DPIAction);
+ final Button print600DPIButton = new Button("600dpi");
+ print600DPIButton.addActionListener(print600DPIAction);
+
+ frame.setLayout(new BorderLayout());
+ Panel printPanel = new Panel();
+ printPanel.add(print72DPIButton);
+ printPanel.add(print300DPIButton);
+ printPanel.add(print600DPIButton);
+ Panel southPanel = new Panel();
+ southPanel.add(new Label("South"));
+ Panel eastPanel = new Panel();
+ eastPanel.add(new Label("East"));
+ Panel westPanel = new Panel();
+ westPanel.add(new Label("West"));
+ frame.add(printPanel, BorderLayout.NORTH);
+ frame.add(demoPanel, BorderLayout.CENTER);
+ frame.add(southPanel, BorderLayout.SOUTH);
+ frame.add(eastPanel, BorderLayout.EAST);
+ frame.add(westPanel, BorderLayout.WEST);
+ frame.setTitle("Tiles AWT Print Test");
+
+ Animator animator = new Animator();
+ animator.add(glCanvas1);
+ animator.add(glCanvas2);
+ QuitAdapter quitAdapter = new QuitAdapter();
+
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glCanvas1);
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glCanvas2);
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.pack();
+ frame.setVisible(true);
+ }});
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas2, true));
+
+ animator.setUpdateFPSFrames(60, System.err);
+ animator.start();
+
+ boolean printDone = false;
+ while(!quitAdapter.shouldQuit() && animator.isAnimating() && ( 0 == duration || animator.getTotalFPSDuration()<duration )) {
+ Thread.sleep(200);
+ if( !printDone ) {
+ printDone = true;
+ {
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 72, 0, -1, -1, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 72, 8, -1, -1, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, 2048, 2048, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, -1, -1, true /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, -1, -1, true/* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ if( allow600dpi ) {
+ // No AA needed for 300 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 600, -1, -1, -1, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ }
+ }
+
+ Assert.assertNotNull(frame);
+ Assert.assertNotNull(glCanvas1);
+ Assert.assertNotNull(glCanvas2);
+ Assert.assertNotNull(animator);
+
+ animator.stop();
+ Assert.assertEquals(false, animator.isAnimating());
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setVisible(false);
+ }});
+ Assert.assertEquals(false, frame.isVisible());
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ final Frame _frame = frame;
+ _frame.remove(demoPanel);
+ _frame.dispose();
+ }});
+ }
+
+ @Test
+ public void test01_aa0() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ runTestGL(caps);
+ }
+
+ @Test
+ public void test02_aa8() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setSampleBuffers(true);
+ caps.setNumSamples(8);
+ runTestGL(caps);
+ }
+
+ static long duration = 500; // ms
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ try {
+ duration = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ } else if(args[i].equals("-600dpi")) {
+ allow600dpi = true;
+ } else if(args[i].equals("-wait")) {
+ waitForKey = true;
+ }
+ }
+ if(waitForKey) {
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ System.err.println("Press enter to continue");
+ try {
+ System.err.println(stdin.readLine());
+ } catch (IOException e) { }
+ }
+ org.junit.runner.JUnitCore.main(TestTiledPrintingGearsAWT.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..ec1d7b1
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java
@@ -0,0 +1,286 @@
+/**
+ * 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.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.tile;
+
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Label;
+import java.awt.Panel;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.image.BufferedImage;
+import java.awt.print.PageFormat;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.lang.reflect.InvocationTargetException;
+
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLProfile;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.newt.awt.NewtCanvasAWT;
+import com.jogamp.newt.event.TraceKeyAdapter;
+import com.jogamp.newt.event.TraceWindowAdapter;
+import com.jogamp.newt.event.awt.AWTKeyAdapter;
+import com.jogamp.newt.event.awt.AWTWindowAdapter;
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
+import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
+import com.jogamp.opengl.util.Animator;
+
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestTiledPrintingGearsNewtAWT extends TiledPrintingAWTBase {
+
+ static boolean waitForKey = false;
+ /** only when run manually .. */
+ static boolean allow600dpi = false;
+ static GLProfile glp;
+ static int width, height;
+
+ @BeforeClass
+ public static void initClass() {
+ if(GLProfile.isAvailable(GLProfile.GL2)) {
+ glp = GLProfile.get(GLProfile.GL2);
+ Assert.assertNotNull(glp);
+ width = 640;
+ height = 480;
+ } else {
+ setTestSupported(false);
+ }
+ // Runtime.getRuntime().traceInstructions(true);
+ // Runtime.getRuntime().traceMethodCalls(true);
+ }
+
+ @AfterClass
+ public static void releaseClass() {
+ }
+
+ protected void runTestGL(GLCapabilities caps) throws InterruptedException, InvocationTargetException {
+ final Dimension glc_sz = new Dimension(width/2, height);
+ final GLWindow glad1 = GLWindow.create(caps);
+ Assert.assertNotNull(glad1);
+ final NewtCanvasAWT canvas1 = new NewtCanvasAWT(glad1);
+ Assert.assertNotNull(canvas1);
+ canvas1.setMinimumSize(glc_sz);
+ canvas1.setPreferredSize(glc_sz);
+ canvas1.setSize(glc_sz);
+ glad1.addGLEventListener(new Gears());
+
+ final GLWindow glad2 = GLWindow.create(caps);
+ Assert.assertNotNull(glad2);
+ final NewtCanvasAWT canvas2 = new NewtCanvasAWT(glad2);
+ Assert.assertNotNull(canvas2);
+ canvas2.setMinimumSize(glc_sz);
+ canvas2.setPreferredSize(glc_sz);
+ canvas2.setSize(glc_sz);
+ glad2.addGLEventListener(new RedSquareES2());
+
+ final Panel demoPanel = new Panel();
+ demoPanel.add(canvas1);
+ demoPanel.add(canvas2);
+
+ final Frame frame = new Frame("Newt/AWT Print");
+ Assert.assertNotNull(frame);
+
+ final ActionListener print72DPIAction = new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ doPrintManual(frame, 72, 0, -1, -1);
+ } };
+ final ActionListener print300DPIAction = new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ doPrintManual(frame, 300, -1, -1, -1);
+ } };
+ final ActionListener print600DPIAction = new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ doPrintManual(frame, 600, -1, -1, -1);
+ } };
+ final Button print72DPIButton = new Button("72dpi");
+ print72DPIButton.addActionListener(print72DPIAction);
+ final Button print300DPIButton = new Button("300dpi");
+ print300DPIButton.addActionListener(print300DPIAction);
+ final Button print600DPIButton = new Button("600dpi");
+ print600DPIButton.addActionListener(print600DPIAction);
+
+ frame.setLayout(new BorderLayout());
+ Panel printPanel = new Panel();
+ printPanel.add(print72DPIButton);
+ printPanel.add(print300DPIButton);
+ printPanel.add(print600DPIButton);
+ Panel southPanel = new Panel();
+ southPanel.add(new Label("South"));
+ Panel eastPanel = new Panel();
+ eastPanel.add(new Label("East"));
+ Panel westPanel = new Panel();
+ westPanel.add(new Label("West"));
+ frame.add(printPanel, BorderLayout.NORTH);
+ frame.add(demoPanel, BorderLayout.CENTER);
+ frame.add(southPanel, BorderLayout.SOUTH);
+ frame.add(eastPanel, BorderLayout.EAST);
+ frame.add(westPanel, BorderLayout.WEST);
+ frame.setTitle("Tiles Newt/AWT Print Test");
+
+ Animator animator = new Animator();
+ animator.add(glad1);
+ animator.add(glad2);
+ QuitAdapter quitAdapter = new QuitAdapter();
+
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(canvas1);
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(canvas2);
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.pack();
+ frame.setVisible(true);
+ }});
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(canvas1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(canvas2, true));
+
+ animator.setUpdateFPSFrames(60, System.err);
+ animator.start();
+
+ boolean printDone = false;
+ while(!quitAdapter.shouldQuit() && animator.isAnimating() && ( 0 == duration || animator.getTotalFPSDuration()<duration )) {
+ Thread.sleep(200);
+ if( !printDone ) {
+ printDone = true;
+ {
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 72, 0, -1, -1, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 72, 8, -1, -1, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, 2048, 2048, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, -1, -1, true /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, -1, -1, true /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ if( allow600dpi ) {
+ // No AA needed for 300 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 600, -1, -1, -1, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ }
+ }
+
+ Assert.assertNotNull(frame);
+ Assert.assertNotNull(canvas1);
+ Assert.assertNotNull(canvas2);
+ Assert.assertNotNull(animator);
+
+ animator.stop();
+ Assert.assertEquals(false, animator.isAnimating());
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setVisible(false);
+ }});
+ Assert.assertEquals(false, frame.isVisible());
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ final Frame _frame = frame;
+ _frame.remove(demoPanel);
+ _frame.dispose();
+ }});
+ glad1.destroy();
+ glad2.destroy();
+ }
+
+ @Test
+ public void test01_aa0() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ runTestGL(caps);
+ }
+
+ @Test
+ public void test02_aa8() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setSampleBuffers(true);
+ caps.setNumSamples(8);
+ runTestGL(caps);
+ }
+
+ static long duration = 500; // ms
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ try {
+ duration = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ } else if(args[i].equals("-600dpi")) {
+ allow600dpi = true;
+ } else if(args[i].equals("-wait")) {
+ waitForKey = true;
+ }
+ }
+ if(waitForKey) {
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ System.err.println("Press enter to continue");
+ try {
+ System.err.println(stdin.readLine());
+ } catch (IOException e) { }
+ }
+ org.junit.runner.JUnitCore.main(TestTiledPrintingGearsNewtAWT.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..72cb219
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java
@@ -0,0 +1,363 @@
+/**
+ * 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.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.tile;
+
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Label;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.image.BufferedImage;
+import java.awt.print.PageFormat;
+import java.io.BufferedReader;
+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 javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JLayeredPane;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.common.os.Platform;
+import com.jogamp.newt.event.TraceKeyAdapter;
+import com.jogamp.newt.event.TraceWindowAdapter;
+import com.jogamp.newt.event.awt.AWTKeyAdapter;
+import com.jogamp.newt.event.awt.AWTWindowAdapter;
+import com.jogamp.opengl.test.junit.jogl.demos.es1.RedSquareES1;
+import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
+import com.jogamp.opengl.util.Animator;
+
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase {
+
+ static boolean waitForKey = false;
+ /** only when run manually .. */
+ static boolean allow600dpi = false;
+ static GLProfile glp;
+ static int width, height;
+
+ @BeforeClass
+ public static void initClass() {
+ if(GLProfile.isAvailable(GLProfile.GL2)) {
+ glp = GLProfile.get(GLProfile.GL2);
+ Assert.assertNotNull(glp);
+ width = 640;
+ height = 480;
+ } else {
+ setTestSupported(false);
+ }
+ // Runtime.getRuntime().traceInstructions(true);
+ // Runtime.getRuntime().traceMethodCalls(true);
+ }
+
+ @AfterClass
+ public static void releaseClass() {
+ }
+
+ protected void runTestGL(GLCapabilities caps, boolean layered) throws InterruptedException, InvocationTargetException {
+ final int layerStepX = width/6, layerStepY = height/6;
+ final Dimension glc_sz = new Dimension(layered ? width - 2*layerStepX : width/2, layered ? height - 2*layerStepY : height);
+ final GLJPanel glJPanel1 = new GLJPanel(caps);
+ Assert.assertNotNull(glJPanel1);
+ glJPanel1.setMinimumSize(glc_sz);
+ glJPanel1.setPreferredSize(glc_sz);
+ if( layered ) {
+ glJPanel1.setBounds(layerStepX/2, layerStepY/2, glc_sz.width, glc_sz.height);
+ } else {
+ glJPanel1.setBounds(0, 0, glc_sz.width, glc_sz.height);
+ }
+ glJPanel1.addGLEventListener(new Gears());
+
+ final GLJPanel glJPanel2 = new GLJPanel(caps);
+ Assert.assertNotNull(glJPanel2);
+ glJPanel2.setMinimumSize(glc_sz);
+ glJPanel2.setPreferredSize(glc_sz);
+ if( layered ) {
+ glJPanel2.setBounds(3*layerStepY, 2*layerStepY, glc_sz.width, glc_sz.height);
+ } else {
+ glJPanel2.setBounds(0, 0, glc_sz.width, glc_sz.height);
+ }
+ glJPanel2.addGLEventListener(new RedSquareES1());
+ // glJPanel2.addGLEventListener(new Gears());
+
+ final JComponent demoPanel;
+ if( layered ) {
+ glJPanel1.setOpaque(true);
+ glJPanel2.setOpaque(false);
+ final Dimension lsz = new Dimension(width, height);
+ demoPanel = new JLayeredPane();
+ demoPanel.setMinimumSize(lsz);
+ demoPanel.setPreferredSize(lsz);
+ demoPanel.setBounds(0, 0, lsz.width, lsz.height);
+ demoPanel.setBorder(BorderFactory.createTitledBorder("Layered Pane"));
+ demoPanel.add(glJPanel1, JLayeredPane.DEFAULT_LAYER);
+ demoPanel.add(glJPanel2, Integer.valueOf(1));
+ final JButton tb = new JButton("On Top");
+ tb.setBounds(4*layerStepY, 3*layerStepY, 100, 50);
+ demoPanel.add(tb, Integer.valueOf(2));
+ } else {
+ demoPanel = new JPanel();
+ demoPanel.add(glJPanel1);
+ demoPanel.add(glJPanel2);
+ }
+
+ final JFrame frame = new JFrame("Swing Print");
+ Assert.assertNotNull(frame);
+
+ final ActionListener print72DPIAction = new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ doPrintManual(frame, 72, 0, -1, -1);
+ } };
+ final ActionListener print300DPIAction = new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ doPrintManual(frame, 300, -1, -1, -1);
+ } };
+ final ActionListener print600DPIAction = new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ doPrintManual(frame, 600, -1, -1, -1);
+ } };
+ final Button print72DPIButton = new Button("72dpi");
+ print72DPIButton.addActionListener(print72DPIAction);
+ final Button print300DPIButton = new Button("300dpi");
+ print300DPIButton.addActionListener(print300DPIAction);
+ final Button print600DPIButton = new Button("600dpi");
+ print600DPIButton.addActionListener(print600DPIAction);
+
+ final JPanel printPanel = new JPanel();
+ printPanel.add(print72DPIButton);
+ printPanel.add(print300DPIButton);
+ printPanel.add(print600DPIButton);
+ final JPanel southPanel = new JPanel();
+ southPanel.add(new Label("South"));
+ final JPanel eastPanel = new JPanel();
+ eastPanel.add(new Label("East"));
+ final JPanel westPanel = new JPanel();
+ westPanel.add(new Label("West"));
+
+ Animator animator = new Animator();
+ animator.add(glJPanel1);
+ animator.add(glJPanel2);
+ QuitAdapter quitAdapter = new QuitAdapter();
+
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glJPanel1);
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glJPanel2);
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ final Container fcont = frame.getContentPane();
+ fcont.setLayout(new BorderLayout());
+ fcont.add(printPanel, BorderLayout.NORTH);
+ fcont.add(demoPanel, BorderLayout.CENTER);
+ fcont.add(southPanel, BorderLayout.SOUTH);
+ fcont.add(eastPanel, BorderLayout.EAST);
+ fcont.add(westPanel, BorderLayout.WEST);
+ fcont.validate();
+ frame.pack();
+ frame.setVisible(true);
+ } } ) ;
+
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel2, true));
+
+ animator.setUpdateFPSFrames(60, System.err);
+ animator.start();
+ Assert.assertEquals(true, animator.isAnimating());
+
+ boolean printDone = false;
+ while(!quitAdapter.shouldQuit() && animator.isAnimating() && ( 0 == duration || animator.getTotalFPSDuration()<duration )) {
+ Thread.sleep(200);
+ if( !printDone ) {
+ printDone = true;
+ {
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 72, 0, -1, -1, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 72, 8, -1, -1, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, 2048, 2048, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, -1, -1, true /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_RGB /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_BGR /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, -1, -1, true /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ if( allow600dpi ) {
+ // No AA needed for 300 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 600, -1, -1, -1, false /* resizeWithinPrint */);
+ waitUntilPrintJobsIdle(p);
+ }
+ }
+ }
+
+ Assert.assertNotNull(frame);
+ Assert.assertNotNull(glJPanel1);
+ Assert.assertNotNull(glJPanel2);
+ Assert.assertNotNull(animator);
+
+ animator.stop();
+ Assert.assertEquals(false, animator.isAnimating());
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setVisible(false);
+ }});
+ Assert.assertEquals(false, frame.isVisible());
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ final Frame _frame = frame;
+ _frame.remove(demoPanel);
+ _frame.dispose();
+ }});
+ }
+
+ @Test
+ public void test01_aa0() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ runTestGL(caps, false);
+ }
+
+ @Test
+ public void test01_aa0_layered() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setAlphaBits(8);
+ runTestGL(caps, true);
+ }
+
+ @Test
+ public void test01_aa0_bitmap() throws InterruptedException, InvocationTargetException {
+ if( Platform.OSType.WINDOWS == Platform.getOSType() ) {
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setBitmap(true);
+ runTestGL(caps, false);
+ } // issues w/ AMD catalyst driver and pixmap surface ..
+ }
+
+ @Test
+ public void test01_aa0_bitmap_layered() throws InterruptedException, InvocationTargetException {
+ if( Platform.OSType.WINDOWS == Platform.getOSType() ) {
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setBitmap(true);
+ caps.setAlphaBits(8);
+ runTestGL(caps, true);
+ } // issues w/ AMD catalyst driver and pixmap surface ..
+ }
+
+ @Test
+ public void test02_aa8() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setSampleBuffers(true);
+ caps.setNumSamples(8);
+ runTestGL(caps, false);
+ }
+
+ static long duration = 500; // ms
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ duration = MiscUtils.atol(args[i], duration);
+ } else if(args[i].equals("-width")) {
+ i++;
+ width = MiscUtils.atoi(args[i], width);
+ } else if(args[i].equals("-height")) {
+ i++;
+ height = MiscUtils.atoi(args[i], height);
+ } else if(args[i].equals("-600dpi")) {
+ allow600dpi = true;
+ } else if(args[i].equals("-wait")) {
+ waitForKey = true;
+ }
+ }
+ if(waitForKey) {
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ System.err.println("Press enter to continue");
+ try {
+ System.err.println(stdin.readLine());
+ } catch (IOException e) { }
+ }
+ org.junit.runner.JUnitCore.main(TestTiledPrintingGearsSwingAWT.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..2d4973d
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java
@@ -0,0 +1,340 @@
+/**
+ * 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.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.tile;
+
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Label;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.print.PageFormat;
+import java.io.BufferedReader;
+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 javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JLayeredPane;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.common.os.Platform;
+import com.jogamp.newt.event.TraceKeyAdapter;
+import com.jogamp.newt.event.TraceWindowAdapter;
+import com.jogamp.newt.event.awt.AWTKeyAdapter;
+import com.jogamp.newt.event.awt.AWTWindowAdapter;
+import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
+import com.jogamp.opengl.util.Animator;
+
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase {
+
+ static boolean waitForKey = false;
+ static GLProfile glp;
+ static int width, height;
+
+ @BeforeClass
+ public static void initClass() {
+ if(GLProfile.isAvailable(GLProfile.GL2)) {
+ glp = GLProfile.get(GLProfile.GL2);
+ Assert.assertNotNull(glp);
+ width = 560; // 640;
+ height = 420; // 480;
+ } else {
+ setTestSupported(false);
+ }
+ // Runtime.getRuntime().traceInstructions(true);
+ // Runtime.getRuntime().traceMethodCalls(true);
+ }
+
+ @AfterClass
+ public static void releaseClass() {
+ }
+
+ protected void runTestGL(GLCapabilities caps, final boolean addLayout, boolean layered, boolean useAnim) throws InterruptedException, InvocationTargetException {
+ final Dimension glc_sz = new Dimension(width, height);
+ final GLJPanel glJPanel1 = new GLJPanel(caps);
+ Assert.assertNotNull(glJPanel1);
+ glJPanel1.setMinimumSize(glc_sz);
+ glJPanel1.setPreferredSize(glc_sz);
+ glJPanel1.setBounds(0, 0, glc_sz.width, glc_sz.height);
+ glJPanel1.addGLEventListener(new Gears());
+
+ final JComponent tPanel, demoPanel;
+ if( layered ) {
+ glJPanel1.setOpaque(true);
+ final JButton tb = new JButton("On Top");
+ tb.setBounds(width/2, height/2, 200, 50);
+ if( addLayout ) {
+ tPanel = null;
+ final Dimension lsz = new Dimension(width, height);
+ demoPanel = new JLayeredPane();
+ demoPanel.setMinimumSize(lsz);
+ demoPanel.setPreferredSize(lsz);
+ demoPanel.setBounds(0, 0, lsz.width, lsz.height);
+ demoPanel.setBorder(BorderFactory.createTitledBorder("Layered Pane"));
+ demoPanel.add(glJPanel1, JLayeredPane.DEFAULT_LAYER);
+ demoPanel.add(tb, Integer.valueOf(2));
+ } else {
+ tPanel = new TransparentPanel();
+ tPanel.setBounds(0, 0, width, height);
+ tPanel.setLayout(null);
+ tPanel.add(tb);
+ demoPanel = glJPanel1;
+ }
+ } else {
+ tPanel = null;
+ if( addLayout ) {
+ demoPanel = new JPanel();
+ demoPanel.add(glJPanel1);
+ } else {
+ demoPanel = glJPanel1;
+ }
+ }
+
+ final JFrame frame = new JFrame("Swing Print");
+ Assert.assertNotNull(frame);
+
+ final ActionListener print72DPIAction = new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ doPrintManual(frame, 72, 0, -1, -1);
+ } };
+ final ActionListener print150DPIAction = new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ doPrintManual(frame, 150, -1, -1, -1);
+ } };
+ final ActionListener print300DPIAction = new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ doPrintManual(frame, 300, -1, -1, -1);
+ } };
+ final Button print72DPIButton = new Button("72dpi");
+ print72DPIButton.addActionListener(print72DPIAction);
+ final Button print150DPIButton = new Button("150dpi");
+ print150DPIButton.addActionListener(print150DPIAction);
+ final Button print300DPIButton = new Button("300dpi");
+ print300DPIButton.addActionListener(print300DPIAction);
+
+ final JPanel printPanel = new JPanel();
+ printPanel.add(print72DPIButton);
+ printPanel.add(print150DPIButton);
+ printPanel.add(print300DPIButton);
+ final JPanel southPanel = new JPanel();
+ southPanel.add(new Label("South"));
+ final JPanel eastPanel = new JPanel();
+ eastPanel.add(new Label("East"));
+ final JPanel westPanel = new JPanel();
+ westPanel.add(new Label("West"));
+
+ final Animator animator = useAnim ? new Animator() : null;
+ if( null != animator ) {
+ animator.add(glJPanel1);
+ }
+ QuitAdapter quitAdapter = new QuitAdapter();
+
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glJPanel1);
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ final Container fcont = frame.getContentPane();
+ if( addLayout ) {
+ fcont.setLayout(new BorderLayout());
+ fcont.add(printPanel, BorderLayout.NORTH);
+ fcont.add(demoPanel, BorderLayout.CENTER);
+ fcont.add(southPanel, BorderLayout.SOUTH);
+ fcont.add(eastPanel, BorderLayout.EAST);
+ fcont.add(westPanel, BorderLayout.WEST);
+ fcont.validate();
+ frame.pack();
+ } else {
+ frame.setSize(glc_sz);
+ fcont.setLayout(null);
+ if( null != tPanel ) {
+ fcont.add(tPanel);
+ }
+ fcont.add(demoPanel);
+ }
+ frame.setVisible(true);
+ } } ) ;
+
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel1, true));
+
+ if( null != animator ) {
+ animator.setUpdateFPSFrames(60, System.err);
+ animator.start();
+ Assert.assertEquals(true, animator.isAnimating());
+ }
+
+ final long t0 = System.currentTimeMillis();
+ long t1 = t0;
+ boolean printDone = false;
+ while( !quitAdapter.shouldQuit() && ( 0 == duration || ( t1 - t0 ) < duration ) ) {
+ Thread.sleep(200);
+ if( !printDone ) {
+ printDone = true;
+ {
+ // No AA needed for 150 dpi and greater :)
+ final PrintableBase p = doPrintAuto(frame, PageFormat.PORTRAIT, null, -1 /* offscreen-type */, 150, -1, -1, -1, false);
+ waitUntilPrintJobsIdle(p);
+ }
+ }
+ t1 = System.currentTimeMillis();
+ }
+
+ Assert.assertNotNull(frame);
+ Assert.assertNotNull(glJPanel1);
+
+ if( null != animator ) {
+ animator.stop();
+ Assert.assertEquals(false, animator.isAnimating());
+ }
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setVisible(false);
+ }});
+ Assert.assertEquals(false, frame.isVisible());
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ final Frame _frame = frame;
+ _frame.remove(demoPanel);
+ _frame.dispose();
+ }});
+ }
+
+ @Test
+ public void test01_norm_layout0_layered0() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ runTestGL(caps, false /* addLayout */, false /* layered */, false /* useAnim */);
+ }
+
+ @Test
+ public void test02_norm_layout1_layered0() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ runTestGL(caps, true /* addLayout */, false /* layered */, false /* useAnim */);
+ }
+
+ @Test
+ public void test03_norm_layout0_layered1() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ runTestGL(caps, false /* addLayout */, true /* layered */, false /* useAnim */);
+ }
+
+ @Test
+ public void test04_norm_layout1_layered1() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ runTestGL(caps, true /* addLayout */, true /* layered */, false /* useAnim */);
+ }
+
+ @Test
+ public void test11_bitm_layout0_layered0() throws InterruptedException, InvocationTargetException {
+ if( Platform.OSType.WINDOWS != Platform.getOSType() ) {
+ return;
+ }
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setBitmap(true);
+ runTestGL(caps, false /* addLayout */, false /* layered */, false /* useAnim */);
+ }
+
+ @Test
+ public void test12_bitm_layout1_layered0() throws InterruptedException, InvocationTargetException {
+ if( Platform.OSType.WINDOWS != Platform.getOSType() ) {
+ return;
+ }
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setBitmap(true);
+ runTestGL(caps, true /* addLayout */, false /* layered */, false /* useAnim */);
+ }
+
+ @Test
+ public void test13_bitm_layout0_layered1() throws InterruptedException, InvocationTargetException {
+ if( Platform.OSType.WINDOWS != Platform.getOSType() ) {
+ return;
+ }
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setBitmap(true);
+ runTestGL(caps, false /* addLayout */, true /* layered */, false /* useAnim */);
+ }
+
+ @Test
+ public void test14_bitm_layout1_layered1() throws InterruptedException, InvocationTargetException {
+ if( Platform.OSType.WINDOWS != Platform.getOSType() ) {
+ return;
+ }
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setBitmap(true);
+ runTestGL(caps, true /* addLayout */, true /* layered */, false /* useAnim */);
+ }
+
+ static long duration = 500; // ms
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ duration = MiscUtils.atol(args[i], duration);
+ } else if(args[i].equals("-width")) {
+ i++;
+ width = MiscUtils.atoi(args[i], width);
+ } else if(args[i].equals("-height")) {
+ i++;
+ height = MiscUtils.atoi(args[i], height);
+ } else if(args[i].equals("-wait")) {
+ waitForKey = true;
+ }
+ }
+ if(waitForKey) {
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ System.err.println("Press enter to continue");
+ try {
+ System.err.println(stdin.readLine());
+ } catch (IOException e) { }
+ }
+ org.junit.runner.JUnitCore.main(TestTiledPrintingGearsSwingAWT2.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..b51bfae
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java
@@ -0,0 +1,320 @@
+/**
+ * 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.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.tile;
+
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Graphics2D;
+import java.awt.Insets;
+import java.awt.Label;
+import java.awt.RenderingHints;
+import java.awt.image.BufferedImage;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+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 javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JLayeredPane;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.common.util.awt.AWTEDTExecutor;
+import com.jogamp.nativewindow.awt.AWTPrintLifecycle;
+import com.jogamp.nativewindow.awt.DirectDataBufferInt;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
+import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.texture.TextureIO;
+
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestTiledPrintingNIOImageSwingAWT extends UITestCase {
+
+ static boolean waitForKey = false;
+ /** only when run manually .. */
+ static boolean allow600dpi = false;
+ static GLProfile glp;
+ static int width, height;
+
+ @BeforeClass
+ public static void initClass() {
+ if(GLProfile.isAvailable(GLProfile.GL2)) {
+ glp = GLProfile.get(GLProfile.GL2);
+ Assert.assertNotNull(glp);
+ width = 640;
+ height = 480;
+ } else {
+ setTestSupported(false);
+ }
+ // Runtime.getRuntime().traceInstructions(true);
+ // Runtime.getRuntime().traceMethodCalls(true);
+ }
+
+ @AfterClass
+ public static void releaseClass() {
+ }
+
+ protected void printOffscreenToFile(final BufferedImage image, final Frame frame, final GLCapabilities caps, final int num, final String detail) {
+ final Insets frameInsets = frame.getInsets();
+ final int frameWidth = frame.getWidth();
+ final int frameHeight= frame.getHeight();
+ final int imageWidth = image.getWidth();
+ final int imageHeight= image.getHeight();
+ final double scaleComp72;
+ // Note: Frame size contains the frame border (i.e. insets)!
+ {
+ final double sx = (double)imageWidth / frameWidth;
+ final double sy = (double)imageHeight / frameHeight;
+ scaleComp72 = Math.min(sx, sy);
+ }
+ System.err.println("PRINT DPI: scaleComp72 "+scaleComp72+", image-size "+imageWidth+"x"+imageHeight+", frame[border "+frameInsets+", size "+frameWidth+"x"+frameHeight+"]");
+
+ System.err.println("XXX: image "+image);
+ System.err.println("XXX: cm "+image.getColorModel());
+ System.err.println("XXX: raster "+image.getRaster());
+ System.err.println("XXX: dataBuffer "+image.getRaster().getDataBuffer());
+
+ AWTEDTExecutor.singleton.invoke(true, new Runnable() {
+ public void run() {
+ final Graphics2D g2d = (Graphics2D) image.getGraphics();
+ g2d.setClip(0, 0, image.getWidth(), image.getHeight());
+ g2d.scale(scaleComp72, scaleComp72);
+ // g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+
+ // frame.paintAll(g2d);
+ final AWTPrintLifecycle.Context ctx = AWTPrintLifecycle.Context.setupPrint(frame, 1.0/scaleComp72, 1.0/scaleComp72, 0, -1, -1);
+ try {
+ frame.printAll(g2d);
+ } finally {
+ ctx.releasePrint();
+ }
+ // to file
+ final String fname = getSnapshotFilename(num, detail, caps, image.getWidth(), image.getHeight(), false, TextureIO.PNG, null);
+ System.err.println("XXX file "+fname);
+ final File fout = new File(fname);
+ try {
+ ImageIO.write(image, "png", fout);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ } });
+ }
+
+ protected void runTestGL(final GLCapabilities caps, final boolean layered) throws InterruptedException, InvocationTargetException {
+ final int layerStepX = width/6, layerStepY = height/6;
+ final Dimension glc_sz = new Dimension(layered ? width - 2*layerStepX : width/2, layered ? height - 2*layerStepY : height);
+ final GLJPanel glJPanel1 = new GLJPanel(caps);
+ Assert.assertNotNull(glJPanel1);
+ glJPanel1.setMinimumSize(glc_sz);
+ glJPanel1.setPreferredSize(glc_sz);
+ if( layered ) {
+ glJPanel1.setBounds(layerStepX/2, layerStepY/2, glc_sz.width, glc_sz.height);
+ } else {
+ glJPanel1.setBounds(0, 0, glc_sz.width, glc_sz.height);
+ }
+ glJPanel1.addGLEventListener(new Gears());
+
+ final GLJPanel glJPanel2 = new GLJPanel(caps);
+ Assert.assertNotNull(glJPanel2);
+ glJPanel2.setMinimumSize(glc_sz);
+ glJPanel2.setPreferredSize(glc_sz);
+ if( layered ) {
+ glJPanel2.setBounds(3*layerStepY, 2*layerStepY, glc_sz.width, glc_sz.height);
+ } else {
+ glJPanel2.setBounds(0, 0, glc_sz.width, glc_sz.height);
+ }
+ glJPanel2.addGLEventListener(new RedSquareES2());
+ // glJPanel2.addGLEventListener(new Gears());
+
+ final JComponent demoPanel;
+ if( layered ) {
+ glJPanel1.setOpaque(true);
+ glJPanel2.setOpaque(false);
+ final Dimension lsz = new Dimension(width, height);
+ demoPanel = new JLayeredPane();
+ demoPanel.setMinimumSize(lsz);
+ demoPanel.setPreferredSize(lsz);
+ demoPanel.setBounds(0, 0, lsz.width, lsz.height);
+ demoPanel.setBorder(BorderFactory.createTitledBorder("Layered Pane"));
+ demoPanel.add(glJPanel1, JLayeredPane.DEFAULT_LAYER);
+ demoPanel.add(glJPanel2, Integer.valueOf(1));
+ final JButton tb = new JButton("On Top");
+ tb.setBounds(4*layerStepY, 3*layerStepY, 100, 50);
+ demoPanel.add(tb, Integer.valueOf(2));
+ } else {
+ demoPanel = new JPanel();
+ demoPanel.add(glJPanel1);
+ demoPanel.add(glJPanel2);
+ }
+
+ final JFrame frame = new JFrame("Swing Print");
+ Assert.assertNotNull(frame);
+
+ final Button print72DPIButton = new Button("72dpi"); // dummy
+ final Button print300DPIButton = new Button("300dpi"); // dummy
+ final Button print600DPIButton = new Button("600dpi"); // dummy
+
+ final JPanel printPanel = new JPanel();
+ printPanel.add(print72DPIButton);
+ printPanel.add(print300DPIButton);
+ printPanel.add(print600DPIButton);
+ final JPanel southPanel = new JPanel();
+ southPanel.add(new Label("South"));
+ final JPanel eastPanel = new JPanel();
+ eastPanel.add(new Label("East"));
+ final JPanel westPanel = new JPanel();
+ westPanel.add(new Label("West"));
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ final Container fcont = frame.getContentPane();
+ fcont.setLayout(new BorderLayout());
+ fcont.add(printPanel, BorderLayout.NORTH);
+ fcont.add(demoPanel, BorderLayout.CENTER);
+ fcont.add(southPanel, BorderLayout.SOUTH);
+ fcont.add(eastPanel, BorderLayout.EAST);
+ fcont.add(westPanel, BorderLayout.WEST);
+ fcont.validate();
+ frame.pack();
+ frame.setVisible(true);
+ } } ) ;
+
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel2, true));
+
+ // paint offscreen: array 72dpi ARGB
+ {
+ final BufferedImage image = new BufferedImage(frame.getWidth(), frame.getHeight(), BufferedImage.TYPE_INT_ARGB);
+ printOffscreenToFile(image, frame, caps, 0, "array_072dpi_argb");
+ }
+ // paint offscreen: NIO 72dpi ARGB
+ {
+ final BufferedImage image = DirectDataBufferInt.createBufferedImage(frame.getWidth(), frame.getHeight(), BufferedImage.TYPE_INT_ARGB, null /* location */, null /* properties */);
+ printOffscreenToFile(image, frame, caps, 1, "newio_072dpi_argb");
+ }
+ // paint offscreen: NIO 150dpi ARGB
+ {
+ final int scale = (int) ( 150.0 / 72.0 + 0.5 );
+ final BufferedImage image = DirectDataBufferInt.createBufferedImage(frame.getWidth()*scale, frame.getHeight()*scale, BufferedImage.TYPE_INT_ARGB, null /* location */, null /* properties */);
+ printOffscreenToFile(image, frame, caps, 2, "newio_150dpi_argb");
+ }
+ // paint offscreen: NIO 150dpi ARGB_PRE
+ {
+ final int scale = (int) ( 150.0 / 72.0 + 0.5 );
+ final BufferedImage image = DirectDataBufferInt.createBufferedImage(frame.getWidth()*scale, frame.getHeight()*scale, BufferedImage.TYPE_INT_ARGB_PRE, null /* location */, null /* properties */);
+ printOffscreenToFile(image, frame, caps, 2, "newio_150dpi_argbp");
+ }
+ // paint offscreen: NIO 150dpi RGB
+ {
+ final int scale = (int) ( 150.0 / 72.0 + 0.5 );
+ final BufferedImage image = DirectDataBufferInt.createBufferedImage(frame.getWidth()*scale, frame.getHeight()*scale, BufferedImage.TYPE_INT_RGB, null /* location */, null /* properties */);
+ printOffscreenToFile(image, frame, caps, 2, "newio_150dpi_rgb");
+ }
+ // paint offscreen: NIO 150dpi BGR
+ {
+ final int scale = (int) ( 150.0 / 72.0 + 0.5 );
+ final BufferedImage image = DirectDataBufferInt.createBufferedImage(frame.getWidth()*scale, frame.getHeight()*scale, BufferedImage.TYPE_INT_BGR, null /* location */, null /* properties */);
+ printOffscreenToFile(image, frame, caps, 2, "newio_150dpi_bgr");
+ }
+
+ Assert.assertNotNull(frame);
+ Assert.assertNotNull(glJPanel1);
+ Assert.assertNotNull(glJPanel2);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setVisible(false);
+ }});
+ Assert.assertEquals(false, frame.isVisible());
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ final Frame _frame = frame;
+ _frame.remove(demoPanel);
+ _frame.dispose();
+ }});
+ }
+
+ @Test
+ public void test01_Offscreen_aa0() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ runTestGL(caps, false);
+ }
+
+ @Test
+ public void test01_Offscreen_aa0_layered() throws InterruptedException, InvocationTargetException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ runTestGL(caps, true);
+ }
+
+ static long duration = 500; // ms
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ try {
+ duration = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ } else if(args[i].equals("-600dpi")) {
+ allow600dpi = true;
+ } else if(args[i].equals("-wait")) {
+ waitForKey = true;
+ }
+ }
+ if(waitForKey) {
+ BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
+ System.err.println("Press enter to continue");
+ try {
+ System.err.println(stdin.readLine());
+ } catch (IOException e) { }
+ }
+ org.junit.runner.JUnitCore.main(TestTiledPrintingNIOImageSwingAWT.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..e0fabc3
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering1GL2NEWT.java
@@ -0,0 +1,243 @@
+/**
+ * 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.
+ */
+package com.jogamp.opengl.test.junit.jogl.tile;
+
+import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.GLPixelBuffer;
+import com.jogamp.opengl.util.TileRenderer;
+import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes;
+import com.jogamp.opengl.util.TileRendererBase;
+import com.jogamp.opengl.util.texture.TextureData;
+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 org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+/**
+ * Demos offscreen {@link GLDrawable} being used for
+ * {@link TileRenderer} rendering to produce a PNG file.
+ * <p>
+ * All {@link TileRenderer} operations are
+ * being performed from the main thread sequentially
+ * without {@link GLAutoDrawable} or {@link GLEventListener}.
+ * </p>
+*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestTiledRendering1GL2NEWT extends UITestCase {
+ static long duration = 500; // ms
+
+ static class DrawableContext {
+ DrawableContext(GLDrawable d, GLContext glc) {
+ this.d = d;
+ this.glc = glc;
+ }
+ GLDrawable d;
+ GLContext glc;
+ }
+
+ private static DrawableContext createDrawableAndCurrentCtx(GLCapabilities glCaps, int width, int height) {
+ GLDrawableFactory factory = GLDrawableFactory.getFactory(glCaps.getGLProfile());
+ GLDrawable d = factory.createOffscreenDrawable(null, glCaps, null, width, height);
+ d.setRealized(true);
+ GLContext glc = null;
+ glc = d.createContext(null);
+ Assert.assertTrue("Context could not be made current", GLContext.CONTEXT_NOT_CURRENT < glc.makeCurrent());
+ return new DrawableContext(d, glc);
+ }
+
+ private static void destroyDrawableContext(DrawableContext dc) {
+ if(null != dc.glc) {
+ dc.glc.destroy();
+ dc.glc = null;
+ }
+ if(null != dc.d) {
+ dc.d.setRealized(false);
+ dc.d = null;
+ }
+ }
+
+ @Test
+ public void test01() throws IOException {
+ GLProfile glp = GLProfile.getMaxFixedFunc(true);
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setOnscreen(false);
+
+ final int maxTileSize = 256;
+ DrawableContext dc = createDrawableAndCurrentCtx(caps, maxTileSize, maxTileSize);
+ final GL2 gl = dc.glc.getGL().getGL2();
+
+ // Fix the image size for now
+ final int imageWidth = dc.d.getWidth() * 6;
+ final int imageHeight = dc.d.getHeight() * 4;
+
+ final String filename = this.getSnapshotFilename(0, "-tile", dc.d.getChosenGLCapabilities(), imageWidth, imageHeight, false, TextureIO.PNG, null);
+ final File file = new File(filename);
+
+ // Initialize the tile rendering library
+ final TileRenderer renderer = new com.jogamp.opengl.util.TileRenderer();
+ renderer.setTileSize(dc.d.getWidth(), dc.d.getHeight(), 0);
+ renderer.setImageSize(imageWidth, imageHeight);
+
+ final GLPixelBuffer.GLPixelBufferProvider pixelBufferProvider = GLPixelBuffer.defaultProviderWithRowStride;
+ final boolean[] flipVertically = { false };
+
+ GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, 3);
+ GLPixelBuffer pixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, imageWidth, imageHeight, 1, true, 0);
+ renderer.setImageBuffer(pixelBuffer);
+ flipVertically[0] = false;
+
+ final Gears gears = new Gears();
+ gears.setVerbose(false);
+ gears.init(gl);
+
+ gears.addTileRendererNotify(renderer);
+ while( !renderer.eot() ) {
+ renderer.beginTile(gl);
+ gears.reshape(gl,
+ renderer.getParam(TileRendererBase.TR_CURRENT_TILE_X_POS), renderer.getParam(TileRendererBase.TR_CURRENT_TILE_Y_POS),
+ renderer.getParam(TileRendererBase.TR_CURRENT_TILE_WIDTH), renderer.getParam(TileRendererBase.TR_CURRENT_TILE_HEIGHT),
+ renderer.getParam(TileRendererBase.TR_IMAGE_WIDTH), renderer.getParam(TileRendererBase.TR_IMAGE_HEIGHT));
+ gears.display(gl);
+ renderer.endTile(gl);
+ }
+ gears.removeTileRendererNotify(renderer);
+
+ destroyDrawableContext(dc);
+
+ final GLPixelBuffer imageBuffer = renderer.getImageBuffer();
+ final TextureData textureData = new TextureData(
+ caps.getGLProfile(),
+ 0 /* internalFormat */,
+ imageWidth, imageHeight,
+ 0,
+ imageBuffer.pixelAttributes,
+ false, false,
+ flipVertically[0],
+ imageBuffer.buffer,
+ null /* Flusher */);
+
+ TextureIO.write(textureData, file);
+ }
+
+ @Test
+ public void test02_EOT_01() throws IOException {
+ GLProfile glp = GLProfile.getMaxFixedFunc(true);
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setOnscreen(false);
+
+ final int maxTileSize = 256;
+ DrawableContext dc = createDrawableAndCurrentCtx(caps, maxTileSize, maxTileSize);
+ final GL2 gl = dc.glc.getGL().getGL2();
+
+ // Fix the image size for now
+ final int imageWidth = dc.d.getWidth() * 6;
+ final int imageHeight = dc.d.getHeight() * 4;
+
+ // Initialize the tile rendering library
+ final TileRenderer renderer = new com.jogamp.opengl.util.TileRenderer();
+ renderer.setTileSize(dc.d.getWidth(), dc.d.getHeight(), 0);
+
+ IllegalStateException ise = null;
+ try {
+ renderer.beginTile(gl); // Image size has not been set
+ } catch (IllegalStateException _ise) {
+ ise = _ise;
+ System.err.println("Expected "+ise.getClass().getSimpleName()+": "+ise.getMessage());
+ }
+ Assert.assertNotNull("TileRenderer.beginTile: Image-size exception missing", ise);
+
+ renderer.setImageSize(imageWidth, imageHeight);
+
+ renderer.clipImageSize(0, 0);
+ try {
+ renderer.beginTile(gl); // EOT reached (1)
+ } catch (IllegalStateException _ise) {
+ ise = _ise;
+ System.err.println("Expected "+ise.getClass().getSimpleName()+": "+ise.getMessage());
+ }
+ Assert.assertNotNull("TileRenderer.beginTile: EOT (1) exception missing", ise);
+
+ renderer.clipImageSize(imageWidth, imageHeight); // back to full size
+
+ final Gears gears = new Gears();
+ gears.setVerbose(false);
+ gears.init(gl);
+
+ gears.addTileRendererNotify(renderer);
+ int numTiles = 0;
+ while( !renderer.eot() ) {
+ renderer.beginTile(gl);
+ gears.reshape(gl,
+ renderer.getParam(TileRendererBase.TR_CURRENT_TILE_X_POS), renderer.getParam(TileRendererBase.TR_CURRENT_TILE_Y_POS),
+ renderer.getParam(TileRendererBase.TR_CURRENT_TILE_WIDTH), renderer.getParam(TileRendererBase.TR_CURRENT_TILE_HEIGHT),
+ renderer.getParam(TileRendererBase.TR_IMAGE_WIDTH), renderer.getParam(TileRendererBase.TR_IMAGE_HEIGHT));
+ gears.display(gl);
+ renderer.endTile(gl);
+ numTiles++;
+ }
+ try {
+ renderer.beginTile(gl); // EOT reached (2)
+ } catch (IllegalStateException _ise) {
+ ise = _ise;
+ System.err.println("Expected "+ise.getClass().getSimpleName()+": "+ise.getMessage());
+ }
+ Assert.assertNotNull("TileRenderer.beginTile: EOT (2) exception missing", ise);
+ gears.removeTileRendererNotify(renderer);
+
+ Assert.assertTrue("TileRenderer not rendered more than one tile but "+numTiles, numTiles > 1);
+
+ destroyDrawableContext(dc);
+ }
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ try {
+ duration = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ }
+ }
+ org.junit.runner.JUnitCore.main(TestTiledRendering1GL2NEWT.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..2220c1f
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java
@@ -0,0 +1,263 @@
+/**
+ * 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.
+ */
+package com.jogamp.opengl.test.junit.jogl.tile;
+
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.GLPixelBuffer;
+import com.jogamp.opengl.util.TileRenderer;
+import com.jogamp.opengl.util.TileRendererBase;
+import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes;
+import com.jogamp.opengl.util.texture.TextureData;
+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 org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+/**
+ * Demos offscreen {@link GLAutoDrawable} being used for
+ * {@link TileRenderer} rendering to produce a PNG file.
+ * <p>
+ * {@link TileRenderer} is being kicked off from the main thread.
+ * </p>
+ * <p>
+ * {@link TileRenderer} buffer allocation is performed
+ * within the pre {@link GLEventListener}
+ * set via {@link TileRendererBase#setGLEventListener(GLEventListener, GLEventListener)}
+ * on the main thread.
+ * </p>
+ * <p>
+ * At tile rendering finish, the viewport and
+ * and the original {@link GLEventListener}'s PMV matrix as well.
+ * The latter is done by calling it's {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape} method.
+ * </p>
+*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestTiledRendering2NEWT extends UITestCase {
+ static long duration = 500; // ms
+
+ static GLProfile getGLProfile(String profile) {
+ if( !GLProfile.isAvailable(profile) ) {
+ System.err.println("Profile "+profile+" n/a");
+ return null;
+ }
+ return GLProfile.get(profile);
+ }
+ static GLProfile getGL2ES3() {
+ final GLProfile glp = GLProfile.getMaxProgrammableCore(true);
+ if( null == glp || !glp.isGL2ES3() ) {
+ System.err.println("GL2ES3 n/a, has max-core "+glp);
+ return null;
+ }
+ return glp;
+ }
+
+ @Test
+ public void test001_off_gl2___aa0() throws IOException {
+ GLProfile glp = getGLProfile(GLProfile.GL2);
+ if( null == glp ) {
+ return;
+ }
+ doTest(false, new Gears(), glp, 0);
+ }
+ @Test
+ public void test002_off_gl2___aa8() throws IOException {
+ GLProfile glp = getGLProfile(GLProfile.GL2);
+ if( null == glp ) {
+ return;
+ }
+ doTest(false, new Gears(), glp, 8);
+ }
+ @Test
+ public void test011_off_gl2es3_aa0() throws IOException {
+ GLProfile glp = getGL2ES3();
+ if( null == glp ) {
+ return;
+ }
+ doTest(false, new GearsES2(), glp, 0);
+ }
+ @Test
+ public void test012_off_gl2es3_aa8() throws IOException {
+ GLProfile glp = getGL2ES3();
+ if( null == glp ) {
+ return;
+ }
+ doTest(false, new GearsES2(), glp, 8);
+ }
+ @Test
+ public void test101_on__gl2___aa0() throws IOException {
+ GLProfile glp = getGLProfile(GLProfile.GL2);
+ if( null == glp ) {
+ return;
+ }
+ doTest(true, new Gears(), glp, 0);
+ }
+ @Test
+ public void test102_on__gl2___aa8() throws IOException {
+ GLProfile glp = getGLProfile(GLProfile.GL2);
+ if( null == glp ) {
+ return;
+ }
+ doTest(true, new Gears(), glp, 8);
+ }
+ @Test
+ public void test111_on__gl2es3_aa0() throws IOException {
+ GLProfile glp = getGL2ES3();
+ if( null == glp ) {
+ return;
+ }
+ doTest(true, new GearsES2(), glp, 0);
+ }
+ @Test
+ public void test112_on__gl2es3_aa8() throws IOException {
+ GLProfile glp = getGL2ES3();
+ if( null == glp ) {
+ return;
+ }
+ doTest(true, new GearsES2(), glp, 8);
+ }
+
+ void doTest(boolean onscreen, final GLEventListener demo, GLProfile glp, final int msaaCount) throws IOException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setDoubleBuffered(onscreen);
+ if( msaaCount > 0 ) {
+ caps.setSampleBuffers(true);
+ caps.setNumSamples(msaaCount);
+ }
+
+ final int maxTileSize = 256;
+ final GLAutoDrawable glad;
+ if( onscreen ) {
+ final GLWindow glWin = GLWindow.create(caps);
+ glWin.setSize(maxTileSize, maxTileSize);
+ glWin.setVisible(true);
+ glad = glWin;
+ } else {
+ final GLDrawableFactory factory = GLDrawableFactory.getFactory(glp);
+ glad = factory.createOffscreenAutoDrawable(null, caps, null, maxTileSize, maxTileSize);
+ }
+
+ glad.addGLEventListener( demo );
+
+ // Fix the image size for now
+ final int imageWidth = glad.getWidth() * 6;
+ final int imageHeight = glad.getHeight() * 4;
+
+ final String filename = this.getSnapshotFilename(0, "-tile", glad.getChosenGLCapabilities(), imageWidth, imageHeight, false, TextureIO.PNG, null);
+ final File file = new File(filename);
+
+ // Initialize the tile rendering library
+ final TileRenderer renderer = new TileRenderer();
+ renderer.setImageSize(imageWidth, imageHeight);
+ renderer.setTileSize(glad.getWidth(), glad.getHeight(), 0);
+ renderer.attachAutoDrawable(glad);
+
+ final GLPixelBuffer.GLPixelBufferProvider pixelBufferProvider = GLPixelBuffer.defaultProviderWithRowStride;
+ final boolean[] flipVertically = { false };
+
+ final GLEventListener preTileGLEL = new GLEventListener() {
+ @Override
+ public void init(GLAutoDrawable drawable) {
+ final GL gl = drawable.getGL();
+ GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, 3);
+ GLPixelBuffer pixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, imageWidth, imageHeight, 1, true, 0);
+ renderer.setImageBuffer(pixelBuffer);
+ if( drawable.isGLOriented() ) {
+ flipVertically[0] = false;
+ } else {
+ flipVertically[0] = true;
+ }
+ }
+ @Override
+ public void dispose(GLAutoDrawable drawable) {}
+ @Override
+ public void display(GLAutoDrawable drawable) {}
+ @Override
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {}
+ };
+ renderer.setGLEventListener(preTileGLEL, null);
+
+ while ( !renderer.eot() ) {
+ renderer.display();
+ }
+
+ renderer.detachAutoDrawable();
+
+ // Restore viewport and Gear's PMV matrix
+ // .. even though we close the demo, this is for documentation!
+ glad.invoke(true, new GLRunnable() {
+ @Override
+ public boolean run(GLAutoDrawable drawable) {
+ drawable.getGL().glViewport(0, 0, drawable.getWidth(), drawable.getHeight());
+ demo.reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight());
+ return false;
+ }
+ });
+
+ final GLPixelBuffer imageBuffer = renderer.getImageBuffer();
+ final TextureData textureData = new TextureData(
+ caps.getGLProfile(),
+ 0 /* internalFormat */,
+ imageWidth, imageHeight,
+ 0,
+ imageBuffer.pixelAttributes,
+ false, false,
+ flipVertically[0],
+ imageBuffer.buffer,
+ null /* Flusher */);
+
+ TextureIO.write(textureData, file);
+
+ glad.destroy();
+ }
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ try {
+ duration = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ }
+ }
+ org.junit.runner.JUnitCore.main(TestTiledRendering2NEWT.class.getName());
+ }
+}
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
new file mode 100644
index 0000000..4e9d4bd
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java
@@ -0,0 +1,273 @@
+/**
+ * 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.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.tile;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Rectangle;
+import java.awt.Window;
+import java.awt.print.PageFormat;
+import java.awt.print.Paper;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+
+import javax.media.opengl.GLAutoDrawable;
+import javax.print.StreamPrintService;
+import javax.print.StreamPrintServiceFactory;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.PrintRequestAttributeSet;
+import javax.print.attribute.standard.MediaSizeName;
+
+import jogamp.nativewindow.awt.AWTMisc;
+
+import org.junit.Assert;
+
+import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.awt.AWTEDTExecutor;
+import com.jogamp.common.util.locks.LockFactory;
+import com.jogamp.common.util.locks.RecursiveLock;
+import com.jogamp.nativewindow.awt.AWTPrintLifecycle;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.TileRenderer;
+
+/**
+ * Base unit test class implementing
+ * issuing {@link PrinterJob#print()} on a {@link Printable} implementation,
+ * i.e. {@link OnscreenPrintable} or {@link OffscreenPrintable}.
+ */
+public abstract class TiledPrintingAWTBase extends UITestCase {
+
+ private RecursiveLock lock = LockFactory.createRecursiveLock();
+ private int printCount = 0;
+
+ public TiledPrintingAWTBase() {
+ super();
+ }
+
+ /**
+ *
+ * @param cont
+ * @param pOrientation
+ * @param paper
+ * @param offscrnImageType if < 0 onscreen, otherwise integer BufferedImage type
+ * @param dpi
+ * @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples
+ * @param tileWidth custom tile width for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
+ * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
+ * @param resizeWithinPrintTest TODO
+ */
+ public PrintableBase doPrintAuto(Container cont, int pOrientation, Paper paper,
+ int offscrnImageType, int dpi, int numSamples, int tileWidth, int tileHeight, boolean resizeWithinPrintTest) {
+ lock.lock();
+ try {
+ final PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
+ aset.add(MediaSizeName.ISO_A1); // 594 × 841 mm
+ aset.add(MediaSizeName.ISO_A2); // 420 × 594 mm
+ aset.add(MediaSizeName.ISO_A3); // 297 × 420 mm
+ aset.add(MediaSizeName.ISO_A4); // 210 × 297 mm
+
+ printCount++;
+
+ final String psMimeType = "application/postscript";
+ final String pdfMimeType = "application/pdf";
+ final PrinterJob pj = PrinterJob.getPrinterJob();
+
+ StreamPrintServiceFactory[] factories = PrinterJob.lookupStreamPrintServices(pdfMimeType);
+ if (factories.length > 0) {
+ final String fname = getPrintFilename(offscrnImageType, dpi, numSamples, tileWidth, tileHeight, "pdf", resizeWithinPrintTest);
+ System.err.println("doPrint: dpi "+dpi+", "+fname);
+ FileOutputStream outstream;
+ try {
+ outstream = new FileOutputStream(fname);
+ return doPrintAutoImpl(cont, pj, factories[0].getPrintService(outstream), pOrientation, paper,
+ offscrnImageType, dpi, numSamples, tileWidth, tileHeight, resizeWithinPrintTest);
+ } catch (FileNotFoundException e) {
+ Assert.assertNull("Unexpected exception", e);
+ }
+ }
+ System.err.println("No PDF");
+
+ factories = PrinterJob.lookupStreamPrintServices(psMimeType);
+ if (factories.length > 0) {
+ final String fname = getPrintFilename(offscrnImageType, dpi, numSamples, tileWidth, tileHeight, "ps", resizeWithinPrintTest);
+ System.err.println("doPrint: dpi "+dpi+", "+fname);
+ FileOutputStream outstream;
+ try {
+ outstream = new FileOutputStream(fname);
+ return doPrintAutoImpl(cont, pj, factories[0].getPrintService(outstream), pOrientation, paper, offscrnImageType, dpi, numSamples, tileWidth, tileHeight, resizeWithinPrintTest);
+ } catch (FileNotFoundException e) {
+ Assert.assertNull("Unexpected exception", e);
+ }
+ }
+ System.err.println("No PS");
+ return null;
+ } finally {
+ lock.unlock();
+ }
+ }
+ private String getPrintFilename(int offscrnImageType, int dpi, int numSamples, int tileWidth, int tileHeight, String suffix, boolean resizeWithinPrintTest) {
+ final int maxSimpleTestNameLen = getMaxTestNameLen()+getClass().getSimpleName().length()+1;
+ final String simpleTestName = getSimpleTestName(".");
+ final String onoffscrn = 0 > offscrnImageType ? "on_screen" : "offscrn_"+offscrnImageType;
+ final String aa = 0 <= numSamples ? "aa"+numSamples : "aaN";
+ return String.format("%-"+maxSimpleTestNameLen+"s-n%04d-%s-dpi%03d-%s-tSz%04dx%04d-resize%d.%s",
+ simpleTestName, printCount, onoffscrn, dpi, aa, tileWidth, tileHeight, resizeWithinPrintTest?1:0, suffix).replace(' ', '_');
+ }
+ private PrintableBase doPrintAutoImpl(Container cont, PrinterJob job,
+ StreamPrintService ps, int pOrientation, Paper paper,
+ int offscrnImageType, int dpi, int numSamples, int tileWidth, int tileHeight, boolean resizeWithinPrintTest) {
+ try {
+ PageFormat pageFormat = job.defaultPage();
+ if( null != paper ) {
+ /**
+ Paper paper = new Paper();
+ paper.setSize(500,500); // Large Address Dimension
+ paper.setImageableArea(20, 20, 450, 420); */
+ pageFormat.setPaper(paper);
+ }
+ pageFormat.setOrientation(pOrientation); // PageFormat.LANDSCAPE or PageFormat.PORTRAIT
+ job.setPrintService(ps);
+ final PrintableBase printable;
+ if( 0 < offscrnImageType ) {
+ printable = new OffscreenPrintable(job, cont, dpi, numSamples, tileWidth, tileHeight, offscrnImageType, getPrintFilename(offscrnImageType, dpi, numSamples, tileWidth, tileHeight, "png", resizeWithinPrintTest));
+ } else {
+ printable = new OnscreenPrintable(job, cont, dpi, numSamples, tileWidth, tileHeight);
+ }
+ printable.job.setPrintable(printable, pageFormat);
+ doPrintImpl(printable, resizeWithinPrintTest);
+ return printable;
+ } catch (PrinterException pe) {
+ pe.printStackTrace();
+ return null;
+ }
+ }
+
+ /**
+ * @param cont
+ * @param dpi
+ * @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples
+ * @param tileWidth custom tile width for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
+ * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default.
+ */
+ public PrintableBase doPrintManual(Container cont, int dpi, int numSamples, int tileWidth, int tileHeight) {
+ lock.lock();
+ try {
+ final OnscreenPrintable printable = new OnscreenPrintable(PrinterJob.getPrinterJob(), cont, dpi, numSamples, tileWidth, tileHeight);
+ printable.job.setPrintable(printable);
+ boolean ok = printable.job.printDialog();
+ if (ok) {
+ doPrintImpl(printable, false);
+ }
+ return printable;
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ private final AWTMisc.ComponentAction resizePlusAction = new AWTMisc.ComponentAction() {
+ @Override
+ public void run(Component c) {
+ final Rectangle r = c.getBounds();
+ r.width += 64;
+ r.height += 64;
+ c.setBounds(r);
+ } };
+ private final AWTMisc.ComponentAction resizeMinusAction = new AWTMisc.ComponentAction() {
+ @Override
+ public void run(Component c) {
+ final Rectangle r = c.getBounds();
+ r.width -= 64;
+ r.height -= 64;
+ c.setBounds(r);
+ } };
+
+ private void doPrintImpl(final PrintableBase printable, final boolean resizeWithinPrintTest) {
+ final double scaleGLMatXY = 72.0 / printable.dpi;
+ System.err.println("PRINTable: "+printable.getClass().getSimpleName());
+ System.err.println("PRINT DPI: "+printable.dpi+", AA "+printable.numSamples+", scaleGL "+scaleGLMatXY);
+ final AWTPrintLifecycle.Context ctx =
+ AWTPrintLifecycle.Context.setupPrint(printable.cont, scaleGLMatXY, scaleGLMatXY,
+ printable.numSamples, printable.tileWidth, printable.tileHeight);
+ System.err.println("PRINT AWTPrintLifecycle.setup.count "+ctx.getCount());
+ final int w = printable.cont.getWidth();
+ final int h = printable.cont.getHeight();
+ final long t0 = Platform.currentTimeMillis();
+ try {
+ AWTEDTExecutor.singleton.invoke(true, new Runnable() {
+ public void run() {
+ try {
+ if( resizeWithinPrintTest ) {
+ System.err.println("PRINT resizeWithinPrint size+ "+(w+64)+"x"+(h+64));
+ AWTMisc.performAction(printable.cont, GLAutoDrawable.class, resizePlusAction);
+ printable.cont.validate();
+ if( printable.cont instanceof Window ) {
+ ((Window)printable.cont).pack();
+ }
+ }
+ printable.job.print();
+ } catch (PrinterException ex) {
+ ex.printStackTrace();
+ }
+ } });
+ } finally {
+ ctx.releasePrint();
+ final long td = Platform.currentTimeMillis() - t0;
+ System.err.println("PRINT Duration "+td+" ms");
+ if( resizeWithinPrintTest ) {
+ AWTEDTExecutor.singleton.invoke(true, new Runnable() {
+ public void run() {
+ System.err.println("PRINT resizeWithinPrint repaint");
+ printable.cont.repaint();
+ System.err.println("PRINT resizeWithinPrint size- "+w+"x"+h);
+ AWTMisc.performAction(printable.cont, GLAutoDrawable.class, resizeMinusAction);
+ printable.cont.validate();
+ if( printable.cont instanceof Window ) {
+ ((Window)printable.cont).pack();
+ }
+ } });
+ }
+ System.err.println("PRINT AWTPrintLifecycle.release.count "+ctx.getCount());
+ }
+ }
+
+ /** Wait for idle .. simply acquiring all locks and releasing them. */
+ public void waitUntilPrintJobsIdle(PrintableBase p) {
+ lock.lock();
+ try {
+ if( null != p ) {
+ p.waitUntilIdle();
+ }
+ } finally {
+ lock.unlock();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TransparentPanel.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TransparentPanel.java
new file mode 100644
index 0000000..d68f878
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TransparentPanel.java
@@ -0,0 +1,59 @@
+package com.jogamp.opengl.test.junit.jogl.tile;
+
+import java.awt.*;
+import javax.swing.*;
+import java.lang.reflect.Method;
+
+public class TransparentPanel extends JPanel {
+ public TransparentPanel() {
+ super.setOpaque(false);
+ setMixingCutoutShape(new Rectangle());
+ }
+
+ @Override
+ public void setOpaque(boolean isOpaque) {
+ // Don't let this panel become opaque
+ }
+
+ /**
+ * Helper utility needed to implement TransparentPanel.
+ * This class provides the ability to cut out the background of a lightweight
+ * panel so that it can be layered on top of a heavyweight component and have
+ * the heavyweight component show through. For more infromation, see:
+ *
+ * http://today.java.net/article/2009/11/02/transparent-panel-mixing-heavyweight-and-lightweight-components
+ */
+ private static Method mSetComponentMixing;
+
+ /**
+ * Set the cut out shape on a given Component.
+ *
+ * @param c The Component on which to set the cut out shape.
+ * @param s The shape to cut out of the given Component.
+ */
+ public void setMixingCutoutShape(Shape s)
+ {
+ // Get the cut out shape method
+ if (mSetComponentMixing == null) {
+ try {
+ Class<?> awtUtilitiesClass =
+ Class.forName("com.sun.awt.AWTUtilities");
+ mSetComponentMixing =
+ awtUtilitiesClass.getMethod(
+ "setComponentMixingCutoutShape",
+ Component.class, Shape.class);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ // Cut out the shape
+ if (mSetComponentMixing != null) {
+ try {
+ mSetComponentMixing.invoke( null, this, s );
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+}
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 75a98ed..3e58d3c 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
@@ -58,9 +58,11 @@ public class DemoGL2ES1TextureImmModeSink implements GLEventListener, TextureDra
private GLU glu = new GLU();
private TextureData textureData;
private Texture texture;
+ boolean keepTextureBound;
public DemoGL2ES1TextureImmModeSink() {
this.ims = ImmModeSink.createFixed(32, 3, GL.GL_FLOAT, 4, GL.GL_FLOAT, 0, GL.GL_FLOAT, 2, GL.GL_FLOAT, GL.GL_STATIC_DRAW);
+ this.keepTextureBound = false;
}
public void setForceFFPEmu(boolean forceFFPEmu, boolean verboseFFPEmu, boolean debugFFPEmu, boolean traceFFPEmu) {
@@ -70,6 +72,17 @@ public class DemoGL2ES1TextureImmModeSink implements GLEventListener, TextureDra
this.traceFFPEmu = traceFFPEmu;
}
+
+ @Override
+ public void setKeepTextureBound(boolean v) {
+ this.keepTextureBound = v;
+ }
+ @Override
+ public Texture getTexture( ) {
+ return this.texture;
+ }
+
+ @Override
public void init(GLAutoDrawable drawable) {
GL _gl = drawable.getGL();
if(debugFFPEmu) {
@@ -87,15 +100,16 @@ public class DemoGL2ES1TextureImmModeSink implements GLEventListener, TextureDra
InputStream testTextureStream = testTextureUrlConn.getInputStream();
textureData = TextureIO.newTextureData(gl.getGLProfile(), testTextureStream , false /* mipmap */, TextureIO.PNG);
texture = TextureIO.newTexture(gl, textureData);
+ if( keepTextureBound && null != texture ) {
+ texture.enable(gl);
+ texture.bind(gl);
+ }
} catch (Exception e) {
e.printStackTrace();
}
}
- public Texture getTexture( ) {
- return this.texture;
- }
-
+ @Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
GL2ES1 gl = drawable.getGL().getGL2ES1();
gl.glMatrixMode(GL2ES1.GL_PROJECTION);
@@ -105,6 +119,7 @@ public class DemoGL2ES1TextureImmModeSink implements GLEventListener, TextureDra
gl.glLoadIdentity();
}
+ @Override
public void dispose(GLAutoDrawable drawable) {
GL2ES1 gl = drawable.getGL().getGL2ES1();
if(null!=texture) {
@@ -116,13 +131,16 @@ public class DemoGL2ES1TextureImmModeSink implements GLEventListener, TextureDra
}
}
+ @Override
public void display(GLAutoDrawable drawable) {
GL2ES1 gl = drawable.getGL().getGL2ES1();
// draw one quad with the texture
if(null!=texture) {
- texture.enable(gl);
- texture.bind(gl);
+ if( !keepTextureBound ) {
+ texture.enable(gl);
+ texture.bind(gl);
+ }
// gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_REPLACE);
TextureCoords coords = texture.getImageTexCoords();
ims.glBegin(ImmModeSink.GL_QUADS);
@@ -135,7 +153,9 @@ public class DemoGL2ES1TextureImmModeSink implements GLEventListener, TextureDra
ims.glTexCoord2f(coords.left(), coords.top());
ims.glVertex3f(0, 1, 0);
ims.glEnd(gl);
- texture.disable(gl);
+ if( !keepTextureBound ) {
+ texture.disable(gl);
+ }
}
}
}
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 9d84bc5..e8e3b12 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
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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;
import com.jogamp.newt.opengl.GLWindow;
@@ -45,7 +45,10 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestES1FixedFunctionPipelineNEWT extends UITestCase {
static int width, height;
@@ -78,30 +81,30 @@ public class TestES1FixedFunctionPipelineNEWT extends UITestCase {
glWindow.setVisible(true);
animator.setUpdateFPSFrames(1, null);
animator.start();
-
+
snap.setMakeSnapshot();
while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
Thread.sleep(100);
}
glWindow.removeGLEventListener(demo);
-
+
animator.stop();
glWindow.destroy();
}
-
+
protected void runTestGL(GLCapabilities caps, boolean forceFFPEmu) throws InterruptedException {
final RedSquareES1 demo01 = new RedSquareES1();
demo01.setForceFFPEmu(forceFFPEmu, false, false, false);
runTestGL0(caps, demo01);
-
+
final GearsES1 demo02 = new GearsES1();
demo02.setForceFFPEmu(forceFFPEmu, false, false, false);
runTestGL0(caps, demo02);
-
+
final DemoGL2ES1ImmModeSink demo03 = new DemoGL2ES1ImmModeSink(true);
demo03.setForceFFPEmu(forceFFPEmu, false, false, false);
runTestGL0(caps, demo03);
-
+
final DemoGL2ES1TextureImmModeSink demo04 = new DemoGL2ES1TextureImmModeSink();
demo04.setForceFFPEmu(forceFFPEmu, false, false, false);
runTestGL0(caps, demo04);
@@ -113,28 +116,28 @@ public class TestES1FixedFunctionPipelineNEWT extends UITestCase {
GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2));
runTestGL(caps, false);
}
-
+
@Test
- public void test03GL2FFPEmu() throws InterruptedException {
+ public void test02GL2FFPEmu() throws InterruptedException {
if(!GLProfile.isAvailable(GLProfile.GL2)) { System.err.println("GL2 n/a"); return; }
GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2));
runTestGL(caps, true);
}
-
+
@Test
- public void test04GL2ES1Normal() throws InterruptedException {
+ public void test03GL2ES1Normal() throws InterruptedException {
if(!GLProfile.isAvailable(GLProfile.GL2ES1)) { System.err.println("GL2ES1 n/a"); return; }
GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES1));
runTestGL(caps, false);
}
-
+
@Test
- public void test05ES2FFPEmu() throws InterruptedException {
+ public void test04ES2FFPEmu() throws InterruptedException {
if(!GLProfile.isAvailable(GLProfile.GLES2)) { System.err.println("GLES2 n/a"); return; }
GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2));
runTestGL(caps, false); // should be FFPEmu implicit
}
-
+
static long duration = 1000; // ms
public static void main(String args[]) {
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 d8bdf8a..0ac01bc 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
@@ -36,6 +36,8 @@ import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLProfile;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.util.MiscUtils;
@@ -44,6 +46,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
/**
* Testing the ImmModeSink w/ GL2ES1 context
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestImmModeSinkES1NEWT extends UITestCase {
static int duration = 100;
static final int iWidth = 400;
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 165a3b8..de6aef5 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
@@ -36,6 +36,8 @@ import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLProfile;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.util.MiscUtils;
@@ -44,6 +46,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
/**
* Testing the ImmModeSink w/ GL2ES1 context
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestImmModeSinkES2NEWT extends UITestCase {
static int duration = 100;
static final int iWidth = 400;
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
new file mode 100644
index 0000000..679f069
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug817GLReadBufferUtilGLCTXDefFormatTypeES2NEWT.java
@@ -0,0 +1,130 @@
+/**
+ * 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.
+ */
+
+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 org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.newt.opengl.GLWindow;
+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 com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes;
+import com.jogamp.opengl.util.GLPixelBuffer.GLPixelBufferProvider;
+import com.jogamp.opengl.util.GLReadBufferUtil;
+import com.jogamp.opengl.util.texture.TextureIO;
+
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestBug817GLReadBufferUtilGLCTXDefFormatTypeES2NEWT extends UITestCase {
+ static long durationPerTest = 60; // ms
+
+ public static void main(String[] args) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ durationPerTest = MiscUtils.atoi(args[++i], 500);
+ }
+ }
+ System.out.println("durationPerTest: "+durationPerTest);
+ String tstname = TestBug817GLReadBufferUtilGLCTXDefFormatTypeES2NEWT.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
+
+ @Test
+ public void test00_RGBtoRGB() throws InterruptedException {
+ testImpl(false, false, false, false);
+ }
+ @Test
+ public void test01_RGBtoRGBA() throws InterruptedException {
+ testImpl(false, true, false, false);
+ }
+
+ @Test
+ public void test10_RGBAtoRGB() throws InterruptedException {
+ testImpl(true, false, false, false);
+ }
+ @Test
+ public void test11_RGBAtoRGBA() throws InterruptedException {
+ testImpl(true, true, false, false);
+ }
+ @Test
+ public void test21_RGBtoRGBA_pbuffer() throws InterruptedException {
+ testImpl(false, true, true, false);
+ }
+ @Test
+ public void test22_RGBtoRGBA_fbo() throws InterruptedException {
+ testImpl(false, true, false, true);
+ }
+ @Test
+ public void test31_RGBAtoRGBA_pbuffer() throws InterruptedException {
+ testImpl(true, true, true, false);
+ }
+ @Test
+ public void test32_RGBAtoRGBA_fbo() throws InterruptedException {
+ testImpl(true, true, false, true);
+ }
+
+ private void testImpl(final boolean alphaCaps, final boolean readAlpha, boolean pbuffer, boolean fbo) throws InterruptedException {
+ final GLReadBufferUtil screenshot = new GLReadBufferUtil(readAlpha ? true : false, false);
+ GLProfile glp = GLProfile.getGL2ES2();
+ GLCapabilities caps = new GLCapabilities(glp);
+
+ caps.setAlphaBits( alphaCaps ? 1 : 0 );
+ caps.setPBuffer( pbuffer );
+ caps.setFBO( fbo);
+
+ final GLWindow window = GLWindow.create(caps);
+ window.addGLEventListener(new GearsES2());
+ window.addGLEventListener(new GLEventListener() {
+ int displayCount = 0;
+ public void init(GLAutoDrawable drawable) {}
+ public void dispose(GLAutoDrawable drawable) {}
+ public void display(GLAutoDrawable drawable) {
+ final GLPixelBufferProvider pixelBufferProvider = screenshot.getPixelBufferProvider();
+ final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(drawable.getGL(), readAlpha ? 4 : 3);
+ System.err.println("GLPixelAttributes: "+pixelAttribs);
+ snapshot(displayCount++, null, drawable.getGL(), screenshot, TextureIO.PNG, null);
+ }
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { }
+ });
+ window.setSize(512, 512);
+ window.setVisible(true);
+ window.requestFocus();
+
+ Thread.sleep(durationPerTest);
+
+ window.destroy();
+ }
+
+}
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 e2252d6..21987c5 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
@@ -51,7 +51,10 @@ import org.junit.Assert;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLReadBufferUtilTextureIOWrite01AWT extends UITestCase {
static GLProfile glp;
static GLCapabilities caps;
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 16bd94c..521e89a 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
@@ -44,7 +44,10 @@ import com.jogamp.opengl.test.junit.jogl.offscreen.WindowUtilNEWT;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLReadBufferUtilTextureIOWrite01NEWT extends UITestCase {
static GLProfile glp;
static GLCapabilities caps;
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 bec55d8..3822bff 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
@@ -52,7 +52,10 @@ import org.junit.Assert;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLReadBufferUtilTextureIOWrite02AWT extends UITestCase {
static GLProfile glp;
static GLCapabilities caps;
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 36d905a..9615297 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
@@ -46,7 +46,10 @@ import com.jogamp.opengl.test.junit.jogl.offscreen.WindowUtilNEWT;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLReadBufferUtilTextureIOWrite02NEWT extends UITestCase {
static GLProfile glp;
static GLCapabilities caps;
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 5181dc2..c92174a 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
@@ -39,6 +39,8 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.util.IOUtil;
import com.jogamp.newt.opengl.GLWindow;
@@ -61,6 +63,7 @@ import javax.media.opengl.GL;
* Main function accepts arbitrary JPG file name for manual tests.
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestJPEGImage01NEWT extends UITestCase {
static boolean showFPS = false;
@@ -80,7 +83,7 @@ public class TestJPEGImage01NEWT extends UITestCase {
}
final int internalFormat;
- if(glp.isGL2GL3()) {
+ if(glp.isGL2ES3()) {
internalFormat = hasAlpha ? GL.GL_RGBA8 : GL.GL_RGB8;
} else {
internalFormat = hasAlpha ? GL.GL_RGBA : GL.GL_RGB;
@@ -105,7 +108,7 @@ public class TestJPEGImage01NEWT extends UITestCase {
// load texture from file inside current GL context to match the way
// the bug submitter was doing it
- final GLEventListener gle = new TextureDraw01ES2Listener( texData ) ;
+ final GLEventListener gle = new TextureDraw01ES2Listener( texData, 0 ) ;
glad.addGLEventListener(gle);
glad.addGLEventListener(new GLEventListener() {
boolean shot = false;
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 1e27f5d..bd2488e 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
@@ -48,7 +48,10 @@ import java.net.URLConnection;
import java.nio.Buffer;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestJPEGJoglAWTBenchmarkNewtAWT extends UITestCase {
static boolean showFPS = false;
static String fname = "j1-baseline.jpg";
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 0df2756..dbb4002 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
@@ -59,7 +59,10 @@ import java.net.URLConnection;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestJPEGJoglAWTCompareNewtAWT extends UITestCase {
static boolean showFPS = false;
static long duration = 100; // ms
@@ -134,7 +137,7 @@ public class TestJPEGJoglAWTCompareNewtAWT extends UITestCase {
// load texture from file inside current GL context to match the way
// the bug submitter was doing it
- final GLEventListener gle = new TextureDraw01ES2Listener( texData ) ;
+ final GLEventListener gle = new TextureDraw01ES2Listener( texData, 0 ) ;
glad1.addGLEventListener(gle);
glad1.addGLEventListener(new GLEventListener() {
boolean shot = false;
@@ -190,7 +193,7 @@ public class TestJPEGJoglAWTCompareNewtAWT extends UITestCase {
// the bug submitter was doing it
final GLEventListener gle;
if( texData != null ) {
- gle = new TextureDraw01ES2Listener( texData ) ;
+ gle = new TextureDraw01ES2Listener( texData, 0 ) ;
glad1.addGLEventListener(gle);
} else {
gle = null;
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 adce624..60855e5 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
@@ -56,7 +56,10 @@ import org.junit.Assert;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestJPEGTextureFromFileNEWT extends UITestCase {
static boolean showFPS = false;
static long duration = 100; // ms
@@ -181,7 +184,7 @@ public class TestJPEGTextureFromFileNEWT extends UITestCase {
// load texture from file inside current GL context to match the way
// the bug submitter was doing it
- final GLEventListener gle = useFFP ? new TextureDraw01GL2Listener( texData ) : new TextureDraw01ES2Listener( texData ) ;
+ final GLEventListener gle = useFFP ? new TextureDraw01GL2Listener( texData ) : new TextureDraw01ES2Listener( texData, 0 ) ;
glad.addGLEventListener(gle);
glad.addGLEventListener(new GLEventListener() {
boolean shot = false;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGImage00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGImage00NEWT.java
index aedb6a5..f4b3cab 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGImage00NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGImage00NEWT.java
@@ -34,11 +34,14 @@ import java.net.URLConnection;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.util.IOUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.texture.spi.PNGImage;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestPNGImage00NEWT extends UITestCase {
@Test
public void testPNGReadWriteAndCompare() throws InterruptedException, IOException, MalformedURLException {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGImage01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGImage01NEWT.java
index 839a198..29e0419 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGImage01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGImage01NEWT.java
@@ -40,6 +40,8 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.util.IOUtil;
import com.jogamp.newt.opengl.GLWindow;
@@ -61,6 +63,7 @@ import com.jogamp.opengl.util.texture.spi.PNGImage;
* Main function accepts arbitrary PNG file name for manual tests.
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestPNGImage01NEWT extends UITestCase {
static boolean showFPS = false;
@@ -80,7 +83,7 @@ public class TestPNGImage01NEWT extends UITestCase {
}
final int internalFormat;
- if(glp.isGL2GL3()) {
+ if(glp.isGL2ES3()) {
internalFormat = hasAlpha ? GL.GL_RGBA8 : GL.GL_RGB8;
} else {
internalFormat = hasAlpha ? GL.GL_RGBA : GL.GL_RGB;
@@ -106,7 +109,7 @@ public class TestPNGImage01NEWT extends UITestCase {
// load texture from file inside current GL context to match the way
// the bug submitter was doing it
- final TextureDraw01ES2Listener gle = new TextureDraw01ES2Listener( texData ) ;
+ final TextureDraw01ES2Listener gle = new TextureDraw01ES2Listener( texData, 0 ) ;
// gle.setClearColor(new float[] { 1.0f, 0.0f, 0.0f, 1.0f } );
glad.addGLEventListener(gle);
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 756a8d8..191d67d 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
@@ -62,6 +62,8 @@ import org.junit.Assume;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* Unit test for bug 417, which shows a GLException when reading a grayscale texture.
@@ -69,6 +71,7 @@ import org.junit.Test;
* after the bug was submitted.
* @author Wade Walker, et.al.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestPNGTextureFromFileAWT extends UITestCase {
static boolean showFPS = false;
static long duration = 100; // ms
@@ -130,7 +133,7 @@ public class TestPNGTextureFromFileAWT extends UITestCase {
// load texture from file inside current GL context to match the way
// the bug submitter was doing it
- final GLEventListener gle = useFFP ? new TextureDraw01GL2Listener( texData ) : new TextureDraw01ES2Listener( texData ) ;
+ final GLEventListener gle = useFFP ? new TextureDraw01GL2Listener( texData ) : new TextureDraw01ES2Listener( texData, 0 ) ;
glc.addGLEventListener(gle);
glc.addGLEventListener(new GLEventListener() {
boolean shot = false;
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 42e5230..ce363b6 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
@@ -56,7 +56,10 @@ import org.junit.Assert;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestPNGTextureFromFileNEWT extends UITestCase {
static boolean showFPS = false;
static long duration = 100; // ms
@@ -171,7 +174,7 @@ public class TestPNGTextureFromFileNEWT extends UITestCase {
// load texture from file inside current GL context to match the way
// the bug submitter was doing it
- final GLEventListener gle = useFFP ? new TextureDraw01GL2Listener( texData ) : new TextureDraw01ES2Listener( texData ) ;
+ final GLEventListener gle = useFFP ? new TextureDraw01GL2Listener( texData ) : new TextureDraw01ES2Listener( texData, 0 ) ;
glad.addGLEventListener(gle);
glad.addGLEventListener(new GLEventListener() {
boolean shot = false;
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 17c3d3e..859e4e4 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
@@ -41,6 +41,8 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.util.IOUtil;
import com.jogamp.newt.opengl.GLWindow;
@@ -55,6 +57,7 @@ import com.jogamp.opengl.util.GLReadBufferUtil;
import com.jogamp.opengl.util.texture.TextureData;
import com.jogamp.opengl.util.texture.TextureIO;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestTGATextureFromFileNEWT extends UITestCase {
static boolean showFPS = false;
static long duration = 100; // ms
@@ -102,7 +105,7 @@ public class TestTGATextureFromFileNEWT extends UITestCase {
// load texture from file inside current GL context to match the way
// the bug submitter was doing it
- final GLEventListener gle = useFFP ? new TextureDraw01GL2Listener( texData ) : new TextureDraw01ES2Listener( texData ) ;
+ final GLEventListener gle = useFFP ? new TextureDraw01GL2Listener( texData ) : new TextureDraw01ES2Listener( texData, 0 ) ;
glad.addGLEventListener(gle);
glad.addGLEventListener(new GLEventListener() {
boolean shot = false;
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 6913cf3..855529f 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
@@ -61,6 +61,8 @@ import org.junit.Assume;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* Demonstrates TextureData w/ AWT usage in both directions,
@@ -68,6 +70,7 @@ import org.junit.Test;
* as well as reading out GL framebuffer and displaying it
* as an BufferedImage.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestTexture01AWT extends UITestCase {
static long durationPerTest = 500;
static GLProfile glp;
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 5948f59..566ce0f 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
@@ -52,12 +52,15 @@ import org.junit.Assert;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
/**
* Demonstrates TextureData w/ AWT usage,
* i.e. reading out an animated GL framebuffer and displaying it
* as an BufferedImage.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestTexture02AWT extends UITestCase {
static long durationPerTest = 500;
static GLProfile glp;
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 7bad837..2b3ead5 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
@@ -12,6 +12,8 @@ import org.junit.Assert;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.opengl.test.junit.jogl.demos.TextureSequenceDemo01;
import com.jogamp.opengl.test.junit.jogl.demos.es2.TextureSequenceCubeES2;
@@ -20,6 +22,7 @@ import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestTextureSequence01AWT extends UITestCase {
static boolean showFPS = false;
static int width = 510;
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 ae4d2c3..5145e10 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
@@ -8,6 +8,8 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.jogl.demos.TextureSequenceDemo01;
@@ -17,6 +19,7 @@ import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestTextureSequence01NEWT extends UITestCase {
static boolean showFPS = false;
static int width = 510;
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/DemoCreateAndDisposeOnCloseNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/DemoCreateAndDisposeOnCloseNEWT.java
new file mode 100644
index 0000000..e82204f
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/newt/DemoCreateAndDisposeOnCloseNEWT.java
@@ -0,0 +1,140 @@
+/**
+ * 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.
+ */
+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.newt.event.WindowEvent;
+import com.jogamp.newt.event.WindowAdapter;
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.util.Animator;
+
+/**
+ * Manual test case validating closing behavior.
+ * <p>
+ * Validates bugs:
+ * <ul>
+ * <li>Bug 882: Crash on OSX when closing NEWT window</li>
+ * </ul>
+ * </p>
+ *
+ */
+public class DemoCreateAndDisposeOnCloseNEWT {
+ public static void main(String[] args) {
+ int closeMode = 0; // 0 - none, 1 - window, animator, 2 - animator, window, 3 - System.exit
+
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-close")) {
+ closeMode = MiscUtils.atoi(args[++i], closeMode);
+ }
+ }
+ System.err.println("Close Mode: "+closeMode);
+
+ final GLCapabilities caps = new GLCapabilities(GLProfile.getMaxProgrammable(true));
+ caps.setBackgroundOpaque(true);
+ caps.setDoubleBuffered(true);
+ caps.setDepthBits(16);
+ final Animator animator = new Animator();
+ GLWindow glWindow = GLWindow.create(caps);
+ animator.add(glWindow);
+ glWindow.addGLEventListener(new GLEventListener() {
+ @Override
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ System.out.println("GLEventListener.reshape");
+ }
+
+ @Override
+ public void init(GLAutoDrawable drawable) {
+ System.out.println("GLEventListener.init");
+ }
+
+ @Override
+ public void dispose(GLAutoDrawable drawable) {
+ System.out.println("GLEventListener.dispose");
+ }
+
+ @Override
+ public void display(GLAutoDrawable drawable) {
+ }
+ });
+ glWindow.setTitle("Test");
+ glWindow.setSize(1024, 768);
+ glWindow.setUndecorated(false);
+ glWindow.setPointerVisible(true);
+ glWindow.setVisible(true);
+ glWindow.setFullscreen(false);
+ glWindow.setDefaultCloseOperation(WindowClosingProtocol.WindowClosingMode.DISPOSE_ON_CLOSE);
+ glWindow.addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowDestroyNotify(WindowEvent e) {
+ System.out.println("GLWindow.destroyNotify");
+ }
+
+ @Override
+ public void windowDestroyed(WindowEvent e) {
+ System.out.println("GLWindow.destroyed");
+ animator.stop();
+ }
+ });
+
+ animator.start();
+
+ switch( closeMode ) {
+ case 1:
+ sleep1s();
+ glWindow.destroy();
+ sleep1s();
+ animator.stop();
+ break;
+ case 2:
+ sleep1s();
+ animator.stop();
+ sleep1s();
+ glWindow.destroy();
+ break;
+ case 3:
+ sleep1s();
+ System.exit(0);
+ break;
+ default: break; // 0 - nop
+ }
+ }
+ static void sleep1s() {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
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 d631934..817f414 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestCloseNewtAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestCloseNewtAWT.java
@@ -29,6 +29,8 @@
package com.jogamp.opengl.test.junit.newt;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import org.junit.Assert;
import java.lang.reflect.InvocationTargetException;
@@ -47,6 +49,7 @@ import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.AWTRobotUtil.WindowClosingListener;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestCloseNewtAWT extends UITestCase {
GLWindow newtWindow = null;
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 6a248bc..b007f57 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle01NEWT.java
@@ -31,6 +31,8 @@ package com.jogamp.opengl.test.junit.newt;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import javax.media.opengl.*;
@@ -45,6 +47,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestDisplayLifecycle01NEWT extends UITestCase {
static GLProfile glp;
static GLCapabilities caps;
@@ -205,7 +208,7 @@ public class TestDisplayLifecycle01NEWT extends UITestCase {
final EDTUtil edtUtil = display.getEDTUtil();
Assert.assertNotNull(edtUtil);
Assert.assertEquals(false,edtUtil.isRunning());
- edtUtil.restart();
+ edtUtil.start();
edtUtil.invoke(true, null);
Assert.assertEquals(true,edtUtil.isRunning());
edtUtil.invokeStop(true, null);
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 3ab81bd..87cb6f0 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle02NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle02NEWT.java
@@ -31,6 +31,8 @@ package com.jogamp.opengl.test.junit.newt;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import javax.media.opengl.*;
@@ -44,6 +46,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestDisplayLifecycle02NEWT extends UITestCase {
static GLProfile glp;
static GLCapabilities caps;
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 ecf0ada..a2100cf 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestEventSourceNotAWTBug.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestEventSourceNotAWTBug.java
@@ -30,6 +30,8 @@ package com.jogamp.opengl.test.junit.newt;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
@@ -48,6 +50,7 @@ import com.jogamp.opengl.test.junit.util.*;
/**
* This simple program will throw a {@link RuntimeException} when the application is closed.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestEventSourceNotAWTBug extends UITestCase {
@BeforeClass
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java b/src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java
index 78be14d..5f37023 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java
@@ -48,6 +48,8 @@ import java.io.IOException;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.opengl.GLWindow;
@@ -65,6 +67,7 @@ import com.jogamp.opengl.test.junit.util.*;
* <i>+ Container is the JFrame's implicit root content pane</i><br/>
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestFocus01SwingAWTRobot extends UITestCase {
static int width, height;
static long durationPerTest = 10;
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus02SwingAWTRobot.java b/src/test/com/jogamp/opengl/test/junit/newt/TestFocus02SwingAWTRobot.java
index 5b07c73..1c1ba90 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus02SwingAWTRobot.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestFocus02SwingAWTRobot.java
@@ -34,6 +34,8 @@ import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import java.awt.AWTException;
import java.awt.Button;
@@ -65,6 +67,7 @@ import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
* <i>+ JPanel is set as JFrame's root content pane</i><br/>
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestFocus02SwingAWTRobot extends UITestCase {
static int width, height;
static long durationPerTest = 10;
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 ba69481..75a9e87 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowInvisiblePointer01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowInvisiblePointer01NEWT.java
@@ -11,6 +11,8 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.Screen;
import com.jogamp.newt.opengl.GLWindow;
@@ -18,6 +20,7 @@ import com.jogamp.opengl.test.junit.jogl.demos.es1.GearsES1;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLWindowInvisiblePointer01NEWT extends UITestCase {
static GLProfile glp;
static int width, height;
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 ffbd9d1..d6b550c 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowWarpPointer01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowWarpPointer01NEWT.java
@@ -13,6 +13,8 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.Screen;
import com.jogamp.newt.event.MouseAdapter;
@@ -22,6 +24,7 @@ import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLWindowWarpPointer01NEWT extends UITestCase {
static GLProfile glp;
static int width, height;
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 309d7c7..384b680 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java
@@ -31,6 +31,8 @@ package com.jogamp.opengl.test.junit.newt;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import javax.media.opengl.*;
@@ -43,6 +45,7 @@ import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import javax.media.nativewindow.AbstractGraphicsDevice;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLWindows00NEWT extends UITestCase {
static GLProfile glp;
static int width, height;
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 0c6f60b..2b3e448 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java
@@ -31,6 +31,8 @@ package com.jogamp.opengl.test.junit.newt;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import javax.media.opengl.*;
@@ -43,6 +45,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLWindows01NEWT extends UITestCase {
static GLProfile glp;
static int width, height;
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 e1c6c75..86cb533 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java
@@ -32,6 +32,8 @@ package com.jogamp.opengl.test.junit.newt;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import javax.media.opengl.*;
@@ -45,6 +47,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLWindows02NEWTAnimated extends UITestCase {
static GLProfile glp;
static int width, height;
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 fa7f0f9..91937c8 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestListenerCom01AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestListenerCom01AWT.java
@@ -31,6 +31,8 @@ package com.jogamp.opengl.test.junit.newt;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import java.awt.Frame;
@@ -47,6 +49,7 @@ import java.lang.reflect.InvocationTargetException;
import com.jogamp.opengl.test.junit.util.*;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestListenerCom01AWT extends UITestCase {
static int width, height;
static long durationPerTest = 500;
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 ef830b6..d4e8e7e 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java
@@ -31,6 +31,8 @@ package com.jogamp.opengl.test.junit.newt;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import javax.media.opengl.*;
@@ -46,6 +48,7 @@ import com.jogamp.opengl.test.junit.jogl.demos.es1.GearsES1;
import javax.media.nativewindow.AbstractGraphicsDevice;
import javax.media.nativewindow.NativeWindowException;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestRemoteGLWindows01NEWT extends UITestCase {
static int width = 640, height = 480;
static long durationPerTest = 100; // ms
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 53995e8..a26b96e 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteWindow01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteWindow01NEWT.java
@@ -33,6 +33,8 @@ import org.junit.Assert;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import javax.media.nativewindow.*;
@@ -41,6 +43,7 @@ import java.io.IOException;
import com.jogamp.opengl.test.junit.util.UITestCase;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestRemoteWindow01NEWT extends UITestCase {
static int width, height;
static String remoteDisplay = "localhost:0.0";
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 acaa279..a88b207 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java
@@ -29,6 +29,8 @@
package com.jogamp.opengl.test.junit.newt;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import org.junit.Assert;
import java.lang.reflect.InvocationTargetException;
@@ -48,6 +50,7 @@ import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.AWTRobotUtil.WindowClosingListener;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestWindowClosingProtocol01AWT extends UITestCase {
@Test
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 8d32bee..020581c 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java
@@ -31,6 +31,8 @@ package com.jogamp.opengl.test.junit.newt;
import java.lang.reflect.InvocationTargetException;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import org.junit.Assert;
import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode;
@@ -45,6 +47,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;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestWindowClosingProtocol02NEWT extends UITestCase {
@Test
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 45b4121..efc833d 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java
@@ -31,6 +31,8 @@ package com.jogamp.opengl.test.junit.newt;
import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.opengl.GLWindow;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import org.junit.Assert;
import java.lang.reflect.InvocationTargetException;
@@ -48,6 +50,7 @@ import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.AWTRobotUtil.WindowClosingListener;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestWindowClosingProtocol03NewtAWT extends UITestCase {
@Test
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 e03b5e7..6b44a4b 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java
@@ -31,6 +31,8 @@ package com.jogamp.opengl.test.junit.newt;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import javax.media.nativewindow.*;
@@ -39,6 +41,7 @@ import java.io.IOException;
import com.jogamp.opengl.test.junit.util.UITestCase;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestWindows01NEWT extends UITestCase {
static int width, height;
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 a959a56..44d6a2d 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
@@ -35,7 +35,9 @@ import javax.media.opengl.GLProfile ;
import org.junit.Assert ;
import org.junit.BeforeClass ;
+import org.junit.FixMethodOrder;
import org.junit.Test ;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.util.RunnableTask;
import com.jogamp.newt.event.MouseEvent;
@@ -47,7 +49,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase ;
* class defines most of the tests, but leaves the type of window
* and canvas up to subclasses.
*/
-
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public abstract class BaseNewtEventModifiers extends UITestCase {
////////////////////////////////////////////////////////////////////////////
@@ -298,8 +300,8 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
_numButtonsToTest = 3 ;
{
- if( _numButtonsToTest > com.jogamp.newt.event.MouseEvent.BUTTON_NUMBER ) {
- _numButtonsToTest = com.jogamp.newt.event.MouseEvent.BUTTON_NUMBER ;
+ if( _numButtonsToTest > com.jogamp.newt.event.MouseEvent.BUTTON_COUNT ) {
+ _numButtonsToTest = com.jogamp.newt.event.MouseEvent.BUTTON_COUNT ;
}
// These two arrays are assumed to be peers, i.e. are the same
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 1504c94..f1906f5 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
@@ -37,6 +37,8 @@ import javax.swing.WindowConstants ;
import org.junit.AfterClass ;
import org.junit.Assert;
import org.junit.BeforeClass ;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.event.awt.AWTMouseAdapter ;
import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
@@ -47,6 +49,7 @@ import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
* the source is an AWT canvas.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestNewtEventModifiersAWTCanvas extends BaseNewtEventModifiers {
private static JFrame _testFrame ;
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 71191c8..c4bd3eb 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
@@ -34,6 +34,8 @@ import javax.media.opengl.GLProfile;
import org.junit.AfterClass ;
import org.junit.Assert;
import org.junit.BeforeClass ;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
@@ -42,6 +44,7 @@ import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
/**
* Test whether or not event modifiers are properly delivered by NEWT.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestNewtEventModifiersNEWTWindowAWT extends BaseNewtEventModifiers {
private static GLWindow _glWindow;
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 e0bc847..0abadb0 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
@@ -40,6 +40,8 @@ import javax.swing.WindowConstants ;
import org.junit.AfterClass ;
import org.junit.Assert;
import org.junit.BeforeClass ;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.awt.NewtCanvasAWT ;
import com.jogamp.newt.opengl.GLWindow ;
@@ -50,7 +52,7 @@ import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
* Test whether or not event modifiers are preserved by NEWT when
* the canvas is a NewtCanvasAWT.
*/
-
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestNewtEventModifiersNewtCanvasAWT extends BaseNewtEventModifiers {
private static JFrame _testFrame ;
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 349d200..2a6b8ba 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
@@ -41,6 +41,8 @@ import org.junit.AfterClass ;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.BeforeClass ;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.nativewindow.swt.SWTAccessor;
import com.jogamp.newt.opengl.GLWindow ;
@@ -52,7 +54,7 @@ import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
* Test whether or not event modifiers preserved by NEWT when
* the canvas is a NewtCanvasSWT.
*/
-
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestNewtEventModifiersNewtCanvasSWTAWT extends BaseNewtEventModifiers {
private static Display _display = null;
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 0f79d9b..4be8192 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
@@ -51,6 +51,8 @@ import jogamp.nativewindow.jawt.JAWTUtil;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.event.InputEvent;
@@ -69,6 +71,7 @@ import com.jogamp.opengl.test.junit.util.*;
* even though we do unify VK codes to US keyboard across all layouts.
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestNewtKeyCodeModifiersAWT extends UITestCase {
static int width, height;
static long durationPerTest = 100;
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 333a21b..4778b4f 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
@@ -52,6 +52,8 @@ import jogamp.nativewindow.jawt.JAWTUtil;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.event.KeyEvent;
@@ -65,6 +67,7 @@ import com.jogamp.opengl.test.junit.util.NEWTKeyUtil.CodeSeg;
/**
* Testing key code of key events.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestNewtKeyCodesAWT extends UITestCase {
static int width, height;
static long durationPerTest = 100;
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 8b8a5ac..34e81c0 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
@@ -50,6 +50,8 @@ import java.io.IOException;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.event.InputEvent;
@@ -82,6 +84,7 @@ import com.jogamp.opengl.test.junit.util.*;
* The idea is if you mask out auto-repeat in your event listener
* you just get one long pressed key D/U tuple.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestNewtKeyEventAutoRepeatAWT extends UITestCase {
static int width, height;
static long durationPerTest = 100;
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 d0c3813..23de0e9 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
@@ -49,6 +49,8 @@ import jogamp.nativewindow.jawt.JAWTUtil;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.opengl.GLWindow;
@@ -68,6 +70,7 @@ import com.jogamp.opengl.test.junit.util.*;
* </ol>
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestNewtKeyEventOrderAWT extends UITestCase {
static int width, height;
static long durationPerTest = 100;
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 e0d2ae2..f48a07a 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
@@ -49,6 +49,8 @@ import jogamp.nativewindow.jawt.JAWTUtil;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.event.InputEvent;
@@ -63,6 +65,7 @@ import com.jogamp.opengl.test.junit.util.*;
/**
* Testing key press and release events w/o AUTO-REPEAT
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestNewtKeyPressReleaseUnmaskRepeatAWT extends UITestCase {
static int width, height;
static long durationPerTest = 100;
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 151cc0a..93e005b 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
@@ -34,6 +34,8 @@ import javax.media.nativewindow.NativeWindowFactory;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.util.ArrayHashSet;
import com.jogamp.newt.Display;
@@ -62,6 +64,7 @@ import jogamp.newt.MonitorModeProps;
* Also validates the descending order of the given MonitorMode lists.
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestScreenMode00aNEWT extends UITestCase {
static int screenIdx = 0;
static int width, height;
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 d5323e1..69f19c2 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
@@ -34,6 +34,8 @@ import javax.media.nativewindow.NativeWindowFactory;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.Display;
import com.jogamp.newt.MonitorDevice;
@@ -55,6 +57,7 @@ import javax.media.opengl.GLCapabilitiesImmutable;
* Queries the current MonitorMode 50 times,
* stressing a possible race condition.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestScreenMode00bNEWT extends UITestCase {
static int width, height;
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 bc1dcf7..de856e5 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
@@ -36,6 +36,8 @@ import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.Display;
import com.jogamp.newt.MonitorDevice;
@@ -58,6 +60,7 @@ import javax.media.nativewindow.util.Dimension;
/**
* Tests X11 XRandR MonitorMode reset via {@link UITestCase#resetXRandRIfX11()}.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestScreenMode00cNEWT extends UITestCase {
static boolean manualTest = false;
static GLProfile glp;
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 bff2206..0f3dbee 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
@@ -36,6 +36,8 @@ import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.Display;
import com.jogamp.newt.MonitorDevice;
@@ -63,6 +65,7 @@ import javax.media.nativewindow.util.Dimension;
*
* @see TestScreenMode01dNEWT#cleanupGL()
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestScreenMode01aNEWT extends UITestCase {
static GLProfile glp;
static int width, height;
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 3c363b3..4804a75 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
@@ -36,6 +36,8 @@ import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.Display;
import com.jogamp.newt.MonitorDevice;
@@ -58,6 +60,7 @@ import javax.media.nativewindow.util.RectangleImmutable;
/**
* Mode change on separate monitors ..
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestScreenMode01bNEWT extends UITestCase {
static GLProfile glp;
static int width, height;
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 6a7a399..db6360a 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
@@ -36,6 +36,8 @@ import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.Display;
import com.jogamp.newt.MonitorDevice;
@@ -58,6 +60,7 @@ import javax.media.nativewindow.util.RectangleImmutable;
/**
* Fullscreen on separate monitors, incl. spanning across multiple monitors.
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestScreenMode01cNEWT extends UITestCase {
static GLProfile glp;
static int width, height;
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 b4fd132..6158e62 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
@@ -38,6 +38,8 @@ import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.Display;
import com.jogamp.newt.MonitorDevice;
@@ -66,6 +68,7 @@ import javax.media.nativewindow.util.RectangleImmutable;
* <p>
* Also documents NV RANDR/GL bug, see {@link TestScreenMode01dNEWT#cleanupGL()}.</p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestScreenMode01dNEWT extends UITestCase {
static GLProfile glp;
static int width, height;
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 2575166..e87194b 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
@@ -37,6 +37,8 @@ import com.jogamp.opengl.util.Animator;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.os.Platform;
import com.jogamp.newt.Display;
@@ -60,6 +62,7 @@ import javax.media.nativewindow.util.Dimension;
* MonitorMode change does not use highest resolution.
* </p>
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestScreenMode02aNEWT extends UITestCase {
static GLProfile glp;
static int width, height;
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 aa1bbad..2da2abd 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
@@ -36,6 +36,8 @@ import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.os.Platform;
import com.jogamp.newt.Display;
@@ -70,6 +72,7 @@ import javax.media.nativewindow.util.Dimension;
*
* @see TestScreenMode01NEWT#cleanupGL()
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestScreenMode02bNEWT extends UITestCase {
static GLProfile glp;
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 9d08d8f..4bf1f95 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
@@ -35,33 +35,58 @@ import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
public class NewtAWTReparentingKeyAdapter extends KeyAdapter {
- Frame frame;
- NewtCanvasAWT newtCanvasAWT;
- GLWindow glWindow;
+ final Frame frame;
+ final NewtCanvasAWT newtCanvasAWT;
+ final GLWindow glWindow;
+ final QuitAdapter quitAdapter;
- public NewtAWTReparentingKeyAdapter(Frame frame, NewtCanvasAWT newtCanvasAWT, GLWindow glWindow) {
+ public NewtAWTReparentingKeyAdapter(Frame frame, NewtCanvasAWT newtCanvasAWT, GLWindow glWindow, QuitAdapter quitAdapter) {
this.frame = frame;
this.newtCanvasAWT = newtCanvasAWT;
this.glWindow = glWindow;
+ this.quitAdapter = quitAdapter;
}
public void keyReleased(KeyEvent e) {
if( !e.isPrintableKey() || e.isAutoRepeat() ) {
return;
}
- if(e.getKeyChar()=='i') {
+ if( e.getKeySymbol() == KeyEvent.VK_I ) {
System.err.println(glWindow);
- } else if(e.getKeyChar()=='d') {
- glWindow.setUndecorated(!glWindow.isUndecorated());
- } else if(e.getKeyChar()=='f') {
- glWindow.setFullscreen(!glWindow.isFullscreen());
- } else if(e.getKeyChar()=='l') {
+ } else if( e.getKeySymbol() == KeyEvent.VK_L ) {
javax.media.nativewindow.util.Point p0 = newtCanvasAWT.getNativeWindow().getLocationOnScreen(null);
javax.media.nativewindow.util.Point p1 = glWindow.getLocationOnScreen(null);
System.err.println("NewtCanvasAWT position: "+p0+", "+p1);
- } else if(e.getKeyChar()=='p') {
+ } else if( e.getKeySymbol() == KeyEvent.VK_D ) {
+ glWindow.setUndecorated(!glWindow.isUndecorated());
+ } else if( e.getKeySymbol() == KeyEvent.VK_S ) {
+ if(glWindow.getParent()==null) {
+ System.err.println("XXX glWin to 100/100");
+ glWindow.setPosition(100, 100);
+ } else {
+ System.err.println("XXX glWin to 0/0");
+ glWindow.setPosition(0, 0);
+ }
+ } else if( e.getKeySymbol() == KeyEvent.VK_F ) {
+ if( null != quitAdapter ) {
+ quitAdapter.enable(false);
+ }
+ new Thread() {
+ public void run() {
+ final Thread t = glWindow.setExclusiveContextThread(null);
+ System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
+ glWindow.setFullscreen(!glWindow.isFullscreen());
+ System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
+ glWindow.setExclusiveContextThread(t);
+ if( null != quitAdapter ) {
+ quitAdapter.clear();
+ quitAdapter.enable(true);
+ }
+ } }.start();
+ } else if( e.getKeySymbol() == KeyEvent.VK_P ) {
new Thread() {
public void run() {
if(glWindow.getAnimator().isPaused()) {
@@ -71,34 +96,44 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter {
}
}
}.run();
- } else if(e.getKeyChar()=='r') {
- if(glWindow.getParent()==null) {
- System.err.println("XXX glWin to home");
- glWindow.reparentWindow(newtCanvasAWT.getNativeWindow());
- } else {
- final InsetsImmutable nInsets = glWindow.getInsets();
- java.awt.Insets aInsets = frame.getInsets();
- System.err.println("XXX glWin to TOP - insets " + nInsets + ", " + aInsets);
- glWindow.reparentWindow(null);
- int dx, dy;
- if(nInsets.getTotalHeight()==0) {
- dx = aInsets.left;
- dy = aInsets.top;
- } else {
- dx = nInsets.getLeftWidth();
- dy = nInsets.getTopHeight();
- }
- glWindow.setPosition(frame.getX()+frame.getWidth()+dx, frame.getY()+dy);
- }
- glWindow.requestFocus();
- } else if(e.getKeyChar()=='s') {
- if(glWindow.getParent()==null) {
- System.err.println("XXX glWin to 100/100");
- glWindow.setPosition(100, 100);
- } else {
- System.err.println("XXX glWin to 0/0");
- glWindow.setPosition(0, 0);
+ } else if( e.getKeySymbol() == KeyEvent.VK_R ) {
+ if( null != quitAdapter ) {
+ quitAdapter.enable(false);
}
+ new Thread() {
+ public void run() {
+ final Thread t = glWindow.setExclusiveContextThread(null);
+ if(glWindow.getParent()==null) {
+ System.err.println("XXX glWin to HOME");
+ glWindow.reparentWindow(newtCanvasAWT.getNativeWindow());
+ } else {
+ if( null != frame ) {
+ final InsetsImmutable nInsets = glWindow.getInsets();
+ final java.awt.Insets aInsets = frame.getInsets();
+ int dx, dy;
+ if( nInsets.getTotalHeight()==0 ) {
+ dx = aInsets.left;
+ dy = aInsets.top;
+ } else {
+ dx = nInsets.getLeftWidth();
+ dy = nInsets.getTopHeight();
+ }
+ final int topLevelX = frame.getX()+frame.getWidth()+dx;
+ final int topLevelY = frame.getY()+dy;
+ System.err.println("XXX glWin to TOP.1 "+topLevelX+"/"+topLevelY+" - insets " + nInsets + ", " + aInsets);
+ glWindow.reparentWindow(null, topLevelX, topLevelY, false);
+ } else {
+ System.err.println("XXX glWin to TOP.0");
+ glWindow.reparentWindow(null);
+ }
+ }
+ glWindow.requestFocus();
+ glWindow.setExclusiveContextThread(t);
+ if( null != quitAdapter ) {
+ quitAdapter.clear();
+ quitAdapter.enable(true);
+ }
+ } }.start();
}
}
}
\ No newline at end of file
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 d618d3b..1f19241 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
@@ -32,6 +32,8 @@ package com.jogamp.opengl.test.junit.newt.parenting;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import javax.media.opengl.*;
@@ -45,6 +47,7 @@ import com.jogamp.opengl.test.junit.util.*;
import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestParenting01NEWT extends UITestCase {
static int width, height;
static long durationPerTest = 600;
@@ -376,7 +379,7 @@ public class TestParenting01NEWT extends UITestCase {
// glWindow2 -- child --> glWindow1: compatible
Assert.assertEquals(true, glWindow2.isVisible());
System.err.println("Frames(1) "+glWindow2.getTotalFPSFrames());
- reparentAction = glWindow2.reparentWindow(glWindow1, reparentRecreate);
+ reparentAction = glWindow2.reparentWindow(glWindow1, -1, -1, reparentRecreate);
System.err.println("Frames(2) "+glWindow2.getTotalFPSFrames());
Assert.assertTrue(Window.ReparentOperation.ACTION_INVALID != reparentAction);
Assert.assertEquals(true, glWindow2.isVisible());
@@ -402,7 +405,7 @@ public class TestParenting01NEWT extends UITestCase {
// glWindow2 --> top
Assert.assertEquals(true, glWindow2.isVisible());
- reparentAction = glWindow2.reparentWindow(null, reparentRecreate);
+ reparentAction = glWindow2.reparentWindow(null, -1, -1, reparentRecreate);
Assert.assertTrue(Window.ReparentOperation.ACTION_INVALID != reparentAction);
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
@@ -564,7 +567,7 @@ public class TestParenting01NEWT extends UITestCase {
switch(state) {
case 0:
Assert.assertEquals(true, glWindow2.isVisible());
- reparentAction = glWindow2.reparentWindow(null, reparentRecreate);
+ reparentAction = glWindow2.reparentWindow(null, -1, -1, reparentRecreate);
Assert.assertTrue(Window.ReparentOperation.ACTION_INVALID != reparentAction);
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
@@ -579,7 +582,7 @@ public class TestParenting01NEWT extends UITestCase {
break;
case 1:
Assert.assertEquals(true, glWindow2.isVisible());
- reparentAction = glWindow2.reparentWindow(glWindow1, reparentRecreate);
+ reparentAction = glWindow2.reparentWindow(glWindow1, -1, -1, reparentRecreate);
Assert.assertTrue(Window.ReparentOperation.ACTION_INVALID != reparentAction);
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
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 f8f9751..6de24d1 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
@@ -31,6 +31,8 @@ package com.jogamp.opengl.test.junit.newt.parenting;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import java.awt.Button;
import java.awt.BorderLayout;
@@ -50,6 +52,7 @@ import java.lang.reflect.InvocationTargetException;
import com.jogamp.opengl.test.junit.util.*;
import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestParenting01aAWT extends UITestCase {
static int width, height;
static long durationPerTest = 800;
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 c95ac19..4bb64c7 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
@@ -45,6 +45,8 @@ import org.junit.Assume;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.nativewindow.swt.SWTAccessor;
import com.jogamp.newt.NewtFactory;
@@ -58,6 +60,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
/**
* Simple visibility test ..
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestParenting01aSWT extends UITestCase {
static int width, height;
static long durationPerTest = 800;
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 906aeee..45612eb 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
@@ -31,6 +31,8 @@ package com.jogamp.opengl.test.junit.newt.parenting;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import java.awt.Button;
import java.awt.BorderLayout;
@@ -51,6 +53,7 @@ import java.lang.reflect.InvocationTargetException;
import com.jogamp.opengl.test.junit.util.*;
import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestParenting01bAWT extends UITestCase {
static int width, height;
static long durationPerTest = 800;
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 baa4c46..dd5d6eb 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
@@ -31,6 +31,8 @@ package com.jogamp.opengl.test.junit.newt.parenting;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import java.awt.Button;
import java.awt.BorderLayout;
@@ -50,6 +52,7 @@ import java.lang.reflect.InvocationTargetException;
import com.jogamp.opengl.test.junit.util.*;
import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestParenting01cAWT extends UITestCase {
static int width, height;
static long durationPerTest = 800;
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 1dd80e3..375f676 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
@@ -33,6 +33,8 @@ import java.lang.reflect.*;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import java.awt.Button;
import java.awt.BorderLayout;
@@ -53,6 +55,7 @@ import java.io.IOException;
import com.jogamp.opengl.test.junit.util.*;
import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestParenting01cSwingAWT extends UITestCase {
static int width, height;
static long durationPerTest = 800;
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 204d98d..d79bdca 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
@@ -31,6 +31,8 @@ package com.jogamp.opengl.test.junit.newt.parenting;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import java.awt.Button;
import java.awt.BorderLayout;
@@ -49,6 +51,7 @@ import java.lang.reflect.InvocationTargetException;
import com.jogamp.opengl.test.junit.util.*;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestParenting02AWT extends UITestCase {
static int width, height;
static long durationPerTest = 500;
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 8e2c73e..6294483 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
@@ -32,6 +32,8 @@ package com.jogamp.opengl.test.junit.newt.parenting;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import javax.media.opengl.*;
import javax.media.nativewindow.*;
@@ -48,6 +50,7 @@ import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
// import com.jogamp.opengl.test.junit.jogl.demos.es1.RedSquareES1;
// import com.jogamp.opengl.test.junit.jogl.demos.es1.GearsES1;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestParenting02NEWT extends UITestCase {
static int width, height;
static long durationPerTest = 500;
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 4f88034..30ee0f1 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
@@ -33,6 +33,8 @@ import java.lang.reflect.*;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import java.awt.BorderLayout;
import java.awt.Button;
@@ -52,6 +54,7 @@ import java.io.IOException;
import com.jogamp.opengl.test.junit.util.*;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestParenting03AWT extends UITestCase {
static Dimension glSize, fSize;
static long durationPerTest = 1100;
@@ -85,7 +88,7 @@ public class TestParenting03AWT extends UITestCase {
GLEventListener demo1 = new GearsES2(1);
setDemoFields(demo1, glWindow1, false);
glWindow1.addGLEventListener(demo1);
- glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1));
+ glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1, null));
GLAnimatorControl animator1 = new Animator(glWindow1);
animator1.start();
@@ -101,7 +104,7 @@ public class TestParenting03AWT extends UITestCase {
GLEventListener demo2 = new GearsES2(1);
setDemoFields(demo2, glWindow2, false);
glWindow2.addGLEventListener(demo2);
- glWindow2.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT2, glWindow2));
+ glWindow2.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT2, glWindow2, null));
animator2 = new Animator(glWindow2);
animator2.start();
}
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 0af42ec..827ac52 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
@@ -41,6 +41,8 @@ import javax.swing.SwingUtilities;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.Window;
import com.jogamp.newt.awt.NewtCanvasAWT;
@@ -54,6 +56,7 @@ import com.jogamp.opengl.util.Animator;
/**
* Using {@link NewtCanvasAWT#setNEWTChild(Window)} for reparenting, i.e. NEWT/AWT hopping
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestParenting04AWT extends UITestCase {
static int width, height;
static long durationPerTest = 800;
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 a4e4ace..78b3bc4 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
@@ -45,6 +45,8 @@ import org.junit.Assume;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.nativewindow.swt.SWTAccessor;
import com.jogamp.newt.NewtFactory;
@@ -60,6 +62,7 @@ import com.jogamp.opengl.util.Animator;
/**
* Using {@link NewtCanvasSWT#setNEWTChild(Window)} for reparenting, i.e. NEWT/AWT hopping
*/
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestParenting04SWT extends UITestCase {
static int width, height;
static long durationPerTest = 800;
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingFocusTraversal01AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingFocusTraversal01AWT.java
index d340fc2..ff54040 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingFocusTraversal01AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingFocusTraversal01AWT.java
@@ -36,6 +36,8 @@ import java.util.Set;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import java.awt.AWTException;
import java.awt.AWTKeyStroke;
@@ -62,6 +64,7 @@ import jogamp.newt.driver.DriverClearFocus;
import com.jogamp.opengl.test.junit.util.*;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestParentingFocusTraversal01AWT extends UITestCase {
static Dimension glSize, fSize;
static int numFocus = 8;
@@ -144,7 +147,7 @@ public class TestParentingFocusTraversal01AWT extends UITestCase {
GLEventListener demo1 = new GearsES2(1);
setDemoFields(demo1, glWindow1, false);
glWindow1.addGLEventListener(demo1);
- glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1));
+ glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1, null));
glWindow1.addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent e) {
if( !e.isPrintableKey() || e.isAutoRepeat() ) {
@@ -246,7 +249,7 @@ public class TestParentingFocusTraversal01AWT extends UITestCase {
Assert.assertEquals(true, glWindow1FA.focusLost());
Thread.sleep(durationPerTest/numFocus);
- // direct AWT request focus
+ System.err.println("Test: Direct NewtCanvasAWT focus");
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
@@ -259,7 +262,7 @@ public class TestParentingFocusTraversal01AWT extends UITestCase {
Assert.assertEquals(true, bWestFA.focusLost());
Thread.sleep(durationPerTest/numFocus);
- // direct AWT request focus
+ System.err.println("Test: Direct AWT Button-West focus");
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
@@ -272,7 +275,7 @@ public class TestParentingFocusTraversal01AWT extends UITestCase {
Assert.assertEquals(true, glWindow1FA.focusLost());
Thread.sleep(durationPerTest/numFocus);
- // direct NEWT request focus
+ System.err.println("Test: Direct NEWT-Child request focus");
glWindow1.requestFocus();
Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(glWindow1, glWindow1FA, bWestFA));
Assert.assertEquals(true, glWindow1FA.focusGained());
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 1d186a4..b2286a8 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
@@ -11,6 +11,8 @@ import javax.media.opengl.GLProfile;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
@@ -18,6 +20,7 @@ import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestTranslucentChildWindowBug632NEWT extends UITestCase {
static long durationPerTest = 2*300;
static GLProfile glp;
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 2d668c2..f273f76 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
@@ -49,6 +49,8 @@ import javax.media.opengl.GLEventListener;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.util.ReflectionUtil;
import com.jogamp.newt.Window;
@@ -59,6 +61,7 @@ import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestTranslucentParentingAWT extends UITestCase {
static Dimension size;
static long durationPerTest = 400;
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 a760bbb..cd14835 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.util;
import jogamp.newt.WindowImplAccess;
@@ -39,8 +39,9 @@ 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 javax.media.opengl.awt.GLCanvas;
import org.junit.Assert;
@@ -50,17 +51,17 @@ import com.jogamp.newt.event.WindowEvent;
public class AWTRobotUtil {
static final boolean DEBUG = false;
-
+
public static final int RETRY_NUMBER = 5;
public static final int ROBOT_DELAY = 100; // ms
public static final int TIME_OUT = 2000; // 2s
public static final int POLL_DIVIDER = 20; // TO/20
public static final int TIME_SLICE = TIME_OUT / POLL_DIVIDER ;
- public static Integer AWT_CLICK_TO = null;
-
+ public static Integer AWT_CLICK_TO = null;
+
static Object awtEDTAliveSync = new Object();
- static volatile boolean awtEDTAliveFlag = false;
-
+ static volatile boolean awtEDTAliveFlag = false;
+
static class OurUncaughtExceptionHandler implements UncaughtExceptionHandler {
@Override
public void uncaughtException(Thread t, Throwable e) {
@@ -68,16 +69,16 @@ public class AWTRobotUtil {
e.printStackTrace();
}
}
-
+
static {
Thread.setDefaultUncaughtExceptionHandler( new OurUncaughtExceptionHandler() );
// System.err.println("AWT EDT alive: "+isAWTEDTAlive());
}
-
+
/** Probes whether AWT's EDT is alive or not. */
public static boolean isAWTEDTAlive() {
if( EventQueue.isDispatchThread() ) {
- return true;
+ return true;
}
synchronized ( awtEDTAliveSync ) {
awtEDTAliveFlag = false;
@@ -85,7 +86,7 @@ public class AWTRobotUtil {
@Override
public void run() {
awtEDTAliveFlag = true;
- }
+ }
});
for (int wait=0; wait<POLL_DIVIDER && !awtEDTAliveFlag; wait++) {
try {
@@ -103,13 +104,13 @@ public class AWTRobotUtil {
throw new Error("AWT EDT not alive");
}
}
-
+
/** Issuing {@link #validateAWTEDTIsAlive()} before calling {@link Robot#waitForIdle()}. */
public static void waitForIdle(Robot robot) {
validateAWTEDTIsAlive();
robot.waitForIdle();
}
-
+
public static void clearAWTFocus(Robot robot) throws InterruptedException, InvocationTargetException, AWTException {
if(null == robot) {
robot = new Robot();
@@ -123,8 +124,8 @@ public class AWTRobotUtil {
robot.delay(ROBOT_DELAY);
System.err.println("******** clearAWTFocus.X");
}
-
- public static int[] getCenterLocation(Object obj, boolean onTitleBarIfWindow)
+
+ public static int[] getCenterLocation(Object obj, boolean onTitleBarIfWindow)
throws InterruptedException, InvocationTargetException {
if(obj instanceof com.jogamp.newt.Window) {
return getCenterLocationNEWT((com.jogamp.newt.Window)obj, onTitleBarIfWindow);
@@ -132,37 +133,37 @@ public class AWTRobotUtil {
return getCenterLocationAWT((java.awt.Component)obj, onTitleBarIfWindow);
} else {
throw new RuntimeException("Neither AWT nor NEWT: "+obj);
- }
+ }
}
- private static int[] getCenterLocationNEWT(com.jogamp.newt.Window win, boolean onTitleBarIfWindow)
+ private static int[] getCenterLocationNEWT(com.jogamp.newt.Window win, boolean onTitleBarIfWindow)
throws InterruptedException, InvocationTargetException {
- javax.media.nativewindow.util.Point p0 = win.getLocationOnScreen(null);
+ javax.media.nativewindow.util.Point p0 = win.getLocationOnScreen(null);
if( onTitleBarIfWindow ) {
javax.media.nativewindow.util.InsetsImmutable insets = win.getInsets();
- p0.translate(win.getWidth()/2, insets.getTopHeight()/2);
+ p0.translate(win.getWidth()/2, insets.getTopHeight()/2);
} else {
p0.translate(win.getWidth()/2, win.getHeight()/2);
}
- return new int[] { p0.getX(), p0.getY() };
- }
- private static int[] getCenterLocationAWT(java.awt.Component comp, boolean onTitleBarIfWindow)
+ return new int[] { p0.getX(), p0.getY() };
+ }
+ private static int[] getCenterLocationAWT(java.awt.Component comp, boolean onTitleBarIfWindow)
throws InterruptedException, InvocationTargetException {
int x0, y0;
- java.awt.Point p0 = comp.getLocationOnScreen();
+ java.awt.Point p0 = comp.getLocationOnScreen();
java.awt.Rectangle r0 = comp.getBounds();
if( onTitleBarIfWindow && comp instanceof java.awt.Window) {
java.awt.Window window = (java.awt.Window) comp;
java.awt.Insets insets = window.getInsets();
- y0 = (int) ( p0.getY() + insets.top / 2.0 + .5 ) ;
+ y0 = (int) ( p0.getY() + insets.top / 2.0 + .5 ) ;
} else {
y0 = (int) ( p0.getY() + r0.getHeight() / 2.0 + .5 ) ;
}
x0 = (int) ( p0.getX() + r0.getWidth() / 2.0 + .5 ) ;
- return new int[] { x0, y0 };
+ return new int[] { x0, y0 };
}
- public static int[] getClientLocation(Object obj, int x, int y)
+ public static int[] getClientLocation(Object obj, int x, int y)
throws InterruptedException, InvocationTargetException {
if(obj instanceof com.jogamp.newt.Window) {
return getClientLocationNEWT((com.jogamp.newt.Window)obj, x, y);
@@ -170,19 +171,19 @@ public class AWTRobotUtil {
return getClientLocationAWT((java.awt.Component)obj, x, y);
} else {
throw new RuntimeException("Neither AWT nor NEWT: "+obj);
- }
+ }
}
- private static int[] getClientLocationNEWT(com.jogamp.newt.Window win, int x, int y)
+ private static int[] getClientLocationNEWT(com.jogamp.newt.Window win, int x, int y)
throws InterruptedException, InvocationTargetException {
- javax.media.nativewindow.util.Point p0 = win.getLocationOnScreen(null);
- return new int[] { p0.getX(), p0.getY() };
+ javax.media.nativewindow.util.Point p0 = win.getLocationOnScreen(null);
+ return new int[] { p0.getX(), p0.getY() };
}
- private static int[] getClientLocationAWT(java.awt.Component comp, int x, int y)
+ private static int[] getClientLocationAWT(java.awt.Component comp, int x, int y)
throws InterruptedException, InvocationTargetException {
- java.awt.Point p0 = comp.getLocationOnScreen();
- return new int[] { (int)p0.getX(), (int)p0.getY() };
+ java.awt.Point p0 = comp.getLocationOnScreen();
+ return new int[] { (int)p0.getX(), (int)p0.getY() };
}
-
+
/**
* toFront, call setVisible(true) and toFront(),
* after positioning the mouse in the middle of the window via robot.
@@ -196,7 +197,7 @@ public class AWTRobotUtil {
// just for event tracing ..
AWTWindowFocusAdapter winFA = new AWTWindowFocusAdapter("window");
window.addWindowFocusListener(winFA);
-
+
if(null == robot) {
robot = new Robot();
robot.setAutoWaitForIdle(true);
@@ -221,7 +222,7 @@ public class AWTRobotUtil {
wait++;
} while (wait<POLL_DIVIDER && !window.hasFocus());
final boolean success = wait<POLL_DIVIDER;
-
+
window.removeWindowFocusListener(winFA);
if(!success) {
System.err.println("*** AWTRobotUtil.toFrontAndRequestFocus() UI failure");
@@ -236,7 +237,7 @@ public class AWTRobotUtil {
* centerMouse
* @param onTitleBarIfWindow TODO
*/
- public static void centerMouse(Robot robot, Object obj, boolean onTitleBarIfWindow)
+ public static void centerMouse(Robot robot, Object obj, boolean onTitleBarIfWindow)
throws AWTException, InterruptedException, InvocationTargetException {
if(null == robot) {
@@ -251,20 +252,20 @@ public class AWTRobotUtil {
robot.delay(ROBOT_DELAY);
}
- public static void setMouseToClientLocation(Robot robot, Object obj, int x, int y)
+ public static void setMouseToClientLocation(Robot robot, Object obj, int x, int y)
throws AWTException, InterruptedException, InvocationTargetException {
-
+
if(null == robot) {
robot = new Robot();
robot.setAutoWaitForIdle(true);
}
-
+
int[] p0 = getClientLocation(obj, x, y);
robot.mouseMove( p0[0], p0[1] );
robot.delay(ROBOT_DELAY);
}
-
+
public static int getClickTimeout(Object obj) {
if(obj instanceof com.jogamp.newt.Window) {
return com.jogamp.newt.event.MouseEvent.getClickTimeout();
@@ -272,41 +273,41 @@ public class AWTRobotUtil {
if(null == AWT_CLICK_TO) {
AWT_CLICK_TO =
(Integer) java.awt.Toolkit.getDefaultToolkit().getDesktopProperty("awt.multiClickInterval");
- if(null == AWT_CLICK_TO) {
+ if(null == AWT_CLICK_TO) {
AWT_CLICK_TO = new Integer(500);
}
}
return AWT_CLICK_TO.intValue();
} else {
throw new RuntimeException("Neither AWT nor NEWT: "+obj);
- }
+ }
}
-
+
/**
* requestFocus, if robot is valid, use mouse operation,
* otherwise programmatic, ie call requestFocus
*/
- public static void requestFocus(Robot robot, Object obj)
+ public static void requestFocus(Robot robot, Object obj)
throws AWTException, InterruptedException, InvocationTargetException {
requestFocus(robot, obj, true);
}
-
+
/**
* requestFocus, if robot is valid, use mouse operation,
* otherwise programmatic, ie call requestFocus
*/
- public static void requestFocus(Robot robot, Object obj, boolean onTitleBarIfWindow)
+ public static void requestFocus(Robot robot, Object obj, boolean onTitleBarIfWindow)
throws AWTException, InterruptedException, InvocationTargetException {
if(null != robot) {
- final int mouseButton = java.awt.event.InputEvent.BUTTON1_MASK;
+ final int mouseButton = java.awt.event.InputEvent.BUTTON1_MASK;
centerMouse(robot, obj, onTitleBarIfWindow);
-
+
waitForIdle(robot);
robot.mousePress(mouseButton);
robot.mouseRelease(mouseButton);
final int d = getClickTimeout(obj) + 1;
- robot.delay( d );
- System.err.println("requestFocus: click, d: "+d+" ms");
+ robot.delay( d );
+ System.err.println("requestFocus: click, d: "+d+" ms");
} else {
if(obj instanceof com.jogamp.newt.Window) {
requestFocusNEWT((com.jogamp.newt.Window) obj, onTitleBarIfWindow);
@@ -317,12 +318,12 @@ public class AWTRobotUtil {
}
}
}
- private static void requestFocusNEWT(com.jogamp.newt.Window win, boolean onTitleBarIfWindow)
+ private static void requestFocusNEWT(com.jogamp.newt.Window win, boolean onTitleBarIfWindow)
throws AWTException, InterruptedException, InvocationTargetException {
win.requestFocus();
System.err.println("requestFocus: NEWT Component");
}
- private static void requestFocusAWT(final java.awt.Component comp, boolean onTitleBarIfWindow)
+ private static void requestFocusAWT(final java.awt.Component comp, boolean onTitleBarIfWindow)
throws AWTException, InterruptedException, InvocationTargetException {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
@@ -330,11 +331,11 @@ public class AWTRobotUtil {
System.err.println("requestFocus: AWT Component");
}});
}
-
- public static void requestFocus(Robot robot, Object obj, int x, int y)
+
+ public static void requestFocus(Robot robot, Object obj, int x, int y)
throws AWTException, InterruptedException, InvocationTargetException {
validateAWTEDTIsAlive();
-
+
final boolean idling = robot.isAutoWaitForIdle();
final int mouseButton = java.awt.event.InputEvent.BUTTON1_MASK;
robot.mouseMove( x, y );
@@ -348,7 +349,7 @@ public class AWTRobotUtil {
final int d = getClickTimeout(obj) + 1;
robot.delay( d );
}
-
+
public static boolean hasFocus(Object obj) {
if(obj instanceof com.jogamp.newt.Window) {
return ((com.jogamp.newt.Window) obj).hasFocus();
@@ -388,7 +389,7 @@ public class AWTRobotUtil {
*
* @return True if the Window became the global focused Window within TIME_OUT
*/
- public static boolean waitForFocus(FocusEventCountAdapter gain,
+ public static boolean waitForFocus(FocusEventCountAdapter gain,
FocusEventCountAdapter lost) throws InterruptedException {
int wait;
for (wait=0; wait<POLL_DIVIDER; wait++) {
@@ -399,12 +400,12 @@ public class AWTRobotUtil {
}
return false;
}
-
+
/**
*
* @return True if the Window became the global focused Window within TIME_OUT
*/
- public static boolean waitForFocus(Object obj, FocusEventCountAdapter gain,
+ public static boolean waitForFocus(Object obj, FocusEventCountAdapter gain,
FocusEventCountAdapter lost) throws InterruptedException {
if(!waitForFocus(obj)) {
return false;
@@ -412,13 +413,13 @@ public class AWTRobotUtil {
return waitForFocus(gain, lost);
}
- public static void assertRequestFocusAndWait(Robot robot, Object requestFocus, Object waitForFocus,
+ public static void assertRequestFocusAndWait(Robot robot, Object requestFocus, Object waitForFocus,
FocusEventCountAdapter gain, FocusEventCountAdapter lost)
throws AWTException, InterruptedException, InvocationTargetException {
int i = 0;
boolean hasFocus = false;
-
+
for(i=0; i < RETRY_NUMBER && !hasFocus; i++) {
requestFocus(robot, requestFocus);
hasFocus = waitForFocus(waitForFocus, gain, lost);
@@ -426,7 +427,7 @@ public class AWTRobotUtil {
if(!hasFocus) {
System.err.print("*** AWTRobotUtil.assertRequestFocusAndWait() ");
if( ( null == gain || gain.focusGained() ) && ( null == lost || !lost.focusLost() ) ) {
- // be error tolerant here, some impl. may lack focus-lost events (OS X)
+ // be error tolerant here, some impl. may lack focus-lost events (OS X)
System.err.println("minor UI failure");
hasFocus = true;
} else {
@@ -444,7 +445,7 @@ public class AWTRobotUtil {
}
System.err.println("*** gain: "+gain);
System.err.println("*** lost: "+lost);
- Thread.dumpStack();
+ Thread.dumpStack();
}
Assert.assertTrue("Did not gain focus", hasFocus);
}
@@ -457,15 +458,15 @@ public class AWTRobotUtil {
robot.keyRelease(keyCode);
robot.delay(msDelay);
}
-
+
public static int keyType(int i, Robot robot, int keyCode,
- Object obj, KeyEventCountAdapter counter) throws InterruptedException, AWTException, InvocationTargetException
- {
+ Object obj, KeyEventCountAdapter counter) throws InterruptedException, AWTException, InvocationTargetException
+ {
int tc = 0;
int j;
final long t0 = System.currentTimeMillis();
final int c0 = null!=counter ? counter.getCount() : 0;
-
+
for(j=0; 1 > tc && j<RETRY_NUMBER; j++) {
if(!hasFocus(obj)) {
// focus lost for some reason, regain it programmatic
@@ -491,37 +492,37 @@ public class AWTRobotUtil {
return (int) ( System.currentTimeMillis() - t0 ) ;
}
- /** No validation is performed .. */
+ /** No validation is performed .. */
public static int keyPress(int i, Robot robot, boolean press, int keyCode, int msDelay) {
- final long t0 = System.currentTimeMillis();
+ final long t0 = System.currentTimeMillis();
if(press) {
awtRobotKeyPress(robot, keyCode, msDelay);
} else {
awtRobotKeyRelease(robot, keyCode, msDelay);
}
-
+
return (int) ( System.currentTimeMillis() - t0 ) ;
}
-
- /** No validation is performed .. */
+
+ /** No validation is performed .. */
public static int newtKeyPress(int i, Robot robot, boolean press, short newtKeyCode, int msDelay) {
final int keyCode = AWTNewtEventFactory.newtKeyCode2AWTKeyCode(newtKeyCode);
- final long t0 = System.currentTimeMillis();
+ final long t0 = System.currentTimeMillis();
if(press) {
awtRobotKeyPress(robot, keyCode, msDelay);
} else {
awtRobotKeyRelease(robot, keyCode, msDelay);
}
-
+
return (int) ( System.currentTimeMillis() - t0 ) ;
}
-
+
/**
* @param keyCode TODO
* @param counter shall return the number of keys typed (press + release)
*/
- public static void assertKeyType(Robot robot, int keyCode, int typeCount,
- Object obj, KeyEventCountAdapter counter)
+ public static void assertKeyType(Robot robot, int keyCode, int typeCount,
+ Object obj, KeyEventCountAdapter counter)
throws AWTException, InterruptedException, InvocationTargetException {
if(null == robot) {
@@ -532,16 +533,16 @@ public class AWTRobotUtil {
centerMouse(robot, obj, false);
Assert.assertEquals("Key already pressed", false, counter.isPressed());
-
+
if(DEBUG) {
System.err.println("**************************************");
System.err.println("KC0: "+counter);
}
-
+
final int c0 = counter.getCount();
for(int i=0; i<typeCount; i++) {
- keyType(i, robot, keyCode, obj, counter);
+ keyType(i, robot, keyCode, obj, counter);
}
if(DEBUG) { System.err.println("KC3.0: "+counter); }
@@ -552,8 +553,8 @@ public class AWTRobotUtil {
* @param keyCode TODO
* @param counter shall return the number of keys typed (press + release)
*/
- public static void assertKeyPress(Robot robot, int keyCode, int typeCount,
- Object obj, KeyEventCountAdapter counter)
+ public static void assertKeyPress(Robot robot, int keyCode, int typeCount,
+ Object obj, KeyEventCountAdapter counter)
throws AWTException, InterruptedException, InvocationTargetException {
if(null == robot) {
@@ -564,36 +565,36 @@ public class AWTRobotUtil {
centerMouse(robot, obj, false);
Assert.assertEquals("Key already pressed", false, counter.isPressed());
-
+
if(DEBUG) {
System.err.println("**************************************");
System.err.println("KC0: "+counter);
}
-
+
final int c0 = counter.getCount();
for(int i=0; i<typeCount; i++) {
- keyType(i, robot, keyCode, obj, counter);
+ keyType(i, robot, keyCode, obj, counter);
}
if(DEBUG) { System.err.println("KC3.0: "+counter); }
Assert.assertEquals("Wrong key count", typeCount, counter.getCount()-c0);
}
-
+
static int mouseClick(int i, Robot robot, int mouseButton,
- Object obj, InputEventCountAdapter counter) throws InterruptedException, AWTException, InvocationTargetException
+ Object obj, InputEventCountAdapter counter) throws InterruptedException, AWTException, InvocationTargetException
{
int j;
int tc = 0;
final long t0 = System.currentTimeMillis();
-
+
for(j=0; 1 > tc && j<RETRY_NUMBER; j++) {
if(!hasFocus(obj)) {
// focus lost for some reason, regain it programmatic
if(DEBUG) { System.err.println(i+":"+j+" MC1.0: "+counter+" - regain focus"); }
requestFocus(null, obj);
}
- final int c0 = null != counter ? counter.getCount() : 0;
+ final int c0 = null != counter ? counter.getCount() : 0;
if(DEBUG) { System.err.println(i+":"+j+" MC1.1: "+counter); }
waitForIdle(robot);
robot.mousePress(mouseButton);
@@ -609,13 +610,13 @@ public class AWTRobotUtil {
Assert.assertEquals("Mouse ("+i+":"+j+") not clicked one time", 1, tc);
return (int) ( System.currentTimeMillis() - t0 ) ;
}
-
+
/**
* @param mouseButton ie InputEvent.BUTTON1_MASK
* @param clickCount ie 1, or 2
*/
public static void assertMouseClick(Robot robot, int mouseButton, int clickCount,
- Object obj, InputEventCountAdapter counter)
+ Object obj, InputEventCountAdapter counter)
throws AWTException, InterruptedException, InvocationTargetException {
if(null == robot) {
@@ -628,14 +629,14 @@ public class AWTRobotUtil {
centerMouse(robot, obj, false);
Assert.assertEquals("Mouse already pressed", false, counter.isPressed());
-
+
if(DEBUG) {
System.err.println("**************************************");
System.err.println("MC0: "+counter);
}
-
+
final int c0 = counter.getCount();
-
+
for(int i=0; i<clickCount; i++) {
final int waited = mouseClick(i, robot, mouseButton, obj, counter);
if(DEBUG) { System.err.println(i+": MC2.X: "+counter+", consumed: "+waited); }
@@ -670,7 +671,7 @@ public class AWTRobotUtil {
/**
*
- * @return True if the GLDrawable recives the expected size within TIME_OUT
+ * @return True if the GLDrawable receives the expected size within TIME_OUT
*/
public static boolean waitForSize(GLDrawable drawable, int width, int height) throws InterruptedException {
int wait;
@@ -681,7 +682,6 @@ public class AWTRobotUtil {
}
/**
- *
* @return True if the Component becomes realized (not displayable, native invalid) within TIME_OUT
*/
public static boolean waitForRealized(Object obj, boolean realized) throws InterruptedException {
@@ -702,26 +702,56 @@ public class AWTRobotUtil {
Thread.sleep(TIME_SLICE);
}
// if GLCanvas, ensure it got also painted -> drawable.setRealized(true);
- if(wait<POLL_DIVIDER && comp instanceof GLCanvas) {
- GLCanvas glcanvas = (GLCanvas) comp;
- for (wait=0; wait<POLL_DIVIDER && realized != glcanvas.isRealized(); wait++) {
+ if(wait<POLL_DIVIDER && comp instanceof GLAutoDrawable) {
+ GLAutoDrawable glad = (GLAutoDrawable) comp;
+ for (wait=0; wait<POLL_DIVIDER && realized != glad.isRealized(); wait++) {
Thread.sleep(TIME_SLICE);
}
if(wait>=POLL_DIVIDER) {
// for some reason GLCanvas hasn't been painted yet, force it!
- System.err.println("XXX: FORCE REPAINT PRE - canvas: "+glcanvas);
- glcanvas.repaint();
- for (wait=0; wait<POLL_DIVIDER && realized != glcanvas.isRealized(); wait++) {
+ System.err.println("XXX: FORCE REPAINT PRE - glad: "+glad);
+ comp.repaint();
+ for (wait=0; wait<POLL_DIVIDER && realized != glad.isRealized(); wait++) {
Thread.sleep(TIME_SLICE);
}
- System.err.println("XXX: FORCE REPAINT POST - canvas: "+glcanvas);
+ System.err.println("XXX: FORCE REPAINT POST - glad: "+glad);
}
- for (wait=0; wait<POLL_DIVIDER && realized != glcanvas.isRealized(); wait++) {
+ for (wait=0; wait<POLL_DIVIDER && realized != glad.isRealized(); wait++) {
Thread.sleep(TIME_SLICE);
}
- }
+ }
+ } else if(obj instanceof GLAutoDrawable) {
+ GLAutoDrawable glad = (GLAutoDrawable) obj;
+ for (wait=0; wait<POLL_DIVIDER && realized != glad.isRealized(); wait++) {
+ Thread.sleep(TIME_SLICE);
+ }
} else {
- throw new RuntimeException("Neither AWT nor NEWT: "+obj);
+ throw new RuntimeException("Neither AWT nor NEWT nor GLAutoDrawable: "+obj);
+ }
+ return wait<POLL_DIVIDER;
+ }
+
+ /**
+ *
+ * @return True if the GLContext becomes created or not within TIME_OUT
+ */
+ public static boolean waitForContextCreated(GLAutoDrawable autoDrawable, boolean created) throws InterruptedException {
+ if( null == autoDrawable ) {
+ return !created;
+ }
+ int wait;
+ for (wait=0; wait<POLL_DIVIDER ; wait++) {
+ final GLContext ctx = autoDrawable.getContext();
+ if( created ) {
+ if( null != ctx && ctx.isCreated() ) {
+ break;
+ }
+ } else {
+ if( null == ctx || !ctx.isCreated() ) {
+ break;
+ }
+ }
+ Thread.sleep(TIME_SLICE);
}
return wait<POLL_DIVIDER;
}
@@ -732,9 +762,9 @@ public class AWTRobotUtil {
*
* @param obj either an AWT Window (Frame, JFrame) or NEWT Window
* @param willClose indicating that the window will close, hence this method waits for the window to be closed
- * @param wcl the WindowClosingListener to determine whether the AWT or NEWT widget has been closed. It should be attached
- * to the widget ASAP before any other listener, e.g. via {@link #addClosingListener(Object)}.
- * The WindowClosingListener will be reset before attempting to close the widget.
+ * @param wcl the WindowClosingListener to determine whether the AWT or NEWT widget has been closed. It should be attached
+ * to the widget ASAP before any other listener, e.g. via {@link #addClosingListener(Object)}.
+ * The WindowClosingListener will be reset before attempting to close the widget.
* @return True if the Window is closing and closed (if willClose is true), each within TIME_OUT
* @throws InterruptedException
*/
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 f83cb51..e5f1364 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/MiscUtils.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/MiscUtils.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.util;
@@ -36,6 +36,10 @@ import java.io.InputStreamReader;
import java.io.OutputStream;
import java.lang.reflect.*;
import java.nio.FloatBuffer;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.media.opengl.GLContext;
import com.jogamp.common.os.Platform;
@@ -48,7 +52,7 @@ public class MiscUtils {
}
return def;
}
-
+
public static int atoi(String str, int def) {
try {
return Integer.parseInt(str);
@@ -57,7 +61,7 @@ public class MiscUtils {
}
return def;
}
-
+
public static long atol(String str, long def) {
try {
return Long.parseLong(str);
@@ -75,23 +79,23 @@ public class MiscUtils {
}
return def;
}
-
+
public static String toHexString(byte hex) {
- return "0x" + Integer.toHexString( (int)hex & 0x000000FF );
+ return "0x" + Integer.toHexString( hex & 0x000000FF );
}
-
+
public static String toHexString(short hex) {
- return "0x" + Integer.toHexString( (int)hex & 0x0000FFFF );
+ return "0x" + Integer.toHexString( hex & 0x0000FFFF );
}
-
+
public static String toHexString(int hex) {
return "0x" + Integer.toHexString( hex );
}
-
+
public static String toHexString(long hex) {
return "0x" + Long.toHexString( hex );
}
-
+
public static void assertFloatBufferEquals(String errmsg, FloatBuffer expected, FloatBuffer actual, float delta) {
if(null == expected && null == actual) {
return;
@@ -104,26 +108,26 @@ public class MiscUtils {
throw new AssertionError(msg+"; Actual is null, but expected not: "+expected);
}
if(expected.remaining() != actual.remaining()) {
- throw new AssertionError(msg+"; Expected has "+expected.remaining()+" remaining, but actual has "+actual.remaining());
+ throw new AssertionError(msg+"; Expected has "+expected.remaining()+" remaining, but actual has "+actual.remaining());
}
final int a0 = expected.position();
final int b0 = actual.position();
for(int i=0; i<expected.remaining(); i++) {
final float ai = expected.get(a0 + i);
final float bi = actual.get(b0 + i);
- final float daibi = Math.abs(ai - bi);
+ final float daibi = Math.abs(ai - bi);
if( daibi > delta ) {
throw new AssertionError(msg+"; Expected @ ["+a0+"+"+i+"] has "+ai+", but actual @ ["+b0+"+"+i+"] has "+bi+", it's delta "+daibi+" > "+delta);
}
}
}
-
+
public static void assertFloatBufferNotEqual(String errmsg, FloatBuffer expected, FloatBuffer actual, float delta) {
if(null == expected || null == actual) {
return;
}
if(expected.remaining() != actual.remaining()) {
- return;
+ return;
}
String msg = null != errmsg ? errmsg + " " : "";
final int a0 = expected.position();
@@ -131,14 +135,14 @@ public class MiscUtils {
for(int i=0; i<expected.remaining(); i++) {
final float ai = expected.get(a0 + i);
final float bi = actual.get(b0 + i);
- final float daibi = Math.abs(ai - bi);
+ final float daibi = Math.abs(ai - bi);
if( daibi > delta ) {
return;
}
}
throw new AssertionError(msg+"; Expected and actual are equal.");
}
-
+
public static boolean setFieldIfExists(Object instance, String fieldName, Object value) {
try {
Field f = instance.getClass().getField(fieldName);
@@ -155,14 +159,14 @@ public class MiscUtils {
}
return false;
}
-
+
public static class StreamDump extends Thread {
final InputStream is;
final StringBuilder outString;
final OutputStream outStream;
final String prefix;
final Object sync;
- volatile boolean eos = false;
+ volatile boolean eos = false;
public StreamDump(OutputStream out, String prefix, InputStream is, Object sync) {
this.is = is;
@@ -178,7 +182,7 @@ public class MiscUtils {
this.prefix = null;
this.sync = sync;
}
-
+
public final boolean eos() { return eos; }
@Override
@@ -208,7 +212,28 @@ public class MiscUtils {
}
}
}
- }
+ }
+
+ public static void dumpSharedGLContext(GLContext self) {
+ int i = 0, j = 0;
+ System.err.println("Myself: hash 0x"+Integer.toHexString(self.hashCode())+", \t(isShared "+self.isShared()+", created "+self.isCreated()+")");
+ {
+ final List<GLContext> set = self.getCreatedShares();
+ for (final Iterator<GLContext> iter = set.iterator(); iter.hasNext(); ) {
+ final GLContext c = iter.next();
+ System.err.println("Ctx #"+(i++)+": hash 0x"+Integer.toHexString(c.hashCode())+", \t(created "+c.isCreated()+")");
+ }
+ }
+ {
+ final List<GLContext> set = self.getDestroyedShares();
+ for (final Iterator<GLContext> iter = set.iterator(); iter.hasNext(); ) {
+ final GLContext c = iter.next();
+ System.err.println("Ctx #"+(j++)+": hash 0x"+Integer.toHexString(c.hashCode())+", \t(created "+c.isCreated()+")");
+ }
+ }
+ System.err.println("\t Total created "+i+" + destroyed "+j+" = "+(i+j));
+ System.err.println();
+ }
}
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 839a0c7..82247a5 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java
@@ -56,12 +56,14 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.After;
import org.junit.AfterClass;
+import org.junit.FixMethodOrder;
import org.junit.Rule;
import org.junit.rules.TestName;
+import org.junit.runners.MethodSorters;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.TestClass;
-
+ at FixMethodOrder(MethodSorters.NAME_ASCENDING)
public abstract class UITestCase {
@Rule public TestName _unitTestName = new TestName();
diff --git a/www/index.html b/www/index.html
index 9ab9ade..ff81a77 100644
--- a/www/index.html
+++ b/www/index.html
@@ -53,7 +53,7 @@
</ul>
<h3>Presentations</h3>
<ul>
- <li><a href="../../wiki/index.php/JogAmp_BOF_SIGGRAPH_2013_PLANNING">Siggraph 2013</a></li>
+ <li><a href="../../doc/siggraph2013/">Siggraph 2013</a></li>
<li><a href="../../doc/fosdem2013/">Fosdem 2013</a></li>
<li><a href="../../doc/gpunurbs2011/graphicon2011-slides.pdf">NURBS @ GPU</a></li>
<li><a href="../../doc/siggraph2012/">Siggraph 2012</a></li>
@@ -88,6 +88,7 @@
<a href="../doc/Overview-OpenGL-Evolution-And-JOGL.html">OpenGL Evolution & JOGL</a>
and the <a href="/deployment/jogamp-next/javadoc/jogl/javadoc/overview-summary.html#overview_description">JOGL Specification</a>
may give you a brief overview.
+ </p>
<p>
JOGL integrates with the AWT, Swing and SWT widget sets, as well as with custom windowing toolkits using the NativeWindow API.<br/>
JOGL also provides its own <a href="../doc/NEWT-Overview.html">native windowing toolkit, NEWT</a>.
@@ -104,13 +105,14 @@
and <a href="../../jogl-demos/www"><b>JOGL demos</b></a> for illustrations of
advanced OpenGL techniques now possible with the Java platform.
</p>
+ <!--
<div class="splash" style="padding: 0; text-align: left; font-size:21px; line-height:100%; position:relative; top:-21px;" >
<a href="../../wiki/index.php/JogAmp_BOF_SIGGRAPH_2013_PLANNING">Meet us @</a>
<a href="http://s2013.siggraph.org/attendees/birds-feather/events/jogamp-2d3d-multimedia-across-devices">
<img style="position:relative; top:+25px;" src="../../doc/siggraph2013/media/siggraph2013-logo_right-transparent-226x55.png" width="226" height="55" alt="JogAmp @ SIGGRAPH 2013"/>
</a><br/>
<i style="font-size:10px;">.. and get an awesome T-Shirt free!</i>
- </div>
+ </div> -->
<h3>Featured Projects</h3>
<p>
@@ -132,17 +134,18 @@
<tbody>
<tr>
<td width="50%">
- <a href="http://c3d.com"><img src="media/c3d-studio-snap2-160x160.png"
+ <a href="http://c3d.com"><img src="media/c3d-mobile-01-coll01-160x160.png"
width="160" height="160" align="left" alt="C3D"></img>C3D</a>'s
<a href="http://c3d.com/index.php?option=com_content&view=section&layout=blog&id=5&Itemid=65">product palette</a>
- includes <i>C3D Studio</i> and <i>C3D Viewer</i>.
+ for desktop and mobile.
<a href="http://c3d.com/index.php?option=com_content&view=article&id=46:c3dstudio&catid=34:generalproducts&Itemid=65">C3D Studio</a>
is a 3D based visual framework for developing visual project control solutions for construction projects.
C3D Studio provides a dynamic link between the 3D model of the project and the back-end data.
<a href="http://c3d.com/index.php?option=com_content&view=article&id=47:c3dviewer&catid=34:generalproducts&Itemid=65">C3D Viewer</a>
- is the visualization tool for the 3D Model and related data. The user can either manually load 3D models and connect
- them to data sources, or execute Studio designed rich clients ( timelines) Where 3D and related data are loaded,
- linked and displayed for navigation and updates.
+ is the visualization tool for the 3D Model and related data, which can be linked and displayed for navigation and updates.
+ <a href="https://play.google.com/store/apps/details?id=cctintl.c3d.android">C3D Mobile</a>
+ allows supervisors to interact with 3D models and details relevant to their tasks on the construction site.
+ Models and revisions can be shared using DropBox, Gmail, …etc. while on the move.
</td>
<td width="50%">
@@ -225,9 +228,9 @@
<a href="http://biojava.org/wiki/RCSB_Viewers:About">The RCSB Viewers suite</a> of frameworks provides the capability of creating 3-d viewing applications. The libraries are Java based, and use JOGL for 3d rendering.
Some visualization tools are <a
href="http://www.rcsb.org/">RCSB Protein Data Bank</a> (<a
- href="http://www.rcsb.org/pdb/explore/viewerLaunch.do?viewerType=PW&structureId=3VTQ&unit=bio&unit_id=1">Example</a>) and
+ href="http://www.rcsb.org/pdb/explore/viewerLaunch.do?viewerType=PW&structureId=3VTQ&unit=bio&unit_id=1">Example</a>) and
<a href="http://www.iedb.org/">Epitode Database</a>
- (<a href="http://www.iedb.org/browse_by_3D.php?name=TCELL&mhc_allele_id=143_9606_Homo_sapiens_TCELL">Windows only</a>).
+ (<a href="http://www.iedb.org/browse_by_3D.php?name=TCELL&mhc_allele_id=143_9606_Homo_sapiens_TCELL">Windows only</a>).
</td>
<td width="50%">
@@ -347,7 +350,7 @@
develops a <a href="http://jmonkeyengine.org/groups/development-discussion-jme3/forum/topic/jogl-support-jogl2-that-is/">JOGL backend for jME3</a>
with support of the jME team. <i>NEWT support</i> is also underway, which will allow jME3 to run <i>on mobile devices</i> as long
proper <a href="http://jogamp.org/jogl/doc/Overview-OpenGL-Evolution-And-JOGL.html">JOGL/OpenGL</a>
- <a href="http://jogamp.org/jogl/doc/bouml/html-svg/fig128069.svg">profile separation</a> is being used.
+ <a href="http://jogamp.org/jogl/doc/bouml/html/fig128069.png">profile separation</a> is being used.
</td>
<td width="50%">
@@ -601,12 +604,11 @@
<tr>
<th colspan="1">Discontinued projects</th>
</tr>
+ <!--- abandoned JOGL ..
<tr>
<td >
<table border="0" cellspacing="15">
<tbody>
-
- <!--- abandoned JOGL ..
<tr>
<td >
<a href="http://openendedgroup.com/field"><img src="media/field.png"
@@ -630,12 +632,11 @@
controller classes. Instead of drawing 2D figures, you can now draw 3D figures.
Existing GEF-based 2D editors can be embedded into 3D editors with minimal effort.
</td>
- -->
-
</tbody>
</table>
</td>
</tr>
+ -->
</tbody>
</table>
</div>
diff --git a/www/media/c3d-mobile-01-coll01-160x160.png b/www/media/c3d-mobile-01-coll01-160x160.png
new file mode 100644
index 0000000..1b11b80
Binary files /dev/null and b/www/media/c3d-mobile-01-coll01-160x160.png differ
diff --git a/www/media/c3d-mobile-01-pipes01-160x125.png b/www/media/c3d-mobile-01-pipes01-160x125.png
new file mode 100644
index 0000000..e7434ad
Binary files /dev/null and b/www/media/c3d-mobile-01-pipes01-160x125.png differ
diff --git a/www/media/c3d-mobile-01-pipes07-160x120.png b/www/media/c3d-mobile-01-pipes07-160x120.png
new file mode 100644
index 0000000..20a30d7
Binary files /dev/null and b/www/media/c3d-mobile-01-pipes07-160x120.png differ
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libjogl2-java.git
More information about the pkg-java-commits
mailing list