From 556d92b63555a085b25e32b1cd55afce24edd07a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 3 Jul 2014 16:21:36 +0200 Subject: Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) - Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines --- .../jogamp/opengl/test/android/LauncherUtil.java | 188 +++++++-------- .../opengl/test/android/MovieCubeActivity0a.java | 18 +- .../opengl/test/android/MovieCubeActivity0b.java | 18 +- .../opengl/test/android/MovieSimpleActivity0.java | 16 +- .../opengl/test/android/MovieSimpleActivity1.java | 26 +-- .../opengl/test/android/NEWTElektronActivity.java | 32 +-- .../test/android/NEWTElektronActivityLauncher.java | 14 +- .../opengl/test/android/NEWTGearsES1Activity.java | 32 +-- .../test/android/NEWTGearsES1ActivityLauncher.java | 14 +- .../opengl/test/android/NEWTGearsES2Activity.java | 20 +- .../test/android/NEWTGearsES2ActivityLauncher.java | 24 +- .../android/NEWTGearsES2ECTActivityLauncher.java | 26 +-- .../NEWTGearsES2RGB565ActivityLauncher.java | 24 +- .../test/android/NEWTGearsES2TransActivity.java | 14 +- .../android/NEWTGearsES2TransActivityLauncher.java | 20 +- .../opengl/test/android/NEWTGraphUI1pActivity.java | 32 +-- .../android/NEWTGraphUI1pActivityLauncher.java | 16 +- .../opengl/test/android/NEWTGraphUI2pActivity.java | 12 +- .../android/NEWTGraphUI2pActivityLauncher.java | 16 +- .../test/android/NEWTRedSquareES1Activity.java | 32 +-- .../android/NEWTRedSquareES1ActivityLauncher.java | 16 +- .../test/android/NEWTRedSquareES2Activity.java | 42 ++-- .../android/NEWTRedSquareES2ActivityLauncher.java | 10 +- .../opengl/test/bugs/Bug427GLJPanelTest1.java | 33 +-- .../opengl/test/bugs/Bug735Inv0AppletAWT.java | 246 ++++++++++---------- .../opengl/test/bugs/Bug735Inv1AppletAWT.java | 250 ++++++++++---------- .../opengl/test/bugs/Bug735Inv2AppletAWT.java | 128 +++++------ .../opengl/test/bugs/Bug735Inv3AppletAWT.java | 90 ++++---- .../com/jogamp/opengl/test/bugs/Bug735Inv4AWT.java | 78 +++---- .../DemoBug910ExtendedAWTAppletLifecycleCheck.java | 18 +- .../com/jogamp/opengl/test/bugs/Issue326Test1.java | 48 ++-- .../com/jogamp/opengl/test/bugs/Issue326Test2.java | 37 +-- .../com/jogamp/opengl/test/bugs/Issue344Base.java | 47 ++-- .../com/jogamp/opengl/test/bugs/Issue344Test1.java | 4 +- .../com/jogamp/opengl/test/bugs/Issue344Test2.java | 2 +- .../com/jogamp/opengl/test/bugs/Issue344Test3.java | 2 +- .../com/jogamp/opengl/test/bugs/Issue344Test4.java | 2 +- .../test/junit/graph/TestRegionRendererNEWT01.java | 94 ++++---- .../test/junit/graph/TestTextRendererNEWT00.java | 38 +-- .../test/junit/graph/TestTextRendererNEWT01.java | 56 ++--- .../test/junit/graph/TestTextRendererNEWT10.java | 16 +- .../test/junit/graph/TextRendererGLELBase.java | 54 ++--- .../junit/graph/demos/GPURegionGLListener01.java | 14 +- .../junit/graph/demos/GPURegionGLListener02.java | 14 +- .../test/junit/graph/demos/GPURegionNewtDemo.java | 14 +- .../graph/demos/GPURendererListenerBase01.java | 48 ++-- .../junit/graph/demos/GPUTextGLListener0A.java | 13 +- .../test/junit/graph/demos/GPUTextNewtDemo.java | 14 +- .../graph/demos/GPUTextRendererListenerBase01.java | 42 ++-- .../junit/graph/demos/GPUUISceneGLListener0A.java | 108 ++++----- .../graph/demos/GPUUISceneNewtCanvasAWTDemo.java | 12 +- .../test/junit/graph/demos/GPUUISceneNewtDemo.java | 8 +- .../opengl/test/junit/graph/demos/MSAATool.java | 40 ++-- .../test/junit/graph/demos/ui/CrossHair.java | 10 +- .../graph/demos/ui/GLEventListenerButton.java | 4 +- .../test/junit/graph/demos/ui/ImageSeqButton.java | 2 +- .../opengl/test/junit/graph/demos/ui/Label.java | 16 +- .../opengl/test/junit/graph/demos/ui/Label0.java | 10 +- .../test/junit/graph/demos/ui/LabelButton.java | 13 +- .../junit/graph/demos/ui/MediaPlayerButton.java | 10 +- .../test/junit/graph/demos/ui/RoundButton.java | 8 +- .../junit/graph/demos/ui/SceneUIController.java | 36 +-- .../junit/graph/demos/ui/TextureSeqButton.java | 2 +- .../test/junit/graph/demos/ui/UIGLListener01.java | 18 +- .../junit/graph/demos/ui/UIListenerBase01.java | 62 ++--- .../test/junit/graph/demos/ui/UINewtDemo01.java | 14 +- .../opengl/test/junit/graph/demos/ui/UIShape.java | 36 +-- .../test/junit/jogl/acore/GLReadBuffer00Base.java | 4 +- .../junit/jogl/acore/InitConcurrentBaseNEWT.java | 28 +-- .../jogl/acore/TestAWTCloseX11DisplayBug565.java | 20 +- .../acore/TestAddRemove01GLCanvasSwingAWT.java | 17 +- .../TestAddRemove02GLWindowNewtCanvasAWT.java | 91 ++++---- .../jogl/acore/TestAddRemove03GLWindowNEWT.java | 40 ++-- .../acore/TestBug669RecursiveGLContext01NEWT.java | 50 ++-- .../acore/TestBug669RecursiveGLContext02NEWT.java | 38 +-- .../junit/jogl/acore/TestBug692GL3VAONEWT.java | 124 +++++----- .../junit/jogl/acore/TestCPUSourcingAPINEWT.java | 39 ++-- .../jogl/acore/TestFBOAutoDrawableDeadlockAWT.java | 10 +- .../jogl/acore/TestFBOAutoDrawableFactoryNEWT.java | 16 +- .../test/junit/jogl/acore/TestFBOMRTNEWT01.java | 93 ++++---- .../junit/jogl/acore/TestFBOMix2DemosES2NEWT.java | 88 +++---- ...tFBOOffThreadSharedContextMix2DemosES2NEWT.java | 32 +-- .../TestFBOOnThreadSharedContext1DemoES2NEWT.java | 32 +-- .../jogl/acore/TestGLAutoDrawableDelegateNEWT.java | 15 +- ...estGLAutoDrawableDelegateOnOffscrnCapsNEWT.java | 12 +- ...estGLAutoDrawableFactoryES2OffscrnCapsNEWT.java | 6 +- ...estGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java | 6 +- ...TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java | 4 +- ...TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java | 16 +- ...estGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java | 8 +- ...LAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java | 16 +- .../jogl/acore/TestGLContextSurfaceLockNEWT.java | 96 ++++---- .../test/junit/jogl/acore/TestGLDebug00NEWT.java | 169 +++++++------- .../test/junit/jogl/acore/TestGLDebug01NEWT.java | 121 +++++----- .../jogl/acore/TestGLExtensionQueryOffscreen.java | 16 +- .../junit/jogl/acore/TestGLMesaBug651NEWT.java | 97 ++++---- .../junit/jogl/acore/TestGLMesaBug658NEWT.java | 42 ++-- .../test/junit/jogl/acore/TestGLPointsNEWT.java | 64 +++--- .../test/junit/jogl/acore/TestGLProfile00NEWT.java | 8 +- .../test/junit/jogl/acore/TestGLProfile01NEWT.java | 38 +-- .../jogl/acore/TestGLReadBuffer01GLCanvasAWT.java | 30 +-- .../jogl/acore/TestGLReadBuffer01GLJPanelAWT.java | 30 +-- .../jogl/acore/TestGLReadBuffer01GLWindowNEWT.java | 26 +-- .../jogl/acore/TestGLVersionParsing00NEWT.java | 42 ++-- .../test/junit/jogl/acore/TestGPUMemSec01NEWT.java | 62 ++--- .../junit/jogl/acore/TestInitConcurrent01NEWT.java | 6 +- .../junit/jogl/acore/TestInitConcurrent02NEWT.java | 26 +-- .../jogl/acore/TestMainVersionGLCanvasAWT.java | 14 +- .../jogl/acore/TestMainVersionGLWindowNEWT.java | 16 +- .../junit/jogl/acore/TestMapBufferRead01NEWT.java | 16 +- .../jogl/acore/TestNEWTCloseX11DisplayBug565.java | 20 +- .../test/junit/jogl/acore/TestNVSwapGroupNEWT.java | 54 ++--- .../acore/TestOffscreenLayer01GLCanvasAWT.java | 78 +++---- .../acore/TestOffscreenLayer02NewtCanvasAWT.java | 72 +++--- .../junit/jogl/acore/TestPBufferDeadlockAWT.java | 30 +-- .../junit/jogl/acore/TestSharedContextListAWT.java | 16 +- .../jogl/acore/TestSharedContextListNEWT.java | 20 +- .../jogl/acore/TestSharedContextListNEWT2.java | 36 +-- .../jogl/acore/TestSharedContextNewtAWTBug523.java | 175 +++++++------- .../jogl/acore/TestSharedContextVBOES1NEWT.java | 22 +- .../jogl/acore/TestSharedContextVBOES2AWT3.java | 22 +- .../jogl/acore/TestSharedContextVBOES2AWT3b.java | 14 +- .../jogl/acore/TestSharedContextVBOES2NEWT0.java | 18 +- .../jogl/acore/TestSharedContextVBOES2NEWT1.java | 54 ++--- .../jogl/acore/TestSharedContextVBOES2NEWT2.java | 24 +- .../jogl/acore/TestSharedContextVBOES2NEWT3.java | 44 ++-- .../jogl/acore/TestSharedContextVBOES2SWT3.java | 12 +- .../acore/TestSharedContextWithJTabbedPaneAWT.java | 55 ++--- .../junit/jogl/acore/TestShutdownCompleteAWT.java | 8 +- .../junit/jogl/acore/TestShutdownCompleteNEWT.java | 14 +- .../junit/jogl/acore/TestVersionSemanticsNOUI.java | 4 +- .../junit/jogl/acore/TestX11DefaultDisplay.java | 42 ++-- .../jogl/acore/anim/Bug898AnimatorFromEDTAWT.java | 20 +- .../TestAWTCardLayoutAnimatorStartStopBug532.java | 13 +- .../jogl/acore/anim/TestAnimatorGLJPanel01AWT.java | 26 +-- .../acore/anim/TestAnimatorGLWindow01NEWT.java | 22 +- .../jogl/acore/ect/ExclusiveContextBase00.java | 6 +- .../jogl/acore/ect/ExclusiveContextBase00AWT.java | 70 +++--- .../jogl/acore/ect/ExclusiveContextBase00NEWT.java | 38 +-- .../jogl/acore/ect/ExclusiveContextBase10.java | 6 +- .../jogl/acore/ect/ExclusiveContextBase10AWT.java | 70 +++--- .../jogl/acore/ect/ExclusiveContextBase10NEWT.java | 38 +-- .../ect/TestExclusiveContext01VSyncAnimAWT.java | 20 +- .../ect/TestExclusiveContext01VSyncAnimNEWT.java | 16 +- .../ect/TestExclusiveContext02FPSAnimAWT.java | 20 +- .../ect/TestExclusiveContext02FPSAnimNEWT.java | 20 +- .../ect/TestExclusiveContext11VSyncAnimNEWT.java | 16 +- .../ect/TestExclusiveContext12FPSAnimNEWT.java | 20 +- .../acore/glels/GLContextDrawableSwitchBase.java | 18 +- .../TestBug722GLContextDrawableSwitchNewt2AWT.java | 58 ++--- .../glels/TestGLContextDrawableSwitch01NEWT.java | 156 ++++++------- .../glels/TestGLContextDrawableSwitch02AWT.java | 26 +-- .../glels/TestGLContextDrawableSwitch10NEWT.java | 96 ++++---- .../TestGLContextDrawableSwitch11NewtAWT.java | 48 ++-- .../glels/TestGLContextDrawableSwitch12AWT.java | 52 ++--- .../TestGLContextDrawableSwitch21Newt2AWT.java | 66 +++--- .../jogl/awt/ManualHiDPIBufferedImage01AWT.java | 10 +- .../opengl/test/junit/jogl/awt/TestAWT01GLn.java | 42 ++-- .../junit/jogl/awt/TestAWT02WindowClosing.java | 28 +-- .../jogl/awt/TestAWT03GLCanvasRecreate01.java | 22 +- .../junit/jogl/awt/TestBug460GLCanvasNPEAWT.java | 20 +- .../awt/TestBug461FBOSupersamplingSwingAWT.java | 32 +-- .../TestBug461PBufferSupersamplingSwingAWT.java | 64 +++--- .../opengl/test/junit/jogl/awt/TestBug551AWT.java | 38 +-- .../opengl/test/junit/jogl/awt/TestBug572AWT.java | 8 +- .../opengl/test/junit/jogl/awt/TestBug611AWT.java | 24 +- .../jogl/awt/TestBug642JSplitPaneMixHwLw01AWT.java | 78 +++---- .../awt/TestBug664GLCanvasSetVisibleSwingAWT.java | 25 +- .../jogl/awt/TestBug675BeansInDesignTimeAWT.java | 2 +- .../TestBug816GLCanvasFrameHoppingB849B889AWT.java | 18 +- ...estBug816JTabbedPanelVisibilityB849B878AWT.java | 12 +- .../jogl/awt/TestBug816OSXCALayerPos01AWT.java | 26 +-- .../jogl/awt/TestBug816OSXCALayerPos02AWT.java | 8 +- .../awt/TestBug816OSXCALayerPos03aB729AWT.java | 4 +- .../awt/TestBug816OSXCALayerPos03bB849AWT.java | 4 +- .../awt/TestBug816OSXCALayerPos03cB849AWT.java | 4 +- .../jogl/awt/TestBug816OSXCALayerPos04aAWT.java | 2 +- .../jogl/awt/TestBug816OSXCALayerPos04bAWT.java | 2 +- .../awt/TestGLCanvasAWTActionDeadlock00AWT.java | 98 ++++---- .../awt/TestGLCanvasAWTActionDeadlock01AWT.java | 130 +++++------ .../awt/TestGLCanvasAWTActionDeadlock02AWT.java | 78 +++---- .../junit/jogl/awt/TestGLJPanelResize01AWT.java | 10 +- .../jogl/awt/TestGLJPanelTextureStateAWT.java | 24 +- .../jogl/awt/TestIsRealizedConcurrency01AWT.java | 26 +-- .../jogl/awt/TestJScrollPaneMixHwLw01AWT.java | 72 +++--- .../test/junit/jogl/awt/TestSwingAWT01GLn.java | 28 +-- .../TestAWTTextRendererUseVertexArrayBug464.java | 58 ++--- .../awt/text/TextRendererGLEventListener01.java | 50 ++-- .../jogl/awt/text/TextRendererTraceGL2Mock01.java | 46 ++-- .../test/junit/jogl/caps/MultisampleChooser01.java | 10 +- .../junit/jogl/caps/TestBug605FlippedImageAWT.java | 27 +-- .../jogl/caps/TestBug605FlippedImageNEWT.java | 25 +- .../junit/jogl/caps/TestMultisampleES1AWT.java | 20 +- .../junit/jogl/caps/TestMultisampleES1NEWT.java | 36 +-- .../junit/jogl/caps/TestMultisampleES2NEWT.java | 36 +-- .../test/junit/jogl/caps/TestTranslucencyAWT.java | 44 ++-- .../test/junit/jogl/caps/TestTranslucencyNEWT.java | 40 ++-- .../opengl/test/junit/jogl/demos/GearsObject.java | 30 +-- .../opengl/test/junit/jogl/demos/PointsDemo.java | 12 +- .../junit/jogl/demos/TextureDraw01Accessor.java | 12 +- .../opengl/test/junit/jogl/demos/es1/GearsES1.java | 76 +++--- .../test/junit/jogl/demos/es1/GearsObjectES1.java | 21 +- .../junit/jogl/demos/es1/MultisampleDemoES1.java | 33 +-- .../test/junit/jogl/demos/es1/OlympicES1.java | 64 +++--- .../test/junit/jogl/demos/es1/OneTriangle.java | 27 +-- .../test/junit/jogl/demos/es1/PointsDemoES1.java | 74 +++--- .../test/junit/jogl/demos/es1/RedSquareES1.java | 42 ++-- .../jogl/demos/es1/newt/TestGearsES1NEWT.java | 32 +-- .../jogl/demos/es1/newt/TestOlympicES1NEWT.java | 40 ++-- .../jogl/demos/es1/newt/TestRedSquareES1NEWT.java | 30 +-- .../jogl/demos/es2/ElektronenMultiplizierer.java | 211 ++++++++--------- .../test/junit/jogl/demos/es2/FBOMix2DemosES2.java | 2 +- .../opengl/test/junit/jogl/demos/es2/GearsES2.java | 9 +- .../test/junit/jogl/demos/es2/GearsObjectES2.java | 28 +-- .../test/junit/jogl/demos/es2/LandscapeES2.java | 2 +- .../junit/jogl/demos/es2/MultisampleDemoES2.java | 56 ++--- .../test/junit/jogl/demos/es2/PointsDemoES2.java | 35 +-- .../test/junit/jogl/demos/es2/RedSquareES2.java | 47 ++-- .../junit/jogl/demos/es2/RedSquareMappedES2.java | 47 ++-- .../jogl/demos/es2/TextureDraw01ES2Listener.java | 38 +-- .../demos/es2/TextureDraw02ES2ListenerFBO.java | 2 +- .../jogl/demos/es2/TextureSequenceCubeES2.java | 58 ++--- .../junit/jogl/demos/es2/av/CrossFadePlayer.java | 38 +-- .../test/junit/jogl/demos/es2/av/MovieCube.java | 44 ++-- .../test/junit/jogl/demos/es2/av/MovieSimple.java | 104 ++++----- .../jogl/demos/es2/awt/Bug816AppletGLCanvas01.java | 38 +-- .../demos/es2/awt/Bug816AppletGLCanvas02a.java | 12 +- .../demos/es2/awt/Bug816AppletGLCanvas02b.java | 12 +- .../es2/awt/Bug816AppletOSXCALayerPos03a.java | 26 +-- .../es2/awt/Bug816AppletOSXCALayerPos03b.java | 26 +-- .../jogl/demos/es2/awt/Bug848AppletGLCanvas01.java | 8 +- .../junit/jogl/demos/es2/awt/TestGearsES2AWT.java | 26 +-- .../demos/es2/awt/TestGearsES2GLJPanelAWT.java | 26 +-- .../demos/es2/awt/TestGearsES2GLJPanelsAWT.java | 96 ++++---- .../es2/newt/TestElektronenMultipliziererNEWT.java | 36 +-- .../jogl/demos/es2/newt/TestGearsES2NEWT.java | 45 ++-- .../demos/es2/newt/TestGearsES2NewtCanvasAWT.java | 35 +-- .../demos/es2/newt/TestGearsES2NewtCanvasSWT.java | 24 +- .../jogl/demos/es2/newt/TestLandscapeES2NEWT.java | 39 ++-- .../es2/newt/TestLandscapeES2NewtCanvasAWT.java | 69 +++--- .../jogl/demos/es2/newt/TestRedSquareES2NEWT.java | 10 +- .../jogl/demos/es2/shader/RedSquareShader.java | 4 +- .../junit/jogl/demos/es2/swt/TestGearsES2SWT.java | 14 +- .../opengl/test/junit/jogl/demos/gl2/Gears.java | 127 ++++++----- .../opengl/test/junit/jogl/demos/gl2/Teapot.java | 38 +-- .../jogl/demos/gl2/TextureDraw01GL2Listener.java | 52 +++-- .../jogl/demos/gl2/awt/Bug818GLJPanelApplet.java | 138 +++++------ .../jogl/demos/gl2/awt/TestGLJPanelAWTBug450.java | 47 ++-- .../junit/jogl/demos/gl2/awt/TestGearsAWT.java | 16 +- .../demos/gl2/awt/TestGearsAWTAnalyzeBug455.java | 26 +-- .../jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java | 18 +- .../junit/jogl/demos/gl2/newt/TestGearsNEWT.java | 28 +-- .../demos/gl2/newt/TestGearsNewtAWTWrapper.java | 18 +- .../junit/jogl/demos/gl2/newt/TestTeapotNEWT.java | 24 +- .../jogl/demos/gl3/GeomShader01TextureGL3.java | 24 +- .../gl3/newt/TestGeomShader01TextureGL3NEWT.java | 50 ++-- .../test/junit/jogl/glsl/GLSLMiscHelper.java | 58 ++--- .../junit/jogl/glsl/TestGLSLShaderState01NEWT.java | 254 +++++++++++---------- .../junit/jogl/glsl/TestGLSLShaderState02NEWT.java | 164 ++++++------- .../test/junit/jogl/glsl/TestGLSLSimple01NEWT.java | 30 +-- .../test/junit/jogl/glsl/TestRulerNEWT01.java | 19 +- .../jogl/glsl/TestShaderCompilationBug459AWT.java | 79 ++++--- .../TestTransformFeedbackVaryingsBug407NEWT.java | 69 +++--- .../jogl/glu/TestBug365TextureGenerateMipMaps.java | 146 ++++++------ .../jogl/glu/TestBug463ScaleImageMemoryAWT.java | 70 +++--- .../TestBug694ScaleImageUnpackBufferSizeAWT.java | 24 +- .../test/junit/jogl/math/TestBinary16NOUI.java | 2 +- .../test/junit/jogl/math/TestFloatUtil01NOUI.java | 16 +- .../math/TestFloatUtil02MatrixMatrixMultNOUI.java | 18 +- .../jogl/math/TestFloatUtil03InversionNOUI.java | 12 +- .../jogl/math/TestGluUnprojectDoubleNOUI.java | 16 +- .../junit/jogl/math/TestGluUnprojectFloatNOUI.java | 82 +++---- .../test/junit/jogl/math/TestPMVMatrix01NEWT.java | 32 +-- .../test/junit/jogl/math/TestPMVMatrix02NOUI.java | 20 +- .../test/junit/jogl/math/TestPMVMatrix03NOUI.java | 20 +- .../test/junit/jogl/math/TestQuaternion01NOUI.java | 8 +- ...TestSwingAWTRobotUsageBeforeJOGLInitBug411.java | 50 ++-- .../test/junit/jogl/offscreen/ReadBuffer2File.java | 20 +- .../junit/jogl/offscreen/ReadBuffer2Screen.java | 56 ++--- .../test/junit/jogl/offscreen/ReadBufferBase.java | 24 +- .../test/junit/jogl/offscreen/Surface2File.java | 30 +-- .../offscreen/TestOffscreen01GLPBufferNEWT.java | 78 ++++--- .../jogl/offscreen/TestOffscreen02BitmapNEWT.java | 58 ++--- .../test/junit/jogl/offscreen/WindowUtilNEWT.java | 28 +-- .../jogl/perf/TestPerf001GLJPanelInit01AWT.java | 30 +-- .../jogl/perf/TestPerf001GLJPanelInit02AWT.java | 32 +-- .../jogl/perf/TestPerf001GLWindowInit03NEWT.java | 18 +- .../junit/jogl/perf/TestPerf001RawInit00NEWT.java | 2 +- .../test/junit/jogl/stereo/ovr/OVRDemo01.java | 3 +- .../jogl/swt/TestBug672NewtCanvasSWTSashForm.java | 25 +- .../TestBug672NewtCanvasSWTSashFormComposite.java | 25 +- .../TestNewtCanvasSWTBug628ResizeDeadlockAWT.java | 55 ++--- .../test/junit/jogl/swt/TestNewtCanvasSWTGLn.java | 20 +- .../junit/jogl/swt/TestSWTAccessor03AWTGLn.java | 60 ++--- .../junit/jogl/swt/TestSWTBug643AsyncExec.java | 20 +- .../jogl/swt/TestSWTEclipseGLCanvas01GLn.java | 48 ++-- .../junit/jogl/swt/TestSWTJOGLGLCanvas01GLn.java | 20 +- .../test/junit/jogl/tile/OffscreenPrintable.java | 64 +++--- .../test/junit/jogl/tile/OnscreenPrintable.java | 60 ++--- .../opengl/test/junit/jogl/tile/PrintableBase.java | 22 +- .../tile/TestRandomTiledRendering2GL2NEWT.java | 20 +- .../jogl/tile/TestRandomTiledRendering3GL2AWT.java | 30 +-- .../junit/jogl/tile/TestTiledPrintingGearsAWT.java | 30 +-- .../jogl/tile/TestTiledPrintingGearsNewtAWT.java | 30 +-- .../jogl/tile/TestTiledPrintingGearsSwingAWT.java | 36 +-- .../jogl/tile/TestTiledPrintingGearsSwingAWT2.java | 46 ++-- .../tile/TestTiledPrintingNIOImageSwingAWT.java | 74 +++--- .../jogl/tile/TestTiledRendering1GL2NEWT.java | 106 ++++----- .../junit/jogl/tile/TestTiledRendering2NEWT.java | 40 ++-- .../test/junit/jogl/tile/TiledPrintingAWTBase.java | 84 +++---- .../test/junit/jogl/tile/TransparentPanel.java | 14 +- .../junit/jogl/util/DemoGL2ES1ImmModeSink.java | 41 ++-- .../test/junit/jogl/util/DemoGL2ES1Plain.java | 81 +++---- .../jogl/util/DemoGL2ES1TextureImmModeSink.java | 33 +-- .../junit/jogl/util/DemoGL2ES2ImmModeSink.java | 60 ++--- .../util/TestES1FixedFunctionPipelineNEWT.java | 22 +- .../junit/jogl/util/TestImmModeSinkES1NEWT.java | 46 ++-- .../junit/jogl/util/TestImmModeSinkES2NEWT.java | 40 ++-- .../texture/TestBug362DDSImageCreateFromData.java | 48 ++-- ...7GLReadBufferUtilGLCTXDefFormatTypeES2NEWT.java | 30 +-- .../TestGLReadBufferUtilTextureIOWrite01AWT.java | 46 ++-- .../TestGLReadBufferUtilTextureIOWrite01NEWT.java | 44 ++-- .../TestGLReadBufferUtilTextureIOWrite02AWT.java | 48 ++-- .../TestGLReadBufferUtilTextureIOWrite02NEWT.java | 40 ++-- .../jogl/util/texture/TestJPEGImage01NEWT.java | 50 ++-- .../texture/TestJPEGJoglAWTBenchmarkNewtAWT.java | 26 +-- .../texture/TestJPEGJoglAWTCompareNewtAWT.java | 144 ++++++------ .../util/texture/TestJPEGTextureFromFileNEWT.java | 142 ++++++------ .../jogl/util/texture/TestPNGPixelRect00NEWT.java | 6 +- .../jogl/util/texture/TestPNGPixelRect01NEWT.java | 14 +- .../util/texture/TestPNGTextureFromFileAWT.java | 22 +- .../util/texture/TestPNGTextureFromFileNEWT.java | 130 +++++------ .../util/texture/TestPixelFormatUtil00NEWT.java | 6 +- .../util/texture/TestPixelFormatUtil01NEWT.java | 4 +- .../util/texture/TestTGATextureFromFileNEWT.java | 64 +++--- .../junit/jogl/util/texture/TestTexture01AWT.java | 58 ++--- .../junit/jogl/util/texture/TestTexture02AWT.java | 46 ++-- .../util/texture/TestTextureSequence01AWT.java | 16 +- .../util/texture/TestTextureSequence01NEWT.java | 14 +- .../newt/DemoCreateAndDisposeOnCloseNEWT.java | 18 +- .../opengl/test/junit/newt/TestCloseNewtAWT.java | 25 +- .../junit/newt/TestDisplayLifecycle01NEWT.java | 24 +- .../junit/newt/TestDisplayLifecycle02NEWT.java | 30 +-- .../test/junit/newt/TestEventSourceNotAWTBug.java | 16 +- .../newt/TestGLWindowInvisiblePointer01NEWT.java | 30 +-- .../junit/newt/TestGLWindowWarpPointer01NEWT.java | 70 +++--- .../test/junit/newt/TestGLWindows00NEWT.java | 34 +-- .../test/junit/newt/TestGLWindows01NEWT.java | 102 ++++----- .../junit/newt/TestGLWindows02NEWTAnimated.java | 60 ++--- .../junit/newt/TestGLWindows03NEWTAnimResize.java | 14 +- .../test/junit/newt/TestListenerCom01AWT.java | 38 +-- .../test/junit/newt/TestRemoteGLWindows01NEWT.java | 46 ++-- .../test/junit/newt/TestRemoteWindow01NEWT.java | 42 ++-- .../junit/newt/TestWindowClosingProtocol01AWT.java | 37 ++- .../newt/TestWindowClosingProtocol02NEWT.java | 18 +- .../newt/TestWindowClosingProtocol03NewtAWT.java | 42 ++-- .../opengl/test/junit/newt/TestWindows01NEWT.java | 42 ++-- .../opengl/test/junit/newt/WindowEventCom1.java | 14 +- .../opengl/test/junit/newt/WindowEventCom2.java | 18 +- .../opengl/test/junit/newt/WindowEventCom3.java | 18 +- .../junit/newt/event/BaseNewtEventModifiers.java | 72 +++--- .../event/TestNewtEventModifiersAWTCanvas.java | 4 +- .../event/TestNewtEventModifiersNEWTWindowAWT.java | 18 +- .../event/TestNewtEventModifiersNewtCanvasAWT.java | 26 +-- .../TestNewtEventModifiersNewtCanvasSWTAWT.java | 42 ++-- .../newt/event/TestNewtKeyCodeModifiersAWT.java | 126 +++++----- .../test/junit/newt/event/TestNewtKeyCodesAWT.java | 30 +-- .../newt/event/TestNewtKeyEventAutoRepeatAWT.java | 28 +-- .../junit/newt/event/TestNewtKeyEventOrderAWT.java | 92 ++++---- .../TestNewtKeyPressReleaseUnmaskRepeatAWT.java | 82 +++---- .../event/TestParentingFocus01SwingAWTRobot.java | 36 +-- .../event/TestParentingFocus02SwingAWTRobot.java | 57 ++--- .../event/TestParentingFocus03KeyTraversalAWT.java | 42 ++-- .../junit/newt/mm/ManualScreenMode03aNEWT.java | 34 +-- .../test/junit/newt/mm/TestScreenMode00aNEWT.java | 32 +-- .../test/junit/newt/mm/TestScreenMode00bNEWT.java | 50 ++-- .../test/junit/newt/mm/TestScreenMode00cNEWT.java | 18 +- .../test/junit/newt/mm/TestScreenMode01aNEWT.java | 20 +- .../test/junit/newt/mm/TestScreenMode01bNEWT.java | 26 +-- .../test/junit/newt/mm/TestScreenMode01cNEWT.java | 24 +- .../test/junit/newt/mm/TestScreenMode01dNEWT.java | 50 ++-- .../test/junit/newt/mm/TestScreenMode02aNEWT.java | 76 +++--- .../test/junit/newt/mm/TestScreenMode02bNEWT.java | 78 +++---- .../test/junit/newt/parenting/GLRunnableDummy.java | 14 +- .../test/junit/newt/parenting/KeyAction.java | 18 +- .../parenting/NewtAWTReparentingKeyAdapter.java | 14 +- .../junit/newt/parenting/TestParenting01NEWT.java | 50 ++-- .../junit/newt/parenting/TestParenting01aAWT.java | 40 ++-- .../junit/newt/parenting/TestParenting01aSWT.java | 40 ++-- .../junit/newt/parenting/TestParenting01bAWT.java | 18 +- .../junit/newt/parenting/TestParenting01cAWT.java | 34 +-- .../newt/parenting/TestParenting01cSwingAWT.java | 97 ++++---- .../junit/newt/parenting/TestParenting01dAWT.java | 12 +- .../junit/newt/parenting/TestParenting02AWT.java | 20 +- .../junit/newt/parenting/TestParenting02NEWT.java | 46 ++-- .../junit/newt/parenting/TestParenting03AWT.java | 22 +- .../junit/newt/parenting/TestParenting04AWT.java | 48 ++-- .../junit/newt/parenting/TestParenting04SWT.java | 68 +++--- .../TestTranslucentChildWindowBug632NEWT.java | 62 ++--- .../parenting/TestTranslucentParentingAWT.java | 44 ++-- .../test/junit/newt/parenting/WindowAction.java | 16 +- .../opengl/test/junit/util/AWTFocusAdapter.java | 28 +-- .../opengl/test/junit/util/AWTKeyAdapter.java | 12 +- .../opengl/test/junit/util/AWTMouseAdapter.java | 10 +- .../opengl/test/junit/util/AWTRobotUtil.java | 146 ++++++------ .../test/junit/util/AWTWindowFocusAdapter.java | 26 +-- .../jogamp/opengl/test/junit/util/DumpGLInfo.java | 10 +- .../opengl/test/junit/util/EventCountAdapter.java | 12 +- .../test/junit/util/EventCountAdapterUtil.java | 18 +- .../test/junit/util/FocusEventCountAdapter.java | 10 +- .../test/junit/util/GLEventListenerCounter.java | 8 +- .../opengl/test/junit/util/GLSLSimpleProgram.java | 30 +-- .../test/junit/util/KeyEventCountAdapter.java | 14 +- .../jogamp/opengl/test/junit/util/MiscUtils.java | 48 ++-- .../opengl/test/junit/util/NEWTFocusAdapter.java | 38 +-- .../opengl/test/junit/util/NEWTGLContext.java | 88 +++---- .../opengl/test/junit/util/NEWTKeyAdapter.java | 12 +- .../jogamp/opengl/test/junit/util/NEWTKeyUtil.java | 24 +- .../opengl/test/junit/util/NEWTMouseAdapter.java | 10 +- .../jogamp/opengl/test/junit/util/QuitAdapter.java | 8 +- .../jogamp/opengl/test/junit/util/UITestCase.java | 48 ++-- .../test/junit/util/ValidateLockListener.java | 26 +-- 422 files changed, 8335 insertions(+), 8242 deletions(-) (limited to 'src/test/com') diff --git a/src/test/com/jogamp/opengl/test/android/LauncherUtil.java b/src/test/com/jogamp/opengl/test/android/LauncherUtil.java index ac69e1e4e..11dbe12cf 100644 --- a/src/test/com/jogamp/opengl/test/android/LauncherUtil.java +++ b/src/test/com/jogamp/opengl/test/android/LauncherUtil.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -43,45 +43,45 @@ import android.util.Log; * Helper class to parse Uri's and programmatically add package names and properties to create an Uri or Intend. *

* The order of the Uri segments (any arguments) is preserved. - *

+ *

*/ public class LauncherUtil { - + /** Default launch mode. */ public static final String LAUNCH_ACTIVITY_NORMAL = "org.jogamp.launcher.action.LAUNCH_ACTIVITY_NORMAL"; - + /** Transparent launch mode. Note: This seems to be required to achieve translucency, since setTheme(..) doesn't work. */ public static final String LAUNCH_ACTIVITY_TRANSPARENT = "org.jogamp.launcher.action.LAUNCH_ACTIVITY_TRANSPARENT"; - + /** FIXME: TODO */ public static final String LAUNCH_MAIN = "org.jogamp.launcher.action.LAUNCH_MAIN"; - + /** FIXME: TODO */ public static final String LAUNCH_JUNIT = "org.jogamp.launcher.action.LAUNCH_JUNIT"; - + /** The protocol launch */ public static final String SCHEME = "launch"; - + /** The host jogamp.org */ public static final String HOST = "jogamp.org"; - + static final String SYS_PKG = "sys"; - + static final String USR_PKG = "pkg"; - + static final String ARG = "arg"; - + public static abstract class BaseActivityLauncher extends Activity { final OrderedProperties props = new OrderedProperties(); final ArrayList args = new ArrayList(); - /** + /** * Returns the default {@link LauncherUtil#LAUNCH_ACTIVITY_NORMAL} action. *

* Should be overridden for other action, eg. {@link LauncherUtil#LAUNCH_ACTIVITY_TRANSPARENT}. *

*/ public String getAction() { return LAUNCH_ACTIVITY_NORMAL; } - + /** * Returns the properties, which are being propagated to the target activity. *

@@ -89,58 +89,58 @@ public class LauncherUtil { *

*/ public final OrderedProperties getProperties() { return props; } - + /** * Returns the commandline arguments, which are being propagated to the target activity. *

* Maybe be used to set custom commandline arguments. *

*/ - public final ArrayList getArguments() { return args; } - + public final ArrayList getArguments() { return args; } + /** Custom initialization hook which can be overriden to setup data, e.g. fill the properties retrieved by {@link #getProperties()}. */ public void init() { } - + /** Returns true if this launcher activity shall end after starting the downstream activity. Defaults to true, override to change behavior. */ public boolean finishAfterDelegate() { return true; } - + /** Must return the downstream Activity class name */ public abstract String getActivityName(); - + /** Must return a list of required user packages, at least one containing the activity. */ public abstract List getUsrPackages(); - + /** Return a list of required system packages w/ native libraries, may return null or a zero sized list. */ public abstract List getSysPackages(); @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); - + init(); - + final DataSet data = new DataSet(); data.setActivityName(getActivityName()); data.addAllSysPackages(getSysPackages()); data.addAllUsrPackages(getUsrPackages()); data.addAllProperties(props); data.addAllArguments(args); - + final Intent intent = LauncherUtil.getIntent(getAction(), data); Log.d(getClass().getSimpleName(), "Launching Activity: "+intent); startActivity (intent); - + if(finishAfterDelegate()) { finish(); // done } - } + } } - + public static class OrderedProperties { HashMap map = new HashMap(); - ArrayList keyList = new ArrayList(); - - public final void setProperty(String key, String value) { + ArrayList keyList = new ArrayList(); + + public final void setProperty(final String key, final String value) { if(key.equals(SYS_PKG)) { throw new IllegalArgumentException("Illegal property key, '"+SYS_PKG+"' is reserved"); } @@ -157,36 +157,36 @@ public class LauncherUtil { } keyList.add(key); // new key } - - public final void addAll(OrderedProperties props) { - Iterator argKeys = props.keyList.iterator(); + + public final void addAll(final OrderedProperties props) { + final Iterator argKeys = props.keyList.iterator(); while(argKeys.hasNext()) { final String key = argKeys.next(); setProperty(key, props.map.get(key)); - } + } } - + public final void setSystemProperties() { - Iterator argKeys = keyList.iterator(); + final Iterator argKeys = keyList.iterator(); while(argKeys.hasNext()) { final String key = argKeys.next(); System.setProperty(key, map.get(key)); } } public final void clearSystemProperties() { - Iterator argKeys = keyList.iterator(); + final Iterator argKeys = keyList.iterator(); while(argKeys.hasNext()) { System.clearProperty(argKeys.next()); } } - - public final String getProperty(String key) { return map.get(key); } + + public final String getProperty(final String key) { return map.get(key); } public final Map getProperties() { return map; } - + /** Returns the list of property keys in the order, as they were added. */ - public final List getPropertyKeys() { return keyList; } + public final List getPropertyKeys() { return keyList; } } - + /** * Data set to transfer from and to launch URI consisting out of: *
    @@ -205,56 +205,56 @@ public class LauncherUtil { static final char ASSIG = '='; static final String COLSLASH2 = "://"; static final String EMPTY = ""; - + String activityName = null; ArrayList sysPackages = new ArrayList(); ArrayList usrPackages = new ArrayList(); OrderedProperties properties = new OrderedProperties(); ArrayList arguments = new ArrayList(); - - public final void setActivityName(String name) { activityName = name; } + + public final void setActivityName(final String name) { activityName = name; } public final String getActivityName() { return activityName; } - - public final void addSysPackage(String p) { - sysPackages.add(p); - } - public final void addAllSysPackages(List plist) { + + public final void addSysPackage(final String p) { + sysPackages.add(p); + } + public final void addAllSysPackages(final List plist) { sysPackages.addAll(plist); - } + } public final List getSysPackages() { return sysPackages; } - - public final void addUsrPackage(String p) { - usrPackages.add(p); - } - public final void addAllUsrPackages(List plist) { + + public final void addUsrPackage(final String p) { + usrPackages.add(p); + } + public final void addAllUsrPackages(final List plist) { usrPackages.addAll(plist); - } + } public final List getUsrPackages() { return usrPackages; } - - public final void setProperty(String key, String value) { + + public final void setProperty(final String key, final String value) { properties.setProperty(key, value); } - public final void addAllProperties(OrderedProperties props) { + public final void addAllProperties(final OrderedProperties props) { properties.addAll(props); } public final void setSystemProperties() { properties.setSystemProperties(); - } + } public final void clearSystemProperties() { properties.clearSystemProperties(); - } - public final String getProperty(String key) { return properties.getProperty(key); } + } + public final String getProperty(final String key) { return properties.getProperty(key); } public final OrderedProperties getProperties() { return properties; } public final List getPropertyKeys() { return properties.getPropertyKeys(); } - - public final void addArgument(String arg) { arguments.add(arg); } - public final void addAllArguments(List args) { + + public final void addArgument(final String arg) { arguments.add(arg); } + public final void addAllArguments(final List args) { arguments.addAll(args); } public final ArrayList getArguments() { return arguments; } - + public final Uri getUri() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(SCHEME).append(COLSLASH2).append(HOST).append(SLASH).append(getActivityName()); boolean needsQMark = true; boolean needsSep = false; @@ -284,7 +284,7 @@ public class LauncherUtil { needsSep = true; } } - Iterator propKeys = properties.keyList.iterator(); + final Iterator propKeys = properties.keyList.iterator(); while(propKeys.hasNext()) { if( needsQMark ) { sb.append(QMARK); @@ -297,7 +297,7 @@ public class LauncherUtil { sb.append(key).append(ASSIG).append(properties.map.get(key)); needsSep = true; } - Iterator args = arguments.iterator(); + final Iterator args = arguments.iterator(); while(args.hasNext()) { if( needsQMark ) { sb.append(QMARK); @@ -308,18 +308,18 @@ public class LauncherUtil { } sb.append(ARG).append(ASSIG).append(args.next()); needsSep = true; - } + } return Uri.parse(sb.toString()); } - - public static final DataSet create(Uri uri) { + + public static final DataSet create(final Uri uri) { if(!uri.getScheme().equals(SCHEME)) { return null; } if(!uri.getHost().equals(HOST)) { return null; } - DataSet data = new DataSet(); + final DataSet data = new DataSet(); { String an = uri.getPath(); if(SLASH == an.charAt(0)) { @@ -330,16 +330,16 @@ public class LauncherUtil { } data.setActivityName(an); } - + final String q = uri.getQuery(); final int q_l = null != q ? q.length() : -1; int q_e = -1; while(q_e < q_l) { - int q_b = q_e + 1; // next term + final int q_b = q_e + 1; // next term q_e = q.indexOf(AMPER, q_b); if(0 == q_e) { // single separator - continue; + continue; } if(0 > q_e) { // end @@ -381,41 +381,41 @@ public class LauncherUtil { data.validate(); return data; } - + public final void validate() { if(null == activityName) { throw new RuntimeException("Activity is not NULL"); } } } - - public final static Intent getIntent(String action, DataSet data) { + + public final static Intent getIntent(final String action, final DataSet data) { data.validate(); return new Intent(action, data.getUri()); } - + public static void main(String[] args) { if(args.length==0) { args = new String[] { - SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+SYS_PKG+"=jogamp.pack1&"+SYS_PKG+"=javax.pack2&"+USR_PKG+"=com.jogamp.pack3&"+USR_PKG+"=com.jogamp.pack4&jogamp.common.debug=true&com.jogamp.test=false", + SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+SYS_PKG+"=jogamp.pack1&"+SYS_PKG+"=javax.pack2&"+USR_PKG+"=com.jogamp.pack3&"+USR_PKG+"=com.jogamp.pack4&jogamp.common.debug=true&com.jogamp.test=false", SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+SYS_PKG+"=jogamp.pack1&jogamp.common.debug=true&com.jogamp.test=false", SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+USR_PKG+"=jogamp.pack1&jogamp.common.debug=true&com.jogamp.test=false", SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+USR_PKG+"=jogamp.pack1&"+USR_PKG+"=com.jogamp.pack2", - SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+USR_PKG+"=jogamp.pack1&"+USR_PKG+"=javax.pack2&"+USR_PKG+"=com.jogamp.pack3&jogamp.common.debug=true&com.jogamp.test=false&"+ARG+"=arg1&"+ARG+"=arg2=arg2value&"+ARG+"=arg3", - SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+USR_PKG+"=jogamp.pack1&jogamp.common.debug=true&com.jogamp.test=false&"+ARG+"=arg1&"+ARG+"=arg2=arg2value&"+ARG+"=arg3", - SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+USR_PKG+"=jogamp.pack1&"+ARG+"=arg1&"+ARG+"=arg2=arg2value&"+ARG+"=arg3" + SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+USR_PKG+"=jogamp.pack1&"+USR_PKG+"=javax.pack2&"+USR_PKG+"=com.jogamp.pack3&jogamp.common.debug=true&com.jogamp.test=false&"+ARG+"=arg1&"+ARG+"=arg2=arg2value&"+ARG+"=arg3", + SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+USR_PKG+"=jogamp.pack1&jogamp.common.debug=true&com.jogamp.test=false&"+ARG+"=arg1&"+ARG+"=arg2=arg2value&"+ARG+"=arg3", + SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+USR_PKG+"=jogamp.pack1&"+ARG+"=arg1&"+ARG+"=arg2=arg2value&"+ARG+"=arg3" }; } int errors = 0; for(int i=0; i -> "+uri0+" -> NULL"); } else { - Uri uri1 = data.getUri(); + final Uri uri1 = data.getUri(); if(!uri0.equals(uri1)) { errors++; System.err.println("Error: Not equal: <"+uri_s+"> -> "+uri0+" -> "+uri1); @@ -426,5 +426,5 @@ public class LauncherUtil { } System.err.println("LauncherUtil Self Test: Errors: "+errors); } - + } diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0a.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0a.java index ff1ab5e3d..79b6952ee 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0a.java +++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0a.java @@ -60,7 +60,7 @@ public class MovieCubeActivity0a extends NewtBaseActivity { MouseAdapter showKeyboardMouseListener = new MouseAdapter() { @Override - public void mousePressed(MouseEvent e) { + public void mousePressed(final MouseEvent e) { if( e.getPointerCount() == 4 && e.getPressure(0, true) > 0.7f ) { ((com.jogamp.newt.Window) e.getSource()).setKeyboardVisible(true); } @@ -68,10 +68,10 @@ public class MovieCubeActivity0a extends NewtBaseActivity { }; @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); - String[] streamLocs = new String[] { + final String[] streamLocs = new String[] { System.getProperty("jnlp.media0_url0"), System.getProperty("jnlp.media0_url1"), System.getProperty("jnlp.media0_url2") }; @@ -102,11 +102,11 @@ public class MovieCubeActivity0a extends NewtBaseActivity { final GLMediaPlayer mPlayer = demoMain.getGLMediaPlayer(); mPlayer.addEventListener(new GLMediaEventListener() { @Override - public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) { + public void newFrameAvailable(final GLMediaPlayer ts, final TextureFrame newFrame, final long when) { } @Override - public void attributesChanged(final GLMediaPlayer mp, int event_mask, long when) { + public void attributesChanged(final GLMediaPlayer mp, final int event_mask, final long when) { System.err.println("MovieCubeActivity0 AttributesChanges: events_mask 0x"+Integer.toHexString(event_mask)+", when "+when); System.err.println("MovieCubeActivity0 State: "+mp); if( 0 != ( GLMediaEventListener.EVENT_CHANGE_INIT & event_mask ) ) { @@ -127,7 +127,7 @@ public class MovieCubeActivity0a extends NewtBaseActivity { } }); demoMain.initStream(streamLoc, GLMediaPlayer.STREAM_ID_AUTO, GLMediaPlayer.STREAM_ID_AUTO, 0); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } @@ -136,7 +136,7 @@ public class MovieCubeActivity0a extends NewtBaseActivity { Log.d(TAG, "onCreate - X"); } - static URI getURI(String path[], int off, boolean checkAvail) { + static URI getURI(final String path[], final int off, final boolean checkAvail) { URI uri = null; for(int i=off; null==uri && i0) { @@ -145,7 +145,7 @@ public class MovieCubeActivity0a extends NewtBaseActivity { if( null != uc ) { try { uri = uc.getURL().toURI(); - } catch (URISyntaxException e) { + } catch (final URISyntaxException e) { uri = null; } if( uc instanceof HttpURLConnection ) { @@ -155,7 +155,7 @@ public class MovieCubeActivity0a extends NewtBaseActivity { } else { try { uri = new URI(path[i]); - } catch (URISyntaxException e) { + } catch (final URISyntaxException e) { uri = null; } } diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0b.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0b.java index 2707fbbec..5303276a6 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0b.java +++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0b.java @@ -60,7 +60,7 @@ public class MovieCubeActivity0b extends NewtBaseActivity { MouseAdapter showKeyboardMouseListener = new MouseAdapter() { @Override - public void mousePressed(MouseEvent e) { + public void mousePressed(final MouseEvent e) { if( e.getPointerCount() == 4 && e.getPressure(0, true) > 0.7f ) { ((com.jogamp.newt.Window) e.getSource()).setKeyboardVisible(true); } @@ -68,10 +68,10 @@ public class MovieCubeActivity0b extends NewtBaseActivity { }; @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); - String[] streamLocs = new String[] { + final String[] streamLocs = new String[] { System.getProperty("jnlp.media0_url0"), System.getProperty("jnlp.media0_url1"), System.getProperty("jnlp.media0_url2") }; @@ -104,11 +104,11 @@ public class MovieCubeActivity0b extends NewtBaseActivity { final GLMediaPlayer mPlayer = demoMain.getGLMediaPlayer(); mPlayer.addEventListener(new GLMediaEventListener() { @Override - public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) { + public void newFrameAvailable(final GLMediaPlayer ts, final TextureFrame newFrame, final long when) { } @Override - public void attributesChanged(final GLMediaPlayer mp, int event_mask, long when) { + public void attributesChanged(final GLMediaPlayer mp, final int event_mask, final long when) { System.err.println("MovieCubeActivity0 AttributesChanges: events_mask 0x"+Integer.toHexString(event_mask)+", when "+when); System.err.println("MovieCubeActivity0 State: "+mp); if( 0 != ( GLMediaEventListener.EVENT_CHANGE_INIT & event_mask ) ) { @@ -129,7 +129,7 @@ public class MovieCubeActivity0b extends NewtBaseActivity { } }); demoMain.initStream(streamLoc, GLMediaPlayer.STREAM_ID_AUTO, GLMediaPlayer.STREAM_ID_AUTO, 0); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } @@ -138,7 +138,7 @@ public class MovieCubeActivity0b extends NewtBaseActivity { Log.d(TAG, "onCreate - X"); } - static URI getURI(String path[], int off, boolean checkAvail) { + static URI getURI(final String path[], final int off, final boolean checkAvail) { URI uri = null; for(int i=off; null==uri && i0) { @@ -147,7 +147,7 @@ public class MovieCubeActivity0b extends NewtBaseActivity { if( null != uc ) { try { uri = uc.getURL().toURI(); - } catch (URISyntaxException e) { + } catch (final URISyntaxException e) { uri = null; } if( uc instanceof HttpURLConnection ) { @@ -157,7 +157,7 @@ public class MovieCubeActivity0b extends NewtBaseActivity { } else { try { uri = new URI(path[i]); - } catch (URISyntaxException e) { + } catch (final URISyntaxException e) { uri = null; } } diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity0.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity0.java index 9af75d138..47e1b1796 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity0.java +++ b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity0.java @@ -59,15 +59,15 @@ public class MovieSimpleActivity0 extends NewtBaseActivity { static String TAG = "MovieSimpleActivity0"; MouseAdapter toFrontMouseListener = new MouseAdapter() { - public void mouseClicked(MouseEvent e) { - Object src = e.getSource(); + public void mouseClicked(final MouseEvent e) { + final Object src = e.getSource(); if(src instanceof Window) { ((Window)src).requestFocus(false); } } }; @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); final String[] streamLocs = new String[] { @@ -102,10 +102,10 @@ public class MovieSimpleActivity0 extends NewtBaseActivity { final GLMediaPlayer mPlayer = demoMain.getGLMediaPlayer(); mPlayer.addEventListener( new GLMediaPlayer.GLMediaEventListener() { @Override - public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) { } + public void newFrameAvailable(final GLMediaPlayer ts, final TextureFrame newFrame, final long when) { } @Override - public void attributesChanged(GLMediaPlayer mp, int event_mask, long when) { + public void attributesChanged(final GLMediaPlayer mp, final int event_mask, final long when) { System.err.println("MovieSimpleActivity0 AttributesChanges: events_mask 0x"+Integer.toHexString(event_mask)+", when "+when); System.err.println("MovieSimpleActivity0 State: "+mp); if( 0 != ( GLMediaEventListener.EVENT_CHANGE_INIT & event_mask ) ) { @@ -129,7 +129,7 @@ public class MovieSimpleActivity0 extends NewtBaseActivity { Log.d(TAG, "onCreate - X"); } - static URI getURI(String path[], int off, boolean checkAvail) { + static URI getURI(final String path[], final int off, final boolean checkAvail) { URI uri = null; for(int i=off; null==uri && i0) { @@ -138,7 +138,7 @@ public class MovieSimpleActivity0 extends NewtBaseActivity { if( null != uc ) { try { uri = uc.getURL().toURI(); - } catch (URISyntaxException e) { + } catch (final URISyntaxException e) { uri = null; } if( uc instanceof HttpURLConnection ) { @@ -148,7 +148,7 @@ public class MovieSimpleActivity0 extends NewtBaseActivity { } else { try { uri = new URI(path[i]); - } catch (URISyntaxException e) { + } catch (final URISyntaxException e) { uri = null; } } diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity1.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity1.java index 54b994d1f..1fc736ee7 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity1.java +++ b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity1.java @@ -62,15 +62,15 @@ public class MovieSimpleActivity1 extends NewtBaseActivity { static String TAG = "MovieSimpleActivity1"; MouseAdapter toFrontMouseListener = new MouseAdapter() { - public void mouseClicked(MouseEvent e) { - Object src = e.getSource(); + public void mouseClicked(final MouseEvent e) { + final Object src = e.getSource(); if(src instanceof Window) { ((Window)src).requestFocus(false); } } }; @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); final boolean mPlayerNoZoom = Boolean.valueOf(System.getProperty("jnlp.mplayer.nozoom")); @@ -78,7 +78,7 @@ public class MovieSimpleActivity1 extends NewtBaseActivity { final boolean mPlayerSharedHUD = mPlayerHUD && Boolean.valueOf(System.getProperty("jnlp.mplayer.hud.shared")); Log.d(TAG, "onCreate - 0 - mPlayerNoScale "+mPlayerNoZoom+", mPlayerHUD "+mPlayerHUD+", mPlayerSharedHUD "+mPlayerSharedHUD); - String[] streamLocs = new String[] { + final String[] streamLocs = new String[] { System.getProperty("jnlp.media0_url0"), System.getProperty("jnlp.media0_url1"), System.getProperty("jnlp.media0_url2") }; @@ -89,7 +89,7 @@ public class MovieSimpleActivity1 extends NewtBaseActivity { { URI _streamLoc1 = null; if(mPlayerHUD && !mPlayerSharedHUD) { - String[] urls1 = new String[] { System.getProperty("jnlp.media1_url0") }; + final String[] urls1 = new String[] { System.getProperty("jnlp.media1_url0") }; _streamLoc1 = getURI(urls1, 1, false); } if(null == _streamLoc1) { _streamLoc1 = streamLoc0; } @@ -138,10 +138,10 @@ public class MovieSimpleActivity1 extends NewtBaseActivity { demoMain.setScaleOrig(mPlayerNoZoom); mPlayerMain.addEventListener( new GLMediaPlayer.GLMediaEventListener() { @Override - public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) { } + public void newFrameAvailable(final GLMediaPlayer ts, final TextureFrame newFrame, final long when) { } @Override - public void attributesChanged(GLMediaPlayer mp, int event_mask, long when) { + public void attributesChanged(final GLMediaPlayer mp, final int event_mask, final long when) { System.err.println("MovieSimpleActivity1 AttributesChanges: events_mask 0x"+Integer.toHexString(event_mask)+", when "+when); System.err.println("MovieSimpleActivity1 State: "+mp); if( 0 != ( GLMediaEventListener.EVENT_CHANGE_INIT & event_mask ) ) { @@ -169,7 +169,7 @@ public class MovieSimpleActivity1 extends NewtBaseActivity { final GLWindow glWindowHUD = GLWindow.create(scrn, capsHUD); glWindowMain.invoke(false, new GLRunnable() { @Override - public boolean run(GLAutoDrawable drawable) { + public boolean run(final GLAutoDrawable drawable) { final GLMediaPlayer mPlayerSub; final MovieSimple demoHUD; final Rectangle windowBounds = (Rectangle) scrn.getViewportInWindowUnits().cloneMutable(); @@ -189,10 +189,10 @@ public class MovieSimpleActivity1 extends NewtBaseActivity { } mPlayerSub.addEventListener( new GLMediaPlayer.GLMediaEventListener() { @Override - public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) { } + public void newFrameAvailable(final GLMediaPlayer ts, final TextureFrame newFrame, final long when) { } @Override - public void attributesChanged(GLMediaPlayer mp, int event_mask, long when) { + public void attributesChanged(final GLMediaPlayer mp, final int event_mask, final long when) { if( 0 != ( GLMediaEventListener.EVENT_CHANGE_INIT & event_mask ) ) { glWindowHUD.addGLEventListener(demoHUD); } @@ -231,7 +231,7 @@ public class MovieSimpleActivity1 extends NewtBaseActivity { Log.d(TAG, "onCreate - X"); } - static URI getURI(String path[], int off, boolean checkAvail) { + static URI getURI(final String path[], final int off, final boolean checkAvail) { URI uri = null; for(int i=off; null==uri && i0) { @@ -240,7 +240,7 @@ public class MovieSimpleActivity1 extends NewtBaseActivity { if( null != uc ) { try { uri = uc.getURL().toURI(); - } catch (URISyntaxException e) { + } catch (final URISyntaxException e) { uri = null; } if( uc instanceof HttpURLConnection ) { @@ -250,7 +250,7 @@ public class MovieSimpleActivity1 extends NewtBaseActivity { } else { try { uri = new URI(path[i]); - } catch (URISyntaxException e) { + } catch (final URISyntaxException e) { uri = null; } } diff --git a/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java index 596c2c84e..9183e572c 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -44,35 +44,35 @@ import android.util.Log; public class NEWTElektronActivity extends NewtBaseActivity { static String TAG = "NEWTElektronActivity"; - + @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { Log.d(TAG, "onCreate - 0"); super.onCreate(savedInstanceState); - + // create GLWindow (-> incl. underlying NEWT Display, Screen & Window) - GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2)); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2)); Log.d(TAG, "req caps: "+caps); - GLWindow glWindow = GLWindow.create(caps); + final GLWindow glWindow = GLWindow.create(caps); glWindow.setFullscreen(true); setContentView(getWindow(), glWindow); - + glWindow.addGLEventListener(new ElektronenMultiplizierer()); glWindow.getScreen().addMonitorModeListener(new MonitorModeListener() { @Override - public void monitorModeChangeNotify(MonitorEvent me) { } + public void monitorModeChangeNotify(final MonitorEvent me) { } @Override - public void monitorModeChanged(MonitorEvent me, boolean success) { + public void monitorModeChanged(final MonitorEvent me, final boolean success) { System.err.println("MonitorMode Changed (success "+success+"): "+me); } }); glWindow.setVisible(true); - Animator animator = new Animator(glWindow); - + final Animator animator = new Animator(glWindow); + animator.setUpdateFPSFrames(60, System.err); animator.resetFPSCounter(); glWindow.resetFPSCounter(); - + Log.d(TAG, "onCreate - X"); - } + } } diff --git a/src/test/com/jogamp/opengl/test/android/NEWTElektronActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTElektronActivityLauncher.java index 527d66108..95504b7a7 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTElektronActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTElektronActivityLauncher.java @@ -8,16 +8,16 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class NEWTElektronActivityLauncher extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.NEWTElektronActivity"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; - + @Override public void init() { - final OrderedProperties props = getProperties(); + final OrderedProperties props = getProperties(); // props.setProperty("jogamp.debug.JNILibLoader", "true"); // props.setProperty("jogamp.debug.NativeLibrary", "true"); // properties.setProperty("jogamp.debug.NativeLibrary.Lookup", "true"); - // properties.setProperty("jogamp.debug.IOUtil", "true"); + // properties.setProperty("jogamp.debug.IOUtil", "true"); // properties.setProperty("nativewindow.debug", "all"); props.setProperty("nativewindow.debug.GraphicsConfiguration", "true"); // properties.setProperty("jogl.debug", "all"); @@ -25,7 +25,7 @@ public class NEWTElektronActivityLauncher extends LauncherUtil.BaseActivityLaunc props.setProperty("jogl.debug.GLDrawable", "true"); props.setProperty("jogl.debug.GLContext", "true"); props.setProperty("jogl.debug.GLSLCode", "true"); - props.setProperty("jogl.debug.CapabilitiesChooser", "true"); + props.setProperty("jogl.debug.CapabilitiesChooser", "true"); // properties.setProperty("jogl.debug.GLSLState", "true"); // properties.setProperty("jogl.debug.DebugGL", "true"); // properties.setProperty("jogl.debug.TraceGL", "true"); @@ -34,7 +34,7 @@ public class NEWTElektronActivityLauncher extends LauncherUtil.BaseActivityLaunc // properties.setProperty("newt.debug.Window.MouseEvent", "true"); // properties.setProperty("newt.debug.Window.KeyEvent", "true"); } - + @Override public String getActivityName() { return demo; @@ -43,7 +43,7 @@ public class NEWTElektronActivityLauncher extends LauncherUtil.BaseActivityLaunc public List getSysPackages() { return Arrays.asList(sys_pkgs); } - + @Override public List getUsrPackages() { return Arrays.asList(usr_pkgs); diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java index f10cfc11f..3ec85c108 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -44,40 +44,40 @@ import android.util.Log; public class NEWTGearsES1Activity extends NewtBaseActivity { static String TAG = "NEWTGearsES1Activity"; - + @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { Log.d(TAG, "onCreate - 0"); super.onCreate(savedInstanceState); - + // create GLWindow (-> incl. underlying NEWT Display, Screen & Window) - GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES1)); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES1)); /* caps.setRedBits(5); caps.setGreenBits(6); caps.setBlueBits(5); caps.setAlphaBits(0); */ Log.d(TAG, "req caps: "+caps); - GLWindow glWindow = GLWindow.create(caps); + final GLWindow glWindow = GLWindow.create(caps); glWindow.setFullscreen(true); setContentView(getWindow(), glWindow); - + glWindow.addGLEventListener(new GearsES1(-1)); glWindow.getScreen().addMonitorModeListener(new MonitorModeListener() { @Override - public void monitorModeChangeNotify(MonitorEvent me) { } + public void monitorModeChangeNotify(final MonitorEvent me) { } @Override - public void monitorModeChanged(MonitorEvent me, boolean success) { + public void monitorModeChanged(final MonitorEvent me, final boolean success) { System.err.println("MonitorMode Changed (success "+success+"): "+me); } }); glWindow.setVisible(true); - Animator animator = new Animator(glWindow); - + final Animator animator = new Animator(glWindow); + animator.setUpdateFPSFrames(60, System.err); animator.resetFPSCounter(); glWindow.resetFPSCounter(); - + Log.d(TAG, "onCreate - X"); - } + } } diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES1ActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES1ActivityLauncher.java index dca453126..db4d57825 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES1ActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES1ActivityLauncher.java @@ -7,16 +7,16 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class NEWTGearsES1ActivityLauncher extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.NEWTGearsES1Activity"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; - + @Override public void init() { - final OrderedProperties props = getProperties(); + final OrderedProperties props = getProperties(); // props.setProperty("jogamp.debug.JNILibLoader", "true"); // props.setProperty("jogamp.debug.NativeLibrary", "true"); // properties.setProperty("jogamp.debug.NativeLibrary.Lookup", "true"); - // properties.setProperty("jogamp.debug.IOUtil", "true"); + // properties.setProperty("jogamp.debug.IOUtil", "true"); // properties.setProperty("nativewindow.debug", "all"); props.setProperty("nativewindow.debug.GraphicsConfiguration", "true"); // properties.setProperty("jogl.debug", "all"); @@ -24,7 +24,7 @@ public class NEWTGearsES1ActivityLauncher extends LauncherUtil.BaseActivityLaunc props.setProperty("jogl.debug.GLDrawable", "true"); props.setProperty("jogl.debug.GLContext", "true"); props.setProperty("jogl.debug.GLSLCode", "true"); - props.setProperty("jogl.debug.CapabilitiesChooser", "true"); + props.setProperty("jogl.debug.CapabilitiesChooser", "true"); // properties.setProperty("jogl.debug.GLSLState", "true"); // properties.setProperty("jogl.debug.DebugGL", "true"); // properties.setProperty("jogl.debug.TraceGL", "true"); @@ -33,7 +33,7 @@ public class NEWTGearsES1ActivityLauncher extends LauncherUtil.BaseActivityLaunc // properties.setProperty("newt.debug.Window.MouseEvent", "true"); // properties.setProperty("newt.debug.Window.KeyEvent", "true"); } - + @Override public String getActivityName() { return demo; @@ -42,7 +42,7 @@ public class NEWTGearsES1ActivityLauncher extends LauncherUtil.BaseActivityLaunc public List getSysPackages() { return Arrays.asList(sys_pkgs); } - + @Override public List getUsrPackages() { return Arrays.asList(usr_pkgs); diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java index 9572ef6de..eff2c876a 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java @@ -56,30 +56,30 @@ public class NEWTGearsES2Activity extends NewtBaseActivity { static final String forceKillProcessTest = "demo.force.killProcessTest"; @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { Log.d(TAG, "onCreate - 0"); super.onCreate(savedInstanceState); // create GLWindow (-> incl. underlying NEWT Display, Screen & Window) - GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2)); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2)); if( null != System.getProperty(forceRGBA5650) ) { Log.d(TAG, "forceRGBA5650"); caps.setRedBits(5); caps.setGreenBits(6); caps.setBlueBits(5); } Log.d(TAG, "req caps: "+caps); - GLWindow glWindow = GLWindow.create(caps); + final GLWindow glWindow = GLWindow.create(caps); glWindow.setFullscreen(true); setContentView(getWindow(), glWindow); - GearsES2 demo = new GearsES2(-1); + final GearsES2 demo = new GearsES2(-1); // demo.enableAndroidTrace(true); glWindow.addGLEventListener(demo); glWindow.getScreen().addMonitorModeListener(new MonitorModeListener() { @Override - public void monitorModeChangeNotify(MonitorEvent me) { } + public void monitorModeChangeNotify(final MonitorEvent me) { } @Override - public void monitorModeChanged(MonitorEvent me, boolean success) { + public void monitorModeChanged(final MonitorEvent me, final boolean success) { System.err.println("MonitorMode Changed (success "+success+"): "+me); } }); @@ -87,12 +87,12 @@ public class NEWTGearsES2Activity extends NewtBaseActivity { Log.d(TAG, "forceKillProcessTest"); glWindow.addMouseListener(new MouseAdapter() { @Override - public void mousePressed(MouseEvent e) { + public void mousePressed(final MouseEvent e) { if( e.getPointerCount() == 3 ) { Log.d(TAG, "MemoryHog"); new Thread(new Runnable() { public void run() { - ArrayList buffers = new ArrayList(); + final ArrayList buffers = new ArrayList(); while(true) { final int halfMB = 512 * 1024; final float osizeMB = buffers.size() * 0.5f; @@ -102,7 +102,7 @@ public class NEWTGearsES2Activity extends NewtBaseActivity { System.err.println("MemoryHog: ****** +4k: "+osizeMB+" MB +"+nsizeMB+" MB - Done"); try { Thread.sleep(500); - } catch (Exception e) {}; + } catch (final Exception e) {}; } } }, "MemoryHog").start(); } else if( e.getPointerCount() == 4 ) { @@ -112,7 +112,7 @@ public class NEWTGearsES2Activity extends NewtBaseActivity { } }); } - Animator animator = new Animator(glWindow); + final Animator animator = new Animator(glWindow); // animator.setRunAsFastAsPossible(true); // glWindow.setSkipContextReleaseThread(animator.getThread()); diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java index c87e66189..06316c4b0 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -37,13 +37,13 @@ public class NEWTGearsES2ActivityLauncher extends LauncherUtil.BaseActivityLaunc static String demo = "com.jogamp.opengl.test.android.NEWTGearsES2Activity"; static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; - + @Override public void init() { - final OrderedProperties props = getProperties(); + final OrderedProperties props = getProperties(); // props.setProperty("jogamp.debug.JNILibLoader", "true"); // props.setProperty("jogamp.debug.NativeLibrary", "true"); - // props.setProperty("jogamp.debug.IOUtil", "true"); + // props.setProperty("jogamp.debug.IOUtil", "true"); // properties.setProperty("jogamp.debug.NativeLibrary.Lookup", "true"); // props.setProperty("nativewindow.debug", "all"); props.setProperty("nativewindow.debug.GraphicsConfiguration", "true"); @@ -52,7 +52,7 @@ public class NEWTGearsES2ActivityLauncher extends LauncherUtil.BaseActivityLaunc // props.setProperty("jogl.debug.GLDrawable", "true"); props.setProperty("jogl.debug.GLContext", "true"); props.setProperty("jogl.debug.GLSLCode", "true"); - // props.setProperty("jogl.debug.CapabilitiesChooser", "true"); + // props.setProperty("jogl.debug.CapabilitiesChooser", "true"); // props.setProperty("jogl.debug.GLSLState", "true"); // props.setProperty("jogl.debug.DebugGL", "true"); // props.setProperty("jogl.debug.TraceGL", "true"); @@ -62,20 +62,20 @@ public class NEWTGearsES2ActivityLauncher extends LauncherUtil.BaseActivityLaunc props.setProperty("newt.debug.Window.MouseEvent", "true"); props.setProperty("newt.debug.Window.KeyEvent", "true"); // props.setProperty("newt.debug.Android.MouseEvent", "true"); - + // props.setProperty("demo.force.killProcessTest", "true"); } - + @Override public String getActivityName() { return demo; } - + @Override public List getSysPackages() { return Arrays.asList(sys_pkgs); } - + @Override public List getUsrPackages() { return Arrays.asList(usr_pkgs); diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ECTActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ECTActivityLauncher.java index fb00ecbad..2e005cb7f 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ECTActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ECTActivityLauncher.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -35,15 +35,15 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class NEWTGearsES2ECTActivityLauncher extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.NEWTGearsES2Activity"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; - + @Override public void init() { - final OrderedProperties props = getProperties(); + final OrderedProperties props = getProperties(); // props.setProperty("jogamp.debug.JNILibLoader", "true"); // props.setProperty("jogamp.debug.NativeLibrary", "true"); - // props.setProperty("jogamp.debug.IOUtil", "true"); + // props.setProperty("jogamp.debug.IOUtil", "true"); // properties.setProperty("jogamp.debug.NativeLibrary.Lookup", "true"); // props.setProperty("nativewindow.debug", "all"); props.setProperty("nativewindow.debug.GraphicsConfiguration", "true"); @@ -52,7 +52,7 @@ public class NEWTGearsES2ECTActivityLauncher extends LauncherUtil.BaseActivityLa // props.setProperty("jogl.debug.GLDrawable", "true"); props.setProperty("jogl.debug.GLContext", "true"); props.setProperty("jogl.debug.GLSLCode", "true"); - // props.setProperty("jogl.debug.CapabilitiesChooser", "true"); + // props.setProperty("jogl.debug.CapabilitiesChooser", "true"); // props.setProperty("jogl.debug.GLSLState", "true"); // props.setProperty("jogl.debug.DebugGL", "true"); // props.setProperty("jogl.debug.TraceGL", "true"); @@ -60,10 +60,10 @@ public class NEWTGearsES2ECTActivityLauncher extends LauncherUtil.BaseActivityLa props.setProperty("newt.debug.Window", "true"); props.setProperty("newt.debug.Window.MouseEvent", "true"); props.setProperty("newt.debug.Window.KeyEvent", "true"); - - props.setProperty("demo.force.ect", "true"); + + props.setProperty("demo.force.ect", "true"); } - + @Override public String getActivityName() { return demo; @@ -72,7 +72,7 @@ public class NEWTGearsES2ECTActivityLauncher extends LauncherUtil.BaseActivityLa public List getSysPackages() { return Arrays.asList(sys_pkgs); } - + @Override public List getUsrPackages() { return Arrays.asList(usr_pkgs); diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2RGB565ActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2RGB565ActivityLauncher.java index 8acd2c05a..94e32f1d0 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2RGB565ActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2RGB565ActivityLauncher.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -35,15 +35,15 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class NEWTGearsES2RGB565ActivityLauncher extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.NEWTGearsES2Activity"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; - + @Override public void init() { - final OrderedProperties props = getProperties(); + final OrderedProperties props = getProperties(); // props.setProperty("jogamp.debug.JNILibLoader", "true"); // props.setProperty("jogamp.debug.NativeLibrary", "true"); - // props.setProperty("jogamp.debug.IOUtil", "true"); + // props.setProperty("jogamp.debug.IOUtil", "true"); // properties.setProperty("jogamp.debug.NativeLibrary.Lookup", "true"); // props.setProperty("nativewindow.debug", "all"); props.setProperty("nativewindow.debug.GraphicsConfiguration", "true"); @@ -52,7 +52,7 @@ public class NEWTGearsES2RGB565ActivityLauncher extends LauncherUtil.BaseActivit // props.setProperty("jogl.debug.GLDrawable", "true"); props.setProperty("jogl.debug.GLContext", "true"); props.setProperty("jogl.debug.GLSLCode", "true"); - // props.setProperty("jogl.debug.CapabilitiesChooser", "true"); + // props.setProperty("jogl.debug.CapabilitiesChooser", "true"); // props.setProperty("jogl.debug.GLSLState", "true"); // props.setProperty("jogl.debug.DebugGL", "true"); // props.setProperty("jogl.debug.TraceGL", "true"); @@ -60,10 +60,10 @@ public class NEWTGearsES2RGB565ActivityLauncher extends LauncherUtil.BaseActivit props.setProperty("newt.debug.Window", "true"); props.setProperty("newt.debug.Window.MouseEvent", "true"); props.setProperty("newt.debug.Window.KeyEvent", "true"); - + props.setProperty("demo.force.rgba5650", "true"); } - + @Override public String getActivityName() { return demo; @@ -72,7 +72,7 @@ public class NEWTGearsES2RGB565ActivityLauncher extends LauncherUtil.BaseActivit public List getSysPackages() { return Arrays.asList(sys_pkgs); } - + @Override public List getUsrPackages() { return Arrays.asList(usr_pkgs); diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java index a07d3c97b..1080b2d89 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java @@ -48,18 +48,18 @@ public class NEWTGearsES2TransActivity extends NewtBaseActivity { static String TAG = "NEWTGearsES2TransActivity"; @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { Log.d(TAG, "onCreate - 0"); super.onCreate(savedInstanceState); // create GLWindow (-> incl. underlying NEWT Display, Screen & Window) - GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2)); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2)); caps.setBackgroundOpaque(false); Log.d(TAG, "req caps: "+caps); - Screen screen = NewtFactory.createScreen(NewtFactory.createDisplay(null), 0); + final Screen screen = NewtFactory.createScreen(NewtFactory.createDisplay(null), 0); screen.addReference(); - GLWindow glWindow = GLWindow.create(screen, caps); + final GLWindow glWindow = GLWindow.create(screen, caps); glWindow.setSurfaceSize(2*screen.getWidth()/3, 2*screen.getHeight()/3); glWindow.setUndecorated(true); setContentView(getWindow(), glWindow); @@ -67,13 +67,13 @@ public class NEWTGearsES2TransActivity extends NewtBaseActivity { glWindow.addGLEventListener(new GearsES2(-1)); glWindow.getScreen().addMonitorModeListener(new MonitorModeListener() { @Override - public void monitorModeChangeNotify(MonitorEvent me) { } + public void monitorModeChangeNotify(final MonitorEvent me) { } @Override - public void monitorModeChanged(MonitorEvent me, boolean success) { + public void monitorModeChanged(final MonitorEvent me, final boolean success) { System.err.println("MonitorMode Changed (success "+success+"): "+me); } }); - Animator animator = new Animator(glWindow); + final Animator animator = new Animator(glWindow); // glWindow.setSkipContextReleaseThread(animator.getThread()); glWindow.setVisible(true); diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivityLauncher.java index e6fe2a23f..332b26e76 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivityLauncher.java @@ -7,17 +7,17 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class NEWTGearsES2TransActivityLauncher extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.NEWTGearsES2TransActivity"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; - + @Override public void init() { - final OrderedProperties props = getProperties(); + final OrderedProperties props = getProperties(); // props.setProperty("jnlp.android.translucent", "true"); // props.setProperty("jogamp.debug.JNILibLoader", "true"); // props.setProperty("jogamp.debug.NativeLibrary", "true"); // properties.setProperty("jogamp.debug.NativeLibrary.Lookup", "true"); - // properties.setProperty("jogamp.debug.IOUtil", "true"); + // properties.setProperty("jogamp.debug.IOUtil", "true"); // properties.setProperty("nativewindow.debug", "all"); props.setProperty("nativewindow.debug.GraphicsConfiguration", "true"); // properties.setProperty("jogl.debug", "all"); @@ -25,7 +25,7 @@ public class NEWTGearsES2TransActivityLauncher extends LauncherUtil.BaseActivity props.setProperty("jogl.debug.GLDrawable", "true"); props.setProperty("jogl.debug.GLContext", "true"); props.setProperty("jogl.debug.GLSLCode", "true"); - props.setProperty("jogl.debug.CapabilitiesChooser", "true"); + props.setProperty("jogl.debug.CapabilitiesChooser", "true"); // properties.setProperty("jogl.debug.GLSLState", "true"); // properties.setProperty("jogl.debug.DebugGL", "true"); // properties.setProperty("jogl.debug.TraceGL", "true"); @@ -35,24 +35,24 @@ public class NEWTGearsES2TransActivityLauncher extends LauncherUtil.BaseActivity // properties.setProperty("newt.debug.Window.KeyEvent", "true"); props.setProperty("jogamp.debug.IOUtil", "true"); } - + @Override public String getActivityName() { return demo; } - + @Override public List getSysPackages() { return Arrays.asList(sys_pkgs); } - + @Override public List getUsrPackages() { return Arrays.asList(usr_pkgs); } - + @Override public String getAction() { return LauncherUtil.LAUNCH_ACTIVITY_TRANSPARENT; - } + } } diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java index 26adf0c4b..cd7eb4c66 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -44,38 +44,38 @@ import android.util.Log; public class NEWTGraphUI1pActivity extends NewtBaseActivity { static String TAG = "NEWTGraphUIActivity"; - + @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { Log.d(TAG, "onCreate - 0"); super.onCreate(savedInstanceState); - + // create GLWindow (-> incl. underlying NEWT Display, Screen & Window) - GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2)); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2)); caps.setAlphaBits(4); caps.setNumSamples(4); caps.setSampleBuffers(true); Log.d(TAG, "req caps: "+caps); - GLWindow glWindow = GLWindow.create(caps); + final GLWindow glWindow = GLWindow.create(caps); glWindow.setFullscreen(true); setContentView(getWindow(), glWindow); - + glWindow.addGLEventListener(new GPUUISceneGLListener0A(0)); glWindow.getScreen().addMonitorModeListener(new MonitorModeListener() { @Override - public void monitorModeChangeNotify(MonitorEvent me) { } + public void monitorModeChangeNotify(final MonitorEvent me) { } @Override - public void monitorModeChanged(MonitorEvent me, boolean success) { + public void monitorModeChanged(final MonitorEvent me, final boolean success) { System.err.println("MonitorMode Changed (success "+success+"): "+me); } }); glWindow.setVisible(true); - Animator animator = new Animator(glWindow); - + final Animator animator = new Animator(glWindow); + animator.setUpdateFPSFrames(60, System.err); animator.resetFPSCounter(); glWindow.resetFPSCounter(); - + Log.d(TAG, "onCreate - X"); - } + } } diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivityLauncher.java index c18cf1611..5dd8686b4 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivityLauncher.java @@ -7,16 +7,16 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class NEWTGraphUI1pActivityLauncher extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.NEWTGraphUI1pActivity"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; - + @Override public void init() { - final OrderedProperties props = getProperties(); + final OrderedProperties props = getProperties(); // props.setProperty("jogamp.debug.JNILibLoader", "true"); // props.setProperty("jogamp.debug.NativeLibrary", "true"); // props.setProperty("jogamp.debug.NativeLibrary.Lookup", "true"); - // props.setProperty("jogamp.debug.IOUtil", "true"); + // props.setProperty("jogamp.debug.IOUtil", "true"); // props.setProperty("nativewindow.debug", "all"); props.setProperty("nativewindow.debug.GraphicsConfiguration", "true"); // props.setProperty("jogl.debug", "all"); @@ -24,7 +24,7 @@ public class NEWTGraphUI1pActivityLauncher extends LauncherUtil.BaseActivityLaun props.setProperty("jogl.debug.GLDrawable", "true"); props.setProperty("jogl.debug.GLContext", "true"); props.setProperty("jogl.debug.GLSLCode", "true"); - props.setProperty("jogl.debug.CapabilitiesChooser", "true"); + props.setProperty("jogl.debug.CapabilitiesChooser", "true"); // props.setProperty("jogl.debug.GLSLState", "true"); // props.setProperty("jogl.debug.DebugGL", "true"); // props.setProperty("jogl.debug.TraceGL", "true"); @@ -33,17 +33,17 @@ public class NEWTGraphUI1pActivityLauncher extends LauncherUtil.BaseActivityLaun // props.setProperty("newt.debug.Window.MouseEvent", "true"); // props.setProperty("newt.debug.Window.KeyEvent", "true"); } - + @Override public String getActivityName() { return demo; } - + @Override public List getSysPackages() { return Arrays.asList(sys_pkgs); } - + @Override public List getUsrPackages() { return Arrays.asList(usr_pkgs); diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java index 43e26171e..55bdbcff6 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java @@ -47,29 +47,29 @@ public class NEWTGraphUI2pActivity extends NewtBaseActivity { static String TAG = "NEWTGraphUIActivity"; @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { Log.d(TAG, "onCreate - 0"); super.onCreate(savedInstanceState); // create GLWindow (-> incl. underlying NEWT Display, Screen & Window) - GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2)); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2)); caps.setAlphaBits(4); Log.d(TAG, "req caps: "+caps); - GLWindow glWindow = GLWindow.create(caps); + final GLWindow glWindow = GLWindow.create(caps); glWindow.setFullscreen(true); setContentView(getWindow(), glWindow); glWindow.addGLEventListener(new GPUUISceneGLListener0A(Region.VBAA_RENDERING_BIT)); glWindow.getScreen().addMonitorModeListener(new MonitorModeListener() { @Override - public void monitorModeChangeNotify(MonitorEvent me) { } + public void monitorModeChangeNotify(final MonitorEvent me) { } @Override - public void monitorModeChanged(MonitorEvent me, boolean success) { + public void monitorModeChanged(final MonitorEvent me, final boolean success) { System.err.println("MonitorMode Changed (success "+success+"): "+me); } }); glWindow.setVisible(true); - Animator animator = new Animator(glWindow); + final Animator animator = new Animator(glWindow); animator.setUpdateFPSFrames(60, System.err); animator.resetFPSCounter(); diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivityLauncher.java index 501d42566..09e500b36 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivityLauncher.java @@ -7,16 +7,16 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class NEWTGraphUI2pActivityLauncher extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.NEWTGraphUI2pActivity"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; - + @Override public void init() { - final OrderedProperties props = getProperties(); + final OrderedProperties props = getProperties(); // props.setProperty("jogamp.debug.JNILibLoader", "true"); // props.setProperty("jogamp.debug.NativeLibrary", "true"); // properties.setProperty("jogamp.debug.NativeLibrary.Lookup", "true"); - // properties.setProperty("jogamp.debug.IOUtil", "true"); + // properties.setProperty("jogamp.debug.IOUtil", "true"); // properties.setProperty("nativewindow.debug", "all"); props.setProperty("nativewindow.debug.GraphicsConfiguration", "true"); // properties.setProperty("jogl.debug", "all"); @@ -24,7 +24,7 @@ public class NEWTGraphUI2pActivityLauncher extends LauncherUtil.BaseActivityLaun props.setProperty("jogl.debug.GLDrawable", "true"); props.setProperty("jogl.debug.GLContext", "true"); props.setProperty("jogl.debug.GLSLCode", "true"); - props.setProperty("jogl.debug.CapabilitiesChooser", "true"); + props.setProperty("jogl.debug.CapabilitiesChooser", "true"); // properties.setProperty("jogl.debug.GLSLState", "true"); // properties.setProperty("jogl.debug.DebugGL", "true"); // properties.setProperty("jogl.debug.TraceGL", "true"); @@ -33,17 +33,17 @@ public class NEWTGraphUI2pActivityLauncher extends LauncherUtil.BaseActivityLaun // properties.setProperty("newt.debug.Window.MouseEvent", "true"); // properties.setProperty("newt.debug.Window.KeyEvent", "true"); } - + @Override public String getActivityName() { return demo; } - + @Override public List getSysPackages() { return Arrays.asList(sys_pkgs); } - + @Override public List getUsrPackages() { return Arrays.asList(usr_pkgs); diff --git a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1Activity.java index 08fbf643d..f256f98a9 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1Activity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1Activity.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -44,34 +44,34 @@ import android.util.Log; public class NEWTRedSquareES1Activity extends NewtBaseActivity { static String TAG = "NEWTGearsES1Activity"; - + @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { Log.d(TAG, "onCreate - 0"); super.onCreate(savedInstanceState); - + // create GLWindow (-> incl. underlying NEWT Display, Screen & Window) - GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES1)); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES1)); Log.d(TAG, "req caps: "+caps); - GLWindow glWindow = GLWindow.create(caps); + final GLWindow glWindow = GLWindow.create(caps); setContentView(getWindow(), glWindow); - + glWindow.addGLEventListener(new RedSquareES1(-1)); glWindow.getScreen().addMonitorModeListener(new MonitorModeListener() { @Override - public void monitorModeChangeNotify(MonitorEvent me) { } + public void monitorModeChangeNotify(final MonitorEvent me) { } @Override - public void monitorModeChanged(MonitorEvent me, boolean success) { + public void monitorModeChanged(final MonitorEvent me, final boolean success) { System.err.println("MonitorMode Changed (success "+success+"): "+me); } }); glWindow.setVisible(true); - Animator animator = new Animator(glWindow); - + final Animator animator = new Animator(glWindow); + animator.setUpdateFPSFrames(60, System.err); animator.resetFPSCounter(); glWindow.resetFPSCounter(); - + Log.d(TAG, "onCreate - X"); - } + } } diff --git a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1ActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1ActivityLauncher.java index 59bf5ceee..4b5a05f37 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1ActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1ActivityLauncher.java @@ -7,16 +7,16 @@ import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties; public class NEWTRedSquareES1ActivityLauncher extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.opengl.test.android.NEWTRedSquareES1Activity"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "javax.media.opengl" }; static String[] usr_pkgs = new String[] { "com.jogamp.opengl.test" }; - + @Override public void init() { - final OrderedProperties props = getProperties(); + final OrderedProperties props = getProperties(); // props.setProperty("jogamp.debug.JNILibLoader", "true"); // props.setProperty("jogamp.debug.NativeLibrary", "true"); // properties.setProperty("jogamp.debug.NativeLibrary.Lookup", "true"); - // properties.setProperty("jogamp.debug.IOUtil", "true"); + // properties.setProperty("jogamp.debug.IOUtil", "true"); // properties.setProperty("nativewindow.debug", "all"); props.setProperty("nativewindow.debug.GraphicsConfiguration", "true"); // properties.setProperty("jogl.debug", "all"); @@ -24,7 +24,7 @@ public class NEWTRedSquareES1ActivityLauncher extends LauncherUtil.BaseActivityL props.setProperty("jogl.debug.GLDrawable", "true"); props.setProperty("jogl.debug.GLContext", "true"); props.setProperty("jogl.debug.GLSLCode", "true"); - props.setProperty("jogl.debug.CapabilitiesChooser", "true"); + props.setProperty("jogl.debug.CapabilitiesChooser", "true"); // properties.setProperty("jogl.debug.GLSLState", "true"); // properties.setProperty("jogl.debug.DebugGL", "true"); // properties.setProperty("jogl.debug.TraceGL", "true"); @@ -33,17 +33,17 @@ public class NEWTRedSquareES1ActivityLauncher extends LauncherUtil.BaseActivityL // properties.setProperty("newt.debug.Window.MouseEvent", "true"); // properties.setProperty("newt.debug.Window.KeyEvent", "true"); } - + @Override public String getActivityName() { return demo; } - + @Override public List getSysPackages() { return Arrays.asList(sys_pkgs); } - + @Override public List getUsrPackages() { return Arrays.asList(usr_pkgs); diff --git a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java index 75ae94e89..99c65d6ad 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -44,56 +44,56 @@ import android.util.Log; public class NEWTRedSquareES2Activity extends NewtBaseActivity { static String TAG = "NEWTGearsES2Activity"; - + @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { Log.d(TAG, "onCreate - 0"); super.onCreate(savedInstanceState); - + // create GLWindow (-> incl. underlying NEWT Display, Screen & Window) - GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2)); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2)); Log.d(TAG, "req caps: "+caps); - GLWindow glWindow = GLWindow.create(caps); + final GLWindow glWindow = GLWindow.create(caps); // glWindow.setSize(200, 200); // glWindow.setUndecorated(true); - glWindow.setFullscreen(true); + glWindow.setFullscreen(true); setContentView(getWindow(), glWindow); - + final RedSquareES2 demo = new RedSquareES2(-1); // demo.enableAndroidTrace(true); glWindow.addGLEventListener(demo); glWindow.getScreen().addMonitorModeListener(new MonitorModeListener() { @Override - public void monitorModeChangeNotify(MonitorEvent me) { } + public void monitorModeChangeNotify(final MonitorEvent me) { } @Override - public void monitorModeChanged(MonitorEvent me, boolean success) { + public void monitorModeChanged(final MonitorEvent me, final boolean success) { System.err.println("MonitorMode Changed (success "+success+"): "+me); } }); - Animator animator = new Animator(glWindow); + final Animator animator = new Animator(glWindow); // animator.setRunAsFastAsPossible(true); // glWindow.setSkipContextReleaseThread(animator.getThread()); glWindow.setVisible(true); - + animator.setUpdateFPSFrames(60, System.err); animator.resetFPSCounter(); glWindow.resetFPSCounter(); - + Log.d(TAG, "onCreate - X"); } - + @Override public void onResume() { // android.os.Debug.startMethodTracing("GearsES2.trace"); - // android.os.Debug.startAllocCounting(); + // android.os.Debug.startAllocCounting(); super.onResume(); } - + @Override public void onPause() { // android.os.Debug.stopAllocCounting(); // android.os.Debug.stopMethodTracing(); - super.onPause(); + super.onPause(); } - + } diff --git a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2ActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2ActivityLauncher.java index a631eab8e..40cb4bfb5 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2ActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2ActivityLauncher.java @@ -8,14 +8,14 @@ import android.util.Log; public class NEWTRedSquareES2ActivityLauncher extends Activity { @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); - + final Uri uri = Uri.parse("launch://jogamp.org/com.jogamp.opengl.test.android.NEWTRedSquareES2Activity?sys=com.jogamp.common&sys=javax.media.opengl&pkg=com.jogamp.opengl.test"); - final Intent intent = new Intent("org.jogamp.launcher.action.LAUNCH_ACTIVITY_NORMAL", uri); + final Intent intent = new Intent("org.jogamp.launcher.action.LAUNCH_ACTIVITY_NORMAL", uri); Log.d(getClass().getSimpleName(), "Launching Activity: "+intent); startActivity (intent); - + finish(); // done - } + } } diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug427GLJPanelTest1.java b/src/test/com/jogamp/opengl/test/bugs/Bug427GLJPanelTest1.java index 66889e9ed..9136b4e61 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Bug427GLJPanelTest1.java +++ b/src/test/com/jogamp/opengl/test/bugs/Bug427GLJPanelTest1.java @@ -1,9 +1,12 @@ package com.jogamp.opengl.test.bugs; import javax.swing.*; + import java.awt.*; + import javax.media.opengl.*; import javax.media.opengl.awt.*; +import javax.media.opengl.fixedfunc.GLMatrixFunc; public class Bug427GLJPanelTest1 extends JFrame implements GLEventListener { @@ -20,35 +23,35 @@ public class Bug427GLJPanelTest1 extends JFrame implements GLEventListener { setLocation(40, 40); setVisible(true); } } ); - } catch(Exception ex) { + } catch(final Exception ex) { throw new RuntimeException(ex); } - GLProfile glp = GLProfile.get(GLProfile.GL2); - GLCapabilities caps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.get(GLProfile.GL2); + final GLCapabilities caps = new GLCapabilities(glp); caps.setDoubleBuffered(true); caps.setHardwareAccelerated(true); - GLJPanel panel = new GLJPanel(caps); + final GLJPanel panel = new GLJPanel(caps); panel.addGLEventListener(this); add(panel, BorderLayout.CENTER); } - public static void main(String[] args) { + public static void main(final String[] args) { final Bug427GLJPanelTest1 demo = new Bug427GLJPanelTest1(); try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { demo.setVisible(true); } } ); - } catch(Exception ex) { + } catch(final Exception ex) { throw new RuntimeException(ex); } } - public void display(GLAutoDrawable drawable) { - GL2 gl = drawable.getGL().getGL2(); + public void display(final GLAutoDrawable drawable) { + final GL2 gl = drawable.getGL().getGL2(); gl.glClear(GL.GL_COLOR_BUFFER_BIT); gl.glBegin(GL.GL_TRIANGLES); @@ -66,21 +69,21 @@ public class Bug427GLJPanelTest1 extends JFrame implements GLEventListener { gl.glFlush(); } - public void init(GLAutoDrawable drawable) { - GL2 gl = drawable.getGL().getGL2(); + public void init(final GLAutoDrawable drawable) { + final GL2 gl = drawable.getGL().getGL2(); gl.glClearColor(0, 0, 0, 0); - gl.glMatrixMode(GL2.GL_PROJECTION); + gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); gl.glOrtho(0, 1, 0, 1, -1, 1); } - public void reshape(GLAutoDrawable glDrawable, int x, int y, int w, int h) { + public void reshape(final GLAutoDrawable glDrawable, final int x, final int y, final int w, final int h) { } - public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) { + public void displayChanged(final GLAutoDrawable drawable, final boolean modeChanged, final boolean deviceChanged) { } - - public void dispose(GLAutoDrawable drawable) { + + public void dispose(final GLAutoDrawable drawable) { } } diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java index f443459c3..7b8313b7f 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java +++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java @@ -49,15 +49,15 @@ import com.jogamp.opengl.util.glsl.ShaderState; public class Bug735Inv0AppletAWT extends Applet implements Runnable { static public int AWT = 0; static public int NEWT = 1; - + static public int APPLET_WIDTH = 500; static public int APPLET_HEIGHT = 290; static public int TARGET_FPS = 120; static public int TOOLKIT = NEWT; static public boolean MANUAL_FRAME_HANDLING = true; - + ////////////////////////////////////////////////////////////////////////////// - + static private Frame frame; static private Bug735Inv0AppletAWT applet; private GLCanvas awtCanvas; @@ -66,52 +66,52 @@ public class Bug735Inv0AppletAWT extends Applet implements Runnable { private DrawRunnable drawRunnable; private GLContext context; private GLU glu; - + private int width; private int height; private Thread thread; - + private boolean doneInit = false; private boolean doneSetup = false; - - private long frameRatePeriod = 1000000000L / TARGET_FPS; + + private final long frameRatePeriod = 1000000000L / TARGET_FPS; private long millisOffset; private int frameCount; private float frameRate; - + private ShaderCode vertShader; private ShaderCode fragShader; private ShaderProgram shaderProg; private ShaderState shaderState; private GLUniformData resolution; - private GLUniformData time; - private GLArrayDataServer vertices; - - private int fcount = 0, lastm = 0; - private int fint = 1; - + private GLUniformData time; + private GLArrayDataServer vertices; + + private int fcount = 0, lastm = 0; + private final int fint = 1; + public void init() { setSize(APPLET_WIDTH, APPLET_HEIGHT); setPreferredSize(new Dimension(APPLET_WIDTH, APPLET_HEIGHT)); width = APPLET_WIDTH; height = APPLET_HEIGHT; } - + public void start() { thread = new Thread(this, "Animation Thread"); - thread.start(); + thread.start(); } - - public void run() { + + public void run() { int noDelays = 0; // Number of frames with a delay of 0 ms before the // animation thread yields to other running threads. final int NO_DELAYS_PER_YIELD = 15; final int TIMEOUT_SECONDS = 2; - + long beforeTime = System.nanoTime(); long overSleepTime = 0L; - + millisOffset = System.currentTimeMillis(); frameCount = 1; while (Thread.currentThread() == thread) { @@ -119,26 +119,26 @@ public class Bug735Inv0AppletAWT extends Applet implements Runnable { requestDraw(latch); try { latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } - + if (frameCount == 1) { EventQueue.invokeLater(new Runnable() { public void run() { requestFocusInWindow(); } }); - } - - long afterTime = System.nanoTime(); - long timeDiff = afterTime - beforeTime; - long sleepTime = (frameRatePeriod - timeDiff) - overSleepTime; + } + + final long afterTime = System.nanoTime(); + final long timeDiff = afterTime - beforeTime; + final long sleepTime = (frameRatePeriod - timeDiff) - overSleepTime; if (sleepTime > 0) { // some time left in this cycle try { Thread.sleep(sleepTime / 1000000L, (int) (sleepTime % 1000000L)); noDelays = 0; // Got some sleep, not delaying anymore - } catch (InterruptedException ex) { } + } catch (final InterruptedException ex) { } overSleepTime = (System.nanoTime() - afterTime) - sleepTime; } else { // sleepTime <= 0; the frame took longer than the period overSleepTime = 0L; @@ -147,54 +147,54 @@ public class Bug735Inv0AppletAWT extends Applet implements Runnable { Thread.yield(); // give another thread a chance to run noDelays = 0; } - } + } beforeTime = System.nanoTime(); } } - - public void requestDraw(CountDownLatch latch) { + + public void requestDraw(final CountDownLatch latch) { if (!doneInit) { initDraw(); } - - if (TOOLKIT == AWT) { - awtCanvas.invoke(true, drawRunnable); - } else if (TOOLKIT == NEWT) { - newtWindow.invoke(true, drawRunnable); + + if (TOOLKIT == AWT) { + awtCanvas.invoke(true, drawRunnable); + } else if (TOOLKIT == NEWT) { + newtWindow.invoke(true, drawRunnable); } - + if (latch != null) { latch.countDown(); - } + } } - + private class DrawRunnable implements GLRunnable { private boolean notCurrent; - + @Override - public boolean run(GLAutoDrawable drawable) { + public boolean run(final GLAutoDrawable drawable) { if (MANUAL_FRAME_HANDLING) { - makeContextCurrent(); + makeContextCurrent(); } - + if (doneSetup) { draw(drawable.getGL().getGL2ES2()); } else { setup(drawable.getGL().getGL2ES2()); - } + } checkGLErrors(drawable.getGL()); - + if (MANUAL_FRAME_HANDLING) { swapBuffers(); releaseCurrentContext(); } - + return true; } - + private void makeContextCurrent() { - int MAX_CONTEXT_GRAB_ATTEMPTS = 10; - + final int MAX_CONTEXT_GRAB_ATTEMPTS = 10; + if (context.isCurrent()) { notCurrent = false; } else { @@ -218,17 +218,17 @@ public class Bug735Inv0AppletAWT extends Applet implements Runnable { } catch (final InterruptedException e) { e.printStackTrace(); } - + } while (value == GLContext.CONTEXT_NOT_CURRENT); - } + } } - + private void swapBuffers() { final GL gl = GLContext.getCurrentGL(); gl.glFlush(); - GLContext.getCurrent().getGLDrawable().swapBuffers(); + GLContext.getCurrent().getGLDrawable().swapBuffers(); } - + private void releaseCurrentContext() { if (notCurrent) { try { @@ -237,31 +237,31 @@ public class Bug735Inv0AppletAWT extends Applet implements Runnable { } catch (final GLException gle) { gle.printStackTrace(); } - } + } } } - + private void initGL() { - GLProfile profile = GLProfile.getDefault(); - GLCapabilities caps = new GLCapabilities(profile); + final GLProfile profile = GLProfile.getDefault(); + final GLCapabilities caps = new GLCapabilities(profile); caps.setBackgroundOpaque(true); caps.setOnscreen(true); caps.setSampleBuffers(false); - + if (TOOLKIT == AWT) { awtCanvas = new GLCanvas(caps); awtCanvas.setBounds(0, 0, applet.width, applet.height); awtCanvas.setBackground(new Color(0xFFCCCCCC, true)); - awtCanvas.setFocusable(true); - + awtCanvas.setFocusable(true); + applet.setLayout(new BorderLayout()); applet.add(awtCanvas, BorderLayout.CENTER); - + if (MANUAL_FRAME_HANDLING) { awtCanvas.setIgnoreRepaint(true); - awtCanvas.setAutoSwapBufferMode(false); + awtCanvas.setAutoSwapBufferMode(false); } - } else if (TOOLKIT == NEWT) { + } else if (TOOLKIT == NEWT) { newtWindow = GLWindow.create(caps); newtCanvas = new NewtCanvasAWT(newtWindow); newtCanvas.setBounds(0, 0, applet.width, applet.height); @@ -270,14 +270,14 @@ public class Bug735Inv0AppletAWT extends Applet implements Runnable { applet.setLayout(new BorderLayout()); applet.add(newtCanvas, BorderLayout.CENTER); - + if (MANUAL_FRAME_HANDLING) { newtCanvas.setIgnoreRepaint(true); - newtWindow.setAutoSwapBufferMode(false); + newtWindow.setAutoSwapBufferMode(false); } } } - + private void initDraw() { if (TOOLKIT == AWT) { awtCanvas.setVisible(true); @@ -287,7 +287,7 @@ public class Bug735Inv0AppletAWT extends Applet implements Runnable { // Request the focus here as it cannot work when the window is not visible awtCanvas.requestFocus(); context = awtCanvas.getContext(); - } + } } else if (TOOLKIT == NEWT) { newtCanvas.setVisible(true); // Force the realization @@ -298,37 +298,37 @@ public class Bug735Inv0AppletAWT extends Applet implements Runnable { context = newtWindow.getContext(); } } - + drawRunnable = new DrawRunnable(); - + doneInit = true; } - - private void setup(GL2ES2 gl) { + + private void setup(final GL2ES2 gl) { if (60 < TARGET_FPS) { // Disables vsync - gl.setSwapInterval(0); + gl.setSwapInterval(0); } glu = new GLU(); - + vertShader = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, LandscapeES2.class, "shader", "shader/bin", "landscape", true); fragShader = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, LandscapeES2.class, "shader", "shader/bin", "landscape", true); vertShader.defaultShaderCustomization(gl, true, true); fragShader.defaultShaderCustomization(gl, true, true); shaderProg = new ShaderProgram(); shaderProg.add(gl, vertShader, System.err); - shaderProg.add(gl, fragShader, System.err); - + shaderProg.add(gl, fragShader, System.err); + shaderState = new ShaderState(); shaderState.attachShaderProgram(gl, shaderProg, true); - + resolution = new GLUniformData("iResolution", 3, FloatBuffer.wrap(new float[] {width, height, 0})); shaderState.ownUniform(resolution); - shaderState.uniform(gl, resolution); - + shaderState.uniform(gl, resolution); + time = new GLUniformData("iGlobalTime", 0.0f); shaderState.ownUniform(time); - + vertices = GLArrayDataServer.createGLSL("inVertex", 2, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); vertices.putf(-1.0f); vertices.putf(-1.0f); vertices.putf(+1.0f); vertices.putf(-1.0f); @@ -337,94 +337,94 @@ public class Bug735Inv0AppletAWT extends Applet implements Runnable { vertices.seal(gl, true); shaderState.ownAttribute(vertices, true); shaderState.useProgram(gl, false); - + doneSetup = true; } - private void draw(GL2ES2 gl) { + private void draw(final GL2ES2 gl) { // gl.glClearColor(0.5f, 0.1f, 0.1f, 1); // gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT); - - shaderState.useProgram(gl, true); - + + shaderState.useProgram(gl, true); + time.setData((System.currentTimeMillis() - millisOffset) / 1000.0f); shaderState.uniform(gl, time); vertices.enableBuffer(gl, true); - gl.glDrawArrays(GL2ES2.GL_TRIANGLE_STRIP, 0, 4); + gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4); vertices.enableBuffer(gl, false); - + shaderState.useProgram(gl, false); - + // Compute current framerate and printout. - frameCount++; + frameCount++; fcount += 1; - int m = (int) (System.currentTimeMillis() - millisOffset); + final int m = (int) (System.currentTimeMillis() - millisOffset); if (m - lastm > 1000 * fint) { frameRate = (float)(fcount) / fint; fcount = 0; lastm = m; - } + } if (frameCount % TARGET_FPS == 0) { - System.out.println("FrameCount: " + frameCount + " - " + + System.out.println("FrameCount: " + frameCount + " - " + "FrameRate: " + frameRate); - } - } - - private void checkGLErrors(GL gl) { - int err = gl.glGetError(); + } + } + + private void checkGLErrors(final GL gl) { + final int err = gl.glGetError(); if (err != 0) { - String errString = glu.gluErrorString(err); + final String errString = glu.gluErrorString(err); System.out.println(errString); - } + } } - - static public void main(String[] args) { - GraphicsEnvironment environment = + + static public void main(final String[] args) { + final GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment(); - GraphicsDevice displayDevice = environment.getDefaultScreenDevice(); + final GraphicsDevice displayDevice = environment.getDefaultScreenDevice(); frame = new Frame(displayDevice.getDefaultConfiguration()); frame.setBackground(new Color(0xCC, 0xCC, 0xCC)); frame.setTitle("TestBug735Inv0AppletAWT"); - + try { - Class c = Thread.currentThread().getContextClassLoader(). + final Class c = Thread.currentThread().getContextClassLoader(). loadClass(Bug735Inv0AppletAWT.class.getName()); applet = (Bug735Inv0AppletAWT) c.newInstance(); - } catch (Exception e) { + } catch (final Exception e) { throw new RuntimeException(e); - } - + } + frame.setLayout(null); frame.add(applet); frame.pack(); frame.setResizable(false); - + applet.init(); - - Insets insets = frame.getInsets(); - int windowW = applet.width + insets.left + insets.right; - int windowH = applet.height + insets.top + insets.bottom; - frame.setSize(windowW, windowH); - - Rectangle screenRect = displayDevice.getDefaultConfiguration().getBounds(); + + final Insets insets = frame.getInsets(); + final int windowW = applet.width + insets.left + insets.right; + final int windowH = applet.height + insets.top + insets.bottom; + frame.setSize(windowW, windowH); + + final Rectangle screenRect = displayDevice.getDefaultConfiguration().getBounds(); frame.setLocation(screenRect.x + (screenRect.width - applet.width) / 2, - screenRect.y + (screenRect.height - applet.height) / 2); - - int usableWindowH = windowH - insets.top - insets.bottom; + screenRect.y + (screenRect.height - applet.height) / 2); + + final int usableWindowH = windowH - insets.top - insets.bottom; applet.setBounds((windowW - applet.width)/2, insets.top + (usableWindowH - applet.height)/2, applet.width, applet.height); - + // This allows to close the frame. frame.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { + public void windowClosing(final WindowEvent e) { System.exit(0); } }); - + applet.initGL(); frame.setVisible(true); - applet.start(); + applet.start(); } } diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java index e8cef5e16..377f5e7ef 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java +++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java @@ -51,15 +51,15 @@ import com.jogamp.opengl.util.glsl.ShaderState; public class Bug735Inv1AppletAWT extends Applet implements Runnable { static public int AWT = 0; static public int NEWT = 1; - + static public int APPLET_WIDTH = 500; static public int APPLET_HEIGHT = 290; static public int TARGET_FPS = 120; static public int TOOLKIT = NEWT; static public boolean MANUAL_FRAME_HANDLING = true; - + ////////////////////////////////////////////////////////////////////////////// - + static private Frame frame; static private Bug735Inv1AppletAWT applet; private GLCanvas awtCanvas; @@ -68,52 +68,52 @@ public class Bug735Inv1AppletAWT extends Applet implements Runnable { private DrawRunnable drawRunnable; // JAU private GLContext context; private GLU glu; - + private int width; private int height; private Thread thread; - + private boolean doneInit = false; private boolean doneSetup = false; - - private long frameRatePeriod = 1000000000L / TARGET_FPS; + + private final long frameRatePeriod = 1000000000L / TARGET_FPS; private long millisOffset; private int frameCount; private float frameRate; - + private ShaderCode vertShader; private ShaderCode fragShader; private ShaderProgram shaderProg; private ShaderState shaderState; private GLUniformData resolution; - private GLUniformData time; - private GLArrayDataServer vertices; - - private int fcount = 0, lastm = 0; - private int fint = 1; - + private GLUniformData time; + private GLArrayDataServer vertices; + + private int fcount = 0, lastm = 0; + private final int fint = 1; + public void init() { setSize(APPLET_WIDTH, APPLET_HEIGHT); setPreferredSize(new Dimension(APPLET_WIDTH, APPLET_HEIGHT)); width = APPLET_WIDTH; height = APPLET_HEIGHT; } - + public void start() { thread = new Thread(this, "Animation Thread"); - thread.start(); + thread.start(); } - - public void run() { + + public void run() { int noDelays = 0; // Number of frames with a delay of 0 ms before the // animation thread yields to other running threads. final int NO_DELAYS_PER_YIELD = 15; final int TIMEOUT_SECONDS = 2; - + long beforeTime = System.nanoTime(); long overSleepTime = 0L; - + millisOffset = System.currentTimeMillis(); frameCount = 1; while (Thread.currentThread() == thread) { @@ -121,26 +121,26 @@ public class Bug735Inv1AppletAWT extends Applet implements Runnable { requestDraw(latch); try { latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } - + if (frameCount == 1) { EventQueue.invokeLater(new Runnable() { public void run() { requestFocusInWindow(); } }); - } - - long afterTime = System.nanoTime(); - long timeDiff = afterTime - beforeTime; - long sleepTime = (frameRatePeriod - timeDiff) - overSleepTime; + } + + final long afterTime = System.nanoTime(); + final long timeDiff = afterTime - beforeTime; + final long sleepTime = (frameRatePeriod - timeDiff) - overSleepTime; if (sleepTime > 0) { // some time left in this cycle try { Thread.sleep(sleepTime / 1000000L, (int) (sleepTime % 1000000L)); noDelays = 0; // Got some sleep, not delaying anymore - } catch (InterruptedException ex) { } + } catch (final InterruptedException ex) { } overSleepTime = (System.nanoTime() - afterTime) - sleepTime; } else { // sleepTime <= 0; the frame took longer than the period overSleepTime = 0L; @@ -149,53 +149,53 @@ public class Bug735Inv1AppletAWT extends Applet implements Runnable { Thread.yield(); // give another thread a chance to run noDelays = 0; } - } + } beforeTime = System.nanoTime(); } } - - public void requestDraw(CountDownLatch latch) { + + public void requestDraw(final CountDownLatch latch) { if (!doneInit) { initDraw(); } - - if (TOOLKIT == AWT) { - awtCanvas.invoke(true, drawRunnable); - } else if (TOOLKIT == NEWT) { - newtWindow.invoke(true, drawRunnable); + + if (TOOLKIT == AWT) { + awtCanvas.invoke(true, drawRunnable); + } else if (TOOLKIT == NEWT) { + newtWindow.invoke(true, drawRunnable); } - + if (latch != null) { latch.countDown(); - } + } } - + private class DrawRunnable implements GLRunnable { private boolean notCurrent; - + @Override - public boolean run(GLAutoDrawable drawable) { + public boolean run(final GLAutoDrawable drawable) { if (MANUAL_FRAME_HANDLING) { - makeContextCurrent(drawable.getContext()); + makeContextCurrent(drawable.getContext()); } - + if (!doneSetup) { setup(drawable.getGL().getGL2ES2()); } draw(drawable.getGL().getGL2ES2()); checkGLErrors(drawable.getGL()); - + if (MANUAL_FRAME_HANDLING) { swapBuffers(drawable.getContext()); releaseCurrentContext(drawable.getContext()); } - + return true; } - - private void makeContextCurrent(GLContext context) { - int MAX_CONTEXT_GRAB_ATTEMPTS = 10; - + + private void makeContextCurrent(final GLContext context) { + final int MAX_CONTEXT_GRAB_ATTEMPTS = 10; + if (context.isCurrent()) { notCurrent = false; } else { @@ -219,18 +219,18 @@ public class Bug735Inv1AppletAWT extends Applet implements Runnable { } catch (final InterruptedException e) { e.printStackTrace(); } - + } while (value == GLContext.CONTEXT_NOT_CURRENT); - } + } } - - private void swapBuffers(GLContext context) { + + private void swapBuffers(final GLContext context) { final GL gl = context.getGL(); gl.glFlush(); - context.getGLDrawable().swapBuffers(); + context.getGLDrawable().swapBuffers(); } - - private void releaseCurrentContext(GLContext context) { + + private void releaseCurrentContext(final GLContext context) { if (notCurrent) { try { context.release(); @@ -238,31 +238,31 @@ public class Bug735Inv1AppletAWT extends Applet implements Runnable { } catch (final GLException gle) { gle.printStackTrace(); } - } + } } } - + private void initGL() { - GLProfile profile = GLProfile.getDefault(); - GLCapabilities caps = new GLCapabilities(profile); + final GLProfile profile = GLProfile.getDefault(); + final GLCapabilities caps = new GLCapabilities(profile); caps.setBackgroundOpaque(true); caps.setOnscreen(true); caps.setSampleBuffers(false); - + if (TOOLKIT == AWT) { awtCanvas = new GLCanvas(caps); awtCanvas.setBounds(0, 0, applet.width, applet.height); awtCanvas.setBackground(new Color(0xFFCCCCCC, true)); - awtCanvas.setFocusable(true); - + awtCanvas.setFocusable(true); + applet.setLayout(new BorderLayout()); applet.add(awtCanvas, BorderLayout.CENTER); - + if (MANUAL_FRAME_HANDLING) { awtCanvas.setIgnoreRepaint(true); - awtCanvas.setAutoSwapBufferMode(false); + awtCanvas.setAutoSwapBufferMode(false); } - } else if (TOOLKIT == NEWT) { + } else if (TOOLKIT == NEWT) { newtWindow = GLWindow.create(caps); newtCanvas = new NewtCanvasAWT(newtWindow); newtCanvas.setBounds(0, 0, applet.width, applet.height); @@ -271,14 +271,14 @@ public class Bug735Inv1AppletAWT extends Applet implements Runnable { applet.setLayout(new BorderLayout()); applet.add(newtCanvas, BorderLayout.CENTER); - + if (MANUAL_FRAME_HANDLING) { newtCanvas.setIgnoreRepaint(true); - newtWindow.setAutoSwapBufferMode(false); + newtWindow.setAutoSwapBufferMode(false); } } } - + private void initDraw() { if (TOOLKIT == AWT) { awtCanvas.setVisible(true); @@ -287,7 +287,7 @@ public class Bug735Inv1AppletAWT extends Applet implements Runnable { if (awtCanvas.getDelegatedDrawable().isRealized()) { // Request the focus here as it cannot work when the window is not visible awtCanvas.requestFocus(); - } + } } else if (TOOLKIT == NEWT) { newtCanvas.setVisible(true); // Force the realization @@ -297,37 +297,37 @@ public class Bug735Inv1AppletAWT extends Applet implements Runnable { newtCanvas.requestFocus(); } } - + drawRunnable = new DrawRunnable(); - + doneInit = true; } - - private void setup(GL2ES2 gl) { + + private void setup(final GL2ES2 gl) { if (60 < TARGET_FPS) { // Disables vsync - gl.setSwapInterval(0); - } + gl.setSwapInterval(0); + } glu = new GLU(); - + vertShader = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, LandscapeES2.class, "shader", "shader/bin", "landscape", true); fragShader = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, LandscapeES2.class, "shader", "shader/bin", "landscape", true); vertShader.defaultShaderCustomization(gl, true, true); fragShader.defaultShaderCustomization(gl, true, true); shaderProg = new ShaderProgram(); shaderProg.add(gl, vertShader, System.err); - shaderProg.add(gl, fragShader, System.err); - + shaderProg.add(gl, fragShader, System.err); + shaderState = new ShaderState(); shaderState.attachShaderProgram(gl, shaderProg, true); - + resolution = new GLUniformData("iResolution", 3, FloatBuffer.wrap(new float[] {width, height, 0})); shaderState.ownUniform(resolution); - shaderState.uniform(gl, resolution); - + shaderState.uniform(gl, resolution); + time = new GLUniformData("iGlobalTime", 0.0f); shaderState.ownUniform(time); - + vertices = GLArrayDataServer.createGLSL("inVertex", 2, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); vertices.putf(-1.0f); vertices.putf(-1.0f); vertices.putf(+1.0f); vertices.putf(-1.0f); @@ -336,94 +336,94 @@ public class Bug735Inv1AppletAWT extends Applet implements Runnable { vertices.seal(gl, true); shaderState.ownAttribute(vertices, true); shaderState.useProgram(gl, false); - + doneSetup = true; } - private void draw(GL2ES2 gl) { + private void draw(final GL2ES2 gl) { // gl.glClearColor(0.5f, 0.1f, 0.1f, 1); // gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT); - - shaderState.useProgram(gl, true); - + + shaderState.useProgram(gl, true); + time.setData((System.currentTimeMillis() - millisOffset) / 1000.0f); shaderState.uniform(gl, time); vertices.enableBuffer(gl, true); - gl.glDrawArrays(GL2ES2.GL_TRIANGLE_STRIP, 0, 4); + gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4); vertices.enableBuffer(gl, false); - + shaderState.useProgram(gl, false); - + // Compute current framerate and printout. - frameCount++; + frameCount++; fcount += 1; - int m = (int) (System.currentTimeMillis() - millisOffset); + final int m = (int) (System.currentTimeMillis() - millisOffset); if (m - lastm > 1000 * fint) { frameRate = (float)(fcount) / fint; fcount = 0; lastm = m; - } + } if (frameCount % TARGET_FPS == 0) { - System.out.println("FrameCount: " + frameCount + " - " + + System.out.println("FrameCount: " + frameCount + " - " + "FrameRate: " + frameRate); } - } - - private void checkGLErrors(GL gl) { - int err = gl.glGetError(); + } + + private void checkGLErrors(final GL gl) { + final int err = gl.glGetError(); if (err != 0) { - String errString = glu.gluErrorString(err); + final String errString = glu.gluErrorString(err); System.out.println(errString); - } + } } - - static public void main(String[] args) { - GraphicsEnvironment environment = + + static public void main(final String[] args) { + final GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment(); - GraphicsDevice displayDevice = environment.getDefaultScreenDevice(); + final GraphicsDevice displayDevice = environment.getDefaultScreenDevice(); frame = new Frame(displayDevice.getDefaultConfiguration()); frame.setBackground(new Color(0xCC, 0xCC, 0xCC)); frame.setTitle("TestBug735Inv1AppletAWT"); - + try { - Class c = Thread.currentThread().getContextClassLoader(). + final Class c = Thread.currentThread().getContextClassLoader(). loadClass(Bug735Inv1AppletAWT.class.getName()); applet = (Bug735Inv1AppletAWT) c.newInstance(); - } catch (Exception e) { + } catch (final Exception e) { throw new RuntimeException(e); - } - + } + frame.setLayout(null); frame.add(applet); frame.pack(); frame.setResizable(false); - + applet.init(); - - Insets insets = frame.getInsets(); - int windowW = applet.width + insets.left + insets.right; - int windowH = applet.height + insets.top + insets.bottom; - frame.setSize(windowW, windowH); - - Rectangle screenRect = displayDevice.getDefaultConfiguration().getBounds(); + + final Insets insets = frame.getInsets(); + final int windowW = applet.width + insets.left + insets.right; + final int windowH = applet.height + insets.top + insets.bottom; + frame.setSize(windowW, windowH); + + final Rectangle screenRect = displayDevice.getDefaultConfiguration().getBounds(); frame.setLocation(screenRect.x + (screenRect.width - applet.width) / 2, - screenRect.y + (screenRect.height - applet.height) / 2); - - int usableWindowH = windowH - insets.top - insets.bottom; + screenRect.y + (screenRect.height - applet.height) / 2); + + final int usableWindowH = windowH - insets.top - insets.bottom; applet.setBounds((windowW - applet.width)/2, insets.top + (usableWindowH - applet.height)/2, applet.width, applet.height); - + // This allows to close the frame. frame.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { + public void windowClosing(final WindowEvent e) { System.exit(0); } }); - + applet.initGL(); frame.setVisible(true); - applet.start(); + applet.start(); } } diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java index 6340d2b64..109bb1a42 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java +++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java @@ -33,7 +33,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase; * - Use GLEventListener * - Add GLEventListener to GLAutoDrawable * - Use GLAutoDrawable.display() instead of GLAutoDrawable.invoke(true, GLRunnable { init / render }) - * - Removed MANUAL_FRAME_HANDLING, obsolete due to GLAutoDrawable/GLEventListener + * - Removed MANUAL_FRAME_HANDLING, obsolete due to GLAutoDrawable/GLEventListener * * OSX Results: *
    @@ -45,7 +45,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
     public class Bug735Inv2AppletAWT extends Applet implements Runnable {
       static public int AWT  = 0;
       static public int NEWT = 1;
    -  
    +
       static public int APPLET_WIDTH  = 500;
       static public int APPLET_HEIGHT = 290;
       static public int TARGET_FPS    = 120;
    @@ -53,10 +53,10 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable {
       static public boolean IGNORE_AWT_REPAINT = false;
       static public boolean USE_ECT = false;
       static public int SWAP_INTERVAL = 1;
    -  
    +
       //////////////////////////////////////////////////////////////////////////////
    -  
    -  static boolean waitForKey = false;  
    +
    +  static boolean waitForKey = false;
       static private Frame frame;
       static private Bug735Inv2AppletAWT applet;
       private GLCanvas awtCanvas;
    @@ -64,14 +64,14 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable {
       private GLAutoDrawable glad;
       private NewtCanvasAWT newtCanvas;
       private GLEventListener demo;
    -  
    +
       private int width;
       private int height;
       private Thread thread;
    -  
    -  private long frameRatePeriod = 1000000000L / TARGET_FPS;
    +
    +  private final long frameRatePeriod = 1000000000L / TARGET_FPS;
       private int frameCount;
    -  
    +
       public void init() {
         setSize(APPLET_WIDTH, APPLET_HEIGHT);
         setPreferredSize(new Dimension(APPLET_WIDTH, APPLET_HEIGHT));
    @@ -79,23 +79,23 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable {
         height = APPLET_HEIGHT;
         initGL();
       }
    -  
    +
       public void start() {
         initDraw();
         thread = new Thread(this, "Animation Thread");
    -    thread.start();    
    +    thread.start();
       }
    -  
    -  public void run() {    
    +
    +  public void run() {
         int noDelays = 0;
         // Number of frames with a delay of 0 ms before the
         // animation thread yields to other running threads.
         final int NO_DELAYS_PER_YIELD = 15;
         final int TIMEOUT_SECONDS = 2;
    -    
    +
         long beforeTime = System.nanoTime();
         long overSleepTime = 0L;
    -    
    +
         frameCount = 1;
         while (Thread.currentThread() == thread) {
           if (frameCount == 1) {
    @@ -107,23 +107,23 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable {
             if( USE_ECT ) {
                 glad.setExclusiveContextThread(thread);
             }
    -      }      
    +      }
           final CountDownLatch latch = new CountDownLatch(1);
           requestDraw(latch);
           try {
             latch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS);
    -      } catch (InterruptedException e) {
    +      } catch (final InterruptedException e) {
             e.printStackTrace();
           }
    -            
    -      long afterTime = System.nanoTime();
    -      long timeDiff = afterTime - beforeTime;
    -      long sleepTime = (frameRatePeriod - timeDiff) - overSleepTime;      
    +
    +      final long afterTime = System.nanoTime();
    +      final long timeDiff = afterTime - beforeTime;
    +      final long sleepTime = (frameRatePeriod - timeDiff) - overSleepTime;
           if (sleepTime > 0) {  // some time left in this cycle
             try {
               Thread.sleep(sleepTime / 1000000L, (int) (sleepTime % 1000000L));
               noDelays = 0;  // Got some sleep, not delaying anymore
    -        } catch (InterruptedException ex) { }
    +        } catch (final InterruptedException ex) { }
             overSleepTime = (System.nanoTime() - afterTime) - sleepTime;
           } else {    // sleepTime <= 0; the frame took longer than the period
             overSleepTime = 0L;
    @@ -132,40 +132,40 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable {
               Thread.yield();   // give another thread a chance to run
               noDelays = 0;
             }
    -      }      
    +      }
           beforeTime = System.nanoTime();
         }
       }
    -  
    -  public void requestDraw(CountDownLatch latch) {
    +
    +  public void requestDraw(final CountDownLatch latch) {
         glad.display();
     
         if (latch != null) {
           latch.countDown();
    -    }    
    +    }
       }
    -  
    +
       private void initGL() {
    -    GLProfile profile = GLProfile.getDefault();
    -    GLCapabilities caps = new GLCapabilities(profile);
    +    final GLProfile profile = GLProfile.getDefault();
    +    final GLCapabilities caps = new GLCapabilities(profile);
         caps.setBackgroundOpaque(true);
         caps.setOnscreen(true);
         caps.setSampleBuffers(false);
    -    
    +
         if (TOOLKIT == AWT) {
           awtCanvas = new GLCanvas(caps);
           awtCanvas.setBounds(0, 0, applet.width, applet.height);
           awtCanvas.setBackground(new Color(0xFFCCCCCC, true));
    -      awtCanvas.setFocusable(true); 
    -      
    +      awtCanvas.setFocusable(true);
    +
           applet.setLayout(new BorderLayout());
           applet.add(awtCanvas, BorderLayout.CENTER);
    -      
    +
           if (IGNORE_AWT_REPAINT) {
               awtCanvas.setIgnoreRepaint(true);
           }
           glad = awtCanvas;
    -    } else if (TOOLKIT == NEWT) {      
    +    } else if (TOOLKIT == NEWT) {
           newtWindow = GLWindow.create(caps);
           newtCanvas = new NewtCanvasAWT(newtWindow);
           newtCanvas.setBounds(0, 0, applet.width, applet.height);
    @@ -174,17 +174,17 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable {
     
           applet.setLayout(new BorderLayout());
           applet.add(newtCanvas, BorderLayout.CENTER);
    -      
    +
           if (IGNORE_AWT_REPAINT) {
             newtCanvas.setIgnoreRepaint(true);
           }
           glad = newtWindow;
         }
    -    
    +
         demo = new LandscapeES2(SWAP_INTERVAL);
         glad.addGLEventListener(demo);
       }
    -  
    +
       private void initDraw() {
         if (TOOLKIT == AWT) {
           awtCanvas.setVisible(true);
    @@ -193,7 +193,7 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable {
           if (awtCanvas.getDelegatedDrawable().isRealized()) {
             // Request the focus here as it cannot work when the window is not visible
             awtCanvas.requestFocus();
    -      }      
    +      }
         } else if (TOOLKIT == NEWT) {
           newtCanvas.setVisible(true);
           // Force the realization
    @@ -204,8 +204,8 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable {
           }
         }
       }
    -  
    -  static public void main(String[] args) {    
    +
    +  static public void main(final String[] args) {
         for(int i=0; i c = Thread.currentThread().getContextClassLoader().
    +      final Class c = Thread.currentThread().getContextClassLoader().
               loadClass(Bug735Inv2AppletAWT.class.getName());
           applet = (Bug735Inv2AppletAWT) c.newInstance();
    -    } catch (Exception e) {
    +    } catch (final Exception e) {
           throw new RuntimeException(e);
    -    }    
    -    
    +    }
    +
         frame.setLayout(null);
         frame.add(applet);
         frame.pack();
         frame.setResizable(false);
    -    
    +
         applet.init();
    -    
    -    Insets insets = frame.getInsets();
    -    int windowW = applet.width + insets.left + insets.right;
    -    int windowH = applet.height + insets.top + insets.bottom;
    -    frame.setSize(windowW, windowH);    
    -    
    -    Rectangle screenRect = displayDevice.getDefaultConfiguration().getBounds();    
    +
    +    final Insets insets = frame.getInsets();
    +    final int windowW = applet.width + insets.left + insets.right;
    +    final int windowH = applet.height + insets.top + insets.bottom;
    +    frame.setSize(windowW, windowH);
    +
    +    final Rectangle screenRect = displayDevice.getDefaultConfiguration().getBounds();
         frame.setLocation(screenRect.x + (screenRect.width - applet.width) / 2,
    -        screenRect.y + (screenRect.height - applet.height) / 2);    
    -    
    -    int usableWindowH = windowH - insets.top - insets.bottom;
    +        screenRect.y + (screenRect.height - applet.height) / 2);
    +
    +    final int usableWindowH = windowH - insets.top - insets.bottom;
         applet.setBounds((windowW - applet.width)/2,
                          insets.top + (usableWindowH - applet.height)/2,
                          applet.width, applet.height);
    -    
    +
         // This allows to close the frame.
         frame.addWindowListener(new WindowAdapter() {
    -      public void windowClosing(WindowEvent e) {
    +      public void windowClosing(final WindowEvent e) {
             System.exit(0);
           }
         });
    -        
    +
         frame.setVisible(true);
    -    applet.start();    
    +    applet.start();
       }
     }
    diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv3AppletAWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv3AppletAWT.java
    index 0a4c54046..883a40345 100644
    --- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv3AppletAWT.java
    +++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv3AppletAWT.java
    @@ -32,7 +32,7 @@ import com.jogamp.opengl.util.AnimatorBase;
      *   - Use GLEventListener
      *   - Add GLEventListener to GLAutoDrawable
      *   - Use GLAutoDrawable.display() instead of GLAutoDrawable.invoke(true, GLRunnable { init / render })
    - *   - Removed MANUAL_FRAME_HANDLING, obsolete due to GLAutoDrawable/GLEventListener 
    + *   - Removed MANUAL_FRAME_HANDLING, obsolete due to GLAutoDrawable/GLEventListener
      *   - Use Animator
      *   - Remove applet, component sizes, use frame based size via validate
      *   - Run frame validation/visibility on AWT-EDT
    @@ -48,17 +48,17 @@ import com.jogamp.opengl.util.AnimatorBase;
     public class Bug735Inv3AppletAWT extends Applet {
       static public int AWT  = 0;
       static public int NEWT = 1;
    -  
    +
       static public int APPLET_WIDTH  = 500;
       static public int APPLET_HEIGHT = 290;
       static public int TOOLKIT       = NEWT;
       static public boolean IGNORE_AWT_REPAINT = false;
       static public boolean USE_ECT = false;
       static public int SWAP_INTERVAL = 1;
    -  
    +
       //////////////////////////////////////////////////////////////////////////////
    -  
    -  static boolean waitForKey = false;  
    +
    +  static boolean waitForKey = false;
       static private Frame frame;
       static private Bug735Inv3AppletAWT applet;
       private GLCanvas awtCanvas;
    @@ -67,10 +67,10 @@ public class Bug735Inv3AppletAWT extends Applet {
       private NewtCanvasAWT newtCanvas;
       private GLEventListener demo;
       private AnimatorBase animator;
    -  
    +
       private int width;
       private int height;
    -  
    +
       public void init() {
         setSize(APPLET_WIDTH, APPLET_HEIGHT);
         // JAU setPreferredSize(new Dimension(APPLET_WIDTH, APPLET_HEIGHT));
    @@ -78,34 +78,34 @@ public class Bug735Inv3AppletAWT extends Applet {
         height = APPLET_HEIGHT;
         initGL();
       }
    -  
    +
       public void start() {
         initDraw();
         animator.start();
         animator.setUpdateFPSFrames(60, System.err);
       }
    -  
    +
       private void initGL() {
    -    GLProfile profile = GLProfile.getDefault();
    -    GLCapabilities caps = new GLCapabilities(profile);
    +    final GLProfile profile = GLProfile.getDefault();
    +    final GLCapabilities caps = new GLCapabilities(profile);
         caps.setBackgroundOpaque(true);
         caps.setOnscreen(true);
         caps.setSampleBuffers(false);
    -    
    +
         if (TOOLKIT == AWT) {
           awtCanvas = new GLCanvas(caps);
           // JAU awtCanvas.setBounds(0, 0, applet.width, applet.height);
           awtCanvas.setBackground(new Color(0xFFCCCCCC, true));
    -      awtCanvas.setFocusable(true); 
    -      
    +      awtCanvas.setFocusable(true);
    +
           applet.setLayout(new BorderLayout());
           applet.add(awtCanvas, BorderLayout.CENTER);
    -      
    +
           if (IGNORE_AWT_REPAINT) {
               awtCanvas.setIgnoreRepaint(true);
           }
           glad = awtCanvas;
    -    } else if (TOOLKIT == NEWT) {      
    +    } else if (TOOLKIT == NEWT) {
           newtWindow = GLWindow.create(caps);
           newtCanvas = new NewtCanvasAWT(newtWindow);
           // JAU newtCanvas.setBounds(0, 0, applet.width, applet.height);
    @@ -114,27 +114,27 @@ public class Bug735Inv3AppletAWT extends Applet {
     
           applet.setLayout(new BorderLayout());
           applet.add(newtCanvas, BorderLayout.CENTER);
    -      
    +
           if (IGNORE_AWT_REPAINT) {
             newtCanvas.setIgnoreRepaint(true);
           }
           glad = newtWindow;
         }
    -    
    +
         demo = new LandscapeES2(SWAP_INTERVAL);
         // demo = new GearsES2(SWAP_INTERVAL);
         glad.addGLEventListener(demo);
         animator = new Animator(glad);
         animator.setExclusiveContext(USE_ECT);
       }
    -  
    +
       private void initDraw() {
         if (TOOLKIT == AWT) {
           // JAU awtCanvas.setVisible(true);
           if (awtCanvas.getDelegatedDrawable().isRealized()) {
             // Request the focus here as it cannot work when the window is not visible
             awtCanvas.requestFocus();
    -      }      
    +      }
         } else if (TOOLKIT == NEWT) {
           // JAU newtCanvas.setVisible(true);
           // Force the realization
    @@ -143,10 +143,10 @@ public class Bug735Inv3AppletAWT extends Applet {
             // Request the focus here as it cannot work when the window is not visible
             newtCanvas.requestFocus();
           }
    -    }    
    +    }
       }
    -  
    -  static public void main(String[] args) {    
    +
    +  static public void main(final String[] args) {
         for(int i=0; i c = Thread.currentThread().getContextClassLoader().
    +      final Class c = Thread.currentThread().getContextClassLoader().
               loadClass(Bug735Inv3AppletAWT.class.getName());
           applet = (Bug735Inv3AppletAWT) c.newInstance();
    -    } catch (Exception e) {
    +    } catch (final Exception e) {
           throw new RuntimeException(e);
    -    }    
    -    
    +    }
    +
         // JAU frame.setLayout(null);
         frame.add(applet);
    -    
    +
         applet.init();
    -    
    -    Insets insets = frame.getInsets();
    +
    +    final Insets insets = frame.getInsets();
         final int windowW = applet.width + insets.left + insets.right;
         final int windowH = applet.height + insets.top + insets.bottom;
    -    
    +
         try {
             SwingUtilities.invokeAndWait(new Runnable() {
                public void run() {
                    frame.setSize(windowW, windowH);
                    frame.validate();
                    // JAU frame.pack();
    -                Rectangle screenRect = displayDevice.getDefaultConfiguration().getBounds();    
    +                final Rectangle screenRect = displayDevice.getDefaultConfiguration().getBounds();
                     frame.setLocation(screenRect.x + (screenRect.width - applet.width) / 2,
    -                    screenRect.y + (screenRect.height - applet.height) / 2);    
    -                
    +                    screenRect.y + (screenRect.height - applet.height) / 2);
    +
                    frame.setResizable(false);
    -               frame.setVisible(true);               
    +               frame.setVisible(true);
                }
             });
    -    } catch (Exception e) {
    +    } catch (final Exception e) {
             e.printStackTrace();
    -    }        
    -    
    -    applet.start();    
    +    }
    +
    +    applet.start();
       }
     }
    diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv4AWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv4AWT.java
    index f0be22b65..c9df683b1 100644
    --- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv4AWT.java
    +++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv4AWT.java
    @@ -30,7 +30,7 @@ import com.jogamp.opengl.util.AnimatorBase;
      *   - Use GLEventListener
      *   - Add GLEventListener to GLAutoDrawable
      *   - Use GLAutoDrawable.display() instead of GLAutoDrawable.invoke(true, GLRunnable { init / render })
    - *   - Removed MANUAL_FRAME_HANDLING, obsolete due to GLAutoDrawable/GLEventListener 
    + *   - Removed MANUAL_FRAME_HANDLING, obsolete due to GLAutoDrawable/GLEventListener
      *   - Use Animator
      *   - Remove component sizes, use frame based size via validate
      *   - Run frame validation/visibility on AWT-EDT
    @@ -46,17 +46,17 @@ import com.jogamp.opengl.util.AnimatorBase;
     public class Bug735Inv4AWT {
       static public int AWT  = 0;
       static public int NEWT = 1;
    -  
    +
       static public int APPLET_WIDTH  = 500;
       static public int APPLET_HEIGHT = 290;
       static public int TOOLKIT       = NEWT;
       static public boolean IGNORE_AWT_REPAINT = false;
       static public boolean USE_ECT = false;
       static public int SWAP_INTERVAL = 1;
    -  
    +
       //////////////////////////////////////////////////////////////////////////////
    -  
    -  static boolean waitForKey = false;  
    +
    +  static boolean waitForKey = false;
       static private Frame frame;
       static private Bug735Inv4AWT applet;
       private GLCanvas awtCanvas;
    @@ -65,39 +65,39 @@ public class Bug735Inv4AWT {
       private NewtCanvasAWT newtCanvas;
       private GLEventListener demo;
       private AnimatorBase animator;
    -  
    +
       private int width;
       private int height;
    -  
    +
       public void init() {
         width = APPLET_WIDTH;
         height = APPLET_HEIGHT;
         initGL();
       }
    -  
    +
       public void start() {
         initDraw();
         animator.start();
         animator.setUpdateFPSFrames(60, System.err);
       }
    -  
    +
       private void initGL() {
    -    GLProfile profile = GLProfile.getDefault();
    -    GLCapabilities caps = new GLCapabilities(profile);
    +    final GLProfile profile = GLProfile.getDefault();
    +    final GLCapabilities caps = new GLCapabilities(profile);
         caps.setBackgroundOpaque(true);
         caps.setOnscreen(true);
         caps.setSampleBuffers(false);
    -    
    +
         if (TOOLKIT == AWT) {
           awtCanvas = new GLCanvas(caps);
           awtCanvas.setBackground(new Color(0xFFCCCCCC, true));
    -      awtCanvas.setFocusable(true); 
    -      
    +      awtCanvas.setFocusable(true);
    +
           if (IGNORE_AWT_REPAINT) {
               awtCanvas.setIgnoreRepaint(true);
           }
           glad = awtCanvas;
    -    } else if (TOOLKIT == NEWT) {      
    +    } else if (TOOLKIT == NEWT) {
           newtWindow = GLWindow.create(caps);
           newtCanvas = new NewtCanvasAWT(newtWindow);
           newtCanvas.setBackground(new Color(0xFFCCCCCC, true));
    @@ -108,20 +108,20 @@ public class Bug735Inv4AWT {
           }
           glad = newtWindow;
         }
    -    
    +
         demo = new LandscapeES2(SWAP_INTERVAL);
         // demo = new GearsES2(SWAP_INTERVAL);
         glad.addGLEventListener(demo);
         animator = new Animator(glad);
         animator.setExclusiveContext(USE_ECT);
       }
    -  
    +
       private void initDraw() {
         if (TOOLKIT == AWT) {
           if (awtCanvas.getDelegatedDrawable().isRealized()) {
             // Request the focus here as it cannot work when the window is not visible
             awtCanvas.requestFocus();
    -      }      
    +      }
         } else if (TOOLKIT == NEWT) {
           // newtCanvas.repaint();
           // Force the realization
    @@ -130,10 +130,10 @@ public class Bug735Inv4AWT {
             // Request the focus here as it cannot work when the window is not visible
             newtCanvas.requestFocus();
           }
    -    }    
    +    }
       }
    -  
    -  static public void main(String[] args) {    
    +
    +  static public void main(final String[] args) {
         for(int i=0; i 0;
             for(int i=0; irow) {
                 row = lastRow + 1;
             }
    -        AABBox textBox = font.getMetricBounds(text, fontSize);
    +        final AABBox textBox = font.getMetricBounds(text, fontSize);
             dx += font.getAdvanceWidth('X', fontSize) * column;
             dy -= (int)textBox.getHeight() * ( row + 1 );
     
    diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java b/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java
    index 1c4a20bea..f1a6b761b 100644
    --- a/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java
    +++ b/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java
    @@ -75,7 +75,7 @@ public abstract class TextRendererGLELBase implements GLEventListener {
         public static Font getFont(final int fontSet, final int fontFamily, final int fontStylebits) {
             try {
                 return FontFactory.get(fontSet).get(fontFamily, fontStylebits);
    -        } catch (IOException e) {
    +        } catch (final IOException e) {
                 e.printStackTrace();
             }
             return null;
    @@ -86,7 +86,7 @@ public abstract class TextRendererGLELBase implements GLEventListener {
          * @param sampleCount desired multisampling sample count for msaa-rendering.
          * @see #setRendererCallbacks(com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback, com.jogamp.graph.curve.opengl.RegionRenderer.GLCallback)
          */
    -    public TextRendererGLELBase(final int renderModes, int[] sampleCount) {
    +    public TextRendererGLELBase(final int renderModes, final int[] sampleCount) {
             this.renderModes = renderModes;
             this.vbaaSampleCount = sampleCount;
         }
    @@ -97,7 +97,7 @@ public abstract class TextRendererGLELBase implements GLEventListener {
          * 

    * @param rs */ - public void setRenderState(RenderState rs) { this.rs = rs; } + public void setRenderState(final RenderState rs) { this.rs = rs; } /** * In exclusive mode, impl. uses a pixelScale of 1f and orthogonal PMV on window dimensions @@ -110,7 +110,7 @@ public abstract class TextRendererGLELBase implements GLEventListener { * Must be called before {@link #init(GLAutoDrawable)}. *

    */ - public void setSharedPMVMatrix(PMVMatrix pmv) { + public void setSharedPMVMatrix(final PMVMatrix pmv) { this.sharedPMVMatrix = pmv; } @@ -120,17 +120,17 @@ public abstract class TextRendererGLELBase implements GLEventListener { * Must be called before {@link #init(GLAutoDrawable)}. *

    */ - public void setRendererCallbacks(RegionRenderer.GLCallback enable, RegionRenderer.GLCallback disable) { + public void setRendererCallbacks(final RegionRenderer.GLCallback enable, final RegionRenderer.GLCallback disable) { this.enableCallback = enable; this.disableCallback = disable; } - public void setFlipVerticalInGLOrientation(boolean v) { flipVerticalInGLOrientation=v; } + public void setFlipVerticalInGLOrientation(final boolean v) { flipVerticalInGLOrientation=v; } public final RegionRenderer getRenderer() { return renderer; } public final TextRegionUtil getTextRenderUtil() { return textRenderUtil; } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { if( null == this.rs ) { exclusivePMVMatrix = null == sharedPMVMatrix; this.rs = RenderState.createRenderState(SVertex.factory(), sharedPMVMatrix); @@ -151,7 +151,7 @@ public abstract class TextRendererGLELBase implements GLEventListener { } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { if( null != renderer ) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); renderer.enable(gl, true); @@ -170,7 +170,7 @@ public abstract class TextRendererGLELBase implements GLEventListener { public abstract void display(GLAutoDrawable drawable); @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { if( null != renderer ) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); renderer.destroy(gl); @@ -191,16 +191,16 @@ public abstract class TextRendererGLELBase implements GLEventListener { * @param tz * @param cacheRegion */ - public void renderString(GLAutoDrawable drawable, - Font font, float pixelSize, String text, - int column, float tx, float ty, float tz, boolean cacheRegion) { + public void renderString(final GLAutoDrawable drawable, + final Font font, final float pixelSize, final String text, + final int column, final float tx, final float ty, final float tz, final boolean cacheRegion) { final int row = lastRow + 1; renderStringImpl(drawable, font, pixelSize, text, column, row, tx, ty, tz, cacheRegion, null); } - public void renderString(GLAutoDrawable drawable, - Font font, float pixelSize, String text, - int column, float tx, float ty, float tz, GLRegion region) { + public void renderString(final GLAutoDrawable drawable, + final Font font, final float pixelSize, final String text, + final int column, final float tx, final float ty, final float tz, final GLRegion region) { final int row = lastRow + 1; renderStringImpl(drawable, font, pixelSize, text, column, row, tx, ty, tz, false, region); } @@ -218,24 +218,24 @@ public abstract class TextRendererGLELBase implements GLEventListener { * @param tz * @param cacheRegion */ - public void renderString(GLAutoDrawable drawable, - Font font, float pixelSize, String text, - int column, int row, - float tx, float ty, float tz, boolean cacheRegion) { + public void renderString(final GLAutoDrawable drawable, + final Font font, final float pixelSize, final String text, + final int column, final int row, + final float tx, final float ty, final float tz, final boolean cacheRegion) { renderStringImpl(drawable, font, pixelSize, text, column, row, tx, ty, tz, cacheRegion, null); } - public void renderString(GLAutoDrawable drawable, - Font font, float pixelSize, String text, - int column, int row, - float tx, float ty, float tz, GLRegion region) { + public void renderString(final GLAutoDrawable drawable, + final Font font, final float pixelSize, final String text, + final int column, final int row, + final float tx, final float ty, final float tz, final GLRegion region) { renderStringImpl(drawable, font, pixelSize, text, column, row, tx, ty, tz, false, region); } - private void renderStringImpl(GLAutoDrawable drawable, - Font font, float pixelSize, String text, - int column, int row, - float tx, float ty, float tz, boolean cacheRegion, GLRegion region) { + private void renderStringImpl(final GLAutoDrawable drawable, + final Font font, final float pixelSize, final String text, + final int column, final int row, + final float tx, final float ty, final float tz, final boolean cacheRegion, final GLRegion region) { if( null != renderer ) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java index 4bcbdb380..82d129f4e 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener01.java @@ -49,7 +49,7 @@ import com.jogamp.opengl.util.PMVMatrix; public class GPURegionGLListener01 extends GPURendererListenerBase01 { OutlineShape outlineShape = null; - public GPURegionGLListener01 (RenderState rs, int renderModes, int sampleCount, boolean debug, boolean trace) { + public GPURegionGLListener01 (final RenderState rs, final int renderModes, final int sampleCount, final boolean debug, final boolean trace) { super(RegionRenderer.create(rs, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace); rs.setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); setMatrix(-20, 00, -50, 0f, sampleCount); @@ -95,23 +95,23 @@ public class GPURegionGLListener01 extends GPURendererListenerBase01 { region.addOutlineShape(outlineShape, null, region.hasColorChannel() ? getRenderer().getRenderState().getColorStatic(new float[4]) : null); } - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { super.init(drawable); - GL2ES2 gl = drawable.getGL().getGL2ES2(); + final GL2ES2 gl = drawable.getGL().getGL2ES2(); final RenderState rs = getRenderer().getRenderState(); gl.setSwapInterval(1); - gl.glEnable(GL2ES2.GL_DEPTH_TEST); - gl.glEnable(GL2ES2.GL_BLEND); + gl.glEnable(GL.GL_DEPTH_TEST); + gl.glEnable(GL.GL_BLEND); rs.setColorStatic(0.0f, 0.0f, 0.0f, 1.0f); createTestOutline(); } - public void display(GLAutoDrawable drawable) { - GL2ES2 gl = drawable.getGL().getGL2ES2(); + public void display(final GLAutoDrawable drawable) { + final GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java index ca9f4fda7..2486b5853 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionGLListener02.java @@ -49,7 +49,7 @@ import com.jogamp.opengl.util.PMVMatrix; public class GPURegionGLListener02 extends GPURendererListenerBase01 { List outlineShapes = new ArrayList(); - public GPURegionGLListener02 (RenderState rs, int renderModes, int sampleCount, boolean debug, boolean trace) { + public GPURegionGLListener02 (final RenderState rs, final int renderModes, final int sampleCount, final boolean debug, final boolean trace) { super(RegionRenderer.create(rs, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), renderModes, debug, trace); rs.setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED); setMatrix(-20, 00, -50, 0f, sampleCount); @@ -97,23 +97,23 @@ public class GPURegionGLListener02 extends GPURendererListenerBase01 { region.addOutlineShapes(outlineShapes, null, null); } - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { super.init(drawable); - GL2ES2 gl = drawable.getGL().getGL2ES2(); + final GL2ES2 gl = drawable.getGL().getGL2ES2(); final RenderState rs = getRenderer().getRenderState(); gl.setSwapInterval(1); - gl.glEnable(GL2ES2.GL_DEPTH_TEST); - gl.glEnable(GL2ES2.GL_BLEND); + gl.glEnable(GL.GL_DEPTH_TEST); + gl.glEnable(GL.GL_BLEND); rs.setColorStatic(0.0f, 0.0f, 0.0f, 1.0f); createTestOutline(); } - public void display(GLAutoDrawable drawable) { - GL2ES2 gl = drawable.getGL().getGL2ES2(); + public void display(final GLAutoDrawable drawable) { + final GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo.java index 14ff53f10..77456d5e3 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo.java @@ -58,7 +58,7 @@ public class GPURegionNewtDemo { static int GraphMSAASamples = 0; static boolean GraphUseWeight = true; - public static void main(String[] args) { + public static void main(final String[] args) { int width = 800, height = 400; int x = 10, y = 10; if( 0 != args.length ) { @@ -103,8 +103,8 @@ public class GPURegionNewtDemo { System.err.println("Graph VBAA Samples "+GraphVBAASamples); System.err.println("Graph Weight Mode "+GraphUseWeight); - GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.getGL2ES2(); + final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(4); if( SceneMSAASamples > 0 ) { caps.setSampleBuffers(true); @@ -127,8 +127,8 @@ public class GPURegionNewtDemo { window.setSize(width, height); window.setTitle("GPU Curve Region Newt Demo - graph[vbaa"+GraphVBAASamples+" msaa"+GraphMSAASamples+"], msaa "+SceneMSAASamples); - RenderState rs = RenderState.createRenderState(SVertex.factory()); - GPURegionGLListener01 regionGLListener = new GPURegionGLListener01 (rs, rmode, sampleCount, DEBUG, TRACE); + final RenderState rs = RenderState.createRenderState(SVertex.factory()); + final GPURegionGLListener01 regionGLListener = new GPURegionGLListener01 (rs, rmode, sampleCount, DEBUG, TRACE); regionGLListener.attachInputListenerTo(window); window.addGLEventListener(regionGLListener); window.setVisible(true); @@ -139,14 +139,14 @@ public class GPURegionNewtDemo { animator.add(window); window.addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent arg0) { + public void keyPressed(final KeyEvent arg0) { if(arg0.getKeyCode() == KeyEvent.VK_F4) { window.destroy(); } } }); window.addWindowListener(new WindowAdapter() { - public void windowDestroyed(WindowEvent e) { + public void windowDestroyed(final WindowEvent e) { animator.stop(); } }); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java index ef72b3d45..159d4b84c 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java @@ -93,7 +93,7 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { protected volatile float weight = 1.0f; boolean ignoreInput = false; - public GPURendererListenerBase01(RegionRenderer renderer, int renderModes, boolean debug, boolean trace) { + public GPURendererListenerBase01(final RegionRenderer renderer, final int renderModes, final boolean debug, final boolean trace) { this.renderer = renderer; this.renderModes = renderModes; this.debug = debug; @@ -111,7 +111,7 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { public final int[] getSampleCount() { return sampleCount; } public final float[] getPosition() { return position; } - public void setMatrix(float xtrans, float ytrans, float zTran, float angle, int sampleCount) { + public void setMatrix(final float xtrans, final float ytrans, final float zTran, final float angle, final int sampleCount) { this.xTran = xtrans; this.yTran = ytrans; this.zTran = zTran; @@ -120,7 +120,7 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { autoDrawable = drawable; GL2ES2 gl = drawable.getGL().getGL2ES2(); if(debug) { @@ -138,14 +138,14 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { public static void mapWin2ObjectCoords(final PMVMatrix pmv, final int[] view, final float zNear, final float zFar, - float orthoX, float orthoY, float orthoDist, + final float orthoX, final float orthoY, final float orthoDist, final float[] winZ, final float[] objPos) { winZ[0] = (1f/zNear-1f/orthoDist)/(1f/zNear-1f/zFar); pmv.gluUnProject(orthoX, orthoY, winZ[0], view, 0, objPos, 0); } @Override - public void reshape(GLAutoDrawable drawable, int xstart, int ystart, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int xstart, final int ystart, final int width, final int height) { final PMVMatrix pmv = renderer.getMatrix(); renderer.reshapePerspective(45.0f, width, height, zNear, zFar); pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); @@ -179,9 +179,9 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { autoDrawable = null; - GL2ES2 gl = drawable.getGL().getGL2ES2(); + final GL2ES2 gl = drawable.getGL().getGL2ES2(); if(null != region) { region.destroy(gl); } @@ -189,22 +189,22 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { renderer.destroy(gl); } - public void zoom(int v){ + public void zoom(final int v){ zTran += v; dumpMatrix(); } - public void move(float x, float y){ + public void move(final float x, final float y){ xTran += x; yTran += y; dumpMatrix(); } - public void rotate(float delta){ + public void rotate(final float delta){ ang += delta; ang %= 360.0f; dumpMatrix(); } - public void editGlobalWeight(float delta) { + public void editGlobalWeight(final float delta) { if( !RenderState.isWeightValid(weight+delta) ) { return; } @@ -217,23 +217,23 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { } /** Attach the input listener to the window */ - public void attachInputListenerTo(GLWindow window) { + public void attachInputListenerTo(final GLWindow window) { if ( null == keyAction ) { keyAction = new KeyAction(); window.addKeyListener(keyAction); } } - public void detachInputListenerFrom(GLWindow window) { + public void detachInputListenerFrom(final GLWindow window) { if ( null == keyAction ) { return; } window.removeKeyListener(keyAction); } - public void printScreen(GLAutoDrawable drawable, String dir, String tech, String objName, boolean exportAlpha) throws GLException, IOException { - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); + public void printScreen(final GLAutoDrawable drawable, final String dir, final String tech, final String objName, final boolean exportAlpha) throws GLException, IOException { + final StringWriter sw = new StringWriter(); + final PrintWriter pw = new PrintWriter(sw); pw.printf("-%03dx%03d-Z%04d-S%02d-%s", drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), (int)Math.abs(zTran), sampleCount[0], objName); final String filename = dir + tech + sw +".png"; @@ -244,7 +244,7 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { int screenshot_num = 0; - public void setIgnoreInput(boolean v) { + public void setIgnoreInput(final boolean v) { ignoreInput = v; } public boolean getIgnoreInput() { @@ -253,7 +253,7 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { public class KeyAction implements KeyListener { @Override - public void keyPressed(KeyEvent arg0) { + public void keyPressed(final KeyEvent arg0) { if(ignoreInput) { return; } @@ -300,8 +300,8 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { if(null != autoDrawable) { autoDrawable.invoke(false, new GLRunnable() { @Override - public boolean run(GLAutoDrawable drawable) { - GL gl = drawable.getGL(); + public boolean run(final GLAutoDrawable drawable) { + final GL gl = drawable.getGL(); int i = gl.getSwapInterval(); i = i==0 ? 1 : 0; gl.setSwapInterval(i); @@ -323,15 +323,15 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { if(null != autoDrawable) { autoDrawable.invoke(false, new GLRunnable() { @Override - public boolean run(GLAutoDrawable drawable) { + public boolean run(final GLAutoDrawable drawable) { try { final String modeS = Region.getRenderModeString(renderModes); final String type = modeS + ( Region.hasVariableWeight(renderModes) ? "-vc" : "-uc" ) ; printScreen(drawable, "./", "demo-"+type, "snap"+screenshot_num, false); screenshot_num++; - } catch (GLException e) { + } catch (final GLException e) { e.printStackTrace(); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } return true; @@ -341,6 +341,6 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { } } @Override - public void keyReleased(KeyEvent arg0) {} + public void keyReleased(final KeyEvent arg0) {} } } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java index 08d2f0d70..602879319 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java @@ -28,6 +28,7 @@ package com.jogamp.opengl.test.junit.graph.demos; +import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; import javax.media.opengl.GLAutoDrawable; @@ -43,28 +44,28 @@ public class GPUTextGLListener0A extends GPUTextRendererListenerBase01 { super(RenderState.createRenderState(SVertex.factory()), Region.VBAA_RENDERING_BIT, 4, true, false, false); } - public GPUTextGLListener0A(RenderState rs, int renderModes, int sampleCount, boolean blending, boolean debug, boolean trace) { + public GPUTextGLListener0A(final RenderState rs, final int renderModes, final int sampleCount, final boolean blending, final boolean debug, final boolean trace) { super(rs, renderModes, sampleCount, blending, debug, trace); } - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { if(drawable instanceof GLWindow) { final GLWindow glw = (GLWindow) drawable; attachInputListenerTo(glw); } super.init(drawable); - GL2ES2 gl = drawable.getGL().getGL2ES2(); + final GL2ES2 gl = drawable.getGL().getGL2ES2(); final RenderState rs = getRenderer().getRenderState(); gl.setSwapInterval(1); - gl.glEnable(GL2ES2.GL_DEPTH_TEST); - gl.glEnable(GL2ES2.GL_BLEND); + gl.glEnable(GL.GL_DEPTH_TEST); + gl.glEnable(GL.GL_BLEND); rs.setColorStatic(0.1f, 0.1f, 0.1f, 1.0f); } - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { if(drawable instanceof GLWindow) { final GLWindow glw = (GLWindow) drawable; detachInputListenerFrom(glw); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java index 6a91d005e..cba70c09f 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java @@ -59,7 +59,7 @@ public class GPUTextNewtDemo { static int GraphVBAASamples = 4; static int GraphMSAASamples = 0; - public static void main(String[] args) { + public static void main(final String[] args) { int width = 800, height = 400; int x = 10, y = 10; if( 0 != args.length ) { @@ -100,9 +100,9 @@ public class GPUTextNewtDemo { System.err.println("Graph MSAA Samples "+GraphMSAASamples); System.err.println("Graph VBAA Samples "+GraphVBAASamples); - GLProfile glp = GLProfile.getGL2ES2(); + final GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(4); if( SceneMSAASamples > 0 ) { caps.setSampleBuffers(true); @@ -125,8 +125,8 @@ public class GPUTextNewtDemo { window.setSize(width, height); window.setTitle("GPU Text Newt Demo - graph[vbaa"+GraphVBAASamples+" msaa"+GraphMSAASamples+"], msaa "+SceneMSAASamples); - RenderState rs = RenderState.createRenderState(SVertex.factory()); - GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, rmode, sampleCount, true, DEBUG, TRACE); + final RenderState rs = RenderState.createRenderState(SVertex.factory()); + final GPUTextGLListener0A textGLListener = new GPUTextGLListener0A(rs, rmode, sampleCount, true, DEBUG, TRACE); // ((TextRenderer)textGLListener.getRenderer()).setCacheLimit(32); window.addGLEventListener(textGLListener); window.setVisible(true); @@ -136,14 +136,14 @@ public class GPUTextNewtDemo { animator.add(window); window.addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent arg0) { + public void keyPressed(final KeyEvent arg0) { if(arg0.getKeyCode() == KeyEvent.VK_F4) { window.destroy(); } } }); window.addWindowListener(new WindowAdapter() { - public void windowDestroyed(WindowEvent e) { + public void windowDestroyed(final WindowEvent e) { animator.stop(); } }); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java index 67e2555fd..bb688f9b3 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java @@ -111,7 +111,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB StringBuilder userString = new StringBuilder(); boolean userInput = false; - public GPUTextRendererListenerBase01(RenderState rs, int renderModes, int sampleCount, boolean blending, boolean debug, boolean trace) { + public GPUTextRendererListenerBase01(final RenderState rs, final int renderModes, final int sampleCount, final boolean blending, final boolean debug, final boolean trace) { // NOTE_ALPHA_BLENDING: We use alpha-blending super(RegionRenderer.create(rs, blending ? RegionRenderer.defaultBlendEnable : null, blending ? RegionRenderer.defaultBlendDisable : null), @@ -125,7 +125,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB dumpFontNames(); this.fontName = font.toString(); - } catch (IOException ioe) { + } catch (final IOException ioe) { System.err.println("Caught: "+ioe.getMessage()); ioe.printStackTrace(); } @@ -161,7 +161,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { super.init(drawable); final Object upObj = drawable.getUpstreamWidget(); if( upObj instanceof Window ) { @@ -175,7 +175,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB } @Override - public void reshape(GLAutoDrawable drawable, int xstart, int ystart, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int xstart, final int ystart, final int width, final int height) { super.reshape(drawable, xstart, ystart, width, height); final float dist = 100f; nearPlaneX0 = nearPlane1Box.getMinX() * dist; @@ -191,17 +191,17 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB float nearPlaneX0, nearPlaneY0, nearPlaneZ0, nearPlaneSx, nearPlaneSy, nearPlaneS; @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { regionFPS.destroy(drawable.getGL().getGL2ES2()); regionBottom.destroy(drawable.getGL().getGL2ES2()); super.dispose(drawable); } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { final int width = drawable.getSurfaceWidth(); final int height = drawable.getSurfaceHeight(); - GL2ES2 gl = drawable.getGL().getGL2ES2(); + final GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); @@ -301,12 +301,12 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB } final boolean bottomTextUseFrustum = true; - public void fontBottomIncr(int v) { + public void fontBottomIncr(final int v) { fontSizeBottom = Math.abs((fontSizeBottom + v) % fontSizeModulo) ; dumpMatrix(true); } - public void fontHeadIncr(int v) { + public void fontHeadIncr(final int v) { fontSizeHead = Math.abs((fontSizeHead + v) % fontSizeModulo) ; if(null != headtext) { headbox = font.getMetricBounds(headtext, font.getPixelSize(fontSizeHead, dpiH)); @@ -315,8 +315,8 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB public boolean nextFontSet() { try { - int set = ( fontSet == FontFactory.UBUNTU ) ? FontFactory.JAVA : FontFactory.UBUNTU ; - Font _font = FontFactory.get(set).getDefault(); + final int set = ( fontSet == FontFactory.UBUNTU ) ? FontFactory.JAVA : FontFactory.UBUNTU ; + final Font _font = FontFactory.get(set).getDefault(); if(null != _font) { fontSet = set; font = _font; @@ -325,15 +325,15 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB dumpFontNames(); return true; } - } catch (IOException ex) { + } catch (final IOException ex) { System.err.println("Caught: "+ex.getMessage()); } return false; } - public boolean setFontSet(int set, int family, int stylebits) { + public boolean setFontSet(final int set, final int family, final int stylebits) { try { - Font _font = FontFactory.get(set).get(family, stylebits); + final Font _font = FontFactory.get(set).get(family, stylebits); if(null != _font) { fontSet = set; font = _font; @@ -342,7 +342,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB dumpFontNames(); return true; } - } catch (IOException ex) { + } catch (final IOException ex) { System.err.println("Caught: "+ex.getMessage()); } return false; @@ -350,7 +350,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB public boolean isUserInputMode() { return userInput; } - void dumpMatrix(boolean bbox) { + void dumpMatrix(final boolean bbox) { System.err.println("Matrix: " + getXTran() + "/" + getYTran() + " x"+getZTran() + " @"+getAngle() +" fontSize "+fontSizeBottom); if(bbox) { System.err.println("bbox: "+font.getMetricBounds(text2, nearPlaneS * font.getPixelSize(fontSizeBottom, dpiH))); @@ -360,7 +360,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB KeyAction keyAction = null; @Override - public void attachInputListenerTo(GLWindow window) { + public void attachInputListenerTo(final GLWindow window) { if ( null == keyAction ) { keyAction = new KeyAction(); window.addKeyListener(keyAction); @@ -369,7 +369,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB } @Override - public void detachInputListenerFrom(GLWindow window) { + public void detachInputListenerFrom(final GLWindow window) { super.detachInputListenerFrom(window); if ( null == keyAction ) { return; @@ -377,7 +377,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB window.removeKeyListener(keyAction); } - public void printScreen(GLAutoDrawable drawable, String dir, String tech, boolean exportAlpha) throws GLException, IOException { + public void printScreen(final GLAutoDrawable drawable, final String dir, final String tech, final boolean exportAlpha) throws GLException, IOException { final String fn = font.getFullFamilyName(null).toString(); printScreen(drawable, dir, tech, fn.replace(' ', '_'), exportAlpha); } @@ -386,7 +386,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB public class KeyAction implements KeyListener { @Override - public void keyPressed(KeyEvent e) { + public void keyPressed(final KeyEvent e) { if(userInput) { return; } @@ -421,7 +421,7 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB } @Override - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { if( !e.isPrintableKey() || e.isAutoRepeat() ) { return; } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java index 89361b511..45ed14f7b 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java @@ -124,7 +124,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { /** * @param renderModes */ - public GPUUISceneGLListener0A(int renderModes) { + public GPUUISceneGLListener0A(final int renderModes) { this(renderModes, false, false); } @@ -133,7 +133,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { * @param debug * @param trace */ - public GPUUISceneGLListener0A(int renderModes, boolean debug, boolean trace) { + public GPUUISceneGLListener0A(final int renderModes, final boolean debug, final boolean trace) { this(0f, renderModes, debug, trace); } @@ -142,11 +142,11 @@ public class GPUUISceneGLListener0A implements GLEventListener { * @param debug * @param trace */ - public GPUUISceneGLListener0A(final float noAADPIThreshold, boolean debug, boolean trace) { + public GPUUISceneGLListener0A(final float noAADPIThreshold, final boolean debug, final boolean trace) { this(noAADPIThreshold, 0, debug, trace); } - private GPUUISceneGLListener0A(final float noAADPIThreshold, int renderModes, boolean debug, boolean trace) { + private GPUUISceneGLListener0A(final float noAADPIThreshold, final int renderModes, final boolean debug, final boolean trace) { this.noAADPIThreshold = noAADPIThreshold; this.rs = RenderState.createRenderState(SVertex.factory()); this.debug = debug; @@ -156,7 +156,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { try { font = FontFactory.get(FontFactory.UBUNTU).getDefault(); - } catch (IOException ioe) { + } catch (final IOException ioe) { System.err.println("Caught: "+ioe.getMessage()); ioe.printStackTrace(); } @@ -170,13 +170,13 @@ public class GPUUISceneGLListener0A implements GLEventListener { buttons.get(i).getRotation().rotateByEuler( angdeg ); } } - private void translateButtons(float tx, float ty, float tz) { + private void translateButtons(final float tx, final float ty, final float tz) { for(int i=0; i0); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { cDrawable.invoke(false, new GLRunnable() { @Override - public boolean run(GLAutoDrawable drawable) { - GL gl = drawable.getGL(); + public boolean run(final GLAutoDrawable drawable) { + final GL gl = drawable.getGL(); gl.setSwapInterval(gl.getSwapInterval()<=0?1:0); final GLAnimatorControl a = drawable.getAnimator(); if( null != a ) { @@ -280,7 +280,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.translate(xStartLeft,yStartTop - diffY*buttons.size(), 0f); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { final Object attachment = e.getAttachment(); if( attachment instanceof UIShape.PointerEventInfo ) { final UIShape.PointerEventInfo shapeEvent = (UIShape.PointerEventInfo)attachment; @@ -292,7 +292,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { } } @Override - public void mouseWheelMoved(MouseEvent e) { + public void mouseWheelMoved(final MouseEvent e) { rotateButtons(new float[] { 0f, e.getRotation()[1], 0f}); } } ); buttons.add(button); @@ -302,7 +302,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.translate(xStartLeft,yStartTop - diffY*buttons.size(), 0f); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { final Object attachment = e.getAttachment(); if( attachment instanceof UIShape.PointerEventInfo ) { final UIShape.PointerEventInfo shapeEvent = (UIShape.PointerEventInfo)attachment; @@ -328,7 +328,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.translate(xStartLeft,yStartTop - diffY*buttons.size(), 0f); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { final Object attachment = e.getAttachment(); if( attachment instanceof UIShape.PointerEventInfo ) { final UIShape.PointerEventInfo shapeEvent = (UIShape.PointerEventInfo)attachment; @@ -359,7 +359,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.setPressedColorMod(1.1f, 0.0f, 0.0f, 1.0f); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { new Thread() { public void run() { if( null != cDrawable ) { @@ -376,13 +376,13 @@ public class GPUUISceneGLListener0A implements GLEventListener { // second column to the left { - int j = 1; // column + final int j = 1; // column int k = 0; // row button = new LabelButton(SVertex.factory(), renderModes, font, "y flip", buttonXSize, buttonYSize); button.translate(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { rotateButtons(new float[] { 0f, 180f, 0f}); } } ); button.addMouseListener(dragZoomRotateListener); @@ -393,7 +393,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.translate(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { rotateButtons(new float[] { 180f, 0f, 0f}); } } ); button.addMouseListener(dragZoomRotateListener); @@ -404,7 +404,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.translate(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { final Object attachment = e.getAttachment(); if( attachment instanceof UIShape.PointerEventInfo ) { final UIShape.PointerEventInfo shapeEvent = (UIShape.PointerEventInfo)attachment; @@ -431,7 +431,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.translate(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { final Object attachment = e.getAttachment(); if( attachment instanceof UIShape.PointerEventInfo ) { final UIShape.PointerEventInfo shapeEvent = (UIShape.PointerEventInfo)attachment; @@ -445,7 +445,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { } } @Override - public void mouseWheelMoved(MouseEvent e) { + public void mouseWheelMoved(final MouseEvent e) { setButtonsSpacing(e.getRotation()[0]/100f, e.getRotation()[1]/200f); } } ); buttons.add(button); @@ -455,7 +455,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.translate(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { final Object attachment = e.getAttachment(); if( attachment instanceof UIShape.PointerEventInfo ) { final UIShape.PointerEventInfo shapeEvent = (UIShape.PointerEventInfo)attachment; @@ -470,7 +470,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { } @Override - public void mouseWheelMoved(MouseEvent e) { + public void mouseWheelMoved(final MouseEvent e) { setButtonsCorner(e.getRotation()[1]/20f); } } ); buttons.add(button); @@ -480,7 +480,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.translate(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { resetButtons(); } } ); button.addMouseListener(dragZoomRotateListener); @@ -491,10 +491,10 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.translate(xStartLeft - diffX*j,yStartTop - diffY*k, 0f); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { cDrawable.invoke(false, new GLRunnable() { @Override - public boolean run(GLAutoDrawable drawable) { + public boolean run(final GLAutoDrawable drawable) { printScreen(drawable.getGL()); return true; } @@ -535,14 +535,14 @@ public class GPUUISceneGLListener0A implements GLEventListener { mPlayerButton.addMouseListener(dragZoomRotateListener); mPlayerButton.addMouseListener(new UIShape.MouseGestureAdapter() { @Override - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { mPlayer.setAudioVolume( mPlayerButton.isToggleOn() ? 1f : 0f ); } } ); buttons.add(mPlayerButton); try { final URI streamLoc = new URI("http://archive.org/download/BigBuckBunny_328/BigBuckBunny_512kb.mp4"); mPlayer.initStream(streamLoc, GLMediaPlayer.STREAM_ID_AUTO, GLMediaPlayer.STREAM_ID_AUTO, GLMediaPlayer.TEXTURE_COUNT_DEFAULT); - } catch (URISyntaxException e1) { + } catch (final URISyntaxException e1) { e1.printStackTrace(); } } @@ -553,7 +553,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { try { imgSeq.addFrame(gl, GPUUISceneGLListener0A.class, "button-released-145x53.png", TextureIO.PNG); imgSeq.addFrame(gl, GPUUISceneGLListener0A.class, "button-pressed-145x53.png", TextureIO.PNG); - } catch (IOException e2) { + } catch (final IOException e2) { e2.printStackTrace(); } imgSeq.setManualStepping(true); @@ -561,12 +561,12 @@ public class GPUUISceneGLListener0A implements GLEventListener { imgButton.addMouseListener(dragZoomRotateListener); imgButton.addMouseListener(new UIShape.MouseGestureAdapter() { @Override - public void mousePressed(MouseEvent e) { + public void mousePressed(final MouseEvent e) { imgButton.setCurrentIdx(1); System.err.println("XXX: "+imgButton); } @Override - public void mouseReleased(MouseEvent e) { + public void mouseReleased(final MouseEvent e) { imgButton.setCurrentIdx(0); } } ); buttons.add(imgButton); @@ -585,15 +585,15 @@ public class GPUUISceneGLListener0A implements GLEventListener { } else { glel = new GLEventListener() { @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.glClearColor(0.0f, 0.0f, 1.0f, 0.0f); // gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); @@ -601,7 +601,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } }; @@ -617,7 +617,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { glelButton.addMouseListener(dragZoomRotateListener); glelButton.addMouseListener(new UIShape.MouseGestureAdapter() { @Override - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { glelButton.setAnimate( glelButton.isToggleOn() ); } } ); buttons.add(glelButton); @@ -666,7 +666,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { final boolean enableOthers = true; @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { final Object upObj = drawable.getUpstreamWidget(); if( upObj instanceof Window ) { final Window upWin = (Window)upObj; @@ -707,7 +707,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { try { font = FontFactory.get(fontSet).getDefault(); - } catch (IOException ioe) { + } catch (final IOException ioe) { System.err.println("Caught: "+ioe.getMessage()); ioe.printStackTrace(); } @@ -717,8 +717,8 @@ public class GPUUISceneGLListener0A implements GLEventListener { // renderer = RegionRenderer.create(rs, null, null); gl.setSwapInterval(1); - gl.glEnable(GL2ES2.GL_DEPTH_TEST); - gl.glEnable(GL2ES2.GL_BLEND); + gl.glEnable(GL.GL_DEPTH_TEST); + gl.glEnable(GL.GL_BLEND); renderer.init(gl, renderModes); @@ -772,7 +772,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { if(drawable instanceof GLWindow) { System.err.println("GPUUISceneGLListener0A: dispose (1)"); final GLWindow glw = (GLWindow) drawable; @@ -783,7 +783,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { sceneUIController.dispose(drawable); // disposes all registered UIShapes - GL2ES2 gl = drawable.getGL().getGL2ES2(); + final GL2ES2 gl = drawable.getGL().getGL2ES2(); renderer.destroy(gl); screenshot.dispose(gl); } @@ -803,7 +803,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { // System.err.println("GPUUISceneGLListener0A: display"); final GL2ES2 gl = drawable.getGL().getGL2ES2(); @@ -856,7 +856,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { float lastWidth = 0f, lastHeight = 0f; @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { System.err.println("GPUUISceneGLListener0A: reshape"); // @@ -897,14 +897,14 @@ public class GPUUISceneGLListener0A implements GLEventListener { lastHeight = height; } - public void attachInputListenerTo(GLWindow window) { + public void attachInputListenerTo(final GLWindow window) { if ( !ioAttached ) { ioAttached = true; sceneUIController.attachInputListenerTo(window); } } - public void detachInputListenerFrom(GLWindow window) { + public void detachInputListenerFrom(final GLWindow window) { if ( ioAttached ) { ioAttached = false; sceneUIController.detachInputListenerFrom(window); @@ -920,18 +920,18 @@ public class GPUUISceneGLListener0A implements GLEventListener { boolean dragFirst = false; @Override - public void mousePressed(MouseEvent e) { + public void mousePressed(final MouseEvent e) { dragFirst = true; } @Override - public void mouseReleased(MouseEvent e) { + public void mouseReleased(final MouseEvent e) { dragFirst = false; actionText = null; } @Override - public void mouseDragged(MouseEvent e) { + public void mouseDragged(final MouseEvent e) { final Object attachment = e.getAttachment(); if( attachment instanceof UIShape.PointerEventInfo ) { final UIShape.PointerEventInfo shapeEvent = (UIShape.PointerEventInfo)attachment; @@ -956,7 +956,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { } @Override - public void mouseWheelMoved(MouseEvent e) { + public void mouseWheelMoved(final MouseEvent e) { final Object attachment = e.getAttachment(); if( attachment instanceof UIShape.PointerEventInfo ) { final UIShape.PointerEventInfo shapeEvent = (UIShape.PointerEventInfo)attachment; @@ -979,7 +979,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { } } @Override - public void gestureDetected(GestureEvent e) { + public void gestureDetected(final GestureEvent e) { final Object attachment = e.getAttachment(); if( attachment instanceof UIShape.PointerEventInfo ) { final UIShape.PointerEventInfo shapeEvent = (UIShape.PointerEventInfo)attachment; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java index 993734e46..274fbea2a 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java @@ -36,18 +36,18 @@ public class GPUUISceneNewtCanvasAWTDemo { try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { - java.awt.Dimension d = new java.awt.Dimension(new_sz.getWidth(), new_sz.getHeight()); + final java.awt.Dimension d = new java.awt.Dimension(new_sz.getWidth(), new_sz.getHeight()); comp.setMinimumSize(d); comp.setPreferredSize(d); comp.setSize(d); } } ); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } } - public static void main(String[] args) throws InterruptedException, InvocationTargetException { + public static void main(final String[] args) throws InterruptedException, InvocationTargetException { int width = 800, height = 400; int x = 10, y = 10; @@ -129,7 +129,7 @@ public class GPUUISceneNewtCanvasAWTDemo { glp = GLProfile.getGL2ES2(); } System.err.println("GLProfile: "+glp); - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(4); if( SceneMSAASamples > 0 ) { caps.setSampleBuffers(true); @@ -153,7 +153,7 @@ public class GPUUISceneNewtCanvasAWTDemo { window.setSurfaceScale(reqSurfacePixelScale); final int[] valReqSurfacePixelScale = window.getRequestedSurfaceScale(new int[2]); - GPUUISceneGLListener0A sceneGLListener = 0 < GraphAutoMode ? new GPUUISceneGLListener0A(GraphAutoMode, DEBUG, TRACE) : + final GPUUISceneGLListener0A sceneGLListener = 0 < GraphAutoMode ? new GPUUISceneGLListener0A(GraphAutoMode, DEBUG, TRACE) : new GPUUISceneGLListener0A(rmode, DEBUG, TRACE); window.addGLEventListener(sceneGLListener); @@ -164,7 +164,7 @@ public class GPUUISceneNewtCanvasAWTDemo { animator.add(window); window.addWindowListener(new WindowAdapter() { - public void windowDestroyed(WindowEvent e) { + public void windowDestroyed(final WindowEvent e) { animator.stop(); } }); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java index 15cf99f3b..16d56a041 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java @@ -22,7 +22,7 @@ public class GPUUISceneNewtDemo { static int[] reqSurfacePixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE }; - public static void main(String[] args) { + public static void main(final String[] args) { int width = 800, height = 400; int x = 10, y = 10; @@ -104,7 +104,7 @@ public class GPUUISceneNewtDemo { glp = GLProfile.getGL2ES2(); } System.err.println("GLProfile: "+glp); - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(4); if( SceneMSAASamples > 0 ) { caps.setSampleBuffers(true); @@ -128,7 +128,7 @@ public class GPUUISceneNewtDemo { window.setSurfaceScale(reqSurfacePixelScale); final int[] valReqSurfacePixelScale = window.getRequestedSurfaceScale(new int[2]); - GPUUISceneGLListener0A sceneGLListener = 0 < GraphAutoMode ? new GPUUISceneGLListener0A(GraphAutoMode, DEBUG, TRACE) : + final GPUUISceneGLListener0A sceneGLListener = 0 < GraphAutoMode ? new GPUUISceneGLListener0A(GraphAutoMode, DEBUG, TRACE) : new GPUUISceneGLListener0A(rmode, DEBUG, TRACE); window.addGLEventListener(sceneGLListener); @@ -139,7 +139,7 @@ public class GPUUISceneNewtDemo { animator.add(window); window.addWindowListener(new WindowAdapter() { - public void windowDestroyed(WindowEvent e) { + public void windowDestroyed(final WindowEvent e) { animator.stop(); } }); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/MSAATool.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/MSAATool.java index 3a4e3c4ce..d838e42e8 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/MSAATool.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/MSAATool.java @@ -34,55 +34,55 @@ import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLCapabilitiesImmutable; public class MSAATool { - public static boolean glIsEnabled(GL gl, int name) { + public static boolean glIsEnabled(final GL gl, final int name) { boolean isEnabled = false; try { isEnabled = gl.glIsEnabled(name); - int glerr = gl.glGetError(); + final int glerr = gl.glGetError(); if(GL.GL_NO_ERROR != glerr) { System.err.println("glIsEnabled(0x"+Integer.toHexString(name)+") -> error 0x"+Integer.toHexString(glerr)); } - } catch (Exception e) { + } catch (final Exception e) { System.err.println("Caught exception: "+e.getMessage()); // e.printStackTrace(); } return isEnabled; } - public static void dump(GLAutoDrawable drawable) { - float[] vf = new float[] { 0f }; - byte[] vb = new byte[] { 0 }; - int[] vi = new int[] { 0, 0 }; + public static void dump(final GLAutoDrawable drawable) { + final float[] vf = new float[] { 0f }; + final byte[] vb = new byte[] { 0 }; + final int[] vi = new int[] { 0, 0 }; System.out.println("GL MSAA SETUP:"); - GL2ES2 gl = drawable.getGL().getGL2ES2(); - GLCapabilitiesImmutable caps = drawable.getChosenGLCapabilities(); + final GL2ES2 gl = drawable.getGL().getGL2ES2(); + final GLCapabilitiesImmutable caps = drawable.getChosenGLCapabilities(); System.out.println(" Caps realised "+caps); System.out.println(" Caps sample buffers "+caps.getSampleBuffers()+", samples "+caps.getNumSamples()); - System.out.println(" GL MULTISAMPLE "+glIsEnabled(gl, GL2ES2.GL_MULTISAMPLE)); + System.out.println(" GL MULTISAMPLE "+glIsEnabled(gl, GL.GL_MULTISAMPLE)); // sample buffers min 0, same as GLX_SAMPLE_BUFFERS_ARB or WGL_SAMPLE_BUFFERS_ARB - gl.glGetIntegerv(GL2GL3.GL_SAMPLE_BUFFERS, vi, 0); + gl.glGetIntegerv(GL.GL_SAMPLE_BUFFERS, vi, 0); // samples min 0 - gl.glGetIntegerv(GL2GL3.GL_SAMPLES, vi, 1); + gl.glGetIntegerv(GL.GL_SAMPLES, vi, 1); System.out.println(" GL SAMPLE_BUFFERS "+vi[0]+", SAMPLES "+vi[1]); System.out.println("GL CSAA SETUP:"); // default FALSE - System.out.println(" GL SAMPLE COVERAGE "+glIsEnabled(gl, GL2GL3.GL_SAMPLE_COVERAGE)); + System.out.println(" GL SAMPLE COVERAGE "+glIsEnabled(gl, GL.GL_SAMPLE_COVERAGE)); // default FALSE - System.out.println(" GL SAMPLE_ALPHA_TO_COVERAGE "+glIsEnabled(gl, GL2GL3.GL_SAMPLE_ALPHA_TO_COVERAGE)); + System.out.println(" GL SAMPLE_ALPHA_TO_COVERAGE "+glIsEnabled(gl, GL.GL_SAMPLE_ALPHA_TO_COVERAGE)); // default FALSE - System.out.println(" GL SAMPLE_ALPHA_TO_ONE "+glIsEnabled(gl, GL2GL3.GL_SAMPLE_ALPHA_TO_ONE)); + System.out.println(" GL SAMPLE_ALPHA_TO_ONE "+glIsEnabled(gl, GL.GL_SAMPLE_ALPHA_TO_ONE)); // default FALSE, value 1, invert false - gl.glGetFloatv(GL2GL3.GL_SAMPLE_COVERAGE_VALUE, vf, 0); - gl.glGetBooleanv(GL2GL3.GL_SAMPLE_COVERAGE_INVERT, vb, 0); - System.out.println(" GL SAMPLE_COVERAGE "+glIsEnabled(gl, GL2GL3.GL_SAMPLE_COVERAGE) + + gl.glGetFloatv(GL.GL_SAMPLE_COVERAGE_VALUE, vf, 0); + gl.glGetBooleanv(GL.GL_SAMPLE_COVERAGE_INVERT, vb, 0); + System.out.println(" GL SAMPLE_COVERAGE "+glIsEnabled(gl, GL.GL_SAMPLE_COVERAGE) + ": SAMPLE_COVERAGE_VALUE "+vf[0]+ ", SAMPLE_COVERAGE_INVERT "+vb[0]); dumpBlend(gl); } - public static void dumpBlend(GL gl) { - int[] vi = new int[] { 0, 0, 0, 0 }; + public static void dumpBlend(final GL gl) { + final int[] vi = new int[] { 0, 0, 0, 0 }; gl.glGetIntegerv(GL.GL_BLEND, vi, 0); gl.glGetIntegerv(GL.GL_BLEND_SRC_ALPHA, vi, 1); gl.glGetIntegerv(GL.GL_BLEND_SRC_RGB, vi, 2); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/CrossHair.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/CrossHair.java index 1056bb0f9..0086222dc 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/CrossHair.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/CrossHair.java @@ -40,7 +40,7 @@ import com.jogamp.graph.geom.Vertex.Factory; public class CrossHair extends UIShape { private float width, height, lineWidth; - public CrossHair(Factory factory, int renderModes, float width, float height, float linewidth) { + public CrossHair(final Factory factory, final int renderModes, final float width, final float height, final float linewidth) { super(factory, renderModes); this.width = width; this.height = height; @@ -51,7 +51,7 @@ public class CrossHair extends UIShape { public final float getHeight() { return height; } public final float getLineWidth() { return lineWidth; } - public void setDimension(float width, float height, float lineWidth) { + public void setDimension(final float width, final float height, final float lineWidth) { this.width = width; this.height = height; this.lineWidth = lineWidth; @@ -59,15 +59,15 @@ public class CrossHair extends UIShape { } @Override - protected void clearImpl(GL2ES2 gl, RegionRenderer renderer) { + protected void clearImpl(final GL2ES2 gl, final RegionRenderer renderer) { } @Override - protected void destroyImpl(GL2ES2 gl, RegionRenderer renderer) { + protected void destroyImpl(final GL2ES2 gl, final RegionRenderer renderer) { } @Override - protected void addShapeToRegion(GL2ES2 gl, RegionRenderer renderer) { + protected void addShapeToRegion(final GL2ES2 gl, final RegionRenderer renderer) { final OutlineShape shape = new OutlineShape(renderer.getRenderState().getVertexFactory()); final float tw = getWidth(); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/GLEventListenerButton.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/GLEventListenerButton.java index 6dada5f1e..bdbb77f2d 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/GLEventListenerButton.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/GLEventListenerButton.java @@ -72,7 +72,7 @@ public class GLEventListenerButton extends TextureSeqButton { this.fboHeight = fboHeight; } - public final void setAnimate(boolean v) { animateGLEL = v; } + public final void setAnimate(final boolean v) { animateGLEL = v; } public final boolean getAnimate() { return animateGLEL; } public final void setFBOSize(final int fboWidth, final int fboHeight) { @@ -83,7 +83,7 @@ public class GLEventListenerButton extends TextureSeqButton { public final GLOffscreenAutoDrawable.FBO getFBOAutoDrawable() { return fboGLAD; } @Override - public void drawShape(GL2ES2 gl, RegionRenderer renderer, int[] sampleCount) { + public void drawShape(final GL2ES2 gl, final RegionRenderer renderer, final int[] sampleCount) { if( null == fboGLAD ) { final ImageSequence imgSeq = (ImageSequence)texSeq; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/ImageSeqButton.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/ImageSeqButton.java index ca6f79448..5d8e9e8db 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/ImageSeqButton.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/ImageSeqButton.java @@ -54,7 +54,7 @@ public class ImageSeqButton extends TextureSeqButton { } @Override - public void drawShape(GL2ES2 gl, RegionRenderer renderer, int[] sampleCount) { + public void drawShape(final GL2ES2 gl, final RegionRenderer renderer, final int[] sampleCount) { super.drawShape(gl, renderer, sampleCount); if( !((ImageSequence)texSeq).getManualStepping() ) { markStateDirty(); // keep on going diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java index 175d18135..1181ef914 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java @@ -43,7 +43,7 @@ public class Label extends UIShape { protected float pixelSize; protected String text; - public Label(Factory factory, int renderModes, Font font, float pixelSize, String text) { + public Label(final Factory factory, final int renderModes, final Font font, final float pixelSize, final String text) { super(factory, renderModes); this.font = font; this.pixelSize = pixelSize; @@ -54,7 +54,7 @@ public class Label extends UIShape { return text; } - public void setText(String text) { + public void setText(final String text) { this.text = text; markShapeDirty(); } @@ -63,7 +63,7 @@ public class Label extends UIShape { return font; } - public void setFont(Font font) { + public void setFont(final Font font) { this.font = font; markShapeDirty(); } @@ -76,17 +76,17 @@ public class Label extends UIShape { return font.getLineHeight(pixelSize); } - public void setPixelSize(float pixelSize) { + public void setPixelSize(final float pixelSize) { this.pixelSize = pixelSize; markShapeDirty(); } @Override - protected void clearImpl(GL2ES2 gl, RegionRenderer renderer) { + protected void clearImpl(final GL2ES2 gl, final RegionRenderer renderer) { } @Override - protected void destroyImpl(GL2ES2 gl, RegionRenderer renderer) { + protected void destroyImpl(final GL2ES2 gl, final RegionRenderer renderer) { } private final float[] tmpV3 = new float[3]; @@ -95,7 +95,7 @@ public class Label extends UIShape { private final TextRegionUtil.ShapeVisitor shapeVisitor = new TextRegionUtil.ShapeVisitor() { @Override - public void visit(OutlineShape shape, AffineTransform t) { + public void visit(final OutlineShape shape, final AffineTransform t) { shape.setSharpness(shapesSharpness); region.addOutlineShape(shape, t, rgbaColor); box.resize(shape.getBounds(), t, tmpV3); @@ -103,7 +103,7 @@ public class Label extends UIShape { }; @Override - protected void addShapeToRegion(GL2ES2 gl, RegionRenderer renderer) { + protected void addShapeToRegion(final GL2ES2 gl, final RegionRenderer renderer) { TextRegionUtil.processString(shapeVisitor, null, font, pixelSize, text, tempT1, tempT2); final float[] ctr = box.getCenter(); setRotationOrigin( ctr[0], ctr[1], ctr[2]); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label0.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label0.java index 573dd5604..9a12b7175 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label0.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label0.java @@ -41,7 +41,7 @@ public class Label0 { protected final float[] rgbaColor; protected final AABBox box; - public Label0(Font font, String text, float[] rgbaColor) { + public Label0(final Font font, final String text, final float[] rgbaColor) { this.font = font; this.text = text; this.rgbaColor = rgbaColor; @@ -52,20 +52,20 @@ public class Label0 { public final float[] getColor() { return rgbaColor; } - public final void setColor(float r, float g, float b, float a) { + public final void setColor(final float r, final float g, final float b, final float a) { this.rgbaColor[0] = r; this.rgbaColor[1] = g; this.rgbaColor[2] = b; this.rgbaColor[3] = a; } - public final void setText(String text) { + public final void setText(final String text) { this.text = text; } public final Font getFont() { return font; } - public final void setFont(Font font) { + public final void setFont(final Font font) { this.font = font; } @@ -77,7 +77,7 @@ public class Label0 { private final TextRegionUtil.ShapeVisitor shapeVisitor = new TextRegionUtil.ShapeVisitor() { @Override - public void visit(OutlineShape shape, AffineTransform t) { + public void visit(final OutlineShape shape, final AffineTransform t) { final AffineTransform t1 = t.preConcatenate(tLeft); region.addOutlineShape(shape, t1, rgbaColor); box.resize(shape.getBounds(), t1, tmpV3); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/LabelButton.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/LabelButton.java index 0ac728e50..4943c9418 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/LabelButton.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/LabelButton.java @@ -27,6 +27,7 @@ */ package com.jogamp.opengl.test.junit.graph.demos.ui; +import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; import com.jogamp.graph.curve.OutlineShape; @@ -64,20 +65,20 @@ public class LabelButton extends RoundButton { } @Override - public void drawShape(GL2ES2 gl, RegionRenderer renderer, int[] sampleCount) { + public void drawShape(final GL2ES2 gl, final RegionRenderer renderer, final int[] sampleCount) { if( false ) { // Setup poly offset for z-fighting - gl.glEnable(GL2ES2.GL_POLYGON_OFFSET_FILL); + gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); gl.glPolygonOffset(0f, 1f); super.drawShape(gl, renderer, sampleCount); - gl.glDisable(GL2ES2.GL_POLYGON_OFFSET_FILL); + gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); } else { super.drawShape(gl, renderer, sampleCount); } } @Override - protected void addShapeToRegion(GL2ES2 gl, RegionRenderer renderer) { + protected void addShapeToRegion(final GL2ES2 gl, final RegionRenderer renderer) { final OutlineShape shape = new OutlineShape(renderer.getRenderState().getVertexFactory()); if(corner == 0.0f) { createSharpOutline(shape, DEFAULT_2PASS_LABEL_ZOFFSET); @@ -133,7 +134,7 @@ public class LabelButton extends RoundButton { * @param spacingX spacing in percent on X, default is {@link #DEFAULT_SPACING_X} * @param spacingY spacing in percent on Y, default is {@link #DEFAULT_SPACING_Y} */ - public final void setSpacing(float spacingX, float spacingY) { + public final void setSpacing(final float spacingX, final float spacingY) { if ( spacingX < 0.0f ) { this.spacingX = 0.0f; } else if ( spacingX > 1.0f ) { @@ -155,7 +156,7 @@ public class LabelButton extends RoundButton { return label.getColor(); } - public final void setLabelColor(float r, float g, float b) { + public final void setLabelColor(final float r, final float g, final float b) { label.setColor(r, g, b, 1.0f); markShapeDirty(); } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/MediaPlayerButton.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/MediaPlayerButton.java index 7ec653b62..76b70ddf8 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/MediaPlayerButton.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/MediaPlayerButton.java @@ -73,12 +73,12 @@ public class MediaPlayerButton extends TextureSeqButton { private final GLMediaEventListener defGLMediaEventListener = new GLMediaEventListener() { @Override - public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) { + public void newFrameAvailable(final GLMediaPlayer ts, final TextureFrame newFrame, final long when) { // texButton.markStateDirty(); } @Override - public void attributesChanged(final GLMediaPlayer mp, int event_mask, long when) { + public void attributesChanged(final GLMediaPlayer mp, final int event_mask, final long when) { final GLMediaPlayer mPlayer = (GLMediaPlayer)texSeq; if( verbose ) { System.err.println("MovieCube AttributesChanges: events_mask 0x"+Integer.toHexString(event_mask)+", when "+when); @@ -107,12 +107,12 @@ public class MediaPlayerButton extends TextureSeqButton { @Override - protected void destroyImpl(GL2ES2 gl, RegionRenderer renderer) { + protected void destroyImpl(final GL2ES2 gl, final RegionRenderer renderer) { ((GLMediaPlayer)texSeq).destroy(gl); } @Override - public void drawShape(GL2ES2 gl, RegionRenderer renderer, int[] sampleCount) { + public void drawShape(final GL2ES2 gl, final RegionRenderer renderer, final int[] sampleCount) { final GLMediaPlayer mPlayer = (GLMediaPlayer)texSeq; if( GLMediaPlayer.State.Initialized == mPlayer.getState() ) { try { @@ -120,7 +120,7 @@ public class MediaPlayerButton extends TextureSeqButton { mPlayer.setAudioVolume( 0f ); mPlayer.play(); markStateDirty(); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RoundButton.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RoundButton.java index 2d7320f64..c455ea365 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RoundButton.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RoundButton.java @@ -53,11 +53,11 @@ public abstract class RoundButton extends UIShape { } @Override - protected void clearImpl(GL2ES2 gl, RegionRenderer renderer) { + protected void clearImpl(final GL2ES2 gl, final RegionRenderer renderer) { } @Override - protected void destroyImpl(GL2ES2 gl, RegionRenderer renderer) { + protected void destroyImpl(final GL2ES2 gl, final RegionRenderer renderer) { } public final float getWidth() { return width; } @@ -66,7 +66,7 @@ public abstract class RoundButton extends UIShape { public final float getCorner() { return corner; } - public void setDimension(float width, float height) { + public void setDimension(final float width, final float height) { this.width = width; this.height = height; markShapeDirty(); @@ -115,7 +115,7 @@ public abstract class RoundButton extends UIShape { } /** Set corner size, default is {@link #DEFAULT_CORNER} */ - public void setCorner(float corner) { + public void setCorner(final float corner) { if(corner > 1.0f){ this.corner = 1.0f; } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/SceneUIController.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/SceneUIController.java index 4581223d7..008d4e038 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/SceneUIController.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/SceneUIController.java @@ -54,7 +54,7 @@ public class SceneUIController implements GLEventListener{ this(null, sceneDist, zNear, zFar); } - public SceneUIController(RegionRenderer renderer, float sceneDist, float zNear, float zFar) { + public SceneUIController(final RegionRenderer renderer, final float sceneDist, final float zNear, final float zFar) { this.renderer = renderer; this.sceneDist = sceneDist; this.zFar = zFar; @@ -62,11 +62,11 @@ public class SceneUIController implements GLEventListener{ this.sampleCount[0] = 4; } - public void setRenderer(RegionRenderer renderer) { + public void setRenderer(final RegionRenderer renderer) { this.renderer = renderer; } - public void attachInputListenerTo(GLWindow window) { + public void attachInputListenerTo(final GLWindow window) { if(null == sbcMouseListener) { sbcMouseListener = new SBCMouseListener(); window.addMouseListener(sbcMouseListener); @@ -77,7 +77,7 @@ public class SceneUIController implements GLEventListener{ } } - public void detachInputListenerFrom(GLWindow window) { + public void detachInputListenerFrom(final GLWindow window) { if(null != sbcMouseListener) { window.removeMouseListener(sbcMouseListener); sbcMouseListener = null; @@ -91,15 +91,15 @@ public class SceneUIController implements GLEventListener{ public ArrayList getShapes() { return shapes; } - public void addShape(UIShape b) { + public void addShape(final UIShape b) { shapes.add(b); } - public void removeShape(UIShape b) { + public void removeShape(final UIShape b) { shapes.remove(b); } public int getSampleCount() { return sampleCount[0]; } - public void setSampleCount(int v) { sampleCount[0]=v; markAllShapesDirty(); } + public void setSampleCount(final int v) { sampleCount[0]=v; markAllShapesDirty(); } public void setAllShapesQuality(final int q) { for(int i=0; i getVertexFactory() { return vertexFactory; } public boolean isEnabled() { return enabled; } - public void setEnabled(boolean v) { enabled = v; } + public void setEnabled(final boolean v) { enabled = v; } /** * Clears all data and reset all states as if this instance was newly created * @param gl TODO * @param renderer TODO\ */ - public void clear(GL2ES2 gl, RegionRenderer renderer) { + public void clear(final GL2ES2 gl, final RegionRenderer renderer) { clearImpl(gl, renderer); translate[0] = 0f; translate[1] = 0f; @@ -125,7 +125,7 @@ public abstract class UIShape { * @param gl * @param renderer */ - public void destroy(GL2ES2 gl, RegionRenderer renderer) { + public void destroy(final GL2ES2 gl, final RegionRenderer renderer) { destroyImpl(gl, renderer); translate[0] = 0f; translate[1] = 0f; @@ -141,13 +141,13 @@ public abstract class UIShape { markShapeDirty(); } - public void setTranslate(float tx, float ty, float tz) { + public void setTranslate(final float tx, final float ty, final float tz) { translate[0] = tx; translate[1] = ty; translate[2] = tz; // System.err.println("UIShape.setTranslate: "+tx+"/"+ty+"/"+tz+": "+toString()); } - public void translate(float tx, float ty, float tz) { + public void translate(final float tx, final float ty, final float tz) { translate[0] += tx; translate[1] += ty; translate[2] += tz; @@ -156,17 +156,17 @@ public abstract class UIShape { public final float[] getTranslate() { return translate; } public final Quaternion getRotation() { return rotation; } public final float[] getRotationOrigin() { return rotOrigin; } - public void setRotationOrigin(float rx, float ry, float rz) { + public void setRotationOrigin(final float rx, final float ry, final float rz) { rotOrigin[0] = rx; rotOrigin[1] = ry; rotOrigin[2] = rz; } - public void setScale(float sx, float sy, float sz) { + public void setScale(final float sx, final float sy, final float sz) { scale[0] = sx; scale[1] = sy; scale[2] = sz; } - public void scale(float sx, float sy, float sz) { + public void scale(final float sx, final float sy, final float sz) { scale[0] *= sx; scale[1] *= sy; scale[2] *= sz; @@ -190,7 +190,7 @@ public abstract class UIShape { public final int getRenderModes() { return renderModes; } - public GLRegion getRegion(GL2ES2 gl, RegionRenderer renderer) { + public GLRegion getRegion(final GL2ES2 gl, final RegionRenderer renderer) { validate(gl, renderer); return region; } @@ -204,7 +204,7 @@ public abstract class UIShape { * @param renderer * @param sampleCount */ - public void drawShape(GL2ES2 gl, RegionRenderer renderer, int[] sampleCount) { + public void drawShape(final GL2ES2 gl, final RegionRenderer renderer, final int[] sampleCount) { final float r, g, b, a; final boolean isPressed = isPressed(), isToggleOn = isToggleOn(); final boolean modBaseColor = !Region.hasColorChannel( renderModes ) && !Region.hasColorTexture( renderModes ); @@ -271,7 +271,7 @@ public abstract class UIShape { * @param gl * @param renderer */ - public final void validate(GL2ES2 gl, RegionRenderer renderer) { + public final void validate(final GL2ES2 gl, final RegionRenderer renderer) { if( isShapeDirty() || null == region ) { box.reset(); if( null == region ) { @@ -306,7 +306,7 @@ public abstract class UIShape { region.setQuality(q); } } - public final void setSharpness(float sharpness) { + public final void setSharpness(final float sharpness) { this.shapesSharpness = sharpness; markShapeDirty(); } @@ -314,25 +314,25 @@ public abstract class UIShape { return shapesSharpness; } - public final void setColor(float r, float g, float b, float a) { + public final void setColor(final float r, final float g, final float b, final float a) { this.rgbaColor[0] = r; this.rgbaColor[1] = g; this.rgbaColor[2] = b; this.rgbaColor[3] = a; } - public final void setPressedColorMod(float r, float g, float b, float a) { + public final void setPressedColorMod(final float r, final float g, final float b, final float a) { this.pressedRGBAModulate[0] = r; this.pressedRGBAModulate[1] = g; this.pressedRGBAModulate[2] = b; this.pressedRGBAModulate[3] = a; } - public final void setToggleOnColorMod(float r, float g, float b, float a) { + public final void setToggleOnColorMod(final float r, final float g, final float b, final float a) { this.toggleOnRGBAModulate[0] = r; this.toggleOnRGBAModulate[1] = g; this.toggleOnRGBAModulate[2] = b; this.toggleOnRGBAModulate[3] = a; } - public final void setToggleOffColorMod(float r, float g, float b, float a) { + public final void setToggleOffColorMod(final float r, final float g, final float b, final float a) { this.toggleOffRGBAModulate[0] = r; this.toggleOffRGBAModulate[1] = g; this.toggleOffRGBAModulate[2] = b; @@ -409,7 +409,7 @@ public abstract class UIShape { */ public static abstract class MouseGestureAdapter extends MouseAdapter implements MouseGestureListener { @Override - public void gestureDetected(GestureEvent gh) { + public void gestureDetected(final GestureEvent gh) { } } @@ -522,7 +522,7 @@ public abstract class UIShape { // // - protected OutlineShape createDebugOutline(OutlineShape shape, AABBox box) { + protected OutlineShape createDebugOutline(final OutlineShape shape, final AABBox box) { final float tw = box.getWidth(); final float th = box.getHeight(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java index f4504dbc7..26974eb30 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java @@ -72,13 +72,13 @@ public abstract class GLReadBuffer00Base extends UITestCase { } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { regionFPS.destroy(drawable.getGL().getGL2ES2()); super.dispose(drawable); } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { final String text = String.format("Frame %04d (%03d): %04dx%04d", frameNo, userCounter, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); System.err.println("TextRendererGLEL.display: "+text); if( null != renderer ) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java index 00001d8d2..505e9a748 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java @@ -64,7 +64,7 @@ public abstract class InitConcurrentBaseNEWT extends UITestCase { @BeforeClass public static void initClass() { - Window dummyWindow = NewtFactory.createWindow(new Capabilities()); + final Window dummyWindow = NewtFactory.createWindow(new Capabilities()); dummyWindow.setSize(demoWinSize, demoWinSize); dummyWindow.setVisible(true); Assert.assertEquals(true, dummyWindow.isVisible()); @@ -85,14 +85,14 @@ public abstract class InitConcurrentBaseNEWT extends UITestCase { private final boolean reuse; private boolean done = false; - public JOGLTask(Object postSync, int id, boolean reuse) { + public JOGLTask(final Object postSync, final int id, final boolean reuse) { this.postSync = postSync; this.id = id; this.reuse = reuse; } public void run() { - int x = ( id % num_x ) * ( demoWinSize + insets.getTotalHeight() ); - int y = ( (id / num_x) % num_y ) * ( demoWinSize + insets.getTotalHeight() ); + final int x = ( id % num_x ) * ( demoWinSize + insets.getTotalHeight() ); + final int y = ( (id / num_x) % num_y ) * ( demoWinSize + insets.getTotalHeight() ); System.err.println("JOGLTask "+id+": START: "+x+"/"+y+", reuse "+reuse+" - "+Thread.currentThread().getName()); final Display display = NewtFactory.createDisplay(null, reuse); @@ -105,7 +105,7 @@ public abstract class InitConcurrentBaseNEWT extends UITestCase { glWindow.addGLEventListener(new ValidateLockListener()); glWindow.addGLEventListener(new GearsES2(0)); - Animator animator = new Animator(glWindow); + final Animator animator = new Animator(glWindow); glWindow.setSize(demoWinSize, demoWinSize); glWindow.setVisible(true); @@ -123,7 +123,7 @@ public abstract class InitConcurrentBaseNEWT extends UITestCase { while(animator.isAnimating() && animator.getTotalFPSDuration()=0; i--) { if(!tasks[i].done()) { return false; @@ -150,8 +150,8 @@ public abstract class InitConcurrentBaseNEWT extends UITestCase { } return true; } - protected static String doneDump(JOGLTask[] tasks) { - StringBuilder sb = new StringBuilder(); + protected static String doneDump(final JOGLTask[] tasks) { + final StringBuilder sb = new StringBuilder(); sb.append("["); for(int i=0; i0) { @@ -163,7 +163,7 @@ public abstract class InitConcurrentBaseNEWT extends UITestCase { return sb.toString(); } - protected static boolean isDead(Thread[] threads) { + protected static boolean isDead(final Thread[] threads) { for(int i=threads.length-1; i>=0; i--) { if(threads[i].isAlive()) { return false; @@ -171,8 +171,8 @@ public abstract class InitConcurrentBaseNEWT extends UITestCase { } return true; } - protected static String isAliveDump(Thread[] threads) { - StringBuilder sb = new StringBuilder(); + protected static String isAliveDump(final Thread[] threads) { + final StringBuilder sb = new StringBuilder(); sb.append("["); for(int i=0; i0) { @@ -184,7 +184,7 @@ public abstract class InitConcurrentBaseNEWT extends UITestCase { return sb.toString(); } - protected void runJOGLTasks(int num, boolean reuse) throws InterruptedException { + protected void runJOGLTasks(final int num, final boolean reuse) throws InterruptedException { System.err.println("InitConcurrentBaseNEWT "+num+" threads, reuse display: "+reuse); final String currentThreadName = Thread.currentThread().getName(); final Object syncDone = new Object(); @@ -205,7 +205,7 @@ public abstract class InitConcurrentBaseNEWT extends UITestCase { while(!done(tasks)) { try { syncDone.wait(500); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { throw new RuntimeException(e); } System.err.println(i+": "+doneDump(tasks)); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAWTCloseX11DisplayBug565.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAWTCloseX11DisplayBug565.java index d8506a0d6..0913cd2a8 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAWTCloseX11DisplayBug565.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAWTCloseX11DisplayBug565.java @@ -25,18 +25,18 @@ public class TestAWTCloseX11DisplayBug565 { try { for ( int j = 0; j < 10; j++ ) { final int open0; - if(NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(false)) { + if(NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(false)) { open0 = X11Util.getOpenDisplayConnectionNumber(); } else { open0 = 0; } - - GLCapabilitiesImmutable caps = new GLCapabilities( GLProfile.getDefault( ) ); + + final GLCapabilitiesImmutable caps = new GLCapabilities( GLProfile.getDefault( ) ); final Frame frame = new Frame( "AWT Resource X11 Leak - #" + j ); - + final GLCanvas glCanvas = new GLCanvas( caps ); frame.add( glCanvas ); - + try { javax.swing.SwingUtilities.invokeAndWait( new Runnable() { public void run() { @@ -45,7 +45,7 @@ public class TestAWTCloseX11DisplayBug565 { } } ); } - catch ( Throwable t ) { + catch ( final Throwable t ) { t.printStackTrace(); Assert.fail(t.getMessage()); } @@ -59,7 +59,7 @@ public class TestAWTCloseX11DisplayBug565 { } } ); } - catch ( Throwable t ) { + catch ( final Throwable t ) { t.printStackTrace(); Assert.fail(t.getMessage()); } @@ -74,16 +74,16 @@ public class TestAWTCloseX11DisplayBug565 { } } } - catch ( Exception e ) { + catch ( final Exception e ) { e.printStackTrace(); Assert.fail(e.getMessage()); } } - public static void main(String args[]) { + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestAWTCloseX11DisplayBug565.class.getName()); } - + } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove01GLCanvasSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove01GLCanvasSwingAWT.java index 8dfd93e47..87da6991a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove01GLCanvasSwingAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove01GLCanvasSwingAWT.java @@ -42,6 +42,7 @@ import javax.media.opengl.awt.GLCanvas; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; +import javax.swing.WindowConstants; import jogamp.nativewindow.jawt.JAWTUtil; @@ -100,7 +101,7 @@ public class TestAddRemove01GLCanvasSwingAWT extends UITestCase { final JFrame jFrame1 = new JFrame("JFrame #"+num); // jFrame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - jFrame1.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); // equivalent to Frame, use windowClosing event! + jFrame1.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); // equivalent to Frame, use windowClosing event! jFrame1.getContentPane().add(jPanel[0]); jFrame1.setSize(width, height); @@ -145,7 +146,7 @@ public class TestAddRemove01GLCanvasSwingAWT extends UITestCase { } } ) ; } - protected void runTestGL(boolean onscreen, GLCapabilities caps, int addRemoveOpCount) + protected void runTestGL(final boolean onscreen, final GLCapabilities caps, final int addRemoveOpCount) throws AWTException, InterruptedException, InvocationTargetException { if(waitForKey) { @@ -159,7 +160,7 @@ public class TestAddRemove01GLCanvasSwingAWT extends UITestCase { if( !onscreen ) { glc.setShallUseOffscreenLayer(true); } - Dimension glc_sz = new Dimension(width, height); + final Dimension glc_sz = new Dimension(width, height); glc.setMinimumSize(glc_sz); glc.setPreferredSize(glc_sz); glc.setSize(glc_sz); @@ -203,7 +204,7 @@ public class TestAddRemove01GLCanvasSwingAWT extends UITestCase { System.err.println("No onscreen test requested or platform doesn't support onscreen rendering."); return; } - GLCapabilities caps = new GLCapabilities(glpGL2ES2); + final GLCapabilities caps = new GLCapabilities(glpGL2ES2); runTestGL(true, caps, addRemoveCount); } @@ -219,7 +220,7 @@ public class TestAddRemove01GLCanvasSwingAWT extends UITestCase { System.err.println("Only PBuffer test is requested."); return; } - GLCapabilities caps = new GLCapabilities(glpGL2ES2); + final GLCapabilities caps = new GLCapabilities(glpGL2ES2); if(offscreenPBufferOnly) { caps.setPBuffer(true); caps.setOnscreen(true); // simulate normal behavior .. @@ -239,19 +240,19 @@ public class TestAddRemove01GLCanvasSwingAWT extends UITestCase { System.err.println("Only FBO test is requested."); return; } - GLCapabilities caps = new GLCapabilities(glpGL2); + final GLCapabilities caps = new GLCapabilities(glpGL2); caps.setPBuffer(true); caps.setOnscreen(true); // simulate normal behavior .. runTestGL(false, caps, addRemoveCount); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i * Issues {@link GLContext#makeCurrent()} and {@link GLContext#release()} * from within {@link GLEventListener#display(GLAutoDrawable)}. - *

    - * + *

    + * * */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) @@ -62,64 +62,64 @@ public class TestBug669RecursiveGLContext01NEWT extends UITestCase { public void test01_Plain() { test01Impl(false); } - + @Test(timeout=5000) public void test01_Anim() { test01Impl(true); } - - private void test01Impl(boolean anim) { + + private void test01Impl(final boolean anim) { final String profile = GLProfile.GL2ES2; if(!GLProfile.isAvailable(profile)) { System.err.println(profile+" n/a"); return; } - + final GLProfile pro = GLProfile.get(profile); final GLCapabilities caps = new GLCapabilities(pro); final GLWindow window = GLWindow.create(caps); - + final Animator animator = new Animator(); if(anim) { animator.add(window); } animator.start(); - window.setSize(640, 480); + window.setSize(640, 480); window.addGLEventListener(new GLEventListener() { - private void makeCurrentRecursive(GLContextImpl context, int lockCount) { + private void makeCurrentRecursive(final GLContextImpl context, final int lockCount) { Assert.assertEquals(true, context.isOwner(Thread.currentThread())); Assert.assertEquals(lockCount, context.getLockCount()); Assert.assertEquals(true, context.isCurrent()); - + Assert.assertEquals(GLContext.CONTEXT_CURRENT, context.makeCurrent()); // recursive: lock +1 - + Assert.assertEquals(true, context.isOwner(Thread.currentThread())); Assert.assertEquals(lockCount+1, context.getLockCount()); Assert.assertEquals(true, context.isCurrent()); } - private void releaseRecursive(GLContextImpl context, int lockCount) { + private void releaseRecursive(final GLContextImpl context, final int lockCount) { Assert.assertEquals(true, context.isOwner(Thread.currentThread())); Assert.assertEquals(lockCount, context.getLockCount()); Assert.assertEquals(true, context.isCurrent()); // still current - + context.release(); // recursive: lock -1 - + Assert.assertEquals(true, context.isOwner(Thread.currentThread())); Assert.assertEquals(lockCount-1, context.getLockCount()); Assert.assertEquals(true, context.isCurrent()); // still current } - + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } public void init(final GLAutoDrawable drawable) { } public void dispose(final GLAutoDrawable drawable) { } - public void display(final GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { final GLContextImpl context = (GLContextImpl)drawable.getContext(); makeCurrentRecursive(context, 1); releaseRecursive(context, 2); } }); - window.addGLEventListener(new GearsES2()); + window.addGLEventListener(new GearsES2()); try { window.setVisible(true); @@ -129,10 +129,10 @@ public class TestBug669RecursiveGLContext01NEWT extends UITestCase { window.destroy(); } } - - public static void main(String args[]) { + + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestBug669RecursiveGLContext01NEWT.class.getName()); } - + } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext02NEWT.java index d83101659..54afe9143 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext02NEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -45,12 +45,12 @@ import com.jogamp.opengl.util.Animator; /** * Tests recursive GLContext behavior. - * + * *

    - * Issues {@link GLAutoDrawable#display()} of another {@link GLAutoDrawable} + * Issues {@link GLAutoDrawable#display()} of another {@link GLAutoDrawable} * from within {@link GLEventListener#display(GLAutoDrawable)}. *

    - * + * * */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) @@ -60,26 +60,26 @@ public class TestBug669RecursiveGLContext02NEWT extends UITestCase { public void test01_Plain() { test01Impl(false); } - + @Test(timeout=5000) public void test01_Anim() { test01Impl(true); } - - private void test01Impl(boolean anim) { + + private void test01Impl(final boolean anim) { final String profile = GLProfile.GL2ES2; if(!GLProfile.isAvailable(profile)) { System.err.println(profile+" n/a"); return; } - + final GLProfile pro = GLProfile.get(profile); final GLCapabilities caps = new GLCapabilities(pro); - + final GLWindow window2 = GLWindow.create(caps); // display() triggered by window's GLEventListener! window2.setPosition(0, 0); window2.setSize(200, 200); window2.addGLEventListener(new RedSquareES2()); - + final GLWindow window1 = GLWindow.create(caps); - + final Animator animator1 = new Animator(); final Animator animator2 = new Animator(); if(anim) { @@ -112,11 +112,11 @@ public class TestBug669RecursiveGLContext02NEWT extends UITestCase { if(anim) { try { Thread.sleep(500); - } catch(InterruptedException ie) {} + } catch(final InterruptedException ie) {} } } finally { animator1.stop(); - + final int win1Frames = window1.getTotalFPSFrames(); final int win2Frames = window2.getTotalFPSFrames(); System.err.println("Window1: frames "+win1Frames); @@ -126,10 +126,10 @@ public class TestBug669RecursiveGLContext02NEWT extends UITestCase { window2.destroy(); } } - - public static void main(String args[]) { + + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestBug669RecursiveGLContext02NEWT.class.getName()); } - + } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug692GL3VAONEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug692GL3VAONEWT.java index 5337b64a0..0a9ff5a28 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug692GL3VAONEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug692GL3VAONEWT.java @@ -33,6 +33,8 @@ import java.nio.ShortBuffer; import java.util.logging.Level; import java.util.logging.Logger; +import javax.media.opengl.GL; +import javax.media.opengl.GL2ES2; import javax.media.opengl.GL3; import javax.media.opengl.GL3bc; import javax.media.opengl.GLAutoDrawable; @@ -83,7 +85,7 @@ public class TestBug692GL3VAONEWT extends UITestCase { public enum Mode { CPU_SRC { @Override - void display(GL3VAODemo t, GL3bc gl) { + void display(final GL3VAODemo t, final GL3bc gl) { t.displayCPUSourcing(gl); } }, @@ -91,7 +93,7 @@ public class TestBug692GL3VAONEWT extends UITestCase { /** Traditional one without using VAO */ VBO_ONLY { @Override - void display(GL3VAODemo t, GL3bc gl) { + void display(final GL3VAODemo t, final GL3bc gl) { t.displayVBOOnly(gl); } }, @@ -99,7 +101,7 @@ public class TestBug692GL3VAONEWT extends UITestCase { /** Using VAOs throws [incorrectly as of JOGL 2.0rc11] a GLException */ VBO_VAO { @Override - void display(GL3VAODemo t, GL3bc gl) { + void display(final GL3VAODemo t, final GL3bc gl) { t.displayVBOVAO(gl); } }; @@ -111,7 +113,7 @@ public class TestBug692GL3VAONEWT extends UITestCase { private Mode currentMode; private int currentModeIdx; - public GL3VAODemo(Mode[] modes) { + public GL3VAODemo(final Mode[] modes) { allModes = modes; currentMode = allModes[0]; currentModeIdx = 0; @@ -136,11 +138,11 @@ public class TestBug692GL3VAONEWT extends UITestCase { private int vao = -1; - private static int createShader(final GL3 gl, int type, + private static int createShader(final GL3 gl, final int type, final String[] srcLines){ - int shaderID = gl.glCreateShader(type); + final int shaderID = gl.glCreateShader(type); assert shaderID > 0; - int[] lengths = new int[srcLines.length]; + final int[] lengths = new int[srcLines.length]; for (int i = 0; i < srcLines.length; i++) { lengths[i] = srcLines[i].length(); } @@ -149,28 +151,28 @@ public class TestBug692GL3VAONEWT extends UITestCase { return shaderID; } - private void initBuffers(GL3 gl) { + private void initBuffers(final GL3 gl) { // IDs for 2 buffers - int[] buffArray = new int[2]; + final int[] buffArray = new int[2]; gl.glGenBuffers(buffArray.length, buffArray, 0); vbo = buffArray[0]; assert vbo > 0; // Bind buffer and upload data - gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, vbo); - gl.glBufferData(GL3.GL_ARRAY_BUFFER, vertexColorData.length * Buffers.SIZEOF_FLOAT, - vertexColorDataBuffer, GL3.GL_STATIC_DRAW); - gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, 0); + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vbo); + gl.glBufferData(GL.GL_ARRAY_BUFFER, vertexColorData.length * Buffers.SIZEOF_FLOAT, + vertexColorDataBuffer, GL.GL_STATIC_DRAW); + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); // Buffer with the 3 indices required for one triangle ibo = buffArray[1]; assert ibo > 0; - gl.glBindBuffer(GL3.GL_ELEMENT_ARRAY_BUFFER, ibo); - gl.glBufferData(GL3.GL_ELEMENT_ARRAY_BUFFER,indices.length*Buffers.SIZEOF_SHORT, - indicesBuffer, GL3.GL_STATIC_DRAW); - gl.glBindBuffer(GL3.GL_ELEMENT_ARRAY_BUFFER, 0); + gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, ibo); + gl.glBufferData(GL.GL_ELEMENT_ARRAY_BUFFER,indices.length*Buffers.SIZEOF_SHORT, + indicesBuffer, GL.GL_STATIC_DRAW); + gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, 0); } - private void initShaders(GL3 gl) { + private void initShaders(final GL3 gl) { final String[] vertSrc = new String[]{ "#version 150\n", "in vec4 vPosition;\n", @@ -181,7 +183,7 @@ public class TestBug692GL3VAONEWT extends UITestCase { " gl_Position = vPosition;\n", "}\n" }; - vertID = createShader(gl, GL3.GL_VERTEX_SHADER, vertSrc); + vertID = createShader(gl, GL2ES2.GL_VERTEX_SHADER, vertSrc); final String[] fragSrc = new String[]{ "#version 150\n", @@ -190,7 +192,7 @@ public class TestBug692GL3VAONEWT extends UITestCase { " gl_FragColor = pColor;\n", "}\n" }; - fragID = createShader(gl, GL3.GL_FRAGMENT_SHADER, fragSrc); + fragID = createShader(gl, GL2ES2.GL_FRAGMENT_SHADER, fragSrc); // We're done with the compiler gl.glReleaseShaderCompiler(); @@ -203,10 +205,10 @@ public class TestBug692GL3VAONEWT extends UITestCase { gl.glValidateProgram(progID); } - private int initVAO(GL3 gl) { - int[] buff = new int[1]; + private int initVAO(final GL3 gl) { + final int[] buff = new int[1]; gl.glGenVertexArrays(1, buff, 0); - int vao = buff[0]; + final int vao = buff[0]; Assert.assertTrue("Invalid VAO: "+vao, vao > 0); @@ -216,29 +218,29 @@ public class TestBug692GL3VAONEWT extends UITestCase { gl.glUseProgram(0); gl.glBindVertexArray(vao); - gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, vbo); - gl.glBindBuffer(GL3.GL_ELEMENT_ARRAY_BUFFER, ibo); + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vbo); + gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, ibo); gl.glEnableVertexAttribArray(posLoc); gl.glEnableVertexAttribArray(colorLoc); final int stride = 6 * Buffers.SIZEOF_FLOAT; final int cOff = 3 * Buffers.SIZEOF_FLOAT; - gl.glVertexAttribPointer(posLoc, 3, GL3.GL_FLOAT, false, stride, 0L); - gl.glVertexAttribPointer(colorLoc,3, GL3.GL_FLOAT, false, stride, cOff); + gl.glVertexAttribPointer(posLoc, 3, GL.GL_FLOAT, false, stride, 0L); + gl.glVertexAttribPointer(colorLoc,3, GL.GL_FLOAT, false, stride, cOff); gl.glBindVertexArray(0); // See class documentation above! - gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, 0); - gl.glBindBuffer(GL3.GL_ELEMENT_ARRAY_BUFFER, 0); + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); + gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, 0); return vao; } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { final GL3 gl = drawable.getGL().getGL3(); - gl.glEnable(GL3.GL_DEPTH_TEST); - gl.glDisable(GL3.GL_CULL_FACE); + gl.glEnable(GL.GL_DEPTH_TEST); + gl.glDisable(GL.GL_CULL_FACE); initBuffers(gl); initShaders(gl); @@ -248,7 +250,7 @@ public class TestBug692GL3VAONEWT extends UITestCase { } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { final GL3 gl = drawable.getGL().getGL3(); gl.glDeleteBuffers(2, new int[]{vbo, ibo}, 0); gl.glDetachShader(progID, fragID); @@ -266,12 +268,12 @@ public class TestBug692GL3VAONEWT extends UITestCase { final int stride = 6 * Buffers.SIZEOF_FLOAT; // final int cOff = 3 * Buffers.SIZEOF_FLOAT; - gl.glVertexAttribPointer(posLoc, 3, GL3.GL_FLOAT, false, stride, vertexColorDataBuffer); + gl.glVertexAttribPointer(posLoc, 3, GL.GL_FLOAT, false, stride, vertexColorDataBuffer); vertexColorDataBuffer.position(3); // move to cOff - gl.glVertexAttribPointer(colorLoc,3, GL3.GL_FLOAT, false, stride, vertexColorDataBuffer); + gl.glVertexAttribPointer(colorLoc,3, GL.GL_FLOAT, false, stride, vertexColorDataBuffer); vertexColorDataBuffer.position(0); // rewind cOff - gl.glDrawElements(GL3.GL_TRIANGLES, 3, GL3.GL_UNSIGNED_SHORT, indicesBuffer); + gl.glDrawElements(GL.GL_TRIANGLES, 3, GL.GL_UNSIGNED_SHORT, indicesBuffer); gl.glDisableVertexAttribArray(posLoc); gl.glDisableVertexAttribArray(colorLoc); @@ -283,36 +285,36 @@ public class TestBug692GL3VAONEWT extends UITestCase { gl.glEnableVertexAttribArray(posLoc); gl.glEnableVertexAttribArray(colorLoc); - gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, vbo); + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vbo); final int stride = 6 * Buffers.SIZEOF_FLOAT; final int cOff = 3 * Buffers.SIZEOF_FLOAT; - gl.glVertexAttribPointer(posLoc, 3, GL3.GL_FLOAT, false, stride, 0L); - gl.glVertexAttribPointer(colorLoc,3, GL3.GL_FLOAT, false, stride, cOff); - gl.glBindBuffer(GL3.GL_ELEMENT_ARRAY_BUFFER, ibo); - gl.glDrawElements(GL3.GL_TRIANGLES, 3, GL3.GL_UNSIGNED_SHORT, 0L); + gl.glVertexAttribPointer(posLoc, 3, GL.GL_FLOAT, false, stride, 0L); + gl.glVertexAttribPointer(colorLoc,3, GL.GL_FLOAT, false, stride, cOff); + gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, ibo); + gl.glDrawElements(GL.GL_TRIANGLES, 3, GL.GL_UNSIGNED_SHORT, 0L); gl.glDisableVertexAttribArray(posLoc); gl.glDisableVertexAttribArray(colorLoc); - gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, 0); - gl.glBindBuffer(GL3.GL_ELEMENT_ARRAY_BUFFER, 0); + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); + gl.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, 0); } private void displayVBOVAO(final GL3 gl) { try { gl.glBindVertexArray(vao); - gl.glDrawElements(GL3.GL_TRIANGLES, 3, GL3.GL_UNSIGNED_SHORT, 0L); + gl.glDrawElements(GL.GL_TRIANGLES, 3, GL.GL_UNSIGNED_SHORT, 0L); gl.glBindVertexArray(0); - } catch (GLException ex) { + } catch (final GLException ex) { Logger.getLogger(TestBug692GL3VAONEWT.class.getName()).log(Level.SEVERE,null,ex); } } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { final GL3bc gl = drawable.getGL().getGL3bc(); - float color = ((float) currentMode.ordinal() + 1) / (Mode.values().length + 2); + final float color = ((float) currentMode.ordinal() + 1) / (Mode.values().length + 2); gl.glClearColor(color, color, color, 0); - gl.glClear(GL3.GL_COLOR_BUFFER_BIT | GL3.GL_DEPTH_BUFFER_BIT); + gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl.glUseProgram(progID); final Mode newMode; { @@ -328,18 +330,18 @@ public class TestBug692GL3VAONEWT extends UITestCase { } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int w, final int h) { } } - private void testImpl(GLProfile profile, GL3VAODemo.Mode[] modes) throws InterruptedException { + private void testImpl(final GLProfile profile, final GL3VAODemo.Mode[] modes) throws InterruptedException { final GLCapabilities capabilities = new GLCapabilities(profile); final GLWindow glWindow = GLWindow.create(capabilities); glWindow.setSize(512, 512); - Animator anim = new Animator(glWindow); + final Animator anim = new Animator(glWindow); - QuitAdapter quitAdapter = new QuitAdapter(); + final QuitAdapter quitAdapter = new QuitAdapter(); glWindow.addKeyListener(quitAdapter); glWindow.addWindowListener(quitAdapter); @@ -365,7 +367,7 @@ public class TestBug692GL3VAONEWT extends UITestCase { System.err.println("GL3bc n/a"); return; } - GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.CPU_SRC }; + final GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.CPU_SRC }; testImpl(GLProfile.get(GLProfile.GL3bc), modes); } @@ -375,7 +377,7 @@ public class TestBug692GL3VAONEWT extends UITestCase { System.err.println("GL3bc n/a"); return; } - GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.VBO_ONLY }; + final GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.VBO_ONLY }; testImpl(GLProfile.get(GLProfile.GL3bc), modes); } @@ -385,7 +387,7 @@ public class TestBug692GL3VAONEWT extends UITestCase { System.err.println("GL3bc n/a"); return; } - GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.VBO_VAO }; + final GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.VBO_VAO }; testImpl(GLProfile.get(GLProfile.GL3bc), modes); } @@ -395,7 +397,7 @@ public class TestBug692GL3VAONEWT extends UITestCase { System.err.println("GL3bc n/a"); return; } - GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.CPU_SRC, GL3VAODemo.Mode.VBO_ONLY }; + final GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.CPU_SRC, GL3VAODemo.Mode.VBO_ONLY }; testImpl(GLProfile.get(GLProfile.GL3bc), modes); } @@ -405,7 +407,7 @@ public class TestBug692GL3VAONEWT extends UITestCase { System.err.println("GL3bc n/a"); return; } - GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.CPU_SRC, GL3VAODemo.Mode.VBO_VAO }; + final GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.CPU_SRC, GL3VAODemo.Mode.VBO_VAO }; testImpl(GLProfile.get(GLProfile.GL3bc), modes); } @@ -415,7 +417,7 @@ public class TestBug692GL3VAONEWT extends UITestCase { System.err.println("GL3bc n/a"); return; } - GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.VBO_ONLY, GL3VAODemo.Mode.VBO_VAO }; + final GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.VBO_ONLY, GL3VAODemo.Mode.VBO_VAO }; testImpl(GLProfile.get(GLProfile.GL3bc), modes); } @@ -425,17 +427,17 @@ public class TestBug692GL3VAONEWT extends UITestCase { System.err.println("GL3bc n/a"); return; } - GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.CPU_SRC, GL3VAODemo.Mode.VBO_ONLY, GL3VAODemo.Mode.VBO_VAO }; + final GL3VAODemo.Mode[] modes = new GL3VAODemo.Mode[] { GL3VAODemo.Mode.CPU_SRC, GL3VAODemo.Mode.VBO_ONLY, GL3VAODemo.Mode.VBO_VAO }; testImpl(GLProfile.get(GLProfile.GL3bc), modes); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i 0; - int[] lengths = new int[srcLines.length]; + final int[] lengths = new int[srcLines.length]; for (int i = 0; i < srcLines.length; i++) { lengths[i] = srcLines[i].length(); } @@ -84,7 +85,7 @@ public class TestCPUSourcingAPINEWT extends UITestCase { return shaderID; } - private void initShaders(GL2ES2 gl) { + private void initShaders(final GL2ES2 gl) { final String[] vertSrc = new String[]{ "#version 150\n", "in vec4 vPosition;\n", @@ -118,17 +119,17 @@ public class TestCPUSourcingAPINEWT extends UITestCase { } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); - gl.glEnable(GL2ES2.GL_DEPTH_TEST); - gl.glDisable(GL2ES2.GL_CULL_FACE); + gl.glEnable(GL.GL_DEPTH_TEST); + gl.glDisable(GL.GL_CULL_FACE); initShaders(gl); gl.setSwapInterval(1); } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.glDetachShader(progID, fragID); gl.glDetachShader(progID, vertID); @@ -145,22 +146,22 @@ public class TestCPUSourcingAPINEWT extends UITestCase { final int stride = 6 * Buffers.SIZEOF_FLOAT; // final int cOff = 3 * Buffers.SIZEOF_FLOAT; - gl.glVertexAttribPointer(posLoc, 3, GL2ES2.GL_FLOAT, false, stride, vertexColorDataBuffer); + gl.glVertexAttribPointer(posLoc, 3, GL.GL_FLOAT, false, stride, vertexColorDataBuffer); vertexColorDataBuffer.position(3); // move to cOff - gl.glVertexAttribPointer(colorLoc,3, GL2ES2.GL_FLOAT, false, stride, vertexColorDataBuffer); + gl.glVertexAttribPointer(colorLoc,3, GL.GL_FLOAT, false, stride, vertexColorDataBuffer); vertexColorDataBuffer.position(0); // rewind cOff - gl.glDrawElements(GL2ES2.GL_TRIANGLES, 3, GL2ES2.GL_UNSIGNED_SHORT, indicesBuffer); + gl.glDrawElements(GL.GL_TRIANGLES, 3, GL.GL_UNSIGNED_SHORT, indicesBuffer); gl.glDisableVertexAttribArray(posLoc); gl.glDisableVertexAttribArray(colorLoc); } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.glClearColor(0x44, 0x44, 0x44, 0); - gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT); + gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl.glUseProgram(progID); // Hard casting is of course invalid! @@ -171,14 +172,14 @@ public class TestCPUSourcingAPINEWT extends UITestCase { } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int w, final int h) { } } - private void testImpl(GLProfile profile) throws InterruptedException { + private void testImpl(final GLProfile profile) throws InterruptedException { final GLCapabilities capabilities = new GLCapabilities(profile); - GLDrawableFactory factory = GLDrawableFactory.getFactory(profile); - GLOffscreenAutoDrawable glad = factory.createOffscreenAutoDrawable(null, capabilities, null, 512, 512); + final GLDrawableFactory factory = GLDrawableFactory.getFactory(profile); + final GLOffscreenAutoDrawable glad = factory.createOffscreenAutoDrawable(null, capabilities, null, 512, 512); final Demo vaoTest = new Demo(); glad.addGLEventListener(vaoTest); @@ -206,14 +207,14 @@ public class TestCPUSourcingAPINEWT extends UITestCase { GLException exp = null; try { testImpl(glp); - } catch(GLException gle) { + } catch(final GLException gle) { exp = gle; System.err.println("Expected Exception: "+exp.getMessage()); } Assert.assertNotNull("Excpected GLException missing due to CPU Sourcing w/ GL3 core context", exp); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i 0 ) { // MSAA - FBObject _fboFront = glad.getFBObject(GL.GL_FRONT); - FBObject _fboBack = glad.getFBObject(GL.GL_BACK); + final FBObject _fboFront = glad.getFBObject(GL.GL_FRONT); + final FBObject _fboBack = glad.getFBObject(GL.GL_BACK); Assert.assertTrue("FBO are not equal: "+fboFront+" != "+_fboFront, fboFront.equals(_fboFront)); Assert.assertSame(fboFront, _fboFront); Assert.assertTrue("FBO are not equal: "+fboBack+" != "+_fboBack, fboBack.equals(_fboBack)); Assert.assertSame(fboBack, _fboBack); } else if( chosenCaps.getDoubleBuffered() ) { // real double buffer - FBObject _fboFront = glad.getFBObject(GL.GL_FRONT); - FBObject _fboBack = glad.getFBObject(GL.GL_BACK); + final FBObject _fboFront = glad.getFBObject(GL.GL_FRONT); + final FBObject _fboBack = glad.getFBObject(GL.GL_BACK); Assert.assertTrue("FBO are not equal: "+fboBack+" != "+_fboFront, fboBack.equals(_fboFront)); Assert.assertSame(fboBack, _fboFront); Assert.assertTrue("FBO are not equal: "+fboFront+" != "+_fboBack, fboFront.equals(_fboBack)); Assert.assertSame(fboFront, _fboBack); } else { // single buffer - FBObject _fboFront = glad.getFBObject(GL.GL_FRONT); - FBObject _fboBack = glad.getFBObject(GL.GL_BACK); + final FBObject _fboFront = glad.getFBObject(GL.GL_FRONT); + final FBObject _fboBack = glad.getFBObject(GL.GL_BACK); Assert.assertTrue("FBO are not equal: "+fboFront+" != "+_fboFront, fboFront.equals(_fboFront)); Assert.assertSame(fboFront, _fboFront); Assert.assertTrue("FBO are not equal: "+fboBack+" != "+_fboFront, fboBack.equals(_fboFront)); @@ -380,7 +380,7 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase { System.out.println("Fin: "+glad); } - public static void main(String args[]) throws Exception { + public static void main(final String args[]) throws Exception { org.junit.runner.JUnitCore.main(TestFBOAutoDrawableFactoryNEWT.class.getName()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java index 49db27af9..ba57c6dbd 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java @@ -52,6 +52,7 @@ import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLDrawable; import javax.media.opengl.GLProfile; import javax.media.opengl.GLUniformData; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import org.junit.Assert; import org.junit.Test; @@ -73,17 +74,17 @@ public class TestFBOMRTNEWT01 extends UITestCase { return; } final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow( - new GLCapabilities(GLProfile.getGL2GL3()), width/step, height/step, true); + new GLCapabilities(GLProfile.getGL2GL3()), width/step, height/step, true); final GLDrawable drawable = winctx.context.getGLDrawable(); - GL2GL3 gl = winctx.context.getGL().getGL2GL3(); + final GL2GL3 gl = winctx.context.getGL().getGL2GL3(); // gl = gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, gl, null) ).getGL2GL3(); System.err.println(winctx.context); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - // test code .. + // test code .. final ShaderState st = new ShaderState(); // st.setVerbose(true); - + final ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, RedSquareES2.class, "shader", "shader/bin", "fbo-mrt-1", true); final ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, RedSquareES2.class, "shader", @@ -93,12 +94,12 @@ public class TestFBOMRTNEWT01 extends UITestCase { final ShaderProgram sp0 = new ShaderProgram(); sp0.add(gl, vp0, System.err); sp0.add(gl, fp0, System.err); - Assert.assertTrue(0 != sp0.program()); + Assert.assertTrue(0 != sp0.program()); Assert.assertTrue(!sp0.inUse()); Assert.assertTrue(!sp0.linked()); - Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); + Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); st.attachShaderProgram(gl, sp0, false); - + final ShaderCode vp1 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, RedSquareES2.class, "shader", "shader/bin", "fbo-mrt-2", true); final ShaderCode fp1 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, RedSquareES2.class, "shader", @@ -107,20 +108,20 @@ public class TestFBOMRTNEWT01 extends UITestCase { fp1.defaultShaderCustomization(gl, true, true); final ShaderProgram sp1 = new ShaderProgram(); sp1.add(gl, vp1, System.err); - sp1.add(gl, fp1, System.err); - Assert.assertTrue(0 != sp1.program()); + sp1.add(gl, fp1, System.err); + Assert.assertTrue(0 != sp1.program()); Assert.assertTrue(!sp1.inUse()); Assert.assertTrue(!sp1.linked()); - Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); + Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); st.attachShaderProgram(gl, sp1, true); - + final PMVMatrix pmvMatrix = new PMVMatrix(); final GLUniformData pmvMatrixUniform = new GLUniformData("gcu_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - st.ownUniform(pmvMatrixUniform); + st.ownUniform(pmvMatrixUniform); st.uniform(gl, pmvMatrixUniform); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - + final GLArrayDataServer vertices0 = GLArrayDataServer.createGLSL("gca_Vertices", 3, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); // st.bindAttribLocation(gl, 0, vertices0); vertices0.putf(0); vertices0.putf(1); vertices0.putf(0); @@ -131,7 +132,7 @@ public class TestFBOMRTNEWT01 extends UITestCase { st.ownAttribute(vertices0, true); vertices0.enableBuffer(gl, false); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - + final GLArrayDataServer colors0 = GLArrayDataServer.createGLSL("gca_Colors", 4, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); // st.bindAttribLocation(gl, 1, colors0); colors0.putf(1); colors0.putf(0); colors0.putf(1); colors0.putf(1); @@ -142,20 +143,20 @@ public class TestFBOMRTNEWT01 extends UITestCase { st.ownAttribute(colors0, true); colors0.enableBuffer(gl, false); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - + final GLUniformData texUnit0 = new GLUniformData("gcs_TexUnit0", 0); - st.ownUniform(texUnit0); + st.ownUniform(texUnit0); st.uniform(gl, texUnit0); final GLUniformData texUnit1 = new GLUniformData("gcs_TexUnit1", 1); - st.ownUniform(texUnit1); + st.ownUniform(texUnit1); st.uniform(gl, texUnit1); - + final GLArrayDataServer texCoords0 = GLArrayDataServer.createGLSL("gca_TexCoords", 2, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); // st.bindAttribLocation(gl, 2, texCoords0); texCoords0.putf(0f); texCoords0.putf(1f); texCoords0.putf(1f); texCoords0.putf(1f); texCoords0.putf(0f); texCoords0.putf(0f); - texCoords0.putf(1f); texCoords0.putf(0f); + texCoords0.putf(1f); texCoords0.putf(0f); texCoords0.seal(gl, true); st.ownAttribute(texCoords0, true); texCoords0.enableBuffer(gl, false); @@ -163,7 +164,7 @@ public class TestFBOMRTNEWT01 extends UITestCase { final int texA0Point = 0; // attachment point for texA0 final int texA1Point = 1; // attachment point for texA1 - + // FBO w/ 2 texture2D color buffers final FBObject fbo_mrt = new FBObject(); fbo_mrt.reset(gl, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); @@ -178,44 +179,44 @@ public class TestFBOMRTNEWT01 extends UITestCase { fbo_mrt.attachRenderbuffer(gl, Type.DEPTH, 24); Assert.assertTrue( fbo_mrt.isStatusValid() ) ; fbo_mrt.unbind(gl); - + // misc GL setup gl.glClearColor(1, 1, 1, 1); - gl.glEnable(GL2ES2.GL_DEPTH_TEST); + gl.glEnable(GL.GL_DEPTH_TEST); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); // reshape - pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); pmvMatrix.glOrthof(0f, 1f, 0f, 1f, -10f, 10f); - pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); st.uniform(gl, pmvMatrixUniform); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - + final int[] two_buffers = new int[] { GL.GL_COLOR_ATTACHMENT0+texA0Point, GL.GL_COLOR_ATTACHMENT0+texA1Point }; final int[] bck_buffers = new int[] { GL2GL3.GL_BACK_LEFT }; - + final GLReadBufferUtil screenshot = new GLReadBufferUtil(true, false); int step_i = 0; - int[] last_snap_size = new int[] { 0, 0 }; - + final int[] last_snap_size = new int[] { 0, 0 }; + for(int i=0; i buffer0, Green -> buffer1 - st.attachShaderProgram(gl, sp0, true); + st.attachShaderProgram(gl, sp0, true); vertices0.enableBuffer(gl, true); colors0.enableBuffer(gl, true); - + fbo_mrt.bind(gl); gl.glDrawBuffers(2, two_buffers, 0); - gl.glViewport(0, 0, fbo_mrt.getWidth(), fbo_mrt.getHeight()); - + gl.glViewport(0, 0, fbo_mrt.getWidth(), fbo_mrt.getHeight()); + gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4); fbo_mrt.unbind(gl); vertices0.enableBuffer(gl, false); colors0.enableBuffer(gl, false); - + // pass 2 - mix buffer0, buffer1 and blue // rg = buffer0.rg + buffer1.rg, b = Blue - length(rg); st.attachShaderProgram(gl, sp1, true); @@ -223,10 +224,10 @@ public class TestFBOMRTNEWT01 extends UITestCase { colors0.enableBuffer(gl, true); texCoords0.enableBuffer(gl, true); gl.glDrawBuffers(1, bck_buffers, 0); - + gl.glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); - - gl.glActiveTexture(GL.GL_TEXTURE0 + texUnit0.intValue()); + + gl.glActiveTexture(GL.GL_TEXTURE0 + texUnit0.intValue()); fbo_mrt.use(gl, texA0); if(null != texA1) { gl.glActiveTexture(GL.GL_TEXTURE0 + texUnit1.intValue()); @@ -238,7 +239,7 @@ public class TestFBOMRTNEWT01 extends UITestCase { vertices0.enableBuffer(gl, false); colors0.enableBuffer(gl, false); texCoords0.enableBuffer(gl, false); - + { final NativeSurface ns = gl.getContext().getGLReadDrawable().getNativeSurface(); if(last_snap_size[0] != ns.getSurfaceWidth() && last_snap_size[1] != ns.getSurfaceHeight()) { @@ -248,33 +249,33 @@ public class TestFBOMRTNEWT01 extends UITestCase { last_snap_size[1] = ns.getSurfaceHeight(); } } - + drawable.swapBuffers(); Thread.sleep(50); - int j = (int) ( (long)i / (durationPerTest/(long)step) ) + 1; + final int j = (int) ( i / (durationPerTest/step) ) + 1; if(j>step_i) { - int w = width/step * j; - int h = height/step * j; + final int w = width/step * j; + final int h = height/step * j; System.err.println("resize: "+step_i+" -> "+j+" - "+w+"x"+h); fbo_mrt.reset(gl, w, h); winctx.window.setSize(w, h); step_i = j; } } - + NEWTGLContext.destroyWindow(winctx); } - - public static void main(String args[]) throws IOException { + + public static void main(final String args[]) throws IOException { System.err.println("main - start"); for(int i=0; i "+num); - demo.setMSAA(num); + demo.setMSAA(num); } } } @@ -184,13 +184,13 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase { // glWindow.setSkipContextReleaseThread(animator.getThread()); glWindow.setVisible(true); - + System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities()); System.err.println("GL chosen: "+glWindow.getChosenCapabilities()); System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); - + animator.setUpdateFPSFrames(60, showFPS ? System.err : null); - + while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration() NativeSurface.LOCK_SURFACE_NOT_READY) { try { win.display(); @@ -123,7 +123,7 @@ public class TestGLContextSurfaceLockNEWT extends UITestCase { } }}); } - + System.err.println("Resizer "+id+": DONE/SYNC: "+Thread.currentThread().getName()); synchronized (postSync) { done = true; @@ -132,8 +132,8 @@ public class TestGLContextSurfaceLockNEWT extends UITestCase { } } } - - protected static boolean done(MyRunnable[] tasks) { + + protected static boolean done(final MyRunnable[] tasks) { for(int i=tasks.length-1; i>=0; i--) { if(!tasks[i].done()) { return false; @@ -141,8 +141,8 @@ public class TestGLContextSurfaceLockNEWT extends UITestCase { } return true; } - - protected static boolean isDead(Thread[] threads) { + + protected static boolean isDead(final Thread[] threads) { for(int i=threads.length-1; i>=0; i--) { if(threads[i].isAlive()) { return false; @@ -150,52 +150,52 @@ public class TestGLContextSurfaceLockNEWT extends UITestCase { } return true; } - + protected class MyEventCounter implements GLEventListener { volatile int reshapeCount = 0; volatile int displayCount = 0; - + @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { System.err.println("*** reshapes: "+reshapeCount+", displays "+displayCount); } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { displayCount++; } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { reshapeCount++; } - + public void reset() { reshapeCount = 0; - displayCount = 0; + displayCount = 0; } } - - protected void runJOGLTasks(int animThreadCount, int frameCount, int reszThreadCount, int resizeCount) throws InterruptedException { + + protected void runJOGLTasks(final int animThreadCount, final int frameCount, final int reszThreadCount, final int resizeCount) throws InterruptedException { final GLWindow glWindow = GLWindow.create(new GLCapabilities(GLProfile.getDefault())); final MyEventCounter myEventCounter = new MyEventCounter(); - + glWindow.addGLEventListener(new GearsES2(0)); glWindow.addGLEventListener(myEventCounter); glWindow.setSize(demoSize, demoSize); glWindow.setVisible(true); - + final String currentThreadName = Thread.currentThread().getName(); final Object sync = new Object(); final MyRunnable[] animTasks = new MyRunnable[animThreadCount]; final MyRunnable[] resizeTasks = new MyRunnable[animThreadCount]; final Thread[] animThreads = new Thread[reszThreadCount]; final Thread[] resizeThreads = new Thread[reszThreadCount]; - + System.err.println("animThreadCount "+animThreadCount+", frameCount "+frameCount); System.err.println("reszThreadCount "+reszThreadCount+", resizeCount "+resizeCount); System.err.println("tasks "+(animTasks.length+resizeTasks.length)+", threads "+(animThreads.length+resizeThreads.length)); @@ -212,7 +212,7 @@ public class TestGLContextSurfaceLockNEWT extends UITestCase { } myEventCounter.reset(); - + int j=0, k=0; for(int i=0; i setExtensions = new TreeSet(); + final String[] tabExtensions = extensions.split(" "); + final SortedSet setExtensions = new TreeSet(); Collections.addAll(setExtensions, tabExtensions); System.out.println("SharedContext: "+sharedContext); System.out.println("SharedContext: "+setExtensions); @@ -89,8 +89,8 @@ public class TestGLExtensionQueryOffscreen { } finally { context.release(); } - String[] tabExtensions = extensions.split(" "); - SortedSet setExtensions = new TreeSet(); + final String[] tabExtensions = extensions.split(" "); + final SortedSet setExtensions = new TreeSet(); Collections.addAll(setExtensions, tabExtensions); System.out.println("DefaultContext: "+context); System.out.println("DefaultContext: "+setExtensions); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug651NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug651NEWT.java index 5efe21e16..6359b87f8 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug651NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug651NEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.acore; import com.jogamp.newt.opengl.GLWindow; @@ -34,6 +34,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase; import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2ES3; import javax.media.opengl.GL2GL3; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLCapabilities; @@ -50,11 +51,11 @@ import org.junit.runners.MethodSorters; /** * Some GL state values are broken w/ Mesa 9.0 w/ multiple different context. *

    - * This bug lies within Mesa3D (any renderer) and is fixed in + * This bug lies within Mesa3D (any renderer) and is fixed in * commit 8dc79ae7d73cf6711c2182ff9a5d37ef6c989d23. *

    *

    - * Mesa3D Version 9.0 still exposes this bug, + * Mesa3D Version 9.0 still exposes this bug, * where 9.0.1 has it fixed w/ above commit. *

    * @@ -75,7 +76,7 @@ public class TestGLMesaBug651NEWT extends UITestCase { class UnitTester implements GLEventListener { @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { final GL gl = drawable.getGL(); System.err.println("GL UnitTester"); System.err.println(" GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR)); @@ -86,37 +87,37 @@ public class TestGLMesaBug651NEWT extends UITestCase { System.err.println(" GL Profile: "+gl.getGLProfile()); System.err.println(" GL Renderer Quirks:" + gl.getContext().getRendererQuirks().toString()); System.err.println(" GL:" + gl + ", " + gl.getContext().getGLVersion()); - + final int _glerr = gl.glGetError(); // clear pre-error System.err.println(" - pre GL-Error 0x"+Integer.toHexString(_glerr)); - - final int[] val = new int[1]; + + final int[] val = new int[1]; final int[] glerr = new int[] { GL.GL_NO_ERROR, GL.GL_NO_ERROR, GL.GL_NO_ERROR, GL.GL_NO_ERROR, GL.GL_NO_ERROR }; - int i=0; - + int i=0; + val[0]=0; gl.glGetIntegerv(GL.GL_MAX_TEXTURE_SIZE, val, 0); - System.out.println(" - GL_MAX_TEXTURE_SIZE: " + val[0]); + System.out.println(" - GL_MAX_TEXTURE_SIZE: " + val[0]); glerr[i] = gl.glGetError(); // clear pre-error System.err.println(" - GL-Error 0x"+Integer.toHexString(glerr[i])); i++; - + val[0]=0; - gl.glGetIntegerv(GL2ES2.GL_ACTIVE_TEXTURE, val, 0); - System.out.println(" - GL_ACTIVE_TEXTURE: " + val[0]); + gl.glGetIntegerv(GL.GL_ACTIVE_TEXTURE, val, 0); + System.out.println(" - GL_ACTIVE_TEXTURE: " + val[0]); glerr[i] = gl.glGetError(); // clear pre-error System.err.println(" - GL-Error 0x"+Integer.toHexString(glerr[i])); i++; - + if(gl.isGL2ES2()) { val[0]=0; gl.glGetIntegerv(GL2ES2.GL_MAX_TEXTURE_IMAGE_UNITS, val, 0); - System.out.println(" - GL_MAX_TEXTURE_IMAGE_UNITS: " + val[0]); + System.out.println(" - GL_MAX_TEXTURE_IMAGE_UNITS: " + val[0]); glerr[i] = gl.glGetError(); // clear pre-error System.err.println(" - GL-Error 0x"+Integer.toHexString(glerr[i])); } i++; - + if( gl.hasFullFBOSupport() || gl.isExtensionAvailable(GLExtensions.NV_fbo_color_attachments) ) { val[0]=0; gl.glGetIntegerv(GL2ES2.GL_MAX_COLOR_ATTACHMENTS, val, 0); @@ -125,24 +126,24 @@ public class TestGLMesaBug651NEWT extends UITestCase { System.err.println(" - GL-Error 0x"+Integer.toHexString(glerr[i])); } i++; - + if( gl.hasFullFBOSupport() ) { val[0]=0; - gl.glGetIntegerv(GL2GL3.GL_MAX_SAMPLES, val, 0); + gl.glGetIntegerv(GL2ES3.GL_MAX_SAMPLES, val, 0); System.out.println(" - GL_MAX_SAMPLES: " + val[0]); glerr[i] = gl.glGetError(); // clear pre-error System.err.println(" - GL-Error 0x"+Integer.toHexString(glerr[i])); } i++; - + boolean ok = true; String res=""; for(int j=0; j= 9.0 seems to be broken. *

    - * This bug lies within Mesa3D (any renderer) and is fixed in + * This bug lies within Mesa3D (any renderer) and is fixed in * commit ??? (not yet). *

    *

    - * Mesa3D Version 9.0 still exposes this bug, + * Mesa3D Version 9.0 still exposes this bug, * where 9.?.? has it fixed w/ above commit. *

    * @@ -36,25 +36,25 @@ public class TestGLMesaBug658NEWT extends UITestCase { public void test00ShowAvailProfiles() { System.err.println(JoglVersion.getDefaultOpenGLInfo(null, null, false).toString()); } - + @Test public void test10GL2PolygonModeFailure() { testGLNPolygonModeFailureImpl(GLProfile.GL2); } - + @Test public void test11GL3bcPolygonModeFailure() { testGLNPolygonModeFailureImpl(GLProfile.GL3bc); } - + @Test public void test12GL3PolygonModeFailure() { testGLNPolygonModeFailureImpl(GLProfile.GL3); } - - private void testGLNPolygonModeFailureImpl(String profile) { + + private void testGLNPolygonModeFailureImpl(final String profile) { if(!GLProfile.isAvailable(profile)) { System.err.println(profile+" n/a"); return; } - + final GLProfile pro = GLProfile.get(profile); final GLCapabilities caps = new GLCapabilities(pro); final GLWindow window = GLWindow.create(caps); @@ -82,7 +82,7 @@ public class TestGLMesaBug658NEWT extends UITestCase { System.err.println("GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER)); System.err.println("GL_VERSION: " + gl.glGetString(GL.GL_VERSION)); System.err.println("GL Renderer Quirks:" + gl.getContext().getRendererQuirks().toString()); - + if( gl.isGL2() || gl.isGLES2() ) { // compatibility profile || ES2 gl.glPolygonMode(GL.GL_FRONT, GL2GL3.GL_FILL); } else { @@ -113,24 +113,24 @@ public class TestGLMesaBug658NEWT extends UITestCase { } } - @Test + @Test public void test20GL2BindArrayAttributeFails() { testGLNBindArrayAttributeFailsImpl(GLProfile.GL2); } - - @Test + + @Test public void test21GL3bcBindArrayAttributeFails() { testGLNBindArrayAttributeFailsImpl(GLProfile.GL3bc); } - - @Test + + @Test public void test22GL3BindArrayAttributeFails() { testGLNBindArrayAttributeFailsImpl(GLProfile.GL3); } - - private void testGLNBindArrayAttributeFailsImpl(String profile) { + + private void testGLNBindArrayAttributeFailsImpl(final String profile) { if(!GLProfile.isAvailable(profile)) { System.err.println(profile+ " n/a"); return; } - + final GLProfile pro = GLProfile.get(profile); final GLCapabilities caps = new GLCapabilities(pro); final GLWindow window = GLWindow.create(caps); @@ -172,7 +172,7 @@ public class TestGLMesaBug658NEWT extends UITestCase { gl.glEnableVertexAttribArray(1); Assert.assertTrue(gl.glGetError() == GL.GL_NO_ERROR); gl.glVertexAttribPointer(1, 4, GL.GL_FLOAT, false, 0, 0L); - Assert.assertTrue(gl.glGetError() == GL.GL_NO_ERROR); // FIXME On Mesa 9.0.1 w/ GL 3.1 -> GL.GL_INVALID_OPERATION ? + Assert.assertTrue(gl.glGetError() == GL.GL_NO_ERROR); // FIXME On Mesa 9.0.1 w/ GL 3.1 -> GL.GL_INVALID_OPERATION ? } public void dispose( @@ -194,10 +194,10 @@ public class TestGLMesaBug658NEWT extends UITestCase { window.destroy(); } } - - public static void main(String args[]) { + + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestGLMesaBug658NEWT.class.getName()); } - + } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLPointsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLPointsNEWT.java index 7d3a7b896..fb6a50f7b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLPointsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLPointsNEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.acore; import com.jogamp.newt.opengl.GLWindow; @@ -59,8 +59,8 @@ public class TestGLPointsNEWT extends UITestCase { public static void releaseClass() { } - protected void runTestGL0(GLCapabilities caps, PointsDemo demo) throws InterruptedException { - GLWindow glWindow = GLWindow.create(caps); + protected void runTestGL0(final GLCapabilities caps, final PointsDemo demo) throws InterruptedException { + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setTitle(getSimpleTestName(".")); @@ -71,87 +71,87 @@ public class TestGLPointsNEWT extends UITestCase { glWindow.setSize(width, height); glWindow.setVisible(true); - + demo.setSmoothPoints(false); snap.setMakeSnapshot(); snap.setPostSNDetail("flat"); glWindow.display(); - + demo.setSmoothPoints(true); snap.setMakeSnapshot(); snap.setPostSNDetail("smooth"); glWindow.display(); - - demo.setPointParams(2f, 40f, 0.01f, 0.0f, 0.01f, 1f); + + demo.setPointParams(2f, 40f, 0.01f, 0.0f, 0.01f, 1f); snap.setMakeSnapshot(); snap.setPostSNDetail("attn0"); glWindow.display(); - + glWindow.removeGLEventListener(demo); - + glWindow.destroy(); } - - protected void runTestGL(GLCapabilities caps, PointsDemo demo, boolean forceFFPEmu) throws InterruptedException { + + protected void runTestGL(final GLCapabilities caps, final PointsDemo demo, final boolean forceFFPEmu) throws InterruptedException { // final PointsDemoES2 demo01 = new PointsDemoES2(); - runTestGL0(caps, demo); + runTestGL0(caps, demo); } @Test public void test01FFP__GL2() throws InterruptedException { if(!GLProfile.isAvailable(GLProfile.GL2)) { System.err.println("GL2 n/a"); return; } - GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2)); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2)); runTestGL(caps, new PointsDemoES1(), false); } - + @Test public void test02FFP__ES1() throws InterruptedException { if(!GLProfile.isAvailable(GLProfile.GLES1)) { System.err.println("GLES1 n/a"); return; } - GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES1)); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES1)); runTestGL(caps, new PointsDemoES1(), false); } - + @Test public void test03FFP__ES2() throws InterruptedException { if(!GLProfile.isAvailable(GLProfile.GLES2)) { System.err.println("GLES2 n/a"); return; } - GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2)); - PointsDemoES1 demo = new PointsDemoES1(); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2)); + final PointsDemoES1 demo = new PointsDemoES1(); demo.setForceFFPEmu(true, false, false, false); runTestGL(caps, demo, false); } - + @Test public void test04FFP__GL2ES2() throws InterruptedException { if(!GLProfile.isAvailable(GLProfile.GL2ES2)) { System.err.println("GL2ES2 n/a"); return; } - GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2)); - PointsDemoES1 demo = new PointsDemoES1(); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2)); + final PointsDemoES1 demo = new PointsDemoES1(); demo.setForceFFPEmu(true, false, false, false); runTestGL(caps, demo, false); } - + @Test public void test11GLSL_GL2() throws InterruptedException { if(!GLProfile.isAvailable(GLProfile.GL2)) { System.err.println("GL2 n/a"); return; } - GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2)); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2)); runTestGL(caps, new PointsDemoES2(), false); } - + @Test public void test12GLSL_ES2() throws InterruptedException { if(!GLProfile.isAvailable(GLProfile.GLES2)) { System.err.println("GLES2 n/a"); return; } - GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2)); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2)); runTestGL(caps, new PointsDemoES2(), false); // should be FFPEmu implicit } - + static long duration = 1000; // ms - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i 0 try { - ByteBuffer bb = Buffers.newDirectByteBuffer(height*rowlenA1); + final ByteBuffer bb = Buffers.newDirectByteBuffer(height*rowlenA1); gl.glReadPixels(0, 0, width, height, format, type, bb); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - } catch(IndexOutOfBoundsException e) { + } catch(final IndexOutOfBoundsException e) { ee = e; if(rowlenA1%4>0) { System.err.println( @@ -194,10 +194,10 @@ public class TestGPUMemSec01NEWT extends UITestCase { // ok size ! try { - ByteBuffer bb = Buffers.newDirectByteBuffer(height*rowlenA8); + final ByteBuffer bb = Buffers.newDirectByteBuffer(height*rowlenA8); gl.glReadPixels(0, 0, width, height, format, type, bb); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - } catch(IndexOutOfBoundsException e) { + } catch(final IndexOutOfBoundsException e) { ee = e; } Assert.assertNull( @@ -207,10 +207,10 @@ public class TestGPUMemSec01NEWT extends UITestCase { // too small if rowlenA1%8 > 0 try { - ByteBuffer bb = Buffers.newDirectByteBuffer(height*rowlenA1); + final ByteBuffer bb = Buffers.newDirectByteBuffer(height*rowlenA1); gl.glReadPixels(0, 0, width, height, format, type, bb); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - } catch(IndexOutOfBoundsException e) { + } catch(final IndexOutOfBoundsException e) { ee = e; if(rowlenA1%8>0) { System.err.println( @@ -238,7 +238,7 @@ public class TestGPUMemSec01NEWT extends UITestCase { @Test public void testReadPixelsGL_640x480xRGBAxUB() throws InterruptedException { - GLProfile glp = GLProfile.getDefault(); + final GLProfile glp = GLProfile.getDefault(); final int width = 640; final int height= 480; @@ -258,7 +258,7 @@ public class TestGPUMemSec01NEWT extends UITestCase { @Test public void testReadPixelsGL_99x100xRGBxUB() throws InterruptedException { - GLProfile glp = GLProfile.getGL2ES2(); + final GLProfile glp = GLProfile.getGL2ES2(); final int wwidth = 640; final int wheight= 480; final int rwidth = 99; @@ -280,7 +280,7 @@ public class TestGPUMemSec01NEWT extends UITestCase { @Test public void testReadPixelsGL2GL3_640x480xRGBxUB() throws InterruptedException { - GLProfile glp = GLProfile.getGL2ES2(); + final GLProfile glp = GLProfile.getGL2ES2(); if(!glp.isGL2ES3()) { System.err.println("GL2ES3 n/a skip test"); return; @@ -304,7 +304,7 @@ public class TestGPUMemSec01NEWT extends UITestCase { @Test public void testReadPixelsGL2GL3_99x100xRGBxUB() throws InterruptedException { - GLProfile glp = GLProfile.getGL2ES2(); + final GLProfile glp = GLProfile.getGL2ES2(); if(!glp.isGL2ES3()) { System.err.println("GL2ES3 n/a skip test"); return; @@ -330,7 +330,7 @@ public class TestGPUMemSec01NEWT extends UITestCase { @Test public void testReadPixelsGL2GL3_640x480xREDxUB() throws InterruptedException { - GLProfile glp = GLProfile.getGL2ES2(); + final GLProfile glp = GLProfile.getGL2ES2(); if(!glp.isGL2ES3()) { System.err.println("GL2ES3 n/a skip test"); return; @@ -354,15 +354,15 @@ public class TestGPUMemSec01NEWT extends UITestCase { @Test public void testReadPixelsGL2GL3_102x100xREDxUB() throws InterruptedException { - GLProfile glp = GLProfile.getGL2ES2(); + final GLProfile glp = GLProfile.getGL2ES2(); if(!glp.isGL2ES3()) { System.err.println("GL2ES3 n/a skip test"); return; } - int wwidth = 640; - int wheight= 480; - int rwidth = 102; - int rheight= 100; + final int wwidth = 640; + final int wheight= 480; + final int rwidth = 102; + final int rheight= 100; // preset .. final NEWTGLContext.WindowContext winctx = createCurrentGLOffscreenWindow(glp, wwidth, wheight); @@ -378,8 +378,8 @@ public class TestGPUMemSec01NEWT extends UITestCase { NEWTGLContext.destroyWindow(winctx); } - public static void main(String args[]) throws IOException { - String tstname = TestGPUMemSec01NEWT.class.getName(); + public static void main(final String args[]) throws IOException { + final String tstname = TestGPUMemSec01NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestInitConcurrent01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestInitConcurrent01NEWT.java index 7aca28006..2fc3071c6 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestInitConcurrent01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestInitConcurrent01NEWT.java @@ -66,16 +66,16 @@ public class TestInitConcurrent01NEWT extends InitConcurrentBaseNEWT { } } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i=group) { System.err.println("swap group joing 1: "+glc.joinSwapGroup(group)); if(maxVals[1]>=barrier) { System.err.println("swap group bind 1-1: "+glc.bindSwapBarrier(group, barrier)); } - } + } } - public void dispose(GLAutoDrawable drawable) {} - public void display(GLAutoDrawable drawable) {} - public void reshape(GLAutoDrawable drawable, int x, int y, - int width, int height) {} + public void dispose(final GLAutoDrawable drawable) {} + public void display(final GLAutoDrawable drawable) {} + public void reshape(final GLAutoDrawable drawable, final int x, final int y, + final int width, final int height) {} }); glWindow.addGLEventListener(gears); @@ -105,14 +105,14 @@ public class TestNVSwapGroupNEWT extends UITestCase { @Test public void test01() throws InterruptedException { // make sure it won't be active for now ! - int swap_group = 9999; - int swap_barrier = 9999; - - Animator animator = new Animator(); - GLWindow f1 = runTestGL(animator, 0, 0, swap_group, swap_barrier); - InsetsImmutable insets = f1.getInsets(); - GLWindow f2 = runTestGL(animator, width+insets.getTotalWidth(), 0, swap_group, swap_barrier); - animator.setUpdateFPSFrames(1, null); + final int swap_group = 9999; + final int swap_barrier = 9999; + + final Animator animator = new Animator(); + final GLWindow f1 = runTestGL(animator, 0, 0, swap_group, swap_barrier); + final InsetsImmutable insets = f1.getInsets(); + final GLWindow f2 = runTestGL(animator, width+insets.getTotalWidth(), 0, swap_group, swap_barrier); + animator.setUpdateFPSFrames(1, null); animator.start(); while(animator.isAnimating() && animator.getTotalFPSDuration() errorSet = new HashSet(); - public static void logAnyErrorCodes(Object obj, GL gl, String prefix) { + public static void logAnyErrorCodes(final Object obj, final GL gl, final String prefix) { final int glError = gl.glGetError(); if(glError != GL.GL_NO_ERROR) { final String errStr = "GL-Error: "+prefix + " on obj 0x"+Integer.toHexString(obj.hashCode())+", OpenGL error: 0x" + Integer.toHexString(glError); @@ -498,19 +501,19 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { * @return the distance the camera should be from the center of the scenes * bounding sphere */ - public static float setupViewFrustum(GL2 gl2, int width, int height, float boundsRadius, float zoomFactor, float viewFovDegrees) { + public static float setupViewFrustum(final GL2 gl2, final int width, final int height, final float boundsRadius, final float zoomFactor, final float viewFovDegrees) { assert boundsRadius > 0.0f; assert zoomFactor > 0.0f; assert viewFovDegrees > 0.0f; - GLU glu = new GLU(); + final GLU glu = new GLU(); final float aspectRatio = (float) width / (float) height; final float boundRadiusAdjusted = boundsRadius / zoomFactor; final float lowestFov = aspectRatio > 1.0f ? viewFovDegrees : aspectRatio * viewFovDegrees; final float viewDist = (float) (boundRadiusAdjusted / Math.sin( (lowestFov / 2.0) * (Math.PI / 180.0) )); - gl2.glMatrixMode(GL2.GL_PROJECTION); + gl2.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl2.glLoadIdentity(); glu.gluPerspective(viewFovDegrees, aspectRatio, 0.1*viewDist, viewDist + boundRadiusAdjusted); @@ -549,7 +552,7 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { // GLDrawableFactory factory = GLDrawableFactory.getFactory(GLProfile.get(GLProfile.GL2)); // GLContext sharedContext = factory.getOrCreateSharedContext(factory.getDefaultDevice()); // - GLCapabilities glCapabilities = new GLCapabilities(GLProfile.get(GLProfile.GL2)); + final GLCapabilities glCapabilities = new GLCapabilities(GLProfile.get(GLProfile.GL2)); glCapabilities.setSampleBuffers(true); glCapabilities.setNumSamples(4); @@ -569,19 +572,19 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { final GLAutoDrawable openGLAutoDrawable2; if (useNewt) { - GLWindow glWindow1 = GLWindow.create(glCapabilities); + final GLWindow glWindow1 = GLWindow.create(glCapabilities); if(shareContext) { glWindow1.setSharedAutoDrawable(sharedDrawable); } - NewtCanvasAWT newtCanvasAWT1 = new NewtCanvasAWT(glWindow1); + final NewtCanvasAWT newtCanvasAWT1 = new NewtCanvasAWT(glWindow1); newtCanvasAWT1.setPreferredSize(new Dimension(eventListener1.canvasWidth, eventListener1.canvasHeight)); glWindow1.addGLEventListener(eventListener1); // - GLWindow glWindow2 = GLWindow.create(glCapabilities); + final GLWindow glWindow2 = GLWindow.create(glCapabilities); if(shareContext) { glWindow2.setSharedAutoDrawable(sharedDrawable); } - NewtCanvasAWT newtCanvasAWT2 = new NewtCanvasAWT(glWindow2); + final NewtCanvasAWT newtCanvasAWT2 = new NewtCanvasAWT(glWindow2); newtCanvasAWT2.setPreferredSize(new Dimension(eventListener2.canvasWidth, eventListener2.canvasHeight)); glWindow2.addGLEventListener(eventListener2); @@ -620,52 +623,52 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { // Create slider for x rotation. // The vertically oriented slider rotates around the x axis - final JSlider xAxisRotationSlider = new JSlider(JSlider.VERTICAL, -180, 180, 1); + final JSlider xAxisRotationSlider = new JSlider(SwingConstants.VERTICAL, -180, 180, 1); xAxisRotationSlider.setPaintTicks(false); xAxisRotationSlider.setPaintLabels(false); xAxisRotationSlider.setSnapToTicks(false); xAxisRotationSlider.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { + public void stateChanged(final ChangeEvent e) { eventListener1.setXAxisRotation(xAxisRotationSlider.getValue()); eventListener2.setXAxisRotation(xAxisRotationSlider.getValue()); } }); - JLabel xAxisRotationLabel = new JLabel("X-Axis Rotation"); + final JLabel xAxisRotationLabel = new JLabel("X-Axis Rotation"); // Create slider for y rotation. // The horizontally oriented slider rotates around the y axis - final JSlider yAxisRotationSlider = new JSlider(JSlider.HORIZONTAL, -180, 180, 1); + final JSlider yAxisRotationSlider = new JSlider(SwingConstants.HORIZONTAL, -180, 180, 1); yAxisRotationSlider.setPaintTicks(false); yAxisRotationSlider.setPaintLabels(false); yAxisRotationSlider.setSnapToTicks(false); yAxisRotationSlider.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { + public void stateChanged(final ChangeEvent e) { eventListener1.setYAxisRotation(yAxisRotationSlider.getValue()); eventListener2.setYAxisRotation(yAxisRotationSlider.getValue()); } }); - JLabel yAxisRotationLabel = new JLabel("Y-Axis Rotation"); + final JLabel yAxisRotationLabel = new JLabel("Y-Axis Rotation"); // Create slider for view distance factor. // We want a range of 0.0 to 10.0 with 0.1 increments (so we can scale down using 0.0 to 1.0). // So, set JSlider to 0 to 100 and divide by 10.0 in stateChanged - final JSlider viewDistanceFactorSlider = new JSlider(JSlider.HORIZONTAL, 0, 100, 10); + final JSlider viewDistanceFactorSlider = new JSlider(SwingConstants.HORIZONTAL, 0, 100, 10); viewDistanceFactorSlider.setPaintTicks(false); viewDistanceFactorSlider.setPaintLabels(false); viewDistanceFactorSlider.setSnapToTicks(false); viewDistanceFactorSlider.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { + public void stateChanged(final ChangeEvent e) { eventListener1.setViewDistanceFactor(viewDistanceFactorSlider.getValue() / 10.0f); eventListener2.setViewDistanceFactor(viewDistanceFactorSlider.getValue() / 10.0f); } }); - JLabel viewDistanceFactorLabel = new JLabel("View Distance Factor"); + final JLabel viewDistanceFactorLabel = new JLabel("View Distance Factor"); // group the view distance and label into a vertical panel - JPanel viewDistancePanel = new JPanel(); + final JPanel viewDistancePanel = new JPanel(); viewDistancePanel.setLayout(new BoxLayout(viewDistancePanel, BoxLayout.PAGE_AXIS)); viewDistancePanel.add(Box.createVerticalGlue()); viewDistancePanel.add(viewDistanceFactorSlider); @@ -673,14 +676,14 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { viewDistancePanel.add(Box.createVerticalGlue()); // group both OpenGL canvases / windows into a horizontal panel - JPanel openGLPanel = new JPanel(); + final JPanel openGLPanel = new JPanel(); openGLPanel.setLayout(new BoxLayout(openGLPanel, BoxLayout.LINE_AXIS)); openGLPanel.add(openGLComponent1); openGLPanel.add(Box.createHorizontalStrut(5)); openGLPanel.add(openGLComponent2); // group the open GL panel and the y-axis rotation slider into a vertical panel. - JPanel canvasAndYAxisPanel = new JPanel(); + final JPanel canvasAndYAxisPanel = new JPanel(); canvasAndYAxisPanel.setLayout(new BoxLayout(canvasAndYAxisPanel, BoxLayout.PAGE_AXIS)); canvasAndYAxisPanel.add(openGLPanel); canvasAndYAxisPanel.add(Box.createVerticalGlue()); @@ -688,12 +691,12 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { canvasAndYAxisPanel.add(yAxisRotationLabel); // group the X-axis rotation slider and label into a horizontal panel. - JPanel xAxisPanel = new JPanel(); + final JPanel xAxisPanel = new JPanel(); xAxisPanel.setLayout(new BoxLayout(xAxisPanel, BoxLayout.LINE_AXIS)); xAxisPanel.add(xAxisRotationSlider); xAxisPanel.add(xAxisRotationLabel); - JPanel mainPanel = (JPanel) frame.getContentPane(); + final JPanel mainPanel = (JPanel) frame.getContentPane(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.LINE_AXIS)); mainPanel.add(viewDistancePanel); mainPanel.add(Box.createHorizontalGlue()); @@ -713,7 +716,7 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { frame.addWindowListener(new WindowAdapter() { @Override - public void windowClosing(WindowEvent e) { + public void windowClosing(final WindowEvent e) { closingSemaphore.release(); } }); @@ -729,9 +732,9 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { // wait for the window to be visible and start the animation try { - boolean windowOpened = windowOpenSemaphore.tryAcquire(5000, TimeUnit.MILLISECONDS); + final boolean windowOpened = windowOpenSemaphore.tryAcquire(5000, TimeUnit.MILLISECONDS); Assert.assertEquals(true, windowOpened); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { System.err.println("Closing wait interrupted: " + e.getMessage()); } animator.start(); @@ -742,9 +745,9 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { Thread.sleep(100); } AWTRobotUtil.closeWindow(frame, true, awtClosingListener); - boolean windowClosed = closingSemaphore.tryAcquire(5000, TimeUnit.MILLISECONDS); + final boolean windowClosed = closingSemaphore.tryAcquire(5000, TimeUnit.MILLISECONDS); Assert.assertEquals(true, windowClosed); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { System.err.println("Closing wait interrupted: " + e.getMessage()); } animator.stop(); @@ -766,9 +769,9 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { // wait for orderly destruction; it seems that if we share a GLContext across newt windows, bad things happen; // I must be doing something wrong but I haven't figured it out yet try { - boolean windowsDisposed = closingSemaphore.tryAcquire(5000, TimeUnit.MILLISECONDS); + final boolean windowsDisposed = closingSemaphore.tryAcquire(5000, TimeUnit.MILLISECONDS); Assert.assertEquals(true, windowsDisposed); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { System.err.println("Closing wait interrupted: " + e.getMessage()); } @@ -784,7 +787,7 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { if (acquired){ disposalSuccesses++; } - } catch (InterruptedException e) { + } catch (final InterruptedException e) { System.err.println("Clean exit interrupted: " + e.getMessage()); } @@ -793,15 +796,15 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { releaseShared(sharedDrawable); } - static int atoi(String a) { + static int atoi(final String a) { int i=0; try { i = Integer.parseInt(a); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } return i; } - public static void main(String[] args) throws IOException { + public static void main(final String[] args) throws IOException { for(int i=0; i Platform.getJavaVersionNumber().compareTo(version170); System.err.println("OSX CALayer AWT-Mod Bug "+osxCALayerAWTModBug); System.err.println("OSType "+Platform.getOSType()); System.err.println("Java Version "+Platform.getJavaVersionNumber()); - + try { EventQueue.invokeAndWait(new Runnable() { public void run() { awtEDT = Thread.currentThread(); } } ); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); Assert.assertNull(e); } - + } - + @AfterClass public static void releaseClass00AWT() { } - + @Override protected boolean isAWTTestCase() { return true; } - + @Override protected Thread getAWTRenderThread() { return awtEDT; } - + @Override - protected GLAutoDrawable createGLAutoDrawable(final String title, final int x, final int y, final int width, final int height, GLCapabilitiesImmutable caps) { + protected GLAutoDrawable createGLAutoDrawable(final String title, final int x, final int y, final int width, final int height, final GLCapabilitiesImmutable caps) { final GLCanvas glCanvas = new GLCanvas(); - + // FIXME: Below AWT layouts freezes OSX/Java7 @ setVisible: Window.setVisible .. CWrapper@NSWindow.isKeyWindow // final Dimension sz = new Dimension(width, height); // glCanvas.setMinimumSize(sz); // glCanvas.setPreferredSize(sz); - // glCanvas.setSize(sz); + // glCanvas.setSize(sz); try { EventQueue.invokeAndWait(new Runnable() { public void run() { - final Frame frame = new Frame(); - frame.setLayout(new BorderLayout()); + final Frame frame = new Frame(); + frame.setLayout(new BorderLayout()); frame.setMinimumSize(new Dimension(width, height)); frame.setBounds(x, y, width, height); frame.add(glCanvas, BorderLayout.CENTER); @@ -114,22 +114,22 @@ public abstract class ExclusiveContextBase00AWT extends ExclusiveContextBase00 { frame.setTitle(title); } } }); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); Assert.assertNull(e); } - + return glCanvas; } - - protected Frame getFrame(GLAutoDrawable glad) { + + protected Frame getFrame(final GLAutoDrawable glad) { Container p = ((Component)glad).getParent(); while( null != p && !( p instanceof Frame ) ) { p = p.getParent(); } - return (Frame)p; + return (Frame)p; } - + @Override protected void setGLAutoDrawableVisible(final GLAutoDrawable[] glads) { try { @@ -138,27 +138,27 @@ public abstract class ExclusiveContextBase00AWT extends ExclusiveContextBase00 { final int count = glads.length; for(int i=0; i Platform.getJavaVersionNumber().compareTo(version170); System.err.println("OSX CALayer AWT-Mod Bug "+osxCALayerAWTModBug); System.err.println("OSType "+Platform.getOSType()); System.err.println("Java Version "+Platform.getJavaVersionNumber()); - + try { EventQueue.invokeAndWait(new Runnable() { public void run() { awtEDT = Thread.currentThread(); } } ); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); Assert.assertNull(e); } - + } - + @AfterClass public static void releaseClass00AWT() { } - + @Override protected boolean isAWTTestCase() { return true; } - + @Override protected Thread getAWTRenderThread() { return awtEDT; } - + @Override - protected GLAutoDrawable createGLAutoDrawable(final String title, final int x, final int y, final int width, final int height, GLCapabilitiesImmutable caps) { + protected GLAutoDrawable createGLAutoDrawable(final String title, final int x, final int y, final int width, final int height, final GLCapabilitiesImmutable caps) { final GLCanvas glCanvas = new GLCanvas(); - + // FIXME: Below AWT layouts freezes OSX/Java7 @ setVisible: Window.setVisible .. CWrapper@NSWindow.isKeyWindow // final Dimension sz = new Dimension(width, height); // glCanvas.setMinimumSize(sz); // glCanvas.setPreferredSize(sz); - // glCanvas.setSize(sz); + // glCanvas.setSize(sz); try { EventQueue.invokeAndWait(new Runnable() { public void run() { - final Frame frame = new Frame(); - frame.setLayout(new BorderLayout()); + final Frame frame = new Frame(); + frame.setLayout(new BorderLayout()); frame.setMinimumSize(new Dimension(width, height)); frame.setBounds(x, y, width, height); frame.add(glCanvas, BorderLayout.CENTER); @@ -114,22 +114,22 @@ public abstract class ExclusiveContextBase10AWT extends ExclusiveContextBase10 { frame.setTitle(title); } } }); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); Assert.assertNull(e); } - + return glCanvas; } - - protected Frame getFrame(GLAutoDrawable glad) { + + protected Frame getFrame(final GLAutoDrawable glad) { Container p = ((Component)glad).getParent(); while( null != p && !( p instanceof Frame ) ) { p = p.getParent(); } - return (Frame)p; + return (Frame)p; } - + @Override protected void setGLAutoDrawableVisible(final GLAutoDrawable[] glads) { try { @@ -138,27 +138,27 @@ public abstract class ExclusiveContextBase10AWT extends ExclusiveContextBase10 { final int count = glads.length; for(int i=0; i NEWT. Pre-allocating the X11 Display and keeping it referenced - * to avoid such re-usage worksaround this problem. + * to avoid such re-usage worksaround this problem. */ public static boolean fixedNewtDisplay = true; - + @Test(timeout=180000) // TO 3 min public void test11GLWindow2GLCanvasOnScrnGL2ES2() throws InterruptedException { final GLCapabilities caps = getCaps(GLProfile.GL2ES2); @@ -80,14 +80,14 @@ public class TestBug722GLContextDrawableSwitchNewt2AWT extends GLContextDrawable return; } - - GLADType gladType1 = GLADType.GLWindow; - GLADType gladType2 = GLADType.GLCanvasOnscreen; - - final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener(); + + final GLADType gladType1 = GLADType.GLWindow; + final GLADType gladType2 = GLADType.GLCanvasOnscreen; + + final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener(); final Animator animator = new Animator(); animator.start(); - + final Display dpy; final Screen screen; if( fixedNewtDisplay ) { @@ -97,43 +97,43 @@ public class TestBug722GLContextDrawableSwitchNewt2AWT extends GLContextDrawable } else { dpy = null; screen = null; - } - + } + duration = duration2; - - for(int i=0; i s) { s++; @@ -186,8 +186,8 @@ public class TestGLContextDrawableSwitch01NEWT extends UITestCase { // switch context _and_ the demo synchronously GLDrawableUtil.swapGLContextAndAllGLEventListener(glad1, glad2); - - System.err.println(s+" - switch - END "+ ( t1 - t0 )); + + System.err.println(s+" - switch - END "+ ( t1 - t0 )); } Thread.sleep(100); t1 = System.currentTimeMillis(); @@ -195,56 +195,56 @@ public class TestGLContextDrawableSwitch01NEWT extends UITestCase { animator.stop(); glad1.destroy(); - glad2.destroy(); + glad2.destroy(); } - + @Test(timeout=30000) public void testSwitch2GLWindowOneDemoGL2ES2() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2); if(null == reqGLCaps) return; testSwitch2GLWindowOneDemoImpl(reqGLCaps); } - + @Test(timeout=30000) public void testSwitch2GLWindowOneDemoGLES2() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); if(null == reqGLCaps) return; testSwitch2GLWindowOneDemoImpl(reqGLCaps); } - - private void testSwitch2GLWindowOneDemoImpl(GLCapabilities caps) throws InterruptedException { - final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener(); + + private void testSwitch2GLWindowOneDemoImpl(final GLCapabilities caps) throws InterruptedException { + final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener(); final GearsES2 gears = new GearsES2(1); final QuitAdapter quitAdapter = new QuitAdapter(); - - GLWindow glWindow1 = GLWindow.create(caps); + + final GLWindow glWindow1 = GLWindow.create(caps); glWindow1.setTitle("win1"); glWindow1.setSize(width, height); glWindow1.setPosition(64, 64); glWindow1.addGLEventListener(0, gears); glWindow1.addGLEventListener(snapshotGLEventListener); glWindow1.addWindowListener(quitAdapter); - - GLWindow glWindow2 = GLWindow.create(caps); - glWindow2.setTitle("win2"); + + final GLWindow glWindow2 = GLWindow.create(caps); + glWindow2.setTitle("win2"); glWindow2.setSize(width+100, height+100); glWindow2.setPosition(2*64+width, 64); glWindow2.addWindowListener(quitAdapter); - Animator animator = new Animator(); + final Animator animator = new Animator(); animator.add(glWindow1); animator.add(glWindow2); animator.start(); - + glWindow1.setVisible(true); glWindow2.setVisible(true); snapshotGLEventListener.setMakeSnapshot(); - + int s = 0; - long t0 = System.currentTimeMillis(); + final long t0 = System.currentTimeMillis(); long t1 = t0; - + while( !quitAdapter.shouldQuit() && ( t1 - t0 ) < duration ) { if( ( t1 - t0 ) / period > s) { s++; @@ -254,11 +254,11 @@ public class TestGLContextDrawableSwitch01NEWT extends UITestCase { // switch context _and_ the demo synchronously GLDrawableUtil.swapGLContextAndAllGLEventListener(glWindow1, glWindow2); - + System.err.println(s+" - B w1-h 0x"+Long.toHexString(glWindow1.getHandle())+",-ctx 0x"+Long.toHexString(glWindow1.getContext().getHandle())); System.err.println(s+" - B w2-h 0x"+Long.toHexString(glWindow2.getHandle())+",-ctx 0x"+Long.toHexString(glWindow2.getContext().getHandle())); System.err.println(s+" - switch - END "+ ( t1 - t0 )); - + snapshotGLEventListener.setMakeSnapshot(); } Thread.sleep(100); @@ -268,61 +268,61 @@ public class TestGLContextDrawableSwitch01NEWT extends UITestCase { animator.stop(); glWindow1.destroy(); glWindow2.destroy(); - + } - + @Test(timeout=30000) public void testSwitch2GLWindowEachWithOwnDemoGL2ES2() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2); if(null == reqGLCaps) return; testSwitch2GLWindowEachWithOwnDemoImpl(reqGLCaps); } - + @Test(timeout=30000) public void testSwitch2GLWindowEachWithOwnDemoGLES2() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); if(null == reqGLCaps) return; testSwitch2GLWindowEachWithOwnDemoImpl(reqGLCaps); } - - public void testSwitch2GLWindowEachWithOwnDemoImpl(GLCapabilities caps) throws InterruptedException { + + public void testSwitch2GLWindowEachWithOwnDemoImpl(final GLCapabilities caps) throws InterruptedException { final GearsES2 gears = new GearsES2(1); final RedSquareES2 rsquare = new RedSquareES2(1); final QuitAdapter quitAdapter = new QuitAdapter(); - final SnapshotGLEventListener snapshotGLEventListener1 = new SnapshotGLEventListener(); - final SnapshotGLEventListener snapshotGLEventListener2 = new SnapshotGLEventListener(); - - GLWindow glWindow1 = GLWindow.create(caps); + final SnapshotGLEventListener snapshotGLEventListener1 = new SnapshotGLEventListener(); + final SnapshotGLEventListener snapshotGLEventListener2 = new SnapshotGLEventListener(); + + final GLWindow glWindow1 = GLWindow.create(caps); glWindow1.setTitle("win1"); glWindow1.setSize(width, height); glWindow1.setPosition(64, 64); glWindow1.addGLEventListener(0, gears); glWindow1.addGLEventListener(snapshotGLEventListener1); glWindow1.addWindowListener(quitAdapter); - - GLWindow glWindow2 = GLWindow.create(caps); - glWindow2.setTitle("win2"); + + final GLWindow glWindow2 = GLWindow.create(caps); + glWindow2.setTitle("win2"); glWindow2.setSize(width+100, height+100); glWindow2.setPosition(2*64+width, 64); glWindow2.addGLEventListener(0, rsquare); glWindow2.addGLEventListener(snapshotGLEventListener2); glWindow2.addWindowListener(quitAdapter); - Animator animator = new Animator(); + final Animator animator = new Animator(); animator.add(glWindow1); animator.add(glWindow2); animator.start(); - + glWindow1.setVisible(true); glWindow2.setVisible(true); snapshotGLEventListener1.setMakeSnapshot(); snapshotGLEventListener2.setMakeSnapshot(); - + int s = 0; - long t0 = System.currentTimeMillis(); + final long t0 = System.currentTimeMillis(); long t1 = t0; - + while( !quitAdapter.shouldQuit() && ( t1 - t0 ) < duration ) { if( ( t1 - t0 ) / period > s) { s++; @@ -330,7 +330,7 @@ public class TestGLContextDrawableSwitch01NEWT extends UITestCase { System.err.println(s+" - A w1-h 0x"+Long.toHexString(glWindow1.getHandle())+",-ctx 0x"+Long.toHexString(glWindow1.getContext().getHandle())); System.err.println(s+" - A w2-h 0x"+Long.toHexString(glWindow2.getHandle())+",-ctx 0x"+Long.toHexString(glWindow2.getContext().getHandle())); GLDrawableUtil.swapGLContextAndAllGLEventListener(glWindow1, glWindow2); - System.err.println(s+" - B w1-h 0x"+Long.toHexString(glWindow1.getHandle())+",-ctx 0x"+Long.toHexString(glWindow1.getContext().getHandle())); + System.err.println(s+" - B w1-h 0x"+Long.toHexString(glWindow1.getHandle())+",-ctx 0x"+Long.toHexString(glWindow1.getContext().getHandle())); System.err.println(s+" - B w2-h 0x"+Long.toHexString(glWindow2.getHandle())+",-ctx 0x"+Long.toHexString(glWindow2.getContext().getHandle())); System.err.println(s+" - switch - END "+ ( t1 - t0 )); snapshotGLEventListener1.setMakeSnapshot(); @@ -347,31 +347,31 @@ public class TestGLContextDrawableSwitch01NEWT extends UITestCase { // System.err.println("post-del-w1: w1: "+glWindow1); // System.err.println("post-del-w1: w2: "+glWindow2); glWindow2.destroy(); - + } // default timing for 2 switches static long duration = 2200; // ms static long period = 1000; // ms - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i s) { s++; @@ -168,18 +168,18 @@ public class TestGLContextDrawableSwitch02AWT extends UITestCase { static long duration = 2900; // ms static long period = 1000; // ms - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i - * Test utilizes {@link GLEventListenerState} for preserving the - * GLAutoDrawable state, i.e. GLContext, all GLEventListener + * Test utilizes {@link GLEventListenerState} for preserving the + * GLAutoDrawable state, i.e. GLContext, all GLEventListener * and the GLAnimatorControl association. *

    *

    @@ -84,21 +84,21 @@ public class TestGLContextDrawableSwitch10NEWT extends UITestCase { static int width, height; - static GLCapabilities getCaps(String profile) { + static GLCapabilities getCaps(final String profile) { if( !GLProfile.isAvailable(profile) ) { System.err.println("Profile "+profile+" n/a"); return null; } return new GLCapabilities(GLProfile.get(profile)); } - + @BeforeClass public static void initClass() { width = 256; height = 256; } - private GLAutoDrawable createGLAutoDrawableWithoutContext(GLCapabilities caps, int x, int y, int width, int height, WindowListener wl) throws InterruptedException { + private GLAutoDrawable createGLAutoDrawableWithoutContext(final GLCapabilities caps, final int x, final int y, final int width, final int height, final WindowListener wl) throws InterruptedException { final Window window = NewtFactory.createWindow(caps); Assert.assertNotNull(window); window.setPosition(x, y); @@ -106,87 +106,87 @@ public class TestGLContextDrawableSwitch10NEWT extends UITestCase { window.setVisible(true); Assert.assertTrue(AWTRobotUtil.waitForVisible(window, true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(window, true)); - + final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile()); final GLDrawable drawable = factory.createGLDrawable(window); Assert.assertNotNull(drawable); - + drawable.setRealized(true); Assert.assertTrue(drawable.isRealized()); - + final GLAutoDrawableDelegate glad = new GLAutoDrawableDelegate(drawable, null, window, false, null) { @Override protected void destroyImplInLock() { super.destroyImplInLock(); window.destroy(); // destroys the actual window - } + } }; - + window.setWindowDestroyNotifyAction( new Runnable() { public void run() { glad.windowDestroyNotifyOp(); } } ); - + // add basic window interaction window.addWindowListener(new WindowAdapter() { @Override - public void windowRepaint(WindowUpdateEvent e) { + public void windowRepaint(final WindowUpdateEvent e) { glad.windowRepaintOp(); } @Override - public void windowResized(WindowEvent e) { + public void windowResized(final WindowEvent e) { glad.windowResizedOp(window.getSurfaceWidth(), window.getSurfaceHeight()); } }); window.addWindowListener(wl); - + return glad; } - + @Test(timeout=30000) public void test01GLADDelegateGL2ES2() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2); if(null == reqGLCaps) return; testGLADDelegateImpl(reqGLCaps); } - + @Test(timeout=30000) public void test02GLADDelegateGLES2() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); if(null == reqGLCaps) return; testGLADDelegateImpl(reqGLCaps); } - - private void testGLADDelegateImpl(GLCapabilities caps) throws InterruptedException { + + private void testGLADDelegateImpl(final GLCapabilities caps) throws InterruptedException { final GLEventListenerCounter glelCounter = new GLEventListenerCounter(); - final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener(); + final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener(); final Animator animator = new Animator(); animator.start(); - + final GLEventListenerState glls1; - + // - create glad1 w/o context // - create context using glad1 and assign it to glad1 { - final QuitAdapter quitAdapter = new QuitAdapter(); + final QuitAdapter quitAdapter = new QuitAdapter(); final GLAutoDrawable glad1 = createGLAutoDrawableWithoutContext(caps, 64, 64, width, height, quitAdapter); final GLContext context1 = glad1.createContext(null); glad1.setContext(context1, true); animator.add(glad1); - + glad1.addGLEventListener(glelCounter); glad1.addGLEventListener(new GearsES2(1)); glad1.addGLEventListener(snapshotGLEventListener); snapshotGLEventListener.setMakeSnapshot(); - + final long t0 = System.currentTimeMillis(); long t1 = t0; - + while( !quitAdapter.shouldQuit() && ( t1 - t0 ) < duration ) { Thread.sleep(100); t1 = System.currentTimeMillis(); } - + Assert.assertEquals(1, glelCounter.initCount); Assert.assertTrue(1 <= glelCounter.reshapeCount); Assert.assertTrue(1 <= glelCounter.displayCount); @@ -195,11 +195,11 @@ public class TestGLContextDrawableSwitch10NEWT extends UITestCase { Assert.assertEquals(3, glad1.getGLEventListenerCount()); Assert.assertEquals(context1.getGLReadDrawable(), glad1.getDelegatedDrawable()); Assert.assertEquals(context1.getGLDrawable(), glad1.getDelegatedDrawable()); - + // - dis-associate context from glad1 // - destroy glad1 glls1 = GLEventListenerState.moveFrom(glad1); - + Assert.assertEquals(1, glelCounter.initCount); Assert.assertTrue(1 <= glelCounter.reshapeCount); Assert.assertTrue(1 <= glelCounter.displayCount); @@ -211,27 +211,27 @@ public class TestGLContextDrawableSwitch10NEWT extends UITestCase { Assert.assertEquals(true, glls1.isOwner()); Assert.assertEquals(null, glad1.getContext()); Assert.assertEquals(0, glad1.getGLEventListenerCount()); - + glad1.destroy(); Assert.assertEquals(1, glelCounter.initCount); Assert.assertTrue(1 <= glelCounter.reshapeCount); Assert.assertTrue(1 <= glelCounter.displayCount); Assert.assertEquals(0, glelCounter.disposeCount); } - + // - create glad2 w/ survived context { - final QuitAdapter quitAdapter = new QuitAdapter(); + final QuitAdapter quitAdapter = new QuitAdapter(); final GLAutoDrawable glad2 = createGLAutoDrawableWithoutContext(caps, 2*64+width, 64, width+100, height+100, quitAdapter); snapshotGLEventListener.setMakeSnapshot(); - + Assert.assertEquals(null, glad2.getContext()); Assert.assertEquals(0, glad2.getGLEventListenerCount()); - + glls1.moveTo(glad2); - + Assert.assertTrue(glad2.isRealized()); - + Assert.assertEquals(1, glelCounter.initCount); Assert.assertTrue(1 <= glelCounter.reshapeCount); Assert.assertTrue(1 <= glelCounter.displayCount); @@ -241,15 +241,15 @@ public class TestGLContextDrawableSwitch10NEWT extends UITestCase { Assert.assertEquals(glls1.context.getGLReadDrawable(), glad2.getDelegatedDrawable()); Assert.assertEquals(glls1.context.getGLDrawable(), glad2.getDelegatedDrawable()); Assert.assertEquals(false, glls1.isOwner()); - + final long t0 = System.currentTimeMillis(); long t1 = t0; - + while( !quitAdapter.shouldQuit() && ( t1 - t0 ) < duration ) { Thread.sleep(100); t1 = System.currentTimeMillis(); } - + glad2.destroy(); Assert.assertEquals(1, glelCounter.initCount); Assert.assertTrue(1 <= glelCounter.reshapeCount); @@ -258,20 +258,20 @@ public class TestGLContextDrawableSwitch10NEWT extends UITestCase { } animator.stop(); } - - public static void main(String args[]) throws IOException { + + public static void main(final String args[]) throws IOException { for(int i=0; i - * Test utilizes {@link GLEventListenerState} for preserving the - * GLAutoDrawable state, i.e. GLContext, all GLEventListener + * Test utilizes {@link GLEventListenerState} for preserving the + * GLAutoDrawable state, i.e. GLContext, all GLEventListener * and the GLAnimatorControl association. *

    *

    @@ -68,54 +68,54 @@ public class TestGLContextDrawableSwitch11NewtAWT extends GLContextDrawableSwitc if(null == reqGLCaps) return; testGLWindowImpl(reqGLCaps); } - + @Test(timeout=30000) public void test22GLWindowGLES2() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); if(null == reqGLCaps) return; testGLWindowImpl(reqGLCaps); } - - private void testGLWindowImpl(GLCapabilities caps) throws InterruptedException { - final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener(); + + private void testGLWindowImpl(final GLCapabilities caps) throws InterruptedException { + final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener(); final GLEventListenerCounter glelTracker = new GLEventListenerCounter(); final Animator animator = new Animator(); animator.start(); - + final GLEventListenerState glels[] = new GLEventListenerState[1]; - + // - create glad1 w/o context // - create context using glad1 and assign it to glad1 { - testGLADOneLifecycle(null, caps, GLADType.GLWindow, width, + testGLADOneLifecycle(null, caps, GLADType.GLWindow, width, height, glelTracker, - snapshotGLEventListener, - null, glels, animator); + snapshotGLEventListener, + null, glels, animator); } - + // - create glad2 w/ survived context { - testGLADOneLifecycle(null, caps, GLADType.GLWindow, width+100, + testGLADOneLifecycle(null, caps, GLADType.GLWindow, width+100, height+100, glelTracker, - snapshotGLEventListener, + snapshotGLEventListener, glels[0], null, null); } animator.stop(); } - - public static void main(String args[]) throws IOException { + + public static void main(final String args[]) throws IOException { for(int i=0; i - * Test utilizes {@link GLEventListenerState} for preserving the - * GLAutoDrawable state, i.e. GLContext, all GLEventListener + * Test utilizes {@link GLEventListenerState} for preserving the + * GLAutoDrawable state, i.e. GLContext, all GLEventListener * and the GLAnimatorControl association. *

    *

    @@ -69,29 +69,29 @@ public class TestGLContextDrawableSwitch12AWT extends GLContextDrawableSwitchBas if(null == reqGLCaps) return; testGLCanvasImpl(reqGLCaps, false); } - + @Test(timeout=30000) public void test02GLCanvasOnscreenGLES2() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); if(null == reqGLCaps) return; testGLCanvasImpl(reqGLCaps, false); } - + @Test(timeout=30000) public void test11GLCanvasOffscreenGL2ES2() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2); if(null == reqGLCaps) return; testGLCanvasImpl(reqGLCaps, true); } - + @Test(timeout=30000) public void test12GLCanvasOffscreenGLES2() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); if(null == reqGLCaps) return; testGLCanvasImpl(reqGLCaps, true); } - - private void testGLCanvasImpl(GLCapabilities caps, boolean offscreenLayer) throws InterruptedException { + + private void testGLCanvasImpl(final GLCapabilities caps, final boolean offscreenLayer) throws InterruptedException { if( offscreenLayer ) { if( !JAWTUtil.isOffscreenLayerSupported() ) { System.err.println("Platform doesn't support offscreen rendering."); @@ -103,45 +103,45 @@ public class TestGLContextDrawableSwitch12AWT extends GLContextDrawableSwitchBas return; } } - final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener(); + final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener(); final GLEventListenerCounter glelTracker = new GLEventListenerCounter(); final Animator animator = new Animator(); animator.start(); - + final GLEventListenerState glels[] = new GLEventListenerState[1]; - + // - create glad1 w/o context // - create context using glad1 and assign it to glad1 { - testGLADOneLifecycle(null, caps, offscreenLayer ? GLADType.GLCanvasOffscreen : GLADType.GLCanvasOnscreen, width, + testGLADOneLifecycle(null, caps, offscreenLayer ? GLADType.GLCanvasOffscreen : GLADType.GLCanvasOnscreen, width, height, glelTracker, - snapshotGLEventListener, - null, glels, animator); + snapshotGLEventListener, + null, glels, animator); } - + // - create glad2 w/ survived context { - testGLADOneLifecycle(null, caps, offscreenLayer ? GLADType.GLCanvasOffscreen : GLADType.GLCanvasOnscreen, width+100, + testGLADOneLifecycle(null, caps, offscreenLayer ? GLADType.GLCanvasOffscreen : GLADType.GLCanvasOnscreen, width+100, height+100, glelTracker, - snapshotGLEventListener, + snapshotGLEventListener, glels[0], null, null); } animator.stop(); } - - public static void main(String args[]) throws IOException { + + public static void main(final String args[]) throws IOException { for(int i=0; i - * Test utilizes {@link GLEventListenerState} for preserving the - * GLAutoDrawable state, i.e. GLContext, all GLEventListener + * Test utilizes {@link GLEventListenerState} for preserving the + * GLAutoDrawable state, i.e. GLContext, all GLEventListener * and the GLAnimatorControl association. *

    *

    - * This test moves the {@link GLEventListenerState} from a + * This test moves the {@link GLEventListenerState} from a * NEWT GLWindow before it's destruction to an AWT GLCanvas after it's creation - * and vice versa + * and vice versa *

    *

    * See Bug 665 - https://jogamp.org/bugzilla/show_bug.cgi?id=665. @@ -69,7 +69,7 @@ import org.junit.runners.MethodSorters; * bug causing the quirk {@link GLRendererQuirks#DontCloseX11Display} * also causes an XCB crash when reusing the X11 display connection * from AWT -> NEWT. Pre-allocating the X11 Display and keeping it referenced - * to avoid such re-usage worksaround this problem. + * to avoid such re-usage worksaround this problem. *

    */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) @@ -81,14 +81,14 @@ public class TestGLContextDrawableSwitch21Newt2AWT extends GLContextDrawableSwit if(null == reqGLCaps) return; testGLCanvas2GLWindowImpl(null, reqGLCaps, GLADType.GLCanvasOnscreen, GLADType.GLWindow); } - + @Test(timeout=30000) public void test02GLCanvasOnScrn2GLWindowGLES2() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); if(null == reqGLCaps) return; testGLCanvas2GLWindowImpl(null, reqGLCaps, GLADType.GLCanvasOnscreen, GLADType.GLWindow); } - + @Test(timeout=30000) public void test11GLWindow2GLCanvasOnScrnGL2ES2() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2); @@ -99,7 +99,7 @@ public class TestGLContextDrawableSwitch21Newt2AWT extends GLContextDrawableSwit testGLCanvas2GLWindowImpl(screen, reqGLCaps, GLADType.GLWindow, GLADType.GLCanvasOnscreen); screen.removeReference(); } - + @Test(timeout=30000) public void test12GLWindow2GLCanvasOnScrnGLES2() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); @@ -110,21 +110,21 @@ public class TestGLContextDrawableSwitch21Newt2AWT extends GLContextDrawableSwit testGLCanvas2GLWindowImpl(screen, reqGLCaps, GLADType.GLWindow, GLADType.GLCanvasOnscreen); screen.removeReference(); } - + @Test(timeout=30000) public void test21GLCanvasOffScrn2GLWindowGL2ES2() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2); if(null == reqGLCaps) return; testGLCanvas2GLWindowImpl(null, reqGLCaps, GLADType.GLCanvasOffscreen, GLADType.GLWindow); } - + @Test(timeout=30000) public void test22GLCanvasOffScrn2GLWindowGLES2() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); if(null == reqGLCaps) return; testGLCanvas2GLWindowImpl(null, reqGLCaps, GLADType.GLCanvasOffscreen, GLADType.GLWindow); } - + @Test(timeout=30000) public void test31GLWindow2GLCanvasOffScrnGL2ES2() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2); @@ -135,7 +135,7 @@ public class TestGLContextDrawableSwitch21Newt2AWT extends GLContextDrawableSwit testGLCanvas2GLWindowImpl(screen, reqGLCaps, GLADType.GLWindow, GLADType.GLCanvasOffscreen); screen.removeReference(); } - + @Test(timeout=30000) public void test32GLWindow2GLCanvasOffScrnGLES2() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); @@ -146,50 +146,50 @@ public class TestGLContextDrawableSwitch21Newt2AWT extends GLContextDrawableSwit testGLCanvas2GLWindowImpl(screen, reqGLCaps, GLADType.GLWindow, GLADType.GLCanvasOffscreen); screen.removeReference(); } - - private void testGLCanvas2GLWindowImpl(Screen screen, GLCapabilities caps, GLADType gladType1, GLADType gladType2) throws InterruptedException { + + private void testGLCanvas2GLWindowImpl(final Screen screen, final GLCapabilities caps, final GLADType gladType1, final GLADType gladType2) throws InterruptedException { if( !validateOnOffscreenLayer(gladType1, gladType2) ) { return; } - final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener(); + final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener(); final GLEventListenerCounter glelTracker = new GLEventListenerCounter(); final Animator animator = new Animator(); animator.start(); - + final GLEventListenerState glels[] = new GLEventListenerState[1]; - + // - create glad1 w/o context // - create context using glad1 and assign it to glad1 { - testGLADOneLifecycle(screen, caps, gladType1, width, + testGLADOneLifecycle(screen, caps, gladType1, width, height, glelTracker, - snapshotGLEventListener, - null, glels, animator); + snapshotGLEventListener, + null, glels, animator); } - + // - create glad2 w/ survived context { - testGLADOneLifecycle(screen, caps, gladType2, width+100, + testGLADOneLifecycle(screen, caps, gladType2, width+100, height+100, glelTracker, - snapshotGLEventListener, + snapshotGLEventListener, glels[0], null, null); } animator.stop(); } - - public static void main(String args[]) throws IOException { + + public static void main(final String args[]) throws IOException { for(int i=0; i NPE ok: .. not realized - GLCapabilitiesImmutable glCapsRequested = glc.getRequestedGLCapabilities(); + final GLCapabilitiesImmutable glCapsRequested = glc.getRequestedGLCapabilities(); System.out.println("ReqCaps: "+glCapsRequested); System.out.println("GLCanvas: "+glc); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461FBOSupersamplingSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461FBOSupersamplingSwingAWT.java index 96ec8ab75..19c96af14 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461FBOSupersamplingSwingAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461FBOSupersamplingSwingAWT.java @@ -69,8 +69,8 @@ public class TestBug461FBOSupersamplingSwingAWT extends UITestCase implements GL GLOffscreenAutoDrawable offScreenBuffer; AWTGLReadBufferUtil awtGLReadBufferUtil; - private void render(GLAutoDrawable drawable) { - GL2 gl = drawable.getGL().getGL2(); + private void render(final GLAutoDrawable drawable) { + final GL2 gl = drawable.getGL().getGL2(); Assert.assertNotNull(gl); gl.glClear(GL.GL_COLOR_BUFFER_BIT); @@ -86,37 +86,37 @@ public class TestBug461FBOSupersamplingSwingAWT extends UITestCase implements GL } /* @Override */ - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { awtGLReadBufferUtil = new AWTGLReadBufferUtil(drawable.getGLProfile(), false); } /* @Override */ - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } /* @Override */ - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { render(offScreenBuffer); // BufferedImage outputImage = com.jogamp.opengl.util.awt.Screenshot.readToBufferedImage(200, 200, false); - BufferedImage outputImage = awtGLReadBufferUtil.readPixelsToBufferedImage(drawable.getGL(), 0, 0, 200, 200, true /* awtOrientation */); + final BufferedImage outputImage = awtGLReadBufferUtil.readPixelsToBufferedImage(drawable.getGL(), 0, 0, 200, 200, true /* awtOrientation */); Assert.assertNotNull(outputImage); - ImageIcon imageIcon = new ImageIcon(outputImage); + final ImageIcon imageIcon = new ImageIcon(outputImage); final JLabel imageLabel = new JLabel(imageIcon); try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { - Container cont = jframe.getContentPane(); + final Container cont = jframe.getContentPane(); cont.removeAll(); cont.add(imageLabel); cont.validate(); }}); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } /* @Override */ - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { try { awtGLReadBufferUtil.dispose(drawable.getGL()); javax.swing.SwingUtilities.invokeAndWait(new Runnable() { @@ -124,7 +124,7 @@ public class TestBug461FBOSupersamplingSwingAWT extends UITestCase implements GL jframe.setVisible(false); jframe.dispose(); }}); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } @@ -134,20 +134,20 @@ public class TestBug461FBOSupersamplingSwingAWT extends UITestCase implements GL jframe = new JFrame("Offscreen Supersampling"); Assert.assertNotNull(jframe); jframe.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { + public void windowClosing(final WindowEvent e) { System.exit(0); } }); - GLProfile glp = GLProfile.get(GLProfile.GL2); + final GLProfile glp = GLProfile.get(GLProfile.GL2); Assert.assertNotNull(glp); - GLDrawableFactory fac = GLDrawableFactory.getFactory(glp); + final GLDrawableFactory fac = GLDrawableFactory.getFactory(glp); Assert.assertNotNull(fac); Assert.assertTrue( fac.canCreateGLPbuffer(GLProfile.getDefaultDevice(), glp) ); - GLCapabilities glCap = new GLCapabilities(glp); + final GLCapabilities glCap = new GLCapabilities(glp); Assert.assertNotNull(glCap); // COMMENTING OUT THIS LINE FIXES THE ISSUE. @@ -177,7 +177,7 @@ public class TestBug461FBOSupersamplingSwingAWT extends UITestCase implements GL offScreenBuffer.destroy(); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i * Test disabled since showing the Desktop folder will - * disturb the 'desktop' .. if there is another way to show + * disturb the 'desktop' .. if there is another way to show * the performance bug, pls do so. *

    *

    * Since Windows XP is out of life .. we may not care .. - *

    + *

    */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestBug611AWT extends UITestCase { - + @Test public void test00() { - // make junit happy + // make junit happy } - + // @Test public void test01() { try { @@ -46,17 +46,17 @@ public class TestBug611AWT extends UITestCase { desktop = null; } if(null != desktop) { - String home = System.getProperty("user.home"); + final String home = System.getProperty("user.home"); File homeFolder = null; if(null != home) { { - File tst = new File(home + "/Desktop"); + final File tst = new File(home + "/Desktop"); if( tst.canRead() ) { homeFolder = tst; } } if(null == homeFolder) { - File tst = new File(home); + final File tst = new File(home); if( tst.canRead() ) { homeFolder = tst; } @@ -73,12 +73,12 @@ public class TestBug611AWT extends UITestCase { desktop.open(homeFolder); } } - } catch(Exception ex) { + } catch(final Exception ex) { ex.printStackTrace(); } } - - public static void main(String args[]) { + + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestBug611AWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug642JSplitPaneMixHwLw01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug642JSplitPaneMixHwLw01AWT.java index 57210a946..fffffcb96 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug642JSplitPaneMixHwLw01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug642JSplitPaneMixHwLw01AWT.java @@ -37,7 +37,7 @@ import com.jogamp.opengl.util.FPSAnimator; /** * Documenting Bug 642 (related to Bug 586) - * + * *

    * JSplitPane cannot mix hw/lw components, only if setting property '-Dsun.awt.disableMixing=true'. *

    @@ -47,62 +47,62 @@ import com.jogamp.opengl.util.FPSAnimator; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestBug642JSplitPaneMixHwLw01AWT extends UITestCase { static long durationPerTest = 500; - + static { // too late: use at cmd-line '-Dsun.awt.disableMixing=true' works // System.setProperty("sun.awt.disableMixing", "true"); } /** - * Doesn't work either .. + * Doesn't work either .. */ @SuppressWarnings("serial") public static class TransparentJScrollPane extends JScrollPane { - public TransparentJScrollPane(Component view) { + public TransparentJScrollPane(final Component view) { super(view); - + setOpaque(false); - + try { ReflectionUtil.callStaticMethod( - "com.sun.awt.AWTUtilities", "setComponentMixingCutoutShape", - new Class[] { Component.class, Shape.class }, - new Object[] { this, new Rectangle() } , + "com.sun.awt.AWTUtilities", "setComponentMixingCutoutShape", + new Class[] { Component.class, Shape.class }, + new Object[] { this, new Rectangle() } , GraphicsConfiguration.class.getClassLoader()); System.err.println("com.sun.awt.AWTUtilities.setComponentMixingCutoutShape(..) passed"); - } catch (RuntimeException re) { + } catch (final RuntimeException re) { System.err.println("com.sun.awt.AWTUtilities.setComponentMixingCutoutShape(..) failed: "+re.getMessage()); } } - + @Override - public void setOpaque(boolean isOpaque) { + public void setOpaque(final boolean isOpaque) { } } - - protected void runTestGL(GLCapabilities caps, boolean useGLJPanel, boolean useContainer) throws InterruptedException { + + protected void runTestGL(final GLCapabilities caps, final boolean useGLJPanel, final boolean useContainer) throws InterruptedException { final String typeS = useGLJPanel ? "LW" : "HW"; final JFrame frame = new JFrame("Mix Hw/Lw Swing - Canvas "+typeS); Assert.assertNotNull(frame); - + final Dimension f_sz = new Dimension(824,568); // final Dimension f_sz = new Dimension(600,400); // final Dimension glc_sz = new Dimension(500,600); - + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); - + final Component glComp; final GLAutoDrawable glad; if(useGLJPanel) { final GLJPanel glJPanel = new GLJPanel(new GLCapabilities(GLProfile.getDefault())); - Assert.assertNotNull(glJPanel); + Assert.assertNotNull(glJPanel); glJPanel.addGLEventListener(new GearsES2()); glComp = glJPanel; glad = glJPanel; } else { final GLCanvas glCanvas = new GLCanvas(new GLCapabilities(GLProfile.getDefault())); - Assert.assertNotNull(glCanvas); + Assert.assertNotNull(glCanvas); glCanvas.addGLEventListener(new GearsES2()); if( useContainer ) { final Container cont = new Container(); @@ -114,20 +114,20 @@ public class TestBug642JSplitPaneMixHwLw01AWT extends UITestCase { } glad = glCanvas; } - + final Container contentPane = frame.getContentPane(); - - JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); + + final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); splitPane.setResizeWeight(0.5d); splitPane.setLeftComponent(glComp); // splitPane.setLeftComponent(new JPanel()); // splitPane.setLeftComponent(new Canvas()); splitPane.setRightComponent(new JPanel()); - contentPane.add(splitPane, BorderLayout.CENTER); + contentPane.add(splitPane, BorderLayout.CENTER); final GLAnimatorControl animator = useGLJPanel ? new FPSAnimator(glad, 60) : new Animator(glad); animator.start(); - + try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { @@ -137,7 +137,7 @@ public class TestBug642JSplitPaneMixHwLw01AWT extends UITestCase { frame.setVisible(true); // however, Hw/Lw mixing is still a problem .. }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } @@ -146,14 +146,14 @@ public class TestBug642JSplitPaneMixHwLw01AWT extends UITestCase { Thread.sleep(durationPerTest); animator.stop(); - + try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame.setVisible(false); frame.dispose(); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } @@ -161,26 +161,26 @@ public class TestBug642JSplitPaneMixHwLw01AWT extends UITestCase { @Test public void test01JSplitPaneWithHwGLCanvasPlain() throws InterruptedException { - GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.getGL2ES2(); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps, false, false); } @Test public void test02JSplitPaneWithHwGLCanvasContainer() throws InterruptedException { - GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.getGL2ES2(); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps, false, true); } - + @Test public void test03JSplitPaneWithLwGLJPanel() throws InterruptedException { - GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.getGL2ES2(); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps, true, false); } - - public static void main(String args[]) throws IOException { + + public static void main(final String args[]) throws IOException { for(int i=0; i P2 - START"); dumpGLCanvasStats(glCanvas); panel2.add(glCanvas, BorderLayout.CENTER); @@ -123,10 +123,10 @@ public class TestBug816GLCanvasFrameHoppingB849B889AWT extends UITestCase { }); panel1.add(bMoveP1toP2, BorderLayout.NORTH); - JButton bMoveP2toP1 = new JButton("Move to Panel1"); + final JButton bMoveP2toP1 = new JButton("Move to Panel1"); bMoveP2toP1.addActionListener(new ActionListener() { @Override - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { System.err.println("XXXX Move P2 -> P1 - START"); dumpGLCanvasStats(glCanvas); panel1.add(glCanvas, BorderLayout.CENTER); @@ -241,14 +241,14 @@ public class TestBug816GLCanvasFrameHoppingB849B889AWT extends UITestCase { } }); } - private static String id(Object obj) { return "0x"+Integer.toHexString(obj.hashCode()); } + private static String id(final Object obj) { return "0x"+Integer.toHexString(obj.hashCode()); } - static void dumpGLCanvasStats(GLCanvas glCanvas) { + static void dumpGLCanvasStats(final GLCanvas glCanvas) { System.err.println("XXXX GLCanvas: comp "+glCanvas+", visible "+glCanvas.isVisible()+", showing "+glCanvas.isShowing()+ ", displayable "+glCanvas.isDisplayable()+", "+glCanvas.getSurfaceWidth()+"x"+glCanvas.getSurfaceHeight()); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i Panel1("+id(panel1)+") START"); dumpGLCanvasStats(glCanvas); @@ -174,14 +174,14 @@ public class TestBug816JTabbedPanelVisibilityB849B878AWT extends UITestCase { } }); } - private static String id(Object obj) { return "0x"+Integer.toHexString(obj.hashCode()); } + private static String id(final Object obj) { return "0x"+Integer.toHexString(obj.hashCode()); } - static void dumpGLCanvasStats(GLCanvas glCanvas) { + static void dumpGLCanvasStats(final GLCanvas glCanvas) { System.err.println("XXXX GLCanvas: comp "+glCanvas+", visible "+glCanvas.isVisible()+", showing "+glCanvas.isShowing()+ ", displayable "+glCanvas.isDisplayable()+", "+glCanvas.getSurfaceWidth()+"x"+glCanvas.getSurfaceHeight()); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i + *
      * at apple.awt.CWindow._setTitle(Native Method)
      *  at apple.awt.CWindow.setTitle(CWindow.java:765) [1.6.0_37, build 1.6.0_37-b06-434-11M3909]
      * 
    @@ -75,7 +75,7 @@ import org.junit.runners.MethodSorters; * e.g. setResizable*(). *

    *

    - * Users shall make sure all mutable AWT calls are performed on the EDT, even before 1st setVisible(true) ! + * Users shall make sure all mutable AWT calls are performed on the EDT, even before 1st setVisible(true) ! *

    */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) @@ -86,30 +86,30 @@ public class TestGLCanvasAWTActionDeadlock01AWT extends UITestCase { GLEventListener gle1 = null; GLEventListener gle2 = null; - + @Test public void test00NoAnimator() throws InterruptedException, InvocationTargetException { testImpl(null, 0, false); } - + @Test public void test01Animator() throws InterruptedException, InvocationTargetException { testImpl(new Animator(), 0, false); } - + @Test public void test02FPSAnimator() throws InterruptedException, InvocationTargetException { testImpl(new FPSAnimator(30), 0, false); } - + @Test public void test02FPSAnimator_RestartOnAWTEDT() throws InterruptedException, InvocationTargetException { testImpl(new FPSAnimator(30), 200, false); } - + /** May crash due to invalid thread usage, i.e. non AWT-EDT - * @throws InvocationTargetException - * @throws InterruptedException + * @throws InvocationTargetException + * @throws InterruptedException @Test public void test02FPSAnimator_RestartOnCurrentThread() throws InterruptedException { testImpl(new FPSAnimator(30), 200, true); @@ -125,50 +125,50 @@ public class TestGLCanvasAWTActionDeadlock01AWT extends UITestCase { frame.setTitle(msg); } } ); } - - void testImpl(final AnimatorBase animator, int restartPeriod, boolean restartOnCurrentThread) throws InterruptedException, InvocationTargetException { + + void testImpl(final AnimatorBase animator, final int restartPeriod, final boolean restartOnCurrentThread) throws InterruptedException, InvocationTargetException { final Frame frame1 = new Frame("Frame 1"); final Applet applet1 = new Applet() { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; }; - + final VersionNumber version170 = new VersionNumber(1, 7, 0); - final boolean osxCALayerAWTModBug = Platform.OSType.MACOS == Platform.getOSType() && + final boolean osxCALayerAWTModBug = Platform.OSType.MACOS == Platform.getOSType() && 0 > Platform.getJavaVersionNumber().compareTo(version170); System.err.println("OSX CALayer AWT-Mod Bug "+osxCALayerAWTModBug); System.err.println("OSType "+Platform.getOSType()); System.err.println("Java Version "+Platform.getJavaVersionNumber()); - + Assert.assertNotNull(frame1); javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame1.setLayout(null); frame1.pack(); { - Insets insets = frame1.getInsets(); - int w = width + insets.left + insets.right; - int h = height + insets.top + insets.bottom; + final Insets insets = frame1.getInsets(); + final int w = width + insets.left + insets.right; + final int h = height + insets.top + insets.bottom; frame1.setSize(w, h); - - int usableH = h - insets.top - insets.bottom; - applet1.setBounds((w - width)/2, insets.top + (usableH - height)/2, width, height); + + final int usableH = h - insets.top - insets.bottom; + applet1.setBounds((w - width)/2, insets.top + (usableH - height)/2, width, height); } frame1.setLocation(0, 0); frame1.setTitle("Generic Title"); frame1.add(applet1); }}); - + frame1.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { + public void windowClosing(final WindowEvent e) { dispose(frame1, applet1); } - }); - + }); + gle1 = new GLEventListener() { boolean justInitialized = true; - + @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { justInitialized = true; if( !osxCALayerAWTModBug ) { System.err.println("*Init*: CT "+Thread.currentThread().getName()); @@ -178,13 +178,13 @@ public class TestGLCanvasAWTActionDeadlock01AWT extends UITestCase { } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { System.err.println("*Dispose*: CT "+Thread.currentThread().getName()); setFrameTitle(frame1, "DISPOSE"); } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { if( !osxCALayerAWTModBug || !justInitialized ) { System.err.println("*Display*: CT "+Thread.currentThread().getName()); setFrameTitle(frame1, "f "+frameCount+", fps "+( null != animator ? animator.getLastFPS() : 0)); @@ -195,19 +195,19 @@ public class TestGLCanvasAWTActionDeadlock01AWT extends UITestCase { } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { if( !osxCALayerAWTModBug || !justInitialized ) { System.err.println("*Reshape*: CT "+Thread.currentThread().getName()); setFrameTitle(frame1, "RESHAPE"); } - } - }; + } + }; gle2 = new GearsES2(); GLCanvas glCanvas = createGLCanvas(); glCanvas.addGLEventListener(gle1); glCanvas.addGLEventListener(gle2); - + if(null != animator) { System.err.println("About to start Animator: CT "+Thread.currentThread().getName()); animator.setUpdateFPSFrames(60, System.err); @@ -216,7 +216,7 @@ public class TestGLCanvasAWTActionDeadlock01AWT extends UITestCase { } attachGLCanvas(applet1, glCanvas, false); - + System.err.println("About to setVisible.0 CT "+Thread.currentThread().getName()); try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { @@ -225,12 +225,12 @@ public class TestGLCanvasAWTActionDeadlock01AWT extends UITestCase { frame1.setVisible(true); System.err.println("About to setVisible.1.X CT "+Thread.currentThread().getName()); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } System.err.println("About to setVisible.X CT "+Thread.currentThread().getName()); - + final long sleep = 0 < restartPeriod ? restartPeriod : 100; long togo = durationPerTest; while( 0 < togo ) { @@ -240,23 +240,23 @@ public class TestGLCanvasAWTActionDeadlock01AWT extends UITestCase { if(0 < restartPeriod) { glCanvas = restart(applet1, glCanvas, restartOnCurrentThread); } - + Thread.sleep(sleep); - + togo -= sleep; } - + dispose(frame1, applet1); if(null != animator) { animator.stop(); } - - gle1 = null; + + gle1 = null; gle2 = null; } - + int frameCount = 0; - + GLCanvas createGLCanvas() { System.err.println("*** createGLCanvas.0"); final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); @@ -268,7 +268,7 @@ public class TestGLCanvasAWTActionDeadlock01AWT extends UITestCase { Assert.assertNotNull(glCanvas); System.err.println("*** createGLCanvas.X"); frameCount = 0; - return glCanvas; + return glCanvas; } void dispose(final Frame frame, final Applet applet) { @@ -278,27 +278,27 @@ public class TestGLCanvasAWTActionDeadlock01AWT extends UITestCase { frame.remove(applet); frame.dispose(); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } } - - GLCanvas restart(final Applet applet, GLCanvas glCanvas, boolean restartOnCurrentThread) throws InterruptedException { + + GLCanvas restart(final Applet applet, GLCanvas glCanvas, final boolean restartOnCurrentThread) throws InterruptedException { glCanvas.disposeGLEventListener(gle1, true); glCanvas.disposeGLEventListener(gle2, true); detachGLCanvas(applet, glCanvas, restartOnCurrentThread); - + glCanvas = createGLCanvas(); - + attachGLCanvas(applet, glCanvas, restartOnCurrentThread); glCanvas.addGLEventListener(gle1); glCanvas.addGLEventListener(gle2); - + return glCanvas; } - - void attachGLCanvas(final Applet applet, final GLCanvas glCanvas, boolean restartOnCurrentThread) { + + void attachGLCanvas(final Applet applet, final GLCanvas glCanvas, final boolean restartOnCurrentThread) { System.err.println("*** attachGLCanvas.0 on-current-thread "+restartOnCurrentThread+", currentThread "+Thread.currentThread().getName()); if( restartOnCurrentThread ) { applet.setLayout(new BorderLayout()); @@ -312,15 +312,15 @@ public class TestGLCanvasAWTActionDeadlock01AWT extends UITestCase { applet.add(glCanvas, BorderLayout.CENTER); applet.validate(); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } } System.err.println("*** attachGLCanvas.X"); } - - void detachGLCanvas(final Applet applet, final GLCanvas glCanvas, boolean restartOnCurrentThread) { + + void detachGLCanvas(final Applet applet, final GLCanvas glCanvas, final boolean restartOnCurrentThread) { System.err.println("*** detachGLCanvas.0 on-current-thread "+restartOnCurrentThread+", currentThread "+Thread.currentThread().getName()); if( restartOnCurrentThread ) { applet.remove(glCanvas); @@ -329,18 +329,18 @@ public class TestGLCanvasAWTActionDeadlock01AWT extends UITestCase { try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { - applet.remove(glCanvas); + applet.remove(glCanvas); applet.validate(); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } } System.err.println("*** detachGLCanvas.X"); } - - public static void main(String args[]) { + + public static void main(final String args[]) { for(int i=0; i 1000 * fint) { frate = (float)(fcount) / fint; fcount = 0; @@ -475,14 +475,14 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase { } void clock() { - long afterTime = System.nanoTime(); - long timeDiff = afterTime - beforeTime; - long sleepTime = (frameRatePeriod - timeDiff) - overSleepTime; + final long afterTime = System.nanoTime(); + final long timeDiff = afterTime - beforeTime; + final long sleepTime = (frameRatePeriod - timeDiff) - overSleepTime; if (sleepTime > 0) { // some time left in this cycle try { Thread.sleep(sleepTime / 1000000L, (int) (sleepTime % 1000000L)); - } catch (InterruptedException ex) { } + } catch (final InterruptedException ex) { } overSleepTime = (System.nanoTime() - afterTime) - sleepTime; @@ -495,48 +495,48 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase { class SimpleListener implements GLEventListener { @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { draw(drawable.getGL().getGL2()); justInitialized = false; } @Override - public void dispose(GLAutoDrawable drawable) { } + public void dispose(final GLAutoDrawable drawable) { } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { justInitialized = true; } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) { } + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int w, final int h) { } } - public void mouseDragged(MouseEvent ev) { + public void mouseDragged(final MouseEvent ev) { if (printEventInfo) { System.err.println("Mouse dragged event: " + ev); } } - public void mouseMoved(MouseEvent ev) { + public void mouseMoved(final MouseEvent ev) { if (printEventInfo) { System.err.println("Mouse moved event: " + ev); } } - public void keyPressed(KeyEvent ev) { + public void keyPressed(final KeyEvent ev) { if (printEventInfo) { System.err.println("Key pressed event: " + ev); } } - public void keyReleased(KeyEvent ev) { + public void keyReleased(final KeyEvent ev) { if (printEventInfo) { System.err.println("Key released event: " + ev); } } - public void keyTyped(KeyEvent ev) { + public void keyTyped(final KeyEvent ev) { if (printEventInfo) { System.err.println("Key typed event: " + ev); } @@ -550,13 +550,13 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase { private TimerTask task = null; private volatile boolean shouldRun; - protected String getBaseName(String prefix) { + protected String getBaseName(final String prefix) { return "Custom" + prefix + "Animator" ; } /** Creates an CustomAnimator with an initial drawable to * animate. */ - public CustomAnimator(GLAutoDrawable drawable) { + public CustomAnimator(final GLAutoDrawable drawable) { if (drawable != null) { add(drawable); } @@ -630,7 +630,7 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase { animThread = null; try { Thread.sleep(20); // ~ 1/60 hz wait, since we can't ctrl stopped threads - } catch (InterruptedException e) { } + } catch (final InterruptedException e) { } return true; } @@ -644,21 +644,21 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase { public void test00() { TestGLCanvasAWTActionDeadlock02AWT.MiniPApplet mini; try { - Class c = Thread.currentThread().getContextClassLoader().loadClass(TestGLCanvasAWTActionDeadlock02AWT.MiniPApplet.class.getName()); + final Class c = Thread.currentThread().getContextClassLoader().loadClass(TestGLCanvasAWTActionDeadlock02AWT.MiniPApplet.class.getName()); mini = (TestGLCanvasAWTActionDeadlock02AWT.MiniPApplet) c.newInstance(); - } catch (Exception e) { + } catch (final Exception e) { throw new RuntimeException(e); } if (mini != null) { try { mini.run(); - } catch (Exception ex) { + } catch (final Exception ex) { Assume.assumeNoException(ex); } } } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i * JScrollPane cannot mix hw/lw components, only if setting property '-Dsun.awt.disableMixing=true'. *

    @@ -45,65 +45,65 @@ import com.jogamp.opengl.util.Animator; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestJScrollPaneMixHwLw01AWT extends UITestCase { static long durationPerTest = 500; - + static { // too late: use at cmd-line '-Dsun.awt.disableMixing=true' works // System.setProperty("sun.awt.disableMixing", "true"); } /** - * Doesn't work either .. + * Doesn't work either .. */ @SuppressWarnings("serial") public static class TransparentJScrollPane extends JScrollPane { - public TransparentJScrollPane(Component view) { + public TransparentJScrollPane(final Component view) { super(view); - + setOpaque(false); - + try { ReflectionUtil.callStaticMethod( - "com.sun.awt.AWTUtilities", "setComponentMixingCutoutShape", - new Class[] { Component.class, Shape.class }, - new Object[] { this, new Rectangle() } , + "com.sun.awt.AWTUtilities", "setComponentMixingCutoutShape", + new Class[] { Component.class, Shape.class }, + new Object[] { this, new Rectangle() } , GraphicsConfiguration.class.getClassLoader()); System.err.println("com.sun.awt.AWTUtilities.setComponentMixingCutoutShape(..) passed"); - } catch (RuntimeException re) { + } catch (final RuntimeException re) { System.err.println("com.sun.awt.AWTUtilities.setComponentMixingCutoutShape(..) failed: "+re.getMessage()); } } - + @Override - public void setOpaque(boolean isOpaque) { + public void setOpaque(final boolean isOpaque) { } } - - protected void runTestGL(GLCapabilities caps, boolean useJScroll) throws InterruptedException { + + protected void runTestGL(final GLCapabilities caps, final boolean useJScroll) throws InterruptedException { final String typeS = useJScroll ? "LW" : "HW"; final JFrame frame = new JFrame("Mix Hw/Lw Swing - ScrollPane "+typeS); Assert.assertNotNull(frame); - + final Dimension f_sz = new Dimension(600,400); final Dimension glc_sz = new Dimension(500,600); - + final GLCanvas glCanvas = new GLCanvas(caps); - Assert.assertNotNull(glCanvas); + Assert.assertNotNull(glCanvas); glCanvas.addGLEventListener(new GearsES2()); glCanvas.setPreferredSize(glc_sz); - - JPanel panel = new JPanel(new BorderLayout()); + + final JPanel panel = new JPanel(new BorderLayout()); panel.setOpaque(false); if(useJScroll) { - final JScrollPane scrollPane = new TransparentJScrollPane(glCanvas); + final JScrollPane scrollPane = new TransparentJScrollPane(glCanvas); panel.add(scrollPane, BorderLayout.CENTER); } else { - ScrollPane scrollPane = new ScrollPane(); + final ScrollPane scrollPane = new ScrollPane(); scrollPane.add(glCanvas); panel.add(scrollPane, BorderLayout.CENTER); } - - JTextArea textArea = new JTextArea(); + + final JTextArea textArea = new JTextArea(); textArea.setText("Test\nTest\nTest\nTest\n"); panel.add(textArea, BorderLayout.NORTH); @@ -119,25 +119,25 @@ public class TestJScrollPaneMixHwLw01AWT extends UITestCase { frame.setSize(f_sz); frame.setVisible(true); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } - Animator animator = new Animator(glCanvas); + final Animator animator = new Animator(glCanvas); animator.start(); Thread.sleep(durationPerTest); animator.stop(); - + try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame.setVisible(false); frame.dispose(); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } @@ -145,19 +145,19 @@ public class TestJScrollPaneMixHwLw01AWT extends UITestCase { // @Test doesn't work public void test01JScrollPane() throws InterruptedException { - GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.getGL2ES2(); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps, true); } @Test public void test01ScrollPane() throws InterruptedException { - GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.getGL2ES2(); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps, false); } - - public static void main(String args[]) throws IOException { + + public static void main(final String args[]) throws IOException { for(int i=0; i available, + public int chooseCapabilities(final CapabilitiesImmutable desired, + final List available, final int windowSystemRecommendedChoice) { boolean anyHaveSampleBuffers = false; for (int i = 0; i < available.size(); i++) { - GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) available.get(i); + final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) available.get(i); if ( caps.getSampleBuffers() ) { anyHaveSampleBuffers = true; break; } } - int selection = super.chooseCapabilities(desired, available, windowSystemRecommendedChoice); + final int selection = super.chooseCapabilities(desired, available, windowSystemRecommendedChoice); if (!anyHaveSampleBuffers) { System.err.println("WARNING: antialiasing will be disabled because none of the available pixel formats had it to offer"); } else { - GLCapabilitiesImmutable selected = (GLCapabilitiesImmutable) available.get(selection); + final GLCapabilitiesImmutable selected = (GLCapabilitiesImmutable) available.get(selection); if (!selected.getSampleBuffers()) { System.err.println("WARNING: antialiasing will be disabled because the DefaultGLCapabilitiesChooser didn't supply it"); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageAWT.java index 25883f641..a42564dbc 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageAWT.java @@ -39,6 +39,7 @@ import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.util.awt.Screenshot; import com.jogamp.opengl.util.texture.TextureIO; @@ -55,15 +56,15 @@ import com.jogamp.opengl.test.junit.util.UITestCase; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestBug605FlippedImageAWT extends UITestCase { class FlippedImageTest implements GLEventListener { - public void display(GLAutoDrawable drawable) { - GL2 gl = drawable.getGL().getGL2(); + public void display(final GLAutoDrawable drawable) { + final GL2 gl = drawable.getGL().getGL2(); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT | GL.GL_STENCIL_BUFFER_BIT | GL2.GL_ACCUM_BUFFER_BIT ); - gl.glMatrixMode(GL2.GL_PROJECTION); + gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); - gl.glMatrixMode(GL2.GL_MODELVIEW); + gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); // red below @@ -88,28 +89,28 @@ public class TestBug605FlippedImageAWT extends UITestCase { final String fname = getSnapshotFilename(0, null, caps, width, height, false, TextureIO.PNG, null); try { Screenshot.writeToFile(new File(fname), width, height, false); - } catch (GLException e) { + } catch (final GLException e) { throw e; - } catch (IOException e) { + } catch (final IOException e) { throw new GLException(e); } testFlipped(width, height); } - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { final GL gl = drawable.getGL(); System.err.println("GL_RENDERER: "+gl.glGetString(GL.GL_RENDERER)); System.err.println("GL_VERSION: "+gl.glGetString(GL.GL_VERSION)); } - public void reshape(GLAutoDrawable glDrawable, int x, int y, int w, int h) {} - public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {} - public void dispose(GLAutoDrawable drawable) {} + public void reshape(final GLAutoDrawable glDrawable, final int x, final int y, final int w, final int h) {} + public void displayChanged(final GLAutoDrawable drawable, final boolean modeChanged, final boolean deviceChanged) {} + public void dispose(final GLAutoDrawable drawable) {} } static final int green = 0x0000ff00; // above static final int red = 0x00ff0000; // below - private void testFlipped(int width, int height) { + private void testFlipped(final int width, final int height) { // Default origin 0/0 is lower left corner, so is the memory layout // However AWT origin 0/0 is upper left corner final BufferedImage image = Screenshot.readToBufferedImage(width, height); @@ -129,7 +130,7 @@ public class TestBug605FlippedImageAWT extends UITestCase { } } - private void test(GLCapabilitiesImmutable caps) { + private void test(final GLCapabilitiesImmutable caps) { final GLDrawableFactory glFactory = GLDrawableFactory.getFactory(caps.getGLProfile()); final GLAutoDrawable glad = glFactory.createOffscreenAutoDrawable(null, caps, null, 256, 256); @@ -181,7 +182,7 @@ public class TestBug605FlippedImageAWT extends UITestCase { test(caps); } - public static void main(String[] args) { + public static void main(final String[] args) { org.junit.runner.JUnitCore.main(TestBug605FlippedImageAWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageNEWT.java index ed4e702f4..2d879a6be 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageNEWT.java @@ -37,6 +37,7 @@ import javax.media.opengl.GLCapabilitiesImmutable; import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLProfile; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import org.junit.Assert; import org.junit.Test; @@ -49,15 +50,15 @@ import com.jogamp.opengl.util.GLReadBufferUtil; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestBug605FlippedImageNEWT extends UITestCase { static class FlippedImageTest implements GLEventListener { - public void display(GLAutoDrawable drawable) { - GL2 gl = drawable.getGL().getGL2(); + public void display(final GLAutoDrawable drawable) { + final GL2 gl = drawable.getGL().getGL2(); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT | GL.GL_STENCIL_BUFFER_BIT | GL2.GL_ACCUM_BUFFER_BIT ); - gl.glMatrixMode(GL2.GL_PROJECTION); + gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); - gl.glMatrixMode(GL2.GL_MODELVIEW); + gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); // red below @@ -77,26 +78,26 @@ public class TestBug605FlippedImageNEWT extends UITestCase { gl.glFinish(); } - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { final GL gl = drawable.getGL(); System.err.println("GL_RENDERER: "+gl.glGetString(GL.GL_RENDERER)); System.err.println("GL_VERSION: "+gl.glGetString(GL.GL_VERSION)); } - public void reshape(GLAutoDrawable glDrawable, int x, int y, int w, int h) {} - public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {} - public void dispose(GLAutoDrawable drawable) {} + public void reshape(final GLAutoDrawable glDrawable, final int x, final int y, final int w, final int h) {} + public void displayChanged(final GLAutoDrawable drawable, final boolean modeChanged, final boolean deviceChanged) {} + public void dispose(final GLAutoDrawable drawable) {} } static final int green = 0x0000ff00; // above static final int red = 0x00ff0000; // below - private int getRGB(ByteBuffer bb, int o) { + private int getRGB(final ByteBuffer bb, final int o) { return ( bb.get(o+0) & 0x000000ff ) << 16 | ( bb.get(o+1) & 0x000000ff ) << 8 | ( bb.get(o+2) & 0x000000ff ); } - private void testFlipped(ByteBuffer bb, int width, int height, int comp) { + private void testFlipped(final ByteBuffer bb, final int width, final int height, final int comp) { // Default origin 0/0 is lower left corner, so is the memory layout // x=0, y=0: RGB -> _RGB [high-byte .. low-byte] @@ -116,7 +117,7 @@ public class TestBug605FlippedImageNEWT extends UITestCase { } } - private void test(GLCapabilitiesImmutable caps) { + private void test(final GLCapabilitiesImmutable caps) { final GLReadBufferUtil rbu = new GLReadBufferUtil(false, false); final GLDrawableFactory glFactory = GLDrawableFactory.getFactory(caps.getGLProfile()); final GLAutoDrawable glad = glFactory.createOffscreenAutoDrawable(null, caps, null, 256, 256); @@ -172,7 +173,7 @@ public class TestBug605FlippedImageNEWT extends UITestCase { test(caps); } - public static void main(String[] args) { + public static void main(final String[] args) { org.junit.runner.JUnitCore.main(TestBug605FlippedImageNEWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1AWT.java index ba93dcdcd..7ae9e859a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1AWT.java @@ -67,14 +67,14 @@ public class TestMultisampleES1AWT extends UITestCase { static long durationPerTest = 60; // ms private GLCanvas canvas; - public static void main(String[] args) { + public static void main(final String[] args) { for(int i=0; i0) { caps.setSampleBuffers(true); @@ -108,12 +108,12 @@ public class TestMultisampleES1AWT extends UITestCase { canvas.addGLEventListener(new MultisampleDemoES1(reqSamples>0?true:false)); canvas.addGLEventListener(new GLEventListener() { int displayCount = 0; - public void init(GLAutoDrawable drawable) {} - public void dispose(GLAutoDrawable drawable) {} - public void display(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) {} + public void display(final GLAutoDrawable drawable) { snapshot(displayCount++, null, drawable.getGL(), screenshot, TextureIO.PNG, null); } - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { } + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } }); final Frame frame = new Frame("Multi Samples "+reqSamples); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1NEWT.java index cf30c50bd..4996f786d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES1NEWT.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -29,11 +29,11 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. - * + * * Sun gratefully acknowledges that this software was originally authored * and developed by Kenneth Bradley Russell and Christopher John Kline. */ @@ -62,14 +62,14 @@ public class TestMultisampleES1NEWT extends UITestCase { static long durationPerTest = 60; // ms private GLWindow window; - public static void main(String[] args) { + public static void main(final String[] args) { for(int i=0; i0) { caps.setSampleBuffers(true); caps.setNumSamples(reqSamples); @@ -133,12 +133,12 @@ public class TestMultisampleES1NEWT extends UITestCase { window.addGLEventListener(new MultisampleDemoES1(reqSamples>0?true:false)); window.addGLEventListener(new GLEventListener() { int displayCount = 0; - public void init(GLAutoDrawable drawable) {} - public void dispose(GLAutoDrawable drawable) {} - public void display(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) {} + public void display(final GLAutoDrawable drawable) { snapshot(displayCount++, null, drawable.getGL(), screenshot, TextureIO.PNG, null); } - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { } + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } }); window.setSize(512, 512); window.setVisible(true); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES2NEWT.java index 008568f68..daac8ad5a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestMultisampleES2NEWT.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2010 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -29,11 +29,11 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. - * + * * Sun gratefully acknowledges that this software was originally authored * and developed by Kenneth Bradley Russell and Christopher John Kline. */ @@ -61,14 +61,14 @@ import com.jogamp.opengl.util.texture.TextureIO; public class TestMultisampleES2NEWT extends UITestCase { static long durationPerTest = 60; // ms - public static void main(String[] args) { + public static void main(final String[] args) { for(int i=0; i0) { caps.setSampleBuffers(true); caps.setNumSamples(reqSamples); @@ -122,12 +122,12 @@ public class TestMultisampleES2NEWT extends UITestCase { window.addGLEventListener(new MultisampleDemoES2(reqSamples>0?true:false)); window.addGLEventListener(new GLEventListener() { int displayCount = 0; - public void init(GLAutoDrawable drawable) {} - public void dispose(GLAutoDrawable drawable) {} - public void display(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) {} + public void display(final GLAutoDrawable drawable) { snapshot(displayCount++, null, drawable.getGL(), screenshot, TextureIO.PNG, null); } - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { } + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } }); window.setSize(512, 512); window.setVisible(true); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyAWT.java index 7ba6b0947..521d9c2fe 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyAWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.caps; import java.awt.BorderLayout; @@ -73,23 +73,23 @@ public class TestTranslucencyAWT extends UITestCase { static Frame getTranslucentFrame() { GraphicsConfiguration gc=null; - GraphicsDevice[] devices= GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); + final GraphicsDevice[] devices= GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); for (int i = 0; i < devices.length ; i++) { - GraphicsConfiguration[] configs = devices[i].getConfigurations(); + final GraphicsConfiguration[] configs = devices[i].getConfigurations(); for (int j = 0; j < configs.length ; j++) { - GraphicsConfiguration config = configs[j]; - ColorModel tcm = config.getColorModel(Transparency.TRANSLUCENT); - boolean capable1 = ( null != tcm ) ? tcm.getTransparency() == Transparency.TRANSLUCENT : false; + final GraphicsConfiguration config = configs[j]; + final ColorModel tcm = config.getColorModel(Transparency.TRANSLUCENT); + final boolean capable1 = ( null != tcm ) ? tcm.getTransparency() == Transparency.TRANSLUCENT : false; boolean capable2 = false; try { capable2 = ((Boolean)ReflectionUtil.callStaticMethod( - "com.sun.awt.AWTUtilities", "isTranslucencyCapable", - new Class[] { GraphicsConfiguration.class }, - new Object[] { config } , + "com.sun.awt.AWTUtilities", "isTranslucencyCapable", + new Class[] { GraphicsConfiguration.class }, + new Object[] { config } , GraphicsConfiguration.class.getClassLoader())).booleanValue(); System.err.println("com.sun.awt.AWTUtilities.isTranslucencyCapable(config) passed: "+capable2); - } catch (RuntimeException re) { + } catch (final RuntimeException re) { System.err.println("com.sun.awt.AWTUtilities.isTranslucencyCapable(config) failed: "+re.getMessage()); } System.err.println(i+":"+j+" "+config+", "+tcm+", capable "+capable1+"/"+capable2); @@ -108,18 +108,18 @@ public class TestTranslucencyAWT extends UITestCase { frame.setTitle("AWT Parent Frame (opaque: "+(null==gc)+")"); return frame; } - + @Test public void test() throws InterruptedException, InvocationTargetException { final Frame frame1 = getTranslucentFrame(); final GLCanvas glCanvas= new GLCanvas(glCaps); - + glCanvas.setPreferredSize(size); - GLEventListener demo1 = new GearsES2(1); + final GLEventListener demo1 = new GearsES2(1); // setDemoFields(demo1, glCanvas, false); glCanvas.addGLEventListener(demo1); - GLAnimatorControl animator1 = new Animator(glCanvas); + final GLAnimatorControl animator1 = new Animator(glCanvas); animator1.start(); final Container cont1 = new Container(); @@ -155,21 +155,21 @@ public class TestTranslucencyAWT extends UITestCase { frame1.dispose(); } - static int atoi(String a) { + static int atoi(final String a) { int i=0; try { i = Integer.parseInt(a); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } return i; } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; iwidth) { - float h = (float)height / (float)width; + final float h = (float)height / (float)width; gl.glFrustumf(-1.0f, 1.0f, -h, h, 5.0f, 60.0f); } else { - float h = (float)width / (float)height; + final float h = (float)width / (float)height; gl.glFrustumf(-h, h, -1.0f, 1.0f, 5.0f, 60.0f); } - gl.glMatrixMode(GL2ES1.GL_MODELVIEW); + gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); gl.glTranslatef(0.0f, 0.0f, -40.0f); System.err.println(Thread.currentThread()+" GearsES1.reshape FIN"); } - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { System.err.println(Thread.currentThread()+" GearsES1.dispose ... "); final Object upstreamWidget = drawable.getUpstreamWidget(); if (upstreamWidget instanceof Window) { @@ -234,7 +236,7 @@ public class GearsES1 implements GLEventListener { window.removeMouseListener(gearsMouse); window.removeKeyListener(gearsKeys); } - GL gl = drawable.getGL(); + final GL gl = drawable.getGL(); gear1.destroy(gl); gear1 = null; gear2.destroy(gl); @@ -244,12 +246,12 @@ public class GearsES1 implements GLEventListener { System.err.println(Thread.currentThread()+" GearsES1.dispose FIN"); } - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { // Turn the gears' teeth angle += 2.0f; // Get the GL corresponding to the drawable we are animating - GL2ES1 gl = drawable.getGL().getGL2ES1(); + final GL2ES1 gl = drawable.getGL().getGL2ES1(); final boolean hasFocus; final Object upstreamWidget = drawable.getUpstreamWidget(); @@ -295,8 +297,8 @@ public class GearsES1 implements GLEventListener { class GearsKeyAdapter extends KeyAdapter { - public void keyPressed(KeyEvent e) { - int kc = e.getKeyCode(); + public void keyPressed(final KeyEvent e) { + final int kc = e.getKeyCode(); if(KeyEvent.VK_LEFT == kc) { view_roty -= 1; } else if(KeyEvent.VK_RIGHT == kc) { @@ -310,36 +312,36 @@ public class GearsES1 implements GLEventListener { } class GearsMouseAdapter extends MouseAdapter { - public void mousePressed(MouseEvent e) { + public void mousePressed(final MouseEvent e) { prevMouseX = e.getX(); prevMouseY = e.getY(); } - public void mouseReleased(MouseEvent e) { + public void mouseReleased(final MouseEvent e) { } - public void mouseDragged(MouseEvent e) { - int x = e.getX(); - int y = e.getY(); + public void mouseDragged(final MouseEvent e) { + final int x = e.getX(); + final int y = e.getY(); int width=0, height=0; - Object source = e.getSource(); + final Object source = e.getSource(); if(source instanceof Window) { - Window window = (Window) source; + final Window window = (Window) source; width=window.getSurfaceWidth(); height=window.getSurfaceHeight(); } else if (source instanceof GLAutoDrawable) { - GLAutoDrawable glad = (GLAutoDrawable) source; + final GLAutoDrawable glad = (GLAutoDrawable) source; width = glad.getSurfaceWidth(); height = glad.getSurfaceHeight(); } else if (GLProfile.isAWTAvailable() && source instanceof java.awt.Component) { - java.awt.Component comp = (java.awt.Component) source; + final java.awt.Component comp = (java.awt.Component) source; width=comp.getWidth(); // FIXME HiDPI: May need to convert window units -> pixel units! height=comp.getHeight(); } else { throw new RuntimeException("Event source neither Window nor Component: "+source); } - float thetaY = 360.0f * ( (float)(x-prevMouseX)/(float)width); - float thetaX = 360.0f * ( (float)(prevMouseY-y)/(float)height); + final float thetaY = 360.0f * ( (float)(x-prevMouseX)/(float)width); + final float thetaX = 360.0f * ( (float)(prevMouseY-y)/(float)height); prevMouseX = x; prevMouseY = y; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsObjectES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsObjectES1.java index 777fb04ae..bd487eae2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsObjectES1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsObjectES1.java @@ -26,6 +26,7 @@ import javax.media.opengl.GL; import javax.media.opengl.GL2ES1; import javax.media.opengl.GLBufferStorage; import javax.media.opengl.GLException; +import javax.media.opengl.fixedfunc.GLLightingFunc; import javax.media.opengl.fixedfunc.GLPointerFunc; import com.jogamp.opengl.test.junit.jogl.demos.GearsObject; @@ -37,13 +38,13 @@ import com.jogamp.opengl.util.GLArrayDataServer; */ public class GearsObjectES1 extends GearsObject { - public GearsObjectES1(GL gl, boolean useMappedBuffers, FloatBuffer gearColor, float inner_radius, - float outer_radius, float width, int teeth, float tooth_depth, boolean validateBuffers) { + public GearsObjectES1(final GL gl, final boolean useMappedBuffers, final FloatBuffer gearColor, final float inner_radius, + final float outer_radius, final float width, final int teeth, final float tooth_depth, final boolean validateBuffers) { super(gl, useMappedBuffers, gearColor, inner_radius, outer_radius, width, teeth, tooth_depth, validateBuffers); } @Override - public GLArrayDataServer createInterleaved(boolean useMappedBuffers, int comps, int dataType, boolean normalized, int initialSize, int vboUsage) { + public GLArrayDataServer createInterleaved(final boolean useMappedBuffers, final int comps, final int dataType, final boolean normalized, final int initialSize, final int vboUsage) { if( useMappedBuffers ) { return GLArrayDataServer.createFixedInterleavedMapped(comps, dataType, normalized, initialSize, vboUsage); } else { @@ -52,12 +53,12 @@ public class GearsObjectES1 extends GearsObject { } @Override - public void addInterleavedVertexAndNormalArrays(GLArrayDataServer array, int components) { + public void addInterleavedVertexAndNormalArrays(final GLArrayDataServer array, final int components) { array.addFixedSubArray(GLPointerFunc.GL_VERTEX_ARRAY, components, GL.GL_ARRAY_BUFFER); array.addFixedSubArray(GLPointerFunc.GL_NORMAL_ARRAY, components, GL.GL_ARRAY_BUFFER); } - private void draw(GL2ES1 gl, GLArrayDataServer array, int mode) { + private void draw(final GL2ES1 gl, final GLArrayDataServer array, final int mode) { if( !isShared || gl.glIsBuffer(array.getVBOName()) ) { array.enableBuffer(gl, true); if( validateBuffers ) { @@ -80,20 +81,20 @@ public class GearsObjectES1 extends GearsObject { } @Override - public void draw(GL _gl, float x, float y, float angle) { - GL2ES1 gl = _gl.getGL2ES1(); + public void draw(final GL _gl, final float x, final float y, final float angle) { + final GL2ES1 gl = _gl.getGL2ES1(); gl.glPushMatrix(); gl.glTranslatef(x, y, 0f); gl.glRotatef(angle, 0f, 0f, 1f); - gl.glMaterialfv(GL2ES1.GL_FRONT_AND_BACK, GL2ES1.GL_AMBIENT_AND_DIFFUSE, gearColor); + gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GLLightingFunc.GL_AMBIENT_AND_DIFFUSE, gearColor); - gl.glShadeModel(GL2ES1.GL_FLAT); + gl.glShadeModel(GLLightingFunc.GL_FLAT); draw(gl, frontFace, GL.GL_TRIANGLE_STRIP); draw(gl, frontSide, GL.GL_TRIANGLES); draw(gl, backFace, GL.GL_TRIANGLE_STRIP); draw(gl, backSide, GL.GL_TRIANGLES); draw(gl, outwardFace, GL.GL_TRIANGLE_STRIP); - gl.glShadeModel(GL2ES1.GL_SMOOTH); + gl.glShadeModel(GLLightingFunc.GL_SMOOTH); draw(gl, insideRadiusCyl, GL.GL_TRIANGLE_STRIP); gl.glPopMatrix(); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/MultisampleDemoES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/MultisampleDemoES1.java index 4b4c7f2d8..681628a69 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/MultisampleDemoES1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/MultisampleDemoES1.java @@ -44,6 +44,7 @@ import javax.media.opengl.GL; import javax.media.opengl.GL2ES1; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.util.ImmModeSink; @@ -52,59 +53,59 @@ public class MultisampleDemoES1 implements GLEventListener { boolean multisample; ImmModeSink immModeSink; - public MultisampleDemoES1(boolean multisample) { + public MultisampleDemoES1(final boolean multisample) { this.multisample = multisample; } - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { System.err.println(); System.err.println("Requested: " + drawable.getNativeSurface().getGraphicsConfiguration().getRequestedCapabilities()); System.err.println(); System.err.println("Chosen : " + drawable.getChosenGLCapabilities()); System.err.println(); - GL2ES1 gl = drawable.getGL().getGL2ES1(); + final GL2ES1 gl = drawable.getGL().getGL2ES1(); if (multisample) { gl.glEnable(GL.GL_MULTISAMPLE); } gl.glClearColor(0, 0, 0, 0); // gl.glEnable(GL.GL_DEPTH_TEST); // gl.glDepthFunc(GL.GL_LESS); - gl.glMatrixMode(GL2ES1.GL_MODELVIEW); + gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); - gl.glMatrixMode(GL2ES1.GL_PROJECTION); + gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); gl.glOrtho(-1, 1, -1, 1, -1, 1); if (multisample) { gl.glDisable(GL.GL_MULTISAMPLE); } - immModeSink = ImmModeSink.createFixed(40, + immModeSink = ImmModeSink.createFixed(40, 3, GL.GL_FLOAT, // vertex 0, GL.GL_FLOAT, // color 0, GL.GL_FLOAT, // normal - 0, GL.GL_FLOAT, // texCoords + 0, GL.GL_FLOAT, // texCoords GL.GL_STATIC_DRAW); final int numSteps = 20; final double increment = Math.PI / numSteps; final double radius = 1; immModeSink.glBegin(GL.GL_LINES); for (int i = numSteps - 1; i >= 0; i--) { - immModeSink.glVertex3f((float) (radius * Math.cos(i * increment)), - (float) (radius * Math.sin(i * increment)), + immModeSink.glVertex3f((float) (radius * Math.cos(i * increment)), + (float) (radius * Math.sin(i * increment)), 0f); - immModeSink.glVertex3f((float) (-1.0 * radius * Math.cos(i * increment)), - (float) (-1.0 * radius * Math.sin(i * increment)), + immModeSink.glVertex3f((float) (-1.0 * radius * Math.cos(i * increment)), + (float) (-1.0 * radius * Math.sin(i * increment)), 0f); } immModeSink.glEnd(gl, false); } - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { immModeSink.destroy(drawable.getGL()); immModeSink = null; } - public void display(GLAutoDrawable drawable) { - GL2ES1 gl = drawable.getGL().getGL2ES1(); + public void display(final GLAutoDrawable drawable) { + final GL2ES1 gl = drawable.getGL().getGL2ES1(); if (multisample) { gl.glEnable(GL.GL_MULTISAMPLE); } @@ -116,9 +117,9 @@ public class MultisampleDemoES1 implements GLEventListener { } // Unused routines - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } - public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) { + public void displayChanged(final GLAutoDrawable drawable, final boolean modeChanged, final boolean deviceChanged) { } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OlympicES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OlympicES1.java index 3395ca51f..eae4d41e3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OlympicES1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OlympicES1.java @@ -10,6 +10,8 @@ import javax.media.opengl.GL2ES2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLPipelineFactory; +import javax.media.opengl.fixedfunc.GLLightingFunc; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import javax.media.opengl.glu.GLU; import javax.media.opengl.glu.gl2es1.GLUgl2es1; @@ -78,18 +80,18 @@ public class OlympicES1 implements GLEventListener swapInterval = 1; } - public OlympicES1(int swapInterval) { + public OlympicES1(final int swapInterval) { this.swapInterval = swapInterval; } - public void setForceFFPEmu(boolean forceFFPEmu, boolean verboseFFPEmu, boolean debugFFPEmu, boolean traceFFPEmu) { + public void setForceFFPEmu(final boolean forceFFPEmu, final boolean verboseFFPEmu, final boolean debugFFPEmu, final boolean traceFFPEmu) { this.forceFFPEmu = forceFFPEmu; this.verboseFFPEmu = verboseFFPEmu; this.debugFFPEmu = debugFFPEmu; this.traceFFPEmu = traceFFPEmu; } - public void init(GLAutoDrawable drawable) + public void init(final GLAutoDrawable drawable) { GL _gl = drawable.getGL(); @@ -109,13 +111,13 @@ public class OlympicES1 implements GLEventListener try { // Debug .. gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES1.class, gl, null) ); - } catch (Exception e) {e.printStackTrace();} + } catch (final Exception e) {e.printStackTrace();} } if(trace) { try { // Trace .. gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES1.class, gl, new Object[] { System.err } ) ); - } catch (Exception e) {e.printStackTrace();} + } catch (final Exception e) {e.printStackTrace();} } System.err.println("OlympicES1 init on "+Thread.currentThread()); @@ -129,7 +131,7 @@ public class OlympicES1 implements GLEventListener System.err.println("GL Profile: "+gl.getGLProfile()); System.err.println("GL:" + gl + ", " + gl.getContext().getGLVersion()); - glu = GLUgl2es1.createGLU(gl); + glu = GLU.createGLU(gl); System.err.println("GLU:" + glu.getClass().getName()); rgb_colors=new byte[RINGS][3]; @@ -141,11 +143,11 @@ public class OlympicES1 implements GLEventListener iters=new int[RINGS]; int i; - float top_y = 1.0f; - float bottom_y = 0.0f; - float top_z = 0.15f; - float bottom_z = 0.69f; - float spacing = 2.5f; + final float top_y = 1.0f; + final float bottom_y = 0.0f; + final float top_z = 0.15f; + final float bottom_z = 0.69f; + final float spacing = 2.5f; for (i = 0; i < RINGS; i++) { rgb_colors[i][0] = rgb_colors[i][1] = rgb_colors[i][2] = (byte)0; @@ -194,27 +196,27 @@ public class OlympicES1 implements GLEventListener gl.glEnable(GL.GL_DEPTH_TEST); gl.glClearDepth(1.0); - gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_AMBIENT, light0_ambient, 0); - gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_DIFFUSE, light0_diffuse, 0); - gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_SPECULAR, light0_specular, 0); - gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_POSITION, light0_position, 0); - gl.glEnable(GL2ES1.GL_LIGHT0); + gl.glLightfv(GLLightingFunc.GL_LIGHT0, GLLightingFunc.GL_AMBIENT, light0_ambient, 0); + gl.glLightfv(GLLightingFunc.GL_LIGHT0, GLLightingFunc.GL_DIFFUSE, light0_diffuse, 0); + gl.glLightfv(GLLightingFunc.GL_LIGHT0, GLLightingFunc.GL_SPECULAR, light0_specular, 0); + gl.glLightfv(GLLightingFunc.GL_LIGHT0, GLLightingFunc.GL_POSITION, light0_position, 0); + gl.glEnable(GLLightingFunc.GL_LIGHT0); // gl.glLightModelfv(GL2.GL_LIGHT_MODEL_LOCAL_VIEWER, lmodel_local, 0); gl.glLightModelfv(GL2ES1.GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside, 0); gl.glLightModelfv(GL2ES1.GL_LIGHT_MODEL_AMBIENT, lmodel_ambient, 0); - gl.glEnable(GL2ES1.GL_LIGHTING); + gl.glEnable(GLLightingFunc.GL_LIGHTING); gl.glClearColor(0.5f, 0.5f, 0.5f, 0.0f); - gl.glMaterialfv(GL.GL_FRONT, GL2ES1.GL_AMBIENT, bevel_mat_ambient, 0); - gl.glMaterialfv(GL.GL_FRONT, GL2ES1.GL_SHININESS, bevel_mat_shininess, 0); - gl.glMaterialfv(GL.GL_FRONT, GL2ES1.GL_SPECULAR, bevel_mat_specular, 0); - gl.glMaterialfv(GL.GL_FRONT, GL2ES1.GL_DIFFUSE, bevel_mat_diffuse, 0); + gl.glMaterialfv(GL.GL_FRONT, GLLightingFunc.GL_AMBIENT, bevel_mat_ambient, 0); + gl.glMaterialfv(GL.GL_FRONT, GLLightingFunc.GL_SHININESS, bevel_mat_shininess, 0); + gl.glMaterialfv(GL.GL_FRONT, GLLightingFunc.GL_SPECULAR, bevel_mat_specular, 0); + gl.glMaterialfv(GL.GL_FRONT, GLLightingFunc.GL_DIFFUSE, bevel_mat_diffuse, 0); // gl.glColorMaterial(GL.GL_FRONT_AND_BACK, GL2ES1.GL_DIFFUSE); - gl.glEnable(GL2ES1.GL_COLOR_MATERIAL); - gl.glShadeModel(GL2ES1.GL_SMOOTH); + gl.glEnable(GLLightingFunc.GL_COLOR_MATERIAL); + gl.glShadeModel(GLLightingFunc.GL_SMOOTH); ReInit(); t0 = System.currentTimeMillis(); @@ -223,7 +225,7 @@ public class OlympicES1 implements GLEventListener @Override - public void dispose(GLAutoDrawable glad) { + public void dispose(final GLAutoDrawable glad) { glu = null; theTorus.destroy(glad.getGL()); theTorus = null; @@ -231,20 +233,20 @@ public class OlympicES1 implements GLEventListener @Override - public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable glad, final int x, final int y, final int width, final int height) { final GL2ES1 gl = glad.getGL().getGL2ES1(); gl.setSwapInterval(swapInterval); - gl.glMatrixMode(GL2ES1.GL_PROJECTION); + gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); glu.gluPerspective(45f, (float) width / (float) height, 0.1f, 100.0f); - gl.glMatrixMode(GL2ES1.GL_MODELVIEW); + gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); glu.gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0); } @Override - public void display(GLAutoDrawable glad) { + public void display(final GLAutoDrawable glad) { final GL2ES1 gl = glad.getGL().getGL2ES1(); int i; @@ -271,7 +273,7 @@ public class OlympicES1 implements GLEventListener { int i, j; - long t1 = System.currentTimeMillis(); + final long t1 = System.currentTimeMillis(); if( t1 - tL < 50 ) { return; } @@ -311,7 +313,7 @@ public class OlympicES1 implements GLEventListener } } - protected static void FillTorus(GL gl, ImmModeSink immModeSink, float rc, int numc, float rt, int numt) + protected static void FillTorus(final GL gl, final ImmModeSink immModeSink, final float rc, final int numc, final float rt, final int numt) { int i, j, k; double s, t; @@ -339,7 +341,7 @@ public class OlympicES1 implements GLEventListener } } - protected float Clamp(int iters_left, float t) + protected float Clamp(final int iters_left, final float t) { if (iters_left < 3) { return 0.0f; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OneTriangle.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OneTriangle.java index 4b05f1a42..80f58d74a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OneTriangle.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/OneTriangle.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -30,6 +30,7 @@ package com.jogamp.opengl.test.junit.jogl.demos.es1; import javax.media.opengl.GL; import javax.media.opengl.GL2ES1; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import javax.media.opengl.glu.GLU; import javax.media.opengl.glu.gl2es1.GLUgl2es1; @@ -41,31 +42,31 @@ import com.jogamp.opengl.util.ImmModeSink; */ public class OneTriangle { - public static void setup( GL2ES1 gl, int width, int height ) { - gl.glMatrixMode( GL2ES1.GL_PROJECTION ); + public static void setup( final GL2ES1 gl, final int width, final int height ) { + gl.glMatrixMode( GLMatrixFunc.GL_PROJECTION ); gl.glLoadIdentity(); // coordinate system origin at lower left with width and height same as the window - GLU glu = new GLUgl2es1(); + final GLU glu = new GLUgl2es1(); glu.gluOrtho2D( 0.0f, width, 0.0f, height ); - gl.glMatrixMode( GL2ES1.GL_MODELVIEW ); + gl.glMatrixMode( GLMatrixFunc.GL_MODELVIEW ); gl.glLoadIdentity(); - gl.glViewport( 0, 0, width, height ); + gl.glViewport( 0, 0, width, height ); } - public static void render( GL2ES1 gl, int width, int height) { + public static void render( final GL2ES1 gl, final int width, final int height) { gl.glClear( GL.GL_COLOR_BUFFER_BIT ); // draw a triangle filling the window gl.glLoadIdentity(); - - ImmModeSink immModeSink = ImmModeSink.createFixed(3*3, + + final ImmModeSink immModeSink = ImmModeSink.createFixed(3*3, 3, GL.GL_FLOAT, // vertex 3, GL.GL_FLOAT, // color 0, GL.GL_FLOAT, // normal - 0, GL.GL_FLOAT, // texCoords + 0, GL.GL_FLOAT, // texCoords GL.GL_STATIC_DRAW); immModeSink.glBegin(GL.GL_TRIANGLES); immModeSink.glColor3f( 1, 0, 0 ); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/PointsDemoES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/PointsDemoES1.java index 5f0c99a3d..3aced12ed 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/PointsDemoES1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/PointsDemoES1.java @@ -41,6 +41,8 @@ import javax.media.opengl.GL2ES1; import javax.media.opengl.GL2ES2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLPipelineFactory; +import javax.media.opengl.fixedfunc.GLMatrixFunc; +import javax.media.opengl.fixedfunc.GLPointerFunc; import javax.media.opengl.glu.GLU; import javax.media.opengl.glu.gl2es1.GLUgl2es1; @@ -58,24 +60,24 @@ public class PointsDemoES1 extends PointsDemo { final int edge = 8; // 8*8 boolean smooth = false; - public PointsDemoES1(int swapInterval) { + public PointsDemoES1(final int swapInterval) { this.swapInterval = swapInterval; } public PointsDemoES1() { this.swapInterval = 1; } - - public void setForceFFPEmu(boolean forceFFPEmu, boolean verboseFFPEmu, boolean debugFFPEmu, boolean traceFFPEmu) { + + public void setForceFFPEmu(final boolean forceFFPEmu, final boolean verboseFFPEmu, final boolean debugFFPEmu, final boolean traceFFPEmu) { this.forceFFPEmu = forceFFPEmu; this.verboseFFPEmu = verboseFFPEmu; this.debugFFPEmu = debugFFPEmu; this.traceFFPEmu = traceFFPEmu; } - - public void setSmoothPoints(boolean v) { smooth = v; } - - public void init(GLAutoDrawable glad) { + + public void setSmoothPoints(final boolean v) { smooth = v; } + + public void init(final GLAutoDrawable glad) { GL _gl = glad.getGL(); if(debugFFPEmu) { @@ -89,27 +91,27 @@ public class PointsDemoES1 extends PointsDemo { trace = false; } GL2ES1 gl = FixedFuncUtil.wrapFixedFuncEmul(_gl, ShaderSelectionMode.AUTO, null, forceFFPEmu, verboseFFPEmu); - + if(debug) { try { // Debug .. gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES1.class, gl, null) ); - } catch (Exception e) {e.printStackTrace();} + } catch (final Exception e) {e.printStackTrace();} } if(trace) { try { // Trace .. gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES1.class, gl, new Object[] { System.err } ) ); - } catch (Exception e) {e.printStackTrace();} - } - + } catch (final Exception e) {e.printStackTrace();} + } + System.err.println("GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR)); System.err.println("GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER)); System.err.println("GL_VERSION: " + gl.glGetString(GL.GL_VERSION)); System.err.println("GL Profile: "+gl.getGLProfile()); - + // Allocate Vertex Array - vertices = GLArrayDataServer.createFixed(GL2ES1.GL_VERTEX_ARRAY, 3, GL.GL_FLOAT, false, edge*edge, GL.GL_STATIC_DRAW); + vertices = GLArrayDataServer.createFixed(GLPointerFunc.GL_VERTEX_ARRAY, 3, GL.GL_FLOAT, false, edge*edge, GL.GL_STATIC_DRAW); pointSizes = new float[edge*edge]; for(int i=0; i=0; i--) { gl.glPointSize(pointSizes[i]); - gl.glDrawArrays(GL.GL_POINTS, i, 1); - } - + gl.glDrawArrays(GL.GL_POINTS, i, 1); + } + vertices.enableBuffer(gl, false); } - public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable glad, final int x, final int y, final int width, final int height) { // Thread.dumpStack(); - GL2ES1 gl = glad.getGL().getGL2ES1(); - - if(-1 != swapInterval) { + final GL2ES1 gl = glad.getGL().getGL2ES1(); + + if(-1 != swapInterval) { gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there) } - + // Set location in front of camera - gl.glMatrixMode(PMVMatrix.GL_PROJECTION); + gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); glu.gluPerspective(45.0F, ( (float) width / (float) height ) / 1.0f, 1.0F, 100.0F); //gl.glOrthof(-4.0f, 4.0f, -4.0f, 4.0f, 1.0f, 100.0f); } - public void dispose(GLAutoDrawable glad) { - GL2ES1 gl = glad.getGL().getGL2ES1(); + public void dispose(final GLAutoDrawable glad) { + final GL2ES1 gl = glad.getGL().getGL2ES1(); vertices.destroy(gl); vertices = null; - } + } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java index 5891bce0d..1f81261b8 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java @@ -32,7 +32,7 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende long startTime = 0; long curTime = 0; - public RedSquareES1(int swapInterval) { + public RedSquareES1(final int swapInterval) { this.swapInterval = swapInterval; } @@ -41,33 +41,33 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende } @Override - public void addTileRendererNotify(TileRendererBase tr) { + public void addTileRendererNotify(final TileRendererBase tr) { tileRendererInUse = tr; doRotateBeforePrinting = doRotate; setDoRotation(false); } @Override - public void removeTileRendererNotify(TileRendererBase tr) { + public void removeTileRendererNotify(final TileRendererBase tr) { tileRendererInUse = null; setDoRotation(doRotateBeforePrinting); } @Override - public void startTileRendering(TileRendererBase tr) { + public void startTileRendering(final TileRendererBase tr) { System.err.println("RedSquareES1.startTileRendering: "+tr); } @Override - public void endTileRendering(TileRendererBase tr) { + public void endTileRendering(final TileRendererBase tr) { System.err.println("RedSquareES1.endTileRendering: "+tr); } - public void setDoRotation(boolean rotate) { this.doRotate = rotate; } - public void setForceFFPEmu(boolean forceFFPEmu, boolean verboseFFPEmu, boolean debugFFPEmu, boolean traceFFPEmu) { + public void setDoRotation(final boolean rotate) { this.doRotate = rotate; } + public void setForceFFPEmu(final boolean forceFFPEmu, final boolean verboseFFPEmu, final boolean debugFFPEmu, final boolean traceFFPEmu) { this.forceFFPEmu = forceFFPEmu; this.verboseFFPEmu = verboseFFPEmu; this.debugFFPEmu = debugFFPEmu; this.traceFFPEmu = traceFFPEmu; } - public void setFlipVerticalInGLOrientation(boolean v) { flipVerticalInGLOrientation=v; } + public void setFlipVerticalInGLOrientation(final boolean v) { flipVerticalInGLOrientation=v; } // FIXME: we must add storage of the pointers in the GL state to // the GLImpl classes. The need for this can be seen by making @@ -80,7 +80,7 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende private FloatBuffer vertices; @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { System.err.println(Thread.currentThread()+" RedSquareES1.init ..."); GL _gl = drawable.getGL(); @@ -100,13 +100,13 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende try { // Debug .. gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", GL2ES1.class, gl, null) ); - } catch (Exception e) {e.printStackTrace();} + } catch (final Exception e) {e.printStackTrace();} } if(trace) { try { // Trace .. gl = (GL2ES1) gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES1.class, gl, new Object[] { System.err } ) ); - } catch (Exception e) {e.printStackTrace();} + } catch (final Exception e) {e.printStackTrace();} } System.err.println("RedSquareES1 init on "+Thread.currentThread()); @@ -139,7 +139,7 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende } @Override - public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable glad, final int x, final int y, final int width, final int height) { final GL2ES1 gl = glad.getGL().getGL2ES1(); if(-1 != swapInterval) { gl.setSwapInterval(swapInterval); @@ -148,15 +148,15 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende } @Override - public void reshapeTile(TileRendererBase tr, - int tileX, int tileY, int tileWidth, int tileHeight, - int imageWidth, int imageHeight) { + public void reshapeTile(final TileRendererBase tr, + final int tileX, final int tileY, final int tileWidth, final int tileHeight, + final int imageWidth, final int imageHeight) { final GL2ES1 gl = tr.getAttachedDrawable().getGL().getGL2ES1(); gl.setSwapInterval(0); reshapeImpl(gl, tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight); } - void reshapeImpl(GL2ES1 gl, int tileX, int tileY, int tileWidth, int tileHeight, int imageWidth, int imageHeight) { + void reshapeImpl(final GL2ES1 gl, final int tileX, final int tileY, final int tileWidth, final int tileHeight, final int imageWidth, final int imageHeight) { System.err.println(Thread.currentThread()+" RedSquareES1.reshape "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", tileRendererInUse "+tileRendererInUse); // Set location in front of camera @@ -196,9 +196,9 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { curTime = System.currentTimeMillis(); - GL2ES1 gl = drawable.getGL().getGL2ES1(); + final GL2ES1 gl = drawable.getGL().getGL2ES1(); if( null != tileRendererInUse ) { gl.glClearColor(1.0f, 1.0f, 1.0f, 0.0f); } else { @@ -210,7 +210,7 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); gl.glTranslatef(0, 0, -10); - float ang = doRotate ? ((curTime - startTime) * 360.0f) / 4000.0f : 1f; + final float ang = doRotate ? ((curTime - startTime) * 360.0f) / 4000.0f : 1f; gl.glRotatef(ang, 0, 0, 1); gl.glRotatef(ang, 0, 1, 0); @@ -223,9 +223,9 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { System.err.println(Thread.currentThread()+" RedSquareES1.dispose ... "); - GL2ES1 gl = drawable.getGL().getGL2ES1(); + final GL2ES1 gl = drawable.getGL().getGL2ES1(); gl.glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY); gl.glDisableClientState(GLPointerFunc.GL_COLOR_ARRAY); colors.clear(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestGearsES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestGearsES1NEWT.java index 8abb0cc0e..a093cc07f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestGearsES1NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestGearsES1NEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.demos.es1.newt; import com.jogamp.newt.event.KeyAdapter; @@ -66,8 +66,8 @@ public class TestGearsES1NEWT extends UITestCase { public static void releaseClass() { } - protected void runTestGL(GLCapabilities caps, boolean forceFFPEmu) throws InterruptedException { - GLWindow glWindow = GLWindow.create(caps); + protected void runTestGL(final GLCapabilities caps, final boolean forceFFPEmu) throws InterruptedException { + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setTitle("Gears NEWT Test"); @@ -77,8 +77,8 @@ public class TestGearsES1NEWT extends UITestCase { final SnapshotGLEventListener snap = new SnapshotGLEventListener(); glWindow.addGLEventListener(snap); - Animator animator = new Animator(glWindow); - QuitAdapter quitAdapter = new QuitAdapter(); + final Animator animator = new Animator(glWindow); + final QuitAdapter quitAdapter = new QuitAdapter(); //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter)); //glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter)); @@ -87,10 +87,10 @@ public class TestGearsES1NEWT extends UITestCase { final GLWindow f_glWindow = glWindow; glWindow.addKeyListener(new KeyAdapter() { - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { if( !e.isPrintableKey() || e.isAutoRepeat() ) { return; - } + } if(e.getKeyChar()=='f') { new Thread() { public void run() { @@ -121,19 +121,19 @@ public class TestGearsES1NEWT extends UITestCase { @Test public void test00() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(forceES2 ? GLProfile.get(GLProfile.GLES2) : GLProfile.getGL2ES1()); + final GLCapabilities caps = new GLCapabilities(forceES2 ? GLProfile.get(GLProfile.GLES2) : GLProfile.getGL2ES1()); runTestGL(caps, forceFFPEmu); } - + static long duration = 500; // ms - - public static void main(String args[]) { + + public static void main(final String args[]) { for(int i=0; i * __ __|_ ___________________________________________________________________________ ___|__ __ - * // /\ _ /\ \\ - * //____/ \__ __ _____ _____ _____ _____ _____ | | __ _____ _____ __ __/ \____\\ - * \ \ / / __| | | __| _ | | _ | | | __| | | __| | /\ \ / / - * \____\/_/ | | | | | | | | | | | __| | | | | | | | | | |__ " \_\/____/ - * /\ \ |_____|_____|_____|__|__|_|_|_|__| | | |_____|_____|_____|_____| _ / /\ - * / \____\ http://jogamp.org |_| /____/ \ - * \ / "' _________________________________________________________________________ `" \ / + * // /\ _ /\ \\ + * //____/ \__ __ _____ _____ _____ _____ _____ | | __ _____ _____ __ __/ \____\\ + * \ \ / / __| | | __| _ | | _ | | | __| | | __| | /\ \ / / + * \____\/_/ | | | | | | | | | | | __| | | | | | | | | | |__ " \_\/____/ + * /\ \ |_____|_____|_____|__|__|_|_|_|__| | | |_____|_____|_____|_____| _ / /\ + * / \____\ http://jogamp.org |_| /____/ \ + * \ / "' _________________________________________________________________________ `" \ / * \/____. .____\/ - *
    + * * *

    - * JOGL2 port of my PC 4k intro competition entry for Revision 2011. Sure it got a little bigger + * JOGL2 port of my PC 4k intro competition entry for Revision 2011. Sure it got a little bigger * while porting but the shader and control code remained more or less untouched. The intro renders - * a fullscreen billboard using a single fragment shader. The shader encapsulates basically two + * a fullscreen billboard using a single fragment shader. The shader encapsulates basically two * different routines: A sphere-tracing based raymarcher for a single fractal formula and a bitmap * orbit trap julia+mandelbrot fractal renderer. Additionally an inline-processing analog-distortion * filter is applied to all rendered fragments to make the overall look more interesting. *

    * *

    - * The different intro parts are all parameter variations of the two routines in the fragment shader + * The different intro parts are all parameter variations of the two routines in the fragment shader * synched to the music: Parts 3+5 are obviously the mandelbrot and julia bitmap orbit traps, and parts * 1,2,4 and 6 are pure fractal sphere tracing. *

    * *

    * During the development of the intro it turned out that perfectly raymarching every pixel of the orbit - * trapped julia+mandelbrot fractal was way to slow even on highend hardware. So I inserted a lowres + * trapped julia+mandelbrot fractal was way to slow even on highend hardware. So I inserted a lowres * intermediate FBO to be used by the bitmap based orbit trap routine wich was ofcourse way faster, but - * had the obvious upscaling artefacts. Maybe I'll produce a perfect quality version for very patient + * had the obvious upscaling artefacts. Maybe I'll produce a perfect quality version for very patient * people with insane hardware :) *

    * @@ -119,21 +120,21 @@ public class ElektronenMultiplizierer implements GLEventListener { //BEGIN --- BaseGlobalEnvironment replacement --- - private final GLCapabilities mCaps; + private final GLCapabilities mCaps; // private final GLU mGlu; - private String mCommandLineParameter_BaseRoutineClassName; - private boolean mCommandLineParameter_MultiSampling; - private int mCommandLineParameter_NumberOfSampleBuffers; - private boolean mCommandLineParameter_AnisotropicFiltering; - private float mCommandLineParameter_AnisotropyLevel; - private boolean mCommandLineParameter_FrameCapture; - private boolean mCommandLineParameter_FrameSkip; + private final String mCommandLineParameter_BaseRoutineClassName; + private final boolean mCommandLineParameter_MultiSampling; + private final int mCommandLineParameter_NumberOfSampleBuffers; + private final boolean mCommandLineParameter_AnisotropicFiltering; + private final float mCommandLineParameter_AnisotropyLevel; + private final boolean mCommandLineParameter_FrameCapture; + private final boolean mCommandLineParameter_FrameSkip; private boolean mUsesFullScreenMode; private int mFrameCounter; - private int mCommandLineParameter_FrameRate; + private final int mCommandLineParameter_FrameRate; private long mFrameSkipAverageFramerateTimeStart; - private long mFrameSkipAverageFramerateTimeEnd; + private long mFrameSkipAverageFramerateTimeEnd; private boolean mFrameSkipManual; // private int mSkippedFramesCounter; // private BaseMusic mBaseMusic; @@ -145,7 +146,7 @@ public class ElektronenMultiplizierer implements GLEventListener { private GLUniformData mScreenDimensionUniform; private GLArrayDataServer vertices0; // private GLArrayDataServer texCoords0; - + public String getBaseRoutineClassName() { return mCommandLineParameter_BaseRoutineClassName; } public boolean preferMultiSampling() { return mCommandLineParameter_MultiSampling; } public int getNumberOfSamplingBuffers() { return mCommandLineParameter_NumberOfSampleBuffers; } @@ -157,24 +158,24 @@ public class ElektronenMultiplizierer implements GLEventListener { public boolean usesFullScreenMode() { return mUsesFullScreenMode; } class TimeShiftKeys extends KeyAdapter { - public void keyPressed(KeyEvent e) { + public void keyPressed(final KeyEvent e) { if(KeyEvent.VK_RIGHT == e.getKeyCode()) { skipFrames(120); } else if(KeyEvent.VK_LEFT == e.getKeyCode()) { skipFrames(-120); - } - } + } + } } TimeShiftKeys timeShiftKeys; - + public ElektronenMultiplizierer ( - String inBaseRoutineClassName, - boolean inMultiSampling, - int inNumberOfSampleBuffers, - boolean inAnisotropicFiltering, - float inAnisotropyLevel, - boolean inFrameCapture, - boolean inFrameSkip, int desiredFrameRate, int startFrame + final String inBaseRoutineClassName, + final boolean inMultiSampling, + final int inNumberOfSampleBuffers, + final boolean inAnisotropicFiltering, + final float inAnisotropyLevel, + final boolean inFrameCapture, + final boolean inFrameSkip, final int desiredFrameRate, final int startFrame ) { // mGlu = new GLU(); mCommandLineParameter_BaseRoutineClassName = inBaseRoutineClassName; @@ -195,42 +196,42 @@ public class ElektronenMultiplizierer implements GLEventListener { mCaps.setAccumGreenBits(1); mCaps.setAccumRedBits(1); // turns out we need to have alpha, otherwise no AA will be visible - mCaps.setAlphaBits(1); + mCaps.setAlphaBits(1); } - + mFrameSkipAverageFramerateTimeStart = 0; - mFrameCounter = 0; + mFrameCounter = 0; skipFrames(startFrame); timeShiftKeys = new TimeShiftKeys(); } - + public ElektronenMultiplizierer() { - this(null, false, -1, false, -1.0f, false, true, 30, 0); + this(null, false, -1, false, -1.0f, false, true, 30, 0); } - + /** * skip frames by turning back start time - * @param frames positive or negative values + * @param frames positive or negative values */ - public void skipFrames(int frames) { + public void skipFrames(final int frames) { final long dft = 1000000000/mCommandLineParameter_FrameRate; mFrameSkipAverageFramerateTimeStart -= frames * dft ; mFrameSkipManual = true; } - + public GLCapabilitiesImmutable getGLCapabilities() { return mCaps; } - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { if(drawable instanceof GLWindow) { final GLWindow glw = (GLWindow) drawable; glw.addKeyListener(0, timeShiftKeys); } - GL2ES2 gl = drawable.getGL().getGL2ES2(); + final GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.setSwapInterval(1); - st = new ShaderState(); + st = new ShaderState(); final ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(), "shader", "shader/bin", "default", true); final ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(), "shader", @@ -238,48 +239,48 @@ public class ElektronenMultiplizierer implements GLEventListener { // "shader", "shader/bin", "elektronenmultiplizierer_port", true); vp0.defaultShaderCustomization(gl, true, true); fp0.defaultShaderCustomization(gl, true, true); - + final ShaderProgram sp0 = new ShaderProgram(); sp0.add(gl, vp0, System.err); - sp0.add(gl, fp0, System.err); + sp0.add(gl, fp0, System.err); st.attachShaderProgram(gl, sp0, true); - - final float XRESf = (float) drawable.getSurfaceWidth(); - final float YRESf = (float) drawable.getSurfaceHeight(); + + final float XRESf = drawable.getSurfaceWidth(); + final float YRESf = drawable.getSurfaceHeight(); mScreenDimensionUniform = new GLUniformData("resolution", 2, Buffers.newDirectFloatBuffer(2)); final FloatBuffer mScreenDimensionV = (FloatBuffer) mScreenDimensionUniform.getBuffer(); mScreenDimensionV.put(0, XRESf); mScreenDimensionV.put(1, YRESf); - st.ownUniform(mScreenDimensionUniform); - st.uniform(gl, mScreenDimensionUniform); - + st.ownUniform(mScreenDimensionUniform); + st.uniform(gl, mScreenDimensionUniform); + pmvMatrix = new PMVMatrix(); pmvMatrixUniform = new GLUniformData("gcu_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); st.ownUniform(pmvMatrixUniform); st.uniform(gl, pmvMatrixUniform); - + vertices0 = GLArrayDataServer.createGLSL("gca_Vertices", 2, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); vertices0.putf(0); vertices0.putf(YRESf); vertices0.putf(XRESf); vertices0.putf(YRESf); vertices0.putf(0); vertices0.putf(0); vertices0.putf(XRESf); vertices0.putf(0); - vertices0.seal(gl, true); + vertices0.seal(gl, true); st.ownAttribute(vertices0, true); vertices0.enableBuffer(gl, false); - + /** texCoords0 = GLArrayDataServer.createGLSL("gca_TexCoords", 2, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); texCoords0.putf(0f); texCoords0.putf(1f); texCoords0.putf(1f); texCoords0.putf(1f); - texCoords0.putf(0f); texCoords0.putf(0f); + texCoords0.putf(0f); texCoords0.putf(0f); texCoords0.putf(1f); texCoords0.putf(0f); texCoords0.seal(gl, true); st.ownAttribute(texCoords0, true); texCoords0.enableBuffer(gl, false); */ //generate framebufferobject - int[] result = new int[1]; + final int[] result = new int[1]; gl.glGenTextures(1, result, 0); mFrameBufferTextureID = result[0]; gl.glBindTexture(GL_TEXTURE_2D, mFrameBufferTextureID); @@ -308,20 +309,20 @@ public class ElektronenMultiplizierer implements GLEventListener { // if NO music is used sync to mainloop start ... // (add up current time due to possible turned back start time by skip frames) mFrameSkipAverageFramerateTimeStart += System.nanoTime(); - + // mBaseMusic = new BaseMusic(BaseGlobalEnvironment.getInstance().getMusicFileName()); // mBaseMusic.init(); // mBaseMusic.play(); } - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { if (wantsFrameSkip()) { mFrameSkipAverageFramerateTimeEnd = System.nanoTime(); - double tDesiredFrameRate = (float)getDesiredFramerate(); - double tSingleFrameTime = 1000000000.0f/tDesiredFrameRate; - double tElapsedTime = mFrameSkipAverageFramerateTimeEnd - mFrameSkipAverageFramerateTimeStart; - double mFrameCounterTargetValue = tElapsedTime/tSingleFrameTime; - double mFrameCounterDifference = mFrameCounterTargetValue-mFrameCounter; + final double tDesiredFrameRate = getDesiredFramerate(); + final double tSingleFrameTime = 1000000000.0f/tDesiredFrameRate; + final double tElapsedTime = mFrameSkipAverageFramerateTimeEnd - mFrameSkipAverageFramerateTimeStart; + final double mFrameCounterTargetValue = tElapsedTime/tSingleFrameTime; + final double mFrameCounterDifference = mFrameCounterTargetValue-mFrameCounter; if (mFrameSkipManual || mFrameCounterDifference>2) { mFrameCounter+=mFrameCounterDifference; // mSkippedFramesCounter+=mFrameCounterDifference; @@ -331,9 +332,9 @@ public class ElektronenMultiplizierer implements GLEventListener { } mFrameSkipManual = false; } - - GL2ES2 gl = drawable.getGL().getGL2ES2(); - + + final GL2ES2 gl = drawable.getGL().getGL2ES2(); + final int XRES = drawable.getSurfaceWidth(); final int YRES = drawable.getSurfaceHeight(); @@ -349,7 +350,7 @@ public class ElektronenMultiplizierer implements GLEventListener { // mBaseMusic.synchonizeMusic(); //use this for offline rendering/capture ... - int MMTime_u_ms = (int)((((float)mFrameCounter)*44100.0f)/60.0f); + int MMTime_u_ms = (int)(((mFrameCounter)*44100.0f)/60.0f); //use this for music synched rendering ... //int MMTime_u_ms = (int)(BaseRoutineRuntime.getInstance().getBaseMusic().getPositionInMilliseconds()*(44100.0f/1000.0f)); //dedicated sync variable for each event ... kinda lame but who cares X-) @@ -362,7 +363,7 @@ public class ElektronenMultiplizierer implements GLEventListener { if (MMTime_u_ms>=4438408 && !mSyncEvent_07) { mSyncEvent_07 = true; handleSyncEvent(MMTime_u_ms); } if (MMTime_u_ms>=5482831 && !mSyncEvent_08) { mSyncEvent_08 = true; handleSyncEvent(MMTime_u_ms); } //calculate current time based on 60fps reference framerate ... - MMTime_u_ms = (int)((((float)mFrameCounter)*44100.0f)/60.0f); + MMTime_u_ms = (int)(((mFrameCounter)*44100.0f)/60.0f); gl.glDisable(GL_CULL_FACE); gl.glDisable(GL_DEPTH_TEST); @@ -371,13 +372,13 @@ public class ElektronenMultiplizierer implements GLEventListener { vertices0.enableBuffer(gl, true); // texCoords0.enableBuffer(gl, true); - pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); pmvMatrix.glOrthof(0f, XRES, YRES, 0f, -1f, 1f); - pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); st.uniform(gl, pmvMatrixUniform); - + gl.glActiveTexture(GL_TEXTURE0); //gogogo! O-) @@ -385,8 +386,8 @@ public class ElektronenMultiplizierer implements GLEventListener { if (tBrightnessSync<1) { tBrightnessSync=1; } - mEffectTime = (float)((MMTime_u_ms-mEffectSyncTime)/100000.0f); - + mEffectTime = (MMTime_u_ms-mEffectSyncTime)/100000.0f; + if (mSyncEventNumber==0 && mEffectTime<4.0f) { //fadein and fullscreen rotate tBrightnessSync = mEffectTime/4.0f; @@ -394,12 +395,12 @@ public class ElektronenMultiplizierer implements GLEventListener { //fullscrenn mushroom transform tBrightnessSync = 1.0f-((mEffectTime-12.0f)/3.5f); } - + if (mSyncEventNumber==0 || mSyncEventNumber==1) { //zoomin from fog mEffectNumber = 3; mEffectTime *= 1.75; - float tEffectTimeMax = 9.3f; + final float tEffectTimeMax = 9.3f; if (mEffectTime>=tEffectTimeMax) { mEffectTime=tEffectTimeMax; } @@ -424,10 +425,10 @@ public class ElektronenMultiplizierer implements GLEventListener { mEffectNumber = 6; mEffectTime *= 0.364f; } - + gl.glBindFramebuffer(GL_FRAMEBUFFER, mFrameBufferObjectID); - // gl.glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); - GLUniformData en = st.getUniform("en"); + // gl.glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); + final GLUniformData en = st.getUniform("en"); if(mSyncEventNumber==7) { en.setData(2); } @@ -437,8 +438,8 @@ public class ElektronenMultiplizierer implements GLEventListener { en.setData(0); } st.uniform(gl, en); - - GLUniformData et = st.getUniform("et"); + + final GLUniformData et = st.getUniform("et"); st.uniform(gl, et.setData(9.1f)); st.uniform(gl, st.getUniform("tm").setData(MMTime_u_ms/40000.0f)); @@ -447,7 +448,7 @@ public class ElektronenMultiplizierer implements GLEventListener { if(mSyncEventNumber==4 || mSyncEventNumber==7) { //render to fbo only when using julia/mandel orbittrap ... // gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4); + gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4); } gl.glBindFramebuffer(GL_FRAMEBUFFER, 0); st.uniform(gl, en.setData(mEffectNumber)); @@ -459,19 +460,19 @@ public class ElektronenMultiplizierer implements GLEventListener { gl.glBindTexture(GL_TEXTURE_2D, mFrameBufferTextureID); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4); + gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4); vertices0.enableBuffer(gl, false); - // texCoords0.enableBuffer(gl, false); + // texCoords0.enableBuffer(gl, false); st.useProgram(gl, false); //--- mFrameCounter++; } - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { - GL2ES2 gl = drawable.getGL().getGL2ES2(); - + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { + final GL2ES2 gl = drawable.getGL().getGL2ES2(); + st.useProgram(gl, true); vertices0.seal(false); vertices0.rewind(); @@ -479,34 +480,34 @@ public class ElektronenMultiplizierer implements GLEventListener { vertices0.putf(width); vertices0.putf(height); vertices0.putf(0); vertices0.putf(0); vertices0.putf(width); vertices0.putf(0); - vertices0.seal(gl, true); + vertices0.seal(gl, true); st.ownAttribute(vertices0, true); vertices0.enableBuffer(gl, false); - + final FloatBuffer mScreenDimensionV = (FloatBuffer) mScreenDimensionUniform.getBuffer(); - mScreenDimensionV.put(0, (float) width); - mScreenDimensionV.put(1, (float) height); + mScreenDimensionV.put(0, width); + mScreenDimensionV.put(1, height); st.uniform(gl, mScreenDimensionUniform); st.useProgram(gl, false); - gl.glViewport(0, 0, width, height); + gl.glViewport(0, 0, width, height); } - public void dispose(GLAutoDrawable drawable) { - GL2ES2 gl = drawable.getGL().getGL2ES2(); + public void dispose(final GLAutoDrawable drawable) { + final GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.glDeleteFramebuffers(1, new int[] { mFrameBufferObjectID }, 0); gl.glDeleteTextures(1, new int[] { mFrameBufferTextureID }, 0); st.destroy(gl); if(drawable instanceof GLWindow) { final GLWindow glw = (GLWindow) drawable; glw.removeKeyListener(timeShiftKeys); - } + } } // public BaseMusic getBaseMusic() { // return mBaseMusic; // } - + public void resetFrameCounter() { mFrameCounter = 0; } @@ -530,7 +531,7 @@ public class ElektronenMultiplizierer implements GLEventListener { protected boolean mSyncEvent_07; protected boolean mSyncEvent_08; - public void handleSyncEvent(int inMMTime_u_ms) { + public void handleSyncEvent(final int inMMTime_u_ms) { mSyncTime = inMMTime_u_ms; mSyncEventNumber++; System.out.println("NEW SYNC EVENT! tSyncEventNumber="+mSyncEventNumber+" tSyncTime="+mSyncTime); @@ -538,5 +539,5 @@ public class ElektronenMultiplizierer implements GLEventListener { mEffectSyncTime = inMMTime_u_ms; } } - + } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java index 1a30d1868..f00053989 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java @@ -152,7 +152,7 @@ public class FBOMix2DemosES2 implements GLEventListener { System.err.println("**** Init"); initFBOs(gl, drawable); - gl.glEnable(GL2ES2.GL_DEPTH_TEST); + gl.glEnable(GL.GL_DEPTH_TEST); } private void initFBOs(final GL gl, final GLAutoDrawable drawable) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java index d1a5f888e..2709aa608 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java @@ -54,6 +54,7 @@ import javax.media.opengl.GLAnimatorControl; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLProfile; import javax.media.opengl.GLUniformData; +import javax.media.opengl.fixedfunc.GLMatrixFunc; /** * GearsES2.java
    @@ -395,14 +396,14 @@ public class GearsES2 implements StereoRendererListener, TileRendererBase.TileRe System.err.println(">> GearsES2 "+sid()+", angle "+angle+", [l "+left+", r "+right+", b "+bottom+", t "+top+"] "+w+"x"+h+" -> [l "+l+", r "+r+", b "+b+", t "+t+"] "+_w+"x"+_h+", v-flip "+flipVerticalInGLOrientation); } - pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); if( flipVerticalInGLOrientation && gl.getContext().getGLDrawable().isGLOriented() ) { pmvMatrix.glScalef(1f, -1f, 1f); } pmvMatrix.glFrustumf(l, r, b, t, zNear, zFar); - pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrix.glTranslatef(0.0f, 0.0f, -zViewDist); st.useProgram(gl, true); @@ -421,7 +422,7 @@ public class GearsES2 implements StereoRendererListener, TileRendererBase.TileRe public void reshapeEye(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height, final EyeParameter eyeParam, final EyePose eyePose) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); - pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); final float[] mat4Projection = FloatUtil.makePerspective(mat4Tmp1, 0, true, eyeParam.fovhv, zNear, zFar); if( flipVerticalInGLOrientation && gl.getContext().getGLDrawable().isGLOriented() ) { pmvMatrix.glLoadIdentity(); @@ -431,7 +432,7 @@ public class GearsES2 implements StereoRendererListener, TileRendererBase.TileRe pmvMatrix.glLoadMatrixf(mat4Projection, 0); } - pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); final Quaternion rollPitchYaw = new Quaternion(); // private final float eyeYaw = FloatUtil.PI; // 180 degrees in radians diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsObjectES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsObjectES2.java index 4cef6394e..7088eb757 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsObjectES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsObjectES2.java @@ -43,11 +43,11 @@ public class GearsObjectES2 extends GearsObject { final GLUniformData colorUniform; final ShaderState st; - public GearsObjectES2(GL gl, boolean useMappedBuffers, ShaderState st, FloatBuffer gearColor, - float inner_radius, float outer_radius, - float width, - int teeth, - float tooth_depth, PMVMatrix pmvMatrix, GLUniformData pmvMatrixUniform, GLUniformData colorUniform, boolean validateBuffers) + public GearsObjectES2(final GL gl, final boolean useMappedBuffers, final ShaderState st, final FloatBuffer gearColor, + final float inner_radius, final float outer_radius, + final float width, + final int teeth, + final float tooth_depth, final PMVMatrix pmvMatrix, final GLUniformData pmvMatrixUniform, final GLUniformData colorUniform, final boolean validateBuffers) { super(gl, useMappedBuffers, gearColor, inner_radius, outer_radius, width, teeth, tooth_depth, validateBuffers); this.pmvMatrix = pmvMatrix; @@ -57,10 +57,10 @@ public class GearsObjectES2 extends GearsObject { associate(st); } - public GearsObjectES2(GearsObjectES2 shared, - ShaderState st, - PMVMatrix pmvMatrix, - GLUniformData pmvMatrixUniform, GLUniformData colorUniform) + public GearsObjectES2(final GearsObjectES2 shared, + final ShaderState st, + final PMVMatrix pmvMatrix, + final GLUniformData pmvMatrixUniform, final GLUniformData colorUniform) { super(shared); this.pmvMatrix = pmvMatrix; @@ -70,7 +70,7 @@ public class GearsObjectES2 extends GearsObject { associate(st); } - private void associate(ShaderState st) { + private void associate(final ShaderState st) { frontFace.associate(st, true); frontSide.associate(st, true); backFace.associate(st, true); @@ -80,7 +80,7 @@ public class GearsObjectES2 extends GearsObject { } @Override - public GLArrayDataServer createInterleaved(boolean useMappedBuffers, int comps, int dataType, boolean normalized, int initialSize, int vboUsage) { + public GLArrayDataServer createInterleaved(final boolean useMappedBuffers, final int comps, final int dataType, final boolean normalized, final int initialSize, final int vboUsage) { if( useMappedBuffers ) { return GLArrayDataServer.createGLSLInterleavedMapped(comps, dataType, normalized, initialSize, vboUsage); } else { @@ -89,12 +89,12 @@ public class GearsObjectES2 extends GearsObject { } @Override - public void addInterleavedVertexAndNormalArrays(GLArrayDataServer array, int components) { + public void addInterleavedVertexAndNormalArrays(final GLArrayDataServer array, final int components) { array.addGLSLSubArray("vertices", components, GL.GL_ARRAY_BUFFER); array.addGLSLSubArray("normals", components, GL.GL_ARRAY_BUFFER); } - private void draw(GL2ES2 gl, GLArrayDataServer array, int mode, int face) { + private void draw(final GL2ES2 gl, final GLArrayDataServer array, final int mode, final int face) { if( !isShared || gl.glIsBuffer(array.getVBOName()) ) { if( validateBuffers ) { array.bindBuffer(gl, true); @@ -119,7 +119,7 @@ public class GearsObjectES2 extends GearsObject { } @Override - public void draw(GL _gl, float x, float y, float angle) { + public void draw(final GL _gl, final float x, final float y, final float angle) { final GL2ES2 gl = _gl.getGL2ES2(); pmvMatrix.glPushMatrix(); pmvMatrix.glTranslatef(x, y, 0f); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java index 04af59628..c341c6de6 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java @@ -162,7 +162,7 @@ public class LandscapeES2 implements GLEventListener { timeUni.setData((System.currentTimeMillis() - millisOffset) / 1000.0f); shaderState.uniform(gl, timeUni); vertices.enableBuffer(gl, true); - gl.glDrawArrays(GL2ES2.GL_TRIANGLE_STRIP, 0, 4); + gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4); vertices.enableBuffer(gl, false); shaderState.useProgram(gl, false); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/MultisampleDemoES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/MultisampleDemoES2.java index 430ea45c0..d2f0d89eb 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/MultisampleDemoES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/MultisampleDemoES2.java @@ -62,16 +62,16 @@ public class MultisampleDemoES2 implements GLEventListener { private GLUniformData pmvMatrixUniform; private ImmModeSink immModeSink; - public MultisampleDemoES2(boolean multisample) { + public MultisampleDemoES2(final boolean multisample) { this.multisample = multisample; st = new ShaderState(); - st.setVerbose(true); - pmvMatrix = new PMVMatrix(); + st.setVerbose(true); + pmvMatrix = new PMVMatrix(); } - public void init(GLAutoDrawable glad) { + public void init(final GLAutoDrawable glad) { final GL2ES2 gl = glad.getGL().getGL2ES2(); - + System.err.println(); System.err.println("req. msaa: "+multisample); System.err.println("Requested: " + glad.getNativeSurface().getGraphicsConfiguration().getRequestedCapabilities()); @@ -79,26 +79,26 @@ public class MultisampleDemoES2 implements GLEventListener { System.err.println("Chosen : " + glad.getChosenGLCapabilities()); System.err.println("has msaa: "+multisample); System.err.println(); - + final ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, MultisampleDemoES2.class, "shader", "shader/bin", "mgl_default_xxx", true); final ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, MultisampleDemoES2.class, "shader", "shader/bin", "mgl_default_xxx", true); vp0.defaultShaderCustomization(gl, true, true); fp0.defaultShaderCustomization(gl, true, true); - + sp0 = new ShaderProgram(); sp0.add(gl, vp0, System.err); - sp0.add(gl, fp0, System.err); + sp0.add(gl, fp0, System.err); st.attachShaderProgram(gl, sp0, true); - + pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); - st.ownUniform(pmvMatrixUniform); + st.ownUniform(pmvMatrixUniform); st.uniform(gl, pmvMatrixUniform); - - // Using predef array names, see + + // Using predef array names, see // GLPointerFuncUtil.getPredefinedArrayIndexName(glArrayIndex); - immModeSink = ImmModeSink.createGLSL(40, + immModeSink = ImmModeSink.createGLSL(40, 3, GL.GL_FLOAT, // vertex 4, GL.GL_FLOAT, // color 0, GL.GL_FLOAT, // normal @@ -109,28 +109,28 @@ public class MultisampleDemoES2 implements GLEventListener { final double radius = 1; immModeSink.glBegin(GL.GL_LINES); for (int i = numSteps - 1; i >= 0; i--) { - immModeSink.glVertex3f((float) (radius * Math.cos(i * increment)), - (float) (radius * Math.sin(i * increment)), + immModeSink.glVertex3f((float) (radius * Math.cos(i * increment)), + (float) (radius * Math.sin(i * increment)), 0f); - immModeSink.glColor4f( 1f, 1f, 1f, 1f ); - immModeSink.glVertex3f((float) (-1.0 * radius * Math.cos(i * increment)), - (float) (-1.0 * radius * Math.sin(i * increment)), + immModeSink.glColor4f( 1f, 1f, 1f, 1f ); + immModeSink.glVertex3f((float) (-1.0 * radius * Math.cos(i * increment)), + (float) (-1.0 * radius * Math.sin(i * increment)), 0f); - immModeSink.glColor4f( 1f, 1f, 1f, 1f ); + immModeSink.glColor4f( 1f, 1f, 1f, 1f ); } immModeSink.glEnd(gl, false); - + st.useProgram(gl, false); } - public void dispose(GLAutoDrawable glad) { + public void dispose(final GLAutoDrawable glad) { final GL2ES2 gl = glad.getGL().getGL2ES2(); immModeSink.destroy(gl); immModeSink = null; st.destroy(gl); } - public void display(GLAutoDrawable glad) { + public void display(final GLAutoDrawable glad) { final GL2ES2 gl = glad.getGL().getGL2ES2(); if (multisample) { gl.glEnable(GL.GL_MULTISAMPLE); @@ -139,16 +139,16 @@ public class MultisampleDemoES2 implements GLEventListener { // gl.glEnable(GL.GL_DEPTH_TEST); // gl.glDepthFunc(GL.GL_LESS); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - + st.useProgram(gl, true); - + immModeSink.draw(gl, true); - + st.useProgram(gl, false); } // Unused routines - public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable glad, final int x, final int y, final int width, final int height) { System.err.println("reshape .."); final GL2ES2 gl = glad.getGL().getGL2ES2(); pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); @@ -157,12 +157,12 @@ public class MultisampleDemoES2 implements GLEventListener { pmvMatrix.glOrthof(-1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 10.0f); pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); - + st.useProgram(gl, true); st.uniform(gl, pmvMatrixUniform); st.useProgram(gl, false); } - public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) { + public void displayChanged(final GLAutoDrawable drawable, final boolean modeChanged, final boolean deviceChanged) { } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java index 573c91636..8a99a4d55 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java @@ -43,6 +43,7 @@ import javax.media.opengl.GL2ES2; import javax.media.opengl.GL2GL3; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLUniformData; +import javax.media.opengl.fixedfunc.GLMatrixFunc; public class PointsDemoES2 extends PointsDemo { ShaderState st; @@ -58,7 +59,7 @@ public class PointsDemoES2 extends PointsDemo { /** ( pointSize, pointSmooth, attn. pointMinSize, attn. pointMaxSize ) , ( attenuation coefficients 1f 0f 0f, attenuation fade theshold 1f ) */ private final FloatBuffer pointParams = Buffers.newDirectFloatBuffer(new float[] { 1.0f, 0.0f, 0.0f, 4096.0f, 1.0f, 0.0f, 0.0f, 1.0f }); - public PointsDemoES2(int swapInterval) { + public PointsDemoES2(final int swapInterval) { this.swapInterval = swapInterval; } @@ -66,11 +67,11 @@ public class PointsDemoES2 extends PointsDemo { this.swapInterval = 1; } - public void setSmoothPoints(boolean v) { + public void setSmoothPoints(final boolean v) { pointParams.put(1, v ? 1.0f : 0.0f); } - public void setPointParams(float minSize, float maxSize, float distAttenConst, float distAttenLinear, float distAttenQuadratic, float fadeThreshold) { + public void setPointParams(final float minSize, final float maxSize, final float distAttenConst, final float distAttenLinear, final float distAttenQuadratic, final float fadeThreshold) { pointParams.put(2, minSize); pointParams.put(3, maxSize); pointParams.put(4+0, distAttenConst); @@ -79,8 +80,8 @@ public class PointsDemoES2 extends PointsDemo { pointParams.put(4+3, fadeThreshold); } - public void init(GLAutoDrawable glad) { - GL2ES2 gl = glad.getGL().getGL2ES2(); + public void init(final GLAutoDrawable glad) { + final GL2ES2 gl = glad.getGL().getGL2ES2(); System.err.println("GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR)); System.err.println("GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER)); @@ -103,9 +104,9 @@ public class PointsDemoES2 extends PointsDemo { // setup mgl_PMVMatrix pmvMatrix = new PMVMatrix(); - pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); - pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv st.ownUniform(pmvMatrixUniform); @@ -138,21 +139,21 @@ public class PointsDemoES2 extends PointsDemo { pointSizes.enableBuffer(gl, false); // OpenGL Render Settings - gl.glEnable(GL2ES2.GL_DEPTH_TEST); + gl.glEnable(GL.GL_DEPTH_TEST); st.useProgram(gl, false); } - public void display(GLAutoDrawable glad) { - GL2ES2 gl = glad.getGL().getGL2ES2(); + public void display(final GLAutoDrawable glad) { + final GL2ES2 gl = glad.getGL().getGL2ES2(); gl.glClearColor(0f, 0f, 0f, 0f); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); st.useProgram(gl, true); - pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrix.glTranslatef(0, 0, -10); st.uniform(gl, pmvMatrixUniform); - GLUniformData ud = st.getUniform(mgl_PointParams); + final GLUniformData ud = st.getUniform(mgl_PointParams); if(null!=ud) { // same data object st.uniform(gl, ud); @@ -181,9 +182,9 @@ public class PointsDemoES2 extends PointsDemo { st.useProgram(gl, false); } - public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable glad, final int x, final int y, final int width, final int height) { // Thread.dumpStack(); - GL2ES2 gl = glad.getGL().getGL2ES2(); + final GL2ES2 gl = glad.getGL().getGL2ES2(); if(-1 != swapInterval) { gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there) @@ -191,7 +192,7 @@ public class PointsDemoES2 extends PointsDemo { st.useProgram(gl, true); // Set location in front of camera - pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); pmvMatrix.gluPerspective(45.0F, ( (float) width / (float) height ) / 1.0f, 1.0F, 100.0F); //pmvMatrix.glOrthof(-4.0f, 4.0f, -4.0f, 4.0f, 1.0f, 100.0f); @@ -199,8 +200,8 @@ public class PointsDemoES2 extends PointsDemo { st.useProgram(gl, false); } - public void dispose(GLAutoDrawable glad) { - GL2ES2 gl = glad.getGL().getGL2ES2(); + public void dispose(final GLAutoDrawable glad) { + final GL2ES2 gl = glad.getGL().getGL2ES2(); st.destroy(gl); st = null; pmvMatrix = null; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java index 9f850c35b..8058d1b7d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java @@ -40,6 +40,7 @@ import javax.media.opengl.GL2ES2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLUniformData; +import javax.media.opengl.fixedfunc.GLMatrixFunc; public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRendererListener { private ShaderState st; @@ -55,7 +56,7 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende private TileRendererBase tileRendererInUse = null; private boolean doRotateBeforePrinting; - public RedSquareES2(int swapInterval) { + public RedSquareES2(final int swapInterval) { this.swapInterval = swapInterval; } @@ -64,31 +65,31 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende } @Override - public void addTileRendererNotify(TileRendererBase tr) { + public void addTileRendererNotify(final TileRendererBase tr) { tileRendererInUse = tr; doRotateBeforePrinting = doRotate; setDoRotation(false); } @Override - public void removeTileRendererNotify(TileRendererBase tr) { + public void removeTileRendererNotify(final TileRendererBase tr) { tileRendererInUse = null; setDoRotation(doRotateBeforePrinting); } @Override - public void startTileRendering(TileRendererBase tr) { + public void startTileRendering(final TileRendererBase tr) { System.err.println("RedSquareES2.startTileRendering: "+tr); } @Override - public void endTileRendering(TileRendererBase tr) { + public void endTileRendering(final TileRendererBase tr) { System.err.println("RedSquareES2.endTileRendering: "+tr); } - public void setAspect(float aspect) { this.aspect = aspect; } - public void setDoRotation(boolean rotate) { this.doRotate = rotate; } - public void setClearBuffers(boolean v) { clearBuffers = v; } + public void setAspect(final float aspect) { this.aspect = aspect; } + public void setDoRotation(final boolean rotate) { this.doRotate = rotate; } + public void setClearBuffers(final boolean v) { clearBuffers = v; } @Override - public void init(GLAutoDrawable glad) { + public void init(final GLAutoDrawable glad) { System.err.println(Thread.currentThread()+" RedSquareES2.init: tileRendererInUse "+tileRendererInUse); final GL2ES2 gl = glad.getGL().getGL2ES2(); @@ -115,9 +116,9 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende // setup mgl_PMVMatrix pmvMatrix = new PMVMatrix(); - pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); - pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv st.ownUniform(pmvMatrixUniform); @@ -144,7 +145,7 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende colors.enableBuffer(gl, false); // OpenGL Render Settings - gl.glEnable(GL2ES2.GL_DEPTH_TEST); + gl.glEnable(GL.GL_DEPTH_TEST); st.useProgram(gl, false); t0 = System.currentTimeMillis(); @@ -152,8 +153,8 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende } @Override - public void display(GLAutoDrawable glad) { - long t1 = System.currentTimeMillis(); + public void display(final GLAutoDrawable glad) { + final long t1 = System.currentTimeMillis(); final GL2ES2 gl = glad.getGL().getGL2ES2(); if( clearBuffers ) { @@ -169,11 +170,11 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende } st.useProgram(gl, true); // One rotation every four seconds - pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrix.glTranslatef(0, 0, -10); if(doRotate) { - float ang = ((t1 - t0) * 360.0F) / 4000.0F; + final float ang = ((t1 - t0) * 360.0F) / 4000.0F; pmvMatrix.glRotatef(ang, 0, 0, 1); pmvMatrix.glRotatef(ang, 0, 1, 0); } @@ -189,7 +190,7 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende } @Override - public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable glad, final int x, final int y, final int width, final int height) { final GL2ES2 gl = glad.getGL().getGL2ES2(); if(-1 != swapInterval) { gl.setSwapInterval(swapInterval); @@ -198,15 +199,15 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende } @Override - public void reshapeTile(TileRendererBase tr, - int tileX, int tileY, int tileWidth, int tileHeight, - int imageWidth, int imageHeight) { + public void reshapeTile(final TileRendererBase tr, + final int tileX, final int tileY, final int tileWidth, final int tileHeight, + final int imageWidth, final int imageHeight) { final GL2ES2 gl = tr.getAttachedDrawable().getGL().getGL2ES2(); gl.setSwapInterval(0); reshapeImpl(gl, tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight); } - void reshapeImpl(GL2ES2 gl, int tileX, int tileY, int tileWidth, int tileHeight, int imageWidth, int imageHeight) { + void reshapeImpl(final GL2ES2 gl, final int tileX, final int tileY, final int tileWidth, final int tileHeight, final int imageWidth, final int imageHeight) { System.err.println(Thread.currentThread()+" RedSquareES2.reshape "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", tileRendererInUse "+tileRendererInUse); // Thread.dumpStack(); if( !gl.hasGLSL() ) { @@ -215,7 +216,7 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende st.useProgram(gl, true); // Set location in front of camera - pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); // compute projection parameters 'normal' perspective @@ -247,7 +248,7 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende } @Override - public void dispose(GLAutoDrawable glad) { + public void dispose(final GLAutoDrawable glad) { System.err.println(Thread.currentThread()+" RedSquareES2.dispose: tileRendererInUse "+tileRendererInUse); final GL2ES2 gl = glad.getGL().getGL2ES2(); if( !gl.hasGLSL() ) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareMappedES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareMappedES2.java index 113cbee26..35449b3bf 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareMappedES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareMappedES2.java @@ -43,6 +43,7 @@ import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLBufferStorage; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLUniformData; +import javax.media.opengl.fixedfunc.GLMatrixFunc; public class RedSquareMappedES2 implements GLEventListener, TileRendererBase.TileRendererListener { private ShaderState st; @@ -58,7 +59,7 @@ public class RedSquareMappedES2 implements GLEventListener, TileRendererBase.Til private TileRendererBase tileRendererInUse = null; private boolean doRotateBeforePrinting; - public RedSquareMappedES2(int swapInterval) { + public RedSquareMappedES2(final int swapInterval) { this.swapInterval = swapInterval; } @@ -67,31 +68,31 @@ public class RedSquareMappedES2 implements GLEventListener, TileRendererBase.Til } @Override - public void addTileRendererNotify(TileRendererBase tr) { + public void addTileRendererNotify(final TileRendererBase tr) { tileRendererInUse = tr; doRotateBeforePrinting = doRotate; setDoRotation(false); } @Override - public void removeTileRendererNotify(TileRendererBase tr) { + public void removeTileRendererNotify(final TileRendererBase tr) { tileRendererInUse = null; setDoRotation(doRotateBeforePrinting); } @Override - public void startTileRendering(TileRendererBase tr) { + public void startTileRendering(final TileRendererBase tr) { System.err.println("RedSquareES2.startTileRendering: "+tr); } @Override - public void endTileRendering(TileRendererBase tr) { + public void endTileRendering(final TileRendererBase tr) { System.err.println("RedSquareES2.endTileRendering: "+tr); } - public void setAspect(float aspect) { this.aspect = aspect; } - public void setDoRotation(boolean rotate) { this.doRotate = rotate; } - public void setClearBuffers(boolean v) { clearBuffers = v; } + public void setAspect(final float aspect) { this.aspect = aspect; } + public void setDoRotation(final boolean rotate) { this.doRotate = rotate; } + public void setClearBuffers(final boolean v) { clearBuffers = v; } @Override - public void init(GLAutoDrawable glad) { + public void init(final GLAutoDrawable glad) { System.err.println(Thread.currentThread()+" RedSquareES2.init: tileRendererInUse "+tileRendererInUse); final GL2ES2 gl = glad.getGL().getGL2ES2(); @@ -118,9 +119,9 @@ public class RedSquareMappedES2 implements GLEventListener, TileRendererBase.Til // setup mgl_PMVMatrix pmvMatrix = new PMVMatrix(); - pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); - pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv st.ownUniform(pmvMatrixUniform); @@ -163,7 +164,7 @@ public class RedSquareMappedES2 implements GLEventListener, TileRendererBase.Til colors.enableBuffer(gl, false); // OpenGL Render Settings - gl.glEnable(GL2ES2.GL_DEPTH_TEST); + gl.glEnable(GL.GL_DEPTH_TEST); st.useProgram(gl, false); t0 = System.currentTimeMillis(); @@ -171,8 +172,8 @@ public class RedSquareMappedES2 implements GLEventListener, TileRendererBase.Til } @Override - public void display(GLAutoDrawable glad) { - long t1 = System.currentTimeMillis(); + public void display(final GLAutoDrawable glad) { + final long t1 = System.currentTimeMillis(); final GL2ES2 gl = glad.getGL().getGL2ES2(); if( clearBuffers ) { @@ -188,11 +189,11 @@ public class RedSquareMappedES2 implements GLEventListener, TileRendererBase.Til } st.useProgram(gl, true); // One rotation every four seconds - pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrix.glTranslatef(0, 0, -10); if(doRotate) { - float ang = ((t1 - t0) * 360.0F) / 4000.0F; + final float ang = ((t1 - t0) * 360.0F) / 4000.0F; pmvMatrix.glRotatef(ang, 0, 0, 1); pmvMatrix.glRotatef(ang, 0, 1, 0); } @@ -208,7 +209,7 @@ public class RedSquareMappedES2 implements GLEventListener, TileRendererBase.Til } @Override - public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable glad, final int x, final int y, final int width, final int height) { final GL2ES2 gl = glad.getGL().getGL2ES2(); if(-1 != swapInterval) { gl.setSwapInterval(swapInterval); @@ -217,15 +218,15 @@ public class RedSquareMappedES2 implements GLEventListener, TileRendererBase.Til } @Override - public void reshapeTile(TileRendererBase tr, - int tileX, int tileY, int tileWidth, int tileHeight, - int imageWidth, int imageHeight) { + public void reshapeTile(final TileRendererBase tr, + final int tileX, final int tileY, final int tileWidth, final int tileHeight, + final int imageWidth, final int imageHeight) { final GL2ES2 gl = tr.getAttachedDrawable().getGL().getGL2ES2(); gl.setSwapInterval(0); reshapeImpl(gl, tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight); } - void reshapeImpl(GL2ES2 gl, int tileX, int tileY, int tileWidth, int tileHeight, int imageWidth, int imageHeight) { + void reshapeImpl(final GL2ES2 gl, final int tileX, final int tileY, final int tileWidth, final int tileHeight, final int imageWidth, final int imageHeight) { System.err.println(Thread.currentThread()+" RedSquareES2.reshape "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", tileRendererInUse "+tileRendererInUse); // Thread.dumpStack(); if( !gl.hasGLSL() ) { @@ -234,7 +235,7 @@ public class RedSquareMappedES2 implements GLEventListener, TileRendererBase.Til st.useProgram(gl, true); // Set location in front of camera - pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); // compute projection parameters 'normal' perspective @@ -266,7 +267,7 @@ public class RedSquareMappedES2 implements GLEventListener, TileRendererBase.Til } @Override - public void dispose(GLAutoDrawable glad) { + public void dispose(final GLAutoDrawable glad) { System.err.println(Thread.currentThread()+" RedSquareES2.dispose: tileRendererInUse "+tileRendererInUse); final GL2ES2 gl = glad.getGL().getGL2ES2(); if( !gl.hasGLSL() ) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw01ES2Listener.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw01ES2Listener.java index fb30ef6b5..9e643ded6 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw01ES2Listener.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw01ES2Listener.java @@ -65,18 +65,18 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A * @param td * @param textureUnit of range [0..] */ - public TextureDraw01ES2Listener(TextureData td, int textureUnit) { + public TextureDraw01ES2Listener(final TextureData td, final int textureUnit) { this.textureData = td; this.textureUnit = textureUnit; this.keepTextureBound = false; } - public void setClearColor(float[] clearColor) { + public void setClearColor(final float[] clearColor) { this.clearColor = clearColor; } @Override - public void setKeepTextureBound(boolean v) { + public void setKeepTextureBound(final boolean v) { this.keepTextureBound = v; } @Override @@ -101,17 +101,17 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A static final String shaderBasename = "texture01_xxx"; - private void initShader(GL2ES2 gl, boolean use_program) { + private void initShader(final GL2ES2 gl, final boolean use_program) { // Create & Compile the shader objects - ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(), + final ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(), "shader", "shader/bin", shaderBasename, true); - ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(), + final ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(), "shader", "shader/bin", shaderBasename, true); rsVp.defaultShaderCustomization(gl, true, true); rsFp.defaultShaderCustomization(gl, true, true); // Create & Link the shader program - ShaderProgram sp = new ShaderProgram(); + final ShaderProgram sp = new ShaderProgram(); sp.add(rsVp); sp.add(rsFp); if(!sp.link(gl, System.err)) { @@ -124,19 +124,19 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A } @Override - public void init(GLAutoDrawable glad) { + public void init(final GLAutoDrawable glad) { if(null!=textureData) { this.texture = TextureIO.newTexture(glad.getGL(), textureData); } - GL2ES2 gl = glad.getGL().getGL2ES2(); + final GL2ES2 gl = glad.getGL().getGL2ES2(); initShader(gl, true); // setup mgl_PMVMatrix pmvMatrix = new PMVMatrix(); - pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); - pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv @@ -158,7 +158,7 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A //interleavedVBO.addGLSLSubArray("mgl_Normal", 3, GL.GL_ARRAY_BUFFER); interleavedVBO.addGLSLSubArray("mgl_MultiTexCoord", 2, GL.GL_ARRAY_BUFFER); - FloatBuffer ib = (FloatBuffer)interleavedVBO.getBuffer(); + final FloatBuffer ib = (FloatBuffer)interleavedVBO.getBuffer(); for(int i=0; i<4; i++) { ib.put(s_quadVertices, i*3, 3); @@ -173,7 +173,7 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A // OpenGL Render Settings gl.glClearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]); - gl.glEnable(GL2ES2.GL_DEPTH_TEST); + gl.glEnable(GL.GL_DEPTH_TEST); if( keepTextureBound && null != texture ) { gl.glActiveTexture(GL.GL_TEXTURE0 + textureUnit); @@ -184,8 +184,8 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { - GL2ES2 gl = drawable.getGL().getGL2ES2(); + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { + final GL2ES2 gl = drawable.getGL().getGL2ES2(); // Clear background to white gl.glClearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]); @@ -204,8 +204,8 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A } @Override - public void dispose(GLAutoDrawable drawable) { - GL2ES2 gl = drawable.getGL().getGL2ES2(); + public void dispose(final GLAutoDrawable drawable) { + final GL2ES2 gl = drawable.getGL().getGL2ES2(); if(null!=texture) { texture.disable(gl); texture.destroy(gl); @@ -221,8 +221,8 @@ public class TextureDraw01ES2Listener implements GLEventListener, TextureDraw01A } @Override - public void display(GLAutoDrawable drawable) { - GL2ES2 gl = drawable.getGL().getGL2ES2(); + public void display(final GLAutoDrawable drawable) { + final GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java index da9281207..18cb35929 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java @@ -138,7 +138,7 @@ public class TextureDraw02ES2ListenerFBO implements GLEventListener { st.useProgram(gl, false); - gl.glEnable(GL2ES2.GL_DEPTH_TEST); + gl.glEnable(GL.GL_DEPTH_TEST); } private void initFBOs(final GL gl, final int width, final int height) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java index b86dbb603..b49fa182a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java @@ -57,7 +57,7 @@ import com.jogamp.opengl.util.texture.TextureSequence; import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame; public class TextureSequenceCubeES2 implements GLEventListener { - public TextureSequenceCubeES2 (TextureSequence texSource, boolean innerCube, float zoom0, float rotx, float roty) { + public TextureSequenceCubeES2 (final TextureSequence texSource, final boolean innerCube, final float zoom0, final float rotx, final float roty) { this.texSeq = texSource; this.innerCube = innerCube; this.zoom = zoom0; @@ -84,26 +84,26 @@ public class TextureSequenceCubeES2 implements GLEventListener { int ly = 0; boolean first = false; - public void mousePressed(MouseEvent e) { + public void mousePressed(final MouseEvent e) { first = true; } - public void mouseMoved(MouseEvent e) { + public void mouseMoved(final MouseEvent e) { first = false; } - public void mouseDragged(MouseEvent e) { + public void mouseDragged(final MouseEvent e) { int width, height; - Object source = e.getSource(); + final Object source = e.getSource(); Window window = null; if(source instanceof Window) { window = (Window) source; width=window.getSurfaceWidth(); height=window.getSurfaceHeight(); } else if (source instanceof GLAutoDrawable) { - GLAutoDrawable glad = (GLAutoDrawable) source; + final GLAutoDrawable glad = (GLAutoDrawable) source; width = glad.getSurfaceWidth(); height = glad.getSurfaceHeight(); } else if (GLProfile.isAWTAvailable() && source instanceof java.awt.Component) { - java.awt.Component comp = (java.awt.Component) source; + final java.awt.Component comp = (java.awt.Component) source; width=comp.getWidth(); // FIXME HiDPI: May need to convert window units -> pixel units! height=comp.getHeight(); } else { @@ -116,8 +116,8 @@ public class TextureSequenceCubeES2 implements GLEventListener { first=false; return; } - int nv = Math.abs(e.getY(0)-e.getY(1)); - int dy = nv - lx; + final int nv = Math.abs(e.getY(0)-e.getY(1)); + final int dy = nv - lx; { final float o = zoom; @@ -135,15 +135,15 @@ public class TextureSequenceCubeES2 implements GLEventListener { first=false; return; } - int nx = e.getX(); - int ny = e.getY(); + final int nx = e.getX(); + final int ny = e.getY(); view_roty += 360f * ( (float)( nx - lx ) / (float)width ); view_rotx += 360f * ( (float)( ny - ly ) / (float)height ); lx = nx; ly = ny; } } - public void mouseWheelMoved(MouseEvent e) { + public void mouseWheelMoved(final MouseEvent e) { // System.err.println("XXX "+e); if( !e.isShiftDown() ) { final float o = zoom; @@ -157,11 +157,11 @@ public class TextureSequenceCubeES2 implements GLEventListener { static final String shaderBasename = "texsequence_xxx"; static final String myTextureLookupName = "myTexture2D"; - private void initShader(GL2ES2 gl) { + private void initShader(final GL2ES2 gl) { // Create & Compile the shader objects - ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(), + final ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(), "shader", "shader/bin", shaderBasename, true); - ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(), + final ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(), "shader", "shader/bin", shaderBasename, true); boolean preludeGLSLVersion = true; @@ -192,7 +192,7 @@ public class TextureSequenceCubeES2 implements GLEventListener { rsFp.insertShaderSource(0, "TEXTURE-SEQUENCE-CODE-BEGIN", 0, sFpIns); // Create & Link the shader program - ShaderProgram sp = new ShaderProgram(); + final ShaderProgram sp = new ShaderProgram(); sp.add(rsVp); sp.add(rsFp); if(!sp.link(gl, System.err)) { @@ -206,8 +206,8 @@ public class TextureSequenceCubeES2 implements GLEventListener { GLArrayDataServer interleavedVBO, cubeIndicesVBO; - public void init(GLAutoDrawable drawable) { - GL2ES2 gl = drawable.getGL().getGL2ES2(); + public void init(final GLAutoDrawable drawable) { + final GL2ES2 gl = drawable.getGL().getGL2ES2(); System.err.println(JoglVersion.getGLInfo(gl, null)); final TextureFrame frame = texSeq.getLastTexture(); if( null == frame ) { @@ -232,7 +232,7 @@ public class TextureSequenceCubeES2 implements GLEventListener { // calculate centered tex coords w/ aspect ratio - float[] fixedCubeTexCoords = new float[s_cubeTexCoords.length]; + final float[] fixedCubeTexCoords = new float[s_cubeTexCoords.length]; { final float aspect = tex.getAspectRatio(); final TextureCoords tc = tex.getImageTexCoords(); @@ -264,7 +264,7 @@ public class TextureSequenceCubeES2 implements GLEventListener { //interleavedVBO.addGLSLSubArray("mgl_Normal", 3, GL.GL_ARRAY_BUFFER); interleavedVBO.addGLSLSubArray("mgl_MultiTexCoord", 2, GL.GL_ARRAY_BUFFER); - FloatBuffer ib = (FloatBuffer)interleavedVBO.getBuffer(); + final FloatBuffer ib = (FloatBuffer)interleavedVBO.getBuffer(); for(int i=0; i<6*4; i++) { ib.put(s_cubeVertices, i*3, 3); @@ -286,7 +286,7 @@ public class TextureSequenceCubeES2 implements GLEventListener { st.ownAttribute(cubeIndicesVBO, true); - gl.glEnable(GL2ES2.GL_DEPTH_TEST); + gl.glEnable(GL.GL_DEPTH_TEST); st.useProgram(gl, false); @@ -304,8 +304,8 @@ public class TextureSequenceCubeES2 implements GLEventListener { System.out.println(st); } - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { - GL2ES2 gl = drawable.getGL().getGL2ES2(); + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { + final GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.glViewport(0, 0, width, height); @@ -326,7 +326,7 @@ public class TextureSequenceCubeES2 implements GLEventListener { } - private void reshapePMV(int width, int height) { + private void reshapePMV(final int width, final int height) { if(null != pmvMatrix) { pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); @@ -347,8 +347,8 @@ public class TextureSequenceCubeES2 implements GLEventListener { @Override - public void dispose(GLAutoDrawable drawable) { - GL2ES2 gl = drawable.getGL().getGL2ES2(); + public void dispose(final GLAutoDrawable drawable) { + final GL2ES2 gl = drawable.getGL().getGL2ES2(); texSeq = null; pmvMatrixUniform = null; @@ -360,8 +360,8 @@ public class TextureSequenceCubeES2 implements GLEventListener { } @Override - public void display(GLAutoDrawable drawable) { - GL2ES2 gl = drawable.getGL().getGL2ES2(); + public void display(final GLAutoDrawable drawable) { + final GL2ES2 gl = drawable.getGL().getGL2ES2(); if(innerCube) { // Clear background to white @@ -397,7 +397,7 @@ public class TextureSequenceCubeES2 implements GLEventListener { } } cubeIndicesVBO.bindBuffer(gl, true); // keeps VBO binding - gl.glDrawElements(GL2ES2.GL_TRIANGLES, cubeIndicesVBO.getElementCount() * cubeIndicesVBO.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); + gl.glDrawElements(GL.GL_TRIANGLES, cubeIndicesVBO.getElementCount() * cubeIndicesVBO.getComponentCount(), GL.GL_UNSIGNED_SHORT, 0); cubeIndicesVBO.bindBuffer(gl, false); if(null != tex) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/CrossFadePlayer.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/CrossFadePlayer.java index 02f62c415..e5e752d96 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/CrossFadePlayer.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/CrossFadePlayer.java @@ -47,7 +47,7 @@ public class CrossFadePlayer static GLMediaPlayer[] player; static volatile boolean stop = false; - public static void main(String[] args) + public static void main(final String[] args) { if(args.length==0) { @@ -57,13 +57,13 @@ public class CrossFadePlayer "and i will try CrossFade-play them all in parallel!"); } - GLMediaEventListener mediaEventListener = new GLMediaEventListener() + final GLMediaEventListener mediaEventListener = new GLMediaEventListener() { @Override - public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) { } + public void newFrameAvailable(final GLMediaPlayer ts, final TextureFrame newFrame, final long when) { } @Override - public void attributesChanged(final GLMediaPlayer mp, int event_mask, long when) + public void attributesChanged(final GLMediaPlayer mp, final int event_mask, final long when) { System.out.println("\n***\nEvent mask changed: " + event_mask); System.out.println("Timestamp: "+ when); @@ -80,7 +80,7 @@ public class CrossFadePlayer if ( GLMediaPlayer.State.Paused == mp.getState() ) { // init OK mp.play(); } - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } @@ -126,7 +126,7 @@ public class CrossFadePlayer // Initialize media players player = new GLMediaPlayer[args.length]; int i=0; - for( String arg: args ) { + for( final String arg: args ) { player[i] = GLMediaPlayerFactory.createDefault(); if(player[i]!=null){ System.out.println("Created CrossFade player: "+ i + " " + player[i].getClass().getName()); @@ -137,18 +137,18 @@ public class CrossFadePlayer System.out.println("No file selected: arg " + i +" = "+ filename); player[i]=null; } else { - File file = new File(filename); + final File file = new File(filename); if(!file.exists()){ System.out.println("File do not exist"); } else { - URI uri = file.toURI(); + final URI uri = file.toURI(); System.out.println("State of player "+ i +": " + player[i].getState().toString()); System.out.println("...initializing stream "+ i +"..."); player[i].initStream(uri, GLMediaPlayer.STREAM_ID_NONE, GLMediaPlayer.STREAM_ID_AUTO, GLMediaPlayer.TEXTURE_COUNT_DEFAULT); } } - } catch (Exception e1) { + } catch (final Exception e1) { e1.printStackTrace(); } } else { @@ -159,17 +159,17 @@ public class CrossFadePlayer // Main thread CrossFade until playback is done - long startTime = com.jogamp.common.os.Platform.currentTimeMillis(); - double piPlayers = Math.PI*2.0f/args.length; + final long startTime = com.jogamp.common.os.Platform.currentTimeMillis(); + final double piPlayers = Math.PI*2.0f/args.length; StreamException se = null; while( null == se && stop == false ) { try { Thread.sleep(100); - } catch (InterruptedException e) { } + } catch (final InterruptedException e) { } // Find out the longest duration... float maxDuration = 1000.0f ; - for(GLMediaPlayer p: player) { + for(final GLMediaPlayer p: player) { if(p!=null){ if( p.getDuration() > maxDuration) { maxDuration = p.getDuration(); @@ -178,15 +178,15 @@ public class CrossFadePlayer } // tune the volume on players to crossfade! - float progress = (com.jogamp.common.os.Platform.currentTimeMillis()-startTime)/maxDuration; + final float progress = (com.jogamp.common.os.Platform.currentTimeMillis()-startTime)/maxDuration; i = 0; - for(GLMediaPlayer p: player){ + for(final GLMediaPlayer p: player){ if(p!=null){ - AudioSink sink = p.getAudioSink(); + final AudioSink sink = p.getAudioSink(); if(sink != null){ - float volume = (float) (0.5f+(0.5f*(Math.cos(40.0f*progress+(piPlayers*i))))); - float playbacktime = com.jogamp.common.os.Platform.currentTimeMillis()-startTime; + final float volume = (float) (0.5f+(0.5f*(Math.cos(40.0f*progress+(piPlayers*i))))); + final float playbacktime = com.jogamp.common.os.Platform.currentTimeMillis()-startTime; // System.out.println("player: "+ i +" volume = " + volume +" progress = "+ progress +" time = "+ playbacktime + " / duration = " + maxDuration); sink.setVolume(volume); } @@ -202,7 +202,7 @@ public class CrossFadePlayer } } - for(GLMediaPlayer p: player) { + for(final GLMediaPlayer p: player) { if(p!=null) p.destroy(null); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java index 42c1234da..607bfd1b0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java @@ -88,7 +88,7 @@ public class MovieCube implements GLEventListener { // Blender's Big Buck Bunny Trailer: 24f 640p VP8, Vorbis 44100Hz mono, WebM/Matroska Stream. // _defURI = new URI("http://video.webmfiles.org/big-buck-bunny_trailer.webm"); _defURI = new URI("http://archive.org/download/BigBuckBunny_328/BigBuckBunny_512kb.mp4"); - } catch (URISyntaxException e) { + } catch (final URISyntaxException e) { e.printStackTrace(); } defURI = _defURI; @@ -107,10 +107,10 @@ public class MovieCube implements GLEventListener { mPlayer.addEventListener(new GLMediaEventListener() { @Override - public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) { } + public void newFrameAvailable(final GLMediaPlayer ts, final TextureFrame newFrame, final long when) { } @Override - public void attributesChanged(final GLMediaPlayer mp, int event_mask, long when) { + public void attributesChanged(final GLMediaPlayer mp, final int event_mask, final long when) { System.err.println("MovieCube AttributesChanges: events_mask 0x"+Integer.toHexString(event_mask)+", when "+when); System.err.println("MovieCube State: "+mp); if( 0 != ( GLMediaEventListener.EVENT_CHANGE_SIZE & event_mask ) ) { @@ -131,7 +131,7 @@ public class MovieCube implements GLEventListener { while( null == se && GLMediaPlayer.State.Initialized != mPlayer.getState() ) { try { Thread.sleep(16); - } catch (InterruptedException e) { } + } catch (final InterruptedException e) { } se = mPlayer.getStreamException(); } if( null != se ) { @@ -143,7 +143,7 @@ public class MovieCube implements GLEventListener { /** * Custom constructor, user needs to issue {@link #initStream(URI, int, int, int)} afterwards. */ - public MovieCube(float zoom0, float rotx, float roty, boolean showText) throws IOException { + public MovieCube(final float zoom0, final float rotx, final float roty, final boolean showText) throws IOException { this.zoom0 = zoom0; this.rotx = rotx; this.roty = roty; @@ -151,12 +151,12 @@ public class MovieCube implements GLEventListener { mPlayer = GLMediaPlayerFactory.createDefault(); } - public void initStream(URI streamLoc, int vid, int aid, int textureCount) { + public void initStream(final URI streamLoc, final int vid, final int aid, final int textureCount) { mPlayer.initStream(streamLoc, vid, aid, textureCount); System.out.println("pC.1b "+mPlayer); } - public void setSwapInterval(int v) { this.swapInterval = v; } + public void setSwapInterval(final int v) { this.swapInterval = v; } public GLMediaPlayer getGLMediaPlayer() { return mPlayer; } @@ -191,7 +191,7 @@ public class MovieCube implements GLEventListener { } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { // non-exclusive mode! this.setSharedPMVMatrix(cube.pmvMatrix); super.init(drawable); @@ -208,7 +208,7 @@ public class MovieCube implements GLEventListener { } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { if( null != regionFPS ) { regionFPS.destroy(drawable.getGL().getGL2ES2()); } @@ -216,7 +216,7 @@ public class MovieCube implements GLEventListener { } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { final GLAnimatorControl anim = drawable.getAnimator(); final float lfps = null != anim ? anim.getLastFPS() : 0f; final float tfps = null != anim ? anim.getTotalFPS() : 0f; @@ -270,7 +270,7 @@ public class MovieCube implements GLEventListener { private boolean displayOSD = true; private final KeyListener keyAction = new KeyAdapter() { - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { if( e.isAutoRepeat() ) { return; } @@ -345,7 +345,7 @@ public class MovieCube implements GLEventListener { }; @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { if(null == mPlayer) { throw new InternalError("mPlayer null"); } @@ -357,7 +357,7 @@ public class MovieCube implements GLEventListener { } resetGLState = false; - GL2ES2 gl = drawable.getGL().getGL2ES2(); + final GL2ES2 gl = drawable.getGL().getGL2ES2(); System.err.println(JoglVersion.getGLInfo(gl, null)); cube = new TextureSequenceCubeES2(mPlayer, false, zoom0, rotx, roty); @@ -369,7 +369,7 @@ public class MovieCube implements GLEventListener { if( GLMediaPlayer.State.Initialized == mPlayer.getState() ) { try { mPlayer.initGL(gl); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); if(null != mPlayer) { mPlayer.destroy(gl); @@ -400,13 +400,13 @@ public class MovieCube implements GLEventListener { } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { if(null == mPlayer) { return; } cube.reshape(drawable, x, y, width, height); } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { System.err.println(Thread.currentThread()+" MovieCube.dispose ... "); if( null != textRendererGLEL ) { drawable.disposeGLEventListener(textRendererGLEL, true); @@ -415,7 +415,7 @@ public class MovieCube implements GLEventListener { disposeImpl(drawable, true); } - private void disposeImpl(GLAutoDrawable drawable, boolean disposePlayer) { + private void disposeImpl(final GLAutoDrawable drawable, final boolean disposePlayer) { if(null == mPlayer) { return; } final Object upstreamWidget = drawable.getUpstreamWidget(); if (upstreamWidget instanceof Window) { @@ -433,7 +433,7 @@ public class MovieCube implements GLEventListener { @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { if(-1 != swapInterval) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there) @@ -459,7 +459,7 @@ public class MovieCube implements GLEventListener { cube.display(drawable); } - public static void main(String[] args) throws IOException, InterruptedException, URISyntaxException { + public static void main(final String[] args) throws IOException, InterruptedException, URISyntaxException { int swapInterval = 1; int width = 800; int height = 600; @@ -557,7 +557,7 @@ public class MovieCube implements GLEventListener { final GLWindow window = GLWindow.create(caps); final Animator anim = new Animator(window); window.addWindowListener(new WindowAdapter() { - public void windowDestroyed(WindowEvent e) { + public void windowDestroyed(final WindowEvent e) { anim.stop(); } }); @@ -568,11 +568,11 @@ public class MovieCube implements GLEventListener { mc.mPlayer.addEventListener(new GLMediaEventListener() { @Override - public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) { + public void newFrameAvailable(final GLMediaPlayer ts, final TextureFrame newFrame, final long when) { } @Override - public void attributesChanged(final GLMediaPlayer mp, int event_mask, long when) { + public void attributesChanged(final GLMediaPlayer mp, final int event_mask, final long when) { System.err.println("MovieCube AttributesChanges: events_mask 0x"+Integer.toHexString(event_mask)+", when "+when); System.err.println("MovieCube State: "+mp); if( 0 != ( GLMediaEventListener.EVENT_CHANGE_SIZE & event_mask ) ) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java index 7b6dd162a..8760cd2c3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java @@ -129,7 +129,7 @@ public class MovieSimple implements GLEventListener { // Blender's Big Buck Bunny Trailer: 24f 640p VP8, Vorbis 44100Hz mono, WebM/Matroska Stream. // _defURI = new URI("http://video.webmfiles.org/big-buck-bunny_trailer.webm"); _defURI = new URI("http://archive.org/download/BigBuckBunny_328/BigBuckBunny_512kb.mp4"); - } catch (URISyntaxException e) { + } catch (final URISyntaxException e) { e.printStackTrace(); } defURI = _defURI; @@ -159,12 +159,12 @@ public class MovieSimple implements GLEventListener { } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { super.init(drawable); } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { if( null != regionFPS ) { regionFPS.destroy(drawable.getGL().getGL2ES2()); } @@ -172,7 +172,7 @@ public class MovieSimple implements GLEventListener { } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { final GLAnimatorControl anim = drawable.getAnimator(); final float lfps = null != anim ? anim.getLastFPS() : 0f; final float tfps = null != anim ? anim.getTotalFPS() : 0f; @@ -212,7 +212,7 @@ public class MovieSimple implements GLEventListener { private boolean displayOSD = true; private final MouseListener mouseAction = new MouseAdapter() { - public void mousePressed(MouseEvent e) { + public void mousePressed(final MouseEvent e) { if(e.getY()<=surfHeight/2 && null!=mPlayer && 1 == e.getClickCount()) { if(GLMediaPlayer.State.Playing == mPlayer.getState()) { mPlayer.pause(false); @@ -221,20 +221,20 @@ public class MovieSimple implements GLEventListener { } } } - public void mouseReleased(MouseEvent e) { + public void mouseReleased(final MouseEvent e) { if(e.getY()<=surfHeight/2) { rotate = -1; zoom = zoom0; System.err.println("zoom: "+zoom); } } - public void mouseMoved(MouseEvent e) { + public void mouseMoved(final MouseEvent e) { prevMouseX = e.getX(); // prevMouseY = e.getY(); } - public void mouseDragged(MouseEvent e) { - int x = e.getX(); - int y = e.getY(); + public void mouseDragged(final MouseEvent e) { + final int x = e.getX(); + final int y = e.getY(); if(y>surfHeight/2) { final float dp = (float)(x-prevMouseX)/(float)surfWidth; @@ -249,7 +249,7 @@ public class MovieSimple implements GLEventListener { prevMouseX = x; // prevMouseY = y; } - public void mouseWheelMoved(MouseEvent e) { + public void mouseWheelMoved(final MouseEvent e) { if( !e.isShiftDown() ) { zoom += e.getRotation()[1]/10f; // vertical: wheel System.err.println("zoom: "+zoom); @@ -257,7 +257,7 @@ public class MovieSimple implements GLEventListener { } }; private final KeyListener keyAction = new KeyAdapter() { - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { if( e.isAutoRepeat() ) { return; } @@ -343,10 +343,10 @@ public class MovieSimple implements GLEventListener { mPlayer.addEventListener(new GLMediaEventListener() { @Override - public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) { } + public void newFrameAvailable(final GLMediaPlayer ts, final TextureFrame newFrame, final long when) { } @Override - public void attributesChanged(final GLMediaPlayer mp, int event_mask, long when) { + public void attributesChanged(final GLMediaPlayer mp, final int event_mask, final long when) { System.err.println("MovieCube AttributesChanges: events_mask 0x"+Integer.toHexString(event_mask)+", when "+when); System.err.println("MovieCube State: "+mp); if( 0 != ( GLMediaEventListener.EVENT_CHANGE_SIZE & event_mask ) ) { @@ -367,7 +367,7 @@ public class MovieSimple implements GLEventListener { while( null == se && GLMediaPlayer.State.Initialized != mPlayer.getState() ) { try { Thread.sleep(16); - } catch (InterruptedException e) { } + } catch (final InterruptedException e) { } se = mPlayer.getStreamException(); } if( null != se ) { @@ -377,7 +377,7 @@ public class MovieSimple implements GLEventListener { } /** Custom constructor, user needs to issue {@link #initStream(URI, int, int, int)} afterwards. */ - public MovieSimple(GLMediaPlayer sharedMediaPlayer) throws IllegalStateException { + public MovieSimple(final GLMediaPlayer sharedMediaPlayer) throws IllegalStateException { mPlayer = sharedMediaPlayer; mPlayerScaleOrig = false; mPlayerShared = null != mPlayer; @@ -388,26 +388,26 @@ public class MovieSimple implements GLEventListener { System.out.println("pC.1a shared "+mPlayerShared+", "+mPlayer); } - public void initStream(URI streamLoc, int vid, int aid, int textureCount) { + public void initStream(final URI streamLoc, final int vid, final int aid, final int textureCount) { mPlayer.initStream(streamLoc, vid, aid, textureCount); System.out.println("pC.1b "+mPlayer); } - public void setSwapInterval(int v) { this.swapInterval = v; } + public void setSwapInterval(final int v) { this.swapInterval = v; } public GLMediaPlayer getGLMediaPlayer() { return mPlayer; } - public void setScaleOrig(boolean v) { + public void setScaleOrig(final boolean v) { mPlayerScaleOrig = v; } /** defaults to true */ - public void setOrthoProjection(boolean v) { orthoProjection=v; } + public void setOrthoProjection(final boolean v) { orthoProjection=v; } public boolean getOrthoProjection() { return orthoProjection; } - public boolean hasEffect(int e) { return 0 != ( effects & e ) ; } - public void setEffects(int e) { effects = e; }; - public void setTransparency(float alpha) { + public boolean hasEffect(final int e) { return 0 != ( effects & e ) ; } + public void setEffects(final int e) { effects = e; }; + public void setTransparency(final float alpha) { this.effects |= EFFECT_TRANSPARENT; this.alpha = alpha; } @@ -416,11 +416,11 @@ public class MovieSimple implements GLEventListener { resetGLState = true; } - private void initShader(GL2ES2 gl) { + private void initShader(final GL2ES2 gl) { // Create & Compile the shader objects - ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, MovieSimple.class, + final ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, MovieSimple.class, "../shader", "../shader/bin", shaderBasename, true); - ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, MovieSimple.class, + final ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, MovieSimple.class, "../shader", "../shader/bin", shaderBasename, true); boolean preludeGLSLVersion = true; @@ -451,7 +451,7 @@ public class MovieSimple implements GLEventListener { rsFp.insertShaderSource(0, "TEXTURE-SEQUENCE-CODE-BEGIN", 0, sFpIns); // Create & Link the shader program - ShaderProgram sp = new ShaderProgram(); + final ShaderProgram sp = new ShaderProgram(); sp.add(rsVp); sp.add(rsFp); if(!sp.link(gl, System.err)) { @@ -464,7 +464,7 @@ public class MovieSimple implements GLEventListener { } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { if(null == mPlayer) { throw new InternalError("mPlayer null"); } @@ -478,7 +478,7 @@ public class MovieSimple implements GLEventListener { zoom1 = orthoProjection ? 0f : -5f; zoom = zoom0; - GL2ES2 gl = drawable.getGL().getGL2ES2(); + final GL2ES2 gl = drawable.getGL().getGL2ES2(); System.err.println(JoglVersion.getGLInfo(gl, null)); System.err.println("Alpha: "+alpha+", opaque "+drawable.getChosenGLCapabilities().isBackgroundOpaque()+ ", "+drawable.getClass().getName()+", "+drawable); @@ -511,7 +511,7 @@ public class MovieSimple implements GLEventListener { if(!mPlayerShared) { mPlayer.setTextureMinMagFilter( new int[] { GL.GL_NEAREST, GL.GL_LINEAR } ); } - } catch (Exception glex) { + } catch (final Exception glex) { glex.printStackTrace(); if(!mPlayerShared && null != mPlayer) { mPlayer.destroy(gl); @@ -526,7 +526,7 @@ public class MovieSimple implements GLEventListener { // Push the 1st uniform down the path st.useProgram(gl, true); - int[] viewPort = new int[] { 0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()}; + final int[] viewPort = new int[] { 0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()}; pmvMatrix = new PMVMatrix(); reshapePMV(viewPort[2], viewPort[3]); pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); @@ -537,11 +537,11 @@ public class MovieSimple implements GLEventListener { throw new GLException("Error setting mgl_ActiveTexture in shader: "+st); } - float dWidth = drawable.getSurfaceWidth(); - float dHeight = drawable.getSurfaceHeight(); - float mWidth = mPlayer.getWidth(); - float mHeight = mPlayer.getHeight(); - float mAspect = mWidth/mHeight; + final float dWidth = drawable.getSurfaceWidth(); + final float dHeight = drawable.getSurfaceHeight(); + final float mWidth = mPlayer.getWidth(); + final float mHeight = mPlayer.getHeight(); + final float mAspect = mWidth/mHeight; System.err.println("XXX0: mov aspect: "+mAspect); float xs, ys; if(orthoProjection) { @@ -563,8 +563,8 @@ public class MovieSimple implements GLEventListener { { System.err.println("XXX0: pixel LB: "+verts[0]+", "+verts[1]+", "+verts[2]); System.err.println("XXX0: pixel RT: "+verts[3]+", "+verts[4]+", "+verts[5]); - float[] winLB = new float[3]; - float[] winRT = new float[3]; + final float[] winLB = new float[3]; + final float[] winRT = new float[3]; pmvMatrix.gluProject(verts[0], verts[1], verts[2], viewPort, 0, winLB, 0); pmvMatrix.gluProject(verts[3], verts[4], verts[5], viewPort, 0, winRT, 0); System.err.println("XXX0: win LB: "+winLB[0]+", "+winLB[1]+", "+winLB[2]); @@ -582,7 +582,7 @@ public class MovieSimple implements GLEventListener { st.ownAttribute(interleavedVBO, true); gl.glClearColor(0.3f, 0.3f, 0.3f, 0.3f); - gl.glEnable(GL2ES2.GL_DEPTH_TEST); + gl.glEnable(GL.GL_DEPTH_TEST); st.useProgram(gl, false); @@ -611,7 +611,7 @@ public class MovieSimple implements GLEventListener { drawable.addGLEventListener(textRendererGLEL); } - protected void updateInterleavedVBO(GL gl, Texture tex) { + protected void updateInterleavedVBO(final GL gl, final Texture tex) { final float ss = 1f, ts = 1f; // scale tex-coord final boolean wasEnabled = interleavedVBO.enabled(); interleavedVBO.seal(gl, false); @@ -666,7 +666,7 @@ public class MovieSimple implements GLEventListener { } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); if(null == mPlayer) { return; } surfWidth = width; @@ -682,7 +682,7 @@ public class MovieSimple implements GLEventListener { System.out.println("pR "+mPlayer); } - private void reshapePMV(int width, int height) { + private void reshapePMV(final int width, final int height) { pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); if(orthoProjection) { @@ -702,13 +702,13 @@ public class MovieSimple implements GLEventListener { } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { drawable.disposeGLEventListener(textRendererGLEL, true); textRendererGLEL = null; disposeImpl(drawable, true); } - private void disposeImpl(GLAutoDrawable drawable, boolean disposePlayer) { + private void disposeImpl(final GLAutoDrawable drawable, final boolean disposePlayer) { if(null == mPlayer) { return; } final Object upstreamWidget = drawable.getUpstreamWidget(); @@ -719,7 +719,7 @@ public class MovieSimple implements GLEventListener { } System.out.println("pD.1 "+mPlayer+", disposePlayer "+disposePlayer); - GL2ES2 gl = drawable.getGL().getGL2ES2(); + final GL2ES2 gl = drawable.getGL().getGL2ES2(); if( disposePlayer ) { if(!mPlayerShared) { mPlayer.destroy(gl); @@ -740,7 +740,7 @@ public class MovieSimple implements GLEventListener { long lastPerfPos = 0; @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); if(-1 != swapInterval) { gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there) @@ -815,11 +815,11 @@ public class MovieSimple implements GLEventListener { } @Override - public void newFrameAvailable(GLMediaPlayer ts, TextureFrame newFrame, long when) { + public void newFrameAvailable(final GLMediaPlayer ts, final TextureFrame newFrame, final long when) { } @Override - public void attributesChanged(final GLMediaPlayer mp, int event_mask, long when) { + public void attributesChanged(final GLMediaPlayer mp, final int event_mask, final long when) { System.err.println("MovieSimple AttributesChanges: events_mask 0x"+Integer.toHexString(event_mask)+", when "+when); System.err.println("MovieSimple State: "+mp); final GLWindow window = (GLWindow) mp.getAttachedObject(WINDOW_KEY); @@ -908,7 +908,7 @@ public class MovieSimple implements GLEventListener { static boolean loopEOS = false; static boolean origSize; - public static void main(String[] args) throws IOException, URISyntaxException { + public static void main(final String[] args) throws IOException, URISyntaxException { int swapInterval = 1; int width = 800; int height = 600; @@ -934,7 +934,7 @@ public class MovieSimple implements GLEventListener { } windowCount = _windowCount; } - String[] urls_s = new String[windowCount]; + final String[] urls_s = new String[windowCount]; String file_s1=null, file_s2=null; { boolean _origSize = false; @@ -997,7 +997,7 @@ public class MovieSimple implements GLEventListener { if( null != urls_s[0] ) { streamLoc0 = new URI(urls_s[0]); } else if( null != file_s1 ) { - File movieFile = new File(file_s1); + final File movieFile = new File(file_s1); streamLoc0 = movieFile.toURI(); } else if( null != file_s2 ) { streamLoc0 = IOUtil.toURISimple(new File(file_s2)); @@ -1038,7 +1038,7 @@ public class MovieSimple implements GLEventListener { anim.start(); windows[i] = GLWindow.create(caps); windows[i].addWindowListener(new WindowAdapter() { - public void windowDestroyed(WindowEvent e) { + public void windowDestroyed(final WindowEvent e) { anim.stop(); } }); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas01.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas01.java index 4cecd90a1..9866e769c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas01.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -61,7 +61,7 @@ public class Bug816AppletGLCanvas01 extends Applet implements GLEventListener { public static JPanel appletHolder; public static boolean isApplet = true; - static public void main(String args[]) { + static public void main(final String args[]) { Applet myApplet = null; isApplet = false; @@ -69,7 +69,7 @@ public class Bug816AppletGLCanvas01 extends Applet implements GLEventListener { appletStarter(myApplet, "Bug861AppletGLCanvasTest01", 800, 600); } - static public void appletStarter(final Applet des, String frameName, int width, int height) { + static public void appletStarter(final Applet des, final String frameName, final int width, final int height) { appletHolder = new JPanel(); if (frame != null) { frame.dispose(); @@ -84,16 +84,16 @@ public class Bug816AppletGLCanvas01 extends Applet implements GLEventListener { appletHolder.add(des); frame.setVisible(true); - int frameBorderSize = appletHolder.getLocationOnScreen().x - frame.getLocationOnScreen().x; - int titleBarHeight = appletHolder.getLocationOnScreen().y - frame.getLocationOnScreen().y; - int frameWidth = width + 2 * frameBorderSize; - int frameHeight = height + titleBarHeight + frameBorderSize; + final int frameBorderSize = appletHolder.getLocationOnScreen().x - frame.getLocationOnScreen().x; + final int titleBarHeight = appletHolder.getLocationOnScreen().y - frame.getLocationOnScreen().y; + final int frameWidth = width + 2 * frameBorderSize; + final int frameHeight = height + titleBarHeight + frameBorderSize; frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(frameWidth, frameHeight); frame.setVisible(true); des.init(); frame.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { + public void windowClosing(final WindowEvent e) { System.exit(0); } }); @@ -107,28 +107,28 @@ public class Bug816AppletGLCanvas01 extends Applet implements GLEventListener { setBackground(Color.gray); setLayout(null); - GLProfile glp = GLProfile.getDefault(); - GLCapabilities caps = new GLCapabilities(glp); - GLCanvas canvas = new GLCanvas((GLCapabilitiesImmutable) caps); + final GLProfile glp = GLProfile.getDefault(); + final GLCapabilities caps = new GLCapabilities(glp); + final GLCanvas canvas = new GLCanvas(caps); canvas.setBounds(50, 50, 200, 450); canvas.addGLEventListener(this); add(canvas); } - public void init(GLAutoDrawable gLAutoDrawable) { - GL gl = gLAutoDrawable.getGL(); + public void init(final GLAutoDrawable gLAutoDrawable) { + final GL gl = gLAutoDrawable.getGL(); gl.glClearColor(1.0f, 0.0f, 0.0f, 1.0f); gl.glClear(GL.GL_COLOR_BUFFER_BIT); gLAutoDrawable.swapBuffers(); } - public void dispose(GLAutoDrawable glad) { + public void dispose(final GLAutoDrawable glad) { } - public void display(GLAutoDrawable glad) { + public void display(final GLAutoDrawable glad) { } - public void reshape(GLAutoDrawable glad, int i, int i1, int i2, int i3) { + public void reshape(final GLAutoDrawable glad, final int i, final int i1, final int i2, final int i3) { } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas02a.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas02a.java index 3bbb423fd..6218edd50 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas02a.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas02a.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -62,7 +62,7 @@ public class Bug816AppletGLCanvas02a extends Applet { } private GLCanvas createCanvas() { - GLCanvas canvas = new GLCanvas(); + final GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener(new GearsES2(1)); canvas.setSize(300, 300); animator.add(canvas); @@ -72,7 +72,7 @@ public class Bug816AppletGLCanvas02a extends Applet { String currentThreadName() { return Thread.currentThread().getName(); } - + @Override public void start() { System.err.println("GearsApplet: start() - begin [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas02b.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas02b.java index 87a7ea4f5..62eb8ea18 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas02b.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletGLCanvas02b.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -62,7 +62,7 @@ public class Bug816AppletGLCanvas02b extends Applet { } private GLCanvas createCanvas() { - GLCanvas canvas = new GLCanvas(); + final GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener(new GearsES2(1)); canvas.setSize(300, 300); animator.add(canvas); @@ -72,7 +72,7 @@ public class Bug816AppletGLCanvas02b extends Applet { String currentThreadName() { return Thread.currentThread().getName(); } - + @Override public void start() { System.err.println("GearsApplet: start() - begin [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletOSXCALayerPos03a.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletOSXCALayerPos03a.java index a0ce938fe..32122937e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletOSXCALayerPos03a.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletOSXCALayerPos03a.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -59,24 +59,24 @@ public class Bug816AppletOSXCALayerPos03a extends Applet { @Override public void init() { System.err.println("GearsApplet: init() - begin [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName()); - GLProfile glp = GLProfile.getDefault(); + final GLProfile glp = GLProfile.getDefault(); final GLCapabilities caps = new GLCapabilities(glp); final GLCanvas glCanvas1 = new GLCanvas(caps); glCanvas1.addGLEventListener(new GearsES2(1)); - + animator = new Animator(); animator.add(glCanvas1); setLayout(new BorderLayout()); - - // Build a GUI where the canvas 3D is located at top right of the frame + + // Build a GUI where the canvas 3D is located at top right of the frame // and can be resized with split panes dividers - JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, - true, new JScrollPane(), glCanvas1); + final JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, + true, new JScrollPane(), glCanvas1); verticalSplitPane.setResizeWeight(0.5); - JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, + final JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, new JScrollPane(), verticalSplitPane); horizontalSplitPane.setResizeWeight(0.5); - JRootPane intermediateRootPane = new JRootPane(); + final JRootPane intermediateRootPane = new JRootPane(); intermediateRootPane.setContentPane(horizontalSplitPane); add(intermediateRootPane, BorderLayout.CENTER); System.err.println("GearsApplet: init() - end [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName()); @@ -85,7 +85,7 @@ public class Bug816AppletOSXCALayerPos03a extends Applet { String currentThreadName() { return Thread.currentThread().getName(); } - + @Override public void start() { System.err.println("GearsApplet: start() - begin [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletOSXCALayerPos03b.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletOSXCALayerPos03b.java index 48dac25e8..491bc5fbc 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletOSXCALayerPos03b.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug816AppletOSXCALayerPos03b.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -57,24 +57,24 @@ public class Bug816AppletOSXCALayerPos03b extends JApplet { @Override public void init() { System.err.println("GearsApplet: init() - begin [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName()); - GLProfile glp = GLProfile.getDefault(); + final GLProfile glp = GLProfile.getDefault(); final GLCapabilities caps = new GLCapabilities(glp); final GLCanvas glCanvas1 = new GLCanvas(caps); glCanvas1.addGLEventListener(new GearsES2(1)); - + animator = new Animator(); animator.add(glCanvas1); setSize(640, 480); - - // Build a GUI where the canvas 3D is located at top right of the frame + + // Build a GUI where the canvas 3D is located at top right of the frame // and can be resized with split panes dividers - JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, - true, new JScrollPane(), glCanvas1); + final JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, + true, new JScrollPane(), glCanvas1); verticalSplitPane.setResizeWeight(0.5); - JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, + final JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, new JScrollPane(), verticalSplitPane); horizontalSplitPane.setResizeWeight(0.5); - JRootPane intermediateRootPane = new JRootPane(); + final JRootPane intermediateRootPane = new JRootPane(); intermediateRootPane.setContentPane(horizontalSplitPane); intermediateRootPane.setSize(640, 480); this.add(intermediateRootPane); @@ -84,7 +84,7 @@ public class Bug816AppletOSXCALayerPos03b extends JApplet { String currentThreadName() { return Thread.currentThread().getName(); } - + @Override public void start() { System.err.println("GearsApplet: start() - begin [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug848AppletGLCanvas01.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug848AppletGLCanvas01.java index c3d40b71d..e85e84cf3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug848AppletGLCanvas01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/Bug848AppletGLCanvas01.java @@ -62,8 +62,8 @@ public class Bug848AppletGLCanvas01 extends Applet { System.err.println("GearsApplet: init() - end [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName()); } - private GLCanvas createCanvas(int vsyncI) { - GLCanvas canvas = new GLCanvas(); + private GLCanvas createCanvas(final int vsyncI) { + final GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener(new GearsES2(vsyncI)); canvas.setSize(300, 300); animators.add(new Animator(canvas)); @@ -77,7 +77,7 @@ public class Bug848AppletGLCanvas01 extends Applet { @Override public void start() { System.err.println("GearsApplet: start() - begin [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName()); - for (GLAnimatorControl control : animators) { + for (final GLAnimatorControl control : animators) { control.start(); control.setUpdateFPSFrames(60, System.err); } @@ -87,7 +87,7 @@ public class Bug848AppletGLCanvas01 extends Applet { @Override public void stop() { System.err.println("GearsApplet: stop() - [visible "+isVisible()+", displayable "+isDisplayable()+"] - "+currentThreadName()); - for (GLAnimatorControl control : animators) { + for (final GLAnimatorControl control : animators) { control.stop(); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java index 6fb972bb5..d8c4341a8 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java @@ -105,7 +105,7 @@ public class TestGearsES2AWT extends UITestCase { public void run() { awtEDT = Thread.currentThread(); } } ); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); Assert.assertNull(e); } @@ -126,7 +126,7 @@ public class TestGearsES2AWT extends UITestCase { frame.pack(); } } } ); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -140,7 +140,7 @@ public class TestGearsES2AWT extends UITestCase { frame.validate(); } } } ); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -163,7 +163,7 @@ public class TestGearsES2AWT extends UITestCase { frame.setTitle("GLCanvas["+capsA+"], swapI "+swapInterval+", win: ["+b.x+"/"+b.y+" "+b.width+"x"+b.height+"], pix: "+glc.getSurfaceWidth()+"x"+glc.getSurfaceHeight()); } - protected void runTestGL(final GLCapabilities caps, final ResizeBy resizeBy, FrameLayout frameLayout) throws InterruptedException, InvocationTargetException { + protected void runTestGL(final GLCapabilities caps, final ResizeBy resizeBy, final FrameLayout frameLayout) throws InterruptedException, InvocationTargetException { final Frame frame = new Frame("GearsES2 AWT Test"); Assert.assertNotNull(frame); @@ -197,7 +197,7 @@ public class TestGearsES2AWT extends UITestCase { frame.add(glCanvas, BorderLayout.CENTER); break; case DoubleBorderCenterSurrounded: - Container c = new Container(); + final Container c = new Container(); c.setLayout(new BorderLayout()); c.add(new Button("north"), BorderLayout.NORTH); c.add(new Button("south"), BorderLayout.SOUTH); @@ -217,20 +217,20 @@ public class TestGearsES2AWT extends UITestCase { frame.addComponentListener(new ComponentListener() { @Override - public void componentResized(ComponentEvent e) { + public void componentResized(final ComponentEvent e) { setTitle(frame, glCanvas, caps); } @Override - public void componentMoved(ComponentEvent e) { + public void componentMoved(final ComponentEvent e) { setTitle(frame, glCanvas, caps); } @Override - public void componentShown(ComponentEvent e) { } + public void componentShown(final ComponentEvent e) { } @Override - public void componentHidden(ComponentEvent e) { } + public void componentHidden(final ComponentEvent e) { } }); final GearsES2 demo = new GearsES2(swapInterval); @@ -414,11 +414,11 @@ public class TestGearsES2AWT extends UITestCase { reqSurfacePixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; reqSurfacePixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; - GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2()); + final GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2()); runTestGL(caps, resizeBy, frameLayout); } - public static void main(String args[]) { + public static void main(final String args[]) { boolean waitForKey = false; int rw=-1, rh=-1; @@ -507,11 +507,11 @@ public class TestGearsES2AWT extends UITestCase { System.err.println("shallUseOffscreenPBufferLayer "+shallUseOffscreenPBufferLayer); if(waitForKey) { - BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); + final BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); System.err.println("Press enter to continue"); try { System.err.println(stdin.readLine()); - } catch (IOException e) { } + } catch (final IOException e) { } } org.junit.runner.JUnitCore.main(TestGearsES2AWT.class.getName()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java index 551b27c3e..dd16b88cc 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java @@ -100,7 +100,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { frame.validate(); } } } ); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -142,20 +142,20 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { frame.addComponentListener(new ComponentListener() { @Override - public void componentResized(ComponentEvent e) { + public void componentResized(final ComponentEvent e) { setTitle(frame, glJPanel, caps); } @Override - public void componentMoved(ComponentEvent e) { + public void componentMoved(final ComponentEvent e) { setTitle(frame, glJPanel, caps); } @Override - public void componentShown(ComponentEvent e) { } + public void componentShown(final ComponentEvent e) { } @Override - public void componentHidden(ComponentEvent e) { } + public void componentHidden(final ComponentEvent e) { } }); final FPSAnimator animator = useAnimator ? new FPSAnimator(glJPanel, 60) : null; @@ -275,7 +275,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { } else { glp = GLProfile.getGL2ES2(); } - GLCapabilities caps = new GLCapabilities( glp ); + final GLCapabilities caps = new GLCapabilities( glp ); if(useMSAA) { caps.setNumSamples(4); caps.setSampleBuffers(true); @@ -296,7 +296,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { if( manualTest ) { return; } - GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); + final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); caps.setNumSamples(4); caps.setSampleBuffers(true); runTestGL(caps); @@ -309,7 +309,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { if( manualTest ) { return; } - GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); + final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); caps.setPBuffer(true); runTestGL(caps); } @@ -321,7 +321,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { if( manualTest ) { return; } - GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); + final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); caps.setNumSamples(4); caps.setSampleBuffers(true); caps.setPBuffer(true); @@ -335,7 +335,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { if( manualTest ) { return; } - GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); + final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); caps.setBitmap(true); runTestGL(caps); } @@ -347,7 +347,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { if( manualTest ) { return; } - GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); + final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); caps.setNumSamples(4); caps.setSampleBuffers(true); caps.setBitmap(true); @@ -398,13 +398,13 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { reqSurfacePixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; reqSurfacePixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; - GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); + final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); runTestGL(caps); } static long duration = 500; // ms - public static void main(String args[]) { + public static void main(final String args[]) { int w=640, h=480, rw=-1, rh=-1; for(int i=0; i flicker - due to JComponent _paintImmediately(..) (?) - static boolean glOpaque = true; // can be either .. + static boolean glOpaque = true; // can be either .. static float glAlpha = 0.3f; static boolean jZOrder = false; static GLProfile glp; @@ -81,13 +81,13 @@ public class TestGearsES2GLJPanelsAWT extends UITestCase { static boolean manualTest = false; static boolean initSingleBuffer = false; - /** - * Even though GLJPanel uses a SingleAWTGLPixelBufferProvider per default, - * we like to initialize it's size to a common maximum to ensure + /** + * Even though GLJPanel uses a SingleAWTGLPixelBufferProvider per default, + * we like to initialize it's size to a common maximum to ensure * only one {@link AWTGLPixelBuffer} gets allocated. */ static SingleAWTGLPixelBufferProvider singleAWTGLPixelBufferProvider; - + @BeforeClass public static void initClass() { if(GLProfile.isAvailable(GLProfile.GL2)) { @@ -96,7 +96,7 @@ public class TestGearsES2GLJPanelsAWT extends UITestCase { } else { setTestSupported(false); } - + if( initSingleBuffer ) { singleAWTGLPixelBufferProvider = new SingleAWTGLPixelBufferProvider( glp.isGL2ES3() /* allowRowStride */); singleAWTGLPixelBufferProvider.initSingleton(4, 600, 600, 1, true); @@ -108,12 +108,12 @@ public class TestGearsES2GLJPanelsAWT extends UITestCase { @AfterClass public static void releaseClass() { } - + final static boolean useInterPanel = true; - + /** Adds new JPanel to frame's content pane at index 0 */ - private JComponent addPanel(GLCapabilitiesImmutable caps, GLAnimatorControl anim, final JFrame frame, boolean opaque, int x, int y, int w, int h, FloatBuffer color, float[] clearColor) - throws InterruptedException, InvocationTargetException + private JComponent addPanel(final GLCapabilitiesImmutable caps, final GLAnimatorControl anim, final JFrame frame, final boolean opaque, final int x, final int y, final int w, final int h, final FloatBuffer color, final float[] clearColor) + throws InterruptedException, InvocationTargetException { final GLJPanel canvas = new GLJPanel(caps); if( initSingleBuffer ) { @@ -127,7 +127,7 @@ public class TestGearsES2GLJPanelsAWT extends UITestCase { if( caps.isBitmap() ) { demo = new Gears(swapInterval); } else { - GearsES2 gdemo = new GearsES2(swapInterval); + final GearsES2 gdemo = new GearsES2(swapInterval); gdemo.setIgnoreFocus(true); gdemo.setGearsColors(color, color, color); gdemo.setClearColor(clearColor); @@ -145,12 +145,12 @@ public class TestGearsES2GLJPanelsAWT extends UITestCase { panel.setBounds(x, y, w, h); panel.setOpaque(opaque); text = new JTextField(x+"/"+y+" "+w+"x"+h); - text.setOpaque(true); + text.setOpaque(true); } else { panel = null; text = null; } - + SwingUtilities.invokeAndWait(new Runnable() { public void run() { if ( useInterPanel ) { @@ -164,7 +164,7 @@ public class TestGearsES2GLJPanelsAWT extends UITestCase { return useInterPanel ? panel : canvas; } - public static final FloatBuffer red = Buffers.newDirectFloatBuffer( new float[] { 1.0f, 0.0f, 0.0f, 1.0f } ); + public static final FloatBuffer red = Buffers.newDirectFloatBuffer( new float[] { 1.0f, 0.0f, 0.0f, 1.0f } ); public static final FloatBuffer green = Buffers.newDirectFloatBuffer( new float[] { 0.0f, 1.0f, 0.0f, 1.0f } ); public static final FloatBuffer blue = Buffers.newDirectFloatBuffer( new float[] { 0.0f, 0.0f, 1.0f, 1.0f } ); public static final FloatBuffer yellow = Buffers.newDirectFloatBuffer( new float[] { 1.0f, 1.0f, 0.0f, 1.0f } ); @@ -175,43 +175,43 @@ public class TestGearsES2GLJPanelsAWT extends UITestCase { public static final float[] blueish = new float[] { 0.0f, 0.0f, grayf, glAlpha }; public static final float[] yellowish = new float[] { grayf, grayf, 0.0f, glAlpha }; public static final float[] greyish = new float[] { grayf, grayf, grayf, glAlpha }; - - protected void relayout(Container cont, float oW, float oH) { + + protected void relayout(final Container cont, final float oW, final float oH) { final int count = cont.getComponentCount(); final int nW = cont.getWidth(); final int nH = cont.getHeight(); for(int i = 0 ; i < count; i++ ) { final Component comp = cont.getComponent(i); - float fx = comp.getX() / oW; - float fy = comp.getY() / oH; - float fw = comp.getWidth() / oW; - float fh = comp.getHeight() / oH; + final float fx = comp.getX() / oW; + final float fy = comp.getY() / oH; + final float fw = comp.getWidth() / oW; + final float fh = comp.getHeight() / oH; comp.setBounds( (int)(fx * nW), (int)(fy * nH), (int)(fw * nW), (int)(fh * nH) ); } } - - protected void runTestGL(GLCapabilities caps) + + protected void runTestGL(final GLCapabilities caps) throws AWTException, InterruptedException, InvocationTargetException { if( !glOpaque ) { caps.setAlphaBits(caps.getRedBits()); } - + final JFrame frame = new JFrame("Swing GLJPanel"); Assert.assertNotNull(frame); - + final FPSAnimator animator = useAnimator ? new FPSAnimator(60) : null; SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame.getContentPane().setLayout(null); } } ); - + final float[] oldSize = new float[] { 600f, 600f }; - + frame.addComponentListener(new ComponentAdapter() { @Override - public void componentResized(ComponentEvent e) { + public void componentResized(final ComponentEvent e) { final int count = frame.getComponentCount(); for(int i = 0 ; i < count; i++ ) { relayout(frame.getContentPane(), oldSize[0], oldSize[1]); @@ -243,7 +243,7 @@ public class TestGearsES2GLJPanelsAWT extends UITestCase { cont.setComponentZOrder(cont.getComponent(i), count - 1 - i); } } - + SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame.setSize((int)oldSize[0], (int)oldSize[1]); @@ -258,7 +258,7 @@ public class TestGearsES2GLJPanelsAWT extends UITestCase { Assert.assertEquals(true, animator.isAnimating()); } - QuitAdapter quitAdapter = new QuitAdapter(); + final QuitAdapter quitAdapter = new QuitAdapter(); final long t0 = System.currentTimeMillis(); long t1 = t0; @@ -287,7 +287,7 @@ public class TestGearsES2GLJPanelsAWT extends UITestCase { public void test01_DefaultNorm() throws AWTException, InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); + final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); if(useMSAA) { caps.setNumSamples(4); caps.setSampleBuffers(true); @@ -308,12 +308,12 @@ public class TestGearsES2GLJPanelsAWT extends UITestCase { if( manualTest ) { return; } - GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); + final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); caps.setNumSamples(4); caps.setSampleBuffers(true); runTestGL(caps); } - + @Test public void test03_PbufferNorm() throws AWTException, InterruptedException, InvocationTargetException @@ -321,11 +321,11 @@ public class TestGearsES2GLJPanelsAWT extends UITestCase { if( manualTest ) { return; } - GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); + final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); caps.setPBuffer(true); runTestGL(caps); } - + @Test public void test04_PbufferMsaa() throws AWTException, InterruptedException, InvocationTargetException @@ -333,13 +333,13 @@ public class TestGearsES2GLJPanelsAWT extends UITestCase { if( manualTest ) { return; } - GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); + final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); caps.setNumSamples(4); caps.setSampleBuffers(true); caps.setPBuffer(true); runTestGL(caps); } - + @Test public void test05_BitmapNorm() throws AWTException, InterruptedException, InvocationTargetException @@ -347,11 +347,11 @@ public class TestGearsES2GLJPanelsAWT extends UITestCase { if( manualTest ) { return; } - GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); + final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); caps.setBitmap(true); runTestGL(caps); } - + @Test public void test06_BitmapMsaa() throws AWTException, InterruptedException, InvocationTargetException @@ -359,16 +359,16 @@ public class TestGearsES2GLJPanelsAWT extends UITestCase { if( manualTest ) { return; } - GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); + final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); caps.setNumSamples(4); caps.setSampleBuffers(true); caps.setBitmap(true); runTestGL(caps); } - + static long duration = 500; // ms - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i= 130\n" + " #define attribute in\n" + " #define varying out\n" + - "#endif\n"+ + "#endif\n"+ "\n" + "uniform mat4 mgl_PMVMatrix[2];\n" + "attribute vec4 mgl_Vertex;\n" + @@ -61,7 +61,7 @@ public class RedSquareShader { " #define varying in\n" + " out vec4 mgl_FragColor;\n" + "#else\n" + - " #define mgl_FragColor gl_FragColor\n" + + " #define mgl_FragColor gl_FragColor\n" + "#endif\n" + "\n" + "varying vec4 frontColor;\n" + diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java index b1a4793ff..7ecb63938 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java @@ -35,16 +35,14 @@ import com.jogamp.nativewindow.swt.SWTAccessor; import com.jogamp.opengl.swt.GLCanvas; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; - import com.jogamp.opengl.util.Animator; - +import com.jogamp.opengl.util.AnimatorBase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import javax.media.nativewindow.util.Dimension; import javax.media.nativewindow.util.Point; import javax.media.nativewindow.util.PointImmutable; import javax.media.nativewindow.util.DimensionImmutable; - import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLCapabilitiesImmutable; import javax.media.opengl.GLProfile; @@ -132,7 +130,7 @@ public class TestGearsES2SWT extends UITestCase { display.dispose(); }}); } - catch( Throwable throwable ) { + catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -141,7 +139,7 @@ public class TestGearsES2SWT extends UITestCase { composite = null; } - protected void runTestGL(GLCapabilitiesImmutable caps) throws InterruptedException, InvocationTargetException { + protected void runTestGL(final GLCapabilitiesImmutable caps) throws InterruptedException, InvocationTargetException { System.err.println("requested: vsync "+swapInterval+", "+caps); final GLCanvas canvas = GLCanvas.create( composite, 0, caps, null); @@ -150,8 +148,8 @@ public class TestGearsES2SWT extends UITestCase { final GearsES2 demo = new GearsES2(swapInterval); canvas.addGLEventListener(demo); - Animator animator = new Animator(); - animator.setModeBits(false, Animator.MODE_EXPECT_AWT_RENDERING_THREAD); + final Animator animator = new Animator(); + animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); animator.setExclusiveContext(exclusiveContext); animator.add(canvas); @@ -254,7 +252,7 @@ public class TestGearsES2SWT extends UITestCase { runTestGL(caps); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { mainRun = true; int x=0, y=0, w=640, h=480, rw=-1, rh=-1; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java index 881625ee4..dbc760d15 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java @@ -3,9 +3,12 @@ package com.jogamp.opengl.test.junit.jogl.demos.gl2; import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2GL3; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLProfile; +import javax.media.opengl.fixedfunc.GLLightingFunc; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.newt.Window; import com.jogamp.newt.event.InputEvent; @@ -43,7 +46,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList // private boolean mouseRButtonDown = false; private int prevMouseX, prevMouseY; - public Gears(int swapInterval) { + public Gears(final int swapInterval) { this.swapInterval = swapInterval; } @@ -52,30 +55,30 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList } @Override - public void addTileRendererNotify(TileRendererBase tr) { + public void addTileRendererNotify(final TileRendererBase tr) { tileRendererInUse = tr; doRotateBeforePrinting = doRotate; setDoRotation(false); } @Override - public void removeTileRendererNotify(TileRendererBase tr) { + public void removeTileRendererNotify(final TileRendererBase tr) { tileRendererInUse = null; setDoRotation(doRotateBeforePrinting); } @Override - public void startTileRendering(TileRendererBase tr) { + public void startTileRendering(final TileRendererBase tr) { System.err.println("Gears.startTileRendering: "+tr); } @Override - public void endTileRendering(TileRendererBase tr) { + public void endTileRendering(final TileRendererBase tr) { System.err.println("Gears.endTileRendering: "+tr); } - public void setDoRotation(boolean rotate) { doRotate = rotate; } - public void setVerbose(boolean v) { verbose = v; } - public void setFlipVerticalInGLOrientation(boolean v) { flipVerticalInGLOrientation=v; } + public void setDoRotation(final boolean rotate) { doRotate = rotate; } + public void setVerbose(final boolean v) { verbose = v; } + public void setFlipVerticalInGLOrientation(final boolean v) { flipVerticalInGLOrientation=v; } - public void setGears(int g1, int g2, int g3) { + public void setGears(final int g1, final int g2, final int g3) { gear1 = g1; gear2 = g2; gear3 = g3; @@ -97,8 +100,8 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList public int getGear3() { return gear3; } @Override - public void init(GLAutoDrawable drawable) { - GL2 gl = drawable.getGL().getGL2(); + public void init(final GLAutoDrawable drawable) { + final GL2 gl = drawable.getGL().getGL2(); init(gl); @@ -114,7 +117,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList } } - public void init(GL2 gl) { + public void init(final GL2 gl) { final float lightPos[] = { 5.0f, 5.0f, 10.0f, 0.0f }; final float red[] = { 0.8f, 0.1f, 0.0f, 0.7f }; final float green[] = { 0.0f, 0.8f, 0.2f, 0.7f }; @@ -128,20 +131,20 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList System.err.println(JoglVersion.getGLStrings(gl, null, false).toString()); } - gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, lightPos, 0); + gl.glLightfv(GLLightingFunc.GL_LIGHT0, GLLightingFunc.GL_POSITION, lightPos, 0); if( ! ( flipVerticalInGLOrientation && gl.getContext().getGLDrawable().isGLOriented() ) ) { // Only possible if we do not flip the projection matrix - gl.glEnable(GL2.GL_CULL_FACE); + gl.glEnable(GL.GL_CULL_FACE); } - gl.glEnable(GL2.GL_LIGHTING); - gl.glEnable(GL2.GL_LIGHT0); - gl.glEnable(GL2.GL_DEPTH_TEST); + gl.glEnable(GLLightingFunc.GL_LIGHTING); + gl.glEnable(GLLightingFunc.GL_LIGHT0); + gl.glEnable(GL.GL_DEPTH_TEST); /* make the gears */ if(0>=gear1) { gear1 = gl.glGenLists(1); gl.glNewList(gear1, GL2.GL_COMPILE); - gl.glMaterialfv(GL2.GL_FRONT, GL2.GL_AMBIENT_AND_DIFFUSE, red, 0); + gl.glMaterialfv(GL.GL_FRONT, GLLightingFunc.GL_AMBIENT_AND_DIFFUSE, red, 0); gear(gl, 1.0f, 4.0f, 1.0f, 20, 0.7f); gl.glEndList(); System.err.println("gear1 list created: "+gear1); @@ -152,7 +155,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList if(0>=gear2) { gear2 = gl.glGenLists(1); gl.glNewList(gear2, GL2.GL_COMPILE); - gl.glMaterialfv(GL2.GL_FRONT, GL2.GL_AMBIENT_AND_DIFFUSE, green, 0); + gl.glMaterialfv(GL.GL_FRONT, GLLightingFunc.GL_AMBIENT_AND_DIFFUSE, green, 0); gear(gl, 0.5f, 2.0f, 2.0f, 10, 0.7f); gl.glEndList(); System.err.println("gear2 list created: "+gear2); @@ -163,7 +166,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList if(0>=gear3) { gear3 = gl.glGenLists(1); gl.glNewList(gear3, GL2.GL_COMPILE); - gl.glMaterialfv(GL2.GL_FRONT, GL2.GL_AMBIENT_AND_DIFFUSE, blue, 0); + gl.glMaterialfv(GL.GL_FRONT, GLLightingFunc.GL_AMBIENT_AND_DIFFUSE, blue, 0); gear(gl, 1.3f, 2.0f, 0.5f, 10, 0.7f); gl.glEndList(); System.err.println("gear3 list created: "+gear3); @@ -171,11 +174,11 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList System.err.println("gear3 list reused: "+gear3); } - gl.glEnable(GL2.GL_NORMALIZE); + gl.glEnable(GLLightingFunc.GL_NORMALIZE); } @Override - public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable glad, final int x, final int y, final int width, final int height) { final GL2 gl = glad.getGL().getGL2(); if(-1 != swapInterval) { gl.setSwapInterval(swapInterval); @@ -184,15 +187,15 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList } @Override - public void reshapeTile(TileRendererBase tr, - int tileX, int tileY, int tileWidth, int tileHeight, - int imageWidth, int imageHeight) { + public void reshapeTile(final TileRendererBase tr, + final int tileX, final int tileY, final int tileWidth, final int tileHeight, + final int imageWidth, final int imageHeight) { final GL2 gl = tr.getAttachedDrawable().getGL().getGL2(); gl.setSwapInterval(0); reshape(gl, tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight); } - public void reshape(GL2 gl, int tileX, int tileY, int tileWidth, int tileHeight, int imageWidth, int imageHeight) { + public void reshape(final GL2 gl, final int tileX, final int tileY, final int tileWidth, final int tileHeight, final int imageWidth, final int imageHeight) { final boolean msaa = gl.getContext().getGLDrawable().getChosenGLCapabilities().getSampleBuffers(); System.err.println(Thread.currentThread()+" Gears.reshape "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", msaa "+msaa+", tileRendererInUse "+tileRendererInUse); @@ -203,13 +206,13 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList // compute projection parameters 'normal' float left, right, bottom, top; if( imageHeight > imageWidth ) { - float a = (float)imageHeight / (float)imageWidth; + final float a = (float)imageHeight / (float)imageWidth; left = -1.0f; right = 1.0f; bottom = -a; top = a; } else { - float a = (float)imageWidth / (float)imageHeight; + final float a = (float)imageWidth / (float)imageHeight; left = -a; right = a; bottom = -1.0f; @@ -231,14 +234,14 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList System.err.println(">> Gears angle "+angle+", [l "+left+", r "+right+", b "+bottom+", t "+top+"] "+w+"x"+h+" -> [l "+l+", r "+r+", b "+b+", t "+t+"] "+_w+"x"+_h+", v-flip "+flipVerticalInGLOrientation); } - gl.glMatrixMode(GL2.GL_PROJECTION); + gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); if( flipVerticalInGLOrientation && gl.getContext().getGLDrawable().isGLOriented() ) { gl.glScalef(1f, -1f, 1f); } gl.glFrustum(l, r, b, t, 5.0f, 60.0f); - gl.glMatrixMode(GL2.GL_MODELVIEW); + gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); gl.glTranslatef(0.0f, 0.0f, -40.0f); @@ -248,7 +251,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { System.err.println(Thread.currentThread()+" Gears.dispose: tileRendererInUse "+tileRendererInUse); try { final Object upstreamWidget = drawable.getUpstreamWidget(); @@ -257,14 +260,14 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList window.removeMouseListener(gearsMouse); window.removeKeyListener(gearsKeys); } - } catch (Exception e) { System.err.println("Caught: "); e.printStackTrace(); } + } catch (final Exception e) { System.err.println("Caught: "); e.printStackTrace(); } setGears(0, 0, 0); } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { // Get the GL corresponding to the drawable we are animating - GL2 gl = drawable.getGL().getGL2(); + final GL2 gl = drawable.getGL().getGL2(); final boolean msaa = gl.getContext().getGLDrawable().getChosenGLCapabilities().getSampleBuffers(); if( msaa ) { @@ -283,16 +286,16 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList (drawable instanceof javax.media.opengl.awt.GLJPanel) && !((javax.media.opengl.awt.GLJPanel) drawable).isOpaque() && ((javax.media.opengl.awt.GLJPanel) drawable).shouldPreserveColorBufferIfTranslucent()) { - gl.glClear(GL2.GL_DEPTH_BUFFER_BIT); + gl.glClear(GL.GL_DEPTH_BUFFER_BIT); } else { - gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT); + gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); } displayImpl(gl); if( msaa ) { gl.glDisable(GL.GL_MULTISAMPLE); } } - public void display(GL2 gl) { + public void display(final GL2 gl) { final boolean msaa = gl.getContext().getGLDrawable().getChosenGLCapabilities().getSampleBuffers(); if( msaa ) { gl.glEnable(GL.GL_MULTISAMPLE); @@ -302,13 +305,13 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList } else { gl.glClearColor(1.0f, 1.0f, 1.0f, 0.0f); } - gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT); + gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); displayImpl(gl); if( msaa ) { gl.glDisable(GL.GL_MULTISAMPLE); } } - private void displayImpl(GL2 gl) { + private void displayImpl(final GL2 gl) { if( doRotate ) { // Turn the gears' teeth angle += 2.0f; @@ -346,12 +349,12 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList gl.glPopMatrix(); } - public static void gear(GL2 gl, - float inner_radius, - float outer_radius, - float width, - int teeth, - float tooth_depth) + public static void gear(final GL2 gl, + final float inner_radius, + final float outer_radius, + final float width, + final int teeth, + final float tooth_depth) { int i; float r0, r1, r2; @@ -364,7 +367,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList da = 2.0f * (float) Math.PI / teeth / 4.0f; - gl.glShadeModel(GL2.GL_FLAT); + gl.glShadeModel(GLLightingFunc.GL_FLAT); gl.glNormal3f(0.0f, 0.0f, 1.0f); @@ -384,7 +387,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList gl.glEnd(); /* draw front sides of teeth */ - gl.glBegin(GL2.GL_QUADS); + gl.glBegin(GL2GL3.GL_QUADS); for (i = 0; i < teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; @@ -408,7 +411,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList gl.glEnd(); /* draw back sides of teeth */ - gl.glBegin(GL2.GL_QUADS); + gl.glBegin(GL2GL3.GL_QUADS); for (i = 0; i < teeth; i++) { angle = i * 2.0f * (float) Math.PI / teeth; @@ -448,7 +451,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList gl.glVertex3f(r1 * (float)Math.cos(0), r1 * (float)Math.sin(0), -width * 0.5f); gl.glEnd(); - gl.glShadeModel(GL2.GL_SMOOTH); + gl.glShadeModel(GLLightingFunc.GL_SMOOTH); /* draw inside radius cylinder */ gl.glBegin(GL2.GL_QUAD_STRIP); @@ -463,8 +466,8 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList } class GearsKeyAdapter extends KeyAdapter { - public void keyPressed(KeyEvent e) { - int kc = e.getKeyCode(); + public void keyPressed(final KeyEvent e) { + final int kc = e.getKeyCode(); if(KeyEvent.VK_LEFT == kc) { view_roty -= 1; } else if(KeyEvent.VK_RIGHT == kc) { @@ -478,7 +481,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList } class GearsMouseAdapter extends MouseAdapter { - public void mousePressed(MouseEvent e) { + public void mousePressed(final MouseEvent e) { prevMouseX = e.getX(); prevMouseY = e.getY(); if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0) { @@ -486,34 +489,34 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList } } - public void mouseReleased(MouseEvent e) { + public void mouseReleased(final MouseEvent e) { if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0) { // mouseRButtonDown = false; } } - public void mouseDragged(MouseEvent e) { - int x = e.getX(); - int y = e.getY(); + public void mouseDragged(final MouseEvent e) { + final int x = e.getX(); + final int y = e.getY(); int width=0, height=0; - Object source = e.getSource(); + final Object source = e.getSource(); if(source instanceof Window) { - Window window = (Window) source; + final Window window = (Window) source; width=window.getSurfaceWidth(); height=window.getSurfaceHeight(); } else if (source instanceof GLAutoDrawable) { - GLAutoDrawable glad = (GLAutoDrawable) source; + final GLAutoDrawable glad = (GLAutoDrawable) source; width = glad.getSurfaceWidth(); height = glad.getSurfaceHeight(); } else if (GLProfile.isAWTAvailable() && source instanceof java.awt.Component) { - java.awt.Component comp = (java.awt.Component) source; + final java.awt.Component comp = (java.awt.Component) source; width=comp.getWidth(); // FIXME HiDPI: May need to convert window units -> pixel units! height=comp.getHeight(); } else { throw new RuntimeException("Event source neither Window nor Component: "+source); } - float thetaY = 360.0f * ( (float)(x-prevMouseX)/(float)width); - float thetaX = 360.0f * ( (float)(prevMouseY-y)/(float)height); + final float thetaY = 360.0f * ( (float)(x-prevMouseX)/(float)width); + final float thetaX = 360.0f * ( (float)(prevMouseY-y)/(float)height); prevMouseX = x; prevMouseY = y; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Teapot.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Teapot.java index 64e4472c0..d29688b96 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Teapot.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Teapot.java @@ -6,6 +6,8 @@ import javax.media.opengl.GL; import javax.media.opengl.GL2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; +import javax.media.opengl.fixedfunc.GLLightingFunc; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.common.util.IOUtil; import com.jogamp.opengl.test.junit.jogl.util.texture.PNGTstFiles; @@ -27,16 +29,16 @@ public class Teapot implements GLEventListener { private Texture tex = null; @Override - public void init(GLAutoDrawable drawable) { - GL2 gl = drawable.getGL().getGL2(); + public void init(final GLAutoDrawable drawable) { + final GL2 gl = drawable.getGL().getGL2(); glut = new GLUT(); gl.glClearColor(0.5f, 0.5f, 0.5f, 0.0f); try { - URLConnection urlConn = IOUtil.getResource(PNGTstFiles.class, "test-ntscP_3-01-160x90.png"); + final URLConnection urlConn = IOUtil.getResource(PNGTstFiles.class, "test-ntscP_3-01-160x90.png"); tex = TextureIO.newTexture(gl, TextureIO.newTextureData(gl.getGLProfile(), urlConn.getInputStream(), false, TextureIO.PNG)); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } tex.bind(gl); @@ -55,7 +57,7 @@ public class Teapot implements GLEventListener { // gl.glTexImage1D(GL2.GL_TEXTURE_1D, 0, 3, stripeImageWidth, 0, // GL.GL_RGB, GL.GL_UNSIGNED_BYTE, stripeImageBuf); - gl.glTexParameterf(GL2.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT); + gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT); // gl.glTexGeni(GL2.GL_S, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_OBJECT_LINEAR); // gl.glTexGenfv(GL2.GL_S, GL2.GL_OBJECT_PLANE, sgenparams, 0); @@ -64,15 +66,15 @@ public class Teapot implements GLEventListener { gl.glDepthFunc(GL.GL_LESS); // gl.glEnable(GL2.GL_TEXTURE_GEN_S); // gl.glEnable(GL2.GL_TEXTURE_1D); - gl.glEnable(GL2.GL_TEXTURE_2D); - gl.glEnable(GL2.GL_CULL_FACE); - gl.glEnable(GL2.GL_LIGHTING); - gl.glEnable(GL2.GL_LIGHT0); + gl.glEnable(GL.GL_TEXTURE_2D); + gl.glEnable(GL.GL_CULL_FACE); + gl.glEnable(GLLightingFunc.GL_LIGHTING); + gl.glEnable(GLLightingFunc.GL_LIGHT0); gl.glEnable(GL2.GL_AUTO_NORMAL); - gl.glEnable(GL2.GL_NORMALIZE); + gl.glEnable(GLLightingFunc.GL_NORMALIZE); gl.glFrontFace(GL.GL_CW); gl.glCullFace(GL.GL_BACK); - gl.glMaterialf(GL.GL_FRONT, GL2.GL_SHININESS, 64.0f); + gl.glMaterialf(GL.GL_FRONT, GLLightingFunc.GL_SHININESS, 64.0f); } float angleZ = 0.0f; @@ -80,11 +82,11 @@ public class Teapot implements GLEventListener { public float rotIncr = 0.4f; @Override - public void display(GLAutoDrawable gLDrawable) { + public void display(final GLAutoDrawable gLDrawable) { final GL2 gl = gLDrawable.getGL().getGL2(); tex.bind(gl); - gl.glEnable(GL2.GL_TEXTURE_2D); + gl.glEnable(GL.GL_TEXTURE_2D); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl.glPushMatrix(); @@ -102,11 +104,11 @@ public class Teapot implements GLEventListener { } @Override - public void reshape(GLAutoDrawable gLDrawable, int x, int y, int w, int h) { - GL2 gl = gLDrawable.getGL().getGL2(); + public void reshape(final GLAutoDrawable gLDrawable, final int x, final int y, final int w, final int h) { + final GL2 gl = gLDrawable.getGL().getGL2(); gl.glViewport(0, 0, w, h); - gl.glMatrixMode(GL2.GL_PROJECTION); + gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); if (w <= h) { gl.glOrtho(-3.5, 3.5, -3.5 * h / w, @@ -115,11 +117,11 @@ public class Teapot implements GLEventListener { gl.glOrtho(-3.5 * w / h, 3.5 * w / h, -3.5, 3.5, -3.5, 3.5); } - gl.glMatrixMode(GL2.GL_MODELVIEW); + gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); } @Override - public void dispose(GLAutoDrawable gLDrawable) { + public void dispose(final GLAutoDrawable gLDrawable) { } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/TextureDraw01GL2Listener.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/TextureDraw01GL2Listener.java index fb8e6bfa3..786229360 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/TextureDraw01GL2Listener.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/TextureDraw01GL2Listener.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.demos.gl2; import com.jogamp.opengl.test.junit.jogl.demos.TextureDraw01Accessor; @@ -33,35 +33,39 @@ import com.jogamp.opengl.util.texture.Texture; import com.jogamp.opengl.util.texture.TextureCoords; import com.jogamp.opengl.util.texture.TextureData; import com.jogamp.opengl.util.texture.TextureIO; + +import javax.media.opengl.GL; import javax.media.opengl.GL2ES1; import javax.media.opengl.GL2; +import javax.media.opengl.GL2GL3; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import javax.media.opengl.glu.GLU; public class TextureDraw01GL2Listener implements GLEventListener, TextureDraw01Accessor { - private GLU glu = new GLU(); - private TextureData textureData; + private final GLU glu = new GLU(); + private final TextureData textureData; private Texture texture; boolean keepTextureBound; - - public TextureDraw01GL2Listener(TextureData td) { + + public TextureDraw01GL2Listener(final TextureData td) { this.textureData = td; this.keepTextureBound = false; } @Override - public void setKeepTextureBound(boolean v) { + public void setKeepTextureBound(final boolean v) { this.keepTextureBound = v; } @Override public Texture getTexture( ) { return this.texture; } - + @Override - public void init(GLAutoDrawable drawable) { - GL2 gl = drawable.getGL().getGL2(); + public void init(final GLAutoDrawable drawable) { + final GL2 gl = drawable.getGL().getGL2(); if(null!=textureData) { this.texture = TextureIO.newTexture(drawable.getGL(), textureData); if( keepTextureBound ) { @@ -72,18 +76,18 @@ public class TextureDraw01GL2Listener implements GLEventListener, TextureDraw01A } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { - GL2 gl = drawable.getGL().getGL2(); - gl.glMatrixMode(GL2ES1.GL_PROJECTION); + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { + final GL2 gl = drawable.getGL().getGL2(); + gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); glu.gluOrtho2D(0, 1, 0, 1); - gl.glMatrixMode(GL2ES1.GL_MODELVIEW); + gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); } @Override - public void dispose(GLAutoDrawable drawable) { - GL2 gl = drawable.getGL().getGL2(); + public void dispose(final GLAutoDrawable drawable) { + final GL2 gl = drawable.getGL().getGL2(); if(null!=texture) { texture.disable(gl); texture.destroy(gl); @@ -94,8 +98,8 @@ public class TextureDraw01GL2Listener implements GLEventListener, TextureDraw01A } @Override - public void display(GLAutoDrawable drawable) { - GL2 gl = drawable.getGL().getGL2(); + public void display(final GLAutoDrawable drawable) { + final GL2 gl = drawable.getGL().getGL2(); // draw one quad with the texture if(null!=texture) { @@ -103,9 +107,9 @@ public class TextureDraw01GL2Listener implements GLEventListener, TextureDraw01A texture.enable(gl); texture.bind(gl); } - gl.glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_REPLACE); - TextureCoords coords = texture.getImageTexCoords(); - gl.glBegin(GL2.GL_QUADS); + gl.glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE); + final TextureCoords coords = texture.getImageTexCoords(); + gl.glBegin(GL2GL3.GL_QUADS); gl.glTexCoord2f(coords.left(), coords.bottom()); gl.glVertex3f(0, 0, 0); gl.glTexCoord2f(coords.right(), coords.bottom()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/Bug818GLJPanelApplet.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/Bug818GLJPanelApplet.java index 7e3d78b92..8280919e6 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/Bug818GLJPanelApplet.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/Bug818GLJPanelApplet.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -38,12 +38,14 @@ import java.nio.FloatBuffer; import javax.media.opengl.GL; import javax.media.opengl.GL2; import javax.media.opengl.GL2ES1; +import javax.media.opengl.GL2GL3; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; import javax.media.opengl.awt.GLCanvas; import javax.media.opengl.awt.GLJPanel; import javax.media.opengl.fixedfunc.GLLightingFunc; import javax.media.opengl.fixedfunc.GLMatrixFunc; +import javax.media.opengl.fixedfunc.GLPointerFunc; import javax.swing.JApplet; import javax.swing.JPanel; import javax.swing.JFrame; @@ -76,7 +78,7 @@ public class Bug818GLJPanelApplet extends JApplet { public static JPanel appletHolder; public static boolean isApplet = true; - static public void main(String args[]) { + static public void main(final String args[]) { isApplet = false; final JApplet myApplet = new Bug818GLJPanelApplet(); @@ -88,7 +90,7 @@ public class Bug818GLJPanelApplet extends JApplet { frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { + public void windowClosing(final WindowEvent e) { System.exit(0); } }); @@ -101,7 +103,7 @@ public class Bug818GLJPanelApplet extends JApplet { frame.pack(); frame.setVisible(true); } } ); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); } @@ -151,97 +153,97 @@ public class Bug818GLJPanelApplet extends JApplet { * Self-contained example (within a single class only to keep it simple) displaying a rotating quad */ static class JOGLQuad implements GLEventListener { - + private static final float[] VERTEX_DATA = { -1.0f, 1.0f, 0.0f, // Top Left 1.0f, 1.0f, 0.0f, // Top Right 1.0f, -1.0f, 0.0f, // Bottom Right -1.0f, -1.0f, 0.0f // Bottom Left }; - + private static final float[] TEXCOORD_DATA = { 0.0f, 1.0f, // Top Left 1.0f, 1.0f, // Top Right 1.0f, 0.0f, // Bottom Right 0.0f, 0.0f // Bottom Left }; - - private FloatBuffer vertexBuf; - - private FloatBuffer texCoordBuf; - + + private final FloatBuffer vertexBuf; + + private final FloatBuffer texCoordBuf; + private int vertexVBO; - + private int texCoordVBO; - + private float rotateT = 0.0f; - - private boolean canvas; - + + private final boolean canvas; + private Texture texture; - - JOGLQuad(boolean canvas) { - + + JOGLQuad(final boolean canvas) { + this.canvas = canvas; - + ByteBuffer bb = ByteBuffer.allocateDirect(VERTEX_DATA.length * 4); bb.order(ByteOrder.nativeOrder()); vertexBuf = bb.asFloatBuffer(); vertexBuf.put(VERTEX_DATA); vertexBuf.rewind(); - + bb = ByteBuffer.allocateDirect(TEXCOORD_DATA.length * 4); bb.order(ByteOrder.nativeOrder()); texCoordBuf = bb.asFloatBuffer(); texCoordBuf.put(TEXCOORD_DATA); texCoordBuf.rewind(); } - + @Override - public void init(GLAutoDrawable glDrawable) { - + public void init(final GLAutoDrawable glDrawable) { + final GL2 gl = glDrawable.getGL().getGL2(); - + System.err.println(VersionUtil.getPlatformInfo()); System.err.println(JoglVersion.getGLInfo(gl, null, false /* withCapabilitiesAndExtensionInfo */).toString()); - + gl.glShadeModel(GLLightingFunc.GL_SMOOTH); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); gl.glClearDepth(1.0f); gl.glEnable(GL.GL_DEPTH_TEST); gl.glDepthFunc(GL.GL_LEQUAL); gl.glHint(GL2ES1.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); - - int[] tmp = new int[2]; + + final int[] tmp = new int[2]; gl.glGenBuffers(tmp.length, tmp, 0); vertexVBO = tmp[0]; texCoordVBO = tmp[1]; - - gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, vertexVBO); - gl.glBufferData(GL2.GL_ARRAY_BUFFER, VERTEX_DATA.length * 4, vertexBuf, GL2.GL_STATIC_DRAW); - gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, texCoordVBO); - gl.glBufferData(GL2.GL_ARRAY_BUFFER, TEXCOORD_DATA.length * 4, texCoordBuf, GL2.GL_STATIC_DRAW); - gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0); - + + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vertexVBO); + gl.glBufferData(GL.GL_ARRAY_BUFFER, VERTEX_DATA.length * 4, vertexBuf, GL.GL_STATIC_DRAW); + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, texCoordVBO); + gl.glBufferData(GL.GL_ARRAY_BUFFER, TEXCOORD_DATA.length * 4, texCoordBuf, GL.GL_STATIC_DRAW); + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); + try { - InputStream stream = getClass().getClassLoader().getResourceAsStream("com/jogamp/opengl/test/junit/jogl/util/texture/test-ntscN_3-01-160x90-90pct-yuv444-base.jpg"); + final InputStream stream = getClass().getClassLoader().getResourceAsStream("com/jogamp/opengl/test/junit/jogl/util/texture/test-ntscN_3-01-160x90-90pct-yuv444-base.jpg"); texture = TextureIO.newTexture(stream, true, TextureIO.JPG); - } catch (Exception exc) { + } catch (final Exception exc) { exc.printStackTrace(System.err); } } - + @Override - public void dispose(GLAutoDrawable drawable) { - + public void dispose(final GLAutoDrawable drawable) { + final GL2 gl = drawable.getGL().getGL2(); - int[] tmp = new int[] {vertexVBO, texCoordVBO}; + final int[] tmp = new int[] {vertexVBO, texCoordVBO}; gl.glGenBuffers(tmp.length, tmp, 0); } - + @Override - public void reshape(GLAutoDrawable gLDrawable, int x, int y, int width, int height) { - + public void reshape(final GLAutoDrawable gLDrawable, final int x, final int y, final int width, final int height) { + final GL2 gl = gLDrawable.getGL().getGL2(); final float aspect = (float) width / (float) height; gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); @@ -252,55 +254,55 @@ public class Bug818GLJPanelApplet extends JApplet { gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); } - + @Override - public void display(GLAutoDrawable gLDrawable) { - + public void display(final GLAutoDrawable gLDrawable) { + final GL2 gl = gLDrawable.getGL().getGL2(); - + gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl.glLoadIdentity(); gl.glTranslatef(0.0f, 0.0f, -5.0f); - + // rotate about the three axes gl.glRotatef(rotateT, 1.0f, 0.0f, 0.0f); gl.glRotatef(rotateT, 0.0f, 1.0f, 0.0f); gl.glRotatef(rotateT, 0.0f, 0.0f, 1.0f); - + // set the color of the quad if (canvas) { gl.glColor3f(0.2f, 1.0f, 1.0f); } else { gl.glColor3f(1.0f, 0.2f, 0.2f); } - + if (texture != null) { texture.bind(gl); texture.enable(gl); } else { System.err.println("no texture"); } - + // Draw A Quad - gl.glEnableClientState(GL2.GL_VERTEX_ARRAY); - gl.glEnableClientState(GL2.GL_TEXTURE_COORD_ARRAY); - gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, vertexVBO); - gl.glVertexPointer(3, GL2.GL_FLOAT, 0, 0); - gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, texCoordVBO); - gl.glTexCoordPointer(2, GL2.GL_FLOAT, 0, 0); - gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0); - gl.glDrawArrays(GL2.GL_QUADS, 0, 4); - gl.glDisableClientState(GL2.GL_TEXTURE_COORD_ARRAY); - gl.glDisableClientState(GL2.GL_VERTEX_ARRAY); - + gl.glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY); + gl.glEnableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY); + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vertexVBO); + gl.glVertexPointer(3, GL.GL_FLOAT, 0, 0); + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, texCoordVBO); + gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, 0); + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); + gl.glDrawArrays(GL2GL3.GL_QUADS, 0, 4); + gl.glDisableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY); + gl.glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY); + if (texture != null) { texture.disable(gl); } - + // increasing rotation for the next iteration rotateT += 0.2f; } - + } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGLJPanelAWTBug450.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGLJPanelAWTBug450.java index 0a8c406fb..ee5149b1c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGLJPanelAWTBug450.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGLJPanelAWTBug450.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -38,6 +38,7 @@ import javax.media.opengl.glu.gl2.GLUgl2; import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2; import com.jogamp.opengl.test.junit.util.UITestCase; + import java.awt.AWTException; import java.awt.BorderLayout; import java.lang.reflect.InvocationTargetException; @@ -56,7 +57,7 @@ import org.junit.runners.MethodSorters; /** * Test for bug 450, which causes the right part of the frame to be black * for all x >= height. - * + * * Draws the Gears demo in a window that's twice as wide than it is tall, * and checks to see if a particular pixel in the right half of the frame * is colored. @@ -86,7 +87,7 @@ public class TestGLJPanelAWTBug450 extends UITestCase { public static void releaseClass() { } - protected void runTestGL(GLCapabilities caps) + protected void runTestGL(final GLCapabilities caps) throws AWTException, InterruptedException, InvocationTargetException { final GLReadBufferUtil screenshot = new GLReadBufferUtil(true, false); @@ -95,26 +96,26 @@ public class TestGLJPanelAWTBug450 extends UITestCase { final GLJPanel glJPanel = new GLJPanel(caps); Assert.assertNotNull(glJPanel); - RedSquareES2 demo = new RedSquareES2(); + final RedSquareES2 demo = new RedSquareES2(); demo.setAspect((float)width/(float)height); demo.setDoRotation(false); glJPanel.addGLEventListener(demo); glJPanel.addGLEventListener(new GLEventListener() { int f = 0; @Override - public void init(GLAutoDrawable drawable) { - // drawable.getGL().glClearColor(0, 0, 1, 1); + public void init(final GLAutoDrawable drawable) { + // drawable.getGL().glClearColor(0, 0, 1, 1); } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { // look at one pixel at the bottom of the frame, just right of // the center line, and make sure it's not black - GL2 gl = GLUgl2.getCurrentGL2(); - ByteBuffer bytebuffer = ByteBuffer.allocateDirect( 3 ); - gl.glReadPixels( r_x, r_y, 1, 1, GL2.GL_BGR, GL2.GL_UNSIGNED_BYTE, bytebuffer ); - byte byte0 = bytebuffer.get( 0 ); - byte byte1 = bytebuffer.get( 1 ); - byte byte2 = bytebuffer.get( 2 ); + final GL2 gl = GLUgl2.getCurrentGL2(); + final ByteBuffer bytebuffer = ByteBuffer.allocateDirect( 3 ); + gl.glReadPixels( r_x, r_y, 1, 1, GL2GL3.GL_BGR, GL.GL_UNSIGNED_BYTE, bytebuffer ); + final byte byte0 = bytebuffer.get( 0 ); + final byte byte1 = bytebuffer.get( 1 ); + final byte byte2 = bytebuffer.get( 2 ); if( (byte0 == 0) && (byte1 == 0) && (byte2 == 0) ) { failed = true; } @@ -125,12 +126,12 @@ public class TestGLJPanelAWTBug450 extends UITestCase { f++; } @Override - public void dispose(GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) {} @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { } + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } }); - FPSAnimator animator = new FPSAnimator(glJPanel, 60); + final FPSAnimator animator = new FPSAnimator(glJPanel, 60); SwingUtilities.invokeAndWait(new Runnable() { public void run() { @@ -139,7 +140,7 @@ public class TestGLJPanelAWTBug450 extends UITestCase { frame.setVisible(true); } } ) ; - animator.setUpdateFPSFrames(1, null); + animator.setUpdateFPSFrames(1, null); animator.start(); Assert.assertEquals(true, animator.isAnimating()); @@ -169,19 +170,19 @@ public class TestGLJPanelAWTBug450 extends UITestCase { public void test01() throws AWTException, InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); + final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); runTestGL(caps); } static long duration = 500; // ms - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i 0 ) { caps.setSampleBuffers(true); caps.setNumSamples(msaaCount); @@ -143,28 +143,28 @@ public class TestGearsAWT extends UITestCase { static long duration = 500; // ms - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i "+geomShaderBaseNames[geomShader]); @@ -130,9 +130,9 @@ public class GeomShader01TextureGL3 implements GLEventListener { // setup mgl_PMVMatrix pmvMatrix = new PMVMatrix(); - pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); - pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv st.ownUniform(pmvMatrixUniform); @@ -148,7 +148,7 @@ public class GeomShader01TextureGL3 implements GLEventListener { try { texture = createTestTexture(gl); - } catch (IOException e) { + } catch (final IOException e) { throw new RuntimeException(e); } if(null == texture) { @@ -160,7 +160,7 @@ public class GeomShader01TextureGL3 implements GLEventListener { // TL, TR, BR { int i=0; - TextureCoords tc = texture.getImageTexCoords(); + final TextureCoords tc = texture.getImageTexCoords(); s_triTexCoords[i++] = tc.left(); s_triTexCoords[i++] = tc.top(); s_triTexCoords[i++] = tc.left(); s_triTexCoords[i++] = tc.bottom(); s_triTexCoords[i++] = tc.right(); s_triTexCoords[i++] = tc.bottom(); @@ -175,7 +175,7 @@ public class GeomShader01TextureGL3 implements GLEventListener { interleavedVBO.addGLSLSubArray("mgl_Color", 4, GL.GL_ARRAY_BUFFER); interleavedVBO.addGLSLSubArray("mgl_MultiTexCoord", 2, GL.GL_ARRAY_BUFFER); - FloatBuffer ib = (FloatBuffer)interleavedVBO.getBuffer(); + final FloatBuffer ib = (FloatBuffer)interleavedVBO.getBuffer(); for(int i=0; i<6; i++) { ib.put(s_triVertices, i*2, 2); @@ -192,7 +192,7 @@ public class GeomShader01TextureGL3 implements GLEventListener { st.useProgram(gl, false); } - private Texture createTestTexture(GL3 gl) throws IOException { + private Texture createTestTexture(final GL3 gl) throws IOException { final URLConnection urlConn = IOUtil.getResource(this.getClass(), "../../util/texture/test-ntscN_3-01-160x90.png"); if(null == urlConn) { return null; } final InputStream istream = urlConn.getInputStream(); @@ -204,7 +204,7 @@ public class GeomShader01TextureGL3 implements GLEventListener { } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { final GL3 gl = drawable.getGL().getGL3(); if(null!=texture) { texture.disable(gl); @@ -220,8 +220,8 @@ public class GeomShader01TextureGL3 implements GLEventListener { } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { - GL3 gl = drawable.getGL().getGL3(); + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { + final GL3 gl = drawable.getGL().getGL3(); gl.setSwapInterval(1); @@ -243,7 +243,7 @@ public class GeomShader01TextureGL3 implements GLEventListener { } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { final GL3 gl = drawable.getGL().getGL3(); gl.glClear(GL.GL_DEPTH_BUFFER_BIT | GL.GL_COLOR_BUFFER_BIT); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/newt/TestGeomShader01TextureGL3NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/newt/TestGeomShader01TextureGL3NEWT.java index 8e582bd3b..583334e1f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/newt/TestGeomShader01TextureGL3NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/newt/TestGeomShader01TextureGL3NEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -51,73 +51,73 @@ import com.jogamp.opengl.util.Animator; public class TestGeomShader01TextureGL3NEWT extends UITestCase { static long duration = 500; // ms - static GLCapabilities getCaps(String profile) { + static GLCapabilities getCaps(final String profile) { if( !GLProfile.isAvailable(profile) ) { System.err.println("Profile "+profile+" n/a"); return null; } return new GLCapabilities(GLProfile.get(profile)); } - + @Test public void test01_GL3Core_Passthrough() throws InterruptedException { - GLCapabilities caps = getCaps(GLProfile.GL3); + final GLCapabilities caps = getCaps(GLProfile.GL3); if( null == caps ) { return; } testImpl(caps, 0); } - + @Test public void test02_GL3Core_FlipXYZ() throws InterruptedException { - GLCapabilities caps = getCaps(GLProfile.GL3); + final GLCapabilities caps = getCaps(GLProfile.GL3); if( null == caps ) { return; } testImpl(caps, 1); } - + @Test public void test11_GL3Compat_Passthrough() throws InterruptedException { - GLCapabilities caps = getCaps(GLProfile.GL3bc); + final GLCapabilities caps = getCaps(GLProfile.GL3bc); if( null == caps ) { return; } testImpl(caps, 0); } - + @Test public void test12_GL3Compat_FlipXYZ() throws InterruptedException { - GLCapabilities caps = getCaps(GLProfile.GL3bc); + final GLCapabilities caps = getCaps(GLProfile.GL3bc); if( null == caps ) { return; } testImpl(caps, 1); } - - private void testImpl(GLCapabilities caps, int geomShader) throws InterruptedException { - GLWindow glWindow = GLWindow.create(caps); + + private void testImpl(final GLCapabilities caps, final int geomShader) throws InterruptedException { + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setSize(800, 600); glWindow.setVisible(true); glWindow.setTitle("JOGL Geometry Shader Banana Test"); Assert.assertTrue(glWindow.isNativeValid()); - - QuitAdapter quitAdapter = new QuitAdapter(); + + final QuitAdapter quitAdapter = new QuitAdapter(); glWindow.addKeyListener(quitAdapter); glWindow.addWindowListener(quitAdapter); glWindow.addGLEventListener( new GeomShader01TextureGL3(geomShader) ); - + final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener(); glWindow.addGLEventListener(snapshotGLEventListener); - + final Animator animator = new Animator(glWindow); animator.start(); - + animator.setUpdateFPSFrames(60, System.err); snapshotGLEventListener.setMakeSnapshot(); - + while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()0) { pause(postDelay); } + if(postDelay>0) { pause(postDelay); } } - - public static void displayVCArraysNoChecks(GLDrawable drawable, GL2ES2 gl, boolean preEnable, GLArrayDataServer vertices, GLArrayDataServer colors, boolean postDisable) throws InterruptedException { + + public static void displayVCArraysNoChecks(final GLDrawable drawable, final GL2ES2 gl, final boolean preEnable, final GLArrayDataServer vertices, final GLArrayDataServer colors, final boolean postDisable) throws InterruptedException { if(preEnable) { vertices.enableBuffer(gl, true); colors.enableBuffer(gl, true); } gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4); + gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4); if(postDisable) { vertices.enableBuffer(gl, false); colors.enableBuffer(gl, false); } drawable.swapBuffers(); } - - public static GLArrayDataServer createVertices(GL2ES2 gl, ShaderState st, int shaderProgram, int location, float[] vertices) { + + public static GLArrayDataServer createVertices(final GL2ES2 gl, final ShaderState st, final int shaderProgram, final int location, final float[] vertices) { if(null != st && 0 != shaderProgram) { throw new InternalError("Use either ShaderState _or_ shader-program, not both"); } @@ -118,7 +118,7 @@ public class GLSLMiscHelper { throw new InternalError("Pass a valid ShaderState _xor_ shader-program, not none"); } // Allocate Vertex Array0 - GLArrayDataServer vDataArray = GLArrayDataServer.createGLSL("mgl_Vertex", 3, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); + final GLArrayDataServer vDataArray = GLArrayDataServer.createGLSL("mgl_Vertex", 3, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); if(null != st) { st.ownAttribute(vDataArray, true); if(0<=location) { @@ -144,7 +144,7 @@ public class GLSLMiscHelper { Assert.assertTrue(vDataArray.isVBOWritten()); Assert.assertTrue(vDataArray.sealed()); Assert.assertEquals(4, vDataArray.getElementCount()); - Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); + Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); Assert.assertEquals(0, gl.getBoundBuffer(GL.GL_ARRAY_BUFFER)); // should be cleared ASAP validateGLArrayDataServerState(gl, st, vDataArray); return vDataArray; @@ -153,20 +153,20 @@ public class GLSLMiscHelper { 2f, 2f, 0f, -2f, -2f, 0f, 2f, -2f, 0f }; - + public static float[] vertices1 = new float[] { -2f, 1f, 0f, 2f, 1f, 0f, -2f, -1f, 0f, 2f, -1f, 0f }; - - public static GLArrayDataServer createColors(GL2ES2 gl, ShaderState st, int shaderProgram, int location, float[] colors) { + + public static GLArrayDataServer createColors(final GL2ES2 gl, final ShaderState st, final int shaderProgram, final int location, final float[] colors) { if(null != st && 0 != shaderProgram) { throw new InternalError("Use either ShaderState _or_ shader-program, not both"); } if(null == st && 0 == shaderProgram) { throw new InternalError("Pass a valid ShaderState _xor_ shader-program, not none"); } - GLArrayDataServer cDataArray = GLArrayDataServer.createGLSL("mgl_Color", 4, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); + final GLArrayDataServer cDataArray = GLArrayDataServer.createGLSL("mgl_Color", 4, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); if(null != st) { st.ownAttribute(cDataArray, true); if(0<=location) { @@ -198,10 +198,10 @@ public class GLSLMiscHelper { 0f, 0f, 1f, 1f, 1f, 0f, 0f, 1f, 1f, 0f, 1f, 1f }; - + public static float[] colors1 = new float[] { 1f, 0f, 1f, 1f, 0f, 1f, 0f, 1f, 1f, 0f, 1f, 1f, 1f, 0f, 1f, 1f }; - + } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java index 99d2dd683..b3e01ac0f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java @@ -38,12 +38,14 @@ import com.jogamp.opengl.test.junit.util.NEWTGLContext; import com.jogamp.opengl.test.junit.util.UITestCase; import java.io.IOException; + import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLDrawable; import javax.media.opengl.GLProfile; import javax.media.opengl.GLUniformData; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import org.junit.Assert; import org.junit.Test; @@ -61,7 +63,7 @@ public class TestGLSLShaderState01NEWT extends UITestCase { static final int vertices0_loc = 0; // FIXME: AMD needs this to be location 0 ? hu ? static final int colors0_loc = 1; - + @Test public void test00NoShaderState_Validation() throws InterruptedException { // preset .. @@ -72,109 +74,109 @@ public class TestGLSLShaderState01NEWT extends UITestCase { System.err.println(winctx.context); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - - // test code .. - final ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, RedSquareES2.class, + + // test code .. + final ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, RedSquareES2.class, "shader", "shader/bin", "RedSquareShader", true); - final ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, RedSquareES2.class, + final ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, RedSquareES2.class, "shader", "shader/bin", "RedSquareShader", true); rsVp.defaultShaderCustomization(gl, true, true); rsFp.defaultShaderCustomization(gl, true, true); final ShaderProgram sp = new ShaderProgram(); Assert.assertTrue(0 == sp.program()); - + sp.add(gl, rsVp, System.err); sp.add(gl, rsFp, System.err); - - Assert.assertTrue(0 != sp.program()); + + Assert.assertTrue(0 != sp.program()); Assert.assertTrue(!sp.inUse()); Assert.assertTrue(!sp.linked()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - + Assert.assertTrue( sp.link(gl, System.err) ); sp.useProgram(gl, true); - + // Allocate Vertex Array0 final GLArrayDataServer vertices0 = GLSLMiscHelper.createVertices(gl, null, sp.program(), vertices0_loc, GLSLMiscHelper.vertices0); - System.err.println("vertices0: " + vertices0); + System.err.println("vertices0: " + vertices0); vertices0.enableBuffer(gl, false); Assert.assertEquals(vertices0_loc, vertices0.getLocation()); - + // Allocate Color Array0 final GLArrayDataServer colors0 = GLSLMiscHelper.createColors(gl, null, sp.program(), colors0_loc, GLSLMiscHelper.colors0); System.err.println("colors0: " + colors0); colors0.enableBuffer(gl, false); Assert.assertEquals(colors0_loc, colors0.getLocation()); - + Assert.assertTrue(sp.link(gl, System.err)); Assert.assertTrue(sp.linked()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - + Assert.assertEquals(vertices0_loc, vertices0.getLocation()); GLSLMiscHelper.validateGLArrayDataServerState(gl, null, vertices0); - + Assert.assertEquals(colors0_loc, colors0.getLocation()); GLSLMiscHelper.validateGLArrayDataServerState(gl, null, colors0); - + sp.useProgram(gl, true); Assert.assertTrue(sp.inUse()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - + // setup mgl_PMVMatrix final PMVMatrix pmvMatrix = new PMVMatrix(); final GLUniformData pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); pmvMatrixUniform.setLocation(gl, sp.program()); gl.glUniform(pmvMatrixUniform); - + Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - + // Allocate Vertex Array1 final GLArrayDataServer vertices1 = GLSLMiscHelper.createVertices(gl, null, sp.program(), -1, GLSLMiscHelper.vertices1); System.err.println("vertices1: " + vertices1); vertices1.enableBuffer(gl, false); GLSLMiscHelper.validateGLArrayDataServerState(gl, null, vertices1); - + // Allocate Color Array1 final GLArrayDataServer colors1 = GLSLMiscHelper.createColors(gl, null, sp.program(), -1, GLSLMiscHelper.colors1); System.err.println("colors1: " + colors1); colors1.enableBuffer(gl, false); GLSLMiscHelper.validateGLArrayDataServerState(gl, null, colors1); - + // misc GL setup gl.glClearColor(0, 0, 0, 1); - gl.glEnable(GL2ES2.GL_DEPTH_TEST); + gl.glEnable(GL.GL_DEPTH_TEST); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); // reshape - pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); pmvMatrix.gluPerspective(45.0F, (float) drawable.getSurfaceWidth() / (float) drawable.getSurfaceHeight(), 1.0F, 100.0F); - pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrix.glTranslatef(0, 0, -10); gl.glUniform(pmvMatrixUniform); - - gl.glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); + + gl.glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - + // display #1 vertices0 / colors0 (post-disable) GLSLMiscHelper.displayVCArrays(drawable, gl, null, true, vertices0, colors0, true, 1, durationPerTest); // display #2 #1 vertices1 / colors1 (post-disable) GLSLMiscHelper.displayVCArrays(drawable, gl, null, true, vertices1, colors1, true, 2, durationPerTest); - + // display #3 vertices0 / colors0 (post-disable) GLSLMiscHelper.displayVCArrays(drawable, gl, null, true, vertices0, colors0, true, 3, durationPerTest); - + // cleanup sp.useProgram(gl, false); sp.destroy(gl); vertices1.destroy(gl); colors0.destroy(gl); colors1.destroy(gl); - + NEWTGLContext.destroyWindow(winctx); } @@ -188,10 +190,10 @@ public class TestGLSLShaderState01NEWT extends UITestCase { System.err.println(winctx.context); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - - // test code .. + + // test code .. final ShaderState st = new ShaderState(); - + final ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, RedSquareES2.class, "shader", "shader/bin", "RedSquareShader", true); final ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, RedSquareES2.class, "shader", @@ -201,95 +203,95 @@ public class TestGLSLShaderState01NEWT extends UITestCase { final ShaderProgram sp = new ShaderProgram(); Assert.assertTrue(0 == sp.program()); - + sp.add(gl, rsVp, System.err); sp.add(gl, rsFp, System.err); - - Assert.assertTrue(0 != sp.program()); + + Assert.assertTrue(0 != sp.program()); Assert.assertTrue(!sp.inUse()); Assert.assertTrue(!sp.linked()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - + st.attachShaderProgram(gl, sp, false); Assert.assertTrue(!sp.inUse()); Assert.assertTrue(!sp.linked()); - + // Allocate Vertex Array0 final GLArrayDataServer vertices0 = GLSLMiscHelper.createVertices(gl, st, 0, vertices0_loc, GLSLMiscHelper.vertices0); - System.err.println("vertices0: " + vertices0); + System.err.println("vertices0: " + vertices0); vertices0.enableBuffer(gl, false); Assert.assertEquals(vertices0_loc, vertices0.getLocation()); - + // Allocate Color Array0 final GLArrayDataServer colors0 = GLSLMiscHelper.createColors(gl, st, 0, colors0_loc, GLSLMiscHelper.colors0); System.err.println("colors0: " + colors0); colors0.enableBuffer(gl, false); Assert.assertEquals(colors0_loc, colors0.getLocation()); - + Assert.assertTrue(sp.link(gl, System.err)); Assert.assertTrue(sp.linked()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - + Assert.assertEquals(vertices0_loc, vertices0.getLocation()); GLSLMiscHelper.validateGLArrayDataServerState(gl, st, vertices0); - + Assert.assertEquals(colors0_loc, colors0.getLocation()); GLSLMiscHelper.validateGLArrayDataServerState(gl, st, colors0); - + st.useProgram(gl, true); Assert.assertTrue(sp.inUse()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - + // setup mgl_PMVMatrix final PMVMatrix pmvMatrix = new PMVMatrix(); final GLUniformData pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); st.ownUniform(pmvMatrixUniform); - + st.uniform(gl, pmvMatrixUniform); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); Assert.assertEquals(pmvMatrixUniform, st.getUniform("mgl_PMVMatrix")); - + // Allocate Vertex Array1 final GLArrayDataServer vertices1 = GLSLMiscHelper.createVertices(gl, st, 0, -1, GLSLMiscHelper.vertices1); System.err.println("vertices1: " + vertices1); vertices1.enableBuffer(gl, false); GLSLMiscHelper.validateGLArrayDataServerState(gl, st, vertices1); - + // Allocate Color Array1 final GLArrayDataServer colors1 = GLSLMiscHelper.createColors(gl, st, 0, -1, GLSLMiscHelper.colors1); System.err.println("colors1: " + colors1); colors1.enableBuffer(gl, false); GLSLMiscHelper.validateGLArrayDataServerState(gl, st, colors1); - + // misc GL setup gl.glClearColor(0, 0, 0, 1); - gl.glEnable(GL2ES2.GL_DEPTH_TEST); + gl.glEnable(GL.GL_DEPTH_TEST); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); // reshape - pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); pmvMatrix.gluPerspective(45.0F, (float) drawable.getSurfaceWidth() / (float) drawable.getSurfaceHeight(), 1.0F, 100.0F); - pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrix.glTranslatef(0, 0, -10); st.uniform(gl, pmvMatrixUniform); - gl.glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); + gl.glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - + // display #1 vertices0 / colors0 (post-disable) GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices0, colors0, true, 1, durationPerTest); // display #2 #1 vertices1 / colors1 (post-disable) GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices1, colors1, true, 2, durationPerTest); - + // display #3 vertices0 / colors0 (post-disable) GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices0, colors0, true, 3, durationPerTest); - + // cleanup st.destroy(gl); - + NEWTGLContext.destroyWindow(winctx); } @@ -301,8 +303,8 @@ public class TestGLSLShaderState01NEWT extends UITestCase { public void test03ShaderState_PerformanceSingleToggleEnable() throws InterruptedException { testShaderState_PerformanceSingleImpl(true); } - - private void testShaderState_PerformanceSingleImpl(boolean toggleEnable) throws InterruptedException { + + private void testShaderState_PerformanceSingleImpl(final boolean toggleEnable) throws InterruptedException { // preset .. final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow( new GLCapabilities(GLProfile.getGL2ES2()), 480, 480, false); @@ -310,12 +312,12 @@ public class TestGLSLShaderState01NEWT extends UITestCase { final GL2ES2 gl = winctx.context.getGL().getGL2ES2(); System.err.println(winctx.context); gl.setSwapInterval(0); - + Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - - // test code .. + + // test code .. final ShaderState st = new ShaderState(); - + final ShaderCode rsVp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, RedSquareES2.class, "shader", "shader/bin", "RedSquareShader", true); final ShaderCode rsFp = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, RedSquareES2.class, "shader", @@ -326,70 +328,70 @@ public class TestGLSLShaderState01NEWT extends UITestCase { final ShaderProgram sp = new ShaderProgram(); sp.add(rsVp); sp.add(rsFp); - + sp.init(gl); Assert.assertTrue(sp.link(gl, System.err)); - - st.attachShaderProgram(gl, sp, true); - + + st.attachShaderProgram(gl, sp, true); + // setup mgl_PMVMatrix final PMVMatrix pmvMatrix = new PMVMatrix(); - final GLUniformData pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); + final GLUniformData pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); st.ownUniform(pmvMatrixUniform); st.uniform(gl, pmvMatrixUniform); - + // Allocate Vertex Array0 final GLArrayDataServer vertices0 = GLSLMiscHelper.createVertices(gl, st, 0, -1, GLSLMiscHelper.vertices0); vertices0.enableBuffer(gl, toggleEnable ? false : true); - + // Allocate Color Array0 final GLArrayDataServer colors0 = GLSLMiscHelper.createColors(gl, st, 0, -1, GLSLMiscHelper.colors0); colors0.enableBuffer(gl, toggleEnable ? false : true); - + // misc GL setup gl.glClearColor(0, 0, 0, 1); - gl.glEnable(GL2ES2.GL_DEPTH_TEST); + gl.glEnable(GL.GL_DEPTH_TEST); // reshape - pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); pmvMatrix.gluPerspective(45.0F, (float) drawable.getSurfaceWidth() / (float) drawable.getSurfaceHeight(), 1.0F, 100.0F); - pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrix.glTranslatef(0, 0, -10); st.uniform(gl, pmvMatrixUniform); - gl.glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); + gl.glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); gl.setSwapInterval(0); - + // validation .. GLSLMiscHelper.displayVCArrays(drawable, gl, st, toggleEnable, vertices0, colors0, toggleEnable, 1, 0); - + // warmup .. for(int frames=0; frames d "+delta+", exp "+expWE+", equal "+equalWE+", comp "+compWE+" - "+msgWE+", epsilon "+EPSILON); } - private void dumpTestNE(int tstNum, int exp, final float a, final float b) { + private void dumpTestNE(final int tstNum, final int exp, final float a, final float b) { final float delta = a-b; final boolean equal = FloatUtil.isEqual(a, b); final int comp = FloatUtil.compare(a, b); @@ -102,7 +102,7 @@ public class TestFloatUtil01NOUI { dumpTestWE(i++, 1, 0f, 0f+EPSILON-Float.MIN_VALUE, EPSILON); dumpTestWE(i++, 1, 0f, 0f-EPSILON+Float.MIN_VALUE, EPSILON); } - private void testZeroWithEpsilon(int tstNum, boolean exp, final float a, final float EPSILON) { + private void testZeroWithEpsilon(final int tstNum, final boolean exp, final float a, final float EPSILON) { final boolean zero = FloatUtil.isZero(a, EPSILON); final float delta = a-0f; System.err.println("Zero."+tstNum+": a: "+a+", -> d "+delta+", exp "+exp+", zero "+zero+", epsilon "+EPSILON); @@ -134,7 +134,7 @@ public class TestFloatUtil01NOUI { dumpTestNE(i++, 0, 1f, 1f+Float.MIN_VALUE); dumpTestNE(i++, 0, 0f, 0f+Float.MIN_VALUE); } - private void testEqualsNoEpsilon(int tstNum, boolean exp, final float a, final float b) { + private void testEqualsNoEpsilon(final int tstNum, final boolean exp, final float a, final float b) { final boolean equal = FloatUtil.isEqual(a, b); final int comp = FloatUtil.compare(a, b); final float delta = a-b; @@ -174,7 +174,7 @@ public class TestFloatUtil01NOUI { dumpTestWE(i++, 1, 1f, 1f+EPSILON-Float.MIN_VALUE, EPSILON); dumpTestWE(i++, 1, 1f, 1f-EPSILON+Float.MIN_VALUE, EPSILON); } - private void testEqualsWithEpsilon(int tstNum, boolean exp, final float a, final float b, final float EPSILON) { + private void testEqualsWithEpsilon(final int tstNum, final boolean exp, final float a, final float b, final float EPSILON) { final boolean equal = FloatUtil.isEqual(a, b, EPSILON); final int comp = FloatUtil.compare(a, b, EPSILON); final float delta = a-b; @@ -221,7 +221,7 @@ public class TestFloatUtil01NOUI { dumpTestNE(i++, 0, 1f, 1f+Float.MIN_VALUE); dumpTestNE(i++, 0, 0f, 0f+Float.MIN_VALUE); } - private void testCompareNoEpsilon(int tstNum, final int exp, final float a, final float b) { + private void testCompareNoEpsilon(final int tstNum, final int exp, final float a, final float b) { final boolean equal = FloatUtil.isEqual(a, b); final int comp = FloatUtil.compare(a, b); final float delta = a-b; @@ -267,7 +267,7 @@ public class TestFloatUtil01NOUI { testCompareWithEpsilon(i++, 0, -0f, 0f, EPSILON); testCompareWithEpsilon(i++, 0, 0f, -0f, EPSILON); } - private void testCompareWithEpsilon(int tstNum, final int exp, final float a, final float b, float EPSILON) { + private void testCompareWithEpsilon(final int tstNum, final int exp, final float a, final float b, final float EPSILON) { final boolean equal = FloatUtil.isEqual(a, b, EPSILON); final int comp = FloatUtil.compare(a, b, EPSILON); final float delta = a-b; @@ -276,7 +276,7 @@ public class TestFloatUtil01NOUI { } - public static void main(String args[]) { + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestFloatUtil01NOUI.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil02MatrixMatrixMultNOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil02MatrixMatrixMultNOUI.java index feb5d3245..13285ac0b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil02MatrixMatrixMultNOUI.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil02MatrixMatrixMultNOUI.java @@ -59,8 +59,8 @@ public class TestFloatUtil02MatrixMatrixMultNOUI { 893, 116, 116, 113, 748, 116, 120, 104, 1182, 113, 104, 131 }; - - public static final void multMatrixf_RM(final float[] a, int a_off, final float[] b, int b_off, float[] d, int d_off) { + + public static final void multMatrixf_RM(final float[] a, final int a_off, final float[] b, final int b_off, final float[] d, final int d_off) { for (int i = 0; i < 4; i++) { final float ai0=a[a_off+i*4+0], ai1=a[a_off+i*4+1], ai2=a[a_off+i*4+2], ai3=a[a_off+i*4+3]; d[d_off+i*4+0] = ai0 * b[b_off+0*4+0] + ai1 * b[b_off+1*4+0] + ai2 * b[b_off+2*4+0] + ai3 * b[b_off+3*4+0] ; @@ -73,7 +73,7 @@ public class TestFloatUtil02MatrixMatrixMultNOUI { @Test public void testCM_m1xm2(){ - float[] r = new float[16]; + final float[] r = new float[16]; FloatUtil.multMatrix(m1, 0, m2, 0, r, 0); @@ -83,7 +83,7 @@ public class TestFloatUtil02MatrixMatrixMultNOUI { @Test public void testCM_m2xm1(){ - float[] r = new float[16]; + final float[] r = new float[16]; FloatUtil.multMatrix(m2, 0, m1, 0, r, 0); @@ -93,8 +93,8 @@ public class TestFloatUtil02MatrixMatrixMultNOUI { @Test public void testRM_m1xm2(){ - float[] r = new float[16]; - + final float[] r = new float[16]; + multMatrixf_RM(m1, 0, m2, 0, r, 0); Assert.assertArrayEquals(m1xm2_RM, r, 0f); @@ -103,14 +103,14 @@ public class TestFloatUtil02MatrixMatrixMultNOUI { @Test public void testRM_m2xm1(){ - float[] r = new float[16]; - + final float[] r = new float[16]; + multMatrixf_RM(m2, 0, m1, 0, r, 0); Assert.assertArrayEquals(m2xm1_RM, r, 0f); } - public static void main(String args[]) { + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestFloatUtil02MatrixMatrixMultNOUI.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil03InversionNOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil03InversionNOUI.java index e9558b251..a2aa69863 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil03InversionNOUI.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil03InversionNOUI.java @@ -96,7 +96,7 @@ public class TestFloatUtil03InversionNOUI { @Test public void test02(){ - float[] p = new float[] { 2.3464675f, 0, 0, 0, + final float[] p = new float[] { 2.3464675f, 0, 0, 0, 0, 2.4142134f, 0, 0, 0, 0, -1.0002f, -1, 0, 0, -20.002f, 0 }; @@ -105,7 +105,7 @@ public class TestFloatUtil03InversionNOUI { @Test public void test03(){ - float[] mv = new float[] { 1, 0, 0, 0, + final float[] mv = new float[] { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, -200, 1 } ; @@ -114,7 +114,7 @@ public class TestFloatUtil03InversionNOUI { @Test public void test04(){ - float[] p = new float[] { 2.3464675f, 0, 0, 0, + final float[] p = new float[] { 2.3464675f, 0, 0, 0, 0, 2.4142134f, 0, 0, 0, 0, -1.0002f, -1, 0, 0, -20.002f, 0 }; @@ -124,12 +124,12 @@ public class TestFloatUtil03InversionNOUI { @Test public void test05Perf(){ - float[] p1 = new float[] { 2.3464675f, 0, 0, 0, + final float[] p1 = new float[] { 2.3464675f, 0, 0, 0, 0, 2.4142134f, 0, 0, 0, 0, -1.0002f, -1, 0, 0, -20.002f, 0 }; - float[] p2 = new float[]{ 26, 59, 143, 71, + final float[] p2 = new float[]{ 26, 59, 143, 71, 59, 174, 730, 386, 143, 730, 9770, 5370, 71, 386, 5370, 2954 }; @@ -256,7 +256,7 @@ public class TestFloatUtil03InversionNOUI { return mres; } - public static void main(String args[]) { + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestFloatUtil03InversionNOUI.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectDoubleNOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectDoubleNOUI.java index db40dad15..d10a04845 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectDoubleNOUI.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectDoubleNOUI.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.math; import javax.media.opengl.glu.GLU; @@ -51,10 +51,10 @@ public class TestGluUnprojectDoubleNOUI { final int[] viewport = new int[]{0,0,800,600}; final double[] objCoords = new double[]{Double.NaN,Double.NaN,Double.NaN}; glu.gluUnProject(pickedPoint[0], pickedPoint[1], pickedPointDepth, sceneModelViewValues, 0, projectionValues, 0, viewport, 0, objCoords, 0); - Assert.assertTrue(!Double.isNaN(objCoords[0])&&!Double.isNaN(objCoords[1])&&!Double.isNaN(objCoords[2])); + Assert.assertTrue(!Double.isNaN(objCoords[0])&&!Double.isNaN(objCoords[1])&&!Double.isNaN(objCoords[2])); } - - public static void main(String args[]) { + + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestGluUnprojectDoubleNOUI.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectFloatNOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectFloatNOUI.java index 0f9a45fd7..278c2450a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectFloatNOUI.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestGluUnprojectFloatNOUI.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.math; import javax.media.opengl.glu.GLU; @@ -37,7 +37,7 @@ import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestGluUnprojectFloatNOUI { - + @Test public void testNaN(){ final GLU glu = new GLU(); @@ -48,59 +48,59 @@ public class TestGluUnprojectFloatNOUI { final int[] viewport = new int[]{0,0,800,600}; final float[] objCoords = new float[]{Float.NaN,Float.NaN,Float.NaN}; glu.gluUnProject(pickedPoint[0], pickedPoint[1], pickedPointDepth, sceneModelViewValues, 0, projectionValues, 0, viewport, 0, objCoords, 0); - Assert.assertTrue(!Double.isNaN(objCoords[0])&&!Double.isNaN(objCoords[1])&&!Double.isNaN(objCoords[2])); + Assert.assertTrue(!Double.isNaN(objCoords[0])&&!Double.isNaN(objCoords[1])&&!Double.isNaN(objCoords[2])); } - + @Test public void test01(){ - float[] mv = new float[] { 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, + final float[] mv = new float[] { 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, 0, 0, 0, 1 }; - - float[] p = new float[] { 2.3464675f, 0, 0, 0, - 0, 2.4142134f, 0, 0, - 0, 0, -1.0002f, -1, + + final float[] p = new float[] { 2.3464675f, 0, 0, 0, + 0, 2.4142134f, 0, 0, + 0, 0, -1.0002f, -1, 0, 0, -20.002f, 0 }; - - int[] v = new int[] { 0, 0, 1000, 1000 }; - - float[] s = new float[] { 250, 250, 0.5f }; - - float[] expected = new float[] { -4.2612f, -4.1417f, -19.9980f }; - float[] result = new float[] { 0, 0, 0 }; - + + final int[] v = new int[] { 0, 0, 1000, 1000 }; + + final float[] s = new float[] { 250, 250, 0.5f }; + + final float[] expected = new float[] { -4.2612f, -4.1417f, -19.9980f }; + final float[] result = new float[] { 0, 0, 0 }; + final GLU glu = new GLU(); glu.gluUnProject(s[0], s[1], s[2], mv, 0, p, 0, v, 0, result, 0); - + Assert.assertArrayEquals(expected, result, 0.0001f); } @Test public void test02(){ - float[] mv = new float[] { 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, + final float[] mv = new float[] { 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, 0, 0, -200, 1 } ; - - float[] p = new float[] { 2.3464675f, 0, 0, 0, - 0, 2.4142134f, 0, 0, - 0, 0, -1.0002f, -1, + + final float[] p = new float[] { 2.3464675f, 0, 0, 0, + 0, 2.4142134f, 0, 0, + 0, 0, -1.0002f, -1, 0, 0, -20.002f, 0 }; - - int[] v = new int[] { 0, 0, 1000, 1000 }; - - float[] s = new float[] { 250, 250, 0.5f }; - float[] expected = new float[] { -4.2612f, -4.1417f, 180.002f }; - float[] result = new float[] { 0, 0, 0 }; - + + final int[] v = new int[] { 0, 0, 1000, 1000 }; + + final float[] s = new float[] { 250, 250, 0.5f }; + final float[] expected = new float[] { -4.2612f, -4.1417f, 180.002f }; + final float[] result = new float[] { 0, 0, 0 }; + final GLU glu = new GLU(); glu.gluUnProject(s[0], s[1], s[2], mv, 0, p, 0, v, 0, result, 0); - + Assert.assertArrayEquals(expected, result, 0.0001f); } - - public static void main(String args[]) { + + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestGluUnprojectFloatNOUI.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java index 464a43ac8..e111887f7 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java @@ -38,6 +38,8 @@ import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLProfile; import javax.media.opengl.fixedfunc.GLMatrixFunc; +import jogamp.common.os.PlatformPropsImpl; + import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; @@ -345,7 +347,7 @@ public class TestPMVMatrix01NEWT extends UITestCase { final FloatBuffer glMv = FloatBuffer.allocate(16); { - GL2ES1 gl = dc.glc.getGL().getGL2ES1(); + final GL2ES1 gl = dc.glc.getGL().getGL2ES1(); gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); @@ -356,8 +358,8 @@ public class TestPMVMatrix01NEWT extends UITestCase { } // System.err.println(PMVMatrix.matrixToString(null, "%10.5f", glMv, pmvMv).toString()); - MiscUtils.assertFloatBufferEquals("Arrays not equal, expected"+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", glMv).toString()+ - ", actual"+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", pmvMv).toString(), + MiscUtils.assertFloatBufferEquals("Arrays not equal, expected"+PlatformPropsImpl.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", glMv).toString()+ + ", actual"+PlatformPropsImpl.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", pmvMv).toString(), glMv, pmvMv, epsilon); // System.err.println("pmvMvi: "+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", pmvMvi)); @@ -384,7 +386,7 @@ public class TestPMVMatrix01NEWT extends UITestCase { final FloatBuffer glMv = FloatBuffer.allocate(16); { - GL2ES1 gl = dc.glc.getGL().getGL2ES1(); + final GL2ES1 gl = dc.glc.getGL().getGL2ES1(); gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); @@ -396,8 +398,8 @@ public class TestPMVMatrix01NEWT extends UITestCase { } // System.err.println(PMVMatrix.matrixToString(null, "%10.5f", glMv, pmvMv).toString()); - MiscUtils.assertFloatBufferEquals("Arrays not equal, expected"+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", glMv).toString()+ - ", actual"+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", pmvMv).toString(), + MiscUtils.assertFloatBufferEquals("Arrays not equal, expected"+PlatformPropsImpl.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", glMv).toString()+ + ", actual"+PlatformPropsImpl.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", pmvMv).toString(), glMv, pmvMv, epsilon); // System.err.println("pmvMvi: "+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", pmvMvi)); @@ -410,7 +412,7 @@ public class TestPMVMatrix01NEWT extends UITestCase { public static void setup() throws Throwable { try { dc = createOffscreenDrawableAndCurrentFFPContext(); - } catch (Throwable t) { + } catch (final Throwable t) { setTestSupported(false); throw t; } @@ -422,7 +424,7 @@ public class TestPMVMatrix01NEWT extends UITestCase { } static class DrawableContext { - DrawableContext(GLDrawable d, GLContext glc) { + DrawableContext(final GLDrawable d, final GLContext glc) { this.d = d; this.glc = glc; } @@ -431,19 +433,19 @@ public class TestPMVMatrix01NEWT extends UITestCase { } private static DrawableContext createOffscreenDrawableAndCurrentFFPContext() throws Throwable { - GLProfile glp = GLProfile.getMaxFixedFunc(true); - GLCapabilities glCaps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.getMaxFixedFunc(true); + final GLCapabilities glCaps = new GLCapabilities(glp); glCaps.setOnscreen(false); glCaps.setPBuffer(true); - GLDrawableFactory factory = GLDrawableFactory.getFactory(glp); - GLDrawable d = factory.createOffscreenDrawable(null, glCaps, null, 64, 64); + final GLDrawableFactory factory = GLDrawableFactory.getFactory(glp); + final GLDrawable d = factory.createOffscreenDrawable(null, glCaps, null, 64, 64); d.setRealized(true); GLContext glc = null; try { glc = d.createContext(null); Assert.assertTrue("Context could not be made current", GLContext.CONTEXT_NOT_CURRENT < glc.makeCurrent()); return new DrawableContext(d, glc); - } catch (Throwable t) { + } catch (final Throwable t) { if(null != glc) { glc.destroy(); } @@ -452,7 +454,7 @@ public class TestPMVMatrix01NEWT extends UITestCase { } } - private static void destroyDrawableContext(DrawableContext dc) { + private static void destroyDrawableContext(final DrawableContext dc) { if(null != dc.glc) { dc.glc.destroy(); dc.glc = null; @@ -463,7 +465,7 @@ public class TestPMVMatrix01NEWT extends UITestCase { } } - public static void main(String args[]) { + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestPMVMatrix01NEWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix02NOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix02NOUI.java index 2c3a6f36a..7250e438d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix02NOUI.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix02NOUI.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.math; import org.junit.Before; @@ -62,8 +62,8 @@ public class TestPMVMatrix02NOUI { 0, 0, -1, 0, 1, 0 ); - FloatBuffer mvMatrix = fMat.glGetMvMatrixf(); - float[] mvMatrixArr = new float[16]; + final FloatBuffer mvMatrix = fMat.glGetMvMatrixf(); + final float[] mvMatrixArr = new float[16]; mvMatrix.asReadOnlyBuffer().get(mvMatrixArr); assertArrayEquals( /** @@ -88,8 +88,8 @@ public class TestPMVMatrix02NOUI { 0, 1, 0, 0, 0, 1 ); - FloatBuffer mvMatrix = fMat.glGetMvMatrixf(); - float[] mvMatrixArr = new float[16]; + final FloatBuffer mvMatrix = fMat.glGetMvMatrixf(); + final float[] mvMatrixArr = new float[16]; mvMatrix.asReadOnlyBuffer().get(mvMatrixArr); assertArrayEquals( /** @@ -106,7 +106,7 @@ public class TestPMVMatrix02NOUI { ); } - public static void main(String args[]) { + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestPMVMatrix02NOUI.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix03NOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix03NOUI.java index d832dbadf..87e759919 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix03NOUI.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix03NOUI.java @@ -2,6 +2,8 @@ package com.jogamp.opengl.test.junit.jogl.math; import java.util.Arrays; +import javax.media.opengl.fixedfunc.GLMatrixFunc; + import jogamp.opengl.ProjectFloat; import com.jogamp.opengl.math.FloatUtil; @@ -49,7 +51,7 @@ public class TestPMVMatrix03NOUI { FloatUtil.mapObjToWinCoords(0f, 0f, 0f, mat4PMv, viewport, 0, winB01, 0, vec4Tmp1, vec4Tmp2); System.err.println("B.0.1 - Project 0,0 -->" + Arrays.toString(winB01)); - m.glMatrixMode(PMVMatrix.GL_PROJECTION); + m.glMatrixMode(GLMatrixFunc.GL_PROJECTION); m.glOrthof(0, 10, 0, 10, 1, -1); System.err.println("MATRIX - Ortho 0,0,10,10 - Locate the origin in the bottom left and scale"); System.err.println(m); @@ -74,12 +76,12 @@ public class TestPMVMatrix03NOUI { //////////////////// ///////////////////// - float[] winC00 = new float[4]; - float[] winC01 = new float[4]; - float[] winC10 = new float[4]; - float[] winC11 = new float[4]; - float[] projMatrixC = new float[16]; - float[] modelMatrixC = new float[16]; + final float[] winC00 = new float[4]; + final float[] winC01 = new float[4]; + final float[] winC10 = new float[4]; + final float[] winC11 = new float[4]; + final float[] projMatrixC = new float[16]; + final float[] modelMatrixC = new float[16]; FloatUtil.makeIdentity(projMatrixC); FloatUtil.makeIdentity(modelMatrixC); final ProjectFloat projectFloat = new ProjectFloat(); @@ -131,7 +133,7 @@ public class TestPMVMatrix03NOUI { final float ty=-1.0f*(top+bottom)/dy; final float tz=-1.0f*(zFar+zNear)/dz; - float[] matrixOrtho = new float[16]; + final float[] matrixOrtho = new float[16]; FloatUtil.makeIdentity(matrixOrtho); matrixOrtho[0+4*0] = 2.0f/dx; matrixOrtho[1+4*1] = 2.0f/dy; @@ -143,7 +145,7 @@ public class TestPMVMatrix03NOUI { FloatUtil.multMatrix(m, 0, matrixOrtho, 0); } - public static void main(String args[]) { + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestPMVMatrix03NOUI.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java index 6881dab8f..d6d7131fa 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestQuaternion01NOUI.java @@ -248,7 +248,7 @@ public class TestQuaternion01NOUI { final float[] vecHas = new float[3]; final float[] vecOut2 = new float[4]; float[] mat1 = new float[4*4]; - float[] mat2 = new float[4*4]; + final float[] mat2 = new float[4*4]; final Quaternion quat = new Quaternion(); // @@ -401,8 +401,8 @@ public class TestQuaternion01NOUI { // a = FloatUtil.QUARTER_PI; - float[] vecExp = new float[3]; - float[] vecCol = new float[3]; + final float[] vecExp = new float[3]; + final float[] vecCol = new float[3]; mat1 = new float[] { // Column Order FloatUtil.cos(a), FloatUtil.sin(a), 0, 0, // -FloatUtil.sin(a), FloatUtil.cos(a), 0, 0, @@ -811,7 +811,7 @@ public class TestQuaternion01NOUI { Assert.assertEquals(0f, VectorUtil.distVec3(direction, vecHas), Quaternion.ALLOWED_DEVIANCE); } - public static void main(String args[]) { + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestQuaternion01NOUI.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java b/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java index 3bc5159a6..883bf4362 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java @@ -85,7 +85,7 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase { boolean modLightBrighter = true; - Color modLight(Color c) { + Color modLight(final Color c) { Color c2; if(modLightBrighter) { c2 = c.brighter(); @@ -99,18 +99,18 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase { } class SwingGLAction implements GLEventListener { - public void init(GLAutoDrawable glad) { + public void init(final GLAutoDrawable glad) { } - public void dispose(GLAutoDrawable glad) { + public void dispose(final GLAutoDrawable glad) { } - public void display(GLAutoDrawable glad) { + public void display(final GLAutoDrawable glad) { colorPanel.setBackground(modLight(colorPanel.getBackground())); colorPanel.repaint(); } - public void reshape(GLAutoDrawable glad, final int x, final int y, final int width, final int height) { + public void reshape(final GLAutoDrawable glad, final int x, final int y, final int width, final int height) { } } @@ -127,21 +127,21 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase { button = new JButton("Click me"); button.addMouseListener(new MouseAdapter() { - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { System.err.println("Test: "+e); } }); panel.add(button, BorderLayout.NORTH); colorPanel = new JPanel(); - Dimension size = new Dimension(400,100); + final Dimension size = new Dimension(400,100); colorPanel.setPreferredSize(size); colorPanel.setBorder(border); panel.add(colorPanel, BorderLayout.SOUTH); frame = new JFrame("PRE JOGL"); frame.addWindowListener( new WindowAdapter() { - public void windowClosing(WindowEvent ev) { + public void windowClosing(final WindowEvent ev) { windowClosing=true; } }); @@ -199,10 +199,10 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase { System.err.println("TestSwingAWTRobotUsageBeforeJOGLInitBug411.release(): End"); } - protected void runTestGL(final Canvas canvas, GLAutoDrawable drawable) + protected void runTestGL(final Canvas canvas, final GLAutoDrawable drawable) throws AWTException, InterruptedException, InvocationTargetException { - Dimension size = new Dimension(400,400); + final Dimension size = new Dimension(400,400); canvas.setPreferredSize(size); javax.swing.SwingUtilities.invokeAndWait(new Runnable() { @@ -232,7 +232,7 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase { colorPanel.setBackground(Color.blue); drawable.addGLEventListener(new SwingGLAction()); - Point p0 = canvas.getLocationOnScreen(); + final Point p0 = canvas.getLocationOnScreen(); p0.translate(10,10); robot.mouseMove( (int) ( p0.getX() + .5 ) , (int) ( p0.getY() + .5 ) ); @@ -262,23 +262,23 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase { public void test01NewtCanvasAWT() throws AWTException, InterruptedException, InvocationTargetException { System.err.println("TestSwingAWTRobotUsageBeforeJOGLInitBug411.test01NewtCanvasAWT(): Start"); - GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.getGL2ES2(); + final GLCapabilities caps = new GLCapabilities(glp); - GLWindow win0 = GLWindow.create(caps); + final GLWindow win0 = GLWindow.create(caps); win0.setSize(100,100); win0.setVisible(true); Assert.assertEquals(true, AWTRobotUtil.waitForRealized(win0, true)); - Screen screen = win0.getScreen(); + final Screen screen = win0.getScreen(); final RectangleImmutable screenBoundsInWinU = screen.getViewportInWindowUnits(); win0.setPosition(screenBoundsInWinU.getX()-150, 0); win0.addGLEventListener(new GearsES2()); - Animator anim = new Animator(win0); + final Animator anim = new Animator(win0); anim.start(); - GLWindow win1 = GLWindow.create(caps); - NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(win1); + final GLWindow win1 = GLWindow.create(caps); + final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(win1); anim.add(win1); runTestGL(newtCanvasAWT, win1); @@ -301,10 +301,10 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase { @Test public void test02GLCanvas() throws AWTException, InterruptedException, InvocationTargetException { System.err.println("TestSwingAWTRobotUsageBeforeJOGLInitBug411.test02GLCanvas(): Start"); - GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.getGL2ES2(); + final GLCapabilities caps = new GLCapabilities(glp); - Animator anim = new Animator(); + final Animator anim = new Animator(); anim.start(); /** @@ -320,7 +320,7 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase { anim.add(win0); */ - GLCanvas glCanvas = new GLCanvas(caps); + final GLCanvas glCanvas = new GLCanvas(caps); anim.add(glCanvas); runTestGL(glCanvas, glCanvas); @@ -335,15 +335,15 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase { System.err.println("TestSwingAWTRobotUsageBeforeJOGLInitBug411.test02GLCanvas(): End"); } - static int atoi(String a) { + static int atoi(final String a) { int i=0; try { i = Integer.parseInt(a); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } return i; } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i0; - Surface2File s2f = new Surface2File(testName, alpha); + final Surface2File s2f = new Surface2File(testName, alpha); windowOffScreen.addSurfaceUpdatedListener(s2f); } if(null!=ul) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit01AWT.java index 0ca84e4c3..33c918b66 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit01AWT.java @@ -96,15 +96,15 @@ public class TestPerf001GLJPanelInit01AWT extends UITestCase { final GLAutoDrawable glad = useGLJPanel ? createGLJPanel(caps, useGears, animator, eSize) : createGLCanvas(caps, useGears, animator, eSize); glad.addGLEventListener(new GLEventListener() { @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { initCount++; } @Override - public void dispose(GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) {} @Override - public void display(GLAutoDrawable drawable) {} + public void display(final GLAutoDrawable drawable) {} @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {} + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {} }); panel.add((Component)glad); } @@ -116,7 +116,7 @@ public class TestPerf001GLJPanelInit01AWT extends UITestCase { frame.setVisible(true); t[2] = Platform.currentTimeMillis(); } } ); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -126,7 +126,7 @@ public class TestPerf001GLJPanelInit01AWT extends UITestCase { try { Thread.sleep(100); System.err.println("Sleep initialized: "+initCount+"/"+panelCount); - } catch (InterruptedException e1) { + } catch (final InterruptedException e1) { e1.printStackTrace(); } t1 = System.currentTimeMillis(); @@ -145,7 +145,7 @@ public class TestPerf001GLJPanelInit01AWT extends UITestCase { } try { Thread.sleep(duration); - } catch (InterruptedException e1) { + } catch (final InterruptedException e1) { e1.printStackTrace(); } t[4] = Platform.currentTimeMillis(); @@ -154,7 +154,7 @@ public class TestPerf001GLJPanelInit01AWT extends UITestCase { public void run() { frame.dispose(); } } ); - } catch (Exception e1) { + } catch (final Exception e1) { e1.printStackTrace(); } final long ti_net = (t[4]-t[0])-duration; @@ -165,8 +165,8 @@ public class TestPerf001GLJPanelInit01AWT extends UITestCase { System.err.println("Total: "+(t[4]-t[0])); } - private GLAutoDrawable createGLCanvas(GLCapabilitiesImmutable caps, boolean useGears, GLAnimatorControl anim, Dimension size) { - GLCanvas canvas = new GLCanvas(caps); + private GLAutoDrawable createGLCanvas(final GLCapabilitiesImmutable caps, final boolean useGears, final GLAnimatorControl anim, final Dimension size) { + final GLCanvas canvas = new GLCanvas(caps); canvas.setSize(size); canvas.setPreferredSize(size); if( useGears ) { @@ -177,8 +177,8 @@ public class TestPerf001GLJPanelInit01AWT extends UITestCase { } return canvas; } - private GLAutoDrawable createGLJPanel(GLCapabilitiesImmutable caps, boolean useGears, GLAnimatorControl anim, Dimension size) { - GLJPanel canvas = new GLJPanel(caps); + private GLAutoDrawable createGLJPanel(final GLCapabilitiesImmutable caps, final boolean useGears, final GLAnimatorControl anim, final Dimension size) { + final GLJPanel canvas = new GLJPanel(caps); canvas.setSize(size); canvas.setPreferredSize(size); if( useGears ) { @@ -197,7 +197,7 @@ public class TestPerf001GLJPanelInit01AWT extends UITestCase { @Test public void test02NopGLJPanelBitmap() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(null); + final GLCapabilities caps = new GLCapabilities(null); caps.setBitmap(true); test(caps, false /*useGears*/, width, height, rows, cols, true /* useGLJPanel */, false /*useAnim*/); } @@ -213,7 +213,7 @@ public class TestPerf001GLJPanelInit01AWT extends UITestCase { volatile int initCount = 0; - public static void main(String[] args) { + public static void main(final String[] args) { boolean useGLJPanel = true, useGears = false, manual=false; boolean waitMain = false; @@ -248,7 +248,7 @@ public class TestPerf001GLJPanelInit01AWT extends UITestCase { } if( manual ) { GLProfile.initSingleton(); - TestPerf001GLJPanelInit01AWT demo = new TestPerf001GLJPanelInit01AWT(); + final TestPerf001GLJPanelInit01AWT demo = new TestPerf001GLJPanelInit01AWT(); demo.test(null, useGears, width, height, rows, cols, useGLJPanel, false /*useAnim*/); } else { org.junit.runner.JUnitCore.main(TestPerf001GLJPanelInit01AWT.class.getName()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit02AWT.java index 2b1dc411f..0cbcd5e2f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit02AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLJPanelInit02AWT.java @@ -120,15 +120,15 @@ public class TestPerf001GLJPanelInit02AWT extends UITestCase { if( null != glad ) { glad.addGLEventListener(new GLEventListener() { @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { initCount++; } @Override - public void dispose(GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) {} @Override - public void display(GLAutoDrawable drawable) {} + public void display(final GLAutoDrawable drawable) {} @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {} + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {} }); panel.add((Component)glad); } else { @@ -143,7 +143,7 @@ public class TestPerf001GLJPanelInit02AWT extends UITestCase { } @SuppressWarnings("deprecation") @Override - public void reshape(int x, int y, int width, int height) { + public void reshape(final int x, final int y, final int width, final int height) { super.reshape(x, y, width, height); reshapeWidth = width; reshapeHeight = height; } @@ -172,7 +172,7 @@ public class TestPerf001GLJPanelInit02AWT extends UITestCase { } t[2] = Platform.currentTimeMillis(); } } ); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -182,7 +182,7 @@ public class TestPerf001GLJPanelInit02AWT extends UITestCase { try { Thread.sleep(100); System.err.println("Sleep initialized: "+initCount+"/"+frameCount); - } catch (InterruptedException e1) { + } catch (final InterruptedException e1) { e1.printStackTrace(); } t1 = System.currentTimeMillis(); @@ -202,7 +202,7 @@ public class TestPerf001GLJPanelInit02AWT extends UITestCase { } try { Thread.sleep(duration); - } catch (InterruptedException e1) { + } catch (final InterruptedException e1) { e1.printStackTrace(); } t[4] = Platform.currentTimeMillis(); @@ -213,7 +213,7 @@ public class TestPerf001GLJPanelInit02AWT extends UITestCase { frame[i].dispose(); } } } ); - } catch (Exception e1) { + } catch (final Exception e1) { e1.printStackTrace(); } @@ -225,8 +225,8 @@ public class TestPerf001GLJPanelInit02AWT extends UITestCase { System.err.println("Total: "+(t[4]-t[0])); } - private GLAutoDrawable createGLCanvas(GLCapabilitiesImmutable caps, boolean useGears, GLAnimatorControl anim, Dimension size) { - GLCanvas canvas = new GLCanvas(caps); + private GLAutoDrawable createGLCanvas(final GLCapabilitiesImmutable caps, final boolean useGears, final GLAnimatorControl anim, final Dimension size) { + final GLCanvas canvas = new GLCanvas(caps); canvas.setSize(size); canvas.setPreferredSize(size); if( useGears ) { @@ -239,8 +239,8 @@ public class TestPerf001GLJPanelInit02AWT extends UITestCase { } return canvas; } - private GLAutoDrawable createGLJPanel(boolean initMT, boolean useSwingDoubleBuffer, GLCapabilitiesImmutable caps, boolean useGears, boolean skipGLOrientationVerticalFlip, GLAnimatorControl anim, Dimension size) { - GLJPanel canvas = new GLJPanel(caps); + private GLAutoDrawable createGLJPanel(final boolean initMT, final boolean useSwingDoubleBuffer, final GLCapabilitiesImmutable caps, final boolean useGears, final boolean skipGLOrientationVerticalFlip, final GLAnimatorControl anim, final Dimension size) { + final GLJPanel canvas = new GLJPanel(caps); canvas.setSize(size); canvas.setPreferredSize(size); canvas.setDoubleBuffered(useSwingDoubleBuffer); @@ -370,7 +370,7 @@ public class TestPerf001GLJPanelInit02AWT extends UITestCase { // @Test public void testXXNopGLJPanelBitmapGridSingle() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(null); + final GLCapabilities caps = new GLCapabilities(null); caps.setBitmap(true); test(caps, false /*useGears*/, false /*skipGLOrientationVerticalFlip*/, width , height, frameCount, false /* initMT */, true /* useGLJPanel */, false /*useSwingDoubleBuffer*/, false /* useGLCanvas */, false /*useAnim*/, false); @@ -382,7 +382,7 @@ public class TestPerf001GLJPanelInit02AWT extends UITestCase { volatile int initCount = 0; - public static void main(String[] args) { + public static void main(final String[] args) { boolean manual=false; boolean waitMain = false; boolean useGLJPanel = true, initMT = false, useGLCanvas = false, useSwingDoubleBuffer=false; @@ -435,7 +435,7 @@ public class TestPerf001GLJPanelInit02AWT extends UITestCase { } if( manual ) { GLProfile.initSingleton(); - TestPerf001GLJPanelInit02AWT demo = new TestPerf001GLJPanelInit02AWT(); + final TestPerf001GLJPanelInit02AWT demo = new TestPerf001GLJPanelInit02AWT(); demo.test(null, useGears, skipGLOrientationVerticalFlip, width, height, frameCount, initMT, useGLJPanel, useSwingDoubleBuffer, useGLCanvas, useAnim, overlap); } else { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLWindowInit03NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLWindowInit03NEWT.java index 18b3d5454..d3dddc56f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLWindowInit03NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001GLWindowInit03NEWT.java @@ -60,7 +60,7 @@ public class TestPerf001GLWindowInit03NEWT extends UITestCase { GLProfile.initSingleton(); } - public void test(final GLCapabilitiesImmutable caps, final boolean useGears, final int width, final int height, final int frameCount, boolean reuseDevice) { + public void test(final GLCapabilitiesImmutable caps, final boolean useGears, final int width, final int height, final int frameCount, final boolean reuseDevice) { final int cols = (int)Math.round(Math.sqrt(frameCount)); final int rows = frameCount / cols; final int eWidth = width/cols; @@ -92,15 +92,15 @@ public class TestPerf001GLWindowInit03NEWT extends UITestCase { } frame[i].addGLEventListener(new GLEventListener() { @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { initCount++; } @Override - public void dispose(GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) {} @Override - public void display(GLAutoDrawable drawable) {} + public void display(final GLAutoDrawable drawable) {} @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {} + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {} }); } t[1] = Platform.currentTimeMillis(); @@ -115,7 +115,7 @@ public class TestPerf001GLWindowInit03NEWT extends UITestCase { try { Thread.sleep(100); System.err.println("Sleep initialized: "+initCount+"/"+frameCount); - } catch (InterruptedException e1) { + } catch (final InterruptedException e1) { e1.printStackTrace(); } t1 = System.currentTimeMillis(); @@ -134,7 +134,7 @@ public class TestPerf001GLWindowInit03NEWT extends UITestCase { } try { Thread.sleep(duration); - } catch (InterruptedException e1) { + } catch (final InterruptedException e1) { e1.printStackTrace(); } t[4] = Platform.currentTimeMillis(); @@ -171,7 +171,7 @@ public class TestPerf001GLWindowInit03NEWT extends UITestCase { volatile int initCount = 0; - public static void main(String[] args) { + public static void main(final String[] args) { mainRun = true; boolean useGears = false, manual=false; boolean waitMain = false; @@ -203,7 +203,7 @@ public class TestPerf001GLWindowInit03NEWT extends UITestCase { } if( manual ) { GLProfile.initSingleton(); - TestPerf001GLWindowInit03NEWT demo = new TestPerf001GLWindowInit03NEWT(); + final TestPerf001GLWindowInit03NEWT demo = new TestPerf001GLWindowInit03NEWT(); demo.test(null, useGears, width, height, frameCount, false /* reuseDevice */); } else { org.junit.runner.JUnitCore.main(TestPerf001GLWindowInit03NEWT.class.getName()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001RawInit00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001RawInit00NEWT.java index 6f7d9329b..f8b15a843 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001RawInit00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/perf/TestPerf001RawInit00NEWT.java @@ -207,7 +207,7 @@ public class TestPerf001RawInit00NEWT extends UITestCase { static int manualTest = 0; static int width = 800, height = 600, count = 50; - public static void main(String[] args) { + public static void main(final String[] args) { boolean waitMain = false; for(int i=0; i>>>>>>> reshape " + x + ", " + y + ", " + width + ", " +height ) ; - GL2 gl = drawable.getGL().getGL2() ; + final GL2 gl = drawable.getGL().getGL2() ; gl.glViewport( 0, 0, width, height ) ; - gl.glMatrixMode( GL2.GL_PROJECTION ) ; + gl.glMatrixMode( GLMatrixFunc.GL_PROJECTION ) ; gl.glLoadIdentity() ; gl.glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 ) ; - gl.glMatrixMode( GL2.GL_MODELVIEW ) ; + gl.glMatrixMode( GLMatrixFunc.GL_MODELVIEW ) ; gl.glLoadIdentity() ; } - public void display( GLAutoDrawable drawable ) + public void display( final GLAutoDrawable drawable ) { // System.err.println( ">>>> display" ) ; - GL2 gl = drawable.getGL().getGL2() ; + final GL2 gl = drawable.getGL().getGL2() ; // Sven: I could have been seeing things, but it seemed that if this // glClear is in here twice it seems aggravates the problem. Not // sure why other than it just takes longer, but this is pretty // fast operation. - gl.glClear( GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT ) ; - gl.glClear( GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT ) ; + gl.glClear( GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT ) ; + gl.glClear( GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT ) ; gl.glColor4f( r, g, b, 1.0f ) ; @@ -135,7 +136,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase { } } - public void dispose( GLAutoDrawable drawable ) + public void dispose( final GLAutoDrawable drawable ) { } } @@ -147,7 +148,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase { private final Shell _shell ; private int _n ; - public ResizeThread( Shell shell ) + public ResizeThread( final Shell shell ) { super(); _shell = shell ; @@ -166,7 +167,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase { } else { _shell.setSize( 400, 450 ) ; } - } catch (Exception e0) { + } catch (final Exception e0) { e0.printStackTrace(); Assert.assertTrue("Deadlock @ setSize: "+e0, false); } @@ -196,7 +197,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase { display.wake(); Thread.sleep( 50L ) ; - } catch( InterruptedException e ) { + } catch( final InterruptedException e ) { break ; } } @@ -213,7 +214,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase { Robot _robot; int _n = 0; - public KeyfireThread(Robot robot, Display display) + public KeyfireThread(final Robot robot, final Display display) { _robot = robot; _display = display; @@ -235,7 +236,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase { if(!_display.isDisposed()) { _display.wake(); } - } catch( InterruptedException e ) { + } catch( final InterruptedException e ) { break ; } } @@ -287,7 +288,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase { display.dispose(); }}); } - catch( Throwable throwable ) { + catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -299,7 +300,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase { class WaitAction implements Runnable { private final long sleepMS; - WaitAction(long sleepMS) { + WaitAction(final long sleepMS) { this.sleepMS = sleepMS; } public void run() { @@ -307,7 +308,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase { // blocks on linux .. display.sleep(); try { Thread.sleep(sleepMS); - } catch (InterruptedException e) { } + } catch (final InterruptedException e) { } } } } @@ -325,12 +326,12 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase { { final GLProfile gl2Profile = GLProfile.get( GLProfile.GL2 ) ; final GLCapabilities caps = new GLCapabilities( gl2Profile ) ; - com.jogamp.newt.Screen screen = NewtFactory.createScreen(dsc.swtNewtDisplay, 0); + final com.jogamp.newt.Screen screen = NewtFactory.createScreen(dsc.swtNewtDisplay, 0); glWindow = GLWindow.create( screen, caps ) ; glWindow.addGLEventListener( new BigFlashingX() ) ; glWindow.addKeyListener(new KeyAdapter() { @Override - public void keyReleased(com.jogamp.newt.event.KeyEvent e) { + public void keyReleased(final com.jogamp.newt.event.KeyEvent e) { if( !e.isPrintableKey() || e.isAutoRepeat() ) { return; } @@ -372,17 +373,17 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase { public void run() { try { Thread.sleep(duration); - } catch (InterruptedException e) {} + } catch (final InterruptedException e) {} resizer.shallStop = true; keyfire.shallStop = true; try { resizer.join(); - } catch( InterruptedException e ) { } + } catch( final InterruptedException e ) { } try { keyfire.join(); - } catch( InterruptedException e ) { } + } catch( final InterruptedException e ) { } shallStop = true; if( null != dsc.display && !dsc.display.isDisposed() ) { dsc.display.wake(); @@ -400,11 +401,11 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase { // blocks on linux .. dsc.display.sleep(); try { Thread.sleep(10); - } catch (InterruptedException ie) { ie.printStackTrace(); } + } catch (final InterruptedException ie) { ie.printStackTrace(); } } } } ); } - } catch (Exception e0) { + } catch (final Exception e0) { e0.printStackTrace(); Assert.assertTrue("Deadlock @ dispatch: "+e0, false); } @@ -414,7 +415,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase { dsc.dispose(); } - public static void main( String[] args ) { + public static void main( final String[] args ) { for(int i=0; i + *

    * Uses the SWT GLCanvas org.eclipse.swt.opengl.GLCanvas. *

    * @author Wade Walker, et.al. @@ -86,7 +86,7 @@ public class TestSWTEclipseGLCanvas01GLn extends UITestCase { @Before public void init() { SWTAccessor.invoke(true, new Runnable() { - public void run() { + public void run() { display = new Display(); Assert.assertNotNull( display ); shell = new Shell( display ); @@ -111,7 +111,7 @@ public class TestSWTEclipseGLCanvas01GLn extends UITestCase { display.dispose(); }}); } - catch( Throwable throwable ) { + catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -120,8 +120,8 @@ public class TestSWTEclipseGLCanvas01GLn extends UITestCase { composite = null; } - protected void runTestAGL( GLProfile glprofile ) throws InterruptedException { - GLData gldata = new GLData(); + protected void runTestAGL( final GLProfile glprofile ) throws InterruptedException { + final GLData gldata = new GLData(); gldata.doubleBuffer = true; // need SWT.NO_BACKGROUND to prevent SWT from clearing the window // at the wrong times (we use glClear for this instead) @@ -133,11 +133,11 @@ public class TestSWTEclipseGLCanvas01GLn extends UITestCase { // fix the viewport when the user resizes the window glcanvas.addListener( SWT.Resize, new Listener() { - public void handleEvent( Event event ) { - Rectangle rectangle = glcanvas.getClientArea(); + public void handleEvent( final Event event ) { + final Rectangle rectangle = glcanvas.getClientArea(); glcanvas.setCurrent(); glcontext.makeCurrent(); - GL2ES1 gl = glcontext.getGL().getGL2ES1(); + final GL2ES1 gl = glcontext.getGL().getGL2ES1(); OneTriangle.setup( gl, rectangle.width, rectangle.height ); glcontext.release(); System.err.println("resize"); @@ -146,24 +146,24 @@ public class TestSWTEclipseGLCanvas01GLn extends UITestCase { // draw the triangle when the OS tells us that any part of the window needs drawing glcanvas.addPaintListener( new PaintListener() { - public void paintControl( PaintEvent paintevent ) { - Rectangle rectangle = glcanvas.getClientArea(); + public void paintControl( final PaintEvent paintevent ) { + final Rectangle rectangle = glcanvas.getClientArea(); glcanvas.setCurrent(); glcontext.makeCurrent(); - GL2ES1 gl = glcontext.getGL().getGL2ES1(); + final GL2ES1 gl = glcontext.getGL().getGL2ES1(); OneTriangle.render( gl, rectangle.width, rectangle.height ); glcanvas.swapBuffers(); glcontext.release(); System.err.println("paint"); } }); - + shell.setText( getClass().getName() ); shell.setSize( 640, 480 ); shell.open(); - long lStartTime = System.currentTimeMillis(); - long lEndTime = lStartTime + duration; + final long lStartTime = System.currentTimeMillis(); + final long lEndTime = lStartTime + duration; try { while( (System.currentTimeMillis() < lEndTime) && !glcanvas.isDisposed() ) { if( !display.readAndDispatch() ) { @@ -171,7 +171,7 @@ public class TestSWTEclipseGLCanvas01GLn extends UITestCase { Thread.sleep(10); } } - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -180,19 +180,19 @@ public class TestSWTEclipseGLCanvas01GLn extends UITestCase { @Test public void test() throws InterruptedException { - GLProfile glprofile = GLProfile.getGL2ES1(); + final GLProfile glprofile = GLProfile.getGL2ES1(); runTestAGL( glprofile ); } - static int atoi(String a) { + static int atoi(final String a) { int i=0; try { i = Integer.parseInt(a); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } return i; } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i 0 enables using given num samples * @param tileWidth custom tile width for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default. * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default. - * @param imageType AWT BufferedImage type (must be one of the integer types) + * @param imageType AWT BufferedImage type (must be one of the integer types) * @param pngFilename TODO */ - public OffscreenPrintable(PrinterJob job, Container printContainer, int printDPI, int numSamples, int tileWidth, int tileHeight, int imageType, String pngFilename) { + public OffscreenPrintable(final PrinterJob job, final Container printContainer, final int printDPI, final int numSamples, final int tileWidth, final int tileHeight, final int imageType, final String pngFilename) { super(job, printContainer, printDPI, numSamples, tileWidth, tileHeight); this.imageType = imageType; this.pngFilename = pngFilename; } - + @Override - public int print(Graphics g, PageFormat pf, int page) throws PrinterException { + public int print(final Graphics g, final PageFormat pf, final int page) throws PrinterException { if (page > 0) { // We have only one page, and 'page' is zero-based return NO_SUCH_PAGE; } - + lockPrinting.lock(); try { final Paper paper = pf.getPaper(); @@ -93,58 +93,58 @@ public class OffscreenPrintable extends PrintableBase implements Printable { final double paperWHeightMM = paperWHeightInch * MM_PER_INCH; final double paperIWidthMM = paperIWidthInch * MM_PER_INCH; final double paperIHeightMM = paperIHeightInch * MM_PER_INCH; - - final double pfWWidthInch = pf.getWidth() / 72.0; + + final double pfWWidthInch = pf.getWidth() / 72.0; final double pfWHeightInch = pf.getHeight() / 72.0; - final double pfIWidthInch = pf.getImageableWidth() / 72.0; + final double pfIWidthInch = pf.getImageableWidth() / 72.0; final double pfIHeightInch = pf.getImageableHeight() / 72.0; - final double pfWWidthMM = pfWWidthInch * MM_PER_INCH; + final double pfWWidthMM = pfWWidthInch * MM_PER_INCH; final double pfWHeightMM = pfWHeightInch * MM_PER_INCH; - final double pfIWidthMM = pfIWidthInch * MM_PER_INCH; + final double pfIWidthMM = pfIWidthInch * MM_PER_INCH; final double pfIHeightMM = pfIHeightInch * MM_PER_INCH; - + System.err.println("PF: Paper whole size "+ Math.round(paperWWidthMM)+" x "+Math.round(paperWHeightMM)+" mm, "+ Math.round(paperWWidthInch)+" x "+Math.round(paperWHeightInch)+" inch"); - + System.err.println("PF: Paper image size "+paper.getImageableX()+" / "+paper.getImageableY()+" "+ Math.round(paperIWidthMM)+" x "+Math.round(paperIHeightMM)+" mm, "+ Math.round(paperIWidthInch)+" x "+Math.round(paperIHeightInch)+" inch, "+ Math.round(paper.getImageableWidth())+"x"+Math.round(paper.getImageableHeight())+" 72dpi dots"); - + System.err.println("PF: Page whole size "+ Math.round(pfWWidthMM)+" x "+Math.round(pfWHeightMM)+" mm, "+ Math.round(pfWWidthInch)+" x "+Math.round(pfWHeightInch)+" inch"); - + System.err.println("PF: Page image size "+pf.getImageableX()+" / "+pf.getImageableY()+" "+ Math.round(pfIWidthMM)+" x "+Math.round(pfIHeightMM)+" mm, "+ Math.round(pfIWidthInch)+" x "+Math.round(pfIHeightInch)+" inch, "+ Math.round(pf.getImageableWidth())+"x"+Math.round(pf.getImageableHeight())+" 72dpi dots"); - + System.err.println("PF: Page orientation "+pf.getOrientation()); - + /** * See: 'Scaling of Frame and GL content' in Class description! * Note: Frame size contains the frame border (i.e. insets)! - */ + */ final Insets frameInsets = cont.getInsets(); final int frameWidth = cont.getWidth(); final int frameHeight= cont.getHeight(); final double scaleGraphics = dpi / 72.0; - final int frameSWidth = (int) ( frameWidth * scaleGraphics ); + final int frameSWidth = (int) ( frameWidth * scaleGraphics ); final int frameSHeight = (int) ( frameHeight * scaleGraphics ); final double scaleComp72; { - final double sx = pf.getImageableWidth() / (double)frameSWidth; - final double sy = pf.getImageableHeight() / (double)frameSHeight; + final double sx = pf.getImageableWidth() / frameSWidth; + final double sy = pf.getImageableHeight() / frameSHeight; scaleComp72 = Math.min(sx, sy); } - + System.err.println("PRINT.offscrn thread "+Thread.currentThread().getName()); System.err.println("PRINT.offscrn DPI: scaleGraphics "+scaleGraphics+", scaleComp72 "+scaleComp72); System.err.println("PRINT.offscrn DPI: frame: border "+frameInsets+", size "+frameWidth+"x"+frameHeight+ " -> scaled "+frameSWidth+ "x" + frameSHeight); - + final BufferedImage image = DirectDataBufferInt.createBufferedImage(frameSWidth, frameSHeight, imageType, null /* location */, null /* properties */); { System.err.println("PRINT.offscrn image "+image); @@ -163,16 +163,16 @@ public class OffscreenPrintable extends PrintableBase implements Printable { final File fout = new File(pngFilename); try { ImageIO.write(image, "png", fout); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } } - + final Graphics2D g2d = (Graphics2D)g; g2d.translate(pf.getImageableX(), pf.getImageableY()); g2d.scale(scaleComp72, scaleComp72); g2d.drawImage(image, 0, 0, image.getWidth(), image.getHeight(), null); // Null ImageObserver since image data is ready. - + /* tell the caller that this page is part of the printed document */ return PAGE_EXISTS; } finally { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/OnscreenPrintable.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/OnscreenPrintable.java index 6f73ef2b4..228fa81e2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/OnscreenPrintable.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/OnscreenPrintable.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -62,25 +62,25 @@ import com.jogamp.opengl.util.TileRenderer; public class OnscreenPrintable extends PrintableBase implements Printable { /** - * + * * @param job * @param printContainer * @param printDPI - * @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples + * @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples * @param tileWidth custom tile width for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default. * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default. */ - public OnscreenPrintable(PrinterJob job, Container printContainer, int printDPI, int numSamples, int tileWidth, int tileHeight) { + public OnscreenPrintable(final PrinterJob job, final Container printContainer, final int printDPI, final int numSamples, final int tileWidth, final int tileHeight) { super(job, printContainer, printDPI, numSamples, tileWidth, tileHeight); } - - + + @Override - public int print(Graphics g, PageFormat pf, int page) throws PrinterException { + public int print(final Graphics g, final PageFormat pf, final int page) throws PrinterException { if (page > 0) { // We have only one page, and 'page' is zero-based return NO_SUCH_PAGE; } - + lockPrinting.lock(); try { final Paper paper = pf.getPaper(); @@ -92,70 +92,70 @@ public class OnscreenPrintable extends PrintableBase implements Printable { final double paperWHeightMM = paperWHeightInch * MM_PER_INCH; final double paperIWidthMM = paperIWidthInch * MM_PER_INCH; final double paperIHeightMM = paperIHeightInch * MM_PER_INCH; - - final double pfWWidthInch = pf.getWidth() / 72.0; + + final double pfWWidthInch = pf.getWidth() / 72.0; final double pfWHeightInch = pf.getHeight() / 72.0; - final double pfIWidthInch = pf.getImageableWidth() / 72.0; + final double pfIWidthInch = pf.getImageableWidth() / 72.0; final double pfIHeightInch = pf.getImageableHeight() / 72.0; - final double pfWWidthMM = pfWWidthInch * MM_PER_INCH; + final double pfWWidthMM = pfWWidthInch * MM_PER_INCH; final double pfWHeightMM = pfWHeightInch * MM_PER_INCH; - final double pfIWidthMM = pfIWidthInch * MM_PER_INCH; + final double pfIWidthMM = pfIWidthInch * MM_PER_INCH; final double pfIHeightMM = pfIHeightInch * MM_PER_INCH; - + System.err.println("PF: Paper whole size "+ Math.round(paperWWidthMM)+" x "+Math.round(paperWHeightMM)+" mm, "+ Math.round(paperWWidthInch)+" x "+Math.round(paperWHeightInch)+" inch"); - + System.err.println("PF: Paper image size "+paper.getImageableX()+" / "+paper.getImageableY()+" "+ Math.round(paperIWidthMM)+" x "+Math.round(paperIHeightMM)+" mm, "+ Math.round(paperIWidthInch)+" x "+Math.round(paperIHeightInch)+" inch, "+ Math.round(paper.getImageableWidth())+"x"+Math.round(paper.getImageableHeight())+" 72dpi dots"); - + System.err.println("PF: Page whole size "+ Math.round(pfWWidthMM)+" x "+Math.round(pfWHeightMM)+" mm, "+ Math.round(pfWWidthInch)+" x "+Math.round(pfWHeightInch)+" inch"); - + System.err.println("PF: Page image size "+pf.getImageableX()+" / "+pf.getImageableY()+" "+ Math.round(pfIWidthMM)+" x "+Math.round(pfIHeightMM)+" mm, "+ Math.round(pfIWidthInch)+" x "+Math.round(pfIHeightInch)+" inch, "+ Math.round(pf.getImageableWidth())+"x"+Math.round(pf.getImageableHeight())+" 72dpi dots"); - + System.err.println("PF: Page orientation "+pf.getOrientation()); - + /** * See: 'Scaling of Frame and GL content' in Class description! * Note: Frame size contains the frame border (i.e. insets)! - */ + */ final Insets frameInsets = cont.getInsets(); final int frameWidth = cont.getWidth(); final int frameHeight= cont.getHeight(); final double scaleGraphics = dpi / 72.0; - final int frameSWidth = (int) ( frameWidth * scaleGraphics ); + final int frameSWidth = (int) ( frameWidth * scaleGraphics ); final int frameSHeight = (int) ( frameHeight * scaleGraphics ); final double scaleComp72; { - final double sx = pf.getImageableWidth() / (double)frameWidth; - final double sy = pf.getImageableHeight() / (double)frameHeight; + final double sx = pf.getImageableWidth() / frameWidth; + final double sy = pf.getImageableHeight() / frameHeight; scaleComp72 = Math.min(sx, sy); - } + } System.err.println("PRINT.onscrn thread "+Thread.currentThread().getName()); System.err.println("PRINT.onscrn DPI: scaleGraphics "+scaleGraphics+", scaleComp72 "+scaleComp72); System.err.println("PRINT.onscrn DPI: frame: border "+frameInsets+", size "+frameWidth+"x"+frameHeight+ " -> scaled "+frameSWidth+ "x" + frameSHeight); - + final Graphics2D g2d = (Graphics2D)g; System.err.println("PRINT at.pre: "+g2d.getTransform()); g2d.translate(pf.getImageableX(), pf.getImageableY()); g2d.scale(scaleComp72, scaleComp72); // WARNING: Produces rounding artifacts due to diff scale-factor of AWT/GL comps !!! // g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); - + AWTEDTExecutor.singleton.invoke(true, new Runnable() { public void run() { cont.printAll(g2d); } }); - + /* tell the caller that this page is part of the printed document */ return PAGE_EXISTS; } finally { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/PrintableBase.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/PrintableBase.java index dd9de60c3..39cc4fbd2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/PrintableBase.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/PrintableBase.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -37,7 +37,7 @@ import com.jogamp.opengl.util.TileRenderer; /** * Base {@link Printable} implementation class. - * + * *
    Virtual printer driver
    *

    * Note, on OSX you might need to setup a dummy printer, i.e. print to file.
    @@ -54,7 +54,7 @@ import com.jogamp.opengl.util.TileRenderer; public abstract class PrintableBase implements Printable { public static final double MM_PER_INCH = 25.4; - + public final PrinterJob job; public final Container cont; public final int dpi; @@ -63,15 +63,15 @@ public abstract class PrintableBase implements Printable { protected final RecursiveLock lockPrinting = LockFactory.createRecursiveLock(); /** - * + * * @param job * @param printContainer * @param printDPI - * @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples + * @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples * @param tileWidth custom tile width for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default. * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default. */ - public PrintableBase(PrinterJob job, Container printContainer, int printDPI, int numSamples, int tileWidth, int tileHeight) { + public PrintableBase(final PrinterJob job, final Container printContainer, final int printDPI, final int numSamples, final int tileWidth, final int tileHeight) { this.job = job; this.cont = printContainer; this.dpi = printDPI; @@ -79,10 +79,10 @@ public abstract class PrintableBase implements Printable { this.tileWidth = tileWidth; this.tileHeight = tileHeight; } - + /** Wait for idle .. simply acquiring all locks and releasing them. */ public void waitUntilIdle() { lockPrinting.lock(); lockPrinting.unlock(); - } + } } \ No newline at end of file diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java index 9783b9205..546420057 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java @@ -83,7 +83,7 @@ public class TestRandomTiledRendering2GL2NEWT extends UITestCase { doTest(8); } - void doTest(int msaaCount) throws IOException, InterruptedException, InvocationTargetException { + void doTest(final int msaaCount) throws IOException, InterruptedException, InvocationTargetException { final GLCapabilities caps = new GLCapabilities(null); caps.setDoubleBuffered(true); if( msaaCount > 0 ) { @@ -115,10 +115,10 @@ public class TestRandomTiledRendering2GL2NEWT extends UITestCase { final GLEventListener preTileGLEL = new GLEventListener() { @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { final GL gl = drawable.getGL(); - GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, 3); - GLPixelBuffer pixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, imageWidth, imageHeight, 1, true, 0); + final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, 3); + final GLPixelBuffer pixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, imageWidth, imageHeight, 1, true, 0); renderer.setImageBuffer(pixelBuffer); if( drawable.isGLOriented() ) { flipVertically[0] = false; @@ -127,11 +127,11 @@ public class TestRandomTiledRendering2GL2NEWT extends UITestCase { } } @Override - public void dispose(GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) {} @Override - public void display(GLAutoDrawable drawable) {} + public void display(final GLAutoDrawable drawable) {} @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {} + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {} }; renderer.setGLEventListener(preTileGLEL, null); @@ -152,7 +152,7 @@ public class TestRandomTiledRendering2GL2NEWT extends UITestCase { // .. even though we close the demo, this is for documentation! glad.invoke(true, new GLRunnable() { @Override - public boolean run(GLAutoDrawable drawable) { + public boolean run(final GLAutoDrawable drawable) { drawable.getGL().glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); gears.reshape(drawable, 0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); return false; @@ -179,13 +179,13 @@ public class TestRandomTiledRendering2GL2NEWT extends UITestCase { TextureIO.write(textureData, file); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i 0 ) { caps.setSampleBuffers(true); @@ -104,7 +104,7 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase { final GLCanvas glad = new GLCanvas(caps); Assert.assertNotNull(glad); - Dimension glc_sz = new Dimension(width, height); + final Dimension glc_sz = new Dimension(width, height); glad.setMinimumSize(glc_sz); glad.setPreferredSize(glc_sz); glad.setSize(glc_sz); @@ -134,10 +134,10 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase { int dx = 0, dy = 0; @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { final GL gl = drawable.getGL(); - GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, 3); - GLPixelBuffer pixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, imageWidth, imageHeight, 1, true, 0); + final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, 3); + final GLPixelBuffer pixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, imageWidth, imageHeight, 1, true, 0); renderer.setImageBuffer(pixelBuffer); if( drawable.isGLOriented() ) { flipVertically[0] = false; @@ -147,9 +147,9 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase { System.err.println("XXX pre-init: "+renderer); } @Override - public void dispose(GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) {} @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { if( dx+w <= imageWidth && dy+h <= imageHeight ) { renderer.setTileRect(dx, dy, w, h); dx+=w+w/2; @@ -163,15 +163,15 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase { System.err.println("XXX pre-display: "+renderer); } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {} + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {} }; final GLEventListener postTileGLEL = new GLEventListener() { @Override - public void init(GLAutoDrawable drawable) {} + public void init(final GLAutoDrawable drawable) {} @Override - public void dispose(GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) {} @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { if( !rendererActive[0] ) { final GLPixelBuffer imageBuffer = renderer.getImageBuffer(); imageBuffer.clear(); // full size available @@ -191,7 +191,7 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase { final String filename = getSnapshotFilename(0, "-tile", glad.getChosenGLCapabilities(), imageWidth, imageHeight, false, TextureIO.PNG, null); final File file = new File(filename); TextureIO.write(textureData, file); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } renderer.detachAutoDrawable(); @@ -201,7 +201,7 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase { } } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {} + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {} }; renderer.setGLEventListener(preTileGLEL, postTileGLEL); @@ -247,13 +247,13 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase { }}); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i - * All {@link TileRenderer} operations are + * All {@link TileRenderer} operations are * being performed from the main thread sequentially - * without {@link GLAutoDrawable} or {@link GLEventListener}. + * without {@link GLAutoDrawable} or {@link GLEventListener}. *

    */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) @@ -67,25 +67,25 @@ public class TestTiledRendering1GL2NEWT extends UITestCase { static long duration = 500; // ms static class DrawableContext { - DrawableContext(GLDrawable d, GLContext glc) { + DrawableContext(final GLDrawable d, final GLContext glc) { this.d = d; this.glc = glc; } GLDrawable d; GLContext glc; } - - private static DrawableContext createDrawableAndCurrentCtx(GLCapabilities glCaps, int width, int height) { - GLDrawableFactory factory = GLDrawableFactory.getFactory(glCaps.getGLProfile()); - GLDrawable d = factory.createOffscreenDrawable(null, glCaps, null, width, height); + + private static DrawableContext createDrawableAndCurrentCtx(final GLCapabilities glCaps, final int width, final int height) { + final GLDrawableFactory factory = GLDrawableFactory.getFactory(glCaps.getGLProfile()); + final GLDrawable d = factory.createOffscreenDrawable(null, glCaps, null, width, height); d.setRealized(true); GLContext glc = null; glc = d.createContext(null); Assert.assertTrue("Context could not be made current", GLContext.CONTEXT_NOT_CURRENT < glc.makeCurrent()); return new DrawableContext(d, glc); } - - private static void destroyDrawableContext(DrawableContext dc) { + + private static void destroyDrawableContext(final DrawableContext dc) { if(null != dc.glc) { dc.glc.destroy(); dc.glc = null; @@ -95,43 +95,43 @@ public class TestTiledRendering1GL2NEWT extends UITestCase { dc.d = null; } } - + @Test public void test01() throws IOException { - GLProfile glp = GLProfile.getMaxFixedFunc(true); - GLCapabilities caps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.getMaxFixedFunc(true); + final GLCapabilities caps = new GLCapabilities(glp); caps.setOnscreen(false); - + final int maxTileSize = 256; - DrawableContext dc = createDrawableAndCurrentCtx(caps, maxTileSize, maxTileSize); + final DrawableContext dc = createDrawableAndCurrentCtx(caps, maxTileSize, maxTileSize); final GL2 gl = dc.glc.getGL().getGL2(); - + // Fix the image size for now final int imageWidth = dc.d.getSurfaceWidth() * 6; final int imageHeight = dc.d.getSurfaceHeight() * 4; - + final String filename = this.getSnapshotFilename(0, "-tile", dc.d.getChosenGLCapabilities(), imageWidth, imageHeight, false, TextureIO.PNG, null); final File file = new File(filename); - + // Initialize the tile rendering library - final TileRenderer renderer = new com.jogamp.opengl.util.TileRenderer(); + final TileRenderer renderer = new com.jogamp.opengl.util.TileRenderer(); renderer.setTileSize(dc.d.getSurfaceWidth(), dc.d.getSurfaceHeight(), 0); renderer.setImageSize(imageWidth, imageHeight); - + final GLPixelBuffer.GLPixelBufferProvider pixelBufferProvider = GLPixelBuffer.defaultProviderWithRowStride; final boolean[] flipVertically = { false }; - - GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, 3); - GLPixelBuffer pixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, imageWidth, imageHeight, 1, true, 0); + + final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, 3); + final GLPixelBuffer pixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, imageWidth, imageHeight, 1, true, 0); renderer.setImageBuffer(pixelBuffer); flipVertically[0] = false; - + final Gears gears = new Gears(); gears.setVerbose(false); gears.init(gl); gears.addTileRendererNotify(renderer); - while( !renderer.eot() ) { + while( !renderer.eot() ) { renderer.beginTile(gl); gears.reshape(gl, renderer.getParam(TileRendererBase.TR_CURRENT_TILE_X_POS), renderer.getParam(TileRendererBase.TR_CURRENT_TILE_Y_POS), @@ -143,69 +143,69 @@ public class TestTiledRendering1GL2NEWT extends UITestCase { gears.removeTileRendererNotify(renderer); destroyDrawableContext(dc); - + final GLPixelBuffer imageBuffer = renderer.getImageBuffer(); final TextureData textureData = new TextureData( caps.getGLProfile(), 0 /* internalFormat */, imageWidth, imageHeight, - 0, + 0, imageBuffer.pixelAttributes, - false, false, + false, false, flipVertically[0], imageBuffer.buffer, null /* Flusher */); - + TextureIO.write(textureData, file); } - + @Test public void test02_EOT_01() throws IOException { - GLProfile glp = GLProfile.getMaxFixedFunc(true); - GLCapabilities caps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.getMaxFixedFunc(true); + final GLCapabilities caps = new GLCapabilities(glp); caps.setOnscreen(false); - + final int maxTileSize = 256; - DrawableContext dc = createDrawableAndCurrentCtx(caps, maxTileSize, maxTileSize); + final DrawableContext dc = createDrawableAndCurrentCtx(caps, maxTileSize, maxTileSize); final GL2 gl = dc.glc.getGL().getGL2(); - + // Fix the image size for now final int imageWidth = dc.d.getSurfaceWidth() * 6; final int imageHeight = dc.d.getSurfaceHeight() * 4; - + // Initialize the tile rendering library final TileRenderer renderer = new com.jogamp.opengl.util.TileRenderer(); renderer.setTileSize(dc.d.getSurfaceWidth(), dc.d.getSurfaceHeight(), 0); - + IllegalStateException ise = null; try { renderer.beginTile(gl); // Image size has not been set - } catch (IllegalStateException _ise) { + } catch (final IllegalStateException _ise) { ise = _ise; System.err.println("Expected "+ise.getClass().getSimpleName()+": "+ise.getMessage()); } Assert.assertNotNull("TileRenderer.beginTile: Image-size exception missing", ise); - + renderer.setImageSize(imageWidth, imageHeight); - + renderer.clipImageSize(0, 0); try { renderer.beginTile(gl); // EOT reached (1) - } catch (IllegalStateException _ise) { + } catch (final IllegalStateException _ise) { ise = _ise; System.err.println("Expected "+ise.getClass().getSimpleName()+": "+ise.getMessage()); } Assert.assertNotNull("TileRenderer.beginTile: EOT (1) exception missing", ise); - + renderer.clipImageSize(imageWidth, imageHeight); // back to full size - + final Gears gears = new Gears(); gears.setVerbose(false); gears.init(gl); gears.addTileRendererNotify(renderer); int numTiles = 0; - while( !renderer.eot() ) { + while( !renderer.eot() ) { renderer.beginTile(gl); gears.reshape(gl, renderer.getParam(TileRendererBase.TR_CURRENT_TILE_X_POS), renderer.getParam(TileRendererBase.TR_CURRENT_TILE_Y_POS), @@ -217,27 +217,27 @@ public class TestTiledRendering1GL2NEWT extends UITestCase { } try { renderer.beginTile(gl); // EOT reached (2) - } catch (IllegalStateException _ise) { + } catch (final IllegalStateException _ise) { ise = _ise; System.err.println("Expected "+ise.getClass().getSimpleName()+": "+ise.getMessage()); } Assert.assertNotNull("TileRenderer.beginTile: EOT (2) exception missing", ise); gears.removeTileRendererNotify(renderer); - + Assert.assertTrue("TileRenderer not rendered more than one tile but "+numTiles, numTiles > 1); destroyDrawableContext(dc); } - - public static void main(String args[]) { + + public static void main(final String args[]) { for(int i=0; i 0 ) { caps.setSampleBuffers(true); @@ -195,10 +195,10 @@ public class TestTiledRendering2NEWT extends UITestCase { final GLEventListener preTileGLEL = new GLEventListener() { @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { final GL gl = drawable.getGL(); - GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, 3); - GLPixelBuffer pixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, imageWidth, imageHeight, 1, true, 0); + final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(gl, 3); + final GLPixelBuffer pixelBuffer = pixelBufferProvider.allocate(gl, pixelAttribs, imageWidth, imageHeight, 1, true, 0); renderer.setImageBuffer(pixelBuffer); if( drawable.isGLOriented() ) { flipVertically[0] = false; @@ -207,11 +207,11 @@ public class TestTiledRendering2NEWT extends UITestCase { } } @Override - public void dispose(GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) {} @Override - public void display(GLAutoDrawable drawable) {} + public void display(final GLAutoDrawable drawable) {} @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {} + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {} }; renderer.setGLEventListener(preTileGLEL, null); @@ -225,7 +225,7 @@ public class TestTiledRendering2NEWT extends UITestCase { // .. even though we close the demo, this is for documentation! glad.invoke(true, new GLRunnable() { @Override - public boolean run(GLAutoDrawable drawable) { + public boolean run(final GLAutoDrawable drawable) { drawable.getGL().glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); demo.reshape(drawable, 0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); return false; @@ -249,13 +249,13 @@ public class TestTiledRendering2NEWT extends UITestCase { glad.destroy(); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i 0 enables using given num samples + * @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples * @param tileWidth custom tile width for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default. * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default. * @param resizeWithinPrintTest TODO */ - public PrintableBase doPrintAuto(Container cont, int pOrientation, Paper paper, - int offscrnImageType, int dpi, int numSamples, int tileWidth, int tileHeight, boolean resizeWithinPrintTest) { + public PrintableBase doPrintAuto(final Container cont, final int pOrientation, final Paper paper, + final int offscrnImageType, final int dpi, final int numSamples, final int tileWidth, final int tileHeight, final boolean resizeWithinPrintTest) { lock.lock(); try { final PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); @@ -94,13 +94,13 @@ public abstract class TiledPrintingAWTBase extends UITestCase { aset.add(MediaSizeName.ISO_A2); // 420 × 594 mm aset.add(MediaSizeName.ISO_A3); // 297 × 420 mm aset.add(MediaSizeName.ISO_A4); // 210 × 297 mm - + printCount++; - + final String psMimeType = "application/postscript"; final String pdfMimeType = "application/pdf"; final PrinterJob pj = PrinterJob.getPrinterJob(); - + StreamPrintServiceFactory[] factories = PrinterJob.lookupStreamPrintServices(pdfMimeType); if (factories.length > 0) { final String fname = getPrintFilename(offscrnImageType, dpi, numSamples, tileWidth, tileHeight, "pdf", resizeWithinPrintTest); @@ -108,14 +108,14 @@ public abstract class TiledPrintingAWTBase extends UITestCase { FileOutputStream outstream; try { outstream = new FileOutputStream(fname); - return doPrintAutoImpl(cont, pj, factories[0].getPrintService(outstream), pOrientation, paper, + return doPrintAutoImpl(cont, pj, factories[0].getPrintService(outstream), pOrientation, paper, offscrnImageType, dpi, numSamples, tileWidth, tileHeight, resizeWithinPrintTest); - } catch (FileNotFoundException e) { + } catch (final FileNotFoundException e) { Assert.assertNull("Unexpected exception", e); } - } + } System.err.println("No PDF"); - + factories = PrinterJob.lookupStreamPrintServices(psMimeType); if (factories.length > 0) { final String fname = getPrintFilename(offscrnImageType, dpi, numSamples, tileWidth, tileHeight, "ps", resizeWithinPrintTest); @@ -124,29 +124,29 @@ public abstract class TiledPrintingAWTBase extends UITestCase { try { outstream = new FileOutputStream(fname); return doPrintAutoImpl(cont, pj, factories[0].getPrintService(outstream), pOrientation, paper, offscrnImageType, dpi, numSamples, tileWidth, tileHeight, resizeWithinPrintTest); - } catch (FileNotFoundException e) { + } catch (final FileNotFoundException e) { Assert.assertNull("Unexpected exception", e); } - } + } System.err.println("No PS"); return null; } finally { lock.unlock(); } } - private String getPrintFilename(int offscrnImageType, int dpi, int numSamples, int tileWidth, int tileHeight, String suffix, boolean resizeWithinPrintTest) { + private String getPrintFilename(final int offscrnImageType, final int dpi, final int numSamples, final int tileWidth, final int tileHeight, final String suffix, final boolean resizeWithinPrintTest) { final int maxSimpleTestNameLen = getMaxTestNameLen()+getClass().getSimpleName().length()+1; final String simpleTestName = getSimpleTestName("."); final String onoffscrn = 0 > offscrnImageType ? "on_screen" : "offscrn_"+offscrnImageType; final String aa = 0 <= numSamples ? "aa"+numSamples : "aaN"; - return String.format("%-"+maxSimpleTestNameLen+"s-n%04d-%s-dpi%03d-%s-tSz%04dx%04d-resize%d.%s", + return String.format("%-"+maxSimpleTestNameLen+"s-n%04d-%s-dpi%03d-%s-tSz%04dx%04d-resize%d.%s", simpleTestName, printCount, onoffscrn, dpi, aa, tileWidth, tileHeight, resizeWithinPrintTest?1:0, suffix).replace(' ', '_'); } - private PrintableBase doPrintAutoImpl(Container cont, PrinterJob job, - StreamPrintService ps, int pOrientation, Paper paper, - int offscrnImageType, int dpi, int numSamples, int tileWidth, int tileHeight, boolean resizeWithinPrintTest) { - try { - PageFormat pageFormat = job.defaultPage(); + private PrintableBase doPrintAutoImpl(final Container cont, final PrinterJob job, + final StreamPrintService ps, final int pOrientation, final Paper paper, + final int offscrnImageType, final int dpi, final int numSamples, final int tileWidth, final int tileHeight, final boolean resizeWithinPrintTest) { + try { + final PageFormat pageFormat = job.defaultPage(); if( null != paper ) { /** Paper paper = new Paper(); @@ -165,25 +165,25 @@ public abstract class TiledPrintingAWTBase extends UITestCase { printable.job.setPrintable(printable, pageFormat); doPrintImpl(printable, resizeWithinPrintTest); return printable; - } catch (PrinterException pe) { + } catch (final PrinterException pe) { pe.printStackTrace(); return null; - } + } } /** * @param cont * @param dpi - * @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples + * @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples * @param tileWidth custom tile width for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default. * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default. */ - public PrintableBase doPrintManual(Container cont, int dpi, int numSamples, int tileWidth, int tileHeight) { + public PrintableBase doPrintManual(final Container cont, final int dpi, final int numSamples, final int tileWidth, final int tileHeight) { lock.lock(); try { final OnscreenPrintable printable = new OnscreenPrintable(PrinterJob.getPrinterJob(), cont, dpi, numSamples, tileWidth, tileHeight); printable.job.setPrintable(printable); - boolean ok = printable.job.printDialog(); + final boolean ok = printable.job.printDialog(); if (ok) { doPrintImpl(printable, false); } @@ -192,10 +192,10 @@ public abstract class TiledPrintingAWTBase extends UITestCase { lock.unlock(); } } - + private final AWTMisc.ComponentAction resizePlusAction = new AWTMisc.ComponentAction() { @Override - public void run(Component c) { + public void run(final Component c) { final Rectangle r = c.getBounds(); r.width += 64; r.height += 64; @@ -203,19 +203,19 @@ public abstract class TiledPrintingAWTBase extends UITestCase { } }; private final AWTMisc.ComponentAction resizeMinusAction = new AWTMisc.ComponentAction() { @Override - public void run(Component c) { + public void run(final Component c) { final Rectangle r = c.getBounds(); r.width -= 64; r.height -= 64; c.setBounds(r); } }; - + private void doPrintImpl(final PrintableBase printable, final boolean resizeWithinPrintTest) { final double scaleGLMatXY = 72.0 / printable.dpi; System.err.println("PRINTable: "+printable.getClass().getSimpleName()); System.err.println("PRINT DPI: "+printable.dpi+", AA "+printable.numSamples+", scaleGL "+scaleGLMatXY); - final AWTPrintLifecycle.Context ctx = - AWTPrintLifecycle.Context.setupPrint(printable.cont, scaleGLMatXY, scaleGLMatXY, + final AWTPrintLifecycle.Context ctx = + AWTPrintLifecycle.Context.setupPrint(printable.cont, scaleGLMatXY, scaleGLMatXY, printable.numSamples, printable.tileWidth, printable.tileHeight); System.err.println("PRINT AWTPrintLifecycle.setup.count "+ctx.getCount()); final int w = printable.cont.getWidth(); @@ -227,14 +227,14 @@ public abstract class TiledPrintingAWTBase extends UITestCase { try { if( resizeWithinPrintTest ) { System.err.println("PRINT resizeWithinPrint size+ "+(w+64)+"x"+(h+64)); - AWTMisc.performAction(printable.cont, GLAutoDrawable.class, resizePlusAction); + AWTMisc.performAction(printable.cont, GLAutoDrawable.class, resizePlusAction); printable.cont.validate(); if( printable.cont instanceof Window ) { ((Window)printable.cont).pack(); } } printable.job.print(); - } catch (PrinterException ex) { + } catch (final PrinterException ex) { ex.printStackTrace(); } } }); @@ -248,7 +248,7 @@ public abstract class TiledPrintingAWTBase extends UITestCase { System.err.println("PRINT resizeWithinPrint repaint"); printable.cont.repaint(); System.err.println("PRINT resizeWithinPrint size- "+w+"x"+h); - AWTMisc.performAction(printable.cont, GLAutoDrawable.class, resizeMinusAction); + AWTMisc.performAction(printable.cont, GLAutoDrawable.class, resizeMinusAction); printable.cont.validate(); if( printable.cont instanceof Window ) { ((Window)printable.cont).pack(); @@ -260,7 +260,7 @@ public abstract class TiledPrintingAWTBase extends UITestCase { } /** Wait for idle .. simply acquiring all locks and releasing them. */ - public void waitUntilPrintJobsIdle(PrintableBase p) { + public void waitUntilPrintJobsIdle(final PrintableBase p) { lock.lock(); try { if( null != p ) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TransparentPanel.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TransparentPanel.java index d68f878fa..9fc790a77 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TransparentPanel.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TransparentPanel.java @@ -11,7 +11,7 @@ public class TransparentPanel extends JPanel { } @Override - public void setOpaque(boolean isOpaque) { + public void setOpaque(final boolean isOpaque) { // Don't let this panel become opaque } @@ -31,18 +31,18 @@ public class TransparentPanel extends JPanel { * @param c The Component on which to set the cut out shape. * @param s The shape to cut out of the given Component. */ - public void setMixingCutoutShape(Shape s) + public void setMixingCutoutShape(final Shape s) { // Get the cut out shape method if (mSetComponentMixing == null) { try { - Class awtUtilitiesClass = + final Class awtUtilitiesClass = Class.forName("com.sun.awt.AWTUtilities"); - mSetComponentMixing = + mSetComponentMixing = awtUtilitiesClass.getMethod( - "setComponentMixingCutoutShape", + "setComponentMixingCutoutShape", Component.class, Shape.class); - } catch (Exception ex) { + } catch (final Exception ex) { ex.printStackTrace(); } } @@ -51,7 +51,7 @@ public class TransparentPanel extends JPanel { if (mSetComponentMixing != null) { try { mSetComponentMixing.invoke( null, this, s ); - } catch (Exception ex) { + } catch (final Exception ex) { ex.printStackTrace(); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1ImmModeSink.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1ImmModeSink.java index d6c0908f7..ec3049364 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1ImmModeSink.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1ImmModeSink.java @@ -33,6 +33,7 @@ import javax.media.opengl.GL2ES2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLPipelineFactory; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import javax.media.opengl.glu.GLU; import javax.media.opengl.glu.gl2es1.GLUgl2es1; @@ -47,18 +48,18 @@ class DemoGL2ES1ImmModeSink implements GLEventListener { private boolean forceFFPEmu = false; final ImmModeSink ims; final GLU glu; - - DemoGL2ES1ImmModeSink(boolean useVBO) { - ims = ImmModeSink.createFixed(3*3, + + DemoGL2ES1ImmModeSink(final boolean useVBO) { + ims = ImmModeSink.createFixed(3*3, 3, GL.GL_FLOAT, // vertex 3, GL.GL_FLOAT, // color 0, GL.GL_FLOAT, // normal - 0, GL.GL_FLOAT, // texCoords + 0, GL.GL_FLOAT, // texCoords useVBO ? GL.GL_STATIC_DRAW : 0); glu = new GLUgl2es1(); } - - public void setForceFFPEmu(boolean forceFFPEmu, boolean verboseFFPEmu, boolean debugFFPEmu, boolean traceFFPEmu) { + + public void setForceFFPEmu(final boolean forceFFPEmu, final boolean verboseFFPEmu, final boolean debugFFPEmu, final boolean traceFFPEmu) { this.forceFFPEmu = forceFFPEmu; this.verboseFFPEmu = verboseFFPEmu; this.debugFFPEmu = debugFFPEmu; @@ -66,7 +67,7 @@ class DemoGL2ES1ImmModeSink implements GLEventListener { } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { GL _gl = drawable.getGL(); if(debugFFPEmu) { // Debug .. @@ -76,31 +77,31 @@ class DemoGL2ES1ImmModeSink implements GLEventListener { // Trace .. _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES2.class, _gl, new Object[] { System.err } ) ); } - GL2ES1 gl = FixedFuncUtil.wrapFixedFuncEmul(_gl, ShaderSelectionMode.AUTO, null, forceFFPEmu, verboseFFPEmu); - + final GL2ES1 gl = FixedFuncUtil.wrapFixedFuncEmul(_gl, ShaderSelectionMode.AUTO, null, forceFFPEmu, verboseFFPEmu); + System.err.println("GL_VENDOR "+gl.glGetString(GL.GL_VENDOR)); System.err.println("GL_RENDERER "+gl.glGetString(GL.GL_RENDERER)); System.err.println("GL_VERSION "+gl.glGetString(GL.GL_VERSION)); } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { - GL2ES1 gl = drawable.getGL().getGL2ES1(); - - gl.glMatrixMode( GL2ES1.GL_PROJECTION ); + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { + final GL2ES1 gl = drawable.getGL().getGL2ES1(); + + gl.glMatrixMode( GLMatrixFunc.GL_PROJECTION ); gl.glLoadIdentity(); // coordinate system origin at lower left with width and height same as the window glu.gluOrtho2D( 0.0f, width, 0.0f, height ); - gl.glMatrixMode( GL2ES1.GL_MODELVIEW ); + gl.glMatrixMode( GLMatrixFunc.GL_MODELVIEW ); gl.glLoadIdentity(); } - + @Override - public void display(GLAutoDrawable drawable) { - GL2ES1 gl = drawable.getGL().getGL2ES1(); - + public void display(final GLAutoDrawable drawable) { + final GL2ES1 gl = drawable.getGL().getGL2ES1(); + gl.glClear( GL.GL_COLOR_BUFFER_BIT ); // draw a triangle filling the window @@ -115,6 +116,6 @@ class DemoGL2ES1ImmModeSink implements GLEventListener { } @Override - public void dispose(GLAutoDrawable drawable) { - } + public void dispose(final GLAutoDrawable drawable) { + } } \ No newline at end of file diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1Plain.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1Plain.java index 0df368615..c1dd7fb58 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1Plain.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1Plain.java @@ -35,6 +35,7 @@ import javax.media.opengl.GL2ES1; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLException; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import javax.media.opengl.fixedfunc.GLPointerFunc; import javax.media.opengl.glu.GLU; import javax.media.opengl.glu.gl2es1.GLUgl2es1; @@ -47,58 +48,58 @@ class DemoGL2ES1Plain implements GLEventListener { final boolean useArrayData; final boolean useVBO; final GLU glu; - + final float[] vertices = new float[] { 0, 0, 0, TestImmModeSinkES1NEWT.iWidth, 0, 0, TestImmModeSinkES1NEWT.iWidth / 2, TestImmModeSinkES1NEWT.iHeight, 0 }; - - final float[] colors = new float[] { 1, 0, 0, - 0, 1, 0, + + final float[] colors = new float[] { 1, 0, 0, + 0, 1, 0, 0, 0, 1 }; - + final ByteBuffer bufferAll; final int bufferVOffset, bufferCOffset; final int bufferVSize, bufferCSize; final FloatBuffer bufferC, bufferV; final int[] vboName = new int[] { 0 }; final GLArrayDataWrapper arrayC, arrayV; - - DemoGL2ES1Plain(boolean useArrayData, boolean useVBO) { + + DemoGL2ES1Plain(final boolean useArrayData, final boolean useVBO) { this.useArrayData = useArrayData; - this.useVBO = useVBO; + this.useVBO = useVBO; this.glu = new GLUgl2es1(); - + bufferAll = Buffers.newDirectByteBuffer( ( colors.length + vertices.length ) * Buffers.SIZEOF_FLOAT ); - + bufferVOffset = 0; bufferVSize = 3*3*GLBuffers.sizeOfGLType(GL.GL_FLOAT); bufferCOffset = bufferVSize; bufferCSize = 3*3*GLBuffers.sizeOfGLType(GL.GL_FLOAT); - + bufferV = (FloatBuffer) GLBuffers.sliceGLBuffer(bufferAll, bufferVOffset, bufferVSize, GL.GL_FLOAT); bufferV.put(vertices, 0, vertices.length).rewind(); bufferC = (FloatBuffer) GLBuffers.sliceGLBuffer(bufferAll, bufferCOffset, bufferCSize, GL.GL_FLOAT); bufferC.put(colors, 0, colors.length).rewind(); - + System.err.println("bufferAll: "+bufferAll+", byteOffset "+Buffers.getDirectBufferByteOffset(bufferAll)); System.err.println("bufferV: off "+bufferVOffset+", size "+bufferVSize+": "+bufferV+", byteOffset "+Buffers.getDirectBufferByteOffset(bufferV)); System.err.println("bufferC: off "+bufferCOffset+", size "+bufferCSize+": "+bufferC+", byteOffset "+Buffers.getDirectBufferByteOffset(bufferC)); - - if(useArrayData) { + + if(useArrayData) { arrayV = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_VERTEX_ARRAY, 3, GL.GL_FLOAT, false, 0, bufferV, 0, bufferVOffset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER); - + arrayC = GLArrayDataWrapper.createFixed(GLPointerFunc.GL_COLOR_ARRAY, 3, GL.GL_FLOAT, false, 0, bufferC, 0, bufferCOffset, GL.GL_STATIC_DRAW, GL.GL_ARRAY_BUFFER); } else { arrayV = null; - arrayC = null; + arrayC = null; } } - + @Override - public void init(GLAutoDrawable drawable) { - GL gl = drawable.getGL(); + public void init(final GLAutoDrawable drawable) { + final GL gl = drawable.getGL(); System.err.println("GL_VENDOR "+gl.glGetString(GL.GL_VENDOR)); System.err.println("GL_RENDERER "+gl.glGetString(GL.GL_RENDERER)); System.err.println("GL_VERSION "+gl.glGetString(GL.GL_VERSION)); @@ -111,25 +112,25 @@ class DemoGL2ES1Plain implements GLEventListener { } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { - GL2ES1 gl = drawable.getGL().getGL2ES1(); - - gl.glMatrixMode( GL2ES1.GL_PROJECTION ); + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { + final GL2ES1 gl = drawable.getGL().getGL2ES1(); + + gl.glMatrixMode( GLMatrixFunc.GL_PROJECTION ); gl.glLoadIdentity(); // coordinate system origin at lower left with width and height same as the window glu.gluOrtho2D( 0.0f, width, 0.0f, height ); - gl.glMatrixMode( GL2ES1.GL_MODELVIEW ); + gl.glMatrixMode( GLMatrixFunc.GL_MODELVIEW ); gl.glLoadIdentity(); - gl.glViewport( 0, 0, width, height ); + gl.glViewport( 0, 0, width, height ); } - + @Override - public void display(GLAutoDrawable drawable) { - GL2ES1 gl = drawable.getGL().getGL2ES1(); - + public void display(final GLAutoDrawable drawable) { + final GL2ES1 gl = drawable.getGL().getGL2ES1(); + gl.glClear( GL.GL_COLOR_BUFFER_BIT ); // draw a triangle filling the window @@ -143,46 +144,46 @@ class DemoGL2ES1Plain implements GLEventListener { arrayC.setVBOName(vboName[0]); } } - + gl.glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY); if(useArrayData) { gl.glVertexPointer(arrayV); } else { - if(useVBO) { + if(useVBO) { gl.glVertexPointer(3, GL.GL_FLOAT, 0, bufferVOffset); } else { gl.glVertexPointer(3, GL.GL_FLOAT, 0, bufferV); } } - - gl.glEnableClientState(GLPointerFunc.GL_COLOR_ARRAY); + + gl.glEnableClientState(GLPointerFunc.GL_COLOR_ARRAY); if(useArrayData) { gl.glColorPointer(arrayC); } else { - if(useVBO) { + if(useVBO) { gl.glColorPointer(3, GL.GL_FLOAT, 0, bufferCOffset); } else { gl.glColorPointer(3, GL.GL_FLOAT, 0, bufferC); } } - + if(useVBO) { gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); } - + gl.glDrawArrays(GL.GL_TRIANGLES, 0, 3); gl.glFlush(); - + gl.glDisableClientState(GLPointerFunc.GL_COLOR_ARRAY); gl.glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY); } @Override - public void dispose(GLAutoDrawable drawable) { - GL gl = drawable.getGL(); + public void dispose(final GLAutoDrawable drawable) { + final GL gl = drawable.getGL(); if(0 != vboName[0]) { gl.glDeleteBuffers(1, vboName, 0); vboName[0] = 0; } - } + } } \ No newline at end of file diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1TextureImmModeSink.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1TextureImmModeSink.java index 81fa5ded3..d186643b7 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1TextureImmModeSink.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1TextureImmModeSink.java @@ -48,6 +48,7 @@ import javax.media.opengl.GL2ES2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLPipelineFactory; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import javax.media.opengl.glu.GLU; public class DemoGL2ES1TextureImmModeSink implements GLEventListener, TextureDraw01Accessor { @@ -66,7 +67,7 @@ public class DemoGL2ES1TextureImmModeSink implements GLEventListener, TextureDra this.keepTextureBound = false; } - public void setForceFFPEmu(boolean forceFFPEmu, boolean verboseFFPEmu, boolean debugFFPEmu, boolean traceFFPEmu) { + public void setForceFFPEmu(final boolean forceFFPEmu, final boolean verboseFFPEmu, final boolean debugFFPEmu, final boolean traceFFPEmu) { this.forceFFPEmu = forceFFPEmu; this.verboseFFPEmu = verboseFFPEmu; this.debugFFPEmu = debugFFPEmu; @@ -75,7 +76,7 @@ public class DemoGL2ES1TextureImmModeSink implements GLEventListener, TextureDra @Override - public void setKeepTextureBound(boolean v) { + public void setKeepTextureBound(final boolean v) { this.keepTextureBound = v; } @Override @@ -84,7 +85,7 @@ public class DemoGL2ES1TextureImmModeSink implements GLEventListener, TextureDra } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { GL _gl = drawable.getGL(); if(debugFFPEmu) { // Debug .. @@ -94,35 +95,35 @@ public class DemoGL2ES1TextureImmModeSink implements GLEventListener, TextureDra // Trace .. _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", GL2ES2.class, _gl, new Object[] { System.err } ) ); } - GL2ES1 gl = FixedFuncUtil.wrapFixedFuncEmul(_gl, ShaderSelectionMode.AUTO, null, forceFFPEmu, verboseFFPEmu); + final GL2ES1 gl = FixedFuncUtil.wrapFixedFuncEmul(_gl, ShaderSelectionMode.AUTO, null, forceFFPEmu, verboseFFPEmu); - URLConnection testTextureUrlConn = IOUtil.getResource(PNGTstFiles.class, "test-ntscP_3-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource(PNGTstFiles.class, "test-ntscP_3-01-160x90.png"); try { - InputStream testTextureStream = testTextureUrlConn.getInputStream(); + final InputStream testTextureStream = testTextureUrlConn.getInputStream(); textureData = TextureIO.newTextureData(gl.getGLProfile(), testTextureStream , false /* mipmap */, TextureIO.PNG); texture = TextureIO.newTexture(gl, textureData); if( keepTextureBound && null != texture ) { texture.enable(gl); texture.bind(gl); } - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { - GL2ES1 gl = drawable.getGL().getGL2ES1(); - gl.glMatrixMode(GL2ES1.GL_PROJECTION); + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { + final GL2ES1 gl = drawable.getGL().getGL2ES1(); + gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); glu.gluOrtho2D(0, 1, 0, 1); - gl.glMatrixMode(GL2ES1.GL_MODELVIEW); + gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); } @Override - public void dispose(GLAutoDrawable drawable) { - GL2ES1 gl = drawable.getGL().getGL2ES1(); + public void dispose(final GLAutoDrawable drawable) { + final GL2ES1 gl = drawable.getGL().getGL2ES1(); if(null!=texture) { texture.disable(gl); texture.destroy(gl); @@ -133,8 +134,8 @@ public class DemoGL2ES1TextureImmModeSink implements GLEventListener, TextureDra } @Override - public void display(GLAutoDrawable drawable) { - GL2ES1 gl = drawable.getGL().getGL2ES1(); + public void display(final GLAutoDrawable drawable) { + final GL2ES1 gl = drawable.getGL().getGL2ES1(); // draw one quad with the texture if(null!=texture) { @@ -143,7 +144,7 @@ public class DemoGL2ES1TextureImmModeSink implements GLEventListener, TextureDra texture.bind(gl); } // gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_REPLACE); - TextureCoords coords = texture.getImageTexCoords(); + final TextureCoords coords = texture.getImageTexCoords(); ims.glBegin(ImmModeSink.GL_QUADS); ims.glTexCoord2f(coords.left(), coords.bottom()); ims.glVertex3f(0, 0, 0); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES2ImmModeSink.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES2ImmModeSink.java index 9d18f21e0..f2616d987 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES2ImmModeSink.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES2ImmModeSink.java @@ -46,12 +46,12 @@ public class DemoGL2ES2ImmModeSink implements GLEventListener { private final ShaderState st; private final PMVMatrix pmvMatrix; - private int glBufferUsage; + private final int glBufferUsage; private ShaderProgram sp; private GLUniformData pmvMatrixUniform; private ImmModeSink ims; - public DemoGL2ES2ImmModeSink(boolean useVBO, boolean useShaderState) { + public DemoGL2ES2ImmModeSink(final boolean useVBO, final boolean useShaderState) { if(useShaderState) { st = new ShaderState(); st.setVerbose(true); @@ -59,23 +59,23 @@ public class DemoGL2ES2ImmModeSink implements GLEventListener { st = null; } glBufferUsage = useVBO ? GL.GL_STATIC_DRAW : 0; - pmvMatrix = new PMVMatrix(); + pmvMatrix = new PMVMatrix(); } - public void init(GLAutoDrawable glad) { + public void init(final GLAutoDrawable glad) { final GL2ES2 gl = glad.getGL().getGL2ES2(); - + System.err.println("GL_VENDOR "+gl.glGetString(GL.GL_VENDOR)); System.err.println("GL_RENDERER "+gl.glGetString(GL.GL_RENDERER)); System.err.println("GL_VERSION "+gl.glGetString(GL.GL_VERSION)); - - final ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, DemoGL2ES2ImmModeSink.class, + + final ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, DemoGL2ES2ImmModeSink.class, "../demos/es2/shader", "../demos/es2/shader/bin", "mgl_default_xxx", true); - final ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, DemoGL2ES2ImmModeSink.class, + final ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, DemoGL2ES2ImmModeSink.class, "../demos/es2/shader", "../demos/es2/shader/bin", "mgl_default_xxx", true); vp0.defaultShaderCustomization(gl, true, true); fp0.defaultShaderCustomization(gl, true, true); - + sp = new ShaderProgram(); sp.add(gl, vp0, System.err); sp.add(gl, fp0, System.err); @@ -87,10 +87,10 @@ public class DemoGL2ES2ImmModeSink implements GLEventListener { } sp.useProgram(gl, true); } - + pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); if(null != st) { - st.ownUniform(pmvMatrixUniform); + st.ownUniform(pmvMatrixUniform); st.uniform(gl, pmvMatrixUniform); } else { if( pmvMatrixUniform.setLocation(gl, sp.program()) < 0 ) { @@ -98,8 +98,8 @@ public class DemoGL2ES2ImmModeSink implements GLEventListener { } gl.glUniform(pmvMatrixUniform); } - - // Using predef array names, see + + // Using predef array names, see // GLPointerFuncUtil.getPredefinedArrayIndexName(glArrayIndex); if( null != st ) { ims = ImmModeSink.createGLSL(40, @@ -114,24 +114,24 @@ public class DemoGL2ES2ImmModeSink implements GLEventListener { 4, GL.GL_FLOAT, // color 0, GL.GL_FLOAT, // normal 0, GL.GL_FLOAT, // texCoords - glBufferUsage, sp.program()); + glBufferUsage, sp.program()); } final int numSteps = 20; final double increment = Math.PI / numSteps; final double radius = 1; ims.glBegin(GL.GL_LINES); for (int i = numSteps - 1; i >= 0; i--) { - ims.glVertex3f((float) (radius * Math.cos(i * increment)), - (float) (radius * Math.sin(i * increment)), + ims.glVertex3f((float) (radius * Math.cos(i * increment)), + (float) (radius * Math.sin(i * increment)), 0f); - ims.glColor4f( 1f, 1f, 1f, 1f ); - ims.glVertex3f((float) (-1.0 * radius * Math.cos(i * increment)), - (float) (-1.0 * radius * Math.sin(i * increment)), + ims.glColor4f( 1f, 1f, 1f, 1f ); + ims.glVertex3f((float) (-1.0 * radius * Math.cos(i * increment)), + (float) (-1.0 * radius * Math.sin(i * increment)), 0f); - ims.glColor4f( 1f, 1f, 1f, 1f ); + ims.glColor4f( 1f, 1f, 1f, 1f ); } ims.glEnd(gl, false); - + if(null != st) { st.useProgram(gl, false); } else { @@ -139,7 +139,7 @@ public class DemoGL2ES2ImmModeSink implements GLEventListener { } } - public void dispose(GLAutoDrawable glad) { + public void dispose(final GLAutoDrawable glad) { final GL2ES2 gl = glad.getGL().getGL2ES2(); ims.destroy(gl); ims = null; @@ -148,12 +148,12 @@ public class DemoGL2ES2ImmModeSink implements GLEventListener { } } - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); - + gl.glClear( GL.GL_COLOR_BUFFER_BIT ); - // draw a triangle filling the window + // draw a triangle filling the window ims.glBegin(GL.GL_TRIANGLES); ims.glColor3f( 1, 0, 0 ); ims.glVertex2f( 0, 0 ); @@ -161,22 +161,22 @@ public class DemoGL2ES2ImmModeSink implements GLEventListener { ims.glVertex2f( drawable.getSurfaceWidth(), 0 ); ims.glColor3f( 0, 0, 1 ); ims.glVertex2f( drawable.getSurfaceWidth() / 2, drawable.getSurfaceHeight() ); - ims.glEnd(gl, true); + ims.glEnd(gl, true); } // Unused routines - public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable glad, final int x, final int y, final int width, final int height) { System.err.println("reshape .."); final GL2ES2 gl = glad.getGL().getGL2ES2(); pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); - + // coordinate system origin at lower left with width and height same as the window pmvMatrix.glOrthof( 0.0f, width, 0.0f, height, -1, 1 ); pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); - + if(null != st) { st.useProgram(gl, true); st.uniform(gl, pmvMatrixUniform); @@ -188,6 +188,6 @@ public class DemoGL2ES2ImmModeSink implements GLEventListener { } } - public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) { + public void displayChanged(final GLAutoDrawable drawable, final boolean modeChanged, final boolean deviceChanged) { } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/TestES1FixedFunctionPipelineNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/TestES1FixedFunctionPipelineNEWT.java index e8e3b12d9..979c4873e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/TestES1FixedFunctionPipelineNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/TestES1FixedFunctionPipelineNEWT.java @@ -62,8 +62,8 @@ public class TestES1FixedFunctionPipelineNEWT extends UITestCase { public static void releaseClass() { } - protected void runTestGL0(GLCapabilities caps, GLEventListener demo) throws InterruptedException { - GLWindow glWindow = GLWindow.create(caps); + protected void runTestGL0(final GLCapabilities caps, final GLEventListener demo) throws InterruptedException { + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setTitle(getSimpleTestName(".")); @@ -72,8 +72,8 @@ public class TestES1FixedFunctionPipelineNEWT extends UITestCase { snap.setPostSNDetail(demo.getClass().getSimpleName()); glWindow.addGLEventListener(snap); - Animator animator = new Animator(glWindow); - QuitAdapter quitAdapter = new QuitAdapter(); + final Animator animator = new Animator(glWindow); + final QuitAdapter quitAdapter = new QuitAdapter(); glWindow.addKeyListener(quitAdapter); glWindow.addWindowListener(quitAdapter); @@ -92,7 +92,7 @@ public class TestES1FixedFunctionPipelineNEWT extends UITestCase { glWindow.destroy(); } - protected void runTestGL(GLCapabilities caps, boolean forceFFPEmu) throws InterruptedException { + protected void runTestGL(final GLCapabilities caps, final boolean forceFFPEmu) throws InterruptedException { final RedSquareES1 demo01 = new RedSquareES1(); demo01.setForceFFPEmu(forceFFPEmu, false, false, false); runTestGL0(caps, demo01); @@ -113,40 +113,40 @@ public class TestES1FixedFunctionPipelineNEWT extends UITestCase { @Test public void test01GL2Normal() throws InterruptedException { if(!GLProfile.isAvailable(GLProfile.GL2)) { System.err.println("GL2 n/a"); return; } - GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2)); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2)); runTestGL(caps, false); } @Test public void test02GL2FFPEmu() throws InterruptedException { if(!GLProfile.isAvailable(GLProfile.GL2)) { System.err.println("GL2 n/a"); return; } - GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2)); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2)); runTestGL(caps, true); } @Test public void test03GL2ES1Normal() throws InterruptedException { if(!GLProfile.isAvailable(GLProfile.GL2ES1)) { System.err.println("GL2ES1 n/a"); return; } - GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES1)); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES1)); runTestGL(caps, false); } @Test public void test04ES2FFPEmu() throws InterruptedException { if(!GLProfile.isAvailable(GLProfile.GLES2)) { System.err.println("GLES2 n/a"); return; } - GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2)); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2)); runTestGL(caps, false); // should be FFPEmu implicit } static long duration = 1000; // ms - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i
    * Bug Reference: https://jogamp.org/bugzilla/show_bug.cgi?id=362 *

    - * The bug pertains to incorrect size calculation for checking validity of data. Compressed DXT1 has min of 8 bytes, DXT5 has min of 16 bytes. - * It exists in {@link DDSImage#createFromData(int, int, int, ByteBuffer[])} + * The bug pertains to incorrect size calculation for checking validity of data. Compressed DXT1 has min of 8 bytes, DXT5 has min of 16 bytes. + * It exists in {@link DDSImage#createFromData(int, int, int, ByteBuffer[])} * where an {@link IllegalArgumentException} is thrown for Mipmap level size mismatch. *

    *
      The following cases are tested: @@ -31,68 +31,68 @@ import com.jogamp.opengl.util.texture.spi.DDSImage.ImageInfo; *
    • DXT1 compressed 64x32 RGB DDS Image with all mipmap levels (64x32 --> 1x1)
    • *
    • DXT5 compressed 64x32 RGB DDS Image with all mipmap levels (64x32 --> 1x1)
    • *
    - * + * * @author Michael Esemplare * */ public class TestBug362DDSImageCreateFromData { - + File testDDSImage01Uncompressed; File testDDSImage02DXT1; File testDDSImage03DXT5; - + @Before public void setup() throws Throwable { testDDSImage01Uncompressed = initFile("test-64x32_uncompressed.dds"); testDDSImage02DXT1 = initFile("test-64x32_DXT1.dds"); testDDSImage03DXT5 = initFile("test-64x32_DXT5.dds"); } - + @After public void teardown() { testDDSImage01Uncompressed = null; testDDSImage02DXT1 = null; testDDSImage03DXT5 = null; } - - private File initFile(String filename) throws URISyntaxException { - URLConnection connection = IOUtil.getResource(getClass(), filename); + + private File initFile(final String filename) throws URISyntaxException { + final URLConnection connection = IOUtil.getResource(getClass(), filename); Assert.assertNotNull(connection); - URL url = connection.getURL(); - File file = new File(url.toURI()); + final URL url = connection.getURL(); + final File file = new File(url.toURI()); Assert.assertTrue(file.exists()); return file; } - - private void testImpl(File file) throws IOException { - DDSImage ddsImage = DDSImage.read(file); + + private void testImpl(final File file) throws IOException { + final DDSImage ddsImage = DDSImage.read(file); Assert.assertNotNull(ddsImage); - int numMipMaps = ddsImage.getNumMipMaps(); - ByteBuffer[] mipMapArray = new ByteBuffer[numMipMaps]; + final int numMipMaps = ddsImage.getNumMipMaps(); + final ByteBuffer[] mipMapArray = new ByteBuffer[numMipMaps]; for (int i=0;i com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(Unknown Source) - } - + } + final GLReadBufferUtil screenshot = new GLReadBufferUtil(true, false); final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(1); - + final GLWindow glad1 = GLWindow.create(caps); glad1.setTitle("JPEG AWT"); // Size OpenGL to Video Surface glad1.setSize(w, h); glad1.setPosition(xpos, 0); - + // load texture from file inside current GL context to match the way // the bug submitter was doing it final GLEventListener gle; @@ -198,73 +198,73 @@ public class TestJPEGJoglAWTCompareNewtAWT extends UITestCase { } else { gle = null; } - glad1.addGLEventListener(new GLEventListener() { + glad1.addGLEventListener(new GLEventListener() { boolean shot = false; - - @Override public void init(GLAutoDrawable drawable) {} - - public void display(GLAutoDrawable drawable) { + + @Override public void init(final GLAutoDrawable drawable) {} + + public void display(final GLAutoDrawable drawable) { // 1 snapshot if( null!=gle && null!=((TextureDraw01Accessor)gle).getTexture() && !shot) { shot = true; snapshot(0, "AWTJPEG", drawable.getGL(), screenshot, TextureIO.PNG, null); } } - - @Override public void dispose(GLAutoDrawable drawable) { } - @Override public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { } + + @Override public void dispose(final GLAutoDrawable drawable) { } + @Override public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } }); return glad1; } - + @Test public void test01YUV444Base__ES2() throws InterruptedException, IOException { - testImpl(files[0]); - } + testImpl(files[0]); + } @Test public void test01YUV444Prog__ES2() throws InterruptedException, IOException { - testImpl(files[1]); - } - + testImpl(files[1]); + } + @Test public void test01YUV422hBase__ES2() throws InterruptedException, IOException { - testImpl(files[2]); - } + testImpl(files[2]); + } @Test public void test01YUV422hProg_ES2() throws InterruptedException, IOException { - testImpl(files[3]); - } - + testImpl(files[3]); + } + @Test public void test02YUV420Base__ES2() throws InterruptedException, IOException { - testImpl(files[4]); - } + testImpl(files[4]); + } @Test public void test02YUV420Prog_ES2() throws InterruptedException, IOException { - testImpl(files[5]); - } + testImpl(files[5]); + } @Test public void test02YUV420BaseGray_ES2() throws InterruptedException, IOException { - testImpl(files[6]); - } + testImpl(files[6]); + } @Test public void test03CMYK_01_ES2() throws InterruptedException, IOException { - testImpl(files[7]); - } + testImpl(files[7]); + } @Test public void test03YCCK_01_ES2() throws InterruptedException, IOException { - testImpl(files[8]); - } - - public static void main(String args[]) throws IOException { + testImpl(files[8]); + } + + public static void main(final String args[]) throws IOException { for(int i=0; i= image.getSize().getWidth() ) { x1 = image.getSize().getWidth() - w; } @@ -311,7 +311,7 @@ public class TestPixelFormatUtil00NEWT extends UITestCase { } System.err.println(); } - private void testComponents(PixelRectangle image, int x, int y, byte[] components) { + private void testComponents(final PixelRectangle image, final int x, final int y, final byte[] components) { dumpComponents(image, x, y, 3, 3); final ByteBuffer bb = image.getPixels(); final int bpp = image.getPixelformat().bytesPerPixel(); @@ -358,7 +358,7 @@ public class TestPixelFormatUtil00NEWT extends UITestCase { } } - public static void main(String args[]) { + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestPixelFormatUtil00NEWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil01NEWT.java index f54861371..eba920032 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil01NEWT.java @@ -82,7 +82,7 @@ public class TestPixelFormatUtil01NEWT extends UITestCase { { System.err.println("Test01: "+pathname+basename+".png, srcFmt "+srcFmt+", destMinStrideInBytes "+destMinStrideInBytes+", destIsGLOriented "+destIsGLOriented); - URLConnection urlConn = IOUtil.getResource(this.getClass(), pathname+basename+".png"); + final URLConnection urlConn = IOUtil.getResource(this.getClass(), pathname+basename+".png"); final PNGPixelRect image1 = PNGPixelRect.read(urlConn.getInputStream(), srcFmt, false /* directBuffer */, destMinStrideInBytes, false /* isGLOriented */); System.err.println("PNGPixelRect - Orig: "+image1); @@ -99,7 +99,7 @@ public class TestPixelFormatUtil01NEWT extends UITestCase { } } - public static void main(String args[]) { + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestPixelFormatUtil01NEWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTGATextureFromFileNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTGATextureFromFileNEWT.java index 859e4e4b5..4f6705330 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTGATextureFromFileNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTGATextureFromFileNEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -61,27 +61,27 @@ import com.jogamp.opengl.util.texture.TextureIO; public class TestTGATextureFromFileNEWT extends UITestCase { static boolean showFPS = false; static long duration = 100; // ms - + InputStream testTextureStream01U32; InputStream testTextureStream02RLE32; - + @Before public void initTest() throws IOException { { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-u32.tga"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-u32.tga"); Assert.assertNotNull(testTextureUrlConn); testTextureStream01U32 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream01U32); } { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "bug744-rle32.tga"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "bug744-rle32.tga"); Assert.assertNotNull(testTextureUrlConn); testTextureStream02RLE32 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream02RLE32); } } - - public void testImpl(boolean useFFP, final InputStream istream) throws InterruptedException, IOException { + + public void testImpl(final boolean useFFP, final InputStream istream) throws InterruptedException, IOException { final GLReadBufferUtil screenshot = new GLReadBufferUtil(true, false); GLProfile glp; if(useFFP && GLProfile.isAvailable(GLProfile.GL2)) { @@ -94,39 +94,39 @@ public class TestTGATextureFromFileNEWT extends UITestCase { } final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(1); - + final TextureData texData = TextureIO.newTextureData(glp, istream, false /* mipmap */, TextureIO.TGA); - System.err.println("TextureData: "+texData); - + System.err.println("TextureData: "+texData); + final GLWindow glad = GLWindow.create(caps); glad.setTitle("TestTGATextureGL2FromFileNEWT"); // Size OpenGL to Video Surface glad.setSize(texData.getWidth(), texData.getHeight()); - + // load texture from file inside current GL context to match the way // the bug submitter was doing it final GLEventListener gle = useFFP ? new TextureDraw01GL2Listener( texData ) : new TextureDraw01ES2Listener( texData, 0 ) ; glad.addGLEventListener(gle); - glad.addGLEventListener(new GLEventListener() { + glad.addGLEventListener(new GLEventListener() { boolean shot = false; - - @Override public void init(GLAutoDrawable drawable) {} - - public void display(GLAutoDrawable drawable) { + + @Override public void init(final GLAutoDrawable drawable) {} + + public void display(final GLAutoDrawable drawable) { // 1 snapshot if(null!=((TextureDraw01Accessor)gle).getTexture() && !shot) { shot = true; snapshot(0, null, drawable.getGL(), screenshot, TextureIO.PNG, null); } } - - @Override public void dispose(GLAutoDrawable drawable) { } - @Override public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { } + + @Override public void dispose(final GLAutoDrawable drawable) { } + @Override public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } }); - Animator animator = new Animator(glad); + final Animator animator = new Animator(glad); animator.setUpdateFPSFrames(60, showFPS ? System.err : null); - QuitAdapter quitAdapter = new QuitAdapter(); + final QuitAdapter quitAdapter = new QuitAdapter(); glad.addKeyListener(quitAdapter); glad.addWindowListener(quitAdapter); glad.setVisible(true); @@ -135,34 +135,34 @@ public class TestTGATextureFromFileNEWT extends UITestCase { while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration() AWT"); final Canvas canvas = new Canvas(); frame0.add(canvas); - + final GLCanvas glCanvas = new GLCanvas(caps); final Frame frame1 = new Frame("AWT -> Texture"); Assert.assertNotNull(frame1); frame1.add(glCanvas); - // create texture - TextureData textureData = AWTTextureIO.newTextureData(caps.getGLProfile(), textureImage, false); + // create texture + final TextureData textureData = AWTTextureIO.newTextureData(caps.getGLProfile(), textureImage, false); glCanvas.addGLEventListener(new TextureDraw01GL2Listener(textureData)); glCanvas.addGLEventListener(new GLEventListener() { - + @Override - public void init(GLAutoDrawable drawable) { } + public void init(final GLAutoDrawable drawable) { } @Override - public void dispose(GLAutoDrawable drawable) { } + public void dispose(final GLAutoDrawable drawable) { } @Override - public void display(GLAutoDrawable drawable) { - BufferedImage outputImage = awtGLReadBufferUtil.readPixelsToBufferedImage(drawable.getGL(), true /* awtOrientation */); - ImageIcon imageIcon = new ImageIcon(outputImage); - final JLabel imageLabel = new JLabel(imageIcon); + public void display(final GLAutoDrawable drawable) { + final BufferedImage outputImage = awtGLReadBufferUtil.readPixelsToBufferedImage(drawable.getGL(), true /* awtOrientation */); + final ImageIcon imageIcon = new ImageIcon(outputImage); + final JLabel imageLabel = new JLabel(imageIcon); try { AWTEDTExecutor.singleton.invoke(true, new Runnable() { public void run() { @@ -156,17 +156,17 @@ public class TestTexture01AWT extends UITestCase { frame0.add(imageLabel); frame0.validate(); }}); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); - } + } } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { frame0.setSize(frame1.getWidth(), frame1.getHeight()); frame0.setLocation(frame1.getX()+frame1.getWidth()+32, frame0.getY()); frame0.validate(); - } + } }); try { @@ -179,11 +179,11 @@ public class TestTexture01AWT extends UITestCase { frame0.setLocation(frame1.getX()+frame1.getWidth()+32, frame0.getY()); frame0.setVisible(true); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); - } - + } + Thread.sleep(durationPerTest); try { @@ -194,19 +194,19 @@ public class TestTexture01AWT extends UITestCase { frame1.setVisible(false); frame1.dispose(); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); - } + } } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i=5); Assert.assertTrue(caps2.getBlueBits()>=5); @@ -118,7 +118,7 @@ public class TestGLWindows01NEWT extends UITestCase { return glWindow; } - static void destroyWindow(GLWindow glWindow) { + static void destroyWindow(final GLWindow glWindow) { if(null!=glWindow) { glWindow.destroy(); Assert.assertEquals(false,glWindow.isNativeValid()); @@ -127,10 +127,10 @@ public class TestGLWindows01NEWT extends UITestCase { @Test public void testWindowNativeRecreate01aSimple() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); - GLWindow window = createWindow(null, caps, width, height, - true /* onscreen */, false /* undecorated */, + final GLWindow window = createWindow(null, caps, width, height, + true /* onscreen */, false /* undecorated */, false /*addGLEventListenerAfterVisible*/); Assert.assertEquals(true,window.isNativeValid()); @@ -156,10 +156,10 @@ public class TestGLWindows01NEWT extends UITestCase { @Test public void testWindowNativeRecreate01bSimple() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); - GLWindow window = createWindow(null, caps, width, height, - true /* onscreen */, false /* undecorated */, + final GLWindow window = createWindow(null, caps, width, height, + true /* onscreen */, false /* undecorated */, true /*addGLEventListenerAfterVisible*/); Assert.assertEquals(true,window.isNativeValid()); @@ -185,10 +185,10 @@ public class TestGLWindows01NEWT extends UITestCase { @Test public void testWindowDecor01aSimple() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); - GLWindow window = createWindow(null, caps, width, height, - true /* onscreen */, false /* undecorated */, + final GLWindow window = createWindow(null, caps, width, height, + true /* onscreen */, false /* undecorated */, false /*addGLEventListenerAfterVisible*/); System.out.println("Created: "+window); int state; @@ -201,10 +201,10 @@ public class TestGLWindows01NEWT extends UITestCase { @Test public void testWindowDecor01bSimple() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); - GLWindow window = createWindow(null, caps, width, height, - true /* onscreen */, false /* undecorated */, + final GLWindow window = createWindow(null, caps, width, height, + true /* onscreen */, false /* undecorated */, true /*addGLEventListenerAfterVisible*/); System.out.println("Created: "+window); int state; @@ -217,10 +217,10 @@ public class TestGLWindows01NEWT extends UITestCase { @Test public void testWindowDecor02DestroyWinTwiceA() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); - GLWindow window = createWindow(null, caps, width, height, - true /* onscreen */, false /* undecorated */, + final GLWindow window = createWindow(null, caps, width, height, + true /* onscreen */, false /* undecorated */, false /*addGLEventListenerAfterVisible*/); int state; for(state=0; state*100=5); Assert.assertTrue(caps2.getBlueBits()>=5); @@ -112,7 +112,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { return glWindow; } - static void destroyWindow(GLWindow glWindow) { + static void destroyWindow(final GLWindow glWindow) { if(null!=glWindow) { glWindow.destroy(); } @@ -120,10 +120,10 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { @Test public void testWindowDecor01Simple() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); - GLWindow window = createWindow(null, caps, width, height, true /* onscreen */, false /* undecorated */, true /* vsync */); - Animator animator = new Animator(window); + final GLWindow window = createWindow(null, caps, width, height, true /* onscreen */, false /* undecorated */, true /* vsync */); + final Animator animator = new Animator(window); animator.setUpdateFPSFrames(1, null); Assert.assertTrue(animator.start()); while(animator.isAnimating() && animator.getTotalFPSDuration()step_i) { final int w = width/step * j; final int h = height/step * j; @@ -113,25 +113,25 @@ public class TestGLWindows03NEWTAnimResize extends UITestCase { @Test public void test01WindowDecor() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); test(caps, false /* undecorated */); } @Test public void test02WindowUndecor() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); test(caps, true /* undecorated */); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i5); Assert.assertTrue(chosenCapabilities.getBlueBits()>5); @@ -90,7 +90,7 @@ public class TestRemoteWindow01NEWT extends UITestCase { return window; } - static void destroyWindow(Display display, Screen screen, Window window) { + static void destroyWindow(final Display display, final Screen screen, final Window window) { if(null!=window) { window.destroy(); } @@ -104,10 +104,10 @@ public class TestRemoteWindow01NEWT extends UITestCase { @Test public void testRemoteWindow01() throws InterruptedException { - Capabilities caps = new Capabilities(); - Display display1 = NewtFactory.createDisplay(null); // local display - Screen screen1 = NewtFactory.createScreen(display1, 0); // screen 0 - Window window1 = createWindow(screen1, caps, width, height, true /* onscreen */, false /* undecorated */); + final Capabilities caps = new Capabilities(); + final Display display1 = NewtFactory.createDisplay(null); // local display + final Screen screen1 = NewtFactory.createScreen(display1, 0); // screen 0 + final Window window1 = createWindow(screen1, caps, width, height, true /* onscreen */, false /* undecorated */); window1.setVisible(true); Assert.assertEquals(true,window1.isNativeValid()); @@ -115,16 +115,16 @@ public class TestRemoteWindow01NEWT extends UITestCase { // Remote Display/Device/Screen/Window .. Display display2; - AbstractGraphicsDevice device2; + final AbstractGraphicsDevice device2; Screen screen2; Window window2; try { display2 = NewtFactory.createDisplay(remoteDisplay); - display2.createNative(); + display2.createNative(); screen2 = NewtFactory.createScreen(display2, 0); // screen 0 window2 = createWindow(screen2, caps, width, height, true /* onscreen */, false /* undecorated */); window2.setVisible(true); - } catch (NativeWindowException nwe) { + } catch (final NativeWindowException nwe) { System.err.println(nwe); Assume.assumeNoException(nwe); destroyWindow(display1, screen1, window1); @@ -140,14 +140,14 @@ public class TestRemoteWindow01NEWT extends UITestCase { destroyWindow(display2, screen2, window2); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i NOP / HIDE (default) // - Assert.assertEquals(JFrame.HIDE_ON_CLOSE, frame.getDefaultCloseOperation()); + Assert.assertEquals(WindowConstants.HIDE_ON_CLOSE, frame.getDefaultCloseOperation()); WindowClosingMode op = glCanvas.getDefaultCloseOperation(); Assert.assertEquals(WindowClosingMode.DO_NOTHING_ON_CLOSE, op); Thread.sleep(300); - + Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false, closingListener)); // hide Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, false)); // hide -> invisible Assert.assertEquals(true, frame.isDisplayable()); @@ -161,8 +160,8 @@ public class TestWindowClosingProtocol01AWT extends UITestCase { // // close with op (JFrame): DISPOSE_ON_CLOSE -- GLCanvas --> dispose // - frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - Assert.assertEquals(JFrame.DISPOSE_ON_CLOSE, frame.getDefaultCloseOperation()); + frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + Assert.assertEquals(WindowConstants.DISPOSE_ON_CLOSE, frame.getDefaultCloseOperation()); op = glCanvas.getDefaultCloseOperation(); Assert.assertEquals(WindowClosingMode.DISPOSE_ON_CLOSE, op); @@ -174,8 +173,8 @@ public class TestWindowClosingProtocol01AWT extends UITestCase { Assert.assertEquals(false, glCanvas.isRealized()); } - public static void main(String[] args) { - String tstname = TestWindowClosingProtocol01AWT.class.getName(); + public static void main(final String[] args) { + final String tstname = TestWindowClosingProtocol01AWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java index 020581cb0..ab57065b9 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -52,8 +52,8 @@ public class TestWindowClosingProtocol02NEWT extends UITestCase { @Test public void testCloseGLWindow() throws InterruptedException, InvocationTargetException { - GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.getGL2ES2(); + final GLCapabilities caps = new GLCapabilities(glp); final GLWindow glWindow = GLWindow.create(caps); final AWTRobotUtil.WindowClosingListener closingListener = AWTRobotUtil.addClosingListener(glWindow); @@ -72,7 +72,7 @@ public class TestWindowClosingProtocol02NEWT extends UITestCase { glWindow.setDefaultCloseOperation(WindowClosingMode.DO_NOTHING_ON_CLOSE); op = glWindow.getDefaultCloseOperation(); Assert.assertEquals(WindowClosingMode.DO_NOTHING_ON_CLOSE, op); - + Thread.sleep(300); Assert.assertEquals(true, AWTRobotUtil.closeWindow(glWindow, false, closingListener)); // nop @@ -92,8 +92,8 @@ public class TestWindowClosingProtocol02NEWT extends UITestCase { Assert.assertEquals(true, closingListener.isWindowClosing()); } - public static void main(String[] args) { - String tstname = TestWindowClosingProtocol02NEWT.class.getName(); + public static void main(final String[] args) { + final String tstname = TestWindowClosingProtocol02NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java index efc833d88..e458862d0 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -30,22 +30,22 @@ package com.jogamp.opengl.test.junit.newt; import com.jogamp.newt.awt.NewtCanvasAWT; import com.jogamp.newt.opengl.GLWindow; + import org.junit.Test; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; import org.junit.Assert; import java.lang.reflect.InvocationTargetException; + import javax.swing.JFrame; import javax.swing.SwingUtilities; - +import javax.swing.WindowConstants; import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode; - import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; - import com.jogamp.opengl.test.junit.util.AWTRobotUtil; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.util.AWTRobotUtil.WindowClosingListener; @@ -57,9 +57,9 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase { public void testCloseJFrameNewtCanvasAWT() throws InterruptedException, InvocationTargetException { final JFrame frame = new JFrame("testCloseJFrameNewtCanvasAWT"); final WindowClosingListener awtClosingListener = AWTRobotUtil.addClosingListener(frame); - - GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); + + final GLProfile glp = GLProfile.getGL2ES2(); + final GLCapabilities caps = new GLCapabilities(glp); final GLWindow glWindow = GLWindow.create(caps); final AWTRobotUtil.WindowClosingListener newtClosingListener = AWTRobotUtil.addClosingListener(glWindow); @@ -87,15 +87,15 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase { // close with op: DO_NOTHING_ON_CLOSE -> NOP / HIDE (default) // { - Assert.assertEquals(JFrame.HIDE_ON_CLOSE, frame.getDefaultCloseOperation()); - WindowClosingMode op = newtCanvas.getDefaultCloseOperation(); + Assert.assertEquals(WindowConstants.HIDE_ON_CLOSE, frame.getDefaultCloseOperation()); + final WindowClosingMode op = newtCanvas.getDefaultCloseOperation(); Assert.assertEquals(WindowClosingMode.DO_NOTHING_ON_CLOSE, op); } Thread.sleep(300); - + Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false, awtClosingListener)); // hide - Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, false)); // hide -> invisible + Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, false)); // hide -> invisible Assert.assertEquals(true, frame.isDisplayable()); Assert.assertEquals(false, frame.isVisible()); Assert.assertEquals(true, newtCanvas.isValid()); @@ -116,17 +116,17 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase { Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, true)); Assert.assertEquals(true, frame.isDisplayable()); Assert.assertEquals(true, frame.isVisible()); - + // // close with op (JFrame): DISPOSE_ON_CLOSE -- newtCanvas -- glWindow --> dispose // { - frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - Assert.assertEquals(JFrame.DISPOSE_ON_CLOSE, frame.getDefaultCloseOperation()); - WindowClosingMode op = newtCanvas.getDefaultCloseOperation(); + frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + Assert.assertEquals(WindowConstants.DISPOSE_ON_CLOSE, frame.getDefaultCloseOperation()); + final WindowClosingMode op = newtCanvas.getDefaultCloseOperation(); Assert.assertEquals(WindowClosingMode.DISPOSE_ON_CLOSE, op); } - + Thread.sleep(300); Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, true, awtClosingListener)); @@ -142,8 +142,8 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase { Assert.assertEquals(true, newtClosingListener.isWindowClosed()); } - public static void main(String[] args) { - String tstname = TestWindowClosingProtocol03NewtAWT.class.getName(); + public static void main(final String[] args) { + final String tstname = TestWindowClosingProtocol03NewtAWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java index 02ea610d8..153da2666 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java @@ -52,7 +52,7 @@ public class TestWindows01NEWT extends UITestCase { height = 256; } - static Window createWindow(Capabilities caps, int x, int y, int width, int height, boolean onscreen, boolean undecorated) throws InterruptedException { + static Window createWindow(final Capabilities caps, final int x, final int y, final int width, final int height, final boolean onscreen, final boolean undecorated) throws InterruptedException { final boolean userPos = x>=0 && y>=0 ; // user has specified a position Assert.assertNotNull(caps); @@ -62,10 +62,10 @@ public class TestWindows01NEWT extends UITestCase { // // Create native windowing resources .. X11/Win/OSX // - Window window = NewtFactory.createWindow(caps); + final Window window = NewtFactory.createWindow(caps); Assert.assertNotNull(window); - Screen screen = window.getScreen(); - Display display = screen.getDisplay(); + final Screen screen = window.getScreen(); + final Display display = screen.getDisplay(); window.setUndecorated(onscreen && undecorated); if(userPos) { window.setPosition(x, y); @@ -92,7 +92,7 @@ public class TestWindows01NEWT extends UITestCase { Assert.assertEquals(y, window.getY()); } */ - CapabilitiesImmutable chosenCapabilities = window.getGraphicsConfiguration().getChosenCapabilities(); + final CapabilitiesImmutable chosenCapabilities = window.getGraphicsConfiguration().getChosenCapabilities(); Assert.assertNotNull(chosenCapabilities); Assert.assertTrue(chosenCapabilities.getGreenBits()>=5); Assert.assertTrue(chosenCapabilities.getBlueBits()>=5); @@ -102,12 +102,12 @@ public class TestWindows01NEWT extends UITestCase { return window; } - static void destroyWindow(Window window, boolean last) { + static void destroyWindow(final Window window, final boolean last) { if(null==window) { return; } - Screen screen = window.getScreen(); - Display display = screen.getDisplay(); + final Screen screen = window.getScreen(); + final Display display = screen.getDisplay(); window.destroy(); // System.err.println("************* Destroyed: "+window); if(last) { @@ -124,29 +124,29 @@ public class TestWindows01NEWT extends UITestCase { @Test public void testWindowDecorSimpleWMPos() throws InterruptedException { - Capabilities caps = new Capabilities(); + final Capabilities caps = new Capabilities(); Assert.assertNotNull(caps); - Window window = createWindow(caps, -1, -1, width, height, true /* onscreen */, false /* undecorated */); + final Window window = createWindow(caps, -1, -1, width, height, true /* onscreen */, false /* undecorated */); destroyWindow(window, true); } @Test public void testWindowDecorSimpleUserPos() throws InterruptedException { - Capabilities caps = new Capabilities(); + final Capabilities caps = new Capabilities(); Assert.assertNotNull(caps); - Window window = createWindow(caps, 100, 100, width, height, true /* onscreen */, false /* undecorated */); + final Window window = createWindow(caps, 100, 100, width, height, true /* onscreen */, false /* undecorated */); destroyWindow(window, true); } @Test public void testWindowNativeRecreate01Simple() throws InterruptedException { - Capabilities caps = new Capabilities(); + final Capabilities caps = new Capabilities(); Assert.assertNotNull(caps); - Window window = createWindow(caps, -1, -1, width, height, true /* onscreen */, false /* undecorated */); + final Window window = createWindow(caps, -1, -1, width, height, true /* onscreen */, false /* undecorated */); destroyWindow(window, true); window.setVisible(true); @@ -160,27 +160,27 @@ public class TestWindows01NEWT extends UITestCase { @Test public void testWindowDecorDestroyWinTwiceA() throws InterruptedException { - Capabilities caps = new Capabilities(); + final Capabilities caps = new Capabilities(); Assert.assertNotNull(caps); - Window window = createWindow(caps, -1, -1, width, height, true /* onscreen */, false /* undecorated */); + final Window window = createWindow(caps, -1, -1, width, height, true /* onscreen */, false /* undecorated */); destroyWindow(window, true); destroyWindow(window, true); } @Test public void testWindowDecorTwoWin() throws InterruptedException { - Capabilities caps = new Capabilities(); + final Capabilities caps = new Capabilities(); Assert.assertNotNull(caps); - Window window1 = createWindow(caps, -1, -1, width, height, true /* onscreen */, false /* undecorated */); - Window window2 = createWindow(caps, 100, 100, width, height, true /* onscreen */, false /* undecorated */); + final Window window1 = createWindow(caps, -1, -1, width, height, true /* onscreen */, false /* undecorated */); + final Window window2 = createWindow(caps, 100, 100, width, height, true /* onscreen */, false /* undecorated */); destroyWindow(window2, false); destroyWindow(window1, true); } - public static void main(String args[]) throws IOException { - String tstname = TestWindows01NEWT.class.getName(); + public static void main(final String args[]) throws IOException { + final String tstname = TestWindows01NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/WindowEventCom1.java b/src/test/com/jogamp/opengl/test/junit/newt/WindowEventCom1.java index 609d443aa..acc53b2f9 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/WindowEventCom1.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/WindowEventCom1.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,22 +20,22 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.newt; import com.jogamp.newt.event.*; class WindowEventCom1 extends WindowAdapter { - public void windowResized(WindowEvent e) { + public void windowResized(final WindowEvent e) { e.setAttachment(new String("WindowEventCom1.windowResized: "+e)); } - public void windowMoved(WindowEvent e) { + public void windowMoved(final WindowEvent e) { e.setAttachment(new String("WindowEventCom1.windowMoved: "+e)); } } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/WindowEventCom2.java b/src/test/com/jogamp/opengl/test/junit/newt/WindowEventCom2.java index d15a3ccd8..e563e768f 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/WindowEventCom2.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/WindowEventCom2.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,26 +20,26 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.newt; import com.jogamp.newt.event.*; class WindowEventCom2 extends WindowAdapter { - public void windowResized(WindowEvent e) { - String str = (String) e.getAttachment(); + public void windowResized(final WindowEvent e) { + final String str = (String) e.getAttachment(); if(null==str) { e.setAttachment(new String("WindowEventCom2.windowResized: "+e)); } } - public void windowMoved(WindowEvent e) { - String str = (String) e.getAttachment(); + public void windowMoved(final WindowEvent e) { + final String str = (String) e.getAttachment(); if(null==str) { e.setAttachment(new String("WindowEventCom2.windowMoved: "+e)); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/WindowEventCom3.java b/src/test/com/jogamp/opengl/test/junit/newt/WindowEventCom3.java index 87e5eccbb..d3dd6b5f9 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/WindowEventCom3.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/WindowEventCom3.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,24 +20,24 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.newt; import com.jogamp.newt.event.*; class WindowEventCom3 extends WindowAdapter { - public void windowResized(WindowEvent e) { - String str = (String) e.getAttachment(); + public void windowResized(final WindowEvent e) { + final String str = (String) e.getAttachment(); System.out.println("WindowEventCom3.windowResized: "+str); } - public void windowMoved(WindowEvent e) { - String str = (String) e.getAttachment(); + public void windowMoved(final WindowEvent e) { + final String str = (String) e.getAttachment(); System.out.println("WindowEventCom3.windowMoved: "+str); } } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java b/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java index a46e21b23..6fa070b07 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java @@ -89,7 +89,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { private volatile int _eventCount ; private ArrayList _failures = new ArrayList() ; - public synchronized void setModifierCheckEnabled( boolean value ) { + public synchronized void setModifierCheckEnabled( final boolean value ) { _modifierCheckEnabled = value ; } @@ -104,13 +104,13 @@ public abstract class BaseNewtEventModifiers extends UITestCase { * in this test code it's probably ok. */ - public synchronized void setExpectedModifiers( int value ) { + public synchronized void setExpectedModifiers( final int value ) { _expectedModifiers = value ; clear(); } public synchronized ArrayList clear() { - ArrayList old = _failures; + final ArrayList old = _failures; _eventCount = 0; @@ -122,7 +122,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { return old; } - public ArrayList getFailures(int waitEventCount) { + public ArrayList getFailures(final int waitEventCount) { int j; for(j=0; j < 20 && _eventCount < waitEventCount; j++) { // wait until events are collected _robot.delay(MS_ROBOT_AUTO_DELAY); @@ -133,7 +133,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { return clear(); } - private synchronized void _checkModifiers( com.jogamp.newt.event.MouseEvent hasEvent ) { + private synchronized void _checkModifiers( final com.jogamp.newt.event.MouseEvent hasEvent ) { if( _modifierCheckEnabled ) { final MouseEvent expEvent = new MouseEvent(hasEvent.getEventType(), hasEvent.getSource(), hasEvent.getWhen(), _expectedModifiers, @@ -152,7 +152,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { } } - private synchronized void _checkModifierMask( com.jogamp.newt.event.MouseEvent expEvent, com.jogamp.newt.event.MouseEvent hasEvent, int mask, String maskS ) { + private synchronized void _checkModifierMask( final com.jogamp.newt.event.MouseEvent expEvent, final com.jogamp.newt.event.MouseEvent hasEvent, final int mask, final String maskS ) { // If the "no event delivery" failure is still in the list then // get rid of it since that obviously isn't true anymore. We @@ -164,7 +164,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { } if( ( hasEvent.getModifiers() & mask ) != ( expEvent.getModifiers() & mask ) ) { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append( com.jogamp.newt.event.MouseEvent.getEventTypeString( hasEvent.getEventType() ) ).append(": mask ").append(maskS).append(" 0x").append(Integer.toHexString(mask)); sb.append(", eventCount ").append(_eventCount).append(", expected:"); expEvent.getModifiersString(sb); @@ -176,7 +176,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { } } - public synchronized void mousePressed( com.jogamp.newt.event.MouseEvent event ) { + public synchronized void mousePressed( final com.jogamp.newt.event.MouseEvent event ) { _eventCount++; if( _debug ) { _debugPrintStream.println( "MousePressed "+_eventCount+": "+event); @@ -184,7 +184,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { _checkModifiers( event ) ; } - public synchronized void mouseReleased( com.jogamp.newt.event.MouseEvent event ) { + public synchronized void mouseReleased( final com.jogamp.newt.event.MouseEvent event ) { _eventCount++; if( _debug ) { _debugPrintStream.println( "MouseReleased "+_eventCount+": "+event); @@ -192,7 +192,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { _checkModifiers( event ) ; } - public synchronized void mouseDragged( com.jogamp.newt.event.MouseEvent event ) { + public synchronized void mouseDragged( final com.jogamp.newt.event.MouseEvent event ) { _eventCount++; if( _debug ) { _debugPrintStream.println( "MouseDragged "+_eventCount+": "+event); @@ -204,7 +204,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { // IGNORED // - public synchronized void mouseMoved( com.jogamp.newt.event.MouseEvent event ) { + public synchronized void mouseMoved( final com.jogamp.newt.event.MouseEvent event ) { // Ignored, since mouse MOVE doesn't hold mouse button, we look for DRAGGED! // _eventCount++; if( _debug ) { @@ -213,7 +213,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { // _checkModifiers( event ) ; } - public synchronized void mouseClicked( com.jogamp.newt.event.MouseEvent event ) { + public synchronized void mouseClicked( final com.jogamp.newt.event.MouseEvent event ) { // Ignored, since we look for PRESS/RELEASE only! // _eventCount++; if( _debug ) { @@ -222,7 +222,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { // _checkModifiers( event ) ; } - public synchronized void mouseWheelMoved( com.jogamp.newt.event.MouseEvent event ) { + public synchronized void mouseWheelMoved( final com.jogamp.newt.event.MouseEvent event ) { // _eventCount++; if( _debug ) { _debugPrintStream.println( "MouseWheeleMoved ignored: "+event); @@ -230,7 +230,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { // _checkModifiers( event ) ; } - public synchronized void mouseEntered( com.jogamp.newt.event.MouseEvent event ) { + public synchronized void mouseEntered( final com.jogamp.newt.event.MouseEvent event ) { // _eventCount++; if( _debug ) { _debugPrintStream.println( "MouseEntered ignored: "+event); @@ -238,7 +238,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { // _checkModifiers( event ) ; } - public synchronized void mouseExited( com.jogamp.newt.event.MouseEvent event ) { + public synchronized void mouseExited( final com.jogamp.newt.event.MouseEvent event ) { // _eventCount++; if( _debug ) { _debugPrintStream.println( "MouseExited ignored: "+event); @@ -259,7 +259,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { //////////////////////////////////////////////////////////////////////////// - public static int getAWTButtonMask(int button) { + public static int getAWTButtonMask(final int button) { // Java7: java.awt.event.InputEvent.getMaskForButton( n + 1 ) ; -> using InputEvent.BUTTON1_DOWN_MASK .. etc // Java6: Only use BUTTON1_MASK, .. int m; @@ -331,10 +331,10 @@ public abstract class BaseNewtEventModifiers extends UITestCase { protected void eventDispatch() { try { Thread.sleep(100); - } catch (InterruptedException e) { } + } catch (final InterruptedException e) { } } - private void execOffThreadWithOnThreadEventDispatch(Runnable testAction) throws Exception { + private void execOffThreadWithOnThreadEventDispatch(final Runnable testAction) throws Exception { _testMouseListener.setModifierCheckEnabled( false ) ; _robot.setAutoDelay( MS_ROBOT_AUTO_DELAY ) ; { @@ -394,7 +394,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { public void run() { try { _doSingleButtonPressAndRelease( 0, 0 ); - } catch (Exception e) { throw new RuntimeException(e); } + } catch (final Exception e) { throw new RuntimeException(e); } } } ); } @@ -404,7 +404,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { public void run() { try { _doSingleButtonPressAndRelease( java.awt.event.KeyEvent.VK_SHIFT, java.awt.event.InputEvent.SHIFT_DOWN_MASK ) ; - } catch (Exception e) { throw new RuntimeException(e); } + } catch (final Exception e) { throw new RuntimeException(e); } } } ); } @@ -414,7 +414,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { public void run() { try { _doSingleButtonPressAndRelease( java.awt.event.KeyEvent.VK_CONTROL, java.awt.event.InputEvent.CTRL_DOWN_MASK ) ; - } catch (Exception e) { throw new RuntimeException(e); } + } catch (final Exception e) { throw new RuntimeException(e); } } } ); } @@ -467,7 +467,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { public void run() { try { _doHoldOneButtonAndPressAnother( 0, 0 ) ; - } catch (Exception e) { throw new RuntimeException(e); } + } catch (final Exception e) { throw new RuntimeException(e); } } } ); } @@ -477,7 +477,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { public void run() { try { _doPressAllButtonsInSequence( 0, 0 ) ; - } catch (Exception e) { throw new RuntimeException(e); } + } catch (final Exception e) { throw new RuntimeException(e); } } } ); } @@ -487,7 +487,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { public void run() { try { _doSingleButtonClickAndDrag( 0, 0 ) ; - } catch (Exception e) { throw new RuntimeException(e); } + } catch (final Exception e) { throw new RuntimeException(e); } } } ); } @@ -501,7 +501,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { for (int n = 0 ; n < _numButtonsToTest ; ++n) { - int awtButtonMask = _awtButtonMasks[n] ; + final int awtButtonMask = _awtButtonMasks[n] ; if( _debug ) { _debugPrintStream.println( "*** pressing button " + ( n + 1 ) ) ; } _testMouseListener.setExpectedModifiers( _getNewtModifiersForAwtExtendedModifiers( keyModifierMask | awtButtonMask ) ) ; @@ -527,7 +527,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { for (int n = 0 ; n < _numButtonsToTest ; ++n) { - int awtButtonMask = _awtButtonMasks[n] ; + final int awtButtonMask = _awtButtonMasks[n] ; if( _debug ) { _debugPrintStream.println( "*** pressing button " + ( n + 1 ) ) ; } _testMouseListener.setExpectedModifiers( _getNewtModifiersForAwtExtendedModifiers( keyModifierMask | awtButtonMask ) ) ; @@ -606,7 +606,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { for (int n = 0 ; n < _numButtonsToTest ; ++n) { - int awtButtonMask = _awtButtonMasks[n] ; + final int awtButtonMask = _awtButtonMasks[n] ; if( _debug ) { _debugPrintStream.println( "*** pressing button " + ( n + 1 ) ) ; } _testMouseListener.setExpectedModifiers( _getNewtModifiersForAwtExtendedModifiers( keyModifierMask | awtButtonMask ) ) ; @@ -636,10 +636,10 @@ public abstract class BaseNewtEventModifiers extends UITestCase { //////////////////////////////////////////////////////////////////////////// - private void _doKeyPress( int keyCode ) { + private void _doKeyPress( final int keyCode ) { AWTRobotUtil.validateAWTEDTIsAlive(); if( keyCode != 0 ) { - boolean modifierCheckEnabled = _testMouseListener.modifierCheckEnabled() ; + final boolean modifierCheckEnabled = _testMouseListener.modifierCheckEnabled() ; _testMouseListener.setModifierCheckEnabled( false ) ; _robot.keyPress( keyCode ) ; _robot.delay(MS_ROBOT_KEY_PRESS_DELAY); @@ -649,10 +649,10 @@ public abstract class BaseNewtEventModifiers extends UITestCase { //////////////////////////////////////////////////////////////////////////// - private void _doKeyRelease( int keyCode ) { + private void _doKeyRelease( final int keyCode ) { AWTRobotUtil.validateAWTEDTIsAlive(); if( keyCode != 0 ) { - boolean modifierCheckEnabled = _testMouseListener.modifierCheckEnabled() ; + final boolean modifierCheckEnabled = _testMouseListener.modifierCheckEnabled() ; _testMouseListener.setModifierCheckEnabled( false ) ; _robot.keyRelease( keyCode ) ; _robot.delay(MS_ROBOT_KEY_RELEASE_DELAY); @@ -662,11 +662,11 @@ public abstract class BaseNewtEventModifiers extends UITestCase { //////////////////////////////////////////////////////////////////////////// - private void _checkFailures(String descr, int waitEventCount) { - ArrayList failures = _testMouseListener.getFailures(waitEventCount) ; + private void _checkFailures(final String descr, final int waitEventCount) { + final ArrayList failures = _testMouseListener.getFailures(waitEventCount) ; _debugPrintStream.print(getSimpleTestName(".")+" - "+descr+": "); - int numFailures = failures.size() ; + final int numFailures = failures.size() ; if( numFailures == 0 ) { _debugPrintStream.println( " PASSED" ) ; } else { @@ -706,7 +706,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { _robot.setAutoDelay( MS_ROBOT_AUTO_DELAY ) ; - boolean modifierCheckEnabled = _testMouseListener.modifierCheckEnabled() ; + final boolean modifierCheckEnabled = _testMouseListener.modifierCheckEnabled() ; _testMouseListener.setModifierCheckEnabled( false ) ; { @@ -746,7 +746,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { * The equivalent NEWT modifiers. */ - private int _getNewtModifiersForAwtExtendedModifiers( int awtExtendedModifiers ) { + private int _getNewtModifiersForAwtExtendedModifiers( final int awtExtendedModifiers ) { int mask = 0 ; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java index a459a7f1f..194edbcb5 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java @@ -97,8 +97,8 @@ public class TestNewtEventModifiersAWTCanvas extends BaseNewtEventModifiers { //////////////////////////////////////////////////////////////////////////// - public static void main(String args[]) throws Exception { - String testName = TestNewtEventModifiersAWTCanvas.class.getName() ; + public static void main(final String args[]) throws Exception { + final String testName = TestNewtEventModifiersAWTCanvas.class.getName() ; org.junit.runner.JUnitCore.main( testName ) ; } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java index c4bd3eb71..d34c36072 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.newt.event; import javax.media.opengl.GLCapabilities; @@ -60,10 +60,10 @@ public class TestNewtEventModifiersNEWTWindowAWT extends BaseNewtEventModifiers _glWindow.setSize(TEST_FRAME_WIDTH, TEST_FRAME_HEIGHT); _glWindow.setPosition(TEST_FRAME_X, TEST_FRAME_Y); _glWindow.setVisible(true); - + Assert.assertTrue(AWTRobotUtil.waitForVisible(_glWindow, true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(_glWindow, true)); - + AWTRobotUtil.assertRequestFocusAndWait(null, _glWindow, _glWindow, null, null); // programmatic Assert.assertNotNull(_robot); AWTRobotUtil.requestFocus(_robot, _glWindow, false); // within unit framework, prev. tests (TestFocus02SwingAWTRobot) 'confuses' Windows keyboard input @@ -78,8 +78,8 @@ public class TestNewtEventModifiersNEWTWindowAWT extends BaseNewtEventModifiers //////////////////////////////////////////////////////////////////////////// - public static void main(String args[]) throws Exception { - String testName = TestNewtEventModifiersNEWTWindowAWT.class.getName() ; + public static void main(final String args[]) throws Exception { + final String testName = TestNewtEventModifiersNEWTWindowAWT.class.getName() ; org.junit.runner.JUnitCore.main( testName ) ; } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java index 0abadb0d4..c916ddc4d 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.newt.event ; import java.awt.BorderLayout ; @@ -70,27 +70,27 @@ public class TestNewtEventModifiersNewtCanvasAWT extends BaseNewtEventModifiers _testFrame.setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE ) ; { - GLCapabilities caps = new GLCapabilities( GLProfile.getGL2ES2() ) ; + final GLCapabilities caps = new GLCapabilities( GLProfile.getGL2ES2() ) ; _glWindow = GLWindow.create( caps ) ; - NewtCanvasAWT canvas = new NewtCanvasAWT( _glWindow ) ; + final NewtCanvasAWT canvas = new NewtCanvasAWT( _glWindow ) ; _testFrame.getContentPane().add( canvas, BorderLayout.CENTER ) ; _glWindow.addGLEventListener( new RedSquareES2() ) ; } _testFrame.setBounds( TEST_FRAME_X, TEST_FRAME_Y, TEST_FRAME_WIDTH, TEST_FRAME_HEIGHT ) ; - _testFrame.setVisible( true ) ; + _testFrame.setVisible( true ) ; } } ) ; Assert.assertEquals(true, AWTRobotUtil.waitForVisible(_testFrame, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(_glWindow, true)); - Assert.assertTrue(AWTRobotUtil.waitForRealized(_glWindow, true)); - + Assert.assertTrue(AWTRobotUtil.waitForRealized(_glWindow, true)); + AWTRobotUtil.assertRequestFocusAndWait(null, _glWindow, _glWindow, null, null); // programmatic Assert.assertNotNull(_robot); AWTRobotUtil.requestFocus(_robot, _glWindow, false); // within unit framework, prev. tests (TestFocus02SwingAWTRobot) 'confuses' Windows keyboard input - + _glWindow.addMouseListener( _testMouseListener ) ; } @@ -111,8 +111,8 @@ public class TestNewtEventModifiersNewtCanvasAWT extends BaseNewtEventModifiers //////////////////////////////////////////////////////////////////////////// - public static void main(String args[]) throws Exception { - String testName = TestNewtEventModifiersNewtCanvasAWT.class.getName() ; + public static void main(final String args[]) throws Exception { + final String testName = TestNewtEventModifiersNewtCanvasAWT.class.getName() ; org.junit.runner.JUnitCore.main( testName ) ; } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWTAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWTAWT.java index 2a6b8ba19..3e4029cf5 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWTAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWTAWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.newt.event; import org.eclipse.swt.SWT ; @@ -63,12 +63,12 @@ public class TestNewtEventModifiersNewtCanvasSWTAWT extends BaseNewtEventModifie private static GLWindow _glWindow ; //////////////////////////////////////////////////////////////////////////// - + protected static void eventDispatchImpl() { final int maxEvents = 10; try { Thread.sleep(100); - } catch (InterruptedException e) { } + } catch (final InterruptedException e) { } final boolean[] res = { false }; int i=0; do { @@ -83,29 +83,29 @@ public class TestNewtEventModifiersNewtCanvasSWTAWT extends BaseNewtEventModifie i++; } while( i * Due to limitation of AWT Robot, the test machine needs to have US keyboard enabled, * even though we do unify VK codes to US keyboard across all layouts. @@ -89,35 +89,35 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase { @AfterClass public static void release() { } - + @Before - public void initTest() { + public void initTest() { } @After - public void releaseTest() { + public void releaseTest() { } - + @Test(timeout=180000) // TO 3 min public void test01NEWT() throws AWTException, InterruptedException, InvocationTargetException { - GLWindow glWindow = GLWindow.create(glCaps); + final GLWindow glWindow = GLWindow.create(glCaps); glWindow.setSize(width, height); glWindow.setVisible(true); - + testImpl(glWindow); - + glWindow.destroy(); } - - private void testNewtCanvasAWT_Impl(boolean onscreen) throws AWTException, InterruptedException, InvocationTargetException { - GLWindow glWindow = GLWindow.create(glCaps); - + + private void testNewtCanvasAWT_Impl(final boolean onscreen) throws AWTException, InterruptedException, InvocationTargetException { + final GLWindow glWindow = GLWindow.create(glCaps); + // Wrap the window in a canvas. final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow); if( !onscreen ) { newtCanvasAWT.setShallUseOffscreenLayer(true); } - + // Add the canvas to a frame, and make it all visible. final JFrame frame1 = new JFrame("Swing AWT Parent Frame: "+ glWindow.getTitle()); frame1.getContentPane().add(newtCanvasAWT, BorderLayout.CENTER); @@ -126,24 +126,24 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase { public void run() { frame1.setVisible(true); } } ); - + Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame1, true)); - + testImpl(glWindow); - + try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame1.setVisible(false); frame1.dispose(); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); - } - glWindow.destroy(); + } + glWindow.destroy(); } - + @Test(timeout=180000) // TO 3 min public void test02NewtCanvasAWT_Onscreen() throws AWTException, InterruptedException, InvocationTargetException { if( JAWTUtil.isOffscreenLayerRequired() ) { @@ -152,7 +152,7 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase { } testNewtCanvasAWT_Impl(true); } - + @Test(timeout=180000) // TO 3 min public void test03NewtCanvasAWT_Offsccreen() throws AWTException, InterruptedException, InvocationTargetException { if( !JAWTUtil.isOffscreenLayerSupported() ) { @@ -161,9 +161,9 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase { } testNewtCanvasAWT_Impl(false); } - - static void testKeyCodeModifier(Robot robot, NEWTKeyAdapter keyAdapter, short modifierKey, int modifierMask, short keyCode, - char keyCharOnly, char keyCharMod) { + + static void testKeyCodeModifier(final Robot robot, final NEWTKeyAdapter keyAdapter, final short modifierKey, final int modifierMask, final short keyCode, + final char keyCharOnly, final char keyCharMod) { keyAdapter.reset(); AWTRobotUtil.waitForIdle(robot); AWTRobotUtil.newtKeyPress(0, robot, true, keyCode, 10); // press keyCode @@ -172,107 +172,107 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase { for(int j=0; j < 100 && keyAdapter.getQueueSize() < 2; j++) { // wait until events are collected robot.delay(100); } - + AWTRobotUtil.waitForIdle(robot); AWTRobotUtil.newtKeyPress(0, robot, true, modifierKey, 10); // press MOD AWTRobotUtil.newtKeyPress(0, robot, true, keyCode, 10); // press keyCode - AWTRobotUtil.newtKeyPress(0, robot, false, keyCode, 10); // release keyCode + AWTRobotUtil.newtKeyPress(0, robot, false, keyCode, 10); // release keyCode AWTRobotUtil.newtKeyPress(0, robot, false, modifierKey, 100); // release MOD AWTRobotUtil.waitForIdle(robot); for(int j=0; j < 100 && keyAdapter.getQueueSize() < 2+4; j++) { // wait until events are collected robot.delay(100); } NEWTKeyUtil.validateKeyAdapterStats(keyAdapter, - 3 /* press-SI */, 3 /* release-SI */, + 3 /* press-SI */, 3 /* release-SI */, 0 /* press-AR */, 0 /* release-AR */ ); - + final List queue = keyAdapter.copyQueue(); int i=0; NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_PRESSED, 0, keyCode, keyCharOnly); NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_RELEASED, 0, keyCode, keyCharOnly); - + NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_PRESSED, modifierMask, modifierKey, KeyEvent.NULL_CHAR); NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_PRESSED, modifierMask, keyCode, keyCharMod); NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_RELEASED, modifierMask, keyCode, keyCharMod); - KeyEvent e = (KeyEvent) queue.get(i++); + final KeyEvent e = (KeyEvent) queue.get(i++); NEWTKeyUtil.validateKeyEvent(e, KeyEvent.EVENT_KEY_RELEASED, modifierMask, modifierKey, KeyEvent.NULL_CHAR); } - - static void testKeyCodeAllModifierV1(Robot robot, NEWTKeyAdapter keyAdapter) { + + static void testKeyCodeAllModifierV1(final Robot robot, final NEWTKeyAdapter keyAdapter) { final short m1k = KeyEvent.VK_ALT; final int m1m = InputEvent.ALT_MASK; final short m2k = KeyEvent.VK_CONTROL; final int m2m = InputEvent.CTRL_MASK; final short m3k = KeyEvent.VK_SHIFT; final int m3m = InputEvent.SHIFT_MASK; - + keyAdapter.reset(); AWTRobotUtil.waitForIdle(robot); AWTRobotUtil.newtKeyPress(0, robot, true, m1k, 10); // press MOD1 AWTRobotUtil.newtKeyPress(0, robot, true, m2k, 10); // press MOD2 AWTRobotUtil.newtKeyPress(0, robot, true, m3k, 10); // press MOD3 AWTRobotUtil.newtKeyPress(0, robot, true, KeyEvent.VK_1, 10); // press P - - AWTRobotUtil.newtKeyPress(0, robot, false, KeyEvent.VK_1, 100); // release P + + AWTRobotUtil.newtKeyPress(0, robot, false, KeyEvent.VK_1, 100); // release P AWTRobotUtil.newtKeyPress(0, robot, false, m3k, 10); // release MOD AWTRobotUtil.newtKeyPress(0, robot, false, m2k, 10); // release MOD - AWTRobotUtil.newtKeyPress(0, robot, false, m1k, 10); // release MOD + AWTRobotUtil.newtKeyPress(0, robot, false, m1k, 10); // release MOD AWTRobotUtil.waitForIdle(robot); - + for(int j=0; j < 100 && keyAdapter.getQueueSize() < 4+4; j++) { // wait until events are collected robot.delay(100); } - NEWTKeyUtil.validateKeyAdapterStats(keyAdapter, - 4 /* press-SI */, 4 /* release-SI */, + NEWTKeyUtil.validateKeyAdapterStats(keyAdapter, + 4 /* press-SI */, 4 /* release-SI */, 0 /* press-AR */, 0 /* release-AR */ ); - - final List queue = keyAdapter.copyQueue(); + + final List queue = keyAdapter.copyQueue(); int i=0; NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_PRESSED, m1m, m1k, KeyEvent.NULL_CHAR); NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_PRESSED, m1m|m2m, m2k, KeyEvent.NULL_CHAR); NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_PRESSED, m1m|m2m|m3m, m3k, KeyEvent.NULL_CHAR); - + NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_PRESSED, m1m|m2m|m3m, KeyEvent.VK_1, KeyEvent.NULL_CHAR); NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_RELEASED, m1m|m2m|m3m, KeyEvent.VK_1, KeyEvent.NULL_CHAR); - KeyEvent e = (KeyEvent) queue.get(i++); + final KeyEvent e = (KeyEvent) queue.get(i++); NEWTKeyUtil.validateKeyEvent(e, KeyEvent.EVENT_KEY_RELEASED, m1m|m2m|m3m, m3k, KeyEvent.NULL_CHAR); NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_RELEASED, m1m|m2m, m2k, KeyEvent.NULL_CHAR); NEWTKeyUtil.validateKeyEvent((KeyEvent) queue.get(i++), KeyEvent.EVENT_KEY_RELEASED, m1m, m1k, KeyEvent.NULL_CHAR); } - - void testImpl(GLWindow glWindow) throws AWTException, InterruptedException, InvocationTargetException { + + void testImpl(final GLWindow glWindow) throws AWTException, InterruptedException, InvocationTargetException { final Robot robot = new Robot(); robot.setAutoWaitForIdle(true); - GLEventListener demo1 = new RedSquareES2(); + final GLEventListener demo1 = new RedSquareES2(); glWindow.addGLEventListener(demo1); // NEWTFocusAdapter glWindow1FA = new NEWTFocusAdapter("GLWindow1"); // glWindow.addWindowListener(glWindow1FA); - NEWTKeyAdapter glWindow1KA = new NEWTKeyAdapter("GLWindow1"); + final NEWTKeyAdapter glWindow1KA = new NEWTKeyAdapter("GLWindow1"); glWindow1KA.setVerbose(false); glWindow.addKeyListener(glWindow1KA); - Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, true)); + Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, true)); // Continuous animation .. - Animator animator = new Animator(glWindow); + final Animator animator = new Animator(glWindow); animator.start(); Thread.sleep(durationPerTest); // manual testing - + AWTRobotUtil.assertRequestFocusAndWait(null, glWindow, glWindow, null, null); // programmatic AWTRobotUtil.requestFocus(robot, glWindow, false); // within unit framework, prev. tests (TestFocus02SwingAWTRobot) 'confuses' Windows keyboard input - glWindow1KA.reset(); + glWindow1KA.reset(); testKeyCodeModifier(robot, glWindow1KA, KeyEvent.VK_SHIFT, InputEvent.SHIFT_MASK, KeyEvent.VK_1, '1', '!'); testKeyCodeModifier(robot, glWindow1KA, KeyEvent.VK_SHIFT, InputEvent.SHIFT_MASK, KeyEvent.VK_Y, 'y', 'Y'); // US: Y, DE: Z testKeyCodeModifier(robot, glWindow1KA, KeyEvent.VK_SHIFT, InputEvent.SHIFT_MASK, KeyEvent.VK_P, 'p', 'P'); testKeyCodeModifier(robot, glWindow1KA, KeyEvent.VK_CONTROL, InputEvent.CTRL_MASK, KeyEvent.VK_1, '1', KeyEvent.NULL_CHAR); testKeyCodeModifier(robot, glWindow1KA, KeyEvent.VK_ALT, InputEvent.ALT_MASK, KeyEvent.VK_1, '1', KeyEvent.NULL_CHAR); - + testKeyCodeAllModifierV1(robot, glWindow1KA); - + // Remove listeners to avoid logging during dispose/destroy. glWindow.removeKeyListener(glWindow1KA); @@ -280,15 +280,15 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase { animator.stop(); } - static int atoi(String a) { + static int atoi(final String a) { int i=0; try { i = Integer.parseInt(a); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } return i; } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i> cse = new ArrayList>(); keyAdapter.setVerbose(true); // FIXME @@ -204,14 +204,14 @@ public class TestNewtKeyCodesAWT extends UITestCase { // System.err.println("*** KeyCode 0x"+Integer.toHexString(c)); try { AWTRobotUtil.newtKeyPress(0, robot, true, c, 10); - } catch (Exception e) { + } catch (final Exception e) { System.err.println("Exception @ AWT Robot.PRESS "+MiscUtils.toHexString(c)+" - "+e.getMessage()); break; } eventCount++; try { AWTRobotUtil.newtKeyPress(0, robot, false, c, 100); - } catch (Exception e) { + } catch (final Exception e) { System.err.println("Exception @ AWT Robot.RELEASE "+MiscUtils.toHexString(c)+" - "+e.getMessage()); break; } @@ -230,23 +230,23 @@ public class TestNewtKeyCodesAWT extends UITestCase { Assert.assertEquals("KeyCode impl. incomplete", true, NEWTKeyUtil.validateKeyCodes(codeSegments, cse, true)); } - void testImpl(GLWindow glWindow) throws AWTException, InterruptedException, InvocationTargetException { + void testImpl(final GLWindow glWindow) throws AWTException, InterruptedException, InvocationTargetException { final Robot robot = new Robot(); robot.setAutoWaitForIdle(true); - GLEventListener demo1 = new RedSquareES2(); + final GLEventListener demo1 = new RedSquareES2(); glWindow.addGLEventListener(demo1); // NEWTFocusAdapter glWindow1FA = new NEWTFocusAdapter("GLWindow1"); // glWindow.addWindowListener(glWindow1FA); - NEWTKeyAdapter glWindow1KA = new NEWTKeyAdapter("GLWindow1"); + final NEWTKeyAdapter glWindow1KA = new NEWTKeyAdapter("GLWindow1"); glWindow1KA.setVerbose(false); glWindow.addKeyListener(glWindow1KA); Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, true)); // Continuous animation .. - Animator animator = new Animator(glWindow); + final Animator animator = new Animator(glWindow); animator.start(); Thread.sleep(durationPerTest); // manual testing @@ -264,15 +264,15 @@ public class TestNewtKeyCodesAWT extends UITestCase { animator.stop(); } - static int atoi(String a) { + static int atoi(final String a) { int i=0; try { i = Integer.parseInt(a); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } return i; } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i * Note Event order: *
      @@ -88,35 +88,35 @@ public class TestNewtKeyEventOrderAWT extends UITestCase { @AfterClass public static void release() { } - + @Before - public void initTest() { + public void initTest() { } @After - public void releaseTest() { + public void releaseTest() { } - + @Test(timeout=180000) // TO 3 min public void test01NEWT() throws AWTException, InterruptedException, InvocationTargetException { - GLWindow glWindow = GLWindow.create(glCaps); + final GLWindow glWindow = GLWindow.create(glCaps); glWindow.setSize(width, height); glWindow.setVisible(true); - + testImpl(glWindow); - + glWindow.destroy(); } - - private void testNewtCanvasAWT_Impl(boolean onscreen) throws AWTException, InterruptedException, InvocationTargetException { - GLWindow glWindow = GLWindow.create(glCaps); - + + private void testNewtCanvasAWT_Impl(final boolean onscreen) throws AWTException, InterruptedException, InvocationTargetException { + final GLWindow glWindow = GLWindow.create(glCaps); + // Wrap the window in a canvas. final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow); if( !onscreen ) { newtCanvasAWT.setShallUseOffscreenLayer(true); } - + // Add the canvas to a frame, and make it all visible. final JFrame frame1 = new JFrame("Swing AWT Parent Frame: "+ glWindow.getTitle()); frame1.getContentPane().add(newtCanvasAWT, BorderLayout.CENTER); @@ -125,24 +125,24 @@ public class TestNewtKeyEventOrderAWT extends UITestCase { public void run() { frame1.setVisible(true); } } ); - + Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame1, true)); - + testImpl(glWindow); - + try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame1.setVisible(false); frame1.dispose(); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); - } + } glWindow.destroy(); } - + @Test(timeout=180000) // TO 3 min public void test02NewtCanvasAWT_Onscreen() throws AWTException, InterruptedException, InvocationTargetException { if( JAWTUtil.isOffscreenLayerRequired() ) { @@ -151,7 +151,7 @@ public class TestNewtKeyEventOrderAWT extends UITestCase { } testNewtCanvasAWT_Impl(true); } - + @Test(timeout=180000) // TO 3 min public void test03NewtCanvasAWT_Offsccreen() throws AWTException, InterruptedException, InvocationTargetException { if( !JAWTUtil.isOffscreenLayerSupported() ) { @@ -160,8 +160,8 @@ public class TestNewtKeyEventOrderAWT extends UITestCase { } testNewtCanvasAWT_Impl(false); } - - static void testKeyEventOrder(Robot robot, NEWTKeyAdapter keyAdapter, int loops) { + + static void testKeyEventOrder(final Robot robot, final NEWTKeyAdapter keyAdapter, final int loops) { System.err.println("KEY Event Order Test: "+loops); keyAdapter.reset(); for(int i=0; i eventCountAdapters = new ArrayList(); + final ArrayList eventCountAdapters = new ArrayList(); // Create a window. - GLWindow glWindow1 = GLWindow.create(glCaps); + final GLWindow glWindow1 = GLWindow.create(glCaps); glWindow1.setTitle("testNewtChildFocus"); - GLEventListener demo1 = new RedSquareES2(); + final GLEventListener demo1 = new RedSquareES2(); TestListenerCom01AWT.setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); - NEWTFocusAdapter glWindow1FA = new NEWTFocusAdapter("GLWindow1"); + final NEWTFocusAdapter glWindow1FA = new NEWTFocusAdapter("GLWindow1"); glWindow1.addWindowListener(glWindow1FA); // Monitor NEWT focus and keyboard events. - NEWTKeyAdapter glWindow1KA = new NEWTKeyAdapter("GLWindow1"); + final NEWTKeyAdapter glWindow1KA = new NEWTKeyAdapter("GLWindow1"); eventCountAdapters.add(glWindow1KA); glWindow1.addKeyListener(glWindow1KA); @@ -121,10 +121,10 @@ public class TestParentingFocus01SwingAWTRobot extends UITestCase { // newtCanvasAWT.setShallUseOffscreenLayer(true); // Monitor AWT focus and keyboard events. - AWTKeyAdapter newtCanvasAWTKA = new AWTKeyAdapter("NewtCanvasAWT"); + final AWTKeyAdapter newtCanvasAWTKA = new AWTKeyAdapter("NewtCanvasAWT"); newtCanvasAWT.addKeyListener(newtCanvasAWTKA); eventCountAdapters.add(newtCanvasAWTKA); - AWTFocusAdapter newtCanvasAWTFA = new AWTFocusAdapter("NewtCanvasAWT"); + final AWTFocusAdapter newtCanvasAWTFA = new AWTFocusAdapter("NewtCanvasAWT"); newtCanvasAWT.addFocusListener(newtCanvasAWTFA); // Add the canvas to a frame, and make it all visible. @@ -132,12 +132,12 @@ public class TestParentingFocus01SwingAWTRobot extends UITestCase { + glWindow1.getTitle()); frame1.getContentPane().add(newtCanvasAWT, BorderLayout.CENTER); final Button button = new Button("Click me .."); - AWTFocusAdapter buttonFA = new AWTFocusAdapter("Button"); + final AWTFocusAdapter buttonFA = new AWTFocusAdapter("Button"); button.addFocusListener(buttonFA); - AWTKeyAdapter buttonKA = new AWTKeyAdapter("Button"); + final AWTKeyAdapter buttonKA = new AWTKeyAdapter("Button"); button.addKeyListener(buttonKA); eventCountAdapters.add(buttonKA); - AWTMouseAdapter buttonMA = new AWTMouseAdapter("Button"); + final AWTMouseAdapter buttonMA = new AWTMouseAdapter("Button"); button.addMouseListener(buttonMA); eventCountAdapters.add(buttonMA); @@ -161,7 +161,7 @@ public class TestParentingFocus01SwingAWTRobot extends UITestCase { Assert.assertTrue(0 < glWindow1.getTotalFPSFrames()); // Continuous animation .. - Animator animator = new Animator(glWindow1); + final Animator animator = new Animator(glWindow1); animator.start(); // Button Focus @@ -212,7 +212,7 @@ public class TestParentingFocus01SwingAWTRobot extends UITestCase { frame1.setVisible(false); frame1.dispose(); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -220,15 +220,15 @@ public class TestParentingFocus01SwingAWTRobot extends UITestCase { Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow1, false)); } - static int atoi(String a) { + static int atoi(final String a) { int i=0; try { i = Integer.parseInt(a); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } return i; } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i eventCountAdapters = new ArrayList(); + final ArrayList eventCountAdapters = new ArrayList(); - GLWindow glWindow1 = GLWindow.create(glCaps); + final GLWindow glWindow1 = GLWindow.create(glCaps); glWindow1.setTitle("testWindowParenting01CreateVisibleDestroy"); - GLEventListener demo1 = new GearsES2(); + final GLEventListener demo1 = new GearsES2(); glWindow1.addGLEventListener(demo1); - NEWTFocusAdapter glWindow1FA = new NEWTFocusAdapter("GLWindow1"); + final NEWTFocusAdapter glWindow1FA = new NEWTFocusAdapter("GLWindow1"); glWindow1.addWindowListener(glWindow1FA); - NEWTKeyAdapter glWindow1KA = new NEWTKeyAdapter("GLWindow1"); + final NEWTKeyAdapter glWindow1KA = new NEWTKeyAdapter("GLWindow1"); glWindow1.addKeyListener(glWindow1KA); eventCountAdapters.add(glWindow1KA); - NEWTMouseAdapter glWindow1MA = new NEWTMouseAdapter("GLWindow1"); + final NEWTMouseAdapter glWindow1MA = new NEWTMouseAdapter("GLWindow1"); glWindow1.addMouseListener(glWindow1MA); eventCountAdapters.add(glWindow1MA); - NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow1); - AWTFocusAdapter newtCanvasAWTFA = new AWTFocusAdapter("NewtCanvasAWT"); + final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow1); + final AWTFocusAdapter newtCanvasAWTFA = new AWTFocusAdapter("NewtCanvasAWT"); newtCanvasAWT.addFocusListener(newtCanvasAWTFA); - AWTKeyAdapter newtCanvasAWTKA = new AWTKeyAdapter("NewtCanvasAWT"); + final AWTKeyAdapter newtCanvasAWTKA = new AWTKeyAdapter("NewtCanvasAWT"); newtCanvasAWT.addKeyListener(newtCanvasAWTKA); eventCountAdapters.add(newtCanvasAWTKA); - AWTMouseAdapter newtCanvasAWTMA = new AWTMouseAdapter("NewtCanvasAWT"); + final AWTMouseAdapter newtCanvasAWTMA = new AWTMouseAdapter("NewtCanvasAWT"); newtCanvasAWT.addMouseListener(newtCanvasAWTMA); eventCountAdapters.add(newtCanvasAWTMA); - Button buttonNorthInner = new Button("north"); - AWTFocusAdapter buttonNorthInnerFA = new AWTFocusAdapter("ButtonNorthInner"); + final Button buttonNorthInner = new Button("north"); + final AWTFocusAdapter buttonNorthInnerFA = new AWTFocusAdapter("ButtonNorthInner"); buttonNorthInner.addFocusListener(buttonNorthInnerFA); - AWTKeyAdapter buttonNorthInnerKA = new AWTKeyAdapter("ButtonNorthInner"); + final AWTKeyAdapter buttonNorthInnerKA = new AWTKeyAdapter("ButtonNorthInner"); buttonNorthInner.addKeyListener(buttonNorthInnerKA); eventCountAdapters.add(buttonNorthInnerKA); - AWTMouseAdapter buttonNorthInnerMA = new AWTMouseAdapter("ButtonNorthInner"); + final AWTMouseAdapter buttonNorthInnerMA = new AWTMouseAdapter("ButtonNorthInner"); buttonNorthInner.addMouseListener(buttonNorthInnerMA); eventCountAdapters.add(buttonNorthInnerMA); final Container container1 = new Container(); @@ -142,13 +145,13 @@ public class TestParentingFocus02SwingAWTRobot extends UITestCase { container1.add(new Button("west"), BorderLayout.WEST); container1.add(newtCanvasAWT, BorderLayout.CENTER); - Button buttonNorthOuter = new Button("north"); - AWTFocusAdapter buttonNorthOuterFA = new AWTFocusAdapter("ButtonNorthOuter"); + final Button buttonNorthOuter = new Button("north"); + final AWTFocusAdapter buttonNorthOuterFA = new AWTFocusAdapter("ButtonNorthOuter"); buttonNorthOuter.addFocusListener(buttonNorthOuterFA); - AWTKeyAdapter buttonNorthOuterKA = new AWTKeyAdapter("ButtonNorthOuter"); + final AWTKeyAdapter buttonNorthOuterKA = new AWTKeyAdapter("ButtonNorthOuter"); buttonNorthOuter.addKeyListener(buttonNorthOuterKA); eventCountAdapters.add(buttonNorthOuterKA); - AWTMouseAdapter buttonNorthOuterMA = new AWTMouseAdapter("ButtonNorthOuter"); + final AWTMouseAdapter buttonNorthOuterMA = new AWTMouseAdapter("ButtonNorthOuter"); buttonNorthOuter.addMouseListener(buttonNorthOuterMA); eventCountAdapters.add(buttonNorthOuterMA); final JPanel jPanel1 = new JPanel(); @@ -161,7 +164,7 @@ public class TestParentingFocus02SwingAWTRobot extends UITestCase { final JFrame jFrame1 = new JFrame("Swing Parent JFrame"); // jFrame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - jFrame1.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); // equivalent to Frame, use windowClosing event! + jFrame1.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); // equivalent to Frame, use windowClosing event! jFrame1.setContentPane(jPanel1); jFrame1.setSize(width, height); javax.swing.SwingUtilities.invokeAndWait(new Runnable() { @@ -180,7 +183,7 @@ public class TestParentingFocus02SwingAWTRobot extends UITestCase { Assert.assertTrue(0 < glWindow1.getTotalFPSFrames()); // Continuous animation .. - Animator animator1 = new Animator(glWindow1); + final Animator animator1 = new Animator(glWindow1); animator1.start(); Thread.sleep(durationPerTest); // manual testing @@ -287,21 +290,21 @@ public class TestParentingFocus02SwingAWTRobot extends UITestCase { @Test public void testFocus02RobotFocus() throws AWTException, InterruptedException, InvocationTargetException { - Robot robot = new Robot(); + final Robot robot = new Robot(); robot.setAutoWaitForIdle(true); testFocus01ProgrFocusImpl(robot); } - static int atoi(String a) { + static int atoi(final String a) { int i=0; try { i = Integer.parseInt(a); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } return i; } @SuppressWarnings("unused") - public static void main(String args[]) + public static void main(final String args[]) throws IOException, AWTException, InterruptedException, InvocationTargetException { for(int i=0; i monitorModes = monitor.getSupportedModes(); @@ -93,21 +93,21 @@ public class ManualScreenMode03aNEWT extends UITestCase { monitorModes = MonitorModeUtil.filterByResolution(monitorModes, new Dimension(801, 601)); monitorModes = MonitorModeUtil.filterByRate(monitorModes, mmOrig.getRefreshRate()); monitorModes = MonitorModeUtil.getHighestAvailableBpp(monitorModes); - MonitorMode mm = monitorModes.get(0); + final MonitorMode mm = monitorModes.get(0); System.err.println("[0] set current: "+mm); monitor.setCurrentMode(mm); System.err.print("[0] post setting .. wait <"); try { Thread.sleep(waitTime); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { } System.err.println("done>"); System.exit(0); } - public static void main(String args[]) throws IOException { - ManualScreenMode03aNEWT t = new ManualScreenMode03aNEWT(); + public static void main(final String args[]) throws IOException { + final ManualScreenMode03aNEWT t = new ManualScreenMode03aNEWT(); t.run(); } } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00aNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00aNEWT.java index c00f02e7e..68a08b8de 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00aNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00aNEWT.java @@ -130,18 +130,18 @@ public class TestScreenMode00aNEWT extends UITestCase { @Test public void testScreenModeInfo01() throws InterruptedException { - Display dpy = NewtFactory.createDisplay(null); - Screen screen = NewtFactory.createScreen(dpy, screenIdx); + final Display dpy = NewtFactory.createDisplay(null); + final Screen screen = NewtFactory.createScreen(dpy, screenIdx); screen.addReference(); Assert.assertEquals(true,screen.isNativeValid()); Assert.assertEquals(true,screen.getDisplay().isNativeValid()); System.err.println("Screen: "+screen.toString()); - List allMonitorModes = screen.getMonitorModes(); + final List allMonitorModes = screen.getMonitorModes(); Assert.assertTrue(allMonitorModes.size()>0); { int i=0; MonitorMode mmPre = null; - for(Iterator iMode=allMonitorModes.iterator(); iMode.hasNext(); i++) { + for(final Iterator iMode=allMonitorModes.iterator(); iMode.hasNext(); i++) { final MonitorMode mm = iMode.next(); System.err.println(String.format("All-0[%03d]: %s", i, mm)); if( null != mmPre ) { @@ -154,7 +154,7 @@ public class TestScreenMode00aNEWT extends UITestCase { { int i=0; MonitorMode mmPre = null; - for(Iterator iMode=allMonitorModes.iterator(); iMode.hasNext(); i++) { + for(final Iterator iMode=allMonitorModes.iterator(); iMode.hasNext(); i++) { final MonitorMode mm = iMode.next(); System.err.println(String.format("All-1[%03d]: %s", i, mm)); if( null != mmPre ) { @@ -164,17 +164,17 @@ public class TestScreenMode00aNEWT extends UITestCase { } } - List monitors = screen.getMonitorDevices(); + final List monitors = screen.getMonitorDevices(); Assert.assertTrue(monitors.size()>0); int j=0; - for(Iterator iMonitor=monitors.iterator(); iMonitor.hasNext(); j++) { - MonitorDevice monitor = iMonitor.next(); + for(final Iterator iMonitor=monitors.iterator(); iMonitor.hasNext(); j++) { + final MonitorDevice monitor = iMonitor.next(); System.err.println(j+": "+monitor); - List modes = monitor.getSupportedModes(); + final List modes = monitor.getSupportedModes(); Assert.assertTrue(modes.size()>0); int i=0; MonitorMode mmPre = null; - for(Iterator iMode=modes.iterator(); iMode.hasNext(); i++) { + for(final Iterator iMode=modes.iterator(); iMode.hasNext(); i++) { final MonitorMode mm = iMode.next(); System.err.println(String.format("[%02d][%03d]: %s", j, i, mm)); if( null != mmPre ) { @@ -184,9 +184,9 @@ public class TestScreenMode00aNEWT extends UITestCase { } Assert.assertTrue(allMonitorModes.containsAll(modes)); - MonitorMode sm_o = monitor.getOriginalMode(); + final MonitorMode sm_o = monitor.getOriginalMode(); Assert.assertNotNull(sm_o); - MonitorMode sm_c = monitor.queryCurrentMode(); + final MonitorMode sm_c = monitor.queryCurrentMode(); System.err.println("[0] orig : "+sm_o); System.err.println("[0] current: "+sm_c); Assert.assertNotNull(sm_c); @@ -199,20 +199,20 @@ public class TestScreenMode00aNEWT extends UITestCase { Assert.assertEquals(false,screen.getDisplay().isNativeValid()); } - static int atoi(String a) { + static int atoi(final String a) { try { return Integer.parseInt(a); - } catch (Exception ex) { throw new RuntimeException(ex); } + } catch (final Exception ex) { throw new RuntimeException(ex); } } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i screenModes = screen.getMonitorModes(); + + final List screenModes = screen.getMonitorModes(); Assert.assertTrue(screenModes.size()>0); int i=0; - for(Iterator iter=screenModes.iterator(); iter.hasNext(); i++) { + for(final Iterator iter=screenModes.iterator(); iter.hasNext(); i++) { System.err.println(i+": "+iter.next()); } - MonitorDevice monitor = window.getMainMonitor(); - MonitorMode mm_o = monitor.getOriginalMode(); - - Assert.assertNotNull(mm_o); + final MonitorDevice monitor = window.getMainMonitor(); + final MonitorMode mm_o = monitor.getOriginalMode(); + + Assert.assertNotNull(mm_o); MonitorMode mm_c = monitor.queryCurrentMode(); Assert.assertNotNull(mm_c); System.err.println("orig: "+mm_o); System.err.println("curr: "+mm_c); - + for(i=0; i<50; i++) { mm_c = monitor.queryCurrentMode(); Assert.assertNotNull(mm_c); System.err.print("."+i); } System.err.println("!"); - + // screen.removeReference(); anim.stop(); window.destroy(); @@ -124,8 +124,8 @@ public class TestScreenMode00bNEWT extends UITestCase { Assert.assertEquals(false,display.isNativeValid()); } - public static void main(String args[]) throws IOException { - String tstname = TestScreenMode00bNEWT.class.getName(); + public static void main(final String args[]) throws IOException { + final String tstname = TestScreenMode00bNEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00cNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00cNEWT.java index 714e75695..6b353f8fc 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00cNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00cNEWT.java @@ -93,10 +93,10 @@ public class TestScreenMode00cNEWT extends UITestCase { Thread.sleep(waitTimeShort); } - static Window createWindow(Screen screen, GLCapabilities caps, String name, int x, int y, int width, int height) { + static Window createWindow(final Screen screen, final GLCapabilities caps, final String name, final int x, final int y, final int width, final int height) { Assert.assertNotNull(caps); - GLWindow window = GLWindow.create(screen, caps); + final GLWindow window = GLWindow.create(screen, caps); // Window window = NewtFactory.createWindow(screen, caps); window.setTitle(name); window.setPosition(x, y); @@ -107,7 +107,7 @@ public class TestScreenMode00cNEWT extends UITestCase { return window; } - static void destroyWindow(Window window) throws InterruptedException { + static void destroyWindow(final Window window) throws InterruptedException { if(null!=window) { window.destroy(); Assert.assertTrue(AWTRobotUtil.waitForRealized(window, false)); @@ -181,12 +181,12 @@ public class TestScreenMode00cNEWT extends UITestCase { // set mode { - MonitorMode mm = monitorModes.get(0); + final MonitorMode mm = monitorModes.get(0); System.err.println("[1] set current: "+mm); final boolean smOk = monitor.setCurrentMode(mm); - MonitorMode mmCachedCurrent = monitor.getCurrentMode(); - MonitorMode mmQueriedCurrent = monitor.queryCurrentMode(); - boolean mmCurrentEquals = mmQueriedCurrent.equals(mmCachedCurrent); + final MonitorMode mmCachedCurrent = monitor.getCurrentMode(); + final MonitorMode mmQueriedCurrent = monitor.queryCurrentMode(); + final boolean mmCurrentEquals = mmQueriedCurrent.equals(mmCachedCurrent); System.err.println("[1] changeOK : "+smOk); System.err.println("[1] has current cached : "+mmCachedCurrent); System.err.println("[1] has current queried : "+mmQueriedCurrent+", equal "+mmCurrentEquals); @@ -254,7 +254,7 @@ public class TestScreenMode00cNEWT extends UITestCase { Assert.assertEquals(false,screen.isNativeValid()); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { manualTest = true; for(int i=0; i allMonitorModes = screen.getMonitorModes(); + final List allMonitorModes = screen.getMonitorModes(); Assert.assertTrue(allMonitorModes.size()>0); if(allMonitorModes.size()==1) { // no support .. @@ -174,7 +174,7 @@ public class TestScreenMode01bNEWT extends UITestCase { return; } - MonitorDevice monitor = window0.getMainMonitor(); + final MonitorDevice monitor = window0.getMainMonitor(); System.err.println("Test.0: Window monitor: "+monitor); List monitorModes = monitor.getSupportedModes(); @@ -189,7 +189,7 @@ public class TestScreenMode01bNEWT extends UITestCase { MonitorMode mmCurrent = monitor.getCurrentMode(); Assert.assertNotNull(mmCurrent); - MonitorMode mmOrig = monitor.getOriginalMode(); + final MonitorMode mmOrig = monitor.getOriginalMode(); Assert.assertNotNull(mmOrig); System.err.println("[0] orig : "+mmOrig); System.err.println("[0] current: "+mmCurrent); @@ -214,7 +214,7 @@ public class TestScreenMode01bNEWT extends UITestCase { // set mode { - MonitorMode mm = monitorModes.get(0); + final MonitorMode mm = monitorModes.get(0); System.err.println("[0] set current: "+mm); final boolean smOk = monitor.setCurrentMode(mm); mmCurrent = monitor.getCurrentMode(); @@ -272,14 +272,14 @@ public class TestScreenMode01bNEWT extends UITestCase { Assert.assertEquals(true,screen.isNativeValid()); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i monitors = new ArrayList(); monitors.add(screen.getMonitorDevices().get(0)); // Q1 monitors.add(screen.getMonitorDevices().get(1)); // Q2 - RectangleImmutable monitorVp = screen.getMonitorDevices().get(0).getViewport(); + final RectangleImmutable monitorVp = screen.getMonitorDevices().get(0).getViewport(); testScreenFullscreenImpl(screen, monitorVp.getX()+50, monitorVp.getY()+50, true, monitors); } finally { screen.removeReference(); @@ -180,7 +180,7 @@ public class TestScreenMode01cNEWT extends UITestCase { System.err.println("Test Disabled (3): Monitor count < 2: "+screen); return; } - RectangleImmutable monitorVp = screen.getMonitorDevices().get(1).getViewport(); + final RectangleImmutable monitorVp = screen.getMonitorDevices().get(1).getViewport(); testScreenFullscreenImpl(screen, monitorVp.getX()-50, monitorVp.getY()+50, true, null); } finally { screen.removeReference(); @@ -200,7 +200,7 @@ public class TestScreenMode01cNEWT extends UITestCase { System.err.println("Test.0: Window bounds (pre): screenPos "+screenXPos+"/"+screenYPos+" [pixels], windowSize "+width+"x"+height+" [wu] within "+screen.getViewport()+" [pixels]"); - GLWindow window0 = createWindow(screen, caps, "win0", screenXPos, screenYPos, width, height); + final GLWindow window0 = createWindow(screen, caps, "win0", screenXPos, screenYPos, width, height); Assert.assertNotNull(window0); Rectangle window0WindowBounds = window0.getBounds(); DimensionImmutable window0SurfaceSize = new Dimension(window0.getSurfaceWidth(), window0.getSurfaceHeight()); @@ -211,7 +211,7 @@ public class TestScreenMode01cNEWT extends UITestCase { final Animator anim = new Animator(window0); anim.start(); - List allMonitorModes = screen.getMonitorModes(); + final List allMonitorModes = screen.getMonitorModes(); Assert.assertTrue(allMonitorModes.size()>0); MonitorDevice monitor = window0.getMainMonitor(); @@ -236,7 +236,7 @@ public class TestScreenMode01cNEWT extends UITestCase { if( null == monitorsUsed ) { monitorsUsed = window0.getScreen().getMonitorDevices(); } - Rectangle monitorsUsedViewport = new Rectangle(); + final Rectangle monitorsUsedViewport = new Rectangle(); MonitorDevice.unionOfViewports(null, monitorsUsedViewport, monitorsUsed); Assert.assertEquals(monitorsUsedViewport, window0WindowBounds); } @@ -262,14 +262,14 @@ public class TestScreenMode01cNEWT extends UITestCase { Assert.assertEquals(true,screen.isNativeValid()); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i - * MonitorMode change does not use highest resolution. + * MonitorMode change does not use highest resolution. *

      */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestScreenMode02aNEWT extends UITestCase { static GLProfile glp; static int width, height; - + static int waitTimeShort = 2000; // 2 sec static int waitTimeLong = 8000; // 8 sec @@ -78,52 +78,52 @@ public class TestScreenMode02aNEWT extends UITestCase { glp = GLProfile.getDefault(); } - static GLWindow createWindow(Screen screen, GLCapabilities caps, int width, int height, boolean onscreen, boolean undecorated) { + static GLWindow createWindow(final Screen screen, final GLCapabilities caps, final int width, final int height, final boolean onscreen, final boolean undecorated) { Assert.assertNotNull(caps); caps.setOnscreen(onscreen); - GLWindow window = GLWindow.create(screen, caps); + final GLWindow window = GLWindow.create(screen, caps); window.setSize(width, height); window.addGLEventListener(new GearsES2(1)); Assert.assertNotNull(window); return window; } - static void destroyWindow(Window window) throws InterruptedException { + static void destroyWindow(final Window window) throws InterruptedException { if(null!=window) { window.destroy(); Assert.assertTrue(AWTRobotUtil.waitForRealized(window, false)); } } - + @Test public void testScreenRotationChange01_PreWin() throws InterruptedException { testScreenRotationChangeImpl(true, true, false); } - + @Test public void testScreenRotationChange02_PreFull() throws InterruptedException { testScreenRotationChangeImpl(true, true, true); } - + @Test public void testScreenRotationChange11_PostWin() throws InterruptedException { testScreenRotationChangeImpl(true, false, false); } - + @Test public void testScreenRotationChange12_PostFull() throws InterruptedException { testScreenRotationChangeImpl(true, false, true); } - - void testScreenRotationChangeImpl(boolean changeMode, boolean preVis, boolean fullscreen) throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + + void testScreenRotationChangeImpl(final boolean changeMode, final boolean preVis, final boolean fullscreen) throws InterruptedException { + final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); - Display display = NewtFactory.createDisplay(null); // local display + final Display display = NewtFactory.createDisplay(null); // local display Assert.assertNotNull(display); - Screen screen = NewtFactory.createScreen(display, 0); // screen 0 + final Screen screen = NewtFactory.createScreen(display, 0); // screen 0 Assert.assertNotNull(screen); - GLWindow window = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */); + final GLWindow window = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */); Assert.assertNotNull(window); if( preVis ) { window.setVisible(true); @@ -136,9 +136,9 @@ public class TestScreenMode02aNEWT extends UITestCase { Assert.assertEquals(true,screen.isNativeValid()); } - Animator animator = new Animator(window); + final Animator animator = new Animator(window); animator.start(); - + final MonitorDevice monitor = window.getMainMonitor(); final MonitorMode mmOrig = monitor.getOriginalMode(); Assert.assertNotNull(mmOrig); @@ -154,13 +154,13 @@ public class TestScreenMode02aNEWT extends UITestCase { return; } Assert.assertTrue(monitorModes.size()>0); - + MonitorMode mmCurrent = monitor.getCurrentMode(); Assert.assertNotNull(mmCurrent); System.err.println("[0] orig : "+mmOrig); System.err.println("[0] current: "+mmCurrent); Assert.assertEquals(mmCurrent, mmOrig); - + monitorModes = MonitorModeUtil.filterByFlags(monitorModes, 0); // no interlace, double-scan etc Assert.assertNotNull(monitorModes); Assert.assertTrue(monitorModes.size()>0); @@ -181,10 +181,10 @@ public class TestScreenMode02aNEWT extends UITestCase { monitorModes = MonitorModeUtil.getHighestAvailableBpp(monitorModes); Assert.assertNotNull(monitorModes); Assert.assertTrue(monitorModes.size()>0); - + // set mode { - MonitorMode mm = monitorModes.get(0); + final MonitorMode mm = monitorModes.get(0); System.err.println("[0] set current: "+mm); final boolean smOk = monitor.setCurrentMode(mm); mmCurrent = monitor.getCurrentMode(); @@ -196,40 +196,40 @@ public class TestScreenMode02aNEWT extends UITestCase { Assert.assertTrue(smOk); } } - + if( !preVis ) { if( fullscreen ) { window.setFullscreen(true); } window.setVisible(true); } - + Thread.sleep(waitTimeLong); - + if( !preVis && fullscreen ) { window.setFullscreen(false); } - + if(changeMode) { Thread.sleep(waitTimeShort); - + // manual restore! { System.err.println("[1] set orig: "+mmOrig); final boolean smOk = monitor.setCurrentMode(mmOrig); - MonitorMode mmCurrent = monitor.getCurrentMode(); + final MonitorMode mmCurrent = monitor.getCurrentMode(); System.err.println("[1] has orig?: "+mmCurrent+", changeOK "+smOk); Assert.assertFalse(monitor.isModeChangedByUs()); Assert.assertEquals(mmOrig, mmCurrent); Assert.assertTrue(smOk); - } + } Thread.sleep(waitTimeShort); } - + if( preVis && fullscreen ) { window.setFullscreen(false); } - + Assert.assertEquals(true,display.isNativeValid()); Assert.assertEquals(true,screen.isNativeValid()); Assert.assertEquals(true,window.isNativeValid()); @@ -237,7 +237,7 @@ public class TestScreenMode02aNEWT extends UITestCase { animator.stop(); destroyWindow(window); - + Assert.assertEquals(false,window.isVisible()); Assert.assertEquals(false,window.isNativeValid()); Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false)); @@ -245,8 +245,8 @@ public class TestScreenMode02aNEWT extends UITestCase { Assert.assertEquals(false,display.isNativeValid()); } - public static void main(String args[]) throws IOException { - String tstname = TestScreenMode02aNEWT.class.getName(); + public static void main(final String args[]) throws IOException { + final String tstname = TestScreenMode02aNEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02bNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02bNEWT.java index 2da2abd32..47fd53e05 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02bNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02bNEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.newt.mm; import java.io.IOException; @@ -59,7 +59,7 @@ import javax.media.nativewindow.util.Dimension; /** * Tests MonitorMode change w/ changed rotation and fullscreen. *

      - * MonitorMode change uses highest resolution. + * MonitorMode change uses highest resolution. *

      *

      * Bug 734 could not be reproduced, however on tests systems @@ -69,13 +69,13 @@ import javax.media.nativewindow.util.Dimension; *

      * Documents remedy B) for NV RANDR/GL bug *

      - * + * * @see TestScreenMode01NEWT#cleanupGL() */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestScreenMode02bNEWT extends UITestCase { static GLProfile glp; - + static int waitTimeShort = 2000; // 2 sec static int waitTimeLong = 8000; // 8 sec @@ -89,11 +89,11 @@ public class TestScreenMode02bNEWT extends UITestCase { public static void releaseClass() throws InterruptedException { Thread.sleep(waitTimeShort); } - - static GLWindow createWindow(Screen screen, GLCapabilities caps, String name, int x, int y, int width, int height) { + + static GLWindow createWindow(final Screen screen, final GLCapabilities caps, final String name, final int x, final int y, final int width, final int height) { Assert.assertNotNull(caps); - GLWindow window = GLWindow.create(screen, caps); + final GLWindow window = GLWindow.create(screen, caps); // Window window = NewtFactory.createWindow(screen, caps); window.setTitle(name); window.setPosition(x, y); @@ -103,43 +103,43 @@ public class TestScreenMode02bNEWT extends UITestCase { return window; } - static void destroyWindow(Window window) throws InterruptedException { + static void destroyWindow(final Window window) throws InterruptedException { if(null!=window) { window.destroy(); Assert.assertTrue(AWTRobotUtil.waitForRealized(window, false)); } } - + @Test public void testScreenModeChange01_PreFull() throws InterruptedException { testScreenModeChangeImpl(true); } - + @Test public void testScreenModeChange02_PostFull() throws InterruptedException { testScreenModeChangeImpl(false); } - - void testScreenModeChangeImpl(boolean preVis) throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + + void testScreenModeChangeImpl(final boolean preVis) throws InterruptedException { + final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); - Display display = NewtFactory.createDisplay(null); // local display + final Display display = NewtFactory.createDisplay(null); // local display Assert.assertNotNull(display); - Screen screen = NewtFactory.createScreen(display, 0); // screen 0 + final Screen screen = NewtFactory.createScreen(display, 0); // screen 0 Assert.assertNotNull(screen); screen.createNative(); // instantiate for resolution query and keep it alive ! final int swidth = screen.getWidth(); final int sheight = screen.getHeight(); - GLWindow window = createWindow(screen, caps, "win0", 0, 0, 640, 480); + final GLWindow window = createWindow(screen, caps, "win0", 0, 0, 640, 480); if( preVis ) { window.setVisible(true); window.setFullscreen(true); } window.setUndecorated(true); - Assert.assertNotNull(window); + Assert.assertNotNull(window); - List allMonitorModes = screen.getMonitorModes(); + final List allMonitorModes = screen.getMonitorModes(); Assert.assertTrue(allMonitorModes.size()>0); if(allMonitorModes.size()==1) { // no support .. @@ -148,7 +148,7 @@ public class TestScreenMode02bNEWT extends UITestCase { return; } - MonitorDevice monitor = window.getMainMonitor(); + final MonitorDevice monitor = window.getMainMonitor(); List monitorModes = monitor.getSupportedModes(); Assert.assertTrue(monitorModes.size()>0); if(monitorModes.size()==1) { @@ -158,10 +158,10 @@ public class TestScreenMode02bNEWT extends UITestCase { return; } Assert.assertTrue(allMonitorModes.containsAll(monitorModes)); - - Animator animator = new Animator(window); + + final Animator animator = new Animator(window); animator.start(); - + MonitorMode mmCurrent = monitor.queryCurrentMode(); Assert.assertNotNull(mmCurrent); final MonitorMode mmOrig = monitor.getOriginalMode(); @@ -169,7 +169,7 @@ public class TestScreenMode02bNEWT extends UITestCase { System.err.println("[0] orig : "+mmOrig); System.err.println("[0] current: "+mmCurrent); Assert.assertEquals(mmCurrent, mmOrig); - + monitorModes = MonitorModeUtil.filterByFlags(monitorModes, 0); // no interlace, double-scan etc Assert.assertNotNull(monitorModes); Assert.assertTrue(monitorModes.size()>0); @@ -185,16 +185,16 @@ public class TestScreenMode02bNEWT extends UITestCase { Assert.assertNotNull(monitorModes); Assert.assertTrue(monitorModes.size()>0); monitorModes = MonitorModeUtil.filterByRate(monitorModes, mmOrig.getRefreshRate()); - Assert.assertNotNull(monitorModes); + Assert.assertNotNull(monitorModes); Assert.assertTrue(monitorModes.size()>0); - + monitorModes = MonitorModeUtil.getHighestAvailableBpp(monitorModes); Assert.assertNotNull(monitorModes); Assert.assertTrue(monitorModes.size()>0); // set mode { - MonitorMode mm = monitorModes.get(0); // highest resolution .. + final MonitorMode mm = monitorModes.get(0); // highest resolution .. System.err.println("[0] set current: "+mm); final boolean smOk = monitor.setCurrentMode(mm); mmCurrent = monitor.getCurrentMode(); @@ -216,13 +216,13 @@ public class TestScreenMode02bNEWT extends UITestCase { window.setFullscreen(true); window.setVisible(true); } - + Thread.sleep(waitTimeLong); - + if( !preVis ) { window.setFullscreen(false); } - + // manual restore! { System.err.println("[1] set orig: "+mmOrig); @@ -232,21 +232,21 @@ public class TestScreenMode02bNEWT extends UITestCase { Assert.assertFalse(monitor.isModeChangedByUs()); Assert.assertEquals(mmOrig, mmCurrent); Assert.assertTrue(smOk); - } + } Thread.sleep(waitTimeShort); if( preVis ) { window.setFullscreen(false); } - + Assert.assertEquals(true,display.isNativeValid()); Assert.assertEquals(true,screen.isNativeValid()); Assert.assertEquals(true,window.isNativeValid()); Assert.assertEquals(true,window.isVisible()); - animator.stop(); + animator.stop(); destroyWindow(window); - + Assert.assertEquals(false,window.isVisible()); Assert.assertEquals(false,window.isNativeValid()); Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false)); @@ -254,8 +254,8 @@ public class TestScreenMode02bNEWT extends UITestCase { Assert.assertEquals(false,display.isNativeValid()); } - public static void main(String args[]) throws IOException { - String tstname = TestScreenMode02bNEWT.class.getName(); + public static void main(final String args[]) throws IOException { + final String tstname = TestScreenMode02bNEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/GLRunnableDummy.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/GLRunnableDummy.java index 1ca74774b..18f2b9b4a 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/GLRunnableDummy.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/GLRunnableDummy.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.newt.parenting; import javax.media.opengl.*; @@ -36,8 +36,8 @@ public class GLRunnableDummy implements GLRunnable { float b=0.0f; float d=0.1f; - public boolean run(GLAutoDrawable drawable) { - GL2ES1 gl = drawable.getGL().getGL2ES1(); + public boolean run(final GLAutoDrawable drawable) { + final GL2ES1 gl = drawable.getGL().getGL2ES1(); gl.glClearColor(r, g, b, 1f); r+=d; if(r>1f) { diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/KeyAction.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/KeyAction.java index 0ae94d7af..64867b054 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/KeyAction.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/KeyAction.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.newt.parenting; @@ -34,14 +34,14 @@ import com.jogamp.newt.event.*; class KeyAction extends KeyAdapter { NEWTEventFiFo eventFifo; - public KeyAction(NEWTEventFiFo eventFifo) { - this.eventFifo = eventFifo; + public KeyAction(final NEWTEventFiFo eventFifo) { + this.eventFifo = eventFifo; } - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { if( !e.isPrintableKey() || e.isAutoRepeat() ) { return; - } + } eventFifo.put(e); } } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java index 005579352..75037b60c 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java @@ -50,20 +50,20 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter { PointerIcon[] pointerIcons = null; int pointerIconIdx = 0; - public NewtAWTReparentingKeyAdapter(Frame frame, NewtCanvasAWT newtCanvasAWT, GLWindow glWindow, QuitAdapter quitAdapter) { + public NewtAWTReparentingKeyAdapter(final Frame frame, final NewtCanvasAWT newtCanvasAWT, final GLWindow glWindow, final QuitAdapter quitAdapter) { this.frame = frame; this.newtCanvasAWT = newtCanvasAWT; this.glWindow = glWindow; this.quitAdapter = quitAdapter; } - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { if( !e.isPrintableKey() || e.isAutoRepeat() ) { return; } if( e.getKeySymbol() == KeyEvent.VK_L ) { - javax.media.nativewindow.util.Point p0 = newtCanvasAWT.getNativeWindow().getLocationOnScreen(null); - javax.media.nativewindow.util.Point p1 = glWindow.getLocationOnScreen(null); + final javax.media.nativewindow.util.Point p0 = newtCanvasAWT.getNativeWindow().getLocationOnScreen(null); + final javax.media.nativewindow.util.Point p1 = glWindow.getLocationOnScreen(null); System.err.println("NewtCanvasAWT position: "+p0+", "+p1); } else if( e.getKeySymbol() == KeyEvent.VK_D ) { glWindow.setUndecorated(!glWindow.isUndecorated()); @@ -156,7 +156,7 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter { try { _pointerIcon = disp.createPointerIcon(res, 8, 8); System.err.println("Create PointerIcon #01: "+_pointerIcon); - } catch (Exception ex) { + } catch (final Exception ex) { ex.printStackTrace(); } pointerIcons[0] = _pointerIcon; @@ -167,7 +167,7 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter { try { _pointerIcon = disp.createPointerIcon(res, 0, 0); System.err.println("Create PointerIcon #02: "+_pointerIcon); - } catch (Exception ex) { + } catch (final Exception ex) { ex.printStackTrace(); } pointerIcons[1] = _pointerIcon; @@ -181,7 +181,7 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter { System.err.println("Create PointerIcon #03: "+image); _pointerIcon = disp.createPointerIcon(image, 32, 0); System.err.println("Create PointerIcon #03: "+_pointerIcon); - } catch (Exception ex) { + } catch (final Exception ex) { ex.printStackTrace(); } pointerIcons[2] = _pointerIcon; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java index 714c397f3..d6658d809 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java @@ -67,7 +67,7 @@ public class TestParenting01NEWT extends UITestCase { Display display = null; Screen screen = null; - GLWindow glWindow1 = GLWindow.create(glCaps); + final GLWindow glWindow1 = GLWindow.create(glCaps); Assert.assertNotNull(glWindow1); Assert.assertEquals(false, glWindow1.isVisible()); Assert.assertEquals(false, glWindow1.isNativeValid()); @@ -84,11 +84,11 @@ public class TestParenting01NEWT extends UITestCase { glWindow1.setTitle("test01CreateVisibleDestroy"); glWindow1.setSize(640, 480); - GLEventListener demo1 = new RedSquareES2(); + final GLEventListener demo1 = new RedSquareES2(); setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); - GLWindow glWindow2 = GLWindow.create(glWindow1, glCaps); + final GLWindow glWindow2 = GLWindow.create(glWindow1, glCaps); Assert.assertNotNull(glWindow2); Assert.assertEquals(false, glWindow2.isVisible()); Assert.assertEquals(false, glWindow2.isNativeValid()); @@ -96,7 +96,7 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertSame(screen,glWindow2.getScreen()); Assert.assertSame(display,glWindow2.getScreen().getDisplay()); glWindow2.setSize(320, 240); - GLEventListener demo2 = new GearsES2(); + final GLEventListener demo2 = new GearsES2(); setDemoFields(demo2, glWindow2, false); glWindow2.addGLEventListener(demo2); @@ -150,13 +150,13 @@ public class TestParenting01NEWT extends UITestCase { glWindow1.resetFPSCounter(); glWindow2.resetFPSCounter(); - Animator animator1 = new Animator(glWindow1); + final Animator animator1 = new Animator(glWindow1); animator1.setUpdateFPSFrames(1, null); animator1.start(); Assert.assertEquals(true, animator1.isAnimating()); Assert.assertEquals(false, animator1.isPaused()); Assert.assertNotNull(animator1.getThread()); - Animator animator2 = new Animator(glWindow2); + final Animator animator2 = new Animator(glWindow2); animator2.setUpdateFPSFrames(1, null); animator2.start(); Assert.assertEquals(true, animator2.isAnimating()); @@ -305,10 +305,10 @@ public class TestParenting01NEWT extends UITestCase { Display display1 = null; Screen screen1 = null; - GLWindow glWindow1 = GLWindow.create(glCaps); + final GLWindow glWindow1 = GLWindow.create(glCaps); glWindow1.setTitle("test02ReparentTop2Win"); glWindow1.setSize(640, 480); - GLEventListener demo1 = new RedSquareES2(); + final GLEventListener demo1 = new RedSquareES2(); setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); screen1 = glWindow1.getScreen(); @@ -322,9 +322,9 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(false,screen1.isNativeValid()); Assert.assertEquals(0,Display.getActiveDisplayNumber()); - GLWindow glWindow2 = GLWindow.create(glCaps); + final GLWindow glWindow2 = GLWindow.create(glCaps); glWindow2.setSize(320, 240); - GLEventListener demo2 = new GearsES2(); + final GLEventListener demo2 = new GearsES2(); setDemoFields(demo2, glWindow2, false); glWindow2.addGLEventListener(demo2); Assert.assertSame(screen1, glWindow2.getScreen()); @@ -365,10 +365,10 @@ public class TestParenting01NEWT extends UITestCase { System.err.println("Frames for setVisible(true) B1: "+glWindow2.getTotalFPSFrames()); Assert.assertTrue(0 < glWindow1.getTotalFPSFrames()); - Animator animator1 = new Animator(glWindow1); + final Animator animator1 = new Animator(glWindow1); animator1.setUpdateFPSFrames(1, null); animator1.start(); - Animator animator2 = new Animator(glWindow2); + final Animator animator2 = new Animator(glWindow2); animator2.setUpdateFPSFrames(1, null); animator2.start(); @@ -540,12 +540,12 @@ public class TestParenting01NEWT extends UITestCase { Display display2 = null; Screen screen2 = null; - GLWindow glWindow1 = GLWindow.create(glCaps); + final GLWindow glWindow1 = GLWindow.create(glCaps); screen1 = glWindow1.getScreen(); display1 = screen1.getDisplay(); glWindow1.setTitle("test03ReparentWin2Top"); glWindow1.setSize(640, 480); - GLEventListener demo1 = new RedSquareES2(); + final GLEventListener demo1 = new RedSquareES2(); setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); @@ -557,11 +557,11 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(false,screen1.isNativeValid()); Assert.assertEquals(0,Display.getActiveDisplayNumber()); - GLWindow glWindow2 = GLWindow.create(glWindow1, glCaps); + final GLWindow glWindow2 = GLWindow.create(glWindow1, glCaps); screen2 = glWindow2.getScreen(); display2 = screen2.getDisplay(); glWindow2.setSize(320, 240); - GLEventListener demo2 = new GearsES2(); + final GLEventListener demo2 = new GearsES2(); setDemoFields(demo2, glWindow2, false); glWindow2.addGLEventListener(demo2); @@ -593,10 +593,10 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertSame(screen1,glWindow2.getScreen()); Assert.assertEquals(1,Display.getActiveDisplayNumber()); - Animator animator1 = new Animator(glWindow1); + final Animator animator1 = new Animator(glWindow1); animator1.setUpdateFPSFrames(1, null); animator1.start(); - Animator animator2 = new Animator(glWindow2); + final Animator animator2 = new Animator(glWindow2); animator2.setUpdateFPSFrames(1, null); animator2.start(); @@ -734,7 +734,7 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(0,Display.getActiveDisplayNumber()); } - public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) { + public static void setDemoFields(final GLEventListener demo, final GLWindow glWindow, final boolean debug) { Assert.assertNotNull(demo); Assert.assertNotNull(glWindow); if(debug) { @@ -746,15 +746,15 @@ public class TestParenting01NEWT extends UITestCase { } } - static int atoi(String a) { + static int atoi(final String a) { int i=0; try { i = Integer.parseInt(a); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } return i; } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { boolean asMain = false; for(int i=0; i XAWT related) - */ + */ SwingUtilities.invokeAndWait(new Runnable() { public void run() { System.err.println("Demos: 2 - !visible"); @@ -401,18 +402,18 @@ public class TestParenting01cSwingAWT extends UITestCase { Assert.assertEquals(true, glWindow1.isNativeValid()); } // else OK to be destroyed - due to offscreen/onscreen transition - System.err.println("Demos: 6 - X GLWindow"); + System.err.println("Demos: 6 - X GLWindow"); glWindow1.destroy(); Assert.assertEquals(false, glWindow1.isNativeValid()); - - System.err.println("Demos: 7 - X DisturbanceThread"); - disturbanceAction.stopAndWaitUntilDone(); + + System.err.println("Demos: 7 - X DisturbanceThread"); + disturbanceAction.stopAndWaitUntilDone(); } - public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) { + public static void setDemoFields(final GLEventListener demo, final GLWindow glWindow, final boolean debug) { Assert.assertNotNull(demo); Assert.assertNotNull(glWindow); - Window window = glWindow.getDelegatedWindow(); + final Window window = glWindow.getDelegatedWindow(); if(debug) { MiscUtils.setFieldIfExists(demo, "glDebug", true); MiscUtils.setFieldIfExists(demo, "glTrace", true); @@ -422,15 +423,15 @@ public class TestParenting01cSwingAWT extends UITestCase { } } - static int atoi(String a) { + static int atoi(final String a) { int i=0; try { i = Integer.parseInt(a); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } return i; } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i0 && !shouldQuit) { @@ -167,11 +167,11 @@ public class TestParenting02NEWT extends UITestCase { Thread.sleep(step); while( null != ( event = eventFifo.get() ) ) { - Window source = (Window) event.getSource(); + final Window source = (Window) event.getSource(); if(WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY == event.getEventType()) { shouldQuit = true; } else if(event instanceof KeyEvent) { - KeyEvent keyEvent = (KeyEvent) event; + final KeyEvent keyEvent = (KeyEvent) event; switch(keyEvent.getKeyChar()) { case 'q': shouldQuit = true; @@ -187,7 +187,7 @@ public class TestParenting02NEWT extends UITestCase { destroyWindow(display, screen, window1, glWindow1); } - public static void setDemoFields(GLEventListener demo, Window window, GLWindow glWindow, boolean debug) { + public static void setDemoFields(final GLEventListener demo, final Window window, final GLWindow glWindow, final boolean debug) { Assert.assertNotNull(demo); Assert.assertNotNull(window); if(debug) { @@ -199,21 +199,21 @@ public class TestParenting02NEWT extends UITestCase { } } - static int atoi(String a) { + static int atoi(final String a) { int i=0; try { i = Integer.parseInt(a); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } return i; } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i 2 if(detachFirst) { canvas1.setNEWTChild(null); - canvas2.setNEWTChild(null); + canvas2.setNEWTChild(null); } else { canvas2.setNEWTChild(null); // free g2 of w2 } @@ -175,7 +175,7 @@ public class TestParenting04AWT extends UITestCase { // 2 -> 1 if(detachFirst) { canvas1.setNEWTChild(null); - canvas2.setNEWTChild(null); + canvas2.setNEWTChild(null); } else { canvas2.setNEWTChild(null); } @@ -199,13 +199,13 @@ public class TestParenting04AWT extends UITestCase { glWindow1.destroy(); glWindow2.destroy(); Assert.assertEquals(false, glWindow1.isNativeValid()); - Assert.assertEquals(false, glWindow2.isNativeValid()); + Assert.assertEquals(false, glWindow2.isNativeValid()); } - public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) { + public static void setDemoFields(final GLEventListener demo, final GLWindow glWindow, final boolean debug) { Assert.assertNotNull(demo); Assert.assertNotNull(glWindow); - Window window = glWindow.getDelegatedWindow(); + final Window window = glWindow.getDelegatedWindow(); if(debug) { MiscUtils.setFieldIfExists(demo, "glDebug", true); MiscUtils.setFieldIfExists(demo, "glTrace", true); @@ -215,21 +215,21 @@ public class TestParenting04AWT extends UITestCase { } } - static int atoi(String a) { + static int atoi(final String a) { int i=0; try { i = Integer.parseInt(a); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } return i; } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i 2 if(detachFirst) { canvas1.setNEWTChild(null); - canvas2.setNEWTChild(null); + canvas2.setNEWTChild(null); } else { canvas2.setNEWTChild(null); // free g2 of w2 } @@ -212,7 +212,7 @@ public class TestParenting04SWT extends UITestCase { // 2 -> 1 if(detachFirst) { canvas1.setNEWTChild(null); - canvas2.setNEWTChild(null); + canvas2.setNEWTChild(null); } else { canvas2.setNEWTChild(null); } @@ -226,13 +226,13 @@ public class TestParenting04SWT extends UITestCase { canvas1.dispose(); canvas2.dispose(); Assert.assertEquals(false, glWindow1.isNativeValid()); - Assert.assertEquals(false, glWindow2.isNativeValid()); + Assert.assertEquals(false, glWindow2.isNativeValid()); } - public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) { + public static void setDemoFields(final GLEventListener demo, final GLWindow glWindow, final boolean debug) { Assert.assertNotNull(demo); Assert.assertNotNull(glWindow); - Window window = glWindow.getDelegatedWindow(); + final Window window = glWindow.getDelegatedWindow(); if(debug) { MiscUtils.setFieldIfExists(demo, "glDebug", true); MiscUtils.setFieldIfExists(demo, "glTrace", true); @@ -242,21 +242,21 @@ public class TestParenting04SWT extends UITestCase { } } - static int atoi(String a) { + static int atoi(final String a) { int i=0; try { i = Integer.parseInt(a); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } return i; } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i[] { GraphicsConfiguration.class }, - new Object[] { config } , + "com.sun.awt.AWTUtilities", "isTranslucencyCapable", + new Class[] { GraphicsConfiguration.class }, + new Object[] { config } , GraphicsConfiguration.class.getClassLoader())).booleanValue(); System.err.println("com.sun.awt.AWTUtilities.isTranslucencyCapable(config) passed: "+capable2); - } catch (RuntimeException re) { + } catch (final RuntimeException re) { System.err.println("com.sun.awt.AWTUtilities.isTranslucencyCapable(config) failed: "+re.getMessage()); } System.err.println(i+":"+j+" "+config+", "+tcm+", capable "+capable1+"/"+capable2); @@ -117,7 +117,7 @@ public class TestTranslucentParentingAWT extends UITestCase { frame.setTitle("AWT Parent Frame (opaque: "+(null==gc)+")"); return frame; } - + public void testWindowParenting1AWTOneNewtChild() throws InterruptedException, InvocationTargetException { final Frame frame1 = getTranslucentFrame(); final GLWindow glWindow1 = GLWindow.create(glCaps); @@ -126,13 +126,13 @@ public class TestTranslucentParentingAWT extends UITestCase { final NewtCanvasAWT newtCanvasAWT1 = new NewtCanvasAWT(frame1.getGraphicsConfiguration(), glWindow1); newtCanvasAWT1.setPreferredSize(size); - GLEventListener demo1 = new GearsES2(1); + final GLEventListener demo1 = new GearsES2(1); setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); - GLAnimatorControl animator1 = new Animator(glWindow1); + final GLAnimatorControl animator1 = new Animator(glWindow1); animator1.start(); - Container cont1 = new Container(); + final Container cont1 = new Container(); cont1.setLayout(new BorderLayout()); cont1.add(newtCanvasAWT1, BorderLayout.CENTER); cont1.setVisible(true); @@ -167,10 +167,10 @@ public class TestTranslucentParentingAWT extends UITestCase { glWindow1.destroy(); } - public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) { + public static void setDemoFields(final GLEventListener demo, final GLWindow glWindow, final boolean debug) { Assert.assertNotNull(demo); Assert.assertNotNull(glWindow); - Window window = glWindow.getDelegatedWindow(); + final Window window = glWindow.getDelegatedWindow(); if(debug) { MiscUtils.setFieldIfExists(demo, "glDebug", true); MiscUtils.setFieldIfExists(demo, "glTrace", true); @@ -180,7 +180,7 @@ public class TestTranslucentParentingAWT extends UITestCase { } } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i0; } - + public void reset() { focusCount = 0; wasTemporary = false; @@ -64,7 +64,7 @@ public class AWTFocusAdapter implements FocusEventCountAdapter, FocusListener { } /* @Override */ - public void focusGained(FocusEvent e) { + public void focusGained(final FocusEvent e) { if(focusCount<0) { focusCount=0; } focusCount++; wasTemporary = e.isTemporary(); @@ -74,7 +74,7 @@ public class AWTFocusAdapter implements FocusEventCountAdapter, FocusListener { } /* @Override */ - public void focusLost(FocusEvent e) { + public void focusLost(final FocusEvent e) { if(focusCount>0) { focusCount=0; } focusCount--; wasTemporary = e.isTemporary(); @@ -82,6 +82,6 @@ public class AWTFocusAdapter implements FocusEventCountAdapter, FocusListener { System.err.println("FOCUS AWT LOST "+(wasTemporary?"TEMP":"PERM")+" [fc "+focusCount+"]: "+prefix+", "+e); } } - - public String toString() { return prefix+"[focusCount "+focusCount +", temp "+wasTemporary+"]"; } + + public String toString() { return prefix+"[focusCount "+focusCount +", temp "+wasTemporary+"]"; } } diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTKeyAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/AWTKeyAdapter.java index 9461af5c0..84c19612b 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/AWTKeyAdapter.java +++ b/src/test/com/jogamp/opengl/test/junit/util/AWTKeyAdapter.java @@ -42,12 +42,12 @@ public class AWTKeyAdapter extends java.awt.event.KeyAdapter implements KeyEvent List queue = new ArrayList(); boolean verbose = true; - public AWTKeyAdapter(String prefix) { + public AWTKeyAdapter(final String prefix) { this.prefix = prefix; reset(); } - public synchronized void setVerbose(boolean v) { verbose = v; } + public synchronized void setVerbose(final boolean v) { verbose = v; } public synchronized boolean isPressed() { return pressed; @@ -61,11 +61,11 @@ public class AWTKeyAdapter extends java.awt.event.KeyAdapter implements KeyEvent return consumed; } - public synchronized int getKeyPressedCount(boolean autoRepeatOnly) { + public synchronized int getKeyPressedCount(final boolean autoRepeatOnly) { return keyPressed; } - public synchronized int getKeyReleasedCount(boolean autoRepeatOnly) { + public synchronized int getKeyReleasedCount(final boolean autoRepeatOnly) { return keyReleased; } @@ -85,7 +85,7 @@ public class AWTKeyAdapter extends java.awt.event.KeyAdapter implements KeyEvent queue.clear(); } - public synchronized void keyPressed(KeyEvent e) { + public synchronized void keyPressed(final KeyEvent e) { pressed = true; keyPressed++; queue.add(e); @@ -94,7 +94,7 @@ public class AWTKeyAdapter extends java.awt.event.KeyAdapter implements KeyEvent } } - public synchronized void keyReleased(KeyEvent e) { + public synchronized void keyReleased(final KeyEvent e) { pressed = false; keyReleased++; if(e.isConsumed()) { diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTMouseAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/AWTMouseAdapter.java index c1bec79f5..2a4f7a71f 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/AWTMouseAdapter.java +++ b/src/test/com/jogamp/opengl/test/junit/util/AWTMouseAdapter.java @@ -41,12 +41,12 @@ public class AWTMouseAdapter extends java.awt.event.MouseAdapter implements Inpu List queue = new ArrayList(); boolean verbose = true; - public AWTMouseAdapter(String prefix) { + public AWTMouseAdapter(final String prefix) { this.prefix = prefix; reset(); } - public synchronized void setVerbose(boolean v) { verbose = v; } + public synchronized void setVerbose(final boolean v) { verbose = v; } public synchronized boolean isPressed() { return pressed; @@ -75,7 +75,7 @@ public class AWTMouseAdapter extends java.awt.event.MouseAdapter implements Inpu queue.clear(); } - public synchronized void mousePressed(MouseEvent e) { + public synchronized void mousePressed(final MouseEvent e) { pressed = true; queue.add(e); if( verbose ) { @@ -83,7 +83,7 @@ public class AWTMouseAdapter extends java.awt.event.MouseAdapter implements Inpu } } - public synchronized void mouseReleased(MouseEvent e) { + public synchronized void mouseReleased(final MouseEvent e) { pressed = false; queue.add(e); if( verbose ) { @@ -91,7 +91,7 @@ public class AWTMouseAdapter extends java.awt.event.MouseAdapter implements Inpu } } - public synchronized void mouseClicked(java.awt.event.MouseEvent e) { + public synchronized void mouseClicked(final java.awt.event.MouseEvent e) { mouseClicked+=e.getClickCount(); if(e.isConsumed()) { consumed++; diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java index aa9611c6f..318ba17f1 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java +++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java @@ -61,7 +61,7 @@ public class AWTRobotUtil { static class OurUncaughtExceptionHandler implements UncaughtExceptionHandler { @Override - public void uncaughtException(Thread t, Throwable e) { + public void uncaughtException(final Thread t, final Throwable e) { System.err.println("*** AWTRobotUtil: UncaughtException (this Thread "+Thread.currentThread().getName()+") : Thread <"+t.getName()+">, "+e.getClass().getName()+": "+e.getMessage()); e.printStackTrace(); } @@ -83,7 +83,7 @@ public class AWTRobotUtil { for (int wait=0; waitvisible within TIME_OUT */ - public static boolean waitForVisible(Object obj, boolean visible) throws InterruptedException { + public static boolean waitForVisible(final Object obj, final boolean visible) throws InterruptedException { int wait; if(obj instanceof com.jogamp.newt.Window) { - com.jogamp.newt.Window win = (com.jogamp.newt.Window) obj; + final com.jogamp.newt.Window win = (com.jogamp.newt.Window) obj; for (wait=0; wait drawable.setRealized(true); if( (t1-t0) < TIME_OUT && comp instanceof GLAutoDrawable) { - GLAutoDrawable glad = (GLAutoDrawable) comp; + final GLAutoDrawable glad = (GLAutoDrawable) comp; t0 = System.currentTimeMillis(); while( (t1-t0) < TIME_OUT && realized != glad.isRealized() ) { if( null != waitAction ) { @@ -756,7 +756,7 @@ public class AWTRobotUtil { } } } else if(obj instanceof GLAutoDrawable) { - GLAutoDrawable glad = (GLAutoDrawable) obj; + final GLAutoDrawable glad = (GLAutoDrawable) obj; while( (t1-t0) < TIME_OUT && realized != glad.isRealized() ) { if( null != waitAction ) { waitAction.run(); @@ -775,7 +775,7 @@ public class AWTRobotUtil { * * @return True if the GLContext becomes created or not within TIME_OUT */ - public static boolean waitForContextCreated(GLAutoDrawable autoDrawable, boolean created) throws InterruptedException { + public static boolean waitForContextCreated(final GLAutoDrawable autoDrawable, final boolean created) throws InterruptedException { if( null == autoDrawable ) { return !created; } @@ -808,18 +808,18 @@ public class AWTRobotUtil { * @return True if the Window is closing and closed (if willClose is true), each within TIME_OUT * @throws InterruptedException */ - public static boolean closeWindow(Object obj, boolean willClose, WindowClosingListener closingListener) throws InterruptedException { + public static boolean closeWindow(final Object obj, final boolean willClose, final WindowClosingListener closingListener) throws InterruptedException { closingListener.reset(); if(obj instanceof java.awt.Window) { final java.awt.Window win = (java.awt.Window) obj; - java.awt.Toolkit tk = java.awt.Toolkit.getDefaultToolkit(); + final java.awt.Toolkit tk = java.awt.Toolkit.getDefaultToolkit(); final java.awt.EventQueue evtQ = tk.getSystemEventQueue(); AWTEDTExecutor.singleton.invoke(true, new Runnable() { public void run() { evtQ.postEvent(new java.awt.event.WindowEvent(win, java.awt.event.WindowEvent.WINDOW_CLOSING)); } }); } else if(obj instanceof com.jogamp.newt.Window) { - com.jogamp.newt.Window win = (com.jogamp.newt.Window) obj; + final com.jogamp.newt.Window win = (com.jogamp.newt.Window) obj; WindowImplAccess.windowDestroyNotify(win); } int wait; @@ -834,7 +834,7 @@ public class AWTRobotUtil { return wait0; } - + public void reset() { focusCount = 0; } /* @Override */ - public void windowGainedFocus(WindowEvent e) { + public void windowGainedFocus(final WindowEvent e) { if(focusCount<0) { focusCount=0; } focusCount++; if( verbose ) { @@ -66,13 +66,13 @@ public class AWTWindowFocusAdapter implements FocusEventCountAdapter, WindowFocu } /* @Override */ - public void windowLostFocus(WindowEvent e) { + public void windowLostFocus(final WindowEvent e) { if(focusCount>0) { focusCount=0; } focusCount--; if( verbose ) { System.err.println("FOCUS AWT LOST (Window) [fc "+focusCount+"]: "+prefix+", "+e); } } - + public String toString() { return prefix+"[focusCount "+focusCount +"]"; } } diff --git a/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java b/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java index 99db0753b..ec8276dee 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java +++ b/src/test/com/jogamp/opengl/test/junit/util/DumpGLInfo.java @@ -35,17 +35,17 @@ import com.jogamp.opengl.JoglVersion; public class DumpGLInfo implements GLEventListener { - public void init(GLAutoDrawable drawable) { - GL gl = drawable.getGL(); + public void init(final GLAutoDrawable drawable) { + final GL gl = drawable.getGL(); System.err.println(JoglVersion.getGLInfo(gl, null, true)); } - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { } - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { } } diff --git a/src/test/com/jogamp/opengl/test/junit/util/EventCountAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/EventCountAdapter.java index 906e4a7c9..804a4eabe 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/EventCountAdapter.java +++ b/src/test/com/jogamp/opengl/test/junit/util/EventCountAdapter.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.util; /** @@ -36,7 +36,7 @@ package com.jogamp.opengl.test.junit.util; */ public interface EventCountAdapter { void reset(); - + /** Instance starts in verbose mode, call w/ false to disable verbosity. */ void setVerbose(boolean v); } diff --git a/src/test/com/jogamp/opengl/test/junit/util/EventCountAdapterUtil.java b/src/test/com/jogamp/opengl/test/junit/util/EventCountAdapterUtil.java index d919d7cb6..b2db3e017 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/EventCountAdapterUtil.java +++ b/src/test/com/jogamp/opengl/test/junit/util/EventCountAdapterUtil.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.util; import java.util.List; @@ -33,15 +33,15 @@ import java.util.Iterator; public abstract class EventCountAdapterUtil { - public static void reset(EventCountAdapter[] adapters) { + public static void reset(final EventCountAdapter[] adapters) { for(int i=0; i*/ adapters) { - for(Iterator i = adapters.iterator(); i.hasNext(); ) { - EventCountAdapter adapter = (EventCountAdapter) i.next(); + public static void reset(final List/**/ adapters) { + for(final Iterator i = adapters.iterator(); i.hasNext(); ) { + final EventCountAdapter adapter = (EventCountAdapter) i.next(); adapter.reset(); } } diff --git a/src/test/com/jogamp/opengl/test/junit/util/FocusEventCountAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/FocusEventCountAdapter.java index 461c72683..54b14543d 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/FocusEventCountAdapter.java +++ b/src/test/com/jogamp/opengl/test/junit/util/FocusEventCountAdapter.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.util; public interface FocusEventCountAdapter extends EventCountAdapter { diff --git a/src/test/com/jogamp/opengl/test/junit/util/GLEventListenerCounter.java b/src/test/com/jogamp/opengl/test/junit/util/GLEventListenerCounter.java index b0f6e2c7e..981c5c17c 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/GLEventListenerCounter.java +++ b/src/test/com/jogamp/opengl/test/junit/util/GLEventListenerCounter.java @@ -44,22 +44,22 @@ public class GLEventListenerCounter implements GLEventListener { } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { initCount++; } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { disposeCount++; } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { displayCount++; } @Override - public void reshape(GLAutoDrawable d, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable d, final int x, final int y, final int width, final int height) { reshapeCount++; } diff --git a/src/test/com/jogamp/opengl/test/junit/util/GLSLSimpleProgram.java b/src/test/com/jogamp/opengl/test/junit/util/GLSLSimpleProgram.java index 926d4490c..5c2b2c56f 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/GLSLSimpleProgram.java +++ b/src/test/com/jogamp/opengl/test/junit/util/GLSLSimpleProgram.java @@ -41,25 +41,25 @@ public class GLSLSimpleProgram { private int fragShader; private boolean isValid; - private GLSLSimpleProgram(int shaderProgram, int vertShader, int fragShader) { + private GLSLSimpleProgram(final int shaderProgram, final int vertShader, final int fragShader) { this.shaderProgram = shaderProgram; this.vertShader = vertShader; this.fragShader = fragShader; this.isValid = true; } - public static GLSLSimpleProgram create(GL2ES2 gl, String vertShaderCode, String fragShaderCode, boolean link) { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - PrintStream pbaos = new PrintStream(baos); + public static GLSLSimpleProgram create(final GL2ES2 gl, final String vertShaderCode, final String fragShaderCode, final boolean link) { + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final PrintStream pbaos = new PrintStream(baos); - int vertShader = gl.glCreateShader(GL2ES2.GL_VERTEX_SHADER); + final int vertShader = gl.glCreateShader(GL2ES2.GL_VERTEX_SHADER); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - int fragShader = gl.glCreateShader(GL2ES2.GL_FRAGMENT_SHADER); + final int fragShader = gl.glCreateShader(GL2ES2.GL_FRAGMENT_SHADER); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - String[] vlines = new String[] { gl.getContext().getGLSLVersionString()+vertShaderCode }; - int[] vlengths = new int[] { vlines[0].length() }; + final String[] vlines = new String[] { gl.getContext().getGLSLVersionString()+vertShaderCode }; + final int[] vlengths = new int[] { vlines[0].length() }; gl.glShaderSource(vertShader, vlines.length, vlines, vlengths, 0); gl.glCompileShader(vertShader); if(!ShaderUtil.isShaderStatusValid(gl, vertShader, GL2ES2.GL_COMPILE_STATUS, pbaos)) { @@ -69,9 +69,9 @@ public class GLSLSimpleProgram { pbaos.flush(); baos.reset(); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - - String[] flines = new String[] { gl.getContext().getGLSLVersionString()+fragShaderCode }; - int[] flengths = new int[] { flines[0].length() }; + + final String[] flines = new String[] { gl.getContext().getGLSLVersionString()+fragShaderCode }; + final int[] flengths = new int[] { flines[0].length() }; gl.glShaderSource(fragShader, flines.length, flines, flengths, 0); gl.glCompileShader(fragShader); if(!ShaderUtil.isShaderStatusValid(gl, fragShader, GL2ES2.GL_COMPILE_STATUS, pbaos)) { @@ -81,7 +81,7 @@ public class GLSLSimpleProgram { pbaos.flush(); baos.reset(); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - int shaderProgram = gl.glCreateProgram(); + final int shaderProgram = gl.glCreateProgram(); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); gl.glAttachShader(shaderProgram, vertShader); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); @@ -96,11 +96,11 @@ public class GLSLSimpleProgram { } } Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - GLSLSimpleProgram res = new GLSLSimpleProgram(shaderProgram, vertShader, fragShader); + final GLSLSimpleProgram res = new GLSLSimpleProgram(shaderProgram, vertShader, fragShader); return res; } - public void release(GL2ES2 gl) { + public void release(final GL2ES2 gl) { gl.glUseProgram(0); gl.glDetachShader(shaderProgram, vertShader); gl.glDeleteShader(vertShader); @@ -124,7 +124,7 @@ public class GLSLSimpleProgram { public int getVertShader() { return vertShader; } - + public boolean isValid() { return isValid; } diff --git a/src/test/com/jogamp/opengl/test/junit/util/KeyEventCountAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/KeyEventCountAdapter.java index 1d6d97a17..aaafeacee 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/KeyEventCountAdapter.java +++ b/src/test/com/jogamp/opengl/test/junit/util/KeyEventCountAdapter.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,17 +20,17 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.util; public interface KeyEventCountAdapter extends InputEventCountAdapter { public int getKeyPressedCount(boolean autoRepeatOnly); - - public int getKeyReleasedCount(boolean autoRepeatOnly); + + public int getKeyReleasedCount(boolean autoRepeatOnly); } diff --git a/src/test/com/jogamp/opengl/test/junit/util/MiscUtils.java b/src/test/com/jogamp/opengl/test/junit/util/MiscUtils.java index 746e7ee55..e401534bd 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/MiscUtils.java +++ b/src/test/com/jogamp/opengl/test/junit/util/MiscUtils.java @@ -44,63 +44,63 @@ import javax.media.opengl.GLContext; import com.jogamp.common.os.Platform; public class MiscUtils { - public static boolean atob(String str, boolean def) { + public static boolean atob(final String str, final boolean def) { try { return Boolean.parseBoolean(str); - } catch (Exception ex) { + } catch (final Exception ex) { ex.printStackTrace(); } return def; } - public static int atoi(String str, int def) { + public static int atoi(final String str, final int def) { try { return Integer.parseInt(str); - } catch (Exception ex) { + } catch (final Exception ex) { ex.printStackTrace(); } return def; } - public static long atol(String str, long def) { + public static long atol(final String str, final long def) { try { return Long.parseLong(str); - } catch (Exception ex) { + } catch (final Exception ex) { ex.printStackTrace(); } return def; } - public static float atof(String str, float def) { + public static float atof(final String str, final float def) { try { return Float.parseFloat(str); - } catch (Exception ex) { + } catch (final Exception ex) { ex.printStackTrace(); } return def; } - public static String toHexString(byte hex) { + public static String toHexString(final byte hex) { return "0x" + Integer.toHexString( hex & 0x000000FF ); } - public static String toHexString(short hex) { + public static String toHexString(final short hex) { return "0x" + Integer.toHexString( hex & 0x0000FFFF ); } - public static String toHexString(int hex) { + public static String toHexString(final int hex) { return "0x" + Integer.toHexString( hex ); } - public static String toHexString(long hex) { + public static String toHexString(final long hex) { return "0x" + Long.toHexString( hex ); } - public static void assertFloatBufferEquals(String errmsg, FloatBuffer expected, FloatBuffer actual, float delta) { + public static void assertFloatBufferEquals(final String errmsg, final FloatBuffer expected, final FloatBuffer actual, final float delta) { if(null == expected && null == actual) { return; } - String msg = null != errmsg ? errmsg + " " : ""; + final String msg = null != errmsg ? errmsg + " " : ""; if(null == expected) { throw new AssertionError(msg+"; Expected is null, but actual not: "+actual); } @@ -122,14 +122,14 @@ public class MiscUtils { } } - public static void assertFloatBufferNotEqual(String errmsg, FloatBuffer expected, FloatBuffer actual, float delta) { + public static void assertFloatBufferNotEqual(final String errmsg, final FloatBuffer expected, final FloatBuffer actual, final float delta) { if(null == expected || null == actual) { return; } if(expected.remaining() != actual.remaining()) { return; } - String msg = null != errmsg ? errmsg + " " : ""; + final String msg = null != errmsg ? errmsg + " " : ""; final int a0 = expected.position(); final int b0 = actual.position(); for(int i=0; i0; } - + public void reset() { focusCount = 0; } - public void windowGainedFocus(WindowEvent e) { + public void windowGainedFocus(final WindowEvent e) { if(focusCount<0) { focusCount=0; } focusCount++; if( verbose ) { @@ -65,7 +65,7 @@ public class NEWTFocusAdapter implements WindowListener, FocusEventCountAdapter } } - public void windowLostFocus(WindowEvent e) { + public void windowLostFocus(final WindowEvent e) { if(focusCount>0) { focusCount=0; } focusCount--; if( verbose ) { @@ -73,12 +73,12 @@ public class NEWTFocusAdapter implements WindowListener, FocusEventCountAdapter } } - public void windowResized(WindowEvent e) { } - public void windowMoved(WindowEvent e) { } - public void windowDestroyNotify(WindowEvent e) { } - public void windowDestroyed(WindowEvent e) { } - public void windowRepaint(WindowUpdateEvent e) { } - - public String toString() { return prefix+"[focusCount "+focusCount+"]"; } + public void windowResized(final WindowEvent e) { } + public void windowMoved(final WindowEvent e) { } + public void windowDestroyNotify(final WindowEvent e) { } + public void windowDestroyed(final WindowEvent e) { } + public void windowRepaint(final WindowUpdateEvent e) { } + + public String toString() { return prefix+"[focusCount "+focusCount+"]"; } } diff --git a/src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java b/src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java index a76b67d57..cd3a1eaa2 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java +++ b/src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java @@ -41,102 +41,102 @@ import org.junit.Assert; public class NEWTGLContext { - public static class WindowContext { + public static class WindowContext { public final Window window; public final GLDrawable drawable; public final GLContext context; - - public WindowContext(Window w, GLDrawable d, GLContext c) { + + public WindowContext(final Window w, final GLDrawable d, final GLContext c) { window = w; drawable = d; context = c; } } - public static WindowContext createOffscreenWindow(GLCapabilities caps, int width, int height, boolean debugGL) throws InterruptedException { + public static WindowContext createOffscreenWindow(final GLCapabilities caps, final int width, final int height, final boolean debugGL) throws InterruptedException { caps.setOnscreen(false); caps.setPBuffer(true); - + // // Create native windowing resources .. X11/Win/OSX - // - Display display = NewtFactory.createDisplay(null); // local display + // + final Display display = NewtFactory.createDisplay(null); // local display Assert.assertNotNull(display); - - Screen screen = NewtFactory.createScreen(display, 0); // screen 0 + + final Screen screen = NewtFactory.createScreen(display, 0); // screen 0 Assert.assertNotNull(screen); - - Window window = NewtFactory.createWindow(screen, caps); + + final Window window = NewtFactory.createWindow(screen, caps); Assert.assertNotNull(window); window.setSize(width, height); window.setVisible(true); Assert.assertTrue(AWTRobotUtil.waitForVisible(window, true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(window, true)); - - GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile()); - GLDrawable drawable = factory.createGLDrawable(window); + + final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile()); + final GLDrawable drawable = factory.createGLDrawable(window); Assert.assertNotNull(drawable); - + drawable.setRealized(true); Assert.assertTrue(drawable.isRealized()); - - GLContext context = drawable.createContext(null); + + final GLContext context = drawable.createContext(null); Assert.assertNotNull(context); - + context.enableGLDebugMessage(debugGL); - - int res = context.makeCurrent(); + + final int res = context.makeCurrent(); Assert.assertTrue(GLContext.CONTEXT_CURRENT_NEW==res || GLContext.CONTEXT_CURRENT==res); - + return new WindowContext(window, drawable, context); } - public static WindowContext createOnscreenWindow(GLCapabilities caps, int width, int height, boolean debugGL) throws InterruptedException { + public static WindowContext createOnscreenWindow(final GLCapabilities caps, final int width, final int height, final boolean debugGL) throws InterruptedException { // // Create native windowing resources .. X11/Win/OSX - // - Display display = NewtFactory.createDisplay(null); // local display + // + final Display display = NewtFactory.createDisplay(null); // local display Assert.assertNotNull(display); - - Screen screen = NewtFactory.createScreen(display, 0); // screen 0 + + final Screen screen = NewtFactory.createScreen(display, 0); // screen 0 Assert.assertNotNull(screen); - - Window window = NewtFactory.createWindow(screen, caps); + + final Window window = NewtFactory.createWindow(screen, caps); Assert.assertNotNull(window); window.setSize(width, height); window.setVisible(true); Assert.assertTrue(AWTRobotUtil.waitForVisible(window, true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(window, true)); - - GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile()); - GLDrawable drawable = factory.createGLDrawable(window); + + final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile()); + final GLDrawable drawable = factory.createGLDrawable(window); Assert.assertNotNull(drawable); - + drawable.setRealized(true); Assert.assertTrue(drawable.isRealized()); - - GLContext context = drawable.createContext(null); + + final GLContext context = drawable.createContext(null); Assert.assertNotNull(context); - + context.enableGLDebugMessage(debugGL); - - int res = context.makeCurrent(); + + final int res = context.makeCurrent(); Assert.assertTrue(GLContext.CONTEXT_CURRENT_NEW==res || GLContext.CONTEXT_CURRENT==res); - + return new WindowContext(window, drawable, context); } - public static void destroyWindow(WindowContext winctx) { - GLDrawable drawable = winctx.context.getGLDrawable(); - + public static void destroyWindow(final WindowContext winctx) { + final GLDrawable drawable = winctx.context.getGLDrawable(); + Assert.assertNotNull(winctx.context); winctx.context.destroy(); - + Assert.assertNotNull(drawable); drawable.setRealized(false); - + Assert.assertNotNull(winctx.window); winctx.window.destroy(); } - + } diff --git a/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyAdapter.java index 0e86afd93..95cd0e7d3 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyAdapter.java +++ b/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyAdapter.java @@ -46,12 +46,12 @@ public class NEWTKeyAdapter extends KeyAdapter implements KeyEventCountAdapter { List queue = new ArrayList(); boolean verbose = true; - public NEWTKeyAdapter(String prefix) { + public NEWTKeyAdapter(final String prefix) { this.prefix = prefix; reset(); } - public synchronized void setVerbose(boolean v) { verbose = v; } + public synchronized void setVerbose(final boolean v) { verbose = v; } public synchronized boolean isPressed() { return pressed; @@ -65,11 +65,11 @@ public class NEWTKeyAdapter extends KeyAdapter implements KeyEventCountAdapter { return consumed; } - public synchronized int getKeyPressedCount(boolean autoRepeatOnly) { + public synchronized int getKeyPressedCount(final boolean autoRepeatOnly) { return autoRepeatOnly ? keyPressedAR: keyPressed; } - public synchronized int getKeyReleasedCount(boolean autoRepeatOnly) { + public synchronized int getKeyReleasedCount(final boolean autoRepeatOnly) { return autoRepeatOnly ? keyReleasedAR: keyReleased; } @@ -91,7 +91,7 @@ public class NEWTKeyAdapter extends KeyAdapter implements KeyEventCountAdapter { queue.clear(); } - public synchronized void keyPressed(KeyEvent e) { + public synchronized void keyPressed(final KeyEvent e) { pressed = true; keyPressed++; if( 0 != ( e.getModifiers() & InputEvent.AUTOREPEAT_MASK ) ) { @@ -103,7 +103,7 @@ public class NEWTKeyAdapter extends KeyAdapter implements KeyEventCountAdapter { } } - public synchronized void keyReleased(KeyEvent e) { + public synchronized void keyReleased(final KeyEvent e) { pressed = false; keyReleased++; if(e.isConsumed()) { diff --git a/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyUtil.java b/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyUtil.java index 89bafbd8c..623d18229 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyUtil.java +++ b/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyUtil.java @@ -46,7 +46,7 @@ public class NEWTKeyUtil { public final short max; public final String description; - public CodeSeg(int min, int max, String description) { + public CodeSeg(final int min, final int max, final String description) { this.min = (short)min; this.max = (short)max; this.description = description; @@ -57,7 +57,7 @@ public class NEWTKeyUtil { public final String description; public final KeyEvent event; - public CodeEvent(short code, String description, KeyEvent event) { + public CodeEvent(final short code, final String description, final KeyEvent event) { this.code = code; this.description = description; this.event = event; @@ -67,13 +67,13 @@ public class NEWTKeyUtil { } } - public static void dumpKeyEvents(List keyEvents) { + public static void dumpKeyEvents(final List keyEvents) { for(int i=0; i> keyEventsList, boolean verbose) { + public static boolean validateKeyCodes(final CodeSeg[] codeSegments, final List> keyEventsList, final boolean verbose) { final List missCodes = new ArrayList(); int totalCodeCount = 0; boolean res = true; @@ -91,7 +91,7 @@ public class NEWTKeyUtil { } return res; } - public static boolean validateKeyCodes(List missCodes, CodeSeg codeSeg, List keyEvents, boolean verbose) { + public static boolean validateKeyCodes(final List missCodes, final CodeSeg codeSeg, final List keyEvents, final boolean verbose) { final int codeCount = codeSeg.max - codeSeg.min + 1; int misses = 0; int evtIdx = 0; @@ -118,7 +118,7 @@ public class NEWTKeyUtil { return res; } - public static void validateKeyEvent(KeyEvent e, short eventType, int modifiers, short keyCode, char keyChar) { + public static void validateKeyEvent(final KeyEvent e, final short eventType, final int modifiers, final short keyCode, final char keyChar) { if(0 <= eventType) { Assert.assertTrue("KeyEvent type mismatch, expected 0x"+Integer.toHexString(eventType)+", has "+e, eventType == e.getEventType()); } @@ -133,7 +133,7 @@ public class NEWTKeyUtil { } } - public static short getNextKeyEventType(KeyEvent e) { + public static short getNextKeyEventType(final KeyEvent e) { final int et = e.getEventType(); switch( et ) { case KeyEvent.EVENT_KEY_PRESSED: @@ -146,8 +146,8 @@ public class NEWTKeyUtil { } } - public static void validateKeyEventOrder(List keyEvents) { - IntIntHashMap keyCode2NextEvent = new IntIntHashMap(); + public static void validateKeyEventOrder(final List keyEvents) { + final IntIntHashMap keyCode2NextEvent = new IntIntHashMap(); for(int i=0; i queue = new ArrayList(); boolean verbose = true; - public NEWTMouseAdapter(String prefix) { + public NEWTMouseAdapter(final String prefix) { this.prefix = prefix; reset(); } - public synchronized void setVerbose(boolean v) { verbose = v; } + public synchronized void setVerbose(final boolean v) { verbose = v; } public synchronized boolean isPressed() { return pressed; @@ -78,7 +78,7 @@ public class NEWTMouseAdapter extends MouseAdapter implements InputEventCountAda queue.clear(); } - public synchronized void mousePressed(MouseEvent e) { + public synchronized void mousePressed(final MouseEvent e) { pressed = true; queue.add(e); if( verbose ) { @@ -86,7 +86,7 @@ public class NEWTMouseAdapter extends MouseAdapter implements InputEventCountAda } } - public synchronized void mouseReleased(MouseEvent e) { + public synchronized void mouseReleased(final MouseEvent e) { pressed = false; queue.add(e); if( verbose ) { @@ -94,7 +94,7 @@ public class NEWTMouseAdapter extends MouseAdapter implements InputEventCountAda } } - public synchronized void mouseClicked(MouseEvent e) { + public synchronized void mouseClicked(final MouseEvent e) { mouseClicked+=e.getClickCount(); if(e.isConsumed()) { consumed++; diff --git a/src/test/com/jogamp/opengl/test/junit/util/QuitAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/QuitAdapter.java index 467dd7fae..b355d51e3 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/QuitAdapter.java +++ b/src/test/com/jogamp/opengl/test/junit/util/QuitAdapter.java @@ -34,21 +34,21 @@ public class QuitAdapter extends WindowAdapter implements WindowListener, KeyLis boolean shouldQuit = false; boolean enabled = true; - public void enable(boolean v) { enabled = v; } + public void enable(final boolean v) { enabled = v; } public void clear() { shouldQuit = false; } public boolean shouldQuit() { return shouldQuit; } public void doQuit() { shouldQuit=true; } - public void windowDestroyNotify(WindowEvent e) { + public void windowDestroyNotify(final WindowEvent e) { if( enabled ) { System.err.println("QUIT Window "+Thread.currentThread()); shouldQuit = true; } } - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { if( !e.isPrintableKey() || e.isAutoRepeat() ) { return; } @@ -59,6 +59,6 @@ public class QuitAdapter extends WindowAdapter implements WindowListener, KeyLis } } } - public void keyPressed(KeyEvent e) {} + public void keyPressed(final KeyEvent e) {} } diff --git a/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java b/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java index e6958bc48..0044a5708 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java +++ b/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java @@ -94,7 +94,7 @@ public abstract class UITestCase { return testSupported; } - public static void setTestSupported(boolean v) { + public static void setTestSupported(final boolean v) { System.err.println("setTestSupported: "+v); testSupported = v; } @@ -169,13 +169,13 @@ public abstract class UITestCase { System.err.println("XRandR Reset Error Code "+errorCode); } } - } catch (Exception e) { + } catch (final Exception e) { System.err.println("Caught "+e.getClass().getName()+": "+e.getMessage()); e.printStackTrace(); } } } - private static String getFirst(String line) { + private static String getFirst(final String line) { final StringTokenizer tok = new StringTokenizer(line); if( tok.hasMoreTokens() ) { final String s = tok.nextToken().trim(); @@ -186,7 +186,7 @@ public abstract class UITestCase { return null; } - public static int processCommand(String[] cmdline, OutputStream outstream, String outPrefix) { + public static int processCommand(final String[] cmdline, final OutputStream outstream, final String outPrefix) { int errorCode = 0; final Object ioSync = new Object(); try { @@ -202,7 +202,7 @@ public abstract class UITestCase { p.waitFor(); // should be fine by now .. errorCode = p.exitValue(); } - } catch (Exception e) { + } catch (final Exception e) { System.err.println("Caught "+e.getClass().getName()+": "+e.getMessage()); e.printStackTrace(); errorCode = Integer.MIN_VALUE; @@ -215,7 +215,7 @@ public abstract class UITestCase { int ml = 0; final TestClass tc = new TestClass(getClass()); final List testMethods = tc.getAnnotatedMethods(org.junit.Test.class); - for(Iterator iter=testMethods.iterator(); iter.hasNext(); ) { + for(final Iterator iter=testMethods.iterator(); iter.hasNext(); ) { final int l = iter.next().getName().length(); if( ml < l ) { ml = l; } } @@ -228,11 +228,11 @@ public abstract class UITestCase { return _unitTestName.getMethodName(); } - public final String getSimpleTestName(String separator) { + public final String getSimpleTestName(final String separator) { return getClass().getSimpleName()+separator+getTestMethodName(); } - public final String getFullTestName(String separator) { + public final String getFullTestName(final String separator) { return getClass().getName()+separator+getTestMethodName(); } @@ -267,17 +267,17 @@ public abstract class UITestCase { System.err.println("++++ UITestCase.tearDown: "+getFullTestName(" - ")); } - public static void waitForKey(String preMessage) { - BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); + public static void waitForKey(final String preMessage) { + final BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); System.err.println(preMessage+"> Press enter to continue"); try { System.err.println(stdin.readLine()); - } catch (IOException e) { } + } catch (final IOException e) { } } static final String unsupportedTestMsg = "Test not supported on this platform."; - public String getSnapshotFilename(int sn, String postSNDetail, GLCapabilitiesImmutable caps, int width, int height, boolean sinkHasAlpha, String fileSuffix, String destPath) { + public String getSnapshotFilename(final int sn, String postSNDetail, final GLCapabilitiesImmutable caps, final int width, final int height, final boolean sinkHasAlpha, String fileSuffix, final String destPath) { if(null == fileSuffix) { fileSuffix = TextureIO.PNG; } @@ -332,7 +332,7 @@ public abstract class UITestCase { * It shall not end with a directory separator, {@link File#separatorChar}. * If null the current working directory is being used. */ - public void snapshot(int sn, String postSNDetail, GL gl, GLReadBufferUtil readBufferUtil, String fileSuffix, String destPath) { + public void snapshot(final int sn, final String postSNDetail, final GL gl, final GLReadBufferUtil readBufferUtil, final String fileSuffix, final String destPath) { final GLDrawable drawable = gl.getContext().getGLReadDrawable(); final String filename = getSnapshotFilename(sn, postSNDetail, @@ -342,15 +342,15 @@ public abstract class UITestCase { gl.glFinish(); // just make sure rendering finished .. try { snapshot(gl, readBufferUtil, filename); - } catch (ClassNotFoundException cnfe) { + } catch (final ClassNotFoundException cnfe) { // Texture class belongs to jogl-util.jar which my not be included in test environment! System.err.println("Caught ClassNotFoundException: "+cnfe.getMessage()); - } catch (NoClassDefFoundError cnfe) { + } catch (final NoClassDefFoundError cnfe) { // Texture class belongs to jogl-util.jar which my not be included in test environment! System.err.println("Caught NoClassDefFoundError: "+cnfe.getMessage()); } } - private void snapshot(GL gl, GLReadBufferUtil readBufferUtil, String filename) throws ClassNotFoundException, NoClassDefFoundError { + private void snapshot(final GL gl, final GLReadBufferUtil readBufferUtil, final String filename) throws ClassNotFoundException, NoClassDefFoundError { if(readBufferUtil.readPixels(gl, false)) { readBufferUtil.write(new File(filename)); } @@ -364,7 +364,7 @@ public abstract class UITestCase { private volatile int displayCount=0; private volatile int reshapeCount=0; private volatile String postSNDetail = null; - public SnapshotGLEventListener(GLReadBufferUtil screenshot) { + public SnapshotGLEventListener(final GLReadBufferUtil screenshot) { this.screenshot = screenshot; } public SnapshotGLEventListener() { @@ -373,9 +373,9 @@ public abstract class UITestCase { public int getDisplayCount() { return displayCount; } public int getReshapeCount() { return reshapeCount; } public GLReadBufferUtil getGLReadBufferUtil() { return screenshot; } - public void init(GLAutoDrawable drawable) {} - public void dispose(GLAutoDrawable drawable) {} - public void display(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) {} + public void display(final GLAutoDrawable drawable) { final GL gl = drawable.getGL(); final boolean _makeShot = makeShot || makeShotAlways; if(verbose) { @@ -387,7 +387,7 @@ public abstract class UITestCase { } displayCount++; } - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { if(verbose) { System.err.println(Thread.currentThread().getName()+": ** reshape: "+reshapeCount+": "+width+"x"+height+" - "+drawable.getSurfaceWidth()+"x"+drawable.getSurfaceHeight()); } @@ -396,13 +396,13 @@ public abstract class UITestCase { public void setMakeSnapshot() { makeShot=true; } - public void setMakeSnapshotAlways(boolean v) { + public void setMakeSnapshotAlways(final boolean v) { makeShotAlways=v; } - public void setVerbose(boolean v) { + public void setVerbose(final boolean v) { verbose=v; } - public void setPostSNDetail(String v) { + public void setPostSNDetail(final String v) { postSNDetail = v; } }; diff --git a/src/test/com/jogamp/opengl/test/junit/util/ValidateLockListener.java b/src/test/com/jogamp/opengl/test/junit/util/ValidateLockListener.java index 73c1ad74c..ceb171529 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/ValidateLockListener.java +++ b/src/test/com/jogamp/opengl/test/junit/util/ValidateLockListener.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.util; @@ -36,10 +36,10 @@ import javax.media.opengl.GLEventListener; public class ValidateLockListener implements GLEventListener { - private void validateLock(GLAutoDrawable drawable) { + private void validateLock(final GLAutoDrawable drawable) { final NativeSurface ns = drawable.getNativeSurface(); ns.getGraphicsConfiguration().getScreen().getDevice().validateLocked(); - + final Thread current = Thread.currentThread(); final Thread owner = ns.getSurfaceLockOwner(); if( ns.isSurfaceLockedByOtherThread() ) { @@ -49,23 +49,23 @@ public class ValidateLockListener implements GLEventListener { if( null == owner ) { throw new RuntimeException(current.getName()+": Not locked: "+ns); } - throw new RuntimeException(current.getName()+": Locked by another thread(2), owner "+owner+", "+ns); + throw new RuntimeException(current.getName()+": Locked by another thread(2), owner "+owner+", "+ns); } } - - public void init(GLAutoDrawable drawable) { + + public void init(final GLAutoDrawable drawable) { validateLock(drawable); } - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { validateLock(drawable); } - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { validateLock(drawable); } - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { validateLock(drawable); } } -- cgit v1.2.3