summaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/com/jogamp/audio/windows/waveout/TestSpatialization.java4
-rw-r--r--src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java6
-rw-r--r--src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java6
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/Region.java2
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java4
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java10
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java8
-rw-r--r--src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/DebugGL2.java (renamed from src/jogl/classes/javax/media/opengl/DebugGL2.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/DebugGL3.java (renamed from src/jogl/classes/javax/media/opengl/DebugGL3.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/DebugGL3bc.java (renamed from src/jogl/classes/javax/media/opengl/DebugGL3bc.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/DebugGL4.java (renamed from src/jogl/classes/javax/media/opengl/DebugGL4.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/DebugGLES2.java (renamed from src/jogl/classes/javax/media/opengl/DebugGLES2.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/DefaultGLCapabilitiesChooser.java (renamed from src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java)9
-rw-r--r--src/jogl/classes/com/jogamp/opengl/FBObject.java48
-rw-r--r--src/jogl/classes/com/jogamp/opengl/FPSCounter.java (renamed from src/jogl/classes/javax/media/opengl/FPSCounter.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLAnimatorControl.java (renamed from src/jogl/classes/javax/media/opengl/GLAnimatorControl.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLArrayData.java (renamed from src/jogl/classes/javax/media/opengl/GLArrayData.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLAutoDrawable.java (renamed from src/jogl/classes/javax/media/opengl/GLAutoDrawable.java)42
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java22
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLBase.java (renamed from src/jogl/classes/javax/media/opengl/GLBase.java)14
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLBufferStorage.java (renamed from src/jogl/classes/javax/media/opengl/GLBufferStorage.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLCapabilities.java (renamed from src/jogl/classes/javax/media/opengl/GLCapabilities.java)6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLCapabilitiesChooser.java (renamed from src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java)8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLCapabilitiesImmutable.java (renamed from src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java)8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLContext.java (renamed from src/jogl/classes/javax/media/opengl/GLContext.java)109
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLDebugListener.java (renamed from src/jogl/classes/javax/media/opengl/GLDebugListener.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLDebugMessage.java (renamed from src/jogl/classes/javax/media/opengl/GLDebugMessage.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLDrawable.java (renamed from src/jogl/classes/javax/media/opengl/GLDrawable.java)10
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLDrawableFactory.java (renamed from src/jogl/classes/javax/media/opengl/GLDrawableFactory.java)50
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLEventListener.java (renamed from src/jogl/classes/javax/media/opengl/GLEventListener.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java32
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLException.java (renamed from src/jogl/classes/javax/media/opengl/GLException.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLFBODrawable.java (renamed from src/jogl/classes/javax/media/opengl/GLFBODrawable.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLOffscreenAutoDrawable.java (renamed from src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLPipelineFactory.java (renamed from src/jogl/classes/javax/media/opengl/GLPipelineFactory.java)10
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLProfile.java (renamed from src/jogl/classes/javax/media/opengl/GLProfile.java)114
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java45
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLRunnable.java (renamed from src/jogl/classes/javax/media/opengl/GLRunnable.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLRunnable2.java (renamed from src/jogl/classes/javax/media/opengl/GLRunnable2.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLSharedContextSetter.java (renamed from src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java)6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLUniformData.java (renamed from src/jogl/classes/javax/media/opengl/GLUniformData.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GenericGLCapabilitiesChooser.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/JoglVersion.java6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/Threading.java (renamed from src/jogl/classes/javax/media/opengl/Threading.java)6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/TraceGL2.java (renamed from src/jogl/classes/javax/media/opengl/TraceGL2.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/TraceGL3.java (renamed from src/jogl/classes/javax/media/opengl/TraceGL3.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/TraceGL3bc.java (renamed from src/jogl/classes/javax/media/opengl/TraceGL3bc.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/TraceGL4.java (renamed from src/jogl/classes/javax/media/opengl/TraceGL4.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/TraceGLES2.java (renamed from src/jogl/classes/javax/media/opengl/TraceGLES2.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/awt/AWTGLAutoDrawable.java (renamed from src/jogl/classes/javax/media/opengl/awt/AWTGLAutoDrawable.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/awt/ComponentEvents.java (renamed from src/jogl/classes/javax/media/opengl/awt/ComponentEvents.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/awt/GLCanvas.java (renamed from src/jogl/classes/javax/media/opengl/awt/GLCanvas.java)161
-rw-r--r--src/jogl/classes/com/jogamp/opengl/awt/GLJPanel.java (renamed from src/jogl/classes/javax/media/opengl/awt/GLJPanel.java)230
-rw-r--r--src/jogl/classes/com/jogamp/opengl/fixedfunc/GLLightingFunc.java (renamed from src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/fixedfunc/GLMatrixFunc.java (renamed from src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/fixedfunc/GLPointerFunc.java (renamed from src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/fixedfunc/GLPointerFuncUtil.java (renamed from src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/glu/GLUnurbs.java (renamed from src/jogl/classes/javax/media/opengl/glu/GLUnurbs.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/glu/GLUquadric.java (renamed from src/jogl/classes/javax/media/opengl/glu/GLUquadric.java)4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/glu/GLUtessellator.java (renamed from src/jogl/classes/javax/media/opengl/glu/GLUtessellator.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/glu/GLUtessellatorCallback.java (renamed from src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallback.java)10
-rw-r--r--src/jogl/classes/com/jogamp/opengl/glu/GLUtessellatorCallbackAdapter.java (renamed from src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java)2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java18
-rw-r--r--src/jogl/classes/com/jogamp/opengl/math/Matrix4.java24
-rw-r--r--src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java50
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/Animator.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java12
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/CustomGLEventListener.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java10
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java16
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java14
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java44
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java30
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java505
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java18
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java36
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/Gamma.java14
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java15
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java17
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java22
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java14
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java16
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java18
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java197
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java18
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java16
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java37
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java38
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShaderNVidia.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/stereo/StereoClientRenderer.java12
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDevice.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDeviceRenderer.java10
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/stereo/StereoGLEventListener.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/stereo/StereoUtil.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java6
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java10
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java26
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java10
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java10
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java2
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java6
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java6
-rw-r--r--src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java6
-rw-r--r--src/jogl/classes/jogamp/graph/font/JavaFontLoader.java2
-rw-r--r--src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java36
-rw-r--r--src/jogl/classes/jogamp/opengl/Debug.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/FPSCounterImpl.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java36
-rw-r--r--src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java19
-rw-r--r--src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java473
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextShareSet.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java22
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java209
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDrawableHelper.java34
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDrawableImpl.java29
-rw-r--r--src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java47
-rw-r--r--src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/GLRunnableTask.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/GLStateTracker.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/GLWorkerThread.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/ProjectFloat.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/SharedResourceRunner.java110
-rw-r--r--src/jogl/classes/jogamp/opengl/ThreadingImpl.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/ToolkitThreadingPlugin.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/awt/AWTUtil.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/awt/Java2D.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/awt/VersionApplet.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java9
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLContext.java363
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java48
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java126
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java1064
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java7
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java3
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java3
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLGLnDynamicLibraryBundleInfo.java83
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java24
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java55
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java61
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java63
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLSurface.java165
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java71
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java30
-rw-r--r--src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/gl2/fixme/GLObjectTracker.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/error/Error.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java18
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/registry/Registry.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java63
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java154
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java18
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java22
-rw-r--r--src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java18
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java212
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java38
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv11Natives.java78
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java26
-rw-r--r--src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDevice.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDeviceRenderer.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/util/stereo/ScaleAndOffset2D.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java18
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java18
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java54
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java12
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java134
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java32
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java54
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java24
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java94
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java131
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java6
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java22
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java37
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java14
-rw-r--r--src/jogl/native/EGLContext.c39
-rw-r--r--src/jogl/native/libav/ffmpeg_impl_template.c7
-rw-r--r--src/jogl/native/libav/ffmpeg_lavc56_lavf56_lavu54_lavr02.c33
262 files changed, 4593 insertions, 3046 deletions
diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/TestSpatialization.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/TestSpatialization.java
index 3d6de2b29..bd7081002 100644
--- a/src/jogl/classes/com/jogamp/audio/windows/waveout/TestSpatialization.java
+++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/TestSpatialization.java
@@ -33,8 +33,8 @@
package com.jogamp.audio.windows.waveout;
import java.io.*;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.opengl.GLDrawableFactory;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.opengl.GLDrawableFactory;
public class TestSpatialization {
public static void main(String[] args) {
diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java
index 75067a3b7..9381d318b 100644
--- a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java
+++ b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java
@@ -424,7 +424,7 @@ public class BuildComposablePipeline {
final ArrayList<String> imports = new ArrayList<String>();
imports.add("java.io.*");
- imports.add("javax.media.opengl.*");
+ imports.add("com.jogamp.opengl.*");
imports.add("com.jogamp.gluegen.runtime.*");
imports.add(Buffer.class.getPackage().getName()+".*");
for (final Class<?> clasS : clazzList) {
@@ -682,7 +682,7 @@ public class BuildComposablePipeline {
!type.endsWith("core") &&
!type.endsWith("Compatible") )
{
- final Class<?> clazz = BuildComposablePipeline.getClass("javax.media.opengl." + type);
+ final Class<?> clazz = BuildComposablePipeline.getClass("com.jogamp.opengl." + type);
if (clazz.isAssignableFrom(baseInterfaceClass)) {
output.println(" return true;");
} else {
@@ -705,7 +705,7 @@ public class BuildComposablePipeline {
} else if( type.equals("GLProfile") ) {
output.println(" return " + getDownstreamObjectName() + ".getGLProfile();");
} else {
- final Class<?> clazz = BuildComposablePipeline.getClass("javax.media.opengl." + type);
+ final Class<?> clazz = BuildComposablePipeline.getClass("com.jogamp.opengl." + type);
if (clazz.isAssignableFrom(baseInterfaceClass)) {
output.println(" if( is" + type + "() ) { return this; }");
output.println(" throw new GLException(\"Not a " + type + " implementation\");");
diff --git a/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java b/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java
index 23d4fc3cf..3d23a623f 100644
--- a/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java
+++ b/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java
@@ -35,16 +35,14 @@ import com.jogamp.common.os.DynamicLookupHelper;
import com.jogamp.gluegen.runtime.FunctionAddressResolver;
/**
- * @author Sven Gothel
- * @author Michael Bien
+ * @author Michael Bien, et.al.
*/
public class GLProcAddressResolver implements FunctionAddressResolver {
public static final boolean DEBUG = false;
@Override
- public long resolve(final String name, final DynamicLookupHelper lookup) {
-
+ public long resolve(final String name, final DynamicLookupHelper lookup) throws SecurityException {
long newProcAddress = 0;
final int permutations = GLNameResolver.getFuncNamePermutationNumber(name);
diff --git a/src/jogl/classes/com/jogamp/graph/curve/Region.java b/src/jogl/classes/com/jogamp/graph/curve/Region.java
index 023ca8373..dde3858de 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/Region.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/Region.java
@@ -87,7 +87,7 @@ public abstract class Region {
* <p>
* If set, a color channel attribute per vertex is added to the stream,
* otherwise only the
- * {@link com.jogamp.graph.curve.opengl.RegionRenderer#setColorStatic(javax.media.opengl.GL2ES2, float, float, float, float) static color}
+ * {@link com.jogamp.graph.curve.opengl.RegionRenderer#setColorStatic(com.jogamp.opengl.GL2ES2, float, float, float, float) static color}
* is being used.
* </p>
*/
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
index 654f9a692..d924fa9c8 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java
@@ -27,8 +27,8 @@
*/
package com.jogamp.graph.curve.opengl;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
import jogamp.graph.curve.opengl.VBORegion2PMSAAES2;
import jogamp.graph.curve.opengl.VBORegion2PVBAAES2;
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
index a0f54d3b5..0c782d93e 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java
@@ -30,11 +30,11 @@ package com.jogamp.graph.curve.opengl;
import java.io.IOException;
import java.util.Iterator;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLES2;
-import javax.media.opengl.GLException;
-import javax.media.opengl.fixedfunc.GLMatrixFunc;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLES2;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
import jogamp.graph.curve.opengl.shader.AttributeNames;
import jogamp.graph.curve.opengl.shader.UniformNames;
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
index 6ff9bf9cd..2b243e6cf 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java
@@ -29,10 +29,10 @@ package com.jogamp.graph.curve.opengl;
import java.nio.FloatBuffer;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLUniformData;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLUniformData;
import jogamp.common.os.PlatformPropsImpl;
import jogamp.graph.curve.opengl.shader.UniformNames;
diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
index 0fa1f49f1..5423cde95 100644
--- a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
+++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java
@@ -31,8 +31,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLException;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLException;
import jogamp.graph.geom.plane.AffineTransform;
diff --git a/src/jogl/classes/javax/media/opengl/DebugGL2.java b/src/jogl/classes/com/jogamp/opengl/DebugGL2.java
index e0d24c4a1..dc0f0df50 100644
--- a/src/jogl/classes/javax/media/opengl/DebugGL2.java
+++ b/src/jogl/classes/com/jogamp/opengl/DebugGL2.java
@@ -1,4 +1,4 @@
-package javax.media.opengl;
+package com.jogamp.opengl;
/**
* <p>
diff --git a/src/jogl/classes/javax/media/opengl/DebugGL3.java b/src/jogl/classes/com/jogamp/opengl/DebugGL3.java
index 678e800f6..6b27d207b 100644
--- a/src/jogl/classes/javax/media/opengl/DebugGL3.java
+++ b/src/jogl/classes/com/jogamp/opengl/DebugGL3.java
@@ -1,4 +1,4 @@
-package javax.media.opengl;
+package com.jogamp.opengl;
/**
* <p>
diff --git a/src/jogl/classes/javax/media/opengl/DebugGL3bc.java b/src/jogl/classes/com/jogamp/opengl/DebugGL3bc.java
index 2636e9428..d92f6043f 100644
--- a/src/jogl/classes/javax/media/opengl/DebugGL3bc.java
+++ b/src/jogl/classes/com/jogamp/opengl/DebugGL3bc.java
@@ -1,4 +1,4 @@
-package javax.media.opengl;
+package com.jogamp.opengl;
/**
* <p>
diff --git a/src/jogl/classes/javax/media/opengl/DebugGL4.java b/src/jogl/classes/com/jogamp/opengl/DebugGL4.java
index c4f8764cb..76f5a4ac3 100644
--- a/src/jogl/classes/javax/media/opengl/DebugGL4.java
+++ b/src/jogl/classes/com/jogamp/opengl/DebugGL4.java
@@ -1,4 +1,4 @@
-package javax.media.opengl;
+package com.jogamp.opengl;
/**
* <p>
diff --git a/src/jogl/classes/javax/media/opengl/DebugGLES2.java b/src/jogl/classes/com/jogamp/opengl/DebugGLES2.java
index c4e06f347..e2b280515 100644
--- a/src/jogl/classes/javax/media/opengl/DebugGLES2.java
+++ b/src/jogl/classes/com/jogamp/opengl/DebugGLES2.java
@@ -1,4 +1,4 @@
-package javax.media.opengl;
+package com.jogamp.opengl;
/**
* <p>
diff --git a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java b/src/jogl/classes/com/jogamp/opengl/DefaultGLCapabilitiesChooser.java
index 412af25e0..88a88087f 100644
--- a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java
+++ b/src/jogl/classes/com/jogamp/opengl/DefaultGLCapabilitiesChooser.java
@@ -38,14 +38,15 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
-import javax.media.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.NativeWindowException;
import java.util.List;
-import javax.media.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.util.PropertyAccess;
import jogamp.opengl.Debug;
@@ -126,7 +127,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser {
final int availnum = available.size();
if (DEBUG) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
System.err.println("Desired: " + gldes);
System.err.println("Available: " + availnum);
for (int i = 0; i < available.size(); i++) {
diff --git a/src/jogl/classes/com/jogamp/opengl/FBObject.java b/src/jogl/classes/com/jogamp/opengl/FBObject.java
index 03693a688..e1ddc9c66 100644
--- a/src/jogl/classes/com/jogamp/opengl/FBObject.java
+++ b/src/jogl/classes/com/jogamp/opengl/FBObject.java
@@ -30,20 +30,21 @@ package com.jogamp.opengl;
import java.util.Arrays;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GL2ES3;
-import javax.media.opengl.GL2GL3;
-import javax.media.opengl.GL3;
-import javax.media.opengl.GLBase;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GL2ES3;
+import com.jogamp.opengl.GL2GL3;
+import com.jogamp.opengl.GL3;
+import com.jogamp.opengl.GLBase;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import jogamp.opengl.Debug;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.util.PropertyAccess;
import com.jogamp.opengl.FBObject.Attachment.Type;
@@ -698,10 +699,7 @@ public class FBObject {
final int magFilter, final int minFilter, final int wrapS, final int wrapT) {
final int dataFormat, dataType;
final boolean alpha = hasAlpha(internalFormat);
- if( gl.isGLES3() ) {
- dataFormat = alpha ? GL.GL_RGBA : GL.GL_RGB;
- dataType = GL.GL_UNSIGNED_BYTE;
- } else if( gl.isGLES() ) {
+ if( gl.isGLES() ) {
dataFormat = alpha ? GL.GL_RGBA : GL.GL_RGB;
dataType = GL.GL_UNSIGNED_BYTE;
} else {
@@ -1071,7 +1069,7 @@ public class FBObject {
vStatus = GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT; // always incomplete w/o attachments!
if(DEBUG) {
System.err.println("FBObject.init() END: "+this);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
@@ -1306,7 +1304,7 @@ public class FBObject {
final int glerr = gl.glGetError();
if(DEBUG && GL.GL_NO_ERROR != glerr) {
System.err.println("Pre-existing GL error: "+toHexString(glerr));
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return glerr;
}
@@ -1520,7 +1518,7 @@ public class FBObject {
final TextureAttachment texA = colbuf.getTextureAttachment();
if( samples > 0 ) {
removeColorAttachment(attachmentPoint, texA);
- if(initializedColorbuf) {
+ if( initializedColorbuf ) {
texA.free(gl);
}
throw new GLException("Texture2D not supported w/ MSAA. If you have enabled MSAA with exisiting texture attachments, you may want to detach them via detachAllTexturebuffer(gl).");
@@ -1533,9 +1531,9 @@ public class FBObject {
if(!ignoreStatus) {
updateStatus(gl);
- if(!isStatusValid()) {
+ if( !isStatusValid() ) {
detachColorbuffer(gl, attachmentPoint, true);
- throw new GLException("attachTexture2D "+texA+" at "+attachmentPoint+" failed "+getStatusString()+", "+this);
+ throw new GLException("attachTexture2D "+texA+" at "+attachmentPoint+" failed: "+getStatusString()+", "+this);
}
}
} else {
@@ -1548,9 +1546,9 @@ public class FBObject {
if(!ignoreStatus) {
updateStatus(gl);
- if(!isStatusValid()) {
+ if( !isStatusValid() ) {
detachColorbuffer(gl, attachmentPoint, true);
- throw new GLException("attachColorbuffer "+colA+" at "+attachmentPoint+" failed "+getStatusString()+", "+this);
+ throw new GLException("attachColorbuffer "+colA+" at "+attachmentPoint+" failed: "+getStatusString()+", "+this);
}
}
}
@@ -1796,7 +1794,7 @@ public class FBObject {
updateStatus(gl);
if( !isStatusValid() ) {
detachRenderbuffer(gl, atype, true);
- throw new GLException("renderbuffer [attachmentType "+atype+", iformat "+toHexString(internalFormat)+"] failed: "+this.getStatusString()+": "+this.toString());
+ throw new GLException("renderbuffer [attachmentType "+atype+", iformat "+toHexString(internalFormat)+"] failed: "+this.getStatusString()+", "+this.toString());
}
}
@@ -2197,7 +2195,7 @@ public class FBObject {
} */
updateStatus(gl);
if(!isStatusValid()) {
- throw new GLException("detachAllImpl failed "+getStatusString()+", "+this);
+ throw new GLException("detachAllImpl failed: "+getStatusString()+", "+this);
}
}
} finally {
@@ -2306,7 +2304,7 @@ public class FBObject {
public final boolean resetSamplingSink(final GL gl) throws GLException {
if(DEBUG) {
System.err.println("FBObject.resetSamplingSink.0");
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
if( 0 == samples ) {
diff --git a/src/jogl/classes/javax/media/opengl/FPSCounter.java b/src/jogl/classes/com/jogamp/opengl/FPSCounter.java
index 4997258e0..a3b7ccb70 100644
--- a/src/jogl/classes/javax/media/opengl/FPSCounter.java
+++ b/src/jogl/classes/com/jogamp/opengl/FPSCounter.java
@@ -25,7 +25,7 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
import java.io.PrintStream;
diff --git a/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java b/src/jogl/classes/com/jogamp/opengl/GLAnimatorControl.java
index d14ada48b..549efd569 100644
--- a/src/jogl/classes/javax/media/opengl/GLAnimatorControl.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLAnimatorControl.java
@@ -26,11 +26,11 @@
* or implied, of JogAmp Community.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
/**
* An animator control interface,
- * which implementation may drive a {@link javax.media.opengl.GLAutoDrawable} animation.
+ * which implementation may drive a {@link com.jogamp.opengl.GLAutoDrawable} animation.
*/
public interface GLAnimatorControl extends FPSCounter {
/**
diff --git a/src/jogl/classes/javax/media/opengl/GLArrayData.java b/src/jogl/classes/com/jogamp/opengl/GLArrayData.java
index 97f58a92a..ea2dfb0f3 100644
--- a/src/jogl/classes/javax/media/opengl/GLArrayData.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLArrayData.java
@@ -26,11 +26,11 @@
* or implied, of JogAmp Community.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
import java.nio.Buffer;
-import javax.media.opengl.fixedfunc.GLPointerFunc;
+import com.jogamp.opengl.fixedfunc.GLPointerFunc;
/**
*
diff --git a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawable.java
index bded88d20..385acf082 100644
--- a/src/jogl/classes/javax/media/opengl/GLAutoDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawable.java
@@ -38,11 +38,11 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
import java.util.List;
-import javax.media.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeSurface;
import com.jogamp.common.util.locks.RecursiveLock;
@@ -63,7 +63,7 @@ import jogamp.opengl.Debug;
<h5><a name="initialization">GLAutoDrawable Initialization</a></h5>
<p>
The implementation shall initialize itself as soon as possible,
- which is only possible <i>after</i> the attached {@link javax.media.nativewindow.NativeSurface NativeSurface} becomes visible and and is realized.<br>
+ which is only possible <i>after</i> the attached {@link com.jogamp.nativewindow.NativeSurface NativeSurface} becomes visible and and is realized.<br>
The following initialization sequence should be implemented:
<ul>
<li> Create the {@link GLDrawable} with the requested {@link GLCapabilities}</li>
@@ -81,11 +81,11 @@ import jogamp.opengl.Debug;
<p>
Another implementation detail is the {@link GLDrawable} reconfiguration. One use case is where a window is being
dragged to another screen with a different pixel configuration, ie {@link GLCapabilities}. The implementation
- shall be able to detect such cases in conjunction with the associated {@link javax.media.nativewindow.NativeSurface NativeSurface}.<br/>
+ shall be able to detect such cases in conjunction with the associated {@link com.jogamp.nativewindow.NativeSurface NativeSurface}.<br/>
For example, AWT's {@link java.awt.Canvas} 's {@link java.awt.Canvas#getGraphicsConfiguration getGraphicsConfiguration()}
- is capable to determine a display device change. This is demonstrated within {@link javax.media.opengl.awt.GLCanvas}'s
- and NEWT's <code>AWTCanvas</code> {@link javax.media.opengl.awt.GLCanvas#getGraphicsConfiguration getGraphicsConfiguration()}
- specialization. Another demonstration is NEWT's {@link javax.media.nativewindow.NativeWindow NativeWindow}
+ is capable to determine a display device change. This is demonstrated within {@link com.jogamp.opengl.awt.GLCanvas}'s
+ and NEWT's <code>AWTCanvas</code> {@link com.jogamp.opengl.awt.GLCanvas#getGraphicsConfiguration getGraphicsConfiguration()}
+ specialization. Another demonstration is NEWT's {@link com.jogamp.nativewindow.NativeWindow NativeWindow}
implementation on the Windows platform, which utilizes the native platform's <i>MonitorFromWindow(HWND)</i> function.<br/>
All OpenGL resources shall be regenerated, while the drawable's {@link GLCapabilities} has
to be chosen again. The following protocol shall be satisfied.
@@ -342,12 +342,12 @@ public interface GLAutoDrawable extends GLDrawable {
public GLEventListener removeGLEventListener(GLEventListener listener);
/**
- * Registers the usage of an animator, an {@link javax.media.opengl.GLAnimatorControl} implementation.
+ * Registers the usage of an animator, an {@link com.jogamp.opengl.GLAnimatorControl} implementation.
* The animator will be queried whether it's animating, ie periodically issuing {@link #display()} calls or not.
* <p>
* This method shall be called by an animator implementation only,<br>
- * e.g. {@link com.jogamp.opengl.util.Animator#add(javax.media.opengl.GLAutoDrawable)}, passing it's control implementation,<br>
- * and {@link com.jogamp.opengl.util.Animator#remove(javax.media.opengl.GLAutoDrawable)}, passing <code>null</code>.
+ * e.g. {@link com.jogamp.opengl.util.Animator#add(com.jogamp.opengl.GLAutoDrawable)}, passing it's control implementation,<br>
+ * and {@link com.jogamp.opengl.util.Animator#remove(com.jogamp.opengl.GLAutoDrawable)}, passing <code>null</code>.
* </p>
* <p>
* Impacts {@link #display()} and {@link #invoke(boolean, GLRunnable)} semantics.</p><br>
@@ -359,15 +359,15 @@ public interface GLAutoDrawable extends GLDrawable {
* @throws GLException if an animator is already registered.
* @see #display()
* @see #invoke(boolean, GLRunnable)
- * @see javax.media.opengl.GLAnimatorControl
+ * @see com.jogamp.opengl.GLAnimatorControl
*/
public abstract void setAnimator(GLAnimatorControl animatorControl) throws GLException;
/**
- * @return the registered {@link javax.media.opengl.GLAnimatorControl} implementation, using this <code>GLAutoDrawable</code>.
+ * @return the registered {@link com.jogamp.opengl.GLAnimatorControl} implementation, using this <code>GLAutoDrawable</code>.
*
- * @see #setAnimator(javax.media.opengl.GLAnimatorControl)
- * @see javax.media.opengl.GLAnimatorControl
+ * @see #setAnimator(com.jogamp.opengl.GLAnimatorControl)
+ * @see com.jogamp.opengl.GLAnimatorControl
*/
public GLAnimatorControl getAnimator();
@@ -504,15 +504,15 @@ public interface GLAutoDrawable extends GLDrawable {
* <ul>
* <li> Calling {@link GLEventListener#display display(..)} for all
* registered {@link GLEventListener}s. </li>
- * <li> Executes all one-shot {@link javax.media.opengl.GLRunnable GLRunnable},
+ * <li> Executes all one-shot {@link com.jogamp.opengl.GLRunnable GLRunnable},
* enqueued via {@link #invoke(boolean, GLRunnable)}.</li>
* </ul></p>
* <p>
- * May be called periodically by a running {@link javax.media.opengl.GLAnimatorControl} implementation,<br>
- * which must register itself with {@link #setAnimator(javax.media.opengl.GLAnimatorControl)}.</p>
+ * May be called periodically by a running {@link com.jogamp.opengl.GLAnimatorControl} implementation,<br>
+ * which must register itself with {@link #setAnimator(com.jogamp.opengl.GLAnimatorControl)}.</p>
* <p>
* Called automatically by the window system toolkit upon receiving a repaint() request, <br>
- * except an {@link javax.media.opengl.GLAnimatorControl} implementation {@link javax.media.opengl.GLAnimatorControl#isAnimating()}.</p>
+ * except an {@link com.jogamp.opengl.GLAnimatorControl} implementation {@link com.jogamp.opengl.GLAnimatorControl#isAnimating()}.</p>
* <p>
* This routine may also be called manually for better control over the
* rendering process. It is legal to call another GLAutoDrawable's
@@ -525,7 +525,7 @@ public interface GLAutoDrawable extends GLDrawable {
* actual {@link GLEventListener#display display(..)} calls,
* in case this has not been done yet.</p>
*
- * @see #setAnimator(javax.media.opengl.GLAnimatorControl)
+ * @see #setAnimator(com.jogamp.opengl.GLAnimatorControl)
*/
public void display();
@@ -598,8 +598,8 @@ public interface GLAutoDrawable extends GLDrawable {
* <tr><td>Toolkit</td> <td>GLAutoDrawable Implementation</td> <td>~</td> <td>Return Type of getUpstreamWidget()</td</tr>
* <tr><td>NEWT</td> <td>{@link com.jogamp.newt.opengl.GLWindow}</td> <td>has a</td> <td>{@link com.jogamp.newt.Window}</td</tr>
* <tr><td>SWT</td> <td>{@link com.jogamp.opengl.swt.GLCanvas}</td> <td>is a</td> <td>{@link org.eclipse.swt.widgets.Canvas}</td</tr>
- * <tr><td>AWT</td> <td>{@link javax.media.opengl.awt.GLCanvas}</td> <td>is a</td> <td>{@link java.awt.Canvas}</td</tr>
- * <tr><td>AWT</td> <td>{@link javax.media.opengl.awt.GLJPanel}</td> <td>is a</td> <td>{@link javax.swing.JPanel}</td</tr>
+ * <tr><td>AWT</td> <td>{@link com.jogamp.opengl.awt.GLCanvas}</td> <td>is a</td> <td>{@link java.awt.Canvas}</td</tr>
+ * <tr><td>AWT</td> <td>{@link com.jogamp.opengl.awt.GLJPanel}</td> <td>is a</td> <td>{@link javax.swing.JPanel}</td</tr>
* </table>
* However, the result may be other object types than the listed above
* due to new supported toolkits.
diff --git a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
index b9f1fb10c..712fcdac7 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
@@ -28,17 +28,17 @@
package com.jogamp.opengl;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.WindowClosingProtocol;
-import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLSharedContextSetter;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.WindowClosingProtocol;
+import com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLSharedContextSetter;
import com.jogamp.common.util.locks.LockFactory;
import com.jogamp.common.util.locks.RecursiveLock;
diff --git a/src/jogl/classes/javax/media/opengl/GLBase.java b/src/jogl/classes/com/jogamp/opengl/GLBase.java
index 48455c525..19b7808fc 100644
--- a/src/jogl/classes/javax/media/opengl/GLBase.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLBase.java
@@ -27,7 +27,7 @@
* or implied, of JogAmp Community.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
/**
* <P>The base interface from which all GL profiles derive, providing
@@ -584,6 +584,9 @@ public interface GLBase {
/**
* Return the framebuffer name bound to this context,
* see {@link GL#glBindFramebuffer(int, int)}.
+ * <p>
+ * Calls {@link GLContext#getBoundFramebuffer(int)}.
+ * </p>
*/
public int getBoundFramebuffer(int target);
@@ -594,6 +597,9 @@ public interface GLBase {
* in case an framebuffer object ({@link com.jogamp.opengl.FBObject}) based drawable
* is being used.
* </p>
+ * <p>
+ * Calls {@link GLContext#getDefaultDrawFramebuffer()}.
+ * </p>
*/
public int getDefaultDrawFramebuffer();
@@ -604,6 +610,9 @@ public interface GLBase {
* in case an framebuffer object ({@link com.jogamp.opengl.FBObject}) based drawable
* is being used.
* </p>
+ * <p>
+ * Calls {@link GLContext#getDefaultReadFramebuffer()}.
+ * </p>
*/
public int getDefaultReadFramebuffer();
@@ -628,6 +637,9 @@ public interface GLBase {
* Note-3: See {@link com.jogamp.opengl.util.GLDrawableUtil#swapBuffersBeforeRead(GLCapabilitiesImmutable) swapBuffersBeforeRead}
* for read-pixels and swap-buffers implications.
* </p>
+ * <p>
+ * Calls {@link GLContext#getDefaultReadBuffer()}.
+ * </p>
*/
public int getDefaultReadBuffer();
}
diff --git a/src/jogl/classes/javax/media/opengl/GLBufferStorage.java b/src/jogl/classes/com/jogamp/opengl/GLBufferStorage.java
index 1101ed31b..5db97d42f 100644
--- a/src/jogl/classes/javax/media/opengl/GLBufferStorage.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLBufferStorage.java
@@ -25,7 +25,7 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilities.java b/src/jogl/classes/com/jogamp/opengl/GLCapabilities.java
index 0d65d35cb..02aa47119 100644
--- a/src/jogl/classes/javax/media/opengl/GLCapabilities.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLCapabilities.java
@@ -38,10 +38,10 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
-import javax.media.nativewindow.Capabilities;
-import javax.media.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.Capabilities;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
/** Specifies a set of OpenGL capabilities.<br>
At creation time of a {@link GLDrawable} using {@link GLDrawableFactory},
diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java b/src/jogl/classes/com/jogamp/opengl/GLCapabilitiesChooser.java
index 2e0bec1f9..9911d1314 100644
--- a/src/jogl/classes/javax/media/opengl/GLCapabilitiesChooser.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLCapabilitiesChooser.java
@@ -38,14 +38,14 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
import java.util.List;
-import javax.media.nativewindow.CapabilitiesImmutable;
-import javax.media.nativewindow.CapabilitiesChooser;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.CapabilitiesChooser;
-import javax.media.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
/** Provides a mechanism by which applications can customize the
window type selection for a given {@link GLCapabilities}.
diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java b/src/jogl/classes/com/jogamp/opengl/GLCapabilitiesImmutable.java
index dc28539a0..25081a521 100644
--- a/src/jogl/classes/javax/media/opengl/GLCapabilitiesImmutable.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLCapabilitiesImmutable.java
@@ -26,15 +26,15 @@
* or implied, of JogAmp Community.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
-import javax.media.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
/**
* Specifies an immutable set of OpenGL capabilities.<br>
*
- * @see javax.media.opengl.GLCapabilities
- * @see javax.media.nativewindow.CapabilitiesImmutable
+ * @see com.jogamp.opengl.GLCapabilities
+ * @see com.jogamp.nativewindow.CapabilitiesImmutable
*/
public interface GLCapabilitiesImmutable extends CapabilitiesImmutable {
/**
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/com/jogamp/opengl/GLContext.java
index e2498e6f1..6366c4e37 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLContext.java
@@ -38,7 +38,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
import java.nio.IntBuffer;
import java.util.HashMap;
@@ -47,8 +47,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeSurface;
import jogamp.opengl.Debug;
import jogamp.opengl.GLContextImpl;
@@ -123,31 +123,43 @@ public abstract class GLContext {
public static final int CONTEXT_CURRENT_NEW = 2;
/** Version 1.00, i.e. GLSL 1.00 for ES 2.0. */
- public static final VersionNumber Version100 = new VersionNumber(1, 0, 0);
+ public static final VersionNumber Version1_0 = new VersionNumber(1, 0, 0);
/** Version 1.10, i.e. GLSL 1.10 for GL 2.0. */
- public static final VersionNumber Version110 = new VersionNumber(1, 10, 0);
+ public static final VersionNumber Version1_10 = new VersionNumber(1, 10, 0);
/** Version 1.20, i.e. GLSL 1.20 for GL 2.1. */
- public static final VersionNumber Version120 = new VersionNumber(1, 20, 0);
+ public static final VersionNumber Version1_20 = new VersionNumber(1, 20, 0);
/** Version 1.30, i.e. GLSL 1.30 for GL 3.0. */
- public static final VersionNumber Version130 = new VersionNumber(1, 30, 0);
+ public static final VersionNumber Version1_30 = new VersionNumber(1, 30, 0);
/** Version 1.40, i.e. GLSL 1.40 for GL 3.1. */
- public static final VersionNumber Version140 = new VersionNumber(1, 40, 0);
+ public static final VersionNumber Version1_40 = new VersionNumber(1, 40, 0);
/** Version 1.50, i.e. GLSL 1.50 for GL 3.2. */
- public static final VersionNumber Version150 = new VersionNumber(1, 50, 0);
+ public static final VersionNumber Version1_50 = new VersionNumber(1, 50, 0);
+
+ /** Version 1.1, i.e. GL 1.1 */
+ public static final VersionNumber Version1_1 = new VersionNumber(1, 1, 0);
+
+ /** Version 1.2, i.e. GL 1.2 */
+ public static final VersionNumber Version1_2 = new VersionNumber(1, 2, 0);
+
+ /** Version 1.4, i.e. GL 1.4 */
+ public static final VersionNumber Version1_4 = new VersionNumber(1, 4, 0);
+
+ /** Version 1.5, i.e. GL 1.5 */
+ public static final VersionNumber Version1_5 = new VersionNumber(1, 5, 0);
/** Version 3.0. As an OpenGL version, it qualifies for desktop {@link #isGL2()} only, or ES 3.0. Or GLSL 3.00 for ES 3.0. */
- public static final VersionNumber Version300 = new VersionNumber(3, 0, 0);
+ public static final VersionNumber Version3_0 = new VersionNumber(3, 0, 0);
/** Version 3.1. As an OpenGL version, it qualifies for {@link #isGL3core()}, {@link #isGL3bc()} and {@link #isGL3()} */
- public static final VersionNumber Version310 = new VersionNumber(3, 1, 0);
+ public static final VersionNumber Version3_1 = new VersionNumber(3, 1, 0);
/** Version 3.2. As an OpenGL version, it qualifies for geometry shader */
- public static final VersionNumber Version320 = new VersionNumber(3, 2, 0);
+ public static final VersionNumber Version3_2 = new VersionNumber(3, 2, 0);
/** Version 4.3. As an OpenGL version, it qualifies for <code>GL_ARB_ES3_compatibility</code> */
- public static final VersionNumber Version430 = new VersionNumber(4, 3, 0);
+ public static final VersionNumber Version4_3 = new VersionNumber(4, 3, 0);
- protected static final VersionNumber Version800 = new VersionNumber(8, 0, 0);
+ protected static final VersionNumber Version8_0 = new VersionNumber(8, 0, 0);
private static final String S_EMPTY = "";
@@ -321,10 +333,11 @@ public abstract class GLContext {
* if the {@link #getGLReadDrawable() read-drawable} differs
* from the {@link #getGLDrawable() write-drawable}.
* Otherwise set both drawables, read and write.
- * @return The previous read/write drawable
+ * @return The previous read/write drawable if operation succeeds
*
- * @throws GLException in case <code>null</code> is being passed or
- * this context is made current on another thread.
+ * @throws GLException in case <code>null</code> is being passed,
+ * this context is made current on another thread
+ * or operation fails.
*
* @see #isGLReadDrawableAvailable()
* @see #setGLReadDrawable(GLDrawable)
@@ -430,10 +443,8 @@ public abstract class GLContext {
* <li>{@link #CONTEXT_NOT_CURRENT} if the context could not be made current.</li>
* </ul>
*
- * @throws GLException if synchronization is disabled and the
- * context is current on another thread, or because the context
- * could not be created or made current due to non-recoverable,
- * window system-specific errors.
+ * @throws GLException if the context could not be created
+ * or made current due to non-recoverable, system-specific errors.
*/
public abstract int makeCurrent() throws GLException;
@@ -529,7 +540,7 @@ public abstract class GLContext {
switch(res) {
case CONTEXT_NOT_CURRENT: return "CONTEXT_NOT_CURRENT";
case CONTEXT_CURRENT: return "CONTEXT_CURRENT";
- case CONTEXT_CURRENT_NEW: return "CONTEXT_NOT_CURRENT";
+ case CONTEXT_CURRENT_NEW: return "CONTEXT_CURRENT_NEW";
default: return "INVALID_VALUE";
}
}
@@ -666,7 +677,7 @@ public abstract class GLContext {
*
* @param glFunctionName the name of the OpenGL function (e.g., use
* "glPolygonOffsetEXT" or "glPolygonOffset" to check if the {@link
- * javax.media.opengl.GL#glPolygonOffset(float,float)} is available).
+ * com.jogamp.opengl.GL#glPolygonOffset(float,float)} is available).
*/
public abstract boolean isFunctionAvailable(String glFunctionName);
@@ -698,7 +709,7 @@ public abstract class GLContext {
space-separated list of available extensions.
Can only be called while this context is current.
This is equivalent to
- {@link javax.media.opengl.GL#glGetString(int) glGetString}({@link javax.media.opengl.GL#GL_EXTENSIONS GL_EXTENSIONS})
+ {@link com.jogamp.opengl.GL#glGetString(int) glGetString}({@link com.jogamp.opengl.GL#GL_EXTENSIONS GL_EXTENSIONS})
*/
public abstract String getGLExtensionsString();
@@ -844,11 +855,11 @@ public abstract class GLContext {
final int minor = ctxGLSLVersion.getMinor();
final String profileOpt;
if( isGLES() ) {
- profileOpt = ctxGLSLVersion.compareTo(Version300) >= 0 ? " es" : S_EMPTY;
+ profileOpt = ctxGLSLVersion.compareTo(Version3_0) >= 0 ? " es" : S_EMPTY;
} else if( isGLCoreProfile() ) {
- profileOpt = ctxGLSLVersion.compareTo(Version150) >= 0 ? " core" : S_EMPTY;
+ profileOpt = ctxGLSLVersion.compareTo(Version1_50) >= 0 ? " core" : S_EMPTY;
} else if( isGLCompatibilityProfile() ) {
- profileOpt = ctxGLSLVersion.compareTo(Version150) >= 0 ? " compatibility" : S_EMPTY;
+ profileOpt = ctxGLSLVersion.compareTo(Version1_50) >= 0 ? " compatibility" : S_EMPTY;
} else {
throw new InternalError("Neither ES, Core nor Compat: "+this); // see validateProfileBits(..)
}
@@ -858,22 +869,22 @@ public abstract class GLContext {
protected static final VersionNumber getStaticGLSLVersionNumber(final int glMajorVersion, final int glMinorVersion, final int ctxOptions) {
if( 0 != ( CTX_PROFILE_ES & ctxOptions ) ) {
if( 3 == glMajorVersion ) {
- return Version300; // ES 3.0 -> GLSL 3.00
+ return Version3_0; // ES 3.0 -> GLSL 3.00
} else if( 2 == glMajorVersion ) {
- return Version100; // ES 2.0 -> GLSL 1.00
+ return Version1_0; // ES 2.0 -> GLSL 1.00
}
} else if( 1 == glMajorVersion ) {
- return Version110; // GL 1.x -> GLSL 1.10
+ return Version1_10; // GL 1.x -> GLSL 1.10
} else if( 2 == glMajorVersion ) {
switch ( glMinorVersion ) {
- case 0: return Version110; // GL 2.0 -> GLSL 1.10
- default: return Version120; // GL 2.1 -> GLSL 1.20
+ case 0: return Version1_10; // GL 2.0 -> GLSL 1.10
+ default: return Version1_20; // GL 2.1 -> GLSL 1.20
}
} else if( 3 == glMajorVersion && 2 >= glMinorVersion ) {
switch ( glMinorVersion ) {
- case 0: return Version130; // GL 3.0 -> GLSL 1.30
- case 1: return Version140; // GL 3.1 -> GLSL 1.40
- default: return Version150; // GL 3.2 -> GLSL 1.50
+ case 0: return Version1_30; // GL 3.0 -> GLSL 1.30
+ case 1: return Version1_40; // GL 3.1 -> GLSL 1.40
+ default: return Version1_50; // GL 3.2 -> GLSL 1.50
}
}
// The new default: GL >= 3.3, ES >= 3.0
@@ -1032,7 +1043,7 @@ public abstract class GLContext {
*/
public final boolean isGL3bc() {
return 0 != (ctxOptions & CTX_PROFILE_COMPAT) &&
- ctxVersion.compareTo(Version310) >= 0 ;
+ ctxVersion.compareTo(Version3_1) >= 0 ;
}
/**
@@ -1041,7 +1052,7 @@ public abstract class GLContext {
*/
public final boolean isGL3() {
return 0 != (ctxOptions & (CTX_PROFILE_COMPAT|CTX_PROFILE_CORE)) &&
- ctxVersion.compareTo(Version310) >= 0 ;
+ ctxVersion.compareTo(Version3_1) >= 0 ;
}
/**
@@ -1049,7 +1060,7 @@ public abstract class GLContext {
*/
public final boolean isGL3core() {
return 0 != ( ctxOptions & CTX_PROFILE_CORE ) &&
- ctxVersion.compareTo(Version310) >= 0;
+ ctxVersion.compareTo(Version3_1) >= 0;
}
/**
@@ -1058,7 +1069,7 @@ public abstract class GLContext {
public final boolean isGLcore() {
return ( 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() >= 2 ) ||
( 0 != ( ctxOptions & CTX_PROFILE_CORE ) &&
- ctxVersion.compareTo(Version310) >= 0
+ ctxVersion.compareTo(Version3_1) >= 0
) ;
}
@@ -1106,7 +1117,7 @@ public abstract class GLContext {
return // ES 3.x not included, see above. ( 0 != ( ctxOptions & CTX_PROFILE_ES ) && ctxVersion.getMajor() >= 3 ) ||
( 0 != ( ctxOptions & CTX_IS_ARB_CREATED ) &&
0 != ( ctxOptions & CTX_PROFILE_CORE ) &&
- ctxVersion.compareTo(Version310) >= 0
+ ctxVersion.compareTo(Version3_1) >= 0
) ;
}
@@ -1461,13 +1472,13 @@ public abstract class GLContext {
/* 1.*/ { 0, 1, 2, 3, 4, 5 },
/* 2.*/ { 0, 1 },
/* 3.*/ { 0, 1, 2, 3 },
- /* 4.*/ { 0, 1, 2, 3, 4 } };
+ /* 4.*/ { 0, 1, 2, 3, 4, 5 } };
public static final int ES_VERSIONS[][] = {
/* 0.*/ { -1 },
/* 1.*/ { 0, 1 },
/* 2.*/ { 0 },
- /* 3.*/ { 0 } };
+ /* 3.*/ { 0, 1 } };
public static final int getMaxMajor(final int ctxProfile) {
return ( 0 != ( CTX_PROFILE_ES & ctxProfile ) ) ? ES_VERSIONS.length-1 : GL_VERSIONS.length-1;
@@ -1604,12 +1615,12 @@ public abstract class GLContext {
//
/**
- * @see #getDeviceVersionAvailableKey(javax.media.nativewindow.AbstractGraphicsDevice, int, int)
+ * @see #getDeviceVersionAvailableKey(com.jogamp.nativewindow.AbstractGraphicsDevice, int, int)
*/
protected static final IdentityHashMap<String, Integer> deviceVersionAvailable = new IdentityHashMap<String, Integer>();
/**
- * @see #getUniqueDeviceString(javax.media.nativewindow.AbstractGraphicsDevice)
+ * @see #getUniqueDeviceString(com.jogamp.nativewindow.AbstractGraphicsDevice)
*/
private static final IdentityHashMap<String, String> deviceVersionsAvailableSet = new IdentityHashMap<String, String>();
@@ -1626,11 +1637,13 @@ public abstract class GLContext {
}
}
- protected static void setAvailableGLVersionsSet(final AbstractGraphicsDevice device) {
+ protected static void setAvailableGLVersionsSet(final AbstractGraphicsDevice device, final boolean set) {
synchronized ( deviceVersionsAvailableSet ) {
final String devKey = device.getUniqueID();
- if( null != deviceVersionsAvailableSet.put(devKey, devKey) ) {
- throw new InternalError("Already set: "+devKey);
+ if( set ) {
+ deviceVersionsAvailableSet.put(devKey, devKey);
+ } else {
+ deviceVersionsAvailableSet.remove(devKey);
}
if (DEBUG) {
System.err.println(getThreadName() + ": createContextARB: SET mappedVersionsAvailableSet "+devKey);
@@ -1651,7 +1664,7 @@ public abstract class GLContext {
/**
* Called by {@link jogamp.opengl.GLContextImpl#createContextARBMapVersionsAvailable(int,int)} not intended to be used by
* implementations. However, if {@link jogamp.opengl.GLContextImpl#createContextARB(long, boolean)} is not being used within
- * {@link javax.media.opengl.GLDrawableFactory#getOrCreateSharedContext(javax.media.nativewindow.AbstractGraphicsDevice)},
+ * {@link com.jogamp.opengl.GLDrawableFactory#getOrCreateSharedContext(com.jogamp.nativewindow.AbstractGraphicsDevice)},
* GLProfile has to map the available versions.
*
* @param reqMajor Key Value either 1, 2, 3 or 4
diff --git a/src/jogl/classes/javax/media/opengl/GLDebugListener.java b/src/jogl/classes/com/jogamp/opengl/GLDebugListener.java
index ec7f7cec1..30e1a49c2 100644
--- a/src/jogl/classes/javax/media/opengl/GLDebugListener.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLDebugListener.java
@@ -25,7 +25,7 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
/**
* Listener for {@link GLDebugMessage}s.
diff --git a/src/jogl/classes/javax/media/opengl/GLDebugMessage.java b/src/jogl/classes/com/jogamp/opengl/GLDebugMessage.java
index 325345012..a8868026b 100644
--- a/src/jogl/classes/javax/media/opengl/GLDebugMessage.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLDebugMessage.java
@@ -25,7 +25,7 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
import com.jogamp.common.os.Platform;
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawable.java b/src/jogl/classes/com/jogamp/opengl/GLDrawable.java
index 5c881ab73..c801ba463 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLDrawable.java
@@ -38,11 +38,11 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeSurfaceHolder;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeSurfaceHolder;
/** An abstraction for an OpenGL rendering target. A GLDrawable's
@@ -229,7 +229,7 @@ public interface GLDrawable extends NativeSurfaceHolder {
* <i>and</i> while it's {@link NativeSurface surface} is being {@link NativeSurface#lockSurface() locked}.
* <p>
* It is usually identical to the underlying windowing toolkit {@link NativeSurface surface}'s
- * {@link javax.media.nativewindow.NativeSurface#getSurfaceHandle() handle}
+ * {@link com.jogamp.nativewindow.NativeSurface#getSurfaceHandle() handle}
* or an intermediate layer to suite GL, e.g. an EGL surface.
* </p>
* <p>
diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/GLDrawableFactory.java
index 71568ee76..07c3e77e0 100644
--- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLDrawableFactory.java
@@ -38,7 +38,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
import java.util.ArrayList;
import java.util.List;
@@ -48,21 +48,21 @@ import com.jogamp.common.util.ReflectionUtil;
import com.jogamp.opengl.GLAutoDrawableDelegate;
import com.jogamp.opengl.GLRendererQuirks;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.CapabilitiesImmutable;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.nativewindow.ProxySurface;
-import javax.media.nativewindow.UpstreamSurfaceHook;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.nativewindow.ProxySurface;
+import com.jogamp.nativewindow.UpstreamSurfaceHook;
import jogamp.opengl.Debug;
/** <p> Provides a virtual machine- and operating system-independent
mechanism for creating {@link GLDrawable}s.
</p>
- <p> The {@link javax.media.opengl.GLCapabilities} objects passed
+ <p> The {@link com.jogamp.opengl.GLCapabilities} objects passed
in to the various factory methods are used as a hint for the
properties of the returned drawable. The default capabilities
selection algorithm (equivalent to passing in a null {@link
@@ -82,8 +82,8 @@ import jogamp.opengl.Debug;
raising a {@link GLException}. The semantics of the rejection
process are (unfortunately) left unspecified for now. The current
implementation will cause a {@link GLException} to be raised
- during the first repaint of the {@link javax.media.opengl.awt.GLCanvas} or {@link
- javax.media.opengl.awt.GLJPanel} if the capabilities can not be met.<br>
+ during the first repaint of the {@link com.jogamp.opengl.awt.GLCanvas} or {@link
+ com.jogamp.opengl.awt.GLJPanel} if the capabilities can not be met.<br>
{@link GLOffscreenAutoDrawable} are created lazily,
see {@link #createOffscreenAutoDrawable(AbstractGraphicsDevice, GLCapabilitiesImmutable, GLCapabilitiesChooser, int, int) createOffscreenAutoDrawable(..)}.
</p>
@@ -144,7 +144,7 @@ public abstract class GLDrawableFactory {
}
}
}
- if (null != factoryClassName) {
+ if (null != factoryClassName && !GLProfile.disableOpenGLDesktop) {
if (DEBUG || GLProfile.DEBUG) {
System.err.println("GLDrawableFactory.static - Native OS Factory for: "+nwt+": "+factoryClassName);
}
@@ -387,13 +387,14 @@ public abstract class GLDrawableFactory {
* </p>
*
* @param device which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
+ * @param glp {@link GLProfile} to identify the device's {@link GLRendererQuirks}, maybe {@code null}
* @param quirk the quirk to be tested, e.g. {@link GLRendererQuirks#NoDoubleBufferedPBuffer}.
* @throws IllegalArgumentException if the quirk is out of range
- * @see #getRendererQuirks(AbstractGraphicsDevice)
+ * @see #getRendererQuirks(AbstractGraphicsDevice, GLProfile)
* @see GLRendererQuirks
*/
- public final boolean hasRendererQuirk(final AbstractGraphicsDevice device, final int quirk) {
- final GLRendererQuirks glrq = getRendererQuirks(device);
+ public final boolean hasRendererQuirk(final AbstractGraphicsDevice device, final GLProfile glp, final int quirk) {
+ final GLRendererQuirks glrq = getRendererQuirks(device, glp);
return null != glrq ? glrq.exist(quirk) : false;
}
@@ -407,10 +408,11 @@ public abstract class GLDrawableFactory {
* the result is always <code>null</code>.
* </p>
* @param device which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
+ * @param glp {@link GLProfile} to identify the device's {@link GLRendererQuirks}, maybe {@code null}
* @see GLContext#getRendererQuirks()
* @see GLRendererQuirks
*/
- public abstract GLRendererQuirks getRendererQuirks(AbstractGraphicsDevice device);
+ public abstract GLRendererQuirks getRendererQuirks(AbstractGraphicsDevice device, final GLProfile glp);
/**
* Returns the sole GLDrawableFactory instance for the desktop (X11, WGL, ..) if exist or null
@@ -466,7 +468,7 @@ public abstract class GLDrawableFactory {
* due to implementation constraints, ie using the shared resource.
*
* @param device which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
- * @return A list of {@link javax.media.opengl.GLCapabilitiesImmutable}'s, maybe empty if none is available.
+ * @return A list of {@link com.jogamp.opengl.GLCapabilitiesImmutable}'s, maybe empty if none is available.
*/
public final List<GLCapabilitiesImmutable> getAvailableCapabilities(AbstractGraphicsDevice device) {
device = validateDevice(device);
@@ -509,9 +511,9 @@ public abstract class GLDrawableFactory {
*
* @see #canCreateGLPbuffer(AbstractGraphicsDevice, GLProfile)
* @see GLContext#isFBOAvailable(AbstractGraphicsDevice, GLProfile)
- * @see javax.media.opengl.GLCapabilities#isOnscreen()
- * @see javax.media.opengl.GLCapabilities#isFBO()
- * @see javax.media.opengl.GLCapabilities#isPBuffer()
+ * @see com.jogamp.opengl.GLCapabilities#isOnscreen()
+ * @see com.jogamp.opengl.GLCapabilities#isFBO()
+ * @see com.jogamp.opengl.GLCapabilities#isPBuffer()
* @see GraphicsConfigurationFactory#chooseGraphicsConfiguration(CapabilitiesImmutable, CapabilitiesImmutable, CapabilitiesChooser, AbstractGraphicsScreen, int)
*/
public abstract GLDrawable createGLDrawable(NativeSurface target)
@@ -587,7 +589,7 @@ public abstract class GLDrawableFactory {
* @param deviceReq which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device.
* @param createNewDevice if <code>true</code> a new independent device instance is created from the <code>deviceReq</code>, otherwise <code>deviceReq</code> is used as-is and must be valid!
* @param capsRequested the desired {@link GLCapabilitiesImmutable}, incl. it's {@link GLProfile}.
- * For shared context, same {@link GLCapabilitiesImmutable#getVisualID(javax.media.nativewindow.VisualIDHolder.VIDType)}
+ * For shared context, same {@link GLCapabilitiesImmutable#getVisualID(com.jogamp.nativewindow.VisualIDHolder.VIDType)}
* across shared drawables will yield best compatibility.
* @param chooser the custom chooser, may be null for default
* @return the created and realized <i>dummy</i> {@link GLAutoDrawable} instance
@@ -648,7 +650,7 @@ public abstract class GLDrawableFactory {
* @param deviceReq which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device.
* @param createNewDevice if <code>true</code> a new independent device instance is created from the <code>deviceReq</code>, otherwise <code>deviceReq</code> is used as-is and must be valid!
* @param capsRequested the desired {@link GLCapabilitiesImmutable}, incl. it's {@link GLProfile}.
- * For shared context, same {@link GLCapabilitiesImmutable#getVisualID(javax.media.nativewindow.VisualIDHolder.VIDType) visual ID}
+ * For shared context, same {@link GLCapabilitiesImmutable#getVisualID(com.jogamp.nativewindow.VisualIDHolder.VIDType) visual ID}
* or {@link GLCapabilitiesImmutable caps}
* across shared drawables will yield best compatibility.
* @param chooser the custom chooser, may be null for default
@@ -726,7 +728,7 @@ public abstract class GLDrawableFactory {
* context in an external (third-party) OpenGL-based library. This
* GLContext object may be used to draw into this preexisting
* context using its {@link GL} and {@link
- * javax.media.opengl.glu.GLU} objects. New contexts created through
+ * com.jogamp.opengl.glu.GLU} objects. New contexts created through
* {@link GLDrawable}s may share textures and display lists with
* this external context. </P>
*
diff --git a/src/jogl/classes/javax/media/opengl/GLEventListener.java b/src/jogl/classes/com/jogamp/opengl/GLEventListener.java
index 995ca2620..8c5dfd3b3 100644
--- a/src/jogl/classes/javax/media/opengl/GLEventListener.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLEventListener.java
@@ -37,7 +37,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
import java.util.EventListener;
diff --git a/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java b/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java
index bfd5fe115..8f0724b03 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java
@@ -30,18 +30,18 @@ package com.jogamp.opengl;
import java.util.ArrayList;
import java.util.List;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.DefaultGraphicsDevice;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.ProxySurface;
-import javax.media.opengl.GLAnimatorControl;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLRunnable;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.DefaultGraphicsDevice;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.ProxySurface;
+import com.jogamp.opengl.GLAnimatorControl;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLRunnable;
import jogamp.opengl.Debug;
@@ -173,7 +173,7 @@ public class GLEventListenerState {
* <p>
* Locking is performed on the {@link GLAutoDrawable auto-drawable's}
* {@link GLAutoDrawable#getUpstreamLock() upstream-lock} and {@link GLAutoDrawable#getNativeSurface() surface}.
- * See <a href="../../../javax/media/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.</li>
+ * See <a href="../../../com/jogamp/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.</li>
* </p>
*
* @param src {@link GLAutoDrawable} source to move components from
@@ -203,7 +203,7 @@ public class GLEventListenerState {
* Locking is performed on the {@link GLAutoDrawable auto-drawable's}
* {@link GLAutoDrawable#getUpstreamLock() upstream-lock} and {@link GLAutoDrawable#getNativeSurface() surface},
* which is <i>not released</i> if <code>keepLocked</code> is <code>true</code>.
- * See <a href="../../../javax/media/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.</li>
+ * See <a href="../../../com/jogamp/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.</li>
* </p>
* <p>
* <code>keepLocked</code> may be utilized if swapping a context between drawables
@@ -321,7 +321,7 @@ public class GLEventListenerState {
* <p>
* Locking is performed on the {@link GLAutoDrawable auto-drawable's}
* {@link GLAutoDrawable#getUpstreamLock() upstream-lock} and {@link GLAutoDrawable#getNativeSurface() surface}.
- * See <a href="../../../javax/media/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.</li>
+ * See <a href="../../../com/jogamp/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.</li>
* </p>
* <p>
* Note: After this operation, the GLEventListenerState reference should be released.
@@ -351,7 +351,7 @@ public class GLEventListenerState {
* <p>
* Locking is performed on the {@link GLAutoDrawable auto-drawable's}
* {@link GLAutoDrawable#getUpstreamLock() upstream-lock} and {@link GLAutoDrawable#getNativeSurface() surface}.
- * See <a href="../../../javax/media/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.</li>
+ * See <a href="../../../com/jogamp/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.</li>
* </p>
* <p>
* If the {@link GLAutoDrawable} <code>dest</code> has been kept locked by {@link #moveFrom(GLAutoDrawable, boolean)},
diff --git a/src/jogl/classes/javax/media/opengl/GLException.java b/src/jogl/classes/com/jogamp/opengl/GLException.java
index acf7cdec0..843934ab2 100644
--- a/src/jogl/classes/javax/media/opengl/GLException.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLException.java
@@ -38,7 +38,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
/** A generic exception for OpenGL errors used throughout the binding
as a substitute for {@link RuntimeException}. */
diff --git a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java b/src/jogl/classes/com/jogamp/opengl/GLFBODrawable.java
index 524c77e9d..69358743e 100644
--- a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLFBODrawable.java
@@ -26,9 +26,9 @@
* or implied, of JogAmp Community.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
-import javax.media.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.NativeWindowException;
import com.jogamp.opengl.FBObject;
import com.jogamp.opengl.FBObject.Colorbuffer;
diff --git a/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java b/src/jogl/classes/com/jogamp/opengl/GLOffscreenAutoDrawable.java
index 62d10d4cb..a2d0f5fdb 100644
--- a/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLOffscreenAutoDrawable.java
@@ -26,9 +26,9 @@
* or implied, of JogAmp Community.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
-import javax.media.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.NativeWindowException;
import com.jogamp.opengl.FBObject;
diff --git a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java b/src/jogl/classes/com/jogamp/opengl/GLPipelineFactory.java
index ab12ba17c..8d8b0428b 100644
--- a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLPipelineFactory.java
@@ -34,7 +34,7 @@
* facility.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
import java.lang.reflect.*;
import java.util.StringTokenizer;
@@ -57,13 +57,13 @@ public class GLPipelineFactory {
* Sample code which installs a Debug and Trace pipeline
* automatic w/ user defined interface, here: GL2ES2:
* <pre>
- * gl = drawable.setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES2.class, gl, null) );
- * gl = drawable.setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES2.class, gl, new Object[] { System.err } ) );
+ * gl = drawable.setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", GL2ES2.class, gl, null) );
+ * gl = drawable.setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", GL2ES2.class, gl, new Object[] { System.err } ) );
* </pre>
* or automatic w/ automatic defined class:
* <pre>
- * gl = drawable.setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) );
- * gl = drawable.setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) );
+ * gl = drawable.setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", null, gl, null) );
+ * gl = drawable.setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", null, gl, new Object[] { System.err } ) );
* </pre>
* </p>
*
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/com/jogamp/opengl/GLProfile.java
index c7aaca5d3..a36a21ad5 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLProfile.java
@@ -35,12 +35,13 @@
* facility.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
import jogamp.opengl.Debug;
import jogamp.opengl.GLDrawableFactoryImpl;
import jogamp.opengl.DesktopGLDynamicLookupHelper;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.GlueGenVersion;
import com.jogamp.common.jvm.JNILibLoaderBase;
import com.jogamp.common.os.Platform;
@@ -52,11 +53,12 @@ import com.jogamp.common.util.locks.LockFactory;
import com.jogamp.common.util.locks.RecursiveThreadGroupLock;
import com.jogamp.gluegen.runtime.FunctionAddressResolver;
import com.jogamp.nativewindow.NativeWindowVersion;
+import com.jogamp.opengl.GLRendererQuirks;
import com.jogamp.opengl.JoglVersion;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.opengl.fixedfunc.GLPointerFunc;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.opengl.fixedfunc.GLPointerFunc;
import java.lang.reflect.Constructor;
import java.security.AccessController;
@@ -79,13 +81,6 @@ public class GLProfile {
public static final boolean DEBUG;
/**
- * In case no OpenGL ES profiles are required
- * and if one platform may have a buggy implementation,
- * setting the property <code>jogl.disable.opengles</code> disables querying possible existing OpenGL ES profiles.
- */
- public static final boolean disableOpenGLES;
-
- /**
* In case no native OpenGL core profiles are required
* and if one platform may have a buggy implementation,
* setting the property <code>jogl.disable.openglcore</code> disables querying possible existing native OpenGL core profiles.
@@ -100,12 +95,43 @@ public class GLProfile {
* context creation extension is buggy on one platform,
* setting the property <code>jogl.disable.openglarbcontext</code> disables utilizing it.
* <p>
+ * This exclusion also disables {@link #disableOpenGLES OpenGL ES}.
+ * </p>
+ * <p>
* This exclusion is disabled for {@link Platform.OSType#MACOS}.
* </p>
*/
public static final boolean disableOpenGLARBContext;
/**
+ * In case no OpenGL ES profiles are required
+ * and if one platform may have a buggy implementation,
+ * setting the property <code>jogl.disable.opengles</code> disables querying possible existing OpenGL ES profiles.
+ */
+ public static final boolean disableOpenGLES;
+
+ /**
+ * In case no OpenGL desktop profiles are required
+ * and if one platform may have a buggy implementation,
+ * setting the property <code>jogl.disable.opengldesktop</code> disables querying possible existing OpenGL desktop profiles.
+ */
+ public static final boolean disableOpenGLDesktop;
+
+ /**
+ * Disable surfaceless OpenGL context capability and its probing
+ * by setting the property <code>jogl.disable.surfacelesscontext</code>.
+ * <p>
+ * By default surfaceless OpenGL context capability is probed,
+ * i.e. whether an OpenGL context can be made current without a default framebuffer.
+ * </p>
+ * <p>
+ * If probing fails or if this property is set, the {@link GLRendererQuirks quirk} {@link GLRendererQuirks#NoSurfacelessCtx}
+ * is being set.
+ * </p>
+ */
+ public static final boolean disableSurfacelessContext;
+
+ /**
* We have to disable support for ANGLE, the D3D ES2 emulation on Windows provided w/ Firefox and Chrome.
* When run in the mentioned browsers, the eglInitialize(..) implementation crashes.
* <p>
@@ -121,9 +147,11 @@ public class GLProfile {
final boolean isOSX = Platform.OSType.MACOS == Platform.getOSType();
DEBUG = Debug.debug("GLProfile");
- disableOpenGLES = PropertyAccess.isPropertyDefined("jogl.disable.opengles", true);
disableOpenGLCore = PropertyAccess.isPropertyDefined("jogl.disable.openglcore", true) && !isOSX;
disableOpenGLARBContext = PropertyAccess.isPropertyDefined("jogl.disable.openglarbcontext", true) && !isOSX;
+ disableOpenGLES = disableOpenGLARBContext || PropertyAccess.isPropertyDefined("jogl.disable.opengles", true);
+ disableOpenGLDesktop = PropertyAccess.isPropertyDefined("jogl.disable.opengldesktop", true);
+ disableSurfacelessContext = PropertyAccess.isPropertyDefined("jogl.disable.surfacelesscontext", true);
enableANGLE = PropertyAccess.isPropertyDefined("jogl.enable.ANGLE", true);
}
@@ -175,7 +203,7 @@ public class GLProfile {
justInitialized = true;
if(DEBUG) {
System.err.println("GLProfile.initSingleton() - thread "+Thread.currentThread().getName());
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
if(ReflectionUtil.DEBUG_STATS_FORNAME) {
@@ -233,7 +261,7 @@ public class GLProfile {
/**
* Manual shutdown method, may be called after your last JOGL use
* within the running JVM.<br>
- * It releases all temporary created resources, ie issues {@link javax.media.opengl.GLDrawableFactory#shutdown()}.<br>
+ * It releases all temporary created resources, ie issues {@link com.jogamp.opengl.GLDrawableFactory#shutdown()}.<br>
* The shutdown implementation is called via the JVM shutdown hook, if not manually invoked.<br>
* <p>
* This method shall not need to be called for other reasons than issuing a proper shutdown of resources at a defined time.
@@ -246,7 +274,7 @@ public class GLProfile {
initialized = false;
if(DEBUG) {
System.err.println("GLProfile.shutdown() - thread "+Thread.currentThread().getName());
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
GLDrawableFactory.shutdown();
}
@@ -1047,7 +1075,7 @@ public class GLProfile {
return usesNativeGLES2(profileImpl) || usesNativeGLES1(profileImpl);
}
- /** @return {@link javax.media.nativewindow.NativeWindowFactory#isAWTAvailable()} and
+ /** @return {@link com.jogamp.nativewindow.NativeWindowFactory#isAWTAvailable()} and
JOGL's AWT part */
public static boolean isAWTAvailable() { return isAWTAvailable; }
@@ -1065,17 +1093,17 @@ public class GLProfile {
return "GL_FLOAT";
case GL.GL_FIXED:
return "GL_FIXED";
- case javax.media.opengl.GL2ES2.GL_INT:
+ case com.jogamp.opengl.GL2ES2.GL_INT:
return "GL_INT";
case GL.GL_UNSIGNED_INT:
return "GL_UNSIGNED_INT";
- case javax.media.opengl.GL2GL3.GL_DOUBLE:
+ case com.jogamp.opengl.GL2GL3.GL_DOUBLE:
return "GL_DOUBLE";
- case javax.media.opengl.GL2.GL_2_BYTES:
+ case com.jogamp.opengl.GL2.GL_2_BYTES:
return "GL_2_BYTES";
- case javax.media.opengl.GL2.GL_3_BYTES:
+ case com.jogamp.opengl.GL2.GL_3_BYTES:
return "GL_3_BYTES";
- case javax.media.opengl.GL2.GL_4_BYTES:
+ case com.jogamp.opengl.GL2.GL_4_BYTES:
return "GL_4_BYTES";
}
return null;
@@ -1305,18 +1333,18 @@ public class GLProfile {
case GL.GL_FLOAT:
case GL.GL_FIXED:
return true;
- case javax.media.opengl.GL2ES2.GL_INT:
+ case com.jogamp.opengl.GL2ES2.GL_INT:
case GL.GL_UNSIGNED_INT:
if( isGL2ES2() ) {
return true;
}
- case javax.media.opengl.GL2GL3.GL_DOUBLE:
+ case com.jogamp.opengl.GL2GL3.GL_DOUBLE:
if( isGL3() ) {
return true;
}
- case javax.media.opengl.GL2.GL_2_BYTES:
- case javax.media.opengl.GL2.GL_3_BYTES:
- case javax.media.opengl.GL2.GL_4_BYTES:
+ case com.jogamp.opengl.GL2.GL_2_BYTES:
+ case com.jogamp.opengl.GL2.GL_3_BYTES:
+ case com.jogamp.opengl.GL2.GL_4_BYTES:
if( isGL2() ) {
return true;
}
@@ -1451,9 +1479,9 @@ public class GLProfile {
case GL.GL_UNSIGNED_SHORT:
case GL.GL_SHORT:
case GL.GL_FLOAT:
- case javax.media.opengl.GL2ES2.GL_INT:
+ case com.jogamp.opengl.GL2ES2.GL_INT:
case GL.GL_UNSIGNED_INT:
- case javax.media.opengl.GL2GL3.GL_DOUBLE:
+ case com.jogamp.opengl.GL2GL3.GL_DOUBLE:
break;
default:
if(throwException) {
@@ -1480,8 +1508,8 @@ public class GLProfile {
switch(type) {
case GL.GL_SHORT:
case GL.GL_FLOAT:
- case javax.media.opengl.GL2ES2.GL_INT:
- case javax.media.opengl.GL2GL3.GL_DOUBLE:
+ case com.jogamp.opengl.GL2ES2.GL_INT:
+ case com.jogamp.opengl.GL2GL3.GL_DOUBLE:
break;
default:
if(throwException) {
@@ -1507,8 +1535,8 @@ public class GLProfile {
case GL.GL_BYTE:
case GL.GL_SHORT:
case GL.GL_FLOAT:
- case javax.media.opengl.GL2ES2.GL_INT:
- case javax.media.opengl.GL2GL3.GL_DOUBLE:
+ case com.jogamp.opengl.GL2ES2.GL_INT:
+ case com.jogamp.opengl.GL2GL3.GL_DOUBLE:
break;
default:
if(throwException) {
@@ -1534,9 +1562,9 @@ public class GLProfile {
case GL.GL_UNSIGNED_SHORT:
case GL.GL_SHORT:
case GL.GL_FLOAT:
- case javax.media.opengl.GL2ES2.GL_INT:
+ case com.jogamp.opengl.GL2ES2.GL_INT:
case GL.GL_UNSIGNED_INT:
- case javax.media.opengl.GL2GL3.GL_DOUBLE:
+ case com.jogamp.opengl.GL2GL3.GL_DOUBLE:
break;
default:
if(throwException) {
@@ -1560,8 +1588,8 @@ public class GLProfile {
switch(type) {
case GL.GL_SHORT:
case GL.GL_FLOAT:
- case javax.media.opengl.GL2ES2.GL_INT:
- case javax.media.opengl.GL2GL3.GL_DOUBLE:
+ case com.jogamp.opengl.GL2ES2.GL_INT:
+ case com.jogamp.opengl.GL2GL3.GL_DOUBLE:
break;
default:
if(throwException) {
@@ -1699,7 +1727,7 @@ public class GLProfile {
final ClassLoader classloader = GLProfile.class.getClassLoader();
isAWTAvailable = NativeWindowFactory.isAWTAvailable() &&
- ReflectionUtil.isClassAvailable("javax.media.opengl.awt.GLCanvas", classloader) ; // JOGL
+ ReflectionUtil.isClassAvailable("com.jogamp.opengl.awt.GLCanvas", classloader) ; // JOGL
initGLCtorImpl();
@@ -1717,7 +1745,7 @@ public class GLProfile {
try {
desktopFactory = (GLDrawableFactoryImpl) GLDrawableFactory.getFactoryImpl(GL2);
if(null != desktopFactory) {
- final DesktopGLDynamicLookupHelper glLookupHelper = (DesktopGLDynamicLookupHelper) desktopFactory.getGLDynamicLookupHelper(0);
+ final DesktopGLDynamicLookupHelper glLookupHelper = (DesktopGLDynamicLookupHelper) desktopFactory.getGLDynamicLookupHelper(GL2);
if(null!=glLookupHelper) {
hasDesktopGLFactory = glLookupHelper.isLibComplete() && hasGL234Impl;
}
@@ -1754,8 +1782,8 @@ public class GLProfile {
if(null != eglFactory) {
hasEGLFactory = true;
// update hasGLES1Impl, hasGLES3Impl based on EGL
- hasGLES3Impl = null!=eglFactory.getGLDynamicLookupHelper(2) && hasGLES3Impl;
- hasGLES1Impl = null!=eglFactory.getGLDynamicLookupHelper(1) && hasGLES1Impl;
+ hasGLES3Impl = null!=eglFactory.getGLDynamicLookupHelper(GLES2) && hasGLES3Impl;
+ hasGLES1Impl = null!=eglFactory.getGLDynamicLookupHelper(GLES1) && hasGLES1Impl;
}
} catch (final LinkageError le) {
t=le;
@@ -1894,7 +1922,7 @@ public class GLProfile {
// also test GLES1, GLES2 and GLES3 on desktop, since we have implementations / emulations available.
if( deviceIsEGLCompatible && ( hasGLES3Impl || hasGLES1Impl ) ) {
// 1st pretend we have all EGL profiles ..
- computeProfileMap(device, false /* desktopCtxUndef*/, true /* esCtxUndef */);
+ computeProfileMap(device, true /* desktopCtxUndef*/, true /* esCtxUndef */);
// Triggers eager initialization of share context in GLDrawableFactory for the device,
// hence querying all available GLProfiles
@@ -1933,9 +1961,7 @@ public class GLProfile {
}
}
- if(!GLContext.getAvailableGLVersionsSet(device)) {
- GLContext.setAvailableGLVersionsSet(device);
- }
+ GLContext.setAvailableGLVersionsSet(device, true);
if (DEBUG) {
System.err.println("GLProfile.initProfilesForDevice: "+device.getConnection()+": added profile(s): desktop "+addedDesktopProfile+", egl "+addedEGLProfile);
diff --git a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
index e4cd5c5d9..55c02d92a 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
@@ -29,13 +29,12 @@ package com.jogamp.opengl;
import java.util.IdentityHashMap;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.opengl.GLCapabilitiesImmutable;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
import com.jogamp.common.os.Platform;
-
-import jogamp.opengl.egl.EGL;
-import jogamp.opengl.egl.EGLExt;
+import com.jogamp.opengl.egl.EGL;
+import com.jogamp.opengl.egl.EGLExt;
/**
* GLRendererQuirks contains information of known bugs of various GL renderer.
@@ -348,7 +347,7 @@ public class GLRendererQuirks {
* Some drivers wrongly claim to support pbuffers
* with accumulation buffers. However, the creation of such pbuffer fails:
* <pre>
- * javax.media.opengl.GLException: pbuffer creation error: Couldn't find a suitable pixel format
+ * com.jogamp.opengl.GLException: pbuffer creation error: Couldn't find a suitable pixel format
* </pre>
* </p>
* <p>
@@ -402,7 +401,7 @@ public class GLRendererQuirks {
* Some drivers wrongly claim to support ARB_create_context.
* However, the creation of such context fails:
* <pre>
- * javax.media.opengl.GLException: AWT-EventQueue-0: WindowsWGLContex.createContextImpl ctx !ARB, profile > GL2
+ * com.jogamp.opengl.GLException: AWT-EventQueue-0: WindowsWGLContex.createContextImpl ctx !ARB, profile > GL2
* requested (OpenGL >= 3.0.1). Requested: GLProfile[GL3bc/GL3bc.hw], current: 2.1 (Compat profile, FBO, hardware)
* - 2.1.8787
* </pre>
@@ -419,8 +418,36 @@ public class GLRendererQuirks {
*/
public static final int NoARBCreateContext = 21;
+ /**
+ * No support for ES or desktop GL >= 3.0 current context without surface,
+ * i.e. without a default framebuffer as read- and write drawables.
+ * <p>
+ * See <i>OpenGL spec 3.0, chapter 2.1 OpenGL Fundamentals, page 7</i> or<br>
+ * <i>OpenGL ES spec 3.0.2, chapter 2.1 OpenGL Fundamentals, page 6</i>:
+ * <pre>
+ * It is possible to use a GL context without a default framebuffer, in which case
+ * a framebuffer object must be used to perform all rendering. This is useful for
+ * applications neeting to perform offscreen rendering.
+ * </pre>
+ * </p>
+ * <p>
+ * The feature will be attempted at initialization and this quirk will be set if failing.
+ * </p>
+ * <p>
+ * Known drivers failing the specification:
+ * <ul>
+ * <li>GNU/Linux X11 Nvidia proprietary driver
+ * <ul>
+ * <li>GL_VERSION 4.4.0 NVIDIA 340.24</li>
+ * <li>Platform GNU/Linux X11</li>
+ * </ul></li>
+ * </ul>
+ * </p>
+ */
+ public static final int NoSurfacelessCtx = 22;
+
/** Return the number of known quirks. */
- public static final int getCount() { return 22; }
+ public static final int getCount() { return 23; }
private static final String[] _names = new String[] { "NoDoubleBufferedPBuffer", "NoDoubleBufferedBitmap", "NoSetSwapInterval",
"NoOffscreenBitmap", "NoSetSwapIntervalPostRetarget", "GLSLBuggyDiscard",
@@ -429,7 +456,7 @@ public class GLRendererQuirks {
"NoFullFBOSupport", "GLSLNonCompliant", "GL4NeedsGL3Request",
"GLSharedContextBuggy", "GLES3ViaEGLES2Config", "SingletonEGLDisplayOnly",
"NoMultiSamplingBuffers", "BuggyColorRenderbuffer", "NoPBufferWithAccum",
- "NeedSharedObjectSync", "NoARBCreateContext"
+ "NeedSharedObjectSync", "NoARBCreateContext", "NoSurfacelessCtx"
};
private static final IdentityHashMap<String, GLRendererQuirks> stickyDeviceQuirks = new IdentityHashMap<String, GLRendererQuirks>();
diff --git a/src/jogl/classes/javax/media/opengl/GLRunnable.java b/src/jogl/classes/com/jogamp/opengl/GLRunnable.java
index ad68662ce..97a72d6cd 100644
--- a/src/jogl/classes/javax/media/opengl/GLRunnable.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLRunnable.java
@@ -26,12 +26,12 @@
* or implied, of JogAmp Community.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
/**
* <p>
* Declares a one-shot OpenGL command usable for injection
- * via {@link GLAutoDrawable#invoke(boolean, javax.media.opengl.GLRunnable)}.<br>
+ * via {@link GLAutoDrawable#invoke(boolean, com.jogamp.opengl.GLRunnable)}.<br>
* {@link GLAutoDrawable} executes the GLRunnables within it's {@link GLAutoDrawable#display() display()}
* method after all registered {@link GLEventListener}s
* {@link GLEventListener#display(GLAutoDrawable) display(GLAutoDrawable)}
diff --git a/src/jogl/classes/javax/media/opengl/GLRunnable2.java b/src/jogl/classes/com/jogamp/opengl/GLRunnable2.java
index 5f0393257..4b0c63da0 100644
--- a/src/jogl/classes/javax/media/opengl/GLRunnable2.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLRunnable2.java
@@ -26,7 +26,7 @@
* or implied, of JogAmp Community.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
/**
* <p>
diff --git a/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java b/src/jogl/classes/com/jogamp/opengl/GLSharedContextSetter.java
index b8aef126b..852ebcaa7 100644
--- a/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLSharedContextSetter.java
@@ -26,7 +26,7 @@
* or implied, of JogAmp Community.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
import com.jogamp.opengl.GLRendererQuirks;
@@ -45,7 +45,7 @@ import com.jogamp.opengl.GLRendererQuirks;
* i.e. the <i>slave</i> {@link GLAutoDrawable} will not be realized before their associated <i>master</i>.
* </p>
* <p>
- * Using the nearest or same {@link GLCapabilitiesImmutable#getVisualID(javax.media.nativewindow.VisualIDHolder.VIDType) visual ID}
+ * Using the nearest or same {@link GLCapabilitiesImmutable#getVisualID(com.jogamp.nativewindow.VisualIDHolder.VIDType) visual ID}
* or {@link GLCapabilitiesImmutable caps} across the shared {@link GLDrawable}s will yield best compatibility.
* </p>
* <h5><a name="lifecycle">Lifecycle Considerations</a></h5>
@@ -70,7 +70,7 @@ import com.jogamp.opengl.GLRendererQuirks;
* <i>or</i> the <i>slaves</i> validate whether the resources are still valid.
* </p>
* <p>
- * To simplify above lifecycle issues, one may use a {@link GLDrawableFactory#createDummyDrawable(javax.media.nativewindow.AbstractGraphicsDevice, boolean, GLCapabilitiesImmutable, GLCapabilitiesChooser) dummy}
+ * To simplify above lifecycle issues, one may use a {@link GLDrawableFactory#createDummyDrawable(com.jogamp.nativewindow.AbstractGraphicsDevice, boolean, GLCapabilitiesImmutable, GLCapabilitiesChooser) dummy}
* {@link GLDrawable} and it's {@link GLContext} as the <i>master</i> of all shared <i>slave</i> {@link GLContext}.
* Since this <i>dummy instance</i> does not depend on any native windowing system, it can be controlled easily w/o being <i>in sight</i>.<br>
* Below code creates a {@link GLAutoDrawable} based on a <i>dummy GLDrawable</i>:
diff --git a/src/jogl/classes/javax/media/opengl/GLUniformData.java b/src/jogl/classes/com/jogamp/opengl/GLUniformData.java
index 47f07539b..44f7f29c7 100644
--- a/src/jogl/classes/javax/media/opengl/GLUniformData.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLUniformData.java
@@ -1,5 +1,5 @@
-package javax.media.opengl;
+package com.jogamp.opengl;
import java.nio.*;
diff --git a/src/jogl/classes/com/jogamp/opengl/GenericGLCapabilitiesChooser.java b/src/jogl/classes/com/jogamp/opengl/GenericGLCapabilitiesChooser.java
index 3693f647a..46971d168 100644
--- a/src/jogl/classes/com/jogamp/opengl/GenericGLCapabilitiesChooser.java
+++ b/src/jogl/classes/com/jogamp/opengl/GenericGLCapabilitiesChooser.java
@@ -29,8 +29,8 @@
package com.jogamp.opengl;
import java.util.List;
-import javax.media.nativewindow.CapabilitiesImmutable;
-import javax.media.opengl.DefaultGLCapabilitiesChooser;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.opengl.DefaultGLCapabilitiesChooser;
/**
* Ignores windowSystemRecommendedChoice parameter,
diff --git a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java
index 8d6765036..5070f3e4e 100644
--- a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java
+++ b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java
@@ -29,7 +29,7 @@
package com.jogamp.opengl;
import com.jogamp.common.GlueGenVersion;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.VersionUtil;
@@ -37,7 +37,7 @@ import com.jogamp.common.util.JogampVersion;
import java.util.List;
import java.util.jar.Manifest;
-import javax.media.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
public class JoglVersion extends JogampVersion {
@@ -51,7 +51,7 @@ public class JoglVersion extends JogampVersion {
if(null == jogampCommonVersionInfo) { // volatile: ok
synchronized(JoglVersion.class) {
if( null == jogampCommonVersionInfo ) {
- final String packageName = "javax.media.opengl";
+ final String packageName = "com.jogamp.opengl";
final Manifest mf = VersionUtil.getManifest(JoglVersion.class.getClassLoader(), packageName);
jogampCommonVersionInfo = new JoglVersion(packageName, mf);
}
diff --git a/src/jogl/classes/javax/media/opengl/Threading.java b/src/jogl/classes/com/jogamp/opengl/Threading.java
index c8d8d0071..852c8081f 100644
--- a/src/jogl/classes/javax/media/opengl/Threading.java
+++ b/src/jogl/classes/com/jogamp/opengl/Threading.java
@@ -38,7 +38,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package javax.media.opengl;
+package com.jogamp.opengl;
import jogamp.opengl.ThreadingImpl;
@@ -147,7 +147,7 @@ public class Threading {
return ThreadingImpl.getMode();
}
- /** If an implementation of the javax.media.opengl APIs offers a
+ /** If an implementation of the com.jogamp.opengl APIs offers a
multithreading option but the default behavior is single-threading,
this API provides a mechanism for end users to disable single-threading
in this implementation. Users are strongly discouraged from
@@ -189,7 +189,7 @@ public class Threading {
}
/** Executes the passed Runnable on the single thread used for all
- OpenGL work in this javax.media.opengl API implementation. It is
+ OpenGL work in this com.jogamp.opengl API implementation. It is
not specified exactly which thread is used for this
purpose. This method should only be called if the single-thread
model is in use and if the current thread is not the OpenGL
diff --git a/src/jogl/classes/javax/media/opengl/TraceGL2.java b/src/jogl/classes/com/jogamp/opengl/TraceGL2.java
index 94d391d43..1609398e7 100644
--- a/src/jogl/classes/javax/media/opengl/TraceGL2.java
+++ b/src/jogl/classes/com/jogamp/opengl/TraceGL2.java
@@ -1,4 +1,4 @@
-package javax.media.opengl;
+package com.jogamp.opengl;
import java.io.PrintStream;
diff --git a/src/jogl/classes/javax/media/opengl/TraceGL3.java b/src/jogl/classes/com/jogamp/opengl/TraceGL3.java
index 96e655902..fd95d6392 100644
--- a/src/jogl/classes/javax/media/opengl/TraceGL3.java
+++ b/src/jogl/classes/com/jogamp/opengl/TraceGL3.java
@@ -1,4 +1,4 @@
-package javax.media.opengl;
+package com.jogamp.opengl;
import java.io.PrintStream;
diff --git a/src/jogl/classes/javax/media/opengl/TraceGL3bc.java b/src/jogl/classes/com/jogamp/opengl/TraceGL3bc.java
index 2a8590236..7daa9e392 100644
--- a/src/jogl/classes/javax/media/opengl/TraceGL3bc.java
+++ b/src/jogl/classes/com/jogamp/opengl/TraceGL3bc.java
@@ -1,4 +1,4 @@
-package javax.media.opengl;
+package com.jogamp.opengl;
import java.io.PrintStream;
diff --git a/src/jogl/classes/javax/media/opengl/TraceGL4.java b/src/jogl/classes/com/jogamp/opengl/TraceGL4.java
index d48f9926a..b0c817105 100644
--- a/src/jogl/classes/javax/media/opengl/TraceGL4.java
+++ b/src/jogl/classes/com/jogamp/opengl/TraceGL4.java
@@ -1,4 +1,4 @@
-package javax.media.opengl;
+package com.jogamp.opengl;
import java.io.PrintStream;
diff --git a/src/jogl/classes/javax/media/opengl/TraceGLES2.java b/src/jogl/classes/com/jogamp/opengl/TraceGLES2.java
index b58f169a7..7c7956b68 100644
--- a/src/jogl/classes/javax/media/opengl/TraceGLES2.java
+++ b/src/jogl/classes/com/jogamp/opengl/TraceGLES2.java
@@ -1,4 +1,4 @@
-package javax.media.opengl;
+package com.jogamp.opengl;
import java.io.PrintStream;
diff --git a/src/jogl/classes/javax/media/opengl/awt/AWTGLAutoDrawable.java b/src/jogl/classes/com/jogamp/opengl/awt/AWTGLAutoDrawable.java
index 2698678af..6e273e4e6 100644
--- a/src/jogl/classes/javax/media/opengl/awt/AWTGLAutoDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/awt/AWTGLAutoDrawable.java
@@ -37,9 +37,9 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package javax.media.opengl.awt;
+package com.jogamp.opengl.awt;
-import javax.media.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLAutoDrawable;
public interface AWTGLAutoDrawable extends GLAutoDrawable, ComponentEvents {
/** Requests a new width and height for this AWTGLAutoDrawable. */
diff --git a/src/jogl/classes/javax/media/opengl/awt/ComponentEvents.java b/src/jogl/classes/com/jogamp/opengl/awt/ComponentEvents.java
index 5feaa5760..996776c9b 100644
--- a/src/jogl/classes/javax/media/opengl/awt/ComponentEvents.java
+++ b/src/jogl/classes/com/jogamp/opengl/awt/ComponentEvents.java
@@ -37,9 +37,9 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package javax.media.opengl.awt;
+package com.jogamp.opengl.awt;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
import java.awt.event.*;
import java.beans.PropertyChangeListener;
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/awt/GLCanvas.java
index a648e3bf6..11d217535 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/com/jogamp/opengl/awt/GLCanvas.java
@@ -38,7 +38,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package javax.media.opengl.awt;
+package com.jogamp.opengl.awt;
import java.beans.Beans;
import java.lang.reflect.Method;
@@ -61,32 +61,32 @@ import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.OffscreenLayerOption;
-import javax.media.nativewindow.ScalableSurface;
-import javax.media.nativewindow.VisualIDHolder;
-import javax.media.nativewindow.WindowClosingProtocol;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.GraphicsConfigurationFactory;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLAnimatorControl;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesChooser;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLOffscreenAutoDrawable;
-import javax.media.opengl.GLProfile;
-import javax.media.opengl.GLRunnable;
-import javax.media.opengl.GLSharedContextSetter;
-import javax.media.opengl.Threading;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.OffscreenLayerOption;
+import com.jogamp.nativewindow.ScalableSurface;
+import com.jogamp.nativewindow.VisualIDHolder;
+import com.jogamp.nativewindow.WindowClosingProtocol;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.GraphicsConfigurationFactory;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLAnimatorControl;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesChooser;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLOffscreenAutoDrawable;
+import com.jogamp.opengl.GLProfile;
+import com.jogamp.opengl.GLRunnable;
+import com.jogamp.opengl.GLSharedContextSetter;
+import com.jogamp.opengl.Threading;
import com.jogamp.common.GlueGenVersion;
import com.jogamp.common.util.VersionUtil;
@@ -178,9 +178,10 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
private volatile JAWTWindow jawtWindow; // the JAWTWindow presentation of this AWT Canvas, bound to the 'drawable' lifecycle
private volatile GLContextImpl context; // volatile: avoid locking for read-only access
private volatile boolean sendReshape = false; // volatile: maybe written by EDT w/o locking
- private final int[] nativePixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE };
- private final int[] hasPixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE };
- final int[] reqPixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE };
+ private final float[] minPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE };
+ private final float[] maxPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE };
+ private final float[] hasPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE };
+ final float[] reqPixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE };
// copy of the cstr args, mainly for recreation
private final GLCapabilitiesImmutable capsReqUser;
@@ -224,7 +225,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
See details about <a href="#contextSharing">OpenGL context sharing</a>.
</p>
* @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device.
- * @see GLCanvas#GLCanvas(javax.media.opengl.GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, javax.media.opengl.GLContext, java.awt.GraphicsDevice)
+ * @see GLCanvas#GLCanvas(com.jogamp.opengl.GLCapabilitiesImmutable, com.jogamp.opengl.GLCapabilitiesChooser, com.jogamp.opengl.GLContext, java.awt.GraphicsDevice)
*/
public GLCanvas(final GLCapabilitiesImmutable capsReqUser) throws GLException {
this(capsReqUser, null, null);
@@ -642,38 +643,73 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
@Override
- public final void setSurfaceScale(final int[] pixelScale) {
- SurfaceScaleUtils.validateReqPixelScale(reqPixelScale, pixelScale, DEBUG ? getClass().getSimpleName() : null);
- if( isRealized() ) {
- final ScalableSurface ns = jawtWindow;
- if( null != ns ) {
- ns.setSurfaceScale(reqPixelScale);
- final int hadPixelScaleX = hasPixelScale[0];
- final int hadPixelScaleY = hasPixelScale[1];
- ns.getCurrentSurfaceScale(hasPixelScale);
- if( hadPixelScaleX != hasPixelScale[0] || hadPixelScaleY != hasPixelScale[1] ) {
- reshapeImpl(getWidth(), getHeight());
- display();
- }
- }
+ public final boolean setSurfaceScale(final float[] pixelScale) {
+ System.arraycopy(pixelScale, 0, reqPixelScale, 0, 2);
+ if( isRealized() && isShowing ) {
+ Threading.invoke(true, setSurfaceScaleOnEDTAction, getTreeLock());
+ return true;
+ } else {
+ return false;
+ }
+ }
+ private final Runnable setSurfaceScaleOnEDTAction = new Runnable() {
+ @Override
+ public void run() {
+ final RecursiveLock _lock = lock;
+ _lock.lock();
+ try {
+ if( null != drawable && drawable.isRealized() ) {
+ if( setSurfaceScaleImpl(jawtWindow) ) {
+ reshapeImpl(getWidth(), getHeight());
+ if( !helper.isAnimatorAnimatingOnOtherThread() ) {
+ helper.invokeGL(drawable, context, displayAction, initAction); // display
+ }
+ }
+ }
+ } finally {
+ _lock.unlock();
+ }
+ } };
+ private final boolean setSurfaceScaleImpl(final ScalableSurface ns) {
+ if( ns.setSurfaceScale(reqPixelScale) ) {
+ ns.getCurrentSurfaceScale(hasPixelScale);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private final boolean updatePixelScale() {
+ if( jawtWindow.hasPixelScaleChanged() ) {
+ jawtWindow.getMaximumSurfaceScale(maxPixelScale);
+ jawtWindow.getMinimumSurfaceScale(minPixelScale);
+ return setSurfaceScaleImpl(jawtWindow);
+ } else {
+ return false;
}
}
@Override
- public final int[] getRequestedSurfaceScale(final int[] result) {
+ public final float[] getRequestedSurfaceScale(final float[] result) {
System.arraycopy(reqPixelScale, 0, result, 0, 2);
return result;
}
@Override
- public final int[] getCurrentSurfaceScale(final int[] result) {
+ public final float[] getCurrentSurfaceScale(final float[] result) {
System.arraycopy(hasPixelScale, 0, result, 0, 2);
return result;
}
@Override
- public int[] getNativeSurfaceScale(final int[] result) {
- System.arraycopy(nativePixelScale, 0, result, 0, 2);
+ public float[] getMinimumSurfaceScale(final float[] result) {
+ System.arraycopy(minPixelScale, 0, result, 0, 2);
+ return result;
+ }
+
+ @Override
+ public float[] getMaximumSurfaceScale(final float[] result) {
+ System.arraycopy(maxPixelScale, 0, result, 0, 2);
return result;
}
@@ -681,13 +717,14 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
if ( !Beans.isDesignTime() ) {
jawtWindow = (JAWTWindow) NativeWindowFactory.getNativeWindow(this, awtConfig);
jawtWindow.setShallUseOffscreenLayer(shallUseOffscreenLayer);
- jawtWindow.setSurfaceScale(reqPixelScale);
jawtWindow.lockSurface();
try {
+ jawtWindow.setSurfaceScale(reqPixelScale);
drawable = (GLDrawableImpl) GLDrawableFactory.getFactory(capsReqUser.getGLProfile()).createGLDrawable(jawtWindow);
createContextImpl(drawable);
jawtWindow.getCurrentSurfaceScale(hasPixelScale);
- jawtWindow.getNativeSurfaceScale(nativePixelScale);
+ jawtWindow.getMinimumSurfaceScale(minPixelScale);
+ jawtWindow.getMaximumSurfaceScale(maxPixelScale);
} finally {
jawtWindow.unlockSurface();
}
@@ -785,10 +822,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
reshapeImpl(width, height);
}
}
-
private void reshapeImpl(final int width, final int height) {
- final int scaledWidth = width * hasPixelScale[0];
- final int scaledHeight = height * hasPixelScale[1];
+ final int scaledWidth = SurfaceScaleUtils.scale(width, hasPixelScale[0]);
+ final int scaledHeight = SurfaceScaleUtils.scale(height, hasPixelScale[1]);
if(DEBUG) {
final NativeSurface ns = getNativeSurface();
@@ -1187,12 +1223,12 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
@Override
public int getSurfaceWidth() {
- return getWidth() * hasPixelScale[0];
+ return SurfaceScaleUtils.scale(getWidth(), hasPixelScale[0]);
}
@Override
public int getSurfaceHeight() {
- return getHeight() * hasPixelScale[1];
+ return SurfaceScaleUtils.scale(getHeight(), hasPixelScale[1]);
}
@Override
@@ -1239,7 +1275,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
// Internals only below this point
//
- private final String getPixelScaleStr() { return hasPixelScale[0]+"x"+hasPixelScale[1]; }
+ private final String getPixelScaleStr() { return "["+hasPixelScale[0]+", "+hasPixelScale[1]+"]"; }
private final Runnable destroyOnEDTAction = new Runnable() {
@Override
@@ -1322,7 +1358,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
* The drawable and context handle are null'ed as well, assuming {@link #destroy()} has been called already.
* </p>
*
- * @see #chooseGraphicsConfiguration(javax.media.opengl.GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, java.awt.GraphicsDevice)
+ * @see #chooseGraphicsConfiguration(com.jogamp.opengl.GLCapabilitiesImmutable, com.jogamp.opengl.GLCapabilitiesImmutable, com.jogamp.opengl.GLCapabilitiesChooser, java.awt.GraphicsDevice)
*/
private final Runnable disposeJAWTWindowAndAWTDeviceOnEDT = new Runnable() {
@Override
@@ -1339,8 +1375,10 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
}
hasPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE;
hasPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE;
- nativePixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE;
- nativePixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE;
+ minPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE;
+ minPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE;
+ maxPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE;
+ maxPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE;
if(null != awtConfig) {
final AbstractGraphicsConfiguration aconfig = awtConfig.getNativeGraphicsConfiguration();
@@ -1391,6 +1429,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
_lock.lock();
try {
if( null != drawable && drawable.isRealized() ) {
+ if( GLCanvas.this.updatePixelScale() ) {
+ GLCanvas.this.reshapeImpl(getWidth(), getHeight());
+ }
helper.invokeGL(drawable, context, displayAction, initAction);
}
} finally {
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/com/jogamp/opengl/awt/GLJPanel.java
index 8d23d79ff..91b2f5e0c 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/jogl/classes/com/jogamp/opengl/awt/GLJPanel.java
@@ -38,7 +38,7 @@
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
-package javax.media.opengl.awt;
+package com.jogamp.opengl.awt;
import java.awt.Color;
import java.awt.EventQueue;
@@ -58,31 +58,32 @@ import java.beans.Beans;
import java.nio.IntBuffer;
import java.util.List;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.ScalableSurface;
-import javax.media.nativewindow.SurfaceUpdatedListener;
-import javax.media.nativewindow.WindowClosingProtocol;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2;
-import javax.media.opengl.GL2ES3;
-import javax.media.opengl.GL2GL3;
-import javax.media.opengl.GLAnimatorControl;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesChooser;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLFBODrawable;
-import javax.media.opengl.GLOffscreenAutoDrawable;
-import javax.media.opengl.GLProfile;
-import javax.media.opengl.GLRunnable;
-import javax.media.opengl.GLSharedContextSetter;
-import javax.media.opengl.Threading;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.ScalableSurface;
+import com.jogamp.nativewindow.SurfaceUpdatedListener;
+import com.jogamp.nativewindow.WindowClosingProtocol;
+import com.jogamp.nativewindow.util.PixelFormat;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2;
+import com.jogamp.opengl.GL2ES3;
+import com.jogamp.opengl.GL2GL3;
+import com.jogamp.opengl.GLAnimatorControl;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesChooser;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLFBODrawable;
+import com.jogamp.opengl.GLOffscreenAutoDrawable;
+import com.jogamp.opengl.GLProfile;
+import com.jogamp.opengl.GLRunnable;
+import com.jogamp.opengl.GLSharedContextSetter;
+import com.jogamp.opengl.Threading;
import javax.swing.JPanel;
import jogamp.nativewindow.SurfaceScaleUtils;
@@ -261,16 +262,19 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
private boolean handleReshape = false;
private boolean sendReshape = true;
- private final int[] nativePixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE };
- private final int[] hasPixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE };
- private final int[] reqPixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE };
+ private final float[] minPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE };
+ private final float[] maxPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE };
+ private final float[] hasPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE };
+ private final float[] reqPixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE };
- // For handling reshape events lazily: reshapeWidth -> panelWidth -> backend.width
+ /** For handling reshape events lazily: reshapeWidth -> panelWidth -> backend.width in pixel units (scaled) */
private int reshapeWidth;
+ /** For handling reshape events lazily: reshapeHeight -> panelHeight -> backend.height in pixel units (scaled) */
private int reshapeHeight;
- // Width of the actual GLJPanel: reshapeWidth -> panelWidth -> backend.width
+ /** Scaled pixel width of the actual GLJPanel: reshapeWidth -> panelWidth -> backend.width */
private int panelWidth = 0;
+ /** Scaled pixel height of the actual GLJPanel: reshapeHeight -> panelHeight -> backend.height */
private int panelHeight = 0;
// These are always set to (0, 0) except when the Java2D / OpenGL
@@ -447,20 +451,20 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
@Override
public void display() {
- if( isShowing || ( printActive && isVisible() ) ) {
- if (EventQueue.isDispatchThread()) {
- // Want display() to be synchronous, so call paintImmediately()
- paintImmediately(0, 0, getWidth(), getHeight());
- } else {
- // Multithreaded redrawing of Swing components is not allowed,
- // so do everything on the event dispatch thread
- try {
- EventQueue.invokeAndWait(paintImmediatelyAction);
- } catch (final Exception e) {
- throw new GLException(e);
+ if( isShowing || ( printActive && isVisible() ) ) {
+ if (EventQueue.isDispatchThread()) {
+ // Want display() to be synchronous, so call paintImmediately()
+ paintImmediatelyAction.run();
+ } else {
+ // Multithreaded redrawing of Swing components is not allowed,
+ // so do everything on the event dispatch thread
+ try {
+ EventQueue.invokeAndWait(paintImmediatelyAction);
+ } catch (final Exception e) {
+ throw new GLException(e);
+ }
}
- }
- }
+ }
}
protected void dispose(final Runnable post) {
@@ -553,6 +557,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
// re-creating it -- tricky to do properly while the context is
// current
if( !printActive ) {
+ updatePixelScale(backend);
if ( handleReshape ) {
handleReshape = false;
sendReshape = handleReshape();
@@ -576,36 +581,76 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
@Override
- public final void setSurfaceScale(final int[] pixelScale) { // HiDPI support
- SurfaceScaleUtils.validateReqPixelScale(reqPixelScale, pixelScale, DEBUG ? getClass().getSimpleName() : null);
+ public final boolean setSurfaceScale(final float[] pixelScale) { // HiDPI support
+ System.arraycopy(pixelScale, 0, reqPixelScale, 0, 2);
final Backend b = backend;
- if ( isInitialized && null != b ) {
- final int hadPixelScaleX = hasPixelScale[0];
- final int hadPixelScaleY = hasPixelScale[1];
- SurfaceScaleUtils.computePixelScale(hasPixelScale, hasPixelScale, reqPixelScale, nativePixelScale, DEBUG ? getClass().getSimpleName() : null);
- if( hadPixelScaleX != hasPixelScale[0] || hadPixelScaleY != hasPixelScale[1] ) {
- updateWrappedSurfaceScale(b.getDrawable());
- reshapeImpl(getWidth(), getHeight());
- display();
+ if ( isInitialized && null != b && isShowing ) {
+ if( isShowing || ( printActive && isVisible() ) ) {
+ if (EventQueue.isDispatchThread()) {
+ setSurfaceScaleAction.run();
+ } else {
+ try {
+ EventQueue.invokeAndWait(setSurfaceScaleAction);
+ } catch (final Exception e) {
+ throw new GLException(e);
+ }
+ }
}
+ return true;
+ } else {
+ return false;
+ }
+ }
+ private final Runnable setSurfaceScaleAction = new Runnable() {
+ @Override
+ public void run() {
+ final Backend b = backend;
+ if( null != b && setSurfaceScaleImpl(b) ) {
+ if( !helper.isAnimatorAnimatingOnOtherThread() ) {
+ paintImmediatelyAction.run(); // display
+ }
+ }
+ }
+ };
+
+ private final boolean setSurfaceScaleImpl(final Backend b) {
+ if( SurfaceScaleUtils.setNewPixelScale(hasPixelScale, hasPixelScale, reqPixelScale, minPixelScale, maxPixelScale, DEBUG ? getClass().getSimpleName() : null) ) {
+ reshapeImpl(getWidth(), getHeight());
+ updateWrappedSurfaceScale(b.getDrawable());
+ return true;
+ }
+ return false;
+ }
+
+ private final boolean updatePixelScale(final Backend b) {
+ if( JAWTUtil.getPixelScale(getGraphicsConfiguration(), minPixelScale, maxPixelScale) ) {
+ return setSurfaceScaleImpl(b);
+ } else {
+ return false;
}
}
@Override
- public final int[] getRequestedSurfaceScale(final int[] result) {
+ public final float[] getRequestedSurfaceScale(final float[] result) {
System.arraycopy(reqPixelScale, 0, result, 0, 2);
return result;
}
@Override
- public final int[] getCurrentSurfaceScale(final int[] result) {
+ public final float[] getCurrentSurfaceScale(final float[] result) {
System.arraycopy(hasPixelScale, 0, result, 0, 2);
return result;
}
@Override
- public int[] getNativeSurfaceScale(final int[] result) {
- System.arraycopy(nativePixelScale, 0, result, 0, 2);
+ public float[] getMinimumSurfaceScale(final float[] result) {
+ System.arraycopy(minPixelScale, 0, result, 0, 2);
+ return result;
+ }
+
+ @Override
+ public float[] getMaximumSurfaceScale(final float[] result) {
+ System.arraycopy(maxPixelScale, 0, result, 0, 2);
return result;
}
@@ -621,12 +666,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
awtWindowClosingProtocol.addClosingListener();
// HiDPI support
- {
- final int ps = JAWTUtil.getPixelScale(getGraphicsConfiguration());
- nativePixelScale[0] = ps;
- nativePixelScale[1] = ps;
- }
- SurfaceScaleUtils.computePixelScale(hasPixelScale, hasPixelScale, reqPixelScale, nativePixelScale, DEBUG ? getClass().getSimpleName() : null);
+ JAWTUtil.getPixelScale(getGraphicsConfiguration(), minPixelScale, maxPixelScale);
+ SurfaceScaleUtils.setNewPixelScale(hasPixelScale, hasPixelScale, reqPixelScale, minPixelScale, maxPixelScale, DEBUG ? getClass().getSimpleName() : null);
if (DEBUG) {
System.err.println(getThreadName()+": GLJPanel.addNotify()");
@@ -646,8 +687,10 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
dispose(null);
hasPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE;
hasPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE;
- nativePixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE;
- nativePixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE;
+ minPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE;
+ minPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE;
+ maxPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE;
+ maxPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE;
super.removeNotify();
}
@@ -667,8 +710,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
private void reshapeImpl(final int width, final int height) {
- final int scaledWidth = width * hasPixelScale[0];
- final int scaledHeight = height * hasPixelScale[1];
+ final int scaledWidth = SurfaceScaleUtils.scale(width, hasPixelScale[0]);
+ final int scaledHeight = SurfaceScaleUtils.scale(height, hasPixelScale[1]);
if( !printActive && ( handleReshape || scaledWidth != panelWidth || scaledHeight != panelHeight ) ) {
reshapeWidth = scaledWidth;
reshapeHeight = scaledHeight;
@@ -823,8 +866,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
// trigger reshape, i.e. gl-viewport and -listener - this component might got resized!
final int awtWidth = GLJPanel.this.getWidth();
final int awtHeight= GLJPanel.this.getHeight();
- final int scaledAWTWidth = awtWidth * hasPixelScale[0];
- final int scaledAWTHeight= awtHeight * hasPixelScale[1];
+ final int scaledAWTWidth = SurfaceScaleUtils.scale(awtWidth, hasPixelScale[0]);
+ final int scaledAWTHeight= SurfaceScaleUtils.scale(awtHeight, hasPixelScale[1]);
final GLDrawable drawable = GLJPanel.this.getDelegatedDrawable();
if( scaledAWTWidth != panelWidth || scaledAWTHeight != panelHeight ||
drawable.getSurfaceWidth() != panelWidth || drawable.getSurfaceHeight() != panelHeight ) {
@@ -1339,7 +1382,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
}
}
- private final String getPixelScaleStr() { return hasPixelScale[0]+"x"+hasPixelScale[1]; }
+ private final String getPixelScaleStr() { return "["+hasPixelScale[0]+", "+hasPixelScale[1]+"]"; }
@Override
public WindowClosingMode getDefaultCloseOperation() {
@@ -1882,27 +1925,36 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
alignment = 4;
}
- final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, componentCount);
+ final PixelFormat awtPixelFormat = pixelBufferProvider.getAWTPixelFormat(gl.getGLProfile(), componentCount);
+ final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, componentCount, true);
if( useSingletonBuffer ) { // attempt to fetch the latest AWTGLPixelBuffer
- pixelBuffer = (AWTGLPixelBuffer) ((SingletonGLPixelBufferProvider)pixelBufferProvider).getSingleBuffer(pixelAttribs);
+ pixelBuffer = (AWTGLPixelBuffer) ((SingletonGLPixelBufferProvider)pixelBufferProvider).getSingleBuffer(awtPixelFormat.comp, pixelAttribs, true);
}
if( null != pixelBuffer && pixelBuffer.requiresNewBuffer(gl, panelWidth, panelHeight, 0) ) {
pixelBuffer.dispose();
pixelBuffer = null;
alignedImage = null;
}
+ final boolean DEBUG_INIT;
if ( null == pixelBuffer ) {
if (0 >= panelWidth || 0 >= panelHeight ) {
return;
}
- pixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, panelWidth, panelHeight, 1, true, 0);
+ pixelBuffer = pixelBufferProvider.allocate(gl, awtPixelFormat.comp, pixelAttribs, true, panelWidth, panelHeight, 1, 0);
if(DEBUG) {
System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" pixelBufferProvider isSingletonBufferProvider "+useSingletonBuffer+", 0x"+Integer.toHexString(pixelBufferProvider.hashCode())+", "+pixelBufferProvider.getClass().getSimpleName());
System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" pixelBuffer 0x"+Integer.toHexString(pixelBuffer.hashCode())+", "+pixelBuffer+", alignment "+alignment);
- System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" flippedVertical "+flipVertical+", glslTextureRaster "+(null!=glslTextureRaster));
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" flippedVertical "+flipVertical+", glslTextureRaster "+(null!=glslTextureRaster)+", isGL2ES3 "+gl.isGL2ES3());
System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" panelSize "+panelWidth+"x"+panelHeight+" @ scale "+getPixelScaleStr());
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" pixelAttribs "+pixelAttribs);
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" awtPixelFormat "+awtPixelFormat);
+ DEBUG_INIT = true;
+ } else {
+ DEBUG_INIT = false;
}
+ } else {
+ DEBUG_INIT = false;
}
if( offscreenDrawable.getSurfaceWidth() != panelWidth || offscreenDrawable.getSurfaceHeight() != panelHeight ) {
throw new InternalError("OffscreenDrawable panelSize mismatch (reshape missed): panelSize "+panelWidth+"x"+panelHeight+" != drawable "+offscreenDrawable.getSurfaceWidth()+"x"+offscreenDrawable.getSurfaceHeight()+", on thread "+getThreadName());
@@ -1937,6 +1989,13 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
final GL2ES3 gl2es3 = gl.getGL2ES3();
psm.setPackRowLength(gl2es3, panelWidth);
gl2es3.glReadBuffer(gl2es3.getDefaultReadBuffer());
+ if( DEBUG_INIT ) {
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.0: fboDrawable "+offscreenDrawable);
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.0: isGL2ES3, readBuffer 0x"+Integer.toHexString(gl2es3.getDefaultReadBuffer()));
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.0: def-readBuffer 0x"+Integer.toHexString(gl2es3.getDefaultReadBuffer()));
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.0: def-readFBO 0x"+Integer.toHexString(gl2es3.getDefaultReadFramebuffer()));
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.0: bound-readFBO 0x"+Integer.toHexString(gl2es3.getBoundFramebuffer(GL2ES3.GL_READ_FRAMEBUFFER)));
+ }
}
if(null != glslTextureRaster) { // implies flippedVertical
@@ -1965,9 +2024,26 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
// gl.glClear(GL.GL_DEPTH_BUFFER_BIT); // fboFlipped runs w/o DEPTH!
glslTextureRaster.display(gl.getGL2ES2());
+ if( DEBUG_INIT ) {
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.1: fboDrawable "+fboDrawable);
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.1: read from fbo-rb "+fboFlipped.getReadFramebuffer()+", fbo "+fboFlipped);
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.1: isGL2ES3, readBuffer 0x"+Integer.toHexString(gl.getDefaultReadBuffer()));
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.1: def-readBuffer 0x"+Integer.toHexString(gl.getDefaultReadBuffer()));
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.1: def-readFBO 0x"+Integer.toHexString(gl.getDefaultReadFramebuffer()));
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.1: bound-readFBO 0x"+Integer.toHexString(gl.getBoundFramebuffer(GL2ES3.GL_READ_FRAMEBUFFER)));
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.1: "+GLJPanel.this.getName()+" pixelAttribs "+pixelAttribs);
+ }
gl.glReadPixels(0, 0, panelWidth, panelHeight, pixelAttribs.format, pixelAttribs.type, readBackInts);
fboFlipped.unbind(gl);
+ if( DEBUG_INIT ) {
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.2: fboDrawable "+fboDrawable);
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.2: read from fbo-rb "+fboFlipped.getReadFramebuffer()+", fbo "+fboFlipped);
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.2: isGL2ES3, readBuffer 0x"+Integer.toHexString(gl.getDefaultReadBuffer()));
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.2: def-readBuffer 0x"+Integer.toHexString(gl.getDefaultReadBuffer()));
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.2: def-readFBO 0x"+Integer.toHexString(gl.getDefaultReadFramebuffer()));
+ System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0.2: bound-readFBO 0x"+Integer.toHexString(gl.getBoundFramebuffer(GL2ES3.GL_READ_FRAMEBUFFER)));
+ }
if( viewportChange ) {
gl.glViewport(usrViewport[0], usrViewport[1], usrViewport[2], usrViewport[3]);
}
@@ -2022,7 +2098,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing
System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.doPaintComponent.drawImage: - frameCount "+frameCount);
}
// Draw resulting image in one shot
- g.drawImage(alignedImage, 0, 0, alignedImage.getWidth()/hasPixelScale[0], alignedImage.getHeight()/hasPixelScale[1], null); // Null ImageObserver since image data is ready.
+ g.drawImage(alignedImage, 0, 0,
+ SurfaceScaleUtils.scaleInv(alignedImage.getWidth(), hasPixelScale[0]),
+ SurfaceScaleUtils.scaleInv(alignedImage.getHeight(), hasPixelScale[1]), null); // Null ImageObserver since image data is ready.
}
frameCount++;
}
diff --git a/src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java b/src/jogl/classes/com/jogamp/opengl/fixedfunc/GLLightingFunc.java
index 001f4f05b..cf7b9da46 100644
--- a/src/jogl/classes/javax/media/opengl/fixedfunc/GLLightingFunc.java
+++ b/src/jogl/classes/com/jogamp/opengl/fixedfunc/GLLightingFunc.java
@@ -27,7 +27,7 @@
* or implied, of JogAmp Community.
*/
-package javax.media.opengl.fixedfunc;
+package com.jogamp.opengl.fixedfunc;
public interface GLLightingFunc {
public static final int GL_LIGHT0 = 0x4000;
diff --git a/src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java b/src/jogl/classes/com/jogamp/opengl/fixedfunc/GLMatrixFunc.java
index 87a23d12a..90f13faf1 100644
--- a/src/jogl/classes/javax/media/opengl/fixedfunc/GLMatrixFunc.java
+++ b/src/jogl/classes/com/jogamp/opengl/fixedfunc/GLMatrixFunc.java
@@ -27,11 +27,11 @@
* or implied, of JogAmp Community.
*/
-package javax.media.opengl.fixedfunc;
+package com.jogamp.opengl.fixedfunc;
import java.nio.*;
-import javax.media.opengl.GL;
+import com.jogamp.opengl.GL;
/**
* Subset of OpenGL fixed function pipeline's matrix operations.
diff --git a/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java b/src/jogl/classes/com/jogamp/opengl/fixedfunc/GLPointerFunc.java
index 4aff24b36..852d4ebba 100644
--- a/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFunc.java
+++ b/src/jogl/classes/com/jogamp/opengl/fixedfunc/GLPointerFunc.java
@@ -27,9 +27,9 @@
* or implied, of JogAmp Community.
*/
-package javax.media.opengl.fixedfunc;
+package com.jogamp.opengl.fixedfunc;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
public interface GLPointerFunc {
public static final int GL_VERTEX_ARRAY = 0x8074;
diff --git a/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java b/src/jogl/classes/com/jogamp/opengl/fixedfunc/GLPointerFuncUtil.java
index 3264062e8..cb1ff3827 100644
--- a/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/fixedfunc/GLPointerFuncUtil.java
@@ -26,7 +26,7 @@
* or implied, of JogAmp Community.
*/
-package javax.media.opengl.fixedfunc;
+package com.jogamp.opengl.fixedfunc;
public class GLPointerFuncUtil {
public static final String mgl_Vertex = "mgl_Vertex";
diff --git a/src/jogl/classes/javax/media/opengl/glu/GLUnurbs.java b/src/jogl/classes/com/jogamp/opengl/glu/GLUnurbs.java
index 2641115d0..0dbd54674 100644
--- a/src/jogl/classes/javax/media/opengl/glu/GLUnurbs.java
+++ b/src/jogl/classes/com/jogamp/opengl/glu/GLUnurbs.java
@@ -1,4 +1,4 @@
-package javax.media.opengl.glu;
+package com.jogamp.opengl.glu;
/**
* Wrapper for a GLU NURBS object.
diff --git a/src/jogl/classes/javax/media/opengl/glu/GLUquadric.java b/src/jogl/classes/com/jogamp/opengl/glu/GLUquadric.java
index 49451a34b..45b2d054d 100644
--- a/src/jogl/classes/javax/media/opengl/glu/GLUquadric.java
+++ b/src/jogl/classes/com/jogamp/opengl/glu/GLUquadric.java
@@ -1,6 +1,6 @@
-package javax.media.opengl.glu;
+package com.jogamp.opengl.glu;
-import javax.media.opengl.GL;
+import com.jogamp.opengl.GL;
import com.jogamp.opengl.util.ImmModeSink;
/**
diff --git a/src/jogl/classes/javax/media/opengl/glu/GLUtessellator.java b/src/jogl/classes/com/jogamp/opengl/glu/GLUtessellator.java
index f98bbe158..ce9fda8e7 100644
--- a/src/jogl/classes/javax/media/opengl/glu/GLUtessellator.java
+++ b/src/jogl/classes/com/jogamp/opengl/glu/GLUtessellator.java
@@ -50,7 +50,7 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package javax.media.opengl.glu;
+package com.jogamp.opengl.glu;
/**
* The <b>GLUtessellator</b> object is used to hold the data, such as the
diff --git a/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallback.java b/src/jogl/classes/com/jogamp/opengl/glu/GLUtessellatorCallback.java
index 0f05619a4..c616bca38 100644
--- a/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallback.java
+++ b/src/jogl/classes/com/jogamp/opengl/glu/GLUtessellatorCallback.java
@@ -50,7 +50,7 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package javax.media.opengl.glu;
+package com.jogamp.opengl.glu;
/**
* <b>GLUtessellatorCallback</b> interface provides methods that the user will
@@ -63,7 +63,7 @@ package javax.media.opengl.glu;
public interface GLUtessellatorCallback {
/**
* The <b>begin</b> callback method is invoked like
- * {@link javax.media.opengl.GL#glBegin glBegin} to indicate the start of a
+ * {@link com.jogamp.opengl.GL#glBegin glBegin} to indicate the start of a
* (triangle) primitive. The method takes a single argument of type int. If
* the <b>GLU_TESS_BOUNDARY_ONLY</b> property is set to <b>GL_FALSE</b>, then
* the argument is set to either <b>GL_TRIANGLE_FAN</b>,
@@ -104,7 +104,7 @@ public interface GLUtessellatorCallback {
/**
* The <b>edgeFlag</b> callback method is similar to
- * {@link javax.media.opengl.GL#glEdgeFlag glEdgeFlag}. The method takes
+ * {@link com.jogamp.opengl.GL#glEdgeFlag glEdgeFlag}. The method takes
* a single boolean boundaryEdge that indicates which edges lie on the
* polygon boundary. If the boundaryEdge is <b>GL_TRUE</b>, then each vertex
* that follows begins an edge that lies on the polygon boundary, that is,
@@ -149,7 +149,7 @@ public interface GLUtessellatorCallback {
/**
* The <b>vertex</b> callback method is invoked between the {@link
* #begin begin} and {@link #end end} callback methods. It is
- * similar to {@link javax.media.opengl.GL#glVertex3f glVertex3f},
+ * similar to {@link com.jogamp.opengl.GL#glVertex3f glVertex3f},
* and it defines the vertices of the triangles created by the
* tessellation process. The method takes a reference as its only
* argument. This reference is identical to the opaque reference
@@ -186,7 +186,7 @@ public interface GLUtessellatorCallback {
/**
* The end callback serves the same purpose as
- * {@link javax.media.opengl.GL#glEnd glEnd}. It indicates the end of a
+ * {@link com.jogamp.opengl.GL#glEnd glEnd}. It indicates the end of a
* primitive and it takes no arguments.
*
* @see GLU#gluTessCallback gluTessCallback
diff --git a/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java b/src/jogl/classes/com/jogamp/opengl/glu/GLUtessellatorCallbackAdapter.java
index c293fbe18..b9503f12e 100644
--- a/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java
+++ b/src/jogl/classes/com/jogamp/opengl/glu/GLUtessellatorCallbackAdapter.java
@@ -50,7 +50,7 @@
** Java Port: Pepijn Van Eeckhoudt, July 2003
** Java Port: Nathan Parker Burg, August 2003
*/
-package javax.media.opengl.glu;
+package com.jogamp.opengl.glu;
/**
* The <b>GLUtessellatorCallbackAdapter</b> provides a default implementation of
diff --git a/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java b/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java
index 1a8924c8f..a04055430 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/FloatUtil.java
@@ -29,7 +29,7 @@ package com.jogamp.opengl.math;
import java.nio.FloatBuffer;
-import javax.media.opengl.GLException;
+import com.jogamp.opengl.GLException;
import jogamp.opengl.Debug;
@@ -491,16 +491,18 @@ public final class FloatUtil {
* @param zNear
* @param zFar
* @return given matrix for chaining
+ * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0,
+ * or if left == right, or bottom == top, or zNear == zFar.
*/
public static float[] makeFrustum(final float[] m, final int m_offset, final boolean initM,
final float left, final float right,
final float bottom, final float top,
- final float zNear, final float zFar) {
- if(zNear<=0.0f||zFar<0.0f) {
+ final float zNear, final float zFar) throws GLException {
+ if( zNear <= 0.0f || zFar < 0.0f ) {
throw new GLException("GL_INVALID_VALUE: zNear and zFar must be positive, and zNear>0");
}
- if(left==right || top==bottom) {
- throw new GLException("GL_INVALID_VALUE: top,bottom and left,right must not be equal");
+ if( left == right || top == bottom || zNear == zFar ) {
+ throw new GLException("GL_INVALID_VALUE: top,bottom and left,right and zNear,zFar must not be equal");
}
if( initM ) {
// m[m_offset+0+4*0] = 1f;
@@ -563,9 +565,10 @@ public final class FloatUtil {
* @param zNear
* @param zFar
* @return given matrix for chaining
+ * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0, or if zNear == zFar.
*/
public static float[] makePerspective(final float[] m, final int m_off, final boolean initM,
- final float fovy_rad, final float aspect, final float zNear, final float zFar) {
+ final float fovy_rad, final float aspect, final float zNear, final float zFar) throws GLException {
final float top = tan(fovy_rad/2f) * zNear; // use tangent of half-fov !
final float bottom = -1.0f * top;
final float left = aspect * bottom;
@@ -588,9 +591,10 @@ public final class FloatUtil {
* @param zNear
* @param zFar
* @return given matrix for chaining
+ * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0, or if zNear == zFar.
*/
public static float[] makePerspective(final float[] m, final int m_offset, final boolean initM,
- final FovHVHalves fovhv, final float zNear, final float zFar) {
+ final FovHVHalves fovhv, final float zNear, final float zFar) throws GLException {
final FovHVHalves fovhvTan = fovhv.toTangents(); // use tangent of half-fov !
final float top = fovhvTan.top * zNear;
final float bottom = -1.0f * fovhvTan.bottom * zNear;
diff --git a/src/jogl/classes/com/jogamp/opengl/math/Matrix4.java b/src/jogl/classes/com/jogamp/opengl/math/Matrix4.java
index 830f1a882..421bb909f 100644
--- a/src/jogl/classes/com/jogamp/opengl/math/Matrix4.java
+++ b/src/jogl/classes/com/jogamp/opengl/math/Matrix4.java
@@ -28,7 +28,8 @@
package com.jogamp.opengl.math;
-import javax.media.opengl.fixedfunc.GLMatrixFunc;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
import com.jogamp.opengl.util.PMVMatrix;
@@ -139,11 +140,28 @@ public class Matrix4 {
multMatrix( FloatUtil.makeOrtho(mat4Tmp1, 0, true, left, right, bottom, top, zNear, zFar) );
}
- public final void makeFrustum(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) {
+ /**
+ * @param left
+ * @param right
+ * @param bottom
+ * @param top
+ * @param zNear
+ * @param zFar
+ * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0,
+ * or if left == right, or bottom == top, or zNear == zFar.
+ */
+ public final void makeFrustum(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) throws GLException {
multMatrix( FloatUtil.makeFrustum(mat4Tmp1, 0, true, left, right, bottom, top, zNear, zFar) );
}
- public final void makePerspective(final float fovy_rad, final float aspect, final float zNear, final float zFar) {
+ /**
+ * @param fovy_rad
+ * @param aspect
+ * @param zNear
+ * @param zFar
+ * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0, or if zNear == zFar.
+ */
+ public final void makePerspective(final float fovy_rad, final float aspect, final float zNear, final float zFar) throws GLException {
multMatrix( FloatUtil.makePerspective(mat4Tmp1, 0, true, fovy_rad, aspect, zNear, zFar) );
}
diff --git a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
index 28f572d7d..58b5bbcb9 100644
--- a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
+++ b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
@@ -29,31 +29,31 @@ package com.jogamp.opengl.swt;
import java.util.List;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.GraphicsConfigurationFactory;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.ProxySurface;
-import javax.media.nativewindow.UpstreamSurfaceHook;
-import javax.media.nativewindow.VisualIDHolder;
-import javax.media.nativewindow.VisualIDHolder.VIDType;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLAnimatorControl;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesChooser;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
-import javax.media.opengl.GLRunnable;
-import javax.media.opengl.GLSharedContextSetter;
-import javax.media.opengl.Threading;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.GraphicsConfigurationFactory;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.ProxySurface;
+import com.jogamp.nativewindow.UpstreamSurfaceHook;
+import com.jogamp.nativewindow.VisualIDHolder;
+import com.jogamp.nativewindow.VisualIDHolder.VIDType;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLAnimatorControl;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesChooser;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
+import com.jogamp.opengl.GLRunnable;
+import com.jogamp.opengl.GLSharedContextSetter;
+import com.jogamp.opengl.Threading;
import jogamp.nativewindow.x11.X11Util;
import jogamp.opengl.Debug;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java b/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java
index 62df3faca..76d64963f 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java
@@ -45,7 +45,7 @@ import java.util.Map;
import javax.swing.JComponent;
import javax.swing.RepaintManager;
import javax.swing.SwingUtilities;
-import javax.media.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.util.AnimatorBase.UncaughtAnimatorException;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
index b38a42ee3..066709316 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
@@ -40,8 +40,8 @@
package com.jogamp.opengl.util;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLException;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLException;
/** <P> An Animator can be attached to one or more {@link
GLAutoDrawable}s to drive their display() methods in a loop. </P>
diff --git a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
index 5f2db20bd..aafdf63f8 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java
@@ -34,10 +34,12 @@ import jogamp.opengl.FPSCounterImpl;
import java.io.PrintStream;
import java.util.ArrayList;
-import javax.media.opengl.GLAnimatorControl;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.opengl.GLAnimatorControl;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
+
+import com.jogamp.common.ExceptionUtils;
/**
* Base implementation of GLAnimatorControl<br>
@@ -625,7 +627,7 @@ public abstract class AnimatorBase implements GLAnimatorControl {
" - " + getThreadName());
System.err.println(" - "+toString());
if(nok) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
return res;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/CustomGLEventListener.java b/src/jogl/classes/com/jogamp/opengl/util/CustomGLEventListener.java
index 86443087e..222833c7d 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/CustomGLEventListener.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/CustomGLEventListener.java
@@ -27,8 +27,8 @@
*/
package com.jogamp.opengl.util;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLEventListener;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLEventListener;
/**
* Extended {@link GLEventListener} interface
diff --git a/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java b/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java
index 6b1485a6a..6cded29d9 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java
@@ -35,7 +35,7 @@ package com.jogamp.opengl.util;
import java.util.ArrayList;
-import javax.media.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.util.AnimatorBase.UncaughtAnimatorException;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
index 54d40f285..320873ede 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/FPSAnimator.java
@@ -42,8 +42,10 @@ package com.jogamp.opengl.util;
import java.util.Timer;
import java.util.TimerTask;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLException;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLException;
+
+import com.jogamp.common.ExceptionUtils;
/**
* An Animator subclass which attempts to achieve a target
@@ -392,7 +394,7 @@ public class FPSAnimator extends AnimatorBase {
if( null != task ) {
if( DEBUG ) {
System.err.println("FPSAnimator.resume() Ops: !pauseIssued, but task != null: "+toString());
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
task.cancel();
task = null;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
index 1a9ec2782..542da4bf1 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java
@@ -35,9 +35,9 @@ import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLException;
-import javax.media.opengl.fixedfunc.GLPointerFuncUtil;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.fixedfunc.GLPointerFuncUtil;
import jogamp.opengl.util.GLArrayHandler;
import jogamp.opengl.util.GLFixedArrayHandler;
@@ -67,7 +67,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
* @param normalized Whether the data shall be normalized
* @param initialElementCount
*
- * @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int)
+ * @see com.jogamp.opengl.GLContext#getPredefinedArrayIndexName(int)
*/
public static GLArrayDataClient createFixed(final int index, final int comps, final int dataType, final boolean normalized, final int initialElementCount)
throws GLException
@@ -97,7 +97,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData
* @param stride
* @param buffer the user define data
*
- * @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int)
+ * @see com.jogamp.opengl.GLContext#getPredefinedArrayIndexName(int)
*/
public static GLArrayDataClient createFixed(final int index, final int comps, final int dataType, final boolean normalized, final int stride,
final Buffer buffer)
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java
index 9a0f1cb37..7524fe1d1 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataEditable.java
@@ -1,7 +1,7 @@
package com.jogamp.opengl.util;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
import java.nio.*;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java
index 51c55e326..6b7c31d13 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java
@@ -34,12 +34,12 @@ import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLArrayData;
-import javax.media.opengl.GLBufferStorage;
-import javax.media.opengl.GLException;
-import javax.media.opengl.fixedfunc.GLPointerFuncUtil;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLArrayData;
+import com.jogamp.opengl.GLBufferStorage;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.fixedfunc.GLPointerFuncUtil;
import com.jogamp.common.nio.Buffers;
@@ -79,7 +79,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
* @param buffer the user define data
* @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW}
*
- * @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int)
+ * @see com.jogamp.opengl.GLContext#getPredefinedArrayIndexName(int)
*/
public static GLArrayDataServer createFixed(final int index, final int compsPerElement, final int dataType, final boolean normalized, final int stride,
final Buffer buffer, final int vboUsage)
@@ -111,7 +111,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE
* @param initialElementCount
* @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW}
*
- * @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int)
+ * @see com.jogamp.opengl.GLContext#getPredefinedArrayIndexName(int)
*/
public static GLArrayDataServer createFixed(final int index, final int compsPerElement, final int dataType, final boolean normalized, final int initialElementCount,
final int vboUsage)
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java
index 867bc00ac..3f759c6d8 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java
@@ -34,13 +34,13 @@ import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES1;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLArrayData;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
-import javax.media.opengl.fixedfunc.GLPointerFuncUtil;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES1;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLArrayData;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
+import com.jogamp.opengl.fixedfunc.GLPointerFuncUtil;
import com.jogamp.common.nio.Buffers;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java
index d4ab4e4f4..6a2a02387 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java
@@ -41,14 +41,14 @@ package com.jogamp.opengl.util;
import java.nio.Buffer;
import java.nio.ByteBuffer;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GL2ES3;
-import javax.media.opengl.GL2GL3;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLES2;
-import javax.media.opengl.GLException;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GL2ES3;
+import com.jogamp.opengl.GL2GL3;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLES2;
+import com.jogamp.opengl.GLException;
import com.jogamp.common.nio.Buffers;
@@ -372,29 +372,29 @@ public class GLBuffers extends Buffers {
int skipImages = 0;
if (pack) {
- alignment = glGetInteger(gl, GL.GL_PACK_ALIGNMENT, tmp);
+ alignment = glGetInteger(gl, GL.GL_PACK_ALIGNMENT, tmp); // es2, es3, gl3
if( gl.isGL2ES3() ) {
- rowLength = glGetInteger(gl, GL2ES3.GL_PACK_ROW_LENGTH, tmp);
- skipRows = glGetInteger(gl, GL2ES3.GL_PACK_SKIP_ROWS, tmp);
- skipPixels = glGetInteger(gl, GL2ES3.GL_PACK_SKIP_PIXELS, tmp);
- if (depth > 1 && gl.isGL2GL3() && gl.getContext().getGLVersionNumber().compareTo(GLContext.Version120) >= 0 ) {
- imageHeight = glGetInteger(gl, GL2GL3.GL_PACK_IMAGE_HEIGHT, tmp);
- skipImages = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_IMAGES, tmp);
+ rowLength = glGetInteger(gl, GL2ES3.GL_PACK_ROW_LENGTH, tmp); // es3, gl3
+ skipRows = glGetInteger(gl, GL2ES3.GL_PACK_SKIP_ROWS, tmp); // es3, gl3
+ skipPixels = glGetInteger(gl, GL2ES3.GL_PACK_SKIP_PIXELS, tmp); // es3, gl3
+ if (depth > 1 && gl.isGL2GL3() && gl.getContext().getGLVersionNumber().compareTo(GLContext.Version1_2) >= 0 ) {
+ imageHeight = glGetInteger(gl, GL2GL3.GL_PACK_IMAGE_HEIGHT, tmp); // gl3, GL_VERSION_1_2
+ skipImages = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_IMAGES, tmp); // gl3, GL_VERSION_1_2
}
}
} else {
- alignment = glGetInteger(gl, GL.GL_UNPACK_ALIGNMENT, tmp);
+ alignment = glGetInteger(gl, GL.GL_UNPACK_ALIGNMENT, tmp); // es2, es3, gl3
if( gl.isGL2ES3() ) {
- rowLength = glGetInteger(gl, GL2ES2.GL_UNPACK_ROW_LENGTH, tmp);
- skipRows = glGetInteger(gl, GL2ES2.GL_UNPACK_SKIP_ROWS, tmp);
- skipPixels = glGetInteger(gl, GL2ES2.GL_UNPACK_SKIP_PIXELS, tmp);
+ rowLength = glGetInteger(gl, GL2ES2.GL_UNPACK_ROW_LENGTH, tmp); // es3, gl3
+ skipRows = glGetInteger(gl, GL2ES2.GL_UNPACK_SKIP_ROWS, tmp); // es3, gl3
+ skipPixels = glGetInteger(gl, GL2ES2.GL_UNPACK_SKIP_PIXELS, tmp); // es3, gl3
if( depth > 1 &&
( gl.isGL3ES3() ||
- ( gl.isGL2GL3() && gl.getContext().getGLVersionNumber().compareTo(GLContext.Version120) >= 0 )
+ ( gl.isGL2GL3() && gl.getContext().getGLVersionNumber().compareTo(GLContext.Version1_2) >= 0 )
)
) {
- imageHeight = glGetInteger(gl, GL2ES3.GL_UNPACK_IMAGE_HEIGHT, tmp);
- skipImages = glGetInteger(gl, GL2ES3.GL_UNPACK_SKIP_IMAGES, tmp);
+ imageHeight = glGetInteger(gl, GL2ES3.GL_UNPACK_IMAGE_HEIGHT, tmp);// es3, gl3, GL_VERSION_1_2
+ skipImages = glGetInteger(gl, GL2ES3.GL_UNPACK_SKIP_IMAGES, tmp); // es3, gl3, GL_VERSION_1_2
}
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java
index 634cfeaed..4cf752b4c 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java
@@ -27,18 +27,18 @@
*/
package com.jogamp.opengl.util;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.opengl.GLAnimatorControl;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLBase;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLRunnable;
-import javax.media.opengl.Threading;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.opengl.GLAnimatorControl;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLBase;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLRunnable;
+import com.jogamp.opengl.Threading;
import com.jogamp.common.util.locks.RecursiveLock;
import com.jogamp.opengl.GLEventListenerState;
@@ -215,7 +215,7 @@ public class GLDrawableUtil {
* During operation, both {@link GLAutoDrawable auto-drawable's}
* {@link GLAutoDrawable#getUpstreamLock() upstream-locks} and {@link GLAutoDrawable#getNativeSurface() surfaces} are locked,
* hence atomicity of operation is guaranteed,
- * see <a href="../../../../javax/media/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.
+ * see <a href="../../../../com/jogamp/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.
* </p>
* <p>
* Because of above mentioned locking, if this method is not performed
@@ -256,7 +256,7 @@ public class GLDrawableUtil {
* During operation, both {@link GLAutoDrawable auto-drawable's}
* {@link GLAutoDrawable#getUpstreamLock() upstream-locks} and {@link GLAutoDrawable#getNativeSurface() surfaces} are locked,
* hence atomicity of operation is guaranteed,
- * see <a href="../../../../javax/media/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.
+ * see <a href="../../../../com/jogamp/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.
* </p>
* <p>
* Because of above mentioned locking, if this method is not performed
@@ -333,7 +333,7 @@ public class GLDrawableUtil {
* in which case {@link GLDrawable#swapBuffers() swap-buffers} shall happen <b>after</b> calling reading pixels, the default.
* </p>
* <p>
- * However, <i>multisampling</i> offscreen {@link javax.media.opengl.GLFBODrawable}s
+ * However, <i>multisampling</i> offscreen {@link com.jogamp.opengl.GLFBODrawable}s
* utilize {@link GLDrawable#swapBuffers() swap-buffers} to <i>downsample</i>
* the multisamples into the readable sampling sink.
* In this case, we require {@link GLDrawable#swapBuffers() swap-buffers} <b>before</b> reading pixels.
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java
index a09321d75..4575de959 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java
@@ -30,14 +30,14 @@ package com.jogamp.opengl.util;
import java.nio.Buffer;
import java.nio.ByteBuffer;
-import javax.media.nativewindow.util.PixelFormat;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GL2ES3;
-import javax.media.opengl.GL2GL3;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.util.PixelFormat;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GL2ES3;
+import com.jogamp.opengl.GL2GL3;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import com.jogamp.common.nio.Buffers;
import com.jogamp.opengl.util.texture.TextureData;
@@ -58,41 +58,100 @@ public class GLPixelBuffer {
/** Allow {@link GL2ES3#GL_PACK_ROW_LENGTH}, or {@link GL2ES2#GL_UNPACK_ROW_LENGTH}. */
boolean getAllowRowStride();
- /** Called first to determine {@link GLPixelAttributes}. */
- GLPixelAttributes getAttributes(GL gl, int componentCount);
+ /**
+ * Returns RGB[A] {@link GLPixelAttributes} matching {@link GL}, {@code componentCount} and {@code pack}.
+ *
+ * @param gl the corresponding current {@link GL} context object
+ * @param componentCount RGBA component count, i.e. 1 (luminance, alpha or red), 3 (RGB) or 4 (RGBA)
+ * @param pack {@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}.
+ * {@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}.
+ */
+ GLPixelAttributes getAttributes(GL gl, int componentCount, boolean pack);
+
+ /**
+ * Returns the host {@link PixelFormat.Composition} matching {@link GL} and {@code componentCount}
+ * if required by implementation, otherwise {@code null}.
+ *
+ * @param glp the corresponding current {@link GL} context object
+ * @param componentCount RGBA component count, i.e. 1 (luminance, alpha or red), 3 (RGB) or 4 (RGBA)
+ */
+ PixelFormat.Composition getHostPixelComp(final GLProfile glp, final int componentCount);
/**
* Allocates a new {@link GLPixelBuffer} object.
* <p>
- * Being called to gather the initial {@link GLPixelBuffer},
- * or a new replacement {@link GLPixelBuffer} if {@link GLPixelBuffer#requiresNewBuffer(GL, int, int, int)}.
- * </p>
- * <p>
* The minimum required {@link Buffer#remaining() remaining} byte size equals to <code>minByteSize</code>, if &gt; 0,
* otherwise utilize {@link GLBuffers#sizeof(GL, int[], int, int, int, int, int, boolean)}
* to calculate it.
* </p>
*
- * @param gl the corresponding current GL context object
- * @param pixelAttributes the desired {@link GLPixelAttributes}
+ * @param gl the corresponding current {@link GL} context object
+ * @param hostPixComp host {@link PixelFormat pixel format}, i.e. of the source or sink depending on {@code pack},
+ * e.g. fetched via {@link #getHostPixelComp(GLProfile, int)}.
+ * If {@code null}, {@code pixelAttributes} instance maybe used or an exception is thrown,
+ * depending on implementation semantics.
+ * @param pixelAttributes the desired {@link GLPixelAttributes}, e.g. fetched via {@link #getAttributes(GL, int, boolean)}
+ * @param pack {@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}.
+ * {@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}.
* @param width in pixels
* @param height in pixels
* @param depth in pixels
- * @param pack true for read mode GPU -> CPU, otherwise false for write mode CPU -> GPU
* @param minByteSize if &gt; 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore.
+ * @see #getHostPixelComp(GLProfile, int)
+ * @see #getAttributes(GL, int, boolean)
*/
- GLPixelBuffer allocate(GL gl, GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize);
+ GLPixelBuffer allocate(GL gl, PixelFormat.Composition hostPixComp, GLPixelAttributes pixelAttributes,
+ boolean pack, int width, int height, int depth, int minByteSize);
}
/** Single {@link GLPixelBuffer} provider. */
public static interface SingletonGLPixelBufferProvider extends GLPixelBufferProvider {
- /** Return the last {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated} {@link GLPixelBuffer} w/ {@link GLPixelAttributes#componentCount}. */
- GLPixelBuffer getSingleBuffer(GLPixelAttributes pixelAttributes);
/**
- * Initializes the single {@link GLPixelBuffer} w/ a given size, if not yet {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated}.
+ * {@inheritDoc}
+ * <p>
+ * Being called to gather the initial {@link GLPixelBuffer},
+ * or a new replacement {@link GLPixelBuffer} if {@link GLPixelBuffer#requiresNewBuffer(GL, int, int, int)}.
+ * </p>
+ */
+ @Override
+ GLPixelBuffer allocate(GL gl, PixelFormat.Composition hostPixComp, GLPixelAttributes pixelAttributes,
+ boolean pack, int width, int height, int depth, int minByteSize);
+
+ /**
+ * Return the last {@link #allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int) allocated} {@link GLPixelBuffer}
+ * matching the given parameter.
+ * <p>
+ * May return {@code null} if none has been allocated yet.
+ * </p>
+ * <p>
+ * Returned {@link GLPixelBuffer} may be {@link GLPixelBuffer#isValid() invalid}.
+ * </p>
+ * @param hostPixComp host {@link PixelFormat pixel format}, i.e. of the source or sink depending on {@code pack},
+ * e.g. fetched via {@link #getHostPixelComp(GLProfile, int)}.
+ * If {@code null}, {@code pixelAttributes} instance maybe used or an exception is thrown,
+ * depending on implementation semantics.
+ * @param pixelAttributes the desired {@link GLPixelAttributes}, e.g. fetched via {@link #getAttributes(GL, int, boolean)}
+ * @param pack {@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}.
+ * {@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}.
+ */
+ GLPixelBuffer getSingleBuffer(PixelFormat.Composition hostPixelComp, GLPixelAttributes pixelAttributes, boolean pack);
+ /**
+ * Initializes the single {@link GLPixelBuffer} w/ a given size,
+ * if not yet {@link #allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int) allocated}.
+ *
+ * @param glp
+ * @param componentCount RGBA component count, i.e. 1 (luminance, alpha or red), 3 (RGB) or 4 (RGBA)
+ * @param pack {@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}.
+ * {@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}.
+ * @param width
+ * @param height
+ * @param depth
* @return the newly initialized single {@link GLPixelBuffer}, or null if already allocated.
*/
- GLPixelBuffer initSingleton(int componentCount, int width, int height, int depth, boolean pack);
+ GLPixelBuffer initSingleton(GLProfile glp, int componentCount, boolean pack, int width, int height, int depth);
+
+ /** Dispose all resources.*/
+ void dispose();
}
public static class DefaultGLPixelBufferProvider implements GLPixelBufferProvider {
@@ -110,36 +169,24 @@ public class GLPixelBuffer {
public boolean getAllowRowStride() { return allowRowStride; }
@Override
- public GLPixelAttributes getAttributes(final GL gl, final int componentCount) {
- final GLContext ctx = gl.getContext();
- final int dFormat, dType;
-
- if( 1 == componentCount ) {
- if( gl.isGL3ES3() ) {
- // RED is supported on ES3 and >= GL3 [core]; ALPHA is deprecated on core
- dFormat = GL2ES2.GL_RED;
- } else {
- // ALPHA is supported on ES2 and GL2, i.e. <= GL3 [core] or compatibility
- dFormat = GL.GL_ALPHA;
- }
- dType = GL.GL_UNSIGNED_BYTE;
- } else if( 3 == componentCount ) {
- dFormat = GL.GL_RGB;
- dType = GL.GL_UNSIGNED_BYTE;
- } else if( 4 == componentCount ) {
- final int _dFormat = ctx.getDefaultPixelDataFormat();
- final int dComps = GLBuffers.componentCount(_dFormat);
- if( dComps == componentCount ) {
- dFormat = _dFormat;
- dType = ctx.getDefaultPixelDataType();
- } else {
- dFormat = GL.GL_RGBA;
- dType = GL.GL_UNSIGNED_BYTE;
- }
- } else {
+ public GLPixelAttributes getAttributes(final GL gl, final int componentCount, final boolean pack) {
+ final GLPixelAttributes res = GLPixelAttributes.convert(gl, componentCount, pack);
+ if( null == res ) {
throw new GLException("Unsupported componentCount "+componentCount+", contact maintainer to enhance");
+ } else {
+ return res;
}
- return new GLPixelAttributes(componentCount, dFormat, dType);
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Returns {@code null}!
+ * </p>
+ */
+ @Override
+ public PixelFormat.Composition getHostPixelComp(final GLProfile glp, final int componentCount) {
+ return null;
}
/**
@@ -149,13 +196,15 @@ public class GLPixelBuffer {
* </p>
*/
@Override
- public GLPixelBuffer allocate(final GL gl, final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final int minByteSize) {
+ public GLPixelBuffer allocate(final GL gl, final PixelFormat.Composition hostPixComp, final GLPixelAttributes pixelAttributes,
+ final boolean pack, final int width, final int height, final int depth, final int minByteSize) {
+ // unused: hostPixComp
if( minByteSize > 0 ) {
- return new GLPixelBuffer(pixelAttributes, width, height, depth, pack, Buffers.newDirectByteBuffer(minByteSize), getAllowRowStride());
+ return new GLPixelBuffer(pixelAttributes, pack, width, height, depth, Buffers.newDirectByteBuffer(minByteSize), getAllowRowStride());
} else {
final int[] tmp = { 0 };
- final int byteSize = GLBuffers.sizeof(gl, tmp, pixelAttributes.bytesPerPixel, width, height, depth, pack);
- return new GLPixelBuffer(pixelAttributes, width, height, depth, pack, Buffers.newDirectByteBuffer(byteSize), getAllowRowStride());
+ final int byteSize = GLBuffers.sizeof(gl, tmp, pixelAttributes.pfmt.comp.bytesPerPixel(), width, height, depth, pack);
+ return new GLPixelBuffer(pixelAttributes, pack, width, height, depth, Buffers.newDirectByteBuffer(byteSize), getAllowRowStride());
}
}
}
@@ -163,74 +212,190 @@ public class GLPixelBuffer {
/**
* Default {@link GLPixelBufferProvider} with {@link GLPixelBufferProvider#getAllowRowStride()} == <code>false</code>,
* utilizing best match for {@link GLPixelAttributes}
- * and {@link GLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocating} a {@link ByteBuffer}.
+ * and {@link GLPixelBufferProvider#allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int) allocating} a {@link ByteBuffer}.
*/
public static final GLPixelBufferProvider defaultProviderNoRowStride = new DefaultGLPixelBufferProvider(false);
/**
* Default {@link GLPixelBufferProvider} with {@link GLPixelBufferProvider#getAllowRowStride()} == <code>true</code>,
* utilizing best match for {@link GLPixelAttributes}
- * and {@link GLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocating} a {@link ByteBuffer}.
+ * and {@link GLPixelBufferProvider#allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int) allocating} a {@link ByteBuffer}.
*/
public static final GLPixelBufferProvider defaultProviderWithRowStride = new DefaultGLPixelBufferProvider(true);
/** Pixel attributes. */
public static class GLPixelAttributes {
/** Undefined instance of {@link GLPixelAttributes}, having componentCount:=0, format:=0 and type:= 0. */
- public static final GLPixelAttributes UNDEF = new GLPixelAttributes(0, 0, 0, false);
-
- /** Pixel <i>source</i> component count, i.e. number of meaningful components. */
- public final int componentCount;
- /** The OpenGL pixel data format */
- public final int format;
- /** The OpenGL pixel data type */
- public final int type;
- /** The OpenGL pixel size in bytes */
- public final int bytesPerPixel;
+ public static final GLPixelAttributes UNDEF = new GLPixelAttributes(null, PixelFormat.LUMINANCE, 0, 0, true, false);
/**
- * Deriving {@link #componentCount} via GL <code>dataFormat</code>, i.e. {@link GLBuffers#componentCount(int)} if &gt; 0.
- * @param dataFormat GL data format
- * @param dataType GL data type
+ * Returns the matching {@link PixelFormat} for the given GL format and type if exists,
+ * otherwise returns <code>null</code>.
*/
- public GLPixelAttributes(final int dataFormat, final int dataType) {
- this(0 < dataFormat ? GLBuffers.componentCount(dataFormat) : 0, dataFormat, dataType);
+ public static final PixelFormat getPixelFormat(final int glFormat, final int glDataType) {
+ PixelFormat pixFmt = null;
+
+ switch(glFormat) {
+ case GL.GL_ALPHA:
+ case GL.GL_LUMINANCE:
+ case GL2ES2.GL_RED:
+ pixFmt = PixelFormat.LUMINANCE;
+ break;
+ case GL.GL_RGB:
+ switch(glDataType) {
+ case GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV:
+ pixFmt = PixelFormat.RGB565;
+ break;
+ case GL.GL_UNSIGNED_SHORT_5_6_5:
+ pixFmt = PixelFormat.BGR565;
+ break;
+ case GL.GL_UNSIGNED_BYTE:
+ pixFmt = PixelFormat.RGB888;
+ break;
+ }
+ break;
+ case GL.GL_RGBA:
+ switch(glDataType) {
+ case GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV:
+ pixFmt = PixelFormat.RGBA5551;
+ break;
+ case GL.GL_UNSIGNED_SHORT_5_5_5_1:
+ pixFmt = PixelFormat.ABGR1555;
+ break;
+ case GL.GL_UNSIGNED_BYTE:
+ pixFmt = PixelFormat.RGBA8888;
+ break;
+ case GL2GL3.GL_UNSIGNED_INT_8_8_8_8:
+ pixFmt = PixelFormat.ABGR8888;
+ break;
+ }
+ break;
+ case GL2GL3.GL_BGR:
+ if( GL.GL_UNSIGNED_BYTE == glDataType ) {
+ pixFmt = PixelFormat.BGR888;
+ }
+ break;
+ case GL.GL_BGRA:
+ switch(glDataType) {
+ case GL2GL3.GL_UNSIGNED_INT_8_8_8_8:
+ pixFmt = PixelFormat.ARGB8888;
+ break;
+ case GL.GL_UNSIGNED_BYTE:
+ pixFmt = PixelFormat.BGRA8888;
+ break;
+ }
+ break;
+ }
+ return pixFmt;
}
+
/**
- * Using user specified source {@link #componentCount}.
- * @param componentCount source component count
- * @param dataFormat GL data format
- * @param dataType GL data type
+ * Returns the matching {@link GLPixelAttributes} for the given byte sized RGBA {@code componentCount} and {@link GL} if exists,
+ * otherwise returns {@code null}.
+ *
+ * @param gl the corresponding current {@link GL} context object
+ * @param componentCount RGBA component count, i.e. 1 (luminance, alpha or red), 3 (RGB) or 4 (RGBA)
+ * @param pack {@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}.
+ * {@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}.
*/
- public GLPixelAttributes(final int componentCount, final int dataFormat, final int dataType) {
- this(componentCount, dataFormat, dataType, true);
+ public static GLPixelAttributes convert(final GL gl, final int componentCount, final boolean pack) {
+ final int dFormat, dType;
+ final boolean glesReadMode = pack && gl.isGLES();
+
+ if( 1 == componentCount && !glesReadMode ) {
+ if( gl.isGL3ES3() ) {
+ // RED is supported on ES3 and >= GL3 [core]; ALPHA is deprecated on core
+ dFormat = GL2ES2.GL_RED;
+ } else {
+ // ALPHA is supported on ES2 and GL2, i.e. <= GL3 [core] or compatibility
+ dFormat = GL.GL_ALPHA;
+ }
+ dType = GL.GL_UNSIGNED_BYTE;
+ } else if( 3 == componentCount && !glesReadMode ) {
+ dFormat = GL.GL_RGB;
+ dType = GL.GL_UNSIGNED_BYTE;
+ } else if( 4 == componentCount || glesReadMode ) {
+ final GLContext ctx = gl.getContext();
+ final int _dFormat = ctx.getDefaultPixelDataFormat();
+ final int dComps = GLBuffers.componentCount(_dFormat);
+ if( dComps == componentCount || 4 == dComps ) { // accept if desired component count or 4 components
+ dFormat = _dFormat;
+ dType = ctx.getDefaultPixelDataType();
+ } else {
+ dFormat = GL.GL_RGBA;
+ dType = GL.GL_UNSIGNED_BYTE;
+ }
+ } else {
+ return null;
+ }
+ return new GLPixelAttributes(dFormat, dType);
}
/**
- * Returns the matching {@link GLPixelAttributes} for the given {@link PixelFormat} and {@link GLProfile} if exists,
- * otherwise returns <code>null</code>.
+ * Returns the matching {@link GLPixelAttributes} for the given {@link GLProfile}, {@link PixelFormat} and {@code pack} if exists,
+ * otherwise returns {@code null}.
+ * @param glp the corresponding {@link GLProfile}
+ * @param pixFmt the to be matched {@link PixelFormat pixel format}
+ * @param pack {@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}.
+ * {@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}.
*/
- public static final GLPixelAttributes convert(final PixelFormat pixFmt, final GLProfile glp) {
+ public static final GLPixelAttributes convert(final GLProfile glp, final PixelFormat pixFmt, final boolean pack) {
+ final int[] df = new int[1];
+ final int[] dt = new int[1];
+ convert(glp, pixFmt, pack, df, dt);
+ if( 0 != df[0] ) {
+ return new GLPixelAttributes(null, pixFmt, df[0], dt[0], true /* not used */, true);
+ }
+ return null;
+ }
+ private static final int convert(final GLProfile glp, final PixelFormat pixFmt, final boolean pack,
+ final int[] dfRes, final int[] dtRes) {
+ final boolean glesReadMode = pack && glp.isGLES();
int df = 0; // format
int dt = GL.GL_UNSIGNED_BYTE; // data type
switch(pixFmt) {
case LUMINANCE:
- if( glp.isGL3ES3() ) {
- // RED is supported on ES3 and >= GL3 [core]; ALPHA/LUMINANCE is deprecated on core
- df = GL2ES2.GL_RED;
- } else {
- // ALPHA/LUMINANCE is supported on ES2 and GL2, i.e. <= GL3 [core] or compatibility
- df = GL.GL_LUMINANCE;
+ if( !glesReadMode ) {
+ if( glp.isGL3ES3() ) {
+ // RED is supported on ES3 and >= GL3 [core]; ALPHA/LUMINANCE is deprecated on core
+ df = GL2ES2.GL_RED;
+ } else {
+ // ALPHA/LUMINANCE is supported on ES2 and GL2, i.e. <= GL3 [core] or compatibility
+ df = GL.GL_LUMINANCE;
+ }
}
break;
- case BGR888:
+ case RGB565:
if( glp.isGL2GL3() ) {
- df = GL2GL3.GL_BGR;
+ df = GL.GL_RGB; dt = GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV;
+ }
+ break;
+ case BGR565:
+ if( glp.isGL2GL3() ) {
+ df = GL.GL_RGB; dt = GL.GL_UNSIGNED_SHORT_5_6_5;
+ }
+ break;
+ case RGBA5551:
+ if( glp.isGL2GL3() ) {
+ df = GL.GL_RGBA; dt = GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV;
+ }
+ break;
+ case ABGR1555:
+ if( glp.isGL2GL3() ) {
+ df = GL.GL_RGBA; dt = GL.GL_UNSIGNED_SHORT_5_5_5_1;
}
break;
case RGB888:
- df = GL.GL_RGB;
+ if( !glesReadMode ) {
+ df = GL.GL_RGB;
+ }
+ break;
+ case BGR888:
+ if( glp.isGL2GL3() ) {
+ df = GL2GL3.GL_BGR;
+ }
break;
+ case RGBx8888:
case RGBA8888:
df = GL.GL_RGBA;
break;
@@ -239,85 +404,107 @@ public class GLPixelBuffer {
df = GL.GL_RGBA; dt = GL2GL3.GL_UNSIGNED_INT_8_8_8_8;
}
break;
- case BGRA8888:
- df = GL.GL_BGRA;
- break;
case ARGB8888:
if( glp.isGL2GL3() ) {
df = GL.GL_BGRA; dt = GL2GL3.GL_UNSIGNED_INT_8_8_8_8;
}
break;
- default:
+ case BGRx8888:
+ case BGRA8888:
+ if( glp.isGL2GL3() ) { // FIXME: or if( !glesReadMode ) ? BGRA n/a on GLES
+ df = GL.GL_BGRA;
+ }
break;
}
- if( 0 != df ) {
- return new GLPixelAttributes(pixFmt.componentCount, df, dt, true);
- }
- return null;
+ dfRes[0] = df;
+ dtRes[0] = dt;
+ return df;
}
- private GLPixelAttributes(final int componentCount, final int dataFormat, final int dataType, final boolean checkArgs) {
- this.componentCount = componentCount;
- this.format = dataFormat;
- this.type = dataType;
- this.bytesPerPixel = ( 0 < dataFormat && 0 < dataType ) ? GLBuffers.bytesPerPixel(dataFormat, dataType) : 0;
- if( checkArgs ) {
- if( 0 == componentCount || 0 == format || 0 == type ) {
- throw new GLException("Zero components, format and/or type: "+this);
- }
- if( 0 == bytesPerPixel ) {
- throw new GLException("Zero bytesPerPixel: "+this);
- }
+
+ /** The OpenGL pixel data format */
+ public final int format;
+ /** The OpenGL pixel data type */
+ public final int type;
+
+ /** {@link PixelFormat} describing the {@link PixelFormat.Composition component} layout */
+ public final PixelFormat pfmt;
+
+ @Override
+ public final int hashCode() {
+ // 31 * x == (x << 5) - x
+ int hash = pfmt.hashCode();
+ hash = ((hash << 5) - hash) + format;
+ return ((hash << 5) - hash) + type;
+ }
+
+ @Override
+ public final boolean equals(final Object obj) {
+ if(this == obj) { return true; }
+ if( obj instanceof GLPixelAttributes ) {
+ final GLPixelAttributes other = (GLPixelAttributes) obj;
+ return format == other.format &&
+ type == other.type &&
+ pfmt.equals(other.pfmt);
+ } else {
+ return false;
}
}
/**
- * Returns the matching {@link PixelFormat} of this {@link GLPixelAttributes} if exists,
- * otherwise returns <code>null</code>.
+ * Create a new {@link GLPixelAttributes} instance based on GL format and type.
+ * @param dataFormat GL data format
+ * @param dataType GL data type
+ * @throws GLException if {@link PixelFormat} could not be determined, see {@link #getPixelFormat(int, int)}.
*/
- public final PixelFormat getPixelFormat() {
- final PixelFormat pixFmt;
- // FIXME: Take 'type' into consideration and complete mapping!
- switch(format) {
- case GL.GL_ALPHA:
- case GL.GL_LUMINANCE:
- case GL2ES2.GL_RED:
- pixFmt = PixelFormat.LUMINANCE;
- break;
- case GL.GL_RGB:
- pixFmt = PixelFormat.RGB888;
- break;
- case GL.GL_RGBA:
- pixFmt = PixelFormat.RGBA8888;
- break;
- case GL2GL3.GL_BGR:
- pixFmt = PixelFormat.BGR888;
- break;
- case GL.GL_BGRA:
- pixFmt = PixelFormat.BGRA8888;
- break;
- default:
- switch( bytesPerPixel ) {
- case 1:
- pixFmt = PixelFormat.LUMINANCE;
- break;
- case 3:
- pixFmt = PixelFormat.RGB888;
- break;
- case 4:
- pixFmt = PixelFormat.RGBA8888;
- break;
- default:
- pixFmt = null;
- break;
- }
- break;
+ public GLPixelAttributes(final int dataFormat, final int dataType) throws GLException {
+ this(null, null, dataFormat, dataType, true /* not used */, true);
+ }
+
+ /**
+ * Create a new {@link GLPixelAttributes} instance based on {@link GLProfile}, {@link PixelFormat} and {@code pack}.
+ * @param glp the corresponding {@link GLProfile}
+ * @param pixFmt the to be matched {@link PixelFormat pixel format}
+ * @param pack {@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}.
+ * {@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}.
+ * @throws GLException if GL format or type could not be determined, see {@link #convert(GLProfile, PixelFormat, boolean)}.
+ */
+ public GLPixelAttributes(final GLProfile glp, final PixelFormat pixFmt, final boolean pack) throws GLException {
+ this(glp, pixFmt, 0, 0, pack, true);
+ }
+
+ private GLPixelAttributes(final GLProfile glp, final PixelFormat pixFmt,
+ final int dataFormat, final int dataType, final boolean pack, final boolean checkArgs) throws GLException {
+ if( checkArgs && ( 0 == dataFormat || 0 == dataType ) ) {
+ if( null == pixFmt || null == glp ) {
+ throw new GLException("Zero format and/or type w/o pixFmt or glp: "+this);
+ }
+ final int[] df = new int[1];
+ final int[] dt = new int[1];
+ if( 0 == convert(glp, pixFmt, pack, df, dt) ) {
+ throw new GLException("Could not find format and type for "+pixFmt+" and "+glp+", "+this);
+ }
+ this.format = df[0];
+ this.type = dt[0];
+ this.pfmt = pixFmt;
+ } else {
+ this.format = dataFormat;
+ this.type = dataType;
+ this.pfmt = null != pixFmt ? pixFmt : getPixelFormat(dataFormat, dataType);
+ if( null == this.pfmt ) {
+ throw new GLException("Could not find PixelFormat for format and/or type: "+this);
+ }
+ }
+ if( checkArgs ) {
+ final int bytesPerPixel = GLBuffers.bytesPerPixel(this.format, this.type);
+ if( 0 == bytesPerPixel ) {
+ throw new GLException("Zero bytesPerPixel: "+this);
+ }
}
- return pixFmt;
}
@Override
public String toString() {
- return "PixelAttributes[comp "+componentCount+", fmt 0x"+Integer.toHexString(format)+", type 0x"+Integer.toHexString(type)+", bytesPerPixel "+bytesPerPixel+"]";
+ return "PixelAttributes[fmt 0x"+Integer.toHexString(format)+", type 0x"+Integer.toHexString(type)+", "+pfmt+"]";
}
}
@@ -339,14 +526,18 @@ public class GLPixelBuffer {
public final int height;
/** Depth in pixels. */
public final int depth;
- /** Data packing direction. If <code>true</code> for read mode GPU -> CPU, <code>false</code> for write mode CPU -> GPU. */
+ /**
+ * Data packing direction.
+ * <p>{@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}.</p>
+ * <p>{@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}.</p>
+ */
public final boolean pack;
/** Byte size of the buffer. Actually the number of {@link Buffer#remaining()} bytes when passed in ctor. */
public final int byteSize;
/**
* Buffer holding the pixel data. If {@link #rewind()}, it holds <code>byteSize</code> {@link Buffer#remaining()} bytes.
* <p>
- * By default the {@link Buffer} is a {@link ByteBuffer}, due to {@link DefProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int)}.
+ * By default the {@link Buffer} is a {@link ByteBuffer}, due to {@link DefProvider#allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int)}.
* However, other {@link GLPixelBufferProvider} may utilize different {@link Buffer} types.
* </p>
*/
@@ -375,14 +566,16 @@ public class GLPixelBuffer {
/**
* @param pixelAttributes the desired {@link GLPixelAttributes}
+ * @param pack {@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}.
+ * {@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}.
* @param width in pixels
* @param height in pixels
* @param depth in pixels
- * @param pack true for read mode GPU -> CPU, otherwise false for write mode CPU -> GPU
* @param buffer the backing array
* @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. See {@link #requiresNewBuffer(GL, int, int, int)}.
+ * @param hostPixelComp the host {@link PixelFormat.Composition}
*/
- public GLPixelBuffer(final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final Buffer buffer, final boolean allowRowStride) {
+ public GLPixelBuffer(final GLPixelAttributes pixelAttributes, final boolean pack, final int width, final int height, final int depth, final Buffer buffer, final boolean allowRowStride) {
this.pixelAttributes = pixelAttributes;
this.width = width;
this.height = height;
@@ -462,7 +655,7 @@ public class GLPixelBuffer {
* @param newWidth new width in pixels
* @param newHeight new height in pixels
* @param newByteSize if &gt; 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore.
- * @see GLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int)
+ * @see GLPixelBufferProvider#allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int)
*/
public boolean requiresNewBuffer(final GL gl, final int newWidth, final int newHeight, int newByteSize) {
if( !isValid() ) {
@@ -470,7 +663,7 @@ public class GLPixelBuffer {
}
if( 0 >= newByteSize ) {
final int[] tmp = { 0 };
- newByteSize = GLBuffers.sizeof(gl, tmp, pixelAttributes.bytesPerPixel, newWidth, newHeight, 1, true);
+ newByteSize = GLBuffers.sizeof(gl, tmp, pixelAttributes.pfmt.comp.bytesPerPixel(), newWidth, newHeight, 1, true);
}
if( allowRowStride ) {
return byteSize < newByteSize;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java b/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java
index 290033e99..3f52a0d3c 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java
@@ -28,13 +28,13 @@
package com.jogamp.opengl.util;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GL2ES3;
-import javax.media.opengl.GL2GL3;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLException;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GL2ES3;
+import com.jogamp.opengl.GL2GL3;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLException;
/**
* Utility to safely set and restore the PACK and UNPACK pixel storage mode,
@@ -180,7 +180,7 @@ public class GLPixelStorageModes {
if( gl.isGL2GL3() ) {
gl.glPixelStorei(GL2GL3.GL_PACK_SWAP_BYTES, GL.GL_FALSE); // gl3
gl.glPixelStorei(GL2GL3.GL_PACK_LSB_FIRST, GL.GL_FALSE); // gl3
- if( gl.getContext().getGLVersionNumber().compareTo(GLContext.Version120) >= 0 ) {
+ if( gl.getContext().getGLVersionNumber().compareTo(GLContext.Version1_2) >= 0 ) {
gl.glPixelStorei(GL2GL3.GL_PACK_IMAGE_HEIGHT, 0); // gl3, GL_VERSION_1_2
gl.glPixelStorei(GL2GL3.GL_PACK_SKIP_IMAGES, 0); // gl3, GL_VERSION_1_2
}
@@ -251,7 +251,7 @@ public class GLPixelStorageModes {
gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_ROWS, 0); // es3, gl3
gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_PIXELS, 0); // es3, gl3
if( gl.isGL2GL3() ) {
- if( gl.getContext().getGLVersionNumber().compareTo(GLContext.Version120) >= 0 ) {
+ if( gl.getContext().getGLVersionNumber().compareTo(GLContext.Version1_2) >= 0 ) {
gl.glPixelStorei(GL2ES3.GL_UNPACK_IMAGE_HEIGHT, 0); // es3, gl3, GL_VERSION_1_2
gl.glPixelStorei(GL2ES3.GL_UNPACK_SKIP_IMAGES, 0); // es3, gl3, GL_VERSION_1_2
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java
index e84a1d874..c2067a9f2 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java
@@ -31,11 +31,12 @@ package com.jogamp.opengl.util;
import java.io.File;
import java.io.IOException;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES3;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLException;
+import com.jogamp.nativewindow.util.PixelFormat;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES3;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLException;
import com.jogamp.common.nio.Buffers;
import com.jogamp.opengl.util.texture.Texture;
@@ -51,10 +52,10 @@ import com.jogamp.opengl.util.texture.TextureIO;
*/
public class GLReadBufferUtil {
protected final GLPixelBufferProvider pixelBufferProvider;
- protected final int componentCount, alignment;
protected final Texture readTexture;
protected final GLPixelStorageModes psm;
+ protected boolean hasAlpha;
protected GLPixelBuffer readPixelBuffer = null;
protected TextureData readTextureData = null;
@@ -68,10 +69,9 @@ public class GLReadBufferUtil {
public GLReadBufferUtil(final GLPixelBufferProvider pixelBufferProvider, final boolean alpha, final boolean write2Texture) {
this.pixelBufferProvider = pixelBufferProvider;
- this.componentCount = alpha ? 4 : 3 ;
- this.alignment = alpha ? 4 : 1 ;
this.readTexture = write2Texture ? new Texture(GL.GL_TEXTURE_2D) : null ;
this.psm = new GLPixelStorageModes();
+ this.hasAlpha = alpha; // preset
}
/** Returns the {@link GLPixelBufferProvider} used by this instance. */
@@ -81,7 +81,7 @@ public class GLReadBufferUtil {
return null!=readTextureData && null!=readPixelBuffer && readPixelBuffer.isValid();
}
- public boolean hasAlpha() { return 4 == componentCount ? true : false ; }
+ public boolean hasAlpha() { return hasAlpha; }
public GLPixelStorageModes getGLPixelStorageModes() { return psm; }
@@ -173,13 +173,13 @@ public class GLReadBufferUtil {
if(GL.GL_NO_ERROR != glerr0) {
System.err.println("Info: GLReadBufferUtil.readPixels: pre-exisiting GL error 0x"+Integer.toHexString(glerr0));
}
- final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, componentCount);
- final int internalFormat;
- if(gl.isGL2GL3() && 3 == componentCount) {
- internalFormat = GL.GL_RGB;
- } else {
- internalFormat = (4 == componentCount) ? GL.GL_RGBA : GL.GL_RGB;
- }
+ final int reqCompCount = hasAlpha ? 4 : 3;
+ final PixelFormat.Composition hostPixelComp = pixelBufferProvider.getHostPixelComp(gl.getGLProfile(), reqCompCount);
+ final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, reqCompCount, true);
+ final int componentCount = pixelAttribs.pfmt.comp.componenCount();
+ hasAlpha = 0 <= pixelAttribs.pfmt.comp.find(PixelFormat.CType.A);
+ final int alignment = 4 == componentCount ? 4 : 1 ;
+ final int internalFormat = 4 == componentCount ? GL.GL_RGBA : GL.GL_RGB;
final boolean flipVertically;
if( drawable.isGLOriented() ) {
@@ -189,11 +189,11 @@ public class GLReadBufferUtil {
}
final int tmp[] = new int[1];
- final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.bytesPerPixel, width, height, 1, true);
+ final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.pfmt.comp.bytesPerPixel(), width, height, 1, true);
boolean newData = false;
if( null == readPixelBuffer || readPixelBuffer.requiresNewBuffer(gl, width, height, readPixelSize) ) {
- readPixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, width, height, 1, true, readPixelSize);
+ readPixelBuffer = pixelBufferProvider.allocate(gl, hostPixelComp, pixelAttribs, true, width, height, 1, readPixelSize);
Buffers.rangeCheckBytes(readPixelBuffer.buffer, readPixelSize);
try {
readTextureData = new TextureData(
diff --git a/src/jogl/classes/com/jogamp/opengl/util/Gamma.java b/src/jogl/classes/com/jogamp/opengl/util/Gamma.java
index bab85e531..151c8255d 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/Gamma.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/Gamma.java
@@ -39,9 +39,9 @@
package com.jogamp.opengl.util;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLDrawableFactory;
import com.jogamp.common.util.locks.RecursiveLock;
@@ -61,7 +61,7 @@ public class Gamma {
private Gamma() {}
/**
- * Convenient wrapper for {@link GLDrawableFactory#setDisplayGamma(javax.media.nativewindow.NativeSurface, float, float, float)}.
+ * Convenient wrapper for {@link GLDrawableFactory#setDisplayGamma(com.jogamp.nativewindow.NativeSurface, float, float, float)}.
* <p>
* Use {@link #setDisplayGamma(GLAutoDrawable, float, float, float)} in case of using an {#link GLAutoDrawable}.
* </p>
@@ -71,7 +71,7 @@ public class Gamma {
}
/**
- * Convenient wrapper for {@link GLDrawableFactory#setDisplayGamma(javax.media.nativewindow.NativeSurface, float, float, float)}
+ * Convenient wrapper for {@link GLDrawableFactory#setDisplayGamma(com.jogamp.nativewindow.NativeSurface, float, float, float)}
* locking {@link GLAutoDrawable#getUpstreamLock()} to ensure proper atomic operation.
*/
public static boolean setDisplayGamma(final GLAutoDrawable drawable, final float gamma, final float brightness, final float contrast) throws IllegalArgumentException {
@@ -85,7 +85,7 @@ public class Gamma {
}
/**
- * Convenient wrapper for {@link GLDrawableFactory#resetDisplayGamma(javax.media.nativewindow.NativeSurface)}.
+ * Convenient wrapper for {@link GLDrawableFactory#resetDisplayGamma(com.jogamp.nativewindow.NativeSurface)}.
* <p>
* Use {@link #resetDisplayGamma(GLAutoDrawable)} in case of using an {#link GLAutoDrawable}.
* </p>
@@ -95,7 +95,7 @@ public class Gamma {
}
/**
- * Convenient wrapper for {@link GLDrawableFactory#resetDisplayGamma(javax.media.nativewindow.NativeSurface)}
+ * Convenient wrapper for {@link GLDrawableFactory#resetDisplayGamma(com.jogamp.nativewindow.NativeSurface)}
* locking {@link GLAutoDrawable#getUpstreamLock()} to ensure proper atomic operation.
*/
public static void resetDisplayGamma(final GLAutoDrawable drawable) {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java
index 150e92c2e..b627f244c 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java
@@ -8,14 +8,15 @@ import java.nio.ShortBuffer;
import java.util.ArrayList;
import java.util.Iterator;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES1;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLException;
-import javax.media.opengl.fixedfunc.GLPointerFunc;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES1;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.fixedfunc.GLPointerFunc;
import jogamp.opengl.Debug;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.PropertyAccess;
@@ -450,7 +451,7 @@ public class ImmModeSink {
this.nElems=0;
this.tElems=0;
- this.pageSize = Platform.getMachineDescription().pageSizeInBytes();
+ this.pageSize = Platform.getMachineDataInfo().pageSizeInBytes();
reallocateBuffer(initialElementCount);
rewind();
@@ -1376,7 +1377,7 @@ public class ImmModeSink {
if(DEBUG_BUFFER) {
System.err.println("ImmModeSink.realloc.X: "+this.toString());
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return true;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
index 11acb0c58..57f9301b8 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java
@@ -37,9 +37,9 @@ package com.jogamp.opengl.util;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLException;
-import javax.media.opengl.fixedfunc.GLMatrixFunc;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
import jogamp.common.os.PlatformPropsImpl;
@@ -660,8 +660,14 @@ public final class PMVMatrix implements GLMatrixFunc {
glMultMatrixf( FloatUtil.makeOrtho(mat4Tmp1, 0, true, left, right, bottom, top, zNear, zFar), 0 );
}
+ /**
+ * {@inheritDoc}
+ *
+ * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0,
+ * or if left == right, or bottom == top, or zNear == zFar.
+ */
@Override
- public final void glFrustumf(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) {
+ public final void glFrustumf(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) throws GLException {
glMultMatrixf( FloatUtil.makeFrustum(mat4Tmp1, 0, true, left, right, bottom, top, zNear, zFar), 0 );
}
@@ -676,8 +682,9 @@ public final class PMVMatrix implements GLMatrixFunc {
* @param aspect aspect ratio width / height
* @param zNear
* @param zFar
+ * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0, or if zNear == zFar.
*/
- public final void gluPerspective(final float fovy_deg, final float aspect, final float zNear, final float zFar) {
+ public final void gluPerspective(final float fovy_deg, final float aspect, final float zNear, final float zFar) throws GLException {
glMultMatrixf( FloatUtil.makePerspective(mat4Tmp1, 0, true, fovy_deg * FloatUtil.PI / 180.0f, aspect, zNear, zFar), 0 );
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java b/src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java
index 64da547c2..f28774afa 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java
@@ -34,11 +34,11 @@ import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
-import javax.media.nativewindow.util.Dimension;
-import javax.media.nativewindow.util.DimensionImmutable;
-import javax.media.nativewindow.util.PixelFormat;
-import javax.media.nativewindow.util.PixelRectangle;
-import javax.media.nativewindow.util.PixelFormatUtil;
+import com.jogamp.nativewindow.util.Dimension;
+import com.jogamp.nativewindow.util.DimensionImmutable;
+import com.jogamp.nativewindow.util.PixelFormat;
+import com.jogamp.nativewindow.util.PixelRectangle;
+import com.jogamp.nativewindow.util.PixelFormatUtil;
import jogamp.opengl.Debug;
import jogamp.opengl.util.pngj.ImageInfo;
@@ -137,7 +137,7 @@ public class PNGPixelRect extends PixelRectangle.GenericPixelRect {
} else {
destFmt = ddestFmt; // user choice
}
- final int destStrideInBytes = Math.max(destMinStrideInBytes, destFmt.bytesPerPixel() * width);
+ final int destStrideInBytes = Math.max(destMinStrideInBytes, destFmt.comp.bytesPerPixel() * width);
final ByteBuffer destPixels = destDirectBuffer ? Buffers.newDirectByteBuffer(destStrideInBytes * height) :
ByteBuffer.allocate(destStrideInBytes * height);
{
@@ -153,7 +153,7 @@ public class PNGPixelRect extends PixelRectangle.GenericPixelRect {
System.err.println("PNGPixelRect: indexed "+indexed+", alpha "+hasAlpha+", grayscale "+imgInfo.greyscale+", channels "+channels+"/"+imgInfo.channels+
", bytesPerPixel "+bytesPerPixel+"/"+imgInfo.bytesPixel+
", grayAlpha "+isGrayAlpha+", pixels "+width+"x"+height+", dpi "+dpiX+"x"+dpiY+", format "+srcFmt);
- System.err.println("PNGPixelRect: destFormat "+destFmt+" ("+ddestFmt+", bytesPerPixel "+destFmt.bytesPerPixel()+", fast-path "+(destFmt==srcFmt)+"), destDirectBuffer "+destDirectBuffer+", destIsGLOriented (flip) "+destIsGLOriented);
+ System.err.println("PNGPixelRect: destFormat "+destFmt+" ("+ddestFmt+", fast-path "+(destFmt==srcFmt)+"), destDirectBuffer "+destDirectBuffer+", destIsGLOriented (flip) "+destIsGLOriented);
System.err.println("PNGPixelRect: destStrideInBytes "+destStrideInBytes+" (destMinStrideInBytes "+destMinStrideInBytes+")");
}
@@ -227,7 +227,7 @@ public class PNGPixelRect extends PixelRectangle.GenericPixelRect {
(byte)scanline[lineOff+1], // G
(byte)scanline[lineOff+2], // B
srcHasAlpha ? (byte)scanline[lineOff+3] : (byte)0xff); // A
- final int dbpp = dest_fmt.bytesPerPixel();
+ final int dbpp = dest_fmt.comp.bytesPerPixel();
d.put(dOff++, (byte) ( p )); // 1
if( 1 < dbpp ) {
d.put(dOff++, (byte) ( p >>> 8 )); // 2
@@ -261,7 +261,7 @@ public class PNGPixelRect extends PixelRectangle.GenericPixelRect {
if(hasAlpha) {
line.scanline[lineOff + 3] = 0xff & ( p >>> 24 ); // A
}
- return srcOff + pixelformat.bytesPerPixel();
+ return srcOff + pixelformat.comp.bytesPerPixel();
}
private static void setPixelRGBA8(final PixelFormat pixelformat, final ImageLine line, final int lineOff, final int srcPix, final int bytesPerPixel, final boolean hasAlpha) {
@@ -304,7 +304,7 @@ public class PNGPixelRect extends PixelRectangle.GenericPixelRect {
public void write(final OutputStream outstream, final boolean closeOutstream) throws IOException {
final int width = size.getWidth();
final int height = size.getHeight();
- final int bytesPerPixel = pixelformat.bytesPerPixel();
+ final int bytesPerPixel = pixelformat.comp.bytesPerPixel();
final ImageInfo imi = new ImageInfo(width, height, 8 /* bitdepth */,
(4 == bytesPerPixel) ? true : false /* alpha */,
(1 == bytesPerPixel) ? true : false /* grayscale */,
@@ -349,7 +349,7 @@ public class PNGPixelRect extends PixelRectangle.GenericPixelRect {
final OutputStream outstream, final boolean closeOutstream) throws IOException {
final int width = size.getWidth();
final int height = size.getHeight();
- final int bytesPerPixel = pixelformat.bytesPerPixel();
+ final int bytesPerPixel = pixelformat.comp.bytesPerPixel();
final ImageInfo imi = new ImageInfo(width, height, 8 /* bitdepth */,
(4 == bytesPerPixel) ? true : false /* alpha */,
(1 == bytesPerPixel) ? true : false /* grayscale */,
diff --git a/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java
index 3b65b0824..94db6e9e4 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java
@@ -27,10 +27,10 @@
*/
package com.jogamp.opengl.util;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES3;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLException;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES3;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLException;
import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes;
@@ -176,7 +176,7 @@ public class RandomTileRenderer extends TileRendererBase {
final int srcY = 0;
final int srcWidth = currentTileWidth;
final int srcHeight = currentTileHeight;
- final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.bytesPerPixel, srcWidth, srcHeight, 1, true);
+ final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.pfmt.comp.bytesPerPixel(), srcWidth, srcHeight, 1, true);
tileBuffer.clear();
if( tileBuffer.requiresNewBuffer(gl, srcWidth, srcHeight, readPixelSize) ) {
throw new IndexOutOfBoundsException("Required " + readPixelSize + " bytes of buffer, only had " + tileBuffer);
@@ -200,9 +200,9 @@ public class RandomTileRenderer extends TileRendererBase {
psm.setPackRowLength(gl2es3, rowLength);
/* read the tile into the final image */
- final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.bytesPerPixel, srcWidth, srcHeight, 1, true);
+ final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.pfmt.comp.bytesPerPixel(), srcWidth, srcHeight, 1, true);
- final int ibPos = ( currentTileXPos + ( currentTileYPos * rowLength ) ) * pixelAttribs.bytesPerPixel; // skipPixels + skipRows
+ final int ibPos = ( currentTileXPos + ( currentTileYPos * rowLength ) ) * pixelAttribs.pfmt.comp.bytesPerPixel(); // skipPixels + skipRows
final int ibLim = ibPos + readPixelSize;
imageBuffer.clear();
if( imageBuffer.requiresNewBuffer(gl, srcWidth, srcHeight, readPixelSize) ) {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java
index d8410a102..b4ddd4ed0 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java
@@ -36,11 +36,11 @@
*/
package com.jogamp.opengl.util;
-import javax.media.nativewindow.util.Dimension;
-import javax.media.nativewindow.util.DimensionImmutable;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES3;
-import javax.media.opengl.GLException;
+import com.jogamp.nativewindow.util.Dimension;
+import com.jogamp.nativewindow.util.DimensionImmutable;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES3;
+import com.jogamp.opengl.GLException;
import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes;
@@ -479,7 +479,7 @@ public class TileRenderer extends TileRendererBase {
final int srcY = tileBorder;
final int srcWidth = tileSizeNB.getWidth();
final int srcHeight = tileSizeNB.getHeight();
- final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.bytesPerPixel, srcWidth, srcHeight, 1, true);
+ final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.pfmt.comp.bytesPerPixel(), srcWidth, srcHeight, 1, true);
tileBuffer.clear();
if( tileBuffer.requiresNewBuffer(gl, srcWidth, srcHeight, readPixelSize) ) {
throw new IndexOutOfBoundsException("Required " + readPixelSize + " bytes of buffer, only had " + tileBuffer);
@@ -503,11 +503,11 @@ public class TileRenderer extends TileRendererBase {
psm.setPackRowLength(gl2es3, rowLength);
/* read the tile into the final image */
- final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.bytesPerPixel, srcWidth, srcHeight, 1, true);
+ final int readPixelSize = GLBuffers.sizeof(gl, tmp, pixelAttribs.pfmt.comp.bytesPerPixel(), srcWidth, srcHeight, 1, true);
final int skipPixels = currentColumn * tileSizeNB.getWidth();
final int skipRows = currentRow * tileSizeNB.getHeight();
- final int ibPos = ( skipPixels + ( skipRows * rowLength ) ) * pixelAttribs.bytesPerPixel;
+ final int ibPos = ( skipPixels + ( skipRows * rowLength ) ) * pixelAttribs.pfmt.comp.bytesPerPixel();
final int ibLim = ibPos + readPixelSize;
imageBuffer.clear();
if( imageBuffer.requiresNewBuffer(gl, srcWidth, srcHeight, readPixelSize) ) {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java b/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java
index a1735766e..df73f6f3a 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java
@@ -36,15 +36,15 @@
*/
package com.jogamp.opengl.util;
-import javax.media.nativewindow.util.Dimension;
-import javax.media.nativewindow.util.DimensionImmutable;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES3;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLException;
+import com.jogamp.nativewindow.util.Dimension;
+import com.jogamp.nativewindow.util.DimensionImmutable;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES3;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLException;
import jogamp.opengl.Debug;
/**
diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java
index 2ad102235..662cf74b7 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java
@@ -27,9 +27,9 @@
*/
package com.jogamp.opengl.util.av;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLException;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLException;
import jogamp.opengl.Debug;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java
index 04bc0a15d..6b0b3784d 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java
@@ -36,10 +36,14 @@ import java.awt.image.SinglePixelPackedSampleModel;
import java.awt.image.WritableRaster;
import java.nio.Buffer;
import java.nio.IntBuffer;
+import java.util.Iterator;
-import javax.media.opengl.GL;
+import com.jogamp.nativewindow.util.PixelFormat;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLProfile;
import com.jogamp.common.nio.Buffers;
+import com.jogamp.common.util.IntObjectHashMap;
import com.jogamp.opengl.util.GLPixelBuffer;
/**
@@ -50,7 +54,7 @@ import com.jogamp.opengl.util.GLPixelBuffer;
* </p>
* <p>
* {@link AWTGLPixelBuffer} can be produced via {@link AWTGLPixelBufferProvider}'s
- * {@link AWTGLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocate(..)}.
+ * {@link AWTGLPixelBufferProvider#allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int) allocate(..)}.
* </p>
* <p>
* See {@link AWTGLPixelBuffer#requiresNewBuffer(GL, int, int, int)} for {@link #allowRowStride} details.
@@ -61,30 +65,49 @@ import com.jogamp.opengl.util.GLPixelBuffer;
* </p>
*/
public class AWTGLPixelBuffer extends GLPixelBuffer {
- public static final GLPixelAttributes awtPixelAttributesIntRGBA4 = new GLPixelAttributes(4, GL.GL_BGRA, GL.GL_UNSIGNED_BYTE);
- public static final GLPixelAttributes awtPixelAttributesIntRGB3 = new GLPixelAttributes(3, GL.GL_BGRA, GL.GL_UNSIGNED_BYTE);
+ /**
+ * Ignoring componentCount, since otherwise no AWT/GL matching types are found.
+ * <p>
+ * Due to using RGBA and BGRA, pack/unpack usage has makes no difference.
+ * </p>
+ */
+ private static final GLPixelAttributes awtPixelAttributesIntBGRA = new GLPixelAttributes(GL.GL_BGRA, GL.GL_UNSIGNED_BYTE);
+ private static final GLPixelAttributes awtPixelAttributesIntRGBA = new GLPixelAttributes(GL.GL_RGBA, GL.GL_UNSIGNED_BYTE);
/** The underlying {@link BufferedImage}. */
public final BufferedImage image;
+ private final PixelFormat.Composition hostPixelComp;
+ private final int awtFormat;
+
/**
- *
+ * @param hostPixelComp the host {@link PixelFormat.Composition}
* @param pixelAttributes the desired {@link GLPixelAttributes}
+ * @param pack {@code true} for read mode GPU -> CPU, e.g. {@link GL#glReadPixels(int, int, int, int, int, int, Buffer) glReadPixels}.
+ * {@code false} for write mode CPU -> GPU, e.g. {@link GL#glTexImage2D(int, int, int, int, int, int, int, int, Buffer) glTexImage2D}.
+ * @param awtFormat the used AWT format, i.e. {@link AWTGLPixelBufferProvider#getAWTFormat(GLProfile, int)}
* @param width in pixels
* @param height in pixels
* @param depth in pixels
- * @param pack true for read mode GPU -> CPU, otherwise false for write mode CPU -> GPU
* @param image the AWT image
* @param buffer the backing array
* @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. See {@link #requiresNewBuffer(GL, int, int, int)}.
* If <code>true</code>, user shall decide whether to use a {@link #getAlignedImage(int, int) width-aligned image}.
*/
- public AWTGLPixelBuffer(final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final BufferedImage image,
- final Buffer buffer, final boolean allowRowStride) {
- super(pixelAttributes, width, height, depth, pack, buffer, allowRowStride);
+ public AWTGLPixelBuffer(final PixelFormat.Composition hostPixelComp,
+ final GLPixelAttributes pixelAttributes,
+ final boolean pack,
+ final int awtFormat, final int width, final int height, final int depth,
+ final BufferedImage image, final Buffer buffer, final boolean allowRowStride) {
+ super(pixelAttributes, pack, width, height, depth, buffer, allowRowStride);
this.image = image;
+ this.hostPixelComp = hostPixelComp;
+ this.awtFormat = awtFormat;
}
+ public final PixelFormat.Composition getHostPixelComp() { return hostPixelComp; }
+ public final int getAWTFormat() { return awtFormat; }
+
@Override
public void dispose() {
image.flush();
@@ -147,12 +170,57 @@ public class AWTGLPixelBuffer extends GLPixelBuffer {
public AWTGLPixelBufferProvider(final boolean allowRowStride) {
this.allowRowStride = allowRowStride;
}
+
@Override
public boolean getAllowRowStride() { return allowRowStride; }
@Override
- public GLPixelAttributes getAttributes(final GL gl, final int componentCount) {
- return 4 == componentCount ? awtPixelAttributesIntRGBA4 : awtPixelAttributesIntRGB3;
+ public GLPixelAttributes getAttributes(final GL gl, final int componentCount, final boolean pack) {
+ return gl.isGLES() ? awtPixelAttributesIntRGBA : awtPixelAttributesIntBGRA;
+ }
+
+ public GLPixelAttributes getAttributes(final GLProfile glp, final int componentCount) {
+ return glp.isGLES() ? awtPixelAttributesIntRGBA : awtPixelAttributesIntBGRA;
+ }
+
+ /**
+ * {@inheritDoc}
+ * <p>
+ * Returns a valid {@link PixelFormat.Composition} instance from {@link #getAWTPixelFormat(GLProfile, int)}.
+ * </p>
+ */
+ @Override
+ public PixelFormat.Composition getHostPixelComp(final GLProfile glp, final int componentCount) {
+ return getAWTPixelFormat(glp, componentCount).comp;
+ }
+
+ /**
+ * Returns one of
+ * <ul>
+ * <li>GL__, 4c -> 4c: {@link BufferedImage#TYPE_INT_ARGB} <-> {@link GL#GL_BGRA}</li>
+ * <li>GLES, 4c -> 4c: {@link BufferedImage#TYPE_INT_BGR} <-> {@link GL#GL_RGBA}</li>
+ * <li>GL__, 3c -> 4c: {@link BufferedImage#TYPE_INT_RGB} <-> {@link GL#GL_BGRA}</li>
+ * <li>GLES, 3c -> 4c: {@link BufferedImage#TYPE_INT_BGR} <-> {@link GL#GL_RGBA}</li>
+ * </ul>
+ * @param glp
+ * @param componentCount
+ * @return
+ */
+ public int getAWTFormat(final GLProfile glp, final int componentCount) {
+ if( 4 == componentCount ) {
+ // FIXME: 4 component solution BufferedImage.TYPE_INT_ARGB: GLES format missing (i.e. GL_BGRA)
+ return glp.isGLES() ? BufferedImage.TYPE_INT_BGR : BufferedImage.TYPE_INT_ARGB;
+ } else {
+ return glp.isGLES() ? BufferedImage.TYPE_INT_BGR : BufferedImage.TYPE_INT_RGB;
+ }
+ }
+
+ public PixelFormat getAWTPixelFormat(final GLProfile glp, final int componentCount) {
+ if( 4 == componentCount ) {
+ return glp.isGLES() ? PixelFormat.RGBx8888 : PixelFormat.BGRA8888;
+ } else {
+ return glp.isGLES() ? PixelFormat.RGBx8888 : PixelFormat.BGRx8888;
+ }
}
/**
@@ -162,11 +230,17 @@ public class AWTGLPixelBuffer extends GLPixelBuffer {
* </p>
*/
@Override
- public AWTGLPixelBuffer allocate(final GL gl, final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final int minByteSize) {
- final BufferedImage image = new BufferedImage(width, height, 4 == pixelAttributes.componentCount ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB);
+ public AWTGLPixelBuffer allocate(final GL gl, final PixelFormat.Composition hostPixComp, final GLPixelAttributes pixelAttributes, final boolean pack,
+ final int width, final int height, final int depth, final int minByteSize) {
+ if( null == hostPixComp ) {
+ throw new IllegalArgumentException("Null hostPixComp");
+ }
+ final int awtFormat = getAWTFormat(gl.getGLProfile(), hostPixComp.componenCount());
+ final BufferedImage image = new BufferedImage(width, height, awtFormat);
final int[] readBackIntBuffer = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
final Buffer ibuffer = IntBuffer.wrap( readBackIntBuffer );
- return new AWTGLPixelBuffer(pixelAttributes, width, height, depth, pack, image, ibuffer, allowRowStride);
+ return new AWTGLPixelBuffer(hostPixComp, pixelAttributes, pack,
+ awtFormat, width, height, depth, image, ibuffer, allowRowStride);
}
}
@@ -174,15 +248,22 @@ public class AWTGLPixelBuffer extends GLPixelBuffer {
* Provider for singleton {@link AWTGLPixelBuffer} instances.
* <p>
* Provider instance holds the last {@link AWTGLPixelBuffer} instance
- * {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated}.
- * A new {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocation}
+ * {@link #allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int) allocated}.
+ * A new {@link #allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int) allocation}
* will return same instance, if a new buffer is not {@link AWTGLPixelBuffer#requiresNewBuffer(GL, int, int, int) required}.
* The latter is true if size are compatible, hence <code>allowRowStride</code> should be enabled, if possible.
* </p>
*/
public static class SingleAWTGLPixelBufferProvider extends AWTGLPixelBufferProvider implements SingletonGLPixelBufferProvider {
- private AWTGLPixelBuffer singleRGBA4 = null;
- private AWTGLPixelBuffer singleRGB3 = null;
+ private final IntObjectHashMap bufferMap = new IntObjectHashMap(8);
+
+ private static int getHashCode(final PixelFormat.Composition hostPixelComp, final GLPixelAttributes pixelAttributes, final boolean pack) {
+ // 31 * x == (x << 5) - x
+ int hash = hostPixelComp.hashCode();
+ hash = ((hash << 5) - hash) + pixelAttributes.hashCode();
+ // hash = ((hash << 5) - hash) + (pack ? 100 : 0); // no difference due to RGBA/BGRA only modes.
+ return hash;
+ }
/**
* @param allowRowStride If <code>true</code>, allow row-stride, otherwise not. See {@link AWTGLPixelBuffer#requiresNewBuffer(GL, int, int, int)}.
@@ -198,52 +279,72 @@ public class AWTGLPixelBuffer extends GLPixelBuffer {
* </p>
*/
@Override
- public AWTGLPixelBuffer allocate(final GL gl, final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final int minByteSize) {
- if( 4 == pixelAttributes.componentCount ) {
- if( null == singleRGBA4 || singleRGBA4.requiresNewBuffer(gl, width, height, minByteSize) ) {
- singleRGBA4 = allocateImpl(pixelAttributes, width, height, depth, pack, minByteSize);
- }
- return singleRGBA4;
- } else {
- if( null == singleRGB3 || singleRGB3.requiresNewBuffer(gl, width, height, minByteSize) ) {
- singleRGB3 = allocateImpl(pixelAttributes, width, height, depth, pack, minByteSize);
+ public AWTGLPixelBuffer allocate(final GL gl, PixelFormat.Composition hostPixComp, final GLPixelAttributes pixelAttributes,
+ final boolean pack, final int width, final int height, final int depth, final int minByteSize) {
+ if( null == hostPixComp ) {
+ hostPixComp = pixelAttributes.pfmt.comp;
+ }
+ final int bufferKey = getHashCode(hostPixComp, pixelAttributes, pack);
+ AWTGLPixelBuffer r = (AWTGLPixelBuffer) bufferMap.get(bufferKey);
+ if( null == r || r.requiresNewBuffer(gl, width, height, minByteSize) ) {
+ if( null != r ) {
+ r.dispose();
}
- return singleRGB3;
+ r = allocateImpl(hostPixComp, pixelAttributes, pack,
+ getAWTFormat(gl.getGLProfile(), hostPixComp.componenCount()), width, height, depth, minByteSize);
+ bufferMap.put(bufferKey, r);
}
+ return r;
}
- private AWTGLPixelBuffer allocateImpl(final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final int minByteSize) {
- final BufferedImage image = new BufferedImage(width, height, 4 == pixelAttributes.componentCount ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB);
+ private AWTGLPixelBuffer allocateImpl(final PixelFormat.Composition hostPixComp,
+ final GLPixelAttributes pixelAttributes,
+ final boolean pack,
+ final int awtFormat, final int width, final int height, final int depth,
+ final int minByteSize) {
+ final BufferedImage image = new BufferedImage(width, height, awtFormat);
final int[] readBackIntBuffer = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
final Buffer ibuffer = IntBuffer.wrap( readBackIntBuffer );
- return new AWTGLPixelBuffer(pixelAttributes, width, height, depth, pack, image, ibuffer, getAllowRowStride());
+ return new AWTGLPixelBuffer(hostPixComp, pixelAttributes, pack,
+ awtFormat, width, height, depth, image, ibuffer, getAllowRowStride());
}
- /** Return the last {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated} {@link AWTGLPixelBuffer} w/ {@link GLPixelAttributes#componentCount}. */
+ /**
+ * Return the last {@link #allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int) allocated}
+ * {@link AWTGLPixelBuffer}, if compatible w/ the given {@link PixelFormat.Composition} and {@link GLPixelAttributes}.
+ **/
@Override
- public AWTGLPixelBuffer getSingleBuffer(final GLPixelAttributes pixelAttributes) {
- return 4 == pixelAttributes.componentCount ? singleRGBA4 : singleRGB3;
+ public AWTGLPixelBuffer getSingleBuffer(final PixelFormat.Composition hostPixelComp, final GLPixelAttributes pixelAttributes, final boolean pack) {
+ return (AWTGLPixelBuffer) bufferMap.get(getHashCode(hostPixelComp, pixelAttributes, pack));
}
/**
- * Initializes the single {@link AWTGLPixelBuffer} w/ a given size, if not yet {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated}.
+ * Initializes the single {@link AWTGLPixelBuffer} w/ a given size, if not yet {@link #allocate(GL, PixelFormat.Composition, GLPixelAttributes, boolean, int, int, int, int) allocated}.
* @return the newly initialized single {@link AWTGLPixelBuffer}, or null if already allocated.
*/
@Override
- public AWTGLPixelBuffer initSingleton(final int componentCount, final int width, final int height, final int depth, final boolean pack) {
- if( 4 == componentCount ) {
- if( null != singleRGBA4 ) {
- return null;
- }
- singleRGBA4 = allocateImpl(AWTGLPixelBuffer.awtPixelAttributesIntRGBA4, width, height, depth, pack, 0);
- return singleRGBA4;
- } else {
- if( null != singleRGB3 ) {
- return null;
- }
- singleRGB3 = allocateImpl(AWTGLPixelBuffer.awtPixelAttributesIntRGB3, width, height, depth, pack, 0);
- return singleRGB3;
+ public AWTGLPixelBuffer initSingleton(final GLProfile glp, final int componentCount,
+ final boolean pack, final int width, final int height, final int depth) {
+ final GLPixelAttributes pixelAttributes = getAttributes(glp, componentCount);
+ final PixelFormat awtPixelFormat = getAWTPixelFormat(glp, componentCount);
+ final int awtFormat = getAWTFormat(glp, componentCount);
+ final int bufferKey = getHashCode(awtPixelFormat.comp, pixelAttributes, pack);
+ AWTGLPixelBuffer r = (AWTGLPixelBuffer) bufferMap.get(bufferKey);
+ if( null != r ) {
+ return null;
+ }
+ r = allocateImpl(awtPixelFormat.comp, pixelAttributes, pack, awtFormat, width, height, depth, 0);
+ bufferMap.put(bufferKey, r);
+ return r;
+ }
+
+ @Override
+ public void dispose() {
+ for(final Iterator<IntObjectHashMap.Entry> i=bufferMap.iterator(); i.hasNext(); ) {
+ final AWTGLPixelBuffer b = (AWTGLPixelBuffer)i.next().value;
+ b.dispose();
}
+ bufferMap.clear();
}
}
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java
index b75ad3b17..aad94aae6 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java
@@ -29,9 +29,9 @@ package com.jogamp.opengl.util.awt;
import java.awt.image.BufferedImage;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLProfile;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.util.GLReadBufferUtil;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java b/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java
index a78bc9bb3..ee9e1314e 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java
@@ -41,7 +41,7 @@ package com.jogamp.opengl.util.awt;
import java.awt.Graphics2D;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
/** Provides a Java 2D overlay on top of an arbitrary GLDrawable,
making it easier to do things like draw text and images on top of
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
index fc0861eaa..e6f5aaa2e 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java
@@ -64,10 +64,10 @@ import java.nio.*;
import java.text.*;
import java.util.*;
-import javax.media.opengl.*;
-import javax.media.opengl.fixedfunc.GLPointerFunc;
-import javax.media.opengl.glu.*;
-import javax.media.opengl.awt.*;
+import com.jogamp.opengl.*;
+import com.jogamp.opengl.fixedfunc.GLPointerFunc;
+import com.jogamp.opengl.glu.*;
+import com.jogamp.opengl.awt.*;
import jogamp.opengl.Debug;
@@ -81,15 +81,15 @@ import jogamp.opengl.Debug;
Using the {@link TextRenderer TextRenderer} is simple. Add a
"<code>TextRenderer renderer;</code>" field to your {@link
- javax.media.opengl.GLEventListener GLEventListener}. In your {@link
- javax.media.opengl.GLEventListener#init init} method, add:
+ com.jogamp.opengl.GLEventListener GLEventListener}. In your {@link
+ com.jogamp.opengl.GLEventListener#init init} method, add:
<PRE>
renderer = new TextRenderer(new Font("SansSerif", Font.BOLD, 36));
</PRE>
- <P> In the {@link javax.media.opengl.GLEventListener#display display} method of your
- {@link javax.media.opengl.GLEventListener GLEventListener}, add:
+ <P> In the {@link com.jogamp.opengl.GLEventListener#display display} method of your
+ {@link com.jogamp.opengl.GLEventListener GLEventListener}, add:
<PRE>
renderer.beginRendering(drawable.getWidth(), drawable.getHeight());
// optionally set the color
@@ -381,7 +381,7 @@ public class TextRenderer {
@param width the width of the current on-screen OpenGL drawable
@param height the height of the current on-screen OpenGL drawable
- @throws javax.media.opengl.GLException If an OpenGL context is not current when this method is called
+ @throws com.jogamp.opengl.GLException If an OpenGL context is not current when this method is called
*/
public void beginRendering(final int width, final int height) throws GLException {
beginRendering(width, height, true);
diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java
index ef59f9fa0..c8b365235 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java
@@ -47,10 +47,10 @@ import java.awt.Image;
import java.awt.Rectangle;
import java.awt.image.*;
-import javax.media.opengl.*;
-import javax.media.opengl.fixedfunc.GLLightingFunc;
-import javax.media.opengl.fixedfunc.GLMatrixFunc;
-import javax.media.opengl.glu.gl2.*;
+import com.jogamp.opengl.*;
+import com.jogamp.opengl.fixedfunc.GLLightingFunc;
+import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
+import com.jogamp.opengl.glu.gl2.*;
import com.jogamp.opengl.util.texture.*;
import com.jogamp.opengl.util.texture.awt.*;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java
index 92cbd66da..752d56827 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java
@@ -39,10 +39,10 @@
package com.jogamp.opengl.util.gl2;
-import javax.media.opengl.*;
-import javax.media.opengl.fixedfunc.GLLightingFunc;
-import javax.media.opengl.glu.*;
-import javax.media.opengl.glu.gl2.*;
+import com.jogamp.opengl.*;
+import com.jogamp.opengl.fixedfunc.GLLightingFunc;
+import com.jogamp.opengl.glu.*;
+import com.jogamp.opengl.glu.gl2.*;
/** Subset of the routines provided by the GLUT interface. Note the
signatures of many of the methods are necessarily different than
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java
index 3b8706a24..bb1c5e9b1 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java
@@ -44,13 +44,13 @@ import java.util.Arrays;
import java.util.Iterator;
import java.util.Set;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GL3;
-import javax.media.opengl.GL4;
-import javax.media.opengl.GLES2;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLException;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GL3;
+import com.jogamp.opengl.GL4;
+import com.jogamp.opengl.GLES2;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLException;
import jogamp.opengl.Debug;
@@ -1049,7 +1049,7 @@ public class ShaderCode {
public static final boolean requiresGL3DefaultPrecision(final GL2ES2 gl) {
if( gl.isGL3() ) {
final VersionNumber glslVersion = gl.getContext().getGLSLVersionNumber();
- return glslVersion.compareTo(GLContext.Version130) >= 0 && glslVersion.compareTo(GLContext.Version150) < 0 ;
+ return glslVersion.compareTo(GLContext.Version1_30) >= 0 && glslVersion.compareTo(GLContext.Version1_50) < 0 ;
} else {
return false;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
index a9b0bddc6..63455ba51 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java
@@ -28,7 +28,7 @@
package com.jogamp.opengl.util.glsl;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
import com.jogamp.common.os.Platform;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java
index d758fc121..e06f7be00 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java
@@ -32,14 +32,15 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLArrayData;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLUniformData;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLArrayData;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLUniformData;
import jogamp.opengl.Debug;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.PropertyAccess;
import com.jogamp.opengl.util.GLArrayDataEditable;
@@ -161,7 +162,7 @@ public class ShaderState {
final int newId = (null!=prog)?prog.id():-1;
System.err.println("ShaderState: attachShaderProgram: "+curId+" -> "+newId+" (enable: "+enable+")\n\t"+shaderProgram+"\n\t"+prog);
if(DEBUG) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
if(null!=shaderProgram) {
@@ -340,7 +341,7 @@ public class ShaderState {
* @throws GLException if no program is attached
* @throws GLException if the program is already linked
*
- * @see javax.media.opengl.GL2ES2#glBindAttribLocation(int, int, String)
+ * @see com.jogamp.opengl.GL2ES2#glBindAttribLocation(int, int, String)
* @see #getAttribLocation(GL2ES2, String)
* @see #getCachedAttribLocation(String)
*/
@@ -361,7 +362,7 @@ public class ShaderState {
* @throws GLException if no program is attached
* @throws GLException if the program is already linked
*
- * @see javax.media.opengl.GL2ES2#glBindAttribLocation(int, int, String)
+ * @see com.jogamp.opengl.GL2ES2#glBindAttribLocation(int, int, String)
* @see #getAttribLocation(GL2ES2, String)
* @see #getCachedAttribLocation(String)
* @see #getAttribute(String)
@@ -405,7 +406,7 @@ public class ShaderState {
} else if(verbose) {
System.err.println("ShaderState: glGetAttribLocation failed, no location for: "+name+", loc: "+location);
if(DEBUG) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
}
@@ -448,7 +449,7 @@ public class ShaderState {
} else if(verbose) {
System.err.println("ShaderState: glGetAttribLocation failed, no location for: "+name+", loc: "+location);
if(DEBUG) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
}
@@ -483,7 +484,7 @@ public class ShaderState {
if(verbose) {
System.err.println("ShaderState: glEnableVertexAttribArray failed, no index for: "+name);
if(DEBUG) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
return false;
@@ -558,7 +559,7 @@ public class ShaderState {
if(verbose) {
System.err.println("ShaderState: glDisableVertexAttribArray failed, no index for: "+name);
if(DEBUG) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
return false;
@@ -860,7 +861,7 @@ public class ShaderState {
* @throws GLException is the program is not linked
*
* @see #glGetUniformLocation
- * @see javax.media.opengl.GL2ES2#glGetUniformLocation
+ * @see com.jogamp.opengl.GL2ES2#glGetUniformLocation
* @see #getUniformLocation
* @see ShaderProgram#glReplaceShader
*/
@@ -875,7 +876,7 @@ public class ShaderState {
} else if(verbose) {
System.err.println("ShaderState: glUniform failed, no location for: "+name+", index: "+location);
if(DEBUG) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
}
@@ -898,7 +899,7 @@ public class ShaderState {
* @throws GLException is the program is not linked
*
* @see #glGetUniformLocation
- * @see javax.media.opengl.GL2ES2#glGetUniformLocation
+ * @see com.jogamp.opengl.GL2ES2#glGetUniformLocation
* @see #getUniformLocation
* @see ShaderProgram#glReplaceShader
*/
@@ -916,7 +917,7 @@ public class ShaderState {
} else if(verbose) {
System.err.println("ShaderState: glUniform failed, no location for: "+name+", index: "+location);
if(DEBUG) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
}
@@ -935,8 +936,8 @@ public class ShaderState {
* @return false, if the location could not be determined, otherwise true
*
* @see #glGetUniformLocation
- * @see javax.media.opengl.GL2ES2#glGetUniformLocation
- * @see javax.media.opengl.GL2ES2#glUniform
+ * @see com.jogamp.opengl.GL2ES2#glGetUniformLocation
+ * @see com.jogamp.opengl.GL2ES2#glUniform
* @see #getUniformLocation
* @see ShaderProgram#glReplaceShader
*/
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
index 06f7d9268..165a5167a 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java
@@ -37,7 +37,7 @@ import java.io.PrintStream;
import java.nio.*;
import java.util.*;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
import com.jogamp.common.nio.Buffers;
import com.jogamp.opengl.GLExtensions;
@@ -221,7 +221,7 @@ public class ShaderUtil {
/** Returns true if GeometryShader is supported, i.e. whether GLContext is &ge; 3.2 or ARB_geometry_shader4 extension is available. */
public static boolean isGeometryShaderSupported(final GL _gl) {
final GLContext ctx = _gl.getContext();
- return ctx.getGLVersionNumber().compareTo(GLContext.Version320) >= 0 ||
+ return ctx.getGLVersionNumber().compareTo(GLContext.Version3_2) >= 0 ||
ctx.isExtensionAvailable(GLExtensions.ARB_geometry_shader4);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java
index 1ed875f27..37bca895a 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java
@@ -4,12 +4,12 @@
package com.jogamp.opengl.util.glsl.fixedfunc;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES1;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLException;
-import javax.media.opengl.fixedfunc.GLPointerFuncUtil;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES1;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.fixedfunc.GLPointerFuncUtil;
import jogamp.opengl.util.glsl.fixedfunc.FixedFuncHook;
import jogamp.opengl.util.glsl.fixedfunc.FixedFuncImpl;
@@ -77,18 +77,18 @@ public class FixedFuncUtil {
* Useful for uniq mapping of canonical array index names as listed.
*
* @see #mgl_Vertex
- * @see javax.media.opengl.fixedfunc.GLPointerFunc#GL_VERTEX_ARRAY
+ * @see com.jogamp.opengl.fixedfunc.GLPointerFunc#GL_VERTEX_ARRAY
* @see #mgl_Normal
- * @see javax.media.opengl.fixedfunc.GLPointerFunc#GL_NORMAL_ARRAY
+ * @see com.jogamp.opengl.fixedfunc.GLPointerFunc#GL_NORMAL_ARRAY
* @see #mgl_Color
- * @see javax.media.opengl.fixedfunc.GLPointerFunc#GL_COLOR_ARRAY
+ * @see com.jogamp.opengl.fixedfunc.GLPointerFunc#GL_COLOR_ARRAY
* @see #mgl_MultiTexCoord
- * @see javax.media.opengl.fixedfunc.GLPointerFunc#GL_TEXTURE_COORD_ARRAY
- * @see javax.media.opengl.fixedfunc.GLPointerFunc#glEnableClientState
- * @see javax.media.opengl.fixedfunc.GLPointerFunc#glVertexPointer
- * @see javax.media.opengl.fixedfunc.GLPointerFunc#glColorPointer
- * @see javax.media.opengl.fixedfunc.GLPointerFunc#glNormalPointer
- * @see javax.media.opengl.fixedfunc.GLPointerFunc#glTexCoordPointer
+ * @see com.jogamp.opengl.fixedfunc.GLPointerFunc#GL_TEXTURE_COORD_ARRAY
+ * @see com.jogamp.opengl.fixedfunc.GLPointerFunc#glEnableClientState
+ * @see com.jogamp.opengl.fixedfunc.GLPointerFunc#glVertexPointer
+ * @see com.jogamp.opengl.fixedfunc.GLPointerFunc#glColorPointer
+ * @see com.jogamp.opengl.fixedfunc.GLPointerFunc#glNormalPointer
+ * @see com.jogamp.opengl.fixedfunc.GLPointerFunc#glTexCoordPointer
*/
public static String getPredefinedArrayIndexName(final int glArrayIndex) {
return GLPointerFuncUtil.getPredefinedArrayIndexName(glArrayIndex);
@@ -96,25 +96,25 @@ public class FixedFuncUtil {
/**
* String name for
- * @see javax.media.opengl.GL2#GL_VERTEX_ARRAY
+ * @see com.jogamp.opengl.GL2#GL_VERTEX_ARRAY
*/
public static final String mgl_Vertex = GLPointerFuncUtil.mgl_Vertex;
/**
* String name for
- * @see javax.media.opengl.GL2#GL_NORMAL_ARRAY
+ * @see com.jogamp.opengl.GL2#GL_NORMAL_ARRAY
*/
public static final String mgl_Normal = GLPointerFuncUtil.mgl_Normal;
/**
* String name for
- * @see javax.media.opengl.GL2#GL_COLOR_ARRAY
+ * @see com.jogamp.opengl.GL2#GL_COLOR_ARRAY
*/
public static final String mgl_Color = GLPointerFuncUtil.mgl_Color;
/**
* String name for
- * @see javax.media.opengl.GL2#GL_TEXTURE_COORD_ARRAY
+ * @see com.jogamp.opengl.GL2#GL_TEXTURE_COORD_ARRAY
*/
public static final String mgl_MultiTexCoord = GLPointerFuncUtil.mgl_MultiTexCoord;
}
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java
index 1d629131e..f5dec1cab 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java
@@ -2,7 +2,7 @@ package com.jogamp.opengl.util.glsl.sdk;
import com.jogamp.common.util.IOUtil;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
import com.jogamp.opengl.util.glsl.*;
import java.io.*;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShaderNVidia.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShaderNVidia.java
index 9ff37c7ee..ae289acf7 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShaderNVidia.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShaderNVidia.java
@@ -1,6 +1,6 @@
package com.jogamp.opengl.util.glsl.sdk;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
import java.io.*;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoClientRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoClientRenderer.java
index f70ebf928..fad07b026 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoClientRenderer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoClientRenderer.java
@@ -27,12 +27,12 @@
*/
package com.jogamp.opengl.util.stereo;
-import javax.media.nativewindow.util.DimensionImmutable;
-import javax.media.nativewindow.util.RectangleImmutable;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLEventListener;
+import com.jogamp.nativewindow.util.DimensionImmutable;
+import com.jogamp.nativewindow.util.RectangleImmutable;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLEventListener;
import jogamp.opengl.GLDrawableHelper;
import jogamp.opengl.GLDrawableHelper.GLEventListenerAction;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDevice.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDevice.java
index d32c981a3..302e783a2 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDevice.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDevice.java
@@ -27,8 +27,8 @@
*/
package com.jogamp.opengl.util.stereo;
-import javax.media.nativewindow.util.DimensionImmutable;
-import javax.media.nativewindow.util.PointImmutable;
+import com.jogamp.nativewindow.util.DimensionImmutable;
+import com.jogamp.nativewindow.util.PointImmutable;
import jogamp.opengl.Debug;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDeviceRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDeviceRenderer.java
index ab9ba99a1..68ae3241b 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDeviceRenderer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoDeviceRenderer.java
@@ -27,9 +27,9 @@
*/
package com.jogamp.opengl.util.stereo;
-import javax.media.nativewindow.util.DimensionImmutable;
-import javax.media.nativewindow.util.RectangleImmutable;
-import javax.media.opengl.GL;
+import com.jogamp.nativewindow.util.DimensionImmutable;
+import com.jogamp.nativewindow.util.RectangleImmutable;
+import com.jogamp.opengl.GL;
import com.jogamp.opengl.math.FovHVHalves;
@@ -45,8 +45,8 @@ import com.jogamp.opengl.math.FovHVHalves;
* <li>device.{@link #updateEyePose(int)}</li>
* <li>if device.{@link #ppAvailable()}: Set the render target, e.g. FBO</li>
* <li>Set the viewport using {@link Eye#getViewport()}</li>
- * <li>{@link StereoGLEventListener#reshapeForEye(javax.media.opengl.GLAutoDrawable, int, int, int, int, EyeParameter, EyePose) upstream.reshapeEye(..)}</li>
- * <li>{@link StereoGLEventListener#display(javax.media.opengl.GLAutoDrawable, int) upstream.display(..)}.</li>
+ * <li>{@link StereoGLEventListener#reshapeForEye(com.jogamp.opengl.GLAutoDrawable, int, int, int, int, EyeParameter, EyePose) upstream.reshapeEye(..)}</li>
+ * <li>{@link StereoGLEventListener#display(com.jogamp.opengl.GLAutoDrawable, int) upstream.display(..)}.</li>
* </ul></li>
* <li>Reset the viewport</li>
* <li>If device.{@link #ppAvailable()}:<ul>
diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoGLEventListener.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoGLEventListener.java
index ec580cbf9..c1a06796c 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoGLEventListener.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoGLEventListener.java
@@ -27,8 +27,8 @@
*/
package com.jogamp.opengl.util.stereo;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLEventListener;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLEventListener;
import com.jogamp.opengl.math.FloatUtil;
import com.jogamp.opengl.util.CustomGLEventListener;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoUtil.java b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoUtil.java
index 3031013b8..3e4e7ccd9 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoUtil.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/stereo/StereoUtil.java
@@ -75,7 +75,7 @@ public class StereoUtil {
* <p>
* This method merely exist as an example implementation to compute the matrices,
* which shall be adopted by the
- * {@link CustomGLEventListener#reshape(javax.media.opengl.GLAutoDrawable, int, int, int, int, EyeParameter, EyePose) upstream client code}.
+ * {@link CustomGLEventListener#reshape(com.jogamp.opengl.GLAutoDrawable, int, int, int, int, EyeParameter, EyePose) upstream client code}.
* </p>
* @param eyeNum eye denominator
* @param zNear frustum near value
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java b/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java
index f5ef5672f..0f51c2e14 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java
@@ -32,9 +32,9 @@ import java.net.URLConnection;
import java.util.ArrayList;
import java.util.List;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import com.jogamp.common.util.IOUtil;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
index e7693f4a6..18a7527b6 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java
@@ -39,9 +39,9 @@ package com.jogamp.opengl.util.texture;
import java.nio.*;
-import javax.media.opengl.*;
-import javax.media.opengl.glu.*;
-import javax.media.nativewindow.NativeWindowFactory;
+import com.jogamp.opengl.*;
+import com.jogamp.opengl.glu.*;
+import com.jogamp.nativewindow.NativeWindowFactory;
import jogamp.opengl.*;
@@ -346,8 +346,8 @@ public class Texture {
* Returns the OpenGL "target" of this texture.
*
* @return the OpenGL target of this texture
- * @see javax.media.opengl.GL#GL_TEXTURE_2D
- * @see javax.media.opengl.GL2#GL_TEXTURE_RECTANGLE_ARB
+ * @see com.jogamp.opengl.GL#GL_TEXTURE_2D
+ * @see com.jogamp.opengl.GL2#GL_TEXTURE_RECTANGLE_ARB
*/
public int getTarget() {
return target;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java
index 5b2e4fc00..ce1acc6d7 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java
@@ -39,7 +39,7 @@ package com.jogamp.opengl.util.texture;
import java.nio.Buffer;
-import javax.media.opengl.GLProfile;
+import com.jogamp.opengl.GLProfile;
import com.jogamp.common.nio.Buffers;
import com.jogamp.opengl.util.GLBuffers;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java
index 6011afe7b..27571ae0d 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java
@@ -55,15 +55,15 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import javax.media.nativewindow.util.Dimension;
-import javax.media.nativewindow.util.DimensionImmutable;
-import javax.media.nativewindow.util.PixelFormat;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2;
-import javax.media.opengl.GL2GL3;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.util.Dimension;
+import com.jogamp.nativewindow.util.DimensionImmutable;
+import com.jogamp.nativewindow.util.PixelFormat;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2;
+import com.jogamp.opengl.GL2GL3;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import jogamp.opengl.Debug;
@@ -1125,12 +1125,12 @@ public class TextureIO {
final String fileSuffix) throws IOException {
if (PNG.equals(fileSuffix)) {
final PNGPixelRect image = PNGPixelRect.read(stream, null, true /* directBuffer */, 0 /* destMinStrideInBytes */, true /* destIsGLOriented */);
- final GLPixelAttributes glpa = GLPixelAttributes.convert(image.getPixelformat(), glp);
+ final GLPixelAttributes glpa = new GLPixelAttributes(glp, image.getPixelformat(), false /* pack */);
if ( 0 == pixelFormat ) {
pixelFormat = glpa.format;
} // else FIXME: Actually not supported w/ preset pixelFormat!
if ( 0 == internalFormat ) {
- final boolean hasAlpha = 4 == glpa.bytesPerPixel;
+ final boolean hasAlpha = 4 == glpa.pfmt.comp.bytesPerPixel();
if(glp.isGL2ES3()) {
internalFormat = hasAlpha ? GL.GL_RGBA8 : GL.GL_RGB8;
} else {
@@ -1351,8 +1351,8 @@ public class TextureIO {
final GLPixelAttributes pixelAttribs = data.getPixelAttributes();
final int pixelFormat = pixelAttribs.format;
final int pixelType = pixelAttribs.type;
- final int bytesPerPixel = pixelAttribs.bytesPerPixel;
- final PixelFormat pixFmt = pixelAttribs.getPixelFormat();
+ final int bytesPerPixel = pixelAttribs.pfmt.comp.bytesPerPixel();
+ final PixelFormat pixFmt = pixelAttribs.pfmt;
if ( ( 1 == bytesPerPixel || 3 == bytesPerPixel || 4 == bytesPerPixel) &&
( pixelType == GL.GL_BYTE || pixelType == GL.GL_UNSIGNED_BYTE)) {
Buffer buf0 = data.getBuffer();
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java
index 5add4f695..7147fd61b 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java
@@ -27,10 +27,10 @@
*/
package com.jogamp.opengl.util.texture;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLRunnable;
-import javax.media.opengl.GLEventListener;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLRunnable;
+import com.jogamp.opengl.GLEventListener;
import com.jogamp.opengl.util.TimeFrameI;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java
index 467ab41c5..1866c5921 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java
@@ -27,11 +27,11 @@
*/
package com.jogamp.opengl.util.texture;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GL2GL3;
-import javax.media.opengl.GL3;
-import javax.media.opengl.GLException;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GL2GL3;
+import com.jogamp.opengl.GL3;
+import com.jogamp.opengl.GLException;
/**
* Preserves a [ texture-unit, texture-target ] state.
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java
index ccb3ecc3c..aa0be8e9b 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java
@@ -60,11 +60,11 @@ import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2;
-import javax.media.opengl.GL2GL3;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2;
+import com.jogamp.opengl.GL2GL3;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes;
import com.jogamp.opengl.util.texture.TextureData;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java
index c3b3adc75..2b21ef8e4 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java
@@ -41,7 +41,7 @@ package com.jogamp.opengl.util.texture.awt;
import java.awt.image.*;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
import com.jogamp.opengl.util.texture.*;
public class AWTTextureIO extends TextureIO {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java
index 20fc92819..a71458837 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java
@@ -50,7 +50,7 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.channels.FileChannel;
-import javax.media.opengl.GL;
+import com.jogamp.opengl.GL;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.util.IOUtil;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java
index 66a486f9b..0d82528a2 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java
@@ -31,7 +31,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
-import javax.media.opengl.GL;
+import com.jogamp.opengl.GL;
import jogamp.opengl.Debug;
import jogamp.opengl.util.jpeg.JPEGDecoder;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java
index 461ddceb8..700de593f 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java
@@ -43,7 +43,7 @@ import java.io.*;
import java.nio.*;
import java.nio.channels.FileChannel;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
import com.jogamp.common.util.IOUtil;
import com.jogamp.opengl.util.texture.*;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java
index 27549dfe3..9088dc48e 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java
@@ -40,7 +40,7 @@
package com.jogamp.opengl.util.texture.spi;
import java.io.*;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
import com.jogamp.common.util.IOUtil;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java
index 28823abb3..bb872714c 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java
@@ -42,7 +42,7 @@ package com.jogamp.opengl.util.texture.spi;
import java.io.*;
import java.nio.*;
import java.nio.channels.*;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
import com.jogamp.common.util.IOUtil;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java
index 0299531b1..e84f300e2 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TextureProvider.java
@@ -41,7 +41,7 @@ package com.jogamp.opengl.util.texture.spi;
import java.io.*;
import java.net.*;
-import javax.media.opengl.GLProfile;
+import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.util.texture.*;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java
index 4174adf52..ba762baf3 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureProvider.java
@@ -44,7 +44,7 @@ import java.awt.image.*;
import java.io.*;
import java.net.*;
import javax.imageio.*;
-import javax.media.opengl.GLProfile;
+import com.jogamp.opengl.GLProfile;
import jogamp.opengl.Debug;
import com.jogamp.opengl.util.texture.*;
diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java
index 60ac5680e..35a2f8422 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/awt/IIOTextureWriter.java
@@ -45,7 +45,7 @@ import java.io.*;
import java.nio.*;
import javax.imageio.*;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
import com.jogamp.common.util.IOUtil;
import com.jogamp.opengl.util.awt.*;
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
index fbd40ebdd..3010fa5ff 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java
@@ -29,9 +29,9 @@ package jogamp.graph.curve.opengl;
import java.nio.FloatBuffer;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLUniformData;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLUniformData;
import jogamp.graph.curve.opengl.shader.AttributeNames;
import jogamp.graph.curve.opengl.shader.UniformNames;
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
index 8f1de9157..092cc55c1 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java
@@ -29,9 +29,9 @@ package jogamp.graph.curve.opengl;
import java.nio.FloatBuffer;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLUniformData;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLUniformData;
import jogamp.graph.curve.opengl.shader.AttributeNames;
import jogamp.graph.curve.opengl.shader.UniformNames;
diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
index 46e991866..a8e74aed5 100644
--- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
+++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java
@@ -29,9 +29,9 @@ package jogamp.graph.curve.opengl;
import java.nio.FloatBuffer;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLUniformData;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLUniformData;
import jogamp.graph.curve.opengl.shader.AttributeNames;
import jogamp.graph.curve.opengl.shader.UniformNames;
diff --git a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java
index da651cca9..68586dfc5 100644
--- a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java
+++ b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java
@@ -35,7 +35,7 @@ import java.io.InputStream;
import java.security.AccessController;
import java.security.PrivilegedAction;
-import javax.media.opengl.GLException;
+import com.jogamp.opengl.GLException;
import com.jogamp.common.util.IntObjectHashMap;
import com.jogamp.graph.font.Font;
diff --git a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java
index bbf022657..e4b0cb2a8 100644
--- a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java
+++ b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java
@@ -29,9 +29,11 @@ package jogamp.graph.font;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URLConnection;
import com.jogamp.common.net.Uri;
import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.IOUtil;
import com.jogamp.common.util.IntObjectHashMap;
import com.jogamp.common.util.JarUtil;
import com.jogamp.common.util.cache.TempJarCache;
@@ -170,20 +172,26 @@ public class UbuntuFontLoader implements FontSet {
}
}
private Font abspathImpl(final String fname, final int family, final int style) throws IOException {
- final Exception[] privErr = { null };
- final InputStream stream = AccessController.doPrivileged(new PrivilegedAction<InputStream>() {
- @Override
- public InputStream run() {
- try {
- final Uri uri = TempJarCache.getResourceUri(fname);
- return null != uri ? uri.toURL().openConnection().getInputStream() : null;
- } catch (final Exception e) {
- privErr[0] = e;
- return null;
- }
- } } );
- if( null != privErr[0] ) {
- throw new IOException(privErr[0]);
+ final InputStream stream;
+ if( useTempJARCache ) {
+ final Exception[] privErr = { null };
+ stream = AccessController.doPrivileged(new PrivilegedAction<InputStream>() {
+ @Override
+ public InputStream run() {
+ try {
+ final Uri uri = TempJarCache.getResourceUri(fname);
+ return null != uri ? uri.toURL().openConnection().getInputStream() : null;
+ } catch (final Exception e) {
+ privErr[0] = e;
+ return null;
+ }
+ } } );
+ if( null != privErr[0] ) {
+ throw new IOException(privErr[0]);
+ }
+ } else {
+ final URLConnection urlConn = IOUtil.getResource(UbuntuFontLoader.class, fname);
+ stream = null != urlConn ? urlConn.getInputStream() : null;
}
if(null != stream) {
final Font f= FontFactory.get ( stream, true ) ;
diff --git a/src/jogl/classes/jogamp/opengl/Debug.java b/src/jogl/classes/jogamp/opengl/Debug.java
index 5bee56d4b..5273eead7 100644
--- a/src/jogl/classes/jogamp/opengl/Debug.java
+++ b/src/jogl/classes/jogamp/opengl/Debug.java
@@ -51,7 +51,7 @@ public class Debug extends PropertyAccess {
verbose = isPropertyDefined("jogl.verbose", true);
debugAll = isPropertyDefined("jogl.debug", true);
if (verbose) {
- final Package p = Package.getPackage("javax.media.opengl");
+ final Package p = Package.getPackage("com.jogamp.opengl");
System.err.println("JOGL specification version " + p.getSpecificationVersion());
System.err.println("JOGL implementation version " + p.getImplementationVersion());
System.err.println("JOGL implementation vendor " + p.getImplementationVendor());
diff --git a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
index 1b33e1a8b..331414869 100644
--- a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
+++ b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java
@@ -43,10 +43,10 @@ package jogamp.opengl;
import java.util.HashMap;
import java.util.StringTokenizer;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES3;
-import javax.media.opengl.GL2GL3;
-import javax.media.opengl.GLContext;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES3;
+import com.jogamp.opengl.GL2GL3;
+import com.jogamp.opengl.GLContext;
import com.jogamp.common.util.VersionNumber;
diff --git a/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java b/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java
index d7ac6eb1e..7f8f262e9 100644
--- a/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java
+++ b/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java
@@ -30,7 +30,7 @@ package jogamp.opengl;
import java.io.PrintStream;
import java.util.concurrent.TimeUnit;
-import javax.media.opengl.FPSCounter;
+import com.jogamp.opengl.FPSCounter;
/**
* Default implementation of FPSCounter to be used for FPSCounter implementing renderer.
diff --git a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
index 8fa4c581a..19fd6c7e1 100644
--- a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
+++ b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
@@ -31,24 +31,24 @@ package jogamp.opengl;
import java.io.PrintStream;
import java.util.List;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.WindowClosingProtocol;
-import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode;
-import javax.media.opengl.FPSCounter;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLAnimatorControl;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLOffscreenAutoDrawable;
-import javax.media.opengl.GLProfile;
-import javax.media.opengl.GLRunnable;
-import javax.media.opengl.GLSharedContextSetter;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.WindowClosingProtocol;
+import com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode;
+import com.jogamp.opengl.FPSCounter;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLAnimatorControl;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLOffscreenAutoDrawable;
+import com.jogamp.opengl.GLProfile;
+import com.jogamp.opengl.GLRunnable;
+import com.jogamp.opengl.GLSharedContextSetter;
import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.util.locks.RecursiveLock;
diff --git a/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java
index 7e49b3464..2fa282d6e 100644
--- a/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java
+++ b/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java
@@ -32,8 +32,9 @@ import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.util.IntObjectHashMap;
import com.jogamp.common.util.PropertyAccess;
@@ -266,7 +267,7 @@ public class GLBufferObjectTracker {
if( null == objOld ) {
if (DEBUG) {
System.err.printf("%s: %s.notifyBuffersDeleted()[%d/%d]: Buffer %d not tracked%n", warning, msgClazzName, i+1, count, bufferName);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return;
}
@@ -409,7 +410,7 @@ public class GLBufferObjectTracker {
if ( 0 == addr ) {
if( DEBUG ) {
System.err.printf("%s.%s: %s MapBuffer null result for target 0x%X -> %d: %s, off %d, len %d, acc 0x%X%n", msgClazzName, msgMapBuffer, warning, target, bufferName, store, offset, length, access);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
// User shall handle the glError !
} else {
@@ -442,14 +443,14 @@ public class GLBufferObjectTracker {
if( 0 == bufferName ) {
if (DEBUG) {
System.err.printf("%s: %s.%s: Buffer for target 0x%X not bound%n", warning, msgClazzName, msgUnmapped, target);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
store = null;
} else {
store = (GLBufferStorageImpl) bufferName2StorageMap.get(bufferName);
if( DEBUG && null == store ) {
System.err.printf("%s: %s.%s: Buffer %d not tracked%n", warning, msgClazzName, msgUnmapped, bufferName);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
final boolean res = dispatch.unmap(target, glProcAddress);
@@ -459,7 +460,7 @@ public class GLBufferObjectTracker {
if( DEBUG ) {
System.err.printf("%s.%s %s target: 0x%X -> %d: %s%n", msgClazzName, msgUnmapped, res ? "OK" : "Failed", target, bufferName, store.toString(false));
if(!res) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
return res;
@@ -476,7 +477,7 @@ public class GLBufferObjectTracker {
final GLBufferStorageImpl store = (GLBufferStorageImpl) bufferName2StorageMap.get(bufferName);
if (DEBUG && null == store ) {
System.err.printf("%s: %s.%s: Buffer %d not tracked%n", warning, msgClazzName, msgUnmapped, bufferName);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
final boolean res = dispatch.unmap(bufferName, glProcAddress);
if( res && null != store ) {
@@ -485,7 +486,7 @@ public class GLBufferObjectTracker {
if (DEBUG) {
System.err.printf("%s.%s %s %d: %s%n", msgClazzName, msgUnmapped, res ? "OK" : "Failed", bufferName, store.toString(false));
if(!res) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
return res;
@@ -505,7 +506,7 @@ public class GLBufferObjectTracker {
public synchronized final void clear() {
if (DEBUG) {
System.err.printf("%s.clear() - Thread %s%n", msgClazzName, Thread.currentThread().getName());
- // Thread.dumpStack();
+ // ExceptionUtils.dumpStackTrace(System.err);
}
bufferName2StorageMap.clear();
}
diff --git a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java
index 825ad0554..0742f7b05 100644
--- a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java
+++ b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java
@@ -40,7 +40,7 @@
package jogamp.opengl;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
import com.jogamp.common.util.IntIntHashMap;
import com.jogamp.common.util.PropertyAccess;
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index a44075e90..1ff64725a 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -48,6 +48,7 @@ import java.security.PrivilegedAction;
import java.util.HashMap;
import java.util.Map;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.os.DynamicLookupHelper;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.ReflectionUtil;
@@ -60,23 +61,24 @@ import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver;
import com.jogamp.opengl.GLExtensions;
import com.jogamp.opengl.GLRendererQuirks;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GL2ES3;
-import javax.media.opengl.GL2GL3;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDebugListener;
-import javax.media.opengl.GLDebugMessage;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLPipelineFactory;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.nativewindow.ProxySurface;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GL2ES3;
+import com.jogamp.opengl.GL2GL3;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDebugListener;
+import com.jogamp.opengl.GLDebugMessage;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLPipelineFactory;
+import com.jogamp.opengl.GLProfile;
public abstract class GLContextImpl extends GLContext {
/**
@@ -98,6 +100,9 @@ public abstract class GLContextImpl extends GLContext {
private String glRenderer;
private String glRendererLowerCase;
private String glVersion;
+ private boolean glGetPtrInit = false;
+ private long glGetStringPtr = 0;
+ private long glGetIntegervPtr = 0;
// Tracks lifecycle of buffer objects to avoid
// repeated glGet calls upon glMapBuffer operations
@@ -118,6 +123,12 @@ public abstract class GLContextImpl extends GLContext {
protected GLDrawableImpl drawable;
protected GLDrawableImpl drawableRead;
+ /**
+ * If GL >= 3.0 (ES or desktop) and not having {@link GLRendererQuirks#NoSurfacelessCtx},
+ * being evaluated if not surface-handle is null and not yet set at makeCurrent(..).
+ */
+ private boolean surfacelessOK = false;
+
private boolean pixelDataEvaluated;
private int /* pixelDataInternalFormat, */ pixelDataFormat, pixelDataType;
@@ -188,12 +199,16 @@ public abstract class GLContextImpl extends GLContext {
glRenderer = glVendor;
glRendererLowerCase = glRenderer;
glVersion = glVendor;
+ glGetPtrInit = false;
+ glGetStringPtr = 0;
+ glGetIntegervPtr = 0;
if ( !isInit && null != boundFBOTarget ) { // <init>: boundFBOTarget is not written yet
boundFBOTarget[0] = 0; // draw
boundFBOTarget[1] = 0; // read
}
+ surfacelessOK = false;
pixelDataEvaluated = false;
super.resetStates(isInit);
@@ -245,8 +260,9 @@ public abstract class GLContextImpl extends GLContext {
if( drawable == readWrite && ( setWriteOnly || drawableRead == readWrite ) ) {
return drawable; // no change.
}
- final GLDrawableImpl old = drawable;
- if( isCreated() && null != old && old.isRealized() ) {
+ final GLDrawableImpl oldDrawableWrite = drawable;
+ final GLDrawableImpl oldDrawableRead = drawableRead;
+ if( isCreated() && null != oldDrawableWrite && oldDrawableWrite.isRealized() ) {
if(!lockHeld) {
makeCurrent();
}
@@ -266,12 +282,36 @@ public abstract class GLContextImpl extends GLContext {
drawableRetargeted |= null != drawable && readWrite != drawable;
drawable = (GLDrawableImpl) readWrite ;
if( isCreated() && null != drawable && drawable.isRealized() ) {
- makeCurrent(true); // implicit: associateDrawable(true)
+ int res = CONTEXT_NOT_CURRENT;
+ Throwable gle = null;
+ try {
+ res = makeCurrent(true); // implicit: associateDrawable(true)
+ } catch ( final Throwable t ) {
+ gle = t;
+ } finally {
+ if( CONTEXT_NOT_CURRENT == res ) {
+ // Failure, recover and bail out w/ GLException
+ drawableRead = oldDrawableRead;
+ drawable = oldDrawableWrite;
+ if( drawable.isRealized() ) {
+ makeCurrent(true); // implicit: associateDrawable(true)
+ }
+ if( !lockHeld ) {
+ release(false);
+ }
+ final String msg = "Error: makeCurrent() failed with new drawable "+readWrite;
+ if( null != gle ) {
+ throw new GLException(msg, gle);
+ } else {
+ throw new GLException(msg);
+ }
+ }
+ }
if( !lockHeld ) {
release(false);
}
}
- return old;
+ return oldDrawableWrite;
}
@Override
@@ -305,7 +345,7 @@ public abstract class GLContextImpl extends GLContext {
final String sgl1 = (null!=this.gl)?this.gl.getClass().getSimpleName()+", "+this.gl.toString():"<null>";
final String sgl2 = (null!=gl)?gl.getClass().getSimpleName()+", "+gl.toString():"<null>";
System.err.println("Info: setGL (OpenGL "+getGLVersion()+"): "+getThreadName()+", "+sgl1+" -> "+sgl2);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
this.gl = gl;
return gl;
@@ -383,7 +423,7 @@ public abstract class GLContextImpl extends GLContext {
lastCtxReleaseStack = new Throwable(msg);
if( TRACE_SWITCH ) {
System.err.println(msg);
- // Thread.dumpStack();
+ // ExceptionUtils.dumpStackTrace(System.err, 0, 10);
}
}
}
@@ -419,7 +459,7 @@ public abstract class GLContextImpl extends GLContext {
if ( DEBUG_TRACE_SWITCH ) {
if ( lock.getHoldCount() > 2 ) {
System.err.println(getThreadName() + ": GLContextImpl.destroy: Lock was hold more than once - makeCurrent/release imbalance: "+getTraceSwitchMsg());
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
try {
@@ -497,6 +537,8 @@ public abstract class GLContextImpl extends GLContext {
//----------------------------------------------------------------------
//
+ protected final boolean isSurfacelessOK() { return surfacelessOK; }
+
/**
* {@inheritDoc}
* <p>
@@ -564,11 +606,23 @@ public abstract class GLContextImpl extends GLContext {
int res = CONTEXT_NOT_CURRENT;
try {
if ( drawable.isRealized() ) {
- if ( 0 == drawable.getHandle() ) {
- throw new GLException("drawable has invalid handle: "+drawable);
- }
lock.lock();
try {
+ if ( 0 == drawable.getHandle() && !surfacelessOK ) {
+ if( DEBUG ) {
+ System.err.println(getThreadName() +": GLContext.makeCurrent: Surfaceless evaluate");
+ }
+ if( hasRendererQuirk(GLRendererQuirks.NoSurfacelessCtx) ) {
+ throw new GLException(String.format("Surfaceless not supported due to quirk %s: %s",
+ GLRendererQuirks.toString(GLRendererQuirks.NoSurfacelessCtx), toString()));
+ }
+ // Allow probing if ProxySurface && OPT_UPSTREAM_SURFACELESS
+ final NativeSurface surface = drawable.getNativeSurface();
+ if( !(surface instanceof ProxySurface) ||
+ !((ProxySurface)surface).containsUpstreamOptionBits( ProxySurface.OPT_UPSTREAM_SURFACELESS ) ) {
+ throw new GLException(String.format("non-surfaceless drawable has zero-handle: %s", drawable.toString()));
+ }
+ }
// One context can only be current by one thread,
// and one thread can only have one context current!
final GLContext current = getCurrent();
@@ -617,9 +671,19 @@ public abstract class GLContextImpl extends GLContext {
}
}
- if (res != CONTEXT_NOT_CURRENT) { // still locked!
+ if ( CONTEXT_NOT_CURRENT != res ) { // still locked!
+ if( 0 == drawable.getHandle() && !surfacelessOK ) {
+ if( hasRendererQuirk(GLRendererQuirks.NoSurfacelessCtx) ) {
+ throw new GLException(String.format("Surfaceless not supported due to quirk %s: %s",
+ GLRendererQuirks.toString(GLRendererQuirks.NoSurfacelessCtx), toString()));
+ }
+ if( DEBUG ) {
+ System.err.println(getThreadName() +": GLContext.makeCurrent: Surfaceless OK - validated");
+ }
+ surfacelessOK = true;
+ }
setCurrent(this);
- if(res == CONTEXT_CURRENT_NEW) {
+ if( CONTEXT_CURRENT_NEW == res ) {
// check if the drawable's and the GL's GLProfile are equal
// throws an GLException if not
drawable.getGLProfile().verifyEquality(gl.getGLProfile());
@@ -627,13 +691,13 @@ public abstract class GLContextImpl extends GLContext {
glDebugHandler.init( isGL2GL3() && isGLDebugEnabled() );
if(DEBUG_GL) {
- setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) );
+ setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", null, gl, null) );
if(glDebugHandler.isEnabled()) {
glDebugHandler.addListener(new GLDebugMessageHandler.StdErrGLDebugListener(true));
}
}
if(TRACE_GL) {
- setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, gl, new Object[] { System.err } ) );
+ setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", null, gl, new Object[] { System.err } ) );
}
forceDrawableAssociation = true;
@@ -698,12 +762,10 @@ public abstract class GLContextImpl extends GLContext {
if( created && hasNoDefaultVAO() ) {
final int[] tmp = new int[1];
final GL rootGL = gl.getRootGL();
- if( rootGL.isGL2ES3() ) { // FIXME remove if ES2 == ES3 later
- final GL2ES3 gl2es3 = rootGL.getGL2ES3();
- gl2es3.glGenVertexArrays(1, tmp, 0);
- defaultVAO = tmp[0];
- gl2es3.glBindVertexArray(defaultVAO);
- }
+ final GL2ES3 gl2es3 = rootGL.getGL2ES3();
+ gl2es3.glGenVertexArrays(1, tmp, 0);
+ defaultVAO = tmp[0];
+ gl2es3.glBindVertexArray(defaultVAO);
}
} finally {
if ( null != sharedMaster ) {
@@ -712,7 +774,7 @@ public abstract class GLContextImpl extends GLContext {
}
if ( DEBUG_TRACE_SWITCH ) {
System.err.println(getThreadName() + ": Create GL context "+(created?"OK":"FAILED")+": For " + getClass().getName()+" - "+getGLVersion()+" - "+getTraceSwitchMsg());
- // Thread.dumpStack();
+ // ExceptionUtils.dumpStackTrace(System.err, 0, 10);
}
if(!created) {
return CONTEXT_NOT_CURRENT;
@@ -728,7 +790,7 @@ public abstract class GLContextImpl extends GLContext {
if( 0 == ( ctxOptions & GLContext.CTX_PROFILE_ES) ) { // not ES profile
final int reqMajor;
final int reqProfile;
- if( ctxVersion.compareTo(Version300) <= 0 ) {
+ if( ctxVersion.compareTo(Version3_0) <= 0 ) {
reqMajor = 2;
} else {
reqMajor = ctxVersion.getMajor();
@@ -759,7 +821,7 @@ public abstract class GLContextImpl extends GLContext {
GLContext.mapAvailableGLVersion(device, 3, reqProfile, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
}
}
- GLContext.setAvailableGLVersionsSet(device);
+ GLContext.setAvailableGLVersionsSet(device, true);
if (DEBUG) {
System.err.println(getThreadName() + ": createContextOLD-MapVersionsAvailable HAVE: " + device+" -> "+reqMajor+"."+reqProfile+ " -> "+getGLVersion());
@@ -868,7 +930,15 @@ public abstract class GLContextImpl extends GLContext {
*/
protected final long createContextARB(final long share, final boolean direct)
{
- if( GLProfile.disableOpenGLARBContext ) {
+ if( GLProfile.disableOpenGLARBContext ||
+ GLRendererQuirks.existStickyDeviceQuirk(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(),
+ GLRendererQuirks.NoARBCreateContext) ) {
+ if( DEBUG ) {
+ System.err.println(getThreadName() + ": createContextARB: Disabled "+
+ "- property disableOpenGLARBContext "+ GLProfile.disableOpenGLARBContext +
+ ", quirk NoARBCreateContext "+GLRendererQuirks.existStickyDeviceQuirk(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(),
+ GLRendererQuirks.NoARBCreateContext));
+ }
return 0;
}
final AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration();
@@ -879,19 +949,21 @@ public abstract class GLContextImpl extends GLContext {
GLContext.getAvailableGLVersionsSet(device));
}
+ final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
+ final GLProfile glp = glCaps.getGLProfile();
+
if ( !GLContext.getAvailableGLVersionsSet(device) ) {
- if(!mapGLVersions(device)) {
+ if( !mapGLVersions(device) ) {
// none of the ARB context creation calls was successful, bail out
return 0;
}
}
- final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
final int[] reqMajorCTP = new int[] { 0, 0 };
- GLContext.getRequestMajorAndCompat(glCaps.getGLProfile(), reqMajorCTP);
+ GLContext.getRequestMajorAndCompat(glp, reqMajorCTP);
if(DEBUG) {
- System.err.println(getThreadName() + ": createContextARB: Requested "+GLContext.getGLVersion(reqMajorCTP[0], 0, reqMajorCTP[0], null));
+ System.err.println(getThreadName() + ": createContextARB: Requested "+glp+" -> "+GLContext.getGLVersion(reqMajorCTP[0], 0, reqMajorCTP[1], null));
}
final int _major[] = { 0 };
final int _minor[] = { 0 };
@@ -1023,7 +1095,7 @@ public abstract class GLContextImpl extends GLContext {
}
if(success) {
// only claim GL versions set [and hence detected] if ARB context creation was successful
- GLContext.setAvailableGLVersionsSet(device);
+ GLContext.setAvailableGLVersionsSet(device, true);
if(DEBUG) {
final long t1 = System.nanoTime();
System.err.println("GLContextImpl.mapGLVersions: "+device+", profileAliasing: "+PROFILE_ALIASING+", total "+(t1-t0)/1e6 +"ms");
@@ -1051,17 +1123,23 @@ public abstract class GLContextImpl extends GLContext {
int majorMin, minorMin;
final int major[] = new int[1];
final int minor[] = new int[1];
- if( 4 == reqMajor ) {
- majorMax=4; minorMax=GLContext.getMaxMinor(ctp, majorMax);
- majorMin=4; minorMin=0;
- } else if( 3 == reqMajor ) {
- majorMax=3; minorMax=GLContext.getMaxMinor(ctp, majorMax);
- majorMin=3; minorMin=1;
- } else /* if( glp.isGL2() ) */ {
- // our minimum desktop OpenGL runtime requirements are 1.1,
- // nevertheless we restrict ARB context creation to 2.0 to spare us futile attempts
- majorMax=3; minorMax=0;
- majorMin=2; minorMin=0;
+
+ if( CTX_PROFILE_ES == reqProfile ) {
+ majorMax=reqMajor; minorMax=GLContext.getMaxMinor(ctp, majorMax);
+ majorMin=reqMajor; minorMin=0;
+ } else {
+ if( 4 == reqMajor ) {
+ majorMax=4; minorMax=GLContext.getMaxMinor(ctp, majorMax);
+ majorMin=4; minorMin=0;
+ } else if( 3 == reqMajor ) {
+ majorMax=3; minorMax=GLContext.getMaxMinor(ctp, majorMax);
+ majorMin=3; minorMin=1;
+ } else /* if( glp.isGL2() ) */ {
+ // our minimum desktop OpenGL runtime requirements are 1.1,
+ // nevertheless we restrict ARB context creation to 2.0 to spare us futile attempts
+ majorMax=3; minorMax=0;
+ majorMin=2; minorMin=0;
+ }
}
_context = createContextARBVersions(0, true, ctp,
/* max */ majorMax, minorMax,
@@ -1181,16 +1259,19 @@ public abstract class GLContextImpl extends GLContext {
// Helpers for various context implementations
//
- private Object createInstance(final GLProfile glp, final boolean glObject, final Object[] cstrArgs) {
+ private final Object createInstance(final GLProfile glp, final boolean glObject, final Object[] cstrArgs) {
return ReflectionUtil.createInstance(glp.getGLCtor(glObject), cstrArgs);
}
- private boolean verifyInstance(final GLProfile glp, final String suffix, final Object instance) {
+ private final boolean verifyInstance(final GLProfile glp, final String suffix, final Object instance) {
return ReflectionUtil.instanceOf(instance, glp.getGLImplBaseClassName()+suffix);
}
- /** Create the GL for this context. */
- protected GL createGL(final GLProfile glp) {
+ /**
+ * Create the GL instance for this context,
+ * requires valid {@link #getGLProcAddressTable()} result!
+ */
+ private final GL createGL(final GLProfile glp) {
final GL gl = (GL) createInstance(glp, true, new Object[] { glp, this } );
/* FIXME: refactor dependence on Java 2D / JOGL bridge
@@ -1219,6 +1300,8 @@ public abstract class GLContextImpl extends GLContext {
}
if( null != finalizeInit ) {
ReflectionUtil.callMethod(gl, finalizeInit, new Object[]{ });
+ } else {
+ throw new InternalError("Missing 'void finalizeInit(ProcAddressTable)' in "+gl.getClass().getName());
}
}
@@ -1290,43 +1373,58 @@ public abstract class GLContextImpl extends GLContext {
} );
}
+ private final PrivilegedAction<Object> privInitGLGetPtrAction = new PrivilegedAction<Object>() {
+ @Override
+ public Object run() {
+ final GLDynamicLookupHelper glDynLookupHelper = getDrawableImpl().getGLDynamicLookupHelper();
+ glDynLookupHelper.claimAllLinkPermission();
+ try {
+ glGetStringPtr = glDynLookupHelper.dynamicLookupFunction("glGetString");
+ glGetIntegervPtr = glDynLookupHelper.dynamicLookupFunction("glGetIntegerv");
+ } finally {
+ glDynLookupHelper.releaseAllLinkPermission();
+ }
+ return null;
+ } };
private final boolean initGLRendererAndGLVersionStrings() {
- final GLDynamicLookupHelper glDynLookupHelper = getDrawableImpl().getGLDynamicLookupHelper();
- final long _glGetString = glDynLookupHelper.dynamicLookupFunction("glGetString");
- if(0 == _glGetString) {
- System.err.println("Error: Entry point to 'glGetString' is NULL.");
+ if( !glGetPtrInit ) {
+ AccessController.doPrivileged(privInitGLGetPtrAction);
+ glGetPtrInit = true;
+ }
+ if( 0 == glGetStringPtr || 0 == glGetIntegervPtr ) {
+ System.err.println("Error: Could not lookup: glGetString "+toHexString(glGetStringPtr)+", glGetIntegerv "+toHexString(glGetIntegervPtr));
if(DEBUG) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return false;
} else {
- final String _glVendor = glGetStringInt(GL.GL_VENDOR, _glGetString);
+ final String _glVendor = glGetStringInt(GL.GL_VENDOR, glGetStringPtr);
if(null == _glVendor) {
if(DEBUG) {
System.err.println("Warning: GL_VENDOR is NULL.");
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return false;
}
glVendor = _glVendor;
- final String _glRenderer = glGetStringInt(GL.GL_RENDERER, _glGetString);
+ final String _glRenderer = glGetStringInt(GL.GL_RENDERER, glGetStringPtr);
if(null == _glRenderer) {
if(DEBUG) {
System.err.println("Warning: GL_RENDERER is NULL.");
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return false;
}
glRenderer = _glRenderer;
glRendererLowerCase = glRenderer.toLowerCase();
- final String _glVersion = glGetStringInt(GL.GL_VERSION, _glGetString);
+ final String _glVersion = glGetStringInt(GL.GL_VERSION, glGetStringPtr);
if(null == _glVersion) {
// FIXME
if(DEBUG) {
System.err.println("Warning: GL_VERSION is NULL.");
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return false;
}
@@ -1337,6 +1435,26 @@ public abstract class GLContextImpl extends GLContext {
}
/**
+ * Returns false if <code>glGetIntegerv</code> is inaccessible, otherwise queries major.minor
+ * version for given arrays.
+ * <p>
+ * If the GL query fails, major will be zero.
+ * </p>
+ */
+ private final void getGLIntVersion(final int[] glIntMajor, final int[] glIntMinor) {
+ glIntMajor[0] = 0; // clear
+ glIntMinor[0] = 0; // clear
+ if( 0 == glGetIntegervPtr ) {
+ // should not be reached, since initGLRendererAndGLVersionStrings(..)'s failure should abort caller!
+ throw new InternalError("Not initialized: glGetString "+toHexString(glGetStringPtr)+", glGetIntegerv "+toHexString(glGetIntegervPtr));
+ } else {
+ glGetIntegervInt(GL2ES3.GL_MAJOR_VERSION, glIntMajor, 0, glGetIntegervPtr);
+ glGetIntegervInt(GL2ES3.GL_MINOR_VERSION, glIntMinor, 0, glGetIntegervPtr);
+ }
+ }
+
+
+ /**
* Returns null if version string is invalid, otherwise a valid instance.
* <p>
* Note: Non ARB ctx is limited to GL 3.0.
@@ -1356,30 +1474,6 @@ public abstract class GLContextImpl extends GLContext {
return null;
}
- /**
- * Returns false if <code>glGetIntegerv</code> is inaccessible, otherwise queries major.minor
- * version for given arrays.
- * <p>
- * If the GL query fails, major will be zero.
- * </p>
- */
- private final boolean getGLIntVersion(final int[] glIntMajor, final int[] glIntMinor) {
- glIntMajor[0] = 0; // clear
- final GLDynamicLookupHelper glDynLookupHelper = getDrawableImpl().getGLDynamicLookupHelper();
- final long _glGetIntegerv = glDynLookupHelper.dynamicLookupFunction("glGetIntegerv");
- if( 0 == _glGetIntegerv ) {
- System.err.println("Error: Entry point to 'glGetIntegerv' is NULL.");
- if(DEBUG) {
- Thread.dumpStack();
- }
- return false;
- } else {
- glGetIntegervInt(GL2ES3.GL_MAJOR_VERSION, glIntMajor, 0, _glGetIntegerv);
- glGetIntegervInt(GL2ES3.GL_MINOR_VERSION, glIntMinor, 0, _glGetIntegerv);
- return true;
- }
- }
-
protected final int getCtxOptions() {
return ctxOptions;
}
@@ -1396,9 +1490,9 @@ public abstract class GLContextImpl extends GLContext {
*
* @param force force the setting, even if is already being set.
* This might be useful if you change the OpenGL implementation.
- * @param major OpenGL major version
- * @param minor OpenGL minor version
- * @param ctxProfileBits OpenGL context profile and option bits, see {@link javax.media.opengl.GLContext#CTX_OPTION_ANY}
+ * @param major requested OpenGL major version
+ * @param minor requested OpenGL minor version
+ * @param ctxProfileBits OpenGL context profile and option bits, see {@link com.jogamp.opengl.GLContext#CTX_OPTION_ANY}
* @param strictMatch if <code>true</code> the ctx must
* <ul>
* <li>be greater or equal than the requested <code>major.minor</code> version, and</li>
@@ -1412,13 +1506,13 @@ public abstract class GLContextImpl extends GLContext {
* If <code>strictMatch</code> is <code>false</code> method shall always return <code>true</code> or throw an exception.
* If <code>false</code> is returned, no data has been cached or mapped, i.e. ProcAddressTable, Extensions, Version, etc.
* @see #setContextVersion
- * @see javax.media.opengl.GLContext#CTX_OPTION_ANY
- * @see javax.media.opengl.GLContext#CTX_PROFILE_COMPAT
- * @see javax.media.opengl.GLContext#CTX_IMPL_ES2_COMPAT
+ * @see com.jogamp.opengl.GLContext#CTX_OPTION_ANY
+ * @see com.jogamp.opengl.GLContext#CTX_PROFILE_COMPAT
+ * @see com.jogamp.opengl.GLContext#CTX_IMPL_ES2_COMPAT
*/
protected final boolean setGLFunctionAvailability(final boolean force, int major, int minor, int ctxProfileBits,
final boolean strictMatch, final boolean withinGLVersionsMapping) {
- if(null!=this.gl && null!=glProcAddressTable && !force) {
+ if( null != this.gl && null != glProcAddressTable && !force ) {
return true; // already done and not forced
}
@@ -1426,11 +1520,6 @@ public abstract class GLContextImpl extends GLContext {
throw new GLException("Invalid GL Version Request "+GLContext.getGLVersion(major, minor, ctxProfileBits, null));
}
- if(null==this.gl || !verifyInstance(gl.getGLProfile(), "Impl", this.gl)) {
- setGL( createGL( drawable.getGLProfile() ) );
- }
- updateGLXProcAddressTable();
-
final AbstractGraphicsConfiguration aconfig = drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice adevice = aconfig.getScreen().getDevice();
final int reqCtxProfileBits = ctxProfileBits;
@@ -1476,20 +1565,7 @@ public abstract class GLContextImpl extends GLContext {
final VersionNumber hasGLVersionByInt;
{
final int[] glIntMajor = new int[] { 0 }, glIntMinor = new int[] { 0 };
- final boolean getGLIntVersionOK = getGLIntVersion(glIntMajor, glIntMinor);
- if( !getGLIntVersionOK ) {
- final String errMsg = "Fetching GL Integer Version failed. "+adevice+" - "+GLContext.getGLVersion(major, minor, ctxProfileBits, null);
- if( strictMatch ) {
- // query mode .. simply fail
- if(DEBUG) {
- System.err.println("Warning: setGLFunctionAvailability: "+errMsg);
- }
- return false;
- } else {
- // unusable GL context - non query mode - hard fail!
- throw new GLException(errMsg);
- }
- }
+ getGLIntVersion(glIntMajor, glIntMinor);
hasGLVersionByInt = new VersionNumber(glIntMajor[0], glIntMinor[0], 0);
}
if (DEBUG) {
@@ -1501,7 +1577,7 @@ public abstract class GLContextImpl extends GLContext {
// - _and_ a valid int version was fetched,
// otherwise cont. w/ version-string method -> 3.0 > Version || Version > MAX!
//
- if ( ( major >= 3 || hasGLVersionByString.compareTo(Version300) >= 0 ) &&
+ if ( ( major >= 3 || hasGLVersionByString.compareTo(Version3_0) >= 0 ) &&
GLContext.isValidGLVersion(ctxProfileBits, hasGLVersionByInt.getMajor(), hasGLVersionByInt.getMinor()) ) {
// Strict Match (GLVersionMapping):
// Relaxed match for versions ( !isES && major < 3 ) requests, last resort!
@@ -1622,54 +1698,67 @@ public abstract class GLContextImpl extends GLContext {
System.err.println(getThreadName() + ": GLContext.setGLFuncAvail.0 validated FQN: "+contextFQN+" - "+GLContext.getGLVersion(major, minor, ctxProfileBits, glVersion));
}
+ updateGLXProcAddressTable();
+
//
// UpdateGLProcAddressTable functionality
+ // _and_ setup GL instance, which ctor requires valid getGLProcAddressTable() result!
//
- ProcAddressTable table = null;
- synchronized(mappedContextTypeObjectLock) {
- table = mappedGLProcAddress.get( contextFQN );
- if(null != table && !verifyInstance(gl.getGLProfile(), "ProcAddressTable", table)) {
- throw new InternalError("GLContext GL ProcAddressTable mapped key("+contextFQN+" - " + GLContext.getGLVersion(major, minor, ctxProfileBits, null)+
- ") -> "+ table.getClass().getName()+" not matching "+gl.getGLProfile().getGLImplBaseClassName());
- }
- }
- if(null != table) {
- glProcAddressTable = table;
- if(DEBUG) {
- System.err.println(getThreadName() + ": GLContext GL ProcAddressTable reusing key("+contextFQN+") -> "+toHexString(table.hashCode()));
- }
- } else {
- glProcAddressTable = (ProcAddressTable) createInstance(gl.getGLProfile(), false,
- new Object[] { new GLProcAddressResolver() } );
- resetProcAddressTable(getGLProcAddressTable());
+ {
+ final GLProfile glp = drawable.getGLProfile();
+
+ ProcAddressTable table = null;
synchronized(mappedContextTypeObjectLock) {
- mappedGLProcAddress.put(contextFQN, getGLProcAddressTable());
+ table = mappedGLProcAddress.get( contextFQN );
+ if(null != table && !verifyInstance(glp, "ProcAddressTable", table)) {
+ throw new InternalError("GLContext GL ProcAddressTable mapped key("+contextFQN+" - " + GLContext.getGLVersion(major, minor, ctxProfileBits, null)+
+ ") -> "+ table.getClass().getName()+" not matching "+glp.getGLImplBaseClassName());
+ }
+ }
+ if(null != table) {
+ glProcAddressTable = table;
if(DEBUG) {
- System.err.println(getThreadName() + ": GLContext GL ProcAddressTable mapping key("+contextFQN+") -> "+toHexString(getGLProcAddressTable().hashCode()));
+ System.err.println(getThreadName() + ": GLContext GL ProcAddressTable reusing key("+contextFQN+") -> "+toHexString(table.hashCode()));
+ }
+ } else {
+ glProcAddressTable = (ProcAddressTable) createInstance(glp, false,
+ new Object[] { new GLProcAddressResolver() } );
+ resetProcAddressTable( glProcAddressTable );
+ synchronized(mappedContextTypeObjectLock) {
+ mappedGLProcAddress.put(contextFQN, glProcAddressTable);
+ if(DEBUG) {
+ System.err.println(getThreadName() + ": GLContext GL ProcAddressTable mapping key("+contextFQN+") -> "+toHexString(glProcAddressTable.hashCode()));
+ }
}
}
+
+ if( null == this.gl || !verifyInstance(glp, "Impl", this.gl) ) {
+ setGL( createGL( glp ) );
+ }
}
//
// Update ExtensionAvailabilityCache
//
- ExtensionAvailabilityCache eCache;
- synchronized(mappedContextTypeObjectLock) {
- eCache = mappedExtensionAvailabilityCache.get( contextFQN );
- }
- if(null != eCache) {
- extensionAvailability = eCache;
- if(DEBUG) {
- System.err.println(getThreadName() + ": GLContext GL ExtensionAvailabilityCache reusing key("+contextFQN+") -> "+toHexString(eCache.hashCode()) + " - entries: "+eCache.getTotalExtensionCount());
- }
- } else {
- extensionAvailability = new ExtensionAvailabilityCache();
- setContextVersion(major, minor, ctxProfileBits, vendorVersion, false); // pre-set of GL version, required for extension cache usage
- extensionAvailability.reset(this);
+ {
+ ExtensionAvailabilityCache eCache;
synchronized(mappedContextTypeObjectLock) {
- mappedExtensionAvailabilityCache.put(contextFQN, extensionAvailability);
+ eCache = mappedExtensionAvailabilityCache.get( contextFQN );
+ }
+ if(null != eCache) {
+ extensionAvailability = eCache;
if(DEBUG) {
- System.err.println(getThreadName() + ": GLContext GL ExtensionAvailabilityCache mapping key("+contextFQN+") -> "+toHexString(extensionAvailability.hashCode()) + " - entries: "+extensionAvailability.getTotalExtensionCount());
+ System.err.println(getThreadName() + ": GLContext GL ExtensionAvailabilityCache reusing key("+contextFQN+") -> "+toHexString(eCache.hashCode()) + " - entries: "+eCache.getTotalExtensionCount());
+ }
+ } else {
+ extensionAvailability = new ExtensionAvailabilityCache();
+ setContextVersion(major, minor, ctxProfileBits, vendorVersion, false); // pre-set of GL version, required for extension cache usage
+ extensionAvailability.reset(this);
+ synchronized(mappedContextTypeObjectLock) {
+ mappedExtensionAvailabilityCache.put(contextFQN, extensionAvailability);
+ if(DEBUG) {
+ System.err.println(getThreadName() + ": GLContext GL ExtensionAvailabilityCache mapping key("+contextFQN+") -> "+toHexString(extensionAvailability.hashCode()) + " - entries: "+extensionAvailability.getTotalExtensionCount());
+ }
}
}
}
@@ -1770,6 +1859,38 @@ public abstract class GLContextImpl extends GLContext {
}
}
}
+ if( GLProfile.disableSurfacelessContext ) {
+ final int quirk = GLRendererQuirks.NoSurfacelessCtx;
+ if(DEBUG) {
+ System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: disabled");
+ }
+ quirks.addQuirk( quirk );
+ if( withinGLVersionsMapping ) {
+ // Thread safe due to single threaded initialization!
+ GLRendererQuirks.addStickyDeviceQuirk(adevice, quirk);
+ } else {
+ // FIXME: Remove when moving EGL/ES to ARB ctx creation
+ synchronized(GLContextImpl.class) {
+ GLRendererQuirks.addStickyDeviceQuirk(adevice, quirk);
+ }
+ }
+ }
+ if( GLProfile.disableOpenGLARBContext ) {
+ final int quirk = GLRendererQuirks.NoARBCreateContext;
+ if(DEBUG) {
+ System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: disabled");
+ }
+ quirks.addQuirk( quirk );
+ if( withinGLVersionsMapping ) {
+ // Thread safe due to single threaded initialization!
+ GLRendererQuirks.addStickyDeviceQuirk(adevice, quirk);
+ } else {
+ // FIXME: Remove when moving EGL/ES to ARB ctx creation
+ synchronized(GLContextImpl.class) {
+ GLRendererQuirks.addStickyDeviceQuirk(adevice, quirk);
+ }
+ }
+ }
//
// OS related quirks
@@ -1860,6 +1981,10 @@ public abstract class GLContextImpl extends GLContext {
System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType()+", [Vendor "+glVendor+", Renderer "+glRenderer+" and Version "+glVersion+"]");
}
quirks.addQuirk( quirk );
+ if( withinGLVersionsMapping ) {
+ // Thread safe due to single threaded initialization!
+ GLRendererQuirks.addStickyDeviceQuirk(adevice, quirk);
+ }
}
}
} else if( isDriverIntel && glRenderer.equals("Intel Bear Lake B") ) {
@@ -1903,7 +2028,7 @@ public abstract class GLContextImpl extends GLContext {
//
final int quirk = GLRendererQuirks.DontCloseX11Display;
if( glRenderer.contains(MesaSP) ) {
- if ( glRenderer.contains("X11") && vendorVersion.compareTo(Version800) < 0 ) {
+ if ( glRenderer.contains("X11") && vendorVersion.compareTo(Version8_0) < 0 ) {
if(DEBUG) {
System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: X11 Renderer=" + glRenderer + ", Version=[vendor " + vendorVersion + ", GL " + glVersion+"]");
}
@@ -2114,7 +2239,7 @@ public abstract class GLContextImpl extends GLContext {
@Override
public final boolean isFunctionAvailable(final String glFunctionName) {
// Check GL 1st (cached)
- if(null!=glProcAddressTable) { // null if this context wasn't not created
+ if( null != glProcAddressTable ) { // null if this context wasn't not created
try {
if( glProcAddressTable.isFunctionAvailable( glFunctionName ) ) {
return true;
@@ -2135,15 +2260,24 @@ public abstract class GLContextImpl extends GLContext {
// dynamic function lookup at last incl name aliasing (not cached)
final DynamicLookupHelper dynLookup = getDrawableImpl().getGLDynamicLookupHelper();
final String tmpBase = GLNameResolver.normalizeVEN(GLNameResolver.normalizeARB(glFunctionName, true), true);
- boolean res = false;
- final int variants = GLNameResolver.getFuncNamePermutationNumber(tmpBase);
- for(int i = 0; !res && i < variants; i++) {
- final String tmp = GLNameResolver.getFuncNamePermutation(tmpBase, i);
- try {
- res = dynLookup.isFunctionAvailable(tmp);
- } catch (final Exception e) { }
- }
- return res;
+ return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
+ @Override
+ public Boolean run() {
+ boolean res = false;
+ dynLookup.claimAllLinkPermission();
+ try {
+ final int variants = GLNameResolver.getFuncNamePermutationNumber(tmpBase);
+ for(int i = 0; !res && i < variants; i++) {
+ final String tmp = GLNameResolver.getFuncNamePermutation(tmpBase, i);
+ try {
+ res = dynLookup.isFunctionAvailable(tmp);
+ } catch (final Exception e) { }
+ }
+ } finally {
+ dynLookup.releaseAllLinkPermission();
+ }
+ return Boolean.valueOf(res);
+ } } ).booleanValue();
}
@Override
@@ -2309,9 +2443,6 @@ public abstract class GLContextImpl extends GLContext {
}
switch(target) {
case GL.GL_FRAMEBUFFER:
- boundFBOTarget[0] = framebufferName; // draw
- boundFBOTarget[1] = framebufferName; // read
- break;
case GL2ES3.GL_DRAW_FRAMEBUFFER:
boundFBOTarget[0] = framebufferName; // draw
break;
diff --git a/src/jogl/classes/jogamp/opengl/GLContextShareSet.java b/src/jogl/classes/jogamp/opengl/GLContextShareSet.java
index aed611edd..61d6ad198 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextShareSet.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextShareSet.java
@@ -46,8 +46,8 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLException;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLException;
/** Provides a deterministic mechanism by which OpenGL contexts can share textures
diff --git a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java
index 7519d568b..cd31d02fd 100644
--- a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java
+++ b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java
@@ -31,15 +31,15 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GL2GL3;
-import javax.media.opengl.GLDebugListener;
-import javax.media.opengl.GLDebugMessage;
-import javax.media.opengl.GLException;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLDebugListener;
+import com.jogamp.opengl.GLDebugMessage;
+import com.jogamp.opengl.GLException;
import jogamp.common.os.PlatformPropsImpl;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.os.Platform;
import com.jogamp.gluegen.runtime.ProcAddressTable;
import com.jogamp.opengl.GLExtensions;
@@ -56,7 +56,7 @@ import com.jogamp.opengl.GLExtensions;
* return as fast as possible.</p>
*
* <p>In case no <i>GL_ARB_debug_output</i> is available, but <i>GL_AMD_debug_output</i>,
- * the messages are translated to <i>ARB</i> {@link GLDebugMessage}, using {@link GLDebugMessage#translateAMDEvent(javax.media.opengl.GLContext, long, int, int, int, String)}.</p>
+ * the messages are translated to <i>ARB</i> {@link GLDebugMessage}, using {@link GLDebugMessage#translateAMDEvent(com.jogamp.opengl.GLContext, long, int, int, int, String)}.</p>
*/
public class GLDebugMessageHandler {
private static final boolean DEBUG = Debug.debug("GLDebugMessageHandler");
@@ -212,12 +212,12 @@ public class GLDebugMessageHandler {
}
/**
- * @see javax.media.opengl.GLContext#isGLDebugSynchronous()
+ * @see com.jogamp.opengl.GLContext#isGLDebugSynchronous()
*/
public final boolean isSynchronous() { return synchronous; }
/**
- * @see javax.media.opengl.GLContext#setGLDebugSynchronous(boolean)
+ * @see com.jogamp.opengl.GLContext#setGLDebugSynchronous(boolean)
*/
public final void setSynchronous(final boolean synchronous) {
this.synchronous = synchronous;
@@ -239,7 +239,7 @@ public class GLDebugMessageHandler {
}
/**
- * @see javax.media.opengl.GLContext#enableGLDebugMessage(boolean)
+ * @see com.jogamp.opengl.GLContext#enableGLDebugMessage(boolean)
*/
public final void enable(final boolean enable) throws GLException {
ctx.validateCurrent();
@@ -308,7 +308,7 @@ public class GLDebugMessageHandler {
public void messageSent(final GLDebugMessage event) {
System.err.println(event);
if(threadDump) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
}
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
index b51f290e9..b7f861e13 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java
@@ -46,27 +46,28 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.nativewindow.OffscreenLayerSurface;
-import javax.media.nativewindow.ProxySurface;
-import javax.media.nativewindow.MutableSurface;
-import javax.media.nativewindow.UpstreamSurfaceHook;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesChooser;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLFBODrawable;
-import javax.media.opengl.GLOffscreenAutoDrawable;
-import javax.media.opengl.GLProfile;
-
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.nativewindow.OffscreenLayerSurface;
+import com.jogamp.nativewindow.ProxySurface;
+import com.jogamp.nativewindow.MutableSurface;
+import com.jogamp.nativewindow.UpstreamSurfaceHook;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesChooser;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLFBODrawable;
+import com.jogamp.opengl.GLOffscreenAutoDrawable;
+import com.jogamp.opengl.GLProfile;
+
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.nativewindow.MutableGraphicsConfiguration;
import com.jogamp.nativewindow.DelegatedUpstreamSurfaceHookWithSurfaceSize;
import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize;
@@ -87,11 +88,97 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
}
/**
+ * Returns {@code true} if context is capable of operating without a surface,
+ * otherwise returns {@code false} and sets the {@link GLRendererQuirks#NoSurfacelessCtx}.
+ * <p>
+ * Method will skip probing in case {@link GLRendererQuirks#NoSurfacelessCtx} has been already set.
+ * </p>
+ * <p>
+ * Caller shall skip probing in case surfaceless support is not possible,
+ * e.g. OpenGL ES without {@code EGL_KHR_surfaceless_context} or EGL &lt; 1.5,
+ * or desktop OpenGL context &lt; 3.0 and instead call {@link #setNoSurfacelessCtxQuirk(GLContext)}!
+ * </p>
+ *
+ * @param context the context to probe, must be current
+ * @param restoreDrawable If {@code true}, the initial drawable will be restored after probing
+ * and the temporary {@code zeroDrawable} will be released.
+ * If {@code false}, the temporary {@code zeroDrawable} will be kept (bound) to the context.
+ * Restoration may be skipped, if the drawable and context will be destroyed anyways.
+ *
+ * @see GLRendererQuirks#NoSurfacelessCtx
+ */
+ protected final boolean probeSurfacelessCtx(final GLContext context, final boolean restoreDrawable) {
+ final GLDrawable origDrawable = context.getGLDrawable();
+ final AbstractGraphicsDevice device = origDrawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice();
+
+ final boolean noSurfacelessCtxQuirk = context.hasRendererQuirk(GLRendererQuirks.NoSurfacelessCtx);
+ boolean allowsSurfacelessCtx = false;
+
+ if( !noSurfacelessCtxQuirk ) {
+ GLDrawable zeroDrawable = null;
+ try {
+ final GLCapabilitiesImmutable caps = origDrawable.getRequestedGLCapabilities();
+ final ProxySurface zeroSurface = createSurfacelessImpl(device, true, caps, caps, null, 64, 64);
+ zeroDrawable = createOnscreenDrawableImpl(zeroSurface);
+ zeroDrawable.setRealized(true);
+
+ // Since context is still current,
+ // will keep context current w/ zeroDrawable or throws GLException
+ context.setGLDrawable(zeroDrawable, false);
+ allowsSurfacelessCtx = true; // if setGLDrawable is successful, i.e. no GLException
+
+ if( restoreDrawable ) {
+ context.setGLDrawable(origDrawable, false);
+ }
+ } catch (final Throwable t) {
+ if( DEBUG || GLContext.DEBUG ) {
+ ExceptionUtils.dumpThrowable("", t);
+ }
+ } finally {
+ if( null != zeroDrawable && restoreDrawable ) {
+ zeroDrawable.setRealized(false);
+ }
+ }
+ }
+ if( !noSurfacelessCtxQuirk && !allowsSurfacelessCtx ) {
+ setNoSurfacelessCtxQuirkImpl(device, context);
+ }
+ return allowsSurfacelessCtx;
+ }
+
+ /**
+ * Method will set the {@link GLRendererQuirks#NoSurfacelessCtx}
+ * if it has not been set already.
+ *
+ * @param context the context to probe, must be current
+ * @see GLRendererQuirks#NoSurfacelessCtx
+ */
+ protected final void setNoSurfacelessCtxQuirk(final GLContext context) {
+ final boolean noSurfacelessCtxQuirk = context.hasRendererQuirk(GLRendererQuirks.NoSurfacelessCtx);
+ if( !noSurfacelessCtxQuirk ) {
+ final GLDrawable origDrawable = context.getGLDrawable();
+ final AbstractGraphicsDevice device = origDrawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice();
+ setNoSurfacelessCtxQuirkImpl(device, context);
+ }
+ }
+ private final void setNoSurfacelessCtxQuirkImpl(final AbstractGraphicsDevice device, final GLContext context) {
+ final int quirk = GLRendererQuirks.NoSurfacelessCtx;
+ if(DEBUG || GLContext.DEBUG) {
+ System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+" -> "+device+": cause: probe");
+ }
+ final GLRendererQuirks glrq = context.getRendererQuirks();
+ if( null != glrq ) {
+ glrq.addQuirk(quirk);
+ }
+ GLRendererQuirks.addStickyDeviceQuirk(device, quirk);
+ }
+
+ /**
* Returns the shared resource mapped to the <code>device</code> {@link AbstractGraphicsDevice#getConnection()},
* either a pre-existing or newly created, or <code>null</code> if creation failed or not supported.<br>
* Creation of the shared resource is tried only once.
*
- * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
+ * @param device which {@link com.jogamp.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
*/
protected final SharedResourceRunner.Resource getOrCreateSharedResource(AbstractGraphicsDevice device) {
try {
@@ -114,7 +201,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
* either a pre-existing or newly created, or <code>null</code> if creation failed or <b>not supported</b>.<br>
* Creation of the shared context is tried only once.
*
- * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
+ * @param device which {@link com.jogamp.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be <code>null</code> for the platform's default device.
*/
public final GLContext getOrCreateSharedContext(final AbstractGraphicsDevice device) {
final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device );
@@ -128,16 +215,16 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
protected final boolean createSharedResourceImpl(final AbstractGraphicsDevice device) {
final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device );
if(null!=sr) {
- return sr.isValid();
+ return sr.isAvailable();
}
return false;
}
@Override
- public final GLRendererQuirks getRendererQuirks(final AbstractGraphicsDevice device) {
+ public final GLRendererQuirks getRendererQuirks(final AbstractGraphicsDevice device, final GLProfile glp) {
final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device );
if(null!=sr) {
- return sr.getRendererQuirks();
+ return sr.getRendererQuirks(glp);
}
return null;
}
@@ -147,7 +234,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
* either a preexisting or newly created, or <code>null</code> if creation failed or not supported.<br>
* Creation of the shared context is tried only once.
*
- * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device.
+ * @param device which {@link com.jogamp.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device.
*/
protected final AbstractGraphicsDevice getOrCreateSharedDevice(final AbstractGraphicsDevice device) {
final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device );
@@ -159,10 +246,11 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
/**
* Returns the GLDynamicLookupHelper
- * @param profile if EGL/ES, profile <code>1</code> refers to ES1 and <code>2</code> to ES2,
+ * @param profileName if EGL/ES, profile <code>1</code> refers to ES1 and <code>2</code> to ES2,
* otherwise the profile is ignored.
+ * @throws GLException if no DynamicLookupHelper is installed
*/
- public abstract GLDynamicLookupHelper getGLDynamicLookupHelper(int profile);
+ public abstract GLDynamicLookupHelper getGLDynamicLookupHelper(final String profileName) throws GLException;
//---------------------------------------------------------------------------
// Dispatching GLDrawable construction in respect to the NativeSurface Capabilities
@@ -195,7 +283,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
System.err.println("chosenCapsMod: "+chosenCapsMod);
System.err.println("OffscreenLayerSurface: **** "+ols);
System.err.println("Target: **** "+target);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
if( ! ( target instanceof MutableSurface ) ) {
throw new IllegalArgumentException("Passed NativeSurface must implement SurfaceChangeable for offscreen layered surface: "+target);
@@ -271,9 +359,9 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
@Override
public final GLOffscreenAutoDrawable createOffscreenAutoDrawable(final AbstractGraphicsDevice deviceReq,
- final GLCapabilitiesImmutable capsRequested,
- final GLCapabilitiesChooser chooser,
- final int width, final int height) {
+ final GLCapabilitiesImmutable capsRequested,
+ final GLCapabilitiesChooser chooser,
+ final int width, final int height) {
final GLDrawable drawable = createOffscreenDrawable( deviceReq, capsRequested, chooser, width, height );
try {
drawable.setRealized(true);
@@ -306,24 +394,32 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
@Override
public final GLDrawable createOffscreenDrawable(final AbstractGraphicsDevice deviceReq,
- final GLCapabilitiesImmutable capsRequested,
- final GLCapabilitiesChooser chooser,
- final int width, final int height) {
+ final GLCapabilitiesImmutable capsRequested,
+ final GLCapabilitiesChooser chooser,
+ final int width, final int height) {
if(width<=0 || height<=0) {
throw new GLException("initial size must be positive (were (" + width + " x " + height + "))");
}
- final AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq);
- if(null == device) {
+ final SharedResourceRunner.Resource sr = getOrCreateSharedResource( deviceReq );
+ if( null == sr ) {
throw new GLException("No shared device for requested: "+deviceReq);
}
-
+ final AbstractGraphicsDevice device = sr.getDevice();
final GLCapabilitiesImmutable capsChosen = GLGraphicsConfigurationUtil.fixOffscreenGLCapabilities(capsRequested, this, device);
if( capsChosen.isFBO() ) {
// Use minimum GLCapabilities for the dummy surface w/ same profile
- final ProxySurface dummySurface = createDummySurfaceImpl(device, true, new GLCapabilities(capsChosen.getGLProfile()), capsRequested, null, width, height);
- final GLDrawableImpl dummyDrawable = createOnscreenDrawableImpl(dummySurface);
- return new GLFBODrawableImpl.ResizeableImpl(this, dummyDrawable, dummySurface, capsChosen, 0);
+ final GLProfile glp = capsChosen.getGLProfile();
+ final GLCapabilitiesImmutable glCapsMin = new GLCapabilities(glp);
+ final GLRendererQuirks glrq = sr.getRendererQuirks(glp);
+ final ProxySurface surface;
+ if( null != glrq && !glrq.exist(GLRendererQuirks.NoSurfacelessCtx) ) {
+ surface = createSurfacelessImpl(device, true, glCapsMin, capsRequested, null, width, height);
+ } else {
+ surface = createDummySurfaceImpl(device, true, glCapsMin, capsRequested, null, width, height);
+ }
+ final GLDrawableImpl drawable = createOnscreenDrawableImpl(surface);
+ return new GLFBODrawableImpl.ResizeableImpl(this, drawable, surface, capsChosen, 0);
}
return createOffscreenDrawableImpl( createMutableSurfaceImpl(device, true, capsChosen, capsRequested, chooser,
new UpstreamSurfaceHookMutableSize(width, height) ) );
@@ -380,8 +476,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook);
/**
- * A dummy surface is not visible on screen and will not be used to render directly to,
- * it maybe on- or offscreen.
+ * A dummy surface is not visible on screen, it may be on- or offscreen.
* <p>
* It is used to allow the creation of a {@link GLDrawable} and {@link GLContext} to query information.
* It also allows creation of framebuffer objects which are used for rendering or using a shared GLContext w/o actually rendering to a usable framebuffer.
@@ -389,7 +484,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
* <p>
* Creates a new independent device instance using <code>deviceReq</code> details.
* </p>
- * @param deviceReq which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device.
+ * @param deviceReq which {@link com.jogamp.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device.
* @param requestedCaps
* @param chooser the custom chooser, may be null for default
* @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()}, not the actual dummy surface width.
@@ -409,8 +504,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
}
/**
- * A dummy surface is not visible on screen and will not be used to render directly to,
- * it maybe on- or offscreen.
+ * A dummy surface is not visible on screen and may be on- or offscreen.
* <p>
* It is used to allow the creation of a {@link GLDrawable} and {@link GLContext} to query information.
* It also allows creation of framebuffer objects which are used for rendering or using a shared GLContext w/o actually rendering to a usable framebuffer.
@@ -430,6 +524,27 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory {
public abstract ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice device, boolean createNewDevice,
GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height);
+ /**
+ * A surfaceless {@link ProxySurface} is a non-existing surface and will not be used as a render target.
+ * <p>
+ * It is used to allow the creation of a {@link GLDrawable} and {@link GLContext} w/o default framebuffer to query information.
+ * It also allows creation of framebuffer objects which are used for rendering or using a shared GLContext w/o actually rendering to a usable framebuffer.
+ * </p>
+ * @param device a valid platform dependent target device.
+ * @param createNewDevice if <code>true</code> a new device instance is created using <code>device</code> details,
+ * otherwise <code>device</code> instance is used as-is.
+ * @param chosenCaps
+ * @param requestedCaps
+ * @param chooser the custom chooser, may be null for default
+ * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()}, not the actual dummy surface width.
+ * The latter is platform specific and small
+ * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()}, not the actual dummy surface height,
+ * The latter is platform specific and small
+ * @return the created {@link ProxySurface} instance w/o defined surface handle but platform specific {@link UpstreamSurfaceHook}.
+ */
+ public abstract ProxySurface createSurfacelessImpl(AbstractGraphicsDevice device, boolean createNewDevice,
+ GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height);
+
//---------------------------------------------------------------------------
//
// ProxySurface (Wrapped pre-existing native surface) construction
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
index 3847b4042..e9ee46a51 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
@@ -45,20 +45,20 @@ import java.util.ArrayList;
import java.util.List;
import java.util.HashSet;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.ProxySurface;
-import javax.media.nativewindow.UpstreamSurfaceHook;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLAnimatorControl;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLFBODrawable;
-import javax.media.opengl.GLRunnable;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.ProxySurface;
+import com.jogamp.nativewindow.UpstreamSurfaceHook;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLAnimatorControl;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLFBODrawable;
+import com.jogamp.opengl.GLRunnable;
import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.util.PropertyAccess;
@@ -227,7 +227,7 @@ public class GLDrawableHelper {
* i.e. lock the involved {@link GLDrawable#getNativeSurface() drawable's} {@link NativeSurface}s
* to avoid a race condition. In case {@link GLAutoDrawable auto-drawable's} are used,
* their {@link GLAutoDrawable#getUpstreamLock() upstream-lock} must be locked beforehand
- * see <a href="../../javax/media/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.</li>
+ * see <a href="../../com/jogamp/opengl/GLAutoDrawable.html#locking">GLAutoDrawable Locking</a>.</li>
* </ul>
* </p>
*
@@ -355,7 +355,7 @@ public class GLDrawableHelper {
}
if( DEBUG && ( 0>=newWidth || 0>=newHeight) ) {
System.err.println("WARNING: Odd size detected: "+newWidth+"x"+newHeight+", using safe size 1x1. Drawable "+drawable);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
if( 0 >= newWidth ) { newWidth = 1; validateSize=false; }
if( 0 >= newHeight ) { newHeight = 1; validateSize=false; }
@@ -734,7 +734,7 @@ public class GLDrawableHelper {
final int glerr0 = drawable.getGL().glGetError();
if( GL.GL_NO_ERROR != glerr0 ) {
System.err.println("Info: GLDrawableHelper.reshape: pre-exisiting GL error 0x"+Integer.toHexString(glerr0));
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
drawable.getGL().glViewport(x, y, width, height);
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
index 544aaf064..849a08623 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java
@@ -40,16 +40,18 @@
package jogamp.opengl;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.ProxySurface;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.ProxySurface;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
+
+import com.jogamp.common.ExceptionUtils;
public abstract class GLDrawableImpl implements GLDrawable {
protected static final boolean DEBUG = GLDrawableFactoryImpl.DEBUG;
@@ -67,8 +69,11 @@ public abstract class GLDrawableImpl implements GLDrawable {
/**
* Returns the DynamicLookupHelper
+ * @throws GLException if no DynamicLookupHelper is installed
*/
- public abstract GLDynamicLookupHelper getGLDynamicLookupHelper();
+ public final GLDynamicLookupHelper getGLDynamicLookupHelper() throws GLException {
+ return getFactoryImpl().getGLDynamicLookupHelper( getGLProfile().getImplName() );
+ }
public final GLDrawableFactoryImpl getFactoryImpl() {
return (GLDrawableFactoryImpl) getFactory();
@@ -176,7 +181,7 @@ public abstract class GLDrawableImpl implements GLDrawable {
final boolean isProxySurface = surface instanceof ProxySurface;
if(DEBUG) {
System.err.println(getThreadName() + ": setRealized: drawable "+getClass().getSimpleName()+", surface "+surface.getClass().getSimpleName()+", isProxySurface "+isProxySurface+": "+realized+" -> "+realizedArg);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
final AbstractGraphicsDevice aDevice = surface.getGraphicsConfiguration().getScreen().getDevice();
if(realizedArg) {
diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
index 991a351e6..cddaebe25 100644
--- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
@@ -1,16 +1,17 @@
package jogamp.opengl;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.ProxySurface;
-import javax.media.nativewindow.UpstreamSurfaceHook;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLFBODrawable;
-
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.ProxySurface;
+import com.jogamp.nativewindow.UpstreamSurfaceHook;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLFBODrawable;
+
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.util.PropertyAccess;
import com.jogamp.common.util.VersionUtil;
import com.jogamp.nativewindow.MutableGraphicsConfiguration;
@@ -104,7 +105,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
private final void setupFBO(final GL gl, final int idx, final int width, final int height, final int samples,
final boolean useAlpha, final int depthBits, final int stencilBits,
- final boolean useTexture, final boolean realUnbind) {
+ final boolean useTexture, final boolean setupViewportScissors, final boolean realUnbind) {
final FBObject fbo = new FBObject();
fbos[idx] = fbo;
@@ -155,6 +156,11 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
// Also remedy for Bug 1020, i.e. OSX/Nvidia's FBO needs to be cleared before blitting,
// otherwise first MSAA frame lacks antialiasing.
fbo.bind(gl);
+ if( setupViewportScissors ) {
+ // Surfaceless: Set initial viewport/scissors
+ gl.glViewport(0, 0, width, height);
+ gl.glScissor(0, 0, width, height);
+ }
if( useDepth ) {
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
} else {
@@ -171,7 +177,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
if( !initialized && !realize ) {
if( DEBUG ) {
System.err.println("GLFBODrawableImpl.initialize(): WARNING - Already unrealized!");
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return; // NOP, no exception for de-init twice or no init!
}
@@ -216,7 +222,9 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
for(int i=0; i<fbosN; i++) {
setupFBO(gl, i, width, height, samples, useAlpha,
- chosenFBOCaps.getDepthBits(), chosenFBOCaps.getStencilBits(), useTexture, fbosN-1==i);
+ chosenFBOCaps.getDepthBits(), chosenFBOCaps.getStencilBits(), useTexture,
+ 0==i && 0 == parent.getHandle() /* setupViewportScissors for surfaceless */,
+ fbosN-1==i /* unbind */);
}
fbos[0].formatToGLCapabilities(chosenFBOCaps);
chosenFBOCaps.setDoubleBuffered( chosenFBOCaps.getDoubleBuffered() || samples > 0 );
@@ -233,7 +241,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
if(DEBUG) {
System.err.println("GLFBODrawableImpl.initialize("+realize+"): "+this);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
@@ -270,7 +278,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
// resetQuirk fallback
fbos[idx].destroy(gl);
final boolean useTexture = 0 != ( FBOMODE_USE_TEXTURE & fboModeBits );
- setupFBO(gl, idx, width, height, samples, useAlpha, depthBits, stencilBits, useTexture, true);
+ setupFBO(gl, idx, width, height, samples, useAlpha, depthBits, stencilBits, useTexture, false, true);
}
private final void reset(final GL gl, int newSamples) throws GLException {
@@ -284,7 +292,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
final boolean ctxSwitch = null != curContext && curContext != ourContext;
if(DEBUG) {
System.err.println("GLFBODrawableImpl.reset(newSamples "+newSamples+"): BEGIN - ctxSwitch "+ctxSwitch+", "+this);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
Throwable tFBO = null;
Throwable tGL = null;
@@ -359,11 +367,6 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
//
@Override
- public final GLDynamicLookupHelper getGLDynamicLookupHelper() {
- return parent.getGLDynamicLookupHelper();
- }
-
- @Override
protected final int getDefaultDrawFramebuffer() { return initialized ? fbos[fboIBack].getWriteFramebuffer() : 0; }
@Override
diff --git a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java
index 90d18eb60..9a8f72304 100644
--- a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java
@@ -29,11 +29,11 @@
package jogamp.opengl;
import java.util.List;
-import javax.media.nativewindow.CapabilitiesChooser;
-import javax.media.nativewindow.CapabilitiesImmutable;
-import javax.media.nativewindow.GraphicsConfigurationFactory;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.opengl.DefaultGLCapabilitiesChooser;
+import com.jogamp.nativewindow.CapabilitiesChooser;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.GraphicsConfigurationFactory;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.opengl.DefaultGLCapabilitiesChooser;
public abstract class GLGraphicsConfigurationFactory extends GraphicsConfigurationFactory {
diff --git a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java
index 1fb27cfcf..e9670baa6 100644
--- a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java
+++ b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java
@@ -28,12 +28,12 @@
package jogamp.opengl;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.GLRendererQuirks;
@@ -204,7 +204,7 @@ public class GLGraphicsConfigurationUtil {
final boolean fboAvailable = GLContext.isFBOAvailable(device, glp);
final boolean pbufferAvailable = factory.canCreateGLPbuffer(device, glp);
- final GLRendererQuirks glrq = factory.getRendererQuirks(device);
+ final GLRendererQuirks glrq = factory.getRendererQuirks(device, glp);
final boolean bitmapAvailable;
final boolean doubleBufferAvailable;
diff --git a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java
index 721dc7384..44eb07678 100644
--- a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java
@@ -28,12 +28,12 @@
package jogamp.opengl;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLOffscreenAutoDrawable;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLOffscreenAutoDrawable;
import com.jogamp.common.util.locks.RecursiveLock;
import com.jogamp.opengl.FBObject;
diff --git a/src/jogl/classes/jogamp/opengl/GLRunnableTask.java b/src/jogl/classes/jogamp/opengl/GLRunnableTask.java
index ca1c1869e..1a6024bfa 100644
--- a/src/jogl/classes/jogamp/opengl/GLRunnableTask.java
+++ b/src/jogl/classes/jogamp/opengl/GLRunnableTask.java
@@ -28,8 +28,8 @@
package jogamp.opengl;
-import javax.media.opengl.GLRunnable;
-import javax.media.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLRunnable;
+import com.jogamp.opengl.GLAutoDrawable;
/**
* Helper class to provide a Runnable queue implementation with a Runnable wrapper
diff --git a/src/jogl/classes/jogamp/opengl/GLStateTracker.java b/src/jogl/classes/jogamp/opengl/GLStateTracker.java
index dc49b35f4..d85fb1347 100644
--- a/src/jogl/classes/jogamp/opengl/GLStateTracker.java
+++ b/src/jogl/classes/jogamp/opengl/GLStateTracker.java
@@ -39,7 +39,7 @@
package jogamp.opengl;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
import com.jogamp.common.util.IntIntHashMap;
diff --git a/src/jogl/classes/jogamp/opengl/GLWorkerThread.java b/src/jogl/classes/jogamp/opengl/GLWorkerThread.java
index 131e6f3ac..c03cdea02 100644
--- a/src/jogl/classes/jogamp/opengl/GLWorkerThread.java
+++ b/src/jogl/classes/jogamp/opengl/GLWorkerThread.java
@@ -43,14 +43,14 @@ import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
-import javax.media.opengl.GLContext;
+import com.jogamp.opengl.GLContext;
/** Singleton thread upon which all OpenGL work is performed by
default. Unfortunately many vendors' OpenGL drivers are not really
thread-safe and stability is much improved by performing OpenGL
work on at most one thread. This is the default behavior of the
GLAutoDrawable implementations according to the {@link
- javax.media.opengl.Threading Threading} class. The GLWorkerThread
+ com.jogamp.opengl.Threading Threading} class. The GLWorkerThread
replaces the original AWT event queue thread-based mechanism for
two reasons: first, more than one AWT event queue thread may be
spawned, for example if a dialog is being shown; second, it avoids
diff --git a/src/jogl/classes/jogamp/opengl/ProjectFloat.java b/src/jogl/classes/jogamp/opengl/ProjectFloat.java
index 5921eb9a9..ee9560214 100644
--- a/src/jogl/classes/jogamp/opengl/ProjectFloat.java
+++ b/src/jogl/classes/jogamp/opengl/ProjectFloat.java
@@ -118,7 +118,8 @@ package jogamp.opengl;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
-import javax.media.opengl.fixedfunc.GLMatrixFunc;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
import com.jogamp.opengl.math.FloatUtil;
@@ -169,8 +170,9 @@ public class ProjectFloat {
* @param aspect
* @param zNear
* @param zFar
+ * @throws GLException with GL_INVALID_VALUE if zNear is <= 0, or zFar < 0, or if zNear == zFar.
*/
- public void gluPerspective(final GLMatrixFunc gl, final float fovy_deg, final float aspect, final float zNear, final float zFar) {
+ public void gluPerspective(final GLMatrixFunc gl, final float fovy_deg, final float aspect, final float zNear, final float zFar) throws GLException {
gl.glMultMatrixf(FloatUtil.makePerspective(mat4Tmp1, 0, true, fovy_deg * FloatUtil.PI / 180.0f, aspect, zNear, zFar), 0);
}
diff --git a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java
index 93a4eb32e..9b9093a87 100644
--- a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java
+++ b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java
@@ -30,21 +30,24 @@ package jogamp.opengl;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.opengl.GLProfile;
+
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.opengl.GLRendererQuirks;
public class SharedResourceRunner implements Runnable {
protected static final boolean DEBUG = GLDrawableImpl.DEBUG;
public static interface Resource {
- boolean isValid();
+ boolean isAvailable();
AbstractGraphicsDevice getDevice();
AbstractGraphicsScreen getScreen();
GLDrawableImpl getDrawable();
GLContextImpl getContext();
- GLRendererQuirks getRendererQuirks();
+ GLRendererQuirks getRendererQuirks(GLProfile glp);
}
public static interface Implementation {
@@ -52,19 +55,19 @@ public class SharedResourceRunner implements Runnable {
* <p>
* Called within synchronized block.
* </p>
- * @param connection for creation a {@link AbstractGraphicsDevice} instance.
+ * @param device for creation a {@link AbstractGraphicsDevice} instance.
* @return <code>true</code> if the device supports all protocols required for the implementation, otherwise <code>false</code>.
*/
- boolean isDeviceSupported(String connection);
+ boolean isDeviceSupported(final AbstractGraphicsDevice device);
/**
* <p>
* Called within synchronized block.
* </p>
- * @param connection for creation a {@link AbstractGraphicsDevice} instance.
+ * @param device for creation a {@link AbstractGraphicsDevice} instance.
* @return A new shared resource instance
*/
- Resource createSharedResource(String connection);
+ Resource createSharedResource(final AbstractGraphicsDevice device);
/** Called within synchronized block. */
void releaseSharedResource(Resource shared);
@@ -72,9 +75,9 @@ public class SharedResourceRunner implements Runnable {
void clear();
/** Called within synchronized block. */
- Resource mapPut(String connection, Resource resource);
+ Resource mapPut(final AbstractGraphicsDevice device, final Resource resource);
/** Called within synchronized block. */
- Resource mapGet(String connection);
+ Resource mapGet(final AbstractGraphicsDevice device);
/** Called within synchronized block. */
Collection<Resource> mapValues();
}
@@ -86,17 +89,17 @@ public class SharedResourceRunner implements Runnable {
boolean running;
boolean ready;
boolean shouldRelease;
- String initConnection;
- String releaseConnection;
+ AbstractGraphicsDevice initDevice;
+ AbstractGraphicsDevice releaseDevice;
- private boolean getDeviceTried(final String connection) { // synchronized call
- return devicesTried.contains(connection);
+ private boolean getDeviceTried(final AbstractGraphicsDevice device) { // synchronized call
+ return devicesTried.contains(device.getConnection());
}
- private void addDeviceTried(final String connection) { // synchronized call
- devicesTried.add(connection);
+ private void addDeviceTried(final AbstractGraphicsDevice device) { // synchronized call
+ devicesTried.add(device.getConnection());
}
- private void removeDeviceTried(final String connection) { // synchronized call
- devicesTried.remove(connection);
+ private void removeDeviceTried(final AbstractGraphicsDevice device) { // synchronized call
+ devicesTried.remove(device.getConnection());
}
public SharedResourceRunner(final Implementation impl) {
@@ -110,8 +113,8 @@ public class SharedResourceRunner implements Runnable {
ready = false;
running = false;
shouldRelease = false;
- initConnection = null;
- releaseConnection = null;
+ initDevice = null;
+ releaseDevice = null;
}
/**
@@ -176,20 +179,20 @@ public class SharedResourceRunner implements Runnable {
if(null != device) {
synchronized (this) {
start();
- final String connection = device.getConnection();
- sr = impl.mapGet(connection);
+ sr = impl.mapGet(device);
if (null == sr) {
- if ( !getDeviceTried(connection) ) {
- addDeviceTried(connection);
+ if ( !getDeviceTried(device) ) {
+ addDeviceTried(device);
if (DEBUG) {
- System.err.println("SharedResourceRunner.getOrCreateShared() " + connection + ": trying - "+getThreadName());
+ System.err.println("SharedResourceRunner.getOrCreateShared() " + device + ": trying - "+getThreadName());
+ ExceptionUtils.dumpStack(System.err);
}
- if ( impl.isDeviceSupported(connection) ) {
- doAndWait(connection, null);
- sr = impl.mapGet(connection);
+ if ( impl.isDeviceSupported(device) ) {
+ doAndWait(device, null);
+ sr = impl.mapGet(device);
}
if (DEBUG) {
- System.err.println("SharedResourceRunner.getOrCreateShared() " + connection + ": "+ ( ( null != sr ) ? "success" : "failed" ) +" - "+getThreadName());
+ System.err.println("SharedResourceRunner.getOrCreateShared() " + device + ": "+ ( ( null != sr ) ? "success" : "failed" ) +" - "+getThreadName());
}
}
}
@@ -202,16 +205,15 @@ public class SharedResourceRunner implements Runnable {
SharedResourceRunner.Resource sr = null;
if(null != device) {
synchronized (this) {
- final String connection = device.getConnection();
- sr = impl.mapGet(connection);
+ sr = impl.mapGet(device);
if (null != sr) {
- removeDeviceTried(connection);
+ removeDeviceTried(device);
if (DEBUG) {
- System.err.println("SharedResourceRunner.releaseShared() " + connection + ": trying - "+getThreadName());
+ System.err.println("SharedResourceRunner.releaseShared() " + device + ": trying - "+getThreadName());
}
- doAndWait(null, connection);
+ doAndWait(null, device);
if (DEBUG) {
- System.err.println("SharedResourceRunner.releaseShared() " + connection + ": done - "+getThreadName());
+ System.err.println("SharedResourceRunner.releaseShared() " + device + ": done - "+getThreadName());
}
}
}
@@ -219,13 +221,13 @@ public class SharedResourceRunner implements Runnable {
return sr;
}
- private final void doAndWait(final String initConnection, final String releaseConnection) {
+ private final void doAndWait(final AbstractGraphicsDevice initDevice, final AbstractGraphicsDevice releaseDevice) {
synchronized (this) {
// wait until thread becomes ready to init new device,
// pass the device and release the sync
final String threadName = getThreadName();
if (DEBUG) {
- System.err.println("SharedResourceRunner.doAndWait() START init: " + initConnection + ", release: "+releaseConnection+" - "+threadName);
+ System.err.println("SharedResourceRunner.doAndWait() START init: " + initDevice + ", release: "+releaseDevice+" - "+threadName);
}
while (!ready && running) {
try {
@@ -233,20 +235,20 @@ public class SharedResourceRunner implements Runnable {
} catch (final InterruptedException ex) { }
}
if (DEBUG) {
- System.err.println("SharedResourceRunner.doAndWait() set command: " + initConnection + ", release: "+releaseConnection+" - "+threadName);
+ System.err.println("SharedResourceRunner.doAndWait() set command: " + initDevice + ", release: "+releaseDevice+" - "+threadName);
}
- this.initConnection = initConnection;
- this.releaseConnection = releaseConnection;
+ this.initDevice = initDevice;
+ this.releaseDevice = releaseDevice;
this.notifyAll();
// wait until thread has init/released the device
- while ( running && ( !ready || null != this.initConnection || null != this.releaseConnection ) ) {
+ while ( running && ( !ready || null != this.initDevice || null != this.releaseDevice ) ) {
try {
this.wait();
} catch (final InterruptedException ex) { }
}
if (DEBUG) {
- System.err.println("SharedResourceRunner.initializeAndWait END init: " + initConnection + ", release: "+releaseConnection+" - "+threadName);
+ System.err.println("SharedResourceRunner.initializeAndWait END init: " + initDevice + ", release: "+releaseDevice+" - "+threadName);
}
}
// done
@@ -283,40 +285,40 @@ public class SharedResourceRunner implements Runnable {
if (!shouldRelease) {
if (DEBUG) {
- System.err.println("SharedResourceRunner.run(): WOKE UP for device connection init: " + initConnection +
- ", release: " + releaseConnection + " - " + threadName);
+ System.err.println("SharedResourceRunner.run(): WOKE UP for device connection init: " + initDevice +
+ ", release: " + releaseDevice + " - " + threadName);
}
- if(null != initConnection) {
+ if(null != initDevice) {
if (DEBUG) {
- System.err.println("SharedResourceRunner.run(): create Shared for: " + initConnection + " - " + threadName);
+ System.err.println("SharedResourceRunner.run(): create Shared for: " + initDevice + " - " + threadName);
}
Resource sr = null;
try {
- sr = impl.createSharedResource(initConnection);
+ sr = impl.createSharedResource(initDevice);
} catch (final Exception e) {
e.printStackTrace();
}
if (null != sr) {
- impl.mapPut(initConnection, sr);
+ impl.mapPut(initDevice, sr);
}
}
- if(null != releaseConnection) {
+ if(null != releaseDevice) {
if (DEBUG) {
- System.err.println("SharedResourceRunner.run(): release Shared for: " + releaseConnection + " - " + threadName);
+ System.err.println("SharedResourceRunner.run(): release Shared for: " + releaseDevice + " - " + threadName);
}
- final Resource sr = impl.mapGet(releaseConnection);
+ final Resource sr = impl.mapGet(releaseDevice);
if (null != sr) {
try {
impl.releaseSharedResource(sr);
- impl.mapPut(releaseConnection, null);
+ impl.mapPut(releaseDevice, null);
} catch (final Exception e) {
e.printStackTrace();
}
}
}
}
- initConnection = null;
- releaseConnection = null;
+ initDevice = null;
+ releaseDevice = null;
}
if (DEBUG) {
diff --git a/src/jogl/classes/jogamp/opengl/ThreadingImpl.java b/src/jogl/classes/jogamp/opengl/ThreadingImpl.java
index 7b405e524..8545f10bf 100644
--- a/src/jogl/classes/jogamp/opengl/ThreadingImpl.java
+++ b/src/jogl/classes/jogamp/opengl/ThreadingImpl.java
@@ -38,16 +38,16 @@ import java.lang.reflect.InvocationTargetException;
import java.security.AccessController;
import java.security.PrivilegedAction;
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
-import javax.media.opengl.Threading.Mode;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
+import com.jogamp.opengl.Threading.Mode;
import com.jogamp.common.JogampRuntimeException;
import com.jogamp.common.util.PropertyAccess;
import com.jogamp.common.util.ReflectionUtil;
-/** Implementation of the {@link javax.media.opengl.Threading} class. */
+/** Implementation of the {@link com.jogamp.opengl.Threading} class. */
public class ThreadingImpl {
protected static final boolean DEBUG = Debug.debug("Threading");
@@ -127,7 +127,7 @@ public class ThreadingImpl {
public static boolean isX11() { return _isX11; }
public static Mode getMode() { return mode; }
- /** If an implementation of the javax.media.opengl APIs offers a
+ /** If an implementation of the com.jogamp.opengl APIs offers a
multithreading option but the default behavior is single-threading,
this API provides a mechanism for end users to disable single-threading
in this implementation. Users are strongly discouraged from
@@ -144,7 +144,7 @@ public class ThreadingImpl {
if( Mode.MT != mode ) {
singleThreaded = false;
if (Debug.verbose()) {
- System.err.println("Application forced disabling of single-threading of javax.media.opengl implementation");
+ System.err.println("Application forced disabling of single-threading of com.jogamp.opengl implementation");
}
}
}
@@ -188,7 +188,7 @@ public class ThreadingImpl {
}
/** Executes the passed Runnable on the single thread used for all
- OpenGL work in this javax.media.opengl API implementation. It is
+ OpenGL work in this com.jogamp.opengl API implementation. It is
not specified exactly which thread is used for this
purpose. This method should only be called if the single-thread
model is in use and if the current thread is not the OpenGL
diff --git a/src/jogl/classes/jogamp/opengl/ToolkitThreadingPlugin.java b/src/jogl/classes/jogamp/opengl/ToolkitThreadingPlugin.java
index 06fb0fe91..0a28e85eb 100644
--- a/src/jogl/classes/jogamp/opengl/ToolkitThreadingPlugin.java
+++ b/src/jogl/classes/jogamp/opengl/ToolkitThreadingPlugin.java
@@ -40,7 +40,7 @@
package jogamp.opengl;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
public interface ToolkitThreadingPlugin {
/** Indicates whether the current thread is the designated toolkit thread,
@@ -48,13 +48,13 @@ public interface ToolkitThreadingPlugin {
public boolean isToolkitThread() throws GLException;
/** Indicates whether the current thread is the thread on
- which this implementation of the javax.media.opengl APIs
+ which this implementation of the com.jogamp.opengl APIs
performs all of its OpenGL-related work. This method should only
be called if the single-thread model is in effect. */
public boolean isOpenGLThread() throws GLException;
/** Executes the passed Runnable on the single thread used for all
- OpenGL work in this javax.media.opengl API implementation. It is
+ OpenGL work in this com.jogamp.opengl API implementation. It is
not specified exactly which thread is used for this
purpose. This method should only be called if the single-thread
model is in use and if the current thread is not the OpenGL
diff --git a/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java b/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java
index 495887e0f..da81922a4 100644
--- a/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java
+++ b/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java
@@ -30,9 +30,9 @@ package jogamp.opengl.android.av;
import java.io.IOException;
import java.util.List;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLES2;
-import javax.media.opengl.GLException;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLES2;
+import com.jogamp.opengl.GLException;
import com.jogamp.common.os.AndroidVersion;
import com.jogamp.common.os.Platform;
diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java b/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java
index 3f8910fb5..be2d9609f 100644
--- a/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java
+++ b/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java
@@ -42,7 +42,7 @@ package jogamp.opengl.awt;
import java.awt.EventQueue;
-import javax.media.opengl.GLException;
+import com.jogamp.opengl.GLException;
import com.jogamp.common.util.awt.AWTEDTExecutor;
diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java
index a5f5b4702..7cc009668 100644
--- a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java
+++ b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java
@@ -45,11 +45,12 @@ import java.util.Set;
import java.util.Map.Entry;
import javax.imageio.ImageIO;
-import javax.media.nativewindow.util.DimensionImmutable;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLEventListener;
+import com.jogamp.nativewindow.util.DimensionImmutable;
+import com.jogamp.nativewindow.util.PixelFormat;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLEventListener;
import jogamp.opengl.Debug;
@@ -288,8 +289,9 @@ public class AWTTilePainter {
final int tWidth = renderer.getParam(TileRenderer.TR_TILE_WIDTH);
final int tHeight = renderer.getParam(TileRenderer.TR_TILE_HEIGHT);
final AWTGLPixelBufferProvider printBufferProvider = new AWTGLPixelBufferProvider( true /* allowRowStride */ );
- final GLPixelAttributes pixelAttribs = printBufferProvider.getAttributes(gl, componentCount);
- tBuffer = printBufferProvider.allocate(gl, pixelAttribs, tWidth, tHeight, 1, true, 0);
+ final PixelFormat.Composition hostPixelComp = printBufferProvider.getHostPixelComp(gl.getGLProfile(), componentCount);
+ final GLPixelAttributes pixelAttribs = printBufferProvider.getAttributes(gl, componentCount, true);
+ tBuffer = printBufferProvider.allocate(gl, hostPixelComp, pixelAttribs, true, tWidth, tHeight, 1, 0);
renderer.setTileBuffer(tBuffer);
if( flipVertical ) {
vFlipImage = new BufferedImage(tBuffer.width, tBuffer.height, tBuffer.image.getType());
diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java b/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java
index e34ec18b6..9a4d1f9a1 100644
--- a/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java
+++ b/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java
@@ -40,8 +40,8 @@ package jogamp.opengl.awt;
import java.awt.GraphicsEnvironment;
import java.lang.reflect.Method;
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.opengl.GLException;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.opengl.GLException;
public class AWTUtil {
// See whether we're running in headless mode
diff --git a/src/jogl/classes/jogamp/opengl/awt/Java2D.java b/src/jogl/classes/jogamp/opengl/awt/Java2D.java
index 55212025d..f8826f23d 100644
--- a/src/jogl/classes/jogamp/opengl/awt/Java2D.java
+++ b/src/jogl/classes/jogamp/opengl/awt/Java2D.java
@@ -51,11 +51,11 @@ import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import com.jogamp.common.os.Platform;
diff --git a/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java b/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java
index 2f87f01a9..bc6ec3b54 100644
--- a/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java
+++ b/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java
@@ -11,14 +11,14 @@ import java.awt.event.WindowEvent;
import java.util.List;
-import javax.media.opengl.GLProfile;
-import javax.media.opengl.awt.GLCanvas;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLEventListener;
+import com.jogamp.opengl.GLProfile;
+import com.jogamp.opengl.awt.GLCanvas;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLEventListener;
import com.jogamp.common.GlueGenVersion;
import com.jogamp.common.os.Platform;
diff --git a/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java
index 8c6091273..245b6a945 100644
--- a/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/egl/DesktopES2DynamicLibraryBundleInfo.java
@@ -28,9 +28,12 @@
package jogamp.opengl.egl;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
-import jogamp.opengl.*;
+import com.jogamp.opengl.egl.EGL;
+
+import jogamp.opengl.GLDynamicLibraryBundleInfo;
/**
* Implementation of the DynamicLookupHelper for Desktop ES2 (AMD, ..)
@@ -56,7 +59,7 @@ public final class DesktopES2DynamicLibraryBundleInfo extends GLDynamicLibraryBu
@Override
public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) {
- return EGL.eglGetProcAddress(toolGetProcAddressHandle, funcName);
+ return EGLContext.eglGetProcAddress(toolGetProcAddressHandle, funcName);
}
@Override
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
index 964401244..910afcd22 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java
@@ -40,30 +40,41 @@ import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.Map;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import jogamp.opengl.GLContextImpl;
import jogamp.opengl.GLDrawableImpl;
+import jogamp.opengl.egl.EGLExtImpl;
+import jogamp.opengl.egl.EGLExtProcAddressTable;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.nio.Buffers;
import com.jogamp.gluegen.runtime.ProcAddressTable;
import com.jogamp.gluegen.runtime.opengl.GLProcAddressResolver;
import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
import com.jogamp.opengl.GLRendererQuirks;
+import com.jogamp.opengl.egl.EGL;
+import com.jogamp.opengl.egl.EGLExt;
public class EGLContext extends GLContextImpl {
- private boolean eglQueryStringInitialized;
- private boolean eglQueryStringAvailable;
- private EGLExt _eglExt;
// Table that holds the addresses of the native C-language entry points for
// EGL extension functions.
private EGLExtProcAddressTable eglExtProcAddressTable;
+ private EGLExtImpl eglExtImpl;
+
+ static final int CTX_PROFILE_COMPAT = GLContext.CTX_PROFILE_COMPAT;
+ static final int CTX_PROFILE_CORE = GLContext.CTX_PROFILE_CORE;
+ static final int CTX_PROFILE_ES = GLContext.CTX_PROFILE_ES;
+
+ public static String getGLProfile(final int major, final int minor, final int ctp) throws GLException {
+ return GLContext.getGLProfile(major, minor, ctp);
+ }
EGLContext(final GLDrawableImpl drawable,
final GLContext shareWith) {
@@ -72,10 +83,8 @@ public class EGLContext extends GLContextImpl {
@Override
protected void resetStates(final boolean isInit) {
- eglQueryStringInitialized = false;
- eglQueryStringAvailable = false;
eglExtProcAddressTable = null;
- // no inner state _eglExt = null;
+ eglExtImpl = null;
super.resetStates(isInit);
}
@@ -84,11 +93,8 @@ public class EGLContext extends GLContextImpl {
return getEGLExt();
}
- public EGLExt getEGLExt() {
- if (_eglExt == null) {
- _eglExt = new EGLExtImpl(this);
- }
- return _eglExt;
+ public final EGLExt getEGLExt() {
+ return eglExtImpl;
}
@Override
@@ -96,10 +102,6 @@ public class EGLContext extends GLContextImpl {
return eglExtProcAddressTable;
}
- public final EGLExtProcAddressTable getEGLExtProcAddressTable() {
- return eglExtProcAddressTable;
- }
-
@Override
protected Map<String, String> getFunctionNameMap() { return null; }
@@ -113,16 +115,14 @@ public class EGLContext extends GLContextImpl {
@Override
protected void makeCurrentImpl() throws GLException {
- if (EGL.eglGetCurrentContext() != contextHandle) {
- final long dpy = drawable.getNativeSurface().getDisplayHandle();
- if (!EGL.eglMakeCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) {
- throw new GLException("Error making context " + toHexString(contextHandle) +
- " current on Thread " + getThreadName() +
- " with display " + toHexString(dpy) +
- ", drawableWrite " + toHexString(drawable.getHandle()) +
- ", drawableRead "+ toHexString(drawableRead.getHandle()) +
- " - Error code " + toHexString(EGL.eglGetError()) + ", " + this);
- }
+ final long dpy = drawable.getNativeSurface().getDisplayHandle();
+ if ( !EGL.eglMakeCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle) ) {
+ throw new GLException("Error making context " + toHexString(contextHandle) +
+ " current on Thread " + getThreadName() +
+ " with display " + toHexString(dpy) +
+ ", drawableWrite " + toHexString(drawable.getHandle()) +
+ ", drawableRead "+ toHexString(drawableRead.getHandle()) +
+ " - Error code " + toHexString(EGL.eglGetError()) + ", " + this);
}
}
@@ -140,11 +140,6 @@ public class EGLContext extends GLContextImpl {
}
@Override
- protected long createContextARBImpl(final long share, final boolean direct, final int ctp, final int major, final int minor) {
- return 0; // FIXME
- }
-
- @Override
protected void destroyContextARBImpl(final long _context) {
if (!EGL.eglDestroyContext(drawable.getNativeSurface().getDisplayHandle(), _context)) {
final int eglError = EGL.eglGetError();
@@ -155,14 +150,39 @@ public class EGLContext extends GLContextImpl {
}
}
+ private static final int ctx_attribs_idx_major = 0;
+ private static final int ctx_attribs_rom[] = {
+ /* 0 */ EGLExt.EGL_CONTEXT_MAJOR_VERSION_KHR, 0, // alias of EGL.EGL_CONTEXT_CLIENT_VERSION
+ /* 2 */ EGL.EGL_NONE, EGL.EGL_NONE, // EGLExt.EGL_CONTEXT_MINOR_VERSION_KHR
+ /* 4 */ EGL.EGL_NONE, EGL.EGL_NONE, // EGLExt.EGL_CONTEXT_FLAGS_KHR
+ /* 6 */ EGL.EGL_NONE, EGL.EGL_NONE, // EGLExt.EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR
+ /* 8 */ EGL.EGL_NONE, EGL.EGL_NONE, // EGLExt.EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR
+ /* 10 */ EGL.EGL_NONE
+ };
+
@Override
- protected boolean createImpl(final long shareWithHandle) throws GLException {
+ protected long createContextARBImpl(final long share, final boolean direct, final int ctp, final int reqMajor, final int reqMinor) {
final EGLGraphicsConfiguration config = (EGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration();
- final long eglDisplay = config.getScreen().getDevice().getHandle();
- final GLProfile glProfile = drawable.getGLProfile();
+ final EGLGraphicsDevice device = (EGLGraphicsDevice) config.getScreen().getDevice();
+ final long eglDisplay = device.getHandle();
final long eglConfig = config.getNativeConfig();
- // 0 == EGL.EGL_NO_CONTEXT;
-
+ final EGLDrawableFactory factory = (EGLDrawableFactory) drawable.getFactoryImpl();
+
+ final boolean hasOpenGLAPISupport = factory.hasOpenGLAPISupport();
+ final boolean useKHRCreateContext = factory.hasDefaultDeviceKHRCreateContext();
+ final boolean allowOpenGLAPI = hasOpenGLAPISupport && useKHRCreateContext;
+ final boolean ctDesktopGL = 0 == ( GLContext.CTX_PROFILE_ES & ctp );
+ final boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ;
+ final boolean ctFwdCompat = 0 != ( CTX_OPTION_FORWARD & ctp ) ;
+ final boolean ctDebug = 0 != ( CTX_OPTION_DEBUG & ctp ) ;
+
+ if(DEBUG) {
+ System.err.println(getThreadName() + ": EGLContext.createContextARBImpl: Start "+getGLVersion(reqMajor, reqMinor, ctp, "@creation")
+ + ", hasOpenGLAPISupport "+hasOpenGLAPISupport
+ + ", useKHRCreateContext "+useKHRCreateContext
+ + ", allowOpenGLAPI "+allowOpenGLAPI
+ + ", device "+device);
+ }
if ( 0 == eglDisplay ) {
throw new GLException("Error: attempted to create an OpenGL context without a display connection");
}
@@ -170,72 +190,168 @@ public class EGLContext extends GLContextImpl {
throw new GLException("Error: attempted to create an OpenGL context without a graphics configuration");
}
+ /**
+ * It has been experienced w/ Mesa 10.3.2 (EGL 1.4/Gallium)
+ * that even though initial OpenGL context can be created w/o 'EGL_KHR_create_context',
+ * switching the API via 'eglBindAPI(EGL_OpenGL_API)' the latter 'eglCreateContext(..)' fails w/ EGL_BAD_ACCESS.
+ * Hence we require both: OpenGL API support _and_ 'EGL_KHR_create_context'.
+ *
+ * FIXME: Evaluate this issue in more detail!
+ *
+ * FIXME: Utilization of eglBindAPI(..) must be re-evaluated in case we mix ES w/ OpenGL, see EGL 1.4 spec.
+ * This is due to new semantics, i.e. API is bound on a per thread base,
+ * hence it must be switched before makeCurrent w/ different APIs, see:
+ * eglWaitClient();
+ */
+ if( ctDesktopGL && !allowOpenGLAPI ) {
+ // if( ctDesktopGL && !hasOpenGLAPISupport ) {
+ if(DEBUG) {
+ System.err.println(getThreadName() + ": EGLContext.createContextARBImpl: DesktopGL not avail "+getGLVersion(reqMajor, reqMinor, ctp, "@creation"));
+ }
+ return 0; // n/a
+ }
+
try {
- // might be unavailable on EGL < 1.2
- if( !EGL.eglBindAPI(EGL.EGL_OPENGL_ES_API) ) {
- throw new GLException("Caught: eglBindAPI to ES failed , error "+toHexString(EGL.eglGetError()));
+ if( allowOpenGLAPI && device.getEGLVersion().compareTo(Version1_2) >= 0 ) {
+ EGL.eglWaitClient(); // EGL >= 1.2
+ }
+ if( !EGL.eglBindAPI( ctDesktopGL ? EGL.EGL_OPENGL_API : EGL.EGL_OPENGL_ES_API) ) {
+ throw new GLException("Caught: eglBindAPI to "+(ctDesktopGL ? "ES" : "GL")+" failed , error "+toHexString(EGL.eglGetError())+" - "+getGLVersion(reqMajor, reqMinor, ctp, "@creation"));
}
} catch (final GLException glex) {
if (DEBUG) {
- glex.printStackTrace();
+ ExceptionUtils.dumpThrowable("", glex);
}
}
- // Cannot check extension 'EGL_KHR_create_context' before having one current!
+ final int useMajor;
+ if( reqMajor >= 3 &&
+ GLRendererQuirks.existStickyDeviceQuirk( GLDrawableFactory.getEGLFactory().getDefaultDevice(), GLRendererQuirks.GLES3ViaEGLES2Config) ) {
+ useMajor = 2;
+ } else {
+ useMajor = reqMajor;
+ }
+
+ final IntBuffer attribs = Buffers.newDirectIntBuffer(ctx_attribs_rom);
+ if( useKHRCreateContext ) {
+ attribs.put(ctx_attribs_idx_major + 1, useMajor);
- final IntBuffer contextAttrsNIO;
- final int contextVersionReq, contextVersionAttr;
- {
- if ( glProfile.usesNativeGLES3() ) {
- contextVersionReq = 3;
- if( GLRendererQuirks.existStickyDeviceQuirk( GLDrawableFactory.getEGLFactory().getDefaultDevice(), GLRendererQuirks.GLES3ViaEGLES2Config) ) {
- contextVersionAttr = 2;
+ int index = ctx_attribs_idx_major + 2;
+
+ /** if( ctDesktopGL && reqMinor >= 0 ) { // FIXME: No minor version probing for ES currently!
+ attribs.put(index + 0, EGLExt.EGL_CONTEXT_MINOR_VERSION_KHR);
+ attribs.put(index + 1, reqMinor);
+ index += 2;
+ } */
+
+ if( ctDesktopGL && ( useMajor > 3 || useMajor == 3 && reqMinor >= 2 ) ) {
+ attribs.put(index + 0, EGLExt.EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR);
+ if( ctBwdCompat ) {
+ attribs.put(index + 1, EGLExt.EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR);
} else {
- contextVersionAttr = 3;
+ attribs.put(index + 1, EGLExt.EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR);
+ }
+ index += 2;
+ }
+ int flags = 0;
+ if( ctDesktopGL && useMajor >= 3 && !ctBwdCompat && ctFwdCompat ) {
+ flags |= EGLExt.EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
+ }
+ if( ctDebug ) {
+ flags |= EGLExt.EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
+ }
+ // TODO: flags |= EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR
+ if( 0 != flags ) {
+ attribs.put(index + 0, EGLExt.EGL_CONTEXT_FLAGS_KHR);
+ attribs.put(index + 1, flags);
+ index += 2;
+ }
+ if(DEBUG) {
+ System.err.println(getThreadName() + ": EGLContext.createContextARBImpl: attrs.1: major "+useMajor+", flags "+toHexString(flags)+", index "+index);
+ }
+ } else {
+ attribs.put(ctx_attribs_idx_major + 1, useMajor);
+ if(DEBUG) {
+ System.err.println(getThreadName() + ": EGLContext.createContextARBImpl: attrs.2: major "+useMajor);
+ }
+ }
+
+ long ctx=0;
+ try {
+ ctx = EGL.eglCreateContext(eglDisplay, eglConfig, share, attribs);
+ } catch (final RuntimeException re) {
+ if(DEBUG) {
+ System.err.println(getThreadName()+": Info: EGLContext.createContextARBImpl glXCreateContextAttribsARB failed with "+getGLVersion(reqMajor, reqMinor, ctp, "@creation"));
+ ExceptionUtils.dumpThrowable("", re);
+ }
+ }
+
+ if(0!=ctx) {
+ if (!EGL.eglMakeCurrent(eglDisplay, drawable.getHandle(), drawableRead.getHandle(), ctx)) {
+ if(DEBUG) {
+ System.err.println(getThreadName()+": EGLContext.createContextARBImpl couldn't make current "+getGLVersion(reqMajor, reqMinor, ctp, "@creation")+" - error "+toHexString(EGL.eglGetError()));
}
- } else if ( glProfile.usesNativeGLES2() ) {
- contextVersionReq = 2;
- contextVersionAttr = 2;
- } else if ( glProfile.usesNativeGLES1() ) {
- contextVersionReq = 1;
- contextVersionAttr = 1;
+ // release & destroy
+ EGL.eglMakeCurrent(eglDisplay, EGL.EGL_NO_SURFACE, EGL.EGL_NO_SURFACE, EGL.EGL_NO_CONTEXT);
+ EGL.eglDestroyContext(eglDisplay, ctx);
+ ctx = 0;
+ } else if (DEBUG) {
+ System.err.println(getThreadName() + ": EGLContext.createContextARBImpl: OK "+getGLVersion(reqMajor, reqMinor, ctp, "@creation")+", share "+share+", direct "+direct);
+ }
+ } else if (DEBUG) {
+ System.err.println(getThreadName() + ": EGLContext.createContextARBImpl: NO "+getGLVersion(reqMajor, reqMinor, ctp, "@creation")+" - error "+toHexString(EGL.eglGetError()));
+ }
+
+ return ctx;
+ }
+
+ @Override
+ protected boolean createImpl(final long shareWithHandle) throws GLException {
+ final EGLGraphicsConfiguration config = (EGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration();
+ final AbstractGraphicsDevice device = config.getScreen().getDevice();
+ final GLCapabilitiesImmutable glCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
+ final GLProfile glp = glCaps.getGLProfile();
+
+ contextHandle = createContextARB(shareWithHandle, true);
+ if (DEBUG) {
+ if( 0 != contextHandle ) {
+ System.err.println(getThreadName() + ": EGLContext.createImpl: OK (ARB) on eglDevice "+device+
+ ", eglConfig "+config+", "+glp+", shareWith "+toHexString(shareWithHandle)+", error "+toHexString(EGL.eglGetError()));
} else {
- throw new GLException("Error creating OpenGL context - invalid GLProfile: "+glProfile);
+ System.err.println(getThreadName() + ": EGLContext.createImpl: NOT OK (ARB) - creation failed on eglDevice "+device+
+ ", eglConfig "+config+", "+glp+", shareWith "+toHexString(shareWithHandle)+", error "+toHexString(EGL.eglGetError()));
}
- // EGLExt.EGL_CONTEXT_MAJOR_VERSION_KHR == EGL.EGL_CONTEXT_CLIENT_VERSION
- final int[] contextAttrs = new int[] { EGL.EGL_CONTEXT_CLIENT_VERSION, contextVersionAttr, EGL.EGL_NONE };
- contextAttrsNIO = Buffers.newDirectIntBuffer(contextAttrs);
}
- contextHandle = EGL.eglCreateContext(eglDisplay, eglConfig, shareWithHandle, contextAttrsNIO);
- if (contextHandle == 0) {
- throw new GLException("Error creating OpenGL context: eglDisplay "+toHexString(eglDisplay)+
- ", eglConfig "+config+", "+glProfile+", shareWith "+toHexString(shareWithHandle)+", error "+toHexString(EGL.eglGetError()));
+ if( 0 == contextHandle ) {
+ if( !glp.isGLES() ) {
+ throw new GLException(getThreadName()+": Unable to create desktop OpenGL context(ARB n/a) on eglDevice "+device+
+ ", eglConfig "+config+", "+glp+", shareWith "+toHexString(shareWithHandle)+", error "+toHexString(EGL.eglGetError()));
+ }
+ final int[] reqMajorCTP = new int[] { 0, 0 };
+ GLContext.getRequestMajorAndCompat(glp, reqMajorCTP);
+ reqMajorCTP[1] |= getContextCreationFlags();
+
+ contextHandle = createContextARBImpl(shareWithHandle, true, reqMajorCTP[1], reqMajorCTP[0], 0);
+ if( 0 == contextHandle ) {
+ throw new GLException(getThreadName()+": Unable to create ES OpenGL context on eglDevice "+device+
+ ", eglConfig "+config+", "+glp+", shareWith "+toHexString(shareWithHandle)+", error "+toHexString(EGL.eglGetError()));
+ }
+ if( !setGLFunctionAvailability(true, reqMajorCTP[0], 0, reqMajorCTP[1], false /* strictMatch */, false /* withinGLVersionsMapping */) ) {
+ EGL.eglMakeCurrent(drawable.getNativeSurface().getDisplayHandle(), EGL.EGL_NO_SURFACE, EGL.EGL_NO_SURFACE, EGL.EGL_NO_CONTEXT);
+ EGL.eglDestroyContext(drawable.getNativeSurface().getDisplayHandle(), contextHandle);
+ contextHandle = 0;
+ throw new InternalError("setGLFunctionAvailability !strictMatch failed");
+ }
}
if (DEBUG) {
- System.err.println(getThreadName() + ": Created OpenGL context 0x" +
+ System.err.println(getThreadName() + ": EGLContext.createImpl: Created OpenGL context 0x" +
Long.toHexString(contextHandle) +
",\n\twrite surface 0x" + Long.toHexString(drawable.getHandle()) +
",\n\tread surface 0x" + Long.toHexString(drawableRead.getHandle())+
",\n\t"+this+
",\n\tsharing with 0x" + Long.toHexString(shareWithHandle));
}
- if (!EGL.eglMakeCurrent(eglDisplay, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) {
- throw new GLException("Error making context " +
- toHexString(contextHandle) + " current: error code " + toHexString(EGL.eglGetError()));
- }
- if( !setGLFunctionAvailability(true, contextVersionReq, 0, CTX_PROFILE_ES,
- true /* strictMatch */, // always req. strict match
- false /* withinGLVersionsMapping */) ) {
- if(DEBUG) {
- System.err.println(getThreadName() + ": createImpl: setGLFunctionAvailability FAILED delete "+toHexString(contextHandle));
- }
- EGL.eglMakeCurrent(drawable.getNativeSurface().getDisplayHandle(), EGL.EGL_NO_SURFACE, EGL.EGL_NO_SURFACE, EGL.EGL_NO_CONTEXT);
- EGL.eglDestroyContext(drawable.getNativeSurface().getDisplayHandle(), contextHandle);
- contextHandle = 0;
- return false;
- } else {
- return true;
- }
+ return 0 != contextHandle;
}
@Override
@@ -246,8 +362,6 @@ public class EGLContext extends GLContextImpl {
if (DEBUG) {
System.err.println(getThreadName() + ": Initializing EGLextension address table: "+key);
}
- eglQueryStringInitialized = false;
- eglQueryStringAvailable = false;
ProcAddressTable table = null;
synchronized(mappedContextTypeObjectLock) {
@@ -258,31 +372,52 @@ public class EGLContext extends GLContextImpl {
if(DEBUG) {
System.err.println(getThreadName() + ": GLContext EGL ProcAddressTable reusing key("+key+") -> "+toHexString(table.hashCode()));
}
+ if( null == eglExtImpl || eglExtImpl.getProcAdressTable() != eglExtProcAddressTable ) {
+ eglExtImpl = new EGLExtImpl(this, eglExtProcAddressTable);
+ }
} else {
eglExtProcAddressTable = new EGLExtProcAddressTable(new GLProcAddressResolver());
- resetProcAddressTable(getEGLExtProcAddressTable());
+ resetProcAddressTable(eglExtProcAddressTable);
synchronized(mappedContextTypeObjectLock) {
- mappedGLXProcAddress.put(key, getEGLExtProcAddressTable());
+ mappedGLXProcAddress.put(key, eglExtProcAddressTable);
if(DEBUG) {
- System.err.println(getThreadName() + ": GLContext EGL ProcAddressTable mapping key("+key+") -> "+toHexString(getEGLExtProcAddressTable().hashCode()));
+ System.err.println(getThreadName() + ": GLContext EGL ProcAddressTable mapping key("+key+") -> "+toHexString(eglExtProcAddressTable.hashCode()));
}
}
+ eglExtImpl = new EGLExtImpl(this, eglExtProcAddressTable);
}
}
@Override
protected final StringBuilder getPlatformExtensionsStringImpl() {
+ final EGLGraphicsDevice device = (EGLGraphicsDevice) drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice();
+ return getPlatformExtensionsStringImpl(device);
+ }
+ final static StringBuilder getPlatformExtensionsStringImpl(final EGLGraphicsDevice device) {
final StringBuilder sb = new StringBuilder();
- if (!eglQueryStringInitialized) {
- eglQueryStringAvailable = getDrawableImpl().getGLDynamicLookupHelper().isFunctionAvailable("eglQueryString");
- eglQueryStringInitialized = true;
- }
- if (eglQueryStringAvailable) {
- final String ret = EGL.eglQueryString(drawable.getNativeSurface().getDisplayHandle(), EGL.EGL_EXTENSIONS);
+ device.lock();
+ try{
+ final long handle = device.getHandle();
if (DEBUG) {
- System.err.println("EGL extensions: " + ret);
+ System.err.println("EGL PlatformExtensions: Device "+device);
+ EGLDrawableFactory.dumpEGLInfo("EGL PlatformExtensions: ", handle);
}
- sb.append(ret);
+ if( device.getEGLVersion().compareTo(Version1_5) >= 0 ) {
+ final String ret = EGL.eglQueryString(EGL.EGL_NO_DISPLAY, EGL.EGL_EXTENSIONS);
+ if (DEBUG) {
+ System.err.println("EGL extensions (Client): " + ret);
+ }
+ sb.append(ret).append(" ");
+ }
+ if( 0 != handle ) {
+ final String ret = EGL.eglQueryString(handle, EGL.EGL_EXTENSIONS);
+ if (DEBUG) {
+ System.err.println("EGL extensions (Server): " + ret);
+ }
+ sb.append(ret).append(" ");
+ }
+ } finally {
+ device.unlock();
}
return sb;
}
@@ -295,12 +430,22 @@ public class EGLContext extends GLContextImpl {
return EGL.eglSwapInterval(drawable.getNativeSurface().getDisplayHandle(), interval);
}
+ static long eglGetProcAddress(final long eglGetProcAddressHandle, final String procname)
+ {
+ if (0 == eglGetProcAddressHandle) {
+ throw new GLException("Passed null pointer for method \"eglGetProcAddress\"");
+ }
+ return dispatch_eglGetProcAddress0(procname, eglGetProcAddressHandle);
+ }
+ /** Entry point to C language function: <code> __EGLFuncPtr eglGetProcAddress(const char * procname) </code> <br>Part of <code>EGL_VERSION_1_X</code> */
+ static private native long dispatch_eglGetProcAddress0(String procname, long procAddress);
+
//
// Accessible ..
//
- /* pp */ void mapCurrentAvailableGLVersion(final AbstractGraphicsDevice device) {
- mapStaticGLVersion(device, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
+ /* pp */ void mapCurrentAvailableGLESVersion(final AbstractGraphicsDevice device) {
+ mapStaticGLESVersion(device, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions);
}
/* pp */ int getContextOptions() { return ctxOptions; }
/* pp */ static void mapStaticGLESVersion(final AbstractGraphicsDevice device, final GLCapabilitiesImmutable caps) {
@@ -317,19 +462,19 @@ public class EGLContext extends GLContextImpl {
if( !caps.getHardwareAccelerated() ) {
reqMajorCTP[1] |= GLContext.CTX_IMPL_ACCEL_SOFT;
}
- mapStaticGLVersion(device, reqMajorCTP[0], 0, reqMajorCTP[1]);
+ mapStaticGLESVersion(device, reqMajorCTP[0], 0, reqMajorCTP[1]);
}
- /* pp */ static void mapStaticGLVersion(final AbstractGraphicsDevice device, final int major, final int minor, final int ctp) {
+ /* pp */ static void mapStaticGLESVersion(final AbstractGraphicsDevice device, final int major, final int minor, final int ctp) {
if( 0 != ( ctp & GLContext.CTX_PROFILE_ES) ) {
// ES1, ES2, ES3, ..
- mapStaticGLVersion(device, major /* reqMajor */, major, minor, ctp);
+ mapStaticGLESVersion(device, major /* reqMajor */, major, minor, ctp);
if( 3 == major ) {
// map ES2 -> ES3
- mapStaticGLVersion(device, 2 /* reqMajor */, major, minor, ctp);
+ mapStaticGLESVersion(device, 2 /* reqMajor */, major, minor, ctp);
}
}
}
- private static void mapStaticGLVersion(final AbstractGraphicsDevice device, final int reqMajor, final int major, final int minor, final int ctp) {
+ private static void mapStaticGLESVersion(final AbstractGraphicsDevice device, final int reqMajor, final int major, final int minor, final int ctp) {
GLContext.mapAvailableGLVersion(device, reqMajor, GLContext.CTX_PROFILE_ES, major, minor, ctp);
if(! ( device instanceof EGLGraphicsDevice ) ) {
final EGLGraphicsDevice eglDevice = new EGLGraphicsDevice(device.getHandle(), EGL.EGL_NO_DISPLAY, device.getConnection(), device.getUnitID(), null);
@@ -343,8 +488,8 @@ public class EGLContext extends GLContextImpl {
protected static boolean getAvailableGLVersionsSet(final AbstractGraphicsDevice device) {
return GLContext.getAvailableGLVersionsSet(device);
}
- protected static void setAvailableGLVersionsSet(final AbstractGraphicsDevice device) {
- GLContext.setAvailableGLVersionsSet(device);
+ protected static void setAvailableGLVersionsSet(final AbstractGraphicsDevice device, final boolean set) {
+ GLContext.setAvailableGLVersionsSet(device, set);
}
protected static String toHexString(final int hex) {
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java
index 9499c70f4..3d2d03403 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java
@@ -31,16 +31,19 @@ package jogamp.opengl.egl;
import java.nio.IntBuffer;
import java.util.Iterator;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.nativewindow.ToolkitLock;
-import javax.media.opengl.GLException;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.nativewindow.ToolkitLock;
+import com.jogamp.opengl.GLException;
import jogamp.opengl.Debug;
+import com.jogamp.common.ExceptionUtils;
+import com.jogamp.common.nio.Buffers;
import com.jogamp.common.util.LongObjectHashMap;
import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
+import com.jogamp.opengl.egl.EGL;
/**
* This implementation provides recursive calls to
@@ -148,7 +151,7 @@ public class EGLDisplayUtil {
if(DEBUG || verbose || openEGLDisplays.size() > 0 ) {
System.err.println("EGLDisplayUtil.EGLDisplays: Shutdown (open: "+openEGLDisplays.size()+")");
if(DEBUG) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
if( openEGLDisplays.size() > 0) {
dumpOpenDisplayConnections();
@@ -198,17 +201,30 @@ public class EGLDisplayUtil {
*
* @see EGL#eglInitialize(long, IntBuffer, IntBuffer)
*/
- private static synchronized boolean eglInitialize(final long eglDisplay, final IntBuffer major, final IntBuffer minor) {
+ private static synchronized boolean eglInitialize(final long eglDisplay, final int[] major, final int[] minor) {
if( EGL.EGL_NO_DISPLAY == eglDisplay) {
return false;
}
- final EGLDisplayRef d = EGLDisplayRef.getOrCreateOpened(eglDisplay, major, minor);
+ final EGLDisplayRef d = EGLDisplayRef.getOrCreateOpened(eglDisplay, _eglMajorVersion, _eglMinorVersion);
+ final int _major = _eglMajorVersion.get(0);
+ final int _minor = _eglMinorVersion.get(0);
+ if( null != major && null != minor ) {
+ if( null != d ) {
+ major[0] = _major;
+ minor[0] = _minor;
+ } else {
+ major[0] = 0;
+ minor[0] = 0;
+ }
+ }
if(DEBUG) {
- System.err.println("EGLDisplayUtil.eglInitialize("+EGLContext.toHexString(eglDisplay)+" ...): "+d+" = "+(null != d)+", singletonEGLDisplay "+singletonEGLDisplay+" (use "+useSingletonEGLDisplay+")");
+ System.err.println("EGLDisplayUtil.eglInitialize("+EGLContext.toHexString(eglDisplay)+" ...): "+d+" = "+(null != d)+", eglVersion "+_major+"."+_minor+", singletonEGLDisplay "+singletonEGLDisplay+" (use "+useSingletonEGLDisplay+")");
// Thread.dumpStack();
}
return null != d;
}
+ private static final IntBuffer _eglMajorVersion = Buffers.newDirectIntBuffer(1);
+ private static final IntBuffer _eglMinorVersion = Buffers.newDirectIntBuffer(1);
/**
* @param nativeDisplayID
@@ -222,7 +238,7 @@ public class EGLDisplayUtil {
* @see #eglGetDisplay(long)
* @see #eglInitialize(long, IntBuffer, IntBuffer)
*/
- private static synchronized int eglGetDisplayAndInitialize(final long nativeDisplayID, final long[] eglDisplay, final int[] eglErr, final IntBuffer major, final IntBuffer minor) {
+ private static synchronized int eglGetDisplayAndInitialize(final long nativeDisplayID, final long[] eglDisplay, final int[] eglErr, final int[] major, final int[] minor) {
eglDisplay[0] = EGL.EGL_NO_DISPLAY;
final long _eglDisplay = eglGetDisplay( nativeDisplayID );
if ( EGL.EGL_NO_DISPLAY == _eglDisplay ) {
@@ -244,13 +260,15 @@ public class EGLDisplayUtil {
*
* @throws GLException if {@link EGL#eglGetDisplay(long)} or {@link EGL#eglInitialize(long, int[], int, int[], int)} fails incl fallback
* @param nativeDisplayID in/out array of size 1, passing the requested nativeVisualID, may return a different revised nativeVisualID handle
+ * @param major
+ * @param minor
* @return the initialized EGL display ID
* @throws GLException if not successful
*/
- private static synchronized long eglGetDisplayAndInitialize(final long[] nativeDisplayID) {
+ private static synchronized long eglGetDisplayAndInitialize(final long[] nativeDisplayID, final int[] major, final int[] minor) {
final long[] eglDisplay = new long[1];
final int[] eglError = new int[1];
- int eglRes = EGLDisplayUtil.eglGetDisplayAndInitialize(nativeDisplayID[0], eglDisplay, eglError, null, null);
+ int eglRes = EGLDisplayUtil.eglGetDisplayAndInitialize(nativeDisplayID[0], eglDisplay, eglError, major, minor);
if( EGL.EGL_SUCCESS == eglRes ) {
return eglDisplay[0];
}
@@ -258,7 +276,7 @@ public class EGLDisplayUtil {
if(DEBUG) {
System.err.println("EGLDisplayUtil.eglGetAndInitDisplay failed with native "+EGLContext.toHexString(nativeDisplayID[0])+", error "+EGLContext.toHexString(eglRes)+"/"+EGLContext.toHexString(eglError[0])+" - fallback!");
}
- eglRes = EGLDisplayUtil.eglGetDisplayAndInitialize(EGL.EGL_DEFAULT_DISPLAY, eglDisplay, eglError, null, null);
+ eglRes = EGLDisplayUtil.eglGetDisplayAndInitialize(EGL.EGL_DEFAULT_DISPLAY, eglDisplay, eglError, major, minor);
if( EGL.EGL_SUCCESS == eglRes ) {
nativeDisplayID[0] = EGL.EGL_DEFAULT_DISPLAY;
return eglDisplay[0];
@@ -286,8 +304,8 @@ public class EGLDisplayUtil {
private static final EGLGraphicsDevice.EGLDisplayLifecycleCallback eglLifecycleCallback = new EGLGraphicsDevice.EGLDisplayLifecycleCallback() {
@Override
- public long eglGetAndInitDisplay(final long[] nativeDisplayID) {
- return eglGetDisplayAndInitialize(nativeDisplayID);
+ public long eglGetAndInitDisplay(final long[] nativeDisplayID, final int[] major, final int[] minor) {
+ return eglGetDisplayAndInitialize(nativeDisplayID, major, minor);
}
@Override
public void eglTerminate(final long eglDisplayHandle) {
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
index bacf9f18e..e63a63634 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java
@@ -36,114 +36,65 @@
package jogamp.opengl.egl;
-import java.nio.IntBuffer;
-
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindow;
-import javax.media.nativewindow.ProxySurface;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLException;
+import com.jogamp.nativewindow.ProxySurface;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLException;
+import jogamp.nativewindow.ProxySurfaceImpl;
import jogamp.opengl.GLDrawableImpl;
-import jogamp.opengl.GLDynamicLookupHelper;
-import com.jogamp.common.nio.Buffers;
import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
+import com.jogamp.opengl.egl.EGL;
-public abstract class EGLDrawable extends GLDrawableImpl {
+public class EGLDrawable extends GLDrawableImpl {
+ static boolean DEBUG = GLDrawableImpl.DEBUG;
- protected EGLDrawable(final EGLDrawableFactory factory, final NativeSurface component) throws GLException {
+ protected EGLDrawable(final EGLDrawableFactory factory, final EGLSurface component) throws GLException {
super(factory, component, false);
}
@Override
- public abstract GLContext createContext(GLContext shareWith);
-
- protected abstract long createSurface(EGLGraphicsConfiguration config, int width, int height, long nativeSurfaceHandle);
-
- private final long createEGLSurface() {
- final EGLWrappedSurface eglws = (EGLWrappedSurface) surface;
- final EGLGraphicsConfiguration eglConfig = (EGLGraphicsConfiguration) eglws.getGraphicsConfiguration();
- final NativeSurface upstreamSurface = eglws.getUpstreamSurface();
-
- long eglSurface = createSurface(eglConfig, eglws.getSurfaceWidth(), eglws.getSurfaceHeight(), upstreamSurface.getSurfaceHandle());
-
- int eglError0;
- if (EGL.EGL_NO_SURFACE == eglSurface) {
- eglError0 = EGL.eglGetError();
- if(EGL.EGL_BAD_NATIVE_WINDOW == eglError0) {
- // Try window handle if available and differs (Windows HDC / HWND).
- // ANGLE impl. required HWND on Windows.
- if(upstreamSurface instanceof NativeWindow) {
- final NativeWindow nw = (NativeWindow) upstreamSurface;
- if(nw.getWindowHandle() != nw.getSurfaceHandle()) {
- if(DEBUG) {
- System.err.println(getThreadName() + ": Info: Creation of window surface w/ surface handle failed: "+eglConfig+", error "+toHexString(eglError0)+", retry w/ windowHandle");
- }
- eglSurface = createSurface(eglConfig, eglws.getSurfaceWidth(), eglws.getSurfaceHeight(), nw.getWindowHandle());
- if (EGL.EGL_NO_SURFACE == eglSurface) {
- eglError0 = EGL.eglGetError();
- }
- }
- }
- }
- } else {
- eglError0 = EGL.EGL_SUCCESS;
- }
- if (EGL.EGL_NO_SURFACE == eglSurface) {
- throw new GLException("Creation of window surface failed: "+eglConfig+", "+surface+", error "+toHexString(eglError0));
- }
- if(DEBUG) {
- System.err.println(getThreadName() + ": createEGLSurface handle "+toHexString(eglSurface));
- }
- return eglSurface;
+ public final GLContext createContext(final GLContext shareWith) {
+ return new EGLContext(this, shareWith);
}
@Override
protected final void createHandle() {
- final EGLWrappedSurface eglws = (EGLWrappedSurface) surface;
+ final EGLSurface eglSurf = (EGLSurface) surface;
if(DEBUG) {
- System.err.println(getThreadName() + ": createHandle of "+eglws);
+ System.err.println(getThreadName() + ": createHandle of "+eglSurf);
+ ProxySurfaceImpl.dumpHierarchy(System.err, eglSurf);
}
- if( eglws.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) {
- if( EGL.EGL_NO_SURFACE != eglws.getSurfaceHandle() ) {
- throw new InternalError("Set surface but claimed to be invalid: "+eglws);
+ if( eglSurf.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) {
+ if( EGL.EGL_NO_SURFACE != eglSurf.getSurfaceHandle() ) {
+ throw new InternalError("Set surface but claimed to be invalid: "+eglSurf);
}
- eglws.setSurfaceHandle( createEGLSurface() );
- } else if( EGL.EGL_NO_SURFACE == eglws.getSurfaceHandle() ) {
- throw new InternalError("Nil surface but claimed to be valid: "+eglws);
+ if( !eglSurf.containsUpstreamOptionBits( ProxySurface.OPT_UPSTREAM_SURFACELESS ) ) {
+ eglSurf.setEGLSurfaceHandle();
+ }
+ } else if( EGL.EGL_NO_SURFACE == eglSurf.getSurfaceHandle() ) {
+ throw new InternalError("Nil surface but claimed to be valid: "+eglSurf);
}
}
@Override
protected void destroyHandle() {
- final EGLWrappedSurface eglws = (EGLWrappedSurface) surface;
+ final EGLSurface eglSurf = (EGLSurface) surface;
+ final long eglSurfHandle = eglSurf.getSurfaceHandle();
if(DEBUG) {
- System.err.println(getThreadName() + ": destroyHandle of "+eglws);
- }
- if( EGL.EGL_NO_SURFACE == eglws.getSurfaceHandle() ) {
- throw new InternalError("Nil surface but claimed to be valid: "+eglws);
- }
- final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) eglws.getGraphicsConfiguration().getScreen().getDevice();
- if( eglws.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) {
- EGL.eglDestroySurface(eglDevice.getHandle(), eglws.getSurfaceHandle());
- eglws.setSurfaceHandle(EGL.EGL_NO_SURFACE);
+ System.err.println(getThreadName() + ": destroyHandle of "+eglSurf);
}
- }
-
- protected static boolean isValidEGLSurface(final long eglDisplayHandle, final long surfaceHandle) {
- if( 0 == surfaceHandle ) {
- return false;
+ if( !eglSurf.containsUpstreamOptionBits( ProxySurface.OPT_UPSTREAM_SURFACELESS ) &&
+ EGL.EGL_NO_SURFACE == eglSurfHandle ) {
+ throw new InternalError("Nil surface but claimed to be valid: "+eglSurf);
}
- final IntBuffer val = Buffers.newDirectIntBuffer(1);
- final boolean eglSurfaceValid = EGL.eglQuerySurface(eglDisplayHandle, surfaceHandle, EGL.EGL_CONFIG_ID, val);
- if( !eglSurfaceValid ) {
- final int eglErr = EGL.eglGetError();
- if(DEBUG) {
- System.err.println(getThreadName() + ": EGLDrawable.isValidEGLSurface eglQuerySuface failed: error "+toHexString(eglErr)+", "+toHexString(surfaceHandle));
+ final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) eglSurf.getGraphicsConfiguration().getScreen().getDevice();
+ if( eglSurf.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) {
+ if( EGL.EGL_NO_SURFACE != eglSurfHandle ) {
+ EGL.eglDestroySurface(eglDevice.getHandle(), eglSurfHandle);
+ eglSurf.setSurfaceHandle(EGL.EGL_NO_SURFACE);
}
}
- return eglSurfaceValid;
}
@Override
@@ -165,19 +116,6 @@ public abstract class EGLDrawable extends GLDrawableImpl {
}
@Override
- public GLDynamicLookupHelper getGLDynamicLookupHelper() {
- if (getGLProfile().usesNativeGLES3()) {
- return getFactoryImpl().getGLDynamicLookupHelper(3);
- } else if (getGLProfile().usesNativeGLES2()) {
- return getFactoryImpl().getGLDynamicLookupHelper(2);
- } else if (getGLProfile().usesNativeGLES1()) {
- return getFactoryImpl().getGLDynamicLookupHelper(1);
- } else {
- throw new GLException("Unsupported: "+getGLProfile());
- }
- }
-
- @Override
public String toString() {
return getClass().getName()+"[realized "+isRealized()+
",\n\tfactory "+getFactory()+
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
index 2edb22314..8e2535309 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java
@@ -40,33 +40,31 @@ import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.DefaultGraphicsScreen;
-import javax.media.nativewindow.MutableSurface;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.nativewindow.ProxySurface;
-import javax.media.nativewindow.UpstreamSurfaceHook;
-import javax.media.nativewindow.VisualIDHolder;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesChooser;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.DefaultGraphicsScreen;
+import com.jogamp.nativewindow.MutableSurface;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.nativewindow.ProxySurface;
+import com.jogamp.nativewindow.UpstreamSurfaceHook;
+import com.jogamp.nativewindow.VisualIDHolder;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesChooser;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import jogamp.common.os.PlatformPropsImpl;
-import jogamp.nativewindow.WrappedSurface;
import jogamp.opengl.Debug;
import jogamp.opengl.GLContextImpl;
import jogamp.opengl.GLDrawableFactoryImpl;
@@ -75,16 +73,22 @@ import jogamp.opengl.GLDynamicLookupHelper;
import jogamp.opengl.GLGraphicsConfigurationUtil;
import jogamp.opengl.SharedResourceRunner;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.nio.PointerBuffer;
+import com.jogamp.common.os.DynamicLookupHelper;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.PropertyAccess;
import com.jogamp.common.util.ReflectionUtil;
+import com.jogamp.common.util.VersionNumber;
+import com.jogamp.nativewindow.GenericUpstreamSurfacelessHook;
import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
import com.jogamp.opengl.GLRendererQuirks;
+import com.jogamp.opengl.egl.EGL;
public class EGLDrawableFactory extends GLDrawableFactoryImpl {
protected static final boolean DEBUG = GLDrawableFactoryImpl.DEBUG; // allow package access
+ private static final boolean DEBUG_SHAREDCTX = DEBUG || GLContext.DEBUG;
/* package */ static final boolean QUERY_EGL_ES_NATIVE_TK;
@@ -93,8 +97,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
QUERY_EGL_ES_NATIVE_TK = PropertyAccess.isPropertyDefined("jogl.debug.EGLDrawableFactory.QueryNativeTK", true);
}
+ private static boolean eglDynamicLookupHelperInit = false;
private static GLDynamicLookupHelper eglES1DynamicLookupHelper = null;
private static GLDynamicLookupHelper eglES2DynamicLookupHelper = null;
+ private static GLDynamicLookupHelper eglGLnDynamicLookupHelper = null;
private static final boolean isANGLE(final GLDynamicLookupHelper dl) {
if(Platform.OSType.WINDOWS == PlatformPropsImpl.OS_TYPE) {
@@ -112,50 +118,103 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
dl.isFunctionAvailable("glColorPointer");
}
- public EGLDrawableFactory() {
- super();
+ private static class EGLFeatures {
+ public final String vendor;
+ public final VersionNumber version;
+ public final boolean hasGLAPI;
+ public final boolean hasKHRCreateContext;
+ public final boolean hasKHRSurfaceless;
- // Register our GraphicsConfigurationFactory implementations
- // The act of constructing them causes them to be registered
- EGLGraphicsConfigurationFactory.registerFactory();
-
- // Check for other underlying stuff ..
- if(NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true)) {
- hasX11 = true;
- try {
- ReflectionUtil.createInstance("jogamp.opengl.x11.glx.X11GLXGraphicsConfigurationFactory", EGLDrawableFactory.class.getClassLoader());
- } catch (final Exception jre) { /* n/a .. */ }
+ public EGLFeatures(final EGLGraphicsDevice device) {
+ final long eglDisplay = device.getHandle();
+ vendor = EGL.eglQueryString(eglDisplay, EGL.EGL_VENDOR);
+ if(DEBUG) {
+ System.err.println("EGLFeatures on device "+device+", vendor "+vendor);
+ }
+ version = device.getEGLVersion();
+ final boolean hasEGL_1_4 = version.compareTo(GLContext.Version1_4) >= 0;
+ final boolean hasEGL_1_5 = version.compareTo(GLContext.Version1_5) >= 0;
+ {
+ boolean _hasGLAPI = false;
+ final String eglClientAPIStr = EGL.eglQueryString(eglDisplay, EGL.EGL_CLIENT_APIS);
+ if( hasEGL_1_4 ) {
+ final String[] eglClientAPIs = eglClientAPIStr.split("\\s");
+ for(int i=eglClientAPIs.length-1; i>=0; i--) {
+ _hasGLAPI = eglClientAPIs[i].equals("OpenGL");
+ }
+ }
+ hasGLAPI = _hasGLAPI;
+ if(DEBUG) {
+ System.err.println(" Client APIs: "+eglClientAPIStr+"; has EGL 1.4 "+hasEGL_1_4+" -> has OpenGL "+hasGLAPI);
+ }
+ }
+ {
+ final String extensions = EGLContext.getPlatformExtensionsStringImpl(device).toString();
+ if( hasEGL_1_5 ) {
+ // subsumed in EGL 1.5
+ hasKHRCreateContext = true;
+ hasKHRSurfaceless = true;
+ } else {
+ if( hasEGL_1_4 ) {
+ // requires EGL 1.4
+ hasKHRCreateContext = extensions.contains("EGL_KHR_create_context");
+ } else {
+ hasKHRCreateContext = false;
+ }
+ hasKHRSurfaceless = extensions.contains("EGL_KHR_surfaceless_context");
+ }
+ if(DEBUG) {
+ System.err.println(" Extensions: "+extensions);
+ System.err.println(" KHR_create_context: "+hasKHRCreateContext);
+ System.err.println(" KHR_surfaceless_context: "+hasKHRSurfaceless);
+ }
+ }
+ }
+ public final String toString() {
+ return "EGLFeatures[vendor "+vendor+", version "+version+
+ ", has[GL-API "+hasGLAPI+", KHR[CreateContext "+hasKHRCreateContext+", Surfaceless "+hasKHRSurfaceless+"]]]";
}
+ }
+
+ static class EGLAcc extends EGL {
+ protected static boolean resetProcAddressTable(final DynamicLookupHelper lookup) {
+ return EGL.resetProcAddressTable(lookup);
+ }
+ }
+ static final String eglInitializeFuncName = "eglInitialize";
- // FIXME: Probably need to move EGL from a static model
- // to a dynamic one, where there can be 2 instances
- // for each ES profile with their own ProcAddressTable.
+ public EGLDrawableFactory() {
+ super();
synchronized(EGLDrawableFactory.class) {
- final boolean hasDesktopES2 = null != eglES2DynamicLookupHelper;
+ if( eglDynamicLookupHelperInit ) {
+ return;
+ }
+ eglDynamicLookupHelperInit = true;
- if(!hasDesktopES2 && null==eglES1DynamicLookupHelper) {
- GLDynamicLookupHelper tmp=null;
+ // Check for other underlying stuff ..
+ if(NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true)) {
+ hasX11 = true;
try {
- tmp = new GLDynamicLookupHelper(new EGLES1DynamicLibraryBundleInfo());
- } catch (final GLException gle) {
- if(DEBUG) {
- gle.printStackTrace();
- }
- }
- if(null!=tmp && tmp.isLibComplete()) {
- eglES1DynamicLookupHelper = tmp;
- EGL.resetProcAddressTable(eglES1DynamicLookupHelper);
- final boolean isANGLEES1 = isANGLE(eglES1DynamicLookupHelper);
- isANGLE |= isANGLEES1;
- if (DEBUG || GLProfile.DEBUG) {
- System.err.println("Info: EGLDrawableFactory: EGL ES1 - OK, isANGLE: "+isANGLEES1);
- }
- } else if (DEBUG || GLProfile.DEBUG) {
- System.err.println("Info: EGLDrawableFactory: EGL ES1 - NOPE (ES1 lib)");
- }
+ ReflectionUtil.createInstance("jogamp.opengl.x11.glx.X11GLXGraphicsConfigurationFactory", EGLDrawableFactory.class.getClassLoader());
+ } catch (final Exception jre) { /* n/a .. */ }
}
- if(!hasDesktopES2 && null==eglES2DynamicLookupHelper) {
+
+ /**
+ * FIXME: Probably need to move EGL from a static model
+ * to a dynamic one, where there can be 2 instances
+ * for each ES profile with their own ProcAddressTable.
+ *
+ * Since EGL is designed to be static
+ * we validate the function address of 'eglInitialize'
+ * with all EGL/ES and EGL/GL combinations.
+ * In case this address doesn't match the primary tuple EGL/ES2
+ * the profile is skipped!
+ */
+ boolean eglTableReset = false;
+ long eglInitializeAddress = 0;
+ // Setup: eglES2DynamicLookupHelper[, eglES1DynamicLookupHelper]
+ {
GLDynamicLookupHelper tmp=null;
try {
tmp = new GLDynamicLookupHelper(new EGLES2DynamicLibraryBundleInfo());
@@ -164,9 +223,9 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
gle.printStackTrace();
}
}
- if(null!=tmp && tmp.isLibComplete()) {
+ if( null != tmp && tmp.isLibComplete() && true == ( eglTableReset = EGLAcc.resetProcAddressTable(tmp) ) ) {
+ eglInitializeAddress = tmp.dynamicLookupFunction(eglInitializeFuncName);
eglES2DynamicLookupHelper = tmp;
- EGL.resetProcAddressTable(eglES2DynamicLookupHelper);
final boolean includesES1 = null == eglES1DynamicLookupHelper && includesES1(eglES2DynamicLookupHelper);
if(includesES1) {
eglES1DynamicLookupHelper = tmp;
@@ -174,7 +233,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
final boolean isANGLEES2 = isANGLE(eglES2DynamicLookupHelper);
isANGLE |= isANGLEES2;
if (DEBUG || GLProfile.DEBUG) {
- System.err.println("Info: EGLDrawableFactory: EGL ES2 - OK (includesES1 "+includesES1+", isANGLE: "+isANGLEES2+")");
+ System.err.println("Info: EGLDrawableFactory: EGL ES2 - OK (includesES1 "+includesES1+", isANGLE: "+isANGLEES2+", eglInitialize 0x"+Long.toHexString(eglInitializeAddress)+")");
if(includesES1) {
System.err.println("Info: EGLDrawableFactory: EGL ES1 - OK (ES2 lib)");
}
@@ -183,7 +242,85 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
System.err.println("Info: EGLDrawableFactory: EGL ES2 - NOPE");
}
}
- if( null != eglES2DynamicLookupHelper || null != eglES1DynamicLookupHelper ) {
+ // Setup: eglES1DynamicLookupHelper
+ if( null == eglES1DynamicLookupHelper ) {
+ GLDynamicLookupHelper tmp=null;
+ try {
+ tmp = new GLDynamicLookupHelper(new EGLES1DynamicLibraryBundleInfo());
+ } catch (final GLException gle) {
+ if(DEBUG) {
+ gle.printStackTrace();
+ }
+ }
+ if( null != tmp && tmp.isLibComplete() ) {
+ final boolean ok;
+ final long _eglInitializeAddress;
+ if( !eglTableReset ) {
+ if( true == ( eglTableReset = EGLAcc.resetProcAddressTable(tmp) ) ) {
+ _eglInitializeAddress = tmp.dynamicLookupFunction(eglInitializeFuncName);
+ eglInitializeAddress = _eglInitializeAddress;
+ ok = true;
+ } else {
+ _eglInitializeAddress = 0;
+ ok = false;
+ }
+ } else {
+ _eglInitializeAddress = tmp.dynamicLookupFunction(eglInitializeFuncName);
+ ok = _eglInitializeAddress == eglInitializeAddress;
+ }
+ if( ok ) {
+ eglES1DynamicLookupHelper = tmp;
+ final boolean isANGLEES1 = isANGLE(eglES1DynamicLookupHelper);
+ isANGLE |= isANGLEES1;
+ if (DEBUG || GLProfile.DEBUG) {
+ System.err.println("Info: EGLDrawableFactory: EGL ES1 - OK (isANGLE: "+isANGLEES1+", eglTableReset "+eglTableReset+", eglInitialize 0x"+Long.toHexString(_eglInitializeAddress)+")");
+ }
+ } else if (DEBUG || GLProfile.DEBUG) {
+ System.err.println("Info: EGLDrawableFactory: EGL ES1 - NOPE (ES1 proc, eglTableReset "+eglTableReset+", eglInitialize 0x"+Long.toHexString(_eglInitializeAddress)+")");
+ }
+ } else if (DEBUG || GLProfile.DEBUG) {
+ System.err.println("Info: EGLDrawableFactory: EGL ES1 - NOPE (ES1 lib)");
+ }
+ }
+ // Setup: eglGLnDynamicLookupHelper
+ if( null == eglGLnDynamicLookupHelper ) {
+ GLDynamicLookupHelper tmp=null;
+ try {
+ tmp = new GLDynamicLookupHelper(new EGLGLnDynamicLibraryBundleInfo());
+ } catch (final GLException gle) {
+ if(DEBUG) {
+ gle.printStackTrace();
+ }
+ }
+ if( null != tmp && tmp.isLibComplete() ) {
+ final boolean ok;
+ final long _eglInitializeAddress;
+ if( !eglTableReset ) {
+ if( true == ( eglTableReset = EGLAcc.resetProcAddressTable(tmp) ) ) {
+ _eglInitializeAddress = tmp.dynamicLookupFunction(eglInitializeFuncName);
+ eglInitializeAddress = _eglInitializeAddress;
+ ok = true;
+ } else {
+ _eglInitializeAddress = 0;
+ ok = false;
+ }
+ } else {
+ _eglInitializeAddress = tmp.dynamicLookupFunction(eglInitializeFuncName);
+ ok = _eglInitializeAddress == eglInitializeAddress;
+ }
+ if( ok ) {
+ eglGLnDynamicLookupHelper = tmp;
+ if (DEBUG || GLProfile.DEBUG) {
+ System.err.println("Info: EGLDrawableFactory: EGL GLn - OK (eglTableReset "+eglTableReset+", eglInitialize 0x"+Long.toHexString(_eglInitializeAddress)+")");
+ }
+ } else if (DEBUG || GLProfile.DEBUG) {
+ System.err.println("Info: EGLDrawableFactory: EGL GLn - NOPE (GLn proc, eglTableReset "+eglTableReset+", eglInitialize 0x"+Long.toHexString(_eglInitializeAddress)+")");
+ }
+ } else if (DEBUG || GLProfile.DEBUG) {
+ System.err.println("Info: EGLDrawableFactory: EGL GLn - NOPE (GLn lib)");
+ }
+ }
+ if( null != eglES2DynamicLookupHelper || null != eglES1DynamicLookupHelper || null != eglGLnDynamicLookupHelper ) {
if(isANGLE && !GLProfile.enableANGLE) {
if(DEBUG || GLProfile.DEBUG) {
System.err.println("Info: EGLDrawableFactory.init - EGL/ES2 ANGLE disabled");
@@ -192,13 +329,22 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
if( isANGLE && ( DEBUG || GLProfile.DEBUG ) ) {
System.err.println("Info: EGLDrawableFactory.init - EGL/ES2 ANGLE enabled");
}
- sharedMap = new HashMap<String /*uniqueKey*/, SharedResource>();
- sharedMapCreateAttempt = new HashSet<String>();
+ // Register our GraphicsConfigurationFactory implementations
+ // The act of constructing them causes them to be registered
+ EGLGraphicsConfigurationFactory.registerFactory();
+
+ sharedMap = new HashMap<String, SharedResourceRunner.Resource>();
+
// FIXME: defaultDevice.open() triggers eglInitialize(..) which crashed on Windows w/ Chrome/ANGLE, FF/ANGLE!
defaultDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(EGL.EGL_DEFAULT_DISPLAY, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT);
+
+ // Init shared resources off thread
+ // Will be released via ShutdownHook
+ sharedResourceRunner = new SharedResourceRunner(new SharedResourceImplementation());
+ sharedResourceRunner.start();
}
}
- }
+ } // synchronized(EGLDrawableFactory.class)
}
@Override
@@ -212,26 +358,15 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
if( DEBUG ) {
System.err.println("EGLDrawableFactory.shutdown");
}
+ if(null != sharedResourceRunner) {
+ sharedResourceRunner.stop();
+ sharedResourceRunner = null;
+ }
if(null != sharedMap) {
- if(DEBUG) {
- dumpMap();
- }
- final Collection<SharedResource> srl = sharedMap.values();
- for(final Iterator<SharedResource> sri = srl.iterator(); sri.hasNext(); ) {
- final SharedResource sr = sri.next();
- if(DEBUG) {
- System.err.println("EGLDrawableFactory.shutdown: "+sr.device.toString());
- }
- sr.device.close();
- }
sharedMap.clear();
- sharedMapCreateAttempt.clear();
sharedMap = null;
- sharedMapCreateAttempt = null;
- }
- if(null != defaultSharedResource) {
- defaultSharedResource = null;
}
+
if(null != defaultDevice) {
defaultDevice.close();
defaultDevice = null;
@@ -247,6 +382,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
// eglES2DynamicLookupHelper.destroy();
eglES2DynamicLookupHelper = null;
}
+ if(null != eglGLnDynamicLookupHelper) {
+ // eglGLDynamicLookupHelper.destroy();
+ eglGLnDynamicLookupHelper = null;
+ }
EGLGraphicsConfigurationFactory.unregisterFactory();
EGLDisplayUtil.shutdown(DEBUG);
}
@@ -258,65 +397,59 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
final Set<String> keys = sharedMap.keySet();
for(final Iterator<String> keyI = keys.iterator(); keyI.hasNext(); i++) {
final String key = keyI.next();
- final SharedResource sr = sharedMap.get(key);
- System.err.println("EGLDrawableFactory.map["+i+"] "+key+" -> "+sr.getDevice()+", "+
- "es1 [avail "+sr.wasES1ContextCreated+", pbuffer "+sr.hasPBufferES1+", quirks "+sr.rendererQuirksES1+", ctp "+EGLContext.getGLVersion(1, 0, sr.ctpES1, null)+"], "+
- "es2/3 [es2 "+sr.wasES2ContextCreated+", es3 "+sr.wasES3ContextCreated+", [pbuffer "+sr.hasPBufferES3ES2+", quirks "+sr.rendererQuirksES3ES2+", ctp "+EGLContext.getGLVersion(2, 0, sr.ctpES3ES2, null)+"]]");
+ final SharedResource sr = (SharedResource) sharedMap.get(key);
+ System.err.println("EGLDrawableFactory.map["+i+"] "+key+" -> "+sr.getDevice()+", avail "+sr.isAvailable+
+ "gln [quirks "+sr.rendererQuirksGLn+", ctp "+EGLContext.getGLVersion(3, 0, sr.ctpGLn, null)+"], "+
+ "es1 [quirks "+sr.rendererQuirksES1+", ctp "+EGLContext.getGLVersion(1, 0, sr.ctpES1, null)+"], "+
+ "es2/3 [quirks "+sr.rendererQuirksES3ES2+", ctp "+EGLContext.getGLVersion(2, 0, sr.ctpES3ES2, null)+"]");
}
;
}
}
- private HashMap<String /*uniqueKey*/, SharedResource> sharedMap = null;
- private HashSet<String> sharedMapCreateAttempt = null;
- private EGLGraphicsDevice defaultDevice = null;
- private SharedResource defaultSharedResource = null;
private boolean isANGLE = false;
private boolean hasX11 = false;
+ private EGLGraphicsDevice defaultDevice = null;
+ private EGLFeatures defaultDeviceEGLFeatures;
+ private SharedResourceRunner sharedResourceRunner;
+ private HashMap<String /* uniqueKey */, SharedResourceRunner.Resource> sharedMap;
static class SharedResource implements SharedResourceRunner.Resource {
- private final EGLGraphicsDevice device;
+ private EGLGraphicsDevice device;
// private final EGLContext contextES1;
// private final EGLContext contextES2;
// private final EGLContext contextES3;
- private final boolean wasES1ContextCreated;
- private final boolean wasES2ContextCreated;
- private final boolean wasES3ContextCreated;
- private final GLRendererQuirks rendererQuirksES1;
- private final GLRendererQuirks rendererQuirksES3ES2;
- private final int ctpES1;
- private final int ctpES3ES2;
- private final boolean hasPBufferES1;
- private final boolean hasPBufferES3ES2;
-
- SharedResource(final EGLGraphicsDevice dev,
- final boolean wasContextES1Created, final boolean hasPBufferES1, final GLRendererQuirks rendererQuirksES1, final int ctpES1,
- final boolean wasContextES2Created, final boolean wasContextES3Created,
- final boolean hasPBufferES3ES2, final GLRendererQuirks rendererQuirksES3ES2, final int ctpES3ES2) {
+ final boolean isAvailable;
+ final GLRendererQuirks rendererQuirksGLn;
+ final GLRendererQuirks rendererQuirksES1;
+ final GLRendererQuirks rendererQuirksES3ES2;
+ final int ctpGLn;
+ final int ctpES1;
+ final int ctpES3ES2;
+
+ SharedResource(final EGLGraphicsDevice dev, final boolean isAvailable,
+ final GLRendererQuirks rendererQuirksGLn, final int ctpGLn,
+ final GLRendererQuirks rendererQuirksES1, final int ctpES1,
+ final GLRendererQuirks rendererQuirksES3ES2, final int ctpES3ES2) {
this.device = dev;
- // this.contextES1 = ctxES1;
- this.wasES1ContextCreated = wasContextES1Created;
- this.hasPBufferES1= hasPBufferES1;
+ this.isAvailable = isAvailable;
+
+ this.rendererQuirksGLn = rendererQuirksGLn;
+ this.ctpGLn = ctpGLn;
+
this.rendererQuirksES1 = rendererQuirksES1;
this.ctpES1 = ctpES1;
- // this.contextES2 = ctxES2;
- // this.contextES3 = ctxES3;
- this.wasES2ContextCreated = wasContextES2Created;
- this.wasES3ContextCreated = wasContextES3Created;
- this.hasPBufferES3ES2= hasPBufferES3ES2;
this.rendererQuirksES3ES2 = rendererQuirksES3ES2;
this.ctpES3ES2 = ctpES3ES2;
}
+
@Override
- public final boolean isValid() {
- return wasES1ContextCreated || wasES2ContextCreated || wasES3ContextCreated;
+ public final boolean isAvailable() {
+ return isAvailable;
}
@Override
public final EGLGraphicsDevice getDevice() { return device; }
- // final EGLContext getContextES1() { return contextES1; }
- // final EGLContext getContextES2() { return contextES2; }
- // final EGLContext getContextES3() { return contextES3; }
@Override
public AbstractGraphicsScreen getScreen() {
@@ -331,368 +464,416 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
return null;
}
@Override
- public GLRendererQuirks getRendererQuirks() {
- return null != rendererQuirksES3ES2 ? rendererQuirksES3ES2 : rendererQuirksES1 ;
+ public GLRendererQuirks getRendererQuirks(final GLProfile glp) {
+ if( null == glp ) {
+ if( null != rendererQuirksES3ES2 ) {
+ return rendererQuirksES3ES2;
+ } else if( null != rendererQuirksES1 ) {
+ return rendererQuirksES1;
+ } else {
+ return rendererQuirksGLn;
+ }
+ } else if( !glp.isGLES() ) {
+ return rendererQuirksGLn;
+ } else if( glp.isGLES1() ) {
+ return rendererQuirksES1;
+ } else {
+ return rendererQuirksES3ES2;
+ }
}
- }
-
- @Override
- public final AbstractGraphicsDevice getDefaultDevice() {
- return defaultDevice;
- }
+ }
- @Override
- public final boolean getIsDeviceCompatible(final AbstractGraphicsDevice device) {
- // via mappings (X11/WGL/.. -> EGL) we shall be able to handle all types.
- return null != sharedMap ; // null!=eglES2DynamicLookupHelper || null!=eglES1DynamicLookupHelper;
- }
+ class SharedResourceImplementation implements SharedResourceRunner.Implementation {
+ @Override
+ public void clear() {
+ sharedMap.clear();
+ }
+ @Override
+ public SharedResourceRunner.Resource mapPut(final AbstractGraphicsDevice device, final SharedResourceRunner.Resource resource) {
+ return sharedMap.put(device.getConnection(), resource);
+ }
+ @Override
+ public SharedResourceRunner.Resource mapGet(final AbstractGraphicsDevice device) {
+ return sharedMap.get(device.getConnection());
+ }
+ @Override
+ public Collection<SharedResourceRunner.Resource> mapValues() {
+ return sharedMap.values();
+ }
- private static List<GLCapabilitiesImmutable> getAvailableEGLConfigs(final EGLGraphicsDevice eglDisplay, final GLCapabilitiesImmutable caps) {
- final IntBuffer numConfigs = Buffers.newDirectIntBuffer(1);
- if(!EGL.eglGetConfigs(eglDisplay.getHandle(), null, 0, numConfigs)) {
- throw new GLException("EGLDrawableFactory.getAvailableEGLConfigs: Get maxConfigs (eglGetConfigs) call failed, error "+EGLContext.toHexString(EGL.eglGetError()));
+ @Override
+ public boolean isDeviceSupported(final AbstractGraphicsDevice device) {
+ return null != sharedMap; // null != eglES2DynamicLookupHelper || null != eglES1DynamicLookupHelper
}
- if(0 < numConfigs.get(0)) {
- final PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0));
- final IntBuffer attrs = EGLGraphicsConfiguration.GLCapabilities2AttribList(caps);
- final int winattrmask = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(caps);
- if( EGL.eglChooseConfig(eglDisplay.getHandle(), attrs, configs, configs.capacity(), numConfigs) && numConfigs.get(0) > 0) {
- return EGLGraphicsConfigurationFactory.eglConfigs2GLCaps(eglDisplay, caps.getGLProfile(), configs, numConfigs.get(0), winattrmask, false /* forceTransparentFlag */, false /* onlyFirstValid */);
+
+ @Override
+ public SharedResourceRunner.Resource createSharedResource(final AbstractGraphicsDevice adevice) {
+ adevice.lock();
+ try {
+ return createEGLSharedResourceImpl(adevice);
+ } catch (final Throwable t) {
+ throw new GLException("EGLGLXDrawableFactory - Could not initialize shared resources for "+adevice, t);
+ } finally {
+ adevice.unlock();
}
}
- return new ArrayList<GLCapabilitiesImmutable>(0);
- }
- private static void dumpEGLInfo(final String prefix, final long eglDisplay) {
- final String eglVendor = EGL.eglQueryString(eglDisplay, EGL.EGL_VENDOR);
- final String eglClientAPIs = EGL.eglQueryString(eglDisplay, EGL.EGL_CLIENT_APIS);
- final String eglVersion = EGL.eglQueryString(eglDisplay, EGL.EGL_VERSION);
- System.err.println(prefix+"EGL vendor "+eglVendor+", version "+eglVersion+", clientAPIs "+eglClientAPIs);
- }
-
- private boolean mapAvailableEGLESConfig(final AbstractGraphicsDevice adevice, final int[] esProfile,
- final boolean[] hasPBuffer, final GLRendererQuirks[] rendererQuirks, final int[] ctp) {
- final String profileString;
- switch( esProfile[0] ) {
- case 3:
- profileString = GLProfile.GLES3; break;
- case 2:
- profileString = GLProfile.GLES2; break;
- case 1:
- profileString = GLProfile.GLES1; break;
- default:
- throw new GLException("Invalid ES profile number "+esProfile[0]);
- }
- if ( !GLProfile.isAvailable(adevice, profileString) ) {
- if( DEBUG ) {
- System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: "+profileString+" n/a on "+adevice);
+ private SharedResource createEGLSharedResourceImpl(final AbstractGraphicsDevice adevice) {
+ final GLRendererQuirks[] rendererQuirksES1 = new GLRendererQuirks[] { null };
+ final GLRendererQuirks[] rendererQuirksES3ES2 = new GLRendererQuirks[] { null };
+ final GLRendererQuirks[] rendererQuirksGLn = new GLRendererQuirks[] { null };
+ final int[] ctpES1 = new int[] { EGLContext.CTX_PROFILE_ES };
+ final int[] ctpES3ES2 = new int[] { EGLContext.CTX_PROFILE_ES };
+ final int[] ctpGLn = new int[] { EGLContext.CTX_PROFILE_CORE };
+
+ if ( DEBUG_SHAREDCTX ) {
+ System.err.println("EGLDrawableFactory.createShared(): device "+adevice);
}
- return false;
- }
- final GLProfile glp = GLProfile.get(adevice, profileString) ;
- final GLDrawableFactoryImpl desktopFactory = (GLDrawableFactoryImpl) GLDrawableFactory.getDesktopFactory();
- final boolean initDefaultDevice = 0 == defaultDevice.getHandle(); // Note: GLProfile always triggers EGL device initialization first!
- final boolean mapsADeviceToDefaultDevice = !QUERY_EGL_ES_NATIVE_TK || initDefaultDevice ||
- null == desktopFactory || adevice instanceof EGLGraphicsDevice ;
- if( DEBUG ) {
- System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: "+profileString+" ( "+esProfile[0]+" ), "+
- "defaultSharedResourceSet "+(null!=defaultSharedResource)+", mapsADeviceToDefaultDevice "+mapsADeviceToDefaultDevice+
- " (QUERY_EGL_ES_NATIVE_TK "+QUERY_EGL_ES_NATIVE_TK+", hasDesktopFactory "+(null != desktopFactory)+
- ", isEGLGraphicsDevice "+(adevice instanceof EGLGraphicsDevice)+")");
- }
-
- EGLGraphicsDevice eglDevice = null;
- NativeSurface surface = null;
- ProxySurface upstreamSurface = null; // X11, GLX, ..
- ProxySurface downstreamSurface = null; // EGL
- boolean success = false;
- try {
- final GLCapabilities reqCapsAny = new GLCapabilities(glp);
- reqCapsAny.setRedBits(5); reqCapsAny.setGreenBits(5); reqCapsAny.setBlueBits(5); reqCapsAny.setAlphaBits(0);
- reqCapsAny.setDoubleBuffered(false);
-
- if( mapsADeviceToDefaultDevice ) {
- // In this branch, any non EGL device is mapped to EGL default shared resources (default behavior).
- // Only one default shared resource instance is ever be created.
- if( initDefaultDevice ) {
- defaultDevice.open();
-
- // Probe for GLRendererQuirks.SingletonEGLDisplayOnly
- final long secondEGLDisplay = EGL.eglGetDisplay(EGL.EGL_DEFAULT_DISPLAY);
- if ( EGL.EGL_NO_DISPLAY == secondEGLDisplay ) {
- final int[] quirks = { GLRendererQuirks.SingletonEGLDisplayOnly };
- GLRendererQuirks.addStickyDeviceQuirks(adevice, quirks, 0, 1);
- EGLDisplayUtil.setSingletonEGLDisplayOnly(true);
- if(DEBUG) {
- System.err.println("Quirk: "+GLRendererQuirks.toString(quirks[0])+": cause: Second eglGetDisplay(EGL_DEFAULT_DISPLAY) failed");
+
+ boolean madeCurrentES1 = false;
+ boolean madeCurrentES2 = false;
+ boolean madeCurrentES3 = false;
+ boolean madeCurrentGLn = false;
+
+ if( null != eglGLnDynamicLookupHelper ) {
+ // OpenGL 3.1 core -> GL3, will utilize normal desktop profile mapping
+ final int[] major = { 3 };
+ final int[] minor = { 1 }; // FIXME: No minor version probing for ES currently!
+ madeCurrentGLn = mapAvailableEGLESConfig(adevice, major, minor,
+ ctpGLn, rendererQuirksGLn) && 0 != major[0];
+ } else {
+ madeCurrentGLn = false;
+ }
+ EGLContext.setAvailableGLVersionsSet(adevice, true);
+
+ if( null != eglES1DynamicLookupHelper ) {
+ final int[] major = { 1 };
+ final int[] minor = { 0 };
+ madeCurrentES1 = mapAvailableEGLESConfig(adevice, major, minor,
+ ctpES1, rendererQuirksES1) && 1 == major[0];
+ } else {
+ madeCurrentES1 = false;
+ }
+ if( null != eglES2DynamicLookupHelper ) {
+ // ES3 Query
+ final int[] major = { 3 };
+ final int[] minor = { 0 };
+ madeCurrentES3 = mapAvailableEGLESConfig(adevice, major, minor,
+ ctpES3ES2, rendererQuirksES3ES2) && 3 == major[0];
+ if( !madeCurrentES3 ) {
+ // ES2 Query, may result in ES3
+ major[0] = 2;
+ if( mapAvailableEGLESConfig(adevice, major, minor,
+ ctpES3ES2, rendererQuirksES3ES2) )
+ {
+ switch( major[0] ) {
+ case 2: madeCurrentES2 = true; break;
+ case 3: madeCurrentES3 = true; break;
+ default: throw new InternalError("XXXX Got "+major[0]);
}
}
}
- if( DEBUG ) {
- dumpEGLInfo("EGLDrawableFactory.mapAvailableEGLESConfig: ", defaultDevice.getHandle());
- }
+ }
+
+ if( hasX11 ) {
+ handleDontCloseX11DisplayQuirk(rendererQuirksES1[0]);
+ handleDontCloseX11DisplayQuirk(rendererQuirksES3ES2[0]);
+ }
+ final SharedResource sr = new SharedResource(defaultDevice,
+ madeCurrentGLn || madeCurrentES1 || madeCurrentES2 || madeCurrentES3,
+ rendererQuirksGLn[0], ctpGLn[0],
+ rendererQuirksES1[0], ctpES1[0],
+ rendererQuirksES3ES2[0], ctpES3ES2[0]);
+
+ if ( DEBUG_SHAREDCTX ) {
+ System.err.println("EGLDrawableFactory.createShared: devices: queried nativeTK "+QUERY_EGL_ES_NATIVE_TK+", adevice " + adevice + ", defaultDevice " + defaultDevice);
+ System.err.println("EGLDrawableFactory.createShared: context GLn: " + madeCurrentGLn + ", quirks "+rendererQuirksGLn[0]);
+ System.err.println("EGLDrawableFactory.createShared: context ES1: " + madeCurrentES1 + ", quirks "+rendererQuirksES1[0]);
+ System.err.println("EGLDrawableFactory.createShared: context ES2: " + madeCurrentES2 + ", quirks "+rendererQuirksES3ES2[0]);
+ System.err.println("EGLDrawableFactory.createShared: context ES3: " + madeCurrentES3 + ", quirks "+rendererQuirksES3ES2[0]);
+ dumpMap();
+ }
+ return sr;
+ }
+
+ private void handleDontCloseX11DisplayQuirk(final GLRendererQuirks quirks) {
+ if( null != quirks && quirks.exist( GLRendererQuirks.DontCloseX11Display ) ) {
+ jogamp.nativewindow.x11.X11Util.markAllDisplaysUnclosable();
+ }
+ }
- final GLCapabilitiesImmutable reqCapsPBuffer = GLGraphicsConfigurationUtil.fixGLPBufferGLCapabilities(reqCapsAny);
- final List<GLCapabilitiesImmutable> availablePBufferCapsL = getAvailableEGLConfigs(defaultDevice, reqCapsPBuffer);
- hasPBuffer[0] = availablePBufferCapsL.size() > 0;
+ private boolean mapAvailableEGLESConfig(final AbstractGraphicsDevice adevice,
+ final int[] majorVersion, final int[] minorVersion,
+ final int[] ctxProfile, final GLRendererQuirks[] rendererQuirks) {
+ final String profileString = EGLContext.getGLProfile(majorVersion[0], minorVersion[0], ctxProfile[0]);
- // 1st case: adevice is not the EGL default device, map default shared resources
- if( adevice != defaultDevice ) {
- if(null == defaultSharedResource) {
- return false;
- }
- switch(esProfile[0]) {
- case 3:
- if( !defaultSharedResource.wasES3ContextCreated ) {
- return false;
- }
- rendererQuirks[0] = defaultSharedResource.rendererQuirksES3ES2;
- ctp[0] = defaultSharedResource.ctpES3ES2;
- break;
- case 2:
- if( !defaultSharedResource.wasES2ContextCreated ) {
- return false;
- }
- rendererQuirks[0] = defaultSharedResource.rendererQuirksES3ES2;
- ctp[0] = defaultSharedResource.ctpES3ES2;
- break;
- case 1:
- if( !defaultSharedResource.wasES1ContextCreated ) {
- return false;
+ if ( !GLProfile.isAvailable(adevice, profileString) ) {
+ if ( DEBUG_SHAREDCTX ) {
+ System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: "+profileString+" n/a on "+adevice);
+ }
+ return false;
+ }
+ final GLProfile glp = GLProfile.get(adevice, profileString) ;
+ final GLDrawableFactoryImpl desktopFactory = (GLDrawableFactoryImpl) GLDrawableFactory.getDesktopFactory();
+ final boolean initDefaultDevice = 0 == defaultDevice.getHandle(); // Note: GLProfile always triggers EGL device initialization first!
+ final boolean mapsADeviceToDefaultDevice = !QUERY_EGL_ES_NATIVE_TK || initDefaultDevice ||
+ null == desktopFactory;
+ // FIXME || adevice instanceof EGLGraphicsDevice ;
+ if ( DEBUG_SHAREDCTX ) {
+ System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: "+profileString+" ( "+majorVersion[0]+" ), "+
+ "mapsADeviceToDefaultDevice "+mapsADeviceToDefaultDevice+
+ " (QUERY_EGL_ES_NATIVE_TK "+QUERY_EGL_ES_NATIVE_TK+", initDefaultDevice "+initDefaultDevice+", hasDesktopFactory "+(null != desktopFactory)+
+ ", isEGLGraphicsDevice "+(adevice instanceof EGLGraphicsDevice)+")");
+ }
+
+ boolean hasPBuffer;
+ EGLGraphicsDevice eglDevice = null;
+ EGLFeatures eglFeatures = null;
+ NativeSurface surface = null;
+ ProxySurface upstreamSurface = null; // X11, GLX, ..
+ ProxySurface downstreamSurface = null; // EGL
+ boolean success = false;
+ try {
+ final GLCapabilities reqCapsAny = new GLCapabilities(glp);
+ reqCapsAny.setRedBits(5); reqCapsAny.setGreenBits(5); reqCapsAny.setBlueBits(5); reqCapsAny.setAlphaBits(0);
+ reqCapsAny.setDoubleBuffered(false);
+
+ if( mapsADeviceToDefaultDevice ) {
+ // In this branch, any non EGL device is mapped to EGL default shared resources (default behavior).
+ // Only one default shared resource instance is ever be created.
+ if( initDefaultDevice ) {
+ defaultDevice.open();
+ defaultDeviceEGLFeatures = new EGLFeatures(defaultDevice);
+
+ // Probe for GLRendererQuirks.SingletonEGLDisplayOnly
+ final long secondEGLDisplay = EGL.eglGetDisplay(EGL.EGL_DEFAULT_DISPLAY);
+ if ( EGL.EGL_NO_DISPLAY == secondEGLDisplay ) {
+ final int quirk = GLRendererQuirks.SingletonEGLDisplayOnly;
+ GLRendererQuirks.addStickyDeviceQuirk(adevice, quirk);
+ EGLDisplayUtil.setSingletonEGLDisplayOnly(true);
+ if ( DEBUG_SHAREDCTX ) {
+ System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: Second eglGetDisplay(EGL_DEFAULT_DISPLAY) failed");
}
- rendererQuirks[0] = defaultSharedResource.rendererQuirksES1;
- ctp[0] = defaultSharedResource.ctpES1;
- break;
+ }
}
- if( null != rendererQuirks[0] ) {
- GLRendererQuirks.addStickyDeviceQuirks(adevice, rendererQuirks[0]);
+ eglDevice = defaultDevice; // reuse
+ eglFeatures = defaultDeviceEGLFeatures;
+ if ( DEBUG_SHAREDCTX ) {
+ System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig.0: "+eglFeatures);
}
- EGLContext.mapStaticGLVersion(adevice, esProfile[0], 0, ctp[0]);
- return true;
- }
- // attempt to created the default shared resources ..
-
- if( hasPBuffer[0] ) {
- // 2nd case create defaultDevice shared resource using pbuffer surface
- downstreamSurface = createDummySurfaceImpl(defaultDevice, false, reqCapsPBuffer, reqCapsPBuffer, null, 64, 64); // egl pbuffer offscreen
- if( null != downstreamSurface ) {
- downstreamSurface.createNotify();
- surface = downstreamSurface;
+ if( !glp.isGLES() && !eglFeatures.hasGLAPI ) {
+ if ( DEBUG_SHAREDCTX ) {
+ System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig() OpenGL API not supported (1)");
+ }
+ } else {
+ final GLCapabilitiesImmutable reqCapsPBuffer = GLGraphicsConfigurationUtil.fixGLPBufferGLCapabilities(reqCapsAny);
+ final List<GLCapabilitiesImmutable> availablePBufferCapsL = getAvailableEGLConfigs(eglDevice, reqCapsPBuffer);
+ hasPBuffer = availablePBufferCapsL.size() > 0;
+
+ // attempt to created the default shared resources ..
+ if( hasPBuffer ) {
+ // 2nd case create defaultDevice shared resource using pbuffer surface
+ downstreamSurface = createDummySurfaceImpl(eglDevice, false, reqCapsPBuffer, reqCapsPBuffer, null, 64, 64); // egl pbuffer offscreen
+ if( null != downstreamSurface ) {
+ downstreamSurface.createNotify();
+ surface = downstreamSurface;
+ }
+ } else {
+ // 3rd case fake creation of defaultDevice shared resource, no pbuffer available
+ final List<GLCapabilitiesImmutable> capsAnyL = getAvailableEGLConfigs(eglDevice, reqCapsAny);
+ if(capsAnyL.size() > 0) {
+ final GLCapabilitiesImmutable chosenCaps = capsAnyL.get(0);
+ EGLContext.mapStaticGLESVersion(eglDevice, chosenCaps);
+ success = true;
+ }
+ if ( DEBUG_SHAREDCTX ) {
+ System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig() no pbuffer config available, detected !pbuffer config: "+success);
+ EGLGraphicsConfigurationFactory.printCaps("!PBufferCaps", capsAnyL, System.err);
+ }
+ }
}
} else {
- // 3rd case fake creation of defaultDevice shared resource, no pbuffer available
- final List<GLCapabilitiesImmutable> capsAnyL = getAvailableEGLConfigs(defaultDevice, reqCapsAny);
- if(capsAnyL.size() > 0) {
- final GLCapabilitiesImmutable chosenCaps = capsAnyL.get(0);
- EGLContext.mapStaticGLESVersion(defaultDevice, chosenCaps);
- success = true;
- }
- if(DEBUG) {
- System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig() no pbuffer config available, detected !pbuffer config: "+success);
- EGLGraphicsConfigurationFactory.printCaps("!PBufferCaps", capsAnyL, System.err);
- }
- }
- eglDevice = defaultDevice; // reuse
- } else {
- // 4th case always creates a true mapping of given device to EGL
- upstreamSurface = desktopFactory.createDummySurface(adevice, reqCapsAny, null, 64, 64); // X11, WGL, .. dummy window
- if(null != upstreamSurface) {
- upstreamSurface.createNotify();
- eglDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(upstreamSurface);
- eglDevice.open();
- if( DEBUG ) {
- dumpEGLInfo("EGLDrawableFactory.mapAvailableEGLESConfig: ", eglDevice.getHandle());
+ // 4th case always creates a true mapping of given device to EGL
+ upstreamSurface = desktopFactory.createDummySurface(adevice, reqCapsAny, null, 64, 64); // X11, WGL, .. dummy window
+ if(null != upstreamSurface) {
+ upstreamSurface.createNotify();
+ eglDevice = EGLDisplayUtil.eglCreateEGLGraphicsDevice(upstreamSurface);
+ eglDevice.open();
+ eglFeatures = new EGLFeatures(eglDevice);
+ if ( DEBUG_SHAREDCTX ) {
+ System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig.1: "+eglFeatures);
+ }
+ if( !glp.isGLES() && !eglFeatures.hasGLAPI ) {
+ if ( DEBUG_SHAREDCTX ) {
+ System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig() OpenGL API not supported (2)");
+ }
+ // disposed at finalized: eglDevice, upstreamSurface
+ } else {
+ hasPBuffer = true;
+ surface = upstreamSurface;
+ }
}
- hasPBuffer[0] = true;
- surface = upstreamSurface;
}
- }
- if(null != surface) {
- final EGLDrawable drawable = (EGLDrawable) createOnscreenDrawableImpl ( surface ); // works w/ implicit pbuffer surface via proxy-hook
- drawable.setRealized(true);
- final EGLContext context = (EGLContext) drawable.createContext(null);
- if (null != context) {
+ if(null != surface) {
+ EGLDrawable drawable = null;
+ GLDrawable zeroDrawable = null;
+ EGLContext context = null;
try {
- context.makeCurrent(); // could cause exception
- if(context.isCurrent()) {
- final String glVersion = context.getGL().glGetString(GL.GL_VERSION);
- if(null != glVersion) {
- context.mapCurrentAvailableGLVersion(eglDevice);
+ drawable = (EGLDrawable) createOnscreenDrawableImpl ( surface );
+ drawable.setRealized(true);
+
+ context = (EGLContext) drawable.createContext(null);
+ if (null == context) {
+ throw new GLException("Couldn't create shared context for drawable: "+drawable);
+ }
+
+ if( GLContext.CONTEXT_NOT_CURRENT != context.makeCurrent() ) { // could cause exception
+ // context.isCurrent() !
+ final String glVersionString = context.getGL().glGetString(GL.GL_VERSION);
+ if(null != glVersionString) {
+ context.mapCurrentAvailableGLESVersion(eglDevice);
if(eglDevice != adevice) {
- context.mapCurrentAvailableGLVersion(adevice);
+ context.mapCurrentAvailableGLESVersion(adevice);
+ }
+
+ if( eglFeatures.hasKHRSurfaceless &&
+ ( context.isGLES() || context.getGLVersionNumber().compareTo(GLContext.Version3_0) >= 0 )
+ )
+ {
+ if( probeSurfacelessCtx(context, false /* restoreDrawable */) ) {
+ zeroDrawable = context.getGLDrawable();
+ }
+ } else {
+ setNoSurfacelessCtxQuirk(context);
}
rendererQuirks[0] = context.getRendererQuirks();
- ctp[0] = context.getContextOptions();
- esProfile[0] = context.getGLVersionNumber().getMajor();
+ ctxProfile[0] = context.getContextOptions();
+ majorVersion[0] = context.getGLVersionNumber().getMajor();
+ minorVersion[0] = context.getGLVersionNumber().getMinor();
success = true;
} else {
// Oops .. something is wrong
- if(DEBUG) {
+ if ( DEBUG_SHAREDCTX ) {
System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: "+eglDevice+", "+context.getGLVersion()+" - VERSION is null, dropping availability!");
}
}
}
} catch (final Throwable t) {
- if (DEBUG) {
+ if ( DEBUG_SHAREDCTX ) {
System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: INFO: context create/makeCurrent failed");
t.printStackTrace();
}
} finally {
- context.destroy();
+ if( null != context ) {
+ try {
+ context.destroy();
+ } catch (final GLException gle) {
+ if ( DEBUG_SHAREDCTX ) {
+ System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: INFO: destroy caught exception:");
+ gle.printStackTrace();
+ }
+ }
+ }
+ if( null != zeroDrawable ) {
+ zeroDrawable.setRealized(false);
+ }
+ if( null != drawable ) {
+ drawable.setRealized(false);
+ }
}
}
- drawable.setRealized(false);
- }
- } catch (final Throwable t) {
- if(DEBUG) {
- System.err.println("Caught exception on thread "+getThreadName());
- t.printStackTrace();
- }
- success = false;
- } finally {
- if(null != downstreamSurface) {
- downstreamSurface.destroyNotify();
- }
- if( defaultDevice != eglDevice ) { // don't close default device
- if(null != eglDevice) {
- eglDevice.close();
+ } catch (final Throwable t) {
+ if ( DEBUG_SHAREDCTX ) {
+ System.err.println("Caught exception on thread "+getThreadName());
+ t.printStackTrace();
+ }
+ success = false;
+ } finally {
+ if(null != downstreamSurface) {
+ downstreamSurface.destroyNotify();
+ }
+ if( defaultDevice != eglDevice ) { // don't close default device
+ if(null != eglDevice) {
+ eglDevice.close();
+ }
}
if(null != upstreamSurface) {
upstreamSurface.destroyNotify();
}
}
+ return success;
}
- return success;
- }
- private final boolean needsToCreateSharedResource(final String key, final SharedResource[] existing) {
- synchronized(sharedMap) {
- final SharedResource sr = sharedMap.get(key);
- if( null == sr ) {
- final boolean createAttempted = sharedMapCreateAttempt.contains(key);
- if(!createAttempted) {
- sharedMapCreateAttempt.add(key);
- }
- return !createAttempted;
- } else {
- if(null != existing) {
- existing[0] = sr;
- }
- return false;
+ @Override
+ public void releaseSharedResource(final SharedResourceRunner.Resource shared) {
+ final SharedResource sr = (SharedResource) shared;
+ if ( DEBUG_SHAREDCTX ) {
+ System.err.println("Shutdown Shared:");
+ System.err.println("Device : " + sr.device);
+ ExceptionUtils.dumpStack(System.err);
}
- }
- }
-
- @Override
- protected final SharedResource getOrCreateSharedResourceImpl(final AbstractGraphicsDevice adevice) {
- if(null == sharedMap) { // null == eglES1DynamicLookupHelper && null == eglES2DynamicLookupHelper
- return null;
- }
- if( needsToCreateSharedResource(defaultDevice.getUniqueID(), null) ) {
- if (DEBUG) {
- System.err.println("EGLDrawableFactory.createShared: (defaultDevice): req. device: "+adevice+", defaultDevice "+defaultDevice);
- Thread.dumpStack();
- }
- if(null != defaultSharedResource) {
- dumpMap();
- throw new InternalError("defaultSharedResource already exist: "+defaultSharedResource);
+ if (null != sr.device) {
+ // Issues eglTerminate(), which may cause SIGSEGV w/ NVIDIA 343.36 w/ TestGLProfile01NEWT
+ // May cause JVM SIGSEGV:
+ sr.device.close();
+ sr.device = null;
}
- defaultSharedResource = createEGLSharedResourceImpl(defaultDevice);
}
+ }
- final String key = adevice.getUniqueID();
- if( defaultDevice.getUniqueID().equals(key) ) {
- return defaultSharedResource;
- } else {
- if( null == defaultSharedResource) { // defaultDevice must be initialized before host-device
- dumpMap();
- throw new InternalError("defaultSharedResource does not exist");
- }
- final SharedResource[] existing = new SharedResource[] { null };
- if ( !needsToCreateSharedResource(key, existing) ) {
- return existing[0];
- }
- return createEGLSharedResourceImpl(adevice);
- }
+ public final boolean hasDefaultDeviceKHRCreateContext() {
+ return defaultDeviceEGLFeatures.hasKHRCreateContext;
+ }
+ public final boolean hasOpenGLAPISupport() {
+ return defaultDeviceEGLFeatures.hasGLAPI;
}
- private SharedResource createEGLSharedResourceImpl(final AbstractGraphicsDevice adevice) {
- final boolean madeCurrentES1;
- final boolean[] hasPBufferES1 = new boolean[] { false };
- final boolean[] hasPBufferES3ES2 = new boolean[] { false };
- // EGLContext[] eglCtxES1 = new EGLContext[] { null };
- // EGLContext[] eglCtxES2 = new EGLContext[] { null };
- final GLRendererQuirks[] rendererQuirksES1 = new GLRendererQuirks[] { null };
- final GLRendererQuirks[] rendererQuirksES3ES2 = new GLRendererQuirks[] { null };
- final int[] ctpES1 = new int[] { -1 };
- final int[] ctpES3ES2 = new int[] { -1 };
+ @Override
+ public final AbstractGraphicsDevice getDefaultDevice() {
+ return defaultDevice;
+ }
+ @Override
+ public final boolean getIsDeviceCompatible(final AbstractGraphicsDevice device) {
+ // via mappings (X11/WGL/.. -> EGL) we shall be able to handle all types.
+ return null != sharedMap ; // null!=eglES2DynamicLookupHelper || null!=eglES1DynamicLookupHelper;
+ }
- if (DEBUG) {
- System.err.println("EGLDrawableFactory.createShared(): device "+adevice);
+ private static List<GLCapabilitiesImmutable> getAvailableEGLConfigs(final EGLGraphicsDevice eglDisplay, final GLCapabilitiesImmutable caps) {
+ final IntBuffer numConfigs = Buffers.newDirectIntBuffer(1);
+ if(!EGL.eglGetConfigs(eglDisplay.getHandle(), null, 0, numConfigs)) {
+ throw new GLException("EGLDrawableFactory.getAvailableEGLConfigs: Get maxConfigs (eglGetConfigs) call failed, error "+EGLContext.toHexString(EGL.eglGetError()));
}
-
- if( null != eglES1DynamicLookupHelper ) {
- final int[] esProfile = { 1 };
- madeCurrentES1 = mapAvailableEGLESConfig(adevice, esProfile, hasPBufferES1, rendererQuirksES1, ctpES1) && 1 == esProfile[0];
- } else {
- madeCurrentES1 = false;
- }
- boolean madeCurrentES2 = false;
- boolean madeCurrentES3 = false;
- if( null != eglES2DynamicLookupHelper ) {
- // ES3 Query
- final int[] esProfile = { 3 };
- madeCurrentES3 = mapAvailableEGLESConfig(adevice, esProfile, hasPBufferES3ES2, rendererQuirksES3ES2, ctpES3ES2) && 3 == esProfile[0];
- if( !madeCurrentES3 ) {
- // ES2 Query, may result in ES3
- esProfile[0] = 2;
- if( mapAvailableEGLESConfig(adevice, esProfile, hasPBufferES3ES2, rendererQuirksES3ES2, ctpES3ES2) ) {
- switch( esProfile[0] ) {
- case 2: madeCurrentES2 = true; break;
- case 3: madeCurrentES3 = true; break;
- default: throw new InternalError("XXXX Got "+esProfile[0]);
- }
- }
+ if(0 < numConfigs.get(0)) {
+ final PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0));
+ final IntBuffer attrs = EGLGraphicsConfiguration.GLCapabilities2AttribList(caps);
+ final int winattrmask = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(caps);
+ if( EGL.eglChooseConfig(eglDisplay.getHandle(), attrs, configs, configs.capacity(), numConfigs) && numConfigs.get(0) > 0) {
+ return EGLGraphicsConfigurationFactory.eglConfigs2GLCaps(eglDisplay, caps.getGLProfile(), configs, numConfigs.get(0), winattrmask, false /* forceTransparentFlag */, false /* onlyFirstValid */);
}
}
- if( !EGLContext.getAvailableGLVersionsSet(adevice) ) {
- // Even though we override the non EGL native mapping intentionally,
- // avoid exception due to double 'set' - carefull exception of the rule.
- EGLContext.setAvailableGLVersionsSet(adevice);
- }
- if( hasX11 ) {
- handleDontCloseX11DisplayQuirk(rendererQuirksES1[0]);
- handleDontCloseX11DisplayQuirk(rendererQuirksES3ES2[0]);
- }
- final SharedResource sr = new SharedResource(defaultDevice, madeCurrentES1, hasPBufferES1[0], rendererQuirksES1[0], ctpES1[0],
- madeCurrentES2, madeCurrentES3, hasPBufferES3ES2[0], rendererQuirksES3ES2[0], ctpES3ES2[0]);
+ return new ArrayList<GLCapabilitiesImmutable>(0);
+ }
- synchronized(sharedMap) {
- sharedMap.put(adevice.getUniqueID(), sr);
- }
- if (DEBUG) {
- System.err.println("EGLDrawableFactory.createShared: devices: queried nativeTK "+QUERY_EGL_ES_NATIVE_TK+", adevice " + adevice + ", defaultDevice " + defaultDevice);
- System.err.println("EGLDrawableFactory.createShared: context ES1: " + madeCurrentES1 + ", hasPBuffer "+hasPBufferES1[0]+", quirks "+rendererQuirksES1[0]);
- System.err.println("EGLDrawableFactory.createShared: context ES2: " + madeCurrentES2 + ", hasPBuffer "+hasPBufferES3ES2[0]+", quirks "+rendererQuirksES3ES2[0]);
- System.err.println("EGLDrawableFactory.createShared: context ES3: " + madeCurrentES3 + ", hasPBuffer "+hasPBufferES3ES2[0]+", quirks "+rendererQuirksES3ES2[0]);
- dumpMap();
- }
- return sr;
+ static void dumpEGLInfo(final String prefix, final long eglDisplay) {
+ final String eglVendor = EGL.eglQueryString(eglDisplay, EGL.EGL_VENDOR);
+ final String eglClientAPIs = EGL.eglQueryString(eglDisplay, EGL.EGL_CLIENT_APIS);
+ final String eglClientVersion = EGL.eglQueryString(EGL.EGL_NO_DISPLAY, EGL.EGL_VERSION);
+ final String eglServerVersion = EGL.eglQueryString(eglDisplay, EGL.EGL_VERSION);
+ System.err.println(prefix+"EGL vendor "+eglVendor+", version [client "+eglClientVersion+", server "+eglServerVersion+"], clientAPIs "+eglClientAPIs);
}
- private void handleDontCloseX11DisplayQuirk(final GLRendererQuirks quirks) {
- if( null != quirks && quirks.exist( GLRendererQuirks.DontCloseX11Display ) ) {
- jogamp.nativewindow.x11.X11Util.markAllDisplaysUnclosable();
- }
+ @Override
+ protected final SharedResource getOrCreateSharedResourceImpl(final AbstractGraphicsDevice adevice) {
+ return (SharedResource) sharedResourceRunner.getOrCreateShared(adevice);
}
@Override
protected final Thread getSharedResourceThread() {
- return null;
+ return sharedResourceRunner.start();
}
public final boolean isANGLE() {
@@ -700,14 +881,19 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
- public GLDynamicLookupHelper getGLDynamicLookupHelper(final int esProfile) {
- if ( 2==esProfile || 3==esProfile ) {
- return eglES2DynamicLookupHelper;
- } else if (1==esProfile) {
- return eglES1DynamicLookupHelper;
+ public GLDynamicLookupHelper getGLDynamicLookupHelper(final String esProfile) {
+ final GLDynamicLookupHelper res;
+ if ( GLProfile.GLES2 == esProfile || GLProfile.GLES3 == esProfile ) {
+ res = eglES2DynamicLookupHelper;
+ } else if ( GLProfile.GLES1 == esProfile ) {
+ res = eglES1DynamicLookupHelper;
} else {
- throw new GLException("Unsupported: ES"+esProfile);
+ res = eglGLnDynamicLookupHelper;
+ }
+ if( null == res ) {
+ throw new GLException("No lookup for esProfile "+esProfile);
}
+ return res;
}
@Override
@@ -723,7 +909,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
if (target == null) {
throw new IllegalArgumentException("Null target");
}
- return new EGLOnscreenDrawable(this, EGLWrappedSurface.get(target));
+ return new EGLDrawable(this, EGLSurface.get(target));
}
@Override
@@ -737,7 +923,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
throw new GLException("Non pbuffer not yet implemented");
}
// PBuffer GLDrawable Creation
- return new EGLPbufferDrawable(this, EGLWrappedSurface.get(target));
+ return new EGLDrawable(this, EGLSurface.get(target));
}
@Override
@@ -747,28 +933,35 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
return true;
}
- @Override
- protected ProxySurface createMutableSurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice,
- final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested,
- final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstreamHook) {
- final boolean ownDevice;
+ private final EGLGraphicsConfiguration evalConfig(final boolean[] ownDevice, final AbstractGraphicsDevice deviceReq, final boolean createNewDevice,
+ final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested,
+ final GLCapabilitiesChooser chooser) {
final EGLGraphicsDevice device;
if( createNewDevice || ! (deviceReq instanceof EGLGraphicsDevice) ) {
final long nativeDisplayID = ( deviceReq instanceof EGLGraphicsDevice) ?
( (EGLGraphicsDevice) deviceReq ).getNativeDisplayID() : deviceReq.getHandle() ;
device = EGLDisplayUtil.eglCreateEGLGraphicsDevice(nativeDisplayID, deviceReq.getConnection(), deviceReq.getUnitID());
device.open();
- ownDevice = true;
+ ownDevice[0] = true;
} else {
device = (EGLGraphicsDevice) deviceReq;
- ownDevice = false;
+ ownDevice[0] = false;
}
final DefaultGraphicsScreen screen = new DefaultGraphicsScreen(device, 0);
final EGLGraphicsConfiguration config = EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen, VisualIDHolder.VID_UNDEFINED, false);
if(null == config) {
throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen);
}
- return new WrappedSurface(config, 0, upstreamHook, ownDevice);
+ return config;
+ }
+
+ @Override
+ protected final ProxySurface createMutableSurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice,
+ final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested,
+ final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstreamHook) {
+ final boolean[] ownDevice = { false };
+ final EGLGraphicsConfiguration config = evalConfig(ownDevice, deviceReq, createNewDevice, capsChosen, capsRequested, chooser);
+ return EGLSurface.createWrapped(config, 0, upstreamHook, ownDevice[0]);
}
@Override
@@ -778,6 +971,15 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new EGLDummyUpstreamSurfaceHook(width, height));
}
+ @Override
+ public final ProxySurface createSurfacelessImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice,
+ GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) {
+ chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps);
+ final boolean[] ownDevice = { false };
+ final EGLGraphicsConfiguration config = evalConfig(ownDevice, deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser);
+ return EGLSurface.createSurfaceless(config, new GenericUpstreamSurfacelessHook(width, height), ownDevice[0]);
+ }
+
/**
* @param ms {@link MutableSurface} which dimensions and config are being used to create the pbuffer surface.
* It will also hold the resulting pbuffer surface handle.
@@ -813,13 +1015,15 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
- protected ProxySurface createProxySurfaceImpl(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstream) {
+ protected ProxySurface createProxySurfaceImpl(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle,
+ final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser,
+ final UpstreamSurfaceHook upstream) {
final EGLGraphicsDevice eglDeviceReq = (EGLGraphicsDevice) deviceReq;
final EGLGraphicsDevice device = EGLDisplayUtil.eglCreateEGLGraphicsDevice(eglDeviceReq.getNativeDisplayID(), deviceReq.getConnection(), deviceReq.getUnitID());
device.open();
final DefaultGraphicsScreen screen = new DefaultGraphicsScreen(device, screenIdx);
final EGLGraphicsConfiguration cfg = EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsRequested, capsRequested, chooser, screen, VisualIDHolder.VID_UNDEFINED, false);
- return new WrappedSurface(cfg, windowHandle, upstream, true);
+ return EGLSurface.createWrapped(cfg, windowHandle, upstream, true);
}
@Override
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java
index f00d7059d..6c11b3bdc 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java
@@ -1,11 +1,12 @@
package jogamp.opengl.egl;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.ProxySurface;
-import javax.media.nativewindow.UpstreamSurfaceHook;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.ProxySurface;
+import com.jogamp.nativewindow.UpstreamSurfaceHook;
import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize;
import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
+import com.jogamp.opengl.egl.EGL;
/** Uses a PBuffer offscreen surface */
public class EGLDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize {
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java
index 05dae0b9d..1b433cc30 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java
@@ -28,13 +28,15 @@
package jogamp.opengl.egl;
-import com.jogamp.common.os.AndroidVersion;
-import com.jogamp.common.os.Platform;
-
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
import jogamp.common.os.PlatformPropsImpl;
-import jogamp.opengl.*;
+import jogamp.opengl.GLDynamicLibraryBundleInfo;
+
+import com.jogamp.common.os.AndroidVersion;
+import com.jogamp.common.os.Platform;
+import com.jogamp.opengl.egl.EGL;
/**
* Abstract implementation of the DynamicLookupHelper for EGL,
@@ -43,7 +45,7 @@ import jogamp.opengl.*;
* Currently two implementations exist, one for ES1 and one for ES3 and ES2.
*/
public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundleInfo {
- static final List<String> glueLibNames;
+ private static final List<String> glueLibNames;
static {
glueLibNames = new ArrayList<String>();
glueLibNames.add("jogl_mobile");
@@ -79,7 +81,7 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle
@Override
public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) {
- return EGL.eglGetProcAddress(toolGetProcAddressHandle, funcName);
+ return EGLContext.eglGetProcAddress(toolGetProcAddressHandle, funcName);
}
@Override
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java
index 361ec26ff..3c7ee410a 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLES1DynamicLibraryBundleInfo.java
@@ -28,7 +28,8 @@
package jogamp.opengl.egl;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
public final class EGLES1DynamicLibraryBundleInfo extends EGLDynamicLibraryBundleInfo {
protected EGLES1DynamicLibraryBundleInfo() {
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java
index 74738463f..d37efc455 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java
@@ -28,7 +28,8 @@
package jogamp.opengl.egl;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
/**
* <p>
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java
index babea4240..14a5aac33 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java
@@ -35,11 +35,11 @@
package jogamp.opengl.egl;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
import jogamp.opengl.*;
-import javax.media.nativewindow.*;
+import com.jogamp.nativewindow.*;
public class EGLExternalContext extends EGLContext {
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java
index a8dd7d5c8..546d8e69a 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java
@@ -28,12 +28,14 @@
package jogamp.opengl.egl;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
+import com.jogamp.opengl.egl.EGL;
+import com.jogamp.opengl.egl.EGLExt;
public class EGLGLCapabilities extends GLCapabilities {
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGLnDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLGLnDynamicLibraryBundleInfo.java
new file mode 100644
index 000000000..6a3a20100
--- /dev/null
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGLnDynamicLibraryBundleInfo.java
@@ -0,0 +1,83 @@
+/**
+ * Copyright 2014 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package jogamp.opengl.egl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.jogamp.common.os.Platform;
+
+/**
+ * <p>
+ * Covering Desktop GL
+ * </p>
+ */
+public final class EGLGLnDynamicLibraryBundleInfo extends EGLDynamicLibraryBundleInfo {
+ private static final List<String> glueLibNames;
+ static {
+ glueLibNames = new ArrayList<String>();
+ glueLibNames.add("jogl_desktop");
+ }
+
+ protected EGLGLnDynamicLibraryBundleInfo() {
+ super();
+ }
+
+ @Override
+ public final List<List<String>> getToolLibNames() {
+ final List<List<String>> libsList = new ArrayList<List<String>>();
+ {
+ final List<String> libsGL = new ArrayList<String>();
+
+ final Platform.OSType osType = Platform.getOSType();
+ if( Platform.OSType.MACOS == osType ) {
+ libsGL.add("/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib");
+ libsGL.add("GL");
+ } else if( Platform.OSType.WINDOWS == Platform.getOSType() ) {
+ libsGL.add("OpenGL32");
+ } else {
+ // this is the default lib name, according to the spec
+ libsGL.add("libGL.so.1");
+
+ // try this one as well, if spec fails
+ libsGL.add("libGL.so");
+
+ // last but not least .. the generic one
+ libsGL.add("GL");
+ }
+
+ libsList.add(libsGL);
+ }
+ libsList.add(getEGLLibNamesList());
+
+ return libsList;
+ }
+
+}
+
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
index 1d90e63af..7e54152bf 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
@@ -38,17 +38,17 @@ package jogamp.opengl.egl;
import java.nio.IntBuffer;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.CapabilitiesImmutable;
-import javax.media.nativewindow.GraphicsConfigurationFactory;
-import javax.media.nativewindow.VisualIDHolder;
-import javax.media.opengl.DefaultGLCapabilitiesChooser;
-import javax.media.opengl.GLCapabilitiesChooser;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.GraphicsConfigurationFactory;
+import com.jogamp.nativewindow.VisualIDHolder;
+import com.jogamp.opengl.DefaultGLCapabilitiesChooser;
+import com.jogamp.opengl.GLCapabilitiesChooser;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import jogamp.opengl.GLGraphicsConfigurationUtil;
@@ -57,6 +57,8 @@ import com.jogamp.common.nio.PointerBuffer;
import com.jogamp.nativewindow.MutableGraphicsConfiguration;
import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
import com.jogamp.opengl.GLRendererQuirks;
+import com.jogamp.opengl.egl.EGL;
+import com.jogamp.opengl.egl.EGLExt;
public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable {
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
index d4e5e7d62..d10263f22 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
@@ -33,36 +33,37 @@
package jogamp.opengl.egl;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.CapabilitiesChooser;
-import javax.media.nativewindow.CapabilitiesImmutable;
-import javax.media.nativewindow.GraphicsConfigurationFactory;
-import javax.media.nativewindow.VisualIDHolder;
-import javax.media.nativewindow.VisualIDHolder.VIDType;
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesChooser;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
-import javax.media.opengl.GLDrawableFactory;
+import java.io.PrintStream;
+import java.nio.IntBuffer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
-import com.jogamp.common.nio.Buffers;
-import com.jogamp.common.nio.PointerBuffer;
-import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
-import com.jogamp.opengl.GLRendererQuirks;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.CapabilitiesChooser;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.GraphicsConfigurationFactory;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.nativewindow.VisualIDHolder;
+import com.jogamp.nativewindow.VisualIDHolder.VIDType;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesChooser;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import jogamp.opengl.GLGraphicsConfigurationFactory;
import jogamp.opengl.GLGraphicsConfigurationUtil;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.io.PrintStream;
-import java.nio.IntBuffer;
+import com.jogamp.common.nio.Buffers;
+import com.jogamp.common.nio.PointerBuffer;
+import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
+import com.jogamp.opengl.GLRendererQuirks;
+import com.jogamp.opengl.egl.EGL;
/** Subclass of GraphicsConfigurationFactory used when non-AWT tookits
@@ -89,7 +90,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
fallbackGraphicsConfigurationFactory = GraphicsConfigurationFactory.getFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, CapabilitiesImmutable.class);
}
} /* else if(NativeWindowFactory.TYPE_WINDOWS == NativeWindowFactory.getNativeWindowType(false)) {
- nativeGraphicsConfigurationFactory = GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.windows.WindowsGraphicsDevice.class, eglFactory);
+ nativeGraphicsConfigurationFactory = GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.windows.WindowsGraphicsDevice.class, eglFactory);
} else if(NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false)) {
} */
@@ -102,7 +103,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
if(NativeWindowFactory.TYPE_X11 == nwType) {
GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.x11.X11GraphicsDevice.class, GLCapabilitiesImmutable.class, nativeGraphicsConfigurationFactory);
} /* else if(NativeWindowFactory.TYPE_WINDOWS == NativeWindowFactory.getNativeWindowType(false)) {
- GraphicsConfigurationFactory.registerFactory(javax.media.nativewindow.windows.WindowsGraphicsDevice.class, nativeGraphicsConfigurationFactory);
+ GraphicsConfigurationFactory.registerFactory(com.jogamp.nativewindow.windows.WindowsGraphicsDevice.class, nativeGraphicsConfigurationFactory);
} else if(NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false)) {
} */
nativeGraphicsConfigurationFactory = null;
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java
deleted file mode 100644
index 4c018fe25..000000000
--- a/src/jogl/classes/jogamp/opengl/egl/EGLOnscreenDrawable.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- * Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistribution of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistribution in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- *
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package jogamp.opengl.egl;
-
-import javax.media.opengl.*;
-import javax.media.nativewindow.*;
-
-public class EGLOnscreenDrawable extends EGLDrawable {
- protected EGLOnscreenDrawable(final EGLDrawableFactory factory, final NativeSurface component) throws GLException {
- super(factory, component);
- }
-
- @Override
- public GLContext createContext(final GLContext shareWith) {
- return new EGLContext(this, shareWith);
- }
-
- @Override
- protected long createSurface(final EGLGraphicsConfiguration config, final int width, final int height, final long nativeSurfaceHandle) {
- return EGL.eglCreateWindowSurface(config.getScreen().getDevice().getHandle(), config.getNativeConfig(), nativeSurfaceHandle, null);
- }
-}
-
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java
deleted file mode 100644
index 8842edbc0..000000000
--- a/src/jogl/classes/jogamp/opengl/egl/EGLPbufferDrawable.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- * Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistribution of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistribution in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- *
- * Sun gratefully acknowledges that this software was originally authored
- * and developed by Kenneth Bradley Russell and Christopher John Kline.
- */
-
-package jogamp.opengl.egl;
-
-import javax.media.nativewindow.NativeSurface;
-import javax.media.opengl.GLContext;
-
-public class EGLPbufferDrawable extends EGLDrawable {
- protected static final boolean useTexture = false; // No yet ..
-
- protected EGLPbufferDrawable(final EGLDrawableFactory factory, final NativeSurface target) {
- super(factory, target);
- }
-
- @Override
- protected long createSurface(final EGLGraphicsConfiguration config, final int width, final int height, final long nativeSurfaceHandle) {
- return EGLDrawableFactory.createPBufferSurfaceImpl(config, width, height, false);
- }
-
- @Override
- public GLContext createContext(final GLContext shareWith) {
- return new EGLContext(this, shareWith);
- }
-}
-
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLSurface.java b/src/jogl/classes/jogamp/opengl/egl/EGLSurface.java
new file mode 100644
index 000000000..e4e692fb2
--- /dev/null
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLSurface.java
@@ -0,0 +1,165 @@
+/**
+ * Copyright 2014 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package jogamp.opengl.egl;
+
+import java.nio.IntBuffer;
+
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeWindow;
+import com.jogamp.nativewindow.ProxySurface;
+import com.jogamp.nativewindow.UpstreamSurfaceHook;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLException;
+
+import com.jogamp.common.nio.Buffers;
+import com.jogamp.nativewindow.GenericUpstreamSurfacelessHook;
+import com.jogamp.opengl.egl.EGL;
+
+import jogamp.nativewindow.ProxySurfaceImpl;
+import jogamp.nativewindow.WrappedSurface;
+import jogamp.opengl.GLDrawableImpl;
+
+/**
+ * <pre>
+ * EGLSurface [ is_a -> WrappedSurface -> ProxySurfaceImpl -> ProxySurface -> MutableSurface -> NativeSurface] has_a
+ * EGLUpstreamSurfaceHook [ is_a -> UpstreamSurfaceHook.MutableSize -> UpstreamSurfaceHook ] has_a
+ * NativeSurface (e.g. native [X11, WGL, ..] surface, or WrappedSurface, ..)
+ * </pre>
+ */
+public class EGLSurface extends WrappedSurface {
+ static boolean DEBUG = EGLDrawable.DEBUG || ProxySurface.DEBUG;
+
+ public static EGLSurface get(final NativeSurface surface) {
+ if(surface instanceof EGLSurface) {
+ return (EGLSurface)surface;
+ }
+ return new EGLSurface(surface);
+ }
+ private EGLSurface(final NativeSurface surface) {
+ super(surface.getGraphicsConfiguration(), EGL.EGL_NO_SURFACE, new EGLUpstreamSurfaceHook(surface), false /* tbd in UpstreamSurfaceHook */);
+ if(EGLDrawableFactory.DEBUG) {
+ System.err.println("EGLSurface.ctor().1: "+this);
+ ProxySurfaceImpl.dumpHierarchy(System.err, this);
+ }
+ }
+
+ public static EGLSurface createWrapped(final EGLGraphicsConfiguration cfg, final long handle,
+ final UpstreamSurfaceHook upstream, final boolean ownsDevice) {
+ return new EGLSurface(cfg, handle, upstream, ownsDevice);
+ }
+ private EGLSurface(final EGLGraphicsConfiguration cfg, final long handle,
+ final UpstreamSurfaceHook upstream, final boolean ownsDevice) {
+ super(cfg, EGL.EGL_NO_SURFACE, new EGLUpstreamSurfaceHook(cfg, handle, upstream, ownsDevice), false /* tbd in UpstreamSurfaceHook */);
+ if(EGLDrawableFactory.DEBUG) {
+ System.err.println("EGLSurface.ctor().2: "+this);
+ ProxySurfaceImpl.dumpHierarchy(System.err, this);
+ }
+ }
+
+ public static EGLSurface createSurfaceless(final EGLGraphicsConfiguration cfg, final GenericUpstreamSurfacelessHook upstream, final boolean ownsDevice) {
+ return new EGLSurface(cfg, upstream, ownsDevice);
+ }
+ private EGLSurface(final EGLGraphicsConfiguration cfg, final GenericUpstreamSurfacelessHook upstream, final boolean ownsDevice) {
+ super(cfg, EGL.EGL_NO_SURFACE, upstream, ownsDevice);
+ if(EGLDrawableFactory.DEBUG) {
+ System.err.println("EGLSurface.ctor().3: "+this);
+ ProxySurfaceImpl.dumpHierarchy(System.err, this);
+ }
+ }
+
+ public void setEGLSurfaceHandle() throws GLException {
+ setSurfaceHandle( createEGLSurfaceHandle() );
+ }
+ private long createEGLSurfaceHandle() throws GLException {
+ final EGLGraphicsConfiguration config = (EGLGraphicsConfiguration) getGraphicsConfiguration();
+ final NativeSurface nativeSurface = getUpstreamSurface();
+ final boolean isPBuffer = ((GLCapabilitiesImmutable) config.getChosenCapabilities()).isPBuffer();
+
+ long eglSurface = createEGLSurfaceHandle(isPBuffer, true /* useSurfaceHandle */, config, nativeSurface);
+ if ( EGL.EGL_NO_SURFACE == eglSurface ) {
+ final int eglError0 = EGL.eglGetError();
+ if( EGL.EGL_BAD_NATIVE_WINDOW == eglError0 && !isPBuffer ) {
+ // Try window handle if available and differs (Windows HDC / HWND).
+ // ANGLE impl. required HWND on Windows.
+ if( hasUniqueNativeWindowHandle(nativeSurface) ) {
+ if(DEBUG) {
+ System.err.println(getThreadName() + ": Info: Creation of window surface w/ surface handle failed: "+config+", error "+GLDrawableImpl.toHexString(eglError0)+", retry w/ windowHandle");
+ }
+ eglSurface = createEGLSurfaceHandle(isPBuffer, false /* useSurfaceHandle */, config, nativeSurface);
+ if (EGL.EGL_NO_SURFACE == eglSurface) {
+ throw new GLException("Creation of window surface w/ window handle failed: "+config+", "+this+", error "+GLDrawableImpl.toHexString(EGL.eglGetError()));
+ }
+ } else {
+ throw new GLException("Creation of window surface w/ surface handle failed (2): "+config+", "+this+", error "+GLDrawableImpl.toHexString(eglError0));
+ }
+ } else {
+ throw new GLException("Creation of window surface w/ surface handle failed (1): "+config+", "+this+", error "+GLDrawableImpl.toHexString(eglError0));
+ }
+ }
+ if(DEBUG) {
+ System.err.println(getThreadName() + ": createEGLSurface handle "+GLDrawableImpl.toHexString(eglSurface));
+ }
+ return eglSurface;
+ }
+ private long createEGLSurfaceHandle(final boolean isPBuffer, final boolean useSurfaceHandle,
+ final EGLGraphicsConfiguration config, final NativeSurface nativeSurface) {
+ if( isPBuffer ) {
+ return EGLDrawableFactory.createPBufferSurfaceImpl(config, getSurfaceWidth(), getSurfaceHeight(), false);
+ } else {
+ if( useSurfaceHandle ) {
+ return EGL.eglCreateWindowSurface(config.getScreen().getDevice().getHandle(),
+ config.getNativeConfig(),
+ nativeSurface.getSurfaceHandle(), null);
+ } else {
+ return EGL.eglCreateWindowSurface(config.getScreen().getDevice().getHandle(),
+ config.getNativeConfig(),
+ ((NativeWindow)nativeSurface).getWindowHandle(), null);
+ }
+ }
+ }
+ private static boolean hasUniqueNativeWindowHandle(final NativeSurface nativeSurface) {
+ return nativeSurface instanceof NativeWindow &&
+ ((NativeWindow)nativeSurface).getWindowHandle() != nativeSurface.getSurfaceHandle();
+ }
+ static String getThreadName() { return Thread.currentThread().getName(); }
+
+ public static boolean isValidEGLSurfaceHandle(final long eglDisplayHandle, final long eglSurfaceHandle) {
+ if( 0 == eglSurfaceHandle ) {
+ return false;
+ }
+ final IntBuffer val = Buffers.newDirectIntBuffer(1);
+ final boolean eglSurfaceValid = EGL.eglQuerySurface(eglDisplayHandle, eglSurfaceHandle, EGL.EGL_CONFIG_ID, val);
+ if( !eglSurfaceValid ) {
+ final int eglErr = EGL.eglGetError();
+ if(DEBUG) {
+ System.err.println(getThreadName() + ": EGLSurface.isValidEGLSurfaceHandle eglQuerySuface failed: error "+GLDrawableImpl.toHexString(eglErr)+", "+GLDrawableImpl.toHexString(eglSurfaceHandle));
+ }
+ }
+ return eglSurfaceValid;
+ }
+}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java
index cc15f0cd6..05a6fc153 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java
@@ -1,27 +1,57 @@
+/**
+ * Copyright 2014 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
package jogamp.opengl.egl;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.DefaultGraphicsScreen;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.ProxySurface;
-import javax.media.nativewindow.UpstreamSurfaceHook;
-import javax.media.nativewindow.VisualIDHolder.VIDType;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLException;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.DefaultGraphicsScreen;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.ProxySurface;
+import com.jogamp.nativewindow.UpstreamSurfaceHook;
+import com.jogamp.nativewindow.VisualIDHolder.VIDType;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLException;
+
+import jogamp.nativewindow.WrappedSurface;
import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
+import com.jogamp.opengl.egl.EGL;
/**
* <pre>
- * EGLWrappedSurface [ is_a -> WrappedSurface -> ProxySurfaceImpl -> ProxySurface -> MutableSurface -> NativeSurface] has_a
+ * EGLSurface [ is_a -> WrappedSurface -> ProxySurfaceImpl -> ProxySurface -> MutableSurface -> NativeSurface] has_a
* EGLUpstreamSurfaceHook [ is_a -> UpstreamSurfaceHook.MutableSize -> UpstreamSurfaceHook ] has_a
- * NativeSurface (e.g. native X11 surface)
+ * NativeSurface (e.g. native [X11, WGL, ..] surface, or WrappedSurface, ..)
* </pre>
*/
public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize {
- protected static final boolean DEBUG = EGLDrawableFactory.DEBUG;
+ private static final boolean DEBUG = EGLDrawableFactory.DEBUG;
private final NativeSurface upstreamSurface;
private final UpstreamSurfaceHook.MutableSize upstreamSurfaceHookMutableSize;
@@ -40,6 +70,11 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize {
}
}
+ public EGLUpstreamSurfaceHook(final EGLGraphicsConfiguration cfg, final long handle,
+ final UpstreamSurfaceHook upstream, final boolean ownsDevice) {
+ this( new WrappedSurface(cfg, handle, upstream, ownsDevice) );
+ }
+
static String getThreadName() { return Thread.currentThread().getName(); }
/**
@@ -176,10 +211,10 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize {
}
surface.setGraphicsConfiguration(eglConfig);
- if(isEGLSurfaceValid) {
- isEGLSurfaceValid = EGLDrawable.isValidEGLSurface(eglDevice.getHandle(), upstreamSurface.getSurfaceHandle());
+ if( isEGLSurfaceValid ) {
+ isEGLSurfaceValid = EGLSurface.isValidEGLSurfaceHandle(eglDevice.getHandle(), upstreamSurface.getSurfaceHandle());
}
- if(isEGLSurfaceValid) {
+ if( isEGLSurfaceValid ) {
surface.setSurfaceHandle(upstreamSurface.getSurfaceHandle());
surface.clearUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
if(DEBUG) {
@@ -196,8 +231,8 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize {
@Override
public final void destroy(final ProxySurface surface) {
- if(EGLDrawableFactory.DEBUG) {
- System.err.println("EGLUpstreamSurfaceHook.destroy("+surface.getClass().getSimpleName()+"): "+this);
+ if(DEBUG) {
+ System.err.println(getThreadName() + ": EGLUpstreamSurfaceHook.destroy("+surface.getClass().getSimpleName()+"): "+this);
}
surface.clearUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE );
if(upstreamSurface instanceof ProxySurface) {
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java b/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java
deleted file mode 100644
index 89024eed3..000000000
--- a/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package jogamp.opengl.egl;
-
-import javax.media.nativewindow.NativeSurface;
-
-import jogamp.nativewindow.WrappedSurface;
-
-/**
- * <pre>
- * EGLWrappedSurface [ is_a -> WrappedSurface -> ProxySurfaceImpl -> ProxySurface -> MutableSurface -> NativeSurface] has_a
- * EGLUpstreamSurfaceHook [ is_a -> UpstreamSurfaceHook.MutableSize -> UpstreamSurfaceHook ] has_a
- * NativeSurface (i.e. native X11 surface)
- * </pre>
- */
-public class EGLWrappedSurface extends WrappedSurface {
-
- public static EGLWrappedSurface get(final NativeSurface surface) {
- if(surface instanceof EGLWrappedSurface) {
- return (EGLWrappedSurface)surface;
- }
- return new EGLWrappedSurface(surface);
- }
-
- public EGLWrappedSurface(final NativeSurface surface) {
- super(surface.getGraphicsConfiguration(), EGL.EGL_NO_SURFACE, new EGLUpstreamSurfaceHook(surface), false /* tbd in UpstreamSurfaceHook */);
- if(EGLDrawableFactory.DEBUG) {
- System.err.println("EGLWrappedSurface.ctor(): "+this);
- }
- }
-
-}
diff --git a/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java b/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java
index f0922644b..3b4f15b52 100644
--- a/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java
+++ b/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java
@@ -117,7 +117,7 @@ package jogamp.opengl.gl2;
import java.nio.DoubleBuffer;
import java.nio.IntBuffer;
-import javax.media.opengl.GL2;
+import com.jogamp.opengl.GL2;
import com.jogamp.common.nio.Buffers;
diff --git a/src/jogl/classes/jogamp/opengl/gl2/fixme/GLObjectTracker.java b/src/jogl/classes/jogamp/opengl/gl2/fixme/GLObjectTracker.java
index 903a82fac..a60ed0157 100644
--- a/src/jogl/classes/jogamp/opengl/gl2/fixme/GLObjectTracker.java
+++ b/src/jogl/classes/jogamp/opengl/gl2/fixme/GLObjectTracker.java
@@ -42,7 +42,7 @@ package jogamp.opengl.gl2;
import jogamp.opengl.*;
import java.nio.*;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
/**
* Tracks the creation of server-side OpenGL objects which can be
diff --git a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java
index c91a045ae..afd6ba204 100644
--- a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java
+++ b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java
@@ -115,9 +115,9 @@
package jogamp.opengl.glu;
-import javax.media.opengl.GL;
-import javax.media.opengl.glu.GLU;
-import javax.media.opengl.glu.GLUquadric;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.glu.GLU;
+import com.jogamp.opengl.glu.GLUquadric;
import com.jogamp.opengl.math.FloatUtil;
import com.jogamp.opengl.util.ImmModeSink;
diff --git a/src/jogl/classes/jogamp/opengl/glu/error/Error.java b/src/jogl/classes/jogamp/opengl/glu/error/Error.java
index 235c59717..564ba3376 100644
--- a/src/jogl/classes/jogamp/opengl/glu/error/Error.java
+++ b/src/jogl/classes/jogamp/opengl/glu/error/Error.java
@@ -44,8 +44,8 @@
package jogamp.opengl.glu.error;
-import javax.media.opengl.GL;
-import javax.media.opengl.glu.GLU;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.glu.GLU;
import jogamp.opengl.glu.Glue;
/**
diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java
index 96da49a80..554da5e91 100644
--- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java
+++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java
@@ -1,11 +1,11 @@
package jogamp.opengl.glu.gl2.nurbs;
import jogamp.opengl.glu.nurbs.*;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2;
-import javax.media.opengl.GL2GL3;
-import javax.media.opengl.glu.GLU;
-import javax.media.opengl.glu.gl2.GLUgl2;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2;
+import com.jogamp.opengl.GL2GL3;
+import com.jogamp.opengl.glu.GLU;
+import com.jogamp.opengl.glu.gl2.GLUgl2;
/**
* Class rendering curves with OpenGL
diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java
index e5cb715ab..e4f5e4c39 100644
--- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java
+++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java
@@ -1,11 +1,11 @@
package jogamp.opengl.glu.gl2.nurbs;
import jogamp.opengl.glu.nurbs.*;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2;
-import javax.media.opengl.GL2GL3;
-import javax.media.opengl.glu.GLU;
-import javax.media.opengl.glu.gl2.GLUgl2;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2;
+import com.jogamp.opengl.GL2GL3;
+import com.jogamp.opengl.glu.GLU;
+import com.jogamp.opengl.glu.gl2.GLUgl2;
/**
* Class rendering surfaces with OpenGL
diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java
index a4507b767..d546066d4 100644
--- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java
+++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java
@@ -37,8 +37,8 @@ import jogamp.opengl.glu.nurbs.*;
import java.lang.reflect.Method;
-import javax.media.opengl.GL2;
-import javax.media.opengl.glu.GLUnurbs;
+import com.jogamp.opengl.GL2;
+import com.jogamp.opengl.glu.GLUnurbs;
/**
* Base object for working with NURBS curves and surfaces
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java
index 337d93b80..3127879dc 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java
@@ -44,12 +44,12 @@
package jogamp.opengl.glu.mipmap;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GL2ES3;
-import javax.media.opengl.GL2GL3;
-import javax.media.opengl.glu.GLU;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GL2ES3;
+import com.jogamp.opengl.GL2GL3;
+import com.jogamp.opengl.glu.GLU;
import jogamp.opengl.Debug;
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java
index 95ce86a5b..1b58ef5d2 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java
@@ -44,7 +44,7 @@
package jogamp.opengl.glu.mipmap;
-import javax.media.opengl.GL;
+import com.jogamp.opengl.GL;
import java.nio.*;
/**
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java
index ef77f3555..f09a6fdf3 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java
@@ -44,10 +44,10 @@
package jogamp.opengl.glu.mipmap;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GL2GL3;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GL2GL3;
import java.nio.*;
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java
index 51d8ca6fe..adf6c7da4 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java
@@ -44,14 +44,14 @@
package jogamp.opengl.glu.mipmap;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GL2ES3;
-import javax.media.opengl.GL2GL3;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.glu.GLU;
-import javax.media.opengl.GLException;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GL2ES3;
+import com.jogamp.opengl.GL2GL3;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.glu.GLU;
+import com.jogamp.opengl.GLException;
import java.nio.*;
@@ -257,7 +257,7 @@ public class Mipmap {
public static void closestFit( final GL gl, final int target, final int width, final int height, final int internalFormat,
final int format, final int type, final int[] newWidth, final int[] newHeight ) {
// Use proxy textures if OpenGL GL2/GL3 version >= 1.1
- if( gl.isGL2GL3() && gl.getContext().getGLVersionNumber().compareTo(GLContext.Version110) >= 0 ) {
+ if( gl.isGL2GL3() && gl.getContext().getGLVersionNumber().compareTo(GLContext.Version1_1) >= 0 ) {
int widthPowerOf2 = nearestPower( width );
int heightPowerOf2 = nearestPower( height );
final int[] proxyWidth = new int[1];
diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java
index ccb75091c..1d62884d0 100644
--- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java
+++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java
@@ -44,9 +44,9 @@
package jogamp.opengl.glu.mipmap;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2;
-import javax.media.opengl.glu.GLU;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2;
+import com.jogamp.opengl.glu.GLU;
import java.nio.*;
import com.jogamp.common.nio.Buffers;
diff --git a/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java b/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java
index 5cae679a2..1988d8ee9 100644
--- a/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java
+++ b/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java
@@ -44,7 +44,7 @@
package jogamp.opengl.glu.registry;
-import javax.media.opengl.glu.GLU;
+import com.jogamp.opengl.glu.GLU;
/**
*
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java
index f2a9c78fa..9686b0d04 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java
@@ -53,8 +53,8 @@
package jogamp.opengl.glu.tessellator;
import jogamp.opengl.glu.tessellator.*;
-import javax.media.opengl.*;
-import javax.media.opengl.glu.*;
+import com.jogamp.opengl.*;
+import com.jogamp.opengl.glu.*;
public class GLUtessellatorImpl implements GLUtessellator {
public static final int TESS_MAX_CACHE = 100;
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java
index 44668a943..e61f9dee1 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java
@@ -52,8 +52,8 @@
*/
package jogamp.opengl.glu.tessellator;
-import javax.media.opengl.*;
-import javax.media.opengl.glu.*;
+import com.jogamp.opengl.*;
+import com.jogamp.opengl.glu.*;
class Normal {
private Normal() {
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java
index 6325de8d2..a250a85ae 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java
@@ -52,8 +52,8 @@
*/
package jogamp.opengl.glu.tessellator;
-import javax.media.opengl.*;
-import javax.media.opengl.glu.*;
+import com.jogamp.opengl.*;
+import com.jogamp.opengl.glu.*;
class Render {
private static final boolean USE_OPTIMIZED_CODE_PATH = false;
diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java
index b6c60058f..e0e183bc1 100644
--- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java
+++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java
@@ -52,8 +52,8 @@
*/
package jogamp.opengl.glu.tessellator;
-import javax.media.opengl.*;
-import javax.media.opengl.glu.*;
+import com.jogamp.opengl.*;
+import com.jogamp.opengl.glu.*;
class Sweep {
private Sweep() {
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index cb691a7ab..51b243f37 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -44,22 +44,22 @@ import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.Map;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.nativewindow.OffscreenLayerSurface;
-import javax.media.nativewindow.ProxySurface;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GL3ES3;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
-import javax.media.opengl.GLUniformData;
-import javax.media.opengl.fixedfunc.GLMatrixFunc;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.nativewindow.OffscreenLayerSurface;
+import com.jogamp.nativewindow.ProxySurface;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GL3ES3;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
+import com.jogamp.opengl.GLUniformData;
+import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
import jogamp.nativewindow.macosx.OSXUtil;
import jogamp.opengl.GLContextImpl;
@@ -310,7 +310,7 @@ public class MacOSXCGLContext extends GLContextImpl
if (getOpenGLMode() != ((MacOSXCGLDrawable)drawable).getOpenGLMode()) {
setOpenGLMode(((MacOSXCGLDrawable)drawable).getOpenGLMode());
} */
- if (!impl.makeCurrent(contextHandle)) {
+ if ( !impl.makeCurrent(contextHandle) ) {
throw new GLException("Error making Context current: "+this);
}
drawableUpdatedNotify();
@@ -402,7 +402,7 @@ public class MacOSXCGLContext extends GLContextImpl
@Override
protected void copyImpl(final GLContext source, final int mask) throws GLException {
if( isNSContext() != ((MacOSXCGLContext)source).isNSContext() ) {
- throw new GLException("Source/Destination OpenGL Context tyoe mismatch: source "+source+", dest: "+this);
+ throw new GLException("Source/Destination OpenGL Context type mismatch: source "+source+", dest: "+this);
}
if(!impl.copyImpl(source.getHandle(), mask)) {
throw new GLException("Error copying OpenGL Context: source "+source+", dest: "+this);
@@ -528,15 +528,16 @@ public class MacOSXCGLContext extends GLContextImpl
public boolean isNSContext() { return true; }
- /** Only returns a valid NSView. If !NSView, return null and mark either pbuffer and FBO. */
- private long getNSViewHandle(final boolean[] isPBuffer, final boolean[] isFBO) {
+ /** Only returns a valid NSView. If !NSView, return null and mark either isPBuffer, isFBO or isSurfaceless. */
+ private long getNSViewHandle(final boolean[] isPBuffer, final boolean[] isFBO, final boolean[] isSurfaceless) {
final long nsViewHandle;
if(drawable instanceof GLFBODrawableImpl) {
nsViewHandle = 0;
isPBuffer[0] = false;
isFBO[0] = true;
+ isSurfaceless[0] = false;
if(DEBUG) {
- System.err.println("NS viewHandle.1: GLFBODrawableImpl drawable: isFBO "+isFBO[0]+", isPBuffer "+isPBuffer[0]+", "+drawable.getClass().getName()+",\n\t"+drawable);
+ System.err.println("NS viewHandle.1: GLFBODrawableImpl drawable: isFBO "+isFBO[0]+", isPBuffer "+isPBuffer[0]+", isSurfaceless "+isSurfaceless[0]+", "+drawable.getClass().getName()+",\n\t"+drawable);
}
} else {
final long drawableHandle = drawable.getHandle();
@@ -544,6 +545,7 @@ public class MacOSXCGLContext extends GLContextImpl
final boolean isNSWindow = OSXUtil.isNSWindow(drawableHandle);
isPBuffer[0] = CGL.isNSOpenGLPixelBuffer(drawableHandle);
isFBO[0] = false;
+ isSurfaceless[0] = false;
if( isNSView ) {
nsViewHandle = drawableHandle;
@@ -551,11 +553,14 @@ public class MacOSXCGLContext extends GLContextImpl
nsViewHandle = OSXUtil.GetNSView(drawableHandle);
} else if( isPBuffer[0] ) {
nsViewHandle = 0;
+ } else if( isSurfacelessOK() ) {
+ isSurfaceless[0] = true;
+ nsViewHandle = 0;
} else {
- throw new RuntimeException("Drawable's handle neither NSView, NSWindow nor PBuffer: drawableHandle "+toHexString(drawableHandle)+", isNSView "+isNSView+", isNSWindow "+isNSWindow+", isFBO "+isFBO[0]+", isPBuffer "+isPBuffer[0]+", "+drawable.getClass().getName()+",\n\t"+drawable);
+ throw new GLException("Drawable's handle neither NSView, NSWindow nor PBuffer: drawableHandle "+toHexString(drawableHandle)+", isNSView "+isNSView+", isNSWindow "+isNSWindow+", isFBO "+isFBO[0]+", isPBuffer "+isPBuffer[0]+", "+drawable.getClass().getName()+",\n\t"+drawable);
}
if(DEBUG) {
- System.err.println("NS viewHandle.2: drawableHandle "+toHexString(drawableHandle)+" -> nsViewHandle "+toHexString(nsViewHandle)+": isNSView "+isNSView+", isNSWindow "+isNSWindow+", isFBO "+isFBO[0]+", isPBuffer "+isPBuffer[0]+", "+drawable.getClass().getName()+",\n\t"+drawable);
+ System.err.println("NS viewHandle.2: drawableHandle "+toHexString(drawableHandle)+" -> nsViewHandle "+toHexString(nsViewHandle)+": isNSView "+isNSView+", isNSWindow "+isNSWindow+", isFBO "+isFBO[0]+", isPBuffer "+isPBuffer[0]+", isSurfaceless "+isSurfaceless[0]+", "+drawable.getClass().getName()+",\n\t"+drawable);
}
}
needsSetContextPBuffer = isPBuffer[0];
@@ -571,12 +576,15 @@ public class MacOSXCGLContext extends GLContextImpl
final long nsViewHandle;
final boolean isPBuffer;
final boolean isFBO;
+ final boolean isSurfaceless;
{
final boolean[] _isPBuffer = { false };
final boolean[] _isFBO = { false };
- nsViewHandle = getNSViewHandle(_isPBuffer, _isFBO);
+ final boolean[] _isSurfaceless = { false };
+ nsViewHandle = getNSViewHandle(_isPBuffer, _isFBO, _isSurfaceless);
isPBuffer = _isPBuffer[0];
isFBO = _isFBO[0];
+ isSurfaceless = _isSurfaceless[0];
}
final OffscreenLayerSurface backingLayerHost = NativeWindowFactory.getOffscreenLayerSurface(surface, true);
@@ -612,7 +620,7 @@ public class MacOSXCGLContext extends GLContextImpl
// determine on-/offscreen caps, since pformat is ambiguous
_fixedCaps.setPBuffer( isPBuffer ); // exclusive
_fixedCaps.setBitmap( false ); // n/a in our OSX impl.
- _fixedCaps.setOnscreen( !isFBO && !isPBuffer );
+ _fixedCaps.setOnscreen( !isFBO && !isPBuffer && !isSurfaceless );
fixedCaps = GLGraphicsConfigurationUtil.fixOpaqueGLCapabilities(_fixedCaps, chosenCaps.isBackgroundOpaque());
}
final int sRefreshRate = OSXUtil.GetScreenRefreshRate(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getIndex());
@@ -625,7 +633,7 @@ public class MacOSXCGLContext extends GLContextImpl
System.err.println("NS create backingLayerHost: "+backingLayerHost);
System.err.println("NS create share: "+share);
System.err.println("NS create drawable type: "+drawable.getClass().getName());
- System.err.println("NS create drawable handle: isPBuffer "+isPBuffer+", isFBO "+isFBO);
+ System.err.println("NS create drawable handle: isPBuffer "+isPBuffer+", isFBO "+isFBO+", isSurfaceless "+isSurfaceless);
System.err.println("NS create pixelFormat: "+toHexString(pixelFormat));
System.err.println("NS create chosenCaps: "+chosenCaps);
System.err.println("NS create fixedCaps: "+fixedCaps);
@@ -873,7 +881,8 @@ public class MacOSXCGLContext extends GLContextImpl
lastHeight = drawable.getSurfaceHeight();
final boolean[] isPBuffer = { false };
final boolean[] isFBO = { false };
- CGL.setContextView(contextHandle, getNSViewHandle(isPBuffer, isFBO));
+ final boolean[] isSurfaceless = { false };
+ CGL.setContextView(contextHandle, getNSViewHandle(isPBuffer, isFBO, isSurfaceless));
}
} else { // -> !bound
if( null != backingLayerHost ) {
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
index 8ea84a32d..ab643c095 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
@@ -44,13 +44,12 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
import jogamp.opengl.GLDrawableImpl;
-import jogamp.opengl.GLDynamicLookupHelper;
public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
// The Java2D/OpenGL pipeline on OS X uses low-level CGLContextObjs
@@ -148,11 +147,6 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
}
}
- @Override
- public GLDynamicLookupHelper getGLDynamicLookupHelper() {
- return getFactoryImpl().getGLDynamicLookupHelper(0);
- }
-
// Support for "mode switching" as described in MacOSXCGLDrawable
public void setOpenGLMode(final GLBackendType mode) {
if (mode == openGLMode) {
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
index 045abca4c..ab1d56e29 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -47,20 +47,20 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.DefaultGraphicsScreen;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.ProxySurface;
-import javax.media.nativewindow.UpstreamSurfaceHook;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesChooser;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.DefaultGraphicsScreen;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.ProxySurface;
+import com.jogamp.nativewindow.UpstreamSurfaceHook;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesChooser;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import jogamp.nativewindow.WrappedSurface;
import jogamp.nativewindow.macosx.OSXDummyUpstreamSurfaceHook;
@@ -74,12 +74,15 @@ import jogamp.opengl.SharedResourceRunner;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.util.ReflectionUtil;
+import com.jogamp.nativewindow.GenericUpstreamSurfacelessHook;
import com.jogamp.nativewindow.MutableGraphicsConfiguration;
import com.jogamp.nativewindow.macosx.MacOSXGraphicsDevice;
import com.jogamp.opengl.GLExtensions;
import com.jogamp.opengl.GLRendererQuirks;
public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
+ private static final boolean DEBUG_SHAREDCTX = DEBUG || GLContext.DEBUG;
+
private static DesktopGLDynamicLookupHelper macOSXCGLDynamicLookupHelper = null;
public MacOSXCGLDrawableFactory() {
@@ -145,7 +148,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
- public GLDynamicLookupHelper getGLDynamicLookupHelper(final int profile) {
+ public GLDynamicLookupHelper getGLDynamicLookupHelper(final String profileName) {
return macOSXCGLDynamicLookupHelper;
}
@@ -175,7 +178,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
this.hasAppleFloatPixels = hasAppletFloatPixels;
}
@Override
- public final boolean isValid() {
+ public final boolean isAvailable() {
return valid;
}
@Override
@@ -197,7 +200,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
return null;
}
@Override
- public GLRendererQuirks getRendererQuirks() {
+ public GLRendererQuirks getRendererQuirks(final GLProfile glp) {
return glRendererQuirks;
}
}
@@ -242,62 +245,86 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
}
if(null==sr && !getDeviceTried(connection)) {
addDeviceTried(connection);
- final MacOSXGraphicsDevice sharedDevice = new MacOSXGraphicsDevice(adevice.getUnitID());
- GLRendererQuirks glRendererQuirks = null;
- boolean isValid = false;
- boolean hasNPOTTextures = false;
- boolean hasRECTTextures = false;
- boolean hasAppleFloatPixels = false;
- {
- final GLProfile glp = GLProfile.get(sharedDevice, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false);
+ final MacOSXGraphicsDevice device = new MacOSXGraphicsDevice(adevice.getUnitID());
+ GLDrawable drawable = null;
+ GLDrawable zeroDrawable = null;
+ GLContextImpl context = null;
+ boolean contextIsCurrent = false;
+ device.lock();
+ try {
+ final GLProfile glp = GLProfile.get(device, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false);
if (null == glp) {
- throw new GLException("Couldn't get default GLProfile for device: "+sharedDevice);
+ throw new GLException("Couldn't get default GLProfile for device: "+device);
}
final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
- final GLDrawableImpl sharedDrawable = createOnscreenDrawableImpl(createDummySurfaceImpl(sharedDevice, false, caps, caps, null, 64, 64));
- sharedDrawable.setRealized(true);
+ drawable = createOnscreenDrawableImpl(createDummySurfaceImpl(device, false, caps, caps, null, 64, 64));
+ drawable.setRealized(true);
- final MacOSXCGLContext sharedContext = (MacOSXCGLContext) sharedDrawable.createContext(null);
- if (null == sharedContext) {
- throw new GLException("Couldn't create shared context for drawable: "+sharedDrawable);
+ context = (MacOSXCGLContext) drawable.createContext(null);
+ if (null == context) {
+ throw new GLException("Couldn't create shared context for drawable: "+drawable);
}
-
- try {
- sharedContext.makeCurrent(); // could cause exception
- isValid = sharedContext.isCurrent();
- if(isValid) {
- final GL gl = sharedContext.getGL();
- hasNPOTTextures = gl.isNPOTTextureAvailable();
- hasRECTTextures = gl.isExtensionAvailable(GLExtensions.EXT_texture_rectangle);
- hasAppleFloatPixels = gl.isExtensionAvailable(GLExtensions.APPLE_float_pixels);
- glRendererQuirks = sharedContext.getRendererQuirks();
+ contextIsCurrent = GLContext.CONTEXT_NOT_CURRENT != context.makeCurrent();
+
+ final boolean allowsSurfacelessCtx;
+ final boolean hasNPOTTextures;
+ final boolean hasRECTTextures;
+ final boolean hasAppleFloatPixels;
+ final GLRendererQuirks glRendererQuirks;
+ if( contextIsCurrent ) {
+ // We allow probing surfaceless for even the compatible 2.1 context,
+ // which we probably have right here - since OSX may support this.
+ // Otherwise, we cannot map the quirk to the device.
+ if( probeSurfacelessCtx(context, false /* restoreDrawable */) ) {
+ allowsSurfacelessCtx = true;
+ zeroDrawable = context.getGLDrawable();
+ } else {
+ allowsSurfacelessCtx = false;
}
- } catch (final GLException gle) {
- if (DEBUG) {
- System.err.println("MacOSXCGLDrawableFactory.createShared: INFO: makeCurrent caught exception:");
- gle.printStackTrace();
- }
- } finally {
+ final GL gl = context.getGL();
+ hasNPOTTextures = gl.isNPOTTextureAvailable();
+ hasRECTTextures = gl.isExtensionAvailable(GLExtensions.EXT_texture_rectangle);
+ hasAppleFloatPixels = gl.isExtensionAvailable(GLExtensions.APPLE_float_pixels);
+ glRendererQuirks = context.getRendererQuirks();
+ } else {
+ allowsSurfacelessCtx = false;
+ hasNPOTTextures = false;
+ hasRECTTextures = false;
+ hasAppleFloatPixels = false;
+ glRendererQuirks = null;
+ }
+ sr = new SharedResource(device, contextIsCurrent, hasNPOTTextures, hasRECTTextures, hasAppleFloatPixels, glRendererQuirks);
+ if ( DEBUG_SHAREDCTX ) {
+ System.err.println("SharedDevice: " + device);
+ System.err.println("SharedContext: " + context + ", madeCurrent " + contextIsCurrent);
+ System.err.println(" NPOT "+hasNPOTTextures+", RECT "+hasRECTTextures+", FloatPixels "+hasAppleFloatPixels);
+ System.err.println(" allowsSurfacelessCtx "+allowsSurfacelessCtx);
+ System.err.println(" glRendererQuirks "+glRendererQuirks);
+ }
+ synchronized(sharedMap) {
+ sharedMap.put(connection, sr);
+ }
+ } catch (final Throwable t) {
+ throw new GLException("MacOSXCGLDrawableFactory - Could not initialize shared resources for "+adevice, t);
+ } finally {
+ if( null != context ) {
try {
- sharedContext.destroy();
+ context.destroy();
} catch (final GLException gle) {
- if (DEBUG) {
+ if ( DEBUG_SHAREDCTX ) {
System.err.println("MacOSXCGLDrawableFactory.createShared: INFO: destroy caught exception:");
gle.printStackTrace();
}
}
}
- sharedDrawable.setRealized(false);
- }
- sr = new SharedResource(sharedDevice, isValid, hasNPOTTextures, hasRECTTextures, hasAppleFloatPixels, glRendererQuirks);
- synchronized(sharedMap) {
- sharedMap.put(connection, sr);
- }
- removeDeviceTried(connection);
- if (DEBUG) {
- System.err.println("MacOSXCGLDrawableFactory.createShared: device: " + sharedDevice);
- System.err.println("MacOSXCGLDrawableFactory.createShared: context: madeCurrent " + isValid + ", NPOT "+hasNPOTTextures+
- ", RECT "+hasRECTTextures+", FloatPixels "+hasAppleFloatPixels+", "+glRendererQuirks);
+ if( null != zeroDrawable ) {
+ zeroDrawable.setRealized(false);
+ }
+ if( null != drawable ) {
+ drawable.setRealized(false);
+ }
+ device.unlock();
+ removeDeviceTried(connection);
}
}
return sr;
@@ -373,6 +400,13 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
+ public final ProxySurface createSurfacelessImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice,
+ GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) {
+ chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps);
+ return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new GenericUpstreamSurfacelessHook(width, height));
+ }
+
+ @Override
protected ProxySurface createProxySurfaceImpl(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstream) {
final MacOSXGraphicsDevice device = new MacOSXGraphicsDevice(deviceReq.getUnitID());
final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, screenIdx);
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java
index 3ec40ffce..5cf4f36a1 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java
@@ -28,8 +28,10 @@
package jogamp.opengl.macosx.cgl;
-import jogamp.opengl.*;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+
+import jogamp.opengl.DesktopGLDynamicLibraryBundleInfo;
public final class MacOSXCGLDynamicLibraryBundleInfo extends DesktopGLDynamicLibraryBundleInfo {
protected MacOSXCGLDynamicLibraryBundleInfo() {
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
index cd89ad526..efb9bd5ad 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
@@ -40,12 +40,12 @@ import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.List;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.nio.PointerBuffer;
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java
index 50de70227..7e5f8b2b3 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java
@@ -36,15 +36,15 @@ package jogamp.opengl.macosx.cgl;
import jogamp.opengl.GLGraphicsConfigurationFactory;
import jogamp.opengl.GLGraphicsConfigurationUtil;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.CapabilitiesChooser;
-import javax.media.nativewindow.CapabilitiesImmutable;
-import javax.media.nativewindow.GraphicsConfigurationFactory;
-import javax.media.opengl.GLCapabilitiesChooser;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLDrawableFactory;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.CapabilitiesChooser;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.GraphicsConfigurationFactory;
+import com.jogamp.opengl.GLCapabilitiesChooser;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLDrawableFactory;
/** Subclass of GraphicsConfigurationFactory used when non-AWT tookits
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java
index c17ed7d59..db15fb95b 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java
@@ -40,14 +40,14 @@
package jogamp.opengl.macosx.cgl;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.DefaultGraphicsScreen;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.DefaultGraphicsScreen;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
import jogamp.nativewindow.WrappedSurface;
import jogamp.opengl.GLContextShareSet;
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java
index c613efa63..b0701403c 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java
@@ -40,9 +40,9 @@
package jogamp.opengl.macosx.cgl;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawableFactory;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
public class MacOSXOffscreenCGLDrawable extends MacOSXPbufferCGLDrawable {
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java
index e9ea2ff61..d283ae2cb 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java
@@ -40,9 +40,9 @@
package jogamp.opengl.macosx.cgl;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawableFactory;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
public class MacOSXOnscreenCGLDrawable extends MacOSXCGLDrawable {
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
index bc88d9ca9..56d1a94cf 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java
@@ -42,13 +42,13 @@ package jogamp.opengl.macosx.cgl;
import java.lang.ref.WeakReference;
-import javax.media.nativewindow.DefaultGraphicsConfiguration;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.MutableSurface;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
+import com.jogamp.nativewindow.DefaultGraphicsConfiguration;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.MutableSurface;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
import com.jogamp.common.nio.PointerBuffer;
import com.jogamp.opengl.util.GLBuffers;
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java
index 01300b005..180860f2a 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java
@@ -37,17 +37,17 @@ import jogamp.opengl.GLGraphicsConfigurationFactory;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.CapabilitiesChooser;
-import javax.media.nativewindow.CapabilitiesImmutable;
-import javax.media.nativewindow.DefaultGraphicsScreen;
-import javax.media.nativewindow.GraphicsConfigurationFactory;
-
-import javax.media.opengl.GLCapabilitiesChooser;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLException;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.CapabilitiesChooser;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.DefaultGraphicsScreen;
+import com.jogamp.nativewindow.GraphicsConfigurationFactory;
+
+import com.jogamp.opengl.GLCapabilitiesChooser;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLException;
import com.jogamp.nativewindow.awt.AWTGraphicsConfiguration;
import com.jogamp.nativewindow.awt.AWTGraphicsDevice;
diff --git a/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java b/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java
index 003b9148e..562d4883d 100644
--- a/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java
+++ b/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java
@@ -33,6 +33,7 @@ import java.util.Arrays;
import jogamp.opengl.Debug;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.util.LFRingbuffer;
import com.jogamp.common.util.PropertyAccess;
import com.jogamp.common.util.Ringbuffer;
@@ -262,7 +263,7 @@ public class ALAudioSink implements AudioSink {
if( ALCConstants.ALC_NO_ERROR != alcErr ) {
final String err = getThreadName()+": ALCError "+toHexString(alcErr)+" while makeCurrent. "+this;
System.err.println(err);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
lock.unlock();
throw new RuntimeException(err);
}
@@ -270,7 +271,7 @@ public class ALAudioSink implements AudioSink {
if( ALCConstants.ALC_NO_ERROR != alErr ) {
if( DEBUG ) {
System.err.println(getThreadName()+": Prev - ALError "+toHexString(alErr)+" @ makeCurrent. "+this);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
}
@@ -290,8 +291,7 @@ public class ALAudioSink implements AudioSink {
alc.alcDestroyContext(context);
} catch (final Throwable t) {
if( DEBUG ) {
- System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage());
- t.printStackTrace();
+ ExceptionUtils.dumpThrowable("", t);
}
}
context = null;
@@ -652,7 +652,7 @@ public class ALAudioSink implements AudioSink {
alBufferBytesQueued = 0;
if(DEBUG_TRACE) {
System.err.println("<< _FLUSH_ [al "+val[0]+", err "+toHexString(alErr)+"] <- "+shortString()+" @ "+getThreadName());
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
diff --git a/src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java
index 810a9286b..a2bb498b3 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLArrayHandler.java
@@ -28,7 +28,7 @@
package jogamp.opengl.util;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
/**
* Handles consistency of buffer data and array state.<br/>
diff --git a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java
index 179142fee..3af1501c4 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerFlat.java
@@ -28,7 +28,7 @@
package jogamp.opengl.util;
-import javax.media.opengl.*;
+import com.jogamp.opengl.*;
import com.jogamp.opengl.util.GLArrayDataWrapper;
diff --git a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java
index 3119b96ca..24105fdd2 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java
@@ -31,7 +31,7 @@ package jogamp.opengl.util;
import java.util.ArrayList;
import java.util.List;
-import javax.media.opengl.GL;
+import com.jogamp.opengl.GL;
import com.jogamp.opengl.util.GLArrayDataEditable;
diff --git a/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java
index 66be98215..b617ad5b0 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLDataArrayHandler.java
@@ -28,8 +28,8 @@
package jogamp.opengl.util;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLException;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLException;
import com.jogamp.opengl.util.GLArrayDataEditable;
diff --git a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java
index f5869c6ba..d1abbf5b4 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandler.java
@@ -28,9 +28,9 @@
package jogamp.opengl.util;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLException;
-import javax.media.opengl.fixedfunc.GLPointerFunc;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.fixedfunc.GLPointerFunc;
import com.jogamp.opengl.util.GLArrayDataEditable;
diff --git a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java
index b5fa2f0e5..bbd8fcd12 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLFixedArrayHandlerFlat.java
@@ -28,9 +28,9 @@
package jogamp.opengl.util;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLException;
-import javax.media.opengl.fixedfunc.GLPointerFunc;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.fixedfunc.GLPointerFunc;
import com.jogamp.opengl.util.GLArrayDataWrapper;
diff --git a/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java
index 7bc1ef1ef..a9424282e 100644
--- a/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java
+++ b/src/jogl/classes/jogamp/opengl/util/GLVBOArrayHandler.java
@@ -30,7 +30,7 @@ package jogamp.opengl.util;
import java.nio.Buffer;
-import javax.media.opengl.GL;
+import com.jogamp.opengl.GL;
import com.jogamp.opengl.util.GLArrayDataEditable;
diff --git a/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java
index f9df9153f..0e3317c5e 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java
@@ -30,16 +30,16 @@ package jogamp.opengl.util.av;
import java.nio.Buffer;
import java.nio.IntBuffer;
-import javax.media.opengl.GL;
+import com.jogamp.opengl.GL;
import com.jogamp.common.nio.Buffers;
+import com.jogamp.opengl.egl.EGL;
+import com.jogamp.opengl.egl.EGLExt;
import com.jogamp.opengl.util.texture.Texture;
import com.jogamp.opengl.util.texture.TextureSequence;
-import jogamp.opengl.egl.EGL;
import jogamp.opengl.egl.EGLContext;
import jogamp.opengl.egl.EGLDrawable;
-import jogamp.opengl.egl.EGLExt;
public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl {
final protected TextureType texType;
diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
index 0969199c6..cfecbfd8d 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
@@ -33,15 +33,15 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2GL3;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLES2;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2GL3;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLES2;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import jogamp.opengl.Debug;
diff --git a/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java
index 4a15c7422..92ed2d749 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java
@@ -31,9 +31,9 @@ import java.io.IOException;
import java.net.URLConnection;
import java.nio.ByteBuffer;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import jogamp.opengl.util.av.GLMediaPlayerImpl;
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java
index 42a908f93..f294d5bc0 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java
@@ -36,7 +36,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import javax.media.opengl.GLProfile;
+import com.jogamp.opengl.GLProfile;
import com.jogamp.common.os.DynamicLibraryBundle;
import com.jogamp.common.os.DynamicLibraryBundleInfo;
@@ -115,7 +115,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
/* 54 */ "avformat_find_stream_info", // 53.3.0 (opt)
// libavdevice
-/* 55 */ "avdevice_register_all", // ???
+/* 55 */ "avdevice_register_all", // supported in all version <= 56
// libavresample
"avresample_alloc_context", // 1.0.1
@@ -154,7 +154,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
"avresample_free",
"avresample_convert",
- // libavresample
+ // libswresample
"av_opt_set_sample_fmt", // actually lavu .. but exist only w/ swresample!
"swresample_version", // 0
"swr_alloc",
@@ -163,12 +163,11 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
"swr_convert",
};
+ /** util, format, codec, device, avresample, swresample */
+ private static final boolean[] libLoaded = new boolean[6];
private static final long[] symbolAddr = new long[symbolCount];
private static final boolean ready;
private static final boolean libsUFCLoaded;
- private static final boolean avresampleLoaded; // optional
- private static final boolean swresampleLoaded; // optional
- private static final boolean avdeviceLoaded; // optional
static final VersionNumber avCodecVersion;
static final VersionNumber avFormatVersion;
static final VersionNumber avUtilVersion;
@@ -183,23 +182,81 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
private static final int LIB_IDX_AVR = 4;
private static final int LIB_IDX_SWR = 5;
+ private static final PrivilegedAction<DynamicLibraryBundle> privInitSymbolsAction = new PrivilegedAction<DynamicLibraryBundle>() {
+ @Override
+ public DynamicLibraryBundle run() {
+ final DynamicLibraryBundle dl = new DynamicLibraryBundle(new FFMPEGDynamicLibraryBundleInfo());
+ for(int i=0; i<6; i++) {
+ libLoaded[i] = dl.isToolLibLoaded(i);
+ }
+ if( !libLoaded[LIB_IDX_UTI] || !libLoaded[LIB_IDX_FMT] || !libLoaded[LIB_IDX_COD] ) {
+ throw new RuntimeException("FFMPEG Tool library incomplete: [ avutil "+libLoaded[LIB_IDX_UTI]+", avformat "+libLoaded[LIB_IDX_FMT]+", avcodec "+libLoaded[LIB_IDX_COD]+"]");
+ }
+ dl.claimAllLinkPermission();
+ try {
+ for(int i = 0; i<symbolCount; i++) {
+ symbolAddr[i] = dl.dynamicLookupFunction(symbolNames[i]);
+ }
+ } finally {
+ dl.releaseAllLinkPermission();
+ }
+ return dl;
+ } };
+
+ /**
+ * @param loaded 6: util, format, codec, device, avresample, swresample
+ * @param versions 5: util, format, codec, avresample, swresample
+ * @return
+ */
+ private static final boolean initSymbols(final VersionNumber[] versions) {
+ for(int i=0; i<6; i++) {
+ libLoaded[i] = false;
+ }
+ if(symbolNames.length != symbolCount) {
+ throw new InternalError("XXX0 "+symbolNames.length+" != "+symbolCount);
+ }
+
+ AccessController.doPrivileged(privInitSymbolsAction);
+
+ // optional symbol name set
+ final Set<String> optionalSymbolNameSet = new HashSet<String>();
+ optionalSymbolNameSet.addAll(Arrays.asList(optionalSymbolNames));
+
+ // validate results
+ boolean res = true;
+ for(int i = 0; i<symbolCount; i++) {
+ if( 0 == symbolAddr[i] ) {
+ // no symbol, check optional and alternative symbols
+ final String symbol = symbolNames[i];
+ if ( !optionalSymbolNameSet.contains(symbol) ) {
+ System.err.println("Fail: Could not resolve symbol <"+symbolNames[i]+">: not optional, no alternatives.");
+ res = false;
+ } else if(DEBUG) {
+ System.err.println("OK: Unresolved optional symbol <"+symbolNames[i]+">");
+ }
+ }
+ }
+ versions[0] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[0]));
+ versions[1] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[1]));
+ versions[2] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[2]));
+ versions[3] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[3]));
+ versions[4] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[4]));
+
+ return res;
+ }
+
static {
// native ffmpeg media player implementation is included in jogl_desktop and jogl_mobile
GLProfile.initSingleton();
boolean _ready = false;
- /** util, format, codec, device, avresample, swresample */
- final boolean[] _loaded= new boolean[6];
/** util, format, codec, avresample, swresample */
final VersionNumber[] _versions = new VersionNumber[5];
try {
- _ready = initSymbols(_loaded, _versions);
+ _ready = initSymbols(_versions);
} catch (final Throwable t) {
t.printStackTrace();
}
- libsUFCLoaded = _loaded[LIB_IDX_UTI] && _loaded[LIB_IDX_FMT] && _loaded[LIB_IDX_COD];
- avdeviceLoaded = _loaded[LIB_IDX_DEV];
- avresampleLoaded = _loaded[LIB_IDX_AVR];
- swresampleLoaded = _loaded[LIB_IDX_SWR];
+ libsUFCLoaded = libLoaded[LIB_IDX_UTI] && libLoaded[LIB_IDX_FMT] && libLoaded[LIB_IDX_COD];
avUtilVersion = _versions[0];
avFormatVersion = _versions[1];
avCodecVersion = _versions[2];
@@ -226,6 +283,9 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
} else if( avCodecMajor == 55 && avFormatMajor == 55 && ( avUtilMajor == 52 || avUtilMajor == 53 ) ) {
// lavc55.lavf55.lavu52.lavr01 (ffmpeg) or lavc55.lavf55.lavu53.lavr01 (libav)
natives = new FFMPEGv10Natives();
+ } else if( avCodecMajor == 56 && avFormatMajor == 56 && avUtilMajor == 54 ) {
+ // lavc56.lavf56.lavu54.lavr02
+ natives = new FFMPEGv11Natives();
} else {
System.err.println("LIB_AV No Version/Native-Impl Match");
natives = null;
@@ -239,74 +299,12 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
}
static boolean libsLoaded() { return libsUFCLoaded; }
- static boolean avDeviceLoaded() { return avdeviceLoaded; }
- static boolean avResampleLoaded() { return avresampleLoaded; }
- static boolean swResampleLoaded() { return swresampleLoaded; }
+ static boolean avDeviceLoaded() { return libLoaded[LIB_IDX_DEV]; }
+ static boolean avResampleLoaded() { return libLoaded[LIB_IDX_AVR]; }
+ static boolean swResampleLoaded() { return libLoaded[LIB_IDX_SWR]; }
static FFMPEGNatives getNatives() { return natives; }
static boolean initSingleton() { return ready; }
- /**
- * @param loaded 6: util, format, codec, device, avresample, swresample
- * @param versions 5: util, format, codec, avresample, swresample
- * @return
- */
- private static final boolean initSymbols(final boolean[] loaded, final VersionNumber[] versions) {
- for(int i=0; i<6; i++) {
- loaded[i] = false;
- }
- final DynamicLibraryBundle dl = AccessController.doPrivileged(new PrivilegedAction<DynamicLibraryBundle>() {
- @Override
- public DynamicLibraryBundle run() {
- return new DynamicLibraryBundle(new FFMPEGDynamicLibraryBundleInfo());
- } } );
- dl.toString();
- for(int i=0; i<6; i++) {
- loaded[i] = dl.isToolLibLoaded(i);
- }
- if( !loaded[LIB_IDX_UTI] || !loaded[LIB_IDX_FMT] || !loaded[LIB_IDX_COD] ) {
- throw new RuntimeException("FFMPEG Tool library incomplete: [ avutil "+loaded[LIB_IDX_UTI]+", avformat "+loaded[LIB_IDX_FMT]+", avcodec "+loaded[LIB_IDX_COD]+"]");
- }
- if(symbolNames.length != symbolCount) {
- throw new InternalError("XXX0 "+symbolNames.length+" != "+symbolCount);
- }
-
- // optional symbol name set
- final Set<String> optionalSymbolNameSet = new HashSet<String>();
- optionalSymbolNameSet.addAll(Arrays.asList(optionalSymbolNames));
-
- // lookup
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- @Override
- public Object run() {
- for(int i = 0; i<symbolCount; i++) {
- symbolAddr[i] = dl.dynamicLookupFunction(symbolNames[i]);
- }
- return null;
- } } );
-
- // validate results
- boolean res = true;
- for(int i = 0; i<symbolCount; i++) {
- if( 0 == symbolAddr[i] ) {
- // no symbol, check optional and alternative symbols
- final String symbol = symbolNames[i];
- if ( !optionalSymbolNameSet.contains(symbol) ) {
- System.err.println("Fail: Could not resolve symbol <"+symbolNames[i]+">: not optional, no alternatives.");
- res = false;
- } else if(DEBUG) {
- System.err.println("OK: Unresolved optional symbol <"+symbolNames[i]+">");
- }
- }
- }
- versions[0] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[0]));
- versions[1] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[1]));
- versions[2] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[2]));
- versions[3] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[3]));
- versions[4] = FFMPEGStaticNatives.getAVVersion(FFMPEGStaticNatives.getAvVersion0(symbolAddr[4]));
-
- return res;
- }
-
protected FFMPEGDynamicLibraryBundleInfo() {
}
@@ -338,13 +336,17 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
final List<String> avutil = new ArrayList<String>();
avutil.add("avutil"); // default
- avutil.add("libavutil.so.53"); // dummy future proof
- avutil.add("libavutil.so.52"); // ffmpeg 1.2 + 2 / libav 9 + 10
+ avutil.add("libavutil.so.55"); // dummy future proof
+ avutil.add("libavutil.so.54"); // ffmpeg 2.[4-x] / libav 11
+ avutil.add("libavutil.so.53"); // ffmpeg 2.[0-3] / libav 10
+ avutil.add("libavutil.so.52"); // ffmpeg 1.2 + 2.[0-3] / libav 9
avutil.add("libavutil.so.51"); // 0.8
avutil.add("libavutil.so.50"); // 0.7
- avutil.add("avutil-53"); // dummy future proof
- avutil.add("avutil-52"); // ffmpeg 1.2 + 2 / libav 9 + 10
+ avutil.add("avutil-55"); // dummy future proof
+ avutil.add("avutil-54"); // ffmpeg 2.[4-x] / libav 11
+ avutil.add("avutil-53"); // ffmpeg 2.[0-3] / libav 10
+ avutil.add("avutil-52"); // ffmpeg 1.2 + 2.[0-3] / libav 9
avutil.add("avutil-51"); // 0.8
avutil.add("avutil-50"); // 0.7
libsList.add(avutil);
@@ -352,14 +354,16 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
final List<String> avformat = new ArrayList<String>();
avformat.add("avformat"); // default
- avformat.add("libavformat.so.56"); // dummy future proof
- avformat.add("libavformat.so.55"); // ffmpeg 2 / libav 10
+ avformat.add("libavformat.so.57"); // dummy future proof
+ avformat.add("libavformat.so.56"); // ffmpeg 2.[4-x] / libav 11
+ avformat.add("libavformat.so.55"); // ffmpeg 2.[0-3] / libav 10
avformat.add("libavformat.so.54"); // ffmpeg 1.2 / libav 9
avformat.add("libavformat.so.53"); // 0.8
avformat.add("libavformat.so.52"); // 0.7
- avformat.add("avformat-56"); // dummy future proof
- avformat.add("avformat-55"); // ffmpeg 2 / libav 10
+ avformat.add("avformat-57"); // dummy future proof
+ avformat.add("avformat-56"); // ffmpeg 2.[4-x] / libav 11
+ avformat.add("avformat-55"); // ffmpeg 2.[0-3] / libav 10
avformat.add("avformat-54"); // ffmpeg 1.2 / libav 9
avformat.add("avformat-53"); // 0.8
avformat.add("avformat-52"); // 0.7
@@ -368,14 +372,16 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
final List<String> avcodec = new ArrayList<String>();
avcodec.add("avcodec"); // default
- avcodec.add("libavcodec.so.56"); // dummy future proof
- avcodec.add("libavcodec.so.55"); // ffmpeg 2/ libav 10
+ avcodec.add("libavcodec.so.57"); // dummy future proof
+ avcodec.add("libavcodec.so.56"); // ffmpeg 2.[4-x] / libav 11
+ avcodec.add("libavcodec.so.55"); // ffmpeg 2.[0-3] / libav 10
avcodec.add("libavcodec.so.54"); // ffmpeg 1.2 / libav 9
avcodec.add("libavcodec.so.53"); // 0.8
avcodec.add("libavcodec.so.52"); // 0.7
- avcodec.add("avcodec-56"); // dummy future proof
- avcodec.add("avcodec-55"); // ffmpeg 2/ libav 10
+ avcodec.add("avcodec-57"); // dummy future proof
+ avcodec.add("avcodec-56"); // ffmpeg 2.[4-x] / libav 11
+ avcodec.add("avcodec-55"); // ffmpeg 2.[0-3] / libav 10
avcodec.add("avcodec-54"); // ffmpeg 1.2 / libav 9
avcodec.add("avcodec-53"); // 0.8
avcodec.add("avcodec-52"); // 0.7
@@ -384,13 +390,15 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
final List<String> avdevice = new ArrayList<String>();
avdevice.add("avdevice"); // default
- avdevice.add("libavdevice.so.56"); // dummy future proof
- avdevice.add("libavdevice.so.55"); // ffmpeg 2
+ avdevice.add("libavdevice.so.57"); // dummy future proof
+ avdevice.add("libavdevice.so.56"); // ffmpeg 2.[4-x]
+ avdevice.add("libavdevice.so.55"); // ffmpeg 2.[0-3] / libav 11
avdevice.add("libavdevice.so.54"); // ffmpeg 1.2 / libav 10
avdevice.add("libavdevice.so.53"); // 0.8 && libav 9
- avdevice.add("avdevice-56"); // dummy future proof
- avdevice.add("avdevice-55"); // ffmpeg 2
+ avdevice.add("avdevice-57"); // dummy future proof
+ avdevice.add("avdevice-56"); // ffmpeg 2.[4-x]
+ avdevice.add("avdevice-55"); // ffmpeg 2.[0-3] / libav 11
avdevice.add("avdevice-54"); // ffmpeg 1.2 / libav 10
avdevice.add("avdevice-53"); // 0.8 && libav 9
libsList.add(avdevice);
@@ -398,21 +406,25 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
final List<String> avresample = new ArrayList<String>();
avresample.add("avresample"); // default
- avresample.add("libavresample.so.2"); // dummy future proof
+ avresample.add("libavresample.so.3"); // dummy future proof
+ avresample.add("libavresample.so.2"); // libav 11
avresample.add("libavresample.so.1"); // libav 9 + 10
- avresample.add("avresample-2"); // dummy future proof
+ avresample.add("avresample-3"); // dummy future proof
+ avresample.add("avresample-2"); // libav 11
avresample.add("avresample-1"); // libav 9 + 10
libsList.add(avresample);
final List<String> swresample = new ArrayList<String>();
swresample.add("swresample"); // default
- swresample.add("libswresample.so.1"); // dummy future proof
- swresample.add("libswresample.so.0"); // ffmpeg 1.2 + 2.x
+ swresample.add("libswresample.so.2"); // dummy future proof
+ swresample.add("libswresample.so.1"); // ffmpeg 2.[4-x]
+ swresample.add("libswresample.so.0"); // ffmpeg 1.2 + 2.[0-3]
- swresample.add("swresample-1"); // dummy future proof
- swresample.add("swresample-0"); // ffmpeg 1.2 + 2.x
+ swresample.add("swresample-2"); // dummy future proof
+ swresample.add("swresample-1"); // ffmpeg 2.[4-x]
+ swresample.add("swresample-0"); // ffmpeg 1.2 + 2.[0-3]
libsList.add(swresample);
return libsList;
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
index 4601df67d..7df5d6a9e 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java
@@ -33,9 +33,9 @@ import java.nio.ByteBuffer;
import java.security.AccessController;
import java.security.PrivilegedAction;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLException;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLException;
import com.jogamp.common.util.IOUtil;
import com.jogamp.common.util.VersionNumber;
@@ -106,14 +106,24 @@ import jogamp.opengl.util.av.VideoPixelFormat;
* <p>
* Currently we are binary compatible w/:
* <table border="1">
- * <tr><th>libav / ffmpeg</th><th>lavc</th><th>lavf</th><th>lavu</th><th>lavr</th> <th>FFMPEG* class</th></tr>
+ * <tr><th>libav / ffmpeg</th><th>lavc</th><th>lavf</th><th>lavu</th><th>lavr/lswr</th> <th>FFMPEG* class</th></tr>
* <tr><td>0.8</td> <td>53</td> <td>53</td> <td>51</td> <td></td> <td>FFMPEGv08</td></tr>
* <tr><td>9.0 / 1.2</td> <td>54</td> <td>54</td> <td>52</td> <td>01/00</td> <td>FFMPEGv09</td></tr>
- * <tr><td>10 / 2</td> <td>55</td> <td>55</td> <td>53/52</td> <td>01/00</td> <td>FFMPEGv10</td></tr>
+ * <tr><td>10 / 2.[0-3]</td> <td>55</td> <td>55</td> <td>53/52</td> <td>01/00</td> <td>FFMPEGv10</td></tr>
+ * <tr><td>11 / 2.[4-x]</td> <td>56</td> <td>56</td> <td>54</td> <td>02/01</td> <td>FFMPEGv11</td></tr>
* </table>
* </p>
* <p>
- * See http://upstream-tracker.org/versions/libav.html
+ * See FFmpeg:
+ * <ul>
+ * <li>http://ffmpeg.org/documentation.html</li>
+ * <li>http://git.videolan.org/?p=ffmpeg.git;a=blob;f=doc/APIchanges;hb=HEAD</li>
+ * </ul>
+ * See libav:
+ * <ul>
+ * <li>https://libav.org/documentation.html</li>
+ * <li>http://upstream-tracker.org/versions/libav.html</li>
+ * </ul>
* </p>
* <p>
* Check tag 'FIXME: Add more planar formats !'
@@ -163,6 +173,8 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
private static final int avResampleMajorVersionCC;
private static final int swResampleMajorVersionCC;
private static final boolean available;
+ private static final boolean enableAvResample;
+ private static final boolean enableSwResample;
static {
final boolean libAVGood = FFMPEGDynamicLibraryBundleInfo.initSingleton();
@@ -205,9 +217,13 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
avFormatMajorVersionCC == avFormatMajor &&
( avUtilMajorVersionCC == avUtilMajor ||
55 == avCodecMajorVersionCC && 53 == avUtilMajorVersionCC && 52 == avUtilMajor /* ffmpeg 2.x */
- ) &&
- ( !avResampleLoaded || avResampleMajorVersionCC < 0 || avResampleMajorVersionCC == avResampleVersion.getMajor() ) &&
- ( !swResampleLoaded || swResampleMajorVersionCC < 0 || swResampleMajorVersionCC == swResampleVersion.getMajor() ) ;
+ );
+ enableAvResample = avResampleLoaded && avResampleMajorVersionCC == avResampleVersion.getMajor();
+ enableSwResample = swResampleLoaded && swResampleMajorVersionCC == swResampleVersion.getMajor();
+ if( DEBUG ) {
+ System.err.println("LIB_AV Resample: enabled "+enableAvResample);
+ System.err.println("LIB_SW Resample: enabled "+enableSwResample);
+ }
if( !libAVVersionGood ) {
System.err.println("LIB_AV Not Matching Compile-Time / Runtime Major-Version");
}
@@ -219,6 +235,8 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
avResampleMajorVersionCC = 0;
swResampleMajorVersionCC = 0;
libAVVersionGood = false;
+ enableAvResample = false;
+ enableSwResample = false;
}
available = libAVGood && libAVVersionGood && null != natives;
}
@@ -256,7 +274,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl {
if(!available) {
throw new RuntimeException("FFMPEGMediaPlayer not available");
}
- moviePtr = natives.createInstance0(this, DEBUG_NATIVE);
+ moviePtr = natives.createInstance0(this, enableAvResample, enableSwResample, DEBUG_NATIVE);
if(0==moviePtr) {
throw new GLException("Couldn't create FFMPEGInstance");
}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java
index 8fd439082..3b8fc83d9 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java
@@ -43,7 +43,7 @@ import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame;
abstract int getAvResampleMajorVersionCC0();
abstract int getSwResampleMajorVersionCC0();
- abstract long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose);
+ abstract long createInstance0(FFMPEGMediaPlayer upstream, boolean enableAvResample, boolean enableSwResample, boolean verbose);
abstract void destroyInstance0(long moviePtr);
/**
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java
index 6bab23f25..eff9ee5f5 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv08Natives.java
@@ -47,7 +47,7 @@ class FFMPEGv08Natives extends FFMPEGNatives {
native int getSwResampleMajorVersionCC0();
@Override
- native long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose);
+ native long createInstance0(FFMPEGMediaPlayer upstream, boolean enableAvResample, boolean enableSwResample, boolean verbose);
@Override
native void destroyInstance0(long moviePtr);
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java
index a48b5f21f..d61b39c77 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv09Natives.java
@@ -47,7 +47,7 @@ class FFMPEGv09Natives extends FFMPEGNatives {
native int getSwResampleMajorVersionCC0();
@Override
- native long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose);
+ native long createInstance0(FFMPEGMediaPlayer upstream, boolean enableAvResample, boolean enableSwResample, boolean verbose);
@Override
native void destroyInstance0(long moviePtr);
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java
index f35fb29dc..109fd8953 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv10Natives.java
@@ -47,7 +47,7 @@ class FFMPEGv10Natives extends FFMPEGNatives {
native int getSwResampleMajorVersionCC0();
@Override
- native long createInstance0(FFMPEGMediaPlayer upstream, boolean verbose);
+ native long createInstance0(FFMPEGMediaPlayer upstream, boolean enableAvResample, boolean enableSwResample, boolean verbose);
@Override
native void destroyInstance0(long moviePtr);
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv11Natives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv11Natives.java
new file mode 100644
index 000000000..9654eca82
--- /dev/null
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGv11Natives.java
@@ -0,0 +1,78 @@
+/**
+ * Copyright 2015 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package jogamp.opengl.util.av.impl;
+
+class FFMPEGv11Natives extends FFMPEGNatives {
+ @Override
+ native boolean initSymbols0(Object mutex_avcodec_openclose, long[] symbols, int count);
+
+ @Override
+ native int getAvUtilMajorVersionCC0();
+
+ @Override
+ native int getAvFormatMajorVersionCC0();
+
+ @Override
+ native int getAvCodecMajorVersionCC0();
+
+ @Override
+ native int getAvResampleMajorVersionCC0();
+
+ @Override
+ native int getSwResampleMajorVersionCC0();
+
+ @Override
+ native long createInstance0(FFMPEGMediaPlayer upstream, boolean enableAvResample, boolean enableSwResample, boolean verbose);
+
+ @Override
+ native void destroyInstance0(long moviePtr);
+
+ @Override
+ native void setStream0(long moviePtr, String url, boolean isCameraInput, int vid, String sizes, int vWidth, int vHeight, int vRate, int aid, int aMaxChannelCount, int aPrefSampleRate);
+
+ @Override
+ native void setGLFuncs0(long moviePtr, long procAddrGLTexSubImage2D, long procAddrGLGetError, long procAddrGLFlush, long procAddrGLFinish);
+
+ @Override
+ native int getVideoPTS0(long moviePtr);
+
+ @Override
+ native int getAudioPTS0(long moviePtr);
+
+ @Override
+ native int readNextPacket0(long moviePtr, int texTarget, int texFmt, int texType);
+
+ @Override
+ native int play0(long moviePtr);
+
+ @Override
+ native int pause0(long moviePtr);
+
+ @Override
+ native int seek0(long moviePtr, int position);
+}
diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java
index 5baf9e543..c69108b04 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java
@@ -30,12 +30,12 @@ package jogamp.opengl.util.av.impl;
import java.io.IOException;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLException;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.egl.EGL;
import com.jogamp.opengl.util.texture.TextureSequence;
-import jogamp.opengl.egl.EGL;
import jogamp.opengl.util.av.EGLMediaPlayerImpl;
/**
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java
index 5a78f514d..6c497c9e3 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java
@@ -30,8 +30,8 @@ package jogamp.opengl.util.glsl;
import java.nio.Buffer;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
import jogamp.opengl.util.GLArrayHandlerFlat;
import jogamp.opengl.util.GLVBOArrayHandler;
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java
index 85fcabdd9..c78ddf4e8 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java
@@ -28,8 +28,8 @@
package jogamp.opengl.util.glsl;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
import jogamp.opengl.util.GLArrayHandlerFlat;
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java
index 0169b0747..016c25e42 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java
@@ -31,7 +31,7 @@ package jogamp.opengl.util.glsl;
import java.util.ArrayList;
import java.util.List;
-import javax.media.opengl.GL;
+import com.jogamp.opengl.GL;
import jogamp.opengl.util.GLArrayHandlerFlat;
import jogamp.opengl.util.GLVBOArrayHandler;
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java
index d5d0020c5..66c5c855b 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLTextureRaster.java
@@ -35,12 +35,12 @@ import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLArrayData;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLUniformData;
-import javax.media.opengl.fixedfunc.GLMatrixFunc;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLArrayData;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLUniformData;
+import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
public class GLSLTextureRaster {
private final boolean textureVertFlipped;
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java
index 2dde27b1d..0b8a15557 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncHook.java
@@ -32,14 +32,14 @@ package jogamp.opengl.util.glsl.fixedfunc;
import java.nio.Buffer;
import java.nio.IntBuffer;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLArrayData;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
-import javax.media.opengl.fixedfunc.GLLightingFunc;
-import javax.media.opengl.fixedfunc.GLMatrixFunc;
-import javax.media.opengl.fixedfunc.GLPointerFunc;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLArrayData;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
+import com.jogamp.opengl.fixedfunc.GLLightingFunc;
+import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
+import com.jogamp.opengl.fixedfunc.GLPointerFunc;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.util.ValueConv;
diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java
index 7371b0f3b..5ac1dc7bf 100644
--- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java
+++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java
@@ -34,19 +34,19 @@ import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2;
-import javax.media.opengl.GL2ES1;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GL2GL3;
-import javax.media.opengl.GLArrayData;
-import javax.media.opengl.GLES2;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLRunnable2;
-import javax.media.opengl.GLUniformData;
-import javax.media.opengl.fixedfunc.GLLightingFunc;
-import javax.media.opengl.fixedfunc.GLPointerFunc;
-import javax.media.opengl.fixedfunc.GLPointerFuncUtil;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2;
+import com.jogamp.opengl.GL2ES1;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GL2GL3;
+import com.jogamp.opengl.GLArrayData;
+import com.jogamp.opengl.GLES2;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLRunnable2;
+import com.jogamp.opengl.GLUniformData;
+import com.jogamp.opengl.fixedfunc.GLLightingFunc;
+import com.jogamp.opengl.fixedfunc.GLPointerFunc;
+import com.jogamp.opengl.fixedfunc.GLPointerFuncUtil;
import jogamp.opengl.Debug;
diff --git a/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java b/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java
index e3e43b30c..8254f164c 100644
--- a/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java
+++ b/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java
@@ -470,11 +470,11 @@ public class JPEGDecoder {
}
private final int readUInt8() throws IOException {
- return bstream.readUInt8(true /* msbFirst */);
+ return bstream.readUInt8();
}
private final int readUInt16() throws IOException {
- return bstream.readUInt16(true /* msbFirst */, true /* bigEndian */);
+ return bstream.readUInt16(true /* bigEndian */);
}
private final int readNumber() throws IOException {
diff --git a/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDevice.java b/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDevice.java
index 36e8bc5a5..69a3f2eda 100644
--- a/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDevice.java
+++ b/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDevice.java
@@ -29,12 +29,12 @@ package jogamp.opengl.util.stereo;
import java.util.Arrays;
-import javax.media.nativewindow.util.Dimension;
-import javax.media.nativewindow.util.DimensionImmutable;
-import javax.media.nativewindow.util.Point;
-import javax.media.nativewindow.util.PointImmutable;
-import javax.media.nativewindow.util.Rectangle;
-import javax.media.nativewindow.util.RectangleImmutable;
+import com.jogamp.nativewindow.util.Dimension;
+import com.jogamp.nativewindow.util.DimensionImmutable;
+import com.jogamp.nativewindow.util.Point;
+import com.jogamp.nativewindow.util.PointImmutable;
+import com.jogamp.nativewindow.util.Rectangle;
+import com.jogamp.nativewindow.util.RectangleImmutable;
import com.jogamp.common.util.ReflectionUtil;
import com.jogamp.opengl.math.FloatUtil;
diff --git a/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDeviceRenderer.java b/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDeviceRenderer.java
index d957bd4e7..3b9fb9c26 100644
--- a/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDeviceRenderer.java
+++ b/src/jogl/classes/jogamp/opengl/util/stereo/GenericStereoDeviceRenderer.java
@@ -30,14 +30,14 @@ package jogamp.opengl.util.stereo;
import java.nio.FloatBuffer;
import java.nio.ShortBuffer;
-import javax.media.nativewindow.util.Dimension;
-import javax.media.nativewindow.util.DimensionImmutable;
-import javax.media.nativewindow.util.RectangleImmutable;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES2;
-import javax.media.opengl.GLArrayData;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLUniformData;
+import com.jogamp.nativewindow.util.Dimension;
+import com.jogamp.nativewindow.util.DimensionImmutable;
+import com.jogamp.nativewindow.util.RectangleImmutable;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLArrayData;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLUniformData;
import jogamp.common.os.PlatformPropsImpl;
diff --git a/src/jogl/classes/jogamp/opengl/util/stereo/ScaleAndOffset2D.java b/src/jogl/classes/jogamp/opengl/util/stereo/ScaleAndOffset2D.java
index ce154e03e..1fed69363 100644
--- a/src/jogl/classes/jogamp/opengl/util/stereo/ScaleAndOffset2D.java
+++ b/src/jogl/classes/jogamp/opengl/util/stereo/ScaleAndOffset2D.java
@@ -27,8 +27,8 @@
*/
package jogamp.opengl.util.stereo;
-import javax.media.nativewindow.util.DimensionImmutable;
-import javax.media.nativewindow.util.RectangleImmutable;
+import com.jogamp.nativewindow.util.DimensionImmutable;
+import com.jogamp.nativewindow.util.RectangleImmutable;
import com.jogamp.opengl.math.FovHVHalves;
import com.jogamp.opengl.math.VectorUtil;
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java
index 25b73a2a6..f00d38baa 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java
@@ -33,11 +33,11 @@ import java.nio.IntBuffer;
import jogamp.nativewindow.windows.GDI;
import jogamp.nativewindow.windows.PIXELFORMATDESCRIPTOR;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
public class WGLGLCapabilities extends GLCapabilities {
final private PIXELFORMATDESCRIPTOR pfd;
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java
index 0878f186c..c1ab8d076 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java
@@ -40,14 +40,14 @@
package jogamp.opengl.windows.wgl;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.MutableSurface;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.MutableSurface;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import jogamp.nativewindow.windows.BITMAPINFO;
import jogamp.nativewindow.windows.BITMAPINFOHEADER;
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java
index 4cebc6357..79628321d 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java
@@ -40,15 +40,15 @@
package jogamp.opengl.windows.wgl;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.DefaultGraphicsScreen;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.DefaultGraphicsScreen;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import jogamp.nativewindow.WrappedSurface;
import jogamp.nativewindow.windows.GDI;
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java
index 1378bcf3e..4cebb7e2d 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java
@@ -40,14 +40,14 @@
package jogamp.opengl.windows.wgl;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.DefaultGraphicsScreen;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.DefaultGraphicsScreen;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import jogamp.nativewindow.WrappedSurface;
import jogamp.nativewindow.windows.GDI;
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java
index 0d0681df9..46f682575 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java
@@ -40,9 +40,9 @@
package jogamp.opengl.windows.wgl;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawableFactory;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
public class WindowsOnscreenWGLDrawable extends WindowsWGLDrawable {
protected WindowsOnscreenWGLDrawable(final GLDrawableFactory factory, final NativeSurface component) {
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java
index 775e2936c..b9a02ddf8 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java
@@ -43,15 +43,15 @@ package jogamp.opengl.windows.wgl;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.MutableSurface;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.MutableSurface;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import com.jogamp.common.nio.Buffers;
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
index ebd107c47..ec4575a9c 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java
@@ -45,13 +45,12 @@ import java.nio.IntBuffer;
import java.util.HashMap;
import java.util.Map;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
import com.jogamp.common.nio.Buffers;
import com.jogamp.gluegen.runtime.ProcAddressTable;
@@ -152,17 +151,33 @@ public class WindowsWGLContext extends GLContextImpl {
// should not happen due to 'isGLReadDrawableAvailable()' query in GLContextImpl
throw new InternalError("Given readDrawable but no driver support");
}
- final int werr = ( !ok ) ? GDI.GetLastError() : GDI.ERROR_SUCCESS;
if(DEBUG && !ok) {
- final Throwable t = new Throwable ("Info: wglMakeContextCurrent draw "+
+ final Throwable t = new Throwable ("Info: wglMakeContextCurrent NOK: draw "+
GLContext.toHexString(hDrawDC) + ", read " + GLContext.toHexString(hReadDC) +
- ", ctx " + GLContext.toHexString(ctx) + ", werr " + werr);
+ ", ctx " + GLContext.toHexString(ctx) + ", werr " + GDI.GetLastError());
t.printStackTrace();
}
- if(!ok && 0==hDrawDC && 0==hReadDC) {
+ return ok;
+ }
+
+ private final boolean wglReleaseContext() {
+ boolean ok = false;
+ if(wglGLReadDrawableAvailable) {
+ // needs initilized WGL ProcAddress table
+ ok = getWGLExt().wglMakeContextCurrent(0, 0, 0);
+ } else {
+ ok = WGL.wglMakeCurrent(0, 0);
+ }
+ if( !ok ) {
+ final int werr = GDI.GetLastError();
+ final boolean ok2 = werr == GDI.ERROR_SUCCESS;
+ if(DEBUG) {
+ final Throwable t = new Throwable ("Info: wglReleaseContext NOK: werr " + werr + " -> ok "+ok2);
+ t.printStackTrace();
+ }
// Some GPU's falsely fails with a zero error code (success),
// in case this is a release context request we tolerate this
- return werr == GDI.ERROR_SUCCESS ;
+ return ok2 ;
}
return ok;
}
@@ -316,6 +331,8 @@ public class WindowsWGLContext extends GLContextImpl {
throw new GLException("Error making temp context current: 0x" + toHexString(temp_ctx) + ", werr: "+GDI.GetLastError());
}
if( !setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT, false /* strictMatch */, null == sharedContext /* withinGLVersionsMapping */) ) { // use GL_VERSION
+ WGL.wglMakeCurrent(0, 0); // release temp context
+ WGL.wglDeleteContext(temp_ctx);
throw new InternalError("setGLFunctionAvailability !strictMatch failed");
}
WGL.wglMakeCurrent(0, 0); // release temp context
@@ -331,7 +348,7 @@ public class WindowsWGLContext extends GLContextImpl {
isProcCreateContextAttribsARBAvailable = false;
isExtARBCreateContextAvailable = false;
}
- if ( isProcCreateContextAttribsARBAvailable && isExtARBCreateContextAvailable && !GLProfile.disableOpenGLARBContext && !getRendererQuirks().exist( GLRendererQuirks.NoARBCreateContext ) ) {
+ if ( isProcCreateContextAttribsARBAvailable && isExtARBCreateContextAvailable ) {
// initial ARB context creation
contextHandle = createContextARB(shareWithHandle, true);
createContextARBTried=true;
@@ -345,8 +362,7 @@ public class WindowsWGLContext extends GLContextImpl {
} else if (DEBUG) {
System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - extension not available - share "+toHexString(shareWithHandle)+
", isProcCreateContextAttribsARBAvailable "+isProcCreateContextAttribsARBAvailable+
- ", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable+
- ", disableOpenGLARBContext "+GLProfile.disableOpenGLARBContext);
+ ", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable);
}
}
} else {
@@ -368,7 +384,7 @@ public class WindowsWGLContext extends GLContextImpl {
// otherwise context of similar profile but different creation method may not be share-able.
WGL.wglMakeCurrent(0, 0);
WGL.wglDeleteContext(temp_ctx);
- throw new GLException(getThreadName()+": WindowsWGLContex.createContextImpl ctx !ARB but ARB is used, profile > GL2 requested (OpenGL >= 3.0.1). Requested: "+glCaps.getGLProfile()+", current: "+getGLVersion());
+ throw new GLException(getThreadName()+": WindowsWGLContex.createContextImpl ctx !ARB but ARB is used, profile > GL2 requested (OpenGL >= 3.1). Requested: "+glCaps.getGLProfile()+", current: "+getGLVersion());
}
if(DEBUG) {
System.err.println("WindowsWGLContext.createContext ARB not used, fall back to !ARB context "+getGLVersion());
@@ -400,20 +416,18 @@ public class WindowsWGLContext extends GLContextImpl {
@Override
protected void makeCurrentImpl() throws GLException {
- if (WGL.wglGetCurrentContext() != contextHandle) {
- if (!wglMakeContextCurrent(drawable.getHandle(), drawableRead.getHandle(), contextHandle)) {
+ if ( !wglMakeContextCurrent(drawable.getHandle(), drawableRead.getHandle(), contextHandle) ) {
throw new GLException("Error making context " + toHexString(contextHandle) +
" current on Thread " + getThreadName() +
", drawableWrite " + toHexString(drawable.getHandle()) +
", drawableRead "+ toHexString(drawableRead.getHandle()) +
", werr: " + GDI.GetLastError() + ", " + this);
}
- }
}
@Override
protected void releaseImpl() throws GLException {
- if (!wglMakeContextCurrent(0, 0, 0)) {
+ if ( !wglReleaseContext() ) {
throw new GLException("Error freeing OpenGL context, werr: " + GDI.GetLastError());
}
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java
index 00b048e38..81f14dfab 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java
@@ -40,16 +40,15 @@
package jogamp.opengl.windows.wgl;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
import com.jogamp.common.util.PropertyAccess;
import jogamp.nativewindow.windows.GDI;
import jogamp.opengl.Debug;
import jogamp.opengl.GLDrawableImpl;
-import jogamp.opengl.GLDynamicLookupHelper;
public abstract class WindowsWGLDrawable extends GLDrawableImpl {
@@ -105,9 +104,4 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl {
}
}
}
-
- @Override
- public GLDynamicLookupHelper getGLDynamicLookupHelper() {
- return getFactoryImpl().getGLDynamicLookupHelper(0);
- }
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
index fa052d784..932c81f5d 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -48,20 +48,20 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.List;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.DefaultGraphicsScreen;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.ProxySurface;
-import javax.media.nativewindow.UpstreamSurfaceHook;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesChooser;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.DefaultGraphicsScreen;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.ProxySurface;
+import com.jogamp.nativewindow.UpstreamSurfaceHook;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesChooser;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import jogamp.nativewindow.WrappedSurface;
import jogamp.nativewindow.windows.GDI;
@@ -80,11 +80,14 @@ import jogamp.opengl.SharedResourceRunner;
import com.jogamp.common.nio.PointerBuffer;
import com.jogamp.common.util.PropertyAccess;
import com.jogamp.common.util.ReflectionUtil;
+import com.jogamp.nativewindow.GenericUpstreamSurfacelessHook;
import com.jogamp.nativewindow.windows.WindowsGraphicsDevice;
import com.jogamp.opengl.GLExtensions;
import com.jogamp.opengl.GLRendererQuirks;
public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
+ private static final boolean DEBUG_SHAREDCTX = DEBUG || GLContext.DEBUG;
+
/**
* Bug 1036: NVidia Windows Driver 'Threaded optimization' workaround.
* <p>
@@ -228,7 +231,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
- public GLDynamicLookupHelper getGLDynamicLookupHelper(final int profile) {
+ public GLDynamicLookupHelper getGLDynamicLookupHelper(final String profileName) {
return windowsWGLDynamicLookupHelper;
}
@@ -275,7 +278,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
- public final boolean isValid() {
+ public final boolean isAvailable() {
return null != context;
}
@Override
@@ -287,7 +290,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
@Override
final public GLContextImpl getContext() { return context; }
@Override
- public GLRendererQuirks getRendererQuirks() {
+ public GLRendererQuirks getRendererQuirks(final GLProfile glp) {
return null != context ? context.getRendererQuirks() : null;
}
@@ -303,12 +306,12 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
sharedMap.clear();
}
@Override
- public SharedResourceRunner.Resource mapPut(final String connection, final SharedResourceRunner.Resource resource) {
- return sharedMap.put(connection, resource);
+ public SharedResourceRunner.Resource mapPut(final AbstractGraphicsDevice device, final SharedResourceRunner.Resource resource) {
+ return sharedMap.put(device.getConnection(), resource);
}
@Override
- public SharedResourceRunner.Resource mapGet(final String connection) {
- return sharedMap.get(connection);
+ public SharedResourceRunner.Resource mapGet(final AbstractGraphicsDevice device) {
+ return sharedMap.get(device.getConnection());
}
@Override
public Collection<SharedResourceRunner.Resource> mapValues() {
@@ -318,65 +321,83 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
- public boolean isDeviceSupported(final String connection) {
+ public boolean isDeviceSupported(final AbstractGraphicsDevice device) {
return true;
}
@Override
- public SharedResourceRunner.Resource createSharedResource(final String connection) {
- final WindowsGraphicsDevice sharedDevice = new WindowsGraphicsDevice(connection, AbstractGraphicsDevice.DEFAULT_UNIT);
- sharedDevice.lock();
+ public SharedResourceRunner.Resource createSharedResource(final AbstractGraphicsDevice adevice) {
+ final WindowsGraphicsDevice device = new WindowsGraphicsDevice(adevice.getConnection(), adevice.getUnitID());
+ GLContextImpl context = null;
+ boolean contextIsCurrent = false;
+ device.lock();
try {
- final AbstractGraphicsScreen absScreen = new DefaultGraphicsScreen(sharedDevice, 0);
- final GLProfile glp = GLProfile.get(sharedDevice, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false);
+ final AbstractGraphicsScreen absScreen = new DefaultGraphicsScreen(device, 0);
+ final GLProfile glp = GLProfile.get(device, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false);
if (null == glp) {
- throw new GLException("Couldn't get default GLProfile for device: "+sharedDevice);
+ throw new GLException("Couldn't get default GLProfile for device: "+device);
}
final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
- final GLDrawableImpl sharedDrawable = createOnscreenDrawableImpl(createDummySurfaceImpl(sharedDevice, false, caps, caps, null, 64, 64));
- sharedDrawable.setRealized(true);
+ final GLDrawableImpl drawable = createOnscreenDrawableImpl(createDummySurfaceImpl(device, false, caps, caps, null, 64, 64));
+ drawable.setRealized(true);
- final GLContextImpl sharedContext = (GLContextImpl) sharedDrawable.createContext(null);
- if (null == sharedContext) {
- throw new GLException("Couldn't create shared context for drawable: "+sharedDrawable);
+ context = (GLContextImpl) drawable.createContext(null);
+ if (null == context) {
+ throw new GLException("Couldn't create shared context for drawable: "+drawable);
}
- boolean hasARBPixelFormat;
- boolean hasARBMultisample;
- boolean hasARBPBuffer;
- boolean hasARBReadDrawableAvailable;
- sharedContext.makeCurrent();
- try {
- hasARBPixelFormat = sharedContext.isExtensionAvailable(WGL_ARB_pixel_format);
- hasARBMultisample = sharedContext.isExtensionAvailable(WGL_ARB_multisample);
- hasARBPBuffer = sharedContext.isExtensionAvailable(GLExtensions.ARB_pbuffer);
- hasARBReadDrawableAvailable = sharedContext.isExtensionAvailable(WGL_ARB_make_current_read) &&
- sharedContext.isFunctionAvailable(wglMakeContextCurrent);
- } finally {
- sharedContext.release();
+ contextIsCurrent = GLContext.CONTEXT_NOT_CURRENT != context.makeCurrent();
+
+ final boolean allowsSurfacelessCtx;
+ final boolean hasARBPixelFormat;
+ final boolean hasARBMultisample;
+ final boolean hasARBPBuffer;
+ final boolean hasARBReadDrawableAvailable;
+ if( contextIsCurrent ) {
+ if( context.getGLVersionNumber().compareTo(GLContext.Version3_0) >= 0 ) {
+ allowsSurfacelessCtx = probeSurfacelessCtx(context, true /* restoreDrawable */);
+ } else {
+ setNoSurfacelessCtxQuirk(context);
+ allowsSurfacelessCtx = false;
+ }
+ hasARBPixelFormat = context.isExtensionAvailable(WGL_ARB_pixel_format);
+ hasARBMultisample = context.isExtensionAvailable(WGL_ARB_multisample);
+ hasARBPBuffer = context.isExtensionAvailable(GLExtensions.ARB_pbuffer);
+ hasARBReadDrawableAvailable = context.isExtensionAvailable(WGL_ARB_make_current_read) &&
+ context.isFunctionAvailable(wglMakeContextCurrent);
+ } else {
+ allowsSurfacelessCtx = false;
+ hasARBPixelFormat = false;
+ hasARBMultisample = false;
+ hasARBPBuffer = false;
+ hasARBReadDrawableAvailable = false;
}
- if (DEBUG) {
- System.err.println("SharedDevice: " + sharedDevice);
+ if ( DEBUG_SHAREDCTX ) {
+ System.err.println("SharedDevice: " + device);
System.err.println("SharedScreen: " + absScreen);
- System.err.println("SharedContext: " + sharedContext);
+ System.err.println("SharedContext: " + context + ", madeCurrent " + contextIsCurrent);
+ System.err.println(" allowsSurfacelessCtx "+allowsSurfacelessCtx);
System.err.println("pixelformat: " + hasARBPixelFormat);
System.err.println("multisample: " + hasARBMultisample);
System.err.println("pbuffer: " + hasARBPBuffer);
System.err.println("readDrawable: " + hasARBReadDrawableAvailable);
}
- return new SharedResource(sharedDevice, absScreen, sharedDrawable, sharedContext,
+ return new SharedResource(device, absScreen, drawable, context,
hasARBPixelFormat, hasARBMultisample,
hasARBPBuffer, hasARBReadDrawableAvailable);
} catch (final Throwable t) {
- throw new GLException("WindowsWGLDrawableFactory - Could not initialize shared resources for "+connection, t);
+ throw new GLException("WindowsWGLDrawableFactory - Could not initialize shared resources for "+adevice, t);
} finally {
- sharedDevice.unlock();
+ if ( contextIsCurrent ) {
+ context.release();
+ }
+ device.unlock();
}
}
@Override
public void releaseSharedResource(final SharedResourceRunner.Resource shared) {
final SharedResource sr = (SharedResource) shared;
- if (DEBUG) {
+ if ( DEBUG_SHAREDCTX ) {
System.err.println("Shutdown Shared:");
System.err.println("Device : " + sr.device);
System.err.println("Screen : " + sr.screen);
@@ -555,6 +576,13 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
+ public final ProxySurface createSurfacelessImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice,
+ GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) {
+ chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps);
+ return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new GenericUpstreamSurfacelessHook(width, height));
+ }
+
+ @Override
protected final ProxySurface createProxySurfaceImpl(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstream) {
final WindowsGraphicsDevice device = new WindowsGraphicsDevice(deviceReq.getConnection(), deviceReq.getUnitID());
final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, screenIdx);
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java
index 2285ae996..d13e4ddad 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java
@@ -28,8 +28,10 @@
package jogamp.opengl.windows.wgl;
-import jogamp.opengl.*;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+
+import jogamp.opengl.DesktopGLDynamicLibraryBundleInfo;
public final class WindowsWGLDynamicLibraryBundleInfo extends DesktopGLDynamicLibraryBundleInfo {
protected WindowsWGLDynamicLibraryBundleInfo() {
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
index 5785f8041..f88718d1b 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
@@ -38,16 +38,17 @@ import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.List;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLCapabilitiesChooser;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
-
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLCapabilitiesChooser;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
+
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.nio.Buffers;
import com.jogamp.nativewindow.MutableGraphicsConfiguration;
import com.jogamp.opengl.GLRendererQuirks;
@@ -226,6 +227,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
public final boolean isDetermined() { return isDetermined; }
public final PIXELFORMATDESCRIPTOR getPixelFormat() { return isDetermined ? ((WGLGLCapabilities)capabilitiesChosen).getPFD() : null; }
+ /** FIXME: NPE ..*/
public final int getPixelFormatID() { return isDetermined ? ((WGLGLCapabilities)capabilitiesChosen).getPFDID() : 0; }
public final boolean isChoosenByARB() { return isDetermined ? ((WGLGLCapabilities)capabilitiesChosen).isSetByARB() : false; }
@@ -281,7 +283,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
System.err.println("GetPixelFormatAttribivARB: Failed - HDC 0x" + Long.toHexString(hdc) +
", value "+iresults.get(0)+
", LastError: " + GDI.GetLastError());
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return 0;
}
@@ -290,7 +292,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
if(DEBUG) {
System.err.println("GetPixelFormatAttribivARB: No formats - HDC 0x" + Long.toHexString(hdc) +
", LastError: " + GDI.GetLastError());
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
return pfdIDCount;
@@ -351,7 +353,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
iattributes, accelerationMode, null) ) {
if (DEBUG) {
System.err.println("wglChoosePixelFormatARB: GLCapabilities2AttribList failed: " + GDI.GetLastError());
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return null;
}
@@ -365,7 +367,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
pformatsTmp, numFormatsTmp) ) {
if (DEBUG) {
System.err.println("wglChoosePixelFormatARB: wglChoosePixelFormatARB failed: " + GDI.GetLastError());
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return null;
}
@@ -508,7 +510,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
caps.getAccumGreenBits() > 0 ||
caps.getAccumBlueBits() > 0 ||
caps.getAccumAlphaBits() > 0 ) {
- final GLRendererQuirks sharedQuirks = sharedResource.getRendererQuirks();
+ final GLRendererQuirks sharedQuirks = sharedResource.getRendererQuirks(null);
if ( !usePBuffer || null==sharedQuirks || !sharedQuirks.exist(GLRendererQuirks.NoPBufferWithAccum) ) {
iattributes.put(niattribs++, WGLExt.WGL_ACCUM_BITS_ARB);
iattributes.put(niattribs++, ( caps.getAccumRedBits() +
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
index ea9b86712..21eb6b8f3 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
@@ -33,23 +33,25 @@
package jogamp.opengl.windows.wgl;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.CapabilitiesChooser;
-import javax.media.nativewindow.DefaultGraphicsScreen;
-import javax.media.nativewindow.GraphicsConfigurationFactory;
-import javax.media.nativewindow.CapabilitiesImmutable;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.nativewindow.VisualIDHolder;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLCapabilitiesChooser;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
-
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.CapabilitiesChooser;
+import com.jogamp.nativewindow.DefaultGraphicsScreen;
+import com.jogamp.nativewindow.GraphicsConfigurationFactory;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.nativewindow.ProxySurface;
+import com.jogamp.nativewindow.VisualIDHolder;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLCapabilitiesChooser;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
+
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.nio.Buffers;
import com.jogamp.opengl.GLRendererQuirks;
@@ -131,7 +133,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
List<GLCapabilitiesImmutable> availableCaps = null;
final GLContext sharedContext;
- if ( factory.hasRendererQuirk(device, GLRendererQuirks.NeedCurrCtx4ARBPixFmtQueries) ) {
+ if ( factory.hasRendererQuirk(device, null, GLRendererQuirks.NeedCurrCtx4ARBPixFmtQueries) ) {
sharedContext = sharedResource.getContext();
if(GLContext.CONTEXT_NOT_CURRENT == sharedContext.makeCurrent()) {
throw new GLException("Could not make Shared Context current: "+device);
@@ -221,7 +223,11 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
try {
final long hdc = ns.getSurfaceHandle();
if (0 == hdc) {
- throw new GLException("Error: HDC is null");
+ if( !(ns instanceof ProxySurface) ||
+ !((ProxySurface)ns).containsUpstreamOptionBits( ProxySurface.OPT_UPSTREAM_SURFACELESS ) ) {
+ throw new GLException(String.format("non-surfaceless drawable has zero-handle (HDC): %s", ns.toString()));
+ }
+ return; // NOP .. will reach ns.unlockSurface()
}
final WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) ns.getGraphicsConfiguration();
@@ -299,7 +305,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
final AbstractGraphicsDevice device = config.getScreen().getDevice();
final WindowsWGLDrawableFactory.SharedResource sharedResource = ((WindowsWGLDrawableFactory)factory).getOrCreateSharedResourceImpl(device);
final GLContext sharedContext;
- if ( factory.hasRendererQuirk(device, GLRendererQuirks.NeedCurrCtx4ARBPixFmtQueries) ) {
+ if ( factory.hasRendererQuirk(device, null, GLRendererQuirks.NeedCurrCtx4ARBPixFmtQueries) ) {
sharedContext = sharedResource.getContext();
if(GLContext.CONTEXT_NOT_CURRENT == sharedContext.makeCurrent()) {
throw new GLException("Could not make Shared Context current: "+device);
@@ -417,7 +423,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
if (null == pformats) {
if (DEBUG) {
System.err.println("updateGraphicsConfigurationARB: failed, return false");
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return false;
}
@@ -431,7 +437,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
if( null == availableCaps || 0 == availableCaps.size() ) {
if (DEBUG) {
System.err.println("updateGraphicsConfigurationARB: wglARBPFIDs2GLCapabilities failed with " + pformats.length + " pfd ids");
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return false;
}
@@ -453,7 +459,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
}
if ( 0 > chosenIndex ) {
if (DEBUG) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return false;
}
@@ -603,7 +609,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat
if ( 0 > chosenIndex ) {
if (DEBUG) {
System.err.println("updateGraphicsConfigurationGDI: failed, return false");
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return false;
}
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java
index 9e784ad73..83e4ae472 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java
@@ -45,21 +45,21 @@ import jogamp.opengl.GLGraphicsConfigurationFactory;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.CapabilitiesChooser;
-import javax.media.nativewindow.CapabilitiesImmutable;
-import javax.media.nativewindow.DefaultGraphicsScreen;
-import javax.media.nativewindow.GraphicsConfigurationFactory;
-
-import javax.media.opengl.GLCapabilitiesChooser;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLException;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.CapabilitiesChooser;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.DefaultGraphicsScreen;
+import com.jogamp.nativewindow.GraphicsConfigurationFactory;
+
+import com.jogamp.opengl.GLCapabilitiesChooser;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLException;
import jogamp.opengl.windows.wgl.WindowsWGLDrawableFactory;
import jogamp.opengl.windows.wgl.WindowsWGLGraphicsConfiguration;
-import javax.media.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLDrawableFactory;
public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFactory {
public static void registerFactory() {
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java
index 195096110..b8d803338 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java
@@ -35,7 +35,7 @@ package jogamp.opengl.x11.glx;
import java.nio.IntBuffer;
-import javax.media.opengl.GLException;
+import com.jogamp.opengl.GLException;
import jogamp.opengl.Debug;
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java
index 7040621be..fab5895e8 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java
@@ -42,13 +42,13 @@ package jogamp.opengl.x11.glx;
import java.nio.IntBuffer;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.VisualIDHolder;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.VisualIDHolder;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import jogamp.nativewindow.WrappedSurface;
import jogamp.opengl.GLContextShareSet;
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java
index d2f967a5c..bce5b6294 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java
@@ -41,11 +41,11 @@ package jogamp.opengl.x11.glx;
import java.nio.IntBuffer;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import jogamp.nativewindow.WrappedSurface;
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java
index 36e791641..740289fa6 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java
@@ -30,11 +30,11 @@ package jogamp.opengl.x11.glx;
import jogamp.nativewindow.x11.XVisualInfo;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.VisualIDHolder;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.VisualIDHolder;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
public class X11GLCapabilities extends GLCapabilities {
final private XVisualInfo xVisualInfo; // maybe null if !onscreen
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
index 9631dbb5b..19056a73b 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java
@@ -45,13 +45,13 @@ import java.nio.IntBuffer;
import java.util.HashMap;
import java.util.Map;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import jogamp.nativewindow.x11.X11Lib;
import jogamp.nativewindow.x11.X11Util;
@@ -59,6 +59,7 @@ import jogamp.opengl.GLContextImpl;
import jogamp.opengl.GLDrawableImpl;
import jogamp.opengl.GLXExtensions;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.util.VersionNumber;
import com.jogamp.gluegen.runtime.ProcAddressTable;
@@ -186,11 +187,32 @@ public class X11GLXContext extends GLContextImpl {
return res;
}
+ private final boolean glXReleaseContext(final long dpy) {
+ boolean res = false;
+
+ try {
+ if ( isGLXVersionGreaterEqualOneThree() ) {
+ // System.err.println(getThreadName() +": X11GLXContext.releaseCurrent: obj " + toHexString(hashCode()) + " / ctx "+toHexString(contextHandle)+": ctx "+toHexString(ctx)+" - switch");
+ res = GLX.glXMakeContextCurrent(dpy, 0, 0, 0);
+ } else {
+ // System.err.println(getThreadName() +": X11GLXContext.releaseCurrent: obj " + toHexString(hashCode()) + " / ctx "+toHexString(contextHandle)+": ctx "+toHexString(ctx)+" - switch");
+ res = GLX.glXMakeCurrent(dpy, 0, 0);
+ }
+ } catch (final RuntimeException re) {
+ if( DEBUG_TRACE_SWITCH ) {
+ System.err.println(getThreadName()+": Warning: X11GLXContext.glXReleaseContext failed: "+re+", with "+
+ "dpy "+toHexString(dpy));
+ re.printStackTrace();
+ }
+ }
+ return res;
+ }
+
@Override
protected void destroyContextARBImpl(final long ctx) {
final long display = drawable.getNativeSurface().getDisplayHandle();
- glXMakeContextCurrent(display, 0, 0, 0);
+ glXReleaseContext(display);
GLX.glXDestroyContext(display, ctx);
}
private static final int ctx_arb_attribs_idx_major = 0;
@@ -220,8 +242,6 @@ public class X11GLXContext extends GLContextImpl {
final boolean ctFwdCompat = 0 != ( CTX_OPTION_FORWARD & ctp ) ;
final boolean ctDebug = 0 != ( CTX_OPTION_DEBUG & ctp ) ;
- long ctx=0;
-
final IntBuffer attribs = Buffers.newDirectIntBuffer(ctx_arb_attribs_rom);
attribs.put(ctx_arb_attribs_idx_major + 1, major);
attribs.put(ctx_arb_attribs_idx_minor + 1, minor);
@@ -249,6 +269,7 @@ public class X11GLXContext extends GLContextImpl {
final X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration();
final AbstractGraphicsDevice device = config.getScreen().getDevice();
final long display = device.getHandle();
+ long ctx=0;
try {
// critical path, a remote display might not support this command,
@@ -258,8 +279,8 @@ public class X11GLXContext extends GLContextImpl {
ctx = _glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs);
} catch (final RuntimeException re) {
if(DEBUG) {
- final Throwable t = new Throwable(getThreadName()+": Info: X11GLXContext.createContextARBImpl glXCreateContextAttribsARB failed with "+getGLVersion(major, minor, ctp, "@creation"), re);
- t.printStackTrace();
+ System.err.println(getThreadName()+": Info: X11GLXContext.createContextARBImpl glXCreateContextAttribsARB failed with "+getGLVersion(major, minor, ctp, "@creation"));
+ ExceptionUtils.dumpThrowable("", re);
}
}
@@ -269,7 +290,7 @@ public class X11GLXContext extends GLContextImpl {
System.err.println(getThreadName()+": X11GLXContext.createContextARBImpl couldn't make current "+getGLVersion(major, minor, ctp, "@creation"));
}
// release & destroy
- glXMakeContextCurrent(display, 0, 0, 0);
+ glXReleaseContext(display);
GLX.glXDestroyContext(display, ctx);
ctx = 0;
} else if (DEBUG) {
@@ -314,7 +335,10 @@ public class X11GLXContext extends GLContextImpl {
throw new GLException(getThreadName()+": Error making temp context(0) current: display "+toHexString(display)+", context "+toHexString(contextHandle)+", drawable "+drawable);
}
if( !setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT, false /* strictMatch */, null == sharedContext /* withinGLVersionsMapping */) ) { // use GL_VERSION
- throw new InternalError("setGLFunctionAvailability !strictMatch failed");
+ glXReleaseContext(display); // release temp context
+ GLX.glXDestroyContext(display, contextHandle);
+ contextHandle = 0;
+ throw new InternalError("setGLFunctionAvailability !strictMatch failed.1");
}
isDirect = GLX.glXIsDirect(display, contextHandle);
if (DEBUG) {
@@ -345,13 +369,17 @@ public class X11GLXContext extends GLContextImpl {
if ( !glXMakeContextCurrent(display, drawable.getHandle(), drawableRead.getHandle(), temp_ctx) ) {
throw new GLException(getThreadName()+": Error making temp context(1) current: display "+toHexString(display)+", context "+toHexString(temp_ctx)+", drawable "+drawable);
}
- setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT, false /* strictMatch */, null == sharedContext /* withinGLVersionsMapping */); // use GL_VERSION
- glXMakeContextCurrent(display, 0, 0, 0); // release temp context
+ if( !setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT, false /* strictMatch */, null == sharedContext /* withinGLVersionsMapping */) ) { // use GL_VERSION
+ glXReleaseContext(display); // release temp context
+ GLX.glXDestroyContext(display, temp_ctx);
+ throw new InternalError("setGLFunctionAvailability !strictMatch failed.2");
+ }
+ glXReleaseContext(display); // release temp context
if( !createContextARBTried ) {
// is*Available calls are valid since setGLFunctionAvailability(..) was called
final boolean isProcCreateContextAttribsARBAvailable = isFunctionAvailable("glXCreateContextAttribsARB");
final boolean isExtARBCreateContextAvailable = isExtensionAvailable("GLX_ARB_create_context");
- if ( isProcCreateContextAttribsARBAvailable && isExtARBCreateContextAvailable && !GLProfile.disableOpenGLARBContext ) {
+ if ( isProcCreateContextAttribsARBAvailable && isExtARBCreateContextAvailable ) {
// initial ARB context creation
contextHandle = createContextARB(shareWithHandle, direct);
createContextARBTried=true;
@@ -365,8 +393,7 @@ public class X11GLXContext extends GLContextImpl {
} else if( DEBUG ) {
System.err.println(getThreadName() + ": createContextImpl: NOT OK (ARB, initial) - extension not available - share "+toHexString(shareWithHandle)+
", isProcCreateContextAttribsARBAvailable "+isProcCreateContextAttribsARBAvailable+
- ", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable+
- ", disableOpenGLARBContext "+GLProfile.disableOpenGLARBContext);
+ ", isExtGLXARBCreateContextAvailable "+isExtARBCreateContextAvailable);
}
}
} else {
@@ -375,7 +402,7 @@ public class X11GLXContext extends GLContextImpl {
if( 0 != contextHandle ) {
if( 0 != temp_ctx ) {
- glXMakeContextCurrent(display, 0, 0, 0);
+ glXReleaseContext(display);
GLX.glXDestroyContext(display, temp_ctx);
if ( !glXMakeContextCurrent(display, drawable.getHandle(), drawableRead.getHandle(), contextHandle) ) {
throw new GLException(getThreadName()+": Cannot make previous verified context current");
@@ -385,9 +412,9 @@ public class X11GLXContext extends GLContextImpl {
if( glp.isGL3() && createContextARBTried ) {
// We shall not allow context creation >= GL3 w/ non ARB methods if ARB is used,
// otherwise context of similar profile but different creation method may not be share-able.
- glXMakeContextCurrent(display, 0, 0, 0);
+ glXReleaseContext(display);
GLX.glXDestroyContext(display, temp_ctx);
- throw new GLException(getThreadName()+": X11GLXContext.createContextImpl ctx !ARB but ARB is used, profile > GL2 requested (OpenGL >= 3.0.1). Requested: "+glp+", current: "+getGLVersion());
+ throw new GLException(getThreadName()+": X11GLXContext.createContextImpl ARB n/a but required, profile > GL2 requested (OpenGL >= 3.1). Requested: "+glp+", current: "+getGLVersion());
}
if(DEBUG) {
@@ -397,7 +424,7 @@ public class X11GLXContext extends GLContextImpl {
// continue with temp context
contextHandle = temp_ctx;
if ( !glXMakeContextCurrent(display, drawable.getHandle(), drawableRead.getHandle(), contextHandle) ) {
- glXMakeContextCurrent(display, 0, 0, 0);
+ glXReleaseContext(display);
GLX.glXDestroyContext(display, temp_ctx);
throw new GLException(getThreadName()+": Error making context(1) current: display "+toHexString(display)+", context "+toHexString(contextHandle)+", drawable "+drawable);
}
@@ -416,23 +443,20 @@ public class X11GLXContext extends GLContextImpl {
@Override
protected void makeCurrentImpl() throws GLException {
final long dpy = drawable.getNativeSurface().getDisplayHandle();
-
- if (GLX.glXGetCurrentContext() != contextHandle) {
- if (!glXMakeContextCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) {
- throw new GLException("Error making context " + toHexString(contextHandle) +
- " current on Thread " + getThreadName() +
- " with display " + toHexString(dpy) +
- ", drawableWrite " + toHexString(drawable.getHandle()) +
- ", drawableRead "+ toHexString(drawableRead.getHandle()) +
- " - " + this);
- }
+ if ( !glXMakeContextCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle) ) {
+ throw new GLException("Error making context " + toHexString(contextHandle) +
+ " current on Thread " + getThreadName() +
+ " with display " + toHexString(dpy) +
+ ", drawableWrite " + toHexString(drawable.getHandle()) +
+ ", drawableRead "+ toHexString(drawableRead.getHandle()) +
+ " - " + this);
}
}
@Override
protected void releaseImpl() throws GLException {
final long display = drawable.getNativeSurface().getDisplayHandle();
- if (!glXMakeContextCurrent(display, 0, 0, 0)) {
+ if ( !glXReleaseContext(display) ) {
throw new GLException(getThreadName()+": Error freeing OpenGL context");
}
}
@@ -491,7 +515,7 @@ public class X11GLXContext extends GLContextImpl {
x11Device.lock();
try{
if (DEBUG) {
- System.err.println("GLX Version client version "+ GLXUtil.getClientVersionNumber()+
+ System.err.println("GLX Version client "+ GLXUtil.getClientVersionNumber()+
", server: "+ GLXUtil.getGLXServerVersionNumber(x11Device));
}
if(((X11GLXDrawableFactory)drawable.getFactoryImpl()).isGLXVersionGreaterEqualOneOne(x11Device)) {
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java
index c29bc3bc3..86ce0d427 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java
@@ -40,11 +40,10 @@
package jogamp.opengl.x11.glx;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.opengl.GLDrawableFactory;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.opengl.GLDrawableFactory;
import jogamp.opengl.GLDrawableImpl;
-import jogamp.opengl.GLDynamicLookupHelper;
public abstract class X11GLXDrawable extends GLDrawableImpl {
protected X11GLXDrawable(final GLDrawableFactory factory, final NativeSurface comp, final boolean realized) {
@@ -52,11 +51,6 @@ public abstract class X11GLXDrawable extends GLDrawableImpl {
}
@Override
- public GLDynamicLookupHelper getGLDynamicLookupHelper() {
- return getFactoryImpl().getGLDynamicLookupHelper(0);
- }
-
- @Override
protected void setRealizedImpl() {
if(realized) {
final X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration();
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
index 60e4438d0..ecaf20d86 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java
@@ -45,20 +45,20 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.List;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.ProxySurface;
-import javax.media.nativewindow.UpstreamSurfaceHook;
-import javax.media.nativewindow.VisualIDHolder;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesChooser;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.ProxySurface;
+import com.jogamp.nativewindow.UpstreamSurfaceHook;
+import com.jogamp.nativewindow.VisualIDHolder;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesChooser;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import jogamp.nativewindow.WrappedSurface;
import jogamp.nativewindow.x11.X11DummyUpstreamSurfaceHook;
@@ -72,13 +72,16 @@ import jogamp.opengl.GLDynamicLookupHelper;
import jogamp.opengl.GLGraphicsConfigurationUtil;
import jogamp.opengl.SharedResourceRunner;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.util.VersionNumber;
+import com.jogamp.nativewindow.GenericUpstreamSurfacelessHook;
import com.jogamp.nativewindow.x11.X11GraphicsDevice;
import com.jogamp.nativewindow.x11.X11GraphicsScreen;
import com.jogamp.opengl.GLRendererQuirks;
public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
+ private static final boolean DEBUG_SHAREDCTX = DEBUG || GLContext.DEBUG;
public static final VersionNumber versionOneZero = new VersionNumber(1, 0, 0);
public static final VersionNumber versionOneOne = new VersionNumber(1, 1, 0);
@@ -160,7 +163,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
- public final GLDynamicLookupHelper getGLDynamicLookupHelper(final int profile) {
+ public final GLDynamicLookupHelper getGLDynamicLookupHelper(final String profileName) {
return x11GLXDynamicLookupHelper;
}
@@ -183,7 +186,8 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
SharedResource(final X11GraphicsDevice dev, final X11GraphicsScreen scrn,
final GLDrawableImpl draw, final GLContextImpl ctx,
- final VersionNumber glXServerVer, final String glXServerVendor, final boolean glXServerMultisampleAvail) {
+ final VersionNumber glXServerVer, final String glXServerVendor,
+ final boolean glXServerMultisampleAvail) {
device = dev;
screen = scrn;
drawable = draw;
@@ -197,7 +201,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
glXMultisampleAvailable = glXServerMultisampleAvail;
}
@Override
- public final boolean isValid() {
+ public final boolean isAvailable() {
return null != context;
}
@Override
@@ -209,7 +213,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
@Override
final public GLContextImpl getContext() { return context; }
@Override
- public GLRendererQuirks getRendererQuirks() {
+ public GLRendererQuirks getRendererQuirks(final GLProfile glp) {
return null != context ? context.getRendererQuirks() : null;
}
@@ -228,12 +232,12 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
sharedMap.clear();
}
@Override
- public SharedResourceRunner.Resource mapPut(final String connection, final SharedResourceRunner.Resource resource) {
- return sharedMap.put(connection, resource);
+ public SharedResourceRunner.Resource mapPut(final AbstractGraphicsDevice device, final SharedResourceRunner.Resource resource) {
+ return sharedMap.put(device.getConnection(), resource);
}
@Override
- public SharedResourceRunner.Resource mapGet(final String connection) {
- return sharedMap.get(connection);
+ public SharedResourceRunner.Resource mapGet(final AbstractGraphicsDevice device) {
+ return sharedMap.get(device.getConnection());
}
@Override
public Collection<SharedResourceRunner.Resource> mapValues() {
@@ -241,9 +245,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
- public boolean isDeviceSupported(final String connection) {
+ public boolean isDeviceSupported(final AbstractGraphicsDevice device) {
final boolean res;
- final X11GraphicsDevice x11Device = new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */);
+ final X11GraphicsDevice x11Device = new X11GraphicsDevice(X11Util.openDisplay(device.getConnection()), device.getUnitID(), true /* owner */);
x11Device.lock();
try {
res = GLXUtil.isGLXAvailableOnServer(x11Device);
@@ -258,51 +262,56 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
- public SharedResourceRunner.Resource createSharedResource(final String connection) {
- final X11GraphicsDevice sharedDevice = new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */);
- sharedDevice.lock();
+ public SharedResourceRunner.Resource createSharedResource(final AbstractGraphicsDevice adevice) {
+ final X11GraphicsDevice device = new X11GraphicsDevice(X11Util.openDisplay(adevice.getConnection()), adevice.getUnitID(), true /* owner */);
+ GLContextImpl context = null;
+ boolean contextIsCurrent = false;
+ device.lock();
try {
- final X11GraphicsScreen sharedScreen = new X11GraphicsScreen(sharedDevice, sharedDevice.getDefaultScreen());
+ final X11GraphicsScreen screen = new X11GraphicsScreen(device, device.getDefaultScreen());
- GLXUtil.initGLXClientDataSingleton(sharedDevice);
- final String glXServerVendorName = GLX.glXQueryServerString(sharedDevice.getHandle(), 0, GLX.GLX_VENDOR);
- final boolean glXServerMultisampleAvailable = GLXUtil.isMultisampleAvailable(GLX.glXQueryServerString(sharedDevice.getHandle(), 0, GLX.GLX_EXTENSIONS));
+ GLXUtil.initGLXClientDataSingleton(device);
+ final String glXServerVendorName = GLX.glXQueryServerString(device.getHandle(), 0, GLX.GLX_VENDOR);
+ final boolean glXServerMultisampleAvailable = GLXUtil.isMultisampleAvailable(GLX.glXQueryServerString(device.getHandle(), 0, GLX.GLX_EXTENSIONS));
- final GLProfile glp = GLProfile.get(sharedDevice, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false);
+ final GLProfile glp = GLProfile.get(device, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false);
if (null == glp) {
- throw new GLException("Couldn't get default GLProfile for device: "+sharedDevice);
+ throw new GLException("Couldn't get default GLProfile for device: "+device);
}
final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
- final GLDrawableImpl sharedDrawable = createOnscreenDrawableImpl(createDummySurfaceImpl(sharedDevice, false, caps, caps, null, 64, 64));
- sharedDrawable.setRealized(true);
- final X11GLCapabilities chosenCaps = (X11GLCapabilities) sharedDrawable.getChosenGLCapabilities();
+ final GLDrawableImpl drawable = createOnscreenDrawableImpl(createDummySurfaceImpl(device, false, caps, caps, null, 64, 64));
+ drawable.setRealized(true);
+ final X11GLCapabilities chosenCaps = (X11GLCapabilities) drawable.getChosenGLCapabilities();
final boolean glxForcedOneOne = !chosenCaps.hasFBConfig();
final VersionNumber glXServerVersion;
if( glxForcedOneOne ) {
glXServerVersion = versionOneOne;
} else {
- glXServerVersion = GLXUtil.getGLXServerVersionNumber(sharedDevice);
+ glXServerVersion = GLXUtil.getGLXServerVersionNumber(device);
}
- final GLContextImpl sharedContext = (GLContextImpl) sharedDrawable.createContext(null);
- if (null == sharedContext) {
- throw new GLException("Couldn't create shared context for drawable: "+sharedDrawable);
+ context = (GLContextImpl) drawable.createContext(null);
+ if (null == context) {
+ throw new GLException("Couldn't create shared context for drawable: "+drawable);
}
+ contextIsCurrent = GLContext.CONTEXT_NOT_CURRENT != context.makeCurrent();
- boolean madeCurrent = false;
- sharedContext.makeCurrent();
- try {
- madeCurrent = sharedContext.isCurrent();
- } finally {
- sharedContext.release();
+ final boolean allowsSurfacelessCtx;
+ if( contextIsCurrent && context.getGLVersionNumber().compareTo(GLContext.Version3_0) >= 0 ) {
+ allowsSurfacelessCtx = probeSurfacelessCtx(context, true /* restoreDrawable */);
+ } else {
+ setNoSurfacelessCtxQuirk(context);
+ allowsSurfacelessCtx = false;
}
- if( sharedContext.hasRendererQuirk( GLRendererQuirks.DontCloseX11Display ) ) {
+
+ if( context.hasRendererQuirk( GLRendererQuirks.DontCloseX11Display ) ) {
X11Util.markAllDisplaysUnclosable();
}
- if (DEBUG) {
- System.err.println("SharedDevice: " + sharedDevice);
- System.err.println("SharedScreen: " + sharedScreen);
- System.err.println("SharedContext: " + sharedContext + ", madeCurrent " + madeCurrent);
+ if ( DEBUG_SHAREDCTX ) {
+ System.err.println("SharedDevice: " + device);
+ System.err.println("SharedScreen: " + screen);
+ System.err.println("SharedContext: " + context + ", madeCurrent " + contextIsCurrent);
+ System.err.println(" allowsSurfacelessCtx "+allowsSurfacelessCtx);
System.err.println("GLX Server Vendor: " + glXServerVendorName);
System.err.println("GLX Server Version: " + glXServerVersion + ", forced "+glxForcedOneOne);
System.err.println("GLX Server Multisample: " + glXServerMultisampleAvailable);
@@ -310,26 +319,29 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
System.err.println("GLX Client Version: " + GLXUtil.getClientVersionNumber());
System.err.println("GLX Client Multisample: " + GLXUtil.isClientMultisampleAvailable());
}
- return new SharedResource(sharedDevice, sharedScreen, sharedDrawable, sharedContext,
+ return new SharedResource(device, screen, drawable, context,
glXServerVersion, glXServerVendorName,
glXServerMultisampleAvailable && GLXUtil.isClientMultisampleAvailable());
} catch (final Throwable t) {
- throw new GLException("X11GLXDrawableFactory - Could not initialize shared resources for "+connection, t);
+ throw new GLException("X11GLXDrawableFactory - Could not initialize shared resources for "+adevice, t);
} finally {
- sharedDevice.unlock();
+ if ( contextIsCurrent ) {
+ context.release();
+ }
+ device.unlock();
}
}
@Override
public void releaseSharedResource(final SharedResourceRunner.Resource shared) {
final SharedResource sr = (SharedResource) shared;
- if (DEBUG) {
+ if ( DEBUG_SHAREDCTX ) {
System.err.println("Shutdown Shared:");
System.err.println("Device : " + sr.device);
System.err.println("Screen : " + sr.screen);
System.err.println("Drawable: " + sr.drawable);
System.err.println("CTX : " + sr.context);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
if (null != sr.context) {
@@ -524,6 +536,13 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
@Override
+ public final ProxySurface createSurfacelessImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice,
+ GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) {
+ chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps);
+ return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new GenericUpstreamSurfacelessHook(width, height));
+ }
+
+ @Override
protected final ProxySurface createProxySurfaceImpl(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstream) {
final X11GraphicsDevice device = new X11GraphicsDevice(X11Util.openDisplay(deviceReq.getConnection()), deviceReq.getUnitID(), true /* owner */);
final X11GraphicsScreen screen = new X11GraphicsScreen(device, screenIdx);
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java
index 0e91a6a65..bfe36dbc8 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java
@@ -28,8 +28,10 @@
package jogamp.opengl.x11.glx;
-import jogamp.opengl.*;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+
+import jogamp.opengl.DesktopGLDynamicLibraryBundleInfo;
public final class X11GLXDynamicLibraryBundleInfo extends DesktopGLDynamicLibraryBundleInfo {
protected X11GLXDynamicLibraryBundleInfo() {
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java
index 5f6a6b344..86349b645 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java
@@ -37,17 +37,17 @@ import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.List;
-import javax.media.nativewindow.CapabilitiesImmutable;
-import javax.media.nativewindow.GraphicsConfigurationFactory;
-import javax.media.nativewindow.VisualIDHolder;
-import javax.media.opengl.DefaultGLCapabilitiesChooser;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesChooser;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.GraphicsConfigurationFactory;
+import com.jogamp.nativewindow.VisualIDHolder;
+import com.jogamp.opengl.DefaultGLCapabilitiesChooser;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesChooser;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
import jogamp.nativewindow.x11.X11Lib;
import jogamp.nativewindow.x11.XRenderDirectFormat;
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
index 44479acc0..4dc2d7e0b 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java
@@ -33,22 +33,23 @@
package jogamp.opengl.x11.glx;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.CapabilitiesChooser;
-import javax.media.nativewindow.CapabilitiesImmutable;
-import javax.media.nativewindow.GraphicsConfigurationFactory;
-import javax.media.nativewindow.VisualIDHolder;
-import javax.media.nativewindow.VisualIDHolder.VIDType;
-import javax.media.opengl.DefaultGLCapabilitiesChooser;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesChooser;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
-
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.CapabilitiesChooser;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.GraphicsConfigurationFactory;
+import com.jogamp.nativewindow.VisualIDHolder;
+import com.jogamp.nativewindow.VisualIDHolder.VIDType;
+import com.jogamp.opengl.DefaultGLCapabilitiesChooser;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesChooser;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
+
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.nio.PointerBuffer;
import com.jogamp.nativewindow.x11.X11GraphicsDevice;
@@ -375,7 +376,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
if ( 0 > chosenIndex ) {
if (DEBUG) {
System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationFBConfig: failed, return null");
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return null;
}
@@ -472,7 +473,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF
if ( 0 > chosenIndex ) {
if (DEBUG) {
System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationXVisual: failed, return null");
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return null;
}
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java
index 866662950..670f6c246 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java
@@ -40,10 +40,10 @@
package jogamp.opengl.x11.glx;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
public class X11OnscreenGLXDrawable extends X11GLXDrawable {
/** GLXWindow can't be made current on AWT with NVidia driver, hence disabled for now */
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java
index 21ad06020..b961c97a2 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java
@@ -42,13 +42,13 @@ package jogamp.opengl.x11.glx;
import java.nio.IntBuffer;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.MutableSurface;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.MutableSurface;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
import com.jogamp.common.nio.Buffers;
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java
index e217e1c2a..17e2cb219 100644
--- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java
@@ -40,13 +40,13 @@
package jogamp.opengl.x11.glx;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.MutableSurface;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.MutableSurface;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
import jogamp.nativewindow.x11.X11Lib;
import jogamp.nativewindow.x11.XVisualInfo;
diff --git a/src/jogl/native/EGLContext.c b/src/jogl/native/EGLContext.c
new file mode 100644
index 000000000..7bf60b850
--- /dev/null
+++ b/src/jogl/native/EGLContext.c
@@ -0,0 +1,39 @@
+#include <jni.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <assert.h>
+
+#include <stdio.h> /* android */
+#include <gluegen_stdint.h>
+#include <gluegen_stddef.h>
+#include <EGL/egl.h>
+
+/* Java->C glue code:
+ * Java package: jogamp.opengl.egl.EGLContext
+ * Java method: long dispatch_eglGetProcAddress(java.lang.String procname)
+ * C function: __EGLFuncPtr eglGetProcAddress(const char * procname)
+ */
+JNIEXPORT jlong JNICALL
+Java_jogamp_opengl_egl_EGLContext_dispatch_1eglGetProcAddress0__Ljava_lang_String_2J(JNIEnv *env, jclass _unused, jstring procname, jlong procAddress) {
+ typedef __EGLFuncPtr (EGLAPIENTRY*_local_PFNEGLGETPROCADDRESSPROC)(const char * procname);
+ _local_PFNEGLGETPROCADDRESSPROC ptr_eglGetProcAddress;
+ const char* _strchars_procname = NULL;
+ __EGLFuncPtr _res;
+ if ( NULL != procname ) {
+ _strchars_procname = (*env)->GetStringUTFChars(env, procname, (jboolean*)NULL);
+ if ( NULL == _strchars_procname ) {
+ (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/OutOfMemoryError"),
+ "Failed to get UTF-8 chars for argument \"procname\" in native dispatcher for \"dispatch_eglGetProcAddress\"");
+ return 0;
+ }
+ }
+ ptr_eglGetProcAddress = (_local_PFNEGLGETPROCADDRESSPROC) (intptr_t) procAddress;
+ assert(ptr_eglGetProcAddress != NULL);
+ _res = (* ptr_eglGetProcAddress) ((const char *) _strchars_procname);
+ if ( NULL != procname ) {
+ (*env)->ReleaseStringUTFChars(env, procname, _strchars_procname);
+ }
+ return (jlong) (intptr_t) _res;
+}
+
diff --git a/src/jogl/native/libav/ffmpeg_impl_template.c b/src/jogl/native/libav/ffmpeg_impl_template.c
index 3077070db..ca283ef52 100644
--- a/src/jogl/native/libav/ffmpeg_impl_template.c
+++ b/src/jogl/native/libav/ffmpeg_impl_template.c
@@ -535,7 +535,8 @@ JNIEXPORT jint JNICALL FF_FUNC(getSwResampleMajorVersionCC0)
}
JNIEXPORT jlong JNICALL FF_FUNC(createInstance0)
- (JNIEnv *env, jobject instance, jobject ffmpegMediaPlayer, jboolean verbose)
+ (JNIEnv *env, jobject instance, jobject ffmpegMediaPlayer,
+ jboolean enableAvResample, jboolean enableSwResample, jboolean verbose)
{
FFMPEGToolBasicAV_t * pAV = calloc(1, sizeof(FFMPEGToolBasicAV_t));
if(NULL==pAV) {
@@ -545,12 +546,12 @@ JNIEXPORT jlong JNICALL FF_FUNC(createInstance0)
pAV->avcodecVersion = sp_avcodec_version();
pAV->avformatVersion = sp_avformat_version();
pAV->avutilVersion = sp_avutil_version();
- if(HAS_FUNC(sp_avresample_version)) {
+ if(HAS_FUNC(sp_avresample_version) && enableAvResample) {
pAV->avresampleVersion = sp_avresample_version();
} else {
pAV->avresampleVersion = 0;
}
- if(HAS_FUNC(sp_swresample_version)) {
+ if(HAS_FUNC(sp_swresample_version) && enableSwResample) {
pAV->swresampleVersion = sp_swresample_version();
} else {
pAV->swresampleVersion = 0;
diff --git a/src/jogl/native/libav/ffmpeg_lavc56_lavf56_lavu54_lavr02.c b/src/jogl/native/libav/ffmpeg_lavc56_lavf56_lavu54_lavr02.c
new file mode 100644
index 000000000..d1657d0c6
--- /dev/null
+++ b/src/jogl/native/libav/ffmpeg_lavc56_lavf56_lavu54_lavr02.c
@@ -0,0 +1,33 @@
+/**
+ * Copyright 2013 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+#include "jogamp_opengl_util_av_impl_FFMPEGv11Natives.h"
+
+#define FF_FUNC(METHOD) Java_jogamp_opengl_util_av_impl_FFMPEGv11Natives_ ## METHOD
+
+#include "ffmpeg_impl_template.c"