aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJOGAMP DEV TEAM <[email protected]>2010-04-22 21:12:36 -0400
committerJOGAMP DEV TEAM <[email protected]>2010-04-22 21:12:36 -0400
commit1d889ddc4728d1534e310b44fad74a2932d22d39 (patch)
tree4ad0c3eeb3ef728522ac9459eb12c667301a0c32 /src
parent8790075f074013aa3c71b96993838cf1117275f1 (diff)
parenta588326d206ff32e5ff5db97560851cb9b826022 (diff)
Merge branch 'master' of github.com:sgothel/jogl
Diffstat (limited to 'src')
-rwxr-xr-xsrc/jogl/classes/com/jogamp/audio/windows/waveout/Audio.java (renamed from src/jogl/classes/com/sun/javafx/audio/windows/waveout/Audio.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java (renamed from src/jogl/classes/com/sun/javafx/audio/windows/waveout/Mixer.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/audio/windows/waveout/SoundBuffer.java (renamed from src/jogl/classes/com/sun/javafx/audio/windows/waveout/SoundBuffer.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/audio/windows/waveout/TestSpatialization.java (renamed from src/jogl/classes/com/sun/javafx/audio/windows/waveout/TestSpatialization.java)3
-rwxr-xr-xsrc/jogl/classes/com/jogamp/audio/windows/waveout/Track.java (renamed from src/jogl/classes/com/sun/javafx/audio/windows/waveout/Track.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/audio/windows/waveout/Vec3f.java (renamed from src/jogl/classes/com/sun/javafx/audio/windows/waveout/Vec3f.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/cg/CgException.java (renamed from src/jogl/classes/com/sun/opengl/cg/CgException.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/DRIHack.java (renamed from src/jogl/classes/com/sun/opengl/impl/DRIHack.java)48
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/Debug.java (renamed from src/jogl/classes/com/sun/opengl/impl/Debug.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/ExtensionAvailabilityCache.java (renamed from src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java)223
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/GLBufferSizeTracker.java (renamed from src/jogl/classes/com/sun/opengl/impl/GLBufferSizeTracker.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/GLBufferStateTracker.java (renamed from src/jogl/classes/com/sun/opengl/impl/GLBufferStateTracker.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java (renamed from src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java)653
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLContextLock.java (renamed from src/jogl/classes/com/sun/opengl/impl/GLContextLock.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLContextShareSet.java (renamed from src/jogl/classes/com/sun/opengl/impl/GLContextShareSet.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java (renamed from src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java)46
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java (renamed from src/jogl/classes/com/sun/opengl/impl/GLDrawableHelper.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java (renamed from src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java)14
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLJNILibLoader.java (renamed from src/jogl/classes/com/sun/opengl/impl/NativeLibLoader.java)8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java (renamed from src/jogl/classes/com/sun/opengl/impl/GLPbufferImpl.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/GLStateTracker.java (renamed from src/jogl/classes/com/sun/opengl/impl/GLStateTracker.java)29
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/GLWorkerThread.java (renamed from src/jogl/classes/com/sun/opengl/impl/GLWorkerThread.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/InternalBufferUtil.java.javame_cdc_fp (renamed from src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javame_cdc_fp)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/InternalBufferUtil.java.javase (renamed from src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javase)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/ProjectFloat.java (renamed from src/jogl/classes/com/sun/opengl/impl/ProjectFloat.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/SystemUtil.java.javame_cdc_fp (renamed from src/jogl/classes/com/sun/opengl/impl/SystemUtil.java.javame_cdc_fp)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/SystemUtil.java.javase (renamed from src/jogl/classes/com/sun/opengl/impl/SystemUtil.java.javase)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/ThreadingImpl.java (renamed from src/jogl/classes/com/sun/opengl/impl/ThreadingImpl.java)13
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/ThreadingPlugin.java (renamed from src/jogl/classes/com/sun/opengl/impl/ThreadingPlugin.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/awt/AWTThreadingPlugin.java (renamed from src/jogl/classes/com/sun/opengl/impl/awt/AWTThreadingPlugin.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/awt/AWTUtil.java (renamed from src/jogl/classes/com/sun/opengl/impl/awt/AWTUtil.java)8
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/awt/Java2D.java (renamed from src/jogl/classes/com/sun/opengl/impl/awt/Java2D.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/awt/Java2DGLContext.java (renamed from src/jogl/classes/com/sun/opengl/impl/awt/Java2DGLContext.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java (renamed from src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java)39
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java (renamed from src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java)9
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java (renamed from src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java)24
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLookupHelper.java (renamed from src/jogl/classes/com/sun/opengl/impl/egl/EGLDynamicLookupHelper.java)27
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLookupHelper.java (renamed from src/jogl/classes/com/sun/opengl/impl/egl/EGLES1DynamicLookupHelper.java)7
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLES2DynamicLookupHelper.java (renamed from src/jogl/classes/com/sun/opengl/impl/egl/EGLES2DynamicLookupHelper.java)7
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLExternalContext.java (renamed from src/jogl/classes/com/sun/opengl/impl/egl/EGLExternalContext.java)6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfiguration.java (renamed from src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java)81
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java (renamed from src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfigurationFactory.java)30
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenContext.java (renamed from src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenContext.java)6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java (renamed from src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java)32
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/egl/EGLPbufferContext.java (renamed from src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferContext.java)6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/egl/EGLPbufferDrawable.java (renamed from src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java)6
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/gl2/ProjectDouble.java (renamed from src/jogl/classes/com/sun/opengl/impl/gl2/ProjectDouble.java)6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/gl2/Util.java (renamed from src/jogl/classes/com/sun/opengl/impl/gl2/Util.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/gl2/fixme/GLObjectTracker.java (renamed from src/jogl/classes/com/sun/opengl/impl/gl2/fixme/GLObjectTracker.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/GLUquadricImpl.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/GLUquadricImpl.java)6
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/Glue.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/Glue.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/error/Error.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/error/Error.java)6
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/gl2/nurbs/GL2Backend.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/gl2/nurbs/GL2Backend.java)6
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/gl2/nurbs/GL2CurveEvaluator.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/gl2/nurbs/GL2CurveEvaluator.java)6
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/gl2/nurbs/GL2SurfaceEvaluator.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/gl2/nurbs/GL2SurfaceEvaluator.java)6
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/gl2/nurbs/GLUgl2nurbsImpl.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/gl2/nurbs/GLUgl2nurbsImpl.java)6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/BuildMipmap.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/BuildMipmap.java)8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract1010102.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract1010102.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract1555rev.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract1555rev.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract2101010rev.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract2101010rev.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract233rev.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract233rev.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract332.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract332.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract4444.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract4444.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract4444rev.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract4444rev.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract5551.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract5551.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract565.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract565.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract565rev.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract565rev.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract8888.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract8888.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract8888rev.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract8888rev.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractFloat.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractFloat.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractPrimitive.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractPrimitive.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractSByte.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractSByte.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractSInt.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractSInt.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractSShort.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractSShort.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractUByte.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractUByte.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractUInt.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractUInt.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractUShort.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractUShort.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/HalveImage.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/HalveImage.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Image.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Image.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Mipmap.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Mipmap.java)293
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/PixelStorageModes.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/PixelStorageModes.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ScaleInternal.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ScaleInternal.java)6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Type_Widget.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Type_Widget.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Arc.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Arc.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/ArcSdirSorter.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/ArcSdirSorter.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/ArcTdirSorter.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/ArcTdirSorter.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/ArcTesselator.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/ArcTesselator.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Backend.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Backend.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/BezierArc.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/BezierArc.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Bin.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Bin.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Breakpt.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Breakpt.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/CArrayOfArcs.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfArcs.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/CArrayOfBreakpts.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfBreakpts.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/CArrayOfFloats.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfFloats.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/CArrayOfQuiltspecs.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfQuiltspecs.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Curve.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Curve.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/CurveEvaluator.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CurveEvaluator.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Curvelist.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Curvelist.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/DisplayList.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/DisplayList.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Flist.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Flist.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Knotspec.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Knotspec.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Knotvector.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Knotvector.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Mapdesc.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Mapdesc.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Maplist.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Maplist.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/NurbsConsts.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/NurbsConsts.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/O_curve.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_curve.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/O_nurbscurve.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_nurbscurve.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/O_nurbssurface.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_nurbssurface.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/O_pwlcurve.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_pwlcurve.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/O_surface.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_surface.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/O_trim.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_trim.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Patch.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Patch.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Patchlist.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Patchlist.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Property.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Property.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Pspec.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Pspec.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/PwlArc.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/PwlArc.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Quilt.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Quilt.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Quiltspec.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Quiltspec.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/README.txt (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/README.txt)0
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Renderhints.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Renderhints.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Splinespec.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Splinespec.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Subdivider.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Subdivider.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/SurfaceEvaluator.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/SurfaceEvaluator.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/TrimVertex.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/nurbs/TrimVertex.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/registry/Registry.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/registry/Registry.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/ActiveRegion.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/tessellator/ActiveRegion.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/CachedVertex.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/tessellator/CachedVertex.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/Dict.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/tessellator/Dict.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/DictNode.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/tessellator/DictNode.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/GLUface.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/tessellator/GLUface.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/GLUhalfEdge.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/tessellator/GLUhalfEdge.java)8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/GLUmesh.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/tessellator/GLUmesh.java)10
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/GLUtessellatorImpl.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/tessellator/GLUtessellatorImpl.java)6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/GLUvertex.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/tessellator/GLUvertex.java)6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/Geom.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/tessellator/Geom.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/Mesh.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/tessellator/Mesh.java)160
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/Normal.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/tessellator/Normal.java)22
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/PriorityQ.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/tessellator/PriorityQ.java)6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/PriorityQHeap.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/tessellator/PriorityQHeap.java)40
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/PriorityQSort.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/tessellator/PriorityQSort.java)28
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/Render.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/tessellator/Render.java)56
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/Sweep.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/tessellator/Sweep.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/TessMono.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/tessellator/TessMono.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/TessState.java (renamed from src/jogl/classes/com/sun/opengl/impl/glu/tessellator/TessState.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java (renamed from src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java)42
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java (renamed from src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java)13
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java (renamed from src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java)25
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java (renamed from src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java)5
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java (renamed from src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java)8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java (renamed from src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java)11
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOffscreenCGLContext.java (renamed from src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOffscreenCGLContext.java)6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java (renamed from src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java (renamed from src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java)8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java (renamed from src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java (renamed from src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java)34
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java (renamed from src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java)15
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLDrawableFactory.java (renamed from src/jogl/classes/com/sun/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLDrawableFactory.java)11
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java (renamed from src/jogl/classes/com/sun/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java)12
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXJava2DCGLContext.java (renamed from src/jogl/classes/com/sun/opengl/impl/macosx/cgl/awt/MacOSXJava2DCGLContext.java)21
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java (renamed from src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java)13
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java (renamed from src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLContext.java)12
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java (renamed from src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java)6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLContext.java (renamed from src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLContext.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java (renamed from src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java)8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java (renamed from src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOnscreenWGLDrawable.java (renamed from src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLDrawable.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java (renamed from src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java)6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java (renamed from src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java (renamed from src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java)274
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java (renamed from src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java)20
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java (renamed from src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java)132
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java (renamed from src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java)23
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java (renamed from src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java)66
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java (renamed from src/jogl/classes/com/sun/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java)12
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/GLXUtil.java (renamed from src/jogl/classes/com/sun/opengl/impl/x11/glx/GLXUtil.java)58
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java94
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXContext.java (renamed from src/jogl/classes/com/sun/opengl/impl/x11/glx/X11ExternalGLXContext.java)10
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java (renamed from src/jogl/classes/com/sun/opengl/impl/x11/glx/X11ExternalGLXDrawable.java)8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java (renamed from src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java)417
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java (renamed from src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java)41
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java (renamed from src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java)235
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java (renamed from src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java)67
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java (renamed from src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java)283
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java (renamed from src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXContext.java)8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java (renamed from src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java)113
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OnscreenGLXContext.java (renamed from src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java)6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java (renamed from src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java)6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXContext.java (renamed from src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXContext.java)35
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java (renamed from src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java)8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java (renamed from src/jogl/classes/com/sun/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java)16
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java (renamed from src/jogl/classes/com/sun/opengl/util/AWTAnimatorImpl.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/Animator.java (renamed from src/jogl/classes/com/sun/opengl/util/Animator.java)6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/AnimatorImpl.java (renamed from src/jogl/classes/com/sun/opengl/util/AnimatorImpl.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/FBObject.java (renamed from src/jogl/classes/com/sun/opengl/util/FBObject.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java (renamed from src/jogl/classes/com/sun/opengl/util/FPSAnimator.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/FileUtil.java (renamed from src/jogl/classes/com/sun/opengl/util/FileUtil.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/FixedPoint.java (renamed from src/jogl/classes/com/sun/opengl/util/FixedPoint.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java (renamed from src/jogl/classes/com/sun/opengl/util/GLArrayDataClient.java)27
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java (renamed from src/jogl/classes/com/sun/opengl/util/GLArrayDataEditable.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java (renamed from src/jogl/classes/com/sun/opengl/util/GLArrayDataServer.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java (renamed from src/jogl/classes/com/sun/opengl/util/GLArrayDataWrapper.java)12
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLArrayHandler.java (renamed from src/jogl/classes/com/sun/opengl/util/GLArrayHandler.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/GLBuffers.java137
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLFixedArrayHandler.java (renamed from src/jogl/classes/com/sun/opengl/util/GLFixedArrayHandler.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/Gamma.java (renamed from src/jogl/classes/com/sun/opengl/util/Gamma.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java (renamed from src/jogl/classes/com/sun/opengl/util/ImmModeSink.java)170
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/Locator.java (renamed from src/jogl/classes/com/sun/opengl/util/Locator.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java (renamed from src/jogl/classes/com/sun/opengl/util/PMVMatrix.java)15
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/StreamUtil.java (renamed from src/jogl/classes/com/sun/opengl/util/StreamUtil.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/TGAWriter.java (renamed from src/jogl/classes/com/sun/opengl/util/TGAWriter.java)10
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java (renamed from src/jogl/classes/com/sun/opengl/util/awt/ImageUtil.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java (renamed from src/jogl/classes/com/sun/opengl/util/awt/Overlay.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java (renamed from src/jogl/classes/com/sun/opengl/util/awt/Screenshot.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java (renamed from src/jogl/classes/com/sun/opengl/util/awt/TextRenderer.java)21
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java (renamed from src/jogl/classes/com/sun/opengl/util/awt/TextureRenderer.java)14
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java (renamed from src/jogl/classes/com/sun/opengl/util/gl2/BitmapCharRec.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java (renamed from src/jogl/classes/com/sun/opengl/util/gl2/BitmapFontRec.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java (renamed from src/jogl/classes/com/sun/opengl/util/gl2/CoordRec.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java (renamed from src/jogl/classes/com/sun/opengl/util/gl2/GLUT.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap8x13.java (renamed from src/jogl/classes/com/sun/opengl/util/gl2/GLUTBitmap8x13.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap9x15.java (renamed from src/jogl/classes/com/sun/opengl/util/gl2/GLUTBitmap9x15.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica10.java (renamed from src/jogl/classes/com/sun/opengl/util/gl2/GLUTBitmapHelvetica10.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica12.java (renamed from src/jogl/classes/com/sun/opengl/util/gl2/GLUTBitmapHelvetica12.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica18.java (renamed from src/jogl/classes/com/sun/opengl/util/gl2/GLUTBitmapHelvetica18.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman10.java (renamed from src/jogl/classes/com/sun/opengl/util/gl2/GLUTBitmapTimesRoman10.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman24.java (renamed from src/jogl/classes/com/sun/opengl/util/gl2/GLUTBitmapTimesRoman24.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java (renamed from src/jogl/classes/com/sun/opengl/util/gl2/GLUTStrokeMonoRoman.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java (renamed from src/jogl/classes/com/sun/opengl/util/gl2/GLUTStrokeRoman.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java (renamed from src/jogl/classes/com/sun/opengl/util/gl2/StrokeCharRec.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java (renamed from src/jogl/classes/com/sun/opengl/util/gl2/StrokeFontRec.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java (renamed from src/jogl/classes/com/sun/opengl/util/gl2/StrokeRec.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/gl2/TileRenderer.java (renamed from src/jogl/classes/com/sun/opengl/util/gl2/TileRenderer.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/GLSLArrayHandler.java (renamed from src/jogl/classes/com/sun/opengl/util/glsl/GLSLArrayHandler.java)6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java (renamed from src/jogl/classes/com/sun/opengl/util/glsl/ShaderCode.java)11
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java (renamed from src/jogl/classes/com/sun/opengl/util/glsl/ShaderProgram.java)15
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java (renamed from src/jogl/classes/com/sun/opengl/util/glsl/ShaderState.java)63
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java (renamed from src/jogl/classes/com/sun/opengl/util/glsl/ShaderUtil.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java (renamed from src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/FixedFuncUtil.java)14
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncHook.java (renamed from src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/FixedFuncHook.java)36
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncPipeline.java (renamed from src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/FixedFuncPipeline.java)28
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColor.fp (renamed from src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColor.fp)0
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColor.vp (renamed from src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColor.vp)0
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColorLight.vp (renamed from src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColorLight.vp)0
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColorTexture.fp (renamed from src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColorTexture.fp)0
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColor.bfp (renamed from src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColor.bfp)bin1108 -> 1108 bytes
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColor.bvp (renamed from src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColor.bvp)bin2344 -> 2344 bytes
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColorLight.bvp (renamed from src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColorLight.bvp)bin8787 -> 8787 bytes
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColorTexture.bfp (renamed from src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColorTexture.bfp)bin2392 -> 2392 bytes
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/es_precision.glsl (renamed from src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/es_precision.glsl)0
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/mgl_attribute.glsl (renamed from src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/mgl_attribute.glsl)0
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/mgl_const.glsl (renamed from src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/mgl_const.glsl)0
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/mgl_lightdef.glsl (renamed from src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/mgl_lightdef.glsl)0
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/mgl_settexcoord.vp (renamed from src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/mgl_settexcoord.vp)0
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/mgl_uniform.glsl (renamed from src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/mgl_uniform.glsl)0
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/mgl_uniform_light.glsl (renamed from src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/mgl_uniform_light.glsl)0
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/mgl_varying.glsl (renamed from src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/mgl_varying.glsl)0
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/scripts/nvidia-apx/glslc-ff.bat (renamed from src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/scripts/nvidia-apx/glslc-ff.bat)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/scripts/nvidia-apx/glslc.bat (renamed from src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/scripts/nvidia-apx/glslc.bat)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java (renamed from src/jogl/classes/com/sun/opengl/util/glsl/sdk/CompileShader.java)27
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShaderNVidia.java (renamed from src/jogl/classes/com/sun/opengl/util/glsl/sdk/CompileShaderNVidia.java)6
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/packrect/BackingStoreManager.java (renamed from src/jogl/classes/com/sun/opengl/util/packrect/BackingStoreManager.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/packrect/Level.java (renamed from src/jogl/classes/com/sun/opengl/util/packrect/Level.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java (renamed from src/jogl/classes/com/sun/opengl/util/packrect/LevelSet.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java (renamed from src/jogl/classes/com/sun/opengl/util/packrect/Rect.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/packrect/RectVisitor.java (renamed from src/jogl/classes/com/sun/opengl/util/packrect/RectVisitor.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java (renamed from src/jogl/classes/com/sun/opengl/util/packrect/RectanglePacker.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/packrect/package.html (renamed from src/jogl/classes/com/sun/opengl/util/packrect/package.html)0
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/texture/Texture.java (renamed from src/jogl/classes/com/sun/opengl/util/texture/Texture.java)36
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java (renamed from src/jogl/classes/com/sun/opengl/util/texture/TextureCoords.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java (renamed from src/jogl/classes/com/sun/opengl/util/texture/TextureData.java)58
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java.javame_cdc_fp (renamed from src/jogl/classes/com/sun/opengl/util/texture/TextureIO.java.javame_cdc_fp)107
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java.javase (renamed from src/jogl/classes/com/sun/opengl/util/texture/TextureIO.java.javase)107
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java (renamed from src/jogl/classes/com/sun/opengl/util/texture/awt/AWTTextureData.java)41
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java (renamed from src/jogl/classes/com/sun/opengl/util/texture/awt/AWTTextureIO.java)30
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp (renamed from src/jogl/classes/com/sun/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp)8
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java.javase (renamed from src/jogl/classes/com/sun/opengl/util/texture/spi/DDSImage.java.javase)8
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java (renamed from src/jogl/classes/com/sun/opengl/util/texture/spi/LEDataInputStream.java)2
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java (renamed from src/jogl/classes/com/sun/opengl/util/texture/spi/LEDataOutputStream.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java (renamed from src/jogl/classes/com/sun/opengl/util/texture/spi/NetPbmTextureWriter.java)8
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java (renamed from src/jogl/classes/com/sun/opengl/util/texture/spi/SGIImage.java)4
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java.javame_cdc_fp (renamed from src/jogl/classes/com/sun/opengl/util/texture/spi/TGAImage.java.javame_cdc_fp)16
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java.javase (renamed from src/jogl/classes/com/sun/opengl/util/texture/spi/TGAImage.java.javase)16
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java (renamed from src/jogl/classes/com/sun/opengl/util/texture/spi/TextureProvider.java)17
-rwxr-xr-xsrc/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureWriter.java (renamed from src/jogl/classes/com/sun/opengl/util/texture/spi/TextureWriter.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java (renamed from src/jogl/classes/com/sun/opengl/util/texture/spi/awt/IIOTextureProvider.java)23
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java (renamed from src/jogl/classes/com/sun/opengl/util/texture/spi/awt/IIOTextureWriter.java)10
-rw-r--r--src/jogl/classes/com/jogamp/openmax/OMXEventListener.java (renamed from src/jogl/classes/com/sun/openmax/OMXEventListener.java)2
-rw-r--r--src/jogl/classes/com/jogamp/openmax/OMXInstance.java (renamed from src/jogl/classes/com/sun/openmax/OMXInstance.java)18
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/util/BufferUtil.java.javame_cdc_fp449
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/util/BufferUtil.java.javase499
-rw-r--r--src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java13
-rw-r--r--src/jogl/classes/javax/media/opengl/GLArrayData.java10
-rw-r--r--src/jogl/classes/javax/media/opengl/GLAutoDrawable.java2
-rw-r--r--src/jogl/classes/javax/media/opengl/GLBase.java30
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java257
-rw-r--r--src/jogl/classes/javax/media/opengl/GLDrawableFactory.java82
-rw-r--r--src/jogl/classes/javax/media/opengl/GLPipelineFactory.java2
-rw-r--r--src/jogl/classes/javax/media/opengl/GLProfile.java512
-rw-r--r--src/jogl/classes/javax/media/opengl/GLUniformData.java2
-rwxr-xr-xsrc/jogl/classes/javax/media/opengl/Threading.java2
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java2
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLJPanel.java18
-rw-r--r--src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java4
-rwxr-xr-xsrc/jogl/classes/javax/media/opengl/glu/GLUquadric.java2
-rwxr-xr-xsrc/jogl/classes/javax/media/opengl/glu/GLUtessellator.java2
-rwxr-xr-xsrc/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallback.java4
-rwxr-xr-xsrc/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java4
-rwxr-xr-xsrc/jogl/native/audio/Mixer.cpp26
-rw-r--r--src/jogl/native/openmax/com_sun_openmax_OMXInstance.c36
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01CORE.java95
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java106
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/demos/es1/RedSquare.java170
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java306
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java185
-rwxr-xr-x[-rw-r--r--]src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBuffer2File.java (renamed from src/nativewindow/classes/com/sun/nativewindow/impl/jvm/JVMUtil.java)69
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/offscreen/ReadBuffer2Screen.java192
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/offscreen/ReadBufferBase.java95
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/offscreen/ReadBufferUtil.java111
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/offscreen/Surface2File.java82
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java389
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java113
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java109
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/util/texture/gl2/TextureGL2ListenerDraw1.java109
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java165
-rw-r--r--src/junit/com/jogamp/test/junit/util/MiscUtils.java67
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/Debug.java (renamed from src/nativewindow/classes/com/sun/nativewindow/impl/Debug.java)2
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/GraphicsConfigurationFactoryImpl.java (renamed from src/nativewindow/classes/com/sun/nativewindow/impl/GraphicsConfigurationFactoryImpl.java)2
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/InternalBufferUtil.java (renamed from src/nativewindow/classes/com/sun/nativewindow/impl/InternalBufferUtil.java)4
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/LockingNativeWindowFactory.java (renamed from src/nativewindow/classes/com/sun/nativewindow/impl/LockingNativeWindowFactory.java)2
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/NWJNILibLoader.java50
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/NativeWindowFactoryImpl.java (renamed from src/nativewindow/classes/com/sun/nativewindow/impl/NativeWindowFactoryImpl.java)13
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/NullWindow.java (renamed from src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java)2
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTJNILibLoader.java (renamed from src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTNativeLibLoader.java)6
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTUtil.java (renamed from src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTUtil.java)10
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTWindow.java (renamed from src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java)6
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWT_PlatformInfo.java (renamed from src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWT_PlatformInfo.java)4
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/macosx/MacOSXJAWTWindow.java (renamed from src/nativewindow/classes/com/sun/nativewindow/impl/jawt/macosx/MacOSXJAWTWindow.java)6
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/windows/WindowsJAWTWindow.java (renamed from src/nativewindow/classes/com/sun/nativewindow/impl/jawt/windows/WindowsJAWTWindow.java)6
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/x11/X11JAWTWindow.java (renamed from src/nativewindow/classes/com/sun/nativewindow/impl/jawt/x11/X11JAWTWindow.java)8
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/x11/X11SunJDKReflection.java (renamed from src/nativewindow/classes/com/sun/nativewindow/impl/jawt/x11/X11SunJDKReflection.java)4
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11GraphicsConfigurationFactory.java (renamed from src/nativewindow/classes/com/sun/nativewindow/impl/x11/X11GraphicsConfigurationFactory.java)10
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11Util.java334
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/awt/X11AWTNativeWindowFactory.java (renamed from src/nativewindow/classes/com/sun/nativewindow/impl/x11/awt/X11AWTNativeWindowFactory.java)10
-rw-r--r--src/nativewindow/classes/com/sun/nativewindow/impl/NWReflection.java181
-rw-r--r--src/nativewindow/classes/com/sun/nativewindow/impl/NativeLibLoaderBase.java202
-rw-r--r--src/nativewindow/classes/com/sun/nativewindow/impl/x11/X11Util.java166
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java5
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java15
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java2
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsDevice.java2
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsScreen.java2
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/package.html2
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsConfiguration.java2
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java37
-rw-r--r--src/nativewindow/native/JAWT_DrawingSurfaceInfo.c2
-rw-r--r--src/nativewindow/native/JVM_Tool.c51
-rw-r--r--src/nativewindow/native/x11/Xmisc.c493
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/Display.java (renamed from src/newt/classes/com/sun/javafx/newt/Display.java)61
-rw-r--r--src/newt/classes/com/jogamp/newt/Event.java (renamed from src/newt/classes/com/sun/javafx/newt/Event.java)2
-rw-r--r--src/newt/classes/com/jogamp/newt/EventListener.java (renamed from src/newt/classes/com/sun/javafx/newt/EventListener.java)2
-rw-r--r--src/newt/classes/com/jogamp/newt/InputEvent.java (renamed from src/newt/classes/com/sun/javafx/newt/InputEvent.java)2
-rw-r--r--src/newt/classes/com/jogamp/newt/Insets.java (renamed from src/newt/classes/com/sun/javafx/newt/Insets.java)2
-rw-r--r--src/newt/classes/com/jogamp/newt/KeyEvent.java (renamed from src/newt/classes/com/sun/javafx/newt/KeyEvent.java)2
-rw-r--r--src/newt/classes/com/jogamp/newt/KeyListener.java (renamed from src/newt/classes/com/sun/javafx/newt/KeyListener.java)2
-rw-r--r--src/newt/classes/com/jogamp/newt/MouseEvent.java (renamed from src/newt/classes/com/sun/javafx/newt/MouseEvent.java)2
-rw-r--r--src/newt/classes/com/jogamp/newt/MouseListener.java (renamed from src/newt/classes/com/sun/javafx/newt/MouseListener.java)2
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/NewtFactory.java (renamed from src/newt/classes/com/sun/javafx/newt/NewtFactory.java)4
-rw-r--r--src/newt/classes/com/jogamp/newt/OffscreenWindow.java (renamed from src/newt/classes/com/sun/javafx/newt/OffscreenWindow.java)2
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/PaintEvent.java (renamed from src/newt/classes/com/sun/javafx/newt/PaintEvent.java)2
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/PaintListener.java (renamed from src/newt/classes/com/sun/javafx/newt/PaintListener.java)2
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/Screen.java (renamed from src/newt/classes/com/sun/javafx/newt/Screen.java)14
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/Window.java (renamed from src/newt/classes/com/sun/javafx/newt/Window.java)242
-rw-r--r--src/newt/classes/com/jogamp/newt/WindowEvent.java (renamed from src/newt/classes/com/sun/javafx/newt/WindowEvent.java)2
-rw-r--r--src/newt/classes/com/jogamp/newt/WindowListener.java (renamed from src/newt/classes/com/sun/javafx/newt/WindowListener.java)2
-rw-r--r--src/newt/classes/com/jogamp/newt/awt/AWTCanvas.java (renamed from src/newt/classes/com/sun/javafx/newt/awt/AWTCanvas.java)6
-rw-r--r--src/newt/classes/com/jogamp/newt/awt/AWTDisplay.java (renamed from src/newt/classes/com/sun/javafx/newt/awt/AWTDisplay.java)50
-rw-r--r--src/newt/classes/com/jogamp/newt/awt/AWTScreen.java (renamed from src/newt/classes/com/sun/javafx/newt/awt/AWTScreen.java)4
-rw-r--r--src/newt/classes/com/jogamp/newt/awt/AWTWindow.java (renamed from src/newt/classes/com/sun/javafx/newt/awt/AWTWindow.java)56
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/Debug.java (renamed from src/newt/classes/com/sun/javafx/newt/impl/Debug.java)4
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/NEWTJNILibLoader.java (renamed from src/newt/classes/com/sun/javafx/newt/impl/NativeLibLoader.java)6
-rw-r--r--src/newt/classes/com/jogamp/newt/intel/gdl/Display.java (renamed from src/newt/classes/com/sun/javafx/newt/intel/gdl/Display.java)8
-rw-r--r--src/newt/classes/com/jogamp/newt/intel/gdl/Screen.java (renamed from src/newt/classes/com/sun/javafx/newt/intel/gdl/Screen.java)6
-rw-r--r--src/newt/classes/com/jogamp/newt/intel/gdl/Window.java (renamed from src/newt/classes/com/sun/javafx/newt/intel/gdl/Window.java)4
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/macosx/MacDisplay.java (renamed from src/newt/classes/com/sun/javafx/newt/macosx/MacDisplay.java)10
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/macosx/MacScreen.java (renamed from src/newt/classes/com/sun/javafx/newt/macosx/MacScreen.java)4
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/macosx/MacWindow.java (renamed from src/newt/classes/com/sun/javafx/newt/macosx/MacWindow.java)48
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java (renamed from src/newt/classes/com/sun/javafx/newt/opengl/GLWindow.java)22
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/broadcom/egl/Display.java (renamed from src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Display.java)10
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/opengl/broadcom/egl/Screen.java (renamed from src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Screen.java)5
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/opengl/broadcom/egl/Window.java (renamed from src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Window.java)8
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/opengl/kd/KDDisplay.java (renamed from src/newt/classes/com/sun/javafx/newt/opengl/kd/KDDisplay.java)10
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/opengl/kd/KDScreen.java (renamed from src/newt/classes/com/sun/javafx/newt/opengl/kd/KDScreen.java)4
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/opengl/kd/KDWindow.java (renamed from src/newt/classes/com/sun/javafx/newt/opengl/kd/KDWindow.java)8
-rw-r--r--src/newt/classes/com/jogamp/newt/util/EDTUtil.java (renamed from src/newt/classes/com/sun/javafx/newt/util/EventDispatchThread.java)98
-rw-r--r--src/newt/classes/com/jogamp/newt/util/MainThread.java (renamed from src/newt/classes/com/sun/javafx/newt/util/MainThread.java)18
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/windows/WindowsDisplay.java (renamed from src/newt/classes/com/sun/javafx/newt/windows/WindowsDisplay.java)8
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/windows/WindowsScreen.java (renamed from src/newt/classes/com/sun/javafx/newt/windows/WindowsScreen.java)5
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/windows/WindowsWindow.java (renamed from src/newt/classes/com/sun/javafx/newt/windows/WindowsWindow.java)4
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/x11/X11Display.java (renamed from src/newt/classes/com/sun/javafx/newt/x11/X11Display.java)16
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/x11/X11Screen.java (renamed from src/newt/classes/com/sun/javafx/newt/x11/X11Screen.java)6
-rwxr-xr-xsrc/newt/classes/com/jogamp/newt/x11/X11Window.java (renamed from src/newt/classes/com/sun/javafx/newt/x11/X11Window.java)5
-rwxr-xr-xsrc/newt/native/BroadcomEGL.c16
-rw-r--r--src/newt/native/IntelGDL.c24
-rwxr-xr-xsrc/newt/native/KDWindow.c20
-rw-r--r--src/newt/native/MacWindow.m62
-rw-r--r--src/newt/native/NewtMacWindow.h2
-rwxr-xr-xsrc/newt/native/NewtMacWindow.m2
-rwxr-xr-xsrc/newt/native/WindowsWindow.c74
-rwxr-xr-xsrc/newt/native/X11Window.c194
410 files changed, 8051 insertions, 4910 deletions
diff --git a/src/jogl/classes/com/sun/javafx/audio/windows/waveout/Audio.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/Audio.java
index 8e4e97b0c..2b51be164 100755
--- a/src/jogl/classes/com/sun/javafx/audio/windows/waveout/Audio.java
+++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/Audio.java
@@ -30,7 +30,7 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.javafx.audio.windows.waveout;
+package com.jogamp.audio.windows.waveout;
import java.io.*;
diff --git a/src/jogl/classes/com/sun/javafx/audio/windows/waveout/Mixer.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java
index 814a74a8c..60972873e 100755
--- a/src/jogl/classes/com/sun/javafx/audio/windows/waveout/Mixer.java
+++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java
@@ -30,7 +30,7 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.javafx.audio.windows.waveout;
+package com.jogamp.audio.windows.waveout;
import java.io.*;
import java.nio.*;
diff --git a/src/jogl/classes/com/sun/javafx/audio/windows/waveout/SoundBuffer.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/SoundBuffer.java
index b0404673e..c45430d23 100755
--- a/src/jogl/classes/com/sun/javafx/audio/windows/waveout/SoundBuffer.java
+++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/SoundBuffer.java
@@ -30,7 +30,7 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.javafx.audio.windows.waveout;
+package com.jogamp.audio.windows.waveout;
import java.io.*;
diff --git a/src/jogl/classes/com/sun/javafx/audio/windows/waveout/TestSpatialization.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/TestSpatialization.java
index 4bf967a02..78fb3493f 100755
--- a/src/jogl/classes/com/sun/javafx/audio/windows/waveout/TestSpatialization.java
+++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/TestSpatialization.java
@@ -30,9 +30,10 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.javafx.audio.windows.waveout;
+package com.jogamp.audio.windows.waveout;
import java.io.*;
+import javax.media.nativewindow.NativeWindow;
import javax.media.opengl.GLDrawableFactory;
public class TestSpatialization {
diff --git a/src/jogl/classes/com/sun/javafx/audio/windows/waveout/Track.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/Track.java
index 190396112..b57bf1dc6 100755
--- a/src/jogl/classes/com/sun/javafx/audio/windows/waveout/Track.java
+++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/Track.java
@@ -30,7 +30,7 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.javafx.audio.windows.waveout;
+package com.jogamp.audio.windows.waveout;
import java.io.*;
import java.nio.*;
diff --git a/src/jogl/classes/com/sun/javafx/audio/windows/waveout/Vec3f.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/Vec3f.java
index 9a3038e35..1afdaf081 100755
--- a/src/jogl/classes/com/sun/javafx/audio/windows/waveout/Vec3f.java
+++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/Vec3f.java
@@ -30,7 +30,7 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.javafx.audio.windows.waveout;
+package com.jogamp.audio.windows.waveout;
/** 3-element single-precision vector */
diff --git a/src/jogl/classes/com/sun/opengl/cg/CgException.java b/src/jogl/classes/com/jogamp/opengl/cg/CgException.java
index 3380bb540..8bfd9e23e 100644
--- a/src/jogl/classes/com/sun/opengl/cg/CgException.java
+++ b/src/jogl/classes/com/jogamp/opengl/cg/CgException.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.cg;
+package com.jogamp.opengl.cg;
/**
* A generic exception for errors that occur throughout the NVidia Cg
diff --git a/src/jogl/classes/com/sun/opengl/impl/DRIHack.java b/src/jogl/classes/com/jogamp/opengl/impl/DRIHack.java
index 63a2f7ecd..7e81d194b 100755
--- a/src/jogl/classes/com/sun/opengl/impl/DRIHack.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/DRIHack.java
@@ -37,11 +37,12 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
+import com.jogamp.common.os.NativeLibrary;
+import com.jogamp.common.os.Platform;
import java.io.*;
import java.security.*;
-import com.sun.gluegen.runtime.*;
/**
* Helper class for working around problems with open-source DRI
@@ -76,27 +77,31 @@ import com.sun.gluegen.runtime.*;
*/
public class DRIHack {
+
private static final boolean DEBUG = Debug.debug("DRIHack");
private static boolean driHackNeeded;
private static NativeLibrary oglLib;
- public static void begin() {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- String os = Debug.getProperty("os.name", false).toLowerCase();
- // Do DRI hack on all Linux distributions for best robustness
- driHackNeeded =
- (os.startsWith("linux") ||
- new File("/usr/lib/dri").exists() ||
- new File("/usr/X11R6/lib/modules/dri").exists());
- // Allow manual overriding for now as a workaround for
- // problems seen in some situations -- needs more investigation
- if (Debug.getProperty("jogl.drihack.disable", true) != null) {
+ static {
+ // Allow manual overriding for now as a workaround for
+ // problems seen in some situations -- needs more investigation
+ if (Debug.getProperty("jogl.drihack.disable", true) != null) {
driHackNeeded = false;
- }
- return null;
+ } else {
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ String os = Platform.getOS().toLowerCase();
+ // Do DRI hack on all Linux distributions for best robustness
+ driHackNeeded = os.startsWith("linux")
+ || new File("/usr/lib/dri").exists()
+ || new File("/usr/X11R6/lib/modules/dri").exists();
+ return null;
+ }
+ });
}
- });
+ }
+
+ public static void begin() {
if (driHackNeeded) {
if (DEBUG) {
@@ -106,12 +111,17 @@ public class DRIHack {
// Try a few different variants for best robustness
// In theory probably only the first is necessary
oglLib = NativeLibrary.open("libGL.so.1", null);
- if (DEBUG && oglLib != null) System.err.println(" Found libGL.so.1");
+ if (DEBUG && oglLib != null) {
+ System.err.println(" Found libGL.so.1");
+ }
if (oglLib == null) {
oglLib = NativeLibrary.open("/usr/lib/libGL.so.1", null);
- if (DEBUG && oglLib != null) System.err.println(" Found /usr/lib/libGL.so.1");
+ if (DEBUG && oglLib != null) {
+ System.err.println(" Found /usr/lib/libGL.so.1");
+ }
}
}
+
}
public static void end() {
diff --git a/src/jogl/classes/com/sun/opengl/impl/Debug.java b/src/jogl/classes/com/jogamp/opengl/impl/Debug.java
index 7c5451706..82a5f2ff2 100644
--- a/src/jogl/classes/com/sun/opengl/impl/Debug.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/Debug.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
import java.security.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java b/src/jogl/classes/com/jogamp/opengl/impl/ExtensionAvailabilityCache.java
index 26072519e..9d1235e13 100644
--- a/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/ExtensionAvailabilityCache.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
import javax.media.opengl.*;
import java.util.*;
@@ -66,12 +66,10 @@ public final class ExtensionAvailabilityCache {
public void flush()
{
if(DEBUG) {
- System.out.println("ExtensionAvailabilityCache: Flush availability OpenGL "+majorVersion+"."+minorVersion);
+ System.out.println("ExtensionAvailabilityCache: Flush availability OpenGL "+context.getGLVersion());
}
availableExtensionCache.clear();
initialized = false;
- majorVersion = 1;
- minorVersion = 0;
}
/**
@@ -104,53 +102,21 @@ public final class ExtensionAvailabilityCache {
return glExtensions;
}
- public int getMajorVersion() {
- initAvailableExtensions();
- return majorVersion;
- }
-
- public int getMinorVersion() {
- initAvailableExtensions();
- return minorVersion;
- }
-
private void initAvailableExtensions() {
+ GL gl = context.getGL();
// if hash is empty (meaning it was flushed), pre-cache it with the list
// of extensions that are in the GL_EXTENSIONS string
if (availableExtensionCache.isEmpty() || !initialized) {
- GL gl = context.getGL();
-
if (DEBUG) {
- System.err.println("ExtensionAvailabilityCache: Pre-caching init "+gl+", GL_VERSION "+gl.glGetString(GL.GL_VERSION));
- }
-
- // Set version
- Version version = new Version(gl.glGetString(GL.GL_VERSION));
- if (version.isValid()) {
- majorVersion = version.getMajor();
- minorVersion = version.getMinor();
-
- if( !gl.isGL3() &&
- ( majorVersion > 3 ||
- ( majorVersion == 3 && minorVersion >= 1 ) ) ) {
- // downsize version to 3.0 in case we are not using GL3 (3.1)
- majorVersion = 3;
- minorVersion = 0;
- }
+ System.err.println("ExtensionAvailabilityCache: Pre-caching init "+gl+", OpenGL "+context.getGLVersion());
}
boolean useGetStringi = false;
- if ( majorVersion > 3 ||
- ( majorVersion == 3 && minorVersion >= 0 ) ||
- gl.isGL3() ) {
- if ( ! gl.isGL2GL3() ) {
+ if ( gl.isGL2GL3() ) {
+ if ( ! gl.isFunctionAvailable("glGetStringi") ) {
if(DEBUG) {
- System.err.println("ExtensionAvailabilityCache: GL >= 3.1 usage, but no GL2GL3 interface: "+gl.getClass().getName());
- }
- } else if ( ! gl.isFunctionAvailable("glGetStringi") ) {
- if(DEBUG) {
- System.err.println("ExtensionAvailabilityCache: GL >= 3.1 usage, but no glGetStringi");
+ System.err.println("GLContext: GL >= 3.1 usage, but no glGetStringi");
}
} else {
useGetStringi = true;
@@ -158,7 +124,7 @@ public final class ExtensionAvailabilityCache {
}
if (DEBUG) {
- System.err.println("ExtensionAvailabilityCache: Pre-caching extension availability OpenGL "+majorVersion+"."+minorVersion+
+ System.err.println("ExtensionAvailabilityCache: Pre-caching extension availability OpenGL "+context.getGLVersion()+
", use "+ ( useGetStringi ? "glGetStringi" : "glGetString" ) );
}
@@ -197,39 +163,21 @@ public final class ExtensionAvailabilityCache {
}
}
- // Put GL version strings in the table as well
- // FIXME: this needs to be adjusted when the major rev changes
- // beyond the known ones
- int major = majorVersion;
- int minor = minorVersion;
- while (major > 0) {
- while (minor >= 0) {
- availableExtensionCache.add("GL_VERSION_" + major + "_" + minor);
- if (DEBUG) {
- System.err.println("ExtensionAvailabilityCache: Added GL_VERSION_" + major + "_" + minor + " to known extensions");
- }
- --minor;
- }
-
- switch (major) {
- case 3:
- if(gl.isGL3()) {
- // GL3 is a GL 3.1 forward compatible context,
- // hence no 2.0, 1.0 - 1.5 GL versions are supported.
- major=0;
- }
- // Restart loop at version 2.1
- minor = 1;
- break;
- case 2:
- // Restart loop at version 1.5
- minor = 5;
- break;
- case 1:
- break;
+ int major[] = new int[] { context.getGLVersionMajor() };
+ int minor[] = new int[] { context.getGLVersionMinor() };
+ if( !gl.isGL3() && !gl.isGL4() &&
+ ( major[0] > 3 ||
+ ( major[0] == 3 && minor[0] >= 1 ) ) ) {
+ // downsize version to 3.0 in case we are not using GL3 (>=3.1)
+ major[0] = 3;
+ minor[0] = 0;
+ }
+ while (GLContext.isValidGLVersion(major[0], minor[0])) {
+ availableExtensionCache.add("GL_VERSION_" + major[0] + "_" + minor[0]);
+ if (DEBUG) {
+ System.err.println("ExtensionAvailabilityCache: Added GL_VERSION_" + major[0] + "_" + minor[0] + " to known extensions");
}
-
- --major;
+ if(!GLContext.decrementGLVersion(major, minor)) break;
}
// put a dummy var in here so that the cache is no longer empty even if
@@ -255,136 +203,9 @@ public final class ExtensionAvailabilityCache {
//
private boolean initialized = false;
- private int majorVersion = 1;
- private int minorVersion = 0;
private String glExtensions = null;
private String glXExtensions = null;
private HashSet availableExtensionCache = new HashSet(50);
private GLContextImpl context;
- /**
- * A class for storing and comparing OpenGL version numbers.
- * This only works for desktop OpenGL at the moment.
- */
- private static class Version implements Comparable
- {
- private boolean valid;
- private int major, minor, sub;
- public Version(int majorRev, int minorRev, int subMinorRev)
- {
- major = majorRev;
- minor = minorRev;
- sub = subMinorRev;
- }
-
- /**
- * @param versionString must be of the form "GL_VERSION_X" or
- * "GL_VERSION_X_Y" or "GL_VERSION_X_Y_Z" or "X.Y", where X, Y,
- * and Z are integers.
- *
- * @exception IllegalArgumentException if the argument is not a valid
- * OpenGL version identifier
- */
- public Version(String versionString)
- {
- try
- {
- if (versionString.startsWith("GL_VERSION_"))
- {
- StringTokenizer tok = new StringTokenizer(versionString, "_");
-
- tok.nextToken(); // GL_
- tok.nextToken(); // VERSION_
- if (!tok.hasMoreTokens()) { major = 0; return; }
- major = Integer.valueOf(tok.nextToken()).intValue();
- if (!tok.hasMoreTokens()) { minor = 0; return; }
- minor = Integer.valueOf(tok.nextToken()).intValue();
- if (!tok.hasMoreTokens()) { sub = 0; return; }
- sub = Integer.valueOf(tok.nextToken()).intValue();
- }
- else
- {
- int radix = 10;
- if (versionString.length() > 2) {
- if (Character.isDigit(versionString.charAt(0)) &&
- versionString.charAt(1) == '.' &&
- Character.isDigit(versionString.charAt(2))) {
- major = Character.digit(versionString.charAt(0), radix);
- minor = Character.digit(versionString.charAt(2), radix);
-
- // See if there's version-specific information which might
- // imply a more recent OpenGL version
- StringTokenizer tok = new StringTokenizer(versionString, " ");
- if (tok.hasMoreTokens()) {
- tok.nextToken();
- if (tok.hasMoreTokens()) {
- String token = tok.nextToken();
- int i = 0;
- while (i < token.length() && !Character.isDigit(token.charAt(i))) {
- i++;
- }
- if (i < token.length() - 2 &&
- Character.isDigit(token.charAt(i)) &&
- token.charAt(i+1) == '.' &&
- Character.isDigit(token.charAt(i+2))) {
- int altMajor = Character.digit(token.charAt(i), radix);
- int altMinor = Character.digit(token.charAt(i+2), radix);
- // Avoid possibly confusing situations by putting some
- // constraints on the upgrades we do to the major and
- // minor versions
- if ((altMajor == major && altMinor > minor) ||
- altMajor == major + 1) {
- major = altMajor;
- minor = altMinor;
- }
- }
- }
- }
- }
- }
- }
- valid = true;
- }
- catch (Exception e)
- {
- // FIXME: refactor desktop OpenGL dependencies and make this
- // class work properly for OpenGL ES
- System.err.println("ExtensionAvailabilityCache: FunctionAvailabilityCache.Version.<init>: "+e);
- major = 1;
- minor = 0;
- /*
- throw (IllegalArgumentException)
- new IllegalArgumentException(
- "Illegally formatted version identifier: \"" + versionString + "\"")
- .initCause(e);
- */
- }
- }
-
- public boolean isValid() {
- return valid;
- }
-
- public int compareTo(Object o)
- {
- Version vo = (Version)o;
- if (major > vo.major) return 1;
- else if (major < vo.major) return -1;
- else if (minor > vo.minor) return 1;
- else if (minor < vo.minor) return -1;
- else if (sub > vo.sub) return 1;
- else if (sub < vo.sub) return -1;
-
- return 0; // they are equal
- }
-
- public int getMajor() {
- return major;
- }
-
- public int getMinor() {
- return minor;
- }
-
- } // end class Version
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLBufferSizeTracker.java b/src/jogl/classes/com/jogamp/opengl/impl/GLBufferSizeTracker.java
index 53fcc2de1..48affa534 100755
--- a/src/jogl/classes/com/sun/opengl/impl/GLBufferSizeTracker.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLBufferSizeTracker.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
import java.util.*;
import javax.media.opengl.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLBufferStateTracker.java b/src/jogl/classes/com/jogamp/opengl/impl/GLBufferStateTracker.java
index c61d3602d..df8d673a1 100755
--- a/src/jogl/classes/com/sun/opengl/impl/GLBufferStateTracker.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLBufferStateTracker.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
import java.util.*;
import javax.media.opengl.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
index 97100208d..7143344bf 100644
--- a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLContextImpl.java
@@ -37,15 +37,18 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
+import com.jogamp.common.os.DynamicLookupHelper;
import java.nio.*;
-import java.lang.reflect.*;
+import java.util.*;
import javax.media.opengl.*;
-import com.sun.nativewindow.impl.NWReflection;
-import com.sun.gluegen.runtime.*;
-import com.sun.gluegen.runtime.opengl.*;
+import javax.media.nativewindow.*;
+import com.jogamp.gluegen.runtime.*;
+import com.jogamp.gluegen.runtime.opengl.*;
+import com.jogamp.common.JogampRuntimeException;
+import com.jogamp.common.util.ReflectionUtil;
public abstract class GLContextImpl extends GLContext {
protected GLContextLock lock = new GLContextLock();
@@ -121,69 +124,33 @@ public abstract class GLContextImpl extends GLContext {
return (GLDrawableImpl) getGLDrawable();
}
- public int makeCurrent() throws GLException {
- // Support calls to makeCurrent() over and over again with
- // different contexts without releasing them
- // Could implement this more efficiently without explicit
- // releasing of the underlying context; would require more error
- // checking during the makeCurrentImpl phase
- GLContext current = getCurrent();
- if (current != null) {
- if (current == this) {
- // Assume we don't need to make this context current again
- // For Mac OS X, however, we need to update the context to track resizes
- update();
- return CONTEXT_CURRENT;
- } else {
- current.release();
- }
- }
+ public final GL getGL() {
+ return gl;
+ }
- if (GLWorkerThread.isStarted() &&
- !GLWorkerThread.isWorkerThread()) {
- // Kick the GLWorkerThread off its current context
- GLWorkerThread.invokeLater(new Runnable() { public void run() {} });
+ public GL setGL(GL gl) {
+ if(DEBUG) {
+ String sgl1 = (null!=this.gl)?this.gl.getClass().toString()+", "+this.gl.toString():new String("<null>");
+ String sgl2 = (null!=gl)?gl.getClass().toString()+", "+gl.toString():new String("<null>");
+ Exception e = new Exception("setGL (OpenGL "+getGLVersion()+"): "+Thread.currentThread()+", "+sgl1+" -> "+sgl2);
+ e.printStackTrace();
}
+ this.gl = gl;
+ return gl;
+ }
- lock.lock();
- int res = 0;
- try {
- res = makeCurrentImpl();
-
- /* FIXME: refactor dependence on Java 2D / JOGL bridge
- if ((tracker != null) &&
- (res == CONTEXT_CURRENT_NEW)) {
- // Increase reference count of GLObjectTracker
- tracker.ref();
- }
- */
- } catch (GLException e) {
- lock.unlock();
- throw(e);
- }
- if (res == CONTEXT_NOT_CURRENT) {
- lock.unlock();
- } else {
- if(res == CONTEXT_CURRENT_NEW) {
- // check if the drawable's and the GL's GLProfile are equal
- // throws an GLException if not
- getGLDrawable().getGLProfile().verifyEquality(gl.getGLProfile());
- }
- setCurrent(this);
+ // This is only needed for Mac OS X on-screen contexts
+ protected void update() throws GLException { }
- /* FIXME: refactor dependence on Java 2D / JOGL bridge
+ public boolean isSynchronized() {
+ return !lock.getFailFastMode();
+ }
- // Try cleaning up any stale server-side OpenGL objects
- // FIXME: not sure what to do here if this throws
- if (deletedObjectTracker != null) {
- deletedObjectTracker.clean(getGL());
- }
- */
- }
- return res;
+ public void setSynchronized(boolean isSynchronized) {
+ lock.setFailFastMode(!isSynchronized);
}
- protected abstract int makeCurrentImpl() throws GLException;
+ public abstract Object getPlatformGLExtensions();
public void release() throws GLException {
if (!lock.isHeld()) {
@@ -240,7 +207,7 @@ public abstract class GLContextImpl extends GLContext {
}
if (glStateTracker != null) {
- glStateTracker.clearStates();
+ glStateTracker.clearStates(false);
}
destroyImpl();
@@ -251,41 +218,391 @@ public abstract class GLContextImpl extends GLContext {
protected abstract void destroyImpl() throws GLException;
- // This is only needed for Mac OS X on-screen contexts
- protected void update() throws GLException {
+ //----------------------------------------------------------------------
+ //
+
+ /**
+ * MakeCurrent functionality, which also issues the creation of the actual OpenGL context.<br>
+ * The complete callgraph for general OpenGL context creation is:<br>
+ * <ul>
+ * <li> {@link #makeCurrent} <i>GLContextImpl</i>
+ * <li> {@link #makeCurrentImpl} <i>Platform Implementation</i>
+ * <li> {@link #create} <i>Platform Implementation</i>
+ * <li> If <code>ARB_create_context</code> is supported:
+ * <ul>
+ * <li> {@link #createContextARB} <i>GLContextImpl</i>
+ * <li> {@link #createContextARBImpl} <i>Platform Implementation</i>
+ * </ul>
+ * </ul><br>
+ *
+ * Once at startup, ie triggered by the singleton {@link GLDrawableImpl} constructor,
+ * calling {@link #createContextARB} will query all available OpenGL versions:<br>
+ * <ul>
+ * <li> <code>FOR ALL GL* DO</code>:
+ * <ul>
+ * <li> {@link #createContextARBMapVersionsAvailable}
+ * <ul>
+ * <li> {@link #createContextARBVersions}
+ * </ul>
+ * <li> {@link #mapVersionAvailable}
+ * </ul>
+ * </ul><br>
+ *
+ * @see #makeCurrentImpl
+ * @see #create
+ * @see #createContextARB
+ * @see #createContextARBImpl
+ * @see #mapVersionAvailable
+ * @see #destroyContextARBImpl
+ */
+ public int makeCurrent() throws GLException {
+ // Support calls to makeCurrent() over and over again with
+ // different contexts without releasing them
+ // Could implement this more efficiently without explicit
+ // releasing of the underlying context; would require more error
+ // checking during the makeCurrentImpl phase
+ GLContext current = getCurrent();
+ if (current != null) {
+ if (current == this) {
+ // Assume we don't need to make this context current again
+ // For Mac OS X, however, we need to update the context to track resizes
+ update();
+ return CONTEXT_CURRENT;
+ } else {
+ current.release();
+ }
+ }
+
+ if (GLWorkerThread.isStarted() &&
+ !GLWorkerThread.isWorkerThread()) {
+ // Kick the GLWorkerThread off its current context
+ GLWorkerThread.invokeLater(new Runnable() { public void run() {} });
+ }
+
+ lock.lock();
+ int res = 0;
+ try {
+ res = makeCurrentImpl();
+
+ /* FIXME: refactor dependence on Java 2D / JOGL bridge
+ if ((tracker != null) &&
+ (res == CONTEXT_CURRENT_NEW)) {
+ // Increase reference count of GLObjectTracker
+ tracker.ref();
+ }
+ */
+ } catch (GLException e) {
+ lock.unlock();
+ throw(e);
+ }
+ if (res == CONTEXT_NOT_CURRENT) {
+ lock.unlock();
+ } else {
+ if(res == CONTEXT_CURRENT_NEW) {
+ // check if the drawable's and the GL's GLProfile are equal
+ // throws an GLException if not
+ getGLDrawable().getGLProfile().verifyEquality(gl.getGLProfile());
+ }
+ setCurrent(this);
+
+ /* FIXME: refactor dependence on Java 2D / JOGL bridge
+
+ // Try cleaning up any stale server-side OpenGL objects
+ // FIXME: not sure what to do here if this throws
+ if (deletedObjectTracker != null) {
+ deletedObjectTracker.clean(getGL());
+ }
+ */
+ }
+ return res;
}
- public boolean isSynchronized() {
- return !lock.getFailFastMode();
+ /**
+ * @see #makeCurrent
+ */
+ protected abstract int makeCurrentImpl() throws GLException;
+
+ /**
+ * @see #makeCurrent
+ */
+ protected abstract void create() throws GLException ;
+
+ /**
+ * Platform dependent but harmonized implementation of the <code>ARB_create_context</code>
+ * mechanism to create a context.<br>
+ *
+ * This method is called from {@link #createContextARB}.<br>
+ *
+ * The implementation shall verify this context with a
+ * <code>MakeContextCurrent</code> call.<br>
+ *
+ * @param share the shared context or null
+ * @param direct flag if direct is requested
+ * @param ctxOptionFlags <code>ARB_create_context</code> related, see references below
+ * @param major major number
+ * @param minor minor number
+ * @return the valid context if successfull, or null
+ *
+ * @see #makeCurrent
+ * @see #CTX_PROFILE_COMPAT
+ * @see #CTX_OPTION_FORWARD
+ * @see #CTX_OPTION_DEBUG
+ * @see #makeCurrentImpl
+ * @see #create
+ * @see #createContextARB
+ * @see #createContextARBImpl
+ * @see #destroyContextARBImpl
+ */
+ protected abstract long createContextARBImpl(long share, boolean direct, int ctxOptionFlags,
+ int major, int minor);
+
+ /**
+ * Destroy the context created by {@link #createContextARBImpl}.
+ *
+ * @see #makeCurrent
+ * @see #makeCurrentImpl
+ * @see #create
+ * @see #createContextARB
+ * @see #createContextARBImpl
+ * @see #destroyContextARBImpl
+ */
+ protected abstract void destroyContextARBImpl(long context);
+
+ /**
+ * Platform independent part of using the <code>ARB_create_context</code>
+ * mechanism to create a context.<br>
+ *
+ * The implementation of {@link #create} shall use this protocol in case the platform supports <code>ARB_create_context</code>.<br>
+ *
+ * This method may call {@link #createContextARBImpl} and {@link #destroyContextARBImpl}. <br>
+ *
+ * This method will also query all available native OpenGL context when first called,<br>
+ * usually the first call should happen with the shared GLContext of the DrawableFactory.<br>
+ *
+ * @see #makeCurrentImpl
+ * @see #create
+ * @see #createContextARB
+ * @see #createContextARBImpl
+ * @see #destroyContextARBImpl
+ */
+ protected long createContextARB(long share, boolean direct,
+ int major[], int minor[], int ctp[])
+ {
+ AbstractGraphicsConfiguration config = drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ GLCapabilities glCaps = (GLCapabilities) config.getChosenCapabilities();
+ GLProfile glp = glCaps.getGLProfile();
+ long _context = 0;
+
+ if( !mappedVersionsAvailableSet ) {
+ synchronized(mappedVersionsAvailableLock) {
+ if( !mappedVersionsAvailableSet ) {
+ createContextARBMapVersionsAvailable(4, false /* compat */); // GL4
+ createContextARBMapVersionsAvailable(4, true /* compat */); // GL4bc
+ createContextARBMapVersionsAvailable(3, false /* compat */); // GL3
+ createContextARBMapVersionsAvailable(3, true /* compat */); // GL3bc
+ createContextARBMapVersionsAvailable(2, true /* compat */); // GL2
+ mappedVersionsAvailableSet=true;
+ }
+ }
+ }
+
+ int reqMajor;
+ if(glp.isGL4()) {
+ reqMajor=4;
+ } else if (glp.isGL3()) {
+ reqMajor=3;
+ } else /* if (glp.isGL2()) */ {
+ reqMajor=2;
+ }
+ boolean compat = glp.isGL2(); // incl GL3bc and GL4bc
+
+ int key = compose8bit(reqMajor, compat?CTX_PROFILE_COMPAT:CTX_PROFILE_CORE, 0, 0);
+ int val = mappedVersionsAvailable.get( key );
+ long _ctx = 0;
+ if(val>0) {
+ int _major = getComposed8bit(val, 1);
+ int _minor = getComposed8bit(val, 2);
+ int _ctp = getComposed8bit(val, 3);
+
+ _ctx = createContextARBImpl(share, direct, _ctp, _major, _minor);
+ if(0!=_ctx) {
+ setGLFunctionAvailability(true, _major, _minor, _ctp);
+ }
+ }
+ return _ctx;
}
- public void setSynchronized(boolean isSynchronized) {
- lock.setFailFastMode(!isSynchronized);
+ private void createContextARBMapVersionsAvailable(int reqMajor, boolean compat)
+ {
+ long _context;
+ int ctp = CTX_IS_ARB_CREATED | CTX_PROFILE_CORE | CTX_OPTION_ANY; // default
+ if(compat) {
+ ctp &= ~CTX_PROFILE_CORE ;
+ ctp |= CTX_PROFILE_COMPAT ;
+ }
+
+ // FIXME GL3GL4:
+ // To avoid OpenGL implementation bugs and raise compatibility
+ // within JOGL, we map to the proper GL version.
+ // This may change later when GL3 and GL4 drivers become more mature!
+ // Bug: To ensure GL profile compatibility within the JOGL application
+ // Bug: we always try to map against the highest GL version,
+ // Bug: so the use can always cast to a higher one
+ // Bug: int majorMax=GLContext.getMaxMajor();
+ // Bug: int minorMax=GLContext.getMaxMinor(majorMax);
+ int majorMax, minorMax;
+ int majorMin, minorMin;
+ int major[] = new int[1];
+ int minor[] = new int[1];
+ if( 4 == reqMajor ) {
+ majorMax=4; minorMax=GLContext.getMaxMinor(majorMax);
+ majorMin=4; minorMin=0;
+ } else if( 3 == reqMajor ) {
+ majorMax=3; minorMax=GLContext.getMaxMinor(majorMax);
+ majorMin=3; minorMin=1;
+ } else /* if( glp.isGL2() ) */ {
+ majorMax=3; minorMax=0;
+ majorMin=1; minorMin=1; // our minimum desktop OpenGL runtime requirements
+ }
+ _context = createContextARBVersions(0, true, ctp,
+ /* max */ majorMax, minorMax,
+ /* min */ majorMin, minorMin,
+ /* res */ major, minor);
+
+ if(0==_context && !compat) {
+ ctp &= ~CTX_PROFILE_COMPAT ;
+ ctp |= CTX_PROFILE_CORE ;
+ ctp &= ~CTX_OPTION_ANY ;
+ ctp |= CTX_OPTION_FORWARD ;
+ _context = createContextARBVersions(0, true, ctp,
+ /* max */ majorMax, minorMax,
+ /* min */ majorMin, minorMin,
+ /* res */ major, minor);
+ if(0==_context) {
+ // Try a compatible one .. even though not requested .. last resort
+ ctp &= ~CTX_PROFILE_CORE ;
+ ctp |= CTX_PROFILE_COMPAT ;
+ ctp &= ~CTX_OPTION_FORWARD ;
+ ctp |= CTX_OPTION_ANY ;
+ _context = createContextARBVersions(0, true, ctp,
+ /* max */ majorMax, minorMax,
+ /* min */ majorMin, minorMin,
+ /* res */ major, minor);
+ }
+ }
+ if(0!=_context) {
+ destroyContextARBImpl(_context);
+ mapVersionAvailable(reqMajor, compat, major[0], minor[0], ctp);
+ }
}
- public final GL getGL() {
- return gl;
+ private long createContextARBVersions(long share, boolean direct, int ctxOptionFlags,
+ int majorMax, int minorMax,
+ int majorMin, int minorMin,
+ int major[], int minor[]) {
+ major[0]=majorMax;
+ minor[0]=minorMax;
+ long _context=0;
+
+ while ( 0==_context &&
+ GLContext.isValidGLVersion(major[0], minor[0]) &&
+ ( major[0]>majorMin || major[0]==majorMin && minor[0] >=minorMin ) ) {
+
+ _context = createContextARBImpl(share, direct, ctxOptionFlags, major[0], minor[0]);
+
+ if(0==_context) {
+ if(!GLContext.decrementGLVersion(major, minor)) break;
+ }
+ }
+ return _context;
}
- public GL setGL(GL gl) {
- if(DEBUG) {
- String sgl1 = (null!=this.gl)?this.gl.getClass().toString()+", "+this.gl.toString():new String("<null>");
- String sgl2 = (null!=gl)?gl.getClass().toString()+", "+gl.toString():new String("<null>");
- Exception e = new Exception("setGL: "+Thread.currentThread()+", "+sgl1+" -> "+sgl2);
- e.printStackTrace();
+ //----------------------------------------------------------------------
+ // Managing the actual OpenGL version, usually figured at creation time.
+ // As a last resort, the GL_VERSION string may be used ..
+ //
+
+ /**
+ * If major > 0 || minor > 0 : Use passed values, determined at creation time
+ * If major==0 && minor == 0 : Use GL_VERSION
+ * Otherwise .. don't touch ..
+ */
+ protected void setContextVersion(int major, int minor, int ctp) {
+ if (0==ctp) {
+ GLException e = new GLException("Invalid GL Version "+major+"."+minor+", ctp "+toHexString(ctp));
+ throw e;
+ }
+ if(major>0 || minor>0) {
+ if (!GLContext.isValidGLVersion(major, minor)) {
+ GLException e = new GLException("Invalid GL Version "+major+"."+minor+", ctp "+toHexString(ctp));
+ throw e;
+ }
+ ctxMajorVersion = major;
+ ctxMinorVersion = minor;
+ ctxOptions = ctp;
+ ctxVersionString = getGLVersion(gl, ctxMajorVersion, ctxMinorVersion, ctxOptions, getGL().glGetString(GL.GL_VERSION));
+ return;
+ }
+
+ if(major==0 && minor==0) {
+ String versionStr = getGL().glGetString(GL.GL_VERSION);
+ if(null==versionStr) {
+ throw new GLException("GL_VERSION is NULL: "+this);
+ }
+ ctxOptions = ctp;
+
+ // Set version
+ Version version = new Version(versionStr);
+ if (version.isValid()) {
+ ctxMajorVersion = version.getMajor();
+ ctxMinorVersion = version.getMinor();
+
+ ctxVersionString = getGLVersion(gl, ctxMajorVersion, ctxMinorVersion, ctxOptions, versionStr);
+ return;
+ }
+ }
+ }
+
+ private static boolean appendString(StringBuffer sb, String string, boolean needColon, boolean condition) {
+ if(condition) {
+ if(needColon) {
+ sb.append(", ");
+ }
+ sb.append(string);
+ needColon=true;
}
- this.gl = gl;
- return gl;
+ return needColon;
}
- public abstract Object getPlatformGLExtensions();
+ protected static String getGLVersion(GL gl, int major, int minor, int ctp, String gl_version) {
+ boolean needColon = false;
+ StringBuffer sb = new StringBuffer();
+ sb.append(major);
+ sb.append(".");
+ sb.append(minor);
+ sb.append(" (");
+ needColon = appendString(sb, "ES", needColon, null!=gl && gl.isGLES());
+ needColon = appendString(sb, "compatibility profile", needColon, 0 != ( CTX_PROFILE_COMPAT & ctp ));
+ needColon = appendString(sb, "core profile", needColon, 0 != ( CTX_PROFILE_CORE & ctp ));
+ needColon = appendString(sb, "forward compatible", needColon, 0 != ( CTX_OPTION_FORWARD & ctp ));
+ needColon = appendString(sb, "any", needColon, 0 != ( CTX_OPTION_ANY & ctp ));
+ needColon = appendString(sb, "new", needColon, 0 != ( CTX_IS_ARB_CREATED & ctp ));
+ needColon = appendString(sb, "old", needColon, 0 == ( CTX_IS_ARB_CREATED & ctp ));
+ sb.append(") - ");
+ if(null!=gl_version) {
+ sb.append(gl_version);
+ } else {
+ sb.append("n/a");
+ }
+ return sb.toString();
+ }
//----------------------------------------------------------------------
// Helpers for various context implementations
//
private Object createInstance(GLProfile glp, String suffix, Class[] cstrArgTypes, Object[] cstrArgs) {
- return NWReflection.createInstance(glp.getGLImplBaseClassName()+suffix, cstrArgTypes, cstrArgs);
+ return ReflectionUtil.createInstance(glp.getGLImplBaseClassName()+suffix, cstrArgTypes, cstrArgs);
}
/** Create the GL for this context. */
@@ -346,13 +663,30 @@ public abstract class GLContextImpl extends GLContext {
/** Maps the given "platform-independent" function name to a real function
name. Currently this is only used to map "glAllocateMemoryNV" and
associated routines to wglAllocateMemoryNV / glXAllocateMemoryNV. */
- protected abstract String mapToRealGLFunctionName(String glFunctionName);
+ protected String mapToRealGLFunctionName(String glFunctionName) {
+ Map/*<String, String>*/ map = getFunctionNameMap();
+ String lookup = ( null != map ) ? (String) map.get(glFunctionName) : null;
+ if (lookup != null) {
+ return lookup;
+ }
+ return glFunctionName;
+ }
+ protected abstract Map/*<String, String>*/ getFunctionNameMap() ;
/** Maps the given "platform-independent" extension name to a real
function name. Currently this is only used to map
- "GL_ARB_pbuffer" and "GL_ARB_pixel_format" to "WGL_ARB_pbuffer"
- and "WGL_ARB_pixel_format" (not yet mapped to X11). */
- protected abstract String mapToRealGLExtensionName(String glExtensionName);
+ "GL_ARB_pbuffer" to "WGL_ARB_pbuffer/GLX_SGIX_pbuffer" and
+ "GL_ARB_pixel_format" to "WGL_ARB_pixel_format/n.a."
+ */
+ protected String mapToRealGLExtensionName(String glExtensionName) {
+ Map/*<String, String>*/ map = getExtensionNameMap();
+ String lookup = ( null != map ) ? (String) map.get(glExtensionName) : null;
+ if (lookup != null) {
+ return lookup;
+ }
+ return glExtensionName;
+ }
+ protected abstract Map/*<String, String>*/ getExtensionNameMap() ;
/** Helper routine which resets a ProcAddressTable generated by the
GLEmitter by looking up anew all of its function pointers. */
@@ -373,8 +707,10 @@ public abstract class GLContextImpl extends GLContext {
*
* @param force force the setting, even if is already being set.
* This might be usefull if you change the OpenGL implementation.
+ *
+ * @see #setContextVersion
*/
- protected void setGLFunctionAvailability(boolean force) {
+ protected void setGLFunctionAvailability(boolean force, int major, int minor, int ctp) {
if(null!=this.gl && null!=glProcAddressTable && !force) {
return; // already done and not forced
}
@@ -382,15 +718,17 @@ public abstract class GLContextImpl extends GLContext {
setGL(createGL(getGLDrawable().getGLProfile()));
}
- updateGLProcAddressTable();
+ updateGLProcAddressTable(major, minor, ctp);
}
/**
* Updates the cache of which GL functions are available for calling through this
* context. See {@link #isFunctionAvailable(String)} for more information on
* the definition of "available".
+ *
+ * @see #setContextVersion
*/
- protected void updateGLProcAddressTable() {
+ protected void updateGLProcAddressTable(int major, int minor, int ctp) {
if(null==this.gl) {
throw new GLException("setGLFunctionAvailability not called yet");
}
@@ -404,6 +742,8 @@ public abstract class GLContextImpl extends GLContext {
}
resetProcAddressTable(getGLProcAddressTable());
+ setContextVersion(major, minor, ctp);
+
extensionAvailability.reset();
}
@@ -475,14 +815,6 @@ public abstract class GLContextImpl extends GLContext {
return extensionAvailability.getGLExtensions();
}
- public int getMajorVersion() {
- return extensionAvailability.getMajorVersion();
- }
-
- public int getMinorVersion() {
- return extensionAvailability.getMinorVersion();
- }
-
public boolean isExtensionCacheInitialized() {
return extensionAvailability.isInitialized();
}
@@ -507,10 +839,6 @@ public abstract class GLContextImpl extends GLContext {
return Thread.currentThread().getName();
}
- public static String toHexString(long hex) {
- return "0x" + Long.toHexString(hex);
- }
-
//----------------------------------------------------------------------
// Helpers for buffer object optimizations
@@ -599,4 +927,131 @@ public abstract class GLContextImpl extends GLContext {
*/
+ /**
+ * A class for storing and comparing OpenGL version numbers.
+ * This only works for desktop OpenGL at the moment.
+ */
+ private static class Version implements Comparable
+ {
+ private boolean valid;
+ private int major, minor, sub;
+ public Version(int majorRev, int minorRev, int subMinorRev)
+ {
+ major = majorRev;
+ minor = minorRev;
+ sub = subMinorRev;
+ }
+
+ /**
+ * @param versionString must be of the form "GL_VERSION_X" or
+ * "GL_VERSION_X_Y" or "GL_VERSION_X_Y_Z" or "X.Y", where X, Y,
+ * and Z are integers.
+ *
+ * @exception IllegalArgumentException if the argument is not a valid
+ * OpenGL version identifier
+ */
+ public Version(String versionString)
+ {
+ try
+ {
+ if (versionString.startsWith("GL_VERSION_"))
+ {
+ StringTokenizer tok = new StringTokenizer(versionString, "_");
+
+ tok.nextToken(); // GL_
+ tok.nextToken(); // VERSION_
+ if (!tok.hasMoreTokens()) { major = 0; return; }
+ major = Integer.valueOf(tok.nextToken()).intValue();
+ if (!tok.hasMoreTokens()) { minor = 0; return; }
+ minor = Integer.valueOf(tok.nextToken()).intValue();
+ if (!tok.hasMoreTokens()) { sub = 0; return; }
+ sub = Integer.valueOf(tok.nextToken()).intValue();
+ }
+ else
+ {
+ int radix = 10;
+ if (versionString.length() > 2) {
+ if (Character.isDigit(versionString.charAt(0)) &&
+ versionString.charAt(1) == '.' &&
+ Character.isDigit(versionString.charAt(2))) {
+ major = Character.digit(versionString.charAt(0), radix);
+ minor = Character.digit(versionString.charAt(2), radix);
+
+ // See if there's version-specific information which might
+ // imply a more recent OpenGL version
+ StringTokenizer tok = new StringTokenizer(versionString, " ");
+ if (tok.hasMoreTokens()) {
+ tok.nextToken();
+ if (tok.hasMoreTokens()) {
+ String token = tok.nextToken();
+ int i = 0;
+ while (i < token.length() && !Character.isDigit(token.charAt(i))) {
+ i++;
+ }
+ if (i < token.length() - 2 &&
+ Character.isDigit(token.charAt(i)) &&
+ token.charAt(i+1) == '.' &&
+ Character.isDigit(token.charAt(i+2))) {
+ int altMajor = Character.digit(token.charAt(i), radix);
+ int altMinor = Character.digit(token.charAt(i+2), radix);
+ // Avoid possibly confusing situations by putting some
+ // constraints on the upgrades we do to the major and
+ // minor versions
+ if ((altMajor == major && altMinor > minor) ||
+ altMajor == major + 1) {
+ major = altMajor;
+ minor = altMinor;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ valid = true;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ // FIXME: refactor desktop OpenGL dependencies and make this
+ // class work properly for OpenGL ES
+ System.err.println("ExtensionAvailabilityCache: FunctionAvailabilityCache.Version.<init>: "+e);
+ major = 1;
+ minor = 0;
+ /*
+ throw (IllegalArgumentException)
+ new IllegalArgumentException(
+ "Illegally formatted version identifier: \"" + versionString + "\"")
+ .initCause(e);
+ */
+ }
+ }
+
+ public boolean isValid() {
+ return valid;
+ }
+
+ public int compareTo(Object o)
+ {
+ Version vo = (Version)o;
+ if (major > vo.major) return 1;
+ else if (major < vo.major) return -1;
+ else if (minor > vo.minor) return 1;
+ else if (minor < vo.minor) return -1;
+ else if (sub > vo.sub) return 1;
+ else if (sub < vo.sub) return -1;
+
+ return 0; // they are equal
+ }
+
+ public int getMajor() {
+ return major;
+ }
+
+ public int getMinor() {
+ return minor;
+ }
+
+ } // end class Version
+
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLContextLock.java b/src/jogl/classes/com/jogamp/opengl/impl/GLContextLock.java
index 753ef14f8..56a5b023f 100644
--- a/src/jogl/classes/com/sun/opengl/impl/GLContextLock.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLContextLock.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
import javax.media.opengl.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLContextShareSet.java b/src/jogl/classes/com/jogamp/opengl/impl/GLContextShareSet.java
index 5f8fc1c84..abeb231f4 100644
--- a/src/jogl/classes/com/sun/opengl/impl/GLContextShareSet.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLContextShareSet.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
// FIXME: refactor Java SE dependencies
// import java.awt.GraphicsConfiguration;
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java
index ceef07727..cdf5beb24 100644
--- a/src/jogl/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java
@@ -37,13 +37,13 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
import java.nio.*;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.gluegen.runtime.*;
-import com.sun.nativewindow.impl.NWReflection;
+import com.jogamp.common.util.*;
+import com.jogamp.gluegen.runtime.*;
import java.lang.reflect.*;
/** Extends GLDrawableFactory with a few methods for handling
@@ -54,10 +54,24 @@ import java.lang.reflect.*;
public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
protected static final boolean DEBUG = Debug.debug("GLDrawableFactory");
+ private boolean isValid = false;
+
+ public void shutdown() {
+ validate();
+ isValid = false;
+ }
+
+ protected final void validate() {
+ if(!isValid) {
+ throw new GLException("GLDrawableFactory is already shutdown!");
+ }
+ }
+
//---------------------------------------------------------------------------
// Dispatching GLDrawable construction in respect to the NativeWindow Capabilities
//
public GLDrawable createGLDrawable(NativeWindow target) {
+ validate();
if (target == null) {
throw new IllegalArgumentException("Null target");
}
@@ -65,9 +79,6 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
GLCapabilities caps = (GLCapabilities) target.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
GLDrawable result = null;
if(caps.isOnscreen()) {
- if(caps.isPBuffer()) {
- throw new IllegalArgumentException("Onscreen target can't be PBuffer: "+caps);
- }
if(DEBUG) {
System.out.println("GLDrawableFactoryImpl.createGLDrawable -> OnscreenDrawable: "+target);
}
@@ -76,7 +87,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
if( ! ( target instanceof SurfaceChangeable ) ) {
throw new IllegalArgumentException("Passed NativeWindow must implement SurfaceChangeable for offscreen: "+target);
}
- if(caps.isPBuffer() && canCreateGLPbuffer()) {
+ if(caps.isPBuffer()) {
if(DEBUG) {
System.out.println("GLDrawableFactoryImpl.createGLDrawable -> PbufferDrawable: "+target);
}
@@ -111,7 +122,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
protected abstract GLDrawableImpl createGLPbufferDrawableImpl(NativeWindow target);
protected GLDrawableImpl createGLPbufferDrawable(NativeWindow target) {
- if (!canCreateGLPbuffer()) {
+ if (!canCreateGLPbuffer(target.getGraphicsConfiguration().getNativeGraphicsConfiguration().getScreen().getDevice())) {
throw new GLException("Pbuffer support not available with current graphics card");
}
return createGLPbufferDrawableImpl(target);
@@ -121,11 +132,12 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
GLCapabilitiesChooser chooser,
int width,
int height) {
+ validate();
if(height<=0 || height<=0) {
throw new GLException("Width and height of pbuffer must be positive (were (" +
width + ", " + height + "))");
}
- capabilities.setDoubleBuffered(false); // FIXME
+ capabilities.setDoubleBuffered(false); // FIXME DBLBUFOFFSCRN
capabilities.setOnscreen(false);
capabilities.setPBuffer(true);
return createGLPbufferDrawable( createOffscreenWindow(capabilities, chooser, height, height) );
@@ -136,6 +148,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
int width,
int height,
GLContext shareWith) {
+ validate();
return new GLPbufferImpl( (GLDrawableImpl) createGLPbufferDrawable(capabilities, chooser, height, height),
shareWith);
}
@@ -152,11 +165,12 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
GLCapabilitiesChooser chooser,
int width,
int height) {
+ validate();
if(width<=0 || height<=0) {
throw new GLException("Width and height of pbuffer must be positive (were (" +
width + ", " + height + "))");
}
- capabilities.setDoubleBuffered(false); // FIXME
+ capabilities.setDoubleBuffered(false); // FIXME DBLBUFOFFSCRN
capabilities.setOnscreen(false);
capabilities.setPBuffer(false);
return createOffscreenDrawable( createOffscreenWindow(capabilities, chooser, width, height) );
@@ -169,8 +183,12 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
protected abstract NativeWindow createOffscreenWindow(GLCapabilities capabilities, GLCapabilitiesChooser chooser,
int width, int height);
+ protected abstract GLDrawableImpl getSharedDrawable();
+ protected abstract GLContextImpl getSharedContext();
+
protected GLDrawableFactoryImpl() {
super();
+ isValid = true;
}
protected void maybeDoSingleThreadedWorkaround(Runnable action) {
@@ -215,7 +233,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
// implement this functionality on all other platforms
//
- public abstract boolean canCreateContextOnJava2DSurface();
+ public abstract boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device);
public abstract GLContext createContextOnJava2DSurface(Object graphics, GLContext shareWith)
throws GLException;
@@ -276,6 +294,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
* out-of-bounds
*/
public boolean setDisplayGamma(float gamma, float brightness, float contrast) throws IllegalArgumentException {
+ validate();
if ((brightness < -1.0f) || (brightness > 1.0f)) {
throw new IllegalArgumentException("Brightness must be between -1.0 and 1.0");
}
@@ -308,11 +327,12 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
}
public synchronized void resetDisplayGamma() {
+ validate();
if (gammaShutdownHook == null) {
throw new IllegalArgumentException("Should not call this unless setDisplayGamma called first");
}
resetGammaRamp(originalGammaRamp);
- unregisterGammeShutdownHook();
+ unregisterGammaShutdownHook();
}
//------------------------------------------------------
@@ -364,7 +384,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
gammaShutdownHookRegistered = true;
}
- private synchronized void unregisterGammeShutdownHook() {
+ private synchronized void unregisterGammaShutdownHook() {
if (!gammaShutdownHookRegistered)
return;
if (gammaShutdownHook == null) {
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLDrawableHelper.java b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java
index d6ca2cbf5..7a4e84081 100644
--- a/src/jogl/classes/com/sun/opengl/impl/GLDrawableHelper.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableHelper.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
import java.util.*;
import javax.media.opengl.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java
index befee170f..2fef8fd80 100644
--- a/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableImpl.java
@@ -37,11 +37,11 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
+import com.jogamp.common.os.DynamicLookupHelper;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.gluegen.runtime.DynamicLookupHelper;
public abstract class GLDrawableImpl implements GLDrawable {
protected static final boolean DEBUG = Debug.debug("GLDrawable");
@@ -88,7 +88,7 @@ public abstract class GLDrawableImpl implements GLDrawable {
protected abstract void swapBuffersImpl();
public static String toHexString(long hex) {
- return GLContextImpl.toHexString(hex);
+ return "0x" + Long.toHexString(hex);
}
public GLProfile getGLProfile() {
@@ -153,11 +153,9 @@ public abstract class GLDrawableImpl implements GLDrawable {
}
public String toString() {
- return getClass().getName()+"[realized "+getRealized()+
- ",\n\tfactory "+getFactory()+
- ",\n\twindow "+getNativeWindow()+
- ",\n\trequested "+getRequestedGLCapabilities()+
- ",\n\tchosen "+getChosenGLCapabilities()+"]";
+ return getClass().getName()+"[Realized "+getRealized()+
+ ",\n\tFactory "+getFactory()+
+ ",\n\tWindow "+getNativeWindow()+"]";
}
protected GLDrawableFactory factory;
diff --git a/src/jogl/classes/com/sun/opengl/impl/NativeLibLoader.java b/src/jogl/classes/com/jogamp/opengl/impl/GLJNILibLoader.java
index 59f92e53f..c3958eedf 100644
--- a/src/jogl/classes/com/sun/opengl/impl/NativeLibLoader.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLJNILibLoader.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
// FIXME: refactor Java SE dependencies
//import java.awt.Toolkit;
@@ -46,9 +46,9 @@ import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.HashSet;
-import com.sun.nativewindow.impl.NativeLibLoaderBase;
+import com.jogamp.common.jvm.JNILibLoaderBase;
-public class NativeLibLoader extends NativeLibLoaderBase {
+public class GLJNILibLoader extends JNILibLoaderBase {
public static void loadNEWT() {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
@@ -61,7 +61,7 @@ public class NativeLibLoader extends NativeLibLoaderBase {
public static void loadGLDesktop() {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
- loadLibrary("jogl_gl2", nativeOSPreload, true);
+ loadLibrary("jogl_desktop", nativeOSPreload, true);
return null;
}
});
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLPbufferImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java
index ffaf798ae..dd8d980a6 100644
--- a/src/jogl/classes/com/sun/opengl/impl/GLPbufferImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLPbufferImpl.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
/**
import java.awt.Dimension;
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLStateTracker.java b/src/jogl/classes/com/jogamp/opengl/impl/GLStateTracker.java
index 698d20c47..744e7b924 100755
--- a/src/jogl/classes/com/sun/opengl/impl/GLStateTracker.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLStateTracker.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
import java.util.*;
import javax.media.opengl.*;
@@ -52,7 +52,7 @@ import javax.media.opengl.*;
public class GLStateTracker {
private static final boolean DEBUG = Debug.debug("GLStateTracker");
- private boolean enabled = true;
+ private volatile boolean enabled = true;
private Map/*<Integer,Integer>*/ pixelStateMap = new HashMap/*<Integer,Integer>*/();
@@ -75,7 +75,8 @@ public class GLStateTracker {
resetStates();
}
- public void clearStates() {
+ public void clearStates(boolean enable) {
+ enabled = enable;
pixelStateMap.clear();
}
@@ -91,7 +92,13 @@ public class GLStateTracker {
if(enabled) {
Integer key = boxKey(pname);
if(null!=key) {
- params[params_offset] = ((Integer) pixelStateMap.get(key)).intValue();
+ Integer value = (Integer) pixelStateMap.get(key);
+ if(null!=value) {
+ params[params_offset] = value.intValue();
+ } else {
+ GLException re = new GLException("Key (0x"+Integer.toHexString(key.intValue())+") is not mapped");
+ throw re;
+ }
return true;
}
}
@@ -102,7 +109,13 @@ public class GLStateTracker {
if(enabled) {
Integer key = boxKey(pname);
if(null!=key) {
- params.put(params.position(), ((Integer) pixelStateMap.get(key)).intValue());
+ Integer value = (Integer) pixelStateMap.get(key);
+ if(null!=value) {
+ params.put(params.position(), value.intValue());
+ } else {
+ GLException re = new GLException("Key (0x"+Integer.toHexString(key.intValue())+") is not mapped");
+ throw re;
+ }
return true;
}
}
@@ -138,11 +151,11 @@ public class GLStateTracker {
throw new GLException("null stack element (remaining stack size "+stack.size()+")");
}
- clearStates();
-
+ Map/*<Integer,Integer>*/ pixelStateMapNew = new HashMap/*<Integer,Integer>*/();
if ( null != state.getPixelStateMap() ) {
- pixelStateMap.putAll(state.getPixelStateMap());
+ pixelStateMapNew.putAll(state.getPixelStateMap());
}
+ pixelStateMap = pixelStateMapNew;
}
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLWorkerThread.java b/src/jogl/classes/com/jogamp/opengl/impl/GLWorkerThread.java
index b110e4335..768eea3f7 100755
--- a/src/jogl/classes/com/sun/opengl/impl/GLWorkerThread.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/GLWorkerThread.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
import java.lang.reflect.InvocationTargetException;
import java.security.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javame_cdc_fp b/src/jogl/classes/com/jogamp/opengl/impl/InternalBufferUtil.java.javame_cdc_fp
index 32c3cd70c..4a0eaa22b 100644
--- a/src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javame_cdc_fp
+++ b/src/jogl/classes/com/jogamp/opengl/impl/InternalBufferUtil.java.javame_cdc_fp
@@ -31,13 +31,13 @@
*
*/
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
import java.lang.reflect.*;
import java.nio.*;
/** Internal copy of selected routines from BufferUtil to avoid
- outward dependencies on com.sun.opengl.util package. */
+ outward dependencies on com.jogamp.opengl.util package. */
public class InternalBufferUtil {
public static final int SIZEOF_BYTE = 1;
public static final int SIZEOF_SHORT = 2;
diff --git a/src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javase b/src/jogl/classes/com/jogamp/opengl/impl/InternalBufferUtil.java.javase
index 59d44f04d..655fa95de 100644
--- a/src/jogl/classes/com/sun/opengl/impl/InternalBufferUtil.java.javase
+++ b/src/jogl/classes/com/jogamp/opengl/impl/InternalBufferUtil.java.javase
@@ -31,13 +31,13 @@
*
*/
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
import java.lang.reflect.*;
import java.nio.*;
/** Internal copy of selected routines from BufferUtil to avoid
- outward dependencies on com.sun.opengl.util package. */
+ outward dependencies on com.jogamp.opengl.util package. */
public class InternalBufferUtil {
public static final int SIZEOF_BYTE = 1;
public static final int SIZEOF_SHORT = 2;
diff --git a/src/jogl/classes/com/sun/opengl/impl/ProjectFloat.java b/src/jogl/classes/com/jogamp/opengl/impl/ProjectFloat.java
index cc8ba639f..dbd84c9de 100755
--- a/src/jogl/classes/com/sun/opengl/impl/ProjectFloat.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/ProjectFloat.java
@@ -1,7 +1,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -112,7 +112,7 @@
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
import java.nio.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/SystemUtil.java.javame_cdc_fp b/src/jogl/classes/com/jogamp/opengl/impl/SystemUtil.java.javame_cdc_fp
index 91723b505..f686bea92 100644
--- a/src/jogl/classes/com/sun/opengl/impl/SystemUtil.java.javame_cdc_fp
+++ b/src/jogl/classes/com/jogamp/opengl/impl/SystemUtil.java.javame_cdc_fp
@@ -1,4 +1,4 @@
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
public class SystemUtil {
diff --git a/src/jogl/classes/com/sun/opengl/impl/SystemUtil.java.javase b/src/jogl/classes/com/jogamp/opengl/impl/SystemUtil.java.javase
index 3f201c2b6..dbb717a32 100644
--- a/src/jogl/classes/com/sun/opengl/impl/SystemUtil.java.javase
+++ b/src/jogl/classes/com/jogamp/opengl/impl/SystemUtil.java.javase
@@ -1,4 +1,4 @@
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
public class SystemUtil {
diff --git a/src/jogl/classes/com/sun/opengl/impl/ThreadingImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/ThreadingImpl.java
index 4a4b2d5f9..1a68f38d4 100644
--- a/src/jogl/classes/com/sun/opengl/impl/ThreadingImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/ThreadingImpl.java
@@ -31,14 +31,15 @@
*
*/
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
import java.lang.reflect.InvocationTargetException;
import java.security.AccessController;
import java.security.PrivilegedAction;
+import com.jogamp.common.JogampRuntimeException;
+import com.jogamp.common.util.*;
import javax.media.nativewindow.NativeWindowFactory;
-import com.sun.nativewindow.impl.NWReflection;
import javax.media.opengl.GLException;
/** Implementation of the {@link javax.media.opengl.Threading} class. */
@@ -71,8 +72,8 @@ public class ThreadingImpl {
// while holding the AWT lock. The optimization of
// makeCurrent / release calls isn't worth these stability
// problems.
- hasAWT = NWReflection.isClassAvailable("java.awt.Canvas") &&
- NWReflection.isClassAvailable("javax.media.opengl.awt.GLCanvas");
+ hasAWT = ReflectionUtil.isClassAvailable("java.awt.Canvas") &&
+ ReflectionUtil.isClassAvailable("javax.media.opengl.awt.GLCanvas");
String osType = NativeWindowFactory.getNativeWindowType(false);
_isX11 = NativeWindowFactory.TYPE_X11.equals(osType);
@@ -102,8 +103,8 @@ public class ThreadingImpl {
Object threadingPluginObj=null;
// try to fetch the AWTThreadingPlugin
try {
- threadingPluginObj = NWReflection.createInstance("com.sun.opengl.impl.awt.AWTThreadingPlugin");
- } catch (Throwable t) { }
+ threadingPluginObj = ReflectionUtil.createInstance("com.jogamp.opengl.impl.awt.AWTThreadingPlugin");
+ } catch (JogampRuntimeException jre) { /* n/a .. */ }
return threadingPluginObj;
}
});
diff --git a/src/jogl/classes/com/sun/opengl/impl/ThreadingPlugin.java b/src/jogl/classes/com/jogamp/opengl/impl/ThreadingPlugin.java
index 5c52f871e..37e4aac70 100644
--- a/src/jogl/classes/com/sun/opengl/impl/ThreadingPlugin.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/ThreadingPlugin.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl;
+package com.jogamp.opengl.impl;
import javax.media.opengl.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/awt/AWTThreadingPlugin.java b/src/jogl/classes/com/jogamp/opengl/impl/awt/AWTThreadingPlugin.java
index c7dd9ea80..07bf2f2db 100755
--- a/src/jogl/classes/com/sun/opengl/impl/awt/AWTThreadingPlugin.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/awt/AWTThreadingPlugin.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.awt;
+package com.jogamp.opengl.impl.awt;
import javax.media.opengl.*;
@@ -46,7 +46,7 @@ import java.awt.event.*;
import java.awt.EventQueue;
import java.lang.reflect.InvocationTargetException;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
public class AWTThreadingPlugin implements ThreadingPlugin {
diff --git a/src/jogl/classes/com/sun/opengl/impl/awt/AWTUtil.java b/src/jogl/classes/com/jogamp/opengl/impl/awt/AWTUtil.java
index f4c8944df..e5570a8ee 100644
--- a/src/jogl/classes/com/sun/opengl/impl/awt/AWTUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/awt/AWTUtil.java
@@ -34,11 +34,11 @@
* facility.
*/
-package com.sun.opengl.impl.awt;
+package com.jogamp.opengl.impl.awt;
-import com.sun.nativewindow.impl.jawt.*;
+import com.jogamp.nativewindow.impl.jawt.*;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
import javax.media.opengl.*;
@@ -58,7 +58,7 @@ public class AWTUtil {
headlessMode = GraphicsEnvironment.isHeadless();
if(!headlessMode) {
try {
- j2dClazz = Class.forName("com.sun.opengl.impl.awt.Java2D");
+ j2dClazz = Class.forName("com.jogamp.opengl.impl.awt.Java2D");
isOGLPipelineActive = j2dClazz.getMethod("isOGLPipelineActive", null);
isQueueFlusherThread = j2dClazz.getMethod("isQueueFlusherThread", null);
j2dOk = true;
diff --git a/src/jogl/classes/com/sun/opengl/impl/awt/Java2D.java b/src/jogl/classes/com/jogamp/opengl/impl/awt/Java2D.java
index 098ec8529..b871c66a7 100755
--- a/src/jogl/classes/com/sun/opengl/impl/awt/Java2D.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/awt/Java2D.java
@@ -37,9 +37,9 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.awt;
+package com.jogamp.opengl.impl.awt;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
import java.awt.*;
import java.awt.image.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/awt/Java2DGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/awt/Java2DGLContext.java
index 48461c116..07bc54b6a 100644
--- a/src/jogl/classes/com/sun/opengl/impl/awt/Java2DGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/awt/Java2DGLContext.java
@@ -37,9 +37,9 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.awt;
+package com.jogamp.opengl.impl.awt;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
import java.awt.Graphics;
/** Provides a construct by which the shared GLJPanel code can
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java
index 756f6afd4..48f80977c 100755
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLContext.java
@@ -33,12 +33,12 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.egl;
+package com.jogamp.opengl.impl.egl;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.gluegen.runtime.ProcAddressTable;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.gluegen.runtime.ProcAddressTable;
import java.nio.*;
import java.util.*;
@@ -80,13 +80,9 @@ public abstract class EGLContext extends GLContextImpl {
return eglExtProcAddressTable;
}
- protected String mapToRealGLFunctionName(String glFunctionName) {
- return glFunctionName;
- }
+ protected Map/*<String, String>*/ getFunctionNameMap() { return null; }
- protected String mapToRealGLExtensionName(String glExtensionName) {
- return glExtensionName;
- }
+ protected Map/*<String, String>*/ getExtensionNameMap() { return null; }
public long getContext() {
return eglContext;
@@ -94,17 +90,16 @@ public abstract class EGLContext extends GLContextImpl {
protected int makeCurrentImpl() throws GLException {
if(EGL.EGL_NO_DISPLAY==((EGLDrawable)drawable).getDisplay() ) {
- System.err.println("drawable not properly initialized");
- return CONTEXT_NOT_CURRENT;
+ throw new GLException("drawable not properly initialized: "+drawable);
}
boolean created = false;
if (eglContext == 0) {
create();
+ created = true;
if (DEBUG) {
System.err.println(getThreadName() + ": !!! Created GL context 0x" +
Long.toHexString(eglContext) + " for " + getClass().getName());
}
- created = true;
}
if (EGL.eglGetCurrentContext() != eglContext) {
if (!EGL.eglMakeCurrent(((EGLDrawable)drawable).getDisplay(),
@@ -117,7 +112,7 @@ public abstract class EGLContext extends GLContextImpl {
}
if (created) {
- setGLFunctionAvailability(false);
+ setGLFunctionAvailability(false, -1, -1, CTX_PROFILE_ES|CTX_PROFILE_CORE|CTX_OPTION_ANY);
return CONTEXT_CURRENT_NEW;
}
return CONTEXT_CURRENT;
@@ -154,17 +149,25 @@ public abstract class EGLContext extends GLContextImpl {
}
}
+ protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) {
+ return 0; // FIXME
+ }
+
+ protected void destroyContextARBImpl(long _context) {
+ // FIXME
+ }
+
protected void create() throws GLException {
long eglDisplay = ((EGLDrawable)drawable).getDisplay();
EGLGraphicsConfiguration config = ((EGLDrawable)drawable).getGraphicsConfiguration();
GLProfile glProfile = drawable.getGLProfile();
- _EGLConfig eglConfig = config.getNativeConfig();
+ long eglConfig = config.getNativeConfig();
long shareWith = EGL.EGL_NO_CONTEXT;
if (eglDisplay == 0) {
throw new GLException("Error: attempted to create an OpenGL context without a display connection");
}
- if (eglConfig == null) {
+ if (eglConfig == 0) {
throw new GLException("Error: attempted to create an OpenGL context without a graphics configuration");
}
@@ -219,14 +222,14 @@ public abstract class EGLContext extends GLContextImpl {
throw new GLException("Error making context 0x" +
Long.toHexString(eglContext) + " current: error code " + EGL.eglGetError());
}
- setGLFunctionAvailability(true);
+ setGLFunctionAvailability(true, glProfile.usesNativeGLES2()?2:1, 0, CTX_PROFILE_ES|CTX_PROFILE_CORE|CTX_OPTION_ANY);
}
public boolean isCreated() {
return (eglContext != 0);
}
- protected void updateGLProcAddressTable() {
+ protected void updateGLProcAddressTable(int major, int minor, int ctp) {
if (DEBUG) {
System.err.println(getThreadName() + ": !!! Initializing EGL extension address table");
}
@@ -239,7 +242,7 @@ public abstract class EGLContext extends GLContextImpl {
eglExtProcAddressTable = new EGLExtProcAddressTable();
}
resetProcAddressTable(getEGLExtProcAddressTable());
- super.updateGLProcAddressTable();
+ super.updateGLProcAddressTable(major, minor, ctp);
}
public synchronized String getPlatformExtensionsString() {
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java
index dd801e4e2..dcfe06bdc 100755
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java
@@ -33,11 +33,10 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.egl;
+package com.jogamp.opengl.impl.egl;
-import com.sun.opengl.impl.GLDrawableImpl;
-import com.sun.nativewindow.impl.NWReflection;
-import com.sun.gluegen.runtime.DynamicLookupHelper;
+import com.jogamp.common.os.DynamicLookupHelper;
+import com.jogamp.opengl.impl.GLDrawableImpl;
import javax.media.nativewindow.*;
import javax.media.nativewindow.egl.*;
@@ -75,7 +74,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
public abstract GLContext createContext(GLContext shareWith);
- protected abstract long createSurface(long eglDpy, _EGLConfig eglNativeCfg, long surfaceHandle);
+ protected abstract long createSurface(long eglDpy, long eglNativeCfg, long surfaceHandle);
private void recreateSurface() {
// create a new EGLSurface ..
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java
index e9a622cc5..4fccf22f8 100755
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java
@@ -33,14 +33,14 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.egl;
+package com.jogamp.opengl.impl.egl;
-import java.util.*;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.*;
-import com.sun.gluegen.runtime.NativeLibrary;
+import com.jogamp.common.JogampRuntimeException;
+import com.jogamp.common.util.*;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.nativewindow.impl.NullWindow;
public class EGLDrawableFactory extends GLDrawableFactoryImpl {
@@ -52,8 +52,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
// Check for other underlying stuff ..
if(NativeWindowFactory.TYPE_X11.equals(NativeWindowFactory.getNativeWindowType(true))) {
try {
- NWReflection.createInstance("com.sun.opengl.impl.x11.glx.X11GLXGraphicsConfigurationFactory");
- } catch (Throwable t) {}
+ ReflectionUtil.createInstance("com.jogamp.opengl.impl.x11.glx.X11GLXGraphicsConfigurationFactory");
+ } catch (JogampRuntimeException jre) { /* n/a .. */ }
}
}
@@ -61,6 +61,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
super();
}
+
+ protected final GLDrawableImpl getSharedDrawable() { return null; }
+ protected final GLContextImpl getSharedContext() { return null; }
+
public GLDrawableImpl createOnscreenDrawable(NativeWindow target) {
if (target == null) {
throw new IllegalArgumentException("Null target");
@@ -72,7 +76,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
throw new GLException("Not yet implemented");
}
- public boolean canCreateGLPbuffer() {
+ public boolean canCreateGLPbuffer(AbstractGraphicsDevice device) {
return true;
}
@@ -91,7 +95,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
return new EGLExternalContext(absScreen);
}
- public boolean canCreateExternalGLDrawable() {
+ public boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) {
return false;
}
@@ -102,7 +106,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
public void loadGLULibrary() {
}
- public boolean canCreateContextOnJava2DSurface() {
+ public boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) {
return false;
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDynamicLookupHelper.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLookupHelper.java
index 00973de89..9e34dc9e9 100755
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDynamicLookupHelper.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDynamicLookupHelper.java
@@ -33,15 +33,14 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.egl;
+package com.jogamp.opengl.impl.egl;
+import com.jogamp.common.os.DynamicLookupHelper;
+import com.jogamp.common.os.NativeLibrary;
import java.util.*;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.*;
-import com.sun.gluegen.runtime.NativeLibrary;
-import com.sun.gluegen.runtime.DynamicLookupHelper;
+import com.jogamp.opengl.impl.*;
import java.security.*;
/**
@@ -51,7 +50,7 @@ import java.security.*;
* Currently two implementations exist, one for ES1 and one for ES2.
*/
public abstract class EGLDynamicLookupHelper implements DynamicLookupHelper {
- protected static final boolean DEBUG = com.sun.opengl.impl.Debug.debug("EGL");
+ protected static final boolean DEBUG = com.jogamp.opengl.impl.Debug.debug("EGL");
protected static final boolean DEBUG_LOOKUP;
private static final EGLDynamicLookupHelper eglES1DynamicLookupHelper;
@@ -60,14 +59,14 @@ public abstract class EGLDynamicLookupHelper implements DynamicLookupHelper {
static {
AccessControlContext localACC=AccessController.getContext();
- DEBUG_LOOKUP = com.sun.opengl.impl.Debug.isPropertyDefined("jogl.debug.DynamicLookup", true, localACC);
+ DEBUG_LOOKUP = com.jogamp.opengl.impl.Debug.isPropertyDefined("jogl.debug.DynamicLookup", true, localACC);
EGLDynamicLookupHelper tmp=null;
try {
tmp = new EGLES1DynamicLookupHelper();
- } catch (Throwable t) {
+ } catch (GLException gle) {
if(DEBUG) {
- t.printStackTrace();
+ gle.printStackTrace();
}
}
eglES1DynamicLookupHelper = tmp;
@@ -75,9 +74,9 @@ public abstract class EGLDynamicLookupHelper implements DynamicLookupHelper {
tmp=null;
try {
tmp = new EGLES2DynamicLookupHelper();
- } catch (Throwable t) {
+ } catch (GLException gle) {
if(DEBUG) {
- t.printStackTrace();
+ gle.printStackTrace();
}
}
eglES2DynamicLookupHelper = tmp;
@@ -192,9 +191,9 @@ public abstract class EGLDynamicLookupHelper implements DynamicLookupHelper {
}
if (esProfile==2) {
- NativeLibLoader.loadES2();
+ GLJNILibLoader.loadES2();
} else if (esProfile==1) {
- NativeLibLoader.loadES1();
+ GLJNILibLoader.loadES1();
} else {
throw new GLException("Unsupported: ES"+esProfile);
}
@@ -226,7 +225,7 @@ public abstract class EGLDynamicLookupHelper implements DynamicLookupHelper {
// Look up this function name in all known libraries
for (Iterator iter = glesLibraries.iterator(); iter.hasNext(); ) {
NativeLibrary lib = (NativeLibrary) iter.next();
- long addr = lib.lookupFunction(glFuncName);
+ long addr = lib.dynamicLookupFunction(glFuncName);
if (addr != 0) {
return addr;
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLES1DynamicLookupHelper.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLookupHelper.java
index 7e60e25c0..e5740a4f0 100755
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLES1DynamicLookupHelper.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES1DynamicLookupHelper.java
@@ -33,14 +33,9 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.egl;
+package com.jogamp.opengl.impl.egl;
import java.util.*;
-import javax.media.nativewindow.*;
-import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.*;
-import com.sun.gluegen.runtime.NativeLibrary;
/**
* Implementation of the EGLDynamicLookupHelper for ES1.
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLES2DynamicLookupHelper.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES2DynamicLookupHelper.java
index cfd0558c9..c4fc66630 100755
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLES2DynamicLookupHelper.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLES2DynamicLookupHelper.java
@@ -33,14 +33,9 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.egl;
+package com.jogamp.opengl.impl.egl;
import java.util.*;
-import javax.media.nativewindow.*;
-import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.*;
-import com.sun.gluegen.runtime.NativeLibrary;
/**
* Implementation of the EGLDynamicLookupHelper for ES2.
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLExternalContext.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLExternalContext.java
index 86c82396e..5a8454ea7 100755
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLExternalContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLExternalContext.java
@@ -33,10 +33,10 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.egl;
+package com.jogamp.opengl.impl.egl;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
import javax.media.nativewindow.*;
public class EGLExternalContext extends EGLContext {
@@ -47,7 +47,7 @@ public class EGLExternalContext extends EGLContext {
public EGLExternalContext(AbstractGraphicsScreen screen) {
super(null, null);
GLContextShareSet.contextCreated(this);
- setGLFunctionAvailability(false);
+ setGLFunctionAvailability(false, 0, 0, CTX_IS_ARB_CREATED|CTX_PROFILE_ES|CTX_PROFILE_CORE|CTX_OPTION_ANY);
getGLStateTracker().setEnabled(false); // external context usage can't track state in Java
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfiguration.java
index 5ab3c3ed5..2d5154442 100644
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfiguration.java
@@ -33,20 +33,20 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.egl;
+package com.jogamp.opengl.impl.egl;
+import com.jogamp.common.nio.PointerBuffer;
import java.util.*;
import javax.media.nativewindow.*;
import javax.media.nativewindow.egl.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.gluegen.runtime.NativeLibrary;
+import com.jogamp.opengl.impl.*;
public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration implements Cloneable {
protected static final boolean DEBUG = Debug.debug("GraphicsConfiguration");
- public _EGLConfig getNativeConfig() {
- return _config;
+ public long getNativeConfig() {
+ return config;
}
public int getNativeConfigID() {
@@ -55,10 +55,10 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple
public EGLGraphicsConfiguration(AbstractGraphicsScreen absScreen,
GLCapabilities capsChosen, GLCapabilities capsRequested, GLCapabilitiesChooser chooser,
- _EGLConfig cfg, int cfgID) {
+ long cfg, int cfgID) {
super(absScreen, capsChosen, capsRequested);
this.chooser = chooser;
- _config = cfg;
+ config = cfg;
configID = cfgID;
}
@@ -72,9 +72,9 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple
throw new GLException("Invalid EGL display: "+absDevice);
}
GLProfile glp = capsRequested.getGLProfile();
- _EGLConfig _cfg = EGLConfigId2EGLConfig(glp, dpy, cfgID);
- GLCapabilities caps = EGLConfig2Capabilities(glp, dpy, _cfg, false, capsRequested.isOnscreen(), capsRequested.isPBuffer());
- return new EGLGraphicsConfiguration(absScreen, caps, capsRequested, new DefaultGLCapabilitiesChooser(), _cfg, cfgID);
+ long cfg = EGLConfigId2EGLConfig(glp, dpy, cfgID);
+ GLCapabilities caps = EGLConfig2Capabilities(glp, dpy, cfg, false, capsRequested.isOnscreen(), capsRequested.isPBuffer());
+ return new EGLGraphicsConfiguration(absScreen, caps, capsRequested, new DefaultGLCapabilitiesChooser(), cfg, cfgID);
}
public Object clone() {
@@ -89,7 +89,7 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple
if(null!=newConfig) {
// FIXME: setScreen( ... );
setChosenCapabilities(newConfig.getChosenCapabilities());
- _config = newConfig.getNativeConfig();
+ config = newConfig.getNativeConfig();
configID = newConfig.getNativeConfigID();
if(DEBUG) {
System.err.println("!!! updateGraphicsConfiguration: "+this);
@@ -97,23 +97,23 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple
}
}
- public static _EGLConfig EGLConfigId2EGLConfig(GLProfile glp, long display, int configID) {
+ public static long EGLConfigId2EGLConfig(GLProfile glp, long display, int configID) {
int[] attrs = new int[] {
EGL.EGL_CONFIG_ID, configID,
EGL.EGL_NONE
};
- _EGLConfig[] configs = new _EGLConfig[1];
+ PointerBuffer configs = PointerBuffer.allocateDirect(1);
int[] numConfigs = new int[1];
if (!EGL.eglChooseConfig(display,
attrs, 0,
configs, 1,
numConfigs, 0)) {
- return null;
+ return 0;
}
if (numConfigs[0] == 0) {
- return null;
+ return 0;
}
- return configs[0];
+ return configs.get(0);
}
public static boolean EGLConfigDrawableTypeVerify(int val, boolean onscreen, boolean usePBuffer) {
@@ -122,62 +122,63 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple
if ( onscreen ) {
res = ( 0 != (val & EGL.EGL_WINDOW_BIT) ) ;
} else {
- res = ( 0 != (val & EGL.EGL_PIXMAP_BIT) ) || usePBuffer ;
- }
- if ( usePBuffer ) {
- res = res && ( 0 != (val & EGL.EGL_PBUFFER_BIT) ) ;
+ if ( usePBuffer ) {
+ res = ( 0 != (val & EGL.EGL_PBUFFER_BIT) ) ;
+ } else {
+ res = ( 0 != (val & EGL.EGL_PIXMAP_BIT) ) ;
+ }
}
return res;
}
- public static GLCapabilities EGLConfig2Capabilities(GLProfile glp, long display, _EGLConfig _config,
+ public static GLCapabilities EGLConfig2Capabilities(GLProfile glp, long display, long config,
boolean relaxed, boolean onscreen, boolean usePBuffer) {
GLCapabilities caps = new GLCapabilities(glp);
int[] val = new int[1];
// Read the actual configuration into the choosen caps
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_RED_SIZE, val, 0)) {
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_RED_SIZE, val, 0)) {
caps.setRedBits(val[0]);
}
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_GREEN_SIZE, val, 0)) {
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_GREEN_SIZE, val, 0)) {
caps.setGreenBits(val[0]);
}
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_BLUE_SIZE, val, 0)) {
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_BLUE_SIZE, val, 0)) {
caps.setBlueBits(val[0]);
}
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_ALPHA_SIZE, val, 0)) {
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_ALPHA_SIZE, val, 0)) {
caps.setAlphaBits(val[0]);
}
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_STENCIL_SIZE, val, 0)) {
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_STENCIL_SIZE, val, 0)) {
caps.setStencilBits(val[0]);
}
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_DEPTH_SIZE, val, 0)) {
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_DEPTH_SIZE, val, 0)) {
caps.setDepthBits(val[0]);
}
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_SAMPLES, val, 0)) {
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_SAMPLES, val, 0)) {
caps.setSampleBuffers(val[0]>0?true:false);
caps.setNumSamples(val[0]);
}
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_TRANSPARENT_TYPE, val, 0)) {
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_TRANSPARENT_TYPE, val, 0)) {
caps.setBackgroundOpaque(val[0] != EGL.EGL_TRANSPARENT_RGB);
}
if(!caps.isBackgroundOpaque()) {
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_TRANSPARENT_RED_VALUE, val, 0)) {
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_TRANSPARENT_RED_VALUE, val, 0)) {
caps.setTransparentRedValue(val[0]==EGL.EGL_DONT_CARE?-1:val[0]);
}
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_TRANSPARENT_GREEN_VALUE, val, 0)) {
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_TRANSPARENT_GREEN_VALUE, val, 0)) {
caps.setTransparentGreenValue(val[0]==EGL.EGL_DONT_CARE?-1:val[0]);
}
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_TRANSPARENT_BLUE_VALUE, val, 0)) {
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_TRANSPARENT_BLUE_VALUE, val, 0)) {
caps.setTransparentBlueValue(val[0]==EGL.EGL_DONT_CARE?-1:val[0]);
}
/** Not defined in EGL
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_TRANSPARENT_ALPHA_VALUE, val, 0)) {
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_TRANSPARENT_ALPHA_VALUE, val, 0)) {
caps.setTransparentAlphaValue(val[0]==EGL.EGL_DONT_CARE?-1:val[0]);
} */
}
- if(EGL.eglGetConfigAttrib(display, _config, EGL.EGL_SURFACE_TYPE, val, 0)) {
+ if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_SURFACE_TYPE, val, 0)) {
if(EGLConfigDrawableTypeVerify(val[0], onscreen, usePBuffer)) {
caps.setDoubleBuffered(onscreen);
caps.setOnscreen(onscreen);
@@ -187,17 +188,13 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple
caps.setOnscreen( 0 != (val[0] & EGL.EGL_WINDOW_BIT) );
caps.setPBuffer ( 0 != (val[0] & EGL.EGL_PBUFFER_BIT) );
} else {
- throw new GLException("EGL_SURFACE_TYPE does not match !!!");
- }
- } else {
- if(relaxed) {
if(DEBUG) {
- System.err.println("Could not determine EGL_SURFACE_TYPE !!!");
+ System.err.println("EGL_SURFACE_TYPE does not match: req(onscrn "+onscreen+", pbuffer "+usePBuffer+"), got(onscreen "+( 0 != (val[0] & EGL.EGL_WINDOW_BIT) )+", pbuffer "+( 0 != (val[0] & EGL.EGL_PBUFFER_BIT) )+", pixmap "+( 0 != (val[0] & EGL.EGL_PIXMAP_BIT) )+")");
}
return null;
- } else {
- throw new GLException("Could not determine EGL_SURFACE_TYPE !!!");
}
+ } else {
+ throw new GLException("Could not determine EGL_SURFACE_TYPE !!!");
}
return caps;
@@ -300,7 +297,7 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple
}
private GLCapabilitiesChooser chooser;
- private _EGLConfig _config;
+ private long config;
private int configID;
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java
index 3997850c0..33e301ee9 100644
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java
@@ -30,15 +30,15 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.opengl.impl.egl;
+package com.jogamp.opengl.impl.egl;
+import com.jogamp.common.nio.PointerBuffer;
import java.io.PrintStream;
import javax.media.nativewindow.*;
import javax.media.nativewindow.egl.*;
-import com.sun.nativewindow.impl.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
+
/** Subclass of GraphicsConfigurationFactory used when non-AWT tookits
are used on X11 platforms. Toolkits will likely need to delegate
@@ -46,7 +46,7 @@ import com.sun.opengl.impl.*;
GraphicsDevice and GraphicsConfiguration abstractions. */
public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactory {
- protected static final boolean DEBUG = GraphicsConfigurationFactory.DEBUG || com.sun.opengl.impl.Debug.debug("EGL");
+ protected static final boolean DEBUG = GraphicsConfigurationFactory.DEBUG || com.jogamp.opengl.impl.Debug.debug("EGL");
public EGLGraphicsConfigurationFactory() {
// become the selector for KD/EGL ..
@@ -99,7 +99,7 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
GLCapabilities caps2 = (GLCapabilities) capabilities.clone();
if(!caps2.isOnscreen()) {
- // OFFSCREEN !DOUBLE_BUFFER
+ // OFFSCREEN !DOUBLE_BUFFER // FIXME DBLBUFOFFSCRN
caps2.setDoubleBuffered(false);
}
@@ -115,10 +115,10 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
chooser = new DefaultGLCapabilitiesChooser();
}
- _EGLConfig[] configs = new _EGLConfig[10];
+ PointerBuffer configs = PointerBuffer.allocateDirect(10);
int[] numConfigs = new int[1];
- if(!EGL.eglGetConfigs(eglDisplay, configs, configs.length, numConfigs, 0)) {
+ if(!EGL.eglGetConfigs(eglDisplay, configs, configs.capacity(), numConfigs, 0)) {
throw new GLException("Graphics configuration fetch (eglGetConfigs) failed");
}
if (numConfigs[0] == 0) {
@@ -205,11 +205,11 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
AbstractGraphicsScreen absScreen) {
GLProfile glp = capsChosen0.getGLProfile();
int[] attrs = EGLGraphicsConfiguration.GLCapabilities2AttribList(capsChosen0);
- _EGLConfig[] configs = new _EGLConfig[1];
+ PointerBuffer configs = PointerBuffer.allocateDirect(1);
int[] numConfigs = new int[1];
if (!EGL.eglChooseConfig(eglDisplay,
attrs, 0,
- configs, configs.length,
+ configs, configs.capacity(),
numConfigs, 0)) {
throw new GLException("Graphics configuration selection (eglChooseConfig) failed for "+capsChosen0);
}
@@ -222,14 +222,14 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
}
int[] val = new int[1];
// get the configID
- if(!EGL.eglGetConfigAttrib(eglDisplay, configs[0], EGL.EGL_CONFIG_ID, val, 0)) {
+ if(!EGL.eglGetConfigAttrib(eglDisplay, configs.get(0), EGL.EGL_CONFIG_ID, val, 0)) {
if(DEBUG) {
// FIXME: this happens on a ATI PC Emulation ..
System.err.println("EGL couldn't retrieve ConfigID for already chosen eglConfig "+capsChosen0+", error 0x"+Integer.toHexString(EGL.eglGetError()));
}
return null;
}
- GLCapabilities capsChosen1 = EGLGraphicsConfiguration.EGLConfig2Capabilities(glp, eglDisplay, configs[0],
+ GLCapabilities capsChosen1 = EGLGraphicsConfiguration.EGLConfig2Capabilities(glp, eglDisplay, configs.get(0),
true, capsChosen0.isOnscreen(), capsChosen0.isPBuffer());
if(null!=capsChosen1) {
if(DEBUG) {
@@ -237,7 +237,7 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
", eglConfig ID 0x"+Integer.toHexString(val[0])+
", "+capsChosen0+" -> "+capsChosen1);
}
- return new EGLGraphicsConfiguration(absScreen, capsChosen1, capsRequested, chooser, configs[0], val[0]);
+ return new EGLGraphicsConfiguration(absScreen, capsChosen1, capsRequested, chooser, configs.get(0), val[0]);
}
if(DEBUG) {
System.err.println("eglChooseConfig couldn't verify: eglDisplay 0x"+Long.toHexString(eglDisplay)+
@@ -253,11 +253,11 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
return null;
}
- protected static GLCapabilities[] eglConfigs2GLCaps(GLProfile glp, long eglDisplay, _EGLConfig[] configs, int num,
+ protected static GLCapabilities[] eglConfigs2GLCaps(GLProfile glp, long eglDisplay, PointerBuffer configs, int num,
boolean onscreen, boolean usePBuffer) {
GLCapabilities[] caps = new GLCapabilities[num];
for(int i=0; i<num; i++) {
- caps[i] = EGLGraphicsConfiguration.EGLConfig2Capabilities(glp, eglDisplay, configs[i],
+ caps[i] = EGLGraphicsConfiguration.EGLConfig2Capabilities(glp, eglDisplay, configs.get(i),
true, onscreen, usePBuffer);
}
return caps;
@@ -273,7 +273,7 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
if(caps.isOnscreen()) {
throw new GLException("Error: Onscreen set: "+caps);
}
- caps.setDoubleBuffered(false); // FIXME
+ caps.setDoubleBuffered(false); // FIXME DBLBUFOFFSCRN
long eglDisplay = EGL.eglGetDisplay(EGL.EGL_DEFAULT_DISPLAY);
if (eglDisplay == EGL.EGL_NO_DISPLAY) {
throw new GLException("Failed to created EGL default display: error 0x"+Integer.toHexString(EGL.eglGetError()));
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenContext.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenContext.java
index c1a5bd583..b74991671 100755
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenContext.java
@@ -33,12 +33,12 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.egl;
+package com.jogamp.opengl.impl.egl;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.gluegen.runtime.ProcAddressTable;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.gluegen.runtime.ProcAddressTable;
import java.nio.*;
import java.util.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java
index 45fffbc91..3864fc39c 100644
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLOnscreenDrawable.java
@@ -37,13 +37,13 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.egl;
+package com.jogamp.opengl.impl.egl;
import javax.media.opengl.*;
import javax.media.nativewindow.*;
import javax.media.nativewindow.egl.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.NullWindow;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.nativewindow.impl.NullWindow;
public class EGLOnscreenDrawable extends EGLDrawable {
protected EGLOnscreenDrawable(EGLDrawableFactory factory, NativeWindow component) throws GLException {
@@ -54,27 +54,25 @@ public class EGLOnscreenDrawable extends EGLDrawable {
return new EGLOnscreenContext(this, shareWith);
}
- protected long createSurface(long eglDpy, _EGLConfig eglNativeCfg, long surfaceHandle) {
+ protected long createSurface(long eglDpy, long eglNativeCfg, long surfaceHandle) {
return EGL.eglCreateWindowSurface(eglDpy, eglNativeCfg, surfaceHandle, null);
}
protected void swapBuffersImpl() {
boolean didLock = false;
+ if (!isSurfaceLocked()) {
+ // Usually the surface shall be locked within [makeCurrent .. swap .. release]
+ if (lockSurface() == NativeWindow.LOCK_SURFACE_NOT_READY) {
+ return;
+ }
+ didLock = true;
+ }
try {
- if ( !isSurfaceLocked() ) {
- // Usually the surface shall be locked within [makeCurrent .. swap .. release]
- if (lockSurface() == NativeWindow.LOCK_SURFACE_NOT_READY) {
- return;
- }
- didLock = true;
- }
-
- EGL.eglSwapBuffers(eglDisplay, eglSurface);
-
+ EGL.eglSwapBuffers(eglDisplay, eglSurface);
} finally {
- if(didLock) {
- unlockSurface();
- }
+ if (didLock) {
+ unlockSurface();
+ }
}
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferContext.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLPbufferContext.java
index 2a7a7705c..5c634b9bd 100755
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLPbufferContext.java
@@ -33,12 +33,12 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.egl;
+package com.jogamp.opengl.impl.egl;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.gluegen.runtime.ProcAddressTable;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.gluegen.runtime.ProcAddressTable;
import java.nio.*;
import java.util.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLPbufferDrawable.java
index e16420b3a..03b02b77e 100644
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLPbufferDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLPbufferDrawable.java
@@ -37,12 +37,12 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.egl;
+package com.jogamp.opengl.impl.egl;
import javax.media.opengl.*;
import javax.media.nativewindow.*;
import javax.media.nativewindow.egl.*;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
public class EGLPbufferDrawable extends EGLDrawable {
private int texFormat;
@@ -73,7 +73,7 @@ public class EGLPbufferDrawable extends EGLDrawable {
}
- protected long createSurface(long eglDpy, _EGLConfig eglNativeCfg, long surfaceHandle) {
+ protected long createSurface(long eglDpy, long eglNativeCfg, long surfaceHandle) {
NativeWindow nw = getNativeWindow();
int[] attrs = EGLGraphicsConfiguration.CreatePBufferSurfaceAttribList(nw.getWidth(), nw.getHeight(), texFormat);
long surf = EGL.eglCreatePbufferSurface(eglDpy, eglNativeCfg, attrs, 0);
diff --git a/src/jogl/classes/com/sun/opengl/impl/gl2/ProjectDouble.java b/src/jogl/classes/com/jogamp/opengl/impl/gl2/ProjectDouble.java
index 5b7b679ad..2eb3ca5df 100755
--- a/src/jogl/classes/com/sun/opengl/impl/gl2/ProjectDouble.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/gl2/ProjectDouble.java
@@ -1,7 +1,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -112,12 +112,12 @@
* in the design, construction, operation or maintenance of any nuclear
* facility.
*/
-package com.sun.opengl.impl.gl2;
+package com.jogamp.opengl.impl.gl2;
import java.nio.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
/**
* Project.java
diff --git a/src/jogl/classes/com/sun/opengl/impl/gl2/Util.java b/src/jogl/classes/com/jogamp/opengl/impl/gl2/Util.java
index 0fc72daa9..a542dcf19 100644
--- a/src/jogl/classes/com/sun/opengl/impl/gl2/Util.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/gl2/Util.java
@@ -66,9 +66,9 @@
* facility.
*/
-package com.sun.opengl.impl.gl2;
+package com.jogamp.opengl.impl.gl2;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
import java.nio.IntBuffer;
import javax.media.opengl.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/gl2/fixme/GLObjectTracker.java b/src/jogl/classes/com/jogamp/opengl/impl/gl2/fixme/GLObjectTracker.java
index 885f3cb28..3e3b6ae87 100755
--- a/src/jogl/classes/com/sun/opengl/impl/gl2/fixme/GLObjectTracker.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/gl2/fixme/GLObjectTracker.java
@@ -37,9 +37,9 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.gl2;
+package com.jogamp.opengl.impl.gl2;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
import java.nio.*;
import javax.media.opengl.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/GLUquadricImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/GLUquadricImpl.java
index 34b5ced6b..d7e6a23c1 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/GLUquadricImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/GLUquadricImpl.java
@@ -1,7 +1,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -113,11 +113,11 @@
* facility.
*/
-package com.sun.opengl.impl.glu;
+package com.jogamp.opengl.impl.glu;
import javax.media.opengl.*;
import javax.media.opengl.glu.*;
-import com.sun.opengl.util.ImmModeSink;
+import com.jogamp.opengl.util.ImmModeSink;
import java.nio.*;
/**
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/Glue.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/Glue.java
index ada5ab684..7c360c574 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/Glue.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/Glue.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu;
+package com.jogamp.opengl.impl.glu;
/**
*
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/error/Error.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/error/Error.java
index d24a41f10..7c7e6b0d8 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/error/Error.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/error/Error.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,11 +42,11 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.error;
+package com.jogamp.opengl.impl.glu.error;
import javax.media.opengl.GL;
import javax.media.opengl.glu.GLU;
-import com.sun.opengl.impl.glu.Glue;
+import com.jogamp.opengl.impl.glu.Glue;
/**
*
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/gl2/nurbs/GL2Backend.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/gl2/nurbs/GL2Backend.java
index d54f1c56f..42ddeea50 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/gl2/nurbs/GL2Backend.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/gl2/nurbs/GL2Backend.java
@@ -1,10 +1,10 @@
-package com.sun.opengl.impl.glu.gl2.nurbs;
-import com.sun.opengl.impl.glu.nurbs.*;
+package com.jogamp.opengl.impl.glu.gl2.nurbs;
+import com.jogamp.opengl.impl.glu.nurbs.*;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/gl2/nurbs/GL2CurveEvaluator.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/gl2/nurbs/GL2CurveEvaluator.java
index 5be4f9049..adb8c51d8 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/gl2/nurbs/GL2CurveEvaluator.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/gl2/nurbs/GL2CurveEvaluator.java
@@ -1,10 +1,10 @@
-package com.sun.opengl.impl.glu.gl2.nurbs;
-import com.sun.opengl.impl.glu.nurbs.*;
+package com.jogamp.opengl.impl.glu.gl2.nurbs;
+import com.jogamp.opengl.impl.glu.nurbs.*;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/gl2/nurbs/GL2SurfaceEvaluator.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/gl2/nurbs/GL2SurfaceEvaluator.java
index c226b7db9..393601ff7 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/gl2/nurbs/GL2SurfaceEvaluator.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/gl2/nurbs/GL2SurfaceEvaluator.java
@@ -1,10 +1,10 @@
-package com.sun.opengl.impl.glu.gl2.nurbs;
-import com.sun.opengl.impl.glu.nurbs.*;
+package com.jogamp.opengl.impl.glu.gl2.nurbs;
+import com.jogamp.opengl.impl.glu.nurbs.*;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/gl2/nurbs/GLUgl2nurbsImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/gl2/nurbs/GLUgl2nurbsImpl.java
index d6c653a73..13b68138c 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/gl2/nurbs/GLUgl2nurbsImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/gl2/nurbs/GLUgl2nurbsImpl.java
@@ -1,10 +1,10 @@
-package com.sun.opengl.impl.glu.gl2.nurbs;
-import com.sun.opengl.impl.glu.nurbs.*;
+package com.jogamp.opengl.impl.glu.gl2.nurbs;
+import com.jogamp.opengl.impl.glu.nurbs.*;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/BuildMipmap.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/BuildMipmap.java
index f77f76fc8..501f5f585 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/BuildMipmap.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/BuildMipmap.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,13 +42,13 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.glu.GLU;
-import com.sun.opengl.impl.Debug;
-import com.sun.opengl.impl.InternalBufferUtil;
+import com.jogamp.opengl.impl.Debug;
+import com.jogamp.opengl.impl.InternalBufferUtil;
import java.nio.*;
import java.io.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract.java
index d5224af74..be86585e7 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.ByteBuffer;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract1010102.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract1010102.java
index fc29b299b..7e172b1ce 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract1010102.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract1010102.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.ByteBuffer;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract1555rev.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract1555rev.java
index e1c59041a..37895096e 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract1555rev.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract1555rev.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.ByteBuffer;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract2101010rev.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract2101010rev.java
index e04d948d8..077f3037b 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract2101010rev.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract2101010rev.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.ByteBuffer;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract233rev.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract233rev.java
index a3d8ce2a8..fa35c6fbc 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract233rev.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract233rev.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.ByteBuffer;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract332.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract332.java
index 008911364..35936466c 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract332.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract332.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.ByteBuffer;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract4444.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract4444.java
index b7414b184..bac4f57aa 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract4444.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract4444.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract4444rev.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract4444rev.java
index 30a2fa1ac..b1bea75e1 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract4444rev.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract4444rev.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract5551.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract5551.java
index f9e692e98..a6247844f 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract5551.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract5551.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract565.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract565.java
index 5eff68d7e..624a4f3f2 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract565.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract565.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract565rev.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract565rev.java
index 099f80be5..4ab6d7e98 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract565rev.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract565rev.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract8888.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract8888.java
index f3da73952..90d7e57c9 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract8888.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract8888.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract8888rev.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract8888rev.java
index 58dbe81f8..10970573b 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Extract8888rev.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Extract8888rev.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractFloat.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractFloat.java
index 7d06dfa82..c42799470 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractFloat.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractFloat.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractPrimitive.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractPrimitive.java
index 4cea1aa39..8b986d6d0 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractPrimitive.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractPrimitive.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.ByteBuffer;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractSByte.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractSByte.java
index a2cfeca94..4f61015f4 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractSByte.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractSByte.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.ByteBuffer;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractSInt.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractSInt.java
index 48becdc18..2d5ac5329 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractSInt.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractSInt.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractSShort.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractSShort.java
index 00ff15119..8b8d50cbf 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractSShort.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractSShort.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractUByte.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractUByte.java
index 4767d93c0..d33213f89 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractUByte.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractUByte.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.ByteBuffer;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractUInt.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractUInt.java
index e6cd6e183..873668a43 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractUInt.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractUInt.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractUShort.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractUShort.java
index 89b42e41b..86bbb95f1 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ExtractUShort.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ExtractUShort.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/HalveImage.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/HalveImage.java
index 7f2e87a63..893d33c66 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/HalveImage.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/HalveImage.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import javax.media.opengl.GL;
import java.nio.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Image.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Image.java
index 605d5547b..b2aaad2f7 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Image.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Image.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Mipmap.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Mipmap.java
index aa33550ca..1c0707c57 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Mipmap.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Mipmap.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,14 +42,15 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
+import javax.media.opengl.GL2GL3;
import javax.media.opengl.glu.GLU;
import javax.media.opengl.GLException;
import java.nio.*;
-import com.sun.opengl.impl.InternalBufferUtil;
+import com.jogamp.opengl.impl.InternalBufferUtil;
/**
*
@@ -125,7 +126,7 @@ public class Mipmap {
if( !legalFormat( format ) || !legalType( type ) ) {
return( GLU.GLU_INVALID_ENUM );
}
- if( format == GL2.GL_STENCIL_INDEX ) {
+ if( format == GL2GL3.GL_STENCIL_INDEX ) {
return( GLU.GLU_INVALID_ENUM );
}
if( !isLegalFormatForPackedPixelType( format, type ) ) {
@@ -137,18 +138,18 @@ public class Mipmap {
public static boolean legalFormat( int format ) {
switch( format ) {
case( GL2.GL_COLOR_INDEX ):
- case( GL2.GL_STENCIL_INDEX ):
- case( GL2.GL_DEPTH_COMPONENT ):
- case( GL2.GL_RED ):
- case( GL2.GL_GREEN ):
- case( GL2.GL_BLUE ):
- case( GL2.GL_ALPHA ):
- case( GL2.GL_RGB ):
- case( GL2.GL_RGBA ):
- case( GL2.GL_LUMINANCE ):
- case( GL2.GL_LUMINANCE_ALPHA ):
- case( GL2.GL_BGR ):
- case( GL2.GL_BGRA ):
+ case( GL2GL3.GL_STENCIL_INDEX ):
+ case( GL2GL3.GL_DEPTH_COMPONENT ):
+ case( GL2GL3.GL_RED ):
+ case( GL2GL3.GL_GREEN ):
+ case( GL2GL3.GL_BLUE ):
+ case( GL2GL3.GL_ALPHA ):
+ case( GL2GL3.GL_RGB ):
+ case( GL2GL3.GL_RGBA ):
+ case( GL2GL3.GL_LUMINANCE ):
+ case( GL2GL3.GL_LUMINANCE_ALPHA ):
+ case( GL2GL3.GL_BGR ):
+ case( GL2GL3.GL_BGRA ):
return( true );
default:
return( false );
@@ -158,25 +159,25 @@ public class Mipmap {
public static boolean legalType( int type ) {
switch( type ) {
case( GL2.GL_BITMAP ):
- case( GL2.GL_BYTE ):
- case( GL2.GL_UNSIGNED_BYTE ):
- case( GL2.GL_SHORT ):
- case( GL2.GL_UNSIGNED_SHORT ):
- case( GL2.GL_INT ):
- case( GL2.GL_UNSIGNED_INT ):
- case( GL2.GL_FLOAT ):
- case( GL2.GL_UNSIGNED_BYTE_3_3_2 ):
- case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ):
- case( GL2.GL_UNSIGNED_SHORT_5_6_5 ):
- case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ):
- case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ):
- case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ):
- case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ):
- case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ):
- case( GL2.GL_UNSIGNED_INT_8_8_8_8 ):
- case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ):
- case( GL2.GL_UNSIGNED_INT_10_10_10_2 ):
- case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ):
+ case( GL2GL3.GL_BYTE ):
+ case( GL2GL3.GL_UNSIGNED_BYTE ):
+ case( GL2GL3.GL_SHORT ):
+ case( GL2GL3.GL_UNSIGNED_SHORT ):
+ case( GL2GL3.GL_INT ):
+ case( GL2GL3.GL_UNSIGNED_INT ):
+ case( GL2GL3.GL_FLOAT ):
+ case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ):
+ case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ):
+ case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5 ):
+ case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ):
+ case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 ):
+ 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( 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 ):
return( true );
default:
return( false );
@@ -186,18 +187,18 @@ public class Mipmap {
public static boolean isTypePackedPixel( int type ) {
assert( legalType( type ) );
- if( type == GL2.GL_UNSIGNED_BYTE_3_3_2 ||
- type == GL2.GL_UNSIGNED_BYTE_2_3_3_REV ||
- type == GL2.GL_UNSIGNED_SHORT_5_6_5 ||
- type == GL2.GL_UNSIGNED_SHORT_5_6_5_REV ||
- type == GL2.GL_UNSIGNED_SHORT_4_4_4_4 ||
- type == GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ||
- type == GL2.GL_UNSIGNED_SHORT_5_5_5_1 ||
- type == GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ||
- type == GL2.GL_UNSIGNED_INT_8_8_8_8 ||
- type == GL2.GL_UNSIGNED_INT_8_8_8_8_REV ||
- type == GL2.GL_UNSIGNED_INT_10_10_10_2 ||
- type == GL2.GL_UNSIGNED_INT_2_10_10_10_REV ) {
+ 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 ||
+ type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 ||
+ type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ||
+ type == GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 ||
+ type == GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ||
+ type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ||
+ type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ||
+ type == GL2GL3.GL_UNSIGNED_INT_10_10_10_2 ||
+ type == GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ) {
return( true );
}
return( false );
@@ -210,23 +211,23 @@ public class Mipmap {
}
// 3_3_2/2_3_3_REV & 5_6_5/5_6_5_REV are only compatible with RGB
- if( (type == GL2.GL_UNSIGNED_BYTE_3_3_2 || type == GL2.GL_UNSIGNED_BYTE_2_3_3_REV ||
- type == GL2.GL_UNSIGNED_SHORT_5_6_5 || type == GL2.GL_UNSIGNED_SHORT_5_6_5_REV )
- & format != GL2.GL_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 == GL2.GL_UNSIGNED_SHORT_4_4_4_4 ||
- type == GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ||
- type == GL2.GL_UNSIGNED_SHORT_5_5_5_1 ||
- type == GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ||
- type == GL2.GL_UNSIGNED_INT_8_8_8_8 ||
- type == GL2.GL_UNSIGNED_INT_8_8_8_8_REV ||
- type == GL2.GL_UNSIGNED_INT_10_10_10_2 ||
- type == GL2.GL_UNSIGNED_INT_2_10_10_10_REV ) &&
- (format != GL2.GL_RGBA && format != GL2.GL_BGRA) ) {
+ if( ( type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 ||
+ type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ||
+ type == GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 ||
+ type == GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ||
+ type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ||
+ type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ||
+ type == GL2GL3.GL_UNSIGNED_INT_10_10_10_2 ||
+ type == GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ) &&
+ (format != GL2GL3.GL_RGBA && format != GL2GL3.GL_BGRA) ) {
return( false );
}
return( true );
@@ -272,27 +273,27 @@ public class Mipmap {
assert( heightAtLevelOne > 0 );
// does width x height at level 1 & all their mipmaps fit?
- if( target == GL2.GL_TEXTURE_2D || target == GL2.GL_PROXY_TEXTURE_2D ) {
- proxyTarget = GL2.GL_PROXY_TEXTURE_2D;
+ 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 == GL2.GL_TEXTURE_CUBE_MAP_POSITIVE_X) ||
- (target == GL2.GL_TEXTURE_CUBE_MAP_NEGATIVE_X) ||
- (target == GL2.GL_TEXTURE_CUBE_MAP_POSITIVE_Y) ||
- (target == GL2.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) ||
- (target == GL2.GL_TEXTURE_CUBE_MAP_POSITIVE_Z) ||
- (target == GL2.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) ) {
- proxyTarget = GL2.GL_PROXY_TEXTURE_CUBE_MAP;
+ } 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,
heightAtLevelOne, 0, format, type, null );
} else {
- assert( target == GL2.GL_TEXTURE_1D || target == GL2.GL_PROXY_TEXTURE_1D );
- proxyTarget = GL2.GL_PROXY_TEXTURE_1D;
- gl.getGL2().glTexImage1D( proxyTarget, 1, internalFormat, widthAtLevelOne,
+ 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,
0, format, type, null );
}
- if(gl.isGL2()) {
- gl.getGL2().glGetTexLevelParameteriv( proxyTarget, 1, GL2.GL_TEXTURE_WIDTH, proxyWidth, 0 );
+ if(gl.isGL2GL3()) {
+ gl.getGL2GL3().glGetTexLevelParameteriv( proxyTarget, 1, GL2GL3.GL_TEXTURE_WIDTH, proxyWidth, 0 );
} else {
proxyWidth[0] = 0;
}
@@ -324,7 +325,7 @@ public class Mipmap {
}
}
int[] maxsize = new int[1];
- gl.glGetIntegerv( GL2.GL_MAX_TEXTURE_SIZE, maxsize , 0);
+ gl.glGetIntegerv( GL2GL3.GL_MAX_TEXTURE_SIZE, maxsize , 0);
// clamp user's texture sizes to maximum sizes, if necessary
newWidth[0] = nearestPower( width );
if( newWidth[0] > maxsize[0] ) {
@@ -355,13 +356,13 @@ public class Mipmap {
assert( depthAtLevelOne > 0 );
// does width x height x depth at level 1 & all their mipmaps fit?
- if( target == GL2.GL_TEXTURE_3D || target == GL2.GL_PROXY_TEXTURE_3D ) {
- proxyTarget = GL2.GL_PROXY_TEXTURE_3D;
- gl.getGL2().glTexImage3D( proxyTarget, 1, internalFormat, widthAtLevelOne,
+ if( target == GL2GL3.GL_TEXTURE_3D || target == GL2GL3.GL_PROXY_TEXTURE_3D ) {
+ proxyTarget = GL2GL3.GL_PROXY_TEXTURE_3D;
+ gl.getGL2GL3().glTexImage3D( proxyTarget, 1, internalFormat, widthAtLevelOne,
heightAtLevelOne, depthAtLevelOne, 0, format, type, null );
}
- if(gl.isGL2()) {
- gl.getGL2().glGetTexLevelParameteriv( proxyTarget, 1, GL2.GL_TEXTURE_WIDTH, proxyWidth, 0 );
+ if(gl.isGL2GL3()) {
+ gl.getGL2GL3().glGetTexLevelParameteriv( proxyTarget, 1, GL2GL3.GL_TEXTURE_WIDTH, proxyWidth, 0 );
} else {
proxyWidth[0] = 0;
}
@@ -388,30 +389,30 @@ public class Mipmap {
// Return the number of elements per grtoup of a specified gromat
// If the type is packedpixels then answer is 1
- if( type == GL2.GL_UNSIGNED_BYTE_3_3_2 ||
- type == GL2.GL_UNSIGNED_BYTE_2_3_3_REV ||
- type == GL2.GL_UNSIGNED_SHORT_5_6_5 ||
- type == GL2.GL_UNSIGNED_SHORT_5_6_5_REV ||
- type == GL2.GL_UNSIGNED_SHORT_4_4_4_4 ||
- type == GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ||
- type == GL2.GL_UNSIGNED_SHORT_5_5_5_1 ||
- type == GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ||
- type == GL2.GL_UNSIGNED_INT_8_8_8_8 ||
- type == GL2.GL_UNSIGNED_INT_8_8_8_8_REV ||
- type == GL2.GL_UNSIGNED_INT_10_10_10_2 ||
- type == GL2.GL_UNSIGNED_INT_2_10_10_10_REV ) {
+ 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 ||
+ type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 ||
+ type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ||
+ type == GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 ||
+ type == GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ||
+ type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ||
+ type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ||
+ type == GL2GL3.GL_UNSIGNED_INT_10_10_10_2 ||
+ 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( GL2.GL_RGB ):
- case( GL2.GL_BGR ):
+ case( GL2GL3.GL_RGB ):
+ case( GL2GL3.GL_BGR ):
return( 3 );
- case( GL2.GL_LUMINANCE_ALPHA ):
+ case( GL2GL3.GL_LUMINANCE_ALPHA ):
return( 2 );
- case( GL2.GL_RGBA ):
- case( GL2.GL_BGRA ):
+ case( GL2GL3.GL_RGBA ):
+ case( GL2GL3.GL_BGRA ):
return( 4 );
default:
return( 1 );
@@ -423,27 +424,27 @@ public class Mipmap {
switch( type ) {
case( GL2.GL_BITMAP ):
- case( GL2.GL_BYTE ):
- case( GL2.GL_UNSIGNED_BYTE ):
- case( GL2.GL_UNSIGNED_BYTE_3_3_2 ):
- case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ):
+ case( GL2GL3.GL_BYTE ):
+ case( GL2GL3.GL_UNSIGNED_BYTE ):
+ case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ):
+ case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ):
return( 1 );
- case( GL2.GL_SHORT ):
- case( GL2.GL_UNSIGNED_SHORT ):
- case( GL2.GL_UNSIGNED_SHORT_5_6_5 ):
- case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ):
- case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ):
- case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ):
- case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ):
- case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ):
+ case( GL2GL3.GL_SHORT ):
+ case( GL2GL3.GL_UNSIGNED_SHORT ):
+ case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5 ):
+ case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ):
+ case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 ):
+ 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 ):
return( 2 );
- case( GL2.GL_INT ):
- case( GL2.GL_UNSIGNED_INT ):
- case( GL2.GL_UNSIGNED_INT_8_8_8_8 ):
- case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ):
- case( GL2.GL_UNSIGNED_INT_10_10_10_2 ):
- case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ):
- case( GL2.GL_FLOAT ):
+ case( GL2GL3.GL_INT ):
+ case( GL2GL3.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_FLOAT ):
return( 4 );
default:
return( 4 );
@@ -451,7 +452,7 @@ public class Mipmap {
}
public static boolean is_index( int format ) {
- return( format == GL2.GL_COLOR_INDEX || format == GL2.GL_STENCIL_INDEX );
+ 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. */
@@ -483,67 +484,67 @@ public class Mipmap {
public static void retrieveStoreModes( GL gl, PixelStorageModes psm ) {
int[] a = new int[1];
- gl.glGetIntegerv( GL2.GL_UNPACK_ALIGNMENT, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_UNPACK_ALIGNMENT, a, 0);
psm.setUnpackAlignment( a[0] );
- gl.glGetIntegerv( GL2.GL_UNPACK_ROW_LENGTH, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_UNPACK_ROW_LENGTH, a, 0);
psm.setUnpackRowLength( a[0] );
- gl.glGetIntegerv( GL2.GL_UNPACK_SKIP_ROWS, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_ROWS, a, 0);
psm.setUnpackSkipRows( a[0] );
- gl.glGetIntegerv( GL2.GL_UNPACK_SKIP_PIXELS, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_PIXELS, a, 0);
psm.setUnpackSkipPixels( a[0] );
- gl.glGetIntegerv( GL2.GL_UNPACK_LSB_FIRST, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_UNPACK_LSB_FIRST, a, 0);
psm.setUnpackLsbFirst( ( a[0] == 1 ) );
- gl.glGetIntegerv( GL2.GL_UNPACK_SWAP_BYTES, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_UNPACK_SWAP_BYTES, a, 0);
psm.setUnpackSwapBytes( ( a[0] == 1 ) );
- gl.glGetIntegerv( GL2.GL_PACK_ALIGNMENT, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_PACK_ALIGNMENT, a, 0);
psm.setPackAlignment( a[0] );
- gl.glGetIntegerv( GL2.GL_PACK_ROW_LENGTH, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_PACK_ROW_LENGTH, a, 0);
psm.setPackRowLength( a[0] );
- gl.glGetIntegerv( GL2.GL_PACK_SKIP_ROWS, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_ROWS, a, 0);
psm.setPackSkipRows( a[0] );
- gl.glGetIntegerv( GL2.GL_PACK_SKIP_PIXELS, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_PIXELS, a, 0);
psm.setPackSkipPixels( a[0] );
- gl.glGetIntegerv( GL2.GL_PACK_LSB_FIRST, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_PACK_LSB_FIRST, a, 0);
psm.setPackLsbFirst( ( a[0] == 1 ) );
- gl.glGetIntegerv( GL2.GL_PACK_SWAP_BYTES, a, 0);
+ 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( GL2.GL_UNPACK_ALIGNMENT, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_UNPACK_ALIGNMENT, a, 0);
psm.setUnpackAlignment( a[0] );
- gl.glGetIntegerv( GL2.GL_UNPACK_ROW_LENGTH, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_UNPACK_ROW_LENGTH, a, 0);
psm.setUnpackRowLength( a[0] );
- gl.glGetIntegerv( GL2.GL_UNPACK_SKIP_ROWS, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_ROWS, a, 0);
psm.setUnpackSkipRows( a[0] );
- gl.glGetIntegerv( GL2.GL_UNPACK_SKIP_PIXELS, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_PIXELS, a, 0);
psm.setUnpackSkipPixels( a[0] );
- gl.glGetIntegerv( GL2.GL_UNPACK_LSB_FIRST, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_UNPACK_LSB_FIRST, a, 0);
psm.setUnpackLsbFirst( ( a[0] == 1 ) );
- gl.glGetIntegerv( GL2.GL_UNPACK_SWAP_BYTES, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_UNPACK_SWAP_BYTES, a, 0);
psm.setUnpackSwapBytes( ( a[0] == 1 ) );
- gl.glGetIntegerv( GL2.GL_UNPACK_SKIP_IMAGES, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_IMAGES, a, 0);
psm.setUnpackSkipImages( a[0] );
- gl.glGetIntegerv( GL2.GL_UNPACK_IMAGE_HEIGHT, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_UNPACK_IMAGE_HEIGHT, a, 0);
psm.setUnpackImageHeight( a[0] );
- gl.glGetIntegerv( GL2.GL_PACK_ALIGNMENT, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_PACK_ALIGNMENT, a, 0);
psm.setPackAlignment( a[0] );
- gl.glGetIntegerv( GL2.GL_PACK_ROW_LENGTH, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_PACK_ROW_LENGTH, a, 0);
psm.setPackRowLength( a[0] );
- gl.glGetIntegerv( GL2.GL_PACK_SKIP_ROWS, a, 0);
+ gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_ROWS, a, 0);
psm.setPackSkipRows( a[0] );
- gl.glGetIntegerv( GL2.GL_PACK_SKIP_PIXELS, a, 0 );
+ gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_PIXELS, a, 0 );
psm.setPackSkipPixels( a[0] );
- gl.glGetIntegerv( GL2.GL_PACK_LSB_FIRST, a, 0 );
+ gl.glGetIntegerv( GL2GL3.GL_PACK_LSB_FIRST, a, 0 );
psm.setPackLsbFirst( ( a[0] == 1 ) );
- gl.glGetIntegerv( GL2.GL_PACK_SWAP_BYTES, a, 0 );
+ gl.glGetIntegerv( GL2GL3.GL_PACK_SWAP_BYTES, a, 0 );
psm.setPackSwapBytes( ( a[0] == 1 ) );
- gl.glGetIntegerv( GL2.GL_PACK_SKIP_IMAGES, a, 0 );
+ gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_IMAGES, a, 0 );
psm.setPackSkipImages( a[0] );
- gl.glGetIntegerv( GL2.GL_PACK_IMAGE_HEIGHT, a, 0 );
+ gl.glGetIntegerv( GL2GL3.GL_PACK_IMAGE_HEIGHT, a, 0 );
psm.setPackImageHeight( a[0] );
}
@@ -574,8 +575,8 @@ public class Mipmap {
if( !isLegalFormatForPackedPixelType( format, typeout ) ) {
return( GLU.GLU_INVALID_OPERATION );
}
- beforeimage = InternalBufferUtil.nativeOrder(ByteBuffer.allocateDirect( image_size( widthin, heightin, format, GL2.GL_UNSIGNED_SHORT ) ));
- afterimage = InternalBufferUtil.nativeOrder(ByteBuffer.allocateDirect( image_size( widthout, heightout, format, GL2.GL_UNSIGNED_SHORT ) ));
+ beforeimage = InternalBufferUtil.nativeOrder(ByteBuffer.allocateDirect( image_size( widthin, heightin, format, GL2GL3.GL_UNSIGNED_SHORT ) ));
+ afterimage = InternalBufferUtil.nativeOrder(ByteBuffer.allocateDirect( image_size( widthout, heightout, format, GL2GL3.GL_UNSIGNED_SHORT ) ));
if( beforeimage == null || afterimage == null ) {
return( GLU.GLU_OUT_OF_MEMORY );
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/PixelStorageModes.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/PixelStorageModes.java
index 82324f1b0..43b5c5691 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/PixelStorageModes.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/PixelStorageModes.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
/**
*
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ScaleInternal.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ScaleInternal.java
index f51c72ea6..f0bb7fb33 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/ScaleInternal.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/ScaleInternal.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,13 +42,13 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.glu.GLU;
import java.nio.*;
-import com.sun.opengl.impl.InternalBufferUtil;
+import com.jogamp.opengl.impl.InternalBufferUtil;
/**
*
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Type_Widget.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Type_Widget.java
index d5c6768b3..b329840ef 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/mipmap/Type_Widget.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/mipmap/Type_Widget.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.mipmap;
+package com.jogamp.opengl.impl.glu.mipmap;
import java.nio.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Arc.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Arc.java
index e96aa83f8..9ee2494a1 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Arc.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Arc.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/ArcSdirSorter.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/ArcSdirSorter.java
index f8fbe2930..3955e3176 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/ArcSdirSorter.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/ArcSdirSorter.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/ArcTdirSorter.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/ArcTdirSorter.java
index 9e9a10b42..098ba97b7 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/ArcTdirSorter.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/ArcTdirSorter.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/ArcTesselator.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/ArcTesselator.java
index 496e8b7d6..edfb8905f 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/ArcTesselator.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/ArcTesselator.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Backend.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Backend.java
index 9467104f5..39097720c 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Backend.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Backend.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/BezierArc.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/BezierArc.java
index ef4cf0684..d9b390b67 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/BezierArc.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/BezierArc.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Bin.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Bin.java
index 0f0806d96..61316f348 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Bin.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Bin.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Breakpt.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Breakpt.java
index 9cccc5102..b5b88ad96 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Breakpt.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Breakpt.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfArcs.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/CArrayOfArcs.java
index 3d6e1d47f..0646e1d9f 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfArcs.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/CArrayOfArcs.java
@@ -1,4 +1,4 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/**
* Class replacing C language pointer
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfBreakpts.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/CArrayOfBreakpts.java
index f5932d954..e47fdf966 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfBreakpts.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/CArrayOfBreakpts.java
@@ -1,4 +1,4 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/**
* Class replacing C language pointer
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfFloats.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/CArrayOfFloats.java
index fb3fac69b..60cef9919 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfFloats.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/CArrayOfFloats.java
@@ -1,4 +1,4 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/**
* Class replacing C language pointer
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfQuiltspecs.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/CArrayOfQuiltspecs.java
index fed301895..ef16a8204 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CArrayOfQuiltspecs.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/CArrayOfQuiltspecs.java
@@ -1,4 +1,4 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/**
* Class replacing C language pointer
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Curve.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Curve.java
index 318c8416c..fb1a5acea 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Curve.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Curve.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CurveEvaluator.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/CurveEvaluator.java
index a6393ddf4..c27ffd4c4 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/CurveEvaluator.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/CurveEvaluator.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Curvelist.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Curvelist.java
index fdce39b46..fc3018833 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Curvelist.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Curvelist.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/DisplayList.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/DisplayList.java
index 735c36edf..39a3a28f4 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/DisplayList.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/DisplayList.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Flist.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Flist.java
index d9e798854..00757ed7e 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Flist.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Flist.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Knotspec.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Knotspec.java
index bcb55388d..9251aa231 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Knotspec.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Knotspec.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Knotvector.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Knotvector.java
index c7c3d4578..658a1cbda 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Knotvector.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Knotvector.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Mapdesc.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Mapdesc.java
index 8b52a4a8a..568eddc51 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Mapdesc.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Mapdesc.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Maplist.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Maplist.java
index 3b6e22ea5..b23a1f665 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Maplist.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Maplist.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/NurbsConsts.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/NurbsConsts.java
index c98e74b7c..ee7f3b31b 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/NurbsConsts.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/NurbsConsts.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_curve.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/O_curve.java
index b130226c4..900f8e56f 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_curve.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/O_curve.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_nurbscurve.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/O_nurbscurve.java
index 68bf60b27..81110813f 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_nurbscurve.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/O_nurbscurve.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_nurbssurface.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/O_nurbssurface.java
index 1cbaa6ccc..b598f525d 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_nurbssurface.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/O_nurbssurface.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_pwlcurve.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/O_pwlcurve.java
index 4dec066d6..e50f41d81 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_pwlcurve.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/O_pwlcurve.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_surface.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/O_surface.java
index 4ef680c2f..76ac79f0a 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_surface.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/O_surface.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_trim.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/O_trim.java
index c1f61ebab..17e5002df 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/O_trim.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/O_trim.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Patch.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Patch.java
index f15ad1f92..d3066cc84 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Patch.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Patch.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Patchlist.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Patchlist.java
index b2b9033ec..8b439a02f 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Patchlist.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Patchlist.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Property.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Property.java
index e0ad1dd32..b486a0ead 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Property.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Property.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Pspec.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Pspec.java
index 5fc66fa82..1e60ed335 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Pspec.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Pspec.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/PwlArc.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/PwlArc.java
index 6b8255d85..0c9eca91e 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/PwlArc.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/PwlArc.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Quilt.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Quilt.java
index bc058b093..03e809d23 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Quilt.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Quilt.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Quiltspec.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Quiltspec.java
index d94986a03..6c8e55e06 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Quiltspec.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Quiltspec.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/README.txt b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/README.txt
index 89630c71e..89630c71e 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/README.txt
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/README.txt
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Renderhints.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Renderhints.java
index c571d9d88..d1a23fbab 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Renderhints.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Renderhints.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Splinespec.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Splinespec.java
index 35288c67d..487b47f2d 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Splinespec.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Splinespec.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Subdivider.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Subdivider.java
index b1506d6a1..99c1b740b 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/Subdivider.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/Subdivider.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/SurfaceEvaluator.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/SurfaceEvaluator.java
index feb3bc9a7..fe23f9c08 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/SurfaceEvaluator.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/SurfaceEvaluator.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/TrimVertex.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/TrimVertex.java
index ec3f6fc10..6608f8f40 100755
--- a/src/jogl/classes/com/sun/opengl/impl/glu/nurbs/TrimVertex.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/nurbs/TrimVertex.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.impl.glu.nurbs;
+package com.jogamp.opengl.impl.glu.nurbs;
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
- ** Software License B, Version 1.1 (the "License"), the contents of this
+ ** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/registry/Registry.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/registry/Registry.java
index 488a3c0f2..21b15f4d4 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/registry/Registry.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/registry/Registry.java
@@ -1,7 +1,7 @@
/*
* License Applicability. Except to the extent portions of this file are
* made subject to an alternative license as permitted in the SGI Free
- * Software License B, Version 1.1 (the "License"), the contents of this
+ * Software License B, Version 2.0 (the "License"), the contents of this
* file are subject only to the provisions of the License. You may not use
* this file except in compliance with the License. You may obtain a copy
* of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -42,7 +42,7 @@
* compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-package com.sun.opengl.impl.glu.registry;
+package com.jogamp.opengl.impl.glu.registry;
import javax.media.opengl.glu.GLU;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/ActiveRegion.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/ActiveRegion.java
index a04c5c74b..85397dd6a 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/ActiveRegion.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/ActiveRegion.java
@@ -6,7 +6,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -50,7 +50,7 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package com.sun.opengl.impl.glu.tessellator;
+package com.jogamp.opengl.impl.glu.tessellator;
class ActiveRegion {
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/CachedVertex.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/CachedVertex.java
index 993671c0d..8948acfec 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/CachedVertex.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/CachedVertex.java
@@ -6,7 +6,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -50,7 +50,7 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package com.sun.opengl.impl.glu.tessellator;
+package com.jogamp.opengl.impl.glu.tessellator;
class CachedVertex {
public double[] coords = new double[3];
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/Dict.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/Dict.java
index d2f6e3790..d26948e7f 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/Dict.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/Dict.java
@@ -6,7 +6,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -50,7 +50,7 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package com.sun.opengl.impl.glu.tessellator;
+package com.jogamp.opengl.impl.glu.tessellator;
class Dict {
DictNode head;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/DictNode.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/DictNode.java
index 1222bd948..8864de127 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/DictNode.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/DictNode.java
@@ -6,7 +6,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -50,7 +50,7 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package com.sun.opengl.impl.glu.tessellator;
+package com.jogamp.opengl.impl.glu.tessellator;
class DictNode {
Object key;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/GLUface.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/GLUface.java
index f0589dbea..2ff4aae59 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/GLUface.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/GLUface.java
@@ -6,7 +6,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -50,7 +50,7 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package com.sun.opengl.impl.glu.tessellator;
+package com.jogamp.opengl.impl.glu.tessellator;
class GLUface {
public GLUface next; /* next face (never NULL) */
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/GLUhalfEdge.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/GLUhalfEdge.java
index 1b6e81cc5..c2128b616 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/GLUhalfEdge.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/GLUhalfEdge.java
@@ -6,7 +6,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -50,7 +50,7 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package com.sun.opengl.impl.glu.tessellator;
+package com.jogamp.opengl.impl.glu.tessellator;
class GLUhalfEdge {
public GLUhalfEdge next; /* doubly-linked list (prev==Sym->next) */
@@ -58,10 +58,10 @@ class GLUhalfEdge {
public GLUhalfEdge Onext; /* next edge CCW around origin */
public GLUhalfEdge Lnext; /* next edge CCW around left face */
public GLUvertex Org; /* origin vertex (Overtex too long) */
- public com.sun.opengl.impl.glu.tessellator.GLUface Lface; /* left face */
+ public com.jogamp.opengl.impl.glu.tessellator.GLUface Lface; /* left face */
/* Internal data (keep hidden) */
- public com.sun.opengl.impl.glu.tessellator.ActiveRegion activeRegion; /* a region with this upper edge (sweep.c) */
+ public com.jogamp.opengl.impl.glu.tessellator.ActiveRegion activeRegion; /* a region with this upper edge (sweep.c) */
public int winding; /* change in winding number when crossing */
public boolean first;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/GLUmesh.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/GLUmesh.java
index 73fbe815e..493eb20f4 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/GLUmesh.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/GLUmesh.java
@@ -6,7 +6,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -50,11 +50,11 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package com.sun.opengl.impl.glu.tessellator;
+package com.jogamp.opengl.impl.glu.tessellator;
class GLUmesh {
GLUvertex vHead = new GLUvertex(); /* dummy header for vertex list */
- com.sun.opengl.impl.glu.tessellator.GLUface fHead = new GLUface(); /* dummy header for face list */
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eHead = new GLUhalfEdge(true); /* dummy header for edge list */
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eHeadSym = new GLUhalfEdge(false); /* and its symmetric counterpart */
+ com.jogamp.opengl.impl.glu.tessellator.GLUface fHead = new GLUface(); /* dummy header for face list */
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eHead = new GLUhalfEdge(true); /* dummy header for edge list */
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eHeadSym = new GLUhalfEdge(false); /* and its symmetric counterpart */
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/GLUtessellatorImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/GLUtessellatorImpl.java
index f4efb116a..b21998355 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/GLUtessellatorImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/GLUtessellatorImpl.java
@@ -6,7 +6,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -50,9 +50,9 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package com.sun.opengl.impl.glu.tessellator;
+package com.jogamp.opengl.impl.glu.tessellator;
-import com.sun.opengl.impl.glu.tessellator.*;
+import com.jogamp.opengl.impl.glu.tessellator.*;
import javax.media.opengl.*;
import javax.media.opengl.glu.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/GLUvertex.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/GLUvertex.java
index e97767a12..af294caad 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/GLUvertex.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/GLUvertex.java
@@ -6,7 +6,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -50,12 +50,12 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package com.sun.opengl.impl.glu.tessellator;
+package com.jogamp.opengl.impl.glu.tessellator;
class GLUvertex {
public GLUvertex next; /* next vertex (never NULL) */
public GLUvertex prev; /* previous vertex (never NULL) */
- public com.sun.opengl.impl.glu.tessellator.GLUhalfEdge anEdge; /* a half-edge with this origin */
+ public com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge anEdge; /* a half-edge with this origin */
public Object data; /* client's data */
/* Internal data (keep hidden) */
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/Geom.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/Geom.java
index 1287a60e0..2710346d1 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/Geom.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/Geom.java
@@ -6,7 +6,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -50,7 +50,7 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package com.sun.opengl.impl.glu.tessellator;
+package com.jogamp.opengl.impl.glu.tessellator;
class Geom {
private Geom() {
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/Mesh.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/Mesh.java
index 290fb1037..b8be9f80f 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/Mesh.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/Mesh.java
@@ -6,7 +6,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -50,7 +50,7 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package com.sun.opengl.impl.glu.tessellator;
+package com.jogamp.opengl.impl.glu.tessellator;
class Mesh {
private Mesh() {
@@ -61,19 +61,19 @@ class Mesh {
* No vertex or face structures are allocated, but these must be assigned
* before the current edge operation is completed.
*/
- static com.sun.opengl.impl.glu.tessellator.GLUhalfEdge MakeEdge(com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eNext) {
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e;
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eSym;
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge ePrev;
+ static com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge MakeEdge(com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eNext) {
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge e;
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eSym;
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge ePrev;
// EdgePair * pair = (EdgePair *)
// memAlloc(sizeof(EdgePair));
// if (pair == NULL) return NULL;
//
// e = &pair - > e;
- e = new com.sun.opengl.impl.glu.tessellator.GLUhalfEdge(true);
+ e = new com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge(true);
// eSym = &pair - > eSym;
- eSym = new com.sun.opengl.impl.glu.tessellator.GLUhalfEdge(false);
+ eSym = new com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge(false);
/* Make sure eNext points to the first edge of the edge pair */
@@ -115,9 +115,9 @@ class Mesh {
* depending on whether a and b belong to different face or vertex rings.
* For more explanation see __gl_meshSplice() below.
*/
- static void Splice(com.sun.opengl.impl.glu.tessellator.GLUhalfEdge a, com.sun.opengl.impl.glu.tessellator.GLUhalfEdge b) {
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge aOnext = a.Onext;
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge bOnext = b.Onext;
+ static void Splice(com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge a, com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge b) {
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge aOnext = a.Onext;
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge bOnext = b.Onext;
aOnext.Sym.Lnext = b;
bOnext.Sym.Lnext = a;
@@ -131,11 +131,11 @@ class Mesh {
* the new vertex *before* vNext so that algorithms which walk the vertex
* list will not see the newly created vertices.
*/
- static void MakeVertex(com.sun.opengl.impl.glu.tessellator.GLUvertex newVertex,
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eOrig, com.sun.opengl.impl.glu.tessellator.GLUvertex vNext) {
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e;
- com.sun.opengl.impl.glu.tessellator.GLUvertex vPrev;
- com.sun.opengl.impl.glu.tessellator.GLUvertex vNew = newVertex;
+ static void MakeVertex(com.jogamp.opengl.impl.glu.tessellator.GLUvertex newVertex,
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eOrig, com.jogamp.opengl.impl.glu.tessellator.GLUvertex vNext) {
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge e;
+ com.jogamp.opengl.impl.glu.tessellator.GLUvertex vPrev;
+ com.jogamp.opengl.impl.glu.tessellator.GLUvertex vNew = newVertex;
assert (vNew != null);
@@ -164,10 +164,10 @@ class Mesh {
* the new face *before* fNext so that algorithms which walk the face
* list will not see the newly created faces.
*/
- static void MakeFace(com.sun.opengl.impl.glu.tessellator.GLUface newFace, com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eOrig, com.sun.opengl.impl.glu.tessellator.GLUface fNext) {
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e;
- com.sun.opengl.impl.glu.tessellator.GLUface fPrev;
- com.sun.opengl.impl.glu.tessellator.GLUface fNew = newFace;
+ static void MakeFace(com.jogamp.opengl.impl.glu.tessellator.GLUface newFace, com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eOrig, com.jogamp.opengl.impl.glu.tessellator.GLUface fNext) {
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge e;
+ com.jogamp.opengl.impl.glu.tessellator.GLUface fPrev;
+ com.jogamp.opengl.impl.glu.tessellator.GLUface fNew = newFace;
assert (fNew != null);
@@ -199,8 +199,8 @@ class Mesh {
/* KillEdge( eDel ) destroys an edge (the half-edges eDel and eDel->Sym),
* and removes from the global edge list.
*/
- static void KillEdge(com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eDel) {
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge ePrev, eNext;
+ static void KillEdge(com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eDel) {
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge ePrev, eNext;
/* Half-edges are allocated in pairs, see EdgePair above */
if (!eDel.first) {
@@ -218,9 +218,9 @@ class Mesh {
/* KillVertex( vDel ) destroys a vertex and removes it from the global
* vertex list. It updates the vertex loop to point to a given new vertex.
*/
- static void KillVertex(com.sun.opengl.impl.glu.tessellator.GLUvertex vDel, com.sun.opengl.impl.glu.tessellator.GLUvertex newOrg) {
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e, eStart = vDel.anEdge;
- com.sun.opengl.impl.glu.tessellator.GLUvertex vPrev, vNext;
+ static void KillVertex(com.jogamp.opengl.impl.glu.tessellator.GLUvertex vDel, com.jogamp.opengl.impl.glu.tessellator.GLUvertex newOrg) {
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge e, eStart = vDel.anEdge;
+ com.jogamp.opengl.impl.glu.tessellator.GLUvertex vPrev, vNext;
/* change the origin of all affected edges */
e = eStart;
@@ -239,9 +239,9 @@ class Mesh {
/* KillFace( fDel ) destroys a face and removes it from the global face
* list. It updates the face loop to point to a given new face.
*/
- static void KillFace(com.sun.opengl.impl.glu.tessellator.GLUface fDel, com.sun.opengl.impl.glu.tessellator.GLUface newLface) {
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e, eStart = fDel.anEdge;
- com.sun.opengl.impl.glu.tessellator.GLUface fPrev, fNext;
+ static void KillFace(com.jogamp.opengl.impl.glu.tessellator.GLUface fDel, com.jogamp.opengl.impl.glu.tessellator.GLUface newLface) {
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge e, eStart = fDel.anEdge;
+ com.jogamp.opengl.impl.glu.tessellator.GLUface fPrev, fNext;
/* change the left face of all affected edges */
e = eStart;
@@ -263,11 +263,11 @@ class Mesh {
/* __gl_meshMakeEdge creates one edge, two vertices, and a loop (face).
* The loop consists of the two new half-edges.
*/
- public static com.sun.opengl.impl.glu.tessellator.GLUhalfEdge __gl_meshMakeEdge(com.sun.opengl.impl.glu.tessellator.GLUmesh mesh) {
- com.sun.opengl.impl.glu.tessellator.GLUvertex newVertex1 = new com.sun.opengl.impl.glu.tessellator.GLUvertex();
- com.sun.opengl.impl.glu.tessellator.GLUvertex newVertex2 = new com.sun.opengl.impl.glu.tessellator.GLUvertex();
- com.sun.opengl.impl.glu.tessellator.GLUface newFace = new com.sun.opengl.impl.glu.tessellator.GLUface();
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e;
+ public static com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge __gl_meshMakeEdge(com.jogamp.opengl.impl.glu.tessellator.GLUmesh mesh) {
+ com.jogamp.opengl.impl.glu.tessellator.GLUvertex newVertex1 = new com.jogamp.opengl.impl.glu.tessellator.GLUvertex();
+ com.jogamp.opengl.impl.glu.tessellator.GLUvertex newVertex2 = new com.jogamp.opengl.impl.glu.tessellator.GLUvertex();
+ com.jogamp.opengl.impl.glu.tessellator.GLUface newFace = new com.jogamp.opengl.impl.glu.tessellator.GLUface();
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge e;
e = MakeEdge(mesh.eHead);
if (e == null) return null;
@@ -302,7 +302,7 @@ class Mesh {
* If eDst == eOrg->Onext, the new vertex will have a single edge.
* If eDst == eOrg->Oprev, the old vertex will have a single edge.
*/
- public static boolean __gl_meshSplice(com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eOrg, com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eDst) {
+ public static boolean __gl_meshSplice(com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eOrg, com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eDst) {
boolean joiningLoops = false;
boolean joiningVertices = false;
@@ -323,7 +323,7 @@ class Mesh {
Splice(eDst, eOrg);
if (!joiningVertices) {
- com.sun.opengl.impl.glu.tessellator.GLUvertex newVertex = new com.sun.opengl.impl.glu.tessellator.GLUvertex();
+ com.jogamp.opengl.impl.glu.tessellator.GLUvertex newVertex = new com.jogamp.opengl.impl.glu.tessellator.GLUvertex();
/* We split one vertex into two -- the new vertex is eDst.Org.
* Make sure the old vertex points to a valid half-edge.
@@ -332,7 +332,7 @@ class Mesh {
eOrg.Org.anEdge = eOrg;
}
if (!joiningLoops) {
- com.sun.opengl.impl.glu.tessellator.GLUface newFace = new com.sun.opengl.impl.glu.tessellator.GLUface();
+ com.jogamp.opengl.impl.glu.tessellator.GLUface newFace = new com.jogamp.opengl.impl.glu.tessellator.GLUface();
/* We split one loop into two -- the new loop is eDst.Lface.
* Make sure the old face points to a valid half-edge.
@@ -355,8 +355,8 @@ class Mesh {
* plus a few calls to memFree, but this would allocate and delete
* unnecessary vertices and faces.
*/
- static boolean __gl_meshDelete(com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eDel) {
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eDelSym = eDel.Sym;
+ static boolean __gl_meshDelete(com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eDel) {
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eDelSym = eDel.Sym;
boolean joiningLoops = false;
/* First step: disconnect the origin vertex eDel.Org. We make all
@@ -377,7 +377,7 @@ class Mesh {
Splice(eDel, eDel.Sym.Lnext);
if (!joiningLoops) {
- com.sun.opengl.impl.glu.tessellator.GLUface newFace = new com.sun.opengl.impl.glu.tessellator.GLUface();
+ com.jogamp.opengl.impl.glu.tessellator.GLUface newFace = new com.jogamp.opengl.impl.glu.tessellator.GLUface();
/* We are splitting one loop into two -- create a new loop for eDel. */
MakeFace(newFace, eDel, eDel.Lface);
@@ -415,9 +415,9 @@ class Mesh {
* eNew == eOrg.Lnext, and eNew.Dst is a newly created vertex.
* eOrg and eNew will have the same left face.
*/
- static com.sun.opengl.impl.glu.tessellator.GLUhalfEdge __gl_meshAddEdgeVertex(com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eOrg) {
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eNewSym;
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eNew = MakeEdge(eOrg);
+ static com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge __gl_meshAddEdgeVertex(com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eOrg) {
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eNewSym;
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eNew = MakeEdge(eOrg);
eNewSym = eNew.Sym;
@@ -427,7 +427,7 @@ class Mesh {
/* Set the vertex and face information */
eNew.Org = eOrg.Sym.Org;
{
- com.sun.opengl.impl.glu.tessellator.GLUvertex newVertex = new com.sun.opengl.impl.glu.tessellator.GLUvertex();
+ com.jogamp.opengl.impl.glu.tessellator.GLUvertex newVertex = new com.jogamp.opengl.impl.glu.tessellator.GLUvertex();
MakeVertex(newVertex, eNewSym, eNew.Org);
}
@@ -441,9 +441,9 @@ class Mesh {
* such that eNew == eOrg.Lnext. The new vertex is eOrg.Sym.Org == eNew.Org.
* eOrg and eNew will have the same left face.
*/
- public static com.sun.opengl.impl.glu.tessellator.GLUhalfEdge __gl_meshSplitEdge(com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eOrg) {
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eNew;
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge tempHalfEdge = __gl_meshAddEdgeVertex(eOrg);
+ public static com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge __gl_meshSplitEdge(com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eOrg) {
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eNew;
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge tempHalfEdge = __gl_meshAddEdgeVertex(eOrg);
eNew = tempHalfEdge.Sym;
@@ -472,10 +472,10 @@ class Mesh {
* If (eOrg.Lnext == eDst), the old face is reduced to a single edge.
* If (eOrg.Lnext.Lnext == eDst), the old face is reduced to two edges.
*/
- static com.sun.opengl.impl.glu.tessellator.GLUhalfEdge __gl_meshConnect(com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eOrg, com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eDst) {
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eNewSym;
+ static com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge __gl_meshConnect(com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eOrg, com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eDst) {
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eNewSym;
boolean joiningLoops = false;
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eNew = MakeEdge(eOrg);
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eNew = MakeEdge(eOrg);
eNewSym = eNew.Sym;
@@ -498,7 +498,7 @@ class Mesh {
eOrg.Lface.anEdge = eNewSym;
if (!joiningLoops) {
- com.sun.opengl.impl.glu.tessellator.GLUface newFace = new com.sun.opengl.impl.glu.tessellator.GLUface();
+ com.jogamp.opengl.impl.glu.tessellator.GLUface newFace = new com.jogamp.opengl.impl.glu.tessellator.GLUface();
/* We split one loop into two -- the new loop is eNew.Lface */
MakeFace(newFace, eNew, eOrg.Lface);
@@ -516,10 +516,10 @@ class Mesh {
* An entire mesh can be deleted by zapping its faces, one at a time,
* in any order. Zapped faces cannot be used in further mesh operations!
*/
- static void __gl_meshZapFace(com.sun.opengl.impl.glu.tessellator.GLUface fZap) {
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eStart = fZap.anEdge;
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e, eNext, eSym;
- com.sun.opengl.impl.glu.tessellator.GLUface fPrev, fNext;
+ static void __gl_meshZapFace(com.jogamp.opengl.impl.glu.tessellator.GLUface fZap) {
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eStart = fZap.anEdge;
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge e, eNext, eSym;
+ com.jogamp.opengl.impl.glu.tessellator.GLUface fPrev, fNext;
/* walk around face, deleting edges whose right face is also null */
eNext = eStart.Lnext;
@@ -561,12 +561,12 @@ class Mesh {
/* __gl_meshNewMesh() creates a new mesh with no edges, no vertices,
* and no loops (what we usually call a "face").
*/
- public static com.sun.opengl.impl.glu.tessellator.GLUmesh __gl_meshNewMesh() {
- com.sun.opengl.impl.glu.tessellator.GLUvertex v;
- com.sun.opengl.impl.glu.tessellator.GLUface f;
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e;
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eSym;
- com.sun.opengl.impl.glu.tessellator.GLUmesh mesh = new com.sun.opengl.impl.glu.tessellator.GLUmesh();
+ public static com.jogamp.opengl.impl.glu.tessellator.GLUmesh __gl_meshNewMesh() {
+ com.jogamp.opengl.impl.glu.tessellator.GLUvertex v;
+ com.jogamp.opengl.impl.glu.tessellator.GLUface f;
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge e;
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eSym;
+ com.jogamp.opengl.impl.glu.tessellator.GLUmesh mesh = new com.jogamp.opengl.impl.glu.tessellator.GLUmesh();
v = mesh.vHead;
f = mesh.fHead;
@@ -609,13 +609,13 @@ class Mesh {
/* __gl_meshUnion( mesh1, mesh2 ) forms the union of all structures in
* both meshes, and returns the new mesh (the old meshes are destroyed).
*/
- static com.sun.opengl.impl.glu.tessellator.GLUmesh __gl_meshUnion(com.sun.opengl.impl.glu.tessellator.GLUmesh mesh1, com.sun.opengl.impl.glu.tessellator.GLUmesh mesh2) {
- com.sun.opengl.impl.glu.tessellator.GLUface f1 = mesh1.fHead;
- com.sun.opengl.impl.glu.tessellator.GLUvertex v1 = mesh1.vHead;
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e1 = mesh1.eHead;
- com.sun.opengl.impl.glu.tessellator.GLUface f2 = mesh2.fHead;
- com.sun.opengl.impl.glu.tessellator.GLUvertex v2 = mesh2.vHead;
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e2 = mesh2.eHead;
+ static com.jogamp.opengl.impl.glu.tessellator.GLUmesh __gl_meshUnion(com.jogamp.opengl.impl.glu.tessellator.GLUmesh mesh1, com.jogamp.opengl.impl.glu.tessellator.GLUmesh mesh2) {
+ com.jogamp.opengl.impl.glu.tessellator.GLUface f1 = mesh1.fHead;
+ com.jogamp.opengl.impl.glu.tessellator.GLUvertex v1 = mesh1.vHead;
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge e1 = mesh1.eHead;
+ com.jogamp.opengl.impl.glu.tessellator.GLUface f2 = mesh2.fHead;
+ com.jogamp.opengl.impl.glu.tessellator.GLUvertex v2 = mesh2.vHead;
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge e2 = mesh2.eHead;
/* Add the faces, vertices, and edges of mesh2 to those of mesh1 */
if (f2.next != f2) {
@@ -645,8 +645,8 @@ class Mesh {
/* __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh.
*/
- static void __gl_meshDeleteMeshZap(com.sun.opengl.impl.glu.tessellator.GLUmesh mesh) {
- com.sun.opengl.impl.glu.tessellator.GLUface fHead = mesh.fHead;
+ static void __gl_meshDeleteMeshZap(com.jogamp.opengl.impl.glu.tessellator.GLUmesh mesh) {
+ com.jogamp.opengl.impl.glu.tessellator.GLUface fHead = mesh.fHead;
while (fHead.next != fHead) {
__gl_meshZapFace(fHead.next);
@@ -656,10 +656,10 @@ class Mesh {
/* __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh.
*/
- public static void __gl_meshDeleteMesh(com.sun.opengl.impl.glu.tessellator.GLUmesh mesh) {
- com.sun.opengl.impl.glu.tessellator.GLUface f, fNext;
- com.sun.opengl.impl.glu.tessellator.GLUvertex v, vNext;
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e, eNext;
+ public static void __gl_meshDeleteMesh(com.jogamp.opengl.impl.glu.tessellator.GLUmesh mesh) {
+ com.jogamp.opengl.impl.glu.tessellator.GLUface f, fNext;
+ com.jogamp.opengl.impl.glu.tessellator.GLUvertex v, vNext;
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge e, eNext;
for (f = mesh.fHead.next; f != mesh.fHead; f = fNext) {
fNext = f.next;
@@ -677,13 +677,13 @@ class Mesh {
/* __gl_meshCheckMesh( mesh ) checks a mesh for self-consistency.
*/
- public static void __gl_meshCheckMesh(com.sun.opengl.impl.glu.tessellator.GLUmesh mesh) {
- com.sun.opengl.impl.glu.tessellator.GLUface fHead = mesh.fHead;
- com.sun.opengl.impl.glu.tessellator.GLUvertex vHead = mesh.vHead;
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eHead = mesh.eHead;
- com.sun.opengl.impl.glu.tessellator.GLUface f, fPrev;
- com.sun.opengl.impl.glu.tessellator.GLUvertex v, vPrev;
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e, ePrev;
+ public static void __gl_meshCheckMesh(com.jogamp.opengl.impl.glu.tessellator.GLUmesh mesh) {
+ com.jogamp.opengl.impl.glu.tessellator.GLUface fHead = mesh.fHead;
+ com.jogamp.opengl.impl.glu.tessellator.GLUvertex vHead = mesh.vHead;
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eHead = mesh.eHead;
+ com.jogamp.opengl.impl.glu.tessellator.GLUface f, fPrev;
+ com.jogamp.opengl.impl.glu.tessellator.GLUvertex v, vPrev;
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge e, ePrev;
fPrev = fHead;
for (fPrev = fHead; (f = fPrev.next) != fHead; fPrev = f) {
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/Normal.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/Normal.java
index feb13dfd4..fe1a20c49 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/Normal.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/Normal.java
@@ -6,7 +6,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -50,7 +50,7 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package com.sun.opengl.impl.glu.tessellator;
+package com.jogamp.opengl.impl.glu.tessellator;
import javax.media.opengl.*;
import javax.media.opengl.glu.*;
@@ -110,17 +110,17 @@ class Normal {
}
static void ComputeNormal(GLUtessellatorImpl tess, double[] norm) {
- com.sun.opengl.impl.glu.tessellator.GLUvertex v, v1, v2;
+ com.jogamp.opengl.impl.glu.tessellator.GLUvertex v, v1, v2;
double c, tLen2, maxLen2;
double[] maxVal, minVal, d1, d2, tNorm;
- com.sun.opengl.impl.glu.tessellator.GLUvertex[] maxVert, minVert;
- com.sun.opengl.impl.glu.tessellator.GLUvertex vHead = tess.mesh.vHead;
+ com.jogamp.opengl.impl.glu.tessellator.GLUvertex[] maxVert, minVert;
+ com.jogamp.opengl.impl.glu.tessellator.GLUvertex vHead = tess.mesh.vHead;
int i;
maxVal = new double[3];
minVal = new double[3];
- minVert = new com.sun.opengl.impl.glu.tessellator.GLUvertex[3];
- maxVert = new com.sun.opengl.impl.glu.tessellator.GLUvertex[3];
+ minVert = new com.jogamp.opengl.impl.glu.tessellator.GLUvertex[3];
+ maxVert = new com.jogamp.opengl.impl.glu.tessellator.GLUvertex[3];
d1 = new double[3];
d2 = new double[3];
tNorm = new double[3];
@@ -194,9 +194,9 @@ class Normal {
static void CheckOrientation(GLUtessellatorImpl tess) {
double area;
- com.sun.opengl.impl.glu.tessellator.GLUface f, fHead = tess.mesh.fHead;
- com.sun.opengl.impl.glu.tessellator.GLUvertex v, vHead = tess.mesh.vHead;
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e;
+ com.jogamp.opengl.impl.glu.tessellator.GLUface f, fHead = tess.mesh.fHead;
+ com.jogamp.opengl.impl.glu.tessellator.GLUvertex v, vHead = tess.mesh.vHead;
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge e;
/* When we compute the normal automatically, we choose the orientation
* so that the the sum of the signed areas of all contours is non-negative.
@@ -225,7 +225,7 @@ class Normal {
* of the polygon.
*/
public static void __gl_projectPolygon(GLUtessellatorImpl tess) {
- com.sun.opengl.impl.glu.tessellator.GLUvertex v, vHead = tess.mesh.vHead;
+ com.jogamp.opengl.impl.glu.tessellator.GLUvertex v, vHead = tess.mesh.vHead;
double w;
double[] norm = new double[3];
double[] sUnit, tUnit;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/PriorityQ.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/PriorityQ.java
index 18f2cf32c..b77305ae2 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/PriorityQ.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/PriorityQ.java
@@ -6,7 +6,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -50,7 +50,7 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package com.sun.opengl.impl.glu.tessellator;
+package com.jogamp.opengl.impl.glu.tessellator;
abstract class PriorityQ {
public static final int INIT_SIZE = 32;
@@ -76,7 +76,7 @@ abstract class PriorityQ {
/* Violates modularity, but a little faster */
// #include "geom.h"
public static boolean LEQ(Leq leq, Object x, Object y) {
- return com.sun.opengl.impl.glu.tessellator.Geom.VertLeq((com.sun.opengl.impl.glu.tessellator.GLUvertex) x, (com.sun.opengl.impl.glu.tessellator.GLUvertex) y);
+ return com.jogamp.opengl.impl.glu.tessellator.Geom.VertLeq((com.jogamp.opengl.impl.glu.tessellator.GLUvertex) x, (com.jogamp.opengl.impl.glu.tessellator.GLUvertex) y);
}
static PriorityQ pqNewPriorityQ(Leq leq) {
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/PriorityQHeap.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/PriorityQHeap.java
index 2f856517a..61aa9574f 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/PriorityQHeap.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/PriorityQHeap.java
@@ -6,7 +6,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -50,25 +50,25 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package com.sun.opengl.impl.glu.tessellator;
+package com.jogamp.opengl.impl.glu.tessellator;
-class PriorityQHeap extends com.sun.opengl.impl.glu.tessellator.PriorityQ {
- com.sun.opengl.impl.glu.tessellator.PriorityQ.PQnode[] nodes;
- com.sun.opengl.impl.glu.tessellator.PriorityQ.PQhandleElem[] handles;
+class PriorityQHeap extends com.jogamp.opengl.impl.glu.tessellator.PriorityQ {
+ com.jogamp.opengl.impl.glu.tessellator.PriorityQ.PQnode[] nodes;
+ com.jogamp.opengl.impl.glu.tessellator.PriorityQ.PQhandleElem[] handles;
int size, max;
int freeList;
boolean initialized;
- com.sun.opengl.impl.glu.tessellator.PriorityQ.Leq leq;
+ com.jogamp.opengl.impl.glu.tessellator.PriorityQ.Leq leq;
/* really __gl_pqHeapNewPriorityQ */
- public PriorityQHeap(com.sun.opengl.impl.glu.tessellator.PriorityQ.Leq leq) {
+ public PriorityQHeap(com.jogamp.opengl.impl.glu.tessellator.PriorityQ.Leq leq) {
size = 0;
- max = com.sun.opengl.impl.glu.tessellator.PriorityQ.INIT_SIZE;
- nodes = new com.sun.opengl.impl.glu.tessellator.PriorityQ.PQnode[com.sun.opengl.impl.glu.tessellator.PriorityQ.INIT_SIZE + 1];
+ max = com.jogamp.opengl.impl.glu.tessellator.PriorityQ.INIT_SIZE;
+ nodes = new com.jogamp.opengl.impl.glu.tessellator.PriorityQ.PQnode[com.jogamp.opengl.impl.glu.tessellator.PriorityQ.INIT_SIZE + 1];
for (int i = 0; i < nodes.length; i++) {
nodes[i] = new PQnode();
}
- handles = new com.sun.opengl.impl.glu.tessellator.PriorityQ.PQhandleElem[com.sun.opengl.impl.glu.tessellator.PriorityQ.INIT_SIZE + 1];
+ handles = new com.jogamp.opengl.impl.glu.tessellator.PriorityQ.PQhandleElem[com.jogamp.opengl.impl.glu.tessellator.PriorityQ.INIT_SIZE + 1];
for (int i = 0; i < handles.length; i++) {
handles[i] = new PQhandleElem();
}
@@ -87,8 +87,8 @@ class PriorityQHeap extends com.sun.opengl.impl.glu.tessellator.PriorityQ {
}
void FloatDown(int curr) {
- com.sun.opengl.impl.glu.tessellator.PriorityQ.PQnode[] n = nodes;
- com.sun.opengl.impl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles;
+ com.jogamp.opengl.impl.glu.tessellator.PriorityQ.PQnode[] n = nodes;
+ com.jogamp.opengl.impl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles;
int hCurr, hChild;
int child;
@@ -116,8 +116,8 @@ class PriorityQHeap extends com.sun.opengl.impl.glu.tessellator.PriorityQ {
void FloatUp(int curr) {
- com.sun.opengl.impl.glu.tessellator.PriorityQ.PQnode[] n = nodes;
- com.sun.opengl.impl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles;
+ com.jogamp.opengl.impl.glu.tessellator.PriorityQ.PQnode[] n = nodes;
+ com.jogamp.opengl.impl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles;
int hCurr, hParent;
int parent;
@@ -158,8 +158,8 @@ class PriorityQHeap extends com.sun.opengl.impl.glu.tessellator.PriorityQ {
curr = ++size;
if ((curr * 2) > max) {
- com.sun.opengl.impl.glu.tessellator.PriorityQ.PQnode[] saveNodes = nodes;
- com.sun.opengl.impl.glu.tessellator.PriorityQ.PQhandleElem[] saveHandles = handles;
+ com.jogamp.opengl.impl.glu.tessellator.PriorityQ.PQnode[] saveNodes = nodes;
+ com.jogamp.opengl.impl.glu.tessellator.PriorityQ.PQhandleElem[] saveHandles = handles;
/* If the heap overflows, double its size. */
max <<= 1;
@@ -208,8 +208,8 @@ class PriorityQHeap extends com.sun.opengl.impl.glu.tessellator.PriorityQ {
/* really __gl_pqHeapExtractMin */
Object pqExtractMin() {
- com.sun.opengl.impl.glu.tessellator.PriorityQ.PQnode[] n = nodes;
- com.sun.opengl.impl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles;
+ com.jogamp.opengl.impl.glu.tessellator.PriorityQ.PQnode[] n = nodes;
+ com.jogamp.opengl.impl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles;
int hMin = n[1].handle;
Object min = h[hMin].key;
@@ -230,8 +230,8 @@ class PriorityQHeap extends com.sun.opengl.impl.glu.tessellator.PriorityQ {
/* really __gl_pqHeapDelete */
void pqDelete(int hCurr) {
- com.sun.opengl.impl.glu.tessellator.PriorityQ.PQnode[] n = nodes;
- com.sun.opengl.impl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles;
+ com.jogamp.opengl.impl.glu.tessellator.PriorityQ.PQnode[] n = nodes;
+ com.jogamp.opengl.impl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles;
int curr;
assert (hCurr >= 1 && hCurr <= max && h[hCurr].key != null);
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/PriorityQSort.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/PriorityQSort.java
index 67924524d..f115b8f49 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/PriorityQSort.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/PriorityQSort.java
@@ -1,7 +1,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -45,10 +45,10 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package com.sun.opengl.impl.glu.tessellator;
+package com.jogamp.opengl.impl.glu.tessellator;
-class PriorityQSort extends com.sun.opengl.impl.glu.tessellator.PriorityQ {
- com.sun.opengl.impl.glu.tessellator.PriorityQHeap heap;
+class PriorityQSort extends com.jogamp.opengl.impl.glu.tessellator.PriorityQ {
+ com.jogamp.opengl.impl.glu.tessellator.PriorityQHeap heap;
Object[] keys;
// JAVA: 'order' contains indices into the keys array.
@@ -57,15 +57,15 @@ class PriorityQSort extends com.sun.opengl.impl.glu.tessellator.PriorityQ {
int[] order;
int size, max;
boolean initialized;
- com.sun.opengl.impl.glu.tessellator.PriorityQ.Leq leq;
+ com.jogamp.opengl.impl.glu.tessellator.PriorityQ.Leq leq;
- public PriorityQSort(com.sun.opengl.impl.glu.tessellator.PriorityQ.Leq leq) {
- heap = new com.sun.opengl.impl.glu.tessellator.PriorityQHeap(leq);
+ public PriorityQSort(com.jogamp.opengl.impl.glu.tessellator.PriorityQ.Leq leq) {
+ heap = new com.jogamp.opengl.impl.glu.tessellator.PriorityQHeap(leq);
- keys = new Object[com.sun.opengl.impl.glu.tessellator.PriorityQ.INIT_SIZE];
+ keys = new Object[com.jogamp.opengl.impl.glu.tessellator.PriorityQ.INIT_SIZE];
size = 0;
- max = com.sun.opengl.impl.glu.tessellator.PriorityQ.INIT_SIZE;
+ max = com.jogamp.opengl.impl.glu.tessellator.PriorityQ.INIT_SIZE;
initialized = false;
this.leq = leq;
}
@@ -77,12 +77,12 @@ class PriorityQSort extends com.sun.opengl.impl.glu.tessellator.PriorityQ {
keys = null;
}
- private static boolean LT(com.sun.opengl.impl.glu.tessellator.PriorityQ.Leq leq, Object x, Object y) {
- return (!com.sun.opengl.impl.glu.tessellator.PriorityQHeap.LEQ(leq, y, x));
+ private static boolean LT(com.jogamp.opengl.impl.glu.tessellator.PriorityQ.Leq leq, Object x, Object y) {
+ return (!com.jogamp.opengl.impl.glu.tessellator.PriorityQHeap.LEQ(leq, y, x));
}
- private static boolean GT(com.sun.opengl.impl.glu.tessellator.PriorityQ.Leq leq, Object x, Object y) {
- return (!com.sun.opengl.impl.glu.tessellator.PriorityQHeap.LEQ(leq, x, y));
+ private static boolean GT(com.jogamp.opengl.impl.glu.tessellator.PriorityQ.Leq leq, Object x, Object y) {
+ return (!com.jogamp.opengl.impl.glu.tessellator.PriorityQHeap.LEQ(leq, x, y));
}
private static void Swap(int[] array, int a, int b) {
@@ -249,7 +249,7 @@ class PriorityQSort extends com.sun.opengl.impl.glu.tessellator.PriorityQ {
sortMin = keys[order[size - 1]];
if (!heap.pqIsEmpty()) {
heapMin = heap.pqMinimum();
- if (com.sun.opengl.impl.glu.tessellator.PriorityQHeap.LEQ(leq, heapMin, sortMin)) {
+ if (com.jogamp.opengl.impl.glu.tessellator.PriorityQHeap.LEQ(leq, heapMin, sortMin)) {
return heapMin;
}
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/Render.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/Render.java
index cd6e02255..9761200e0 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/Render.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/Render.java
@@ -6,7 +6,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -50,7 +50,7 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package com.sun.opengl.impl.glu.tessellator;
+package com.jogamp.opengl.impl.glu.tessellator;
import javax.media.opengl.*;
import javax.media.opengl.glu.*;
@@ -73,19 +73,19 @@ class Render {
public FaceCount() {
}
- public FaceCount(long size, com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eStart, renderCallBack render) {
+ public FaceCount(long size, com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eStart, renderCallBack render) {
this.size = size;
this.eStart = eStart;
this.render = render;
}
long size; /* number of triangles used */
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eStart; /* edge where this primitive starts */
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eStart; /* edge where this primitive starts */
renderCallBack render;
};
private static interface renderCallBack {
- void render(GLUtessellatorImpl tess, com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e, long size);
+ void render(GLUtessellatorImpl tess, com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge e, long size);
}
/************************ Strips and Fans decomposition ******************/
@@ -97,8 +97,8 @@ class Render {
*
* The rendering output is provided as callbacks (see the api).
*/
- public static void __gl_renderMesh(GLUtessellatorImpl tess, com.sun.opengl.impl.glu.tessellator.GLUmesh mesh) {
- com.sun.opengl.impl.glu.tessellator.GLUface f;
+ public static void __gl_renderMesh(GLUtessellatorImpl tess, com.jogamp.opengl.impl.glu.tessellator.GLUmesh mesh) {
+ com.jogamp.opengl.impl.glu.tessellator.GLUface f;
/* Make a list of separate triangles so we can render them all at once */
tess.lonelyTriList = null;
@@ -124,7 +124,7 @@ class Render {
}
- static void RenderMaximumFaceGroup(GLUtessellatorImpl tess, com.sun.opengl.impl.glu.tessellator.GLUface fOrig) {
+ static void RenderMaximumFaceGroup(GLUtessellatorImpl tess, com.jogamp.opengl.impl.glu.tessellator.GLUface fOrig) {
/* We want to find the largest triangle fan or strip of unmarked faces
* which includes the given face fOrig. There are 3 possible fans
* passing through fOrig (one centered at each vertex), and 3 possible
@@ -132,7 +132,7 @@ class Render {
* is to try all of these, and take the primitive which uses the most
* triangles (a greedy approach).
*/
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e = fOrig.anEdge;
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge e = fOrig.anEdge;
FaceCount max = new FaceCount();
FaceCount newFace = new FaceCount();
@@ -178,17 +178,17 @@ class Render {
* more complicated, and we need a general tracking method like the
* one here.
*/
- private static boolean Marked(com.sun.opengl.impl.glu.tessellator.GLUface f) {
+ private static boolean Marked(com.jogamp.opengl.impl.glu.tessellator.GLUface f) {
return !f.inside || f.marked;
}
- private static GLUface AddToTrail(com.sun.opengl.impl.glu.tessellator.GLUface f, com.sun.opengl.impl.glu.tessellator.GLUface t) {
+ private static GLUface AddToTrail(com.jogamp.opengl.impl.glu.tessellator.GLUface f, com.jogamp.opengl.impl.glu.tessellator.GLUface t) {
f.trail = t;
f.marked = true;
return f;
}
- private static void FreeTrail(com.sun.opengl.impl.glu.tessellator.GLUface t) {
+ private static void FreeTrail(com.jogamp.opengl.impl.glu.tessellator.GLUface t) {
if (true) {
while (t != null) {
t.marked = false;
@@ -199,14 +199,14 @@ class Render {
}
}
- static FaceCount MaximumFan(com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eOrig) {
+ static FaceCount MaximumFan(com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eOrig) {
/* eOrig.Lface is the face we want to render. We want to find the size
* of a maximal fan around eOrig.Org. To do this we just walk around
* the origin vertex as far as possible in both directions.
*/
FaceCount newFace = new FaceCount(0, null, renderFan);
- com.sun.opengl.impl.glu.tessellator.GLUface trail = null;
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e;
+ com.jogamp.opengl.impl.glu.tessellator.GLUface trail = null;
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge e;
for (e = eOrig; !Marked(e.Lface); e = e.Onext) {
trail = AddToTrail(e.Lface, trail);
@@ -227,7 +227,7 @@ class Render {
return (n & 0x1L) == 0;
}
- static FaceCount MaximumStrip(com.sun.opengl.impl.glu.tessellator.GLUhalfEdge eOrig) {
+ static FaceCount MaximumStrip(com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge eOrig) {
/* Here we are looking for a maximal strip that contains the vertices
* eOrig.Org, eOrig.Dst, eOrig.Lnext.Dst (in that order or the
* reverse, such that all triangles are oriented CCW).
@@ -240,8 +240,8 @@ class Render {
*/
FaceCount newFace = new FaceCount(0, null, renderStrip);
long headSize = 0, tailSize = 0;
- com.sun.opengl.impl.glu.tessellator.GLUface trail = null;
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e, eTail, eHead;
+ com.jogamp.opengl.impl.glu.tessellator.GLUface trail = null;
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge e, eTail, eHead;
for (e = eOrig; !Marked(e.Lface); ++tailSize, e = e.Onext) {
trail = AddToTrail(e.Lface, trail);
@@ -279,7 +279,7 @@ class Render {
}
private static class RenderTriangle implements renderCallBack {
- public void render(GLUtessellatorImpl tess, com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e, long size) {
+ public void render(GLUtessellatorImpl tess, com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge e, long size) {
/* Just add the triangle to a triangle list, so we can render all
* the separate triangles at once.
*/
@@ -289,11 +289,11 @@ class Render {
}
- static void RenderLonelyTriangles(GLUtessellatorImpl tess, com.sun.opengl.impl.glu.tessellator.GLUface f) {
+ static void RenderLonelyTriangles(GLUtessellatorImpl tess, com.jogamp.opengl.impl.glu.tessellator.GLUface f) {
/* Now we render all the separate triangles which could not be
* grouped into a triangle fan or strip.
*/
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e;
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge e;
int newState;
int edgeState = -1; /* force edge state output for first vertex */
@@ -323,7 +323,7 @@ class Render {
}
private static class RenderFan implements renderCallBack {
- public void render(GLUtessellatorImpl tess, com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e, long size) {
+ public void render(GLUtessellatorImpl tess, com.jogamp.opengl.impl.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
* (otherwise we've goofed up somewhere).
@@ -345,7 +345,7 @@ class Render {
}
private static class RenderStrip implements renderCallBack {
- public void render(GLUtessellatorImpl tess, com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e, long size) {
+ public void render(GLUtessellatorImpl tess, com.jogamp.opengl.impl.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
* (otherwise we've goofed up somewhere).
@@ -378,9 +378,9 @@ class Render {
* contour for each face marked "inside". The rendering output is
* provided as callbacks (see the api).
*/
- public static void __gl_renderBoundary(GLUtessellatorImpl tess, com.sun.opengl.impl.glu.tessellator.GLUmesh mesh) {
- com.sun.opengl.impl.glu.tessellator.GLUface f;
- com.sun.opengl.impl.glu.tessellator.GLUhalfEdge e;
+ public static void __gl_renderBoundary(GLUtessellatorImpl tess, com.jogamp.opengl.impl.glu.tessellator.GLUmesh mesh) {
+ com.jogamp.opengl.impl.glu.tessellator.GLUface f;
+ com.jogamp.opengl.impl.glu.tessellator.GLUhalfEdge e;
for (f = mesh.fHead.next; f != mesh.fHead; f = f.next) {
if (f.inside) {
@@ -409,7 +409,7 @@ class Render {
* are degenerate return 0; otherwise (no consistent orientation) return
* SIGN_INCONSISTENT.
*/ {
- com.sun.opengl.impl.glu.tessellator.CachedVertex[] v = tess.cache;
+ com.jogamp.opengl.impl.glu.tessellator.CachedVertex[] v = tess.cache;
// CachedVertex vn = v0 + tess.cacheCount;
int vn = tess.cacheCount;
// CachedVertex vc;
@@ -488,7 +488,7 @@ class Render {
* output is provided as callbacks (see the api).
*/
public static boolean __gl_renderCache(GLUtessellatorImpl tess) {
- com.sun.opengl.impl.glu.tessellator.CachedVertex[] v = tess.cache;
+ com.jogamp.opengl.impl.glu.tessellator.CachedVertex[] v = tess.cache;
// CachedVertex vn = v0 + tess.cacheCount;
int vn = tess.cacheCount;
// CachedVertex vc;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/Sweep.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/Sweep.java
index 105328d87..8ffeadb67 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/Sweep.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/Sweep.java
@@ -6,7 +6,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -50,7 +50,7 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package com.sun.opengl.impl.glu.tessellator;
+package com.jogamp.opengl.impl.glu.tessellator;
import javax.media.opengl.*;
import javax.media.opengl.glu.*;
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/TessMono.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/TessMono.java
index fe0f7946c..ef89b1613 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/TessMono.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/TessMono.java
@@ -6,7 +6,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -50,7 +50,7 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package com.sun.opengl.impl.glu.tessellator;
+package com.jogamp.opengl.impl.glu.tessellator;
class TessMono {
/* __gl_meshTessellateMonoRegion( face ) tessellates a monotone region
diff --git a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/TessState.java b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/TessState.java
index 9cf192529..a8aa41d9f 100644
--- a/src/jogl/classes/com/sun/opengl/impl/glu/tessellator/TessState.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/glu/tessellator/TessState.java
@@ -6,7 +6,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -50,7 +50,7 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package com.sun.opengl.impl.glu.tessellator;
+package com.jogamp.opengl.impl.glu.tessellator;
class TessState {
public static final int T_DORMANT = 0;
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java
index ef3e9f930..ebefaf466 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java
@@ -37,14 +37,14 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.macosx.cgl;
+package com.jogamp.opengl.impl.macosx.cgl;
import java.nio.*;
import java.util.*;
import javax.media.opengl.*;
import javax.media.nativewindow.*;
-import com.sun.opengl.impl.*;
-import com.sun.gluegen.runtime.ProcAddressTable;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.gluegen.runtime.ProcAddressTable;
public abstract class MacOSXCGLContext extends GLContextImpl
{
@@ -84,17 +84,17 @@ public abstract class MacOSXCGLContext extends GLContextImpl
return cglExtProcAddressTable;
}
- protected String mapToRealGLFunctionName(String glFunctionName)
- {
- return glFunctionName;
+ protected Map/*<String, String>*/ getFunctionNameMap() { return null; }
+
+ protected Map/*<String, String>*/ getExtensionNameMap() { return null; }
+
+ protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) {
+ return 0; // FIXME
}
-
- protected String mapToRealGLExtensionName(String glExtensionName)
- {
- return glExtensionName;
+
+ protected void destroyContextARBImpl(long _context) {
+ // FIXME
}
-
- protected abstract boolean create();
/**
* Creates and initializes an appropriate OpenGl nsContext. Should only be
@@ -156,27 +156,25 @@ public abstract class MacOSXCGLContext extends GLContextImpl
if (!CGL.makeCurrentContext(nsContext)) {
throw new GLException("Error making nsContext current");
}
- setGLFunctionAvailability(true);
+ setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
GLContextShareSet.contextCreated(this);
return true;
}
protected int makeCurrentImpl() throws GLException {
if (0 == cglContext && drawable.getNativeWindow().getSurfaceHandle() == 0) {
- if (DEBUG) {
- System.err.println("drawable not properly initialized");
- }
- return CONTEXT_NOT_CURRENT;
+ throw new GLException("drawable not properly initialized: "+drawable);
}
boolean created = false;
if ( 0 == cglContext && 0 == nsContext) {
- if (!create()) {
+ create();
+ created = 0 != cglContext || 0 != nsContext ;
+ if(!created) {
return CONTEXT_NOT_CURRENT;
}
if (DEBUG) {
System.err.println("!!! Created OpenGL context " + toHexString(nsContext) + " for " + getClass().getName());
}
- created = true;
}
if ( 0 != cglContext ) {
@@ -190,7 +188,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
if (created) {
- setGLFunctionAvailability(false);
+ setGLFunctionAvailability(false, -1, -1, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
return CONTEXT_CURRENT_NEW;
}
return CONTEXT_CURRENT;
@@ -257,7 +255,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
}
- protected void updateGLProcAddressTable() {
+ protected void updateGLProcAddressTable(int major, int minor, int ctp) {
if (DEBUG) {
System.err.println("!!! Initializing CGL extension address table");
}
@@ -267,7 +265,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
cglExtProcAddressTable = new CGLExtProcAddressTable();
}
resetProcAddressTable(getCGLExtProcAddressTable());
- super.updateGLProcAddressTable();
+ super.updateGLProcAddressTable(major, minor, ctp);
}
public String getPlatformExtensionsString()
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java
index b417668da..cf29d214b 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawable.java
@@ -37,12 +37,12 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.macosx.cgl;
+package com.jogamp.opengl.impl.macosx.cgl;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.gluegen.runtime.DynamicLookupHelper;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.common.os.DynamicLookupHelper;
public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
// The Java2D/OpenGL pipeline on OS X uses low-level CGLContextObjs
@@ -87,11 +87,8 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
if( NativeWindow.LOCK_SURFACE_NOT_READY == lockSurface() ) {
throw new GLException("Couldn't lock surface");
}
- try {
- // don't remove this block .. locking the surface is essential to update surface data
- } finally {
- unlockSurface();
- }
+ // locking the surface is essential to update surface data
+ unlockSurface();
}
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
index be18ee2da..d10434252 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -37,16 +37,16 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.macosx.cgl;
+package com.jogamp.opengl.impl.macosx.cgl;
-import java.lang.reflect.InvocationTargetException;
+import com.jogamp.common.os.DynamicLookupHelper;
import java.nio.*;
-import java.util.*;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.*;
-import com.sun.gluegen.runtime.DynamicLookupHelper;
+import com.jogamp.common.JogampRuntimeException;
+import com.jogamp.common.util.*;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.nativewindow.impl.NullWindow;
public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl implements DynamicLookupHelper {
public MacOSXCGLDrawableFactory() {
@@ -57,11 +57,14 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl implements D
new MacOSXCGLGraphicsConfigurationFactory();
try {
- NWReflection.createInstance("com.sun.opengl.impl.macosx.cgl.awt.MacOSXAWTCGLGraphicsConfigurationFactory",
+ ReflectionUtil.createInstance("com.jogamp.opengl.impl.macosx.cgl.awt.MacOSXAWTCGLGraphicsConfigurationFactory",
new Object[] {});
- } catch (Throwable t) { }
+ } catch (JogampRuntimeException jre) { /* n/a .. */ }
}
+ protected final GLDrawableImpl getSharedDrawable() { return null; }
+ protected final GLContextImpl getSharedContext() { return null; }
+
public GLDrawableImpl createOnscreenDrawable(NativeWindow target) {
if (target == null) {
throw new IllegalArgumentException("Null target");
@@ -73,7 +76,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl implements D
return new MacOSXOffscreenCGLDrawable(this, target);
}
- public boolean canCreateGLPbuffer() {
+ public boolean canCreateGLPbuffer(AbstractGraphicsDevice device) {
return true;
}
@@ -105,7 +108,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl implements D
return MacOSXExternalCGLContext.create(this, null);
}
- public boolean canCreateExternalGLDrawable() {
+ public boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) {
return false;
}
@@ -123,7 +126,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl implements D
return CGL.getProcAddress(glFuncName);
}
- public boolean canCreateContextOnJava2DSurface() {
+ public boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) {
return false;
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
index c94efc92b..889d1c333 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
@@ -33,13 +33,10 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.macosx.cgl;
+package com.jogamp.opengl.impl.macosx.cgl;
-import java.util.*;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.gluegen.runtime.NativeLibrary;
public class MacOSXCGLGraphicsConfiguration extends DefaultGraphicsConfiguration implements Cloneable {
long pixelformat;
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java
index 7c2c7b751..ada5fb1a7 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java
@@ -30,14 +30,14 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.opengl.impl.macosx.cgl;
+package com.jogamp.opengl.impl.macosx.cgl;
import javax.media.nativewindow.*;
import javax.media.nativewindow.macosx.*;
-import com.sun.nativewindow.impl.*;
+import com.jogamp.nativewindow.impl.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
/** Subclass of GraphicsConfigurationFactory used when non-AWT tookits
are used on OSX platforms. Toolkits will likely need to delegate
@@ -45,7 +45,7 @@ import com.sun.opengl.impl.*;
GraphicsDevice and GraphicsConfiguration abstractions. */
public class MacOSXCGLGraphicsConfigurationFactory extends GraphicsConfigurationFactory {
- protected static final boolean DEBUG = com.sun.opengl.impl.Debug.debug("GraphicsConfiguration");
+ protected static final boolean DEBUG = com.jogamp.opengl.impl.Debug.debug("GraphicsConfiguration");
public MacOSXCGLGraphicsConfigurationFactory() {
GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.macosx.MacOSXGraphicsDevice.class, this);
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java
index 0e468e5c5..eba3cf50e 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java
@@ -37,13 +37,13 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.macosx.cgl;
+package com.jogamp.opengl.impl.macosx.cgl;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
import javax.media.nativewindow.*;
-import com.sun.nativewindow.impl.NullWindow;
+import com.jogamp.nativewindow.impl.NullWindow;
public class MacOSXExternalCGLContext extends MacOSXCGLContext {
private boolean firstMakeCurrent = true;
@@ -56,7 +56,7 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext {
this.cglContext = cglContext;
this.nsContext = nsContext;
GLContextShareSet.contextCreated(this);
- setGLFunctionAvailability(false);
+ setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
getGLStateTracker().setEnabled(false); // external context usage can't track state in Java
}
@@ -110,8 +110,7 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext {
}
}
- protected boolean create() {
- return true;
+ protected void create() {
}
public int makeCurrent() throws GLException {
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOffscreenCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOffscreenCGLContext.java
index b60c48237..89e293665 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOffscreenCGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOffscreenCGLContext.java
@@ -37,10 +37,10 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.macosx.cgl;
+package com.jogamp.opengl.impl.macosx.cgl;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
public class MacOSXOffscreenCGLContext extends MacOSXPbufferCGLContext
{
@@ -51,7 +51,7 @@ public class MacOSXOffscreenCGLContext extends MacOSXPbufferCGLContext
public int getOffscreenContextPixelDataType() {
GL gl = getGL();
- return gl.isGL2()?GL2.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1;
+ return gl.isGL2GL3()?GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1;
}
public int getOffscreenContextReadBuffer() {
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java
index 3448b008a..adaa48f34 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOffscreenCGLDrawable.java
@@ -37,11 +37,11 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.macosx.cgl;
+package com.jogamp.opengl.impl.macosx.cgl;
import javax.media.opengl.*;
import javax.media.nativewindow.*;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
public class MacOSXOffscreenCGLDrawable extends MacOSXPbufferCGLDrawable {
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java
index 4a3e0a8eb..c4eaee489 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java
@@ -37,13 +37,13 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.macosx.cgl;
+package com.jogamp.opengl.impl.macosx.cgl;
import java.util.*;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
public class MacOSXOnscreenCGLContext extends MacOSXCGLContext {
protected MacOSXOnscreenCGLDrawable drawable;
@@ -115,8 +115,8 @@ public class MacOSXOnscreenCGLContext extends MacOSXCGLContext {
CGL.updateContext(nsContext);
}
- protected boolean create() {
- return create(false, false);
+ protected void create() {
+ create(false, false);
}
public void setOpenGLMode(int mode) {
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java
index 56951ae10..6ee023867 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLDrawable.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.macosx.cgl;
+package com.jogamp.opengl.impl.macosx.cgl;
import java.lang.ref.WeakReference;
import java.security.*;
@@ -45,7 +45,7 @@ import java.util.*;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
public class MacOSXOnscreenCGLDrawable extends MacOSXCGLDrawable {
private List/*<WeakReference<GLContext>>*/ createdContexts =
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
index 0754c4b57..52a892b70 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
@@ -1,11 +1,12 @@
-package com.sun.opengl.impl.macosx.cgl;
+package com.jogamp.opengl.impl.macosx.cgl;
+import com.jogamp.common.nio.PointerBuffer;
import java.security.*;
import java.util.*;
import javax.media.opengl.*;
import javax.media.nativewindow.*;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
protected MacOSXPbufferCGLDrawable drawable;
@@ -58,13 +59,14 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
boolean created = false;
if (nsContext == 0) {
- if (!create()) {
+ create();
+ created = 0 != nsContext ;
+ if(!created) {
return CONTEXT_NOT_CURRENT;
}
if (DEBUG) {
System.err.println("!!! Created OpenGL context " + toHexString(nsContext) + " for " + getClass().getName());
}
- created = true;
}
if (!impl.makeCurrent(nsContext)) {
@@ -72,13 +74,13 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
}
if (created) {
- setGLFunctionAvailability(false);
+ setGLFunctionAvailability(false, -1, -1, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
// Initialize render-to-texture support if requested
DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities();
GL gl = getGL();
- boolean rect = gl.isGL2() && capabilities.getPbufferRenderToTextureRectangle();
+ boolean rect = gl.isGL2GL3() && capabilities.getPbufferRenderToTextureRectangle();
if (rect) {
if (!gl.isExtensionAvailable("GL_EXT_texture_rectangle")) {
System.err.println("MacOSXPbufferCGLContext: WARNING: GL_EXT_texture_rectangle extension not " +
@@ -133,7 +135,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
return GLPbuffer.APPLE_FLOAT;
}
- protected boolean create() {
+ protected void create() {
DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities();
if (capabilities.getPbufferFloatingPointBuffers() &&
@@ -151,9 +153,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
if (!impl.makeCurrent(nsContext)) {
throw new GLException("Error making nsContext current");
}
- setGLFunctionAvailability(true);
-
- return true;
+ setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
}
//---------------------------------------------------------------------------
@@ -312,29 +312,29 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
}
// Use attribute array to select pixel format
- long[] fmt = new long[1];
+ PointerBuffer fmt = PointerBuffer.allocateDirect(1);
long[] numScreens = new long[1];
- int res = CGL.CGLChoosePixelFormat(attrs, 0, fmt, 0, numScreens, 0);
+ int res = CGL.CGLChoosePixelFormat(attrs, 0, fmt, numScreens, 0);
if (res != CGL.kCGLNoError) {
throw new GLException("Error code " + res + " while choosing pixel format");
}
// Create new context
- long[] ctx = new long[1];
+ PointerBuffer ctx = PointerBuffer.allocateDirect(1);
if (DEBUG) {
System.err.println("Share context for CGL-based pbuffer context is " + toHexString(share));
}
- res = CGL.CGLCreateContext(fmt[0], share, ctx, 0);
- CGL.CGLDestroyPixelFormat(fmt[0]);
+ res = CGL.CGLCreateContext(fmt.get(0), share, ctx);
+ CGL.CGLDestroyPixelFormat(fmt.get(0));
if (res != CGL.kCGLNoError) {
throw new GLException("Error code " + res + " while creating context");
}
// Attach newly-created context to the pbuffer
- res = CGL.CGLSetPBuffer(ctx[0], drawable.getPbuffer(), 0, 0, 0);
+ res = CGL.CGLSetPBuffer(ctx.get(0), drawable.getPbuffer(), 0, 0, 0);
if (res != CGL.kCGLNoError) {
throw new GLException("Error code " + res + " while attaching context to pbuffer");
}
- return ctx[0];
+ return ctx.get(0);
}
public boolean destroy(long ctx) {
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
index f57952b7c..afdc40dbb 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLDrawable.java
@@ -37,11 +37,12 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.macosx.cgl;
+package com.jogamp.opengl.impl.macosx.cgl;
+import com.jogamp.common.nio.PointerBuffer;
import javax.media.opengl.*;
import javax.media.nativewindow.*;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
private static final boolean DEBUG = Debug.debug("MacOSXPbufferCGLDrawable");
@@ -111,7 +112,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities();
GLProfile glProfile = capabilities.getGLProfile();
int renderTarget;
- if (glProfile.isGL2() && capabilities.getPbufferRenderToTextureRectangle()) {
+ if (glProfile.isGL2GL3() && capabilities.getPbufferRenderToTextureRectangle()) {
renderTarget = GL2.GL_TEXTURE_RECTANGLE;
} else {
int w = getNextPowerOf2(getWidth());
@@ -131,7 +132,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
throw new GLException("Floating-point support (GL_APPLE_float_pixels) not available");
}
*/
- if(glProfile.isGL2()) {
+ if(glProfile.isGL2GL3()) {
switch (capabilities.getRedBits()) {
case 16: internalFormat = GL2.GL_RGBA_FLOAT16_APPLE; break;
case 32: internalFormat = GL2.GL_RGBA_FLOAT32_APPLE; break;
@@ -232,12 +233,12 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable {
// CGL implementation
class CGLImpl implements Impl {
public long create(int renderTarget, int internalFormat, int width, int height) {
- long[] pbuffer = new long[1];
- int res = CGL.CGLCreatePBuffer(width, height, renderTarget, internalFormat, 0, pbuffer, 0);
+ PointerBuffer pbuffer = PointerBuffer.allocateDirect(1);
+ int res = CGL.CGLCreatePBuffer(width, height, renderTarget, internalFormat, 0, pbuffer);
if (res != CGL.kCGLNoError) {
throw new GLException("Error creating CGL-based pbuffer: error code " + res);
}
- return pbuffer[0];
+ return pbuffer.get(0);
}
public void destroy(long pbuffer) {
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLDrawableFactory.java
index d100ab442..eff01ca18 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLDrawableFactory.java
@@ -37,15 +37,16 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.macosx.cgl.awt;
+package com.jogamp.opengl.impl.macosx.cgl.awt;
import java.lang.reflect.InvocationTargetException;
import java.nio.*;
import java.util.*;
+import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.opengl.impl.awt.*;
-import com.sun.opengl.impl.macosx.cgl.*;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.opengl.impl.awt.*;
+import com.jogamp.opengl.impl.macosx.cgl.*;
public class MacOSXAWTCGLDrawableFactory extends MacOSXCGLDrawableFactory {
@@ -53,7 +54,7 @@ public class MacOSXAWTCGLDrawableFactory extends MacOSXCGLDrawableFactory {
super();
}
- public boolean canCreateContextOnJava2DSurface() {
+ public boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) {
return true;
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java
index 5e43eea49..0d59da32e 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java
@@ -30,7 +30,7 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.opengl.impl.macosx.cgl.awt;
+package com.jogamp.opengl.impl.macosx.cgl.awt;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
@@ -41,13 +41,13 @@ import javax.media.nativewindow.awt.*;
import javax.media.opengl.*;
import javax.media.opengl.awt.*;
-import com.sun.opengl.impl.*;
-import com.sun.opengl.impl.macosx.cgl.*;
-import com.sun.nativewindow.impl.jawt.*;
-import com.sun.nativewindow.impl.jawt.macosx.*;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.opengl.impl.macosx.cgl.*;
+import com.jogamp.nativewindow.impl.jawt.*;
+import com.jogamp.nativewindow.impl.jawt.macosx.*;
public class MacOSXAWTCGLGraphicsConfigurationFactory extends GraphicsConfigurationFactory {
- protected static final boolean DEBUG = com.sun.opengl.impl.Debug.debug("GraphicsConfiguration");
+ protected static final boolean DEBUG = com.jogamp.opengl.impl.Debug.debug("GraphicsConfiguration");
public MacOSXAWTCGLGraphicsConfigurationFactory() {
GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.awt.AWTGraphicsDevice.class, this);
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/awt/MacOSXJava2DCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXJava2DCGLContext.java
index 22b0ffe55..97a1435bc 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/awt/MacOSXJava2DCGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXJava2DCGLContext.java
@@ -37,15 +37,15 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.macosx.cgl.awt;
+package com.jogamp.opengl.impl.macosx.cgl.awt;
-import com.sun.opengl.impl.macosx.cgl.*;
+import com.jogamp.opengl.impl.macosx.cgl.*;
import java.awt.Graphics;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.opengl.impl.awt.*;
-import com.sun.opengl.impl.macosx.cgl.*;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.opengl.impl.awt.*;
+import com.jogamp.opengl.impl.macosx.cgl.*;
/** MacOSXCGLContext implementation supporting the Java2D/JOGL bridge
* on Mac OS X. The external GLDrawable mechanism does not work on Mac
@@ -73,7 +73,9 @@ public class MacOSXJava2DCGLContext extends MacOSXCGLContext implements Java2DGL
protected int makeCurrentImpl() throws GLException {
boolean created = false;
if (nsContext == 0) {
- if (!create()) {
+ create();
+ created = 0 != nsContext ;
+ if(!created) {
return CONTEXT_NOT_CURRENT;
}
if (DEBUG) {
@@ -87,13 +89,13 @@ public class MacOSXJava2DCGLContext extends MacOSXCGLContext implements Java2DGL
}
if (created) {
- setGLFunctionAvailability(false);
+ setGLFunctionAvailability(false, -1, -1, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
return CONTEXT_CURRENT_NEW;
}
return CONTEXT_CURRENT;
}
- protected boolean create() {
+ protected void create() {
// Find and configure share context
MacOSXCGLContext other = (MacOSXCGLContext) GLContextShareSet.getShareContext(this);
long share = 0;
@@ -119,11 +121,10 @@ public class MacOSXJava2DCGLContext extends MacOSXCGLContext implements Java2DGL
long ctx = Java2D.createOGLContextOnSurface(graphics, share);
if (ctx == 0) {
- return false;
+ return;
}
// FIXME: think about GLContext sharing
nsContext = ctx;
- return true;
}
protected void releaseImpl() throws GLException {
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java
index f1e9483cd..87a37da04 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsDummyWGLDrawable.java
@@ -37,17 +37,17 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.windows.wgl;
+package com.jogamp.opengl.impl.windows.wgl;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.NullWindow;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.nativewindow.impl.NullWindow;
public class WindowsDummyWGLDrawable extends WindowsWGLDrawable {
private long hwnd, hdc;
- public WindowsDummyWGLDrawable(GLDrawableFactory factory) {
- super(factory, new NullWindow(WindowsWGLGraphicsConfigurationFactory.createDefaultGraphicsConfiguration(null, true, true)), true);
+ public WindowsDummyWGLDrawable(GLDrawableFactory factory, GLProfile glp) {
+ super(factory, new NullWindow(WindowsWGLGraphicsConfigurationFactory.createDefaultGraphicsConfiguration(glp, null, true, true)), true);
// All entries to CreateDummyWindow must synchronize on one object
// to avoid accidentally registering the dummy window class twice
synchronized (WindowsDummyWGLDrawable.class) {
@@ -56,8 +56,9 @@ public class WindowsDummyWGLDrawable extends WindowsWGLDrawable {
hdc = WGL.GetDC(hwnd);
NullWindow nw = (NullWindow) getNativeWindow();
nw.setSurfaceHandle(hdc);
+ WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)nw.getGraphicsConfiguration().getNativeGraphicsConfiguration();
// Choose a (hopefully hardware-accelerated) OpenGL pixel format for this device context
- GLCapabilities caps = new GLCapabilities(null);
+ GLCapabilities caps = (GLCapabilities) config.getChosenCapabilities();
caps.setDepthBits(16);
PIXELFORMATDESCRIPTOR pfd = WindowsWGLGraphicsConfiguration.GLCapabilities2PFD(caps);
int pixelFormat = WGL.ChoosePixelFormat(hdc, pfd);
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java
index b433b6b38..e712d8568 100755
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java
@@ -37,14 +37,12 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.windows.wgl;
+package com.jogamp.opengl.impl.windows.wgl;
-import java.nio.*;
-import java.util.*;
import javax.media.opengl.*;
import javax.media.nativewindow.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.NullWindow;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.nativewindow.impl.NullWindow;
public class WindowsExternalWGLContext extends WindowsWGLContext {
private boolean firstMakeCurrent = true;
@@ -53,12 +51,12 @@ public class WindowsExternalWGLContext extends WindowsWGLContext {
private WindowsExternalWGLContext(Drawable drawable, long hglrc, WindowsWGLGraphicsConfiguration cfg) {
super(drawable, null);
- this.hglrc = hglrc;
+ this.context = hglrc;
if (DEBUG) {
System.err.println(getThreadName() + ": !!! Created external OpenGL context " + toHexString(hglrc) + " for " + this);
}
GLContextShareSet.contextCreated(this);
- setGLFunctionAvailability(false);
+ setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
cfg.updateCapabilitiesByWGL(this);
getGLStateTracker().setEnabled(false); // external context usage can't track state in Java
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java
index 9b87afc38..74db45932 100755
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java
@@ -37,12 +37,12 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.windows.wgl;
+package com.jogamp.opengl.impl.windows.wgl;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.NullWindow;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.nativewindow.impl.NullWindow;
public class WindowsExternalWGLDrawable extends WindowsWGLDrawable {
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLContext.java
index 9f0a5d2a6..25d93b50e 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLContext.java
@@ -37,10 +37,10 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.windows.wgl;
+package com.jogamp.opengl.impl.windows.wgl;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
public class WindowsOffscreenWGLContext extends WindowsWGLContext {
public WindowsOffscreenWGLContext(WindowsOffscreenWGLDrawable drawable,
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java
index cd0491867..bf466d455 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOffscreenWGLDrawable.java
@@ -37,12 +37,12 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.windows.wgl;
+package com.jogamp.opengl.impl.windows.wgl;
import javax.media.opengl.*;
import javax.media.nativewindow.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.NullWindow;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.nativewindow.impl.NullWindow;
public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable {
private long origbitmap;
@@ -99,7 +99,7 @@ public class WindowsOffscreenWGLDrawable extends WindowsWGLDrawable {
}
((SurfaceChangeable)nw).setSurfaceHandle(hdc);
- hbitmap = WGL.CreateDIBSection(hdc, info, WGL.DIB_RGB_COLORS, 0, 0, 0);
+ hbitmap = WGL.CreateDIBSection(hdc, info, WGL.DIB_RGB_COLORS, null, 0, 0);
if (hbitmap == 0) {
WGL.DeleteDC(hdc);
hdc = 0;
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java
index 2261f7742..aeb13110e 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java
@@ -37,13 +37,13 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.windows.wgl;
+package com.jogamp.opengl.impl.windows.wgl;
import java.util.*;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
public class WindowsOnscreenWGLContext extends WindowsWGLContext {
protected WindowsOnscreenWGLDrawable drawable;
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOnscreenWGLDrawable.java
index 395ccf7d2..401b8c3c6 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsOnscreenWGLDrawable.java
@@ -37,11 +37,11 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.windows.wgl;
+package com.jogamp.opengl.impl.windows.wgl;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
public class WindowsOnscreenWGLDrawable extends WindowsWGLDrawable {
protected WindowsOnscreenWGLDrawable(GLDrawableFactory factory, NativeWindow component) {
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java
index 9c492e244..a9e02e11f 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLContext.java
@@ -37,10 +37,10 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.windows.wgl;
+package com.jogamp.opengl.impl.windows.wgl;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
public class WindowsPbufferWGLContext extends WindowsWGLContext {
private static final boolean DEBUG = Debug.debug("WindowsPbufferWGLContext");
@@ -101,7 +101,7 @@ public class WindowsPbufferWGLContext extends WindowsWGLContext {
// Initialize render-to-texture support if requested
GL gl = getGL();
rtt = capabilities.getPbufferRenderToTexture();
- rect = gl.isGL2() && capabilities.getPbufferRenderToTextureRectangle();
+ rect = gl.isGL2GL3() && capabilities.getPbufferRenderToTextureRectangle();
if (rtt) {
if (DEBUG) {
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java
index c324b1ce1..c7034e93b 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java
@@ -37,11 +37,11 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.windows.wgl;
+package com.jogamp.opengl.impl.windows.wgl;
import javax.media.opengl.*;
import javax.media.nativewindow.*;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable {
private long cachedParentHdc;
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java
index 497e9f03b..0f1f9813f 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLContext.java
@@ -37,14 +37,14 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.windows.wgl;
+package com.jogamp.opengl.impl.windows.wgl;
import java.nio.*;
import java.util.*;
import javax.media.opengl.*;
import javax.media.nativewindow.*;
-import com.sun.opengl.impl.*;
-import com.sun.gluegen.runtime.ProcAddressTable;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.gluegen.runtime.ProcAddressTable;
public class WindowsWGLContext extends GLContextImpl {
protected long hglrc;
@@ -118,20 +118,77 @@ public class WindowsWGLContext extends GLContextImpl {
return wglExtProcAddressTable;
}
- protected String mapToRealGLFunctionName(String glFunctionName) {
- String lookup = (String) functionNameMap.get(glFunctionName);
- if (lookup != null) {
- return lookup;
- }
- return glFunctionName;
+ protected Map/*<String, String>*/ getFunctionNameMap() { return functionNameMap; }
+
+ protected Map/*<String, String>*/ getExtensionNameMap() { return extensionNameMap; }
+
+ protected void destroyContextARBImpl(long context) {
+ WGL.wglMakeCurrent(0, 0);
+ WGL.wglDeleteContext(context);
}
- protected String mapToRealGLExtensionName(String glExtensionName) {
- String lookup = (String) extensionNameMap.get(glExtensionName);
- if (lookup != null) {
- return lookup;
+ protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) {
+ WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory)drawable.getFactoryImpl();
+ WGLExt wglExt;
+ if(null==factory.getSharedContext()) {
+ wglExt = getWGLExt();
+ } else {
+ wglExt = ((WindowsWGLContext)factory.getSharedContext()).getWGLExt();
+ }
+
+ boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ;
+ boolean ctFwdCompat = 0 != ( CTX_OPTION_FORWARD & ctp ) ;
+ boolean ctDebug = 0 != ( CTX_OPTION_DEBUG & ctp ) ;
+
+ long _context=0;
+
+ int attribs[] = {
+ /* 0 */ WGLExt.WGL_CONTEXT_MAJOR_VERSION_ARB, major,
+ /* 2 */ WGLExt.WGL_CONTEXT_MINOR_VERSION_ARB, minor,
+ /* 4 */ WGLExt.WGL_CONTEXT_LAYER_PLANE_ARB, WGLExt.WGL_CONTEXT_LAYER_PLANE_ARB, // default
+ /* 6 */ WGLExt.WGL_CONTEXT_FLAGS_ARB, 0,
+ /* 8 */ 0, 0,
+ /* 10 */ 0
+ };
+
+ if ( major > 3 || major == 3 && minor >= 2 ) {
+ // FIXME: Verify with a None drawable binding (default framebuffer)
+ attribs[8+0] = WGLExt.WGL_CONTEXT_PROFILE_MASK_ARB;
+ if( ctBwdCompat ) {
+ attribs[8+1] = WGLExt.WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
+ } else {
+ attribs[8+1] = WGLExt.WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
+ }
+ }
+
+ if ( major >= 3 ) {
+ if( !ctBwdCompat && ctFwdCompat ) {
+ attribs[6+1] |= WGLExt.WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
+ }
+ if( ctDebug) {
+ attribs[6+1] |= WGLExt.WGL_CONTEXT_DEBUG_BIT_ARB;
+ }
+ }
+
+ _context = wglExt.wglCreateContextAttribsARB(drawable.getNativeWindow().getSurfaceHandle(), share, attribs, 0);
+ if(0==_context) {
+ if(DEBUG) {
+ System.err.println("WindowsWGLContext.createContextARB couldn't create "+getGLVersion(null, major, minor, ctp, "@creation"));
+ }
+ } else {
+ // In contrast to GLX no verification with a drawable binding, ie default framebuffer, is necessary,
+ // if no 3.2 is available creation fails already!
+ // Nevertheless .. we do it ..
+ if (!WGL.wglMakeCurrent(drawable.getNativeWindow().getSurfaceHandle(), _context)) {
+ if(DEBUG) {
+ System.err.println("WindowsWGLContext.createContextARB couldn't make current "+getGLVersion(null, major, minor, ctp, "@creation"));
+ }
+ WGL.wglMakeCurrent(0, 0);
+ WGL.wglDeleteContext(_context);
+ _context = 0;
+ }
}
- return glExtensionName;
+ return _context;
}
/**
@@ -139,39 +196,54 @@ public class WindowsWGLContext extends GLContextImpl {
* called by {@link #makeCurrentImpl()}.
*/
protected void create() {
- GLCapabilities glCaps = drawable.getChosenGLCapabilities();
- if(DEBUG) {
- System.err.println("WindowsWGLContext.create got "+glCaps);
+ if(0!=context) {
+ throw new GLException("context is not null: "+context);
}
+ WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory)drawable.getFactoryImpl();
+ GLCapabilities glCaps = drawable.getChosenGLCapabilities();
if (drawable.getNativeWindow().getSurfaceHandle() == 0) {
throw new GLException("Internal error: attempted to create OpenGL context without an associated drawable");
}
// Windows can set up sharing of display lists after creation time
WindowsWGLContext other = (WindowsWGLContext) GLContextShareSet.getShareContext(this);
- long hglrc2 = 0;
+ long share = 0;
if (other != null) {
- hglrc2 = other.getHGLRC();
- if (hglrc2 == 0) {
+ share = other.getHGLRC();
+ if (share == 0) {
throw new GLException("GLContextShareSet returned an invalid OpenGL context");
}
}
- // To use WGL_ARB_create_context, we have to make a temp context current,
- // so we are able to use GetProcAddress
- long temp_hglrc = WGL.wglCreateContext(drawable.getNativeWindow().getSurfaceHandle());
- if (DEBUG) {
- System.err.println(getThreadName() + ": !!! Created temp OpenGL context " + toHexString(temp_hglrc) + " for " + this + ", device context " + toHexString(drawable.getNativeWindow().getSurfaceHandle()) + ", not yet sharing");
+ int minor[] = new int[1];
+ int major[] = new int[1];
+ int ctp[] = new int[1];
+ boolean createContextARBTried = false;
+
+ // utilize the shared context's GLXExt in case it was using the ARB method and it already exists
+ if(null!=factory.getSharedContext() && factory.getSharedContext().isCreatedWithARBMethod()) {
+ if(DEBUG) {
+ System.err.println("WindowsWGLContext.createContext using shared Context: "+factory.getSharedContext());
+ }
+ hglrc = createContextARB(share, true, major, minor, ctp);
+ createContextARBTried = true;
}
- if (temp_hglrc == 0) {
- throw new GLException("Unable to create temp OpenGL context for device context " + toHexString(drawable.getNativeWindow().getSurfaceHandle()));
- } else {
+
+ long temp_hglrc = 0;
+ if(0==hglrc) {
+ // To use WGL_ARB_create_context, we have to make a temp context current,
+ // so we are able to use GetProcAddress
+ temp_hglrc = WGL.wglCreateContext(drawable.getNativeWindow().getSurfaceHandle());
+ if (temp_hglrc == 0) {
+ throw new GLException("Unable to create temp OpenGL context for device context " + toHexString(drawable.getNativeWindow().getSurfaceHandle()));
+ }
if (!WGL.wglMakeCurrent(drawable.getNativeWindow().getSurfaceHandle(), temp_hglrc)) {
throw new GLException("Error making temp context current: 0x" + Integer.toHexString(WGL.GetLastError()));
}
- setGLFunctionAvailability(true);
+ setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
- if( !isFunctionAvailable("wglCreateContextAttribsARB") ||
+ if( createContextARBTried ||
+ !isFunctionAvailable("wglCreateContextAttribsARB") ||
!isExtensionAvailable("WGL_ARB_create_context") ) {
if(glCaps.getGLProfile().isGL3()) {
WGL.wglMakeCurrent(0, 0);
@@ -181,132 +253,66 @@ public class WindowsWGLContext extends GLContextImpl {
// continue with temp context for GL < 3.0
hglrc = temp_hglrc;
- if(DEBUG) {
- System.err.println("WindowsWGLContext.create done (old ctx < 3.0 - no WGL_ARB_create_context) 0x"+Long.toHexString(hglrc));
- }
- } else {
- WGLExt wglExt = getWGLExt();
+ return;
+ }
+ hglrc = createContextARB(share, true, major, minor, ctp);
+ createContextARBTried=true;
+ }
+
+ if(0!=hglrc) {
+ share = 0; // mark as shared ..
- // preset with default values
- int attribs[] = {
- /* 0 */ WGLExt.WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
- /* 2 */ WGLExt.WGL_CONTEXT_MINOR_VERSION_ARB, 0,
- /* 4 */ WGLExt.WGL_CONTEXT_FLAGS_ARB, 0 /* WGLExt.WGL_CONTEXT_DEBUG_BIT_ARB */,
- /* 6 */ 0, 0,
- /* 8 */ 0
- };
+ WGL.wglMakeCurrent(0, 0);
+ WGL.wglDeleteContext(temp_hglrc);
- if(glCaps.getGLProfile().isGL3()) {
- // Try >= 3.2 core first !
- // In contrast to GLX no verify with a None drawable binding (default framebuffer) is necessary,
- // if no 3.2 is available creation fails already!
- attribs[0+1] = 3;
- attribs[2+1] = 2;
- if(glCaps.getGLProfile().isGL3bc()) {
- attribs[6+0] = WGLExt.WGL_CONTEXT_PROFILE_MASK_ARB;
- attribs[6+1] = WGLExt.WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
- }
- /**
- * don't stricten requirements any further, even compatible would be fine
- *
- } else {
- attribs[6+0] = WGLExt.WGL_CONTEXT_PROFILE_MASK_ARB;
- attribs[6+1] = WGLExt.WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
- }
- */
- hglrc = wglExt.wglCreateContextAttribsARB(drawable.getNativeWindow().getSurfaceHandle(), hglrc2, attribs, 0);
- if(0==hglrc) {
- if(DEBUG) {
- System.err.println("WindowsWGLContext.createContext couldn't create >= 3.2 core context - fallback");
- }
- // Try >= 3.1 forward compatible - last resort for GL3 !
- attribs[0+1] = 3;
- attribs[2+1] = 1;
- if(!glCaps.getGLProfile().isGL3bc()) {
- attribs[4+1] |= WGLExt.WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
- }
- attribs[6+0] = 0;
- attribs[6+1] = 0;
- } else if(DEBUG) {
- System.err.println("WindowsWGLContext.createContext >= 3.2 available 0x"+Long.toHexString(hglrc));
- }
- }
- if(0==hglrc) {
- // 3.1 or 3.0 ..
- hglrc = wglExt.wglCreateContextAttribsARB(drawable.getNativeWindow().getSurfaceHandle(), hglrc2, attribs, 0);
- if(DEBUG) {
- if(0==hglrc) {
- System.err.println("WindowsWGLContext.createContext couldn't create >= 3.0 context - fallback");
- } else {
- System.err.println("WindowsWGLContext.createContext >= 3.0 available 0x"+Long.toHexString(hglrc));
- }
- }
- }
+ if (!wglMakeContextCurrent(drawable.getNativeWindow().getSurfaceHandle(), drawableRead.getNativeWindow().getSurfaceHandle(), hglrc)) {
+ throw new GLException("Cannot make previous verified context current: 0x" + Integer.toHexString(WGL.GetLastError()));
+ }
+ } else {
+ if(glCaps.getGLProfile().isGL3()) {
+ WGL.wglMakeCurrent(0, 0);
+ WGL.wglDeleteContext(temp_hglrc);
+ throw new GLException("WindowsWGLContext.createContext failed, but context > GL2 requested "+getGLVersion(null, major[0], minor[0], ctp[0], "@creation")+", ");
+ }
+ if(DEBUG) {
+ System.err.println("WindowsWGLContext.createContext failed, fall back to !ARB context "+getGLVersion(null, major[0], minor[0], ctp[0], "@creation"));
+ }
- if(0==hglrc) {
- if(glCaps.getGLProfile().isGL3()) {
- WGL.wglMakeCurrent(0, 0);
- WGL.wglDeleteContext(temp_hglrc);
- throw new GLException("Unable to create OpenGL >= 3.1 context (have WGL_ARB_create_context)");
- }
-
- // continue with temp context for GL < 3.0
- hglrc = temp_hglrc;
- if (!WGL.wglMakeCurrent(drawable.getNativeWindow().getSurfaceHandle(), hglrc)) {
- throw new GLException("Error making old context current: 0x" + Integer.toHexString(WGL.GetLastError()));
- }
- updateGLProcAddressTable();
- if(DEBUG) {
- System.err.println("WindowsWGLContext.create done (old ctx < 3.0 - no 3.0) 0x"+Long.toHexString(hglrc));
- }
- } else {
- hglrc2 = 0; // mark as shared ..
- WGL.wglMakeCurrent(0, 0);
- WGL.wglDeleteContext(temp_hglrc);
-
- if (!WGL.wglMakeCurrent(drawable.getNativeWindow().getSurfaceHandle(), hglrc)) {
- throw new GLException("Error making new context current: 0x" + Integer.toHexString(WGL.GetLastError()));
- }
- updateGLProcAddressTable();
- if(DEBUG) {
- System.err.println("WindowsWGLContext.create done (new ctx >= 3.0) 0x"+Long.toHexString(hglrc));
- }
- }
+ // continue with temp context for GL < 3.0
+ hglrc = temp_hglrc;
+ if (!wglMakeContextCurrent(drawable.getNativeWindow().getSurfaceHandle(), drawableRead.getNativeWindow().getSurfaceHandle(), hglrc)) {
+ WGL.wglMakeCurrent(0, 0);
+ WGL.wglDeleteContext(hglrc);
+ throw new GLException("Error making old context current: 0x" + Integer.toHexString(WGL.GetLastError()));
}
}
- if(0!=hglrc2) {
- if (!WGL.wglShareLists(hglrc2, hglrc)) {
- throw new GLException("wglShareLists(" + toHexString(hglrc2) +
+
+ if(0!=share) {
+ if (!WGL.wglShareLists(share, hglrc)) {
+ throw new GLException("wglShareLists(" + toHexString(share) +
", " + toHexString(hglrc) + ") failed: error code 0x" +
Integer.toHexString(WGL.GetLastError()));
}
}
GLContextShareSet.contextCreated(this);
- WGL.wglMakeCurrent(0, 0); // release immediatly to gain from ARB/EXT wglMakeContextCurrent(draw, read, ctx)!
- if (DEBUG) {
- System.err.println(getThreadName() + ": !!! Created OpenGL context " + toHexString(hglrc) + " for " + this + ", device context " + toHexString(drawable.getNativeWindow().getSurfaceHandle()) + ", sharing with " + toHexString(hglrc2));
- }
}
protected int makeCurrentImpl() throws GLException {
if (drawable.getNativeWindow().getSurfaceHandle() == 0) {
- if (DEBUG) {
- System.err.println("drawable not properly initialized");
- }
- return CONTEXT_NOT_CURRENT;
+ throw new GLException("drawable not properly initialized: "+drawable);
}
boolean created = false;
if (hglrc == 0) {
create();
+ created = true;
if (DEBUG) {
System.err.println(getThreadName() + ": !!! Created GL context for " + getClass().getName());
}
- created = true;
}
if (WGL.wglGetCurrentContext() != hglrc) {
if (!wglMakeContextCurrent(drawable.getNativeWindow().getSurfaceHandle(), drawableRead.getNativeWindow().getSurfaceHandle(), hglrc)) {
- throw new GLException("Error making context current: 0x" + Integer.toHexString(WGL.GetLastError()));
+ throw new GLException("Error making context current: 0x" + Integer.toHexString(WGL.GetLastError()) + ", " + this);
} else {
if (DEBUG && VERBOSE) {
System.err.println(getThreadName() + ": wglMakeCurrent(hdc " + toHexString(drawable.getNativeWindow().getSurfaceHandle()) +
@@ -316,7 +322,7 @@ public class WindowsWGLContext extends GLContextImpl {
}
if (created) {
- setGLFunctionAvailability(false);
+ setGLFunctionAvailability(false, -1, -1, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
WindowsWGLGraphicsConfiguration config =
(WindowsWGLGraphicsConfiguration)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
@@ -365,7 +371,7 @@ public class WindowsWGLContext extends GLContextImpl {
}
}
- protected void updateGLProcAddressTable() {
+ protected void updateGLProcAddressTable(int major, int minor, int ctp) {
if (DEBUG) {
System.err.println(getThreadName() + ": !!! Initializing WGL extension address table for " + this);
}
@@ -381,7 +387,7 @@ public class WindowsWGLContext extends GLContextImpl {
wglExtProcAddressTable = new WGLExtProcAddressTable();
}
resetProcAddressTable(getWGLExtProcAddressTable());
- super.updateGLProcAddressTable();
+ super.updateGLProcAddressTable(major, minor, ctp);
}
public String getPlatformExtensionsString() {
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java
index 91604d18e..43c1ff5e0 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawable.java
@@ -37,12 +37,12 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.windows.wgl;
+package com.jogamp.opengl.impl.windows.wgl;
+import com.jogamp.common.os.DynamicLookupHelper;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.gluegen.runtime.DynamicLookupHelper;
+import com.jogamp.opengl.impl.*;
public abstract class WindowsWGLDrawable extends GLDrawableImpl {
private static final int MAX_SET_PIXEL_FORMAT_FAIL_COUNT = 5;
@@ -83,14 +83,14 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl {
protected void swapBuffersImpl() {
boolean didLock = false;
- try {
- if ( !isSurfaceLocked() ) {
- // Usually the surface shall be locked within [makeCurrent .. swap .. release]
- if (lockSurface() == NativeWindow.LOCK_SURFACE_NOT_READY) {
- return;
- }
- didLock = true;
+ if ( !isSurfaceLocked() ) {
+ // Usually the surface shall be locked within [makeCurrent .. swap .. release]
+ if (lockSurface() == NativeWindow.LOCK_SURFACE_NOT_READY) {
+ return;
}
+ didLock = true;
+ }
+ try {
long startTime = 0;
if (PROFILING) {
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
index e37179191..a4bf89b81 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -37,16 +37,18 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.windows.wgl;
+package com.jogamp.opengl.impl.windows.wgl;
+import com.jogamp.common.os.DynamicLookupHelper;
import java.nio.*;
import java.util.*;
import javax.media.nativewindow.*;
+import javax.media.nativewindow.windows.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.NWReflection;
-import com.sun.gluegen.runtime.DynamicLookupHelper;
-import com.sun.nativewindow.impl.NullWindow;
+import com.jogamp.common.JogampRuntimeException;
+import com.jogamp.common.util.*;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.nativewindow.impl.NullWindow;
public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements DynamicLookupHelper {
private static final boolean VERBOSE = Debug.verbose();
@@ -65,14 +67,59 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
// The act of constructing them causes them to be registered
new WindowsWGLGraphicsConfigurationFactory();
try {
- NWReflection.createInstance("com.sun.opengl.impl.windows.wgl.awt.WindowsAWTWGLGraphicsConfigurationFactory",
+ ReflectionUtil.createInstance("com.jogamp.opengl.impl.windows.wgl.awt.WindowsAWTWGLGraphicsConfigurationFactory",
new Object[] {});
- } catch (Throwable t) { }
+ } catch (JogampRuntimeException jre) { /* n/a .. */ }
loadOpenGL32Library();
+
+ sharedDrawable = new WindowsDummyWGLDrawable(this, null);
+ WindowsWGLContext ctx = (WindowsWGLContext) sharedDrawable.createContext(null);
+ ctx.makeCurrent();
+ canCreateGLPbuffer = ctx.getGL().isExtensionAvailable("GL_ARB_pbuffer");
+ ctx.release();
+ sharedContext = ctx;
+ if(null==sharedContext) {
+ throw new GLException("Couldn't init shared resources");
+ }
+ if (DEBUG) {
+ System.err.println("!!! SharedContext: "+sharedContext+", pbuffer supported "+canCreateGLPbuffer);
+ }
+ }
+
+ WindowsDummyWGLDrawable sharedDrawable=null;
+ WindowsWGLContext sharedContext=null;
+ boolean canCreateGLPbuffer = false;
+
+ protected final GLDrawableImpl getSharedDrawable() {
+ validate();
+ return sharedDrawable;
+ }
+
+ protected final GLContextImpl getSharedContext() {
+ validate();
+ return sharedContext;
+ }
+
+ public void shutdown() {
+ super.shutdown();
+ if (DEBUG) {
+ System.err.println("!!! Shutdown Shared:");
+ System.err.println("!!! CTX : "+sharedContext);
+ System.err.println("!!! Drawable: "+sharedDrawable);
+ Exception e = new Exception("Debug");
+ e.printStackTrace();
+ }
+ if(null!=sharedContext) {
+ sharedContext.destroy(); // implies release, if current
+ }
+ if(null!=sharedDrawable) {
+ sharedDrawable.destroy();
+ }
}
public GLDrawableImpl createOnscreenDrawable(NativeWindow target) {
+ validate();
if (target == null) {
throw new IllegalArgumentException("Null target");
}
@@ -80,66 +127,42 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
}
protected GLDrawableImpl createOffscreenDrawable(NativeWindow target) {
+ validate();
+ if (target == null) {
+ throw new IllegalArgumentException("Null target");
+ }
return new WindowsOffscreenWGLDrawable(this, target);
}
- private boolean pbufferSupportInitialized = false;
- private boolean canCreateGLPbuffer = false;
- public boolean canCreateGLPbuffer() {
- if (!pbufferSupportInitialized) {
- final GLDrawableFactory factory = this;
- Runnable r = new Runnable() {
- public void run() {
- WindowsDummyWGLDrawable dummyDrawable = new WindowsDummyWGLDrawable(factory);
- GLContext dummyContext = dummyDrawable.createContext(null);
- if (dummyContext != null) {
- GLContext lastContext = GLContext.getCurrent();
- if (lastContext != null) {
- lastContext.release();
- }
- dummyContext.makeCurrent();
- GL dummyGL = dummyContext.getGL();
- canCreateGLPbuffer = dummyGL.isExtensionAvailable("GL_ARB_pbuffer");
- pbufferSupportInitialized = true;
- dummyContext.release();
- dummyContext.destroy();
- dummyDrawable.destroy();
- if (lastContext != null) {
- lastContext.makeCurrent();
- }
- }
- }
- };
- maybeDoSingleThreadedWorkaround(r);
- }
- if (DEBUG) {
- System.err.println("WindowsWGLDrawableFactory.canCreateGLPbuffer() = " + canCreateGLPbuffer);
- }
+ public boolean canCreateGLPbuffer(AbstractGraphicsDevice device) {
+ validate();
return canCreateGLPbuffer;
}
protected GLDrawableImpl createGLPbufferDrawableImpl(final NativeWindow target) {
+ validate();
+ if (target == null) {
+ throw new IllegalArgumentException("Null target");
+ }
final List returnList = new ArrayList();
final GLDrawableFactory factory = this;
+ final WindowsWGLContext _sharedContext = sharedContext;
+ final WindowsDummyWGLDrawable _sharedDrawable = sharedDrawable;
Runnable r = new Runnable() {
public void run() {
- WindowsDummyWGLDrawable dummyDrawable = new WindowsDummyWGLDrawable(factory);
- WindowsWGLContext dummyContext = (WindowsWGLContext) dummyDrawable.createContext(null);
GLContext lastContext = GLContext.getCurrent();
if (lastContext != null) {
lastContext.release();
}
- dummyContext.makeCurrent();
- WGLExt dummyWGLExt = dummyContext.getWGLExt();
+ _sharedContext.makeCurrent();
+ WGLExt wglExt = _sharedContext.getWGLExt();
try {
GLDrawableImpl pbufferDrawable = new WindowsPbufferWGLDrawable(factory, target,
- dummyDrawable,
- dummyWGLExt);
+ _sharedDrawable,
+ wglExt);
returnList.add(pbufferDrawable);
- dummyContext.release();
- dummyContext.destroy();
- dummyDrawable.destroy();
} finally {
+ _sharedContext.release();
if (lastContext != null) {
lastContext.makeCurrent();
}
@@ -151,6 +174,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
}
protected NativeWindow createOffscreenWindow(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) {
+ validate();
AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault();
NullWindow nw = new NullWindow(WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(
capabilities, chooser, screen) );
@@ -159,18 +183,22 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
}
public GLContext createExternalGLContext() {
+ validate();
return WindowsExternalWGLContext.create(this, null);
}
- public boolean canCreateExternalGLDrawable() {
+ public boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) {
+ validate();
return true;
}
public GLDrawable createExternalGLDrawable() {
+ validate();
return WindowsExternalWGLDrawable.create(this, null);
}
public void loadOpenGL32Library() {
+ validate();
if (hopengl32 == 0) {
hopengl32 = WGL.LoadLibraryA("OpenGL32");
if (DEBUG) {
@@ -182,6 +210,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
}
public void loadGLULibrary() {
+ validate();
if (hglu32 == 0) {
hglu32 = WGL.LoadLibraryA("GLU32");
if (hglu32 == 0) {
@@ -191,6 +220,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
}
public long dynamicLookupFunction(String glFuncName) {
+ validate();
long res = WGL.wglGetProcAddress(glFuncName);
if (res == 0) {
// It may happen that a driver doesn't return the OpenGL32 core function pointer
@@ -222,12 +252,14 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl implements
return detail;
}
- public boolean canCreateContextOnJava2DSurface() {
+ public boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) {
+ validate();
return false;
}
public GLContext createContextOnJava2DSurface(Object graphics, GLContext shareWith)
throws GLException {
+ validate();
throw new GLException("Unimplemented on this platform");
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java
index d6ea21b15..aed4012a4 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java
@@ -30,17 +30,15 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.opengl.impl.windows.wgl;
+package com.jogamp.opengl.impl.windows.wgl;
-import java.util.*;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.gluegen.runtime.NativeLibrary;
+import com.jogamp.opengl.impl.*;
public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguration implements Cloneable {
// Keep this under the same debug flag as the drawable factory for convenience
- protected static final boolean DEBUG = com.sun.opengl.impl.Debug.debug("GraphicsConfiguration");
+ protected static final boolean DEBUG = com.jogamp.opengl.impl.Debug.debug("GraphicsConfiguration");
protected static final int MAX_PFORMATS = 256;
protected static final int MAX_ATTRIBS = 256;
@@ -414,14 +412,16 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
if ( onscreen ) {
res = ( 0 != (val & WINDOW_BIT) ) ;
} else {
- res = ( 0 != (val & BITMAP_BIT) ) || usePBuffer ;
- }
- if ( usePBuffer ) {
- res = res && ( 0 != (val & PBUFFER_BIT) ) ;
+ if ( usePBuffer ) {
+ res = ( 0 != (val & PBUFFER_BIT) ) ;
+ } else {
+ res = ( 0 != (val & BITMAP_BIT) ) ;
+ }
}
return res;
}
+
public static GLCapabilities AttribList2GLCapabilities(GLProfile glp, int[] iattribs,
int niattribs,
int[] iresults,
@@ -435,7 +435,10 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
res.setOnscreen( 0 != (drawableTypeBits & WINDOW_BIT) );
res.setPBuffer ( 0 != (drawableTypeBits & PBUFFER_BIT) );
} else {
- throw new GLException("WGL DrawableType does not match !!!");
+ if(DEBUG) {
+ System.err.println("WGL DrawableType does not match: req(onscrn "+onscreen+", pbuffer "+usePBuffer+"), got(onscreen "+( 0 != (drawableTypeBits & WINDOW_BIT) )+", pbuffer "+( 0 != (drawableTypeBits & PBUFFER_BIT) )+", pixmap "+( 0 != (drawableTypeBits & BITMAP_BIT))+")");
+ }
+ return null;
}
for (int i = 0; i < niattribs; i++) {
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
index 229042d9d..ab3227257 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
@@ -30,14 +30,14 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.opengl.impl.windows.wgl;
+package com.jogamp.opengl.impl.windows.wgl;
import javax.media.nativewindow.*;
import javax.media.nativewindow.windows.*;
-import com.sun.nativewindow.impl.*;
+import com.jogamp.nativewindow.impl.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
/** Subclass of GraphicsConfigurationFactory used when non-AWT tookits
are used on Windows platforms. Toolkits will likely need to delegate
@@ -45,7 +45,7 @@ import com.sun.opengl.impl.*;
GraphicsDevice and GraphicsConfiguration abstractions. */
public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfigurationFactory {
- protected static final boolean DEBUG = com.sun.opengl.impl.Debug.debug("GraphicsConfiguration");
+ protected static final boolean DEBUG = com.jogamp.opengl.impl.Debug.debug("GraphicsConfiguration");
public WindowsWGLGraphicsConfigurationFactory() {
GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.windows.WindowsGraphicsDevice.class, this);
@@ -58,22 +58,17 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
return chooseGraphicsConfigurationStatic(caps, chooser, absScreen);
}
- protected static WindowsWGLGraphicsConfiguration createDefaultGraphicsConfiguration(AbstractGraphicsScreen absScreen, boolean onscreen, boolean usePBuffer) {
- GLCapabilities caps = new GLCapabilities(null);
- caps.setDoubleBuffered(onscreen); // FIXME
+ protected static WindowsWGLGraphicsConfiguration createDefaultGraphicsConfiguration(GLProfile glp, AbstractGraphicsScreen absScreen, boolean onscreen, boolean usePBuffer) {
+ GLCapabilities caps = new GLCapabilities(glp);
+ caps.setDoubleBuffered(onscreen); // FIXME DBLBUFOFFSCRN
caps.setOnscreen (onscreen);
caps.setPBuffer (usePBuffer);
- GLCapabilities caps2 = (GLCapabilities) caps.clone();
- if(!caps2.isOnscreen()) {
- // OFFSCREEN !DOUBLE_BUFFER
- caps2.setDoubleBuffered(false);
- }
-
if(null==absScreen) {
absScreen = DefaultGraphicsScreen.createScreenDevice(0);
}
- return new WindowsWGLGraphicsConfiguration(absScreen, caps2, caps, WindowsWGLGraphicsConfiguration.GLCapabilities2PFD(caps2), -1, null);
+ return new WindowsWGLGraphicsConfiguration(absScreen, caps, caps, WindowsWGLGraphicsConfiguration.GLCapabilities2PFD(caps), -1, null);
+
}
protected static WindowsWGLGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilities caps,
@@ -84,7 +79,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
}
GLCapabilities caps2 = (GLCapabilities) caps.clone();
if(!caps2.isOnscreen()) {
- // OFFSCREEN !DOUBLE_BUFFER
+ // OFFSCREEN !DOUBLE_BUFFER // FIXME DBLBUFOFFSCRN
caps2.setDoubleBuffered(false);
}
return new WindowsWGLGraphicsConfiguration(absScreen, caps2, caps, WindowsWGLGraphicsConfiguration.GLCapabilities2PFD(caps2), -1,
@@ -92,7 +87,8 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
}
protected static void updateGraphicsConfiguration(CapabilitiesChooser chooser,
- GLDrawableFactory factory, NativeWindow nativeWindow) {
+ GLDrawableFactory _factory, NativeWindow nativeWindow) {
+ WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory) _factory;
if (nativeWindow == null) {
throw new IllegalArgumentException("NativeWindow is null");
}
@@ -139,25 +135,15 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
pfd = WindowsWGLGraphicsConfiguration.createPixelFormatDescriptor();
// Produce a recommended pixel format selection for the GLCapabilitiesChooser.
// Use wglChoosePixelFormatARB if user requested multisampling and if we have it available
- WindowsWGLDrawable dummyDrawable = null;
- GLContextImpl dummyContext = null;
- WGLExt dummyWGLExt = null;
- if (capabilities.getSampleBuffers()) {
- dummyDrawable = new WindowsDummyWGLDrawable(factory);
- dummyContext = (GLContextImpl) dummyDrawable.createContext(null);
- if (dummyContext != null) {
- dummyContext.makeCurrent();
- dummyWGLExt = (WGLExt) dummyContext.getPlatformGLExtensions();
- }
- } else if (DEBUG) {
- System.err.println(getThreadName() + ": Not using WGL_ARB_pixel_format, because multisampling not requested");
- }
+ factory.sharedContext.makeCurrent();
+ WGLExt wglExt = factory.sharedContext.getWGLExt();
+
int recommendedPixelFormat = pixelFormat; // 1-based pixel format
boolean haveWGLChoosePixelFormatARB = false;
boolean gotAvailableCaps = false;
- if (dummyWGLExt != null) {
+ if (wglExt != null) {
try {
- haveWGLChoosePixelFormatARB = dummyWGLExt.isExtensionAvailable("WGL_ARB_pixel_format");
+ haveWGLChoosePixelFormatARB = wglExt.isExtensionAvailable("WGL_ARB_pixel_format");
if (haveWGLChoosePixelFormatARB) {
if(pixelFormat<=0) {
int[] iattributes = new int [2*WindowsWGLGraphicsConfiguration.MAX_ATTRIBS];
@@ -165,12 +151,12 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
if(WindowsWGLGraphicsConfiguration.GLCapabilities2AttribList(capabilities,
iattributes,
- dummyWGLExt,
+ wglExt,
false,
null)) {
int[] pformats = new int[WindowsWGLGraphicsConfiguration.MAX_PFORMATS];
int[] numFormatsTmp = new int[1];
- if (dummyWGLExt.wglChoosePixelFormatARB(hdc,
+ if (wglExt.wglChoosePixelFormatARB(hdc,
iattributes, 0,
fattributes, 0,
WindowsWGLGraphicsConfiguration.MAX_PFORMATS,
@@ -201,16 +187,14 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
}
}
- availableCaps = WindowsWGLGraphicsConfiguration.HDC2GLCapabilities(dummyWGLExt, hdc, -1, glProfile, pixelFormatSet, onscreen, usePBuffer);
+ availableCaps = WindowsWGLGraphicsConfiguration.HDC2GLCapabilities(wglExt, hdc, -1, glProfile, pixelFormatSet, onscreen, usePBuffer);
gotAvailableCaps = null!=availableCaps ;
choosenBywGLPixelFormat = gotAvailableCaps ;
} else if (DEBUG) {
System.err.println(getThreadName() + ": wglChoosePixelFormatARB not available");
}
} finally {
- dummyContext.release();
- dummyContext.destroy();
- dummyDrawable.destroy();
+ factory.sharedContext.release();
}
}
@@ -265,9 +249,11 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
}
pixelFormat = 1; // default ..
} else if ( pixelFormat > numFormats ) {
- throw new GLException("Invalid result " + pixelFormat +
- " from GLCapabilitiesChooser (should be between 1 and " +
- numFormats + ")");
+ // keep on going ..
+ if(DEBUG) {
+ System.err.println("GLCapabilitiesChooser specified invalid index (expected 1.." + numFormats + ", got "+pixelFormat+")");
+ }
+ pixelFormat = 1; // default ..
}
}
chosenCaps = availableCaps[pixelFormat-1];
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java
index f4c0a8049..02cfd14c3 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java
@@ -30,7 +30,7 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.opengl.impl.windows.wgl.awt;
+package com.jogamp.opengl.impl.windows.wgl.awt;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
@@ -41,13 +41,13 @@ import javax.media.nativewindow.awt.*;
import javax.media.opengl.*;
import javax.media.opengl.awt.*;
-import com.sun.opengl.impl.*;
-import com.sun.opengl.impl.windows.wgl.*;
-import com.sun.nativewindow.impl.jawt.*;
-import com.sun.nativewindow.impl.jawt.windows.*;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.opengl.impl.windows.wgl.*;
+import com.jogamp.nativewindow.impl.jawt.*;
+import com.jogamp.nativewindow.impl.jawt.windows.*;
public class WindowsAWTWGLGraphicsConfigurationFactory extends GraphicsConfigurationFactory {
- protected static final boolean DEBUG = com.sun.opengl.impl.Debug.debug("GraphicsConfiguration");
+ protected static final boolean DEBUG = com.jogamp.opengl.impl.Debug.debug("GraphicsConfiguration");
public WindowsAWTWGLGraphicsConfigurationFactory() {
GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.awt.AWTGraphicsDevice.class, this);
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/GLXUtil.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/GLXUtil.java
index 418d31503..ec0eaf94f 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/GLXUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/GLXUtil.java
@@ -30,18 +30,16 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.opengl.impl.x11.glx;
+package com.jogamp.opengl.impl.x11.glx;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import javax.media.nativewindow.NativeWindowFactory;
-import com.sun.nativewindow.impl.x11.*;
+import com.jogamp.nativewindow.impl.x11.*;
public class GLXUtil {
public static boolean isMultisampleAvailable(long display) {
+ X11Lib.XLockDisplay(display);
try {
- X11Lib.XLockDisplay(display);
String exts = GLX.glXGetClientString(display, GLX.GLX_EXTENSIONS);
if (exts != null) {
return (exts.indexOf("GLX_ARB_multisample") >= 0);
@@ -54,13 +52,55 @@ public class GLXUtil {
/** Workaround for apparent issue with ATI's proprietary drivers
where direct contexts still send GLX tokens for GL calls */
- public static boolean isVendorATI(long display) {
+ public static String getVendorName(long display) {
+ X11Lib.XLockDisplay(display);
try {
- X11Lib.XLockDisplay(display);
- String vendor = GLX.glXGetClientString(display, GLX.GLX_VENDOR);
- return vendor != null && vendor.startsWith("ATI") ;
+ return GLX.glXGetClientString(display, GLX.GLX_VENDOR);
} finally {
X11Lib.XUnlockDisplay(display);
}
}
+
+ public static boolean isVendorNVIDIA(String vendor) {
+ return vendor != null && vendor.startsWith("NVIDIA") ;
+ }
+
+ public static boolean isVendorATI(String vendor) {
+ return vendor != null && vendor.startsWith("ATI") ;
+ }
+
+ public static boolean isVendorATI(long display) {
+ return isVendorATI(getVendorName(display));
+ }
+
+ public static boolean isVendorNVIDIA(long display) {
+ return isVendorNVIDIA(getVendorName(display));
+ }
+
+ public static void getGLXVersion(long display, int major[], int minor[]) {
+ if(0 == display) {
+ throw new GLException("null display handle");
+ }
+ if(major.length<1||minor.length<1) {
+ throw new GLException("passed int arrays size is not >= 1");
+ }
+
+ if (!GLX.glXQueryVersion(display, major, 0, minor, 0)) {
+ 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[0] == 1 && minor[0] == 2) {
+ String str = GLX.glXGetClientString(display, GLX.GLX_VERSION);
+ try {
+ // e.g. "1.3"
+ major[0] = Integer.valueOf(str.substring(0, 1)).intValue();
+ minor[0] = Integer.valueOf(str.substring(2, 3)).intValue();
+ } catch (Exception e) {
+ major[0] = 1;
+ minor[0] = 2;
+ }
+ }
+ }
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java
new file mode 100644
index 000000000..1f148bead
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11DummyGLXDrawable.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. 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 Sven Gothel 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
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.jogamp.opengl.impl.x11.glx;
+
+import javax.media.opengl.*;
+import com.jogamp.opengl.impl.*;
+
+import javax.media.nativewindow.*;
+import javax.media.nativewindow.x11.*;
+import com.jogamp.nativewindow.impl.*;
+import com.jogamp.nativewindow.impl.x11.*;
+
+public class X11DummyGLXDrawable extends X11OnscreenGLXDrawable {
+
+ private long dummyWindow = 0;
+
+ /**
+ * Due to the ATI Bug https://bugzilla.mozilla.org/show_bug.cgi?id=486277,
+ * we cannot switch the Display as we please,
+ * hence we reuse the target's screen configuration.
+ */
+ public X11DummyGLXDrawable(X11GraphicsScreen screen, GLDrawableFactory factory, GLProfile glp) {
+ super(factory,
+ new NullWindow(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(
+ new GLCapabilities(glp), null, screen)));
+ this.realized = true;
+
+ NullWindow nw = (NullWindow) getNativeWindow();
+ X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)nw.getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ GLCapabilities caps = (GLCapabilities) config.getChosenCapabilities();
+
+ X11GraphicsDevice device = (X11GraphicsDevice) screen.getDevice();
+ long dpy = device.getHandle();
+ int scrn = screen.getIndex();
+ long visualID = config.getVisualID();
+
+ X11Lib.XLockDisplay(dpy);
+ try{
+ dummyWindow = X11Lib.CreateDummyWindow(dpy, scrn, visualID);
+ } finally {
+ X11Lib.XUnlockDisplay(dpy);
+ }
+ nw.setSurfaceHandle( dummyWindow );
+ }
+
+ public void setSize(int width, int height) {
+ }
+
+ public int getWidth() {
+ return 1;
+ }
+
+ public int getHeight() {
+ return 1;
+ }
+
+ public void destroy() {
+ if(0!=dummyWindow) {
+ X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ long dpy = config.getScreen().getDevice().getHandle();
+ X11Lib.DestroyDummyWindow(dpy, dummyWindow);
+ }
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXContext.java
index 7e3755870..139c0deed 100755
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11ExternalGLXContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXContext.java
@@ -37,14 +37,14 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.x11.glx;
+package com.jogamp.opengl.impl.x11.glx;
import javax.media.nativewindow.*;
import javax.media.nativewindow.x11.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.NullWindow;
-import com.sun.nativewindow.impl.x11.*;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.nativewindow.impl.NullWindow;
+import com.jogamp.nativewindow.impl.x11.*;
public class X11ExternalGLXContext extends X11GLXContext {
private boolean firstMakeCurrent = true;
@@ -55,7 +55,7 @@ public class X11ExternalGLXContext extends X11GLXContext {
super(drawable, null);
this.context = context;
GLContextShareSet.contextCreated(this);
- setGLFunctionAvailability(false);
+ setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
getGLStateTracker().setEnabled(false); // external context usage can't track state in Java
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11ExternalGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java
index 75a6b221a..f10bd38c6 100755
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11ExternalGLXDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11ExternalGLXDrawable.java
@@ -37,16 +37,14 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.x11.glx;
+package com.jogamp.opengl.impl.x11.glx;
import javax.media.nativewindow.*;
import javax.media.nativewindow.x11.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.NullWindow;
-import com.sun.nativewindow.impl.x11.*;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.nativewindow.impl.NullWindow;
-import com.sun.gluegen.runtime.PointerBuffer;
public class X11ExternalGLXDrawable extends X11GLXDrawable {
private int fbConfigID;
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java
index 330d0a473..dce25978c 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXContext.java
@@ -37,23 +37,24 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.x11.glx;
+package com.jogamp.opengl.impl.x11.glx;
import java.nio.*;
import java.util.*;
import javax.media.opengl.*;
import javax.media.nativewindow.*;
import javax.media.nativewindow.x11.*;
-import com.sun.opengl.impl.*;
-import com.sun.opengl.impl.x11.glx.*;
-import com.sun.nativewindow.impl.x11.*;
-import com.sun.gluegen.runtime.ProcAddressTable;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.opengl.impl.x11.glx.*;
+import com.jogamp.nativewindow.impl.x11.*;
+import com.jogamp.gluegen.runtime.ProcAddressTable;
public abstract class X11GLXContext extends GLContextImpl {
protected long context;
private boolean glXQueryExtensionsStringInitialized;
private boolean glXQueryExtensionsStringAvailable;
private static final Map/*<String, String>*/ functionNameMap;
+ private static final Map/*<String, String>*/ extensionNameMap;
private GLXExt glXExt;
// Table that holds the addresses of the native C-language entry points for
// GLX extension functions.
@@ -63,6 +64,10 @@ public abstract class X11GLXContext extends GLContextImpl {
functionNameMap = new HashMap();
functionNameMap.put("glAllocateMemoryNV", "glXAllocateMemoryNV");
functionNameMap.put("glFreeMemoryNV", "glXFreeMemoryNV");
+
+ extensionNameMap = new HashMap();
+ extensionNameMap.put("GL_ARB_pbuffer", "GLX_SGIX_pbuffer");
+ extensionNameMap.put("GL_ARB_pixel_format", "GLX_SGIX_pbuffer"); // good enough
}
public X11GLXContext(GLDrawableImpl drawable, GLDrawableImpl drawableRead,
@@ -94,35 +99,121 @@ public abstract class X11GLXContext extends GLContextImpl {
return glXExt;
}
- protected String mapToRealGLFunctionName(String glFunctionName) {
- String lookup = (String) functionNameMap.get(glFunctionName);
- if (lookup != null) {
- return lookup;
+ protected Map/*<String, String>*/ getFunctionNameMap() { return functionNameMap; }
+
+ protected Map/*<String, String>*/ getExtensionNameMap() { return extensionNameMap; }
+
+ protected boolean glXMakeContextCurrent(long dpy, long writeDrawable, long readDrawable, long ctx) {
+ boolean res = false;
+
+ try {
+ res = GLX.glXMakeContextCurrent(dpy, writeDrawable, readDrawable, ctx);
+ } catch (RuntimeException re) {
+ if(DEBUG) {
+ System.err.println("X11GLXContext.glXMakeContextCurrent failed: "+re+", with "+
+ "dpy "+toHexString(dpy)+
+ ", write "+toHexString(writeDrawable)+
+ ", read "+toHexString(readDrawable)+
+ ", ctx "+toHexString(ctx));
+ re.printStackTrace();
+ }
}
- return glFunctionName;
+ return res;
}
- protected String mapToRealGLExtensionName(String glExtensionName) {
- return glExtensionName;
+ protected void destroyContextARBImpl(long _context) {
+ X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ long display = config.getScreen().getDevice().getHandle();
+
+ glXMakeContextCurrent(display, 0, 0, 0);
+ GLX.glXDestroyContext(display, _context);
}
- /** Helper routine which usually just turns around and calls
- * createContext (except for pbuffers, which use a different context
- * creation mechanism). Should only be called by {@link
- * makeCurrentImpl()}.
- */
- protected abstract void create();
+ protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) {
+ X11GLXDrawableFactory factory = (X11GLXDrawableFactory)drawable.getFactoryImpl();
+ X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ long display = config.getScreen().getDevice().getHandle();
+
+ GLXExt glXExt;
+ if(null==factory.getSharedContext()) {
+ glXExt = getGLXExt();
+ } else {
+ glXExt = ((X11GLXContext)factory.getSharedContext()).getGLXExt();
+ }
+
+ boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ;
+ boolean ctFwdCompat = 0 != ( CTX_OPTION_FORWARD & ctp ) ;
+ boolean ctDebug = 0 != ( CTX_OPTION_DEBUG & ctp ) ;
+
+ long _context=0;
+
+ int attribs[] = {
+ /* 0 */ GLX.GLX_CONTEXT_MAJOR_VERSION_ARB, major,
+ /* 2 */ GLX.GLX_CONTEXT_MINOR_VERSION_ARB, minor,
+ /* 4 */ GLX.GLX_RENDER_TYPE, GLX.GLX_RGBA_TYPE, // default
+ /* 6 */ GLX.GLX_CONTEXT_FLAGS_ARB, 0,
+ /* 8 */ 0, 0,
+ /* 10 */ 0
+ };
+
+ if ( major > 3 || major == 3 && minor >= 2 ) {
+ // FIXME: Verify with a None drawable binding (default framebuffer)
+ attribs[8+0] = GLX.GLX_CONTEXT_PROFILE_MASK_ARB;
+ if( ctBwdCompat ) {
+ attribs[8+1] = GLX.GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
+ } else {
+ attribs[8+1] = GLX.GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
+ }
+ }
+
+ if ( major >= 3 ) {
+ if( !ctBwdCompat && ctFwdCompat ) {
+ attribs[6+1] |= GLX.GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
+ }
+ if( ctDebug) {
+ attribs[6+1] |= GLX.GLX_CONTEXT_DEBUG_BIT_ARB;
+ }
+ }
+
+ try {
+ _context = glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs, 0);
+ } catch (RuntimeException re) {
+ if(DEBUG) {
+ System.err.println("X11GLXContext.createContextARB glXCreateContextAttribsARB failed: "+re+", with "+getGLVersion(null, major, minor, ctp, "@creation"));
+ re.printStackTrace();
+ }
+ }
+ if(0==_context) {
+ if(DEBUG) {
+ System.err.println("X11GLXContext.createContextARB couldn't create "+getGLVersion(null, major, minor, ctp, "@creation"));
+ }
+ } else {
+ if (!glXMakeContextCurrent(display,
+ drawable.getNativeWindow().getSurfaceHandle(),
+ drawableRead.getNativeWindow().getSurfaceHandle(),
+ _context)) {
+ if(DEBUG) {
+ System.err.println("X11GLXContext.createContextARB couldn't make current "+getGLVersion(null, major, minor, ctp, "@creation"));
+ }
+ glXMakeContextCurrent(display, 0, 0, 0);
+ GLX.glXDestroyContext(display, _context);
+ _context = 0;
+ }
+ }
+ return _context;
+ }
/**
* Creates and initializes an appropriate OpenGL context. Should only be
- * called by {@link create()}.
+ * called by {@link #create()}.
* Note: The direct parameter may be overwritten by the direct state of a shared context.
*/
protected void createContext(boolean direct) {
- X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
- if(DEBUG) {
- System.err.println("X11GLXContext.createContext got "+config);
+ if(0!=context) {
+ throw new GLException("context is not null: "+context);
}
+ X11GLXDrawableFactory factory = (X11GLXDrawableFactory)drawable.getFactoryImpl();
+ X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
long display = config.getScreen().getDevice().getHandle();
X11GLXContext other = (X11GLXContext) GLContextShareSet.getShareContext(this);
@@ -136,176 +227,107 @@ public abstract class X11GLXContext extends GLContextImpl {
}
GLCapabilities glCaps = (GLCapabilities) config.getChosenCapabilities();
- isVendorATI = GLXUtil.isVendorATI(display);
+ GLProfile glp = glCaps.getGLProfile();
+ isVendorATI = factory.isVendorATI();
if(config.getFBConfigID()<0) {
// not able to use FBConfig
- if(glCaps.getGLProfile().isGL3()) {
+ if(glp.isGL3()) {
throw new GLException("Unable to create OpenGL >= 3.1 context");
}
context = GLX.glXCreateContext(display, config.getXVisualInfo(), share, direct);
if (context == 0) {
- throw new GLException("Unable to create OpenGL context");
+ throw new GLException("Unable to create context(0)");
}
- if (!GLX.glXMakeContextCurrent(display,
- drawable.getNativeWindow().getSurfaceHandle(),
- drawableRead.getNativeWindow().getSurfaceHandle(),
- context)) {
- throw new GLException("Error making temp context (old2) current: display 0x"+Long.toHexString(display)+", context 0x"+Long.toHexString(context)+", drawable "+drawable);
+ if (!glXMakeContextCurrent(display,
+ drawable.getNativeWindow().getSurfaceHandle(),
+ drawableRead.getNativeWindow().getSurfaceHandle(),
+ context)) {
+ throw new GLException("Error making temp context(0) current: display "+toHexString(display)+", context "+toHexString(context)+", drawable "+drawable);
}
- setGLFunctionAvailability(true);
+ setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY); // use GL_VERSION
+ return;
+ }
+
+ int minor[] = new int[1];
+ int major[] = new int[1];
+ int ctp[] = new int[1];
+ boolean createContextARBTried = false;
+
+ // utilize the shared context's GLXExt in case it was using the ARB method and it already exists
+ if(null!=factory.getSharedContext() && factory.getSharedContext().isCreatedWithARBMethod()) {
if(DEBUG) {
- System.err.println("X11GLXContext.createContext done (old2 ctx) 0x"+Long.toHexString(context));
+ System.err.println("X11GLXContext.createContext using shared Context: "+factory.getSharedContext());
}
+ context = createContextARB(share, direct, major, minor, ctp);
+ createContextARBTried = true;
+ }
- } else {
-
+ long temp_context = 0;
+ if(0==context) {
// To use GLX_ARB_create_context, we have to make a temp context current,
// so we are able to use GetProcAddress
- long temp_context = GLX.glXCreateNewContext(display, config.getFBConfig(), GLX.GLX_RGBA_TYPE, share, direct);
+ temp_context = GLX.glXCreateNewContext(display, config.getFBConfig(), GLX.GLX_RGBA_TYPE, share, direct);
if (temp_context == 0) {
- throw new GLException("Unable to create temp OpenGL context");
- } else {
- if (!GLX.glXMakeContextCurrent(display,
- drawable.getNativeWindow().getSurfaceHandle(),
- drawableRead.getNativeWindow().getSurfaceHandle(),
- temp_context)) {
- throw new GLException("Error making temp context (old) current: display 0x"+Long.toHexString(display)+", context 0x"+Long.toHexString(context)+", drawable "+drawable);
+ throw new GLException("Unable to create temp OpenGL context(1)");
+ }
+ if (!glXMakeContextCurrent(display,
+ drawable.getNativeWindow().getSurfaceHandle(),
+ drawableRead.getNativeWindow().getSurfaceHandle(),
+ temp_context)) {
+ throw new GLException("Error making temp context(1) current: display "+toHexString(display)+", context "+toHexString(context)+", drawable "+drawable);
+ }
+ setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY); // use GL_VERSION
+
+ if( createContextARBTried ||
+ !isFunctionAvailable("glXCreateContextAttribsARB") ||
+ !isExtensionAvailable("GLX_ARB_create_context") ) {
+ if(glp.isGL3()) {
+ glXMakeContextCurrent(display, 0, 0, 0);
+ GLX.glXDestroyContext(display, temp_context);
+ throw new GLException("Unable to create OpenGL >= 3.1 context (failed GLX_ARB_create_context), GLProfile "+glp+", Drawable "+drawable);
}
- setGLFunctionAvailability(true);
-
- if( !isFunctionAvailable("glXCreateContextAttribsARB") ||
- !isExtensionAvailable("GLX_ARB_create_context") ) {
- if(glCaps.getGLProfile().isGL3()) {
- GLX.glXMakeContextCurrent(display, 0, 0, 0);
- GLX.glXDestroyContext(display, temp_context);
- throw new GLException("Unable to create OpenGL >= 3.1 context (no GLX_ARB_create_context)");
- }
-
- // continue with temp context for GL < 3.0
- context = temp_context;
- if(DEBUG) {
- System.err.println("X11GLXContext.createContext done (old ctx < 3.0 - no GLX_ARB_create_context) 0x"+Long.toHexString(context));
- }
- } else {
- GLXExt glXExt = getGLXExt();
-
- // preset with default values
- int attribs[] = {
- /* 0 */ GLX.GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
- /* 2 */ GLX.GLX_CONTEXT_MINOR_VERSION_ARB, 0,
- /* 4 */ GLX.GLX_RENDER_TYPE, GLX.GLX_RGBA_TYPE,
- /* 6 */ GLX.GLX_CONTEXT_FLAGS_ARB, 0 /* GLX.GLX_CONTEXT_DEBUG_BIT_ARB */,
- /* 8 */ 0, 0,
- /* 10 */ 0
- };
-
- if(glCaps.getGLProfile().isGL3()) {
- // Try >= 3.2 core first
- // and verify with a None drawable binding (default framebuffer)
- attribs[0+1] = 3;
- attribs[2+1] = 2;
- if(glCaps.getGLProfile().isGL3bc()) {
- attribs[8+0] = GLX.GLX_CONTEXT_PROFILE_MASK_ARB;
- attribs[8+1] = GLX.GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
- }
- /**
- * don't stricten requirements any further, even compatible would be fine
- *
- } else {
- attribs[8+0] = GLX.GLX_CONTEXT_PROFILE_MASK_ARB;
- attribs[8+1] = GLX.GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
- }
- */
-
- context = glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs, 0);
- if(0!=context) {
- if (!GLX.glXMakeContextCurrent(display,
- drawable.getNativeWindow().getSurfaceHandle(),
- drawableRead.getNativeWindow().getSurfaceHandle(),
- context)) {
- if(DEBUG) {
- System.err.println("X11GLXContext.createContext couldn't make >= 3.2 core context current - fallback");
- }
- GLX.glXMakeContextCurrent(display, 0, 0, 0);
- GLX.glXDestroyContext(display, context);
- context = 0;
- } else if(DEBUG) {
- System.err.println("X11GLXContext.createContext >= 3.2 available 0x"+Long.toHexString(context));
- }
- } else {
- if(DEBUG) {
- System.err.println("X11GLXContext.createContext couldn't create >= 3.2 core context - fallback");
- }
- }
- if(0==context) {
- // Try >= 3.1 forward compatible - last resort for GL3 !
- attribs[0+1] = 3;
- attribs[2+1] = 1;
- if(!glCaps.getGLProfile().isGL3bc()) {
- attribs[6+1] |= GLX.GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
- }
- attribs[8+0] = 0;
- attribs[8+1] = 0;
- }
- }
- if(0==context) {
- // 3.1 or 3.0 ..
- context = glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs, 0);
- if(0!=context) {
- if (!GLX.glXMakeContextCurrent(display,
- drawable.getNativeWindow().getSurfaceHandle(),
- drawableRead.getNativeWindow().getSurfaceHandle(),
- context)) {
- if(DEBUG) {
- System.err.println("X11GLXContext.createContext couldn't make >= 3.0 core context current - fallback");
- }
- GLX.glXMakeContextCurrent(display, 0, 0, 0);
- GLX.glXDestroyContext(display, context);
- context = 0;
- } else if(DEBUG) {
- System.err.println("X11GLXContext.createContext >= 3.0 available 0x"+Long.toHexString(context));
- }
- } else {
- if(DEBUG) {
- System.err.println("X11GLXContext.createContext couldn't create >= 3.0 core context - fallback");
- }
- }
- }
-
- if(0==context) {
- if(glCaps.getGLProfile().isGL3()) {
- GLX.glXMakeContextCurrent(display, 0, 0, 0);
- GLX.glXDestroyContext(display, temp_context);
- throw new GLException("Unable to create OpenGL >= 3.1 context (have GLX_ARB_create_context)");
- }
-
- // continue with temp context for GL < 3.0
- context = temp_context;
- if (!GLX.glXMakeContextCurrent(display,
- drawable.getNativeWindow().getSurfaceHandle(),
- drawableRead.getNativeWindow().getSurfaceHandle(),
- context)) {
- GLX.glXMakeContextCurrent(display, 0, 0, 0);
- GLX.glXDestroyContext(display, temp_context);
- throw new GLException("Error making context (old) current: display 0x"+Long.toHexString(display)+", context 0x"+Long.toHexString(context)+", drawable "+drawable);
- }
- if(DEBUG) {
- System.err.println("X11GLXContext.createContext done (old ctx < 3.0 - no 3.0) 0x"+Long.toHexString(context));
- }
- } else {
- GLX.glXDestroyContext(display, temp_context);
-
- // need to update the GL func table ..
- updateGLProcAddressTable();
- if(DEBUG) {
- System.err.println("X11GLXContext.createContext done (new ctx >= 3.0) 0x"+Long.toHexString(context));
- }
- }
+
+ // continue with temp context for GL < 3.0
+ context = temp_context;
+ return;
+ }
+ context = createContextARB(share, direct, major, minor, ctp);
+ createContextARBTried=true;
+ }
+
+ if(0!=context) {
+ if(0!=temp_context) {
+ glXMakeContextCurrent(display, 0, 0, 0);
+ GLX.glXDestroyContext(display, temp_context);
+ if (!glXMakeContextCurrent(display,
+ drawable.getNativeWindow().getSurfaceHandle(),
+ drawableRead.getNativeWindow().getSurfaceHandle(),
+ context)) {
+ throw new GLException("Cannot make previous verified context current");
}
- }
- }
- GLContextShareSet.contextCreated(this);
+ }
+ } else {
+ if(glp.isGL3()) {
+ glXMakeContextCurrent(display, 0, 0, 0);
+ GLX.glXDestroyContext(display, temp_context);
+ throw new GLException("X11GLXContext.createContext failed, but context > GL2 requested "+getGLVersion(null, major[0], minor[0], ctp[0], "@creation")+", ");
+ }
+ if(DEBUG) {
+ System.err.println("X11GLXContext.createContext failed, fall back to !ARB context "+getGLVersion(null, major[0], minor[0], ctp[0], "@creation"));
+ }
+
+ // continue with temp context for GL <= 3.0
+ context = temp_context;
+ if (!glXMakeContextCurrent(display,
+ drawable.getNativeWindow().getSurfaceHandle(),
+ drawableRead.getNativeWindow().getSurfaceHandle(),
+ context)) {
+ glXMakeContextCurrent(display, 0, 0, 0);
+ GLX.glXDestroyContext(display, temp_context);
+ throw new GLException("Error making context(1) current: display "+toHexString(display)+", context "+toHexString(context)+", drawable "+drawable);
+ }
+ }
}
// Note: Usually the surface shall be locked within [makeCurrent .. swap .. release]
@@ -340,34 +362,34 @@ public abstract class X11GLXContext extends GLContextImpl {
}
protected int makeCurrentImplAfterLock() throws GLException {
+ long dpy = drawable.getNativeWindow().getDisplayHandle();
+
getDrawableImpl().getFactoryImpl().lockToolkit();
try {
if (drawable.getNativeWindow().getSurfaceHandle() == 0) {
- if (DEBUG) {
- System.err.println("drawable not properly initialized");
- }
- return CONTEXT_NOT_CURRENT;
+ throw new GLException("drawable not properly initialized: "+drawable);
}
boolean created = false;
if (context == 0) {
create();
+ created = true;
+ GLContextShareSet.contextCreated(this);
if (DEBUG) {
System.err.println(getThreadName() + ": !!! Created GL context for " + getClass().getName());
}
- created = true;
}
if (GLX.glXGetCurrentContext() != context) {
- if (!GLX.glXMakeContextCurrent(drawable.getNativeWindow().getDisplayHandle(),
- drawable.getNativeWindow().getSurfaceHandle(),
- drawableRead.getNativeWindow().getSurfaceHandle(),
- context)) {
- throw new GLException("Error making context current");
+ if (!glXMakeContextCurrent(dpy,
+ drawable.getNativeWindow().getSurfaceHandle(),
+ drawableRead.getNativeWindow().getSurfaceHandle(),
+ context)) {
+ throw new GLException("Error making context current: "+this);
}
if (DEBUG && (VERBOSE || created)) {
System.err.println(getThreadName() + ": glXMakeCurrent(display " +
- toHexString(drawable.getNativeWindow().getDisplayHandle()) +
+ toHexString(dpy)+
", drawable " + toHexString(drawable.getNativeWindow().getSurfaceHandle()) +
", drawableRead " + toHexString(drawableRead.getNativeWindow().getSurfaceHandle()) +
", context " + toHexString(context) + ") succeeded");
@@ -375,7 +397,7 @@ public abstract class X11GLXContext extends GLContextImpl {
}
if (created) {
- setGLFunctionAvailability(false);
+ setGLFunctionAvailability(false, -1, -1, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
return CONTEXT_CURRENT_NEW;
}
return CONTEXT_CURRENT;
@@ -387,7 +409,7 @@ public abstract class X11GLXContext extends GLContextImpl {
protected void releaseImplAfterLock() throws GLException {
getDrawableImpl().getFactoryImpl().lockToolkit();
try {
- if (!GLX.glXMakeContextCurrent(drawable.getNativeWindow().getDisplayHandle(), 0, 0, 0)) {
+ if (!glXMakeContextCurrent(drawable.getNativeWindow().getDisplayHandle(), 0, 0, 0)) {
throw new GLException("Error freeing OpenGL context");
}
} finally {
@@ -400,10 +422,10 @@ public abstract class X11GLXContext extends GLContextImpl {
try {
if (context != 0) {
if (DEBUG) {
- System.err.println("glXDestroyContext(0x" +
- Long.toHexString(drawable.getNativeWindow().getDisplayHandle()) +
- ", 0x" +
- Long.toHexString(context) + ")");
+ System.err.println("glXDestroyContext(" +
+ toHexString(drawable.getNativeWindow().getDisplayHandle()) +
+ ", " +
+ toHexString(context) + ")");
}
GLX.glXDestroyContext(drawable.getNativeWindow().getDisplayHandle(), context);
if (DEBUG) {
@@ -442,7 +464,7 @@ public abstract class X11GLXContext extends GLContextImpl {
}
}
- protected void updateGLProcAddressTable() {
+ protected void updateGLProcAddressTable(int major, int minor, int ctp) {
if (DEBUG) {
System.err.println(getThreadName() + ": !!! Initializing GLX extension address table");
}
@@ -455,7 +477,7 @@ public abstract class X11GLXContext extends GLContextImpl {
glXExtProcAddressTable = new GLXExtProcAddressTable();
}
resetProcAddressTable(getGLXExtProcAddressTable());
- super.updateGLProcAddressTable();
+ super.updateGLProcAddressTable(major, minor, ctp);
}
public synchronized String getPlatformExtensionsString() {
@@ -485,7 +507,8 @@ public abstract class X11GLXContext extends GLContextImpl {
public boolean isExtensionAvailable(String glExtensionName) {
if (glExtensionName.equals("GL_ARB_pbuffer") ||
glExtensionName.equals("GL_ARB_pixel_format")) {
- return getGLDrawable().getFactory().canCreateGLPbuffer();
+ return getGLDrawable().getFactory().canCreateGLPbuffer(
+ drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration().getScreen().getDevice() );
}
return super.isExtensionAvailable(glExtensionName);
}
@@ -494,6 +517,10 @@ public abstract class X11GLXContext extends GLContextImpl {
private int hasSwapIntervalSGI = 0;
protected void setSwapIntervalImpl(int interval) {
+ X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ GLCapabilities glCaps = (GLCapabilities) config.getChosenCapabilities();
+ if(!glCaps.isOnscreen()) return;
+
getDrawableImpl().getFactoryImpl().lockToolkit();
try {
GLXExt glXExt = getGLXExt();
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java
index c2a1987cc..95dfc0a1c 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawable.java
@@ -37,13 +37,12 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.x11.glx;
+package com.jogamp.opengl.impl.x11.glx;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.x11.*;
-import com.sun.gluegen.runtime.DynamicLookupHelper;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.common.os.DynamicLookupHelper;
public abstract class X11GLXDrawable extends GLDrawableImpl {
protected X11GLXDrawable(GLDrawableFactory factory, NativeWindow comp, boolean realized) {
@@ -74,25 +73,23 @@ public abstract class X11GLXDrawable extends GLDrawableImpl {
}
}
- protected void swapBuffersImpl() {
- boolean didLock = false;
- try {
- if ( !isSurfaceLocked() ) {
- // Usually the surface shall be locked within [makeCurrent .. swap .. release]
- if (lockSurface() == NativeWindow.LOCK_SURFACE_NOT_READY) {
- return;
- }
- didLock=true;
- }
-
- GLX.glXSwapBuffers(component.getDisplayHandle(), component.getSurfaceHandle());
-
- } finally {
- if(didLock) {
- unlockSurface();
- }
+ protected void swapBuffersImpl() {
+ boolean didLock = false;
+ if (!isSurfaceLocked()) {
+ // Usually the surface shall be locked within [makeCurrent .. swap .. release]
+ if (lockSurface() == NativeWindow.LOCK_SURFACE_NOT_READY) {
+ return;
+ }
+ didLock = true;
+ }
+ try {
+ GLX.glXSwapBuffers(component.getDisplayHandle(), component.getSurfaceHandle());
+ } finally {
+ if (didLock) {
+ unlockSurface();
+ }
+ }
}
- }
//---------------------------------------------------------------------------
// Internals only below this point
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java
index 09bea723f..d8e5f7646 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java
@@ -34,23 +34,22 @@
* facility.
*/
-package com.sun.opengl.impl.x11.glx;
+package com.jogamp.opengl.impl.x11.glx;
+import com.jogamp.common.os.DynamicLookupHelper;
import java.nio.*;
-import java.security.*;
-import java.util.*;
import javax.media.nativewindow.*;
import javax.media.nativewindow.x11.*;
import javax.media.opengl.*;
-import com.sun.gluegen.runtime.*;
-import com.sun.gluegen.runtime.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.opengl.impl.x11.glx.*;
-import com.sun.nativewindow.impl.NullWindow;
-import com.sun.nativewindow.impl.NWReflection;
-import com.sun.nativewindow.impl.x11.*;
+import com.jogamp.gluegen.runtime.opengl.*;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.common.JogampRuntimeException;
+import com.jogamp.common.util.*;
+import com.jogamp.nativewindow.impl.NullWindow;
+import com.jogamp.nativewindow.impl.x11.*;
public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements DynamicLookupHelper {
+
public X11GLXDrawableFactory() {
super();
// Must initialize GLX support eagerly in case a pbuffer is the
@@ -60,94 +59,206 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
// The act of constructing them causes them to be registered
new X11GLXGraphicsConfigurationFactory();
try {
- NWReflection.createInstance("com.sun.opengl.impl.x11.glx.awt.X11AWTGLXGraphicsConfigurationFactory",
+ ReflectionUtil.createInstance("com.jogamp.opengl.impl.x11.glx.awt.X11AWTGLXGraphicsConfigurationFactory",
new Object[] {});
- } catch (Throwable t) { }
+ } catch (JogampRuntimeException jre) { /* n/a .. */ }
+
+ X11GraphicsDevice sharedDevice = new X11GraphicsDevice(X11Util.createThreadLocalDisplay(null));
+ vendorName = GLXUtil.getVendorName(sharedDevice.getHandle());
+ isVendorATI = GLXUtil.isVendorATI(vendorName);
+ isVendorNVIDIA = GLXUtil.isVendorNVIDIA(vendorName);
+ if( isVendorATI() ) {
+ X11Util.markGlobalDisplayUndeletable(sharedDevice.getHandle()); // ATI hack ..
+ }
+ sharedScreen = new X11GraphicsScreen(sharedDevice, 0);
+ X11Lib.XLockDisplay(sharedScreen.getDevice().getHandle());
+ try{
+ sharedDrawable = new X11DummyGLXDrawable(sharedScreen, this, null);
+ X11GLXContext ctx = (X11GLXContext) sharedDrawable.createContext(null);
+ ctx.makeCurrent();
+ ctx.release();
+ sharedContext = ctx;
+ }finally{
+ X11Lib.XUnlockDisplay(sharedScreen.getDevice().getHandle());
+ }
+ if(null==sharedContext) {
+ throw new GLException("Couldn't init shared resources");
+ }
+ if (DEBUG) {
+ System.err.println("!!! Vendor: "+vendorName+", ATI: "+isVendorATI+", NV: "+isVendorNVIDIA);
+ System.err.println("!!! SharedScreen: "+sharedScreen);
+ System.err.println("!!! SharedContext: "+sharedContext);
+ }
+ }
+
+ private X11GraphicsScreen sharedScreen;
+ private String vendorName;
+ private boolean isVendorATI;
+ private boolean isVendorNVIDIA;
+
+ public String getVendorName() { return vendorName; }
+ public boolean isVendorATI() { return isVendorATI; }
+ public boolean isVendorNVIDIA() { return isVendorNVIDIA; }
+
+ private X11DummyGLXDrawable sharedDrawable=null;
+ private X11GLXContext sharedContext=null;
+
+ protected final GLDrawableImpl getSharedDrawable() {
+ validate();
+ return sharedDrawable;
+ }
+
+ protected final GLContextImpl getSharedContext() {
+ validate();
+ return sharedContext;
+ }
+
+ public void shutdown() {
+ super.shutdown();
+ if (DEBUG) {
+ System.err.println("!!! Shutdown Shared:");
+ System.err.println("!!! CTX : "+sharedContext);
+ System.err.println("!!! Drawable: "+sharedDrawable);
+ System.err.println("!!! Screen : "+sharedScreen);
+ Exception e = new Exception("Debug");
+ e.printStackTrace();
+ }
+ if(null!=sharedContext) {
+ sharedContext.destroy(); // implies release, if current
+ }
+ if(null!=sharedDrawable) {
+ sharedDrawable.destroy();
+ }
+ if(null!=sharedScreen) {
+ X11GraphicsDevice sharedDevice = (X11GraphicsDevice) sharedScreen.getDevice();
+ if(null!=sharedDevice) {
+ X11Util.closeThreadLocalDisplay(null);
+ }
+ sharedScreen = null;
+ }
+ X11Util.shutdown( !isVendorATI(), DEBUG );
}
public GLDrawableImpl createOnscreenDrawable(NativeWindow target) {
+ validate();
if (target == null) {
throw new IllegalArgumentException("Null target");
}
+ if( isVendorATI() ) {
+ X11Util.markGlobalDisplayUndeletable(target.getDisplayHandle()); // ATI hack ..
+ }
return new X11OnscreenGLXDrawable(this, target);
}
protected GLDrawableImpl createOffscreenDrawable(NativeWindow target) {
+ validate();
+ if (target == null) {
+ throw new IllegalArgumentException("Null target");
+ }
+ if( isVendorATI() ) {
+ X11Util.markGlobalDisplayUndeletable(target.getDisplayHandle()); // ATI hack ..
+ }
return new X11OffscreenGLXDrawable(this, target);
}
- private boolean pbufferSupportInitialized = false;
- private boolean canCreateGLPbuffer = false;
- public boolean canCreateGLPbuffer() {
- if (!pbufferSupportInitialized) {
- long display = X11Util.getThreadLocalDefaultDisplay();
+ public boolean canCreateGLPbuffer(AbstractGraphicsDevice device) {
+ validate();
+ return glxVersionGreaterEqualThan(device, 1, 3);
+ }
+
+ private boolean glxVersionsQueried = false;
+ private int glxVersionMajor=0, glxVersionMinor=0;
+ public boolean glxVersionGreaterEqualThan(AbstractGraphicsDevice device, int majorReq, int minorReq) {
+ validate();
+ if (!glxVersionsQueried) {
+ if(null == device) {
+ device = (X11GraphicsDevice) sharedScreen.getDevice();
+ }
+ if(null == device) {
+ throw new GLException("FIXME: No AbstractGraphicsDevice (passed or shared-device");
+ }
+ long display = device.getHandle();
int[] major = new int[1];
int[] minor = new int[1];
- int screen = 0; // FIXME: provide way to specify this?
- if (!GLX.glXQueryVersion(display, major, 0, minor, 0)) {
- throw new GLException("glXQueryVersion failed");
- }
+ GLXUtil.getGLXVersion(display, major, minor);
if (DEBUG) {
System.err.println("!!! GLX version: major " + major[0] +
", minor " + minor[0]);
}
- // Work around bugs in ATI's Linux drivers where they report they
- // only implement GLX version 1.2 on the server side
- if (major[0] == 1 && minor[0] == 2) {
- String str = GLX.glXGetClientString(display, GLX.GLX_VERSION);
- if (str != null && str.startsWith("1.") &&
- (str.charAt(2) >= '3')) {
- canCreateGLPbuffer = true;
- }
- } else {
- canCreateGLPbuffer = ((major[0] > 1) || (minor[0] > 2));
- }
-
- pbufferSupportInitialized = true;
+ glxVersionMajor = major[0];
+ glxVersionMinor = minor[0];
+ glxVersionsQueried = true;
}
- return canCreateGLPbuffer;
+ return ( glxVersionMajor > majorReq ) || ( glxVersionMajor == majorReq && glxVersionMinor >= minorReq ) ;
}
protected GLDrawableImpl createGLPbufferDrawableImpl(final NativeWindow target) {
+ validate();
+ if (target == null) {
+ throw new IllegalArgumentException("Null target");
+ }
+
+ GLDrawableImpl pbufferDrawable;
+
/**
- * FIXME: Think about this ..
- * should not be necessary ? ..
- final List returnList = new ArrayList();
- final GLDrawableFactory factory = this;
- Runnable r = new Runnable() {
- public void run() {
- returnList.add(new X11PbufferGLXDrawable(factory, target));
+ * Due to the ATI Bug https://bugzilla.mozilla.org/show_bug.cgi?id=486277,
+ * we need to have a context current on the same Display to create a PBuffer.
+ * The dummy context shall also use the same Display,
+ * since switching Display in this regard is another ATI bug.
+ */
+ boolean usedSharedContext=false;
+ if( isVendorATI() && null == GLContext.getCurrent() ) {
+ sharedContext.makeCurrent();
+ usedSharedContext=true;
+ }
+ if( isVendorATI() ) {
+ X11Util.markGlobalDisplayUndeletable(target.getDisplayHandle()); // ATI hack ..
+ }
+ try {
+ pbufferDrawable = new X11PbufferGLXDrawable(this, target);
+ } finally {
+ if(usedSharedContext) {
+ sharedContext.release();
}
- };
- maybeDoSingleThreadedWorkaround(r);
- return (GLDrawableImpl) returnList.get(0);
- */
- return new X11PbufferGLXDrawable(this, target);
+ }
+ return pbufferDrawable;
}
protected NativeWindow createOffscreenWindow(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) {
- AbstractGraphicsScreen screen = X11GraphicsScreen.createDefault();
- NullWindow nw = new NullWindow(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capabilities, chooser, screen));
- nw.setSize(width, height);
+ validate();
+ NullWindow nw = null;
+ X11Lib.XLockDisplay(sharedScreen.getDevice().getHandle());
+ try{
+ nw = new NullWindow(X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capabilities, chooser, sharedScreen));
+ }finally{
+ X11Lib.XUnlockDisplay(sharedScreen.getDevice().getHandle());
+ }
+ if(nw != null) {
+ nw.setSize(width, height);
+ }
return nw;
}
public GLContext createExternalGLContext() {
+ validate();
return X11ExternalGLXContext.create(this, null);
}
- public boolean canCreateExternalGLDrawable() {
- return canCreateGLPbuffer();
+ public boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) {
+ validate();
+ return canCreateGLPbuffer(device);
}
public GLDrawable createExternalGLDrawable() {
+ validate();
return X11ExternalGLXDrawable.create(this, null);
}
public void loadGLULibrary() {
+ validate();
X11Lib.dlopen("/usr/lib/libGLU.so");
}
@@ -161,7 +272,8 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
return res;
}
- public boolean canCreateContextOnJava2DSurface() {
+ public boolean canCreateContextOnJava2DSurface(AbstractGraphicsDevice device) {
+ validate();
return false;
}
@@ -181,9 +293,10 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
return gammaRampLength;
}
- long display = X11Util.getThreadLocalDefaultDisplay();
+ long display = sharedScreen.getDevice().getHandle();
+
+ X11Lib.XLockDisplay(display);
try {
- X11Lib.XLockDisplay(display);
int[] size = new int[1];
boolean res = X11Lib.XF86VidModeGetGammaRampSize(display,
X11Lib.DefaultScreen(display),
@@ -206,9 +319,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
rampData[i] = (short) (ramp[i] * 65535);
}
- long display = X11Util.getThreadLocalDefaultDisplay();
+ long display = sharedScreen.getDevice().getHandle();
+ X11Lib.XLockDisplay(display);
try {
- X11Lib.XLockDisplay(display);
boolean res = X11Lib.XF86VidModeSetGammaRamp(display,
X11Lib.DefaultScreen(display),
rampData.length,
@@ -233,9 +346,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
rampData.position(2 * size);
rampData.limit(3 * size);
ShortBuffer blueRampData = rampData.slice();
- long display = X11Util.getThreadLocalDefaultDisplay();
+ long display = sharedScreen.getDevice().getHandle();
+ X11Lib.XLockDisplay(display);
try {
- X11Lib.XLockDisplay(display);
boolean res = X11Lib.XF86VidModeGetGammaRamp(display,
X11Lib.DefaultScreen(display),
size,
@@ -269,9 +382,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl implements Dyna
rampData.position(2 * size);
rampData.limit(3 * size);
ShortBuffer blueRampData = rampData.slice();
- long display = X11Util.getThreadLocalDefaultDisplay();
+ long display = sharedScreen.getDevice().getHandle();
+ X11Lib.XLockDisplay(display);
try {
- X11Lib.XLockDisplay(display);
X11Lib.XF86VidModeSetGammaRamp(display,
X11Lib.DefaultScreen(display),
size,
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java
index e1dca3af0..35daf0ae0 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java
@@ -30,16 +30,14 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.opengl.impl.x11.glx;
+package com.jogamp.opengl.impl.x11.glx;
-import java.util.*;
+import com.jogamp.common.nio.PointerBuffer;
import javax.media.nativewindow.*;
import javax.media.nativewindow.x11.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.gluegen.runtime.NativeLibrary;
-import com.sun.gluegen.runtime.PointerBuffer;
-import com.sun.nativewindow.impl.x11.*;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.nativewindow.impl.x11.*;
public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implements Cloneable {
protected static final boolean DEBUG = Debug.debug("GraphicsConfiguration");
@@ -66,18 +64,18 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
int screen = x11Screen.getIndex();
long fbcfg = glXFBConfigID2FBConfig(display, screen, fbcfgID);
if(0==fbcfg) {
- throw new GLException("FBConfig null of 0x"+Integer.toHexString(fbcfgID));
+ throw new GLException("FBConfig null of "+toHexString(fbcfgID));
}
if(null==glp) {
glp = GLProfile.getDefault();
}
GLCapabilities caps = GLXFBConfig2GLCapabilities(glp, display, fbcfg, true, true, true, GLXUtil.isMultisampleAvailable(display));
if(null==caps) {
- throw new GLException("GLCapabilities null of 0x"+Long.toHexString(fbcfg));
+ throw new GLException("GLCapabilities null of "+toHexString(fbcfg));
}
XVisualInfo xvi = GLX.glXGetVisualFromFBConfigCopied(display, fbcfg);
if(null==xvi) {
- throw new GLException("XVisualInfo null of 0x"+Long.toHexString(fbcfg));
+ throw new GLException("XVisualInfo null of "+toHexString(fbcfg));
}
return new X11GLXGraphicsConfiguration(x11Screen, caps, caps, new DefaultGLCapabilitiesChooser(), xvi, fbcfg, fbcfgID);
}
@@ -106,6 +104,10 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
}
}
+ private static int nonZeroOrDontCare(int value) {
+ return value != 0 ? value : (int)GLX.GLX_DONT_CARE ;
+ }
+
public static int[] GLCapabilities2AttribList(GLCapabilities caps,
boolean forFBAttr,
boolean isMultisampleAvailable,
@@ -224,10 +226,11 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
if ( onscreen ) {
res = ( 0 != (val & GLX.GLX_WINDOW_BIT) ) ;
} else {
- res = ( 0 != (val & GLX.GLX_PIXMAP_BIT) ) || usePBuffer ;
- }
- if ( usePBuffer ) {
- res = res && ( 0 != (val & GLX.GLX_PBUFFER_BIT) ) ;
+ if ( usePBuffer ) {
+ res = ( 0 != (val & GLX.GLX_PBUFFER_BIT) ) ;
+ } else {
+ res = ( 0 != (val & GLX.GLX_PIXMAP_BIT) ) ;
+ }
}
return res;
@@ -239,7 +242,10 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
int val;
val = glXGetFBConfig(display, fbcfg, GLX.GLX_RENDER_TYPE, tmp, 0);
if (val != GLX.GLX_RGBA_BIT) {
- throw new GLException("Visual does not support RGBA");
+ if(DEBUG) {
+ System.err.println("FBConfig ("+toHexString(fbcfg)+") does not support RGBA: "+toHexString(val));
+ }
+ return null;
}
GLCapabilities res = new GLCapabilities(glp);
@@ -251,7 +257,10 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
res.setOnscreen( 0 != (val & GLX.GLX_WINDOW_BIT) );
res.setPBuffer ( 0 != (val & GLX.GLX_PBUFFER_BIT) );
} else {
- throw new GLException("GLX_DRAWABLE_TYPE does not match !!!");
+ if(DEBUG) {
+ System.err.println("FBConfig ("+toHexString(fbcfg)+") GLX_DRAWABLE_TYPE does not match: req(onscrn "+onscreen+", pbuffer "+usePBuffer+"), got(onscreen "+( 0 != (val & GLX.GLX_WINDOW_BIT) )+", pbuffer "+( 0 != (val & GLX.GLX_PBUFFER_BIT) )+", pixmap "+( 0 != (val & GLX.GLX_PIXMAP_BIT) )+")");
+ }
+ return null;
}
res.setDoubleBuffered(glXGetFBConfig(display, fbcfg, GLX.GLX_DOUBLEBUFFER, tmp, 0) != 0);
res.setStereo (glXGetFBConfig(display, fbcfg, GLX.GLX_STEREO, tmp, 0) != 0);
@@ -304,7 +313,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
}
int res = GLX.glXGetFBConfigAttrib(display, cfg, attrib, tmp, tmp_offset);
if (res != 0) {
- throw new GLException("glXGetFBConfig(0x"+Long.toHexString(attrib)+") failed: error code " + glXGetFBConfigErrorCode(res));
+ throw new GLException("glXGetFBConfig("+toHexString(attrib)+") failed: error code " + glXGetFBConfigErrorCode(res));
}
return tmp[tmp_offset];
}
@@ -342,8 +351,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
NativeWindowFactory.getDefaultFactory().getToolkitLock().unlock();
}
if (DEBUG) {
- System.err.println("!!! Fetched XVisualInfo for visual ID 0x" + Long.toHexString(visualID));
- System.err.println("!!! Resulting XVisualInfo: visualid = 0x" + Long.toHexString(res.getVisualid()));
+ System.err.println("!!! Fetched XVisualInfo for visual ID " + toHexString(visualID));
+ System.err.println("!!! Resulting XVisualInfo: visualid = " + toHexString(res.getVisualid()));
}
return res;
}
@@ -352,11 +361,17 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
int[] tmp = new int[1];
int val = glXGetConfig(display, info, GLX.GLX_USE_GL, tmp, 0);
if (val == 0) {
- throw new GLException("Visual does not support OpenGL");
+ if(DEBUG) {
+ System.err.println("Visual ("+toHexString(info.getVisualid())+") does not support OpenGL");
+ }
+ return null;
}
val = glXGetConfig(display, info, GLX.GLX_RGBA, tmp, 0);
if (val == 0) {
- throw new GLException("Visual does not support RGBA");
+ if(DEBUG) {
+ System.err.println("Visual ("+toHexString(info.getVisualid())+") does not support RGBA");
+ }
+ return null;
}
GLCapabilities res = new GLCapabilities(glp);
res.setOnscreen (onscreen);
@@ -401,13 +416,21 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
}
int res = GLX.glXGetConfig(display, info, attrib, tmp, tmp_offset);
if (res != 0) {
- throw new GLException("glXGetConfig(0x"+Long.toHexString(attrib)+") failed: error code " + glXGetConfigErrorCode(res));
+ throw new GLException("glXGetConfig("+toHexString(attrib)+") failed: error code " + glXGetConfigErrorCode(res));
}
return tmp[tmp_offset];
}
+ public static String toHexString(int val) {
+ return "0x"+Integer.toHexString(val);
+ }
+
+ public static String toHexString(long val) {
+ return "0x"+Long.toHexString(val);
+ }
+
public String toString() {
- return "X11GLXGraphicsConfiguration["+getScreen()+", visualID 0x" + Long.toHexString(getVisualID()) + ", fbConfigID 0x" + Long.toHexString(fbConfigID) +
+ return "X11GLXGraphicsConfiguration["+getScreen()+", visualID " + toHexString(getVisualID()) + ", fbConfigID " + toHexString(fbConfigID) +
",\n\trequested " + getRequestedCapabilities()+
",\n\tchosen " + getChosenCapabilities()+
"]";
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java
index 808f2ab7d..e65fb5e90 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXGraphicsConfigurationFactory.java
@@ -30,18 +30,16 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.opengl.impl.x11.glx;
+package com.jogamp.opengl.impl.x11.glx;
+import com.jogamp.common.nio.PointerBuffer;
import javax.media.nativewindow.*;
import javax.media.nativewindow.x11.*;
-import com.sun.nativewindow.impl.NativeWindowFactoryImpl;
-import com.sun.nativewindow.impl.x11.*;
+import com.jogamp.nativewindow.impl.x11.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.opengl.impl.x11.glx.*;
+import com.jogamp.opengl.impl.*;
-import com.sun.gluegen.runtime.PointerBuffer;
/** Subclass of GraphicsConfigurationFactory used when non-AWT tookits
are used on X11 platforms. Toolkits will likely need to delegate
@@ -61,7 +59,8 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
return chooseGraphicsConfigurationStatic(capabilities, chooser, absScreen);
}
- protected static X11GLXGraphicsConfiguration createDefaultGraphicsConfiguration(AbstractGraphicsScreen absScreen, boolean onscreen, boolean usePBuffer) {
+ /**
+ protected static X11GLXGraphicsConfiguration createDefaultGraphicsConfigurationFBConfig(AbstractGraphicsScreen absScreen, boolean onscreen, boolean usePBuffer) {
if (absScreen == null) {
throw new IllegalArgumentException("AbstractGraphicsScreen is null");
}
@@ -80,9 +79,10 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
//
GLCapabilities capsFB = null;
long display = x11Screen.getDevice().getHandle();
+
+ NativeWindowFactory.getDefaultFactory().getToolkitLock().lock();
+ X11Lib.XLockDisplay(display);
try {
- NativeWindowFactory.getDefaultFactory().getToolkitLock().lock();
- X11Lib.XLockDisplay(display);
int screen = x11Screen.getIndex();
boolean isMultisampleAvailable = GLXUtil.isMultisampleAvailable(display);
@@ -112,7 +112,7 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
}
return new X11GLXGraphicsConfiguration(x11Screen, (null!=capsFB)?capsFB:caps, caps, null, xvis, fbcfg, fbid);
- }
+ } */
protected static X11GLXGraphicsConfiguration chooseGraphicsConfigurationStatic(Capabilities capabilities,
CapabilitiesChooser chooser,
@@ -145,7 +145,7 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
GLCapabilities caps2 = (GLCapabilities) capabilities.clone();
if(!caps2.isOnscreen()) {
- // OFFSCREEN !DOUBLE_BUFFER
+ // OFFSCREEN !DOUBLE_BUFFER // FIXME DBLBUFOFFSCRN
caps2.setDoubleBuffered(false);
}
@@ -155,14 +155,14 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
x11Screen);
if(null==res) {
if(usePBuffer) {
- throw new GLException("Error: Couldn't create X11GLXGraphicsConfiguration based on FBConfig");
+ throw new GLException("Error: Couldn't create X11GLXGraphicsConfiguration based on FBConfig for "+caps2);
}
res = chooseGraphicsConfigurationXVisual((GLCapabilities) caps2,
(GLCapabilitiesChooser) chooser,
x11Screen);
}
if(null==res) {
- throw new GLException("Error: Couldn't create X11GLXGraphicsConfiguration");
+ throw new GLException("Error: Couldn't create X11GLXGraphicsConfiguration based on FBConfig and XVisual for "+caps2);
}
if(DEBUG) {
System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationStatic("+x11Screen+","+caps2+"): "+res);
@@ -173,6 +173,7 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
protected static X11GLXGraphicsConfiguration chooseGraphicsConfigurationFBConfig(GLCapabilities capabilities,
GLCapabilitiesChooser chooser,
X11GraphicsScreen x11Screen) {
+ long recommendedFBConfig = 0;
int recommendedIndex = -1;
GLCapabilities[] caps = null;
PointerBuffer fbcfgsL = null;
@@ -187,70 +188,113 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
//
AbstractGraphicsDevice absDevice = x11Screen.getDevice();
long display = absDevice.getHandle();
+
+ NativeWindowFactory.getDefaultFactory().getToolkitLock().lock();
try {
- NativeWindowFactory.getDefaultFactory().getToolkitLock().lock();
X11Lib.XLockDisplay(display);
- int screen = x11Screen.getIndex();
- boolean isMultisampleAvailable = GLXUtil.isMultisampleAvailable(display);
- int[] attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(capabilities, true, isMultisampleAvailable, display, screen);
- int[] count = { -1 };
-
- fbcfgsL = GLX.glXChooseFBConfigCopied(display, screen, attribs, 0, count, 0);
- if (fbcfgsL == null || fbcfgsL.limit()<1) {
- if(DEBUG) {
- System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: Failed glXChooseFBConfig ("+x11Screen+","+capabilities+"): "+fbcfgsL+", "+count[0]);
+ try{
+ int screen = x11Screen.getIndex();
+ boolean isMultisampleAvailable = GLXUtil.isMultisampleAvailable(display);
+ int[] attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(capabilities, true, isMultisampleAvailable, display, screen);
+ int[] count = { -1 };
+
+ // determine the recommended FBConfig ..
+ fbcfgsL = GLX.glXChooseFBConfigCopied(display, screen, attribs, 0, count, 0);
+ if (fbcfgsL == null || fbcfgsL.limit()<1) {
+ if(DEBUG) {
+ System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: Failed glXChooseFBConfig ("+x11Screen+","+capabilities+"): "+fbcfgsL+", "+count[0]);
+ }
+ } else if( !X11GLXGraphicsConfiguration.GLXFBConfigValid( display, fbcfgsL.get(0) ) ) {
+ if(DEBUG) {
+ System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: Failed - GLX FBConfig invalid: ("+x11Screen+","+capabilities+"): "+fbcfgsL+", fbcfg: "+toHexString(fbcfgsL.get(0)));
+ }
+ } else {
+ recommendedFBConfig = fbcfgsL.get(0);
}
- return null;
- }
- if( !X11GLXGraphicsConfiguration.GLXFBConfigValid( display, fbcfgsL.get(0) ) ) {
- if(DEBUG) {
- System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: Failed - GLX FBConfig invalid: ("+x11Screen+","+capabilities+"): "+fbcfgsL+", fbcfg: 0x"+Long.toHexString(fbcfgsL.get(0)));
+
+ // get all, glXChooseFBConfig(.. attribs==null ..) == glXGetFBConfig(..)
+ fbcfgsL = GLX.glXChooseFBConfigCopied(display, screen, null, 0, count, 0);
+ if (fbcfgsL == null || fbcfgsL.limit()<1) {
+ if(DEBUG) {
+ System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: Failed glXGetFBConfig ("+x11Screen+"): "+fbcfgsL+", "+count[0]);
+ }
+ return null;
}
- return null;
- }
- recommendedIndex = 0; // 1st match is always recommended ..
- caps = new GLCapabilities[fbcfgsL.limit()];
- for (int i = 0; i < fbcfgsL.limit(); i++) {
- caps[i] = X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities(glProfile, display, fbcfgsL.get(i),
- false, onscreen, usePBuffer, isMultisampleAvailable);
- }
- if(null==chooser) {
- chosen = recommendedIndex;
- } else {
- try {
- chosen = chooser.chooseCapabilities(capabilities, caps, recommendedIndex);
- } catch (NativeWindowException e) {
- if(DEBUG) {
- e.printStackTrace();
- }
- chosen = -1;
+ // make GLCapabilities and seek the recommendedIndex
+ caps = new GLCapabilities[fbcfgsL.limit()];
+ for (int i = 0; i < fbcfgsL.limit(); i++) {
+ if( !X11GLXGraphicsConfiguration.GLXFBConfigValid( display, fbcfgsL.get(i) ) ) {
+ if(DEBUG) {
+ System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: FBConfig invalid: ("+x11Screen+","+capabilities+"): fbcfg: "+toHexString(fbcfgsL.get(i)));
+ }
+ } else {
+ caps[i] = X11GLXGraphicsConfiguration.GLXFBConfig2GLCapabilities(glProfile, display, fbcfgsL.get(i),
+ false, onscreen, usePBuffer, isMultisampleAvailable);
+ if(caps[i]!=null && recommendedFBConfig==fbcfgsL.get(i)) {
+ recommendedIndex=i;
+ if (DEBUG) {
+ System.err.println("!!! glXChooseFBConfig recommended "+i+", "+caps[i]);
+ }
+ }
+ }
}
- }
- if (chosen < 0) {
- // keep on going ..
- if(DEBUG) {
- System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig Failed .. unable to choose config, using first");
- }
- chosen = 0; // default ..
- } else if (chosen >= caps.length) {
- throw new GLException("GLCapabilitiesChooser specified invalid index (expected 0.." + (caps.length - 1) + ")");
- }
- retFBID = X11GLXGraphicsConfiguration.glXFBConfig2FBConfigID(display, fbcfgsL.get(chosen));
+ if(null==chooser) {
+ chosen = recommendedIndex; // may still be -1 in case nothing was recommended (-1)
+ }
- retXVisualInfo = GLX.glXGetVisualFromFBConfigCopied(display, fbcfgsL.get(chosen));
- if (retXVisualInfo==null) {
- if(DEBUG) {
- System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: Failed glXGetVisualFromFBConfig ("+x11Screen+", "+fbcfgsL.get(chosen) +" (Continue: "+(false==caps[chosen].isOnscreen())+"):\n\t"+caps[chosen]);
+ if (chosen < 0) {
+ if(null==chooser) {
+ // nothing recommended .. so use our default implementation
+ chooser = new DefaultGLCapabilitiesChooser();
+ }
+ try {
+ chosen = chooser.chooseCapabilities(capabilities, caps, recommendedIndex);
+ } catch (NativeWindowException e) {
+ if(DEBUG) {
+ e.printStackTrace();
+ }
+ chosen = -1;
+ }
}
- if(caps[chosen].isOnscreen()) {
- // Onscreen drawables shall have a XVisual ..
+ if (chosen < 0) {
+ // keep on going ..
+ if(DEBUG) {
+ System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig Failed .. unable to choose config, using first");
+ }
+ // seek first available one ..
+ for(chosen = 0; chosen < caps.length && caps[chosen]==null; chosen++) ;
+ if(chosen==caps.length) {
+ // give up ..
+ if(DEBUG) {
+ System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig Failed .. nothing available, bail out");
+ }
+ return null;
+ }
+ } else if (chosen >= caps.length) {
+ if(DEBUG) {
+ System.err.println("GLCapabilitiesChooser specified invalid index (expected 0.." + (caps.length - 1) + ", got "+chosen+")");
+ }
return null;
}
+
+ retFBID = X11GLXGraphicsConfiguration.glXFBConfig2FBConfigID(display, fbcfgsL.get(chosen));
+
+ retXVisualInfo = GLX.glXGetVisualFromFBConfigCopied(display, fbcfgsL.get(chosen));
+ if (retXVisualInfo==null) {
+ if(DEBUG) {
+ System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: Failed glXGetVisualFromFBConfig ("+x11Screen+", "+fbcfgsL.get(chosen) +" (Continue: "+(false==caps[chosen].isOnscreen())+"):\n\t"+caps[chosen]);
+ }
+ if(caps[chosen].isOnscreen()) {
+ // Onscreen drawables shall have a XVisual ..
+ return null;
+ }
+ }
+ }finally{
+ X11Lib.XUnlockDisplay(display);
}
} finally {
- X11Lib.XUnlockDisplay(display);
NativeWindowFactory.getDefaultFactory().getToolkitLock().unlock();
}
@@ -277,64 +321,77 @@ public class X11GLXGraphicsConfigurationFactory extends GraphicsConfigurationFac
AbstractGraphicsDevice absDevice = x11Screen.getDevice();
long display = absDevice.getHandle();
+
+ NativeWindowFactory.getDefaultFactory().getToolkitLock().lock();
try {
- NativeWindowFactory.getDefaultFactory().getToolkitLock().lock();
X11Lib.XLockDisplay(display);
- int screen = x11Screen.getIndex();
- boolean isMultisampleAvailable = GLXUtil.isMultisampleAvailable(display);
- int[] attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(capabilities, false, isMultisampleAvailable, display, screen);
- XVisualInfo[] infos = null;
-
- XVisualInfo recommendedVis = GLX.glXChooseVisualCopied(display, screen, attribs, 0);
- if (DEBUG) {
- System.err.print("!!! glXChooseVisual recommended ");
- if (recommendedVis == null) {
- System.err.println("null visual");
- } else {
- System.err.println("visual id 0x" + Long.toHexString(recommendedVis.getVisualid()));
+ try{
+ int screen = x11Screen.getIndex();
+ boolean isMultisampleAvailable = GLXUtil.isMultisampleAvailable(display);
+ int[] attribs = X11GLXGraphicsConfiguration.GLCapabilities2AttribList(capabilities, false, isMultisampleAvailable, display, screen);
+ XVisualInfo[] infos = null;
+
+ XVisualInfo recommendedVis = GLX.glXChooseVisualCopied(display, screen, attribs, 0);
+ if (DEBUG) {
+ System.err.print("!!! glXChooseVisual recommended ");
+ if (recommendedVis == null) {
+ System.err.println("null visual");
+ } else {
+ System.err.println("visual id " + toHexString(recommendedVis.getVisualid()));
+ }
}
- }
- int[] count = new int[1];
- XVisualInfo template = XVisualInfo.create();
- template.setScreen(screen);
- infos = X11Lib.XGetVisualInfoCopied(display, X11Lib.VisualScreenMask, template, count, 0);
- if (infos == null || infos.length<1) {
- throw new GLException("Error while enumerating available XVisualInfos");
- }
- caps = new GLCapabilities[infos.length];
- for (int i = 0; i < infos.length; i++) {
- caps[i] = X11GLXGraphicsConfiguration.XVisualInfo2GLCapabilities(glProfile, display, infos[i], onscreen, false, isMultisampleAvailable);
- // Attempt to find the visual chosen by glXChooseVisual
- if (recommendedVis != null && recommendedVis.getVisualid() == infos[i].getVisualid()) {
- recommendedIndex = i;
+ int[] count = new int[1];
+ XVisualInfo template = XVisualInfo.create();
+ template.setScreen(screen);
+ infos = X11Lib.XGetVisualInfoCopied(display, X11Lib.VisualScreenMask, template, count, 0);
+ if (infos == null || infos.length<1) {
+ throw new GLException("Error while enumerating available XVisualInfos");
}
+ caps = new GLCapabilities[infos.length];
+ for (int i = 0; i < infos.length; i++) {
+ caps[i] = X11GLXGraphicsConfiguration.XVisualInfo2GLCapabilities(glProfile, display, infos[i], onscreen, false, isMultisampleAvailable);
+ // Attempt to find the visual chosen by glXChooseVisual
+ if (recommendedVis != null && recommendedVis.getVisualid() == infos[i].getVisualid()) {
+ recommendedIndex = i;
+ }
+ }
+ try {
+ chosen = chooser.chooseCapabilities(capabilities, caps, recommendedIndex);
+ } catch (NativeWindowException e) {
+ if(DEBUG) {
+ e.printStackTrace();
+ }
+ chosen = -1;
+ }
+ if (chosen < 0) {
+ // keep on going ..
+ if(DEBUG) {
+ System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationXVisual Failed .. unable to choose config, using first");
+ }
+ chosen = 0; // default ..
+ } else if (chosen >= caps.length) {
+ throw new GLException("GLCapabilitiesChooser specified invalid index (expected 0.." + (caps.length - 1) + ")");
+ }
+ if (infos[chosen] == null) {
+ throw new GLException("GLCapabilitiesChooser chose an invalid visual for "+caps[chosen]);
+ }
+ retXVisualInfo = XVisualInfo.create(infos[chosen]);
+ }finally{
+ X11Lib.XUnlockDisplay(display);
}
- try {
- chosen = chooser.chooseCapabilities(capabilities, caps, recommendedIndex);
- } catch (NativeWindowException e) {
- if(DEBUG) {
- e.printStackTrace();
- }
- chosen = -1;
- }
- if (chosen < 0) {
- // keep on going ..
- if(DEBUG) {
- System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationXVisual Failed .. unable to choose config, using first");
- }
- chosen = 0; // default ..
- } else if (chosen >= caps.length) {
- throw new GLException("GLCapabilitiesChooser specified invalid index (expected 0.." + (caps.length - 1) + ")");
- }
- if (infos[chosen] == null) {
- throw new GLException("GLCapabilitiesChooser chose an invalid visual");
- }
- retXVisualInfo = XVisualInfo.create(infos[chosen]);
} finally {
- X11Lib.XUnlockDisplay(display);
NativeWindowFactory.getDefaultFactory().getToolkitLock().unlock();
}
return new X11GLXGraphicsConfiguration(x11Screen, caps[chosen], capabilities, chooser, retXVisualInfo, 0, -1);
}
+
+ public static String toHexString(int val) {
+ return "0x"+Integer.toHexString(val);
+ }
+
+ public static String toHexString(long val) {
+ return "0x"+Long.toHexString(val);
+ }
+
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java
index 7a38f0ce1..bea953ee9 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXContext.java
@@ -37,11 +37,11 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.x11.glx;
+package com.jogamp.opengl.impl.x11.glx;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.opengl.impl.x11.*;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.opengl.impl.x11.*;
public class X11OffscreenGLXContext extends X11GLXContext {
private X11OffscreenGLXDrawable drawable;
@@ -54,7 +54,7 @@ public class X11OffscreenGLXContext extends X11GLXContext {
public int getOffscreenContextPixelDataType() {
GL gl = getGL();
- return gl.isGL2()?GL2.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1;
+ return gl.isGL2GL3()?GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV:GL.GL_UNSIGNED_SHORT_5_5_5_1;
}
public int getOffscreenContextReadBuffer() {
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java
index 30772f8ab..14d07e74f 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OffscreenGLXDrawable.java
@@ -37,12 +37,11 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.x11.glx;
+package com.jogamp.opengl.impl.x11.glx;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.x11.*;
+import com.jogamp.nativewindow.impl.x11.*;
public class X11OffscreenGLXDrawable extends X11GLXDrawable {
private long pixmap;
@@ -76,26 +75,30 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable {
getFactoryImpl().lockToolkit();
try {
- X11Lib.XLockDisplay(dpy);
- pixmap = X11Lib.XCreatePixmap(dpy, (int) X11Lib.RootWindow(dpy, screen),
- component.getWidth(), component.getHeight(), bitsPerPixel);
- if (pixmap == 0) {
- throw new GLException("XCreatePixmap failed");
- }
- long drawable = GLX.glXCreateGLXPixmap(dpy, vis, pixmap);
- if (drawable == 0) {
- X11Lib.XFreePixmap(dpy, pixmap);
- pixmap = 0;
- throw new GLException("glXCreateGLXPixmap failed");
- }
- ((SurfaceChangeable)nw).setSurfaceHandle(drawable);
- if (DEBUG) {
- System.err.println("Created pixmap " + toHexString(pixmap) +
- ", GLXPixmap " + toHexString(drawable) +
- ", display " + toHexString(dpy));
- }
+ X11Lib.XLockDisplay(dpy);
+ try{
+
+ pixmap = X11Lib.XCreatePixmap(dpy, X11Lib.RootWindow(dpy, screen),
+ component.getWidth(), component.getHeight(), bitsPerPixel);
+ if (pixmap == 0) {
+ throw new GLException("XCreatePixmap failed");
+ }
+ long drawable = GLX.glXCreateGLXPixmap(dpy, vis, pixmap);
+ if (drawable == 0) {
+ X11Lib.XFreePixmap(dpy, pixmap);
+ pixmap = 0;
+ throw new GLException("glXCreateGLXPixmap failed");
+ }
+ ((SurfaceChangeable)nw).setSurfaceHandle(drawable);
+ if (DEBUG) {
+ System.err.println("Created pixmap " + toHexString(pixmap) +
+ ", GLXPixmap " + toHexString(drawable) +
+ ", display " + toHexString(dpy));
+ }
+ }finally{
+ X11Lib.XUnlockDisplay(dpy);
+ }
} finally {
- X11Lib.XUnlockDisplay(dpy);
getFactoryImpl().unlockToolkit();
}
}
@@ -105,41 +108,45 @@ public class X11OffscreenGLXDrawable extends X11GLXDrawable {
NativeWindow nw = getNativeWindow();
long display = nw.getDisplayHandle();
+
+ getFactoryImpl().lockToolkit();
try {
- getFactoryImpl().lockToolkit();
- X11Lib.XLockDisplay(display);
-
- long drawable = nw.getSurfaceHandle();
- if (DEBUG) {
- System.err.println("Destroying pixmap " + toHexString(pixmap) +
- ", GLXPixmap " + toHexString(drawable) +
- ", display " + toHexString(display));
- }
-
- // Must destroy pixmap and GLXPixmap
-
- if (DEBUG) {
- long cur = GLX.glXGetCurrentContext();
- if (cur != 0) {
- System.err.println("WARNING: found context " + toHexString(cur) + " current during pixmap destruction");
+ X11Lib.XLockDisplay(display);
+ try{
+ long drawable = nw.getSurfaceHandle();
+ if (DEBUG) {
+ System.err.println("Destroying pixmap " + toHexString(pixmap) +
+ ", GLXPixmap " + toHexString(drawable) +
+ ", display " + toHexString(display));
+ }
+
+ // Must destroy pixmap and GLXPixmap
+
+ if (DEBUG) {
+ long cur = GLX.glXGetCurrentContext();
+ if (cur != 0) {
+ System.err.println("WARNING: found context " + toHexString(cur) + " current during pixmap destruction");
+ }
+ }
+
+ // FIXME: workaround for crashes on NVidia hardware when
+ // destroying pixmap (no context is current at the point of the
+ // crash, at least from the point of view of
+ // glXGetCurrentContext)
+ GLX.glXMakeCurrent(display, 0, 0);
+
+ GLX.glXDestroyGLXPixmap(display, drawable);
+ X11Lib.XFreePixmap(display, pixmap);
+ drawable = 0;
+ pixmap = 0;
+ ((SurfaceChangeable)nw).setSurfaceHandle(0);
+
+ }finally{
+ X11Lib.XUnlockDisplay(display);
}
- }
-
- // FIXME: workaround for crashes on NVidia hardware when
- // destroying pixmap (no context is current at the point of the
- // crash, at least from the point of view of
- // glXGetCurrentContext)
- GLX.glXMakeCurrent(display, 0, 0);
-
- GLX.glXDestroyGLXPixmap(display, drawable);
- X11Lib.XFreePixmap(display, pixmap);
- drawable = 0;
- pixmap = 0;
- display = 0;
- ((SurfaceChangeable)nw).setSurfaceHandle(0);
} finally {
- X11Lib.XUnlockDisplay(display);
getFactoryImpl().unlockToolkit();
+ display = 0;
}
}
protected void swapBuffersImpl() {
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OnscreenGLXContext.java
index a73b41146..c89a5efd5 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OnscreenGLXContext.java
@@ -37,14 +37,14 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.x11.glx;
+package com.jogamp.opengl.impl.x11.glx;
import java.util.*;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.opengl.impl.x11.*;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.opengl.impl.x11.*;
public class X11OnscreenGLXContext extends X11GLXContext {
// This indicates whether the context we have created is indirect
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java
index 4a81448fd..43468b858 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java
@@ -37,12 +37,12 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.x11.glx;
+package com.jogamp.opengl.impl.x11.glx;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.opengl.impl.x11.*;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.opengl.impl.x11.*;
public class X11OnscreenGLXDrawable extends X11GLXDrawable {
protected X11OnscreenGLXDrawable(GLDrawableFactory factory, NativeWindow component) {
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXContext.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXContext.java
index 3938c0ecc..1b70adf6b 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXContext.java
@@ -37,11 +37,11 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.x11.glx;
+package com.jogamp.opengl.impl.x11.glx;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
-import com.sun.opengl.impl.x11.*;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.opengl.impl.x11.*;
public class X11PbufferGLXContext extends X11GLXContext {
private X11PbufferGLXDrawable drawable;
@@ -68,33 +68,6 @@ public class X11PbufferGLXContext extends X11GLXContext {
}
protected void create() {
- if (DEBUG) {
- System.err.println("Creating context for pbuffer " + drawable.getWidth() +
- " x " + drawable.getHeight());
- }
-
- // Create a gl context for the p-buffer.
- X11GLXContext other = (X11GLXContext) GLContextShareSet.getShareContext(this);
- long share = 0;
- if (other != null) {
- share = other.getContext();
- if (share == 0) {
- throw new GLException("GLContextShareSet returned an invalid OpenGL context");
- }
- }
- X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)
- getGLDrawable().getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
-
- context = GLX.glXCreateNewContext(drawable.getNativeWindow().getDisplayHandle(),
- config.getFBConfig(), GLX.GLX_RGBA_TYPE, share, true);
- if (context == 0) {
- throw new GLException("pbuffer creation error: glXCreateNewContext() failed");
- }
- GLContextShareSet.contextCreated(this);
-
- if (DEBUG) {
- System.err.println("Created context for pbuffer " + drawable.getWidth() +
- " x " + drawable.getHeight());
- }
+ createContext(true);
}
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
index e87ef54ac..50b32b9ec 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
@@ -37,13 +37,13 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.impl.x11.glx;
+package com.jogamp.opengl.impl.x11.glx;
import javax.media.opengl.*;
import javax.media.nativewindow.*;
-import com.sun.opengl.impl.*;
-import com.sun.opengl.impl.x11.glx.*;
-import com.sun.nativewindow.impl.x11.*;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.opengl.impl.x11.glx.*;
+import com.jogamp.nativewindow.impl.x11.*;
public class X11PbufferGLXDrawable extends X11GLXDrawable {
protected X11PbufferGLXDrawable(GLDrawableFactory factory, NativeWindow target) {
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java
index 1b92e6f86..dc6c60664 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java
@@ -30,7 +30,7 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.opengl.impl.x11.glx.awt;
+package com.jogamp.opengl.impl.x11.glx.awt;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
@@ -41,12 +41,12 @@ import javax.media.nativewindow.awt.*;
import javax.media.opengl.*;
import javax.media.opengl.awt.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.jawt.*;
-import com.sun.nativewindow.impl.jawt.x11.*;
-import com.sun.nativewindow.impl.x11.*;
-import com.sun.opengl.impl.x11.*;
-import com.sun.opengl.impl.x11.glx.*;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.nativewindow.impl.jawt.*;
+import com.jogamp.nativewindow.impl.jawt.x11.*;
+import com.jogamp.nativewindow.impl.x11.*;
+import com.jogamp.opengl.impl.x11.*;
+import com.jogamp.opengl.impl.x11.glx.*;
public class X11AWTGLXGraphicsConfigurationFactory extends GraphicsConfigurationFactory {
protected static final boolean DEBUG = Debug.debug("GraphicsConfiguration");
@@ -92,7 +92,7 @@ public class X11AWTGLXGraphicsConfigurationFactory extends GraphicsConfiguration
try {
long displayHandle = X11SunJDKReflection.graphicsDeviceGetDisplay(device);
if(0==displayHandle) {
- displayHandle = X11Util.getThreadLocalDefaultDisplay();
+ displayHandle = X11Util.createThreadLocalDefaultDisplay();
if(DEBUG) {
System.err.println("X11AWTGLXGraphicsConfigurationFactory: using a thread local X11 display");
}
diff --git a/src/jogl/classes/com/sun/opengl/util/AWTAnimatorImpl.java b/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java
index 9809e44d2..d8e1cf080 100644
--- a/src/jogl/classes/com/sun/opengl/util/AWTAnimatorImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java
@@ -30,7 +30,7 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.opengl.util;
+package com.jogamp.opengl.util;
import java.awt.Component;
import java.awt.EventQueue;
diff --git a/src/jogl/classes/com/sun/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
index 1d4b832e8..30be0bd90 100755
--- a/src/jogl/classes/com/sun/opengl/util/Animator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
@@ -37,13 +37,13 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util;
+package com.jogamp.opengl.util;
import java.util.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.Debug;
+import com.jogamp.opengl.impl.Debug;
/** <P> An Animator can be attached to one or more {@link
GLAutoDrawable}s to drive their display() methods in a loop. </P>
@@ -72,7 +72,7 @@ public class Animator {
if(GLProfile.isAWTJOGLAvailable()) {
try {
- impl = (AnimatorImpl) Class.forName("com.sun.opengl.util.awt.AWTAnimatorImpl").newInstance();
+ impl = (AnimatorImpl) Class.forName("com.jogamp.opengl.util.awt.AWTAnimatorImpl").newInstance();
} catch (Exception e) { }
}
if(null==impl) {
diff --git a/src/jogl/classes/com/sun/opengl/util/AnimatorImpl.java b/src/jogl/classes/com/jogamp/opengl/util/AnimatorImpl.java
index 8bba4b71a..50b91b729 100644
--- a/src/jogl/classes/com/sun/opengl/util/AnimatorImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/AnimatorImpl.java
@@ -30,7 +30,7 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.opengl.util;
+package com.jogamp.opengl.util;
import java.util.*;
import javax.media.opengl.*;
diff --git a/src/jogl/classes/com/sun/opengl/util/FBObject.java b/src/jogl/classes/com/jogamp/opengl/util/FBObject.java
index 84b79dff4..4920ed5f5 100755
--- a/src/jogl/classes/com/sun/opengl/util/FBObject.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/FBObject.java
@@ -31,7 +31,7 @@
*
*/
-package com.sun.opengl.util;
+package com.jogamp.opengl.util;
import javax.media.opengl.*;
diff --git a/src/jogl/classes/com/sun/opengl/util/FPSAnimator.java b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
index 290de89d6..75c4cdff7 100755
--- a/src/jogl/classes/com/sun/opengl/util/FPSAnimator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util;
+package com.jogamp.opengl.util;
import java.util.*;
import javax.media.opengl.*;
diff --git a/src/jogl/classes/com/sun/opengl/util/FileUtil.java b/src/jogl/classes/com/jogamp/opengl/util/FileUtil.java
index 84b846853..6ad0da825 100755
--- a/src/jogl/classes/com/sun/opengl/util/FileUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/FileUtil.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util;
+package com.jogamp.opengl.util;
import java.io.*;
diff --git a/src/jogl/classes/com/sun/opengl/util/FixedPoint.java b/src/jogl/classes/com/jogamp/opengl/util/FixedPoint.java
index e9bdae0e9..6412db5ef 100644
--- a/src/jogl/classes/com/sun/opengl/util/FixedPoint.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/FixedPoint.java
@@ -31,7 +31,7 @@
*
*/
-package com.sun.opengl.util;
+package com.jogamp.opengl.util;
public class FixedPoint {
public static final int toFixed(int value) {
diff --git a/src/jogl/classes/com/sun/opengl/util/GLArrayDataClient.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
index ec4c5e393..1141f6624 100644
--- a/src/jogl/classes/com/sun/opengl/util/GLArrayDataClient.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
@@ -1,13 +1,14 @@
-package com.sun.opengl.util;
+package com.jogamp.opengl.util;
+import com.jogamp.common.nio.Buffers;
import java.security.*;
import javax.media.opengl.*;
-import com.sun.opengl.util.glsl.*;
+import com.jogamp.opengl.util.glsl.*;
-import com.sun.opengl.impl.SystemUtil;
+import com.jogamp.opengl.impl.SystemUtil;
import java.nio.*;
@@ -189,7 +190,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
public void padding(int done) {
if ( buffer==null || sealed ) return;
while(done<strideL) {
- BufferUtil.putb(buffer, (byte)0);
+ Buffers.putb(buffer, (byte)0);
done++;
}
}
@@ -206,25 +207,25 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
throw new GLException("Buffer length ("+v.remaining()+") is not a multiple of component-stride:\n\t"+this);
}
growBufferIfNecessary(v.remaining());
- BufferUtil.put(buffer, v);
+ Buffers.put(buffer, v);
}
public void putb(byte v) {
if ( buffer==null || sealed ) return;
growBufferIfNecessary(1);
- BufferUtil.putb(buffer, v);
+ Buffers.putb(buffer, v);
}
public void puts(short v) {
if ( buffer==null || sealed ) return;
growBufferIfNecessary(1);
- BufferUtil.puts(buffer, v);
+ Buffers.puts(buffer, v);
}
public void puti(int v) {
if ( buffer==null || sealed ) return;
growBufferIfNecessary(1);
- BufferUtil.puti(buffer, v);
+ Buffers.puti(buffer, v);
}
public void putx(int v) {
@@ -234,7 +235,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
public void putf(float v) {
if ( buffer==null || sealed ) return;
growBufferIfNecessary(1);
- BufferUtil.putf(buffer, v);
+ Buffers.putf(buffer, v);
}
public String toString() {
@@ -274,28 +275,28 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
if(components>0) {
int osize = (buffer!=null)?buffer.capacity():0;
if(clazz==ByteBuffer.class) {
- ByteBuffer newBBuffer = BufferUtil.newByteBuffer( (osize+additional) * components );
+ ByteBuffer newBBuffer = Buffers.newDirectByteBuffer( (osize+additional) * components );
if(buffer!=null) {
buffer.flip();
newBBuffer.put((ByteBuffer)buffer);
}
buffer = newBBuffer;
} else if(clazz==ShortBuffer.class) {
- ShortBuffer newSBuffer = BufferUtil.newShortBuffer( (osize+additional) * components );
+ ShortBuffer newSBuffer = Buffers.newDirectShortBuffer( (osize+additional) * components );
if(buffer!=null) {
buffer.flip();
newSBuffer.put((ShortBuffer)buffer);
}
buffer = newSBuffer;
} else if(clazz==IntBuffer.class) {
- IntBuffer newIBuffer = BufferUtil.newIntBuffer( (osize+additional) * components );
+ IntBuffer newIBuffer = Buffers.newDirectIntBuffer( (osize+additional) * components );
if(buffer!=null) {
buffer.flip();
newIBuffer.put((IntBuffer)buffer);
}
buffer = newIBuffer;
} else if(clazz==FloatBuffer.class) {
- FloatBuffer newFBuffer = BufferUtil.newFloatBuffer( (osize+additional) * components );
+ FloatBuffer newFBuffer = Buffers.newDirectFloatBuffer( (osize+additional) * components );
if(buffer!=null) {
buffer.flip();
newFBuffer.put((FloatBuffer)buffer);
diff --git a/src/jogl/classes/com/sun/opengl/util/GLArrayDataEditable.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java
index c8fcbf573..0f8ed27be 100644
--- a/src/jogl/classes/com/sun/opengl/util/GLArrayDataEditable.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java
@@ -1,5 +1,5 @@
-package com.sun.opengl.util;
+package com.jogamp.opengl.util;
import javax.media.opengl.*;
diff --git a/src/jogl/classes/com/sun/opengl/util/GLArrayDataServer.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java
index dc233ce36..c061e212a 100644
--- a/src/jogl/classes/com/sun/opengl/util/GLArrayDataServer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java
@@ -1,10 +1,10 @@
-package com.sun.opengl.util;
+package com.jogamp.opengl.util;
import javax.media.opengl.*;
import java.nio.*;
-import com.sun.opengl.util.glsl.*;
+import com.jogamp.opengl.util.glsl.*;
public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataEditable {
diff --git a/src/jogl/classes/com/sun/opengl/util/GLArrayDataWrapper.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java
index 72e7c19bb..2ab77fa1b 100644
--- a/src/jogl/classes/com/sun/opengl/util/GLArrayDataWrapper.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.util;
+package com.jogamp.opengl.util;
import javax.media.opengl.*;
-import com.sun.opengl.util.glsl.fixedfunc.impl.*;
+import com.jogamp.opengl.util.glsl.fixedfunc.impl.*;
import java.nio.*;
@@ -65,16 +65,16 @@ public class GLArrayDataWrapper implements GLArrayData {
public final int getComponentSize() {
if(clazz==ByteBuffer.class) {
- return BufferUtil.SIZEOF_BYTE;
+ return GLBuffers.SIZEOF_BYTE;
}
if(clazz==ShortBuffer.class) {
- return BufferUtil.SIZEOF_SHORT;
+ return GLBuffers.SIZEOF_SHORT;
}
if(clazz==IntBuffer.class) {
- return BufferUtil.SIZEOF_INT;
+ return GLBuffers.SIZEOF_INT;
}
if(clazz==FloatBuffer.class) {
- return BufferUtil.SIZEOF_FLOAT;
+ return GLBuffers.SIZEOF_FLOAT;
}
throw new GLException("Given Buffer Class not supported: "+clazz+":\n\t"+this);
}
diff --git a/src/jogl/classes/com/sun/opengl/util/GLArrayHandler.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayHandler.java
index 9443ad6ed..bfabb5b01 100644
--- a/src/jogl/classes/com/sun/opengl/util/GLArrayHandler.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayHandler.java
@@ -1,5 +1,5 @@
-package com.sun.opengl.util;
+package com.jogamp.opengl.util;
import javax.media.opengl.*;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java
new file mode 100755
index 000000000..efe3a7675
--- /dev/null
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java
@@ -0,0 +1,137 @@
+/*
+ * 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.
+ *
+ * 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 com.jogamp.opengl.util;
+
+import com.jogamp.common.nio.Buffers;
+import javax.media.opengl.GL;
+import javax.media.opengl.GL2;
+import javax.media.opengl.GL2ES2;
+
+import java.nio.*;
+
+/**
+ * Utility routines for dealing with direct buffers.
+ * @author Kenneth Russel
+ * @author Michael Bien
+ */
+public class GLBuffers extends Buffers {
+
+ public static final int sizeOfGLType(int glType) {
+ switch (glType) {
+ case GL.GL_UNSIGNED_BYTE:
+ return SIZEOF_BYTE;
+ case GL.GL_BYTE:
+ return SIZEOF_BYTE;
+ case GL.GL_UNSIGNED_SHORT:
+ return SIZEOF_SHORT;
+ case GL.GL_SHORT:
+ return SIZEOF_SHORT;
+ case GL.GL_FLOAT:
+ return SIZEOF_FLOAT;
+ case GL.GL_FIXED:
+ return SIZEOF_INT;
+ case GL2ES2.GL_INT:
+ return SIZEOF_INT;
+ case GL2ES2.GL_UNSIGNED_INT:
+ return SIZEOF_INT;
+ case GL2.GL_DOUBLE:
+ return SIZEOF_DOUBLE;
+ }
+ return -1;
+ }
+
+ public static final Buffer newDirectGLBuffer(int glType, int numElements) {
+ switch (glType) {
+ case GL.GL_UNSIGNED_BYTE:
+ case GL.GL_BYTE:
+ return newDirectByteBuffer(numElements);
+ case GL.GL_UNSIGNED_SHORT:
+ case GL.GL_SHORT:
+ return newDirectShortBuffer(numElements);
+ case GL.GL_FLOAT:
+ return newDirectFloatBuffer(numElements);
+ case GL.GL_FIXED:
+ case GL2ES2.GL_INT:
+ case GL2ES2.GL_UNSIGNED_INT:
+ return newDirectIntBuffer(numElements);
+ case GL2.GL_DOUBLE:
+ return newDirectDoubleBuffer(numElements);
+ }
+ return null;
+ }
+
+ public static final Buffer sliceGLBuffer(ByteBuffer parent, int bytePos, int byteLen, int glType) {
+ if (parent == null || byteLen == 0) {
+ return null;
+ }
+ parent.position(bytePos);
+ parent.limit(bytePos + byteLen);
+
+ switch (glType) {
+ case GL.GL_UNSIGNED_BYTE:
+ case GL.GL_BYTE:
+ return parent.slice();
+ case GL.GL_UNSIGNED_SHORT:
+ case GL.GL_SHORT:
+ return parent.asShortBuffer();
+ case GL.GL_FLOAT:
+ return parent.asFloatBuffer();
+ case GL.GL_FIXED:
+ case GL2ES2.GL_INT:
+ case GL2ES2.GL_UNSIGNED_INT:
+ return parent.asIntBuffer();
+ case GL2.GL_DOUBLE:
+ return parent.asDoubleBuffer();
+ }
+ return null;
+ }
+
+ //----------------------------------------------------------------------
+ // Conversion routines
+ //
+ public final static float[] getFloatArray(double[] source) {
+ int i = source.length;
+ float[] dest = new float[i--];
+ while (i >= 0) {
+ dest[i] = (float) source[i];
+ i--;
+ }
+ return dest;
+ }
+}
diff --git a/src/jogl/classes/com/sun/opengl/util/GLFixedArrayHandler.java b/src/jogl/classes/com/jogamp/opengl/util/GLFixedArrayHandler.java
index f1e2502be..f0f5ea896 100644
--- a/src/jogl/classes/com/sun/opengl/util/GLFixedArrayHandler.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLFixedArrayHandler.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.util;
+package com.jogamp.opengl.util;
import javax.media.opengl.*;
import javax.media.opengl.fixedfunc.*;
-import com.sun.opengl.util.*;
+import com.jogamp.opengl.util.*;
import java.nio.*;
public class GLFixedArrayHandler implements GLArrayHandler {
diff --git a/src/jogl/classes/com/sun/opengl/util/Gamma.java b/src/jogl/classes/com/jogamp/opengl/util/Gamma.java
index da0d7bd96..672325cf3 100755
--- a/src/jogl/classes/com/sun/opengl/util/Gamma.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/Gamma.java
@@ -37,10 +37,10 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util;
+package com.jogamp.opengl.util;
import javax.media.opengl.*;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
/** Provides control over the primary display's gamma, brightness and
contrast controls via the hardware gamma ramp tables. Not
diff --git a/src/jogl/classes/com/sun/opengl/util/ImmModeSink.java b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java
index 65c676f4a..04b994198 100644
--- a/src/jogl/classes/com/sun/opengl/util/ImmModeSink.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java
@@ -1,9 +1,9 @@
-package com.sun.opengl.util;
+package com.jogamp.opengl.util;
+import com.jogamp.common.util.*;
import javax.media.opengl.*;
import javax.media.opengl.fixedfunc.*;
-import com.sun.nativewindow.impl.NWReflection;
import java.nio.*;
import java.util.Iterator;
import java.util.ArrayList;
@@ -35,8 +35,8 @@ public class ImmModeSink {
* a ShaderState must be current, using ShaderState.glUseProgram().
*
* @see #draw(GL, boolean)
- * @see javax.media.opengl.glsl.ShaderState#glUseProgram(GL2ES2, boolean)
- * @see javax.media.opengl.glsl.ShaderState#getCurrent()
+ * @see com.jogamp.opengl.util.glsl.ShaderState#glUseProgram(GL2ES2, boolean)
+ * @see com.jogamp.opengl.util.glsl.ShaderState#getCurrent()
*/
public static ImmModeSink createGLSL(GL gl, int glBufferUsage, int initialSize,
int vComps, int vDataType,
@@ -341,9 +341,9 @@ public class ImmModeSink {
} else {
Class clazz = indices.getClass();
int type=-1;
- if(NWReflection.instanceOf(clazz, ByteBuffer.class.getName())) {
+ if(ReflectionUtil.instanceOf(clazz, ByteBuffer.class.getName())) {
type = GL.GL_UNSIGNED_BYTE;
- } else if(NWReflection.instanceOf(clazz, ShortBuffer.class.getName())) {
+ } else if(ReflectionUtil.instanceOf(clazz, ShortBuffer.class.getName())) {
type = GL.GL_UNSIGNED_SHORT;
}
if(0>type) {
@@ -361,79 +361,79 @@ public class ImmModeSink {
public void glVertexv(Buffer v) {
checkSeal(false);
- BufferUtil.put(vertexArray, v);
+ GLBuffers.put(vertexArray, v);
}
public void glNormalv(Buffer v) {
checkSeal(false);
- BufferUtil.put(normalArray, v);
+ GLBuffers.put(normalArray, v);
}
public void glColorv(Buffer v) {
checkSeal(false);
- BufferUtil.put(colorArray, v);
+ GLBuffers.put(colorArray, v);
}
public void glTexCoordv(Buffer v) {
checkSeal(false);
- BufferUtil.put(textCoordArray, v);
+ GLBuffers.put(textCoordArray, v);
}
public void glVertex2b(byte x, byte y) {
checkSeal(false);
growBufferIfNecessary(VERTEX, 2);
if(vComps>0)
- BufferUtil.putb(vertexArray, x);
+ GLBuffers.putb(vertexArray, x);
if(vComps>1)
- BufferUtil.putb(vertexArray, y);
+ GLBuffers.putb(vertexArray, y);
padding(VERTEX, vComps-2);
}
public void glVertex3b(byte x, byte y, byte z) {
checkSeal(false);
growBufferIfNecessary(VERTEX, 3);
if(vComps>0)
- BufferUtil.putb(vertexArray, x);
+ GLBuffers.putb(vertexArray, x);
if(vComps>1)
- BufferUtil.putb(vertexArray, y);
+ GLBuffers.putb(vertexArray, y);
if(vComps>2)
- BufferUtil.putb(vertexArray, z);
+ GLBuffers.putb(vertexArray, z);
padding(VERTEX, vComps-3);
}
public void glVertex2s(short x, short y) {
checkSeal(false);
growBufferIfNecessary(VERTEX, 2);
if(vComps>0)
- BufferUtil.puts(vertexArray, x);
+ GLBuffers.puts(vertexArray, x);
if(vComps>1)
- BufferUtil.puts(vertexArray, y);
+ GLBuffers.puts(vertexArray, y);
padding(VERTEX, vComps-2);
}
public void glVertex3s(short x, short y, short z) {
checkSeal(false);
growBufferIfNecessary(VERTEX, 3);
if(vComps>0)
- BufferUtil.puts(vertexArray, x);
+ GLBuffers.puts(vertexArray, x);
if(vComps>1)
- BufferUtil.puts(vertexArray, y);
+ GLBuffers.puts(vertexArray, y);
if(vComps>2)
- BufferUtil.puts(vertexArray, z);
+ GLBuffers.puts(vertexArray, z);
padding(VERTEX, vComps-3);
}
public void glVertex2f(float x, float y) {
checkSeal(false);
growBufferIfNecessary(VERTEX, 2);
if(vComps>0)
- BufferUtil.putf(vertexArray, x);
+ GLBuffers.putf(vertexArray, x);
if(vComps>1)
- BufferUtil.putf(vertexArray, y);
+ GLBuffers.putf(vertexArray, y);
padding(VERTEX, vComps-2);
}
public void glVertex3f(float x, float y, float z) {
checkSeal(false);
growBufferIfNecessary(VERTEX, 3);
if(vComps>0)
- BufferUtil.putf(vertexArray, x);
+ GLBuffers.putf(vertexArray, x);
if(vComps>1)
- BufferUtil.putf(vertexArray, y);
+ GLBuffers.putf(vertexArray, y);
if(vComps>2)
- BufferUtil.putf(vertexArray, z);
+ GLBuffers.putf(vertexArray, z);
padding(VERTEX, vComps-3);
}
@@ -441,33 +441,33 @@ public class ImmModeSink {
checkSeal(false);
growBufferIfNecessary(NORMAL, 3);
if(nComps>0)
- BufferUtil.putb(normalArray, x);
+ GLBuffers.putb(normalArray, x);
if(nComps>1)
- BufferUtil.putb(normalArray, y);
+ GLBuffers.putb(normalArray, y);
if(nComps>2)
- BufferUtil.putb(normalArray, z);
+ GLBuffers.putb(normalArray, z);
padding(NORMAL, nComps-3);
}
public void glNormal3s(short x, short y, short z) {
checkSeal(false);
growBufferIfNecessary(NORMAL, 3);
if(nComps>0)
- BufferUtil.puts(normalArray, x);
+ GLBuffers.puts(normalArray, x);
if(nComps>1)
- BufferUtil.puts(normalArray, y);
+ GLBuffers.puts(normalArray, y);
if(nComps>2)
- BufferUtil.puts(normalArray, z);
+ GLBuffers.puts(normalArray, z);
padding(NORMAL, nComps-3);
}
public void glNormal3f(float x, float y, float z) {
checkSeal(false);
growBufferIfNecessary(NORMAL, 3);
if(nComps>0)
- BufferUtil.putf(normalArray, x);
+ GLBuffers.putf(normalArray, x);
if(nComps>1)
- BufferUtil.putf(normalArray, y);
+ GLBuffers.putf(normalArray, y);
if(nComps>2)
- BufferUtil.putf(normalArray, z);
+ GLBuffers.putf(normalArray, z);
padding(NORMAL, nComps-3);
}
@@ -475,72 +475,72 @@ public class ImmModeSink {
checkSeal(false);
growBufferIfNecessary(COLOR, 3);
if(cComps>0)
- BufferUtil.putb(colorArray, r);
+ GLBuffers.putb(colorArray, r);
if(cComps>1)
- BufferUtil.putb(colorArray, g);
+ GLBuffers.putb(colorArray, g);
if(cComps>2)
- BufferUtil.putb(colorArray, b);
+ GLBuffers.putb(colorArray, b);
padding(COLOR, cComps-3);
}
public void glColor4b(byte r, byte g, byte b, byte a) {
checkSeal(false);
growBufferIfNecessary(COLOR, 4);
if(cComps>0)
- BufferUtil.putb(colorArray, r);
+ GLBuffers.putb(colorArray, r);
if(cComps>1)
- BufferUtil.putb(colorArray, g);
+ GLBuffers.putb(colorArray, g);
if(cComps>2)
- BufferUtil.putb(colorArray, b);
+ GLBuffers.putb(colorArray, b);
if(cComps>3)
- BufferUtil.putb(colorArray, a);
+ GLBuffers.putb(colorArray, a);
padding(COLOR, cComps-4);
}
public void glColor3s(short r, short g, short b) {
checkSeal(false);
growBufferIfNecessary(COLOR, 3);
if(cComps>0)
- BufferUtil.puts(colorArray, r);
+ GLBuffers.puts(colorArray, r);
if(cComps>1)
- BufferUtil.puts(colorArray, g);
+ GLBuffers.puts(colorArray, g);
if(cComps>2)
- BufferUtil.puts(colorArray, b);
+ GLBuffers.puts(colorArray, b);
padding(COLOR, cComps-3);
}
public void glColor4s(short r, short g, short b, short a) {
checkSeal(false);
growBufferIfNecessary(COLOR, 4);
if(cComps>0)
- BufferUtil.puts(colorArray, r);
+ GLBuffers.puts(colorArray, r);
if(cComps>1)
- BufferUtil.puts(colorArray, g);
+ GLBuffers.puts(colorArray, g);
if(cComps>2)
- BufferUtil.puts(colorArray, b);
+ GLBuffers.puts(colorArray, b);
if(cComps>3)
- BufferUtil.puts(colorArray, a);
+ GLBuffers.puts(colorArray, a);
padding(COLOR, cComps-4);
}
public void glColor3f(float r, float g, float b) {
checkSeal(false);
growBufferIfNecessary(COLOR, 3);
if(cComps>0)
- BufferUtil.putf(colorArray, r);
+ GLBuffers.putf(colorArray, r);
if(cComps>1)
- BufferUtil.putf(colorArray, g);
+ GLBuffers.putf(colorArray, g);
if(cComps>2)
- BufferUtil.putf(colorArray, b);
+ GLBuffers.putf(colorArray, b);
padding(COLOR, cComps-3);
}
public void glColor4f(float r, float g, float b, float a) {
checkSeal(false);
growBufferIfNecessary(COLOR, 4);
if(cComps>0)
- BufferUtil.putf(colorArray, r);
+ GLBuffers.putf(colorArray, r);
if(cComps>1)
- BufferUtil.putf(colorArray, g);
+ GLBuffers.putf(colorArray, g);
if(cComps>2)
- BufferUtil.putf(colorArray, b);
+ GLBuffers.putf(colorArray, b);
if(cComps>3)
- BufferUtil.putf(colorArray, a);
+ GLBuffers.putf(colorArray, a);
padding(COLOR, cComps-4);
}
@@ -548,60 +548,60 @@ public class ImmModeSink {
checkSeal(false);
growBufferIfNecessary(TEXTCOORD, 2);
if(tComps>0)
- BufferUtil.putb(textCoordArray, x);
+ GLBuffers.putb(textCoordArray, x);
if(tComps>1)
- BufferUtil.putb(textCoordArray, y);
+ GLBuffers.putb(textCoordArray, y);
padding(TEXTCOORD, tComps-2);
}
public void glTexCoord3b(byte x, byte y, byte z) {
checkSeal(false);
growBufferIfNecessary(TEXTCOORD, 3);
if(tComps>0)
- BufferUtil.putb(textCoordArray, x);
+ GLBuffers.putb(textCoordArray, x);
if(tComps>1)
- BufferUtil.putb(textCoordArray, y);
+ GLBuffers.putb(textCoordArray, y);
if(tComps>2)
- BufferUtil.putb(textCoordArray, z);
+ GLBuffers.putb(textCoordArray, z);
padding(TEXTCOORD, tComps-3);
}
public void glTexCoord2s(short x, short y) {
checkSeal(false);
growBufferIfNecessary(TEXTCOORD, 2);
if(tComps>0)
- BufferUtil.puts(textCoordArray, x);
+ GLBuffers.puts(textCoordArray, x);
if(tComps>1)
- BufferUtil.puts(textCoordArray, y);
+ GLBuffers.puts(textCoordArray, y);
padding(TEXTCOORD, tComps-2);
}
public void glTexCoord3s(short x, short y, short z) {
checkSeal(false);
growBufferIfNecessary(TEXTCOORD, 3);
if(tComps>0)
- BufferUtil.puts(textCoordArray, x);
+ GLBuffers.puts(textCoordArray, x);
if(tComps>1)
- BufferUtil.puts(textCoordArray, y);
+ GLBuffers.puts(textCoordArray, y);
if(tComps>2)
- BufferUtil.puts(textCoordArray, z);
+ GLBuffers.puts(textCoordArray, z);
padding(TEXTCOORD, tComps-3);
}
public void glTexCoord2f(float x, float y) {
checkSeal(false);
growBufferIfNecessary(TEXTCOORD, 2);
if(tComps>0)
- BufferUtil.putf(textCoordArray, x);
+ GLBuffers.putf(textCoordArray, x);
if(tComps>1)
- BufferUtil.putf(textCoordArray, y);
+ GLBuffers.putf(textCoordArray, y);
padding(TEXTCOORD, tComps-2);
}
public void glTexCoord3f(float x, float y, float z) {
checkSeal(false);
growBufferIfNecessary(TEXTCOORD, 3);
if(tComps>0)
- BufferUtil.putf(textCoordArray, x);
+ GLBuffers.putf(textCoordArray, x);
if(tComps>1)
- BufferUtil.putf(textCoordArray, y);
+ GLBuffers.putf(textCoordArray, y);
if(tComps>2)
- BufferUtil.putf(textCoordArray, z);
+ GLBuffers.putf(textCoordArray, z);
padding(TEXTCOORD, tComps-3);
}
@@ -746,7 +746,7 @@ public class ImmModeSink {
public void enableBufferGLSL(GL gl, boolean enable) {
GL2ES2 glsl = gl.getGL2ES2();
- com.sun.opengl.util.glsl.ShaderState st = com.sun.opengl.util.glsl.ShaderState.getCurrent();
+ com.jogamp.opengl.util.glsl.ShaderState st = com.jogamp.opengl.util.glsl.ShaderState.getCurrent();
if(null==st) {
throw new GLException("No ShaderState current");
}
@@ -809,20 +809,20 @@ public class ImmModeSink {
// non public matters
protected void allocateBuffer(int elements) {
- int vWidth = vComps * BufferUtil.sizeOfGLType(vDataType);
- int cWidth = cComps * BufferUtil.sizeOfGLType(cDataType);
- int nWidth = nComps * BufferUtil.sizeOfGLType(nDataType);
- int tWidth = tComps * BufferUtil.sizeOfGLType(tDataType);
+ int vWidth = vComps * GLBuffers.sizeOfGLType(vDataType);
+ int cWidth = cComps * GLBuffers.sizeOfGLType(cDataType);
+ int nWidth = nComps * GLBuffers.sizeOfGLType(nDataType);
+ int tWidth = tComps * GLBuffers.sizeOfGLType(tDataType);
count = elements;
bSize = count * ( vWidth + cWidth + nWidth + tWidth ) ;
- buffer = BufferUtil.newByteBuffer(bSize);
+ buffer = GLBuffers.newDirectByteBuffer(bSize);
int pos = 0;
int size= count * vWidth ;
if(size>0) {
- vertexArray = BufferUtil.sliceGLBuffer(buffer, pos, size, vDataType);
+ vertexArray = GLBuffers.sliceGLBuffer(buffer, pos, size, vDataType);
} else {
vertexArray = null;
}
@@ -831,7 +831,7 @@ public class ImmModeSink {
size= count * cWidth ;
if(size>0) {
- colorArray = BufferUtil.sliceGLBuffer(buffer, pos, size, cDataType);
+ colorArray = GLBuffers.sliceGLBuffer(buffer, pos, size, cDataType);
} else {
colorArray = null;
}
@@ -840,7 +840,7 @@ public class ImmModeSink {
size= count * nWidth ;
if(size>0) {
- normalArray = BufferUtil.sliceGLBuffer(buffer, pos, size, nDataType);
+ normalArray = GLBuffers.sliceGLBuffer(buffer, pos, size, nDataType);
} else {
normalArray = null;
}
@@ -849,7 +849,7 @@ public class ImmModeSink {
size= count * tWidth ;
if(size>0) {
- textCoordArray = BufferUtil.sliceGLBuffer(buffer, pos, size, tDataType);
+ textCoordArray = GLBuffers.sliceGLBuffer(buffer, pos, size, tDataType);
} else {
textCoordArray = null;
}
@@ -905,19 +905,19 @@ public class ImmModeSink {
if(null!=_vertexArray) {
_vertexArray.flip();
- BufferUtil.put(vertexArray, _vertexArray);
+ GLBuffers.put(vertexArray, _vertexArray);
}
if(null!=_colorArray) {
_colorArray.flip();
- BufferUtil.put(colorArray, _colorArray);
+ GLBuffers.put(colorArray, _colorArray);
}
if(null!=_normalArray) {
_normalArray.flip();
- BufferUtil.put(normalArray, _normalArray);
+ GLBuffers.put(normalArray, _normalArray);
}
if(null!=_textCoordArray) {
_textCoordArray.flip();
- BufferUtil.put(textCoordArray, _textCoordArray);
+ GLBuffers.put(textCoordArray, _textCoordArray);
}
}
@@ -944,7 +944,7 @@ public class ImmModeSink {
if ( null==dest ) return;
while((fill--)>0) {
- BufferUtil.putb(dest, (byte)0);
+ GLBuffers.putb(dest, (byte)0);
}
}
diff --git a/src/jogl/classes/com/sun/opengl/util/Locator.java b/src/jogl/classes/com/jogamp/opengl/util/Locator.java
index 06cd50ce8..c524c0888 100644
--- a/src/jogl/classes/com/sun/opengl/util/Locator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/Locator.java
@@ -31,7 +31,7 @@
*
*/
-package com.sun.opengl.util;
+package com.jogamp.opengl.util;
import java.util.*;
import java.nio.*;
diff --git a/src/jogl/classes/com/sun/opengl/util/PMVMatrix.java b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
index 4211e893b..47de8ce0a 100755
--- a/src/jogl/classes/com/sun/opengl/util/PMVMatrix.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
@@ -31,9 +31,10 @@
*
*/
-package com.sun.opengl.util;
+package com.jogamp.opengl.util;
-import com.sun.opengl.impl.ProjectFloat;
+import com.jogamp.common.nio.Buffers;
+import com.jogamp.opengl.impl.ProjectFloat;
import java.nio.*;
import java.util.ArrayList;
@@ -47,7 +48,7 @@ public class PMVMatrix implements GLMatrixFunc {
public PMVMatrix() {
projectFloat = new ProjectFloat();
- matrixIdent = BufferUtil.newFloatBuffer(1*16);
+ matrixIdent = Buffers.newDirectFloatBuffer(1*16);
projectFloat.gluMakeIdentityf(matrixIdent);
matrixIdent.rewind();
@@ -57,7 +58,7 @@ public class PMVMatrix implements GLMatrixFunc {
// Mvi Modelview-Inverse
// Mvit Modelview-Inverse-Transpose
// Pmv P * Mv
- matrixTPMvMvitPmv = BufferUtil.newFloatBuffer(6*16); // grouping T + P + Mv + Mvi + Mvit + Pmv
+ matrixTPMvMvitPmv = Buffers.newDirectFloatBuffer(6*16); // grouping T + P + Mv + Mvi + Mvit + Pmv
matrixPMvMvitPmv = slice(matrixTPMvMvitPmv, 1*16, 5*16); // grouping P + Mv + Mvi + Mvit + Pmv
matrixT = slice(matrixTPMvMvitPmv, 0*16, 1*16); // T
matrixPMvMvit = slice(matrixTPMvMvitPmv, 1*16, 4*16); // grouping P + Mv + Mvi + Mvit
@@ -70,9 +71,9 @@ public class PMVMatrix implements GLMatrixFunc {
matrixPmv = slice(matrixTPMvMvitPmv, 5*16, 1*16); // Pmv
matrixTPMvMvitPmv.rewind();
- matrixMvit3 = BufferUtil.newFloatBuffer(3*3);
+ matrixMvit3 = Buffers.newDirectFloatBuffer(3*3);
- localBuf = BufferUtil.newFloatBuffer(6*16);
+ localBuf = Buffers.newDirectFloatBuffer(6*16);
matrixMult=slice(localBuf, 0*16, 16);
@@ -294,7 +295,7 @@ public class PMVMatrix implements GLMatrixFunc {
}
/**
- * @param pname GL_MODELVIEW, GL_PROJECTION or GL.GL_TEXTURE
+ * @param matrixName GL_MODELVIEW, GL_PROJECTION or GL.GL_TEXTURE
* @return the given matrix
*/
public final FloatBuffer glGetMatrixf(final int matrixName) {
diff --git a/src/jogl/classes/com/sun/opengl/util/StreamUtil.java b/src/jogl/classes/com/jogamp/opengl/util/StreamUtil.java
index 8ad731743..4cf8cb1f0 100755
--- a/src/jogl/classes/com/sun/opengl/util/StreamUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/StreamUtil.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util;
+package com.jogamp.opengl.util;
import java.io.*;
import java.nio.*;
@@ -59,7 +59,7 @@ public class StreamUtil {
public static ByteBuffer readAll2Buffer(InputStream stream) throws IOException {
BytesRead bytesRead = readAllImpl(stream);
- return BufferUtil.newByteBuffer(bytesRead.data, 0, bytesRead.payloadLen);
+ return GLBuffers.newDirectByteBuffer(bytesRead.data, 0, bytesRead.payloadLen);
}
private static BytesRead readAllImpl(InputStream stream) throws IOException {
diff --git a/src/jogl/classes/com/sun/opengl/util/TGAWriter.java b/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java
index c5b1041a0..b949f0e39 100755
--- a/src/jogl/classes/com/sun/opengl/util/TGAWriter.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java
@@ -34,7 +34,7 @@
* facility.
*/
-package com.sun.opengl.util;
+package com.jogamp.opengl.util;
import java.io.*;
import java.nio.*;
@@ -42,13 +42,11 @@ import java.nio.channels.*;
/**
* Utility class which helps take fast screenshots of OpenGL rendering
- * results into Targa-format files. Used by the {@link
- * com.sun.opengl.util.gl2.Screenshot Screenshot} class; can also be used
- * in conjunction with the {@link com.sun.opengl.util.gl2.TileRenderer
- * TileRenderer} class. <P>
+ * results into Targa-format files. Used by the {@link com.jogamp.opengl.util.awt.Screenshot}
+ * 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;
diff --git a/src/jogl/classes/com/sun/opengl/util/awt/ImageUtil.java b/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java
index 534ab444d..a3139b16a 100755
--- a/src/jogl/classes/com/sun/opengl/util/awt/ImageUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.awt;
+package com.jogamp.opengl.util.awt;
import java.awt.*;
import java.awt.image.*;
diff --git a/src/jogl/classes/com/sun/opengl/util/awt/Overlay.java b/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java
index 5a54a7161..1275c9391 100755
--- a/src/jogl/classes/com/sun/opengl/util/awt/Overlay.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java
@@ -37,12 +37,12 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.awt;
+package com.jogamp.opengl.util.awt;
import java.awt.Graphics2D;
import javax.media.opengl.*;
-import com.sun.opengl.util.texture.*;
+import com.jogamp.opengl.util.texture.*;
/** Provides a Java 2D overlay on top of an arbitrary GLDrawable,
making it easier to do things like draw text and images on top of
diff --git a/src/jogl/classes/com/sun/opengl/util/awt/Screenshot.java b/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java
index 55099445a..7019d720f 100755
--- a/src/jogl/classes/com/sun/opengl/util/awt/Screenshot.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java
@@ -34,7 +34,7 @@
* facility.
*/
-package com.sun.opengl.util.awt;
+package com.jogamp.opengl.util.awt;
import java.awt.image.*;
import java.io.*;
@@ -46,7 +46,7 @@ import javax.media.opengl.*;
import javax.media.opengl.glu.*;
import javax.media.opengl.glu.gl2.*;
-import com.sun.opengl.util.*;
+import com.jogamp.opengl.util.*;
/** Utilities for taking screenshots of OpenGL applications. */
diff --git a/src/jogl/classes/com/sun/opengl/util/awt/TextRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
index 059ead63d..bac9f88ea 100755
--- a/src/jogl/classes/com/sun/opengl/util/awt/TextRenderer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
@@ -36,13 +36,14 @@
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.awt;
+package com.jogamp.opengl.util.awt;
-import com.sun.opengl.impl.Debug;
-import com.sun.opengl.util.*;
-import com.sun.opengl.util.packrect.*;
-import com.sun.opengl.util.texture.*;
-import com.sun.opengl.util.texture.awt.*;
+import com.jogamp.common.nio.Buffers;
+import com.jogamp.opengl.impl.Debug;
+import com.jogamp.opengl.util.*;
+import com.jogamp.opengl.util.packrect.*;
+import com.jogamp.opengl.util.texture.*;
+import com.jogamp.opengl.util.texture.awt.*;
import java.awt.AlphaComposite;
import java.awt.Color;
@@ -114,7 +115,7 @@ import javax.media.opengl.awt.*;
pack both glyphs and full Strings' rendering results (which are
variable size) onto a larger OpenGL texture. The internal backing
store is maintained using a {@link
- com.sun.opengl.util.awt.TextureRenderer TextureRenderer}. A least
+ com.jogamp.opengl.util.awt.TextureRenderer TextureRenderer}. A least
recently used (LRU) algorithm is used to discard previously
rendered strings; the specific algorithm is undefined, but is
currently implemented by flushing unused Strings' rendering
@@ -442,7 +443,7 @@ public class TextRenderer {
one, where each component ranges from 0.0f - 1.0f. The alpha
component, if used, does not need to be premultiplied into the
color channels as described in the documentation for {@link
- com.sun.opengl.util.texture.Texture Texture}, although
+ com.jogamp.opengl.util.texture.Texture Texture}, although
premultiplied colors are used internally. The default color is
opaque white.
@@ -1707,8 +1708,8 @@ public class TextRenderer {
Pipelined_QuadRenderer() {
GL2 gl = GLContext.getCurrentGL().getGL2();
- mVertCoords = BufferUtil.newFloatBuffer(kTotalBufferSizeCoordsVerts);
- mTexCoords = BufferUtil.newFloatBuffer(kTotalBufferSizeCoordsTex);
+ mVertCoords = Buffers.newDirectFloatBuffer(kTotalBufferSizeCoordsVerts);
+ mTexCoords = Buffers.newDirectFloatBuffer(kTotalBufferSizeCoordsTex);
usingVBOs = is15Available(gl);
diff --git a/src/jogl/classes/com/sun/opengl/util/awt/TextureRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java
index 1f6393d39..bc5aa517e 100755
--- a/src/jogl/classes/com/sun/opengl/util/awt/TextureRenderer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.awt;
+package com.jogamp.opengl.util.awt;
import java.awt.Color;
import java.awt.Dimension;
@@ -49,12 +49,12 @@ import java.awt.image.*;
import javax.media.opengl.*;
import javax.media.opengl.glu.*;
import javax.media.opengl.glu.gl2.*;
-import com.sun.opengl.util.texture.*;
-import com.sun.opengl.util.texture.spi.*;
-import com.sun.opengl.util.texture.awt.*;
+import com.jogamp.opengl.util.texture.*;
+import com.jogamp.opengl.util.texture.spi.*;
+import com.jogamp.opengl.util.texture.awt.*;
/** Provides the ability to render into an OpenGL {@link
- com.sun.opengl.util.texture.Texture Texture} using the Java 2D
+ com.jogamp.opengl.util.texture.Texture Texture} using the Java 2D
APIs. This renderer class uses an internal Java 2D image (of
unspecified type) for its backing store and flushes portions of
that image to an OpenGL texture on demand. The resulting OpenGL
@@ -389,7 +389,7 @@ public class TextureRenderer {
Each component ranges from 0.0f - 1.0f. The alpha component, if
used, does not need to be premultiplied into the color channels
as described in the documentation for {@link
- com.sun.opengl.util.texture.Texture Texture}, although
+ com.jogamp.opengl.util.texture.Texture Texture}, although
premultiplied colors are used internally. The default color is
opaque white.
@@ -631,7 +631,7 @@ public class TextureRenderer {
// BufferedImage; it's just a reference to the contents but we
// need it in order to update sub-regions of the underlying
// texture
- textureData = new AWTTextureData(internalFormat, 0, mipmap, image);
+ textureData = new AWTTextureData(gl.getGLProfile(), internalFormat, 0, mipmap, image);
// For now, always reallocate the underlying OpenGL texture when
// the backing store size changes
mustReallocateTexture = true;
diff --git a/src/jogl/classes/com/sun/opengl/util/gl2/BitmapCharRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java
index 9738be60a..34685e1b2 100644
--- a/src/jogl/classes/com/sun/opengl/util/gl2/BitmapCharRec.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.gl2;
+package com.jogamp.opengl.util.gl2;
/* Copyright (c) Mark J. Kilgard, 1994, 1998. */
diff --git a/src/jogl/classes/com/sun/opengl/util/gl2/BitmapFontRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java
index d110c262b..18f7d3b28 100644
--- a/src/jogl/classes/com/sun/opengl/util/gl2/BitmapFontRec.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.gl2;
+package com.jogamp.opengl.util.gl2;
/* Copyright (c) Mark J. Kilgard, 1994, 1998. */
diff --git a/src/jogl/classes/com/sun/opengl/util/gl2/CoordRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java
index e87354dbf..9ad95ec03 100644
--- a/src/jogl/classes/com/sun/opengl/util/gl2/CoordRec.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.gl2;
+package com.jogamp.opengl.util.gl2;
/* Copyright (c) Mark J. Kilgard, 1994, 1998. */
diff --git a/src/jogl/classes/com/sun/opengl/util/gl2/GLUT.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java
index 5a1f7d12d..8befc13ba 100644
--- a/src/jogl/classes/com/sun/opengl/util/gl2/GLUT.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.gl2;
+package com.jogamp.opengl.util.gl2;
import javax.media.opengl.*;
import javax.media.opengl.glu.*;
diff --git a/src/jogl/classes/com/sun/opengl/util/gl2/GLUTBitmap8x13.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap8x13.java
index b6e5c425a..07ded652a 100644
--- a/src/jogl/classes/com/sun/opengl/util/gl2/GLUTBitmap8x13.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap8x13.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.gl2;
+package com.jogamp.opengl.util.gl2;
class GLUTBitmap8x13 {
diff --git a/src/jogl/classes/com/sun/opengl/util/gl2/GLUTBitmap9x15.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap9x15.java
index bba9a8fc5..5d357f3f7 100644
--- a/src/jogl/classes/com/sun/opengl/util/gl2/GLUTBitmap9x15.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmap9x15.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.gl2;
+package com.jogamp.opengl.util.gl2;
class GLUTBitmap9x15 {
diff --git a/src/jogl/classes/com/sun/opengl/util/gl2/GLUTBitmapHelvetica10.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica10.java
index cca045ffa..b9c7e6e50 100644
--- a/src/jogl/classes/com/sun/opengl/util/gl2/GLUTBitmapHelvetica10.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica10.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.gl2;
+package com.jogamp.opengl.util.gl2;
class GLUTBitmapHelvetica10 {
diff --git a/src/jogl/classes/com/sun/opengl/util/gl2/GLUTBitmapHelvetica12.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica12.java
index b73c82fa9..bc86f6216 100644
--- a/src/jogl/classes/com/sun/opengl/util/gl2/GLUTBitmapHelvetica12.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica12.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.gl2;
+package com.jogamp.opengl.util.gl2;
class GLUTBitmapHelvetica12 {
diff --git a/src/jogl/classes/com/sun/opengl/util/gl2/GLUTBitmapHelvetica18.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica18.java
index cf34a6d25..1b2e69ba4 100644
--- a/src/jogl/classes/com/sun/opengl/util/gl2/GLUTBitmapHelvetica18.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapHelvetica18.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.gl2;
+package com.jogamp.opengl.util.gl2;
class GLUTBitmapHelvetica18 {
diff --git a/src/jogl/classes/com/sun/opengl/util/gl2/GLUTBitmapTimesRoman10.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman10.java
index 32699863f..f753b56f7 100644
--- a/src/jogl/classes/com/sun/opengl/util/gl2/GLUTBitmapTimesRoman10.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman10.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.gl2;
+package com.jogamp.opengl.util.gl2;
class GLUTBitmapTimesRoman10 {
diff --git a/src/jogl/classes/com/sun/opengl/util/gl2/GLUTBitmapTimesRoman24.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman24.java
index 36fb76c66..073e6e673 100644
--- a/src/jogl/classes/com/sun/opengl/util/gl2/GLUTBitmapTimesRoman24.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTBitmapTimesRoman24.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.gl2;
+package com.jogamp.opengl.util.gl2;
class GLUTBitmapTimesRoman24 {
diff --git a/src/jogl/classes/com/sun/opengl/util/gl2/GLUTStrokeMonoRoman.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java
index 79e4b70f8..b8296924e 100644
--- a/src/jogl/classes/com/sun/opengl/util/gl2/GLUTStrokeMonoRoman.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.gl2;
+package com.jogamp.opengl.util.gl2;
class GLUTStrokeMonoRoman {
diff --git a/src/jogl/classes/com/sun/opengl/util/gl2/GLUTStrokeRoman.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java
index e960f155a..94fa1c4fd 100644
--- a/src/jogl/classes/com/sun/opengl/util/gl2/GLUTStrokeRoman.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.gl2;
+package com.jogamp.opengl.util.gl2;
class GLUTStrokeRoman {
diff --git a/src/jogl/classes/com/sun/opengl/util/gl2/StrokeCharRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java
index 1d5d3de63..af3d538ae 100644
--- a/src/jogl/classes/com/sun/opengl/util/gl2/StrokeCharRec.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.gl2;
+package com.jogamp.opengl.util.gl2;
/* Copyright (c) Mark J. Kilgard, 1994, 1998. */
diff --git a/src/jogl/classes/com/sun/opengl/util/gl2/StrokeFontRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java
index 0e6133a2d..d3195f24d 100644
--- a/src/jogl/classes/com/sun/opengl/util/gl2/StrokeFontRec.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.gl2;
+package com.jogamp.opengl.util.gl2;
/* Copyright (c) Mark J. Kilgard, 1994, 1998. */
diff --git a/src/jogl/classes/com/sun/opengl/util/gl2/StrokeRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java
index 91241ebc0..8796e8b08 100644
--- a/src/jogl/classes/com/sun/opengl/util/gl2/StrokeRec.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.gl2;
+package com.jogamp.opengl.util.gl2;
/* Copyright (c) Mark J. Kilgard, 1994, 1998. */
diff --git a/src/jogl/classes/com/sun/opengl/util/gl2/TileRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/TileRenderer.java
index a446b0928..714c134d4 100755
--- a/src/jogl/classes/com/sun/opengl/util/gl2/TileRenderer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/TileRenderer.java
@@ -1,4 +1,4 @@
-package com.sun.opengl.util.gl2;
+package com.jogamp.opengl.util.gl2;
import java.awt.Dimension;
import java.nio.Buffer;
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/GLSLArrayHandler.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/GLSLArrayHandler.java
index 1ef9874e4..1119aa5ab 100644
--- a/src/jogl/classes/com/sun/opengl/util/glsl/GLSLArrayHandler.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/GLSLArrayHandler.java
@@ -1,10 +1,10 @@
-package com.sun.opengl.util.glsl;
+package com.jogamp.opengl.util.glsl;
import javax.media.opengl.*;
import javax.media.opengl.fixedfunc.*;
-import com.sun.opengl.util.*;
-import com.sun.opengl.util.glsl.ShaderState;
+import com.jogamp.opengl.util.*;
+import com.jogamp.opengl.util.glsl.ShaderState;
import java.nio.*;
public class GLSLArrayHandler implements GLArrayHandler {
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/ShaderCode.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java
index 606d2e1b5..d0e7ea29d 100644
--- a/src/jogl/classes/com/sun/opengl/util/glsl/ShaderCode.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java
@@ -1,9 +1,10 @@
-package com.sun.opengl.util.glsl;
+package com.jogamp.opengl.util.glsl;
+import com.jogamp.common.nio.Buffers;
import javax.media.opengl.*;
-import com.sun.opengl.util.*;
-import com.sun.opengl.impl.Debug;
+import com.jogamp.opengl.util.*;
+import com.jogamp.opengl.impl.Debug;
import java.util.*;
import java.nio.*;
@@ -34,7 +35,7 @@ public class ShaderCode {
shaderBinaryFormat = -1;
shaderBinary = null;
shaderType = type;
- shader = BufferUtil.newIntBuffer(number);
+ shader = Buffers.newDirectIntBuffer(number);
id = getNextID();
if(DEBUG_CODE) {
@@ -55,7 +56,7 @@ public class ShaderCode {
shaderBinaryFormat = binFormat;
shaderBinary = binary;
shaderType = type;
- shader = BufferUtil.newIntBuffer(number);
+ shader = Buffers.newDirectIntBuffer(number);
id = getNextID();
}
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/ShaderProgram.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
index c06eae383..430ed08ce 100644
--- a/src/jogl/classes/com/sun/opengl/util/glsl/ShaderProgram.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
@@ -1,11 +1,10 @@
-package com.sun.opengl.util.glsl;
+package com.jogamp.opengl.util.glsl;
import javax.media.opengl.*;
import java.util.HashMap;
import java.util.Iterator;
-import java.nio.*;
import java.io.PrintStream;
public class ShaderProgram {
@@ -104,16 +103,20 @@ public class ShaderProgram {
* Refetches all previously bin/get attribute names
* and resets all attribute data as well
*
- * @see getAttribLocation
* @param gl
* @param oldShaderID the to be replace Shader
* @param newShader the new ShaderCode
* @param verboseOut the optional verbose outputstream
* @throws GLException is the program is not linked
*
- * @see #glRefetchAttribLocations
- * @see #glResetAllVertexAttributes
- * @see #glReplaceShader
+ * @see ShaderState#glEnableVertexAttribArray
+ * @see ShaderState#glDisableVertexAttribArray
+ * @see ShaderState#glVertexAttribPointer
+ * @see ShaderState#getVertexAttribPointer
+ * @see ShaderState#glReleaseAllVertexAttributes
+ * @see ShaderState#glResetAllVertexAttributes
+ * @see ShaderState#glResetAllVertexAttributes
+ * @see ShaderState#glResetAllVertexAttributes
*/
public synchronized boolean glReplaceShader(GL2ES2 gl, int oldShaderID, ShaderCode newShader, PrintStream verboseOut) {
if(!programLinked) throw new GLException("Program is not linked");
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/ShaderState.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java
index 8712ac7e2..86f9251b7 100644
--- a/src/jogl/classes/com/sun/opengl/util/glsl/ShaderState.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java
@@ -1,15 +1,12 @@
-package com.sun.opengl.util.glsl;
+package com.jogamp.opengl.util.glsl;
import javax.media.opengl.*;
-import com.sun.opengl.util.*;
-import com.sun.opengl.impl.Debug;
+import com.jogamp.opengl.impl.Debug;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.nio.*;
-import java.io.PrintStream;
import java.security.*;
public class ShaderState {
@@ -25,8 +22,8 @@ public class ShaderState {
/**
* Fetches the current shader state from the thread local storage (TLS)
*
- * @see javax.media.opengl.glsl.ShaderState#glUseProgram(GL2ES2, boolean)
- * @see javax.media.opengl.glsl.ShaderState#getCurrent()
+ * @see com.jogamp.opengl.util.glsl.ShaderState#glUseProgram(GL2ES2, boolean)
+ * @see com.jogamp.opengl.util.glsl.ShaderState#getCurrent()
*/
public static synchronized ShaderState getCurrent() {
GLContext current = GLContext.getCurrent();
@@ -41,8 +38,8 @@ public class ShaderState {
* Puts this ShaderState to to the thread local storage (TLS),
* if <code>on</code> is <code>true</code>.
*
- * @see javax.media.opengl.glsl.ShaderState#glUseProgram(GL2ES2, boolean)
- * @see javax.media.opengl.glsl.ShaderState#getCurrent()
+ * @see com.jogamp.opengl.util.glsl.ShaderState#glUseProgram(GL2ES2, boolean)
+ * @see com.jogamp.opengl.util.glsl.ShaderState#getCurrent()
*/
public synchronized void glUseProgram(GL2ES2 gl, boolean on) {
if(on) {
@@ -178,7 +175,7 @@ public class ShaderState {
* @see #glGetAttribLocation
* @see javax.media.opengl.GL2ES2#glGetAttribLocation
* @see #getAttribLocation
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
public void glBindAttribLocation(GL2ES2 gl, int index, String name) {
if(null==shaderProgram) throw new GLException("No program is attached");
@@ -203,7 +200,7 @@ public class ShaderState {
* @see #glGetAttribLocation
* @see javax.media.opengl.GL2ES2#glGetAttribLocation
* @see #getAttribLocation
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
public int glGetAttribLocation(GL2ES2 gl, String name) {
if(!shaderProgram.linked()) throw new GLException("Program is not linked");
@@ -240,17 +237,17 @@ public class ShaderState {
* Even if the attribute is not found in the current shader,
* it is stored in this state.
*
- * @returns false, if the name is not found, otherwise true
+ * @return false, if the name is not found, otherwise true
*
* @throws GLException if the program is not in use
*
* @see #glEnableVertexAttribArray
* @see #glDisableVertexAttribArray
* @see #glVertexAttribPointer
- * @see #getVertexAttributePointer
+ * @see #getVertexAttribPointer
* @see #glReleaseAllVertexAttributes
* @see #glResetAllVertexAttributes
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
public boolean glEnableVertexAttribArray(GL2ES2 gl, String name) {
if(!shaderProgram.inUse()) throw new GLException("Program is not in use");
@@ -281,17 +278,17 @@ public class ShaderState {
* Even if the attribute is not found in the current shader,
* it is removed from this state.
*
- * @returns false, if the name is not found, otherwise true
+ * @return false, if the name is not found, otherwise true
*
* @throws GLException if the program is not in use
*
* @see #glEnableVertexAttribArray
* @see #glDisableVertexAttribArray
* @see #glVertexAttribPointer
- * @see #getVertexAttributePointer
+ * @see #getVertexAttribPointer
* @see #glReleaseAllVertexAttributes
* @see #glResetAllVertexAttributes
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
public boolean glDisableVertexAttribArray(GL2ES2 gl, String name) {
if(!shaderProgram.inUse()) throw new GLException("Program is not in use");
@@ -322,17 +319,17 @@ public class ShaderState {
* it's index will be set with the attribute's location,
* if found.
*
- * @returns false, if the name is not found, otherwise true
+ * @return false, if the name is not found, otherwise true
*
* @throws GLException if the program is not in use
*
* @see #glEnableVertexAttribArray
* @see #glDisableVertexAttribArray
* @see #glVertexAttribPointer
- * @see #getVertexAttributePointer
+ * @see #getVertexAttribPointer
* @see #glReleaseAllVertexAttributes
* @see #glResetAllVertexAttributes
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
public boolean glVertexAttribPointer(GL2ES2 gl, GLArrayData data) {
if(!shaderProgram.inUse()) throw new GLException("Program is not in use");
@@ -367,15 +364,15 @@ public class ShaderState {
/**
* Get the vertex attribute data, previously set.
*
- * @returns the GLArrayData object, null if not previously set.
+ * @return the GLArrayData object, null if not previously set.
*
* @see #glEnableVertexAttribArray
* @see #glDisableVertexAttribArray
* @see #glVertexAttribPointer
- * @see #getVertexAttributePointer
+ * @see #getVertexAttribPointer
* @see #glReleaseAllVertexAttributes
* @see #glResetAllVertexAttributes
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
public GLArrayData getVertexAttribPointer(String name) {
return (GLArrayData) vertexAttribMap2Data.get(name);
@@ -390,11 +387,11 @@ public class ShaderState {
* @see #glEnableVertexAttribArray
* @see #glDisableVertexAttribArray
* @see #glVertexAttribPointer
- * @see #getVertexAttributePointer
+ * @see #getVertexAttribPointer
* @see #glReleaseAllVertexAttributes
* @see #glResetAllVertexAttributes
* @see #glResetAllVertexAttributes
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
public void glReleaseAllVertexAttributes(GL2ES2 gl) {
if(null!=shaderProgram) {
@@ -428,11 +425,11 @@ public class ShaderState {
* @see #glEnableVertexAttribArray
* @see #glDisableVertexAttribArray
* @see #glVertexAttribPointer
- * @see #getVertexAttributePointer
+ * @see #getVertexAttribPointer
* @see #glReleaseAllVertexAttributes
* @see #glResetAllVertexAttributes
* @see #glResetAllVertexAttributes
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
public void glDisableAllVertexAttributeArrays(GL2ES2 gl, boolean removeFromState) {
if(!shaderProgram.inUse()) throw new GLException("Program is not in use");
@@ -458,10 +455,10 @@ public class ShaderState {
* @see #glEnableVertexAttribArray
* @see #glDisableVertexAttribArray
* @see #glVertexAttribPointer
- * @see #getVertexAttributePointer
+ * @see #getVertexAttribPointer
* @see #glReleaseAllVertexAttributes
* @see #glResetAllVertexAttributes
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
public void glResetAllVertexAttributes(GL2ES2 gl) {
if(!shaderProgram.inUse()) throw new GLException("Program is not in use");
@@ -520,7 +517,7 @@ public class ShaderState {
* @see #glGetUniformLocation
* @see javax.media.opengl.GL2ES2#glGetUniformLocation
* @see #getUniformLocation
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
protected int glGetUniformLocation(GL2ES2 gl, String name) {
if(!shaderProgram.inUse()) throw new GLException("Program is not in use");
@@ -554,14 +551,14 @@ public class ShaderState {
* if found.
*
*
- * @returns false, if the name is not found, otherwise true
+ * @return false, if the name is not found, otherwise true
*
* @throws GLException if the program is not in use
*
* @see #glGetUniformLocation
* @see javax.media.opengl.GL2ES2#glGetUniformLocation
* @see #getUniformLocation
- * @see #glReplaceShader
+ * @see ShaderProgram#glReplaceShader
*/
public boolean glUniform(GL2ES2 gl, GLUniformData data) {
if(!shaderProgram.inUse()) throw new GLException("Program is not in use");
@@ -581,7 +578,7 @@ public class ShaderState {
/**
* Get the uniform data, previously set.
*
- * @returns the GLUniformData object, null if not previously set.
+ * @return the GLUniformData object, null if not previously set.
*/
public GLUniformData getUniform(String name) {
return (GLUniformData) uniformMap2Data.get(name);
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/ShaderUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
index 390fb27c7..c7e845953 100644
--- a/src/jogl/classes/com/sun/opengl/util/glsl/ShaderUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
@@ -31,7 +31,7 @@
*
*/
-package com.sun.opengl.util.glsl;
+package com.jogamp.opengl.util.glsl;
import java.io.PrintStream;
import java.nio.*;
@@ -221,7 +221,7 @@ public class ShaderUtil {
v = true;
}
shaderCompilerAvailable = new Boolean(v);
- } else if( gl.isGL2() || gl.isGL2ES2() ) {
+ } else if( gl.isGL2ES2() ) {
shaderCompilerAvailable = new Boolean(true);
} else {
throw new GLException("Invalid OpenGL profile");
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/FixedFuncUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java
index 4149aec69..7ec4ac50e 100644
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/FixedFuncUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java
@@ -2,12 +2,12 @@
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
*/
-package com.sun.opengl.util.glsl.fixedfunc;
+package com.jogamp.opengl.util.glsl.fixedfunc;
import javax.media.opengl.*;
import javax.media.opengl.fixedfunc.*;
-import com.sun.opengl.util.glsl.fixedfunc.impl.*;
+import com.jogamp.opengl.util.glsl.fixedfunc.impl.*;
/**
* Tool to pipeline GL2ES2 into a fixed function emulation implementing GL2ES1.
@@ -28,7 +28,7 @@ public class FixedFuncUtil {
gl.getContext().setGL(impl);
return impl;
}
- throw new GLException("GL Object is neither GL2ES1 nor GL2ES2");
+ throw new GLException("GL Object is neither GL2ES1 nor GL2ES2: "+gl.getContext());
}
/**
@@ -66,25 +66,25 @@ public class FixedFuncUtil {
/**
* String name for
- * @see javax.media.opengl.GL#GL_VERTEX_ARRAY
+ * @see javax.media.opengl.GL2#GL_VERTEX_ARRAY
*/
public static final String mgl_Vertex = FixedFuncPipeline.mgl_Vertex;
/**
* String name for
- * @see javax.media.opengl.GL#GL_NORMAL_ARRAY
+ * @see javax.media.opengl.GL2#GL_NORMAL_ARRAY
*/
public static final String mgl_Normal = FixedFuncPipeline.mgl_Normal;
/**
* String name for
- * @see javax.media.opengl.GL#GL_COLOR_ARRAY
+ * @see javax.media.opengl.GL2#GL_COLOR_ARRAY
*/
public static final String mgl_Color = FixedFuncPipeline.mgl_Color;
/**
* String name for
- * @see javax.media.opengl.GL#GL_TEXTURE_COORD_ARRAY
+ * @see javax.media.opengl.GL2#GL_TEXTURE_COORD_ARRAY
*/
public static final String mgl_MultiTexCoord = FixedFuncPipeline.mgl_MultiTexCoord;
}
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/FixedFuncHook.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncHook.java
index 6f44f10b7..b8e3922a4 100755
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/FixedFuncHook.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncHook.java
@@ -2,14 +2,14 @@
* Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
*/
-package com.sun.opengl.util.glsl.fixedfunc.impl;
+package com.jogamp.opengl.util.glsl.fixedfunc.impl;
import javax.media.opengl.*;
import javax.media.opengl.fixedfunc.*;
import javax.media.opengl.glu.*;
-import com.sun.gluegen.runtime.BufferFactory;
-import com.sun.opengl.util.*;
-import com.sun.opengl.util.glsl.*;
+import com.jogamp.common.nio.Buffers;
+import com.jogamp.opengl.util.*;
+import com.jogamp.opengl.util.glsl.*;
import java.nio.*;
public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFunc {
@@ -128,7 +128,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
pmvMatrix.glLoadMatrixf(m);
}
public void glLoadMatrixf(float[] m, int m_offset) {
- glLoadMatrixf(BufferUtil.newFloatBuffer(m, m_offset));
+ glLoadMatrixf(GLBuffers.newDirectFloatBuffer(m, m_offset));
}
public void glPopMatrix() {
pmvMatrix.glPopMatrix();
@@ -143,7 +143,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
pmvMatrix.glMultMatrixf(m);
}
public void glMultMatrixf(float[] m, int m_offset) {
- glMultMatrixf(BufferUtil.newFloatBuffer(m, m_offset));
+ glMultMatrixf(GLBuffers.newDirectFloatBuffer(m, m_offset));
}
public void glTranslatef(float x, float y, float z) {
pmvMatrix.glTranslatef(x, y, z);
@@ -165,23 +165,23 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
// LightingIf
//
public void glColor4f(float red, float green, float blue, float alpha) {
- fixedFunction.glColor4fv(gl, BufferUtil.newFloatBuffer(new float[] { red, green, blue, alpha }));
+ fixedFunction.glColor4fv(gl, GLBuffers.newDirectFloatBuffer(new float[] { red, green, blue, alpha }));
}
public void glLightfv(int light, int pname, java.nio.FloatBuffer params) {
fixedFunction.glLightfv(gl, light, pname, params);
}
public void glLightfv(int light, int pname, float[] params, int params_offset) {
- glLightfv(light, pname, BufferUtil.newFloatBuffer(params, params_offset));
+ glLightfv(light, pname, GLBuffers.newDirectFloatBuffer(params, params_offset));
}
public void glMaterialfv(int face, int pname, java.nio.FloatBuffer params) {
fixedFunction.glMaterialfv(gl, face, pname, params);
}
public void glMaterialfv(int face, int pname, float[] params, int params_offset) {
- glMaterialfv(face, pname, BufferUtil.newFloatBuffer(params, params_offset));
+ glMaterialfv(face, pname, GLBuffers.newDirectFloatBuffer(params, params_offset));
}
public void glMaterialf(int face, int pname, float param) {
- glMaterialfv(face, pname, BufferUtil.newFloatBuffer(new float[] { param }));
+ glMaterialfv(face, pname, GLBuffers.newDirectFloatBuffer(new float[] { param }));
}
public void glShadeModel(int mode) {
fixedFunction.glShadeModel(gl, mode);
@@ -206,8 +206,8 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
if(gl.glIsVBOArrayEnabled()) {
throw new GLException("VBO array is not disabled: "+array);
}
- BufferFactory.rangeCheck(array.getBuffer(), 1);
- if (!BufferFactory.isDirect(array.getBuffer())) {
+ Buffers.rangeCheck(array.getBuffer(), 1);
+ if (!Buffers.isDirect(array.getBuffer())) {
throw new GLException("Argument \"pointer\" was not a direct buffer"); }
}
fixedFunction.glVertexPointer(gl, array);
@@ -234,8 +234,8 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
if(gl.glIsVBOArrayEnabled()) {
throw new GLException("VBO array is not disabled: "+array);
}
- BufferFactory.rangeCheck(array.getBuffer(), 1);
- if (!BufferFactory.isDirect(array.getBuffer())) {
+ Buffers.rangeCheck(array.getBuffer(), 1);
+ if (!Buffers.isDirect(array.getBuffer())) {
throw new GLException("Argument \"pointer\" was not a direct buffer"); }
}
fixedFunction.glColorPointer(gl, array);
@@ -265,8 +265,8 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
if(gl.glIsVBOArrayEnabled()) {
throw new GLException("VBO array is not disabled: "+array);
}
- BufferFactory.rangeCheck(array.getBuffer(), 1);
- if (!BufferFactory.isDirect(array.getBuffer())) {
+ Buffers.rangeCheck(array.getBuffer(), 1);
+ if (!Buffers.isDirect(array.getBuffer())) {
throw new GLException("Argument \"pointer\" was not a direct buffer"); }
}
fixedFunction.glNormalPointer(gl, array);
@@ -293,8 +293,8 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun
if(gl.glIsVBOArrayEnabled()) {
throw new GLException("VBO array is not disabled: "+array);
}
- BufferFactory.rangeCheck(array.getBuffer(), 1);
- if (!BufferFactory.isDirect(array.getBuffer())) {
+ Buffers.rangeCheck(array.getBuffer(), 1);
+ if (!Buffers.isDirect(array.getBuffer())) {
throw new GLException("Argument \"pointer\" was not a direct buffer"); }
}
fixedFunction.glTexCoordPointer(gl, array);
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/FixedFuncPipeline.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncPipeline.java
index 1b8dd1f11..529e4567b 100644
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/FixedFuncPipeline.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/FixedFuncPipeline.java
@@ -1,11 +1,11 @@
-package com.sun.opengl.util.glsl.fixedfunc.impl;
+package com.jogamp.opengl.util.glsl.fixedfunc.impl;
+import com.jogamp.common.nio.Buffers;
import javax.media.opengl.*;
import javax.media.opengl.fixedfunc.*;
-import com.sun.opengl.util.*;
-import com.sun.opengl.util.glsl.*;
-import com.sun.opengl.util.glsl.fixedfunc.*;
+import com.jogamp.opengl.util.*;
+import com.jogamp.opengl.util.glsl.*;
import java.nio.*;
public class FixedFuncPipeline {
@@ -490,14 +490,14 @@ public class FixedFuncPipeline {
protected boolean verbose=false;
protected boolean textureEnabled=false;
- protected IntBuffer textureCoordsEnabled = BufferUtil.newIntBuffer(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 });
+ protected IntBuffer textureCoordsEnabled = Buffers.newDirectIntBuffer(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 });
protected boolean textureCoordsEnabledDirty = false;
protected int activeTextureUnit=0;
protected int cullFace=-2; // <=0 disabled, 1: front, 2: back (default, but disabled), 3: front & back
protected boolean lightingEnabled=false;
- protected IntBuffer lightsEnabled = BufferUtil.newIntBuffer(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 });
+ protected IntBuffer lightsEnabled = Buffers.newDirectIntBuffer(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 });
protected boolean lightsEnabledDirty = false;
protected PMVMatrix pmvMatrix;
@@ -525,23 +525,23 @@ public class FixedFuncPipeline {
protected static final String mgl_CullFace = "mgl_CullFace"; // 1i
- protected static final FloatBuffer zero4f = BufferUtil.newFloatBuffer(new float[] { 0.0f, 0.0f, 0.0f, 0.0f });
+ protected static final FloatBuffer zero4f = Buffers.newDirectFloatBuffer(new float[] { 0.0f, 0.0f, 0.0f, 0.0f });
- public static final FloatBuffer defAmbient = BufferUtil.newFloatBuffer(new float[] { 0f, 0f, 0f, 1f });
+ public static final FloatBuffer defAmbient = Buffers.newDirectFloatBuffer(new float[] { 0f, 0f, 0f, 1f });
public static final FloatBuffer defDiffuse = zero4f;
public static final FloatBuffer defSpecular= zero4f;
- public static final FloatBuffer defPosition= BufferUtil.newFloatBuffer(new float[] { 0f, 0f, 1f, 0f });
- public static final FloatBuffer defSpotDir = BufferUtil.newFloatBuffer(new float[] { 0f, 0f, -1f });
+ public static final FloatBuffer defPosition= Buffers.newDirectFloatBuffer(new float[] { 0f, 0f, 1f, 0f });
+ public static final FloatBuffer defSpotDir = Buffers.newDirectFloatBuffer(new float[] { 0f, 0f, -1f });
public static final float defSpotExponent = 0f;
public static final float defSpotCutoff = 180f;
public static final float defConstantAtten = 1f;
public static final float defLinearAtten = 0f;
public static final float defQuadraticAtten= 0f;
- public static final FloatBuffer defMatAmbient = BufferUtil.newFloatBuffer(new float[] { 0.2f, 0.2f, 0.2f, 1.0f });
- public static final FloatBuffer defMatDiffuse = BufferUtil.newFloatBuffer(new float[] { 0.8f, 0.8f, 0.8f, 1.0f });
- public static final FloatBuffer defMatSpecular= BufferUtil.newFloatBuffer(new float[] { 0f, 0f, 0f, 1f});
- public static final FloatBuffer defMatEmission= BufferUtil.newFloatBuffer(new float[] { 0f, 0f, 0f, 1f});
+ 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= Buffers.newDirectFloatBuffer(new float[] { 0f, 0f, 0f, 1f});
+ public static final FloatBuffer defMatEmission= Buffers.newDirectFloatBuffer(new float[] { 0f, 0f, 0f, 1f});
public static final float defMatShininess = 0f;
protected static final String vertexColorFileDef = "FixedFuncColor";
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColor.fp b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColor.fp
index 408ff7251..408ff7251 100644
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColor.fp
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColor.fp
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColor.vp b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColor.vp
index 346e40196..346e40196 100644
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColor.vp
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColor.vp
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColorLight.vp b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColorLight.vp
index ce203cfb9..ce203cfb9 100644
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColorLight.vp
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColorLight.vp
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColorTexture.fp b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColorTexture.fp
index 86e6ace73..86e6ace73 100644
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColorTexture.fp
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/FixedFuncColorTexture.fp
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColor.bfp b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColor.bfp
index 3ebaaee1d..3ebaaee1d 100755
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColor.bfp
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColor.bfp
Binary files differ
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColor.bvp b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColor.bvp
index 279ef72c7..279ef72c7 100755
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColor.bvp
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColor.bvp
Binary files differ
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColorLight.bvp b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColorLight.bvp
index 5a9deea71..5a9deea71 100755
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColorLight.bvp
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColorLight.bvp
Binary files differ
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColorTexture.bfp b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColorTexture.bfp
index ce1397fe1..ce1397fe1 100755
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColorTexture.bfp
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/bin/nvidia/FixedFuncColorTexture.bfp
Binary files differ
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/es_precision.glsl b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/es_precision.glsl
index fd6abe54e..fd6abe54e 100644
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/es_precision.glsl
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/es_precision.glsl
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/mgl_attribute.glsl b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/mgl_attribute.glsl
index b09bdb05a..b09bdb05a 100644
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/mgl_attribute.glsl
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/mgl_attribute.glsl
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/mgl_const.glsl b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/mgl_const.glsl
index 1a464a1cb..1a464a1cb 100644
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/mgl_const.glsl
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/mgl_const.glsl
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/mgl_lightdef.glsl b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/mgl_lightdef.glsl
index 98e214139..98e214139 100644
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/mgl_lightdef.glsl
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/mgl_lightdef.glsl
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/mgl_settexcoord.vp b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/mgl_settexcoord.vp
index 1efe328d0..1efe328d0 100644
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/mgl_settexcoord.vp
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/mgl_settexcoord.vp
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/mgl_uniform.glsl b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/mgl_uniform.glsl
index d8b3c7f95..d8b3c7f95 100644
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/mgl_uniform.glsl
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/mgl_uniform.glsl
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/mgl_uniform_light.glsl b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/mgl_uniform_light.glsl
index 0dedb5d5d..0dedb5d5d 100644
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/mgl_uniform_light.glsl
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/mgl_uniform_light.glsl
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/mgl_varying.glsl b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/mgl_varying.glsl
index fc9f735d1..fc9f735d1 100644
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/mgl_varying.glsl
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/mgl_varying.glsl
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/scripts/nvidia-apx/glslc-ff.bat b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/scripts/nvidia-apx/glslc-ff.bat
index 002dca8ef..8a2114e07 100755
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/scripts/nvidia-apx/glslc-ff.bat
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/scripts/nvidia-apx/glslc-ff.bat
@@ -6,4 +6,4 @@ IF !"%JOGLDIR%"==""! GOTO YESPATH
set JOGLDIR=..\lib
:YESPATH
-java -cp %JOGLDIR%\jogl.core.jar;%JOGLDIR%\jogl.gles2.jar;%JOGLDIR%\jogl.fixed.jar;%JOGLDIR%\jogl.sdk.jar com.sun.opengl.util.glsl.sdk.CompileShaderNVidia FixedFuncColor.fp FixedFuncColorTexture.fp FixedFuncColorLight.vp FixedFuncColor.vp
+java -cp %JOGLDIR%\jogl.core.jar;%JOGLDIR%\jogl.gles2.jar;%JOGLDIR%\jogl.fixed.jar;%JOGLDIR%\jogl.sdk.jar com.jogamp.opengl.util.glsl.sdk.CompileShaderNVidia FixedFuncColor.fp FixedFuncColorTexture.fp FixedFuncColorLight.vp FixedFuncColor.vp
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/scripts/nvidia-apx/glslc.bat b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/scripts/nvidia-apx/glslc.bat
index 9b5a4b39c..c7ca0a8b7 100755
--- a/src/jogl/classes/com/sun/opengl/util/glsl/fixedfunc/impl/shaders/scripts/nvidia-apx/glslc.bat
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/impl/shaders/scripts/nvidia-apx/glslc.bat
@@ -6,4 +6,4 @@ IF !"%JOGLDIR%"==""! GOTO YESPATH
set JOGLDIR=..\lib
:YESPATH
-java -cp %JOGLDIR%\jogl.core.jar;%JOGLDIR%\jogl.gles2.jar;%JOGLDIR%\jogl.fixed.jar;%JOGLDIR%\jogl.sdk.jar com.sun.opengl.util.glsl.sdk.CompileShaderNVidia %1
+java -cp %JOGLDIR%\jogl.core.jar;%JOGLDIR%\jogl.gles2.jar;%JOGLDIR%\jogl.fixed.jar;%JOGLDIR%\jogl.sdk.jar com.jogamp.opengl.util.glsl.sdk.CompileShaderNVidia %1
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/sdk/CompileShader.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java
index f18005feb..a0eed50ea 100755
--- a/src/jogl/classes/com/sun/opengl/util/glsl/sdk/CompileShader.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java
@@ -1,22 +1,23 @@
-package com.sun.opengl.util.glsl.sdk;
+package com.jogamp.opengl.util.glsl.sdk;
import javax.media.opengl.*;
-import com.sun.opengl.util.*;
-import com.sun.opengl.util.glsl.*;
+import com.jogamp.opengl.util.*;
+import com.jogamp.opengl.util.glsl.*;
import java.io.*;
import java.net.*;
-/** Precompiles a shader into a vendor binary format. Input is the
- resource name of the shader, such as
- "com/sun/opengl/impl/glsl/fixed/shader/a.fp".
- Output is "com/sun/opengl/impl/glsl/fixed/shader/bin/nvidia/a.bfp".
-
- All path and suffixes are determined by the ShaderCode class,
- which ensures runtime compatibility.
-
- @see javax.media.opengl.glsl.ShaderCode
- */
+/**
+ * Precompiles a shader into a vendor binary format. Input is the
+ * resource name of the shader, such as
+ * "com/jogamp/opengl/impl/glsl/fixed/shader/a.fp".
+ * Output is "com/jogamp/opengl/impl/glsl/fixed/shader/bin/nvidia/a.bfp".
+ *
+ * All path and suffixes are determined by the ShaderCode class,
+ * which ensures runtime compatibility.
+ *
+ * @see com.jogamp.opengl.util.glsl.ShaderCode
+ */
public abstract class CompileShader {
diff --git a/src/jogl/classes/com/sun/opengl/util/glsl/sdk/CompileShaderNVidia.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShaderNVidia.java
index 387ccf732..8eb9ef579 100755
--- a/src/jogl/classes/com/sun/opengl/util/glsl/sdk/CompileShaderNVidia.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShaderNVidia.java
@@ -1,4 +1,4 @@
-package com.sun.opengl.util.glsl.sdk;
+package com.jogamp.opengl.util.glsl.sdk;
import javax.media.opengl.*;
@@ -6,8 +6,8 @@ import java.io.*;
/** Precompiles a shader into NVidia binary format. Input is the
resource name of the shader, such as
- "com/sun/opengl/impl/glsl/fixed/shader/a.fp".
- Output is "com/sun/opengl/impl/glsl/fixed/shader/bin/nvidia/a.bfp". */
+ "com/jogamp/opengl/impl/glsl/fixed/shader/a.fp".
+ Output is "com/jogamp/opengl/impl/glsl/fixed/shader/bin/nvidia/a.bfp". */
public class CompileShaderNVidia extends CompileShader {
private static final String NVAPSDK;
diff --git a/src/jogl/classes/com/sun/opengl/util/packrect/BackingStoreManager.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/BackingStoreManager.java
index 754ba2757..7b6a1b479 100755
--- a/src/jogl/classes/com/sun/opengl/util/packrect/BackingStoreManager.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/BackingStoreManager.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.packrect;
+package com.jogamp.opengl.util.packrect;
/** This interface must be implemented by the end user and is called
in response to events like addition of rectangles into the
diff --git a/src/jogl/classes/com/sun/opengl/util/packrect/Level.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.java
index 3dae4301d..5ba3f7330 100755
--- a/src/jogl/classes/com/sun/opengl/util/packrect/Level.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.packrect;
+package com.jogamp.opengl.util.packrect;
import java.util.*;
diff --git a/src/jogl/classes/com/sun/opengl/util/packrect/LevelSet.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java
index 973980fdc..6783aec3b 100755
--- a/src/jogl/classes/com/sun/opengl/util/packrect/LevelSet.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.packrect;
+package com.jogamp.opengl.util.packrect;
import java.util.*;
diff --git a/src/jogl/classes/com/sun/opengl/util/packrect/Rect.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java
index 2f12981a6..6206c4a11 100755
--- a/src/jogl/classes/com/sun/opengl/util/packrect/Rect.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.packrect;
+package com.jogamp.opengl.util.packrect;
/** Represents a rectangular region on the backing store. The edges of
the rectangle are the infinitely thin region between adjacent
diff --git a/src/jogl/classes/com/sun/opengl/util/packrect/RectVisitor.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/RectVisitor.java
index 8f395ed99..49cfc82e6 100755
--- a/src/jogl/classes/com/sun/opengl/util/packrect/RectVisitor.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/RectVisitor.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.packrect;
+package com.jogamp.opengl.util.packrect;
/** Iteration construct without exposing the internals of the
RectanglePacker and without implementing a complex Iterator. */
diff --git a/src/jogl/classes/com/sun/opengl/util/packrect/RectanglePacker.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java
index 51e6842c0..1496a04a6 100755
--- a/src/jogl/classes/com/sun/opengl/util/packrect/RectanglePacker.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.packrect;
+package com.jogamp.opengl.util.packrect;
import java.util.*;
diff --git a/src/jogl/classes/com/sun/opengl/util/packrect/package.html b/src/jogl/classes/com/jogamp/opengl/util/packrect/package.html
index c1c5db477..c1c5db477 100755
--- a/src/jogl/classes/com/sun/opengl/util/packrect/package.html
+++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/package.html
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/Texture.java b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
index 3a2799cf3..57ac0d45a 100755
--- a/src/jogl/classes/com/sun/opengl/util/texture/Texture.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
@@ -34,7 +34,7 @@
* facility.
*/
-package com.sun.opengl.util.texture;
+package com.jogamp.opengl.util.texture;
import java.nio.*;
import java.security.*;
@@ -42,9 +42,9 @@ import java.security.*;
import javax.media.opengl.*;
import javax.media.opengl.glu.*;
import javax.media.nativewindow.NativeWindowFactory;
-import com.sun.opengl.impl.*;
-import com.sun.opengl.util.texture.*;
-import com.sun.opengl.util.texture.spi.*;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.opengl.util.texture.*;
+import com.jogamp.opengl.util.texture.spi.*;
/**
* Represents an OpenGL texture object. Contains convenience routines
@@ -487,7 +487,7 @@ public class Texture {
}
if (!done && preferTexRect(gl) && !isPOT &&
- haveTexRect(gl) && !data.isDataCompressed() && gl.isGL2()) {
+ haveTexRect(gl) && !data.isDataCompressed() && !gl.isGL3() && !gl.isGLES()) {
// GL_ARB_texture_rectangle does not work for compressed textures
if (DEBUG) {
System.err.println("Using GL_ARB_texture_rectangle preferentially on this hardware");
@@ -514,7 +514,7 @@ public class Texture {
done = true;
}
- if (!done && haveTexRect(gl) && !data.isDataCompressed() && gl.isGL2()) {
+ if (!done && haveTexRect(gl) && !data.isDataCompressed() && !gl.isGL3() && !gl.isGLES()) {
// GL_ARB_texture_rectangle does not work for compressed textures
if (DEBUG) {
System.err.println("Using GL_ARB_texture_rectangle");
@@ -1013,10 +1013,10 @@ public class Texture {
int[] skipRows = { 0 };
int[] skipPixels = { 0 };
gl.glGetIntegerv(GL.GL_UNPACK_ALIGNMENT, align, 0); // save alignment
- if(gl.isGL2()) {
- gl.glGetIntegerv(GL2.GL_UNPACK_ROW_LENGTH, rowLength, 0); // save row length
- gl.glGetIntegerv(GL2.GL_UNPACK_SKIP_ROWS, skipRows, 0); // save skipped rows
- gl.glGetIntegerv(GL2.GL_UNPACK_SKIP_PIXELS, skipPixels, 0); // save skipped pixels
+ if(gl.isGL2GL3()) {
+ gl.glGetIntegerv(GL2GL3.GL_UNPACK_ROW_LENGTH, rowLength, 0); // save row length
+ gl.glGetIntegerv(GL2GL3.GL_UNPACK_SKIP_ROWS, skipRows, 0); // save skipped rows
+ gl.glGetIntegerv(GL2GL3.GL_UNPACK_SKIP_PIXELS, skipPixels, 0); // save skipped pixels
}
gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, data.getAlignment());
if (DEBUG && VERBOSE) {
@@ -1028,10 +1028,10 @@ public class Texture {
System.out.println("width = " + width);
System.out.println("height = " + height);
}
- if(gl.isGL2()) {
- gl.glPixelStorei(GL2.GL_UNPACK_ROW_LENGTH, rowlen);
- gl.glPixelStorei(GL2.GL_UNPACK_SKIP_ROWS, srcy);
- gl.glPixelStorei(GL2.GL_UNPACK_SKIP_PIXELS, srcx);
+ if(gl.isGL2GL3()) {
+ gl.glPixelStorei(GL2GL3.GL_UNPACK_ROW_LENGTH, rowlen);
+ gl.glPixelStorei(GL2GL3.GL_UNPACK_SKIP_ROWS, srcy);
+ gl.glPixelStorei(GL2GL3.GL_UNPACK_SKIP_PIXELS, srcx);
} else {
if ( rowlen!=0 && rowlen!=width &&
srcy!=0 && srcx!=0 ) {
@@ -1044,10 +1044,10 @@ public class Texture {
data.getPixelFormat(), data.getPixelType(),
buffer);
gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, align[0]); // restore alignment
- if(gl.isGL2()) {
- gl.glPixelStorei(GL2.GL_UNPACK_ROW_LENGTH, rowLength[0]); // restore row length
- gl.glPixelStorei(GL2.GL_UNPACK_SKIP_ROWS, skipRows[0]); // restore skipped rows
- gl.glPixelStorei(GL2.GL_UNPACK_SKIP_PIXELS, skipPixels[0]); // restore skipped pixels
+ if(gl.isGL2GL3()) {
+ gl.glPixelStorei(GL2GL3.GL_UNPACK_ROW_LENGTH, rowLength[0]); // restore row length
+ gl.glPixelStorei(GL2GL3.GL_UNPACK_SKIP_ROWS, skipRows[0]); // restore skipped rows
+ gl.glPixelStorei(GL2GL3.GL_UNPACK_SKIP_PIXELS, skipPixels[0]); // restore skipped pixels
}
}
}
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/TextureCoords.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java
index 51710e077..8d8b3679d 100755
--- a/src/jogl/classes/com/sun/opengl/util/texture/TextureCoords.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java
@@ -34,7 +34,7 @@
* facility.
*/
-package com.sun.opengl.util.texture;
+package com.jogamp.opengl.util.texture;
/** Specifies texture coordinates for a rectangular area of a
texture. Note that some textures are inherently flipped vertically
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/TextureData.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java
index 8ac4b9b84..f598422bf 100755
--- a/src/jogl/classes/com/sun/opengl/util/texture/TextureData.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java
@@ -34,12 +34,12 @@
* facility.
*/
-package com.sun.opengl.util.texture;
+package com.jogamp.opengl.util.texture;
import java.nio.*;
import javax.media.opengl.*;
-import com.sun.opengl.util.*;
+import com.jogamp.opengl.util.*;
/**
* Represents the data for an OpenGL texture. This is separated from
@@ -49,6 +49,7 @@ import com.sun.opengl.util.*;
*
* @author Chris Campbell
* @author Kenneth Russell
+ * @author Sven Gothel
*/
public class TextureData {
@@ -74,6 +75,7 @@ public class TextureData {
// These booleans are a concession to the AWTTextureData subclass
protected boolean haveEXTABGR;
protected boolean haveGL12;
+ protected GLProfile glProfile;
/**
* Constructs a new TextureData object with the specified parameters
@@ -83,6 +85,8 @@ public class TextureData {
* memory-mapped files that might otherwise require a garbage
* collection to reclaim and close.
*
+ * @param glp the OpenGL Profile this texture data should be
+ * created for.
* @param internalFormat the OpenGL internal format for the
* resulting texture; must be specified, may
* not be 0
@@ -113,7 +117,8 @@ public class TextureData {
* data were invalid, such as requesting mipmap generation for a
* compressed texture
*/
- public TextureData(int internalFormat,
+ public TextureData(GLProfile glp,
+ int internalFormat,
int width,
int height,
int border,
@@ -128,6 +133,7 @@ public class TextureData {
throw new IllegalArgumentException("Can not generate mipmaps for compressed textures");
}
+ this.glProfile = glp;
this.width = width;
this.height = height;
this.border = border;
@@ -151,6 +157,8 @@ public class TextureData {
* complete; for example, closing of memory-mapped files that might
* otherwise require a garbage collection to reclaim and close.
*
+ * @param glp the OpenGL Profile this texture data should be
+ * created for.
* @param internalFormat the OpenGL internal format for the
* resulting texture; must be specified, may
* not be 0
@@ -180,7 +188,8 @@ public class TextureData {
* data were invalid, such as requesting mipmap generation for a
* compressed texture
*/
- public TextureData(int internalFormat,
+ public TextureData(GLProfile glp,
+ int internalFormat,
int width,
int height,
int border,
@@ -190,6 +199,7 @@ public class TextureData {
boolean mustFlipVertically,
Buffer[] mipmapData,
Flusher flusher) throws IllegalArgumentException {
+ this.glProfile = glp;
this.width = width;
this.height = height;
this.border = border;
@@ -207,15 +217,16 @@ public class TextureData {
}
/** Used only by subclasses */
- protected TextureData() {
- }
+ protected TextureData(GLProfile glp) { this.glProfile = glp; }
/** Returns the width in pixels of the texture data. */
public int getWidth() { return width; }
/** 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 pixel format of the texture data. */
public int getPixelFormat() {
return pixelFormat;
@@ -225,27 +236,41 @@ public class TextureData {
return pixelType;
}
/** 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() {
return buffer;
}
/** 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. */
public void setWidth(int width) { this.width = width; }
@@ -291,6 +316,9 @@ public class TextureData {
this.haveGL12 = haveGL12;
}
+ /** Returns the GLProfile this texture data is intended and created for. */
+ public GLProfile getGLProfile() { return glProfile; }
+
/** Returns an estimate of the amount of memory in bytes this
TextureData will consume once uploaded to the graphics card. It
should only be treated as an estimate; most applications should
@@ -337,6 +365,6 @@ public class TextureData {
if (buffer == null) {
return 0;
}
- return buffer.capacity() * BufferUtil.sizeOfBufferElem(buffer);
+ return buffer.capacity() * GLBuffers.sizeOfBufferElem(buffer);
}
}
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/TextureIO.java.javame_cdc_fp b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java.javame_cdc_fp
index e7c80678f..dbd194d21 100755
--- a/src/jogl/classes/com/sun/opengl/util/texture/TextureIO.java.javame_cdc_fp
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java.javame_cdc_fp
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.texture;
+package com.jogamp.opengl.util.texture;
import java.io.*;
import java.net.*;
@@ -46,9 +46,9 @@ import java.util.*;
import javax.media.opengl.*;
import javax.media.opengl.glu.*;
-import com.sun.opengl.impl.Debug;
-import com.sun.opengl.util.*;
-import com.sun.opengl.util.texture.spi.*;
+import com.jogamp.opengl.impl.Debug;
+import com.jogamp.opengl.util.*;
+import com.jogamp.opengl.util.texture.spi.*;
/** <P> Provides input and output facilities for both loading OpenGL
textures from disk and streams as well as writing textures already
@@ -155,6 +155,8 @@ public class TextureIO {
/**
* Creates a TextureData from the given file. Does no OpenGL work.
*
+ * @param glp the OpenGL Profile this texture data should be
+ * created for.
* @param file the file from which to read the texture data
* @param mipmap whether mipmaps should be produced for this
* texture either by autogenerating them or
@@ -171,18 +173,20 @@ public class TextureIO {
* registered texture providers could read the file
* @throws IOException if an error occurred while reading the file
*/
- public static TextureData newTextureData(File file,
+ public static TextureData newTextureData(GLProfile glp, File file,
boolean mipmap,
String fileSuffix) throws IOException {
if (fileSuffix == null) {
fileSuffix = FileUtil.getFileSuffix(file);
}
- return newTextureDataImpl(file, 0, 0, mipmap, fileSuffix);
+ return newTextureDataImpl(glp, file, 0, 0, mipmap, fileSuffix);
}
/**
* Creates a TextureData from the given stream. Does no OpenGL work.
*
+ * @param glp the OpenGL Profile this texture data should be
+ * created for.
* @param stream the stream from which to read the texture data
* @param mipmap whether mipmaps should be produced for this
* texture either by autogenerating them or
@@ -199,15 +203,17 @@ public class TextureIO {
* registered texture providers could read the stream
* @throws IOException if an error occurred while reading the stream
*/
- public static TextureData newTextureData(InputStream stream,
+ public static TextureData newTextureData(GLProfile glp, InputStream stream,
boolean mipmap,
String fileSuffix) throws IOException {
- return newTextureDataImpl(stream, 0, 0, mipmap, fileSuffix);
+ return newTextureDataImpl(glp, stream, 0, 0, mipmap, fileSuffix);
}
/**
* Creates a TextureData from the given URL. Does no OpenGL work.
*
+ * @param glp the OpenGL Profile this texture data should be
+ * created for.
* @param url the URL from which to read the texture data
* @param mipmap whether mipmaps should be produced for this
* texture either by autogenerating them or
@@ -224,13 +230,13 @@ public class TextureIO {
* registered texture providers could read the URL
* @throws IOException if an error occurred while reading the URL
*/
- public static TextureData newTextureData(URL url,
+ public static TextureData newTextureData(GLProfile glp, URL url,
boolean mipmap,
String fileSuffix) throws IOException {
if (fileSuffix == null) {
fileSuffix = FileUtil.getFileSuffix(url.getPath());
}
- return newTextureDataImpl(url, 0, 0, mipmap, fileSuffix);
+ return newTextureDataImpl(glp, url, 0, 0, mipmap, fileSuffix);
}
//----------------------------------------------------------------------
@@ -248,6 +254,8 @@ public class TextureIO {
* variant of this method which does not take these arguments. Does
* no OpenGL work.
*
+ * @param glp the OpenGL Profile this texture data should be
+ * created for.
* @param file the file from which to read the texture data
* @param internalFormat the OpenGL internal format of the texture
* which will eventually result from the TextureData
@@ -270,7 +278,7 @@ public class TextureIO {
* pixelFormat was 0
* @throws IOException if an error occurred while reading the file
*/
- public static TextureData newTextureData(File file,
+ public static TextureData newTextureData(GLProfile glp, File file,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -283,7 +291,7 @@ public class TextureIO {
fileSuffix = FileUtil.getFileSuffix(file);
}
- return newTextureDataImpl(file, internalFormat, pixelFormat, mipmap, fileSuffix);
+ return newTextureDataImpl(glp, file, internalFormat, pixelFormat, mipmap, fileSuffix);
}
/**
@@ -294,6 +302,8 @@ public class TextureIO {
* variant of this method which does not take these arguments. Does
* no OpenGL work.
*
+ * @param glp the OpenGL Profile this texture data should be
+ * created for.
* @param stream the stream from which to read the texture data
* @param internalFormat the OpenGL internal format of the texture
* which will eventually result from the TextureData
@@ -316,7 +326,7 @@ public class TextureIO {
* pixelFormat was 0
* @throws IOException if an error occurred while reading the stream
*/
- public static TextureData newTextureData(InputStream stream,
+ public static TextureData newTextureData(GLProfile glp, InputStream stream,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -325,7 +335,7 @@ public class TextureIO {
throw new IllegalArgumentException("internalFormat and pixelFormat must be non-zero");
}
- return newTextureDataImpl(stream, internalFormat, pixelFormat, mipmap, fileSuffix);
+ return newTextureDataImpl(glp, stream, internalFormat, pixelFormat, mipmap, fileSuffix);
}
/**
@@ -336,6 +346,8 @@ public class TextureIO {
* variant of this method which does not take these arguments. Does
* no OpenGL work.
*
+ * @param glp the OpenGL Profile this texture data should be
+ * created for.
* @param url the URL from which to read the texture data
* @param internalFormat the OpenGL internal format of the texture
* which will eventually result from the TextureData
@@ -358,7 +370,7 @@ public class TextureIO {
* pixelFormat was 0
* @throws IOException if an error occurred while reading the URL
*/
- public static TextureData newTextureData(URL url,
+ public static TextureData newTextureData(GLProfile glp, URL url,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -371,7 +383,7 @@ public class TextureIO {
fileSuffix = FileUtil.getFileSuffix(url.getPath());
}
- return newTextureDataImpl(url, internalFormat, pixelFormat, mipmap, fileSuffix);
+ return newTextureDataImpl(glp, url, internalFormat, pixelFormat, mipmap, fileSuffix);
}
//----------------------------------------------------------------------
@@ -410,7 +422,8 @@ public class TextureIO {
* OpenGL error occurred
*/
public static Texture newTexture(File file, boolean mipmap) throws IOException, GLException {
- TextureData data = newTextureData(file, mipmap, FileUtil.getFileSuffix(file));
+ GLProfile glp = GLContext.getCurrentGL().getGLProfile();
+ TextureData data = newTextureData(glp, file, mipmap, FileUtil.getFileSuffix(file));
Texture texture = newTexture(data);
data.flush();
return texture;
@@ -437,7 +450,8 @@ public class TextureIO {
* OpenGL error occurred
*/
public static Texture newTexture(InputStream stream, boolean mipmap, String fileSuffix) throws IOException, GLException {
- TextureData data = newTextureData(stream, mipmap, fileSuffix);
+ GLProfile glp = GLContext.getCurrentGL().getGLProfile();
+ TextureData data = newTextureData(glp, stream, mipmap, fileSuffix);
Texture texture = newTexture(data);
data.flush();
return texture;
@@ -467,7 +481,8 @@ public class TextureIO {
if (fileSuffix == null) {
fileSuffix = FileUtil.getFileSuffix(url.getPath());
}
- TextureData data = newTextureData(url, mipmap, fileSuffix);
+ GLProfile glp = GLContext.getCurrentGL().getGLProfile();
+ TextureData data = newTextureData(glp, url, mipmap, fileSuffix);
Texture texture = newTexture(data);
data.flush();
return texture;
@@ -580,7 +595,7 @@ public class TextureIO {
int size = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2.GL_TEXTURE_COMPRESSED_IMAGE_SIZE);
ByteBuffer res = ByteBuffer.wrap(new byte[size]);
gl.glGetCompressedTexImage(GL.GL_TEXTURE_2D, 0, res);
- data = new TextureData(internalFormat, width, height, border, internalFormat, GL.GL_UNSIGNED_BYTE,
+ data = new TextureData(gl.getGLProfile(), internalFormat, width, height, border, internalFormat, GL.GL_UNSIGNED_BYTE,
false, true, true, res, null);
} else {
int bytesPerPixel = 0;
@@ -631,7 +646,7 @@ public class TextureIO {
gl.glPixelStorei(GL2.GL_PACK_SKIP_PIXELS, packSkipPixels);
gl.glPixelStorei(GL2.GL_PACK_SWAP_BYTES, packSwapBytes);
- data = new TextureData(internalFormat, width, height, border, fetchedFormat, GL.GL_UNSIGNED_BYTE,
+ data = new TextureData(gl.getGLProfile(), internalFormat, width, height, border, fetchedFormat, GL.GL_UNSIGNED_BYTE,
false, false, false, res, null);
if (DEBUG) {
@@ -719,7 +734,7 @@ public class TextureIO {
try {
// Use reflection to avoid compile-time dependencies on AWT-related classes
TextureProvider provider = (TextureProvider)
- Class.forName("com.sun.opengl.util.texture.spi.awt.IIOTextureProvider").newInstance();
+ Class.forName("com.jogamp.opengl.util.texture.spi.awt.IIOTextureProvider").newInstance();
addTextureProvider(provider);
} catch (Exception e) {
if (DEBUG) {
@@ -740,7 +755,7 @@ public class TextureIO {
try {
// Use reflection to avoid compile-time dependencies on AWT-related classes
TextureWriter writer = (TextureWriter)
- Class.forName("com.sun.opengl.util.texture.spi.awt.IIOTextureWriter").newInstance();
+ Class.forName("com.jogamp.opengl.util.texture.spi.awt.IIOTextureWriter").newInstance();
addTextureWriter(writer);
} catch (Exception e) {
if (DEBUG) {
@@ -758,7 +773,7 @@ public class TextureIO {
}
// Implementation methods
- private static TextureData newTextureDataImpl(File file,
+ private static TextureData newTextureDataImpl(GLProfile glp, File file,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -771,7 +786,7 @@ public class TextureIO {
for (Iterator iter = textureProviders.iterator(); iter.hasNext(); ) {
TextureProvider provider = (TextureProvider) iter.next();
- TextureData data = provider.newTextureData(file,
+ TextureData data = provider.newTextureData(glp, file,
internalFormat,
pixelFormat,
mipmap,
@@ -784,7 +799,7 @@ public class TextureIO {
throw new IOException("No suitable reader for given file "+file.getAbsolutePath());
}
- private static TextureData newTextureDataImpl(InputStream stream,
+ private static TextureData newTextureDataImpl(GLProfile glp, InputStream stream,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -802,7 +817,7 @@ public class TextureIO {
for (Iterator iter = textureProviders.iterator(); iter.hasNext(); ) {
TextureProvider provider = (TextureProvider) iter.next();
- TextureData data = provider.newTextureData(stream,
+ TextureData data = provider.newTextureData(glp, stream,
internalFormat,
pixelFormat,
mipmap,
@@ -815,7 +830,7 @@ public class TextureIO {
throw new IOException("No suitable reader for given stream");
}
- private static TextureData newTextureDataImpl(URL url,
+ private static TextureData newTextureDataImpl(GLProfile glp, URL url,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -828,7 +843,7 @@ public class TextureIO {
for (Iterator iter = textureProviders.iterator(); iter.hasNext(); ) {
TextureProvider provider = (TextureProvider) iter.next();
- TextureData data = provider.newTextureData(url,
+ TextureData data = provider.newTextureData(glp, url,
internalFormat,
pixelFormat,
mipmap,
@@ -844,7 +859,7 @@ public class TextureIO {
//----------------------------------------------------------------------
// DDS provider -- supports files only for now
static class DDSTextureProvider implements TextureProvider {
- public TextureData newTextureData(File file,
+ public TextureData newTextureData(GLProfile glp, File file,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -852,13 +867,13 @@ public class TextureIO {
if (DDS.equals(fileSuffix) ||
DDS.equals(FileUtil.getFileSuffix(file))) {
DDSImage image = DDSImage.read(file);
- return newTextureData(image, internalFormat, pixelFormat, mipmap);
+ return newTextureData(glp, image, internalFormat, pixelFormat, mipmap);
}
return null;
}
- public TextureData newTextureData(InputStream stream,
+ public TextureData newTextureData(GLProfile glp, InputStream stream,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -866,26 +881,26 @@ public class TextureIO {
if (DDS.equals(fileSuffix) ||
DDSImage.isDDSImage(stream)) {
DDSImage image = DDSImage.read(stream);
- return newTextureData(image, internalFormat, pixelFormat, mipmap);
+ return newTextureData(glp, image, internalFormat, pixelFormat, mipmap);
}
return null;
}
- public TextureData newTextureData(URL url,
+ public TextureData newTextureData(GLProfile glp, URL url,
int internalFormat,
int pixelFormat,
boolean mipmap,
String fileSuffix) throws IOException {
InputStream stream = new BufferedInputStream(url.openStream());
try {
- return newTextureData(stream, internalFormat, pixelFormat, mipmap, fileSuffix);
+ return newTextureData(glp, stream, internalFormat, pixelFormat, mipmap, fileSuffix);
} finally {
stream.close();
}
}
- private TextureData newTextureData(final DDSImage image,
+ private TextureData newTextureData(GLProfile glp, final DDSImage image,
int internalFormat,
int pixelFormat,
boolean mipmap) {
@@ -937,7 +952,7 @@ public class TextureIO {
for (int i = 0; i < image.getNumMipMaps(); i++) {
mipmapData[i] = image.getMipMap(i).getData();
}
- data = new TextureData(internalFormat,
+ data = new TextureData(glp, internalFormat,
info.getWidth(),
info.getHeight(),
0,
@@ -951,7 +966,7 @@ public class TextureIO {
// Fix this up for the end user because we can't generate
// mipmaps for compressed textures
mipmap = false;
- data = new TextureData(internalFormat,
+ data = new TextureData(glp, internalFormat,
info.getWidth(),
info.getHeight(),
0,
@@ -970,7 +985,7 @@ public class TextureIO {
//----------------------------------------------------------------------
// Base class for SGI RGB and TGA image providers
static abstract class StreamBasedTextureProvider implements TextureProvider {
- public TextureData newTextureData(File file,
+ public TextureData newTextureData(GLProfile glp, File file,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -980,7 +995,7 @@ public class TextureIO {
// The SGIImage and TGAImage implementations use InputStreams
// anyway so there isn't much point in having a separate code
// path for files
- return newTextureData(inStream,
+ return newTextureData(glp, inStream,
internalFormat,
pixelFormat,
mipmap,
@@ -990,14 +1005,14 @@ public class TextureIO {
}
}
- public TextureData newTextureData(URL url,
+ public TextureData newTextureData(GLProfile glp, URL url,
int internalFormat,
int pixelFormat,
boolean mipmap,
String fileSuffix) throws IOException {
InputStream stream = new BufferedInputStream(url.openStream());
try {
- return newTextureData(stream, internalFormat, pixelFormat, mipmap, fileSuffix);
+ return newTextureData(glp, stream, internalFormat, pixelFormat, mipmap, fileSuffix);
} finally {
stream.close();
}
@@ -1007,7 +1022,7 @@ public class TextureIO {
//----------------------------------------------------------------------
// SGI RGB image provider
static class SGITextureProvider extends StreamBasedTextureProvider {
- public TextureData newTextureData(InputStream stream,
+ public TextureData newTextureData(GLProfile glp, InputStream stream,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -1022,7 +1037,7 @@ public class TextureIO {
if (internalFormat == 0) {
internalFormat = image.getFormat();
}
- return new TextureData(internalFormat,
+ return new TextureData(glp, internalFormat,
image.getWidth(),
image.getHeight(),
0,
@@ -1042,7 +1057,7 @@ public class TextureIO {
//----------------------------------------------------------------------
// TGA (Targa) image provider
static class TGATextureProvider extends StreamBasedTextureProvider {
- public TextureData newTextureData(InputStream stream,
+ public TextureData newTextureData(GLProfile glp, InputStream stream,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -1060,7 +1075,7 @@ public class TextureIO {
internalFormat = (image.getBytesPerPixel()==4)?GL.GL_RGBA:GL.GL_RGB;
}
}
- return new TextureData(internalFormat,
+ return new TextureData(glp, internalFormat,
image.getWidth(),
image.getHeight(),
0,
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/TextureIO.java.javase b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java.javase
index 556d51343..3e6f66f10 100755
--- a/src/jogl/classes/com/sun/opengl/util/texture/TextureIO.java.javase
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java.javase
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.texture;
+package com.jogamp.opengl.util.texture;
import java.io.*;
import java.net.*;
@@ -46,9 +46,9 @@ import java.util.*;
import javax.media.opengl.*;
import javax.media.opengl.glu.*;
-import com.sun.opengl.impl.Debug;
-import com.sun.opengl.util.*;
-import com.sun.opengl.util.texture.spi.*;
+import com.jogamp.opengl.impl.Debug;
+import com.jogamp.opengl.util.*;
+import com.jogamp.opengl.util.texture.spi.*;
/** <P> Provides input and output facilities for both loading OpenGL
textures from disk and streams as well as writing textures already
@@ -155,6 +155,8 @@ public class TextureIO {
/**
* Creates a TextureData from the given file. Does no OpenGL work.
*
+ * @param glp the OpenGL Profile this texture data should be
+ * created for.
* @param file the file from which to read the texture data
* @param mipmap whether mipmaps should be produced for this
* texture either by autogenerating them or
@@ -171,18 +173,20 @@ public class TextureIO {
* registered texture providers could read the file
* @throws IOException if an error occurred while reading the file
*/
- public static TextureData newTextureData(File file,
+ public static TextureData newTextureData(GLProfile glp, File file,
boolean mipmap,
String fileSuffix) throws IOException {
if (fileSuffix == null) {
fileSuffix = FileUtil.getFileSuffix(file);
}
- return newTextureDataImpl(file, 0, 0, mipmap, fileSuffix);
+ return newTextureDataImpl(glp, file, 0, 0, mipmap, fileSuffix);
}
/**
* Creates a TextureData from the given stream. Does no OpenGL work.
*
+ * @param glp the OpenGL Profile this texture data should be
+ * created for.
* @param stream the stream from which to read the texture data
* @param mipmap whether mipmaps should be produced for this
* texture either by autogenerating them or
@@ -199,15 +203,17 @@ public class TextureIO {
* registered texture providers could read the stream
* @throws IOException if an error occurred while reading the stream
*/
- public static TextureData newTextureData(InputStream stream,
+ public static TextureData newTextureData(GLProfile glp, InputStream stream,
boolean mipmap,
String fileSuffix) throws IOException {
- return newTextureDataImpl(stream, 0, 0, mipmap, fileSuffix);
+ return newTextureDataImpl(glp, stream, 0, 0, mipmap, fileSuffix);
}
/**
* Creates a TextureData from the given URL. Does no OpenGL work.
*
+ * @param glp the OpenGL Profile this texture data should be
+ * created for.
* @param url the URL from which to read the texture data
* @param mipmap whether mipmaps should be produced for this
* texture either by autogenerating them or
@@ -224,13 +230,13 @@ public class TextureIO {
* registered texture providers could read the URL
* @throws IOException if an error occurred while reading the URL
*/
- public static TextureData newTextureData(URL url,
+ public static TextureData newTextureData(GLProfile glp, URL url,
boolean mipmap,
String fileSuffix) throws IOException {
if (fileSuffix == null) {
fileSuffix = FileUtil.getFileSuffix(url.getPath());
}
- return newTextureDataImpl(url, 0, 0, mipmap, fileSuffix);
+ return newTextureDataImpl(glp, url, 0, 0, mipmap, fileSuffix);
}
//----------------------------------------------------------------------
@@ -248,6 +254,8 @@ public class TextureIO {
* variant of this method which does not take these arguments. Does
* no OpenGL work.
*
+ * @param glp the OpenGL Profile this texture data should be
+ * created for.
* @param file the file from which to read the texture data
* @param internalFormat the OpenGL internal format of the texture
* which will eventually result from the TextureData
@@ -270,7 +278,7 @@ public class TextureIO {
* pixelFormat was 0
* @throws IOException if an error occurred while reading the file
*/
- public static TextureData newTextureData(File file,
+ public static TextureData newTextureData(GLProfile glp, File file,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -283,7 +291,7 @@ public class TextureIO {
fileSuffix = FileUtil.getFileSuffix(file);
}
- return newTextureDataImpl(file, internalFormat, pixelFormat, mipmap, fileSuffix);
+ return newTextureDataImpl(glp, file, internalFormat, pixelFormat, mipmap, fileSuffix);
}
/**
@@ -294,6 +302,8 @@ public class TextureIO {
* variant of this method which does not take these arguments. Does
* no OpenGL work.
*
+ * @param glp the OpenGL Profile this texture data should be
+ * created for.
* @param stream the stream from which to read the texture data
* @param internalFormat the OpenGL internal format of the texture
* which will eventually result from the TextureData
@@ -316,7 +326,7 @@ public class TextureIO {
* pixelFormat was 0
* @throws IOException if an error occurred while reading the stream
*/
- public static TextureData newTextureData(InputStream stream,
+ public static TextureData newTextureData(GLProfile glp, InputStream stream,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -325,7 +335,7 @@ public class TextureIO {
throw new IllegalArgumentException("internalFormat and pixelFormat must be non-zero");
}
- return newTextureDataImpl(stream, internalFormat, pixelFormat, mipmap, fileSuffix);
+ return newTextureDataImpl(glp, stream, internalFormat, pixelFormat, mipmap, fileSuffix);
}
/**
@@ -336,6 +346,8 @@ public class TextureIO {
* variant of this method which does not take these arguments. Does
* no OpenGL work.
*
+ * @param glp the OpenGL Profile this texture data should be
+ * created for.
* @param url the URL from which to read the texture data
* @param internalFormat the OpenGL internal format of the texture
* which will eventually result from the TextureData
@@ -358,7 +370,7 @@ public class TextureIO {
* pixelFormat was 0
* @throws IOException if an error occurred while reading the URL
*/
- public static TextureData newTextureData(URL url,
+ public static TextureData newTextureData(GLProfile glp, URL url,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -371,7 +383,7 @@ public class TextureIO {
fileSuffix = FileUtil.getFileSuffix(url.getPath());
}
- return newTextureDataImpl(url, internalFormat, pixelFormat, mipmap, fileSuffix);
+ return newTextureDataImpl(glp, url, internalFormat, pixelFormat, mipmap, fileSuffix);
}
//----------------------------------------------------------------------
@@ -410,7 +422,8 @@ public class TextureIO {
* OpenGL error occurred
*/
public static Texture newTexture(File file, boolean mipmap) throws IOException, GLException {
- TextureData data = newTextureData(file, mipmap, FileUtil.getFileSuffix(file));
+ GLProfile glp = GLContext.getCurrentGL().getGLProfile();
+ TextureData data = newTextureData(glp, file, mipmap, FileUtil.getFileSuffix(file));
Texture texture = newTexture(data);
data.flush();
return texture;
@@ -437,7 +450,8 @@ public class TextureIO {
* OpenGL error occurred
*/
public static Texture newTexture(InputStream stream, boolean mipmap, String fileSuffix) throws IOException, GLException {
- TextureData data = newTextureData(stream, mipmap, fileSuffix);
+ GLProfile glp = GLContext.getCurrentGL().getGLProfile();
+ TextureData data = newTextureData(glp, stream, mipmap, fileSuffix);
Texture texture = newTexture(data);
data.flush();
return texture;
@@ -467,7 +481,8 @@ public class TextureIO {
if (fileSuffix == null) {
fileSuffix = FileUtil.getFileSuffix(url.getPath());
}
- TextureData data = newTextureData(url, mipmap, fileSuffix);
+ GLProfile glp = GLContext.getCurrentGL().getGLProfile();
+ TextureData data = newTextureData(glp, url, mipmap, fileSuffix);
Texture texture = newTexture(data);
data.flush();
return texture;
@@ -580,7 +595,7 @@ public class TextureIO {
int size = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2.GL_TEXTURE_COMPRESSED_IMAGE_SIZE);
ByteBuffer res = ByteBuffer.allocate(size);
gl.glGetCompressedTexImage(GL.GL_TEXTURE_2D, 0, res);
- data = new TextureData(internalFormat, width, height, border, internalFormat, GL.GL_UNSIGNED_BYTE,
+ data = new TextureData(gl.getGLProfile(), internalFormat, width, height, border, internalFormat, GL.GL_UNSIGNED_BYTE,
false, true, true, res, null);
} else {
int bytesPerPixel = 0;
@@ -631,7 +646,7 @@ public class TextureIO {
gl.glPixelStorei(GL2.GL_PACK_SKIP_PIXELS, packSkipPixels);
gl.glPixelStorei(GL2.GL_PACK_SWAP_BYTES, packSwapBytes);
- data = new TextureData(internalFormat, width, height, border, fetchedFormat, GL.GL_UNSIGNED_BYTE,
+ data = new TextureData(gl.getGLProfile(), internalFormat, width, height, border, fetchedFormat, GL.GL_UNSIGNED_BYTE,
false, false, false, res, null);
if (DEBUG) {
@@ -718,7 +733,7 @@ public class TextureIO {
try {
// Use reflection to avoid compile-time dependencies on AWT-related classes
TextureProvider provider = (TextureProvider)
- Class.forName("com.sun.opengl.util.texture.spi.awt.IIOTextureProvider").newInstance();
+ Class.forName("com.jogamp.opengl.util.texture.spi.awt.IIOTextureProvider").newInstance();
addTextureProvider(provider);
} catch (Exception e) {
if (DEBUG) {
@@ -737,7 +752,7 @@ public class TextureIO {
try {
// Use reflection to avoid compile-time dependencies on AWT-related classes
TextureWriter writer = (TextureWriter)
- Class.forName("com.sun.opengl.util.texture.spi.awt.IIOTextureWriter").newInstance();
+ Class.forName("com.jogamp.opengl.util.texture.spi.awt.IIOTextureWriter").newInstance();
addTextureWriter(writer);
} catch (Exception e) {
if (DEBUG) {
@@ -758,7 +773,7 @@ public class TextureIO {
}
// Implementation methods
- private static TextureData newTextureDataImpl(File file,
+ private static TextureData newTextureDataImpl(GLProfile glp, File file,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -771,7 +786,7 @@ public class TextureIO {
for (Iterator iter = textureProviders.iterator(); iter.hasNext(); ) {
TextureProvider provider = (TextureProvider) iter.next();
- TextureData data = provider.newTextureData(file,
+ TextureData data = provider.newTextureData(glp, file,
internalFormat,
pixelFormat,
mipmap,
@@ -784,7 +799,7 @@ public class TextureIO {
throw new IOException("No suitable reader for given file "+file.getAbsolutePath());
}
- private static TextureData newTextureDataImpl(InputStream stream,
+ private static TextureData newTextureDataImpl(GLProfile glp, InputStream stream,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -802,7 +817,7 @@ public class TextureIO {
for (Iterator iter = textureProviders.iterator(); iter.hasNext(); ) {
TextureProvider provider = (TextureProvider) iter.next();
- TextureData data = provider.newTextureData(stream,
+ TextureData data = provider.newTextureData(glp, stream,
internalFormat,
pixelFormat,
mipmap,
@@ -815,7 +830,7 @@ public class TextureIO {
throw new IOException("No suitable reader for given stream");
}
- private static TextureData newTextureDataImpl(URL url,
+ private static TextureData newTextureDataImpl(GLProfile glp, URL url,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -828,7 +843,7 @@ public class TextureIO {
for (Iterator iter = textureProviders.iterator(); iter.hasNext(); ) {
TextureProvider provider = (TextureProvider) iter.next();
- TextureData data = provider.newTextureData(url,
+ TextureData data = provider.newTextureData(glp, url,
internalFormat,
pixelFormat,
mipmap,
@@ -844,7 +859,7 @@ public class TextureIO {
//----------------------------------------------------------------------
// DDS provider -- supports files only for now
static class DDSTextureProvider implements TextureProvider {
- public TextureData newTextureData(File file,
+ public TextureData newTextureData(GLProfile glp, File file,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -852,13 +867,13 @@ public class TextureIO {
if (DDS.equals(fileSuffix) ||
DDS.equals(FileUtil.getFileSuffix(file))) {
DDSImage image = DDSImage.read(file);
- return newTextureData(image, internalFormat, pixelFormat, mipmap);
+ return newTextureData(glp, image, internalFormat, pixelFormat, mipmap);
}
return null;
}
- public TextureData newTextureData(InputStream stream,
+ public TextureData newTextureData(GLProfile glp, InputStream stream,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -868,26 +883,26 @@ public class TextureIO {
byte[] data = StreamUtil.readAll2Array(stream);
ByteBuffer buf = ByteBuffer.wrap(data);
DDSImage image = DDSImage.read(buf);
- return newTextureData(image, internalFormat, pixelFormat, mipmap);
+ return newTextureData(glp, image, internalFormat, pixelFormat, mipmap);
}
return null;
}
- public TextureData newTextureData(URL url,
+ public TextureData newTextureData(GLProfile glp, URL url,
int internalFormat,
int pixelFormat,
boolean mipmap,
String fileSuffix) throws IOException {
InputStream stream = new BufferedInputStream(url.openStream());
try {
- return newTextureData(stream, internalFormat, pixelFormat, mipmap, fileSuffix);
+ return newTextureData(glp, stream, internalFormat, pixelFormat, mipmap, fileSuffix);
} finally {
stream.close();
}
}
- private TextureData newTextureData(final DDSImage image,
+ private TextureData newTextureData(GLProfile glp, final DDSImage image,
int internalFormat,
int pixelFormat,
boolean mipmap) {
@@ -939,7 +954,7 @@ public class TextureIO {
for (int i = 0; i < image.getNumMipMaps(); i++) {
mipmapData[i] = image.getMipMap(i).getData();
}
- data = new TextureData(internalFormat,
+ data = new TextureData(glp, internalFormat,
info.getWidth(),
info.getHeight(),
0,
@@ -953,7 +968,7 @@ public class TextureIO {
// Fix this up for the end user because we can't generate
// mipmaps for compressed textures
mipmap = false;
- data = new TextureData(internalFormat,
+ data = new TextureData(glp, internalFormat,
info.getWidth(),
info.getHeight(),
0,
@@ -972,7 +987,7 @@ public class TextureIO {
//----------------------------------------------------------------------
// Base class for SGI RGB and TGA image providers
static abstract class StreamBasedTextureProvider implements TextureProvider {
- public TextureData newTextureData(File file,
+ public TextureData newTextureData(GLProfile glp, File file,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -982,7 +997,7 @@ public class TextureIO {
// The SGIImage and TGAImage implementations use InputStreams
// anyway so there isn't much point in having a separate code
// path for files
- return newTextureData(inStream,
+ return newTextureData(glp, inStream,
internalFormat,
pixelFormat,
mipmap,
@@ -992,14 +1007,14 @@ public class TextureIO {
}
}
- public TextureData newTextureData(URL url,
+ public TextureData newTextureData(GLProfile glp, URL url,
int internalFormat,
int pixelFormat,
boolean mipmap,
String fileSuffix) throws IOException {
InputStream stream = new BufferedInputStream(url.openStream());
try {
- return newTextureData(stream, internalFormat, pixelFormat, mipmap, fileSuffix);
+ return newTextureData(glp, stream, internalFormat, pixelFormat, mipmap, fileSuffix);
} finally {
stream.close();
}
@@ -1009,7 +1024,7 @@ public class TextureIO {
//----------------------------------------------------------------------
// SGI RGB image provider
static class SGITextureProvider extends StreamBasedTextureProvider {
- public TextureData newTextureData(InputStream stream,
+ public TextureData newTextureData(GLProfile glp, InputStream stream,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -1024,7 +1039,7 @@ public class TextureIO {
if (internalFormat == 0) {
internalFormat = image.getFormat();
}
- return new TextureData(internalFormat,
+ return new TextureData(glp, internalFormat,
image.getWidth(),
image.getHeight(),
0,
@@ -1044,7 +1059,7 @@ public class TextureIO {
//----------------------------------------------------------------------
// TGA (Targa) image provider
static class TGATextureProvider extends StreamBasedTextureProvider {
- public TextureData newTextureData(InputStream stream,
+ public TextureData newTextureData(GLProfile glp, InputStream stream,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -1062,7 +1077,7 @@ public class TextureIO {
internalFormat = (image.getBytesPerPixel()==4)?GL.GL_RGBA:GL.GL_RGB;
}
}
- return new TextureData(internalFormat,
+ return new TextureData(glp, internalFormat,
image.getWidth(),
image.getHeight(),
0,
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/awt/AWTTextureData.java b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java
index b3cf537f6..39ec74b97 100755
--- a/src/jogl/classes/com/sun/opengl/util/texture/awt/AWTTextureData.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java
@@ -34,7 +34,7 @@
* facility.
*/
-package com.sun.opengl.util.texture.awt;
+package com.jogamp.opengl.util.texture.awt;
import java.awt.AlphaComposite;
import java.awt.Color;
@@ -45,7 +45,7 @@ import java.awt.image.*;
import java.nio.*;
import javax.media.opengl.*;
-import com.sun.opengl.util.texture.*;
+import com.jogamp.opengl.util.texture.*;
public class AWTTextureData extends TextureData {
// Mechanism for lazily converting input BufferedImages with custom
@@ -77,6 +77,8 @@ public class AWTTextureData extends TextureData {
* TextureData, that modification will be visible in the resulting
* Texture.
*
+ * @param glp the OpenGL Profile this texture data should be
+ * created for.
* @param internalFormat the OpenGL internal format for the
* resulting texture; may be 0, in which case
* it is inferred from the image's type
@@ -89,17 +91,18 @@ public class AWTTextureData extends TextureData {
* texture
* @param image the image containing the texture data
*/
- public AWTTextureData(int internalFormat,
+ public AWTTextureData(GLProfile glp,
+ int internalFormat,
int pixelFormat,
boolean mipmap,
BufferedImage image) {
- super();
+ super(glp);
if (internalFormat == 0) {
this.internalFormat = image.getColorModel().hasAlpha() ? GL.GL_RGBA : GL.GL_RGB;
} else {
this.internalFormat = internalFormat;
}
- createFromImage(image);
+ createFromImage(glp, image);
this.mipmap = mipmap;
if (buffer != null) {
estimatedMemorySize = estimatedMemorySize(buffer);
@@ -146,7 +149,7 @@ public class AWTTextureData extends TextureData {
return buffer;
}
- private void createFromImage(BufferedImage image) {
+ private void createFromImage(GLProfile glp, BufferedImage image) {
pixelType = 0; // Determine from image
mustFlipVertically = true;
@@ -154,6 +157,7 @@ public class AWTTextureData extends TextureData {
height = image.getHeight();
int scanlineStride;
+
SampleModel sm = image.getRaster().getSampleModel();
if (sm instanceof SinglePixelPackedSampleModel) {
scanlineStride =
@@ -170,21 +174,22 @@ public class AWTTextureData extends TextureData {
return;
}
- GLProfile glp = GLContext.getCurrentGL().getGLProfile();
+ width = image.getWidth();
+ height = image.getHeight();
- if (glp.isGL2()) {
+ if (glp.isGL2GL3()) {
switch (image.getType()) {
case BufferedImage.TYPE_INT_RGB:
- pixelFormat = GL2.GL_BGRA;
- pixelType = GL2.GL_UNSIGNED_INT_8_8_8_8_REV;
+ pixelFormat = GL2GL3.GL_BGRA;
+ pixelType = GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV;
rowLength = scanlineStride;
alignment = 4;
expectingGL12 = true;
setupLazyCustomConversion(image);
break;
case BufferedImage.TYPE_INT_ARGB_PRE:
- pixelFormat = GL2.GL_BGRA;
- pixelType = GL2.GL_UNSIGNED_INT_8_8_8_8_REV;
+ pixelFormat = GL2GL3.GL_BGRA;
+ pixelType = GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV;
rowLength = scanlineStride;
alignment = 4;
expectingGL12 = true;
@@ -192,7 +197,7 @@ public class AWTTextureData extends TextureData {
break;
case BufferedImage.TYPE_INT_BGR:
pixelFormat = GL.GL_RGBA;
- pixelType = GL2.GL_UNSIGNED_INT_8_8_8_8_REV;
+ pixelType = GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV;
rowLength = scanlineStride;
alignment = 4;
expectingGL12 = true;
@@ -203,7 +208,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
if ((scanlineStride % 3) == 0) {
- pixelFormat = GL2.GL_BGR;
+ pixelFormat = GL2GL3.GL_BGR;
pixelType = GL.GL_UNSIGNED_BYTE;
rowLength = scanlineStride / 3;
alignment = 1;
@@ -223,7 +228,7 @@ public class AWTTextureData extends TextureData {
// buggy at least on some NVidia drivers and doesn't perform
// the necessary byte swapping (FIXME: needs more
// investigation)
- if ((scanlineStride % 4) == 0 && false) {
+ if ((scanlineStride % 4) == 0 && glp.isGL2() && false) {
pixelFormat = GL2.GL_ABGR_EXT;
pixelType = GL.GL_UNSIGNED_BYTE;
rowLength = scanlineStride / 4;
@@ -249,8 +254,8 @@ public class AWTTextureData extends TextureData {
setupLazyCustomConversion(image);
break;
case BufferedImage.TYPE_USHORT_555_RGB:
- pixelFormat = GL2.GL_BGRA;
- pixelType = GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV;
+ pixelFormat = GL2GL3.GL_BGRA;
+ pixelType = GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV;
rowLength = scanlineStride;
alignment = 2;
expectingGL12 = true;
@@ -388,7 +393,7 @@ public class AWTTextureData extends TextureData {
if (pixelType == 0) pixelType = GL.GL_FLOAT;
} else if (data instanceof DataBufferInt) {
// FIXME: should we support signed ints?
- if (pixelType == 0) pixelType = GL2.GL_UNSIGNED_INT;
+ if (pixelType == 0) pixelType = GL2GL3.GL_UNSIGNED_INT;
} else if (data instanceof DataBufferShort) {
if (pixelType == 0) pixelType = GL.GL_SHORT;
} else if (data instanceof DataBufferUShort) {
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/awt/AWTTextureIO.java b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java
index 490d150cc..fdd1365f7 100644
--- a/src/jogl/classes/com/sun/opengl/util/texture/awt/AWTTextureIO.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java
@@ -37,26 +37,31 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.texture.awt;
+package com.jogamp.opengl.util.texture.awt;
import java.awt.image.*;
import javax.media.opengl.*;
-import com.sun.opengl.util.texture.*;
+import com.jogamp.opengl.util.texture.*;
public class AWTTextureIO extends TextureIO {
/**
* Creates a TextureData from the given BufferedImage. Does no
* OpenGL work.
+ * We assume a desktop GLProfile GL2GL3, otherwise use the other factory.
*
+ * @param glp the OpenGL Profile this texture data should be
+ * created for.
* @param image the BufferedImage containing the texture data
* @param mipmap whether mipmaps should be produced for this
* texture by autogenerating them
* @return the texture data from the image
+ *
+ * @see #newTextureData(GLProfile, BufferedImage, boolean)
*/
- public static TextureData newTextureData(BufferedImage image,
+ public static TextureData newTextureData(GLProfile glp, BufferedImage image,
boolean mipmap) {
- return newTextureDataImpl(image, 0, 0, mipmap);
+ return newTextureDataImpl(glp, image, 0, 0, mipmap);
}
/**
@@ -67,6 +72,8 @@ public class AWTTextureIO extends TextureIO {
* the variant of this method which does not take these
* arguments. Does no OpenGL work.
*
+ * @param glp the OpenGL Profile this texture data should be
+ * created for.
* @param image the BufferedImage containing the texture data
* @param internalFormat the OpenGL internal format of the texture
* which will eventually result from the TextureData
@@ -82,7 +89,7 @@ public class AWTTextureIO extends TextureIO {
* @throws IllegalArgumentException if either internalFormat or
* pixelFormat was 0
*/
- public static TextureData newTextureData(BufferedImage image,
+ public static TextureData newTextureData(GLProfile glp, BufferedImage image,
int internalFormat,
int pixelFormat,
boolean mipmap) throws IllegalArgumentException {
@@ -90,30 +97,33 @@ public class AWTTextureIO extends TextureIO {
throw new IllegalArgumentException("internalFormat and pixelFormat must be non-zero");
}
- return newTextureDataImpl(image, internalFormat, pixelFormat, mipmap);
+ return newTextureDataImpl(glp, image, internalFormat, pixelFormat, mipmap);
}
/**
* Creates an OpenGL texture object from the specified BufferedImage
* using the current OpenGL context.
*
+ * @param glp the OpenGL Profile this texture data should be
+ * created for.
* @param image the BufferedImage from which to read the texture data
* @param mipmap whether mipmaps should be produced for this
* texture by autogenerating them
* @throws GLException if no OpenGL context is current or if an
* OpenGL error occurred
*/
- public static Texture newTexture(BufferedImage image, boolean mipmap) throws GLException {
- TextureData data = newTextureData(image, mipmap);
+ public static Texture newTexture(GLProfile glp, BufferedImage image, boolean mipmap) throws GLException {
+ TextureData data = newTextureData(glp, image, mipmap);
Texture texture = newTexture(data);
data.flush();
return texture;
}
- private static TextureData newTextureDataImpl(BufferedImage image,
+ private static TextureData newTextureDataImpl(GLProfile glp,
+ BufferedImage image,
int internalFormat,
int pixelFormat,
boolean mipmap) {
- return new AWTTextureData(internalFormat, pixelFormat, mipmap, image);
+ return new AWTTextureData(glp, internalFormat, pixelFormat, mipmap, image);
}
}
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp
index ce3d97733..b18991dfc 100755
--- a/src/jogl/classes/com/sun/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp
@@ -37,14 +37,14 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.texture.spi;
+package com.jogamp.opengl.util.texture.spi;
import java.io.*;
import java.nio.*;
import javax.media.opengl.*;
-import com.sun.opengl.util.*;
-import com.sun.opengl.util.texture.*;
+import com.jogamp.opengl.util.*;
+import com.jogamp.opengl.util.texture.*;
/** A reader and writer for DirectDraw Surface (.dds) files, which are
used to describe textures. These files can contain multiple mipmap
@@ -478,7 +478,7 @@ public class DDSImage {
}
if (size == 0)
size = 1;
- return BufferUtil.newByteBuffer(size);
+ return GLBuffers.newDirectByteBuffer(size);
}
public void debugPrint() {
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/spi/DDSImage.java.javase b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java.javase
index 8a3e1c4be..e3092162d 100755
--- a/src/jogl/classes/com/sun/opengl/util/texture/spi/DDSImage.java.javase
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java.javase
@@ -37,15 +37,15 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.texture.spi;
+package com.jogamp.opengl.util.texture.spi;
import java.io.*;
import java.nio.*;
import java.nio.channels.*;
import javax.media.opengl.*;
-import com.sun.opengl.util.*;
-import com.sun.opengl.util.texture.*;
+import com.jogamp.opengl.util.*;
+import com.jogamp.opengl.util.texture.*;
/** A reader and writer for DirectDraw Surface (.dds) files, which are
used to describe textures. These files can contain multiple mipmap
@@ -503,7 +503,7 @@ public class DDSImage {
}
if (size == 0)
size = 1;
- return BufferUtil.newByteBuffer(size);
+ return GLBuffers.newDirectByteBuffer(size);
}
public void debugPrint() {
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/spi/LEDataInputStream.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java
index b2b1226bd..d5f49599c 100755
--- a/src/jogl/classes/com/sun/opengl/util/texture/spi/LEDataInputStream.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.texture.spi;
+package com.jogamp.opengl.util.texture.spi;
import java.io.DataInput;
import java.io.DataInputStream;
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/spi/LEDataOutputStream.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java
index 730ec0dbd..e1e1ca924 100755
--- a/src/jogl/classes/com/sun/opengl/util/texture/spi/LEDataOutputStream.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.texture.spi;
+package com.jogamp.opengl.util.texture.spi;
import java.io.DataOutput;
import java.io.DataOutputStream;
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/spi/NetPbmTextureWriter.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java
index 18df1dc55..499dce7fb 100644
--- a/src/jogl/classes/com/sun/opengl/util/texture/spi/NetPbmTextureWriter.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java
@@ -37,16 +37,16 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.texture.spi;
+package com.jogamp.opengl.util.texture.spi;
import java.io.*;
import java.net.*;
import java.nio.*;
import javax.media.opengl.*;
-import com.sun.opengl.util.*;
-import com.sun.opengl.util.texture.*;
-import com.sun.opengl.util.texture.spi.*;
+import com.jogamp.opengl.util.*;
+import com.jogamp.opengl.util.texture.*;
+import com.jogamp.opengl.util.texture.spi.*;
public class NetPbmTextureWriter implements TextureWriter {
int magic;
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/spi/SGIImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java
index 284fa64bd..bb5040a31 100755
--- a/src/jogl/classes/com/sun/opengl/util/texture/spi/SGIImage.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java
@@ -37,11 +37,11 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.texture.spi;
+package com.jogamp.opengl.util.texture.spi;
import java.io.*;
import javax.media.opengl.*;
-import com.sun.opengl.util.*;
+import com.jogamp.opengl.util.*;
/** <p> Reads and writes SGI RGB/RGBA images. </p>
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/spi/TGAImage.java.javame_cdc_fp b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java.javame_cdc_fp
index c54713a5e..6e6e4ab04 100755
--- a/src/jogl/classes/com/sun/opengl/util/texture/spi/TGAImage.java.javame_cdc_fp
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java.javame_cdc_fp
@@ -37,14 +37,14 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.texture.spi;
+package com.jogamp.opengl.util.texture.spi;
import java.io.*;
import java.nio.*;
import javax.media.opengl.*;
-import com.sun.opengl.util.*;
-import com.sun.opengl.util.texture.spi.*;
-import com.sun.opengl.util.texture.*;
+import com.jogamp.opengl.util.*;
+import com.jogamp.opengl.util.texture.spi.*;
+import com.jogamp.opengl.util.texture.*;
/**
* Targa image reader and writer adapted from sources of the <a href =
@@ -308,8 +308,8 @@ public class TGAImage {
GL gl = GLContext.getCurrentGL();
if (header.pixelDepth() == 24) {
bpp=3;
- if(gl.isGL2()) {
- format = GL2.GL_BGR;
+ if(gl.isGL2GL3()) {
+ format = GL2GL3.GL_BGR;
} else {
format = GL.GL_RGB;
swapBGR(tmpData, rawWidth, header.height(), bpp);
@@ -318,8 +318,8 @@ public class TGAImage {
assert header.pixelDepth() == 32;
bpp=4;
- if(gl.isGL2()) {
- format = GL2.GL_BGRA;
+ if(gl.isGL2GL3()) {
+ format = GL2GL3.GL_BGRA;
} else {
format = GL.GL_RGBA;
swapBGR(tmpData, rawWidth, header.height(), bpp);
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/spi/TGAImage.java.javase b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java.javase
index 1e78ef20d..16ba538b5 100755
--- a/src/jogl/classes/com/sun/opengl/util/texture/spi/TGAImage.java.javase
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java.javase
@@ -37,15 +37,15 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.texture.spi;
+package com.jogamp.opengl.util.texture.spi;
import java.io.*;
import java.nio.*;
import java.nio.channels.*;
import javax.media.opengl.*;
-import com.sun.opengl.util.*;
-import com.sun.opengl.util.texture.spi.*;
-import com.sun.opengl.util.texture.*;
+import com.jogamp.opengl.util.*;
+import com.jogamp.opengl.util.texture.spi.*;
+import com.jogamp.opengl.util.texture.*;
/**
* Targa image reader and writer adapted from sources of the <a href =
@@ -310,8 +310,8 @@ public class TGAImage {
GL gl = GLContext.getCurrentGL();
if (header.pixelDepth() == 24) {
bpp=3;
- if(gl.isGL2()) {
- format = GL2.GL_BGR;
+ if(gl.isGL2GL3()) {
+ format = GL2GL3.GL_BGR;
} else {
format = GL.GL_RGB;
swapBGR(tmpData, rawWidth, header.height(), bpp);
@@ -320,8 +320,8 @@ public class TGAImage {
assert header.pixelDepth() == 32;
bpp=4;
- if(gl.isGL2()) {
- format = GL2.GL_BGRA;
+ if(gl.isGL2GL3()) {
+ format = GL2GL3.GL_BGRA;
} else {
format = GL.GL_RGBA;
swapBGR(tmpData, rawWidth, header.height(), bpp);
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/spi/TextureProvider.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java
index baa087289..88018edbe 100755
--- a/src/jogl/classes/com/sun/opengl/util/texture/spi/TextureProvider.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java
@@ -37,12 +37,13 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.texture.spi;
+package com.jogamp.opengl.util.texture.spi;
import java.io.*;
import java.net.*;
+import javax.media.opengl.GLProfile;
-import com.sun.opengl.util.texture.*;
+import com.jogamp.opengl.util.texture.*;
/** Plug-in interface to TextureIO to support reading OpenGL textures
from new file formats. For all methods, either internalFormat or
@@ -58,6 +59,8 @@ public interface TextureProvider {
* do any OpenGL-related work. The resulting TextureData can be
* converted into an OpenGL texture in a later step.
*
+ * @param glp the OpenGL Profile this texture data should be
+ * created for.
* @param file the file from which to read the texture data
*
* @param internalFormat the OpenGL internal format to be used for
@@ -83,7 +86,7 @@ public interface TextureProvider {
*
* @throws IOException if an error occurred while reading the file
*/
- public TextureData newTextureData(File file,
+ public TextureData newTextureData(GLProfile glp, File file,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -95,6 +98,8 @@ public interface TextureProvider {
* not do any OpenGL-related work. The resulting TextureData can be
* converted into an OpenGL texture in a later step.
*
+ * @param glp the OpenGL Profile this texture data should be
+ * created for.
* @param stream the stream from which to read the texture data
*
* @param internalFormat the OpenGL internal format to be used for
@@ -120,7 +125,7 @@ public interface TextureProvider {
*
* @throws IOException if an error occurred while reading the stream
*/
- public TextureData newTextureData(InputStream stream,
+ public TextureData newTextureData(GLProfile glp, InputStream stream,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -132,6 +137,8 @@ public interface TextureProvider {
* do any OpenGL-related work. The resulting TextureData can be
* converted into an OpenGL texture in a later step.
*
+ * @param glp the OpenGL Profile this texture data should be
+ * created for.
* @param url the URL from which to read the texture data
*
* @param internalFormat the OpenGL internal format to be used for
@@ -157,7 +164,7 @@ public interface TextureProvider {
*
* @throws IOException if an error occurred while reading the URL
*/
- public TextureData newTextureData(URL url,
+ public TextureData newTextureData(GLProfile glp, URL url,
int internalFormat,
int pixelFormat,
boolean mipmap,
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/spi/TextureWriter.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureWriter.java
index cdad15bb2..55527cef5 100755
--- a/src/jogl/classes/com/sun/opengl/util/texture/spi/TextureWriter.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureWriter.java
@@ -37,11 +37,11 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.texture.spi;
+package com.jogamp.opengl.util.texture.spi;
import java.io.*;
-import com.sun.opengl.util.texture.*;
+import com.jogamp.opengl.util.texture.*;
/** Plug-in interface to TextureIO to support writing OpenGL textures
to new file formats. */
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/spi/awt/IIOTextureProvider.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java
index 0244db285..a45821d87 100644
--- a/src/jogl/classes/com/sun/opengl/util/texture/spi/awt/IIOTextureProvider.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java
@@ -37,23 +37,24 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.texture.spi.awt;
+package com.jogamp.opengl.util.texture.spi.awt;
import java.awt.Graphics;
import java.awt.image.*;
import java.io.*;
import java.net.*;
import javax.imageio.*;
+import javax.media.opengl.GLProfile;
-import com.sun.opengl.impl.Debug;
-import com.sun.opengl.util.texture.*;
-import com.sun.opengl.util.texture.awt.*;
-import com.sun.opengl.util.texture.spi.*;
+import com.jogamp.opengl.impl.Debug;
+import com.jogamp.opengl.util.texture.*;
+import com.jogamp.opengl.util.texture.awt.*;
+import com.jogamp.opengl.util.texture.spi.*;
public class IIOTextureProvider implements TextureProvider {
private static final boolean DEBUG = Debug.debug("TextureIO");
- public TextureData newTextureData(File file,
+ public TextureData newTextureData(GLProfile glp, File file,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -66,10 +67,10 @@ public class IIOTextureProvider implements TextureProvider {
System.out.println("TextureIO.newTextureData(): BufferedImage type for " + file + " = " +
img.getType());
}
- return new AWTTextureData(internalFormat, pixelFormat, mipmap, img);
+ return new AWTTextureData(glp, internalFormat, pixelFormat, mipmap, img);
}
- public TextureData newTextureData(InputStream stream,
+ public TextureData newTextureData(GLProfile glp, InputStream stream,
int internalFormat,
int pixelFormat,
boolean mipmap,
@@ -82,17 +83,17 @@ public class IIOTextureProvider implements TextureProvider {
System.out.println("TextureIO.newTextureData(): BufferedImage type for stream = " +
img.getType());
}
- return new AWTTextureData(internalFormat, pixelFormat, mipmap, img);
+ return new AWTTextureData(glp, internalFormat, pixelFormat, mipmap, img);
}
- public TextureData newTextureData(URL url,
+ public TextureData newTextureData(GLProfile glp, URL url,
int internalFormat,
int pixelFormat,
boolean mipmap,
String fileSuffix) throws IOException {
InputStream stream = url.openStream();
try {
- return newTextureData(stream, internalFormat, pixelFormat, mipmap, fileSuffix);
+ return newTextureData(glp, stream, internalFormat, pixelFormat, mipmap, fileSuffix);
} finally {
stream.close();
}
diff --git a/src/jogl/classes/com/sun/opengl/util/texture/spi/awt/IIOTextureWriter.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java
index db77572bf..405211204 100644
--- a/src/jogl/classes/com/sun/opengl/util/texture/spi/awt/IIOTextureWriter.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.opengl.util.texture.spi.awt;
+package com.jogamp.opengl.util.texture.spi.awt;
import java.awt.Graphics;
import java.awt.image.*;
@@ -47,10 +47,10 @@ import java.nio.*;
import javax.imageio.*;
import javax.media.opengl.*;
-import com.sun.opengl.util.*;
-import com.sun.opengl.util.awt.*;
-import com.sun.opengl.util.texture.*;
-import com.sun.opengl.util.texture.spi.*;
+import com.jogamp.opengl.util.*;
+import com.jogamp.opengl.util.awt.*;
+import com.jogamp.opengl.util.texture.*;
+import com.jogamp.opengl.util.texture.spi.*;
public class IIOTextureWriter implements TextureWriter {
public boolean write(File file,
diff --git a/src/jogl/classes/com/sun/openmax/OMXEventListener.java b/src/jogl/classes/com/jogamp/openmax/OMXEventListener.java
index ebbf7129f..08cfeccde 100644
--- a/src/jogl/classes/com/sun/openmax/OMXEventListener.java
+++ b/src/jogl/classes/com/jogamp/openmax/OMXEventListener.java
@@ -1,5 +1,5 @@
-package com.sun.openmax;
+package com.jogamp.openmax;
public interface OMXEventListener {
diff --git a/src/jogl/classes/com/sun/openmax/OMXInstance.java b/src/jogl/classes/com/jogamp/openmax/OMXInstance.java
index 2eff166d2..9f5b850ba 100644
--- a/src/jogl/classes/com/sun/openmax/OMXInstance.java
+++ b/src/jogl/classes/com/jogamp/openmax/OMXInstance.java
@@ -1,14 +1,14 @@
-package com.sun.openmax;
+package com.jogamp.openmax;
import javax.media.opengl.*;
import javax.media.opengl.glu.GLU;
-import com.sun.opengl.util.texture.*;
+import com.jogamp.opengl.util.texture.*;
-import com.sun.opengl.impl.egl.EGL;
-import com.sun.opengl.impl.egl.EGLContext;
-import com.sun.opengl.impl.egl.EGLDrawable;
-import com.sun.opengl.impl.egl.EGLExt;
+import com.jogamp.opengl.impl.egl.EGL;
+import com.jogamp.opengl.impl.egl.EGLContext;
+import com.jogamp.opengl.impl.egl.EGLDrawable;
+import com.jogamp.opengl.impl.egl.EGLExt;
import java.net.URL;
import java.nio.ByteBuffer;
@@ -50,13 +50,13 @@ public class OMXInstance {
protected long o_totalFrames = 0; // duration in frames
static class EGLImageTexture {
- public EGLImageTexture(com.sun.opengl.util.texture.Texture t, long i, long s) {
+ public EGLImageTexture(com.jogamp.opengl.util.texture.Texture t, long i, long s) {
texture = t; image = i; sync = s;
}
public String toString() {
return "EGLImageTexture[" + texture + ", image " + image + ", sync "+sync+"]";
}
- protected com.sun.opengl.util.texture.Texture texture;
+ protected com.jogamp.opengl.util.texture.Texture texture;
protected long image;
protected long sync;
}
@@ -219,7 +219,7 @@ public class OMXInstance {
_setStreamEGLImageTexture2D(moviePtr, i, tex, image, sync);
eglImgTexs[i] = new EGLImageTexture(
- com.sun.opengl.util.texture.TextureIO.newTexture(tex,
+ com.jogamp.opengl.util.texture.TextureIO.newTexture(tex,
javax.media.opengl.GL2.GL_TEXTURE_2D,
width,
height,
diff --git a/src/jogl/classes/com/sun/opengl/util/BufferUtil.java.javame_cdc_fp b/src/jogl/classes/com/sun/opengl/util/BufferUtil.java.javame_cdc_fp
deleted file mode 100755
index 40f035514..000000000
--- a/src/jogl/classes/com/sun/opengl/util/BufferUtil.java.javame_cdc_fp
+++ /dev/null
@@ -1,449 +0,0 @@
-/*
- * 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.
- *
- * 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 com.sun.opengl.util;
-
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
-
-import java.nio.*;
-import java.util.*;
-
-import java.lang.reflect.*;
-
-/** Utility routines for dealing with direct buffers. */
-
-public class BufferUtil {
- public static final int SIZEOF_BYTE = 1;
- public static final int SIZEOF_SHORT = 2;
- public static final int SIZEOF_INT = 4;
- public static final int SIZEOF_FLOAT = 4;
- public static final int SIZEOF_LONG = -1; // not supported
- public static final int SIZEOF_DOUBLE = -1; // not supported
-
- public static final int sizeOfGLType(int glType) {
- switch (glType) {
- case GL.GL_UNSIGNED_BYTE:
- return SIZEOF_BYTE;
- case GL.GL_BYTE:
- return SIZEOF_BYTE;
- case GL.GL_UNSIGNED_SHORT:
- return SIZEOF_SHORT;
- case GL.GL_SHORT:
- return SIZEOF_SHORT;
- case GL.GL_FLOAT:
- return SIZEOF_FLOAT;
- case GL.GL_FIXED:
- return SIZEOF_INT;
- case GL2ES2.GL_INT:
- return SIZEOF_INT;
- case GL2ES2.GL_UNSIGNED_INT:
- return SIZEOF_INT;
- case GL2.GL_DOUBLE:
- return SIZEOF_DOUBLE;
- }
- return -1;
- }
-
- public static final int sizeOfBufferElem(Buffer buffer) {
- if (buffer == null) {
- return 0;
- }
- if (buffer instanceof ByteBuffer) {
- return BufferUtil.SIZEOF_BYTE;
- } else if (buffer instanceof IntBuffer) {
- return BufferUtil.SIZEOF_INT;
- } else if (buffer instanceof ShortBuffer) {
- return BufferUtil.SIZEOF_SHORT;
- } else if (buffer instanceof FloatBuffer) {
- return BufferUtil.SIZEOF_FLOAT;
- }
- throw new RuntimeException("Unexpected buffer type " +
- buffer.getClass().getName());
- }
-
- private BufferUtil() {}
-
- //----------------------------------------------------------------------
- // Allocation routines
- //
-
- public static final Buffer newGLBuffer(int glType, int numElements) {
- switch (glType) {
- case GL.GL_UNSIGNED_BYTE:
- case GL.GL_BYTE:
- return newByteBuffer(numElements);
- case GL.GL_UNSIGNED_SHORT:
- case GL.GL_SHORT:
- return newShortBuffer(numElements);
- case GL.GL_FLOAT:
- return newFloatBuffer(numElements);
- case GL.GL_FIXED:
- case GL2ES2.GL_INT:
- case GL2ES2.GL_UNSIGNED_INT:
- return newIntBuffer(numElements);
- }
- return null;
- }
-
- public static final Buffer sliceGLBuffer(ByteBuffer parent, int bytePos, int byteLen, int glType) {
- if(parent==null || byteLen==0) return null;
- parent.position(bytePos);
- parent.limit(bytePos + byteLen);
-
- switch (glType) {
- case GL.GL_UNSIGNED_BYTE:
- case GL.GL_BYTE:
- return parent.slice();
- case GL.GL_UNSIGNED_SHORT:
- case GL.GL_SHORT:
- return parent.asShortBuffer();
- case GL.GL_FLOAT:
- return parent.asFloatBuffer();
- case GL.GL_FIXED:
- case GL2ES2.GL_INT:
- case GL2ES2.GL_UNSIGNED_INT:
- return parent.asIntBuffer();
- }
- return null;
- }
-
- /** Allocates a new direct ByteBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static ByteBuffer newByteBuffer(int numElements) {
- ByteBuffer bb = ByteBuffer.allocateDirect(numElements);
- nativeOrder(bb);
- return bb;
- }
-
- public static ByteBuffer newByteBuffer(byte[] values, int offset, int len) {
- ByteBuffer bb = newByteBuffer(len);
- bb.put(values, offset, len);
- bb.rewind();
- return bb;
- }
-
- public static ByteBuffer newByteBuffer(byte[] values, int offset) {
- return newByteBuffer(values, offset, values.length-offset);
- }
-
- public static ByteBuffer newByteBuffer(byte[] values) {
- return newByteBuffer(values, 0);
- }
-
- /** Allocates a new direct FloatBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static FloatBuffer newFloatBuffer(int numElements) {
- ByteBuffer bb = newByteBuffer(numElements * SIZEOF_FLOAT);
- return bb.asFloatBuffer();
- }
-
- public static FloatBuffer newFloatBuffer(float[] values, int offset, int len) {
- FloatBuffer bb = newFloatBuffer(len);
- bb.put(values, offset, len);
- bb.rewind();
- return bb;
- }
-
- public static FloatBuffer newFloatBuffer(float[] values, int offset) {
- return newFloatBuffer(values, 0, values.length-offset);
- }
-
- public static FloatBuffer newFloatBuffer(float[] values) {
- return newFloatBuffer(values, 0);
- }
-
- /** Allocates a new direct IntBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static IntBuffer newIntBuffer(int numElements) {
- ByteBuffer bb = newByteBuffer(numElements * SIZEOF_INT);
- return bb.asIntBuffer();
- }
-
- public static IntBuffer newIntBuffer(int[] values, int offset, int len) {
- IntBuffer bb = newIntBuffer(len);
- bb.put(values, offset, len);
- bb.rewind();
- return bb;
- }
-
- public static IntBuffer newIntBuffer(int[] values, int offset) {
- return newIntBuffer(values, 0, values.length-offset);
- }
-
- public static IntBuffer newIntBuffer(int[] values) {
- return newIntBuffer(values, 0);
- }
-
-
- /** Allocates a new direct ShortBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static ShortBuffer newShortBuffer(int numElements) {
- ByteBuffer bb = newByteBuffer(numElements * SIZEOF_SHORT);
- return bb.asShortBuffer();
- }
-
- public static ShortBuffer newShortBuffer(short[] values, int offset, int len) {
- ShortBuffer bb = newShortBuffer(len);
- bb.put(values, offset, len);
- bb.rewind();
- return bb;
- }
-
- public static ShortBuffer newShortBuffer(short[] values, int offset) {
- return newShortBuffer(values, 0, values.length-offset);
- }
-
- public static ShortBuffer newShortBuffer(short[] values) {
- return newShortBuffer(values, 0);
- }
-
-
- //----------------------------------------------------------------------
- // Copy routines (type-to-type)
- //
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed ByteBuffer into
- a newly-allocated direct ByteBuffer. The returned buffer will
- have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyByteBuffer(ByteBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining());
- dest.put(orig);
- dest.rewind();
- return dest;
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed FloatBuffer
- into a newly-allocated direct FloatBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static FloatBuffer copyFloatBuffer(FloatBuffer orig) {
- return copyFloatBufferAsByteBuffer(orig).asFloatBuffer();
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed IntBuffer
- into a newly-allocated direct IntBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static IntBuffer copyIntBuffer(IntBuffer orig) {
- return copyIntBufferAsByteBuffer(orig).asIntBuffer();
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed ShortBuffer
- into a newly-allocated direct ShortBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ShortBuffer copyShortBuffer(ShortBuffer orig) {
- return copyShortBufferAsByteBuffer(orig).asShortBuffer();
- }
-
- //----------------------------------------------------------------------
- // Copy routines (type-to-ByteBuffer)
- //
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed FloatBuffer
- into a newly-allocated direct ByteBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyFloatBufferAsByteBuffer(FloatBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_FLOAT);
- dest.asFloatBuffer().put(orig);
- dest.rewind();
- return dest;
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed IntBuffer into
- a newly-allocated direct ByteBuffer. The returned buffer will
- have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyIntBufferAsByteBuffer(IntBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_INT);
- dest.asIntBuffer().put(orig);
- dest.rewind();
- return dest;
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed ShortBuffer
- into a newly-allocated direct ByteBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyShortBufferAsByteBuffer(ShortBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_SHORT);
- dest.asShortBuffer().put(orig);
- dest.rewind();
- return dest;
- }
-
- //----------------------------------------------------------------------
- // Conversion routines
- //
-
- public final static float[] getFloatArray(double[] source) {
- int i=source.length;
- float[] dest = new float[i--];
- while(i>=0) { dest[i]=(float)source[i]; i--; }
- return dest;
- }
-
- public static ByteBuffer nativeOrder(ByteBuffer buf) {
- if (!isCDCFP) {
- try {
- if (byteOrderClass == null) {
- byteOrderClass = Class.forName("java.nio.ByteOrder");
- orderMethod = ByteBuffer.class.getMethod("order", new Class[] { byteOrderClass });
- Method nativeOrderMethod = byteOrderClass.getMethod("nativeOrder", null);
- nativeOrderObject = nativeOrderMethod.invoke(null, null);
- }
- } catch (Throwable t) {
- // Must be running on CDC / FP
- isCDCFP = true;
- }
-
- if (!isCDCFP) {
- try {
- orderMethod.invoke(buf, new Object[] { nativeOrderObject });
- } catch (Throwable t) {
- }
- }
- }
- return buf;
- }
-
- //----------------------------------------------------------------------
- // Convenient GL put methods with generic target Buffer
- //
- public static void put(Buffer dest, Buffer v) {
- if((dest instanceof ByteBuffer) && (v instanceof ByteBuffer)) {
- ((ByteBuffer)dest).put((ByteBuffer)v);
- } else if((dest instanceof ShortBuffer) && (v instanceof ShortBuffer)) {
- ((ShortBuffer)dest).put((ShortBuffer)v);
- } else if((dest instanceof IntBuffer) && (v instanceof IntBuffer)) {
- ((IntBuffer)dest).put((IntBuffer)v);
- } else if((dest instanceof FloatBuffer) && (v instanceof FloatBuffer)) {
- ((FloatBuffer)dest).put((FloatBuffer)v);
- } else {
- throw new GLException("Incompatible Buffer classes: dest = "+dest.getClass().getName() + ", src = " + v.getClass().getName());
- }
- }
-
- public static void putb(Buffer dest, byte v) {
- if(dest instanceof ByteBuffer) {
- ((ByteBuffer)dest).put(v);
- } else if(dest instanceof ShortBuffer) {
- ((ShortBuffer)dest).put((short)v);
- } else if(dest instanceof IntBuffer) {
- ((IntBuffer)dest).put((int)v);
- } else {
- throw new GLException("Byte doesn't match Buffer Class: "+dest);
- }
- }
-
- public static void puts(Buffer dest, short v) {
- if(dest instanceof ShortBuffer) {
- ((ShortBuffer)dest).put(v);
- } else if(dest instanceof IntBuffer) {
- ((IntBuffer)dest).put((int)v);
- } else {
- throw new GLException("Short doesn't match Buffer Class: "+dest);
- }
- }
-
- public static void puti(Buffer dest, int v) {
- if(dest instanceof IntBuffer) {
- ((IntBuffer)dest).put(v);
- } else {
- throw new GLException("Integer doesn't match Buffer Class: "+dest);
- }
- }
-
- public static void putx(Buffer dest, int v) {
- puti(dest, v);
- }
-
- public static void putf(Buffer dest, float v) {
- if(dest instanceof FloatBuffer) {
- ((FloatBuffer)dest).put(v);
- } else if(dest instanceof IntBuffer) {
- ((IntBuffer)dest).put(FixedPoint.toFixed(v));
- } else {
- throw new GLException("Float doesn't match Buffer Class: "+dest);
- }
- }
-
- //----------------------------------------------------------------------
- // Internals only below this point
- //
-
- // NOTE that this work must be done reflectively at the present time
- // because this code must compile and run correctly on both CDC/FP and J2SE
- private static boolean isCDCFP;
- private static Class byteOrderClass;
- private static Object nativeOrderObject;
- private static Method orderMethod;
-
-}
diff --git a/src/jogl/classes/com/sun/opengl/util/BufferUtil.java.javase b/src/jogl/classes/com/sun/opengl/util/BufferUtil.java.javase
deleted file mode 100755
index d02f3d15f..000000000
--- a/src/jogl/classes/com/sun/opengl/util/BufferUtil.java.javase
+++ /dev/null
@@ -1,499 +0,0 @@
-/*
- * 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.
- *
- * 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 com.sun.opengl.util;
-
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
-
-import java.nio.*;
-import java.util.*;
-
-import java.lang.reflect.*;
-
-/** Utility routines for dealing with direct buffers. */
-
-public class BufferUtil {
- public static final int SIZEOF_BYTE = 1;
- public static final int SIZEOF_SHORT = 2;
- public static final int SIZEOF_INT = 4;
- public static final int SIZEOF_FLOAT = 4;
- public static final int SIZEOF_LONG = 8;
- public static final int SIZEOF_DOUBLE = 8;
-
- public static final int sizeOfGLType(int glType) {
- switch (glType) {
- case GL.GL_UNSIGNED_BYTE:
- return SIZEOF_BYTE;
- case GL.GL_BYTE:
- return SIZEOF_BYTE;
- case GL.GL_UNSIGNED_SHORT:
- return SIZEOF_SHORT;
- case GL.GL_SHORT:
- return SIZEOF_SHORT;
- case GL.GL_FLOAT:
- return SIZEOF_FLOAT;
- case GL.GL_FIXED:
- return SIZEOF_INT;
- case GL2ES2.GL_INT:
- return SIZEOF_INT;
- case GL2ES2.GL_UNSIGNED_INT:
- return SIZEOF_INT;
- case GL2.GL_DOUBLE:
- return SIZEOF_DOUBLE;
- }
- return -1;
- }
-
- public static final int sizeOfBufferElem(Buffer buffer) {
- if (buffer == null) {
- return 0;
- }
- if (buffer instanceof ByteBuffer) {
- return BufferUtil.SIZEOF_BYTE;
- } else if (buffer instanceof IntBuffer) {
- return BufferUtil.SIZEOF_INT;
- } else if (buffer instanceof ShortBuffer) {
- return BufferUtil.SIZEOF_SHORT;
- } else if (buffer instanceof FloatBuffer) {
- return BufferUtil.SIZEOF_FLOAT;
- } else if (buffer instanceof DoubleBuffer) {
- return BufferUtil.SIZEOF_DOUBLE;
- }
- throw new RuntimeException("Unexpected buffer type " +
- buffer.getClass().getName());
- }
-
- private BufferUtil() {}
-
- //----------------------------------------------------------------------
- // Allocation routines
- //
-
- public static final Buffer newGLBuffer(int glType, int numElements) {
- switch (glType) {
- case GL.GL_UNSIGNED_BYTE:
- case GL.GL_BYTE:
- return newByteBuffer(numElements);
- case GL.GL_UNSIGNED_SHORT:
- case GL.GL_SHORT:
- return newShortBuffer(numElements);
- case GL.GL_FLOAT:
- return newFloatBuffer(numElements);
- case GL.GL_FIXED:
- case GL2ES2.GL_INT:
- case GL2ES2.GL_UNSIGNED_INT:
- return newIntBuffer(numElements);
- case GL2.GL_DOUBLE:
- return newDoubleBuffer(numElements);
- }
- return null;
- }
-
- public static final Buffer sliceGLBuffer(ByteBuffer parent, int bytePos, int byteLen, int glType) {
- if(parent==null || byteLen==0) return null;
- parent.position(bytePos);
- parent.limit(bytePos + byteLen);
-
- switch (glType) {
- case GL.GL_UNSIGNED_BYTE:
- case GL.GL_BYTE:
- return parent.slice();
- case GL.GL_UNSIGNED_SHORT:
- case GL.GL_SHORT:
- return parent.asShortBuffer();
- case GL.GL_FLOAT:
- return parent.asFloatBuffer();
- case GL.GL_FIXED:
- case GL2ES2.GL_INT:
- case GL2ES2.GL_UNSIGNED_INT:
- return parent.asIntBuffer();
- case GL2.GL_DOUBLE:
- return parent.asDoubleBuffer();
- }
- return null;
- }
-
- /** Allocates a new direct ByteBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static ByteBuffer newByteBuffer(int numElements) {
- ByteBuffer bb = ByteBuffer.allocateDirect(numElements);
- nativeOrder(bb);
- return bb;
- }
-
- public static ByteBuffer newByteBuffer(byte[] values, int offset, int len) {
- ByteBuffer bb = newByteBuffer(len);
- bb.put(values, offset, len);
- bb.rewind();
- return bb;
- }
-
- public static ByteBuffer newByteBuffer(byte[] values, int offset) {
- return newByteBuffer(values, offset, values.length-offset);
- }
-
- public static ByteBuffer newByteBuffer(byte[] values) {
- return newByteBuffer(values, 0);
- }
-
-
- /** Allocates a new direct DoubleBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static DoubleBuffer newDoubleBuffer(int numElements) {
- ByteBuffer bb = newByteBuffer(numElements * SIZEOF_DOUBLE);
- return bb.asDoubleBuffer();
- }
-
- public static DoubleBuffer newDoubleBuffer(double[] values, int offset) {
- int len = values.length-offset;
- DoubleBuffer bb = newDoubleBuffer(len);
- bb.put(values, offset, len);
- bb.rewind();
- return bb;
- }
-
- public static DoubleBuffer newDoubleBuffer(double[] values) {
- return newDoubleBuffer(values, 0);
- }
-
-
- /** Allocates a new direct FloatBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static FloatBuffer newFloatBuffer(int numElements) {
- ByteBuffer bb = newByteBuffer(numElements * SIZEOF_FLOAT);
- return bb.asFloatBuffer();
- }
-
- public static FloatBuffer newFloatBuffer(float[] values, int offset, int len) {
- FloatBuffer bb = newFloatBuffer(len);
- bb.put(values, offset, len);
- bb.rewind();
- return bb;
- }
-
- public static FloatBuffer newFloatBuffer(float[] values, int offset) {
- return newFloatBuffer(values, 0, values.length-offset);
- }
-
- public static FloatBuffer newFloatBuffer(float[] values) {
- return newFloatBuffer(values, 0);
- }
-
-
- /** Allocates a new direct IntBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static IntBuffer newIntBuffer(int numElements) {
- ByteBuffer bb = newByteBuffer(numElements * SIZEOF_INT);
- return bb.asIntBuffer();
- }
-
- public static IntBuffer newIntBuffer(int[] values, int offset, int len) {
- IntBuffer bb = newIntBuffer(len);
- bb.put(values, offset, len);
- bb.rewind();
- return bb;
- }
-
- public static IntBuffer newIntBuffer(int[] values, int offset) {
- return newIntBuffer(values, 0, values.length-offset);
- }
-
- public static IntBuffer newIntBuffer(int[] values) {
- return newIntBuffer(values, 0);
- }
-
- /** Allocates a new direct LongBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static LongBuffer newLongBuffer(int numElements) {
- ByteBuffer bb = newByteBuffer(numElements * SIZEOF_LONG);
- return bb.asLongBuffer();
- }
-
- /** Allocates a new direct ShortBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static ShortBuffer newShortBuffer(int numElements) {
- ByteBuffer bb = newByteBuffer(numElements * SIZEOF_SHORT);
- return bb.asShortBuffer();
- }
-
- public static ShortBuffer newShortBuffer(short[] values, int offset, int len) {
- ShortBuffer bb = newShortBuffer(len);
- bb.put(values, offset, len);
- bb.rewind();
- return bb;
- }
-
- public static ShortBuffer newShortBuffer(short[] values, int offset) {
- return newShortBuffer(values, 0, values.length-offset);
- }
-
- public static ShortBuffer newShortBuffer(short[] values) {
- return newShortBuffer(values, 0);
- }
-
- //----------------------------------------------------------------------
- // Copy routines (type-to-type)
- //
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed ByteBuffer into
- a newly-allocated direct ByteBuffer. The returned buffer will
- have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyByteBuffer(ByteBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining());
- dest.put(orig);
- dest.rewind();
- return dest;
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed FloatBuffer
- into a newly-allocated direct FloatBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static FloatBuffer copyFloatBuffer(FloatBuffer orig) {
- return copyFloatBufferAsByteBuffer(orig).asFloatBuffer();
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed IntBuffer
- into a newly-allocated direct IntBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static IntBuffer copyIntBuffer(IntBuffer orig) {
- return copyIntBufferAsByteBuffer(orig).asIntBuffer();
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed ShortBuffer
- into a newly-allocated direct ShortBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ShortBuffer copyShortBuffer(ShortBuffer orig) {
- return copyShortBufferAsByteBuffer(orig).asShortBuffer();
- }
-
- //----------------------------------------------------------------------
- // Copy routines (type-to-ByteBuffer)
- //
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed FloatBuffer
- into a newly-allocated direct ByteBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyFloatBufferAsByteBuffer(FloatBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_FLOAT);
- dest.asFloatBuffer().put(orig);
- dest.rewind();
- return dest;
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed IntBuffer into
- a newly-allocated direct ByteBuffer. The returned buffer will
- have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyIntBufferAsByteBuffer(IntBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_INT);
- dest.asIntBuffer().put(orig);
- dest.rewind();
- return dest;
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed ShortBuffer
- into a newly-allocated direct ByteBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyShortBufferAsByteBuffer(ShortBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_SHORT);
- dest.asShortBuffer().put(orig);
- dest.rewind();
- return dest;
- }
-
- //----------------------------------------------------------------------
- // Conversion routines
- //
-
- public final static float[] getFloatArray(double[] source) {
- int i=source.length;
- float[] dest = new float[i--];
- while(i>=0) { dest[i]=(float)source[i]; i--; }
- return dest;
- }
-
- public final static FloatBuffer getFloatBuffer(DoubleBuffer source) {
- source.rewind();
- FloatBuffer dest = BufferUtil.newFloatBuffer(source.limit());
- while(source.hasRemaining()) { dest.put((float)source.get()); }
- return dest;
- }
-
- public static ByteBuffer nativeOrder(ByteBuffer buf) {
- if (!isCDCFP) {
- try {
- if (byteOrderClass == null) {
- byteOrderClass = Class.forName("java.nio.ByteOrder");
- orderMethod = ByteBuffer.class.getMethod("order", new Class[] { byteOrderClass });
- Method nativeOrderMethod = byteOrderClass.getMethod("nativeOrder", null);
- nativeOrderObject = nativeOrderMethod.invoke(null, null);
- }
- } catch (Throwable t) {
- // Must be running on CDC / FP
- isCDCFP = true;
- }
-
- if (!isCDCFP) {
- try {
- orderMethod.invoke(buf, new Object[] { nativeOrderObject });
- } catch (Throwable t) {
- }
- }
- }
- return buf;
- }
-
- //----------------------------------------------------------------------
- // Convenient GL put methods with generic target Buffer
- //
- public static void put(Buffer dest, Buffer v) {
- if((dest instanceof ByteBuffer) && (v instanceof ByteBuffer)) {
- ((ByteBuffer)dest).put((ByteBuffer)v);
- } else if((dest instanceof ShortBuffer) && (v instanceof ShortBuffer)) {
- ((ShortBuffer)dest).put((ShortBuffer)v);
- } else if((dest instanceof IntBuffer) && (v instanceof IntBuffer)) {
- ((IntBuffer)dest).put((IntBuffer)v);
- } else if((dest instanceof FloatBuffer) && (v instanceof FloatBuffer)) {
- ((FloatBuffer)dest).put((FloatBuffer)v);
- } else {
- throw new GLException("Incompatible Buffer classes: dest = "+dest.getClass().getName() + ", src = " + v.getClass().getName());
- }
- }
-
- public static void putb(Buffer dest, byte v) {
- if(dest instanceof ByteBuffer) {
- ((ByteBuffer)dest).put(v);
- } else if(dest instanceof ShortBuffer) {
- ((ShortBuffer)dest).put((short)v);
- } else if(dest instanceof IntBuffer) {
- ((IntBuffer)dest).put((int)v);
- } else {
- throw new GLException("Byte doesn't match Buffer Class: "+dest);
- }
- }
-
- public static void puts(Buffer dest, short v) {
- if(dest instanceof ShortBuffer) {
- ((ShortBuffer)dest).put(v);
- } else if(dest instanceof IntBuffer) {
- ((IntBuffer)dest).put((int)v);
- } else {
- throw new GLException("Short doesn't match Buffer Class: "+dest);
- }
- }
-
- public static void puti(Buffer dest, int v) {
- if(dest instanceof IntBuffer) {
- ((IntBuffer)dest).put(v);
- } else {
- throw new GLException("Integer doesn't match Buffer Class: "+dest);
- }
- }
-
- public static void putx(Buffer dest, int v) {
- puti(dest, v);
- }
-
- public static void putf(Buffer dest, float v) {
- if(dest instanceof FloatBuffer) {
- ((FloatBuffer)dest).put(v);
- } else if(dest instanceof IntBuffer) {
- ((IntBuffer)dest).put(FixedPoint.toFixed(v));
- } else {
- throw new GLException("Float doesn't match Buffer Class: "+dest);
- }
- }
-
- public static void putd(Buffer dest, double v) {
- if(dest instanceof FloatBuffer) {
- ((FloatBuffer)dest).put((float)v);
- } else {
- throw new GLException("Double doesn't match Buffer Class: "+dest);
- }
- }
-
- //----------------------------------------------------------------------
- // Internals only below this point
- //
-
- // NOTE that this work must be done reflectively at the present time
- // because this code must compile and run correctly on both CDC/FP and J2SE
- private static boolean isCDCFP;
- private static Class byteOrderClass;
- private static Object nativeOrderObject;
- private static Method orderMethod;
-
-}
diff --git a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
index 5450e400b..ee41c9161 100644
--- a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
+++ b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
@@ -41,7 +41,7 @@ package javax.media.opengl;
import javax.media.nativewindow.Capabilities;
import javax.media.nativewindow.NativeWindowException;
-import com.sun.opengl.impl.Debug;
+import com.jogamp.opengl.impl.Debug;
/** <P> The default implementation of the {@link
GLCapabilitiesChooser} interface, which provides consistent visual
@@ -89,11 +89,17 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
int windowSystemRecommendedChoice) {
GLCapabilities _desired = (GLCapabilities) desired;
GLCapabilities[] _available = (GLCapabilities[]) available;
+ int availnum = 0;
+
+ for (int i = 0; i < _available.length; i++) {
+ if(null != _available[i]) { availnum++; }
+ }
if (DEBUG) {
System.err.println("Desired: " + _desired);
+ System.err.println("Available: Valid " + availnum + "/" + _available.length);
for (int i = 0; i < _available.length; i++) {
- System.err.println("Available " + i + ": " + _available[i]);
+ System.err.println(i + ": " + _available[i]);
}
System.err.println("Window system's recommended choice: " + windowSystemRecommendedChoice);
}
@@ -132,6 +138,9 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
if (_desired.isOnscreen() != cur.isOnscreen()) {
continue;
}
+ if (!_desired.isOnscreen() && _desired.isPBuffer() && !cur.isPBuffer()) {
+ continue; // only skip if requested Offscreen && PBuffer, but no PBuffer available
+ }
if (_desired.getStereo() != cur.getStereo()) {
continue;
}
diff --git a/src/jogl/classes/javax/media/opengl/GLArrayData.java b/src/jogl/classes/javax/media/opengl/GLArrayData.java
index d17ee6a06..088c71bd8 100644
--- a/src/jogl/classes/javax/media/opengl/GLArrayData.java
+++ b/src/jogl/classes/javax/media/opengl/GLArrayData.java
@@ -21,10 +21,10 @@ public interface GLArrayData {
* The index of the predefined array index, see list below,
* or -1 in case of a shader attribute array.
*
- * @see javax.media.opengl.GL#GL_VERTEX_ARRAY
- * @see javax.media.opengl.GL#GL_NORMAL_ARRAY
- * @see javax.media.opengl.GL#GL_COLOR_ARRAY
- * @see javax.media.opengl.GL#GL_TEXTURE_COORD_ARRAY
+ * @see javax.media.opengl.GL2#GL_VERTEX_ARRAY
+ * @see javax.media.opengl.GL2#GL_NORMAL_ARRAY
+ * @see javax.media.opengl.GL2#GL_COLOR_ARRAY
+ * @see javax.media.opengl.GL2#GL_TEXTURE_COORD_ARRAY
*/
public int getIndex();
@@ -49,7 +49,7 @@ public interface GLArrayData {
* Sets the determined location of the shader attribute
* This is usually done within ShaderState.
*
- * @see javax.media.opengl.glsl.ShaderState#glVertexAttribPointer(GL2ES2, GLArrayData)
+ * @see com.jogamp.opengl.util.glsl.ShaderState#glVertexAttribPointer(GL2ES2, GLArrayData)
*/
public void setLocation(int v);
diff --git a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
index a94c14f33..7342369d9 100644
--- a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
@@ -40,7 +40,7 @@
package javax.media.opengl;
import javax.media.opengl.glu.*;
-import com.sun.opengl.impl.Debug;
+import com.jogamp.opengl.impl.Debug;
import java.security.*;
/** A higher-level abstraction than {@link GLDrawable} which supplies
diff --git a/src/jogl/classes/javax/media/opengl/GLBase.java b/src/jogl/classes/javax/media/opengl/GLBase.java
index be5a6dc4f..5ba410a61 100644
--- a/src/jogl/classes/javax/media/opengl/GLBase.java
+++ b/src/jogl/classes/javax/media/opengl/GLBase.java
@@ -64,6 +64,20 @@ public interface GLBase {
public boolean isGL();
/**
+ * Indicates whether this GL object conforms to the GL4 compatibility profile.
+ * The GL4 compatibility profile merges the GL2 profile and GL4 core profile.
+ * @return whether this GL object conforms to the GL4 compatibility profile
+ */
+ public boolean isGL4bc();
+
+ /**
+ * Indicates whether this GL object conforms to the GL4 core profile.
+ * The GL4 core profile reflects OpenGL versions greater or equal 3.1
+ * @return whether this GL object conforms to the GL4 core profile
+ */
+ public boolean isGL4();
+
+ /**
* Indicates whether this GL object conforms to the GL3 compatibility profile.
* The GL3 compatibility profile merges the GL2 profile and GL3 core profile.
* @return whether this GL object conforms to the GL3 compatibility profile
@@ -131,6 +145,20 @@ public interface GLBase {
public GL getGL() throws GLException;
/**
+ * Casts this object to the GL4bc interface.
+ * @return this object cast to the GL4bc interface
+ * @throws GLException if this GLObject is not a GL4bc implementation
+ */
+ public GL4bc getGL4bc() throws GLException;
+
+ /**
+ * Casts this object to the GL4 interface.
+ * @return this object cast to the GL4 interface
+ * @throws GLException if this GLObject is not a GL4 implementation
+ */
+ public GL4 getGL4() throws GLException;
+
+ /**
* Casts this object to the GL3bc interface.
* @return this object cast to the GL3bc interface
* @throws GLException if this GLObject is not a GL3bc implementation
@@ -220,7 +248,7 @@ public interface GLBase {
*
* @param glFunctionName the name of the OpenGL function (e.g., use
* "glBindRenderbufferEXT" or "glBindRenderbuffer" to check if {@link
- * #glBindRenderbuffer(int,int)} is available).
+ * GL#glBindRenderbuffer(int,int)} is available).
*/
public boolean isFunctionAvailable(String glFunctionName);
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index 840de4764..2709dd506 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -39,8 +39,8 @@
package javax.media.opengl;
-import com.sun.opengl.impl.Debug;
import java.util.HashMap;
+import com.jogamp.common.util.IntIntHashMap;
/** Abstraction for an OpenGL rendering context. In order to perform
OpenGL rendering, a context must be "made current" on the current
@@ -67,6 +67,8 @@ public abstract class GLContext {
private HashMap/*<int, Object>*/ attachedObjects = new HashMap();
+ protected long context;
+
/**
* Returns the GLDrawable to which this context may be used to
* draw.
@@ -136,14 +138,14 @@ public abstract class GLContext {
* 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
- * {@link GL#GL_ALL_ATTRIB_BITS GL_ALL_ATTRIB_BITS} can be used to
+ * {@link GL2#GL_ALL_ATTRIB_BITS GL_ALL_ATTRIB_BITS} can be used to
* copy the maximum possible portion of rendering state. <P>
*
* Not all values for GL state can be copied. For example, pixel
* pack and unpack state, render mode state, and select and feedback
* state are not copied. The state that can be copied is exactly the
* state that is manipulated by the GL command {@link
- * GL#glPushAttrib glPushAttrib}. <P>
+ * GL2#glPushAttrib glPushAttrib}. <P>
*
* On most platforms, this context may not be current to any thread,
* including the calling thread, when this method is called. Some
@@ -164,7 +166,7 @@ public abstract class GLContext {
* If no context is current, throw an GLException
*
* @return the current context's GL object on this thread
- * @thows GLException if no context is current
+ * @throws GLException if no context is current
*/
public static GL getCurrentGL() throws GLException {
GLContext glc = getCurrent();
@@ -259,7 +261,15 @@ public abstract class GLContext {
public final String toString() {
StringBuffer sb = new StringBuffer();
sb.append(getClass().getName());
- sb.append(" [");
+ sb.append(" [OpenGL ");
+ sb.append(getGLVersionMajor());
+ sb.append(".");
+ sb.append(getGLVersionMinor());
+ sb.append(", options 0x");
+ sb.append(Integer.toHexString(ctxOptions));
+ sb.append(", ");
+ sb.append(getGLVersion());
+ sb.append(", ");
sb.append(getGL());
if(getGLDrawable()!=getGLDrawableRead()) {
sb.append(",\n\tDrawable Read : ");
@@ -279,4 +289,241 @@ public abstract class GLContext {
GLX) extensions. Can only be called while this context is
current. */
public abstract String getPlatformExtensionsString();
+
+ public final int getGLVersionMajor() { return ctxMajorVersion; }
+ public final int getGLVersionMinor() { return ctxMinorVersion; }
+ public final boolean isGLCompatibilityProfile() { return ( 0 != ( CTX_PROFILE_COMPAT & ctxOptions ) ); }
+ public final boolean isGLForwardCompatible() { return ( 0 != ( CTX_OPTION_FORWARD & ctxOptions ) ); }
+ public final boolean isCreatedWithARBMethod() { return ( 0 != ( CTX_IS_ARB_CREATED & ctxOptions ) ); }
+
+ /**
+ * Returns a valid OpenGL version string, ie
+ * <code>major.minor ([option]?[options,]*) - gl-version</code>
+ *
+ * <ul>
+ * <li> options
+ * <ul>
+ * <li> <code>old</code> refers to the non ARB_create_context created context
+ * <li> <code>new</code> refers to the ARB_create_context created context
+ * <li> <code>compatible profile</code>
+ * <li> <code>core profile</code>
+ * <li> <code>forward compatible</code>
+ * <li> <code>any</code> refers to the non forward compatible context
+ * <li> <code>ES</code> refers to the GLES context variant
+ * </ul>
+ * <li> <i>gl-version</i> the GL_VERSION string
+ * </ul>
+ *
+ * e.g.:
+ * <table border="0">
+ * <tr> <td></td> <td></td> </tr>
+ * <tr>
+ * <td>row 2, cell 1</td>
+ * <td>row 2, cell 2</td>
+ * </tr>
+ * </table>
+ *
+ * <table border="0">
+ * <tr><td></td> <td>ES2</td> <td><code>2.0 (ES, any, new) - 2.0 ES Profile</code></td></tr>
+ * <tr><td>ATI</td><td>GL2</td> <td><code>3.0 (compatibility profile, any, new) - 3.2.9704 Compatibility Profile Context</code></td></tr>
+ * <tr><td>ATI</td><td>GL3</td> <td><code>3.3 (core profile, any, new) - 1.4 (3.2.9704 Compatibility Profile Context)</code></td></tr>
+ * <tr><td>ATI</td><td>GL3bc</td><td><code>3.3 (compatibility profile, any, new) - 1.4 (3.2.9704 Compatibility Profile Context)</code></td></tr>
+ * <tr><td>NV</td><td>GL2</td> <td><code>3.0 (compatibility profile, any, new) - 3.0.0 NVIDIA 195.36.07.03</code></td></tr>
+ * <tr><td>NV</td><td>GL3</td> <td><code>3.3 (core profile, any, new) - 3.3.0 NVIDIA 195.36.07.03</code></td></tr>
+ * <tr><td>NV</td><td>GL3bc</td> <td><code>3.3 (compatibility profile, any, new) - 3.3.0 NVIDIA 195.36.07.03</code></td></tr>
+ * </table>
+ */
+ public final String getGLVersion() {
+ return ctxVersionString;
+ }
+
+ protected int ctxMajorVersion=-1;
+ protected int ctxMinorVersion=-1;
+ protected int ctxOptions=0;
+ protected String ctxVersionString=null;
+
+ /** <code>ARB_create_context</code> related: created via ARB_create_context */
+ protected static final int CTX_IS_ARB_CREATED = 1 << 0;
+ /** <code>ARB_create_context</code> related: compatibility profile */
+ protected static final int CTX_PROFILE_COMPAT = 1 << 1;
+ /** <code>ARB_create_context</code> related: core profile */
+ protected static final int CTX_PROFILE_CORE = 1 << 2;
+ /** <code>ARB_create_context</code> related: flag forward compatible */
+ protected static final int CTX_PROFILE_ES = 1 << 3;
+ /** <code>ARB_create_context</code> related: flag forward compatible */
+ protected static final int CTX_OPTION_FORWARD = 1 << 4;
+ /** <code>ARB_create_context</code> related: not flag forward compatible */
+ protected static final int CTX_OPTION_ANY = 1 << 5;
+ /** <code>ARB_create_context</code> related: flag debug */
+ protected static final int CTX_OPTION_DEBUG = 1 << 6;
+
+
+ public final boolean isGL4bc() {
+ return ctxMajorVersion>=4 && CTX_PROFILE_COMPAT==(ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_ES));
+ }
+
+ public final boolean isGL4() {
+ return ctxMajorVersion>=4 && 0==(ctxOptions & (CTX_PROFILE_ES));
+ }
+
+ public final boolean isGL3bc() {
+ return ctxMajorVersion>=3 && CTX_PROFILE_COMPAT==(ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_ES));
+ }
+
+ public final boolean isGL3() {
+ return ctxMajorVersion>=3 && 0==(ctxOptions & (CTX_PROFILE_ES));
+ }
+
+ public final boolean isGL2() {
+ return ctxMajorVersion>=1 && CTX_PROFILE_COMPAT==(ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_ES));
+ }
+
+ public final boolean isGL2GL3() {
+ return isGL2() || isGL3();
+ }
+
+ public final boolean isGLES1() {
+ return ctxMajorVersion==1 && CTX_PROFILE_ES==(ctxOptions & CTX_PROFILE_ES);
+ }
+
+ public final boolean isGLES2() {
+ return ctxMajorVersion==2 && CTX_PROFILE_ES==(ctxOptions & CTX_PROFILE_ES);
+ }
+
+ public final boolean isGLES() {
+ return CTX_PROFILE_ES==(ctxOptions & CTX_PROFILE_ES);
+ }
+
+ public final boolean isGL2ES1() {
+ return isGL2() || isGLES1() ;
+ }
+
+ public final boolean isGL2ES2() {
+ return isGL2GL3() || isGLES2() ;
+ }
+
+ public final boolean hasGLSL() {
+ return isGL2ES2() ;
+ }
+
+ public static final int GL_VERSIONS[][] = {
+ /* 0.*/ { -1 },
+ /* 1.*/ { 0, 1, 2, 3, 4, 5 },
+ /* 2.*/ { 0, 1 },
+ /* 3.*/ { 0, 1, 2, 3 },
+ /* 4.*/ { 0 } };
+
+ public static final int getMaxMajor() {
+ return GL_VERSIONS.length-1;
+ }
+
+ public static final int getMaxMinor(int major) {
+ if(1>major || major>=GL_VERSIONS.length) return -1;
+ return GL_VERSIONS[major].length-1;
+ }
+
+ public static final boolean isValidGLVersion(int major, int minor) {
+ if(1>major || major>=GL_VERSIONS.length) return false;
+ if(0>minor || minor>=GL_VERSIONS[major].length) return false;
+ return true;
+ }
+
+ public static final boolean decrementGLVersion(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(m, n)) return false;
+
+ // decrement ..
+ n -= 1;
+ if(n < 0) {
+ m -= 1;
+ n = GL_VERSIONS[m].length-1;
+ }
+ if(!isValidGLVersion(m, n)) return false;
+ major[0]=m;
+ minor[0]=n;
+
+ return true;
+ }
+
+ public static final boolean isGLVersionAvailable(int major, boolean compatibility) {
+ int key = compose8bit(major, compatibility?CTX_PROFILE_COMPAT:CTX_PROFILE_CORE, 0, 0);
+ int val = mappedVersionsAvailable.get( key );
+ return val>0;
+ }
+ public static final boolean isGL4bcAvailable() { return isGLVersionAvailable(4, true); }
+ public static final boolean isGL4Available() { return isGLVersionAvailable(4, false); }
+ public static final boolean isGL3bcAvailable() { return isGLVersionAvailable(3, true); }
+ public static final boolean isGL3Available() { return isGLVersionAvailable(3, false); }
+ public static final boolean isGL2Available() { return isGLVersionAvailable(2, true); }
+
+ protected static final IntIntHashMap mappedVersionsAvailable;
+ protected static volatile boolean mappedVersionsAvailableSet;
+ protected static Object mappedVersionsAvailableLock;
+
+ static {
+ mappedVersionsAvailableLock = new Object();
+ mappedVersionsAvailableSet = false;
+ mappedVersionsAvailable = new IntIntHashMap();
+ mappedVersionsAvailable.setKeyNotFoundValue(-1);
+ }
+
+ /**
+ * Called by {@link GLContextImpl#createContextARBMapVersionsAvailable} not intendet to be used by
+ * implementations. However, if {@link #createContextARB} is not being used within the
+ * {@link GLDrawableImpl} constructor, GLProfile has to map the available versions.
+ *
+ * @see #createContextARBMapVersionsAvailable
+ */
+ protected static void mapVersionAvailable(int reqMajor, boolean reqCompat, int resMajor, int resMinor, int resCtp)
+ {
+ int key = compose8bit(reqMajor, reqCompat?CTX_PROFILE_COMPAT:CTX_PROFILE_CORE, 0, 0);
+ int val = compose8bit(resMajor, resMinor, resCtp, 0);
+ mappedVersionsAvailable.put( key, val );
+ }
+
+ protected static int compose8bit(int one, int two, int three, int four) {
+ return ( ( one & 0x000000FF ) << 24 ) |
+ ( ( two & 0x000000FF ) << 16 ) |
+ ( ( three & 0x000000FF ) << 8 ) |
+ ( ( four & 0x000000FF ) ) ;
+ }
+
+ protected static int getComposed8bit(int bits32, int which ) {
+ switch (which) {
+ case 1: return ( bits32 & 0xFF000000 ) >> 24 ;
+ case 2: return ( bits32 & 0x00FF0000 ) >> 16 ;
+ case 3: return ( bits32 & 0x0000FF00 ) >> 8 ;
+ case 4: return ( bits32 & 0xFF0000FF ) ;
+ }
+ throw new GLException("argument which out of range: "+which);
+ }
+
+ protected static String composed8BitToString(int bits32, boolean hex1, boolean hex2, boolean hex3, boolean hex4) {
+ int a = getComposed8bit(bits32, 1);
+ int b = getComposed8bit(bits32, 2);
+ int c = getComposed8bit(bits32, 3);
+ int d = getComposed8bit(bits32, 4);
+ return "["+toString(a, hex1)+", "+toString(b, hex2)+", "+toString(c, hex3)+", "+toString(d, hex4)+"]";
+ }
+
+ protected static String toString(int val, boolean hex) {
+ if(hex) {
+ return "0x" + Integer.toHexString(val);
+ }
+ return String.valueOf(val);
+ }
+
+ protected static String toHexString(int hex) {
+ return "0x" + Integer.toHexString(hex);
+ }
+
+ protected static String toHexString(long hex) {
+ return "0x" + Long.toHexString(hex);
+ }
+
}
+
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
index b7c81cbed..b02bffb61 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
@@ -41,10 +41,10 @@ package javax.media.opengl;
import javax.media.nativewindow.*;
-import java.lang.reflect.*;
import java.security.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.NWReflection;
+import com.jogamp.common.JogampRuntimeException;
+import com.jogamp.common.util.*;
+import com.jogamp.opengl.impl.*;
/** <P> Provides a virtual machine- and operating system-independent
mechanism for creating {@link GLDrawable}s. </P>
@@ -88,8 +88,8 @@ public abstract class GLDrawableFactory {
private static final GLDrawableFactory eglFactory;
private static final GLDrawableFactory nativeOSFactory;
private static final String nativeOSType;
- static final String macosxFactoryClassNameCGL = "com.sun.opengl.impl.macosx.cgl.MacOSXCGLDrawableFactory";
- static final String macosxFactoryClassNameAWTCGL = "com.sun.opengl.impl.macosx.cgl.awt.MacOSXAWTCGLDrawableFactory";
+ static final String macosxFactoryClassNameCGL = "com.jogamp.opengl.impl.macosx.cgl.MacOSXCGLDrawableFactory";
+ static final String macosxFactoryClassNameAWTCGL = "com.jogamp.opengl.impl.macosx.cgl.awt.MacOSXAWTCGLDrawableFactory";
/**
* Instantiate singleton factories if available, EGLES1, EGLES2 and the OS native ones.
@@ -97,51 +97,50 @@ public abstract class GLDrawableFactory {
static {
GLDrawableFactory tmp = null;
try {
- tmp = (GLDrawableFactory) NWReflection.createInstance("com.sun.opengl.impl.egl.EGLDrawableFactory");
- } catch (Throwable t) {
+ tmp = (GLDrawableFactory) ReflectionUtil.createInstance("com.jogamp.opengl.impl.egl.EGLDrawableFactory");
+ } catch (JogampRuntimeException jre) {
if (GLProfile.DEBUG) {
System.err.println("GLDrawableFactory.static - EGLDrawableFactory - not available");
- t.printStackTrace();
+ jre.printStackTrace();
}
}
eglFactory = tmp;
nativeOSType = NativeWindowFactory.getNativeWindowType(true);
- String factoryClassName = null;
tmp = null;
- try {
- factoryClassName = Debug.getProperty("jogl.gldrawablefactory.class.name", true, AccessController.getContext());
- if (null == factoryClassName) {
- if ( nativeOSType.equals(NativeWindowFactory.TYPE_X11) ) {
- factoryClassName = "com.sun.opengl.impl.x11.glx.X11GLXDrawableFactory";
- } else if ( nativeOSType.equals(NativeWindowFactory.TYPE_WINDOWS) ) {
- factoryClassName = "com.sun.opengl.impl.windows.wgl.WindowsWGLDrawableFactory";
- } else if ( nativeOSType.equals(NativeWindowFactory.TYPE_MACOSX) ) {
- if(NWReflection.isClassAvailable(macosxFactoryClassNameAWTCGL)) {
- factoryClassName = macosxFactoryClassNameAWTCGL;
- } else {
- factoryClassName = macosxFactoryClassNameCGL;
- }
+ String factoryClassName = Debug.getProperty("jogl.gldrawablefactory.class.name", true, AccessController.getContext());
+ if (null == factoryClassName) {
+ if ( nativeOSType.equals(NativeWindowFactory.TYPE_X11) ) {
+ factoryClassName = "com.jogamp.opengl.impl.x11.glx.X11GLXDrawableFactory";
+ } else if ( nativeOSType.equals(NativeWindowFactory.TYPE_WINDOWS) ) {
+ factoryClassName = "com.jogamp.opengl.impl.windows.wgl.WindowsWGLDrawableFactory";
+ } else if ( nativeOSType.equals(NativeWindowFactory.TYPE_MACOSX) ) {
+ if(ReflectionUtil.isClassAvailable(macosxFactoryClassNameAWTCGL)) {
+ factoryClassName = macosxFactoryClassNameAWTCGL;
} else {
- // may use egl*Factory ..
- if (GLProfile.DEBUG) {
- System.err.println("GLDrawableFactory.static - No native OS Factory for: "+nativeOSType+"; May use EGLDrawableFactory, if available." );
- }
+ factoryClassName = macosxFactoryClassNameCGL;
}
- }
- if (null != factoryClassName) {
+ } else {
+ // may use egl*Factory ..
if (GLProfile.DEBUG) {
- System.err.println("GLDrawableFactory.static - Native OS Factory for: "+nativeOSType+": "+factoryClassName);
+ System.err.println("GLDrawableFactory.static - No native OS Factory for: "+nativeOSType+"; May use EGLDrawableFactory, if available." );
}
- tmp = (GLDrawableFactory) NWReflection.createInstance(factoryClassName);
- }
- } catch (Throwable t) {
- if (GLProfile.DEBUG) {
- System.err.println("GLDrawableFactory.static - Native Platform: "+nativeOSType+" - not available: "+factoryClassName);
- t.printStackTrace();
}
}
+ if (null != factoryClassName) {
+ if (GLProfile.DEBUG) {
+ System.err.println("GLDrawableFactory.static - Native OS Factory for: "+nativeOSType+": "+factoryClassName);
+ }
+ try {
+ tmp = (GLDrawableFactory) ReflectionUtil.createInstance(factoryClassName);
+ } catch (JogampRuntimeException jre) {
+ if (GLProfile.DEBUG) {
+ System.err.println("GLDrawableFactory.static - Native Platform: "+nativeOSType+" - not available: "+factoryClassName);
+ jre.printStackTrace();
+ }
+ }
+ }
nativeOSFactory = tmp;
}
@@ -174,8 +173,7 @@ public abstract class GLDrawableFactory {
destroy any GLContexts and GLDrawables that have been created
and are still in use. No further OpenGL calls may be made after
shutting down the GLDrawableFactory. */
- public void shutdown() {
- }
+ public abstract void shutdown();
//----------------------------------------------------------------------
// Methods to create high-level objects
@@ -187,10 +185,10 @@ public abstract class GLDrawableFactory {
* The native platform's chosen Capabilties are referenced within the target
* NativeWindow's AbstractGraphicsConfiguration.<p>
*
- * In case {@link javax.media.nativewindow.Capabilties#isOnscreen()} is true,<br>
+ * In case {@link javax.media.nativewindow.Capabilities#isOnscreen()} is true,<br>
* an onscreen GLDrawable will be realized.
* <p>
- * In case {@link javax.media.nativewindow.Capabilties#isOnscreen()} is false,<br>
+ * In case {@link javax.media.nativewindow.Capabilities#isOnscreen()} is false,<br>
* either a Pbuffer drawable is created if {@link javax.media.opengl.GLCapabilities#isPBuffer()} is true,<br>
* or a simple offscreen drawable is creates. The latter is unlikely to be hardware accelerated.<br>
* <p>
@@ -218,8 +216,9 @@ public abstract class GLDrawableFactory {
/**
* Returns true if it is possible to create a GLPbuffer. Some older
* graphics cards do not have this capability.
+ * @param passing the device for the query, may be null
*/
- public abstract boolean canCreateGLPbuffer();
+ public abstract boolean canCreateGLPbuffer(AbstractGraphicsDevice device);
/**
* Creates a Pbuffer GLDrawable with the given capabilites and dimensions. <P>
@@ -280,8 +279,9 @@ public abstract class GLDrawableFactory {
/**
* Returns true if it is possible to create an external GLDrawable
* object via {@link #createExternalGLDrawable}.
+ * @param passing the device for the query, may be null
*/
- public abstract boolean canCreateExternalGLDrawable();
+ public abstract boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device);
/**
* <P> Creates a {@link GLDrawable} object representing an existing
diff --git a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java
index 63b50cb3c..352545849 100644
--- a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java
+++ b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java
@@ -39,7 +39,7 @@ package javax.media.opengl;
import java.lang.reflect.*;
import java.util.StringTokenizer;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
/**
* Factory for pipelining GL instances
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index 69cdd3f24..0e10b32b3 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -36,13 +36,16 @@
package javax.media.opengl;
-import javax.media.opengl.fixedfunc.*;
-import java.lang.reflect.*;
+import com.jogamp.common.util.*;
+import com.jogamp.opengl.impl.DRIHack;
+import com.jogamp.opengl.impl.Debug;
+import com.jogamp.opengl.impl.GLJNILibLoader;
+import com.jogamp.common.jvm.JVMUtil;
import java.util.HashMap;
-import java.security.*;
-import com.sun.opengl.impl.*;
-import com.sun.nativewindow.impl.NWReflection;
-import com.sun.nativewindow.impl.jvm.JVMUtil;
+import java.util.Iterator;
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import javax.media.opengl.fixedfunc.GLPointerFunc;
/**
* Specifies the the OpenGL profile.
@@ -57,9 +60,62 @@ public class GLProfile implements Cloneable {
public static final boolean DEBUG = Debug.debug("GLProfile");
//
+ // Query platform available OpenGL implementation
+ //
+
+ public static final boolean isGL4bcAvailable() { return null != mappedProfiles.get(GL4bc); }
+ public static final boolean isGL4Available() { return null != mappedProfiles.get(GL4); }
+ public static final boolean isGL3bcAvailable() { return null != mappedProfiles.get(GL3bc); }
+ public static final boolean isGL3Available() { return null != mappedProfiles.get(GL3); }
+ public static final boolean isGL2Available() { return null != mappedProfiles.get(GL2); }
+ public static final boolean isGLES2Available() { return null != mappedProfiles.get(GLES2); }
+ public static final boolean isGLES1Available() { return null != mappedProfiles.get(GLES1); }
+ public static final boolean isGL2ES1Available() { return null != mappedProfiles.get(GL2ES1); }
+ public static final boolean isGL2ES2Available() { return null != mappedProfiles.get(GL2ES2); }
+
+ public static final String glAvailabilityToString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append("GLAvailability[Native[GL4bc ");
+ sb.append(isGL4bcAvailable());
+ sb.append(", GL4 ");
+ sb.append(isGL4Available());
+ sb.append(", GL3bc ");
+ sb.append(isGL3bcAvailable());
+ sb.append(", GL3 ");
+ sb.append(isGL3Available());
+ sb.append(", GL2 ");
+ sb.append(isGL2Available());
+ sb.append(", GL2ES1 ");
+ sb.append(isGL2ES1Available());
+ sb.append(", GLES1 ");
+ sb.append(isGLES1Available());
+ sb.append(", GL2ES2 ");
+ sb.append(isGL2ES2Available());
+ sb.append(", GLES2 ");
+ sb.append(isGLES2Available());
+ sb.append("], Profiles[");
+ for(Iterator i=mappedProfiles.values().iterator(); i.hasNext(); ) {
+ sb.append(((GLProfile)i.next()).toString());
+ sb.append(", ");
+ }
+ sb.append(", default ");
+ sb.append(defaultGLProfile);
+ sb.append("]]");
+
+ return sb.toString();
+ }
+
+ //
// Public (user-visible) profiles
//
+ /** The desktop OpenGL compatibility profile 4.x, with x >= 0, ie GL2 plus GL4.<br>
+ <code>bc</code> stands for backward compatibility. */
+ public static final String GL4bc = "GL4bc";
+
+ /** The desktop OpenGL core profile 4.x, with x >= 0 */
+ public static final String GL4 = "GL4";
+
/** The desktop OpenGL compatibility profile 3.x, with x >= 1, ie GL2 plus GL3.<br>
<code>bc</code> stands for backward compatibility. */
public static final String GL3bc = "GL3bc";
@@ -86,22 +142,92 @@ public class GLProfile implements Cloneable {
public static final String GL2GL3 = "GL2GL3";
/**
- * All GL Profiles in the order of default detection: GL2, GL2ES2, GL2ES1, GLES2, GLES1, GL2GL3, GL3
+ * All GL Profiles in the order of default detection.
+ * Desktop compatibility profiles (the one with fixed function pipeline) comes first.
+ *
+ * FIXME GL3GL4: Due to GL3 and GL4 implementation bugs, we still choose GL2 first, if available!
+ *
+ * <ul>
+ * <li> GL2
+ * <li> GL3bc
+ * <li> GL4bc
+ * <li> GL2GL3
+ * <li> GL3
+ * <li> GL4
+ * <li> GL2ES2
+ * <li> GLES2
+ * <li> GL2ES1
+ * <li> GLES1
+ * </ul>
+ *
+ */
+ public static final String[] GL_PROFILE_LIST_ALL = new String[] { GL2, GL3bc, GL4bc, GL2GL3, GL3, GL4, GL2ES2, GLES2, GL2ES1, GLES1 };
+
+ /**
+ * Order of maximum fixed function profiles
+ *
+ * <ul>
+ * <li> GL4bc
+ * <li> GL3bc
+ * <li> GL2
+ * <li> GL2ES1
+ * <li> GLES1
+ * </ul>
+ *
+ */
+ public static final String[] GL_PROFILE_LIST_MAX_FIXEDFUNC = new String[] { GL4bc, GL3bc, GL2, GL2ES1, GLES1 };
+
+ /**
+ * Order of maximum programmable shader profiles
+ *
+ * <ul>
+ * <li> GL4
+ * <li> GL4bc
+ * <li> GL3
+ * <li> GL3bc
+ * <li> GL2
+ * <li> GL2ES2
+ * <li> GLES2
+ * </ul>
+ *
*/
- public static final String[] GL_PROFILE_LIST_ALL = new String[] { GL2, GL2ES2, GL2ES1, GLES2, GLES1, GL2GL3, GL3bc, GL3 };
+ public static final String[] GL_PROFILE_LIST_MAX_PROGSHADER = new String[] { GL4, GL4bc, GL3, GL3bc, GL2, GL2ES2, GLES2 };
/**
- * All GL2ES2 Profiles in the order of default detection: GL2ES2, GL2, GLES2, GL3
+ * All GL2ES2 Profiles in the order of default detection.
+ *
+ * FIXME GL3GL4: Due to GL3 and GL4 implementation bugs, we still choose GL2 first, if available!
+ *
+ * <ul>
+ * <li> GL2ES2
+ * <li> GL2
+ * <li> GL3
+ * <li> GL4
+ * <li> GLES2
+ * </ul>
+ *
*/
- public static final String[] GL_PROFILE_LIST_GL2ES2 = new String[] { GL2ES2, GL2, GLES2, GL3bc, GL3 };
+ public static final String[] GL_PROFILE_LIST_GL2ES2 = new String[] { GL2ES2, GL2, GL3, GL4, GLES2 };
/**
- * All GL2ES1 Profiles in the order of default detection: GL2ES1, GL2, GLES1
+ * All GL2ES1 Profiles in the order of default detection.
+ *
+ * FIXME GL3GL4: Due to GL3 and GL4 implementation bugs, we still choose GL2 first, if available!
+ *
+ * <ul>
+ * <li> GL2ES1
+ * <li> GL2
+ * <li> GL3bc
+ * <li> GL4bc
+ * <li> GLES1
+ * </ul>
+ *
*/
- public static final String[] GL_PROFILE_LIST_GL2ES1 = new String[] { GL2ES1, GL2, GLES1 };
+ public static final String[] GL_PROFILE_LIST_GL2ES1 = new String[] { GL2ES1, GL2, GL3bc, GL4bc, GLES1 };
/** 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}
+ * @see #GL_PROFILE_LIST_ALL
*/
public static final GLProfile getDefault() {
if(null==defaultGLProfile) {
@@ -110,22 +236,30 @@ public class GLProfile implements Cloneable {
return defaultGLProfile;
}
- /** Returns a GLProfile object.
- * Verfifies the given profile and chooses an apropriate implementation.
- * A generic value of <code>null</code> or <code>GL</code> will result in
- * the default profile.
+ /**
+ * Returns the highest profile, implementing the fixed function pipeline
+ * It selects the first of the set: {@link GLProfile#GL_PROFILE_LIST_MAX_FIXEDFUNC}
*
* @throws GLException if no implementation for the given profile is found.
+ * @see #GL_PROFILE_LIST_MAX_FIXEDFUNC
*/
- public static final GLProfile get(String profile)
+ public static final GLProfile getMaxFixedFunc()
throws GLException
{
- if(null==profile || profile.equals("GL")) return getDefault();
- GLProfile glProfile = (GLProfile) mappedProfiles.get(profile);
- if(null==glProfile) {
- throw new GLException("No implementation for profile "+profile+" available");
- }
- return glProfile;
+ return get(GL_PROFILE_LIST_MAX_FIXEDFUNC);
+ }
+
+ /**
+ * Returns the highest profile, implementing the programmable shader pipeline.
+ * It selects the first of the set: {@link GLProfile#GL_PROFILE_LIST_MAX_PROGSHADER}
+ *
+ * @throws GLException if no implementation for the given profile is found.
+ * @see #GL_PROFILE_LIST_MAX_PROGSHADER
+ */
+ public static final GLProfile getMaxProgrammable()
+ throws GLException
+ {
+ return get(GL_PROFILE_LIST_MAX_PROGSHADER);
}
/**
@@ -133,6 +267,7 @@ public class GLProfile implements Cloneable {
* It selects the first of the set: {@link GLProfile#GL_PROFILE_LIST_GL2ES1}
*
* @throws GLException if no implementation for the given profile is found.
+ * @see #GL_PROFILE_LIST_GL2ES1
*/
public static final GLProfile getGL2ES1()
throws GLException
@@ -145,6 +280,7 @@ public class GLProfile implements Cloneable {
* It selects the first of the set: {@link GLProfile#GL_PROFILE_LIST_GL2ES2}
*
* @throws GLException if no implementation for the given profile is found.
+ * @see #GL_PROFILE_LIST_GL2ES2
*/
public static final GLProfile getGL2ES2()
throws GLException
@@ -152,6 +288,24 @@ public class GLProfile implements Cloneable {
return get(GL_PROFILE_LIST_GL2ES2);
}
+ /** Returns a GLProfile object.
+ * Verfifies the given profile and chooses an apropriate implementation.
+ * A generic value of <code>null</code> or <code>GL</code> will result in
+ * the default profile.
+ *
+ * @throws GLException if no implementation for the given profile is found.
+ */
+ public static final GLProfile get(String profile)
+ throws GLException
+ {
+ if(null==profile || profile.equals("GL")) return getDefault();
+ GLProfile glProfile = (GLProfile) mappedProfiles.get(profile);
+ if(null==glProfile) {
+ throw new GLException("No implementation for profile "+profile+" available");
+ }
+ return glProfile;
+ }
+
/**
* Returns the first profile from the given list,
* where an implementation is available.
@@ -191,18 +345,18 @@ public class GLProfile implements Cloneable {
}
private static final String getGLImplBaseClassName(String profileImpl) {
- if(GL3bc.equals(profileImpl)) {
- return "com.sun.opengl.impl.gl3.GL3bc";
- } else if(GL3.equals(profileImpl)) {
- return "com.sun.opengl.impl.gl3.GL3";
- } else if(GL2.equals(profileImpl)) {
- return "com.sun.opengl.impl.gl2.GL2";
+ if ( GL4bc.equals(profileImpl) ||
+ GL4.equals(profileImpl) ||
+ GL3bc.equals(profileImpl) ||
+ GL3.equals(profileImpl) ||
+ GL2.equals(profileImpl) ) {
+ return "com.jogamp.opengl.impl.gl4.GL4bc";
} else if(GL2ES12.equals(profileImpl)) {
- return "com.sun.opengl.impl.gl2es12.GL2ES12";
+ return "com.jogamp.opengl.impl.gl2es12.GL2ES12";
} else if(GLES1.equals(profileImpl) || GL2ES1.equals(profileImpl)) {
- return "com.sun.opengl.impl.es1.GLES1";
+ return "com.jogamp.opengl.impl.es1.GLES1";
} else if(GLES2.equals(profileImpl) || GL2ES2.equals(profileImpl)) {
- return "com.sun.opengl.impl.es2.GLES2";
+ return "com.jogamp.opengl.impl.es2.GLES2";
} else {
throw new GLException("unsupported profile \"" + profileImpl + "\"");
}
@@ -252,19 +406,29 @@ public class GLProfile implements Cloneable {
return profileImpl;
}
+ /** Indicates whether this profile is capable of GL4bc. */
+ public final boolean isGL4bc() {
+ return GL4bc.equals(profile);
+ }
+
+ /** Indicates whether this profile is capable of GL4. */
+ public final boolean isGL4() {
+ return isGL4bc() || GL4.equals(profile);
+ }
+
/** Indicates whether this profile is capable of GL3bc. */
public final boolean isGL3bc() {
- return GL3bc.equals(profile);
+ return isGL4bc() || GL3bc.equals(profile);
}
/** Indicates whether this profile is capable of GL3. */
public final boolean isGL3() {
- return isGL3bc() || GL3.equals(profile);
+ return isGL4() || isGL3bc() || GL3.equals(profile);
}
- /** Indicates whether this profile is capable of GL2. */
+ /** Indicates whether this context is a GL2 context */
public final boolean isGL2() {
- return GL2.equals(profile);
+ return isGL3bc() || GL2.equals(profile);
}
/** Indicates whether this profile is capable of GLES1. */
@@ -292,6 +456,11 @@ public class GLProfile implements Cloneable {
return GL2GL3.equals(profile) || isGL2() || isGL3() ;
}
+ /** Indicates whether this profile supports GLSL. */
+ public final boolean hasGLSL() {
+ return isGL2ES2() ;
+ }
+
/** Indicates whether this profile uses the native OpenGL ES1 implementations. */
public final boolean usesNativeGLES1() {
return GLES1.equals(profileImpl);
@@ -307,31 +476,6 @@ public class GLProfile implements Cloneable {
return usesNativeGLES2() || usesNativeGLES1();
}
- /** Indicates whether this profile uses the native desktop OpenGL GL2 implementations. */
- public final boolean usesNativeGL2() {
- return GL2.equals(profileImpl) || GL2ES12.equals(profileImpl) ;
- }
-
- /** Indicates whether this profile uses the native desktop OpenGL GL3bc implementations. */
- public final boolean usesNativeGL3bc() {
- return GL3bc.equals(profileImpl);
- }
-
- /** Indicates whether this profile uses the native desktop OpenGL GL3 implementations. */
- public final boolean usesNativeGL3() {
- return usesNativeGL3bc() || GL3.equals(profileImpl);
- }
-
- /** Indicates whether this profile uses the native desktop OpenGL GL2 or GL3 implementations. */
- public final boolean usesNativeGL2GL3() {
- return usesNativeGL2() || usesNativeGL3() ;
- }
-
- /** Indicates whether this profile supports GLSL. */
- public final boolean hasGLSL() {
- return isGL2ES2() ;
- }
-
/**
* General validation if type is a valid GL data type
* for the current profile
@@ -639,18 +783,21 @@ public class GLProfile implements Cloneable {
private static final boolean isAWTAvailable;
private static final boolean isAWTJOGLAvailable;
- private static final boolean hasGL3bcImpl;
- private static final boolean hasGL3Impl;
- private static final boolean hasGL2Impl;
- private static final boolean hasGL2ES12Impl;
- private static final boolean hasGLES2Impl;
- private static final boolean hasGLES1Impl;
+ private static /*final*/ boolean hasGL234Impl;
+ private static /*final*/ boolean hasGL4bcImpl;
+ private static /*final*/ boolean hasGL4Impl;
+ private static /*final*/ boolean hasGL3bcImpl;
+ private static /*final*/ boolean hasGL3Impl;
+ private static /*final*/ boolean hasGL2Impl;
+ private static /*final*/ boolean hasGL2ES12Impl;
+ private static /*final*/ boolean hasGLES2Impl;
+ private static /*final*/ boolean hasGLES1Impl;
/** The JVM/process wide default GL profile **/
- private static GLProfile defaultGLProfile;
+ private static /*final*/ GLProfile defaultGLProfile;
/** All GLProfiles */
- private static final HashMap/*<String, GLProfile>*/ mappedProfiles;
+ private static /*final*/ HashMap/*<String, GLProfile>*/ mappedProfiles;
/**
* Tries the profiles implementation and native libraries.
@@ -662,115 +809,203 @@ public class GLProfile implements Cloneable {
AccessControlContext acc = AccessController.getContext();
isAWTAvailable = !Debug.getBooleanProperty("java.awt.headless", true, acc) &&
- NWReflection.isClassAvailable("java.awt.Component") ;
+ ReflectionUtil.isClassAvailable("java.awt.Component") ;
isAWTJOGLAvailable = isAWTAvailable &&
- NWReflection.isClassAvailable("javax.media.nativewindow.awt.AWTGraphicsDevice") && // NativeWindow
- NWReflection.isClassAvailable("javax.media.opengl.awt.GLCanvas") ; // JOGL
+ ReflectionUtil.isClassAvailable("javax.media.nativewindow.awt.AWTGraphicsDevice") && // NativeWindow
+ ReflectionUtil.isClassAvailable("javax.media.opengl.awt.GLCanvas") ; // JOGL
boolean hasDesktopGL = false;
boolean hasDesktopGLES12 = false;
boolean hasNativeOSFactory = false;
-
+ Throwable t;
+
+ //
+ // First iteration of desktop GL availability detection
+ // - native libs exist
+ // - class exists
+ //
+ t=null;
try {
// See DRIHack.java for an explanation of why this is necessary
DRIHack.begin();
- NativeLibLoader.loadGLDesktop();
+ GLJNILibLoader.loadGLDesktop();
DRIHack.end();
hasDesktopGL = true;
- } catch (Throwable t) {
+ } catch (UnsatisfiedLinkError ule) {
+ t=ule;
+ } catch (SecurityException se) {
+ t=se;
+ } catch (NullPointerException npe) {
+ t=npe;
+ } catch (RuntimeException re) {
+ t=re;
+ }
+ if(null!=t) {
if (DEBUG) {
System.err.println("GLProfile.static Desktop GL Library not available");
t.printStackTrace();
}
}
+ t=null;
try {
// See DRIHack.java for an explanation of why this is necessary
DRIHack.begin();
- NativeLibLoader.loadGLDesktopES12();
+ GLJNILibLoader.loadGLDesktopES12();
DRIHack.end();
hasDesktopGLES12 = true;
- } catch (Throwable t) {
+ } catch (UnsatisfiedLinkError ule) {
+ t=ule;
+ } catch (SecurityException se) {
+ t=se;
+ } catch (NullPointerException npe) {
+ t=npe;
+ } catch (RuntimeException re) {
+ t=re;
+ }
+ if(null!=t) {
if (DEBUG) {
- System.err.println("GLProfile.static Desktop GL ES12 Library not available");
+ System.err.println("GLProfile.static Desktop GLES12 Library not available");
t.printStackTrace();
}
}
+
+ hasGL234Impl = hasDesktopGL && ReflectionUtil.isClassAvailable("com.jogamp.opengl.impl.gl4.GL4bcImpl");
+ hasGL4bcImpl = hasGL234Impl;
+ hasGL4Impl = hasGL234Impl;
+ hasGL3bcImpl = hasGL234Impl;
+ hasGL3Impl = hasGL234Impl;
+ hasGL2Impl = hasGL234Impl;
+ hasGL2ES12Impl = hasDesktopGLES12 && ReflectionUtil.isClassAvailable("com.jogamp.opengl.impl.gl2es12.GL2ES12Impl");
+ mappedProfiles = computeProfileMap();
+
+ //
+ // Second iteration of desktop GL availability detection
+ // utilizing the detected GL version in the shared context.
+ //
+ // - Instantiate GLDrawableFactory incl its shared dummy drawable/context,
+ // which will register at GLContext ..
+ //
+
if(hasDesktopGL||hasDesktopGLES12) {
+ // if successfull it has a shared dummy drawable and context created
try {
- hasNativeOSFactory = null!=GLDrawableFactory.getFactoryImpl(GL2);
- } catch (Throwable t) {
- if (DEBUG) {
- System.err.println("GLProfile.static - Native platform GLDrawable factory not available");
- t.printStackTrace();
- }
+ hasNativeOSFactory = null != GLDrawableFactory.getFactoryImpl(GL2);
+ } catch (RuntimeException re) {
+ System.err.println("GLProfile.static - Native platform GLDrawable factory not available");
+ re.printStackTrace();
}
}
- if(!hasNativeOSFactory) {
- hasDesktopGLES12=false;
- hasDesktopGL=false;
+ if(hasNativeOSFactory && !GLContext.mappedVersionsAvailableSet) {
+ // nobody yet set the available desktop versions, see {@link GLContextImpl#makeCurrent},
+ // so we have to add the usual suspect
+ GLContext.mapVersionAvailable(2, true, 1, 5, GLContext.CTX_PROFILE_COMPAT|GLContext.CTX_OPTION_ANY);
}
- // FIXME: check for real GL3 availability .. ?
- hasGL3bcImpl = hasDesktopGL && NWReflection.isClassAvailable("com.sun.opengl.impl.gl3.GL3bcImpl");
- hasGL3Impl = hasDesktopGL && NWReflection.isClassAvailable("com.sun.opengl.impl.gl3.GL3Impl");
- hasGL2Impl = hasDesktopGL && NWReflection.isClassAvailable("com.sun.opengl.impl.gl2.GL2Impl");
-
- hasGL2ES12Impl = hasDesktopGLES12 && NWReflection.isClassAvailable("com.sun.opengl.impl.gl2es12.GL2ES12Impl");
+ if(!hasNativeOSFactory) {
+ hasDesktopGL = false;
+ hasGL234Impl = false;
+ hasGL4bcImpl = false;
+ hasGL4Impl = false;
+ hasGL3bcImpl = false;
+ hasGL3Impl = false;
+ hasGL2ES12Impl = false;
+ hasGL2Impl = false;
+ } else {
+ hasGL4bcImpl = hasGL4bcImpl && GLContext.isGL4bcAvailable();
+ hasGL4Impl = hasGL4Impl && GLContext.isGL4Available();
+ hasGL3bcImpl = hasGL3bcImpl && GLContext.isGL3bcAvailable();
+ hasGL3Impl = hasGL3Impl && GLContext.isGL3Available();
+ hasGL2Impl = hasGL2Impl && GLContext.isGL2Available();
+ hasGL2ES12Impl = hasGL2ES12Impl && GLContext.isGL2Available();
+ }
boolean btest = false;
- boolean hasEGLDynLookup = NWReflection.isClassAvailable("com.sun.opengl.impl.egl.EGLDynamicLookupHelper");
+ boolean hasEGLDynLookup = ReflectionUtil.isClassAvailable("com.jogamp.opengl.impl.egl.EGLDynamicLookupHelper");
boolean hasEGLDrawableFactory = false;
+ t=null;
try {
if(hasEGLDynLookup) {
hasEGLDrawableFactory = null!=GLDrawableFactory.getFactoryImpl(GLES2);
- btest = hasEGLDrawableFactory &&
- NWReflection.isClassAvailable("com.sun.opengl.impl.es2.GLES2Impl") &&
- null!=com.sun.opengl.impl.egl.EGLDynamicLookupHelper.getDynamicLookupHelper(2);
+ try {
+ btest = hasEGLDrawableFactory &&
+ ReflectionUtil.isClassAvailable("com.jogamp.opengl.impl.es2.GLES2Impl") &&
+ null!=com.jogamp.opengl.impl.egl.EGLDynamicLookupHelper.getDynamicLookupHelper(2);
+ } catch (GLException gle) {
+ // n/a ..
+ }
}
- } catch (Throwable t) {
+ } catch (UnsatisfiedLinkError ule) {
+ t=ule;
+ } catch (SecurityException se) {
+ t=se;
+ } catch (NullPointerException npe) {
+ t=npe;
+ } catch (RuntimeException re) {
+ t=re;
+ }
+ if(null!=t) {
if (DEBUG) {
System.err.println("GLProfile.static - GL ES2 Factory/Library not available");
t.printStackTrace();
}
}
hasGLES2Impl = btest;
+ if(hasGLES2Impl) {
+ GLContext.mapVersionAvailable(2, false, 2, 0, GLContext.CTX_PROFILE_ES|GLContext.CTX_PROFILE_CORE|GLContext.CTX_OPTION_ANY);
+ }
btest = false;
- try {
- if(hasEGLDynLookup) {
+ if(hasEGLDynLookup) {
+ try {
btest = hasEGLDrawableFactory &&
- NWReflection.isClassAvailable("com.sun.opengl.impl.es1.GLES1Impl") &&
- null!=com.sun.opengl.impl.egl.EGLDynamicLookupHelper.getDynamicLookupHelper(1);
- }
- } catch (Throwable t) {
- if (DEBUG) {
- System.err.println("GLProfile.static - GL ES1 Factory/Library not available");
- t.printStackTrace();
+ ReflectionUtil.isClassAvailable("com.jogamp.opengl.impl.es1.GLES1Impl") &&
+ null!=com.jogamp.opengl.impl.egl.EGLDynamicLookupHelper.getDynamicLookupHelper(1);
+ } catch (GLException jre) {
+ /* just not available .. */
}
}
hasGLES1Impl = btest;
+ if(hasGLES1Impl) {
+ GLContext.mapVersionAvailable(1, false, 1, 0, GLContext.CTX_PROFILE_ES|GLContext.CTX_PROFILE_CORE|GLContext.CTX_OPTION_ANY);
+ }
+
+ mappedProfiles = computeProfileMap();
+ if(null==defaultGLProfile) {
+ throw new GLException("No profile available: "+list2String(GL_PROFILE_LIST_ALL)+", "+glAvailabilityToString());
+ }
if (DEBUG) {
System.err.println("GLProfile.static isAWTAvailable "+isAWTAvailable);
System.err.println("GLProfile.static isAWTJOGLAvailable "+isAWTJOGLAvailable);
System.err.println("GLProfile.static hasNativeOSFactory "+hasNativeOSFactory);
- System.err.println("GLProfile.static hasDesktopGLES12 "+hasDesktopGLES12);
System.err.println("GLProfile.static hasDesktopGL "+hasDesktopGL);
- System.err.println("GLProfile.static hasGL3bcImpl "+hasGL3bcImpl);
- System.err.println("GLProfile.static hasGL3Impl "+hasGL3Impl);
- System.err.println("GLProfile.static hasGL2Impl "+hasGL2Impl);
- System.err.println("GLProfile.static hasGL2ES12Impl "+hasGL2ES12Impl);
+ System.err.println("GLProfile.static hasDesktopGLES12 "+hasDesktopGLES12);
System.err.println("GLProfile.static hasEGLDynLookup "+hasEGLDynLookup);
System.err.println("GLProfile.static hasEGLDrawableFactory "+hasEGLDrawableFactory);
- System.err.println("GLProfile.static hasGLES2Impl "+hasGLES2Impl);
- System.err.println("GLProfile.static hasGLES1Impl "+hasGLES1Impl);
+ System.err.println("GLProfile.static hasGL234Impl "+hasGL234Impl);
+ System.err.println("GLProfile.static "+glAvailabilityToString());
}
+ }
+ private static final String list2String(String[] list) {
+ StringBuffer msg = new StringBuffer();
+ msg.append("[");
+ for (int i = 0; i < list.length; i++) {
+ if (i > 0)
+ msg.append(", ");
+ msg.append(list[i]);
+ }
+ msg.append("]");
+ return msg.toString();
+ }
+
+ private static HashMap computeProfileMap() {
+ defaultGLProfile=null;
HashMap/*<String, GLProfile>*/ _mappedProfiles = new HashMap(GL_PROFILE_LIST_ALL.length);
for(int i=0; i<GL_PROFILE_LIST_ALL.length; i++) {
String profile = GL_PROFILE_LIST_ALL[i];
@@ -793,22 +1028,7 @@ public class GLProfile implements Cloneable {
}
}
}
- mappedProfiles = _mappedProfiles; // final ..
- if(null==defaultGLProfile) {
- throw new GLException("No profile available: "+list2String(GL_PROFILE_LIST_ALL));
- }
- }
-
- private static final String list2String(String[] list) {
- StringBuffer msg = new StringBuffer();
- msg.append("[");
- for (int i = 0; i < list.length; i++) {
- if (i > 0)
- msg.append(", ");
- msg.append(list[i]);
- }
- msg.append("]");
- return msg.toString();
+ return _mappedProfiles;
}
/**
@@ -820,6 +1040,10 @@ public class GLProfile implements Cloneable {
return GL2ES12;
} else if(hasGL2Impl) {
return GL2;
+ } else if(hasGL3bcImpl) {
+ return GL3bc;
+ } else if(hasGL4bcImpl) {
+ return GL4bc;
} else if(hasGLES1Impl) {
return GLES1;
}
@@ -830,23 +1054,33 @@ public class GLProfile implements Cloneable {
return GL2;
} else if(hasGL3Impl) {
return GL3;
- } else if(hasGL3bcImpl) {
- return GL3bc;
+ } else if(hasGL4Impl) {
+ return GL4;
} else if(hasGLES2Impl) {
return GLES2;
}
- } else if(GL3bc.equals(profile) && hasGL3bcImpl) {
- return GL3bc;
- } else if(GL3.equals(profile)) {
- if(hasGL3Impl) {
- return GL3;
+ } else if(GL2GL3.equals(profile)) {
+ if(hasGL2Impl) {
+ return GL2;
} else if(hasGL3bcImpl) {
return GL3bc;
+ } else if(hasGL4bcImpl) {
+ return GL4bc;
+ } else if(hasGL3Impl) {
+ return GL3;
+ } else if(hasGL4Impl) {
+ return GL4;
}
+ } else if(GL4bc.equals(profile) && hasGL4bcImpl) {
+ return GL4bc;
+ } else if(GL4.equals(profile) && hasGL4Impl) {
+ return GL4;
+ } else if(GL3bc.equals(profile) && hasGL3bcImpl) {
+ return GL3bc;
+ } else if(GL3.equals(profile) && hasGL3Impl) {
+ return GL3;
} else if(GL2.equals(profile) && hasGL2Impl) {
return GL2;
- } else if(GL2GL3.equals(profile) && hasGL2Impl) {
- return GL2;
} else if(GLES2.equals(profile) && hasGLES2Impl) {
return GLES2;
} else if(GLES1.equals(profile) && hasGLES1Impl) {
diff --git a/src/jogl/classes/javax/media/opengl/GLUniformData.java b/src/jogl/classes/javax/media/opengl/GLUniformData.java
index f628ce35a..9b0d5f151 100644
--- a/src/jogl/classes/javax/media/opengl/GLUniformData.java
+++ b/src/jogl/classes/javax/media/opengl/GLUniformData.java
@@ -10,7 +10,6 @@ public class GLUniformData {
*
* Number of objects is 1
*
- * @param components number of elements of one object, ie 4 for GL_FLOAT_VEC4,
*/
public GLUniformData(String name, int val) {
init(name, 1, new Integer(val));
@@ -21,7 +20,6 @@ public class GLUniformData {
*
* Number of objects is 1
*
- * @param components number of elements of one object, ie 4 for GL_FLOAT_VEC4,
*/
public GLUniformData(String name, float val) {
init(name, 1, new Float(val));
diff --git a/src/jogl/classes/javax/media/opengl/Threading.java b/src/jogl/classes/javax/media/opengl/Threading.java
index fecf6c78b..e58792b8f 100755
--- a/src/jogl/classes/javax/media/opengl/Threading.java
+++ b/src/jogl/classes/javax/media/opengl/Threading.java
@@ -39,7 +39,7 @@
package javax.media.opengl;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
/** This API provides access to the threading model for the implementation of
the classes in this package.
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index 038d6d280..53e79b8d9 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -43,7 +43,7 @@ import javax.media.opengl.*;
import javax.media.nativewindow.*;
import javax.media.nativewindow.awt.*;
-import com.sun.opengl.impl.*;
+import com.jogamp.opengl.impl.*;
import java.awt.Canvas;
import java.awt.Color;
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
index e4758211e..e8de00629 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
@@ -41,20 +41,17 @@ package javax.media.opengl.awt;
import javax.media.opengl.*;
import javax.media.nativewindow.*;
-import javax.media.nativewindow.awt.*;
import java.awt.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.beans.*;
-import javax.swing.*;
import java.nio.*;
import java.security.*;
-import javax.swing.JComponent;
import javax.swing.JPanel;
-import com.sun.opengl.util.FBObject;
-import com.sun.opengl.impl.*;
-import com.sun.opengl.impl.awt.*;
+import com.jogamp.opengl.util.FBObject;
+import com.jogamp.opengl.impl.*;
+import com.jogamp.opengl.impl.awt.*;
// FIXME: Subclasses need to call resetGLFunctionAvailability() on their
// context whenever the displayChanged() function is called on their
@@ -497,7 +494,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
backend = new J2DOGLBackend();
} else {
if (!hardwareAccelerationDisabled &&
- factory.canCreateGLPbuffer()) {
+ factory.canCreateGLPbuffer(null)) {
backend = new PbufferBackend();
} else {
if (softwareRenderingDisabled) {
@@ -1429,7 +1426,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
System.err.println("-- Created External Context: "+j2dContext);
}
if (DEBUG) {
- j2dContext.setGL(new DebugGL2(j2dContext.getGL().getGL2()));
+// j2dContext.setGL(new DebugGL2(j2dContext.getGL().getGL2()));
}
// Check to see whether we can support the requested
@@ -1512,7 +1509,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
}
}
if (joglContext == null) {
- if (factory.canCreateExternalGLDrawable()) {
+ AbstractGraphicsDevice device = j2dContext.getGLDrawable().getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration().getScreen().getDevice();
+ if (factory.canCreateExternalGLDrawable(device)) {
joglDrawable = factory.createExternalGLDrawable();
// FIXME: Need to share with j2d context, due to FBO resource ..
// - ORIG: joglContext = joglDrawable.createContext(shareWith);
@@ -1521,7 +1519,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
System.err.println("-- Created External Drawable: "+joglDrawable);
System.err.println("-- Created Context: "+joglContext);
}
- } else if (factory.canCreateContextOnJava2DSurface()) {
+ } else if (factory.canCreateContextOnJava2DSurface(device)) {
// Mac OS X code path
// FIXME: Need to share with j2d context, due to FBO resource ..
// - ORIG: joglContext = factory.createContextOnJava2DSurface(g, shareWith);
diff --git a/src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java b/src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java
index 61757abde..b899f3c0a 100644
--- a/src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java
+++ b/src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java
@@ -6,8 +6,6 @@ package javax.media.opengl.fixedfunc;
import java.nio.*;
-import javax.media.opengl.*;
-
public interface GLMatrixFunc {
public static final int GL_MATRIX_MODE = 0x0BA0;
@@ -56,7 +54,7 @@ public interface GLMatrixFunc {
/**
* glMultMatrixf
- * @param params the FloatBuffer's position remains unchanged,
+ * @param m the FloatBuffer's position remains unchanged,
* which is the same behavior than the native JOGL GL impl
*/
public void glMultMatrixf(java.nio.FloatBuffer m) ;
diff --git a/src/jogl/classes/javax/media/opengl/glu/GLUquadric.java b/src/jogl/classes/javax/media/opengl/glu/GLUquadric.java
index d5a7a11f3..49451a34b 100755
--- a/src/jogl/classes/javax/media/opengl/glu/GLUquadric.java
+++ b/src/jogl/classes/javax/media/opengl/glu/GLUquadric.java
@@ -1,7 +1,7 @@
package javax.media.opengl.glu;
import javax.media.opengl.GL;
-import com.sun.opengl.util.ImmModeSink;
+import com.jogamp.opengl.util.ImmModeSink;
/**
* Wrapper for a GLU quadric object.
diff --git a/src/jogl/classes/javax/media/opengl/glu/GLUtessellator.java b/src/jogl/classes/javax/media/opengl/glu/GLUtessellator.java
index cb7bd9d76..f98bbe158 100755
--- a/src/jogl/classes/javax/media/opengl/glu/GLUtessellator.java
+++ b/src/jogl/classes/javax/media/opengl/glu/GLUtessellator.java
@@ -6,7 +6,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
diff --git a/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallback.java b/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallback.java
index 4b5ec63b7..72ad68ceb 100755
--- a/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallback.java
+++ b/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallback.java
@@ -6,7 +6,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -352,5 +352,5 @@ public interface GLUtessellatorCallback {
*/
public void errorData(int errnum, Object polygonData);
- //void mesh(com.sun.opengl.impl.tessellator.GLUmesh mesh);
+ //void mesh(com.jogamp.opengl.impl.tessellator.GLUmesh mesh);
}
diff --git a/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java b/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java
index bf6f2d29a..f380f4698 100755
--- a/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java
+++ b/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java
@@ -6,7 +6,7 @@
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
+** Software License B, Version 2.0 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
@@ -68,7 +68,7 @@ public class GLUtessellatorCallbackAdapter implements GLUtessellatorCallback {
public void edgeFlag(boolean boundaryEdge) {}
public void vertex(Object vertexData) {}
public void end() {}
-// public void mesh(com.sun.opengl.impl.tessellator.GLUmesh mesh) {}
+// public void mesh(com.jogamp.opengl.impl.tessellator.GLUmesh mesh) {}
public void error(int errnum) {}
public void combine(double[] coords, Object[] data,
float[] weight, Object[] outData) {}
diff --git a/src/jogl/native/audio/Mixer.cpp b/src/jogl/native/audio/Mixer.cpp
index 8843c00ec..9fa5b61bc 100755
--- a/src/jogl/native/audio/Mixer.cpp
+++ b/src/jogl/native/audio/Mixer.cpp
@@ -2,7 +2,7 @@
#include <stdlib.h>
#include <mmsystem.h>
#include <mmreg.h>
-#include "com_sun_javafx_audio_windows_waveout_Mixer.h"
+#include "com_jogamp_audio_windows_waveout_Mixer.h"
static HANDLE event = NULL;
static HWAVEOUT output = NULL;
@@ -57,7 +57,7 @@ void CALLBACK playbackCallback(HWAVEOUT output,
}
}
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_initializeWaveOut
+JNIEXPORT jboolean JNICALL Java_com_jogamp_audio_windows_waveout_Mixer_initializeWaveOut
(JNIEnv *env, jclass unused, jlong eventObject)
{
event = (HANDLE) eventObject;
@@ -98,7 +98,7 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_initi
return JNI_TRUE;
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_shutdownWaveOut
+JNIEXPORT void JNICALL Java_com_jogamp_audio_windows_waveout_Mixer_shutdownWaveOut
(JNIEnv *env, jclass unused)
{
// writeString("Pausing\n");
@@ -109,7 +109,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_shutdownW
waveOutClose(output);
}
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_getNextMixerBuffer
+JNIEXPORT jlong JNICALL Java_com_jogamp_audio_windows_waveout_Mixer_getNextMixerBuffer
(JNIEnv *env, jclass unused)
{
WAVEHDR* hdr = NULL;
@@ -123,28 +123,28 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_getNextM
return (jlong) hdr;
}
-JNIEXPORT jobject JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_getMixerBufferData
+JNIEXPORT jobject JNICALL Java_com_jogamp_audio_windows_waveout_Mixer_getMixerBufferData
(JNIEnv *env, jclass unused, jlong mixerBuffer)
{
WAVEHDR* hdr = (WAVEHDR*) mixerBuffer;
return env->NewDirectByteBuffer(hdr->lpData, hdr->dwBufferLength);
}
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_getMixerBufferDataAddress
+JNIEXPORT jlong JNICALL Java_com_jogamp_audio_windows_waveout_Mixer_getMixerBufferDataAddress
(JNIEnv *env, jclass unused, jlong mixerBuffer)
{
WAVEHDR* hdr = (WAVEHDR*) mixerBuffer;
return (jlong) hdr->lpData;
}
-JNIEXPORT jint JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_getMixerBufferDataCapacity
+JNIEXPORT jint JNICALL Java_com_jogamp_audio_windows_waveout_Mixer_getMixerBufferDataCapacity
(JNIEnv *env, jclass unused, jlong mixerBuffer)
{
WAVEHDR* hdr = (WAVEHDR*) mixerBuffer;
return (jint) hdr->dwBufferLength;
}
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_prepareMixerBuffer
+JNIEXPORT jboolean JNICALL Java_com_jogamp_audio_windows_waveout_Mixer_prepareMixerBuffer
(JNIEnv *env, jclass unused, jlong mixerBuffer)
{
MMRESULT res = waveOutPrepareHeader(output,
@@ -156,7 +156,7 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_prepa
return JNI_FALSE;
}
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_writeMixerBuffer
+JNIEXPORT jboolean JNICALL Java_com_jogamp_audio_windows_waveout_Mixer_writeMixerBuffer
(JNIEnv *env, jclass unused, jlong mixerBuffer)
{
MMRESULT res = waveOutWrite(output,
@@ -170,13 +170,13 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_write
return JNI_FALSE;
}
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_CreateEvent
+JNIEXPORT jlong JNICALL Java_com_jogamp_audio_windows_waveout_Mixer_CreateEvent
(JNIEnv *env, jclass unused)
{
return (jlong) CreateEvent(NULL, FALSE, TRUE, NULL);
}
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_WaitForSingleObject
+JNIEXPORT jboolean JNICALL Java_com_jogamp_audio_windows_waveout_Mixer_WaitForSingleObject
(JNIEnv *env, jclass unused, jlong eventObject)
{
DWORD res = WaitForSingleObject((HANDLE) eventObject, INFINITE);
@@ -186,13 +186,13 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_WaitF
return JNI_FALSE;
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_SetEvent
+JNIEXPORT void JNICALL Java_com_jogamp_audio_windows_waveout_Mixer_SetEvent
(JNIEnv *env, jclass unused, jlong eventObject)
{
SetEvent((HANDLE) eventObject);
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_CloseHandle
+JNIEXPORT void JNICALL Java_com_jogamp_audio_windows_waveout_Mixer_CloseHandle
(JNIEnv *env, jclass unused, jlong eventObject)
{
CloseHandle((HANDLE) eventObject);
diff --git a/src/jogl/native/openmax/com_sun_openmax_OMXInstance.c b/src/jogl/native/openmax/com_sun_openmax_OMXInstance.c
index c763b0dd6..5317c2abc 100644
--- a/src/jogl/native/openmax/com_sun_openmax_OMXInstance.c
+++ b/src/jogl/native/openmax/com_sun_openmax_OMXInstance.c
@@ -1,5 +1,5 @@
/*
- * javafx_media_video_Movie.c
+ * media_video_Movie.c
* JFXFramework
*
* Created by sun on 17/02/08.
@@ -13,7 +13,7 @@
// http://developer.apple.com/qa/qa2001/qa1149.html
// http://developer.apple.com/qa/qa2001/qa1262.html
-#include "com_sun_openmax_OMXInstance.h"
+#include "com_jogamp_openmax_OMXInstance.h"
#include "omx_tool.h"
#include <stdarg.h>
@@ -21,8 +21,8 @@ static const char * const ClazzNameRuntimeException =
"java/lang/RuntimeException";
static jclass runtimeExceptionClz=NULL;
#ifdef _WIN32_WCE
- #define STDOUT_FILE "\\Storage Card\\javafx_demos\\stdout.txt"
- #define STDERR_FILE "\\Storage Card\\javafx_demos\\stderr.txt"
+ #define STDOUT_FILE "\\Storage Card\\demos\\stdout.txt"
+ #define STDERR_FILE "\\Storage Card\\demos\\stderr.txt"
#endif
static void _initStatics(JNIEnv *env)
@@ -105,7 +105,7 @@ void OMXInstance_UpdateJavaAttributes(OMXToolBasicAV_t *pOMXAV, KDboolean issueJ
}
}
-JNIEXPORT jlong JNICALL Java_com_sun_openmax_OMXInstance__1createInstance
+JNIEXPORT jlong JNICALL Java_com_jogamp_openmax_OMXInstance__1createInstance
(JNIEnv *env, jobject instance)
{
OMXToolBasicAV_t * pOMXAV;
@@ -132,7 +132,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_openmax_OMXInstance__1createInstance
return (jlong) (intptr_t) (void *)pOMXAV;
}
-JNIEXPORT void JNICALL Java_com_sun_openmax_OMXInstance__1setStream
+JNIEXPORT void JNICALL Java_com_jogamp_openmax_OMXInstance__1setStream
(JNIEnv *env, jobject instance, jlong ptr, jint vBufferNum, jstring jpath)
{
jboolean iscopy;
@@ -150,7 +150,7 @@ JNIEXPORT void JNICALL Java_com_sun_openmax_OMXInstance__1setStream
fprintf(stdout, "setStream 3 ..\n"); fflush(stdout); // JAU
}
-JNIEXPORT void JNICALL Java_com_sun_openmax_OMXInstance__1setStreamEGLImageTexture2D
+JNIEXPORT void JNICALL Java_com_jogamp_openmax_OMXInstance__1setStreamEGLImageTexture2D
(JNIEnv *env, jobject instance, jlong ptr, jint i, jint tex, jlong image, jlong sync)
{
OMXToolBasicAV_t *pOMXAV = (OMXToolBasicAV_t *)((void *)((intptr_t)ptr));
@@ -161,7 +161,7 @@ JNIEXPORT void JNICALL Java_com_sun_openmax_OMXInstance__1setStreamEGLImageTextu
}
}
-JNIEXPORT void JNICALL Java_com_sun_openmax_OMXInstance__1activateStream
+JNIEXPORT void JNICALL Java_com_jogamp_openmax_OMXInstance__1activateStream
(JNIEnv *env, jobject instance, jlong ptr)
{
OMXToolBasicAV_t *pOMXAV = (OMXToolBasicAV_t *)((void *)((intptr_t)ptr));
@@ -171,28 +171,28 @@ JNIEXPORT void JNICALL Java_com_sun_openmax_OMXInstance__1activateStream
}
}
-JNIEXPORT void JNICALL Java_com_sun_openmax_OMXInstance__1attachVideoRenderer
+JNIEXPORT void JNICALL Java_com_jogamp_openmax_OMXInstance__1attachVideoRenderer
(JNIEnv *env, jobject instance, jlong ptr)
{
OMXToolBasicAV_t *pOMXAV = (OMXToolBasicAV_t *)((void *)((intptr_t)ptr));
OMXToolBasicAV_AttachVideoRenderer(pOMXAV);
}
-JNIEXPORT void JNICALL Java_com_sun_openmax_OMXInstance__1detachVideoRenderer
+JNIEXPORT void JNICALL Java_com_jogamp_openmax_OMXInstance__1detachVideoRenderer
(JNIEnv *env, jobject instance, jlong ptr)
{
OMXToolBasicAV_t *pOMXAV = (OMXToolBasicAV_t *)((void *)((intptr_t)ptr));
OMXToolBasicAV_DetachVideoRenderer(pOMXAV);
}
-JNIEXPORT void JNICALL Java_com_sun_openmax_OMXInstance__1setPlaySpeed
+JNIEXPORT void JNICALL Java_com_jogamp_openmax_OMXInstance__1setPlaySpeed
(JNIEnv *env, jobject instance, jlong ptr, jfloat scale)
{
OMXToolBasicAV_t *pOMXAV = (OMXToolBasicAV_t *)((void *)((intptr_t)ptr));
OMXToolBasicAV_SetPlaySpeed(pOMXAV, scale);
}
-JNIEXPORT jfloat JNICALL Java_com_sun_openmax_OMXInstance__1play
+JNIEXPORT jfloat JNICALL Java_com_jogamp_openmax_OMXInstance__1play
(JNIEnv *env, jobject instance, jlong ptr)
{
OMXToolBasicAV_t *pOMXAV = (OMXToolBasicAV_t *)((void *)((intptr_t)ptr));
@@ -200,7 +200,7 @@ JNIEXPORT jfloat JNICALL Java_com_sun_openmax_OMXInstance__1play
return OMXToolBasicAV_GetCurrentPosition(pOMXAV);
}
-JNIEXPORT jfloat JNICALL Java_com_sun_openmax_OMXInstance__1pause
+JNIEXPORT jfloat JNICALL Java_com_jogamp_openmax_OMXInstance__1pause
(JNIEnv *env, jobject instance, jlong ptr)
{
OMXToolBasicAV_t *pOMXAV = (OMXToolBasicAV_t *)((void *)((intptr_t)ptr));
@@ -208,7 +208,7 @@ JNIEXPORT jfloat JNICALL Java_com_sun_openmax_OMXInstance__1pause
return OMXToolBasicAV_GetCurrentPosition(pOMXAV);
}
-JNIEXPORT jfloat JNICALL Java_com_sun_openmax_OMXInstance__1stop
+JNIEXPORT jfloat JNICALL Java_com_jogamp_openmax_OMXInstance__1stop
(JNIEnv *env, jobject instance, jlong ptr)
{
OMXToolBasicAV_t *pOMXAV = (OMXToolBasicAV_t *)((void *)((intptr_t)ptr));
@@ -216,7 +216,7 @@ JNIEXPORT jfloat JNICALL Java_com_sun_openmax_OMXInstance__1stop
return OMXToolBasicAV_GetCurrentPosition(pOMXAV);
}
-JNIEXPORT jfloat JNICALL Java_com_sun_openmax_OMXInstance__1seek
+JNIEXPORT jfloat JNICALL Java_com_jogamp_openmax_OMXInstance__1seek
(JNIEnv *env, jobject instance, jlong ptr, jfloat pos)
{
OMXToolBasicAV_t *pOMXAV = (OMXToolBasicAV_t *)((void *)((intptr_t)ptr));
@@ -224,7 +224,7 @@ JNIEXPORT jfloat JNICALL Java_com_sun_openmax_OMXInstance__1seek
return OMXToolBasicAV_GetCurrentPosition(pOMXAV);
}
-JNIEXPORT jint JNICALL Java_com_sun_openmax_OMXInstance__1getNextTextureID
+JNIEXPORT jint JNICALL Java_com_jogamp_openmax_OMXInstance__1getNextTextureID
(JNIEnv *env, jobject instance, jlong ptr)
{
jint textureID = 0xffffffff;
@@ -235,7 +235,7 @@ JNIEXPORT jint JNICALL Java_com_sun_openmax_OMXInstance__1getNextTextureID
return textureID;
}
-JNIEXPORT jfloat JNICALL Java_com_sun_openmax_OMXInstance__1getCurrentPosition
+JNIEXPORT jfloat JNICALL Java_com_jogamp_openmax_OMXInstance__1getCurrentPosition
(JNIEnv *env, jobject instance, jlong ptr)
{
OMXToolBasicAV_t *pOMXAV = (OMXToolBasicAV_t *)((void *)((intptr_t)ptr));
@@ -243,7 +243,7 @@ JNIEXPORT jfloat JNICALL Java_com_sun_openmax_OMXInstance__1getCurrentPosition
}
-JNIEXPORT void JNICALL Java_com_sun_openmax_OMXInstance__1destroyInstance
+JNIEXPORT void JNICALL Java_com_jogamp_openmax_OMXInstance__1destroyInstance
(JNIEnv *env, jobject instance, jlong ptr)
{
OMXToolBasicAV_t *pOMXAV = (OMXToolBasicAV_t *)((void *)((intptr_t)ptr));
diff --git a/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01CORE.java b/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01CORE.java
new file mode 100755
index 000000000..a1ff0d860
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01CORE.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. 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 Sven Gothel 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
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.jogamp.test.junit.jogl.acore;
+
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.AfterClass;
+import org.junit.Test;
+
+import javax.media.opengl.*;
+
+import com.jogamp.newt.*;
+import java.io.IOException;
+
+public class TestGLProfile01CORE {
+ static GLProfile glp;
+ static GLDrawableFactory factory;
+
+ @BeforeClass
+ public static void initClass() {
+ glp = GLProfile.getDefault();
+ Assert.assertNotNull(glp);
+ factory = GLDrawableFactory.getFactory(glp);
+ Assert.assertNotNull(factory);
+ }
+
+ @AfterClass
+ public static void releaseClass() {
+ factory.shutdown();
+ factory=null;
+ }
+
+ @Test
+ public void test01GLProfileDefault() {
+ System.out.println("GLProfile <static> "+GLProfile.glAvailabilityToString());
+ }
+
+ @Test
+ public void test02GLProfileMaxFixedFunc() {
+ System.out.println("GLProfile <static> getMaxFixedFunc(): "+GLProfile.getMaxFixedFunc());
+ }
+
+ @Test
+ public void test02GLProfileMaxProgrammable() {
+ System.out.println("GLProfile <static> getMaxProgrammable(): "+GLProfile.getMaxProgrammable());
+ }
+
+ public static void main(String args[]) throws IOException {
+ String tstname = TestGLProfile01CORE.class.getName();
+ org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
+ tstname,
+ "filtertrace=true",
+ "haltOnError=false",
+ "haltOnFailure=false",
+ "showoutput=true",
+ "outputtoformatters=true",
+ "logfailedtests=true",
+ "logtestlistenerevents=true",
+ "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter",
+ "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } );
+ }
+
+}
diff --git a/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java
new file mode 100755
index 000000000..ac34b46b5
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. 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 Sven Gothel 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
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.jogamp.test.junit.jogl.awt;
+
+import javax.media.opengl.GLProfile;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.awt.GLCanvas;
+import com.jogamp.opengl.util.Animator;
+
+import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
+import java.awt.Frame;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.Test;
+
+public class TestAWT01GLn {
+ Frame frame=null;
+ GLCanvas glCanvas=null;
+
+ @Before
+ public void init() {
+ frame = new Frame("Texture Test");
+ Assert.assertNotNull(frame);
+ }
+
+ @After
+ public void release() {
+ Assert.assertNotNull(frame);
+ Assert.assertNotNull(glCanvas);
+ frame.setVisible(false);
+ frame.remove(glCanvas);
+ frame.dispose();
+ frame=null;
+ glCanvas=null;
+ }
+
+ protected void runTestGL(GLCapabilities caps) throws InterruptedException {
+ glCanvas = new GLCanvas(caps);
+ Assert.assertNotNull(glCanvas);
+ frame.add(glCanvas);
+ frame.setSize(512, 512);
+
+ glCanvas.addGLEventListener(new Gears());
+
+ Animator animator = new Animator(glCanvas);
+ frame.setVisible(true);
+ animator.start();
+
+ Thread.sleep(500); // 500 ms
+
+ animator.stop();
+ }
+
+ @Test
+ public void test01GLDefault() throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+ runTestGL(caps);
+ }
+
+ /** Both fail on ATI .. if GLn n>2
+ public void test02GL3bc() throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL3bc));
+ runTestGL(caps);
+ }
+
+ public void test03GLMaxFixed() throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(GLProfile.getMaxFixedFunc());
+ runTestGL(caps);
+ } */
+
+ public static void main(String args[]) {
+ org.junit.runner.JUnitCore.main(TestAWT01GLn.class.getName());
+ }
+}
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/es1/RedSquare.java b/src/junit/com/jogamp/test/junit/jogl/demos/es1/RedSquare.java
new file mode 100755
index 000000000..9b8982ed4
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/es1/RedSquare.java
@@ -0,0 +1,170 @@
+package com.jogamp.test.junit.jogl.demos.es1;
+
+import com.jogamp.common.nio.Buffers;
+import java.nio.*;
+import java.util.*;
+import javax.media.opengl.*;
+import javax.media.opengl.glu.*;
+import javax.media.nativewindow.*;
+
+import com.jogamp.opengl.util.*;
+import com.jogamp.opengl.util.glsl.fixedfunc.*;
+
+public class RedSquare implements GLEventListener {
+
+ public static boolean glDebugEmu = false;
+ public static boolean glDebug = false ;
+ public static boolean glTrace = false ;
+ public static boolean oneThread = false;
+ public static boolean useAnimator = false;
+ public static int swapInterval = -1;
+
+ boolean debug = false;
+ long startTime = 0;
+ long curTime = 0;
+
+ GLU glu = null;
+
+ public RedSquare() {
+ this(false);
+ }
+
+ public RedSquare(boolean debug) {
+ this.debug = debug;
+ }
+
+ // FIXME: we must add storage of the pointers in the GL state to
+ // the GLImpl classes. The need for this can be seen by making
+ // these variables method local instead of instance members. The
+ // square will disappear after a second or so due to garbage
+ // collection. On desktop OpenGL this implies a stack of
+ // references due to the existence of glPush/PopClientAttrib. On
+ // OpenGL ES 1/2 it can simply be one set of references.
+ private FloatBuffer colors;
+ private FloatBuffer vertices;
+
+ public void init(GLAutoDrawable drawable) {
+ GL _gl = drawable.getGL();
+
+ if(glDebugEmu) {
+ try {
+ // Debug ..
+ _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES2.class, _gl, null) );
+
+ if(glTrace) {
+ // Trace ..
+ _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES2.class, _gl, new Object[] { System.err } ) );
+ }
+ } catch (Exception e) {e.printStackTrace();}
+ glDebug = false;
+ glTrace = false;
+ }
+
+ GL2ES1 gl = FixedFuncUtil.getFixedFuncImpl(_gl);
+ if(swapInterval>=0) {
+ gl.setSwapInterval(swapInterval);
+ }
+
+ if(glDebug) {
+ try {
+ // Debug ..
+ gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES1.class, gl, null) );
+ } catch (Exception e) {e.printStackTrace();}
+ }
+
+ if(glTrace) {
+ try {
+ // Trace ..
+ gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES1.class, gl, new Object[] { System.err } ) );
+ } catch (Exception e) {e.printStackTrace();}
+ }
+
+ glu = GLU.createGLU(gl);
+
+ if(debug) {
+ System.err.println(Thread.currentThread()+" Entering initialization");
+ System.err.println(Thread.currentThread()+" GL Profile: "+gl.getGLProfile());
+ System.err.println(Thread.currentThread()+" GL:" + gl);
+ System.err.println(Thread.currentThread()+" GL_VERSION=" + gl.glGetString(gl.GL_VERSION));
+ System.err.println(Thread.currentThread()+" GL_EXTENSIONS:");
+ System.err.println(Thread.currentThread()+" " + gl.glGetString(gl.GL_EXTENSIONS));
+ System.err.println(Thread.currentThread()+" swapInterval: " + swapInterval + " (GL: "+gl.getSwapInterval()+")");
+ System.err.println(Thread.currentThread()+" GLU: " + glu);
+ }
+
+ // Allocate vertex arrays
+ colors = Buffers.newDirectFloatBuffer(16);
+ vertices = Buffers.newDirectFloatBuffer(12);
+ // Fill them up
+ colors.put( 0, 1); colors.put( 1, 0); colors.put( 2, 0); colors.put( 3, 1);
+ colors.put( 4, 0); colors.put( 5, 0); colors.put( 6, 1); colors.put( 7, 1);
+ colors.put( 8, 1); colors.put( 9, 0); colors.put(10, 0); colors.put(11, 1);
+ colors.put(12, 1); colors.put(13, 0); colors.put(14, 0); colors.put(15, 1);
+ vertices.put(0, -2); vertices.put( 1, 2); vertices.put( 2, 0);
+ vertices.put(3, 2); vertices.put( 4, 2); vertices.put( 5, 0);
+ vertices.put(6, -2); vertices.put( 7, -2); vertices.put( 8, 0);
+ vertices.put(9, 2); vertices.put(10, -2); vertices.put(11, 0);
+
+ gl.glEnableClientState(gl.GL_VERTEX_ARRAY);
+ gl.glEnableClientState(gl.GL_COLOR_ARRAY);
+ gl.glVertexPointer(3, GL.GL_FLOAT, 0, vertices);
+ 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();
+ curTime = startTime;
+ }
+
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ GL2ES1 gl = drawable.getGL().getGL2ES1();
+ // Set location in front of camera
+ gl.glMatrixMode(gl.GL_PROJECTION);
+ gl.glLoadIdentity();
+ glu.gluPerspective(45.0f, (float)width / (float)height, 1.0f, 100.0f);
+ //gl.glOrthof(-4.0f, 4.0f, -4.0f, 4.0f, 1.0f, 100.0f);
+ //glu.gluLookAt(0, 0, -20, 0, 0, 0, 0, 1, 0);
+ }
+
+ public void display(GLAutoDrawable drawable) {
+ curTime = System.currentTimeMillis();
+ GL2ES1 gl = drawable.getGL().getGL2ES1();
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
+
+ // One rotation every four seconds
+ gl.glMatrixMode(gl.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);
+
+
+ // Draw a square
+ gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4);
+ }
+
+ public void dispose(GLAutoDrawable drawable) {
+ GL2ES1 gl = drawable.getGL().getGL2ES1();
+ if(debug) {
+ System.out.println(Thread.currentThread()+" RedSquare.dispose: "+gl.getContext());
+ }
+ gl.glDisableClientState(gl.GL_VERTEX_ARRAY);
+ gl.glDisableClientState(gl.GL_COLOR_ARRAY);
+ glu.destroy();
+ glu = null;
+ colors.clear();
+ colors = null;
+ vertices.clear();
+ vertices = null;
+ if(debug) {
+ System.out.println(Thread.currentThread()+" RedSquare.dispose: FIN");
+ }
+ }
+
+ public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
+ }
+
+}
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java
new file mode 100644
index 000000000..135efd341
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java
@@ -0,0 +1,306 @@
+
+package com.jogamp.test.junit.jogl.demos.gl2.gears;
+
+import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
+import javax.media.opengl.GL2;
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLEventListener;
+
+/**
+ * Gears.java <BR>
+ * author: Brian Paul (converted to Java by Ron Cemer and Sven Goethel) <P>
+ *
+ * This version is equal to Brian Paul's version 1.2 1999/10/21
+ */
+
+public class Gears implements GLEventListener /* , MouseListener, MouseMotionListener */ {
+ private float view_rotx = 20.0f, view_roty = 30.0f, view_rotz = 0.0f;
+ private int gear1, gear2, gear3;
+ private float angle = 0.0f;
+
+ private int prevMouseX, prevMouseY;
+ private boolean mouseRButtonDown = false;
+
+ public void init(GLAutoDrawable drawable) {
+ // Use debug pipeline
+ // drawable.setGL(new DebugGL(drawable.getGL()));
+
+ GL2 gl = drawable.getGL().getGL2();
+
+ System.err.println("INIT GL IS: " + gl.getClass().getName());
+
+ System.err.println("Chosen GLCapabilities: " + drawable.getChosenGLCapabilities());
+
+ gl.setSwapInterval(1);
+
+ float pos[] = { 5.0f, 5.0f, 10.0f, 0.0f };
+ float red[] = { 0.8f, 0.1f, 0.0f, 1.0f };
+ float green[] = { 0.0f, 0.8f, 0.2f, 1.0f };
+ float blue[] = { 0.2f, 0.2f, 1.0f, 1.0f };
+
+ gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, pos, 0);
+ gl.glEnable(GL2.GL_CULL_FACE);
+ gl.glEnable(GL2.GL_LIGHTING);
+ gl.glEnable(GL2.GL_LIGHT0);
+ gl.glEnable(GL2.GL_DEPTH_TEST);
+
+ /* make the gears */
+ gear1 = gl.glGenLists(1);
+ gl.glNewList(gear1, GL2.GL_COMPILE);
+ gl.glMaterialfv(GL2.GL_FRONT, GL2.GL_AMBIENT_AND_DIFFUSE, red, 0);
+ gear(gl, 1.0f, 4.0f, 1.0f, 20, 0.7f);
+ gl.glEndList();
+
+ gear2 = gl.glGenLists(1);
+ gl.glNewList(gear2, GL2.GL_COMPILE);
+ gl.glMaterialfv(GL2.GL_FRONT, GL2.GL_AMBIENT_AND_DIFFUSE, green, 0);
+ gear(gl, 0.5f, 2.0f, 2.0f, 10, 0.7f);
+ gl.glEndList();
+
+ gear3 = gl.glGenLists(1);
+ gl.glNewList(gear3, GL2.GL_COMPILE);
+ gl.glMaterialfv(GL2.GL_FRONT, GL2.GL_AMBIENT_AND_DIFFUSE, blue, 0);
+ gear(gl, 1.3f, 2.0f, 0.5f, 10, 0.7f);
+ gl.glEndList();
+
+ gl.glEnable(GL2.GL_NORMALIZE);
+
+ /**
+ if (drawable instanceof AWTGLAutoDrawable) {
+ AWTGLAutoDrawable awtDrawable = (AWTGLAutoDrawable) drawable;
+ awtDrawable.addMouseListener(this);
+ awtDrawable.addMouseMotionListener(this);
+ } */
+ }
+
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ GL2 gl = drawable.getGL().getGL2();
+
+ float h = (float)height / (float)width;
+
+ gl.glMatrixMode(GL2.GL_PROJECTION);
+
+ System.err.println("GL_VENDOR: " + gl.glGetString(GL2.GL_VENDOR));
+ System.err.println("GL_RENDERER: " + gl.glGetString(GL2.GL_RENDERER));
+ System.err.println("GL_VERSION: " + gl.glGetString(GL2.GL_VERSION));
+ gl.glLoadIdentity();
+ gl.glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f);
+ gl.glMatrixMode(GL2.GL_MODELVIEW);
+ gl.glLoadIdentity();
+ gl.glTranslatef(0.0f, 0.0f, -40.0f);
+ }
+
+ public void dispose(GLAutoDrawable drawable) {
+ System.out.println("Gears.dispose: "+drawable);
+ }
+
+ 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();
+
+ /**
+ // Special handling for the case where the GLJPanel is translucent
+ // and wants to be composited with other Java 2D content
+ if ((drawable instanceof GLJPanel) &&
+ !((GLJPanel) drawable).isOpaque() &&
+ ((GLJPanel) drawable).shouldPreserveColorBufferIfTranslucent()) {
+ gl.glClear(GL2.GL_DEPTH_BUFFER_BIT);
+ } else */ {
+ gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
+ }
+
+ // 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);
+
+ // Place the first gear and call its display list
+ gl.glPushMatrix();
+ gl.glTranslatef(-3.0f, -2.0f, 0.0f);
+ gl.glRotatef(angle, 0.0f, 0.0f, 1.0f);
+ gl.glCallList(gear1);
+ gl.glPopMatrix();
+
+ // Place the second gear and call its display list
+ gl.glPushMatrix();
+ gl.glTranslatef(3.1f, -2.0f, 0.0f);
+ gl.glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f);
+ gl.glCallList(gear2);
+ gl.glPopMatrix();
+
+ // Place the third gear and call its display list
+ gl.glPushMatrix();
+ gl.glTranslatef(-3.1f, 4.2f, 0.0f);
+ gl.glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f);
+ gl.glCallList(gear3);
+ gl.glPopMatrix();
+
+ // Remember that every push needs a pop; this one is paired with
+ // rotating the entire gear assembly
+ gl.glPopMatrix();
+ }
+
+ public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {}
+
+ public static void gear(GL2 gl,
+ float inner_radius,
+ float outer_radius,
+ float width,
+ int teeth,
+ float tooth_depth)
+ {
+ int i;
+ float r0, r1, r2;
+ float angle, da;
+ float u, v, len;
+
+ r0 = inner_radius;
+ r1 = outer_radius - tooth_depth / 2.0f;
+ r2 = outer_radius + tooth_depth / 2.0f;
+
+ da = 2.0f * (float) Math.PI / teeth / 4.0f;
+
+ gl.glShadeModel(GL2.GL_FLAT);
+
+ gl.glNormal3f(0.0f, 0.0f, 1.0f);
+
+ /* draw front face */
+ gl.glBegin(GL2.GL_QUAD_STRIP);
+ for (i = 0; i <= teeth; i++)
+ {
+ angle = i * 2.0f * (float) Math.PI / teeth;
+ gl.glVertex3f(r0 * (float)Math.cos(angle), r0 * (float)Math.sin(angle), width * 0.5f);
+ gl.glVertex3f(r1 * (float)Math.cos(angle), r1 * (float)Math.sin(angle), width * 0.5f);
+ if(i < teeth)
+ {
+ gl.glVertex3f(r0 * (float)Math.cos(angle), r0 * (float)Math.sin(angle), width * 0.5f);
+ gl.glVertex3f(r1 * (float)Math.cos(angle + 3.0f * da), r1 * (float)Math.sin(angle + 3.0f * da), width * 0.5f);
+ }
+ }
+ gl.glEnd();
+
+ /* draw front sides of teeth */
+ gl.glBegin(GL2.GL_QUADS);
+ for (i = 0; i < teeth; i++)
+ {
+ angle = i * 2.0f * (float) Math.PI / teeth;
+ gl.glVertex3f(r1 * (float)Math.cos(angle), r1 * (float)Math.sin(angle), width * 0.5f);
+ gl.glVertex3f(r2 * (float)Math.cos(angle + da), r2 * (float)Math.sin(angle + da), width * 0.5f);
+ gl.glVertex3f(r2 * (float)Math.cos(angle + 2.0f * da), r2 * (float)Math.sin(angle + 2.0f * da), width * 0.5f);
+ gl.glVertex3f(r1 * (float)Math.cos(angle + 3.0f * da), r1 * (float)Math.sin(angle + 3.0f * da), width * 0.5f);
+ }
+ gl.glEnd();
+
+ /* draw back face */
+ gl.glBegin(GL2.GL_QUAD_STRIP);
+ for (i = 0; i <= teeth; i++)
+ {
+ angle = i * 2.0f * (float) Math.PI / teeth;
+ gl.glVertex3f(r1 * (float)Math.cos(angle), r1 * (float)Math.sin(angle), -width * 0.5f);
+ gl.glVertex3f(r0 * (float)Math.cos(angle), r0 * (float)Math.sin(angle), -width * 0.5f);
+ gl.glVertex3f(r1 * (float)Math.cos(angle + 3 * da), r1 * (float)Math.sin(angle + 3 * da), -width * 0.5f);
+ gl.glVertex3f(r0 * (float)Math.cos(angle), r0 * (float)Math.sin(angle), -width * 0.5f);
+ }
+ gl.glEnd();
+
+ /* draw back sides of teeth */
+ gl.glBegin(GL2.GL_QUADS);
+ for (i = 0; i < teeth; i++)
+ {
+ angle = i * 2.0f * (float) Math.PI / teeth;
+ gl.glVertex3f(r1 * (float)Math.cos(angle + 3 * da), r1 * (float)Math.sin(angle + 3 * da), -width * 0.5f);
+ gl.glVertex3f(r2 * (float)Math.cos(angle + 2 * da), r2 * (float)Math.sin(angle + 2 * da), -width * 0.5f);
+ gl.glVertex3f(r2 * (float)Math.cos(angle + da), r2 * (float)Math.sin(angle + da), -width * 0.5f);
+ gl.glVertex3f(r1 * (float)Math.cos(angle), r1 * (float)Math.sin(angle), -width * 0.5f);
+ }
+ gl.glEnd();
+
+ /* draw outward faces of teeth */
+ gl.glBegin(GL2.GL_QUAD_STRIP);
+ for (i = 0; i < teeth; i++)
+ {
+ angle = i * 2.0f * (float) Math.PI / teeth;
+ gl.glVertex3f(r1 * (float)Math.cos(angle), r1 * (float)Math.sin(angle), width * 0.5f);
+ gl.glVertex3f(r1 * (float)Math.cos(angle), r1 * (float)Math.sin(angle), -width * 0.5f);
+ u = r2 * (float)Math.cos(angle + da) - r1 * (float)Math.cos(angle);
+ v = r2 * (float)Math.sin(angle + da) - r1 * (float)Math.sin(angle);
+ len = (float)Math.sqrt(u * u + v * v);
+ u /= len;
+ v /= len;
+ gl.glNormal3f(v, -u, 0.0f);
+ gl.glVertex3f(r2 * (float)Math.cos(angle + da), r2 * (float)Math.sin(angle + da), width * 0.5f);
+ gl.glVertex3f(r2 * (float)Math.cos(angle + da), r2 * (float)Math.sin(angle + da), -width * 0.5f);
+ gl.glNormal3f((float)Math.cos(angle), (float)Math.sin(angle), 0.0f);
+ gl.glVertex3f(r2 * (float)Math.cos(angle + 2 * da), r2 * (float)Math.sin(angle + 2 * da), width * 0.5f);
+ gl.glVertex3f(r2 * (float)Math.cos(angle + 2 * da), r2 * (float)Math.sin(angle + 2 * da), -width * 0.5f);
+ u = r1 * (float)Math.cos(angle + 3 * da) - r2 * (float)Math.cos(angle + 2 * da);
+ v = r1 * (float)Math.sin(angle + 3 * da) - r2 * (float)Math.sin(angle + 2 * da);
+ gl.glNormal3f(v, -u, 0.0f);
+ gl.glVertex3f(r1 * (float)Math.cos(angle + 3 * da), r1 * (float)Math.sin(angle + 3 * da), width * 0.5f);
+ gl.glVertex3f(r1 * (float)Math.cos(angle + 3 * da), r1 * (float)Math.sin(angle + 3 * da), -width * 0.5f);
+ gl.glNormal3f((float)Math.cos(angle), (float)Math.sin(angle), 0.0f);
+ }
+ gl.glVertex3f(r1 * (float)Math.cos(0), r1 * (float)Math.sin(0), width * 0.5f);
+ gl.glVertex3f(r1 * (float)Math.cos(0), r1 * (float)Math.sin(0), -width * 0.5f);
+ gl.glEnd();
+
+ gl.glShadeModel(GL2.GL_SMOOTH);
+
+ /* draw inside radius cylinder */
+ gl.glBegin(GL2.GL_QUAD_STRIP);
+ for (i = 0; i <= teeth; i++)
+ {
+ angle = i * 2.0f * (float) Math.PI / teeth;
+ gl.glNormal3f(-(float)Math.cos(angle), -(float)Math.sin(angle), 0.0f);
+ gl.glVertex3f(r0 * (float)Math.cos(angle), r0 * (float)Math.sin(angle), -width * 0.5f);
+ gl.glVertex3f(r0 * (float)Math.cos(angle), r0 * (float)Math.sin(angle), width * 0.5f);
+ }
+ gl.glEnd();
+ }
+
+ /***
+ // Methods required for the implementation of MouseListener
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {}
+
+ public void mousePressed(MouseEvent e) {
+ prevMouseX = e.getX();
+ prevMouseY = e.getY();
+ if ((e.getModifiers() & e.BUTTON3_MASK) != 0) {
+ mouseRButtonDown = true;
+ }
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ if ((e.getModifiers() & e.BUTTON3_MASK) != 0) {
+ mouseRButtonDown = false;
+ }
+ }
+
+ public void mouseClicked(MouseEvent e) {}
+
+ // Methods required for the implementation of MouseMotionListener
+ public void mouseDragged(MouseEvent e) {
+ int x = e.getX();
+ int y = e.getY();
+ Dimension size = e.getComponent().getSize();
+
+ float thetaY = 360.0f * ( (float)(x-prevMouseX)/(float)size.width);
+ float thetaX = 360.0f * ( (float)(prevMouseY-y)/(float)size.height);
+
+ prevMouseX = x;
+ prevMouseY = y;
+
+ view_rotx += thetaX;
+ view_roty += thetaY;
+ }
+
+ public void mouseMoved(MouseEvent e) {}
+ */
+}
diff --git a/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java b/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java
new file mode 100755
index 000000000..0320c50ae
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. 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 Sven Gothel 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
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.jogamp.test.junit.jogl.drawable;
+
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.AfterClass;
+import org.junit.Test;
+
+import javax.media.opengl.*;
+
+import com.jogamp.newt.*;
+import java.io.IOException;
+
+public class TestDrawable01NEWT {
+ static GLProfile glp;
+ static GLDrawableFactory factory;
+ static int width, height;
+ GLCapabilities caps;
+ Window window;
+ GLDrawable drawable;
+ GLContext context;
+
+ @BeforeClass
+ public static void initClass() {
+ glp = GLProfile.getDefault();
+ Assert.assertNotNull(glp);
+ factory = GLDrawableFactory.getFactory(glp);
+ Assert.assertNotNull(factory);
+ width = 640;
+ height = 480;
+ }
+
+ @AfterClass
+ public static void releaseClass() {
+ factory.shutdown();
+ factory=null;
+ }
+
+ @Before
+ public void initTest() {
+ caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ }
+
+ void createWindow(boolean onscreen, boolean pbuffer, boolean undecorated) {
+ caps.setOnscreen(onscreen);
+ caps.setPBuffer(!onscreen && pbuffer);
+ caps.setDoubleBuffered(!onscreen);
+ // System.out.println("Requested: "+caps);
+
+ //
+ // Create native windowing resources .. X11/Win/OSX
+ //
+ Display display = NewtFactory.createDisplay(null); // local display
+ Assert.assertNotNull(display);
+
+ Screen screen = NewtFactory.createScreen(display, 0); // screen 0
+ Assert.assertNotNull(screen);
+
+ window = NewtFactory.createWindow(screen, caps, onscreen && undecorated);
+ Assert.assertNotNull(window);
+ window.setSize(width, height);
+ window.setVisible(true);
+ // System.out.println("Created: "+window);
+
+ //
+ // Create native OpenGL resources .. XGL/WGL/CGL ..
+ // equivalent to GLAutoDrawable methods: setVisible(true)
+ //
+ GLCapabilities glCaps = (GLCapabilities) window.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
+ Assert.assertNotNull(glCaps);
+ Assert.assertTrue(glCaps.getGreenBits()>5);
+ Assert.assertTrue(glCaps.getBlueBits()>5);
+ Assert.assertTrue(glCaps.getRedBits()>5);
+ Assert.assertTrue(glCaps.isOnscreen()==onscreen);
+ Assert.assertTrue(onscreen || !pbuffer || glCaps.isPBuffer()); // pass if onscreen, or !pbuffer req. or have pbuffer
+ Assert.assertTrue(glCaps.getDoubleBuffered()==!onscreen);
+ Assert.assertTrue(glCaps.getDepthBits()>4);
+
+ drawable = factory.createGLDrawable(window);
+ Assert.assertNotNull(drawable);
+ // System.out.println("Pre: "+drawable);
+ //
+ drawable.setRealized(true);
+ Assert.assertTrue(width==drawable.getWidth());
+ Assert.assertTrue(height==drawable.getHeight());
+ // Assert.assertTrue(glCaps==drawable.getChosenGLCapabilities());
+ Assert.assertTrue(window==drawable.getNativeWindow());
+ // System.out.println("Post: "+drawable);
+
+ context = drawable.createContext(null);
+ Assert.assertNotNull(context);
+ // System.out.println(context);
+
+ int res = context.makeCurrent();
+ Assert.assertTrue(GLContext.CONTEXT_CURRENT_NEW==res || GLContext.CONTEXT_CURRENT==res);
+
+ // draw something ..
+
+ drawable.swapBuffers();
+ context.release();
+
+ // System.out.println("Final: "+window);
+ }
+
+ void destroyWindow() {
+ // GLWindow.dispose(..) sequence
+ Assert.assertNotNull(context);
+ context.destroy();
+
+ Assert.assertNotNull(drawable);
+ drawable.setRealized(false);
+
+ // GLWindow.destroy(..) sequence cont..
+ Assert.assertNotNull(window);
+ window.destroy(true); // incl screen + display
+
+ drawable = null;
+ context = null;
+ window = null;
+ }
+
+ @Test
+ public void testOnScreenDecorated() throws InterruptedException {
+ createWindow(true, false, false);
+ Thread.sleep(1000); // 1000 ms
+ destroyWindow();
+ }
+
+ @Test
+ public void testOnScreenUndecorated() throws InterruptedException {
+ createWindow(true, false, true);
+ Thread.sleep(1000); // 1000 ms
+ destroyWindow();
+ }
+
+ public static void main(String args[]) throws IOException {
+ String tstname = TestDrawable01NEWT.class.getName();
+ org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
+ tstname,
+ "filtertrace=true",
+ "haltOnError=false",
+ "haltOnFailure=false",
+ "showoutput=true",
+ "outputtoformatters=true",
+ "logfailedtests=true",
+ "logtestlistenerevents=true",
+ "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter",
+ "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } );
+ }
+
+}
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/jvm/JVMUtil.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBuffer2File.java
index 3faab68bb..de7c8d43a 100644..100755
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/jvm/JVMUtil.java
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBuffer2File.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright (c) 2010 Sven Gothel. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -12,7 +12,7 @@
* 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
+ * Neither the name Sven Gothel or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
@@ -27,46 +27,47 @@
* 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.
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
+package com.jogamp.test.junit.jogl.offscreen;
-package com.sun.nativewindow.impl.jvm;
+import java.io.IOException;
+import javax.media.opengl.*;
-import java.nio.ByteBuffer;
-import com.sun.nativewindow.impl.*;
+import com.jogamp.opengl.util.texture.TextureIO;
+import java.io.File;
-/**
- * Currently this tool works around the Hotspot race condition bugs:
- <PRE>
- 4395095 JNI access to java.nio DirectBuffer constructor/accessor
- 6852404 Race condition in JNI Direct Buffer access and creation routines
- </PRE>
- *
- * Make sure to initialize this class as soon as possible,
- * before doing any multithreading work.
- *
- */
-public class JVMUtil {
- private static final boolean DEBUG = Debug.debug("JVMUtil");
-
- static {
- NativeLibLoaderBase.loadNativeWindow("jvm");
+public class ReadBuffer2File extends ReadBufferBase {
- ByteBuffer buffer = InternalBufferUtil.newByteBuffer(64);
- if( ! initialize(buffer) ) {
- throw new RuntimeException("Failed to initialize the JVMUtil "+Thread.currentThread().getName());
- }
- if(DEBUG) {
- Exception e = new Exception("JVMUtil.initSingleton() .. initialized "+Thread.currentThread().getName());
- e.printStackTrace();
- }
+ public ReadBuffer2File(GLDrawable externalRead) {
+ super(externalRead);
}
- public static void initSingleton() {
+ @Override
+ public void dispose(GLAutoDrawable drawable) {
+ super.dispose(drawable);
}
+ int shotNum = 0;
+
+ void copyTextureData2File() throws IOException {
+ if (!readBufferUtil.isValid()) {
+ return;
+ }
- private JVMUtil() {}
+ File file = File.createTempFile("shot" + shotNum + "-", ".ppm");
+ TextureIO.write(readBufferUtil.getTextureData(), file);
+ System.out.println("Wrote: " + file.getAbsolutePath() + ", ...");
+ shotNum++;
+ readBufferUtil.rewindPixelBuffer();
+ }
- private static native boolean initialize(java.nio.ByteBuffer buffer);
+ @Override
+ public void display(GLAutoDrawable drawable) {
+ super.display(drawable);
+ try {
+ copyTextureData2File();
+ } catch (IOException ex) {
+ throw new RuntimeException("can not read buffer to file", ex);
+ }
+ }
}
-
diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBuffer2Screen.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBuffer2Screen.java
new file mode 100755
index 000000000..030a7e173
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBuffer2Screen.java
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. 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 Sven Gothel 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
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.jogamp.test.junit.jogl.offscreen;
+
+import java.nio.*;
+import javax.media.opengl.*;
+import javax.media.opengl.fixedfunc.*;
+
+import com.jogamp.opengl.util.*;
+
+import javax.media.opengl.fixedfunc.GLPointerFunc;
+import com.jogamp.opengl.util.texture.TextureCoords;
+import com.jogamp.opengl.util.GLArrayDataClient;
+import com.jogamp.opengl.util.GLArrayDataServer;
+
+public class ReadBuffer2Screen extends ReadBufferBase {
+ PMVMatrix pmvMatrix;
+ GLArrayDataClient readTextureVertices = null;
+ GLArrayDataClient readTextureCoords = null;
+ boolean enableBufferAlways = false; // FIXME
+ boolean enableBufferVBO = true; // FIXME
+
+ public ReadBuffer2Screen (GLDrawable externalRead) {
+ super(externalRead);
+ }
+
+ @Override
+ public void init(GLAutoDrawable drawable) {
+ super.init(drawable);
+
+ GL gl = drawable.getGL();
+
+ pmvMatrix = new PMVMatrix();
+
+ float f_edge = 1f;
+ if(null==readTextureVertices) {
+ //readTextureVertices = GLArrayDataClient.createFixed(gl, GLPointerFunc.GL_VERTEX_ARRAY, "mgl_Vertex",
+ // 2, GL.GL_FLOAT, true, 4);
+ readTextureVertices = GLArrayDataServer.createFixed(gl, GLPointerFunc.GL_VERTEX_ARRAY, "mgl_Vertex",
+ 2, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
+ readTextureVertices.setEnableAlways(enableBufferAlways);
+ readTextureVertices.setVBOUsage(enableBufferVBO);
+ {
+ FloatBuffer vb = (FloatBuffer)readTextureVertices.getBuffer();
+ vb.put(-f_edge); vb.put(-f_edge);
+ vb.put( f_edge); vb.put(-f_edge);
+ vb.put(-f_edge); vb.put( f_edge);
+ vb.put( f_edge); vb.put( f_edge);
+ }
+ readTextureVertices.seal(gl, true);
+ System.out.println(readTextureVertices);
+ }
+
+ // Clear background to gray
+ gl.glClearColor(0.5f, 0.5f, 0.5f, 0.4f);
+ }
+
+ @Override
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ super.reshape(drawable, x, y, width, height);
+
+ GL gl = drawable.getGL();
+
+ gl.glViewport(0, 0, width, height);
+
+ if(gl instanceof GLLightingFunc) {
+ ((GLLightingFunc)gl).glShadeModel(GLLightingFunc.GL_SMOOTH);
+ }
+
+ GLMatrixFunc glM;
+ if(gl instanceof GLMatrixFunc) {
+ glM = (GLMatrixFunc)gl;
+ } else {
+ throw new GLException("ES2 currently unhandled .. ");
+ }
+
+ // Identity ..
+ pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
+ pmvMatrix.glLoadIdentity();
+ pmvMatrix.glTranslatef(0, 0, -2.5f);
+ if(null!=glM) {
+ glM.glMatrixMode(PMVMatrix.GL_MODELVIEW);
+ glM.glLoadMatrixf(pmvMatrix.glGetMvMatrixf());
+ }
+
+ // Set location in front of camera
+ pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
+ pmvMatrix.glLoadIdentity();
+ pmvMatrix.gluPerspective(45.0f, (float)width / (float)height, 1.0f, 100.0f);
+ if(null!=glM) {
+ glM.glMatrixMode(PMVMatrix.GL_PROJECTION);
+ glM.glLoadMatrixf(pmvMatrix.glGetPMatrixf());
+ }
+ }
+
+ @Override
+ public void dispose(GLAutoDrawable drawable) {
+ super.dispose(drawable);
+ }
+
+ void renderOffscreenTexture(GL gl) {
+ if(!readBufferUtil.isValid()) return;
+
+ // Now draw one quad with the texture
+ readBufferUtil.getTexture().enable();
+ readBufferUtil.getTexture().bind();
+
+ if(gl.isGL2ES1()) {
+ // gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_TEXTURE_ENV_MODE, GL2ES1.GL_REPLACE);
+ gl.getGL2ES1().glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_TEXTURE_ENV_MODE, GL2ES1.GL_MODULATE);
+ }
+
+ updateTextureCoords(gl, false);
+
+ readTextureVertices.enableBuffer(gl, true);
+ if(null!=readTextureCoords) {
+ readTextureCoords.enableBuffer(gl, true);
+ }
+ gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, readTextureVertices.getElementNumber());
+ /**
+ if(null!=readTextureCoords) {
+ readTextureCoords.enableBuffer(gl, false);
+ }
+ readTextureVertices.enableBuffer(gl, false); */
+
+ readBufferUtil.getTexture().disable();
+ }
+
+ void updateTextureCoords(GL gl, boolean force) {
+ if(force || null==readTextureCoords) {
+ readTextureCoords = GLArrayDataServer.createFixed(gl, GLPointerFunc.GL_TEXTURE_COORD_ARRAY, "mgl_MultiTexCoord0",
+ 2, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW);
+ readTextureCoords.setEnableAlways(enableBufferAlways);
+ readTextureCoords.setVBOUsage(enableBufferVBO);
+ {
+ TextureCoords coords = readBufferUtil.getTexture().getImageTexCoords();
+ FloatBuffer cb = (FloatBuffer)readTextureCoords.getBuffer();
+ cb.put(coords.left()); cb.put(coords.bottom());
+ cb.put(coords.right()); cb.put(coords.bottom());
+ cb.put(coords.left()); cb.put(coords.top());
+ cb.put(coords.right()); cb.put(coords.top());
+ }
+ readTextureCoords.seal(gl, true);
+ System.out.println(readTextureCoords);
+ }
+ }
+
+ @Override
+ public void display(GLAutoDrawable drawable) {
+ super.display(drawable);
+
+ GL gl = drawable.getGL();
+
+ gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT);
+ if(gl instanceof GLLightingFunc) {
+ ((GLLightingFunc)gl).glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ }
+
+ renderOffscreenTexture(gl);
+ }
+}
+
diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBufferBase.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBufferBase.java
new file mode 100755
index 000000000..4841d33e9
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBufferBase.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. 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 Sven Gothel 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
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.jogamp.test.junit.jogl.offscreen;
+
+import javax.media.opengl.*;
+
+public class ReadBufferBase implements GLEventListener {
+ public boolean glDebug = false ;
+ public boolean glTrace = false ;
+
+ protected GLDrawable externalRead;
+
+ ReadBufferUtil readBufferUtil = new ReadBufferUtil();
+
+ public ReadBufferBase (GLDrawable externalRead) {
+ this.externalRead = externalRead ;
+ }
+
+ public void init(GLAutoDrawable drawable) {
+ GL _gl = drawable.getGL();
+
+ _gl.glGetError(); // flush error ..
+
+ if(glDebug) {
+ try {
+ _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, _gl, null) );
+ } catch (Exception e) {
+ throw new RuntimeException("can not set debug pipeline", e);
+ }
+ }
+
+ if(glTrace) {
+ try {
+ _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, _gl, new Object[] { System.err } ) );
+ } catch (Exception e) {
+ throw new RuntimeException("can not set trace pipeline", e);
+ }
+ }
+
+ System.out.println(_gl);
+
+ _gl.getContext().setGLDrawableRead(externalRead);
+ if(_gl.isGL2GL3()) {
+ _gl.getGL2GL3().glReadBuffer(GL2GL3.GL_FRONT);
+ }
+ System.out.println("---------------------------");
+ System.out.println(_gl.getContext());
+ System.out.println("---------------------------");
+ }
+
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ }
+
+ public void dispose(GLAutoDrawable drawable) {
+ readBufferUtil.dispose();
+ }
+
+ public void display(GLAutoDrawable drawable) {
+ GL gl = drawable.getGL();
+
+ readBufferUtil.fetchOffscreenTexture(drawable, gl);
+ }
+
+}
+
diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBufferUtil.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBufferUtil.java
new file mode 100755
index 000000000..ff3b9b58a
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBufferUtil.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. 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 Sven Gothel 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
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.jogamp.test.junit.jogl.offscreen;
+
+import com.jogamp.opengl.util.GLBuffers;
+import java.nio.*;
+import javax.media.opengl.*;
+
+import com.jogamp.opengl.util.texture.Texture;
+import com.jogamp.opengl.util.texture.TextureData;
+
+public class ReadBufferUtil {
+ protected int readPixelSizeLast = 0;
+ protected Buffer readPixelBuffer = null;
+ protected TextureData readTextureData = null;
+ protected Texture readTexture = new Texture(GL.GL_TEXTURE_2D);
+
+ public Buffer getPixelBuffer() { return readPixelBuffer; }
+ public void rewindPixelBuffer() { readPixelBuffer.rewind(); }
+
+ public TextureData getTextureData() { return readTextureData; }
+ public Texture getTexture() { return readTexture; }
+
+ public boolean isValid() {
+ return null!=readTexture && null!=readTextureData && null!=readPixelBuffer ;
+ }
+
+ public void fetchOffscreenTexture(GLDrawable drawable, GL gl) {
+ int readPixelSize = drawable.getWidth() * drawable.getHeight() * 3 ; // RGB
+ boolean newData = false;
+ if(readPixelSize>readPixelSizeLast) {
+ readPixelBuffer = GLBuffers.newDirectGLBuffer(GL.GL_UNSIGNED_BYTE, readPixelSize);
+ readPixelSizeLast = readPixelSize ;
+ try {
+ readTextureData = new TextureData(
+ gl.getGLProfile(),
+ // gl.isGL2GL3()?gl.GL_RGBA:gl.GL_RGB,
+ gl.GL_RGB,
+ drawable.getWidth(), drawable.getHeight(),
+ 0,
+ gl.GL_RGB,
+ gl.GL_UNSIGNED_BYTE,
+ false, false,
+ false /* flip */,
+ readPixelBuffer,
+ null /* Flusher */);
+ newData = true;
+ } catch (Exception e) {
+ readTextureData = null;
+ readPixelBuffer = null;
+ readPixelSizeLast = 0;
+ throw new RuntimeException("can not fetch offscreen texture", e);
+ }
+ }
+ if(null!=readPixelBuffer) {
+ readPixelBuffer.clear();
+ gl.glReadPixels(0, 0, drawable.getWidth(), drawable.getHeight(), GL.GL_RGB, GL.GL_UNSIGNED_BYTE, readPixelBuffer);
+ readPixelBuffer.rewind();
+ if(newData) {
+ readTexture.updateImage(readTextureData);
+ } else {
+ readTexture.updateSubImage(readTextureData, 0,
+ 0, 0, // src offset
+ 0, 0, // dst offset
+ drawable.getWidth(), drawable.getHeight());
+ }
+ readPixelBuffer.rewind();
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ public void dispose() {
+ readTexture.dispose();
+ readTextureData = null;
+ readPixelBuffer.clear();
+ readPixelBuffer = null;
+ readPixelSizeLast = 0;
+ }
+
+}
+
diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/Surface2File.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/Surface2File.java
new file mode 100755
index 000000000..2799d72c4
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/Surface2File.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. 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 Sven Gothel 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
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+package com.jogamp.test.junit.jogl.offscreen;
+
+import javax.media.opengl.*;
+
+import com.jogamp.opengl.util.texture.TextureIO;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.media.nativewindow.*;
+
+public class Surface2File implements SurfaceUpdatedListener {
+
+ ReadBufferUtil readBufferUtil = new ReadBufferUtil();
+ int shotNum = 0;
+
+ public void dispose() {
+ readBufferUtil.dispose();
+ }
+
+ public void surfaceUpdated(Object updater, NativeWindow window, long when) {
+ if (updater instanceof GLDrawable) {
+ GLDrawable drawable = (GLDrawable) updater;
+ GLContext ctx = GLContext.getCurrent();
+ if (null != ctx && ctx.getGLDrawable() == drawable) {
+ GL gl = ctx.getGL();
+ // FIXME glFinish() is an expensive paranoia sync, should not be necessary due to spec
+ gl.glFinish();
+ readBufferUtil.fetchOffscreenTexture(drawable, gl);
+ gl.glFinish();
+ try {
+ surface2File("shot");
+ } catch (IOException ex) {
+ throw new RuntimeException("can not write survace to file", ex);
+ }
+ }
+ }
+ }
+
+ public void surface2File(String basename) throws IOException {
+ if (!readBufferUtil.isValid()) {
+ return;
+ }
+
+ File file = File.createTempFile(basename + shotNum + "-", ".ppm");
+ TextureIO.write(readBufferUtil.getTextureData(), file);
+ System.out.println("Wrote: " + file.getAbsolutePath() + ", ...");
+ shotNum++;
+ readBufferUtil.rewindPixelBuffer();
+ }
+}
diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
new file mode 100755
index 000000000..459b41f16
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
@@ -0,0 +1,389 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. 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 Sven Gothel 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
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.jogamp.test.junit.jogl.offscreen;
+
+import java.lang.reflect.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.AfterClass;
+import org.junit.After;
+import org.junit.Test;
+
+import javax.media.opengl.*;
+import javax.media.nativewindow.*;
+
+import com.jogamp.newt.*;
+import com.jogamp.newt.opengl.*;
+
+import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
+import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
+import java.io.IOException;
+
+public class TestOffscreen01NEWT {
+ static GLProfile glpDefault;
+ static GLDrawableFactory factory;
+ static int width, height;
+ GLCapabilities capsDefault;
+
+ @BeforeClass
+ public static void initClass() {
+ glpDefault = GLProfile.getDefault();
+ Assert.assertNotNull(glpDefault);
+ factory = GLDrawableFactory.getFactory(glpDefault);
+ Assert.assertNotNull(factory);
+ width = 640;
+ height = 480;
+ }
+
+ @AfterClass
+ public static void releaseClass() {
+ factory.shutdown();
+ factory=null;
+ }
+
+ @Before
+ public void init() {
+ capsDefault = new GLCapabilities(glpDefault);
+ Assert.assertNotNull(capsDefault);
+ }
+
+ private void do01OffscreenWindowPBuffer(GLCapabilities caps) {
+ Display display = NewtFactory.createDisplay(null); // local display
+ Assert.assertNotNull(display);
+ Screen screen = NewtFactory.createScreen(display, 0); // screen 0
+ Assert.assertNotNull(screen);
+ Window window = NewtFactory.createWindow(screen, caps, false /* undecorated */);
+ Assert.assertNotNull(window);
+ window.setSize(width, height);
+ GLWindow glWindow = GLWindow.create(window);
+ Assert.assertNotNull(glWindow);
+ glWindow.setVisible(true);
+ GLEventListener demo = new RedSquare();
+ WindowUtilNEWT.setDemoFields(demo, window, glWindow, false);
+
+ while ( glWindow.getTotalFrames() < 2) {
+ glWindow.display();
+ }
+
+ if(null!=glWindow) {
+ glWindow.destroy();
+ }
+ if(null!=window) {
+ window.destroy();
+ }
+ if(null!=screen) {
+ screen.destroy();
+ }
+ if(null!=display) {
+ display.destroy();
+ }
+ }
+
+ @Test
+ public void test01aOffscreenWindowPBuffer() {
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false);
+ do01OffscreenWindowPBuffer(caps2);
+ }
+
+ @Test
+ public void test01bOffscreenWindowPBufferStencil() {
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false);
+ caps2.setStencilBits(8);
+ do01OffscreenWindowPBuffer(caps2);
+ }
+
+ @Test
+ public void test01cOffscreenWindowPBufferStencilAlpha() {
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false);
+ caps2.setStencilBits(8);
+ caps2.setAlphaBits(8);
+ do01OffscreenWindowPBuffer(caps2);
+ }
+
+ @Test
+ public void test01cOffscreenWindowPBuffer555() {
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false);
+ caps2.setRedBits(5);
+ caps2.setGreenBits(5);
+ caps2.setBlueBits(5);
+ do01OffscreenWindowPBuffer(caps2);
+ }
+
+ @Test
+ public void test02Offscreen3Windows1DisplayPBuffer() {
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false);
+ int winnum = 3, i;
+ Window windows[] = new Window[winnum];
+ GLWindow glWindows[] = new GLWindow[winnum];
+ GLEventListener demos[] = new GLEventListener[winnum];
+
+ Display display = NewtFactory.createDisplay(null); // local display
+ Assert.assertNotNull(display);
+ Screen screen = NewtFactory.createScreen(display, 0); // screen 0
+ Assert.assertNotNull(screen);
+
+ for(i=0; i<winnum; i++) {
+ System.out.println("Create Window "+i);
+ windows[i] = NewtFactory.createWindow(screen, caps2, false /* undecorated */);
+ Assert.assertNotNull(windows[i]);
+ windows[i].setSize(width, height);
+ glWindows[i] = GLWindow.create(windows[i]);
+ Assert.assertNotNull(glWindows[i]);
+ glWindows[i].setVisible(true);
+ demos[i] = new RedSquare();
+ WindowUtilNEWT.setDemoFields(demos[i], windows[i], glWindows[i], false);
+ }
+
+ while ( glWindows[0].getTotalFrames() < 2) {
+ for(i=0; i<winnum; i++) {
+ glWindows[i].display();
+ }
+ }
+
+ for(i=0; i<winnum; i++) {
+ if(null!=glWindows[i]) {
+ glWindows[i].destroy();
+ }
+ if(null!=windows[i]) {
+ windows[i].destroy();
+ }
+ }
+ if(null!=screen) {
+ screen.destroy();
+ }
+ if(null!=display) {
+ display.destroy();
+ }
+ }
+
+ @Test
+ public void test03Offscreen3Windows3DisplaysPBuffer() {
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false);
+ int winnum = 3, i;
+ Display displays[] = new Display[winnum];
+ Screen screens[] = new Screen[winnum];
+ Window windows[] = new Window[winnum];
+ GLWindow glWindows[] = new GLWindow[winnum];
+ GLEventListener demos[] = new GLEventListener[winnum];
+
+ for(i=0; i<winnum; i++) {
+ System.out.println("Create Window "+i);
+ displays[i] = NewtFactory.createDisplay(null); // local display
+ Assert.assertNotNull(displays[i]);
+ screens[i] = NewtFactory.createScreen(displays[i], 0); // screen 0
+ Assert.assertNotNull(screens[i]);
+ windows[i] = NewtFactory.createWindow(screens[i], caps2, false /* undecorated */);
+ Assert.assertNotNull(windows[i]);
+ windows[i].setSize(width, height);
+ glWindows[i] = GLWindow.create(windows[i]);
+ Assert.assertNotNull(glWindows[i]);
+ glWindows[i].setVisible(true);
+ demos[i] = new RedSquare();
+ WindowUtilNEWT.setDemoFields(demos[i], windows[i], glWindows[i], false);
+ }
+
+ while ( glWindows[0].getTotalFrames() < 2) {
+ for(i=0; i<winnum; i++) {
+ glWindows[i].display();
+ }
+ }
+
+ for(i=0; i<winnum; i++) {
+ if(null!=glWindows[i]) {
+ glWindows[i].destroy();
+ }
+ if(null!=windows[i]) {
+ windows[i].destroy();
+ }
+ if(null!=screens[i]) {
+ screens[i].destroy();
+ }
+ if(null!=displays[i]) {
+ displays[i].destroy();
+ }
+ }
+ }
+
+ @Test
+ public void test04OffscreenSnapshotWithDemoPBuffer() {
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false);
+
+ System.out.println("Create Window 1");
+ Display display = NewtFactory.createDisplay(null); // local display
+ Assert.assertNotNull(display);
+ Screen screen = NewtFactory.createScreen(display, 0); // screen 0
+ Assert.assertNotNull(screen);
+ Window window = NewtFactory.createWindow(screen, caps2, false /* undecorated */);
+ Assert.assertNotNull(window);
+ window.setSize(width, height);
+ GLWindow glWindow = GLWindow.create(window);
+ Assert.assertNotNull(glWindow);
+ glWindow.setVisible(true);
+
+ GLWindow windowOnScreen = null;
+ WindowListener wl=null;
+ MouseListener ml=null;
+ SurfaceUpdatedListener ul=null;
+
+ GLEventListener demo = new RedSquare();
+ Assert.assertNotNull(demo);
+
+ WindowUtilNEWT.run(glWindow, demo, windowOnScreen, wl, ml, ul, 2, true /*snapshot*/, false /*debug*/);
+
+ if(null!=windowOnScreen) {
+ windowOnScreen.destroy();
+ }
+ if(null!=glWindow) {
+ glWindow.destroy();
+ }
+ if(null!=window) {
+ window.destroy();
+ }
+ if(null!=screen) {
+ screen.destroy();
+ }
+ if(null!=display) {
+ display.destroy();
+ }
+ }
+
+ @Test
+ public void test11OffscreenWindowPixmap() {
+ // Offscreen doesn't work on >= GL3 (ATI)
+ GLProfile glp = GLProfile.get(GLProfile.GL2);
+ Assert.assertNotNull(glp);
+ GLCapabilities caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, false, false);
+
+ Display display = NewtFactory.createDisplay(null); // local display
+ Assert.assertNotNull(display);
+ Screen screen = NewtFactory.createScreen(display, 0); // screen 0
+ Assert.assertNotNull(screen);
+ Window window = NewtFactory.createWindow(screen, caps2, false /* undecorated */);
+ Assert.assertNotNull(window);
+ window.setSize(width, height);
+ GLWindow glWindow = GLWindow.create(window);
+ Assert.assertNotNull(glWindow);
+ glWindow.setVisible(true);
+ GLEventListener demo = new RedSquare();
+ WindowUtilNEWT.setDemoFields(demo, window, glWindow, false);
+
+ while ( glWindow.getTotalFrames() < 2) {
+ glWindow.display();
+ }
+
+ if(null!=glWindow) {
+ glWindow.destroy();
+ }
+ if(null!=window) {
+ window.destroy();
+ }
+ if(null!=screen) {
+ screen.destroy();
+ }
+ if(null!=display) {
+ display.destroy();
+ }
+ }
+
+ @Test
+ public void test14OffscreenSnapshotWithDemoPixmap() {
+ // Offscreen doesn't work on >= GL3 (ATI)
+ GLProfile glp = GLProfile.get(GLProfile.GL2);
+ Assert.assertNotNull(glp);
+ GLCapabilities caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, false, false);
+
+ System.out.println("Create Window 1");
+ Display display = NewtFactory.createDisplay(null); // local display
+ Assert.assertNotNull(display);
+ Screen screen = NewtFactory.createScreen(display, 0); // screen 0
+ Assert.assertNotNull(screen);
+ Window window = NewtFactory.createWindow(screen, caps2, false /* undecorated */);
+ Assert.assertNotNull(window);
+ window.setSize(width, height);
+ GLWindow glWindow = GLWindow.create(window);
+ Assert.assertNotNull(glWindow);
+ glWindow.setVisible(true);
+
+ GLWindow windowOnScreen = null;
+ WindowListener wl=null;
+ MouseListener ml=null;
+ SurfaceUpdatedListener ul=null;
+
+ GLEventListener demo = new RedSquare();
+ Assert.assertNotNull(demo);
+
+ WindowUtilNEWT.run(glWindow, demo, windowOnScreen, wl, ml, ul, 2, true /*snapshot*/, false /*debug*/);
+
+ if(null!=windowOnScreen) {
+ windowOnScreen.destroy();
+ }
+ if(null!=glWindow) {
+ glWindow.destroy();
+ }
+ if(null!=window) {
+ window.destroy();
+ }
+ if(null!=screen) {
+ screen.destroy();
+ }
+ if(null!=display) {
+ display.destroy();
+ }
+ }
+ public static void main(String args[]) throws IOException {
+ String tstname = TestOffscreen01NEWT.class.getName();
+ org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
+ tstname,
+ "filtertrace=true",
+ "haltOnError=false",
+ "haltOnFailure=false",
+ "showoutput=true",
+ "outputtoformatters=true",
+ "logfailedtests=true",
+ "logtestlistenerevents=true",
+ "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter",
+ "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } );
+ }
+
+}
diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java
new file mode 100755
index 000000000..55ad83d25
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. 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 Sven Gothel 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
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.jogamp.test.junit.jogl.offscreen;
+
+import com.jogamp.test.junit.util.*;
+
+import org.junit.Assert;
+
+import javax.media.opengl.*;
+import javax.media.nativewindow.*;
+import com.jogamp.newt.*;
+import com.jogamp.newt.opengl.*;
+
+public class WindowUtilNEWT {
+
+ public static GLCapabilities fixCaps(GLCapabilities caps, boolean onscreen, boolean pbuffer, boolean undecorated) {
+ GLCapabilities caps2 = (GLCapabilities) caps.clone();
+ caps2.setOnscreen(onscreen);
+ caps2.setPBuffer(!onscreen && pbuffer);
+ caps2.setDoubleBuffered(!onscreen);
+ return caps2;
+ }
+
+ public static void setDemoFields(GLEventListener demo, Window window, GLWindow glWindow, boolean debug) {
+ Assert.assertNotNull(demo);
+ Assert.assertNotNull(window);
+ if(debug) {
+ MiscUtils.setFieldIfExists(demo, "glDebug", true);
+ MiscUtils.setFieldIfExists(demo, "glTrace", true);
+ }
+ if(!MiscUtils.setFieldIfExists(demo, "window", window)) {
+ MiscUtils.setFieldIfExists(demo, "glWindow", glWindow);
+ }
+ }
+
+ public static void run(GLWindow windowOffScreen, GLEventListener demo,
+ GLWindow windowOnScreen, WindowListener wl, MouseListener ml,
+ SurfaceUpdatedListener ul, int frames, boolean snapshot, boolean debug) {
+ Assert.assertNotNull(windowOffScreen);
+ Assert.assertNotNull(demo);
+
+ setDemoFields(demo, windowOffScreen, windowOffScreen, debug);
+ windowOffScreen.addGLEventListener(demo);
+
+ if ( null != windowOnScreen ) {
+ if(null!=wl) {
+ windowOnScreen.addWindowListener(wl);
+ }
+ if(null!=ml) {
+ windowOnScreen.addMouseListener(ml);
+ }
+ windowOnScreen.setVisible(true);
+ }
+
+ GLDrawable readDrawable = windowOffScreen.getContext().getGLDrawable() ;
+
+ if ( null == windowOnScreen ) {
+ if(snapshot) {
+ Surface2File s2f = new Surface2File();
+ windowOffScreen.addSurfaceUpdatedListener(s2f);
+ }
+ } else {
+ ReadBuffer2Screen readDemo = new ReadBuffer2Screen( readDrawable ) ;
+ windowOnScreen.addGLEventListener(readDemo);
+ }
+ if(null!=ul) {
+ windowOffScreen.addSurfaceUpdatedListener(ul);
+ }
+
+ if(debug) {
+ System.out.println("+++++++++++++++++++++++++++");
+ System.out.println(windowOffScreen);
+ System.out.println("+++++++++++++++++++++++++++");
+ }
+
+ while ( windowOffScreen.getTotalFrames() < frames) {
+ windowOffScreen.display();
+ }
+ windowOffScreen.removeAllSurfaceUpdatedListener();
+
+ }
+
+}
diff --git a/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java b/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java
new file mode 100755
index 000000000..4bbbaa271
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. 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 Sven Gothel 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
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.jogamp.test.junit.jogl.texture;
+
+import com.jogamp.test.junit.jogl.util.texture.gl2.TextureGL2ListenerDraw1;
+
+import javax.media.opengl.GLProfile;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.awt.GLCanvas;
+import com.jogamp.opengl.util.texture.TextureData;
+import com.jogamp.opengl.util.texture.awt.AWTTextureIO;
+import com.jogamp.opengl.util.Animator;
+
+import java.awt.AlphaComposite;
+import java.awt.Color;
+import java.awt.Frame;
+import java.awt.GradientPaint;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestTexture01AWT {
+ Frame frame;
+ BufferedImage textureImage;
+
+ @Before
+ public void init() {
+ // create base image
+ BufferedImage baseImage = new BufferedImage(256, 256, BufferedImage.TYPE_INT_RGB);
+ Graphics2D g = baseImage.createGraphics();
+ g.setPaint(new GradientPaint(0, 0, Color.CYAN,
+ baseImage.getWidth(), baseImage.getHeight(), Color.BLUE));
+ g.fillRect(0, 0, baseImage.getWidth(), baseImage.getHeight());
+ g.dispose();
+
+ // create texture image
+ int imageType = BufferedImage.TYPE_INT_RGB;
+ textureImage = new BufferedImage(baseImage.getWidth(),
+ baseImage.getHeight(),
+ imageType);
+ g = textureImage.createGraphics();
+ g.setComposite(AlphaComposite.Src);
+ g.drawImage(baseImage, 0, 0, null);
+ g.dispose();
+
+ frame = new Frame("Texture Test");
+ }
+
+ @Test
+ public void test1() throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2GL3));
+ GLCanvas glCanvas = new GLCanvas(caps);
+ frame.add(glCanvas);
+ frame.setSize(512, 512);
+
+ // create texture
+ TextureData textureData = AWTTextureIO.newTextureData(caps.getGLProfile(), textureImage, false);
+ glCanvas.addGLEventListener(new TextureGL2ListenerDraw1(textureData));
+
+ Animator animator = new Animator(glCanvas);
+ frame.setVisible(true);
+ animator.start();
+
+ Thread.sleep(500); // 500 ms
+
+ animator.stop();
+ frame.setVisible(false);
+
+ frame.remove(glCanvas);
+ frame.dispose();
+ frame=null;
+ }
+
+ public static void main(String args[]) {
+ org.junit.runner.JUnitCore.main(TestTexture01AWT.class.getName());
+ }
+}
diff --git a/src/junit/com/jogamp/test/junit/jogl/util/texture/gl2/TextureGL2ListenerDraw1.java b/src/junit/com/jogamp/test/junit/jogl/util/texture/gl2/TextureGL2ListenerDraw1.java
new file mode 100755
index 000000000..eabd4b79d
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/util/texture/gl2/TextureGL2ListenerDraw1.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. 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 Sven Gothel 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
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.jogamp.test.junit.jogl.util.texture.gl2;
+
+import com.jogamp.opengl.util.texture.Texture;
+import com.jogamp.opengl.util.texture.TextureCoords;
+import com.jogamp.opengl.util.texture.TextureData;
+import com.jogamp.opengl.util.texture.TextureIO;
+import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
+import javax.media.opengl.GL2;
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLEventListener;
+import javax.media.opengl.glu.GLU;
+
+public class TextureGL2ListenerDraw1 implements GLEventListener {
+ private GLU glu = new GLU();
+ private TextureData textureData;
+ private Texture texture;
+
+ public TextureGL2ListenerDraw1(TextureData td) {
+ this.textureData = td;
+ }
+
+ public void init(GLAutoDrawable drawable) {
+ this.texture = TextureIO.newTexture(textureData);
+ }
+
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ GL2 gl = drawable.getGL().getGL2();
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
+ gl.glLoadIdentity();
+ glu.gluOrtho2D(0, 1, 0, 1);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
+ gl.glLoadIdentity();
+ }
+
+ public void dispose(GLAutoDrawable drawable) {
+ GL2 gl = drawable.getGL().getGL2();
+ if(null!=texture) {
+ texture.disable();
+ texture.destroy(gl);
+ }
+ if(null!=textureData) {
+ textureData.destroy();
+ }
+ }
+
+ public void display(GLAutoDrawable drawable) {
+ GL2 gl = drawable.getGL().getGL2();
+
+ // need a valid GL context for this ..
+
+ /** OpenGL ..
+ texture.updateSubImage(textureData, 0,
+ 20, 20,
+ 20, 20,
+ 100, 100); */
+
+
+ // Now draw one quad with the texture
+ texture.enable();
+ texture.bind();
+ gl.glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_REPLACE);
+ TextureCoords coords = texture.getImageTexCoords();
+ gl.glBegin(GL2.GL_QUADS);
+ gl.glTexCoord2f(coords.left(), coords.bottom());
+ gl.glVertex3f(0, 0, 0);
+ gl.glTexCoord2f(coords.right(), coords.bottom());
+ gl.glVertex3f(1, 0, 0);
+ gl.glTexCoord2f(coords.right(), coords.top());
+ gl.glVertex3f(1, 1, 0);
+ gl.glTexCoord2f(coords.left(), coords.top());
+ gl.glVertex3f(0, 1, 0);
+ gl.glEnd();
+ texture.disable();
+ }
+}
+
diff --git a/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java
new file mode 100755
index 000000000..4969a685f
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. 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 Sven Gothel 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
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.jogamp.test.junit.newt;
+
+import java.lang.reflect.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Test;
+
+import javax.media.nativewindow.*;
+
+import com.jogamp.newt.*;
+import java.io.IOException;
+
+public class TestWindows01NEWT {
+ static int width, height;
+
+ @BeforeClass
+ public static void initClass() {
+ width = 640;
+ height = 480;
+ }
+
+ static Window createWindow(Screen screen, Capabilities caps, int width, int height, boolean onscreen, boolean undecorated) {
+ Assert.assertNotNull(caps);
+ caps.setOnscreen(onscreen);
+ // System.out.println("Requested: "+caps);
+
+ //
+ // Create native windowing resources .. X11/Win/OSX
+ //
+ Window window = NewtFactory.createWindow(screen, caps, onscreen && undecorated);
+ Assert.assertNotNull(window);
+ window.setSize(width, height);
+ Assert.assertTrue(false==window.isVisible());
+ window.setVisible(true);
+ Assert.assertTrue(true==window.isVisible());
+ Assert.assertTrue(width==window.getWidth());
+ Assert.assertTrue(height==window.getHeight());
+ // System.out.println("Created: "+window);
+
+ //
+ // Create native OpenGL resources .. XGL/WGL/CGL ..
+ // equivalent to GLAutoDrawable methods: setVisible(true)
+ //
+ caps = window.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
+ Assert.assertNotNull(caps);
+ Assert.assertTrue(caps.getGreenBits()>5);
+ Assert.assertTrue(caps.getBlueBits()>5);
+ Assert.assertTrue(caps.getRedBits()>5);
+ Assert.assertTrue(caps.isOnscreen()==onscreen);
+
+ return window;
+ }
+
+ static void destroyWindow(Display display, Screen screen, Window window) {
+ if(null!=window) {
+ window.destroy();
+ }
+ if(null!=screen) {
+ screen.destroy();
+ }
+ if(null!=display) {
+ display.destroy();
+ }
+ }
+
+ @Test
+ public void testWindowDecor01Simple() throws InterruptedException {
+ Capabilities caps = new Capabilities();
+ Assert.assertNotNull(caps);
+ Display display = NewtFactory.createDisplay(null); // local display
+ Assert.assertNotNull(display);
+ Screen screen = NewtFactory.createScreen(display, 0); // screen 0
+ Assert.assertNotNull(screen);
+
+ Window window = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */);
+ Thread.sleep(1000); // 1000 ms
+ destroyWindow(display, screen, window);
+ }
+
+ @Test
+ public void testWindowDecor02DestroyWinTwiceA() throws InterruptedException {
+ Capabilities caps = new Capabilities();
+ Assert.assertNotNull(caps);
+ Display display = NewtFactory.createDisplay(null); // local display
+ Assert.assertNotNull(display);
+ Screen screen = NewtFactory.createScreen(display, 0); // screen 0
+ Assert.assertNotNull(screen);
+
+ Window window = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */);
+ Thread.sleep(1000); // 1000 ms
+ destroyWindow(null, null, window);
+ destroyWindow(display, screen, window);
+ }
+
+ @Test
+ public void testWindowDecor03TwoWin() throws InterruptedException {
+ Capabilities caps = new Capabilities();
+ Assert.assertNotNull(caps);
+ Display display = NewtFactory.createDisplay(null); // local display
+ Assert.assertNotNull(display);
+ Screen screen = NewtFactory.createScreen(display, 0); // screen 0
+ Assert.assertNotNull(screen);
+
+ Window window1 = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */);
+ Window window2 = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */);
+ Thread.sleep(1000); // 1000 ms
+ destroyWindow(null, null, window2);
+ destroyWindow(display, screen, window1);
+ }
+
+ public static void main(String args[]) throws IOException {
+ String tstname = TestWindows01NEWT.class.getName();
+ org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
+ tstname,
+ "filtertrace=true",
+ "haltOnError=false",
+ "haltOnFailure=false",
+ "showoutput=true",
+ "outputtoformatters=true",
+ "logfailedtests=true",
+ "logtestlistenerevents=true",
+ "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter",
+ "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } );
+ }
+
+}
diff --git a/src/junit/com/jogamp/test/junit/util/MiscUtils.java b/src/junit/com/jogamp/test/junit/util/MiscUtils.java
new file mode 100644
index 000000000..d28d0e7cb
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/util/MiscUtils.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. 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 Sven Gothel 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
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.jogamp.test.junit.util;
+
+import java.lang.reflect.*;
+
+public class MiscUtils {
+ @Deprecated
+ public static int str2int(String str, int def) {
+ try {
+ return Integer.parseInt(str);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ return def;
+ }
+
+ public static boolean setFieldIfExists(Object instance, String fieldName, Object value) {
+ try {
+ Field f = instance.getClass().getField(fieldName);
+ if(value instanceof Boolean || f.getType().isInstance(value)) {
+ f.set(instance, value);
+ return true;
+ } else {
+ System.out.println(instance.getClass()+" '"+fieldName+"' field not assignable with "+value.getClass()+", it's a: "+f.getType());
+ }
+ } catch (IllegalAccessException ex) {
+ throw new RuntimeException(ex);
+ } catch (NoSuchFieldException nsfe) {
+ // OK - throw new RuntimeException(instance.getClass()+" has no '"+fieldName+"' field", nsfe);
+ }
+ return false;
+ }
+}
+
+
+
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/Debug.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/Debug.java
index dd967c71a..edb682392 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/Debug.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/Debug.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.nativewindow.impl;
+package com.jogamp.nativewindow.impl;
import java.security.*;
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/GraphicsConfigurationFactoryImpl.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/GraphicsConfigurationFactoryImpl.java
index 4e8e281a8..22f2d544f 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/GraphicsConfigurationFactoryImpl.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/GraphicsConfigurationFactoryImpl.java
@@ -30,7 +30,7 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.nativewindow.impl;
+package com.jogamp.nativewindow.impl;
import javax.media.nativewindow.*;
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/InternalBufferUtil.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/InternalBufferUtil.java
index 0425014df..f590e9b8b 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/InternalBufferUtil.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/InternalBufferUtil.java
@@ -31,13 +31,13 @@
*
*/
-package com.sun.nativewindow.impl;
+package com.jogamp.nativewindow.impl;
import java.lang.reflect.*;
import java.nio.*;
/** Internal copy of selected routines from BufferUtil to avoid
- outward dependencies on com.sun.opengl.util package. */
+ outward dependencies on com.jogamp.opengl.util package. */
public class InternalBufferUtil {
public static final int SIZEOF_BYTE = 1;
public static final int SIZEOF_SHORT = 2;
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/LockingNativeWindowFactory.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/LockingNativeWindowFactory.java
index 880fd8c7d..fd2478ab2 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/LockingNativeWindowFactory.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/LockingNativeWindowFactory.java
@@ -30,7 +30,7 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.nativewindow.impl;
+package com.jogamp.nativewindow.impl;
import javax.media.nativewindow.*;
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/impl/NWJNILibLoader.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/NWJNILibLoader.java
new file mode 100644
index 000000000..c3c04287a
--- /dev/null
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/NWJNILibLoader.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2010, Sven Gothel
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * 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 Sven Gothel 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 Sven Gothel 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.
+ */
+
+package com.jogamp.nativewindow.impl;
+
+// FIXME: refactor Java SE dependencies
+//import java.awt.Toolkit;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.HashSet;
+import com.jogamp.common.jvm.JNILibLoaderBase;
+
+public class NWJNILibLoader extends JNILibLoaderBase {
+
+ public static void loadNativeWindow(final String ossuffix) {
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ loadLibrary("nativewindow_"+ossuffix, null, false);
+ return null;
+ }
+ });
+ }
+
+}
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/NativeWindowFactoryImpl.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/NativeWindowFactoryImpl.java
index c94dab2f6..d2429cdab 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/NativeWindowFactoryImpl.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/NativeWindowFactoryImpl.java
@@ -30,8 +30,9 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.nativewindow.impl;
+package com.jogamp.nativewindow.impl;
+import com.jogamp.common.util.*;
import java.lang.reflect.*;
import java.security.*;
@@ -55,7 +56,7 @@ public class NativeWindowFactoryImpl extends NativeWindowFactory {
throw new IllegalArgumentException("AbstractGraphicsConfiguration is null with a non NativeWindow object");
}
- if (NWReflection.isAWTComponent(winObj)) {
+ if (ReflectionUtil.instanceOf(winObj, "java.awt.Component")) {
return getAWTNativeWindow(winObj, config);
}
@@ -76,17 +77,17 @@ public class NativeWindowFactoryImpl extends NativeWindowFactory {
// make it easier to run this code on mobile devices
if (osType.equals(TYPE_WINDOWS)) {
- windowClassName = "com.sun.nativewindow.impl.jawt.windows.WindowsJAWTWindow";
+ windowClassName = "com.jogamp.nativewindow.impl.jawt.windows.WindowsJAWTWindow";
} else if (osType.equals(TYPE_MACOSX)) {
- windowClassName = "com.sun.nativewindow.impl.jawt.macosx.MacOSXJAWTWindow";
+ windowClassName = "com.jogamp.nativewindow.impl.jawt.macosx.MacOSXJAWTWindow";
} else if (osType.equals(TYPE_X11)) {
// Assume Linux, Solaris, etc. Should probably test for these explicitly.
- windowClassName = "com.sun.nativewindow.impl.jawt.x11.X11JAWTWindow";
+ windowClassName = "com.jogamp.nativewindow.impl.jawt.x11.X11JAWTWindow";
} else {
throw new IllegalArgumentException("OS " + getNativeOSName(false) + " not yet supported");
}
- nativeWindowConstructor = NWReflection.getConstructor(windowClassName, new Class[] { Object.class, AbstractGraphicsConfiguration.class });
+ nativeWindowConstructor = ReflectionUtil.getConstructor(windowClassName, new Class[] { Object.class, AbstractGraphicsConfiguration.class });
} catch (Exception e) {
throw (IllegalArgumentException) new IllegalArgumentException().initCause(e);
}
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/NullWindow.java
index ca55aa542..4458d7b3d 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/NullWindow.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/NullWindow.java
@@ -34,7 +34,7 @@
* facility.
*/
-package com.sun.nativewindow.impl;
+package com.jogamp.nativewindow.impl;
import javax.media.nativewindow.*;
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTNativeLibLoader.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTJNILibLoader.java
index bc963277a..4ea404c09 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTNativeLibLoader.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTJNILibLoader.java
@@ -37,10 +37,10 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.nativewindow.impl.jawt;
+package com.jogamp.nativewindow.impl.jawt;
import javax.media.nativewindow.NativeWindowFactory;
-import com.sun.nativewindow.impl.NativeLibLoaderBase;
+import com.jogamp.nativewindow.impl.NWJNILibLoader;
import java.awt.Toolkit;
import java.lang.reflect.InvocationTargetException;
@@ -48,7 +48,7 @@ import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
-public class JAWTNativeLibLoader extends NativeLibLoaderBase {
+public class JAWTJNILibLoader extends NWJNILibLoader {
public static void loadAWTImpl() {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTUtil.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTUtil.java
index aac01e990..b3c706ed8 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTUtil.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTUtil.java
@@ -34,9 +34,9 @@
* facility.
*/
-package com.sun.nativewindow.impl.jawt;
+package com.jogamp.nativewindow.impl.jawt;
-import com.sun.nativewindow.impl.*;
+import com.jogamp.nativewindow.impl.*;
import javax.media.nativewindow.*;
@@ -54,8 +54,8 @@ public class JAWTUtil {
private static final boolean j2dExist;
static {
- JAWTNativeLibLoader.loadAWTImpl();
- JAWTNativeLibLoader.loadNativeWindow("awt");
+ JAWTJNILibLoader.loadAWTImpl();
+ JAWTJNILibLoader.loadNativeWindow("awt");
lockedStack = null;
headlessMode = GraphicsEnvironment.isHeadless();
@@ -65,7 +65,7 @@ public class JAWTUtil {
Method m=null;
if(!headlessMode) {
try {
- jC = Class.forName("com.sun.opengl.impl.awt.Java2D");
+ jC = Class.forName("com.jogamp.opengl.impl.awt.Java2D");
m = jC.getMethod("isQueueFlusherThread", null);
ok = true;
} catch (Exception e) {}
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTWindow.java
index b0548bb14..d0529878f 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWTWindow.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWTWindow.java
@@ -34,15 +34,15 @@
* facility.
*/
-package com.sun.nativewindow.impl.jawt;
+package com.jogamp.nativewindow.impl.jawt;
-import com.sun.nativewindow.impl.*;
+import com.jogamp.nativewindow.impl.*;
import java.awt.Component;
import java.awt.Window;
import java.awt.GraphicsEnvironment;
import javax.media.nativewindow.*;
-import com.sun.nativewindow.impl.*;
+import com.jogamp.nativewindow.impl.*;
public abstract class JAWTWindow implements NativeWindow {
protected static final boolean DEBUG = Debug.debug("JAWT");
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWT_PlatformInfo.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWT_PlatformInfo.java
index cc6af7ea4..d49e2f8d0 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/JAWT_PlatformInfo.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/JAWT_PlatformInfo.java
@@ -37,9 +37,9 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.nativewindow.impl.jawt;
+package com.jogamp.nativewindow.impl.jawt;
-import com.sun.nativewindow.impl.*;
+import com.jogamp.nativewindow.impl.*;
/** Marker class for all window system-specific JAWT data structures. */
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/macosx/MacOSXJAWTWindow.java
index 4ecc6aa4d..967d43d60 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/macosx/MacOSXJAWTWindow.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/macosx/MacOSXJAWTWindow.java
@@ -37,10 +37,10 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.nativewindow.impl.jawt.macosx;
+package com.jogamp.nativewindow.impl.jawt.macosx;
-import com.sun.nativewindow.impl.jawt.*;
-import com.sun.nativewindow.impl.*;
+import com.jogamp.nativewindow.impl.*;
+import com.jogamp.nativewindow.impl.jawt.*;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/windows/WindowsJAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/windows/WindowsJAWTWindow.java
index 2b8cab9c4..b23ad3f50 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/windows/WindowsJAWTWindow.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/windows/WindowsJAWTWindow.java
@@ -37,10 +37,10 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.nativewindow.impl.jawt.windows;
+package com.jogamp.nativewindow.impl.jawt.windows;
-import com.sun.nativewindow.impl.*;
-import com.sun.nativewindow.impl.jawt.*;
+import com.jogamp.nativewindow.impl.*;
+import com.jogamp.nativewindow.impl.jawt.*;
import javax.media.nativewindow.*;
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/x11/X11JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/x11/X11JAWTWindow.java
index af2b7a71c..f2977e8f0 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/x11/X11JAWTWindow.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/x11/X11JAWTWindow.java
@@ -34,14 +34,14 @@
* facility.
*/
-package com.sun.nativewindow.impl.jawt.x11;
+package com.jogamp.nativewindow.impl.jawt.x11;
import javax.media.nativewindow.*;
import javax.media.nativewindow.x11.*;
-import com.sun.nativewindow.impl.x11.*;
-import com.sun.nativewindow.impl.jawt.*;
-import com.sun.nativewindow.impl.*;
+import com.jogamp.nativewindow.impl.x11.*;
+import com.jogamp.nativewindow.impl.jawt.*;
+import com.jogamp.nativewindow.impl.*;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/x11/X11SunJDKReflection.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/x11/X11SunJDKReflection.java
index ef1f82cee..7cca6f9f3 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/jawt/x11/X11SunJDKReflection.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/jawt/x11/X11SunJDKReflection.java
@@ -37,9 +37,9 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.nativewindow.impl.jawt.x11;
+package com.jogamp.nativewindow.impl.jawt.x11;
-import com.sun.nativewindow.impl.x11.*;
+import com.jogamp.nativewindow.impl.x11.*;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/x11/X11GraphicsConfigurationFactory.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11GraphicsConfigurationFactory.java
index 4709e3ef0..a6f52f3c0 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/x11/X11GraphicsConfigurationFactory.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11GraphicsConfigurationFactory.java
@@ -30,12 +30,12 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.nativewindow.impl.x11;
+package com.jogamp.nativewindow.impl.x11;
import javax.media.nativewindow.*;
import javax.media.nativewindow.x11.*;
-import com.sun.nativewindow.impl.x11.XVisualInfo;
-import com.sun.nativewindow.impl.x11.X11Lib;
+import com.jogamp.nativewindow.impl.x11.XVisualInfo;
+import com.jogamp.nativewindow.impl.x11.X11Lib;
public class X11GraphicsConfigurationFactory extends GraphicsConfigurationFactory {
public AbstractGraphicsConfiguration
@@ -58,8 +58,8 @@ public class X11GraphicsConfigurationFactory extends GraphicsConfigurationFactor
int num[] = { -1 };
long display = screen.getDevice().getHandle();
+ X11Lib.XLockDisplay(display);
try {
- X11Lib.XLockDisplay(display);
XVisualInfo[] xvis = X11Lib.XGetVisualInfoCopied(display, X11Lib.VisualIDMask|X11Lib.VisualScreenMask, xvi_temp, num, 0);
if(xvis==null || num[0]<1) {
@@ -90,8 +90,8 @@ public class X11GraphicsConfigurationFactory extends GraphicsConfigurationFactor
vinfo_template.setC_class(c_class);
long display = screen.getDevice().getHandle();
+ X11Lib.XLockDisplay(display);
try {
- X11Lib.XLockDisplay(display);
XVisualInfo[] vinfos = X11Lib.XGetVisualInfoCopied(display, X11Lib.VisualScreenMask, vinfo_template, num, 0);
XVisualInfo best=null;
int rdepth = capabilities.getRedBits() + capabilities.getGreenBits() + capabilities.getBlueBits() + capabilities.getAlphaBits();
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11Util.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11Util.java
new file mode 100644
index 000000000..5f5c10885
--- /dev/null
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/X11Util.java
@@ -0,0 +1,334 @@
+/*
+ * 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.
+ */
+
+package com.jogamp.nativewindow.impl.x11;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Collection;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import javax.media.nativewindow.*;
+
+import com.jogamp.nativewindow.impl.*;
+
+/**
+ * Contains a thread safe X11 utility to retrieve thread local display connection,<br>
+ * as well as the static global display connection.<br>
+ *
+ * The TLS variant is thread safe per se, but be aware of the memory leak risk
+ * where an application heavily utilizing this class on temporary new threads.<br>
+ */
+public class X11Util {
+ private static final boolean DEBUG = Debug.debug("X11Util");
+
+ static {
+ NWJNILibLoader.loadNativeWindow("x11");
+ installIOErrorHandler();
+ }
+
+ private X11Util() {}
+
+ private static ThreadLocal currentDisplayMap = new ThreadLocal();
+
+ // 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 Collection globalNamedDisplayActive = new ArrayList();
+ private static Collection globalNamedDisplayPassive = new ArrayList();
+
+ public static final String nullDeviceName = "nil" ;
+
+ public static class NamedDisplay implements Cloneable {
+ String name;
+ long handle;
+ int refCount;
+ boolean unCloseable;
+
+ protected NamedDisplay(String name, long handle) {
+ this.name=name;
+ this.handle=handle;
+ this.refCount=1;
+ this.unCloseable=false;
+ }
+
+ public final String getName() { return name; }
+ public final String getNameSafe() { return null == name ? nullDeviceName : name; }
+ public final long getHandle() { return handle; }
+ public final int getRefCount() { return refCount; }
+ public final boolean isUncloseable() { return unCloseable; }
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public String toString() {
+ return "NamedX11Display["+name+", 0x"+Long.toHexString(handle)+", refCount "+refCount+", unCloseable "+unCloseable+"]";
+ }
+ }
+
+ /** Returns the number of unclosed X11 Displays.
+ * @param realXClosePendingDisplays if true, call XCloseDisplay on the remaining ones
+ */
+ public static int shutdown(boolean realXClosePendingDisplays, boolean verbose) {
+ int num=0;
+ String msg;
+ if(DEBUG||verbose) {
+ msg = "X11Util.Display: Shutdown (active: "+globalNamedDisplayActive.size()+
+ ", passive: "+globalNamedDisplayPassive.size() + ")";
+ if(DEBUG) {
+ Exception e = new Exception(msg);
+ e.printStackTrace();
+ } else if(verbose) {
+ System.err.println(msg);
+ }
+ }
+
+ msg = realXClosePendingDisplays ? "Close" : "Keep" ;
+
+ synchronized(globalLock) {
+ // for all passive displays ..
+ Collection namedDisplays = globalNamedDisplayPassive;
+ globalNamedDisplayPassive = new ArrayList();
+ for(Iterator iter=namedDisplays.iterator(); iter.hasNext(); ) {
+ NamedDisplay ndpy = (NamedDisplay)iter.next();
+ if(DEBUG||verbose) {
+ System.err.println(msg+" passive: "+ndpy);
+ }
+ if(realXClosePendingDisplays) {
+ X11Lib.XCloseDisplay(ndpy.getHandle());
+ }
+ num++;
+ }
+
+ // for all active displays ..
+ namedDisplays = globalNamedDisplayActive;
+ globalNamedDisplayActive = new ArrayList();
+ for(Iterator iter=namedDisplays.iterator(); iter.hasNext(); ) {
+ NamedDisplay ndpy = (NamedDisplay)iter.next();
+ if(DEBUG||verbose) {
+ System.err.println(msg+" active: "+ndpy);
+ }
+ if(realXClosePendingDisplays) {
+ X11Lib.XCloseDisplay(ndpy.getHandle());
+ }
+ num++;
+ }
+ }
+ return num;
+ }
+
+ /** Returns a clone of the thread local display map, you may {@link Object#wait()} on it */
+ public static Map getCurrentDisplayMap() {
+ return (Map) ((HashMap)getCurrentDisplayMapImpl()).clone();
+ }
+
+ /** Returns this thread current default display. If it doesn not exist, it is being created, otherwise the reference count is increased */
+ public static long createThreadLocalDefaultDisplay() {
+ return createThreadLocalDisplay(null);
+ }
+
+ /** Returns this thread named display. If it doesn not exist, it is being created, otherwise the reference count is increased */
+ public static long createThreadLocalDisplay(String name) {
+ NamedDisplay namedDpy = getCurrentDisplay(name);
+ if(null==namedDpy) {
+ synchronized(globalLock) {
+ namedDpy = getNamedDisplay(globalNamedDisplayPassive, name);
+ if(null != namedDpy) {
+ if(!globalNamedDisplayPassive.remove(namedDpy)) { throw new RuntimeException("Internal: "+namedDpy); }
+ globalNamedDisplayActive.add(namedDpy);
+ addCurrentDisplay( namedDpy );
+ }
+ }
+ }
+ if(null==namedDpy) {
+ long dpy = X11Lib.XOpenDisplay(name);
+ if(0==dpy) {
+ throw new NativeWindowException("X11Util.Display: Unable to create a display("+name+") connection in Thread "+Thread.currentThread().getName());
+ }
+ namedDpy = new NamedDisplay(name, dpy);
+ synchronized(globalLock) {
+ globalNamedDisplayActive.add(namedDpy);
+ addCurrentDisplay( namedDpy );
+ }
+ if(DEBUG) {
+ Exception e = new Exception("X11Util.Display: Created new TLS "+namedDpy+" in thread "+Thread.currentThread().getName());
+ e.printStackTrace();
+ }
+ } else {
+ namedDpy.refCount++;
+ if(DEBUG) {
+ Exception e = new Exception("X11Util.Display: Reused TLS "+namedDpy+" in thread "+Thread.currentThread().getName());
+ e.printStackTrace();
+ }
+ }
+ return namedDpy.getHandle();
+ }
+
+ /** Decrease the reference count of this thread named display. If it reaches 0, close it.
+ It returns the handle of the to be closed display.
+ It throws a RuntimeException in case the named display does not exist,
+ or the reference count goes below 0.
+ */
+ public static long closeThreadLocalDisplay(String name) {
+ NamedDisplay namedDpy = getCurrentDisplay(name);
+ if(null==namedDpy) {
+ throw new RuntimeException("X11Util.Display: Display("+name+") with given handle is not mapped to TLS in thread "+Thread.currentThread().getName());
+ }
+ if(0==namedDpy.refCount) {
+ throw new RuntimeException("X11Util.Display: "+namedDpy+" has refCount already 0 in thread "+Thread.currentThread().getName());
+ }
+ long dpy = namedDpy.getHandle();
+ namedDpy.refCount--;
+ if(0==namedDpy.refCount) {
+ synchronized(globalLock) {
+ if(!globalNamedDisplayActive.remove(namedDpy)) { throw new RuntimeException("Internal: "+namedDpy); }
+ if(namedDpy.isUncloseable()) {
+ globalNamedDisplayPassive.add(namedDpy);
+ } else {
+ X11Lib.XCloseDisplay(dpy);
+ }
+ removeCurrentDisplay(namedDpy);
+ }
+ if(DEBUG) {
+ String type = namedDpy.isUncloseable() ? "passive" : "real" ;
+ Exception e = new Exception("X11Util.Display: Closing ( "+type+" ) TLS "+namedDpy+" in thread "+Thread.currentThread().getName());
+ e.printStackTrace();
+ }
+ } else if(DEBUG) {
+ Exception e = new Exception("X11Util.Display: Keep TLS "+namedDpy+" in thread "+Thread.currentThread().getName());
+ e.printStackTrace();
+ }
+ return dpy;
+ }
+
+ public static String getThreadLocalDisplayName(long handle) {
+ NamedDisplay ndpy = getNamedDisplay(getCurrentDisplayMapImpl().values(), handle);
+ return null != ndpy ? ndpy.getName() : null;
+ }
+
+ public static boolean markThreadLocalDisplayUndeletable(long handle) {
+ NamedDisplay ndpy = getNamedDisplay(getCurrentDisplayMapImpl().values(), handle);
+ if( null != ndpy ) {
+ ndpy.unCloseable=true;
+ return true;
+ }
+ return false;
+ }
+
+ public static String getGlobalDisplayName(long handle, boolean active) {
+ String name;
+ synchronized(globalLock) {
+ NamedDisplay ndpy = getNamedDisplay(active ? globalNamedDisplayActive : globalNamedDisplayPassive, handle);
+ name = null != ndpy ? ndpy.getName() : null;
+ }
+ return name;
+ }
+
+ public static boolean markGlobalDisplayUndeletable(long handle) {
+ boolean r=false;
+ synchronized(globalLock) {
+ NamedDisplay ndpy = getNamedDisplay(globalNamedDisplayActive, handle);
+ if( null != ndpy ) {
+ ndpy.unCloseable=true;
+ r=true;
+ }
+ }
+ return r;
+ }
+
+ private static Map getCurrentDisplayMapImpl() {
+ Map displayMap = (Map) currentDisplayMap.get();
+ if(null==displayMap) {
+ displayMap = new HashMap();
+ currentDisplayMap.set( displayMap );
+ }
+ return displayMap;
+ }
+
+ /** maps the given display to the thread local display map
+ * and notifies all threads synchronized to this display map. */
+ private static NamedDisplay addCurrentDisplay(NamedDisplay newDisplay) {
+ Map displayMap = getCurrentDisplayMapImpl();
+ NamedDisplay oldDisplay = null;
+ synchronized(displayMap) {
+ oldDisplay = (NamedDisplay) displayMap.put(newDisplay.getNameSafe(), newDisplay);
+ displayMap.notifyAll();
+ }
+ return oldDisplay;
+ }
+
+ /** removes the mapping of the given name from the thread local display map
+ * and notifies all threads synchronized to this display map. */
+ private static NamedDisplay removeCurrentDisplay(NamedDisplay ndpy) {
+ Map displayMap = getCurrentDisplayMapImpl();
+ synchronized(displayMap) {
+ NamedDisplay ndpyDel = (NamedDisplay) displayMap.remove(ndpy.getNameSafe());
+ if(ndpyDel!=ndpy) {
+ throw new RuntimeException("Wrong mapping req: "+ndpy+", got "+ndpyDel);
+ }
+ displayMap.notifyAll();
+ }
+ return ndpy;
+ }
+
+ /** Returns the thread local display mapped to the given name */
+ private static NamedDisplay getCurrentDisplay(String name) {
+ if(null==name) name=nullDeviceName;
+ Map displayMap = getCurrentDisplayMapImpl();
+ return (NamedDisplay) displayMap.get(name);
+ }
+
+ private static NamedDisplay getNamedDisplay(Collection namedDisplays, String name) {
+ if(null==name) name=nullDeviceName;
+ for(Iterator iter=namedDisplays.iterator(); iter.hasNext(); ) {
+ NamedDisplay ndpy = (NamedDisplay)iter.next();
+ if (ndpy.getNameSafe().equals(name)) {
+ return ndpy;
+ }
+ }
+ return null;
+ }
+
+ private static NamedDisplay getNamedDisplay(Collection namedDisplays, long handle) {
+ for(Iterator iter=namedDisplays.iterator(); iter.hasNext(); ) {
+ NamedDisplay ndpy = (NamedDisplay)iter.next();
+ if (ndpy.getHandle()==handle) {
+ return ndpy;
+ }
+ }
+ return null;
+ }
+
+ private static native void installIOErrorHandler();
+}
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/x11/awt/X11AWTNativeWindowFactory.java b/src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/awt/X11AWTNativeWindowFactory.java
index dff733735..616220e14 100644
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/x11/awt/X11AWTNativeWindowFactory.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/impl/x11/awt/X11AWTNativeWindowFactory.java
@@ -30,17 +30,17 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.sun.nativewindow.impl.x11.awt;
+package com.jogamp.nativewindow.impl.x11.awt;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import javax.media.nativewindow.*;
-import com.sun.nativewindow.impl.*;
-import com.sun.nativewindow.impl.jawt.*;
-import com.sun.nativewindow.impl.jawt.x11.*;
-import com.sun.nativewindow.impl.x11.*;
+import com.jogamp.nativewindow.impl.*;
+import com.jogamp.nativewindow.impl.jawt.*;
+import com.jogamp.nativewindow.impl.jawt.x11.*;
+import com.jogamp.nativewindow.impl.x11.*;
public class X11AWTNativeWindowFactory extends NativeWindowFactoryImpl {
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/NWReflection.java b/src/nativewindow/classes/com/sun/nativewindow/impl/NWReflection.java
deleted file mode 100644
index d86fbdc55..000000000
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/NWReflection.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * 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
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- */
-
-package com.sun.nativewindow.impl;
-
-import java.lang.reflect.*;
-import javax.media.nativewindow.*;
-
-public final class NWReflection {
- public static final boolean DEBUG = Debug.debug("NWReflection");
-
- public static final boolean isClassAvailable(String clazzName) {
- try {
- Class clazz = Class.forName(clazzName, false, NWReflection.class.getClassLoader());
- return null!=clazz;
- } catch (Throwable e) { }
- return false;
- }
-
- public static final Class getClass(String clazzName, boolean initialize) {
- try {
- return Class.forName(clazzName, initialize, NWReflection.class.getClassLoader());
- } catch (Throwable e) { }
- return null;
- }
-
- public static final Constructor getConstructor(String clazzName, Class[] cstrArgTypes) {
- Class factoryClass = null;
- Constructor factory = null;
-
- try {
- factoryClass = getClass(clazzName, true);
- if (factoryClass == null) {
- throw new NativeWindowException(clazzName + " not available");
- }
- return getConstructor(factoryClass, cstrArgTypes);
- } catch (Throwable e) {
- if (DEBUG) {
- e.printStackTrace();
- }
- throw new NativeWindowException(e);
- }
- }
-
- public static final Constructor getConstructor(Class clazz, Class[] cstrArgTypes) {
- Constructor factory = null;
-
- try {
- try {
- factory = clazz.getDeclaredConstructor( cstrArgTypes );
- } catch(NoSuchMethodException nsme) {
- throw new NativeWindowException("Constructor: '" + clazz + "("+cstrArgTypes+")' not found");
- }
- return factory;
- } catch (Throwable e) {
- if (DEBUG) {
- e.printStackTrace();
- }
- throw new NativeWindowException(e);
- }
- }
-
- public static final Constructor getConstructor(String clazzName) {
- return getConstructor(clazzName, new Class[0]);
- }
-
- public static final Object createInstance(Class clazz, Class[] cstrArgTypes, Object[] cstrArgs) {
- Constructor factory = null;
-
- try {
- factory = getConstructor(clazz, cstrArgTypes);
- return factory.newInstance( cstrArgs ) ;
- } catch (Exception e) {
- throw new NativeWindowException(e);
- }
- }
-
- public static final Object createInstance(Class clazz, Object[] cstrArgs) {
- Class[] cstrArgTypes = new Class[cstrArgs.length];
- for(int i=0; i<cstrArgs.length; i++) {
- cstrArgTypes[i] = cstrArgs[i].getClass();
- }
- return createInstance(clazz, cstrArgTypes, cstrArgs);
- }
-
- public static final Object createInstance(String clazzName, Class[] cstrArgTypes, Object[] cstrArgs) {
- Constructor factory = null;
-
- try {
- factory = getConstructor(clazzName, cstrArgTypes);
- return factory.newInstance( cstrArgs ) ;
- } catch (Exception e) {
- throw new NativeWindowException(e);
- }
- }
-
- public static final Object createInstance(String clazzName, Object[] cstrArgs) {
- Class[] cstrArgTypes = new Class[cstrArgs.length];
- for(int i=0; i<cstrArgs.length; i++) {
- cstrArgTypes[i] = cstrArgs[i].getClass();
- }
- return createInstance(clazzName, cstrArgTypes, cstrArgs);
- }
-
- public static final Object createInstance(String clazzName) {
- return createInstance(clazzName, new Class[0], null);
- }
-
- public static final boolean instanceOf(Object obj, String clazzName) {
- return instanceOf(obj.getClass(), clazzName);
- }
- public static final boolean instanceOf(Class clazz, String clazzName) {
- do {
- if(clazz.getName().equals(clazzName)) {
- return true;
- }
- clazz = clazz.getSuperclass();
- } while (clazz!=null);
- return false;
- }
-
- public static final boolean implementationOf(Object obj, String faceName) {
- return implementationOf(obj.getClass(), faceName);
- }
- public static final boolean implementationOf(Class clazz, String faceName) {
- do {
- Class[] clazzes = clazz.getInterfaces();
- for(int i=clazzes.length-1; i>=0; i--) {
- Class face = clazzes[i];
- if(face.getName().equals(faceName)) {
- return true;
- }
- }
- clazz = clazz.getSuperclass();
- } while (clazz!=null);
- return false;
- }
-
- public static boolean isAWTComponent(Object target) {
- return instanceOf(target, "java.awt.Component");
- }
-
- public static boolean isAWTComponent(Class clazz) {
- return instanceOf(clazz, "java.awt.Component");
- }
-
-}
-
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/NativeLibLoaderBase.java b/src/nativewindow/classes/com/sun/nativewindow/impl/NativeLibLoaderBase.java
deleted file mode 100644
index 570cf1f9d..000000000
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/NativeLibLoaderBase.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * 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
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- *
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package com.sun.nativewindow.impl;
-
-// FIXME: refactor Java SE dependencies
-//import java.awt.Toolkit;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.HashSet;
-
-public class NativeLibLoaderBase {
- public static final boolean DEBUG = Debug.debug("NativeLibLoader");
-
- public interface LoaderAction {
- /**
- * Loads the library specified by libname. Optionally preloads the libraries specified by
- * preload. The implementation should ignore, if the preload-libraries have already been
- * loaded.
- * @param libname the library to load
- * @param preload the libraries to load before loading the main library if not null
- * @param preloadIgnoreError true, if errors during loading the preload-libraries should be ignored
- */
- void loadLibrary(String libname, String[] preload,
- boolean preloadIgnoreError);
- }
-
- private static class DefaultAction implements LoaderAction {
- public void loadLibrary(String libname, String[] preload,
- boolean preloadIgnoreError) {
- if (null!=preload) {
- for (int i=0; i<preload.length; i++) {
- if(!isLoaded(preload[i])) {
- try {
- loadLibraryInternal(preload[i]);
- addLoaded(preload[i]);
- if(DEBUG) {
- System.err.println("NativeLibLoaderBase preloaded "+preload[i]);
- }
- }
- catch (UnsatisfiedLinkError e) {
- if(DEBUG) e.printStackTrace();
- if (!preloadIgnoreError && e.getMessage().indexOf("already loaded") < 0) {
- throw e;
- }
- }
- }
- }
- }
- loadLibraryInternal(libname);
- addLoaded(libname);
- if(DEBUG) {
- System.err.println("NativeLibLoaderBase loaded "+libname);
- }
- }
- }
-
- private static final HashSet loaded = new HashSet();
- private static LoaderAction loaderAction = new DefaultAction();
-
- public static boolean isLoaded(String libName) {
- return loaded.contains(libName);
- }
-
- public static void addLoaded(String libName) {
- loaded.add(libName);
- if(DEBUG) {
- System.err.println("NativeLibLoaderBase Loaded Native Library: "+libName);
- }
- }
-
- public static void disableLoading() {
- setLoadingAction(null);
- }
-
- public static void enableLoading() {
- setLoadingAction(new DefaultAction());
- }
-
- public static synchronized void setLoadingAction(LoaderAction action) {
- loaderAction = action;
- }
-
- protected static synchronized void loadLibrary(String libname, String[] preload,
- boolean preloadIgnoreError) {
- if (loaderAction != null && !isLoaded(libname))
- {
- loaderAction.loadLibrary(libname, preload, preloadIgnoreError);
- }
- }
-
- public static void loadNativeWindow(final String ossuffix) {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- loadLibrary("nativewindow_"+ossuffix, null, false);
- return null;
- }
- });
- }
-
-
- private static final Class customLauncherClass;
- private static final Method customLoadLibraryMethod;
-
- static {
- Class launcherClass = null;
- Method loadLibraryMethod = null;
-
- if ( Debug.getBooleanProperty("sun.jnlp.applet.launcher", false) ) {
- try {
- launcherClass = Class.forName("org.jdesktop.applet.util.JNLPAppletLauncher");
- loadLibraryMethod = launcherClass.getDeclaredMethod("loadLibrary", new Class[] { String.class });
- } catch (Throwable t) {
- if(DEBUG) {
- t.printStackTrace();
- }
- launcherClass = null;
- loadLibraryMethod = null;
- }
- }
-
- if(null==launcherClass) {
- String launcherClassName = Debug.getProperty("jnlp.launcher.class", false);
- if(null!=launcherClassName) {
- try {
- launcherClass = Class.forName(launcherClassName);
- loadLibraryMethod = launcherClass.getDeclaredMethod("loadLibrary", new Class[] { String.class });
- } catch (Throwable t) {
- if(DEBUG) {
- t.printStackTrace();
- }
- launcherClass = null;
- loadLibraryMethod = null;
- }
- }
- }
- customLauncherClass = launcherClass;
- customLoadLibraryMethod = loadLibraryMethod;
- }
-
- private static void loadLibraryInternal(String libraryName) {
- // Note: special-casing JAWT which is built in to the JDK
- if (null!=customLoadLibraryMethod && !libraryName.equals("jawt")) {
- try {
- customLoadLibraryMethod.invoke(null, new Object[] { libraryName });
- } catch (Exception e) {
- Throwable t = e;
- if (t instanceof InvocationTargetException) {
- t = ((InvocationTargetException) t).getTargetException();
- }
- if (t instanceof Error)
- throw (Error) t;
- if (t instanceof RuntimeException) {
- throw (RuntimeException) t;
- }
- // Throw UnsatisfiedLinkError for best compatibility with System.loadLibrary()
- throw (UnsatisfiedLinkError) new UnsatisfiedLinkError().initCause(e);
- }
- } else {
- // System.out.println("sun.boot.library.path=" + Debug.getProperty("sun.boot.library.path", false));
- System.loadLibrary(libraryName);
- }
- }
-}
diff --git a/src/nativewindow/classes/com/sun/nativewindow/impl/x11/X11Util.java b/src/nativewindow/classes/com/sun/nativewindow/impl/x11/X11Util.java
deleted file mode 100644
index 11343f3e1..000000000
--- a/src/nativewindow/classes/com/sun/nativewindow/impl/x11/X11Util.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * 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.
- */
-
-package com.sun.nativewindow.impl.x11;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.media.nativewindow.*;
-
-import com.sun.nativewindow.impl.*;
-
-/**
- * Contains a thread safe X11 utility to retrieve thread local display connection,<br>
- * as well as the static global discplay connection.<br>
- *
- * The TLS variant is thread safe per se, but be aware of the memory leak risk
- * where an application heavily utilizing this class on temporary new threads.<br>
- */
-public class X11Util {
- private static final boolean DEBUG = Debug.debug("X11Util");
-
- static {
- NativeLibLoaderBase.loadNativeWindow("x11");
- }
-
- private X11Util() {}
-
- private static ThreadLocal currentDisplayMap = new ThreadLocal();
-
- public static class NamedDisplay implements Cloneable {
- private String name;
- private long handle;
-
- protected NamedDisplay(String name, long handle) {
- this.name=name;
- this.handle=handle;
- }
-
- public String getName() { return name; }
- public long getHandle() { return handle; }
-
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
- }
-
- /** Returns a clone of the thread local display map, you may {@link Object#wait()} on it */
- public static Map getCurrentDisplayMap() {
- return (Map) ((HashMap)getCurrentDisplayMapImpl()).clone();
- }
-
- /** Returns this thread current default display. If it doesn not exist, it is being created */
- public static long getThreadLocalDefaultDisplay() {
- return getThreadLocalDisplay(null);
- }
-
- /** Returns this thread named display. If it doesn not exist, it is being created */
- public static long getThreadLocalDisplay(String name) {
- NamedDisplay namedDpy = getCurrentDisplay(name);
- if(null==namedDpy) {
- long dpy = X11Lib.XOpenDisplay(name);
- if(0==dpy) {
- throw new NativeWindowException("X11Util.Display: Unable to create a display("+name+") connection in Thread "+Thread.currentThread().getName());
- }
- namedDpy = new NamedDisplay(name, dpy);
- setCurrentDisplay( namedDpy );
- if(DEBUG) {
- Exception e = new Exception("X11Util.Display: Created new TLS display("+name+") connection 0x"+Long.toHexString(dpy)+" in thread "+Thread.currentThread().getName());
- e.printStackTrace();
- }
- }
- return namedDpy.getHandle();
- }
-
- /** Closes this thread named display. It returns the handle of the closed display or 0, if it does not exist. */
- public static long closeThreadLocalDisplay(String name) {
- NamedDisplay namedDpy = removeCurrentDisplay(name);
- if(null==namedDpy) {
- if(DEBUG) {
- Exception e = new Exception("X11Util.Display: Display("+name+") with given handle is not mapped to TLS in thread "+Thread.currentThread().getName());
- e.printStackTrace();
- }
- return 0;
- }
- long dpy = namedDpy.getHandle();
- X11Lib.XCloseDisplay(dpy);
- if(DEBUG) {
- Exception e = new Exception("X11Util.Display: Closed TLS Display("+name+") with handle 0x"+Long.toHexString(dpy)+" in thread "+Thread.currentThread().getName());
- e.printStackTrace();
- }
- return dpy;
- }
-
- private static Map getCurrentDisplayMapImpl() {
- Map displayMap = (Map) currentDisplayMap.get();
- if(null==displayMap) {
- displayMap = new HashMap();
- currentDisplayMap.set( displayMap );
- }
- return displayMap;
- }
-
- /** maps the given display to the thread local display map
- * and notifies all threads synchronized to this display map. */
- private static NamedDisplay setCurrentDisplay(NamedDisplay newDisplay) {
- Map displayMap = getCurrentDisplayMapImpl();
- NamedDisplay oldDisplay = null;
- synchronized(displayMap) {
- String name = (null==newDisplay.getName())?"nil":newDisplay.getName();
- oldDisplay = (NamedDisplay) displayMap.put(name, newDisplay);
- displayMap.notifyAll();
- }
- return oldDisplay;
- }
-
- /** removes the mapping of the given name from the thread local display map
- * and notifies all threads synchronized to this display map. */
- private static NamedDisplay removeCurrentDisplay(String name) {
- Map displayMap = getCurrentDisplayMapImpl();
- NamedDisplay oldDisplay = null;
- synchronized(displayMap) {
- if(null==name) name="nil";
- oldDisplay = (NamedDisplay) displayMap.remove(name);
- displayMap.notifyAll();
- }
- return oldDisplay;
- }
-
- /** Returns the thread local display mapped to the given name */
- private static NamedDisplay getCurrentDisplay(String name) {
- if(null==name) name="nil";
- Map displayMap = getCurrentDisplayMapImpl();
- return (NamedDisplay) displayMap.get(name);
- }
-
-}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java
index 881499bec..c692e51c4 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/GraphicsConfigurationFactory.java
@@ -35,7 +35,8 @@ package javax.media.nativewindow;
import java.lang.reflect.*;
import java.util.*;
-import com.sun.nativewindow.impl.*;
+import com.jogamp.common.util.*;
+import com.jogamp.nativewindow.impl.*;
/**
* Provides the mechanism by which the graphics configuration for a
@@ -77,7 +78,7 @@ public abstract class GraphicsConfigurationFactory {
if (NativeWindowFactory.TYPE_X11.equals(NativeWindowFactory.getNativeWindowType(true))) {
try {
GraphicsConfigurationFactory factory = (GraphicsConfigurationFactory)
- NWReflection.createInstance("com.sun.nativewindow.impl.x11.X11GraphicsConfigurationFactory", new Object[] {});
+ ReflectionUtil.createInstance("com.jogamp.nativewindow.impl.x11.X11GraphicsConfigurationFactory", new Object[] {});
registerFactory(javax.media.nativewindow.x11.X11GraphicsDevice.class, factory);
} catch (Exception e) {
throw new RuntimeException(e);
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
index cd89e2164..944fdee74 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
@@ -36,8 +36,9 @@ import java.lang.reflect.*;
import java.security.*;
import java.util.*;
-import com.sun.nativewindow.impl.*;
-import com.sun.nativewindow.impl.jvm.JVMUtil;
+import com.jogamp.common.util.*;
+import com.jogamp.common.jvm.JVMUtil;
+import com.jogamp.nativewindow.impl.*;
/** Provides a pluggable mechanism for arbitrary window toolkits to
adapt their components to the {@link NativeWindow} interface,
@@ -123,10 +124,10 @@ public abstract class NativeWindowFactory {
// make it easier to run this code on mobile devices
Class componentClass = null;
- if ( NWReflection.isClassAvailable("java.awt.Component") &&
- NWReflection.isClassAvailable("javax.media.nativewindow.awt.AWTGraphicsDevice") ) {
+ if ( ReflectionUtil.isClassAvailable("java.awt.Component") &&
+ ReflectionUtil.isClassAvailable("javax.media.nativewindow.awt.AWTGraphicsDevice") ) {
try {
- componentClass = NWReflection.getClass("java.awt.Component", false);
+ componentClass = ReflectionUtil.getClass("java.awt.Component", false);
} catch (Exception e) { }
}
@@ -177,7 +178,7 @@ public abstract class NativeWindowFactory {
try {
Constructor factoryConstructor =
- NWReflection.getConstructor("com.sun.nativewindow.impl.x11.awt.X11AWTNativeWindowFactory", new Class[] {});
+ ReflectionUtil.getConstructor("com.jogamp.nativewindow.impl.x11.awt.X11AWTNativeWindowFactory", new Class[] {});
_factory = (NativeWindowFactory) factoryConstructor.newInstance(null);
} catch (Exception e) { }
}
@@ -185,7 +186,7 @@ public abstract class NativeWindowFactory {
if (toolkitLockForced && null==_factory) {
try {
Constructor factoryConstructor =
- NWReflection.getConstructor("com.sun.nativewindow.impl.LockingNativeWindowFactory", new Class[] {});
+ ReflectionUtil.getConstructor("com.jogamp.nativewindow.impl.LockingNativeWindowFactory", new Class[] {});
_factory = (NativeWindowFactory) factoryConstructor.newInstance(null);
} catch (Exception e) { }
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java
index 7373e7b97..9b48f8f6e 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java
@@ -44,7 +44,7 @@ import java.awt.GraphicsConfiguration;
import java.awt.Transparency;
import java.awt.image.ColorModel;
import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import com.sun.nativewindow.impl.Debug;
+import com.jogamp.nativewindow.impl.Debug;
/** A wrapper for an AWT GraphicsConfiguration allowing it to be
handled in a toolkit-independent manner. */
diff --git a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsDevice.java
index 077cbf8aa..d326b9159 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsDevice.java
@@ -43,7 +43,7 @@ import javax.media.nativewindow.*;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import javax.media.nativewindow.AbstractGraphicsDevice;
-import com.sun.nativewindow.impl.*;
+import com.jogamp.nativewindow.impl.*;
/** A wrapper for an AWT GraphicsDevice allowing it to be
handled in a toolkit-independent manner. */
diff --git a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsScreen.java
index 2ad8a99af..6cbf2ee71 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsScreen.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsScreen.java
@@ -43,7 +43,7 @@ import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import javax.media.nativewindow.*;
import javax.media.nativewindow.AbstractGraphicsDevice;
-import com.sun.nativewindow.impl.*;
+import com.jogamp.nativewindow.impl.*;
/** A wrapper for an AWT GraphicsDevice (screen) allowing it to be
handled in a toolkit-independent manner. */
diff --git a/src/nativewindow/classes/javax/media/nativewindow/package.html b/src/nativewindow/classes/javax/media/nativewindow/package.html
index ce9dbbb7a..fa422b2ab 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/package.html
+++ b/src/nativewindow/classes/javax/media/nativewindow/package.html
@@ -41,7 +41,7 @@
</ul><br>
This protocol <i>does not</i> describe how to <i>create</i> native windows, but how to <i>bind</i> a native window to an implementation of
{@link javax.media.nativewindow.NativeWindow NativeWindow}.<br>
- However, an implementation of this protocol (e.g. {@link com.sun.javafx.newt}) may support the creation.<br>
+ However, an implementation of this protocol (e.g. {@link com.jogamp.newt}) may support the creation.<br>
<h3>Dependencies</h3>
This binding has dependencies to the following:<br><br>
diff --git a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsConfiguration.java
index 49d5f2d83..5659dcdcc 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsConfiguration.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsConfiguration.java
@@ -33,7 +33,7 @@
package javax.media.nativewindow.x11;
import javax.media.nativewindow.*;
-import com.sun.nativewindow.impl.x11.XVisualInfo;
+import com.jogamp.nativewindow.impl.x11.XVisualInfo;
/** Encapsulates a graphics configuration, or OpenGL pixel format, on
X11 platforms. Objects of this type are returned from {@link
diff --git a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java
index 614d26a61..58b40efe0 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java
@@ -33,8 +33,8 @@
package javax.media.nativewindow.x11;
import javax.media.nativewindow.*;
-import com.sun.nativewindow.impl.x11.X11Util;
-import com.sun.nativewindow.impl.x11.X11Lib;
+import com.jogamp.nativewindow.impl.x11.X11Util;
+import com.jogamp.nativewindow.impl.x11.X11Lib;
/** Encapsulates a screen index on X11
platforms. Objects of this type are passed to {@link
@@ -57,13 +57,16 @@ public class X11GraphicsScreen extends DefaultGraphicsScreen implements Cloneabl
/** Creates a new X11GraphicsScreen using a thread local display connection */
public static AbstractGraphicsScreen createDefault() {
NativeWindowFactory.getDefaultFactory().getToolkitLock().lock();
- long display = X11Util.getThreadLocalDefaultDisplay();
try {
+ long display = X11Util.createThreadLocalDefaultDisplay();
X11Lib.XLockDisplay(display);
- int scrnIdx = X11Lib.DefaultScreen(display);
- return createScreenDevice(display, scrnIdx);
+ try{
+ int scrnIdx = X11Lib.DefaultScreen(display);
+ return createScreenDevice(display, scrnIdx);
+ }finally{
+ X11Lib.XUnlockDisplay(display);
+ }
} finally {
- X11Lib.XUnlockDisplay(display);
NativeWindowFactory.getDefaultFactory().getToolkitLock().unlock();
}
}
@@ -71,13 +74,16 @@ public class X11GraphicsScreen extends DefaultGraphicsScreen implements Cloneabl
public long getDefaultVisualID() {
// It still could be an AWT hold handle ..
NativeWindowFactory.getDefaultFactory().getToolkitLock().lock();
- long display = getDevice().getHandle();
try {
+ long display = getDevice().getHandle();
X11Lib.XLockDisplay(display);
- int scrnIdx = X11Lib.DefaultScreen(display);
- return X11Lib.DefaultVisualID(display, scrnIdx);
+ try{
+ int scrnIdx = X11Lib.DefaultScreen(display);
+ return X11Lib.DefaultVisualID(display, scrnIdx);
+ }finally{
+ X11Lib.XUnlockDisplay(display);
+ }
} finally {
- X11Lib.XUnlockDisplay(display);
NativeWindowFactory.getDefaultFactory().getToolkitLock().unlock();
}
}
@@ -85,14 +91,17 @@ public class X11GraphicsScreen extends DefaultGraphicsScreen implements Cloneabl
private static int fetchScreen(X11GraphicsDevice device, int screen) {
// It still could be an AWT hold handle ..
NativeWindowFactory.getDefaultFactory().getToolkitLock().lock();
- long display = device.getHandle();
try {
+ long display = device.getHandle();
X11Lib.XLockDisplay(display);
- if(X11Lib.XineramaEnabled(display)) {
- screen = 0; // Xinerama -> 1 screen
+ try{
+ if(X11Lib.XineramaEnabled(display)) {
+ screen = 0; // Xinerama -> 1 screen
+ }
+ }finally{
+ X11Lib.XUnlockDisplay(display);
}
} finally {
- X11Lib.XUnlockDisplay(display);
NativeWindowFactory.getDefaultFactory().getToolkitLock().unlock();
}
return screen;
diff --git a/src/nativewindow/native/JAWT_DrawingSurfaceInfo.c b/src/nativewindow/native/JAWT_DrawingSurfaceInfo.c
index e4afbdb70..a0422fa8e 100644
--- a/src/nativewindow/native/JAWT_DrawingSurfaceInfo.c
+++ b/src/nativewindow/native/JAWT_DrawingSurfaceInfo.c
@@ -50,7 +50,7 @@
#endif
JNIEXPORT jobject JNICALL
-Java_com_sun_nativewindow_impl_jawt_JAWT_1DrawingSurfaceInfo_platformInfo0(JNIEnv* env, jobject unused, jobject jthis0) {
+Java_com_jogamp_nativewindow_impl_jawt_JAWT_1DrawingSurfaceInfo_platformInfo0(JNIEnv* env, jobject unused, jobject jthis0) {
JAWT_DrawingSurfaceInfo* dsi;
dsi = (*env)->GetDirectBufferAddress(env, jthis0);
if (dsi == NULL) {
diff --git a/src/nativewindow/native/JVM_Tool.c b/src/nativewindow/native/JVM_Tool.c
deleted file mode 100644
index e04032aa2..000000000
--- a/src/nativewindow/native/JVM_Tool.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MIDROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- *
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-#include <jni.h>
-
-JNIEXPORT jboolean JNICALL
-Java_com_sun_nativewindow_impl_jvm_JVMUtil_initialize(JNIEnv *env, jclass _unused, jobject nioBuffer) {
- int res;
- void * ptr = NULL;
- if (nioBuffer != NULL) {
- ptr = (void *) (*env)->GetDirectBufferAddress(env, nioBuffer);
- }
- return ( NULL==ptr ) ? JNI_FALSE : JNI_TRUE ;
-}
-
diff --git a/src/nativewindow/native/x11/Xmisc.c b/src/nativewindow/native/x11/Xmisc.c
new file mode 100644
index 000000000..52449ae84
--- /dev/null
+++ b/src/nativewindow/native/x11/Xmisc.c
@@ -0,0 +1,493 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. 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 Sven Gothel 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
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+/* Linux headers don't work properly */
+#define __USE_GNU
+#include <dlfcn.h>
+#undef __USE_GNU
+
+/* Current versions of Solaris don't expose the XF86 extensions,
+ although with the recent transition to Xorg this will probably
+ happen in an upcoming release */
+#if !defined(__sun) && !defined(_HPUX)
+#include <X11/extensions/xf86vmode.h>
+#else
+/* Need to provide stubs for these */
+Bool XF86VidModeGetGammaRampSize(
+ Display *display,
+ int screen,
+ int* size)
+{
+ return False;
+}
+
+Bool XF86VidModeGetGammaRamp(
+ Display *display,
+ int screen,
+ int size,
+ unsigned short *red_array,
+ unsigned short *green_array,
+ unsigned short *blue_array) {
+ return False;
+}
+Bool XF86VidModeSetGammaRamp(
+ Display *display,
+ int screen,
+ int size,
+ unsigned short *red_array,
+ unsigned short *green_array,
+ unsigned short *blue_array) {
+ return False;
+}
+#endif /* defined(__sun) || defined(_HPUX) */
+
+/* HP-UX doesn't define RTLD_DEFAULT. */
+#if defined(_HPUX) && !defined(RTLD_DEFAULT)
+#define RTLD_DEFAULT NULL
+#endif
+
+#include "com_jogamp_nativewindow_impl_x11_X11Lib.h"
+
+// #define VERBOSE_ON 1
+
+#ifdef VERBOSE_ON
+ // Workaround for ancient compiler on Solaris/SPARC
+ // #define DBG_PRINT(args...) fprintf(stderr, args);
+ #define DBG_PRINT0(str) fprintf(stderr, str);
+ #define DBG_PRINT1(str, arg1) fprintf(stderr, str, arg1);
+ #define DBG_PRINT2(str, arg1, arg2) fprintf(stderr, str, arg1, arg2);
+ #define DBG_PRINT3(str, arg1, arg2, arg3) fprintf(stderr, str, arg1, arg2, arg3);
+ #define DBG_PRINT4(str, arg1, arg2, arg3, arg4) fprintf(stderr, str, arg1, arg2, arg3, arg4);
+ #define DBG_PRINT5(str, arg1, arg2, arg3, arg4, arg5) fprintf(stderr, str, arg1, arg2, arg3, arg4, arg5);
+ #define DBG_PRINT6(str, arg1, arg2, arg3, arg4, arg5, arg6) fprintf(stderr, str, arg1, arg2, arg3, arg4, arg5, arg6);
+ #define DBG_PRINT7(str, arg1, arg2, arg3, arg4, arg5, arg6, arg7) fprintf(stderr, str, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
+ #define DBG_PRINT8(str, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) fprintf(stderr, str, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
+
+#else
+
+ // Workaround for ancient compiler on Solaris/SPARC
+ // #define DBG_PRINT(args...)
+ #define DBG_PRINT0(str)
+ #define DBG_PRINT1(str, arg1)
+ #define DBG_PRINT2(str, arg1, arg2)
+ #define DBG_PRINT3(str, arg1, arg2, arg3)
+ #define DBG_PRINT4(str, arg1, arg2, arg3, arg4)
+ #define DBG_PRINT5(str, arg1, arg2, arg3, arg4, arg5)
+ #define DBG_PRINT6(str, arg1, arg2, arg3, arg4, arg5, arg6)
+ #define DBG_PRINT7(str, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
+ #define DBG_PRINT8(str, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
+
+#endif
+
+/* Need to pull this in as we don't have a stub header for it */
+extern Bool XineramaEnabled(Display* display);
+
+static void _FatalError(JNIEnv *env, const char* msg, ...)
+{
+ char buffer[512];
+ va_list ap;
+
+ va_start(ap, msg);
+ vsnprintf(buffer, sizeof(buffer), msg, ap);
+ va_end(ap);
+
+ fprintf(stderr, buffer);
+ fprintf(stderr, "\n");
+ (*env)->FatalError(env, buffer);
+}
+
+static const char * const ClazzNameInternalBufferUtil = "com/jogamp/nativewindow/impl/InternalBufferUtil";
+static const char * const ClazzNameInternalBufferUtilStaticCstrName = "copyByteBuffer";
+static const char * const ClazzNameInternalBufferUtilStaticCstrSignature = "(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;";
+static const char * const ClazzNameByteBuffer = "java/nio/ByteBuffer";
+static const char * const ClazzNameRuntimeException = "java/lang/RuntimeException";
+static jclass clazzInternalBufferUtil = NULL;
+static jmethodID cstrInternalBufferUtil = NULL;
+static jclass clazzByteBuffer = NULL;
+static jclass clazzRuntimeException=NULL;
+
+static void _initClazzAccess(JNIEnv *env) {
+ jclass c;
+
+ if(NULL!=clazzRuntimeException) return ;
+
+ c = (*env)->FindClass(env, ClazzNameRuntimeException);
+ if(NULL==c) {
+ _FatalError(env, "Nativewindow X11Lib: can't find %s", ClazzNameRuntimeException);
+ }
+ clazzRuntimeException = (jclass)(*env)->NewGlobalRef(env, c);
+ (*env)->DeleteLocalRef(env, c);
+ if(NULL==clazzRuntimeException) {
+ _FatalError(env, "FatalError: NEWT X11Window: can't use %s", ClazzNameRuntimeException);
+ }
+
+ c = (*env)->FindClass(env, ClazzNameInternalBufferUtil);
+ if(NULL==c) {
+ _FatalError(env, "FatalError: Java_com_jogamp_nativewindow_impl_x11_X11Lib: can't find %s", ClazzNameInternalBufferUtil);
+ }
+ clazzInternalBufferUtil = (jclass)(*env)->NewGlobalRef(env, c);
+ (*env)->DeleteLocalRef(env, c);
+ if(NULL==clazzInternalBufferUtil) {
+ _FatalError(env, "FatalError: Java_com_jogamp_nativewindow_impl_x11_X11Lib: can't use %s", ClazzNameInternalBufferUtil);
+ }
+ c = (*env)->FindClass(env, ClazzNameByteBuffer);
+ if(NULL==c) {
+ _FatalError(env, "FatalError: Java_com_jogamp_nativewindow_impl_x11_X11Lib: can't find %s", ClazzNameByteBuffer);
+ }
+ clazzByteBuffer = (jclass)(*env)->NewGlobalRef(env, c);
+ (*env)->DeleteLocalRef(env, c);
+ if(NULL==c) {
+ _FatalError(env, "FatalError: Java_com_jogamp_nativewindow_impl_x11_X11Lib: can't use %s", ClazzNameByteBuffer);
+ }
+
+ cstrInternalBufferUtil = (*env)->GetStaticMethodID(env, clazzInternalBufferUtil,
+ ClazzNameInternalBufferUtilStaticCstrName, ClazzNameInternalBufferUtilStaticCstrSignature);
+ if(NULL==cstrInternalBufferUtil) {
+ _FatalError(env, "FatalError: Java_com_jogamp_nativewindow_impl_x11_X11Lib:: can't create %s.%s %s",
+ ClazzNameInternalBufferUtil, ClazzNameInternalBufferUtilStaticCstrName, ClazzNameInternalBufferUtilStaticCstrSignature);
+ }
+}
+
+static void _throwNewRuntimeException(Display * unlockDisplay, JNIEnv *env, const char* msg, ...)
+{
+ char buffer[512];
+ va_list ap;
+
+ if(NULL!=unlockDisplay) {
+ XUnlockDisplay(unlockDisplay);
+ }
+
+ _initClazzAccess(env);
+
+ va_start(ap, msg);
+ vsnprintf(buffer, sizeof(buffer), msg, ap);
+ va_end(ap);
+
+ (*env)->ThrowNew(env, clazzRuntimeException, buffer);
+}
+
+static JNIEnv * x11ErrorHandlerJNIEnv = NULL;
+static XErrorHandler origErrorHandler = NULL ;
+
+static int x11ErrorHandler(Display *dpy, XErrorEvent *e)
+{
+ _throwNewRuntimeException(NULL, x11ErrorHandlerJNIEnv, "Nativewindow X11 Error: Display %p, Code 0x%X", dpy, e->error_code);
+
+ return 0;
+}
+
+static void x11ErrorHandlerEnable(int onoff, JNIEnv * env) {
+ if(onoff) {
+ if(NULL==origErrorHandler) {
+ x11ErrorHandlerJNIEnv = env;
+ origErrorHandler = XSetErrorHandler(x11ErrorHandler);
+ }
+ } else {
+ XSetErrorHandler(origErrorHandler);
+ origErrorHandler = NULL;
+ }
+}
+
+
+static XIOErrorHandler origIOErrorHandler = NULL;
+
+static int x11IOErrorHandler(Display *dpy)
+{
+ _FatalError(x11ErrorHandlerJNIEnv, "Nativewindow X11 IOError: Display %p not available", dpy);
+ origIOErrorHandler(dpy);
+ return 0;
+}
+
+static void x11IOErrorHandlerEnable(int onoff, JNIEnv * env) {
+ if(onoff) {
+ if(NULL==origIOErrorHandler) {
+ x11ErrorHandlerJNIEnv = env;
+ origIOErrorHandler = XSetIOErrorHandler(x11IOErrorHandler);
+ }
+ } else {
+ XSetIOErrorHandler(origIOErrorHandler);
+ origIOErrorHandler = NULL;
+ }
+}
+
+JNIEXPORT void JNICALL
+Java_com_jogamp_nativewindow_impl_x11_X11Util_installIOErrorHandler(JNIEnv *env, jclass _unused) {
+ x11ErrorHandlerEnable(1, env);
+ x11IOErrorHandlerEnable(1, env);
+}
+
+JNIEXPORT jlong JNICALL
+Java_com_jogamp_nativewindow_impl_x11_X11Lib_dlopen(JNIEnv *env, jclass _unused, jstring name) {
+ const jbyte* chars;
+ void* res;
+ chars = (*env)->GetStringUTFChars(env, name, NULL);
+ res = dlopen(chars, RTLD_LAZY | RTLD_GLOBAL);
+ (*env)->ReleaseStringUTFChars(env, name, chars);
+ return (jlong) ((intptr_t) res);
+}
+
+JNIEXPORT jlong JNICALL
+Java_com_jogamp_nativewindow_impl_x11_X11Lib_dlsym(JNIEnv *env, jclass _unused, jstring name) {
+ const jbyte* chars;
+ void* res;
+ chars = (*env)->GetStringUTFChars(env, name, NULL);
+ res = dlsym(RTLD_DEFAULT, chars);
+ (*env)->ReleaseStringUTFChars(env, name, chars);
+ return (jlong) ((intptr_t) res);
+}
+
+/* Java->C glue code:
+ * Java package: com.jogamp.nativewindow.impl.x11.X11Lib
+ * Java method: XVisualInfo XGetVisualInfo(long arg0, long arg1, XVisualInfo arg2, java.nio.IntBuffer arg3)
+ * C function: XVisualInfo * XGetVisualInfo(Display * , long, XVisualInfo * , int * );
+ */
+JNIEXPORT jobject JNICALL
+Java_com_jogamp_nativewindow_impl_x11_X11Lib_XGetVisualInfoCopied1__JJLjava_nio_ByteBuffer_2Ljava_lang_Object_2I(JNIEnv *env, jclass _unused, jlong arg0, jlong arg1, jobject arg2, jobject arg3, jint arg3_byte_offset) {
+ XVisualInfo * _ptr2 = NULL;
+ int * _ptr3 = NULL;
+ XVisualInfo * _res;
+ int count;
+ jobject jbyteSource;
+ jobject jbyteCopy;
+ if(0==arg0) {
+ _FatalError(env, "invalid display connection..");
+ }
+ if (arg2 != NULL) {
+ _ptr2 = (XVisualInfo *) (((char*) (*env)->GetDirectBufferAddress(env, arg2)) + 0);
+ }
+ if (arg3 != NULL) {
+ _ptr3 = (int *) (((char*) (*env)->GetPrimitiveArrayCritical(env, arg3, NULL)) + arg3_byte_offset);
+ }
+ _res = XGetVisualInfo((Display *) (intptr_t) arg0, (long) arg1, (XVisualInfo *) _ptr2, (int *) _ptr3);
+ count = _ptr3[0];
+ if (arg3 != NULL) {
+ (*env)->ReleasePrimitiveArrayCritical(env, arg3, _ptr3, 0);
+ }
+ if (_res == NULL) return NULL;
+
+ _initClazzAccess(env);
+
+ jbyteSource = (*env)->NewDirectByteBuffer(env, _res, count * sizeof(XVisualInfo));
+ jbyteCopy = (*env)->CallStaticObjectMethod(env,
+ clazzInternalBufferUtil, cstrInternalBufferUtil, jbyteSource);
+
+ XFree(_res);
+
+ return jbyteCopy;
+}
+
+JNIEXPORT jlong JNICALL
+Java_com_jogamp_nativewindow_impl_x11_X11Lib_DefaultVisualID(JNIEnv *env, jclass _unused, jlong display, jint screen) {
+ jlong r;
+ if(0==display) {
+ _FatalError(env, "invalid display connection..");
+ }
+ r = (jlong) XVisualIDFromVisual( DefaultVisual( (Display*) (intptr_t) display, screen ) );
+ return r;
+}
+
+/* Java->C glue code:
+ * Java package: com.jogamp.nativewindow.impl.x11.X11Lib
+ * Java method: void XLockDisplay(long display)
+ * C function: void XLockDisplay(Display * display);
+ */
+JNIEXPORT void JNICALL
+Java_com_jogamp_nativewindow_impl_x11_X11Lib_XLockDisplay__J(JNIEnv *env, jclass _unused, jlong display) {
+ if(0==display) {
+ _FatalError(env, "invalid display connection..");
+ }
+ XLockDisplay((Display *) (intptr_t) display);
+}
+
+/* Java->C glue code:
+ * Java package: com.jogamp.nativewindow.impl.x11.X11Lib
+ * Java method: void XUnlockDisplay(long display)
+ * C function: void XUnlockDisplay(Display * display);
+ */
+JNIEXPORT void JNICALL
+Java_com_jogamp_nativewindow_impl_x11_X11Lib_XUnlockDisplay__J(JNIEnv *env, jclass _unused, jlong display) {
+ if(0==display) {
+ _FatalError(env, "invalid display connection..");
+ }
+ XUnlockDisplay((Display *) (intptr_t) display);
+}
+
+
+/* Java->C glue code:
+ * Java package: com.jogamp.nativewindow.impl.x11.X11Lib
+ * Java method: int XCloseDisplay(long display)
+ * C function: int XCloseDisplay(Display * display);
+ */
+JNIEXPORT jint JNICALL
+Java_com_jogamp_nativewindow_impl_x11_X11Lib_XCloseDisplay__J(JNIEnv *env, jclass _unused, jlong display) {
+ int _res;
+ if(0==display) {
+ _FatalError(env, "invalid display connection..");
+ }
+ _res = XCloseDisplay((Display *) (intptr_t) display);
+ return _res;
+}
+
+/*
+ * Class: com_jogamp_nativewindow_impl_x11_X11Lib
+ * Method: CreateDummyWindow
+ * Signature: (JIJ)J
+ */
+JNIEXPORT jlong JNICALL Java_com_jogamp_nativewindow_impl_x11_X11Lib_CreateDummyWindow
+ (JNIEnv *env, jobject obj, jlong display, jint screen_index, jlong visualID)
+{
+ Display * dpy = (Display *)(intptr_t)display;
+ int scrn_idx = (int)screen_index;
+ Window windowParent = 0;
+ Window window = 0;
+
+ XVisualInfo visualTemplate;
+ XVisualInfo *pVisualQuery = NULL;
+ Visual *visual = NULL;
+ int depth;
+
+ XSetWindowAttributes xswa;
+ unsigned long attrMask;
+ int n;
+
+ Screen* scrn;
+
+ if(NULL==dpy) {
+ _FatalError(env, "invalid display connection..");
+ return 0;
+ }
+
+ if(visualID<0) {
+ _throwNewRuntimeException(NULL, env, "invalid VisualID ..");
+ return 0;
+ }
+
+ XLockDisplay(dpy) ;
+
+ XSync(dpy, False);
+
+ scrn = ScreenOfDisplay(dpy, scrn_idx);
+
+ // try given VisualID on screen
+ memset(&visualTemplate, 0, sizeof(XVisualInfo));
+ visualTemplate.screen = scrn_idx;
+ visualTemplate.visualid = (VisualID)visualID;
+ pVisualQuery = XGetVisualInfo(dpy, VisualIDMask|VisualScreenMask, &visualTemplate,&n);
+ if(pVisualQuery!=NULL) {
+ visual = pVisualQuery->visual;
+ depth = pVisualQuery->depth;
+ visualID = (jlong)pVisualQuery->visualid;
+ XFree(pVisualQuery);
+ pVisualQuery=NULL;
+ }
+ DBG_PRINT5( "X11: [CreateWindow] trying given (dpy %p, screen %d, visualID: %d, parent %p) found: %p\n", dpy, scrn_idx, (int)visualID, windowParent, visual);
+
+ if (visual==NULL)
+ {
+ _throwNewRuntimeException(dpy, env, "could not query Visual by given VisualID, bail out!");
+ return 0;
+ }
+
+ if(pVisualQuery!=NULL) {
+ XFree(pVisualQuery);
+ pVisualQuery=NULL;
+ }
+
+ if(0==windowParent) {
+ windowParent = XRootWindowOfScreen(scrn);
+ }
+
+ attrMask = (CWBackPixel | CWBorderPixel | CWColormap | CWOverrideRedirect) ;
+
+ memset(&xswa, 0, sizeof(xswa));
+ xswa.override_redirect = True; // not decorated
+ xswa.border_pixel = 0;
+ xswa.background_pixel = 0;
+ xswa.event_mask = 0 ; // no events
+ xswa.colormap = XCreateColormap(dpy,
+ XRootWindow(dpy, scrn_idx),
+ visual,
+ AllocNone);
+
+ window = XCreateWindow(dpy,
+ windowParent,
+ 0, 0,
+ 64, 64,
+ 0, // border width
+ depth,
+ InputOutput,
+ visual,
+ attrMask,
+ &xswa);
+
+ XSync(dpy, False);
+
+ XUnlockDisplay(dpy) ;
+
+ DBG_PRINT2( "X11: [CreateWindow] created window %p on display %p\n", window, dpy);
+
+ return (jlong) window;
+}
+
+
+/*
+ * Class: com_jogamp_nativewindow_impl_x11_X11Lib
+ * Method: DestroyDummyWindow
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL Java_com_jogamp_nativewindow_impl_x11_X11Lib_DestroyDummyWindow
+ (JNIEnv *env, jobject obj, jlong display, jlong window)
+{
+ Display * dpy = (Display *)(intptr_t)display;
+ Window w = (Window) window;
+
+ if(NULL==dpy) {
+ _throwNewRuntimeException(NULL, env, "invalid display connection..");
+ return;
+ }
+ XLockDisplay(dpy) ;
+
+ XSync(dpy, False);
+ XUnmapWindow(dpy, w);
+ XSync(dpy, False);
+ XDestroyWindow(dpy, w);
+ XSync(dpy, False);
+
+ XUnlockDisplay(dpy) ;
+}
diff --git a/src/newt/classes/com/sun/javafx/newt/Display.java b/src/newt/classes/com/jogamp/newt/Display.java
index a4b7a4f51..2bc99475c 100755
--- a/src/newt/classes/com/sun/javafx/newt/Display.java
+++ b/src/newt/classes/com/jogamp/newt/Display.java
@@ -31,11 +31,11 @@
*
*/
-package com.sun.javafx.newt;
+package com.jogamp.newt;
import javax.media.nativewindow.*;
-import com.sun.javafx.newt.impl.Debug;
-import com.sun.javafx.newt.util.EventDispatchThread;
+import com.jogamp.newt.impl.Debug;
+import com.jogamp.newt.util.EDTUtil;
import java.util.*;
public abstract class Display {
@@ -47,15 +47,15 @@ public abstract class Display {
Class displayClass = NewtFactory.getCustomClass(type, "Display");
if(null==displayClass) {
if (NativeWindowFactory.TYPE_EGL.equals(type)) {
- displayClass = Class.forName("com.sun.javafx.newt.opengl.kd.KDDisplay");
+ displayClass = Class.forName("com.jogamp.newt.opengl.kd.KDDisplay");
} else if (NativeWindowFactory.TYPE_WINDOWS.equals(type)) {
- displayClass = Class.forName("com.sun.javafx.newt.windows.WindowsDisplay");
+ displayClass = Class.forName("com.jogamp.newt.windows.WindowsDisplay");
} else if (NativeWindowFactory.TYPE_MACOSX.equals(type)) {
- displayClass = Class.forName("com.sun.javafx.newt.macosx.MacDisplay");
+ displayClass = Class.forName("com.jogamp.newt.macosx.MacDisplay");
} else if (NativeWindowFactory.TYPE_X11.equals(type)) {
- displayClass = Class.forName("com.sun.javafx.newt.x11.X11Display");
+ displayClass = Class.forName("com.jogamp.newt.x11.X11Display");
} else if (NativeWindowFactory.TYPE_AWT.equals(type)) {
- displayClass = Class.forName("com.sun.javafx.newt.awt.AWTDisplay");
+ displayClass = Class.forName("com.jogamp.newt.awt.AWTDisplay");
} else {
throw new RuntimeException("Unknown display type \"" + type + "\"");
}
@@ -141,11 +141,16 @@ public abstract class Display {
display.refCount=1;
if(NewtFactory.useEDT()) {
- Thread current = Thread.currentThread();
- display.eventDispatchThread = new EventDispatchThread(display, current.getThreadGroup(), current.getName());
- display.eventDispatchThread.start();
final Display f_dpy = display;
- display.eventDispatchThread.invokeAndWait(new Runnable() {
+ Thread current = Thread.currentThread();
+ display.edtUtil = new EDTUtil(current.getThreadGroup(),
+ "Display_"+display.getName()+"-"+current.getName(),
+ new Runnable() {
+ public void run() {
+ f_dpy.pumpMessagesImpl();
+ } } );
+ display.edt = display.edtUtil.start();
+ display.edtUtil.invokeAndWait(new Runnable() {
public void run() {
f_dpy.createNative();
}
@@ -189,7 +194,7 @@ public abstract class Display {
}
}
- public EventDispatchThread getEDT() { return eventDispatchThread; }
+ public EDTUtil getEDTUtil() { return edtUtil; }
public synchronized void destroy() {
if(DEBUG) {
@@ -201,10 +206,10 @@ public abstract class Display {
if(DEBUG) {
System.err.println("Display.destroy("+name+") REMOVE: "+this+" "+Thread.currentThread());
}
- if(null!=eventDispatchThread) {
+ if(null!=edtUtil) {
final Display f_dpy = this;
- final EventDispatchThread f_edt = eventDispatchThread;
- eventDispatchThread.invokeAndWait(new Runnable() {
+ final EDTUtil f_edt = edtUtil;
+ edtUtil.invokeAndWait(new Runnable() {
public void run() {
f_dpy.closeNative();
f_edt.stop();
@@ -213,9 +218,9 @@ public abstract class Display {
} else {
closeNative();
}
- if(null!=eventDispatchThread) {
- eventDispatchThread.waitUntilStopped();
- eventDispatchThread=null;
+ if(null!=edtUtil) {
+ edtUtil.waitUntilStopped();
+ edtUtil=null;
}
aDevice = null;
} else {
@@ -246,14 +251,13 @@ public abstract class Display {
return aDevice;
}
- public void pumpMessages() {
- if(null!=eventDispatchThread) {
- dispatchMessages();
- } else {
- synchronized(this) {
- dispatchMessages();
- }
- }
+ public synchronized void pumpMessages() {
+ pumpMessagesImpl();
+ }
+
+ private void pumpMessagesImpl() {
+ if(0==refCount) return;
+ dispatchMessages();
}
public String toString() {
@@ -268,7 +272,8 @@ public abstract class Display {
/** Default impl. nop - Currently only X11 needs a Display lock */
protected void unlockDisplay() { }
- protected EventDispatchThread eventDispatchThread = null;
+ protected EDTUtil edtUtil = null;
+ protected Thread edt = null;
protected String name;
protected int refCount;
protected AbstractGraphicsDevice aDevice;
diff --git a/src/newt/classes/com/sun/javafx/newt/Event.java b/src/newt/classes/com/jogamp/newt/Event.java
index 3c045c52b..d42a95735 100644
--- a/src/newt/classes/com/sun/javafx/newt/Event.java
+++ b/src/newt/classes/com/jogamp/newt/Event.java
@@ -31,7 +31,7 @@
*
*/
-package com.sun.javafx.newt;
+package com.jogamp.newt;
public class Event {
private boolean isSystemEvent;
diff --git a/src/newt/classes/com/sun/javafx/newt/EventListener.java b/src/newt/classes/com/jogamp/newt/EventListener.java
index a312752fe..75cb487dd 100644
--- a/src/newt/classes/com/sun/javafx/newt/EventListener.java
+++ b/src/newt/classes/com/jogamp/newt/EventListener.java
@@ -31,7 +31,7 @@
*
*/
-package com.sun.javafx.newt;
+package com.jogamp.newt;
public interface EventListener
{
diff --git a/src/newt/classes/com/sun/javafx/newt/InputEvent.java b/src/newt/classes/com/jogamp/newt/InputEvent.java
index b49c72e75..d4c3f6905 100644
--- a/src/newt/classes/com/sun/javafx/newt/InputEvent.java
+++ b/src/newt/classes/com/jogamp/newt/InputEvent.java
@@ -31,7 +31,7 @@
*
*/
-package com.sun.javafx.newt;
+package com.jogamp.newt;
public abstract class InputEvent extends Event
{
diff --git a/src/newt/classes/com/sun/javafx/newt/Insets.java b/src/newt/classes/com/jogamp/newt/Insets.java
index 7d379cd92..e440892f0 100644
--- a/src/newt/classes/com/sun/javafx/newt/Insets.java
+++ b/src/newt/classes/com/jogamp/newt/Insets.java
@@ -30,7 +30,7 @@
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*
*/
-package com.sun.javafx.newt;
+package com.jogamp.newt;
/**
* Simple class representing insets.
diff --git a/src/newt/classes/com/sun/javafx/newt/KeyEvent.java b/src/newt/classes/com/jogamp/newt/KeyEvent.java
index c7450da67..bec77160b 100644
--- a/src/newt/classes/com/sun/javafx/newt/KeyEvent.java
+++ b/src/newt/classes/com/jogamp/newt/KeyEvent.java
@@ -31,7 +31,7 @@
*
*/
-package com.sun.javafx.newt;
+package com.jogamp.newt;
public class KeyEvent extends InputEvent
{
diff --git a/src/newt/classes/com/sun/javafx/newt/KeyListener.java b/src/newt/classes/com/jogamp/newt/KeyListener.java
index 6f022c45a..28e2b833b 100644
--- a/src/newt/classes/com/sun/javafx/newt/KeyListener.java
+++ b/src/newt/classes/com/jogamp/newt/KeyListener.java
@@ -31,7 +31,7 @@
*
*/
-package com.sun.javafx.newt;
+package com.jogamp.newt;
public interface KeyListener extends EventListener
{
diff --git a/src/newt/classes/com/sun/javafx/newt/MouseEvent.java b/src/newt/classes/com/jogamp/newt/MouseEvent.java
index ede193e1c..d5412c0cc 100644
--- a/src/newt/classes/com/sun/javafx/newt/MouseEvent.java
+++ b/src/newt/classes/com/jogamp/newt/MouseEvent.java
@@ -31,7 +31,7 @@
*
*/
-package com.sun.javafx.newt;
+package com.jogamp.newt;
public class MouseEvent extends InputEvent
{
diff --git a/src/newt/classes/com/sun/javafx/newt/MouseListener.java b/src/newt/classes/com/jogamp/newt/MouseListener.java
index 3d2031f2a..6d931dd31 100644
--- a/src/newt/classes/com/sun/javafx/newt/MouseListener.java
+++ b/src/newt/classes/com/jogamp/newt/MouseListener.java
@@ -31,7 +31,7 @@
*
*/
-package com.sun.javafx.newt;
+package com.jogamp.newt;
public interface MouseListener extends EventListener
{
diff --git a/src/newt/classes/com/sun/javafx/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java
index 6e25b19eb..2d5c10c52 100755
--- a/src/newt/classes/com/sun/javafx/newt/NewtFactory.java
+++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java
@@ -31,12 +31,12 @@
*
*/
-package com.sun.javafx.newt;
+package com.jogamp.newt;
import javax.media.nativewindow.*;
import java.util.ArrayList;
import java.util.Iterator;
-import com.sun.nativewindow.impl.jvm.JVMUtil;
+import com.jogamp.common.jvm.JVMUtil;
public abstract class NewtFactory {
// Work-around for initialization order problems on Mac OS X
diff --git a/src/newt/classes/com/sun/javafx/newt/OffscreenWindow.java b/src/newt/classes/com/jogamp/newt/OffscreenWindow.java
index 11ce8e6c7..c9c56fc61 100644
--- a/src/newt/classes/com/sun/javafx/newt/OffscreenWindow.java
+++ b/src/newt/classes/com/jogamp/newt/OffscreenWindow.java
@@ -31,7 +31,7 @@
*
*/
-package com.sun.javafx.newt;
+package com.jogamp.newt;
import javax.media.nativewindow.*;
diff --git a/src/newt/classes/com/sun/javafx/newt/PaintEvent.java b/src/newt/classes/com/jogamp/newt/PaintEvent.java
index b27b969da..51c43725a 100755
--- a/src/newt/classes/com/sun/javafx/newt/PaintEvent.java
+++ b/src/newt/classes/com/jogamp/newt/PaintEvent.java
@@ -31,7 +31,7 @@
*
*/
-package com.sun.javafx.newt;
+package com.jogamp.newt;
/**
*
diff --git a/src/newt/classes/com/sun/javafx/newt/PaintListener.java b/src/newt/classes/com/jogamp/newt/PaintListener.java
index fab5fa35c..6fbc9c8fc 100755
--- a/src/newt/classes/com/sun/javafx/newt/PaintListener.java
+++ b/src/newt/classes/com/jogamp/newt/PaintListener.java
@@ -31,7 +31,7 @@
*
*/
-package com.sun.javafx.newt;
+package com.jogamp.newt;
/**
*
diff --git a/src/newt/classes/com/sun/javafx/newt/Screen.java b/src/newt/classes/com/jogamp/newt/Screen.java
index 9edd0b719..b393d30de 100755
--- a/src/newt/classes/com/sun/javafx/newt/Screen.java
+++ b/src/newt/classes/com/jogamp/newt/Screen.java
@@ -31,9 +31,9 @@
*
*/
-package com.sun.javafx.newt;
+package com.jogamp.newt;
-import com.sun.javafx.newt.impl.*;
+import com.jogamp.newt.impl.*;
import javax.media.nativewindow.*;
import java.security.*;
@@ -46,15 +46,15 @@ public abstract class Screen {
Class screenClass = NewtFactory.getCustomClass(type, "Screen");
if(null==screenClass) {
if (NativeWindowFactory.TYPE_EGL.equals(type)) {
- screenClass = Class.forName("com.sun.javafx.newt.opengl.kd.KDScreen");
+ screenClass = Class.forName("com.jogamp.newt.opengl.kd.KDScreen");
} else if (NativeWindowFactory.TYPE_WINDOWS.equals(type)) {
- screenClass = Class.forName("com.sun.javafx.newt.windows.WindowsScreen");
+ screenClass = Class.forName("com.jogamp.newt.windows.WindowsScreen");
} else if (NativeWindowFactory.TYPE_MACOSX.equals(type)) {
- screenClass = Class.forName("com.sun.javafx.newt.macosx.MacScreen");
+ screenClass = Class.forName("com.jogamp.newt.macosx.MacScreen");
} else if (NativeWindowFactory.TYPE_X11.equals(type)) {
- screenClass = Class.forName("com.sun.javafx.newt.x11.X11Screen");
+ screenClass = Class.forName("com.jogamp.newt.x11.X11Screen");
} else if (NativeWindowFactory.TYPE_AWT.equals(type)) {
- screenClass = Class.forName("com.sun.javafx.newt.awt.AWTScreen");
+ screenClass = Class.forName("com.jogamp.newt.awt.AWTScreen");
} else {
throw new RuntimeException("Unknown window type \"" + type + "\"");
}
diff --git a/src/newt/classes/com/sun/javafx/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java
index 58bd251d2..b1f8b3977 100755
--- a/src/newt/classes/com/sun/javafx/newt/Window.java
+++ b/src/newt/classes/com/jogamp/newt/Window.java
@@ -31,13 +31,13 @@
*
*/
-package com.sun.javafx.newt;
+package com.jogamp.newt;
-import com.sun.javafx.newt.impl.Debug;
-import com.sun.javafx.newt.util.EventDispatchThread;
+import com.jogamp.newt.impl.Debug;
+import com.jogamp.newt.util.EDTUtil;
+import com.jogamp.common.util.*;
import javax.media.nativewindow.*;
-import com.sun.nativewindow.impl.NWReflection;
import java.util.ArrayList;
import java.util.Iterator;
@@ -70,15 +70,15 @@ public abstract class Window implements NativeWindow
Class windowClass = NewtFactory.getCustomClass(type, "Window");
if(null==windowClass) {
if (NativeWindowFactory.TYPE_EGL.equals(type)) {
- windowClass = Class.forName("com.sun.javafx.newt.opengl.kd.KDWindow");
+ windowClass = Class.forName("com.jogamp.newt.opengl.kd.KDWindow");
} else if (NativeWindowFactory.TYPE_WINDOWS.equals(type)) {
- windowClass = Class.forName("com.sun.javafx.newt.windows.WindowsWindow");
+ windowClass = Class.forName("com.jogamp.newt.windows.WindowsWindow");
} else if (NativeWindowFactory.TYPE_MACOSX.equals(type)) {
- windowClass = Class.forName("com.sun.javafx.newt.macosx.MacWindow");
+ windowClass = Class.forName("com.jogamp.newt.macosx.MacWindow");
} else if (NativeWindowFactory.TYPE_X11.equals(type)) {
- windowClass = Class.forName("com.sun.javafx.newt.x11.X11Window");
+ windowClass = Class.forName("com.jogamp.newt.x11.X11Window");
} else if (NativeWindowFactory.TYPE_AWT.equals(type)) {
- windowClass = Class.forName("com.sun.javafx.newt.awt.AWTWindow");
+ windowClass = Class.forName("com.jogamp.newt.awt.AWTWindow");
} else {
throw new NativeWindowException("Unknown window type \"" + type + "\"");
}
@@ -98,10 +98,10 @@ public abstract class Window implements NativeWindow
window.invalidate();
window.screen = screen;
window.setUndecorated(undecorated||0!=parentWindowHandle);
- EventDispatchThread edt = screen.getDisplay().getEDT();
- if(null!=edt) {
+ EDTUtil edtUtil = screen.getDisplay().getEDTUtil();
+ if(null!=edtUtil) {
final Window f_win = window;
- edt.invokeAndWait(new Runnable() {
+ edtUtil.invokeAndWait(new Runnable() {
public void run() {
f_win.createNative(parentWindowHandle, caps);
}
@@ -109,6 +109,9 @@ public abstract class Window implements NativeWindow
} else {
window.createNative(parentWindowHandle, caps);
}
+ if(DEBUG_WINDOW_EVENT) {
+ System.out.println("Window.create-1() done ("+Thread.currentThread()+", "+window+")");
+ }
return window;
} catch (Throwable t) {
t.printStackTrace();
@@ -127,14 +130,14 @@ public abstract class Window implements NativeWindow
if ( argsChecked < cstrArguments.length ) {
throw new NativeWindowException("WindowClass "+windowClass+" constructor mismatch at argument #"+argsChecked+"; Constructor: "+getTypeStrList(cstrArgumentTypes)+", arguments: "+getArgsStrList(cstrArguments));
}
- Window window = (Window) NWReflection.createInstance( windowClass, cstrArgumentTypes, cstrArguments ) ;
+ Window window = (Window) ReflectionUtil.createInstance( windowClass, cstrArgumentTypes, cstrArguments ) ;
window.invalidate();
window.screen = screen;
window.setUndecorated(undecorated);
- EventDispatchThread edt = screen.getDisplay().getEDT();
- if(null!=edt) {
+ EDTUtil edtUtil = screen.getDisplay().getEDTUtil();
+ if(null!=edtUtil) {
final Window f_win = window;
- edt.invokeAndWait(new Runnable() {
+ edtUtil.invokeAndWait(new Runnable() {
public void run() {
f_win.createNative(0, caps);
}
@@ -142,9 +145,11 @@ public abstract class Window implements NativeWindow
} else {
window.createNative(0, caps);
}
+ if(DEBUG_WINDOW_EVENT) {
+ System.out.println("Window.create-2() done ("+Thread.currentThread()+", "+window+")");
+ }
return window;
} catch (Throwable t) {
- t.printStackTrace();
throw new NativeWindowException(t);
}
}
@@ -212,15 +217,15 @@ public abstract class Window implements NativeWindow
public String toString() {
StringBuffer sb = new StringBuffer();
- sb.append(getClass().getName()+"[config "+config+
- ", windowHandle "+toHexString(getWindowHandle())+
- ", surfaceHandle "+toHexString(getSurfaceHandle())+
- ", pos "+getX()+"/"+getY()+", size "+getWidth()+"x"+getHeight()+
- ", visible "+isVisible()+
- ", undecorated "+undecorated+
- ", fullscreen "+fullscreen+
- ", "+screen+
- ", wrappedWindow "+getWrappedWindow());
+ sb.append(getClass().getName()+"[Config "+config+
+ "\n, "+screen+
+ "\n, WindowHandle "+toHexString(getWindowHandle())+
+ "\n, SurfaceHandle "+toHexString(getSurfaceHandle())+
+ "\n, Pos "+getX()+"/"+getY()+", size "+getWidth()+"x"+getHeight()+
+ "\n, Visible "+isVisible()+
+ "\n, Undecorated "+undecorated+
+ "\n, Fullscreen "+fullscreen+
+ "\n, WrappedWindow "+getWrappedWindow());
sb.append(", SurfaceUpdatedListeners num "+surfaceUpdatedListeners.size()+" [");
for (Iterator iter = surfaceUpdatedListeners.iterator(); iter.hasNext(); ) {
@@ -264,71 +269,48 @@ public abstract class Window implements NativeWindow
//
// NativeWindow impl
//
- private Thread owner;
- private int recursionCount;
- protected Exception lockedStack = null;
/** Recursive and blocking lockSurface() implementation */
public synchronized int lockSurface() {
// We leave the ToolkitLock lock to the specializtion's discretion,
// ie the implicit JAWTWindow in case of AWTWindow
- Thread cur = Thread.currentThread();
- if (owner == cur) {
- ++recursionCount;
- return LOCK_SUCCESS;
- }
- while (owner != null) {
- try {
- wait();
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- }
- owner = cur;
- lockedStack = new Exception("NEWT Surface previously locked by "+Thread.currentThread());
+ surfaceLock.lock();
screen.getDisplay().lockDisplay();
return LOCK_SUCCESS;
}
/** Recursive and unblocking unlockSurface() implementation */
public synchronized void unlockSurface() throws NativeWindowException {
- Thread cur = Thread.currentThread();
- if (owner != cur) {
- lockedStack.printStackTrace();
- throw new NativeWindowException(cur+": Not owner, owner is "+owner);
- }
- if (recursionCount > 0) {
- --recursionCount;
- return;
- }
- owner = null;
- lockedStack = null;
- screen.getDisplay().unlockDisplay();
- notifyAll();
+ surfaceLock.unlock( new Runnable() {
+ final Screen f_screen = screen;
+ public void run() {
+ screen.getDisplay().unlockDisplay();
+ }
+ } );
// We leave the ToolkitLock unlock to the specializtion's discretion,
// ie the implicit JAWTWindow in case of AWTWindow
}
public synchronized boolean isSurfaceLocked() {
- return null!=owner;
+ return surfaceLock.isLocked();
}
public synchronized Thread getSurfaceLockOwner() {
- return owner;
+ return surfaceLock.getOwner();
}
public synchronized Exception getLockedStack() {
- return lockedStack;
+ return surfaceLock.getLockedStack();
}
- public synchronized void destroy() {
+ public void destroy() {
destroy(false);
}
/** @param deep If true, the linked Screen and Display will be destroyed as well. */
- public synchronized void destroy(boolean deep) {
+ public void destroy(boolean deep) {
if(DEBUG_WINDOW_EVENT) {
- System.out.println("Window.destroy() start (deep "+deep+" - "+Thread.currentThread());
+ System.out.println("Window.destroy() start (deep "+deep+" - "+Thread.currentThread()+", "+this+")");
}
synchronized(surfaceUpdatedListeners) {
surfaceUpdatedListeners = new ArrayList();
@@ -342,26 +324,36 @@ public abstract class Window implements NativeWindow
synchronized(keyListeners) {
keyListeners = new ArrayList();
}
- Screen scr = screen;
- Display dpy = (null!=screen) ? screen.getDisplay() : null;
- EventDispatchThread edt = (null!=dpy) ? dpy.getEDT() : null;
- if(null!=edt) {
- final Window f_win = this;
- edt.invokeAndWait(new Runnable() {
- public void run() {
- f_win.closeNative();
+ synchronized(this) {
+ destructionLock.lock();
+ try {
+ Display dpy = null;
+ if( null != screen && 0 != windowHandle ) {
+ Screen scr = screen;
+ dpy = (null!=screen) ? screen.getDisplay() : null;
+ EDTUtil edtUtil = (null!=dpy) ? dpy.getEDTUtil() : null;
+ if(null!=edtUtil) {
+ final Window f_win = this;
+ edtUtil.invokeAndWait(new Runnable() {
+ public void run() {
+ f_win.closeNative();
+ }
+ } );
+ } else {
+ closeNative();
+ }
}
- } );
- } else {
- closeNative();
- }
- invalidate();
- if(deep) {
- if(null!=scr) {
- scr.destroy();
- }
- if(null!=dpy) {
- dpy.destroy();
+ invalidate();
+ if(deep) {
+ if(null!=screen) {
+ screen.destroy();
+ }
+ if(null!=dpy) {
+ dpy.destroy();
+ }
+ }
+ } finally {
+ destructionLock.unlock();
}
}
if(DEBUG_WINDOW_EVENT) {
@@ -487,12 +479,12 @@ public abstract class Window implements NativeWindow
protected void windowDestroyNotify() {
if(DEBUG_WINDOW_EVENT) {
- System.out.println("Window.windowDestroyeNotify start "+Thread.currentThread());
+ System.out.println("Window.windowDestroyNotify start "+Thread.currentThread());
}
sendWindowEvent(WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY);
- if(!autoDrawableMember) {
+ if(!autoDrawableMember && !destructionLock.isLocked()) {
destroy();
}
@@ -505,7 +497,9 @@ public abstract class Window implements NativeWindow
if(DEBUG_WINDOW_EVENT) {
System.out.println("Window.windowDestroyed "+Thread.currentThread());
}
- invalidate();
+ if(!destructionLock.isLocked()) {
+ invalidate();
+ }
}
public abstract void setVisible(boolean visible);
@@ -554,6 +548,12 @@ public abstract class Window implements NativeWindow
}
}
+ public void removeAllSurfaceUpdatedListener() {
+ synchronized(surfaceUpdatedListeners) {
+ surfaceUpdatedListeners = new ArrayList();
+ }
+ }
+
public SurfaceUpdatedListener[] getSurfaceUpdatedListener() {
synchronized(surfaceUpdatedListeners) {
return (SurfaceUpdatedListener[]) surfaceUpdatedListeners.toArray();
@@ -926,4 +926,78 @@ public abstract class Window implements NativeWindow
}
return sb.toString();
}
+
+ //
+ // Reentrance locking toolkit
+ //
+ public static class WindowToolkitLock implements ToolkitLock {
+ private Thread owner;
+ private int recursionCount;
+ private Exception lockedStack = null;
+
+ public Exception getLockedStack() {
+ return lockedStack;
+ }
+
+ public Thread getOwner() {
+ return owner;
+ }
+
+ public boolean isOwner() {
+ return isOwner(Thread.currentThread());
+ }
+
+ public synchronized boolean isOwner(Thread thread) {
+ return owner == thread ;
+ }
+
+ public synchronized boolean isLocked() {
+ return null != owner;
+ }
+
+ /** Recursive and blocking lockSurface() implementation */
+ public synchronized void lock() {
+ Thread cur = Thread.currentThread();
+ if (owner == cur) {
+ ++recursionCount;
+ }
+ while (owner != null) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ owner = cur;
+ lockedStack = new Exception("Previously locked by "+owner);
+ }
+
+
+ /** Recursive and unblocking unlockSurface() implementation */
+ public synchronized void unlock() {
+ unlock(null);
+ }
+
+ /** Recursive and unblocking unlockSurface() implementation */
+ public synchronized void unlock(Runnable releaseAfterUnlockBeforeNotify) {
+ Thread cur = Thread.currentThread();
+ if (owner != cur) {
+ lockedStack.printStackTrace();
+ throw new RuntimeException(cur+": Not owner, owner is "+owner);
+ }
+ if (recursionCount > 0) {
+ --recursionCount;
+ return;
+ }
+ owner = null;
+ lockedStack = null;
+ if(null!=releaseAfterUnlockBeforeNotify) {
+ releaseAfterUnlockBeforeNotify.run();
+ }
+ notifyAll();
+ }
+ }
+ private WindowToolkitLock destructionLock = new WindowToolkitLock();
+ private WindowToolkitLock surfaceLock = new WindowToolkitLock();
}
+
diff --git a/src/newt/classes/com/sun/javafx/newt/WindowEvent.java b/src/newt/classes/com/jogamp/newt/WindowEvent.java
index c5aa65e3d..1189401af 100644
--- a/src/newt/classes/com/sun/javafx/newt/WindowEvent.java
+++ b/src/newt/classes/com/jogamp/newt/WindowEvent.java
@@ -31,7 +31,7 @@
*
*/
-package com.sun.javafx.newt;
+package com.jogamp.newt;
public class WindowEvent extends Event {
public static final int EVENT_WINDOW_RESIZED = 100;
diff --git a/src/newt/classes/com/sun/javafx/newt/WindowListener.java b/src/newt/classes/com/jogamp/newt/WindowListener.java
index 81624fa75..0ec63435c 100644
--- a/src/newt/classes/com/sun/javafx/newt/WindowListener.java
+++ b/src/newt/classes/com/jogamp/newt/WindowListener.java
@@ -31,7 +31,7 @@
*
*/
-package com.sun.javafx.newt;
+package com.jogamp.newt;
public interface WindowListener extends EventListener {
public void windowResized(WindowEvent e);
diff --git a/src/newt/classes/com/sun/javafx/newt/awt/AWTCanvas.java b/src/newt/classes/com/jogamp/newt/awt/AWTCanvas.java
index 6b8fc43c7..f6ea9acc3 100644
--- a/src/newt/classes/com/sun/javafx/newt/awt/AWTCanvas.java
+++ b/src/newt/classes/com/jogamp/newt/awt/AWTCanvas.java
@@ -31,9 +31,9 @@
*
*/
-package com.sun.javafx.newt.awt;
+package com.jogamp.newt.awt;
-import com.sun.javafx.newt.Window;
+import com.jogamp.newt.Window;
import java.awt.Canvas;
import java.awt.GraphicsDevice;
@@ -42,7 +42,7 @@ import java.awt.GraphicsConfiguration;
import javax.media.nativewindow.*;
import javax.media.nativewindow.awt.*;
-import com.sun.javafx.newt.impl.Debug;
+import com.jogamp.newt.impl.Debug;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
diff --git a/src/newt/classes/com/sun/javafx/newt/awt/AWTDisplay.java b/src/newt/classes/com/jogamp/newt/awt/AWTDisplay.java
index 19f3ed1a8..09ce10017 100644
--- a/src/newt/classes/com/sun/javafx/newt/awt/AWTDisplay.java
+++ b/src/newt/classes/com/jogamp/newt/awt/AWTDisplay.java
@@ -31,11 +31,11 @@
*
*/
-package com.sun.javafx.newt.awt;
+package com.jogamp.newt.awt;
import java.awt.event.*;
-import com.sun.javafx.newt.Display;
-import com.sun.javafx.newt.Window;
+import com.jogamp.newt.Display;
+import com.jogamp.newt.Window;
import javax.media.nativewindow.*;
import javax.media.nativewindow.awt.*;
import java.util.*;
@@ -66,20 +66,20 @@ public class AWTDisplay extends Display {
}
if (w != null) {
switch (w.getType()) {
- case com.sun.javafx.newt.WindowEvent.EVENT_WINDOW_RESIZED:
- case com.sun.javafx.newt.WindowEvent.EVENT_WINDOW_MOVED:
- case com.sun.javafx.newt.WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY:
+ case com.jogamp.newt.WindowEvent.EVENT_WINDOW_RESIZED:
+ case com.jogamp.newt.WindowEvent.EVENT_WINDOW_MOVED:
+ case com.jogamp.newt.WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY:
w.getWindow().sendWindowEvent(w.getType());
break;
- case com.sun.javafx.newt.MouseEvent.EVENT_MOUSE_CLICKED:
- case com.sun.javafx.newt.MouseEvent.EVENT_MOUSE_ENTERED:
- case com.sun.javafx.newt.MouseEvent.EVENT_MOUSE_EXITED:
- case com.sun.javafx.newt.MouseEvent.EVENT_MOUSE_PRESSED:
- case com.sun.javafx.newt.MouseEvent.EVENT_MOUSE_RELEASED:
- case com.sun.javafx.newt.MouseEvent.EVENT_MOUSE_MOVED:
- case com.sun.javafx.newt.MouseEvent.EVENT_MOUSE_DRAGGED:
- case com.sun.javafx.newt.MouseEvent.EVENT_MOUSE_WHEEL_MOVED:
+ case com.jogamp.newt.MouseEvent.EVENT_MOUSE_CLICKED:
+ case com.jogamp.newt.MouseEvent.EVENT_MOUSE_ENTERED:
+ case com.jogamp.newt.MouseEvent.EVENT_MOUSE_EXITED:
+ case com.jogamp.newt.MouseEvent.EVENT_MOUSE_PRESSED:
+ case com.jogamp.newt.MouseEvent.EVENT_MOUSE_RELEASED:
+ case com.jogamp.newt.MouseEvent.EVENT_MOUSE_MOVED:
+ case com.jogamp.newt.MouseEvent.EVENT_MOUSE_DRAGGED:
+ case com.jogamp.newt.MouseEvent.EVENT_MOUSE_WHEEL_MOVED:
{
MouseEvent e = (MouseEvent) w.getEvent();
int rotation = 0;
@@ -92,9 +92,9 @@ public class AWTDisplay extends Display {
}
break;
- case com.sun.javafx.newt.KeyEvent.EVENT_KEY_PRESSED:
- case com.sun.javafx.newt.KeyEvent.EVENT_KEY_RELEASED:
- case com.sun.javafx.newt.KeyEvent.EVENT_KEY_TYPED:
+ case com.jogamp.newt.KeyEvent.EVENT_KEY_PRESSED:
+ case com.jogamp.newt.KeyEvent.EVENT_KEY_RELEASED:
+ case com.jogamp.newt.KeyEvent.EVENT_KEY_TYPED:
{
KeyEvent e = (KeyEvent) w.getEvent();
w.getWindow().sendKeyEvent(w.getType(), convertModifiers(e),
@@ -148,19 +148,19 @@ public class AWTDisplay extends Display {
private static int convertModifiers(InputEvent e) {
int newtMods = 0;
int mods = e.getModifiers();
- if ((mods & InputEvent.SHIFT_MASK) != 0) newtMods |= com.sun.javafx.newt.InputEvent.SHIFT_MASK;
- if ((mods & InputEvent.CTRL_MASK) != 0) newtMods |= com.sun.javafx.newt.InputEvent.CTRL_MASK;
- if ((mods & InputEvent.META_MASK) != 0) newtMods |= com.sun.javafx.newt.InputEvent.META_MASK;
- if ((mods & InputEvent.ALT_MASK) != 0) newtMods |= com.sun.javafx.newt.InputEvent.ALT_MASK;
- if ((mods & InputEvent.ALT_GRAPH_MASK) != 0) newtMods |= com.sun.javafx.newt.InputEvent.ALT_GRAPH_MASK;
+ if ((mods & InputEvent.SHIFT_MASK) != 0) newtMods |= com.jogamp.newt.InputEvent.SHIFT_MASK;
+ if ((mods & InputEvent.CTRL_MASK) != 0) newtMods |= com.jogamp.newt.InputEvent.CTRL_MASK;
+ if ((mods & InputEvent.META_MASK) != 0) newtMods |= com.jogamp.newt.InputEvent.META_MASK;
+ if ((mods & InputEvent.ALT_MASK) != 0) newtMods |= com.jogamp.newt.InputEvent.ALT_MASK;
+ if ((mods & InputEvent.ALT_GRAPH_MASK) != 0) newtMods |= com.jogamp.newt.InputEvent.ALT_GRAPH_MASK;
return newtMods;
}
private static int convertButton(MouseEvent e) {
switch (e.getButton()) {
- case MouseEvent.BUTTON1: return com.sun.javafx.newt.MouseEvent.BUTTON1;
- case MouseEvent.BUTTON2: return com.sun.javafx.newt.MouseEvent.BUTTON2;
- case MouseEvent.BUTTON3: return com.sun.javafx.newt.MouseEvent.BUTTON3;
+ case MouseEvent.BUTTON1: return com.jogamp.newt.MouseEvent.BUTTON1;
+ case MouseEvent.BUTTON2: return com.jogamp.newt.MouseEvent.BUTTON2;
+ case MouseEvent.BUTTON3: return com.jogamp.newt.MouseEvent.BUTTON3;
}
return 0;
}
diff --git a/src/newt/classes/com/sun/javafx/newt/awt/AWTScreen.java b/src/newt/classes/com/jogamp/newt/awt/AWTScreen.java
index 9bda5893b..c804bce06 100644
--- a/src/newt/classes/com/sun/javafx/newt/awt/AWTScreen.java
+++ b/src/newt/classes/com/jogamp/newt/awt/AWTScreen.java
@@ -31,9 +31,9 @@
*
*/
-package com.sun.javafx.newt.awt;
+package com.jogamp.newt.awt;
-import com.sun.javafx.newt.*;
+import com.jogamp.newt.*;
import java.awt.DisplayMode;
import javax.media.nativewindow.*;
import javax.media.nativewindow.awt.*;
diff --git a/src/newt/classes/com/sun/javafx/newt/awt/AWTWindow.java b/src/newt/classes/com/jogamp/newt/awt/AWTWindow.java
index 9725cf08b..7beeed44b 100644
--- a/src/newt/classes/com/sun/javafx/newt/awt/AWTWindow.java
+++ b/src/newt/classes/com/jogamp/newt/awt/AWTWindow.java
@@ -31,7 +31,7 @@
*
*/
-package com.sun.javafx.newt.awt;
+package com.jogamp.newt.awt;
import java.awt.BorderLayout;
import java.awt.Canvas;
@@ -47,7 +47,7 @@ import java.awt.event.*;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.*;
-import com.sun.javafx.newt.Window;
+import com.jogamp.newt.Window;
import java.awt.Insets;
import javax.media.nativewindow.*;
import javax.media.nativewindow.awt.*;
@@ -134,18 +134,30 @@ public class AWTWindow extends Window {
}
}
});
+ this.windowHandle = 1; // just a marker ..
}
protected void closeNative() {
- runOnEDT(true, new Runnable() {
- public void run() {
- if(owningFrame && null!=frame) {
+ this.windowHandle = 0; // just a marker ..
+ if(null!=container) {
+ runOnEDT(true, new Runnable() {
+ public void run() {
+ container.setVisible(false);
+ container.remove(canvas);
+ container.setEnabled(false);
+ canvas.setEnabled(false);
+ }
+ });
+ }
+ if(owningFrame && null!=frame) {
+ runOnEDT(true, new Runnable() {
+ public void run() {
frame.dispose();
owningFrame=false;
+ frame = null;
}
- frame = null;
- }
- });
+ });
+ }
}
public boolean hasDeviceChanged() {
@@ -204,7 +216,7 @@ public class AWTWindow extends Window {
});
}
- public com.sun.javafx.newt.Insets getInsets() {
+ public com.jogamp.newt.Insets getInsets() {
final int insets[] = new int[] { 0, 0, 0, 0 };
runOnEDT(true, new Runnable() {
public void run() {
@@ -215,7 +227,7 @@ public class AWTWindow extends Window {
insets[3] = contInsets.right;
}
});
- return new com.sun.javafx.newt.
+ return new com.jogamp.newt.
Insets(insets[0],insets[1],insets[2],insets[3]);
}
@@ -324,7 +336,7 @@ public class AWTWindow extends Window {
x = container.getX();
y = container.getY();
}
- display.enqueueEvent(window, com.sun.javafx.newt.WindowEvent.EVENT_WINDOW_MOVED, null);
+ display.enqueueEvent(window, com.jogamp.newt.WindowEvent.EVENT_WINDOW_MOVED, null);
}
public void componentShown(ComponentEvent e) {
@@ -347,7 +359,7 @@ public class AWTWindow extends Window {
public void componentResized(ComponentEvent e) {
width = canvas.getWidth();
height = canvas.getHeight();
- display.enqueueEvent(window, com.sun.javafx.newt.WindowEvent.EVENT_WINDOW_RESIZED, null);
+ display.enqueueEvent(window, com.jogamp.newt.WindowEvent.EVENT_WINDOW_RESIZED, null);
}
public void componentMoved(ComponentEvent e) {
@@ -365,39 +377,39 @@ public class AWTWindow extends Window {
}
public void mouseEntered(MouseEvent e) {
- display.enqueueEvent(window, com.sun.javafx.newt.MouseEvent.EVENT_MOUSE_ENTERED, e);
+ display.enqueueEvent(window, com.jogamp.newt.MouseEvent.EVENT_MOUSE_ENTERED, e);
}
public void mouseExited(MouseEvent e) {
- display.enqueueEvent(window, com.sun.javafx.newt.MouseEvent.EVENT_MOUSE_EXITED, e);
+ display.enqueueEvent(window, com.jogamp.newt.MouseEvent.EVENT_MOUSE_EXITED, e);
}
public void mousePressed(MouseEvent e) {
- display.enqueueEvent(window, com.sun.javafx.newt.MouseEvent.EVENT_MOUSE_PRESSED, e);
+ display.enqueueEvent(window, com.jogamp.newt.MouseEvent.EVENT_MOUSE_PRESSED, e);
}
public void mouseReleased(MouseEvent e) {
- display.enqueueEvent(window, com.sun.javafx.newt.MouseEvent.EVENT_MOUSE_RELEASED, e);
+ display.enqueueEvent(window, com.jogamp.newt.MouseEvent.EVENT_MOUSE_RELEASED, e);
}
public void mouseMoved(MouseEvent e) {
- display.enqueueEvent(window, com.sun.javafx.newt.MouseEvent.EVENT_MOUSE_MOVED, e);
+ display.enqueueEvent(window, com.jogamp.newt.MouseEvent.EVENT_MOUSE_MOVED, e);
}
public void mouseDragged(MouseEvent e) {
- display.enqueueEvent(window, com.sun.javafx.newt.MouseEvent.EVENT_MOUSE_DRAGGED, e);
+ display.enqueueEvent(window, com.jogamp.newt.MouseEvent.EVENT_MOUSE_DRAGGED, e);
}
public void keyPressed(KeyEvent e) {
- display.enqueueEvent(window, com.sun.javafx.newt.KeyEvent.EVENT_KEY_PRESSED, e);
+ display.enqueueEvent(window, com.jogamp.newt.KeyEvent.EVENT_KEY_PRESSED, e);
}
public void keyReleased(KeyEvent e) {
- display.enqueueEvent(window, com.sun.javafx.newt.KeyEvent.EVENT_KEY_RELEASED, e);
+ display.enqueueEvent(window, com.jogamp.newt.KeyEvent.EVENT_KEY_RELEASED, e);
}
public void keyTyped(KeyEvent e) {
- display.enqueueEvent(window, com.sun.javafx.newt.KeyEvent.EVENT_KEY_TYPED, e);
+ display.enqueueEvent(window, com.jogamp.newt.KeyEvent.EVENT_KEY_TYPED, e);
}
}
@@ -415,7 +427,7 @@ public class AWTWindow extends Window {
public void windowClosed(WindowEvent e) {
}
public void windowClosing(WindowEvent e) {
- display.enqueueEvent(window, com.sun.javafx.newt.WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY, null);
+ display.enqueueEvent(window, com.jogamp.newt.WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY, null);
}
public void windowDeactivated(WindowEvent e) {
}
diff --git a/src/newt/classes/com/sun/javafx/newt/impl/Debug.java b/src/newt/classes/com/jogamp/newt/impl/Debug.java
index 202d9d5b3..62c261d2e 100644
--- a/src/newt/classes/com/sun/javafx/newt/impl/Debug.java
+++ b/src/newt/classes/com/jogamp/newt/impl/Debug.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.javafx.newt.impl;
+package com.jogamp.newt.impl;
import java.security.*;
@@ -54,7 +54,7 @@ public class Debug {
verbose = isPropertyDefined("newt.verbose", true);
debugAll = isPropertyDefined("newt.debug", true);
if (verbose) {
- Package p = Package.getPackage("com.sun.javafx.newt");
+ Package p = Package.getPackage("com.jogamp.newt");
System.err.println("NEWT specification version " + p.getSpecificationVersion());
System.err.println("NEWT implementation version " + p.getImplementationVersion());
System.err.println("NEWT implementation vendor " + p.getImplementationVendor());
diff --git a/src/newt/classes/com/sun/javafx/newt/impl/NativeLibLoader.java b/src/newt/classes/com/jogamp/newt/impl/NEWTJNILibLoader.java
index d96c56f6e..a4d234fd5 100644
--- a/src/newt/classes/com/sun/javafx/newt/impl/NativeLibLoader.java
+++ b/src/newt/classes/com/jogamp/newt/impl/NEWTJNILibLoader.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package com.sun.javafx.newt.impl;
+package com.jogamp.newt.impl;
// FIXME: refactor Java SE dependencies
//import java.awt.Toolkit;
@@ -46,9 +46,9 @@ import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.HashSet;
-import com.sun.nativewindow.impl.NativeLibLoaderBase;
+import com.jogamp.common.jvm.JNILibLoaderBase;
-public class NativeLibLoader extends NativeLibLoaderBase {
+public class NEWTJNILibLoader extends JNILibLoaderBase {
public static void loadNEWT() {
AccessController.doPrivileged(new PrivilegedAction() {
diff --git a/src/newt/classes/com/sun/javafx/newt/intel/gdl/Display.java b/src/newt/classes/com/jogamp/newt/intel/gdl/Display.java
index b1f0ac6d2..a3e5501c4 100644
--- a/src/newt/classes/com/sun/javafx/newt/intel/gdl/Display.java
+++ b/src/newt/classes/com/jogamp/newt/intel/gdl/Display.java
@@ -31,16 +31,16 @@
*
*/
-package com.sun.javafx.newt.intel.gdl;
+package com.jogamp.newt.intel.gdl;
-import com.sun.javafx.newt.impl.*;
+import com.jogamp.newt.impl.*;
import javax.media.nativewindow.*;
-public class Display extends com.sun.javafx.newt.Display {
+public class Display extends com.jogamp.newt.Display {
static int initCounter = 0;
static {
- NativeLibLoader.loadNEWT();
+ NEWTJNILibLoader.loadNEWT();
if (!Screen.initIDs()) {
throw new NativeWindowException("Failed to initialize GDL Screen jmethodIDs");
diff --git a/src/newt/classes/com/sun/javafx/newt/intel/gdl/Screen.java b/src/newt/classes/com/jogamp/newt/intel/gdl/Screen.java
index 83d9074e2..873d1d009 100644
--- a/src/newt/classes/com/sun/javafx/newt/intel/gdl/Screen.java
+++ b/src/newt/classes/com/jogamp/newt/intel/gdl/Screen.java
@@ -31,12 +31,12 @@
*
*/
-package com.sun.javafx.newt.intel.gdl;
+package com.jogamp.newt.intel.gdl;
-import com.sun.javafx.newt.impl.*;
+import com.jogamp.newt.impl.*;
import javax.media.nativewindow.*;
-public class Screen extends com.sun.javafx.newt.Screen {
+public class Screen extends com.jogamp.newt.Screen {
static {
Display.initSingleton();
diff --git a/src/newt/classes/com/sun/javafx/newt/intel/gdl/Window.java b/src/newt/classes/com/jogamp/newt/intel/gdl/Window.java
index 0332f442a..879fc6134 100644
--- a/src/newt/classes/com/sun/javafx/newt/intel/gdl/Window.java
+++ b/src/newt/classes/com/jogamp/newt/intel/gdl/Window.java
@@ -31,11 +31,11 @@
*
*/
-package com.sun.javafx.newt.intel.gdl;
+package com.jogamp.newt.intel.gdl;
import javax.media.nativewindow.*;
-public class Window extends com.sun.javafx.newt.Window {
+public class Window extends com.jogamp.newt.Window {
static {
Display.initSingleton();
}
diff --git a/src/newt/classes/com/sun/javafx/newt/macosx/MacDisplay.java b/src/newt/classes/com/jogamp/newt/macosx/MacDisplay.java
index cd22b2b36..0b5297685 100755
--- a/src/newt/classes/com/sun/javafx/newt/macosx/MacDisplay.java
+++ b/src/newt/classes/com/jogamp/newt/macosx/MacDisplay.java
@@ -31,17 +31,17 @@
*
*/
-package com.sun.javafx.newt.macosx;
+package com.jogamp.newt.macosx;
import javax.media.nativewindow.*;
import javax.media.nativewindow.macosx.*;
-import com.sun.javafx.newt.*;
-import com.sun.javafx.newt.impl.*;
-import com.sun.javafx.newt.util.MainThread;
+import com.jogamp.newt.*;
+import com.jogamp.newt.impl.*;
+import com.jogamp.newt.util.MainThread;
public class MacDisplay extends Display {
static {
- NativeLibLoader.loadNEWT();
+ NEWTJNILibLoader.loadNEWT();
if(!initNSApplication()) {
throw new NativeWindowException("Failed to initialize native Application hook");
diff --git a/src/newt/classes/com/sun/javafx/newt/macosx/MacScreen.java b/src/newt/classes/com/jogamp/newt/macosx/MacScreen.java
index 8983b8803..92f8e908c 100755
--- a/src/newt/classes/com/sun/javafx/newt/macosx/MacScreen.java
+++ b/src/newt/classes/com/jogamp/newt/macosx/MacScreen.java
@@ -31,9 +31,9 @@
*
*/
-package com.sun.javafx.newt.macosx;
+package com.jogamp.newt.macosx;
-import com.sun.javafx.newt.*;
+import com.jogamp.newt.*;
import javax.media.nativewindow.*;
public class MacScreen extends Screen {
diff --git a/src/newt/classes/com/sun/javafx/newt/macosx/MacWindow.java b/src/newt/classes/com/jogamp/newt/macosx/MacWindow.java
index 9f501ac9b..52d6fb0c7 100755
--- a/src/newt/classes/com/sun/javafx/newt/macosx/MacWindow.java
+++ b/src/newt/classes/com/jogamp/newt/macosx/MacWindow.java
@@ -31,13 +31,13 @@
*
*/
-package com.sun.javafx.newt.macosx;
+package com.jogamp.newt.macosx;
import javax.media.nativewindow.*;
-import com.sun.javafx.newt.util.MainThread;
-import com.sun.javafx.newt.*;
-import com.sun.javafx.newt.impl.*;
+import com.jogamp.newt.util.MainThread;
+import com.jogamp.newt.*;
+import com.jogamp.newt.impl.*;
public class MacWindow extends Window {
@@ -212,42 +212,16 @@ public class MacWindow extends Window {
}
}
- private ToolkitLock nsViewLock = new ToolkitLock() {
- private Thread owner;
- private int recursionCount;
-
- public synchronized void lock() {
- Thread cur = Thread.currentThread();
- if (owner == cur) {
- ++recursionCount;
- return;
- }
- while (owner != null) {
- try {
- wait();
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- }
- owner = cur;
- }
-
- public synchronized void unlock() {
- if (owner != Thread.currentThread()) {
- throw new RuntimeException("Not owner");
- }
- if (recursionCount > 0) {
- --recursionCount;
- return;
- }
- owner = null;
- notifyAll();
- }
- };
+ private WindowToolkitLock nsViewLock = new WindowToolkitLock();
public synchronized int lockSurface() throws NativeWindowException {
nsViewLock.lock();
- return super.lockSurface();
+ try {
+ return super.lockSurface();
+ } catch (RuntimeException re) {
+ nsViewLock.unlock();
+ throw re;
+ }
}
public void unlockSurface() {
diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index e809d2cdc..fec70c99c 100644
--- a/src/newt/classes/com/sun/javafx/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -31,12 +31,12 @@
*
*/
-package com.sun.javafx.newt.opengl;
+package com.jogamp.newt.opengl;
-import com.sun.javafx.newt.*;
+import com.jogamp.newt.*;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.sun.opengl.impl.GLDrawableHelper;
+import com.jogamp.opengl.impl.GLDrawableHelper;
import java.util.*;
/**
@@ -58,13 +58,14 @@ public class GLWindow extends Window implements GLAutoDrawable {
private Window window;
private boolean runPumpMessages;
- /** Constructor. Do not call this directly -- use {@link
- create()} instead. */
+ /**
+ * Constructor. Do not call this directly -- use {@link #create()} instead.
+ */
protected GLWindow(Window window, boolean ownerOfWinScrDpy) {
this.ownerOfWinScrDpy = ownerOfWinScrDpy;
this.window = window;
this.window.setAutoDrawableClient(true);
- this.runPumpMessages = ( null == getScreen().getDisplay().getEDT() ) ;
+ this.runPumpMessages = ( null == getScreen().getDisplay().getEDTUtil() ) ;
window.addWindowListener(new WindowListener() {
public void windowResized(WindowEvent e) {
sendReshape = true;
@@ -145,13 +146,13 @@ public class GLWindow extends Window implements GLAutoDrawable {
* Best performance has been achieved with one GLWindow per thread.<br>
*
* Enabling local pump messages while using the EDT,
- * {@link com.sun.javafx.newt.NewtFactory#setUseEDT(boolean)},
+ * {@link com.jogamp.newt.NewtFactory#setUseEDT(boolean)},
* will result in an exception.
*
* @deprecated EXPERIMENTAL, semantic is about to be removed after further verification.
*/
public void setRunPumpMessages(boolean onoff) {
- if( onoff && null!=getScreen().getDisplay().getEDT() ) {
+ if( onoff && null!=getScreen().getDisplay().getEDTUtil() ) {
throw new GLException("GLWindow.setRunPumpMessages(true) - Can't do with EDT on");
}
runPumpMessages = onoff;
@@ -334,6 +335,9 @@ public class GLWindow extends Window implements GLAutoDrawable {
public void removeSurfaceUpdatedListener(SurfaceUpdatedListener l) {
window.removeSurfaceUpdatedListener(l);
}
+ public void removeAllSurfaceUpdatedListener() {
+ window.removeAllSurfaceUpdatedListener();
+ }
public SurfaceUpdatedListener[] getSurfaceUpdatedListener() {
return window.getSurfaceUpdatedListener();
}
@@ -378,7 +382,7 @@ public class GLWindow extends Window implements GLAutoDrawable {
}
public String toString() {
- return "NEWT-GLWindow[ \n\tDrawable: "+drawable+", \n\tWindow: "+window+", \n\tHelper: "+helper+", \n\tFactory: "+factory+"]";
+ return "NEWT-GLWindow[ \n\tHelper: "+helper+", \n\tDrawable: "+drawable + /** ", \n\tWindow: "+window+", \n\tFactory: "+factory+ */ "]";
}
//----------------------------------------------------------------------
diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Display.java b/src/newt/classes/com/jogamp/newt/opengl/broadcom/egl/Display.java
index debe9e9b9..999a407ec 100644
--- a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Display.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/broadcom/egl/Display.java
@@ -31,17 +31,17 @@
*
*/
-package com.sun.javafx.newt.opengl.broadcom.egl;
+package com.jogamp.newt.opengl.broadcom.egl;
-import com.sun.javafx.newt.impl.*;
-import com.sun.opengl.impl.egl.*;
+import com.jogamp.newt.impl.*;
+import com.jogamp.opengl.impl.egl.*;
import javax.media.nativewindow.*;
import javax.media.nativewindow.egl.*;
-public class Display extends com.sun.javafx.newt.Display {
+public class Display extends com.jogamp.newt.Display {
static {
- NativeLibLoader.loadNEWT();
+ NEWTJNILibLoader.loadNEWT();
if (!Window.initIDs()) {
throw new NativeWindowException("Failed to initialize BCEGL Window jmethodIDs");
diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Screen.java b/src/newt/classes/com/jogamp/newt/opengl/broadcom/egl/Screen.java
index 28f7211c3..b4f07599b 100755
--- a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Screen.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/broadcom/egl/Screen.java
@@ -31,12 +31,11 @@
*
*/
-package com.sun.javafx.newt.opengl.broadcom.egl;
+package com.jogamp.newt.opengl.broadcom.egl;
-import com.sun.javafx.newt.impl.*;
import javax.media.nativewindow.*;
-public class Screen extends com.sun.javafx.newt.Screen {
+public class Screen extends com.jogamp.newt.Screen {
static {
Display.initSingleton();
diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Window.java b/src/newt/classes/com/jogamp/newt/opengl/broadcom/egl/Window.java
index 11672dde3..185dc97b9 100755
--- a/src/newt/classes/com/sun/javafx/newt/opengl/broadcom/egl/Window.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/broadcom/egl/Window.java
@@ -31,16 +31,14 @@
*
*/
-package com.sun.javafx.newt.opengl.broadcom.egl;
+package com.jogamp.newt.opengl.broadcom.egl;
-import com.sun.javafx.newt.impl.*;
-import com.sun.opengl.impl.egl.*;
+import com.jogamp.opengl.impl.egl.*;
import javax.media.nativewindow.*;
import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLProfile;
import javax.media.nativewindow.NativeWindowException;
-public class Window extends com.sun.javafx.newt.Window {
+public class Window extends com.jogamp.newt.Window {
static {
Display.initSingleton();
}
diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/kd/KDDisplay.java b/src/newt/classes/com/jogamp/newt/opengl/kd/KDDisplay.java
index 5aeae75ea..6a28f992b 100755
--- a/src/newt/classes/com/sun/javafx/newt/opengl/kd/KDDisplay.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/kd/KDDisplay.java
@@ -31,18 +31,18 @@
*
*/
-package com.sun.javafx.newt.opengl.kd;
+package com.jogamp.newt.opengl.kd;
-import com.sun.javafx.newt.*;
-import com.sun.javafx.newt.impl.*;
-import com.sun.opengl.impl.egl.*;
+import com.jogamp.newt.*;
+import com.jogamp.newt.impl.*;
+import com.jogamp.opengl.impl.egl.*;
import javax.media.nativewindow.*;
import javax.media.nativewindow.egl.*;
public class KDDisplay extends Display {
static {
- NativeLibLoader.loadNEWT();
+ NEWTJNILibLoader.loadNEWT();
if (!KDWindow.initIDs()) {
throw new NativeWindowException("Failed to initialize KDWindow jmethodIDs");
diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/kd/KDScreen.java b/src/newt/classes/com/jogamp/newt/opengl/kd/KDScreen.java
index 1767c1240..cd53c8152 100755
--- a/src/newt/classes/com/sun/javafx/newt/opengl/kd/KDScreen.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/kd/KDScreen.java
@@ -31,9 +31,9 @@
*
*/
-package com.sun.javafx.newt.opengl.kd;
+package com.jogamp.newt.opengl.kd;
-import com.sun.javafx.newt.*;
+import com.jogamp.newt.*;
import javax.media.nativewindow.*;
public class KDScreen extends Screen {
diff --git a/src/newt/classes/com/sun/javafx/newt/opengl/kd/KDWindow.java b/src/newt/classes/com/jogamp/newt/opengl/kd/KDWindow.java
index 605e9c064..555f54599 100755
--- a/src/newt/classes/com/sun/javafx/newt/opengl/kd/KDWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/kd/KDWindow.java
@@ -31,11 +31,11 @@
*
*/
-package com.sun.javafx.newt.opengl.kd;
+package com.jogamp.newt.opengl.kd;
-import com.sun.javafx.newt.*;
-import com.sun.javafx.newt.impl.*;
-import com.sun.opengl.impl.egl.*;
+import com.jogamp.newt.*;
+import com.jogamp.newt.impl.*;
+import com.jogamp.opengl.impl.egl.*;
import javax.media.nativewindow.*;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;
diff --git a/src/newt/classes/com/sun/javafx/newt/util/EventDispatchThread.java b/src/newt/classes/com/jogamp/newt/util/EDTUtil.java
index a98ebab93..f852bcf5c 100644
--- a/src/newt/classes/com/sun/javafx/newt/util/EventDispatchThread.java
+++ b/src/newt/classes/com/jogamp/newt/util/EDTUtil.java
@@ -34,36 +34,36 @@
* facility.
*/
-package com.sun.javafx.newt.util;
+package com.jogamp.newt.util;
-import com.sun.javafx.newt.Display;
-import com.sun.javafx.newt.impl.Debug;
+import com.jogamp.newt.Display;
+import com.jogamp.newt.impl.Debug;
import java.util.*;
-public class EventDispatchThread {
+public class EDTUtil {
public static final boolean DEBUG = Debug.debug("EDT");
private ThreadGroup threadGroup;
private volatile boolean shouldStop = false;
- private TaskWorker taskWorker = null;
- private Object taskWorkerLock = new Object();
+ private EventDispatchThread edt = null;
+ private Object edtLock = new Object();
private ArrayList tasks = new ArrayList(); // one shot tasks
- private Display display = null;
private String name;
- private long edtPollGranularity = 10;
+ private Runnable pumpMessages;
+ private long edtPollGranularity = 10; // 10ms, 1/100s
- public EventDispatchThread(Display display, ThreadGroup tg, String name) {
- this.display = display;
+ public EDTUtil(ThreadGroup tg, String name, Runnable pumpMessages) {
this.threadGroup = tg;
- this.name=new String("EDT-Display_"+display.getName()+"-"+name);
+ this.name=new String("EDT-"+name);
+ this.pumpMessages=pumpMessages;
}
public String getName() { return name; }
public ThreadGroup getThreadGroup() { return threadGroup; }
- public void start() {
- start(false);
+ public Thread start() {
+ return start(false);
}
/**
@@ -75,52 +75,56 @@ public class EventDispatchThread {
* Usefull in combination with externalStimuli=true,
* so an external stimuli can call it.
*/
- public Runnable start(boolean externalStimuli) {
- synchronized(taskWorkerLock) {
- if(null==taskWorker) {
- taskWorker = new TaskWorker(threadGroup, name);
+ public Thread start(boolean externalStimuli) {
+ synchronized(edtLock) {
+ if(null==edt) {
+ edt = new EventDispatchThread(threadGroup, name);
}
- if(!taskWorker.isRunning()) {
+ if(!edt.isRunning()) {
shouldStop = false;
- taskWorker.start(externalStimuli);
+ edt.start(externalStimuli);
}
- taskWorkerLock.notifyAll();
+ edtLock.notifyAll();
}
- return taskWorker;
+ return edt;
}
public void stop() {
- synchronized(taskWorkerLock) {
- if(null!=taskWorker && taskWorker.isRunning()) {
+ synchronized(edtLock) {
+ if(null!=edt && edt.isRunning()) {
shouldStop = true;
}
- taskWorkerLock.notifyAll();
+ edtLock.notifyAll();
if(DEBUG) {
System.out.println(Thread.currentThread()+": EDT signal STOP");
}
}
}
+ public Thread getEDT() {
+ return edt;
+ }
+
public boolean isThreadEDT(Thread thread) {
- return null!=taskWorker && taskWorker == thread;
+ return null!=edt && edt == thread;
}
public boolean isCurrentThreadEDT() {
- return null!=taskWorker && taskWorker == Thread.currentThread();
+ return null!=edt && edt == Thread.currentThread();
}
public boolean isRunning() {
- return null!=taskWorker && taskWorker.isRunning() ;
+ return null!=edt && edt.isRunning() ;
}
public void invokeLater(Runnable task) {
if(task == null) {
return;
}
- synchronized(taskWorkerLock) {
- if(null!=taskWorker && taskWorker.isRunning() && taskWorker != Thread.currentThread() ) {
+ synchronized(edtLock) {
+ if(null!=edt && edt.isRunning() && edt != Thread.currentThread() ) {
tasks.add(task);
- taskWorkerLock.notifyAll();
+ edtLock.notifyAll();
} else {
// if !running or isEDTThread, do it right away
task.run();
@@ -137,10 +141,10 @@ public class EventDispatchThread {
}
public void waitOnWorker() {
- synchronized(taskWorkerLock) {
- if(null!=taskWorker && taskWorker.isRunning() && tasks.size()>0 && taskWorker != Thread.currentThread() ) {
+ synchronized(edtLock) {
+ if(null!=edt && edt.isRunning() && tasks.size()>0 && edt != Thread.currentThread() ) {
try {
- taskWorkerLock.wait();
+ edtLock.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
@@ -149,10 +153,10 @@ public class EventDispatchThread {
}
public void waitUntilStopped() {
- synchronized(taskWorkerLock) {
- while(null!=taskWorker && taskWorker.isRunning() && taskWorker != Thread.currentThread() ) {
+ synchronized(edtLock) {
+ while(null!=edt && edt.isRunning() && edt != Thread.currentThread() ) {
try {
- taskWorkerLock.wait();
+ edtLock.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
@@ -160,11 +164,11 @@ public class EventDispatchThread {
}
}
- class TaskWorker extends Thread {
+ class EventDispatchThread extends Thread {
boolean isRunning = false;
boolean externalStimuli = false;
- public TaskWorker(ThreadGroup tg, String name) {
+ public EventDispatchThread(ThreadGroup tg, String name) {
super(tg, name);
}
@@ -183,7 +187,7 @@ public class EventDispatchThread {
}
/**
- * Utilizing taskWorkerLock only for local resources and task execution,
+ * Utilizing edtLock only for local resources and task execution,
* not for event dispatching.
*/
public void run() {
@@ -194,26 +198,26 @@ public class EventDispatchThread {
try {
// wait for something todo
while(!shouldStop && tasks.size()==0) {
- synchronized(taskWorkerLock) {
+ synchronized(edtLock) {
if(!shouldStop && tasks.size()==0) {
try {
- taskWorkerLock.wait(edtPollGranularity);
+ edtLock.wait(edtPollGranularity);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
- display.pumpMessages(); // event dispatch
+ pumpMessages.run(); // event dispatch
}
if(!shouldStop && tasks.size()>0) {
- synchronized(taskWorkerLock) {
+ synchronized(edtLock) {
if(!shouldStop && tasks.size()>0) {
Runnable task = (Runnable) tasks.remove(0);
task.run();
- taskWorkerLock.notifyAll();
+ edtLock.notifyAll();
}
}
- display.pumpMessages(); // event dispatch
+ pumpMessages.run(); // event dispatch
}
} catch (Throwable t) {
// handle errors ..
@@ -227,8 +231,8 @@ public class EventDispatchThread {
isRunning = !shouldStop;
}
if(!isRunning) {
- synchronized(taskWorkerLock) {
- taskWorkerLock.notifyAll();
+ synchronized(edtLock) {
+ edtLock.notifyAll();
}
}
if(DEBUG) {
diff --git a/src/newt/classes/com/sun/javafx/newt/util/MainThread.java b/src/newt/classes/com/jogamp/newt/util/MainThread.java
index abfe3f0c7..daa09edce 100644
--- a/src/newt/classes/com/sun/javafx/newt/util/MainThread.java
+++ b/src/newt/classes/com/jogamp/newt/util/MainThread.java
@@ -34,7 +34,7 @@
* facility.
*/
-package com.sun.javafx.newt.util;
+package com.jogamp.newt.util;
import java.util.*;
import java.lang.reflect.Method;
@@ -43,10 +43,10 @@ import java.security.*;
import javax.media.nativewindow.*;
-import com.sun.javafx.newt.*;
-import com.sun.javafx.newt.impl.*;
-import com.sun.javafx.newt.macosx.MacDisplay;
-import com.sun.nativewindow.impl.NWReflection;
+import com.jogamp.common.util.*;
+import com.jogamp.newt.*;
+import com.jogamp.newt.impl.*;
+import com.jogamp.newt.macosx.MacDisplay;
/**
* NEWT Utility class MainThread<P>
@@ -64,7 +64,7 @@ import com.sun.nativewindow.impl.NWReflection;
*
* 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 com.sun.javafx.newt.macosx.MacWindow MacWindow} implementation.<br>
+ * have a look at the {@link com.jogamp.newt.macosx.MacWindow MacWindow} implementation.<br>
* <i>TODO</i>: Some hardcoded dependencies exist in this implementation,
* where you have to patch this code or factor it out. <P>
*
@@ -77,7 +77,7 @@ import com.sun.nativewindow.impl.NWReflection;
*
* Test case on Mac OS X (or any other platform):
<PRE>
- java -XstartOnFirstThread com.sun.javafx.newt.util.MainThread demos.es1.RedSquare -GL2 -GL2 -GL2 -GL2
+ java -XstartOnFirstThread com.jogamp.newt.util.MainThread demos.es1.RedSquare -GL2 -GL2 -GL2 -GL2
</PRE>
* Which starts 4 threads, each with a window and OpenGL rendering.<br>
*/
@@ -116,7 +116,7 @@ public class MainThread {
// start user app ..
try {
- Class mainClass = NWReflection.getClass(mainClassName, true);
+ Class mainClass = ReflectionUtil.getClass(mainClassName, true);
if(null==mainClass) {
throw new RuntimeException(new ClassNotFoundException("MainThread couldn't find main class "+mainClassName));
}
@@ -159,7 +159,7 @@ public class MainThread {
System.arraycopy(args, 1, mainClassArgs, 0, args.length-1);
}
- NativeLibLoader.loadNEWT();
+ NEWTJNILibLoader.loadNEWT();
shouldStop = false;
tasks = new ArrayList();
diff --git a/src/newt/classes/com/sun/javafx/newt/windows/WindowsDisplay.java b/src/newt/classes/com/jogamp/newt/windows/WindowsDisplay.java
index 80485ed67..281022901 100755
--- a/src/newt/classes/com/sun/javafx/newt/windows/WindowsDisplay.java
+++ b/src/newt/classes/com/jogamp/newt/windows/WindowsDisplay.java
@@ -31,12 +31,12 @@
*
*/
-package com.sun.javafx.newt.windows;
+package com.jogamp.newt.windows;
import javax.media.nativewindow.*;
import javax.media.nativewindow.windows.*;
-import com.sun.javafx.newt.*;
-import com.sun.javafx.newt.impl.*;
+import com.jogamp.newt.*;
+import com.jogamp.newt.impl.*;
public class WindowsDisplay extends Display {
@@ -45,7 +45,7 @@ public class WindowsDisplay extends Display {
private static long hInstance;
static {
- NativeLibLoader.loadNEWT();
+ NEWTJNILibLoader.loadNEWT();
if (!WindowsWindow.initIDs()) {
throw new NativeWindowException("Failed to initialize WindowsWindow jmethodIDs");
diff --git a/src/newt/classes/com/sun/javafx/newt/windows/WindowsScreen.java b/src/newt/classes/com/jogamp/newt/windows/WindowsScreen.java
index 87ae1b49d..aea3cd439 100755
--- a/src/newt/classes/com/sun/javafx/newt/windows/WindowsScreen.java
+++ b/src/newt/classes/com/jogamp/newt/windows/WindowsScreen.java
@@ -31,10 +31,9 @@
*
*/
-package com.sun.javafx.newt.windows;
+package com.jogamp.newt.windows;
-import com.sun.javafx.newt.*;
-import com.sun.javafx.newt.impl.*;
+import com.jogamp.newt.*;
import javax.media.nativewindow.*;
public class WindowsScreen extends Screen {
diff --git a/src/newt/classes/com/sun/javafx/newt/windows/WindowsWindow.java b/src/newt/classes/com/jogamp/newt/windows/WindowsWindow.java
index 1b5bf80cf..4a468ae86 100755
--- a/src/newt/classes/com/sun/javafx/newt/windows/WindowsWindow.java
+++ b/src/newt/classes/com/jogamp/newt/windows/WindowsWindow.java
@@ -31,10 +31,10 @@
*
*/
-package com.sun.javafx.newt.windows;
+package com.jogamp.newt.windows;
import javax.media.nativewindow.*;
-import com.sun.javafx.newt.*;
+import com.jogamp.newt.*;
public class WindowsWindow extends Window {
diff --git a/src/newt/classes/com/sun/javafx/newt/x11/X11Display.java b/src/newt/classes/com/jogamp/newt/x11/X11Display.java
index ae23c4423..c8faefbf1 100755
--- a/src/newt/classes/com/sun/javafx/newt/x11/X11Display.java
+++ b/src/newt/classes/com/jogamp/newt/x11/X11Display.java
@@ -31,17 +31,17 @@
*
*/
-package com.sun.javafx.newt.x11;
+package com.jogamp.newt.x11;
import javax.media.nativewindow.*;
import javax.media.nativewindow.x11.*;
-import com.sun.javafx.newt.*;
-import com.sun.javafx.newt.impl.*;
-import com.sun.nativewindow.impl.x11.X11Util;
+import com.jogamp.newt.*;
+import com.jogamp.newt.impl.*;
+import com.jogamp.nativewindow.impl.x11.X11Util;
public class X11Display extends Display {
static {
- NativeLibLoader.loadNEWT();
+ NEWTJNILibLoader.loadNEWT();
if (!initIDs()) {
throw new NativeWindowException("Failed to initialize X11Display jmethodIDs");
@@ -61,7 +61,7 @@ public class X11Display extends Display {
}
protected void createNative() {
- long handle= X11Util.getThreadLocalDisplay(name);
+ long handle= X11Util.createThreadLocalDisplay(name);
if (handle == 0 ) {
throw new RuntimeException("Error creating display: "+name);
}
@@ -75,9 +75,7 @@ public class X11Display extends Display {
}
protected void closeNative() {
- if(0==X11Util.closeThreadLocalDisplay(name)) {
- throw new NativeWindowException(this+" was not mapped");
- }
+ X11Util.closeThreadLocalDisplay(name);
}
protected void dispatchMessages() {
diff --git a/src/newt/classes/com/sun/javafx/newt/x11/X11Screen.java b/src/newt/classes/com/jogamp/newt/x11/X11Screen.java
index cee576e2c..e053d99c0 100755
--- a/src/newt/classes/com/sun/javafx/newt/x11/X11Screen.java
+++ b/src/newt/classes/com/jogamp/newt/x11/X11Screen.java
@@ -31,11 +31,9 @@
*
*/
-package com.sun.javafx.newt.x11;
+package com.jogamp.newt.x11;
-import com.sun.javafx.newt.*;
-import com.sun.javafx.newt.impl.*;
-import javax.media.nativewindow.*;
+import com.jogamp.newt.*;
import javax.media.nativewindow.x11.*;
public class X11Screen extends Screen {
diff --git a/src/newt/classes/com/sun/javafx/newt/x11/X11Window.java b/src/newt/classes/com/jogamp/newt/x11/X11Window.java
index f46ae9564..cc3aa58a2 100755
--- a/src/newt/classes/com/sun/javafx/newt/x11/X11Window.java
+++ b/src/newt/classes/com/jogamp/newt/x11/X11Window.java
@@ -31,10 +31,9 @@
*
*/
-package com.sun.javafx.newt.x11;
+package com.jogamp.newt.x11;
-import com.sun.javafx.newt.*;
-import com.sun.javafx.newt.impl.*;
+import com.jogamp.newt.*;
import javax.media.nativewindow.*;
import javax.media.nativewindow.x11.*;
diff --git a/src/newt/native/BroadcomEGL.c b/src/newt/native/BroadcomEGL.c
index 55688f9d1..9aac90abb 100755
--- a/src/newt/native/BroadcomEGL.c
+++ b/src/newt/native/BroadcomEGL.c
@@ -41,7 +41,7 @@
#include <stdio.h>
#include <string.h>
-#include "com_sun_javafx_newt_opengl_broadcom_egl_Window.h"
+#include "com_jogamp_newt_opengl_broadcom_egl_Window.h"
#include "EventListener.h"
#include "MouseEvent.h"
@@ -72,7 +72,7 @@ static jmethodID windowCreatedID = NULL;
* Display
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Display_DispatchMessages
+JNIEXPORT void JNICALL Java_com_jogamp_newt_opengl_broadcom_egl_Display_DispatchMessages
(JNIEnv *env, jobject obj)
{
// FIXME: n/a
@@ -80,7 +80,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Display_Disp
(void) obj;
}
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Display_CreateDisplay
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_opengl_broadcom_egl_Display_CreateDisplay
(JNIEnv *env, jobject obj, jint width, jint height)
{
(void) env;
@@ -94,7 +94,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Display_Cre
return (jlong) (intptr_t) dpy;
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Display_DestroyDisplay
+JNIEXPORT void JNICALL Java_com_jogamp_newt_opengl_broadcom_egl_Display_DestroyDisplay
(JNIEnv *env, jobject obj, jlong display)
{
EGLDisplay dpy = (EGLDisplay)(intptr_t)display;
@@ -111,7 +111,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Display_Dest
* Window
*/
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Window_initIDs
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_opengl_broadcom_egl_Window_initIDs
(JNIEnv *env, jclass clazz)
{
windowCreatedID = (*env)->GetMethodID(env, clazz, "windowCreated", "(III)V");
@@ -123,7 +123,7 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Window_i
return JNI_TRUE;
}
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Window_CreateWindow
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_opengl_broadcom_egl_Window_CreateWindow
(JNIEnv *env, jobject obj, jlong display, jboolean chromaKey, jint width, jint height)
{
EGLDisplay dpy = (EGLDisplay)(intptr_t)display;
@@ -167,7 +167,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Window_Crea
return (jlong) (intptr_t) window;
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Window_CloseWindow
+JNIEXPORT void JNICALL Java_com_jogamp_newt_opengl_broadcom_egl_Window_CloseWindow
(JNIEnv *env, jobject obj, jlong display, jlong window)
{
EGLDisplay dpy = (EGLDisplay) (intptr_t) display;
@@ -180,7 +180,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Window_Close
DBG_PRINT( "[CloseWindow] X\n");
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_broadcom_egl_Window_SwapWindow
+JNIEXPORT void JNICALL Java_com_jogamp_newt_opengl_broadcom_egl_Window_SwapWindow
(JNIEnv *env, jobject obj, jlong display, jlong window)
{
EGLDisplay dpy = (EGLDisplay) (intptr_t) display;
diff --git a/src/newt/native/IntelGDL.c b/src/newt/native/IntelGDL.c
index 1bc43cd0e..7857b594f 100644
--- a/src/newt/native/IntelGDL.c
+++ b/src/newt/native/IntelGDL.c
@@ -37,9 +37,9 @@
#include <stdio.h>
#include <string.h>
-#include "com_sun_javafx_newt_intel_gdl_Display.h"
-#include "com_sun_javafx_newt_intel_gdl_Screen.h"
-#include "com_sun_javafx_newt_intel_gdl_Window.h"
+#include "com_jogamp_newt_intel_gdl_Display.h"
+#include "com_jogamp_newt_intel_gdl_Screen.h"
+#include "com_jogamp_newt_intel_gdl_Window.h"
#include "EventListener.h"
#include "MouseEvent.h"
@@ -123,7 +123,7 @@ static void JNI_ThrowNew(JNIEnv *env, const char *throwable, const char* message
* Display
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Display_DispatchMessages
+JNIEXPORT void JNICALL Java_com_jogamp_newt_intel_gdl_Display_DispatchMessages
(JNIEnv *env, jobject obj, jlong displayHandle, jobject focusedWindow)
{
// FIXME: n/a
@@ -138,7 +138,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Display_DispatchMessag
} */
}
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_intel_gdl_Display_CreateDisplay
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_intel_gdl_Display_CreateDisplay
(JNIEnv *env, jobject obj)
{
gdl_ret_t retval;
@@ -171,7 +171,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_intel_gdl_Display_CreateDisplay
return (jlong) (intptr_t) p_driver_info;
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Display_DestroyDisplay
+JNIEXPORT void JNICALL Java_com_jogamp_newt_intel_gdl_Display_DestroyDisplay
(JNIEnv *env, jobject obj, jlong displayHandle)
{
gdl_driver_info_t * p_driver_info = (gdl_driver_info_t *) (intptr_t) displayHandle;
@@ -190,7 +190,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Display_DestroyDisplay
* Screen
*/
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_intel_gdl_Screen_initIDs
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_intel_gdl_Screen_initIDs
(JNIEnv *env, jclass clazz)
{
screenCreatedID = (*env)->GetMethodID(env, clazz, "screenCreated", "(II)V");
@@ -202,7 +202,7 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_intel_gdl_Screen_initIDs
return JNI_TRUE;
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Screen_GetScreenInfo
+JNIEXPORT void JNICALL Java_com_jogamp_newt_intel_gdl_Screen_GetScreenInfo
(JNIEnv *env, jobject obj, jlong displayHandle, jint idx)
{
gdl_driver_info_t * p_driver_info = (gdl_driver_info_t *) (intptr_t) displayHandle;
@@ -234,7 +234,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Screen_GetScreenInfo
* Window
*/
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_intel_gdl_Window_initIDs
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_intel_gdl_Window_initIDs
(JNIEnv *env, jclass clazz)
{
updateBoundsID = (*env)->GetMethodID(env, clazz, "updateBounds", "(IIII)V");
@@ -246,7 +246,7 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_intel_gdl_Window_initIDs
return JNI_TRUE;
}
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_intel_gdl_Window_CreateSurface
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_intel_gdl_Window_CreateSurface
(JNIEnv *env, jobject obj, jlong displayHandle, jint scr_width, jint scr_height, jint x, jint y, jint width, jint height) {
gdl_driver_info_t * p_driver_info = (gdl_driver_info_t *) (intptr_t) displayHandle;
@@ -339,7 +339,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_intel_gdl_Window_CreateSurface
return (jlong) (intptr_t) plane;
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Window_CloseSurface
+JNIEXPORT void JNICALL Java_com_jogamp_newt_intel_gdl_Window_CloseSurface
(JNIEnv *env, jobject obj, jlong display, jlong surface)
{
gdl_plane_id_t plane = (gdl_plane_id_t) (intptr_t) surface ;
@@ -348,7 +348,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Window_CloseSurface
DBG_PRINT("[CloseSurface] plane %d\n", plane);
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_intel_gdl_Window_SetBounds0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_intel_gdl_Window_SetBounds0
(JNIEnv *env, jobject obj, jlong surface, jint scr_width, jint scr_height, jint x, jint y, jint width, jint height) {
gdl_plane_id_t plane = (gdl_plane_id_t) (intptr_t) surface ;
diff --git a/src/newt/native/KDWindow.c b/src/newt/native/KDWindow.c
index 6c7aa7731..15bef7582 100755
--- a/src/newt/native/KDWindow.c
+++ b/src/newt/native/KDWindow.c
@@ -64,7 +64,7 @@
#include <KD/kd.h>
#include <KD/NV_extwindowprops.h>
-#include "com_sun_javafx_newt_opengl_kd_KDWindow.h"
+#include "com_jogamp_newt_opengl_kd_KDWindow.h"
#include "EventListener.h"
#include "MouseEvent.h"
@@ -103,7 +103,7 @@ static jmethodID sendKeyEventID = NULL;
* Display
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDDisplay_DispatchMessages
+JNIEXPORT void JNICALL Java_com_jogamp_newt_opengl_kd_KDDisplay_DispatchMessages
(JNIEnv *env, jobject obj)
{
const KDEvent * evt;
@@ -200,7 +200,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDDisplay_DispatchMess
* Window
*/
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_initIDs
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_opengl_kd_KDWindow_initIDs
(JNIEnv *env, jclass clazz)
{
#ifdef VERBOSE_ON
@@ -228,7 +228,7 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_initIDs
return JNI_TRUE;
}
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_CreateWindow
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_opengl_kd_KDWindow_CreateWindow
(JNIEnv *env, jobject obj, jlong display, jintArray jAttrs)
{
jint * attrs = NULL;
@@ -270,7 +270,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_CreateWindow
return (jlong) (intptr_t) window;
}
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_RealizeWindow
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_opengl_kd_KDWindow_RealizeWindow
(JNIEnv *env, jobject obj, jlong window)
{
KDWindow *w = (KDWindow*) (intptr_t) window;
@@ -285,7 +285,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_RealizeWindo
return (jlong) (intptr_t) nativeWindow;
}
-JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_CloseWindow
+JNIEXPORT jint JNICALL Java_com_jogamp_newt_opengl_kd_KDWindow_CloseWindow
(JNIEnv *env, jobject obj, jlong window, jlong juserData)
{
KDWindow *w = (KDWindow*) (intptr_t) window;
@@ -299,11 +299,11 @@ JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_CloseWindow
}
/*
- * Class: com_sun_javafx_newt_opengl_kd_KDWindow
+ * Class: com_jogamp_newt_opengl_kd_KDWindow
* Method: setVisible0
* Signature: (JJZ)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_setVisible0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_opengl_kd_KDWindow_setVisible0
(JNIEnv *env, jobject obj, jlong window, jboolean visible)
{
KDWindow *w = (KDWindow*) (intptr_t) window;
@@ -312,7 +312,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_setVisible0
DBG_PRINT( "[setVisible] v=%d\n", visible);
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_setFullScreen0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_opengl_kd_KDWindow_setFullScreen0
(JNIEnv *env, jobject obj, jlong window, jboolean fullscreen)
{
KDWindow *w = (KDWindow*) (intptr_t) window;
@@ -323,7 +323,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_setFullScreen
(void)res;
}
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_opengl_kd_KDWindow_setSize0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_opengl_kd_KDWindow_setSize0
(JNIEnv *env, jobject obj, jlong window, jint width, jint height)
{
KDWindow *w = (KDWindow*) (intptr_t) window;
diff --git a/src/newt/native/MacWindow.m b/src/newt/native/MacWindow.m
index 1749805c8..f0ebfc0a0 100644
--- a/src/newt/native/MacWindow.m
+++ b/src/newt/native/MacWindow.m
@@ -33,7 +33,7 @@
#import <inttypes.h>
-#import "com_sun_javafx_newt_macosx_MacWindow.h"
+#import "com_jogamp_newt_macosx_MacWindow.h"
#import "NewtMacWindow.h"
#import "EventListener.h"
@@ -121,11 +121,11 @@ NS_ENDHANDLER
}
/*
- * Class: com_sun_javafx_newt_macosx_MacDisplay
+ * Class: com_jogamp_newt_macosx_MacDisplay
* Method: initIDs
* Signature: ()Z
*/
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_macosx_MacDisplay_initNSApplication
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_macosx_MacDisplay_initNSApplication
(JNIEnv *env, jclass clazz)
{
static int initialized = 0;
@@ -155,11 +155,11 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_macosx_MacDisplay_initNSAppl
}
/*
- * Class: com_sun_javafx_newt_macosx_MacDisplay
+ * Class: com_jogamp_newt_macosx_MacDisplay
* Method: dispatchMessages0
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacDisplay_dispatchMessages0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_macosx_MacDisplay_dispatchMessages0
(JNIEnv *env, jobject unused, jlong window, jint eventMask)
{
NSEvent* event = NULL;
@@ -195,11 +195,11 @@ NS_ENDHANDLER
}
/*
- * Class: com_sun_javafx_newt_macosx_MacScreen
+ * Class: com_jogamp_newt_macosx_MacScreen
* Method: getWidthImpl
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_macosx_MacScreen_getWidthImpl
+JNIEXPORT jint JNICALL Java_com_jogamp_newt_macosx_MacScreen_getWidthImpl
(JNIEnv *env, jclass clazz, jint screen_idx)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -216,11 +216,11 @@ JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_macosx_MacScreen_getWidthImpl
}
/*
- * Class: com_sun_javafx_newt_macosx_MacScreen
+ * Class: com_jogamp_newt_macosx_MacScreen
* Method: getHeightImpl
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_macosx_MacScreen_getHeightImpl
+JNIEXPORT jint JNICALL Java_com_jogamp_newt_macosx_MacScreen_getHeightImpl
(JNIEnv *env, jclass clazz, jint screen_idx)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -237,11 +237,11 @@ JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_macosx_MacScreen_getHeightImpl
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: initIDs
* Signature: ()Z
*/
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_initIDs
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_macosx_MacWindow_initIDs
(JNIEnv *env, jclass clazz)
{
static int initialized = 0;
@@ -258,11 +258,11 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_initIDs
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: createWindow0
* Signature: (JIIIIZIIIJ)J
*/
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_createWindow0
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_macosx_MacWindow_createWindow0
(JNIEnv *env, jobject jthis, jlong parent, jint x, jint y, jint w, jint h, jboolean fullscreen, jint styleMask,
jint bufferingType, jint screen_idx, jlong jview)
{
@@ -334,11 +334,11 @@ NS_ENDHANDLER
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: makeKeyAndOrderFront
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_makeKeyAndOrderFront
+JNIEXPORT void JNICALL Java_com_jogamp_newt_macosx_MacWindow_makeKeyAndOrderFront
(JNIEnv *env, jobject unused, jlong window)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -348,11 +348,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_makeKeyAndOrder
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: makeKey
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_makeKey
+JNIEXPORT void JNICALL Java_com_jogamp_newt_macosx_MacWindow_makeKey
(JNIEnv *env, jobject unused, jlong window)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -362,11 +362,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_makeKey
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: orderOut
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_orderOut
+JNIEXPORT void JNICALL Java_com_jogamp_newt_macosx_MacWindow_orderOut
(JNIEnv *env, jobject unused, jlong window)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -376,11 +376,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_orderOut
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: close0
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_close0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_macosx_MacWindow_close0
(JNIEnv *env, jobject unused, jlong window)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -401,11 +401,11 @@ NS_ENDHANDLER
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: setTitle0
* Signature: (JLjava/lang/String;)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_setTitle0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_macosx_MacWindow_setTitle0
(JNIEnv *env, jobject unused, jlong window, jstring title)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -417,11 +417,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_setTitle0
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: contentView
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_contentView
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_macosx_MacWindow_contentView
(JNIEnv *env, jobject unused, jlong window)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -432,11 +432,11 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_contentView
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: changeContentView
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_changeContentView
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_macosx_MacWindow_changeContentView
(JNIEnv *env, jobject jthis, jlong parent, jlong window, jlong jview)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -452,11 +452,11 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_changeContentV
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: setContentSize
* Signature: (JII)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_setContentSize
+JNIEXPORT void JNICALL Java_com_jogamp_newt_macosx_MacWindow_setContentSize
(JNIEnv *env, jobject unused, jlong window, jint w, jint h)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -467,11 +467,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_setContentSize
}
/*
- * Class: com_sun_javafx_newt_macosx_MacWindow
+ * Class: com_jogamp_newt_macosx_MacWindow
* Method: setFrameTopLeftPoint
* Signature: (JII)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_setFrameTopLeftPoint
+JNIEXPORT void JNICALL Java_com_jogamp_newt_macosx_MacWindow_setFrameTopLeftPoint
(JNIEnv *env, jobject unused, jlong parent, jlong window, jint x, jint y)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
diff --git a/src/newt/native/NewtMacWindow.h b/src/newt/native/NewtMacWindow.h
index e19be2ed8..560cfe408 100644
--- a/src/newt/native/NewtMacWindow.h
+++ b/src/newt/native/NewtMacWindow.h
@@ -55,7 +55,7 @@
@end
-@interface NewtMacWindow : NSWindow
+@interface NewtMacWindow : NSWindow <NSWindowDelegate>
{
}
diff --git a/src/newt/native/NewtMacWindow.m b/src/newt/native/NewtMacWindow.m
index 146c04de1..3d8d32a40 100755
--- a/src/newt/native/NewtMacWindow.m
+++ b/src/newt/native/NewtMacWindow.m
@@ -441,7 +441,7 @@ static jint mods2JavaMods(NSUInteger mods)
}
(*env)->CallVoidMethod(env, javaWindowObject, windowDestroyNotifyID);
- // Will be called by Window.java (*env)->CallVoidMethod(env, javaWindowObject, windowDestroyedID);
+ (*env)->CallVoidMethod(env, javaWindowObject, windowDestroyedID); // No OSX hook for DidClose, so do it here
// EOL ..
(*env)->DeleteGlobalRef(env, javaWindowObject);
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c
index 5445ca372..67da99b1f 100755
--- a/src/newt/native/WindowsWindow.c
+++ b/src/newt/native/WindowsWindow.c
@@ -89,7 +89,7 @@
#define MONITOR_DEFAULTTONEAREST 2
#endif
-#include "com_sun_javafx_newt_windows_WindowsWindow.h"
+#include "com_jogamp_newt_windows_WindowsWindow.h"
#include "EventListener.h"
#include "MouseEvent.h"
@@ -902,11 +902,11 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message,
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsDisplay
+ * Class: com_jogamp_newt_windows_WindowsDisplay
* Method: DispatchMessages
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsDisplay_DispatchMessages
+JNIEXPORT void JNICALL Java_com_jogamp_newt_windows_WindowsDisplay_DispatchMessages
(JNIEnv *env, jclass clazz)
{
int i = 0;
@@ -925,11 +925,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsDisplay_DispatchM
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsDisplay
+ * Class: com_jogamp_newt_windows_WindowsDisplay
* Method: LoadLibraryW
* Signature: (Ljava/lang/String;)J
*/
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_windows_WindowsDisplay_LoadLibraryW
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_windows_WindowsDisplay_LoadLibraryW
(JNIEnv *env, jclass clazz, jstring dllName)
{
jchar* _dllName = GetNullTerminatedStringChars(env, dllName);
@@ -939,11 +939,11 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_windows_WindowsDisplay_LoadLibr
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsDisplay
+ * Class: com_jogamp_newt_windows_WindowsDisplay
* Method: RegisterWindowClass
* Signature: (Ljava/lang/String;J)I
*/
-JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_windows_WindowsDisplay_RegisterWindowClass
+JNIEXPORT jint JNICALL Java_com_jogamp_newt_windows_WindowsDisplay_RegisterWindowClass
(JNIEnv *env, jclass clazz, jstring wndClassName, jlong hInstance)
{
ATOM res;
@@ -979,44 +979,44 @@ JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_windows_WindowsDisplay_RegisterW
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsDisplay
+ * Class: com_jogamp_newt_windows_WindowsDisplay
* Method: CleanupWindowResources
* Signature: (java/lang/String;J)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsDisplay_UnregisterWindowClass
+JNIEXPORT void JNICALL Java_com_jogamp_newt_windows_WindowsDisplay_UnregisterWindowClass
(JNIEnv *env, jclass clazz, jint wndClassAtom, jlong hInstance)
{
UnregisterClass(MAKEINTATOM(wndClassAtom), (HINSTANCE) (intptr_t) hInstance);
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsScreen
+ * Class: com_jogamp_newt_windows_WindowsScreen
* Method: getWidthImpl
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_windows_WindowsScreen_getWidthImpl
+JNIEXPORT jint JNICALL Java_com_jogamp_newt_windows_WindowsScreen_getWidthImpl
(JNIEnv *env, jobject obj, jint scrn_idx)
{
return (jint)GetSystemMetrics(SM_CXSCREEN);
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsScreen
+ * Class: com_jogamp_newt_windows_WindowsScreen
* Method: getWidthImpl
* Signature: (I)I
*/
-JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_windows_WindowsScreen_getHeightImpl
+JNIEXPORT jint JNICALL Java_com_jogamp_newt_windows_WindowsScreen_getHeightImpl
(JNIEnv *env, jobject obj, jint scrn_idx)
{
return (jint)GetSystemMetrics(SM_CYSCREEN);
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: initIDs
* Signature: ()Z
*/
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_initIDs
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_windows_WindowsWindow_initIDs
(JNIEnv *env, jclass clazz)
{
sizeChangedID = (*env)->GetMethodID(env, clazz, "sizeChanged", "(II)V");
@@ -1045,11 +1045,11 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_initID
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: CreateWindow
* Signature: (JILjava/lang/String;JJZIIII)J
*/
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_CreateWindow
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_windows_WindowsWindow_CreateWindow
(JNIEnv *env, jobject obj, jlong parent, jint wndClassAtom, jstring jWndName, jlong hInstance, jlong visualID,
jboolean bIsUndecorated,
jint jx, jint jy, jint defaultWidth, jint defaultHeight)
@@ -1113,44 +1113,44 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_CreateWin
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: DestroyWindow
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_DestroyWindow
+JNIEXPORT void JNICALL Java_com_jogamp_newt_windows_WindowsWindow_DestroyWindow
(JNIEnv *env, jobject obj, jlong window)
{
DestroyWindow((HWND) (intptr_t) window);
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: GetDC
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_GetDC
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_windows_WindowsWindow_GetDC
(JNIEnv *env, jobject obj, jlong window)
{
return (jlong) (intptr_t) GetDC((HWND) (intptr_t) window);
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: ReleaseDC
* Signature: (JJ)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_ReleaseDC
+JNIEXPORT void JNICALL Java_com_jogamp_newt_windows_WindowsWindow_ReleaseDC
(JNIEnv *env, jobject obj, jlong window, jlong dc)
{
ReleaseDC((HWND) (intptr_t) window, (HDC) (intptr_t) dc);
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: MonitorFromWindow
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_MonitorFromWindow
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_windows_WindowsWindow_MonitorFromWindow
(JNIEnv *env, jobject obj, jlong window)
{
#if (_WIN32_WINNT >= 0x0500 || _WIN32_WINDOWS >= 0x0410 || WINVER >= 0x0500) && !defined(_WIN32_WCE)
@@ -1161,11 +1161,11 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_MonitorFr
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: setVisible0
* Signature: (JZ)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setVisible0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_windows_WindowsWindow_setVisible0
(JNIEnv *_env, jclass clazz, jlong window, jboolean visible)
{
HWND hWnd = (HWND) (intptr_t) window;
@@ -1178,11 +1178,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setVisible
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: setSize0
* Signature: (JII)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setSize0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_windows_WindowsWindow_setSize0
(JNIEnv *env, jobject obj, jlong parent, jlong window, jint x, jint y, jint width, jint height)
{
HWND hwndP = (HWND) (intptr_t) parent;
@@ -1215,11 +1215,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setSize0
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: setPosition
* Signature: (JII)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setPosition
+JNIEXPORT void JNICALL Java_com_jogamp_newt_windows_WindowsWindow_setPosition
(JNIEnv *env, jobject obj, jlong parent, jlong window, jint x, jint y)
{
UINT flags = SWP_NOACTIVATE | SWP_NOSIZE;
@@ -1236,11 +1236,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setPositio
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: setFullscreen
* Signature: (JIIIIZZ)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setFullscreen0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_windows_WindowsWindow_setFullscreen0
(JNIEnv *env, jobject obj, jlong parent, jlong window, jint x, jint y, jint width, jint height, jboolean bIsUndecorated, jboolean on)
{
UINT flags;
@@ -1272,11 +1272,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setFullscr
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: setTitle
* Signature: (JLjava/lang/String;)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setTitle
+JNIEXPORT void JNICALL Java_com_jogamp_newt_windows_WindowsWindow_setTitle
(JNIEnv *env, jclass clazz, jlong window, jstring title)
{
HWND hwnd = (HWND) (intptr_t) window;
@@ -1290,11 +1290,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_setTitle
}
/*
- * Class: com_sun_javafx_newt_windows_WindowsWindow
+ * Class: com_jogamp_newt_windows_WindowsWindow
* Method: requestFocus
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_requestFocus
+JNIEXPORT void JNICALL Java_com_jogamp_newt_windows_WindowsWindow_requestFocus
(JNIEnv *env, jclass clazz, jlong window)
{
HWND hwnd = (HWND) (intptr_t) window;
diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c
index b6b2bbe26..27ca8e6a0 100755
--- a/src/newt/native/X11Window.c
+++ b/src/newt/native/X11Window.c
@@ -46,7 +46,7 @@
#include <X11/Xutil.h>
#include <X11/keysym.h>
-#include "com_sun_javafx_newt_x11_X11Window.h"
+#include "com_jogamp_newt_x11_X11Window.h"
#include "EventListener.h"
#include "MouseEvent.h"
@@ -149,12 +149,25 @@ static jint X11KeySym2NewtVKey(KeySym keySym) {
return keySym;
}
-static const char * const ClazzNameRuntimeException =
- "java/lang/RuntimeException";
+static void _FatalError(JNIEnv *env, const char* msg, ...)
+{
+ char buffer[512];
+ va_list ap;
+
+ va_start(ap, msg);
+ vsnprintf(buffer, sizeof(buffer), msg, ap);
+ va_end(ap);
+
+ fprintf(stderr, buffer);
+ fprintf(stderr, "\n");
+ (*env)->FatalError(env, buffer);
+}
+
+static const char * const ClazzNameRuntimeException = "java/lang/RuntimeException";
static jclass runtimeExceptionClz=NULL;
static const char * const ClazzNameNewtWindow =
- "com/sun/javafx/newt/Window";
+ "com/jogamp/newt/Window";
static jclass newtWindowClz=NULL;
static jmethodID windowChangedID = NULL;
@@ -186,18 +199,51 @@ static void _throwNewRuntimeException(Display * unlockDisplay, JNIEnv *env, cons
* Display
*/
+
+static JNIEnv * x11ErrorHandlerJNIEnv = NULL;
+static XErrorHandler origErrorHandler = NULL ;
+
+static int displayDispatchErrorHandler(Display *dpy, XErrorEvent *e)
+{
+ fprintf(stderr, "Warning: NEWT X11 Error: DisplayDispatch %p, Code 0x%X\n", dpy, e->error_code);
+
+ if (e->error_code == BadAtom)
+ {
+ fprintf(stderr, " BadAtom (%p): Atom probably already removed\n", e->resourceid);
+ } else if (e->error_code == BadWindow)
+ {
+ fprintf(stderr, " BadWindow (%p): Window probably already removed\n", e->resourceid);
+ } else {
+ _throwNewRuntimeException(NULL, x11ErrorHandlerJNIEnv, "NEWT X11 Error: Display %p, Code 0x%X", dpy, e->error_code);
+ }
+
+ return 0;
+}
+
+static void displayDispatchErrorHandlerEnable(int onoff, JNIEnv * env) {
+ if(onoff) {
+ if(NULL==origErrorHandler) {
+ x11ErrorHandlerJNIEnv = env;
+ origErrorHandler = XSetErrorHandler(displayDispatchErrorHandler);
+ }
+ } else {
+ XSetErrorHandler(origErrorHandler);
+ origErrorHandler = NULL;
+ }
+}
+
/*
- * Class: com_sun_javafx_newt_x11_X11Display
+ * Class: com_jogamp_newt_x11_X11Display
* Method: initIDs
* Signature: ()Z
*/
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_x11_X11Display_initIDs
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_x11_X11Display_initIDs
(JNIEnv *env, jclass clazz)
{
jclass c;
if( 0 == XInitThreads() ) {
- fprintf(stderr, "Warning: XInitThreads() failed\n");
+ fprintf(stderr, "Warning: NEWT X11Window: XInitThreads() failed\n");
}
displayCompletedID = (*env)->GetMethodID(env, clazz, "displayCompleted", "(JJ)V");
@@ -208,28 +254,24 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_x11_X11Display_initIDs
if(NULL==newtWindowClz) {
c = (*env)->FindClass(env, ClazzNameNewtWindow);
if(NULL==c) {
- fprintf(stderr, "FatalError: NEWT X11Window: can't find %s\n", ClazzNameNewtWindow);
- return JNI_FALSE;
+ _FatalError(env, "NEWT X11Window: can't find %s", ClazzNameNewtWindow);
}
newtWindowClz = (jclass)(*env)->NewGlobalRef(env, c);
(*env)->DeleteLocalRef(env, c);
if(NULL==newtWindowClz) {
- fprintf(stderr, "FatalError: NEWT X11Window: can't use %s\n", ClazzNameNewtWindow);
- return JNI_FALSE;
+ _FatalError(env, "NEWT X11Window: can't use %s", ClazzNameNewtWindow);
}
}
if(NULL==runtimeExceptionClz) {
c = (*env)->FindClass(env, ClazzNameRuntimeException);
if(NULL==c) {
- fprintf(stderr, "FatalError: NEWT X11Window: can't find %s\n", ClazzNameRuntimeException);
- return JNI_FALSE;
+ _FatalError(env, "NEWT X11Window: can't find %s", ClazzNameRuntimeException);
}
runtimeExceptionClz = (jclass)(*env)->NewGlobalRef(env, c);
(*env)->DeleteLocalRef(env, c);
if(NULL==runtimeExceptionClz) {
- fprintf(stderr, "FatalError: NEWT X11Window: can't use %s\n", ClazzNameRuntimeException);
- return JNI_FALSE;
+ _FatalError(env, "NEWT X11Window: can't use %s", ClazzNameRuntimeException);
}
}
@@ -237,43 +279,45 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_x11_X11Display_initIDs
}
/*
- * Class: com_sun_javafx_newt_x11_X11Display
+ * Class: com_jogamp_newt_x11_X11Display
* Method: LockDisplay
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_LockDisplay
+JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Display_LockDisplay
(JNIEnv *env, jobject obj, jlong display)
{
Display * dpy = (Display *)(intptr_t)display;
if(dpy==NULL) {
- _throwNewRuntimeException(NULL, env, "given display connection is NULL\n");
+ _FatalError(env, "invalid display connection..");
}
XLockDisplay(dpy) ;
+ // DBG_PRINT1( "X11: LockDisplay 0x%X\n", dpy);
}
/*
- * Class: com_sun_javafx_newt_x11_X11Display
+ * Class: com_jogamp_newt_x11_X11Display
* Method: UnlockDisplay
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_UnlockDisplay
+JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Display_UnlockDisplay
(JNIEnv *env, jobject obj, jlong display)
{
Display * dpy = (Display *)(intptr_t)display;
if(dpy==NULL) {
- _throwNewRuntimeException(NULL, env, "given display connection is NULL\n");
+ _FatalError(env, "invalid display connection..");
}
XUnlockDisplay(dpy) ;
+ // DBG_PRINT1( "X11: UnlockDisplay 0x%X\n", dpy);
}
/*
- * Class: com_sun_javafx_newt_x11_X11Display
+ * Class: com_jogamp_newt_x11_X11Display
* Method: CompleteDisplay
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_CompleteDisplay
+JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Display_CompleteDisplay
(JNIEnv *env, jobject obj, jlong display)
{
Display * dpy = (Display *)(intptr_t)display;
@@ -281,19 +325,19 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_CompleteDisplay
jlong windowDeleteAtom;
if(dpy==NULL) {
- _throwNewRuntimeException(NULL, env, "given display connection is NULL\n");
+ _FatalError(env, "invalid display connection..");
}
XLockDisplay(dpy) ;
javaObjectAtom = (jlong) XInternAtom(dpy, "JOGL_JAVA_OBJECT", False);
if(None==javaObjectAtom) {
- _throwNewRuntimeException(dpy, env, "could not create Atom JOGL_JAVA_OBJECT, bail out!\n");
+ _throwNewRuntimeException(dpy, env, "could not create Atom JOGL_JAVA_OBJECT, bail out!");
return;
}
windowDeleteAtom = (jlong) XInternAtom(dpy, "WM_DELETE_WINDOW", False);
if(None==windowDeleteAtom) {
- _throwNewRuntimeException(dpy, env, "could not create Atom WM_DELETE_WINDOW, bail out!\n");
+ _throwNewRuntimeException(dpy, env, "could not create Atom WM_DELETE_WINDOW, bail out!");
return;
}
@@ -323,14 +367,13 @@ static uintptr_t getPtrOut32Long(unsigned long * src) {
}
static void setJavaWindowProperty(JNIEnv *env, Display *dpy, Window window, jlong javaObjectAtom, jobject jwindow) {
- unsigned long jogl_java_object_data[2];
+ unsigned long jogl_java_object_data[2]; // X11 is based on 'unsigned long'
int nitems_32 = putPtrIn32Long( jogl_java_object_data, (uintptr_t) jwindow);
{
jobject test = (jobject) getPtrOut32Long(jogl_java_object_data);
if( ! (jwindow==test) ) {
- _throwNewRuntimeException(dpy, env, "Internal Error .. Encoded Window ref not the same %p != %p !\n", jwindow, test);
- return;
+ _FatalError(env, "Internal Error .. Encoded Window ref not the same %p != %p !", jwindow, test);
}
}
@@ -356,14 +399,13 @@ static jobject getJavaWindowProperty(JNIEnv *env, Display *dpy, Window window, j
&nitems_return, &bytes_after_return, &jogl_java_object_data_pp);
if ( Success != res ) {
- _throwNewRuntimeException(dpy, env, "could not fetch Atom JOGL_JAVA_OBJECT window property (res %d) nitems_return %ld, bytes_after_return %ld, bail out!\n",
- res, nitems_return, bytes_after_return);
+ fprintf(stderr, "Warning: NEWT X11Window: Could not fetch Atom JOGL_JAVA_OBJECT window property (res %d) nitems_return %ld, bytes_after_return %ld, result 0!\n", res, nitems_return, bytes_after_return);
return NULL;
}
if(actual_type_return!=(Atom)javaObjectAtom || nitems_return<nitems_32 || NULL==jogl_java_object_data_pp) {
XFree(jogl_java_object_data_pp);
- _throwNewRuntimeException(dpy, env, "could not fetch Atom JOGL_JAVA_OBJECT window property (res %d) nitems_return %ld, bytes_after_return %ld, actual_type_return %ld, JOGL_JAVA_OBJECT %ld, bail out!\n",
+ fprintf(stderr, "Warning: NEWT X11Window: Fetched invalid Atom JOGL_JAVA_OBJECT window property (res %d) nitems_return %ld, bytes_after_return %ld, actual_type_return %ld, JOGL_JAVA_OBJECT %ld, result 0!\n",
res, nitems_return, bytes_after_return, (long)actual_type_return, javaObjectAtom);
return NULL;
}
@@ -374,18 +416,18 @@ static jobject getJavaWindowProperty(JNIEnv *env, Display *dpy, Window window, j
#ifdef VERBOSE_ON
if(JNI_FALSE == (*env)->IsInstanceOf(env, jwindow, newtWindowClz)) {
- _throwNewRuntimeException(NULL, env, "fetched Atom JOGL_JAVA_OBJECT window is not a NEWT Window: javaWindow 0x%X !\n", jwindow);
+ _throwNewRuntimeException(dpy, env, "fetched Atom JOGL_JAVA_OBJECT window is not a NEWT Window: javaWindow 0x%X !", jwindow);
}
#endif
return jwindow;
}
/*
- * Class: com_sun_javafx_newt_x11_X11Display
+ * Class: com_jogamp_newt_x11_X11Display
* Method: DispatchMessages
* Signature: (JIJJ)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_DispatchMessages
+JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Display_DispatchMessages
(JNIEnv *env, jobject obj, jlong display, jlong javaObjectAtom, jlong wmDeleteAtom)
{
Display * dpy = (Display *) (intptr_t) display;
@@ -405,10 +447,12 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_DispatchMessages
XLockDisplay(dpy) ;
- // num_events = XPending(dpy); // XEventsQueued(dpy, QueuedAfterFlush); // I/O Flush ..
- // num_events = XEventsQueued(dpy, QueuedAlready); // Better, no I/O ..
- if ( 0 >= XEventsQueued(dpy, QueuedAlready) ) {
+ // num_events = XPending(dpy); // I/O Flush ..
+ // num_events = XEventsQueued(dpy, QueuedAfterFlush); // I/O Flush only of no already queued events are available
+ // num_events = XEventsQueued(dpy, QueuedAlready); // no I/O Flush at all, doesn't work on some cards (eg ATI)
+ if ( 0 >= XEventsQueued(dpy, QueuedAfterFlush) ) {
XUnlockDisplay(dpy) ;
+ // DBG_PRINT1( "X11: DispatchMessages 0x%X - Leave 1\n", dpy);
return;
}
@@ -416,19 +460,26 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_DispatchMessages
num_events--;
if( 0==evt.xany.window ) {
- _throwNewRuntimeException(dpy, env, "event window NULL, bail out!\n");
+ _throwNewRuntimeException(dpy, env, "event window NULL, bail out!");
return ;
}
if(dpy!=evt.xany.display) {
- _throwNewRuntimeException(dpy, env, "wrong display, bail out!\n");
+ _throwNewRuntimeException(dpy, env, "wrong display, bail out!");
return ;
}
+
+ displayDispatchErrorHandlerEnable(1, env);
+
jwindow = getJavaWindowProperty(env, dpy, evt.xany.window, javaObjectAtom);
+ displayDispatchErrorHandlerEnable(0, env);
+
if(NULL==jwindow) {
- // just leave .. _throwNewRuntimeException(env, "could not fetch Java Window object, bail out!\n");
+ fprintf(stderr, "Warning: NEWT X11 DisplayDispatch %p, Couldn't handle event %d for invalid X11 window %p\n",
+ dpy, evt.type, evt.xany.window);
XUnlockDisplay(dpy) ;
+ // DBG_PRINT1( "X11: DispatchMessages 0x%X - Leave 2\n", dpy);
return;
}
@@ -446,6 +497,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_DispatchMessages
}
XUnlockDisplay(dpy) ;
+ // DBG_PRINT3( "X11: DispatchMessages 0x%X - Window %p, Event %d\n", dpy, jwindow, evt.type);
switch(evt.type) {
case ButtonPress:
@@ -532,19 +584,18 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Display_DispatchMessages
*/
/*
- * Class: com_sun_javafx_newt_x11_X11Screen
+ * Class: com_jogamp_newt_x11_X11Screen
* Method: GetScreen
* Signature: (JI)J
*/
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_x11_X11Screen_GetScreen
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_x11_X11Screen_GetScreen
(JNIEnv *env, jobject obj, jlong display, jint screen_index)
{
Display * dpy = (Display *)(intptr_t)display;
Screen * scrn= NULL;
if(dpy==NULL) {
- _throwNewRuntimeException(NULL, env, "invalid display connection..\n");
- return 0;
+ _FatalError(env, "invalid display connection..");
}
XLockDisplay(dpy);
@@ -559,14 +610,14 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_x11_X11Screen_GetScreen
return (jlong) (intptr_t) scrn;
}
-JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_x11_X11Screen_getWidth0
+JNIEXPORT jint JNICALL Java_com_jogamp_newt_x11_X11Screen_getWidth0
(JNIEnv *env, jobject obj, jlong display, jint scrn_idx)
{
Display * dpy = (Display *) (intptr_t) display;
return (jint) XDisplayWidth( dpy, scrn_idx);
}
-JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_x11_X11Screen_getHeight0
+JNIEXPORT jint JNICALL Java_com_jogamp_newt_x11_X11Screen_getHeight0
(JNIEnv *env, jobject obj, jlong display, jint scrn_idx)
{
Display * dpy = (Display *) (intptr_t) display;
@@ -579,11 +630,11 @@ JNIEXPORT jint JNICALL Java_com_sun_javafx_newt_x11_X11Screen_getHeight0
*/
/*
- * Class: com_sun_javafx_newt_x11_X11Window
+ * Class: com_jogamp_newt_x11_X11Window
* Method: initIDs
* Signature: ()Z
*/
-JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_x11_X11Window_initIDs
+JNIEXPORT jboolean JNICALL Java_com_jogamp_newt_x11_X11Window_initIDs
(JNIEnv *env, jclass clazz)
{
windowChangedID = (*env)->GetMethodID(env, clazz, "windowChanged", "(IIII)V");
@@ -605,11 +656,11 @@ JNIEXPORT jboolean JNICALL Java_com_sun_javafx_newt_x11_X11Window_initIDs
}
/*
- * Class: com_sun_javafx_newt_x11_X11Window
+ * Class: com_jogamp_newt_x11_X11Window
* Method: CreateWindow
* Signature: (JJIJIIII)J
*/
-JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_x11_X11Window_CreateWindow
+JNIEXPORT jlong JNICALL Java_com_jogamp_newt_x11_X11Window_CreateWindow
(JNIEnv *env, jobject obj, jlong parent, jlong display, jint screen_index,
jlong visualID,
jlong javaObjectAtom, jlong windowDeleteAtom,
@@ -635,12 +686,11 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_x11_X11Window_CreateWindow
DBG_PRINT4( "X11: CreateWindow %x/%d %dx%d\n", x, y, width, height);
if(dpy==NULL) {
- _throwNewRuntimeException(NULL, env, "invalid display connection..\n");
- return 0;
+ _FatalError(env, "invalid display connection..");
}
if(visualID<0) {
- _throwNewRuntimeException(NULL, env, "invalid VisualID ..\n");
+ _throwNewRuntimeException(NULL, env, "invalid VisualID ..");
return 0;
}
@@ -648,7 +698,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_x11_X11Window_CreateWindow
XSync(dpy, False);
- scrn = ScreenOfDisplay(dpy, screen_index);
+ scrn = ScreenOfDisplay(dpy, scrn_idx);
// try given VisualID on screen
memset(&visualTemplate, 0, sizeof(XVisualInfo));
@@ -667,7 +717,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_x11_X11Window_CreateWindow
if (visual==NULL)
{
- _throwNewRuntimeException(dpy, env, "could not query Visual by given VisualID, bail out!\n");
+ _throwNewRuntimeException(dpy, env, "could not query Visual by given VisualID, bail out!");
return 0;
}
@@ -734,11 +784,11 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_x11_X11Window_CreateWindow
}
/*
- * Class: com_sun_javafx_newt_x11_X11Window
+ * Class: com_jogamp_newt_x11_X11Window
* Method: CloseWindow
* Signature: (JJ)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_CloseWindow
+JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Window_CloseWindow
(JNIEnv *env, jobject obj, jlong display, jlong window, jlong javaObjectAtom)
{
Display * dpy = (Display *) (intptr_t) display;
@@ -746,18 +796,17 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_CloseWindow
jobject jwindow;
if(dpy==NULL) {
- _throwNewRuntimeException(NULL, env, "invalid display connection..\n");
- return;
+ _FatalError(env, "invalid display connection..");
}
XLockDisplay(dpy) ;
jwindow = getJavaWindowProperty(env, dpy, w, javaObjectAtom);
if(NULL==jwindow) {
- _throwNewRuntimeException(dpy, env, "could not fetch Java Window object, bail out!\n");
+ _throwNewRuntimeException(dpy, env, "could not fetch Java Window object, bail out!");
return;
}
if ( JNI_FALSE == (*env)->IsSameObject(env, jwindow, obj) ) {
- _throwNewRuntimeException(dpy, env, "Internal Error .. Window global ref not the same!\n");
+ _throwNewRuntimeException(dpy, env, "Internal Error .. Window global ref not the same!");
return;
}
(*env)->DeleteGlobalRef(env, jwindow);
@@ -779,11 +828,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_CloseWindow
}
/*
- * Class: com_sun_javafx_newt_x11_X11Window
+ * Class: com_jogamp_newt_x11_X11Window
* Method: setVisible0
* Signature: (JJZ)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_setVisible0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Window_setVisible0
(JNIEnv *env, jobject obj, jlong display, jlong window, jboolean visible)
{
Display * dpy = (Display *) (intptr_t) display;
@@ -791,8 +840,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_setVisible0
DBG_PRINT1( "X11: setVisible0 vis %d\n", visible);
if(dpy==NULL) {
- _throwNewRuntimeException(NULL, env, "invalid display connection..\n");
- return;
+ _FatalError(env, "invalid display connection..");
}
XLockDisplay(dpy) ;
@@ -823,11 +871,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_setVisible0
#endif
/*
- * Class: com_sun_javafx_newt_x11_X11Window
+ * Class: com_jogamp_newt_x11_X11Window
* Method: setSize0
* Signature: (JIJIIIIIZ)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_setSize0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Window_setSize0
(JNIEnv *env, jobject obj, jlong jparent, jlong display, jint screen_index, jlong window, jint x, jint y, jint width, jint height, jint decorationToggle, jboolean setVisible)
{
Display * dpy = (Display *) (intptr_t) display;
@@ -840,8 +888,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_setSize0
DBG_PRINT6( "X11: setSize0 %d/%d %dx%d, dec %d, vis %d\n", x, y, width, height, decorationToggle, setVisible);
if(dpy==NULL) {
- _throwNewRuntimeException(NULL, env, "invalid display connection..\n");
- return;
+ _FatalError(env, "invalid display connection..");
}
XLockDisplay(dpy) ;
@@ -887,11 +934,11 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_setSize0
}
/*
- * Class: com_sun_javafx_newt_x11_X11Window
+ * Class: com_jogamp_newt_x11_X11Window
* Method: setPosition0
* Signature: (JJII)V
*/
-JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_setPosition0
+JNIEXPORT void JNICALL Java_com_jogamp_newt_x11_X11Window_setPosition0
(JNIEnv *env, jobject obj, jlong display, jlong window, jint x, jint y)
{
Display * dpy = (Display *) (intptr_t) display;
@@ -900,8 +947,7 @@ JNIEXPORT void JNICALL Java_com_sun_javafx_newt_x11_X11Window_setPosition0
DBG_PRINT2( "X11: setPos0 . XConfigureWindow %d/%d\n", x, y);
if(dpy==NULL) {
- _throwNewRuntimeException(NULL, env, "invalid display connection..\n");
- return;
+ _FatalError(env, "invalid display connection..");
}
XLockDisplay(dpy) ;