diff options
author | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-03 16:21:36 +0200 |
commit | 556d92b63555a085b25e32b1cd55afce24edd07a (patch) | |
tree | 6be2b02c62a77d5aba81ffbe34c46960608be163 /src/test | |
parent | a90f4a51dffec3247278e3c683ed4462b1dd9ab5 (diff) |
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
Diffstat (limited to 'src/test')
423 files changed, 8341 insertions, 8248 deletions
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. * <p> * The order of the Uri segments (any arguments) is preserved. - * </p> + * </p> */ 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 <code>launch</code> */ public static final String SCHEME = "launch"; - + /** The host <code>jogamp.org</code> */ 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<String> args = new ArrayList<String>(); - /** + /** * Returns the default {@link LauncherUtil#LAUNCH_ACTIVITY_NORMAL} action. * <p> * Should be overridden for other action, eg. {@link LauncherUtil#LAUNCH_ACTIVITY_TRANSPARENT}. * </p> */ public String getAction() { return LAUNCH_ACTIVITY_NORMAL; } - + /** * Returns the properties, which are being propagated to the target activity. * <p> @@ -89,58 +89,58 @@ public class LauncherUtil { * </p> */ public final OrderedProperties getProperties() { return props; } - + /** * Returns the commandline arguments, which are being propagated to the target activity. * <p> * Maybe be used to set custom commandline arguments. * </p> */ - public final ArrayList<String> getArguments() { return args; } - + public final ArrayList<String> 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 <code>true</code>, 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<String> getUsrPackages(); - + /** Return a list of required system packages w/ native libraries, may return null or a zero sized list. */ public abstract List<String> 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<String, String> map = new HashMap<String, String>(); - ArrayList<String> keyList = new ArrayList<String>(); - - public final void setProperty(String key, String value) { + ArrayList<String> keyList = new ArrayList<String>(); + + 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<String> argKeys = props.keyList.iterator(); + + public final void addAll(final OrderedProperties props) { + final Iterator<String> argKeys = props.keyList.iterator(); while(argKeys.hasNext()) { final String key = argKeys.next(); setProperty(key, props.map.get(key)); - } + } } - + public final void setSystemProperties() { - Iterator<String> argKeys = keyList.iterator(); + final Iterator<String> argKeys = keyList.iterator(); while(argKeys.hasNext()) { final String key = argKeys.next(); System.setProperty(key, map.get(key)); } } public final void clearSystemProperties() { - Iterator<String> argKeys = keyList.iterator(); + final Iterator<String> 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<String, String> getProperties() { return map; } - + /** Returns the list of property keys in the order, as they were added. */ - public final List<String> getPropertyKeys() { return keyList; } + public final List<String> getPropertyKeys() { return keyList; } } - + /** * Data set to transfer from and to launch URI consisting out of: * <ul> @@ -205,56 +205,56 @@ public class LauncherUtil { static final char ASSIG = '='; static final String COLSLASH2 = "://"; static final String EMPTY = ""; - + String activityName = null; ArrayList<String> sysPackages = new ArrayList<String>(); ArrayList<String> usrPackages = new ArrayList<String>(); OrderedProperties properties = new OrderedProperties(); ArrayList<String> arguments = new ArrayList<String>(); - - 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<String> plist) { + + public final void addSysPackage(final String p) { + sysPackages.add(p); + } + public final void addAllSysPackages(final List<String> plist) { sysPackages.addAll(plist); - } + } public final List<String> getSysPackages() { return sysPackages; } - - public final void addUsrPackage(String p) { - usrPackages.add(p); - } - public final void addAllUsrPackages(List<String> plist) { + + public final void addUsrPackage(final String p) { + usrPackages.add(p); + } + public final void addAllUsrPackages(final List<String> plist) { usrPackages.addAll(plist); - } + } public final List<String> 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<String> getPropertyKeys() { return properties.getPropertyKeys(); } - - public final void addArgument(String arg) { arguments.add(arg); } - public final void addAllArguments(List<String> args) { + + public final void addArgument(final String arg) { arguments.add(arg); } + public final void addAllArguments(final List<String> args) { arguments.addAll(args); } public final ArrayList<String> 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<String> propKeys = properties.keyList.iterator(); + final Iterator<String> 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<String> args = arguments.iterator(); + final Iterator<String> 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<args.length; i++) { - String uri_s = args[i]; - Uri uri0 = Uri.parse(uri_s); - DataSet data = DataSet.create(uri0); + final String uri_s = args[i]; + final Uri uri0 = Uri.parse(uri_s); + final DataSet data = DataSet.create(uri0); if(null == data) { errors++; System.err.println("Error: NULL JogAmpLauncherUtil: <"+uri_s+"> -> "+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 && i<path.length; i++) { if(null != path[i] && path[i].length()>0) { @@ -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 && i<path.length; i++) { if(null != path[i] && path[i].length()>0) { @@ -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 && i<path.length; i++) { if(null != path[i] && path[i].length()>0) { @@ -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 && i<path.length; i++) { if(null != path[i] && path[i].length()>0) { @@ -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<String> getSysPackages() { return Arrays.asList(sys_pkgs); } - + @Override public List<String> getUsrPackages() { return Arrays.asList(usr_pkgs); diff --git a/src/test/com/jogamp/opengl/test/android/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<String> getSysPackages() { return Arrays.asList(sys_pkgs); } - + @Override public List<String> getUsrPackages() { return Arrays.asList(usr_pkgs); diff --git a/src/test/com/jogamp/opengl/test/android/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<Buffer> buffers = new ArrayList<Buffer>(); + final ArrayList<Buffer> buffers = new ArrayList<Buffer>(); 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<String> getSysPackages() { return Arrays.asList(sys_pkgs); } - + @Override public List<String> getUsrPackages() { return Arrays.asList(usr_pkgs); diff --git a/src/test/com/jogamp/opengl/test/android/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<String> getSysPackages() { return Arrays.asList(sys_pkgs); } - + @Override public List<String> getUsrPackages() { return Arrays.asList(usr_pkgs); diff --git a/src/test/com/jogamp/opengl/test/android/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<String> getSysPackages() { return Arrays.asList(sys_pkgs); } - + @Override public List<String> getUsrPackages() { return Arrays.asList(usr_pkgs); diff --git a/src/test/com/jogamp/opengl/test/android/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<String> getSysPackages() { return Arrays.asList(sys_pkgs); } - + @Override public List<String> 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<String> getSysPackages() { return Arrays.asList(sys_pkgs); } - + @Override public List<String> getUsrPackages() { return Arrays.asList(usr_pkgs); diff --git a/src/test/com/jogamp/opengl/test/android/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<String> getSysPackages() { return Arrays.asList(sys_pkgs); } - + @Override public List<String> getUsrPackages() { return Arrays.asList(usr_pkgs); diff --git a/src/test/com/jogamp/opengl/test/android/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<String> getSysPackages() { return Arrays.asList(sys_pkgs); } - + @Override public List<String> getUsrPackages() { return Arrays.asList(usr_pkgs); diff --git a/src/test/com/jogamp/opengl/test/android/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 * </pre> * OSX Results: * <pre> @@ -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<args.length; i++) { if(args[i].equals("-vsync")) { i++; @@ -217,56 +217,56 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable { } } System.err.println("swapInterval "+SWAP_INTERVAL); - System.err.println("exclusiveContext "+USE_ECT); + System.err.println("exclusiveContext "+USE_ECT); if(waitForKey) { UITestCase.waitForKey("Start"); } - - GraphicsEnvironment environment = + + 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("TestBug735Inv2AppletAWT"); - + try { - Class<?> 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<args.length; i++) { if(args[i].equals("-vsync")) { i++; @@ -158,61 +158,61 @@ public class Bug735Inv3AppletAWT extends Applet { } } System.err.println("swapInterval "+SWAP_INTERVAL); - System.err.println("exclusiveContext "+USE_ECT); + System.err.println("exclusiveContext "+USE_ECT); if(waitForKey) { UITestCase.waitForKey("Start"); } - - final GraphicsEnvironment environment = + + final GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment(); final GraphicsDevice displayDevice = environment.getDefaultScreenDevice(); frame = new Frame(displayDevice.getDefaultConfiguration()); frame.setBackground(new Color(0xCC, 0xCC, 0xCC)); frame.setTitle("TestBug735Inv3AppletAWT"); - + // This allows to close the frame. frame.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { + public void windowClosing(final WindowEvent e) { System.exit(0); } }); - + try { - Class<?> 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<args.length; i++) { if(args[i].equals("-vsync")) { i++; @@ -145,29 +145,29 @@ public class Bug735Inv4AWT { } } System.err.println("swapInterval "+SWAP_INTERVAL); - System.err.println("exclusiveContext "+USE_ECT); + System.err.println("exclusiveContext "+USE_ECT); if(waitForKey) { UITestCase.waitForKey("Start"); } - - final GraphicsEnvironment environment = + + final GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment(); final GraphicsDevice displayDevice = environment.getDefaultScreenDevice(); frame = new Frame(displayDevice.getDefaultConfiguration()); // JAU frame.setBackground(new Color(0xCC, 0xCC, 0xCC)); frame.setTitle("TestBug735Inv4AWT"); - + // 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 = new Bug735Inv4AWT(); applet.init(); - + if (TOOLKIT == AWT) { frame.add(applet.awtCanvas); } else if (TOOLKIT == NEWT) { @@ -175,28 +175,28 @@ public class Bug735Inv4AWT { } // frame.pack(); // frame.setResizable(false); - - 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(); // 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); - - frame.setVisible(true); + screenRect.y + (screenRect.height - applet.height) / 2); + + 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/DemoBug910ExtendedAWTAppletLifecycleCheck.java b/src/test/com/jogamp/opengl/test/bugs/DemoBug910ExtendedAWTAppletLifecycleCheck.java index 1d7f6e78c..20573aa4b 100644 --- a/src/test/com/jogamp/opengl/test/bugs/DemoBug910ExtendedAWTAppletLifecycleCheck.java +++ b/src/test/com/jogamp/opengl/test/bugs/DemoBug910ExtendedAWTAppletLifecycleCheck.java @@ -41,7 +41,7 @@ public class DemoBug910ExtendedAWTAppletLifecycleCheck extends Applet { private static String currentThreadName() { return "["+Thread.currentThread().getName()+", isAWT-EDT "+EventQueue.isDispatchThread()+"]"; } - private static void invoke(boolean wait, Runnable r) { + private static void invoke(final boolean wait, final Runnable r) { if(EventQueue.isDispatchThread()) { r.run(); } else { @@ -51,24 +51,24 @@ public class DemoBug910ExtendedAWTAppletLifecycleCheck extends Applet { } else { EventQueue.invokeLater(r); } - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new RuntimeException(e.getTargetException()); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { throw new RuntimeException(e); } } } - private static final String comp2Str(Component c) { + private static final String comp2Str(final Component c) { return c.getClass().getSimpleName()+"[visible "+c.isVisible()+", showing "+c.isShowing()+", valid "+c.isValid()+ ", displayable "+c.isDisplayable()+", "+c.getX()+"/"+c.getY()+" "+c.getWidth()+"x"+c.getHeight()+"]"; } - private void println(String msg) { + private void println(final String msg) { System.err.println(msg); } - private final void checkComponentState(String msg, boolean expIsContained, int expAddNotifyCount, int expRemoveNotifyCount) { + private final void checkComponentState(final String msg, final boolean expIsContained, final int expAddNotifyCount, final int expRemoveNotifyCount) { final int compCount = getComponentCount(); final Component c = 1 <= compCount ? getComponent(0) : null; final String clazzName = null != c ? c.getName() : "n/a"; @@ -88,8 +88,8 @@ public class DemoBug910ExtendedAWTAppletLifecycleCheck extends Applet { volatile int stopCount = 0; volatile int destroyCount = 0; - private final void checkAppletState(String msg, boolean expIsActive, - int expInitCount, int expStartCount, int expStopCount, boolean startStopCountEquals, int expDestroyCount) { + private final void checkAppletState(final String msg, final boolean expIsActive, + final int expInitCount, final int expStartCount, final int expStopCount, final boolean startStopCountEquals, final int expDestroyCount) { final boolean isActive = this.isActive(); final String okS = ( expInitCount == initCount && expIsActive == isActive && @@ -144,7 +144,7 @@ public class DemoBug910ExtendedAWTAppletLifecycleCheck extends Applet { } @Override - public void paint(Graphics g) { + public void paint(final Graphics g) { super.paint(g); paintCount++; final int width = getWidth(); diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue326Test1.java b/src/test/com/jogamp/opengl/test/bugs/Issue326Test1.java index 833f34153..802bd65d5 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Issue326Test1.java +++ b/src/test/com/jogamp/opengl/test/bugs/Issue326Test1.java @@ -9,16 +9,18 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.Random; +import javax.media.opengl.GL; import javax.media.opengl.GL2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; import javax.media.opengl.awt.GLCanvas; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import javax.media.opengl.glu.GLU; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.util.awt.TextRenderer; -/** +/** * Demonstrates corruption with older versions of TextRenderer. Two * problems: errors when punting from glyph-based renderer to * string-by-string renderer, and failure of glyph-based renderer when @@ -31,64 +33,64 @@ public class Issue326Test1 extends Frame implements GLEventListener { int width, height; - public static void main(String[] args) { - new Issue326Test1(); + public static void main(final String[] args) { + new Issue326Test1(); } - + GLCanvas canvas; TextRenderer tr ; - + public Issue326Test1() { super("TextTest"); this.setSize(800, 800); canvas = new GLCanvas(); canvas.addGLEventListener(this); add(canvas); - + setVisible(true); addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { + public void windowClosing(final WindowEvent e) { System.exit(0); } }); } - 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, 0, 0, 0); - gl.glClear(GL2.GL_COLOR_BUFFER_BIT|GL2.GL_DEPTH_BUFFER_BIT); - - - gl.glMatrixMode(GL2.GL_PROJECTION); - gl.glLoadIdentity(); + gl.glClear(GL.GL_COLOR_BUFFER_BIT|GL.GL_DEPTH_BUFFER_BIT); + + + gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); + gl.glLoadIdentity(); //new GLU().gluPerspective(45f, (float)width/(float)height, 0.1f, 1000f); gl.glOrtho(0.0, 800, 0.0, 800, -100.0, 100.0); - gl.glMatrixMode(GL2.GL_MODELVIEW); + gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); - + tr.beginRendering(800,800); tr.draw( "die Marktwirtschaft. Da regelt sich � angeblich", 16, 32); tr.draw( "Hello World! This text is scrambled", 16, 16); tr.endRendering(); - + } - public void init(GLAutoDrawable arg0) { + public void init(final GLAutoDrawable arg0) { tr = new TextRenderer(new java.awt.Font("Verdana", java.awt.Font.PLAIN, 12), true, false, null, false); tr.setColor(1, 1, 1 ,1); } - public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3, int arg4) { + public void reshape(final GLAutoDrawable arg0, final int arg1, final int arg2, final int arg3, final int arg4) { width = arg3; height = arg4; - GL2 gl = arg0.getGL().getGL2(); + final GL2 gl = arg0.getGL().getGL2(); gl.glViewport(0, 0, width, height); - gl.glMatrixMode(GL2.GL_PROJECTION); + gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); gl.glOrtho(0.0, 800, 0.0, 200, -100.0, 100.0); - gl.glMatrixMode(GL2.GL_MODELVIEW); + gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); } - public void dispose(GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) {} } diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java b/src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java index 2a8fd3a39..032eaa23c 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java +++ b/src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java @@ -3,10 +3,13 @@ package com.jogamp.opengl.test.bugs; import java.awt.Font; import java.awt.Frame; import java.awt.event.*; + +import javax.media.opengl.GL; import javax.media.opengl.GL2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; import javax.media.opengl.awt.GLCanvas; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.util.awt.*; @@ -20,54 +23,54 @@ public class Issue326Test2 extends Frame implements GLEventListener { int width, height; - public static void main(String[] args) { - new Issue326Test2(); + public static void main(final String[] args) { + new Issue326Test2(); } - + GLCanvas canvas; TextRenderer tr; - + public Issue326Test2() { super(""); this.setSize(800, 800); canvas = new GLCanvas(); canvas.addGLEventListener(this); add(canvas); - + setVisible(true); addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { + public void windowClosing(final WindowEvent e) { System.exit(0); } }); } - 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, 0, 0, 0); - gl.glClear(GL2.GL_COLOR_BUFFER_BIT|GL2.GL_DEPTH_BUFFER_BIT); - + gl.glClear(GL.GL_COLOR_BUFFER_BIT|GL.GL_DEPTH_BUFFER_BIT); + tr.beginRendering(drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); tr.draw("LA CLAPI\u00c8RE \nAlt: 1100-1700m \nGlissement de terrain majeur", 16, 80); tr.draw("dans la haute Tin\u00e9e, sur un flanc du Parc du Mercantour.", 16, 16); tr.endRendering(); - + } - public void init(GLAutoDrawable arg0) { + public void init(final GLAutoDrawable arg0) { tr = new TextRenderer(Font.decode("Arial-BOLD-64")); tr.setColor(1, 1, 1 ,1); } - public void reshape(GLAutoDrawable arg0, int x, int y, int w, int h) { - GL2 gl = arg0.getGL().getGL2(); - gl.glMatrixMode(GL2.GL_PROJECTION); + public void reshape(final GLAutoDrawable arg0, final int x, final int y, final int w, final int h) { + final GL2 gl = arg0.getGL().getGL2(); + gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); gl.glOrtho(0.0, w, 0.0, h, -1, 1); - gl.glMatrixMode(GL2.GL_MODELVIEW); + gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); } - public void dispose(GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) {} } diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue344Base.java b/src/test/com/jogamp/opengl/test/bugs/Issue344Base.java index 2a7afabff..7692a30b7 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Issue344Base.java +++ b/src/test/com/jogamp/opengl/test/bugs/Issue344Base.java @@ -6,11 +6,14 @@ import java.awt.Frame; import java.awt.event.*; import java.awt.geom.*; +import javax.media.opengl.GL; import javax.media.opengl.GL2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; import javax.media.opengl.awt.GLCanvas; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import javax.media.opengl.glu.*; + import com.jogamp.opengl.util.awt.TextRenderer; /** Test Code adapted from TextCube.java (in JOGL demos) @@ -35,17 +38,17 @@ public abstract class Issue344Base implements GLEventListener protected abstract String getText(); - protected void run(String[] args) { + protected void run(final String[] args) { final Frame frame = new Frame(getClass().getName()); frame.setLayout(new BorderLayout()); - GLCanvas canvas = new GLCanvas(); + final GLCanvas canvas = new GLCanvas(); canvas.addGLEventListener(this); frame.add(canvas, BorderLayout.CENTER); frame.setSize(512, 512); frame.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { + public void windowClosing(final WindowEvent e) { new Thread(new Runnable() { public void run() { System.exit(0); @@ -58,57 +61,57 @@ public abstract class Issue344Base implements GLEventListener public void run() { frame.setVisible(true); } } ); - } catch(Exception ex) { + } catch(final Exception ex) { throw new RuntimeException(ex); } } - public void init(GLAutoDrawable drawable) + public void init(final GLAutoDrawable drawable) { - GL2 gl = drawable.getGL().getGL2(); + final GL2 gl = drawable.getGL().getGL2(); - gl.glEnable(GL2.GL_DEPTH_TEST); + gl.glEnable(GL.GL_DEPTH_TEST); renderer = new TextRenderer(font, useMipMaps); - Rectangle2D bounds = renderer.getBounds(getText()); - float w = (float) bounds.getWidth(); - float h = (float) bounds.getHeight(); + final Rectangle2D bounds = renderer.getBounds(getText()); + final float w = (float) bounds.getWidth(); + final float h = (float) bounds.getHeight(); textScaleFactor = 2.0f / (w * 1.1f); gl.setSwapInterval(0); } - public void display(GLAutoDrawable drawable) + public void display(final GLAutoDrawable drawable) { - GL2 gl = drawable.getGL().getGL2(); - gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT); + final GL2 gl = drawable.getGL().getGL2(); + gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - gl.glMatrixMode(GL2.GL_MODELVIEW); + gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); glu.gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0); renderer.begin3DRendering(); - Rectangle2D bounds = renderer.getBounds(getText()); - float w = (float) bounds.getWidth(); - float h = (float) bounds.getHeight(); + final Rectangle2D bounds = renderer.getBounds(getText()); + final float w = (float) bounds.getWidth(); + final float h = (float) bounds.getHeight(); renderer.draw3D(getText(), w / -2.0f * textScaleFactor, h / -2.0f * textScaleFactor, 3f, textScaleFactor); - + renderer.end3DRendering(); } - 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) { - GL2 gl = drawable.getGL().getGL2(); - gl.glMatrixMode(GL2.GL_PROJECTION); + final GL2 gl = drawable.getGL().getGL2(); + gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); glu.gluPerspective(15, (float) width / (float) height, 5, 15); } - public void dispose(GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) {} } diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue344Test1.java b/src/test/com/jogamp/opengl/test/bugs/Issue344Test1.java index f0da7cbf8..384b6e993 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Issue344Test1.java +++ b/src/test/com/jogamp/opengl/test/bugs/Issue344Test1.java @@ -2,11 +2,11 @@ package com.jogamp.opengl.test.bugs; public class Issue344Test1 extends Issue344Base { protected String getText() { - // test 1 - weird artifacts appear with a large font & long string + // test 1 - weird artifacts appear with a large font & long string return "abcdefghijklmnopqrstuvwxyz1234567890"; } - public static void main(String[] args) { + public static void main(final String[] args) { new Issue344Test1().run(args); } } diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue344Test2.java b/src/test/com/jogamp/opengl/test/bugs/Issue344Test2.java index bb1acf2de..9941b3f5b 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Issue344Test2.java +++ b/src/test/com/jogamp/opengl/test/bugs/Issue344Test2.java @@ -6,7 +6,7 @@ public class Issue344Test2 extends Issue344Base { return "\u201Cabcdefghijklmnopqrstuvwxyz\u201D"; } - public static void main(String[] args) { + public static void main(final String[] args) { new Issue344Test2().run(args); } } diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue344Test3.java b/src/test/com/jogamp/opengl/test/bugs/Issue344Test3.java index bb73d84ec..7ae4245c6 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Issue344Test3.java +++ b/src/test/com/jogamp/opengl/test/bugs/Issue344Test3.java @@ -6,7 +6,7 @@ public class Issue344Test3 extends Issue344Base { return "abcde"; } - public static void main(String[] args) { + public static void main(final String[] args) { new Issue344Test3().run(args); } } diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue344Test4.java b/src/test/com/jogamp/opengl/test/bugs/Issue344Test4.java index de4c37a40..87a5b644e 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Issue344Test4.java +++ b/src/test/com/jogamp/opengl/test/bugs/Issue344Test4.java @@ -6,7 +6,7 @@ public class Issue344Test4 extends Issue344Base { return "\u201CGreetings\u201D!"; } - public static void main(String[] args) { + public static void main(final String[] args) { new Issue344Test4().run(args); } } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java index fd1486995..23b39926d 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java @@ -36,6 +36,8 @@ import javax.media.opengl.GLEventListener; import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; +import jogamp.common.os.PlatformPropsImpl; + import org.junit.Assert; import org.junit.Test; import org.junit.FixMethodOrder; @@ -55,21 +57,21 @@ import com.jogamp.opengl.test.junit.util.UITestCase; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestRegionRendererNEWT01 extends UITestCase { - public static void main(String args[]) throws IOException { - String tstname = TestRegionRendererNEWT01.class.getName(); + public static void main(final String args[]) throws IOException { + final String tstname = TestRegionRendererNEWT01.class.getName(); org.junit.runner.JUnitCore.main(tstname); } - static void destroyWindow(GLWindow window) { + static void destroyWindow(final GLWindow window) { if(null!=window) { window.destroy(); } } - static GLWindow createWindow(String title, GLCapabilitiesImmutable caps, int width, int height) { + static GLWindow createWindow(final String title, final GLCapabilitiesImmutable caps, final int width, final int height) { Assert.assertNotNull(caps); - GLWindow window = GLWindow.create(caps); + final GLWindow window = GLWindow.create(caps); window.setSize(width, height); window.setPosition(10, 10); window.setTitle(title); @@ -81,19 +83,19 @@ public class TestRegionRendererNEWT01 extends UITestCase { // @Test public void test00RegionRendererNONE01() throws InterruptedException { - GLProfile glp = GLProfile.get(GLProfile.GL2ES2); - GLCapabilities caps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.get(GLProfile.GL2ES2); + final GLCapabilities caps = new GLCapabilities(glp); // caps.setOnscreen(false); caps.setAlphaBits(4); - GLWindow window = createWindow("shape-vbaa0-msaa0", caps, 800, 400); - RenderState rs = RenderState.createRenderState(SVertex.factory()); + final GLWindow window = createWindow("shape-vbaa0-msaa0", caps, 800, 400); + final RenderState rs = RenderState.createRenderState(SVertex.factory()); - GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, 0, 0, false, false); + final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, 0, 0, false, false); demo01Listener.attachInputListenerTo(window); window.addGLEventListener(demo01Listener); - RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion01"); + final RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion01"); window.addGLEventListener(listener); listener.setTech(-20, 0, -300, 0f, 2); @@ -110,24 +112,24 @@ public class TestRegionRendererNEWT01 extends UITestCase { // @Test public void test01RegionRendererNONE02() throws InterruptedException { - if(Platform.CPUFamily.X86 != Platform.CPU_ARCH.family) { // FIXME + if(Platform.CPUFamily.X86 != PlatformPropsImpl.CPU_ARCH.family) { // FIXME // FIXME: Disabled for now - since it doesn't seem fit for mobile (performance wise). // FIXME: Also the GLSL code for VARIABLE_CURVE is not fit for mobile yet! System.err.println("disabled on non desktop (x86) arch for now .."); return; } - GLProfile glp = GLProfile.get(GLProfile.GL2ES2); - GLCapabilities caps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.get(GLProfile.GL2ES2); + final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(4); - GLWindow window = createWindow("shape-vbaa0-msaa0", caps, 800, 400); - RenderState rs = RenderState.createRenderState(SVertex.factory()); + final GLWindow window = createWindow("shape-vbaa0-msaa0", caps, 800, 400); + final RenderState rs = RenderState.createRenderState(SVertex.factory()); - GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, Region.VARWEIGHT_RENDERING_BIT, 0, false, false); + final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, Region.VARWEIGHT_RENDERING_BIT, 0, false, false); demo01Listener.attachInputListenerTo(window); window.addGLEventListener(demo01Listener); - RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion02"); + final RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion02"); window.addGLEventListener(listener); listener.setTech(-20, 0, -300, 0f, 2); @@ -144,21 +146,21 @@ public class TestRegionRendererNEWT01 extends UITestCase { @Test public void test10RegionRendererMSAA01() throws InterruptedException { - GLProfile glp = GLProfile.get(GLProfile.GL2ES2); - GLCapabilities caps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.get(GLProfile.GL2ES2); + final GLCapabilities caps = new GLCapabilities(glp); // caps.setOnscreen(false); caps.setAlphaBits(4); caps.setSampleBuffers(true); caps.setNumSamples(4); - GLWindow window = createWindow("shape-vbaa0-msaa1", caps, 800, 400); - RenderState rs = RenderState.createRenderState(SVertex.factory()); + final GLWindow window = createWindow("shape-vbaa0-msaa1", caps, 800, 400); + final RenderState rs = RenderState.createRenderState(SVertex.factory()); - GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, 0, 0, false, false); + final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, 0, 0, false, false); demo01Listener.attachInputListenerTo(window); window.addGLEventListener(demo01Listener); - RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion01"); + final RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion01"); window.addGLEventListener(listener); listener.setTech(-20, 00, -300, 0f, 2); @@ -175,26 +177,26 @@ public class TestRegionRendererNEWT01 extends UITestCase { // @Test public void test11RegionRendererMSAA02() throws InterruptedException { - if(Platform.CPUFamily.X86 != Platform.CPU_ARCH.family) { // FIXME + if(Platform.CPUFamily.X86 != PlatformPropsImpl.CPU_ARCH.family) { // FIXME // FIXME: Disabled for now - since it doesn't seem fit for mobile (performance wise). // FIXME: Also the GLSL code for VARIABLE_CURVE is not fit for mobile yet! System.err.println("disabled on non desktop (x86) arch for now .."); return; } - GLProfile glp = GLProfile.get(GLProfile.GL2ES2); - GLCapabilities caps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.get(GLProfile.GL2ES2); + final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(4); caps.setSampleBuffers(true); caps.setNumSamples(4); - GLWindow window = createWindow("shape-vbaa0-msaa1", caps, 800, 400); - RenderState rs = RenderState.createRenderState(SVertex.factory()); + final GLWindow window = createWindow("shape-vbaa0-msaa1", caps, 800, 400); + final RenderState rs = RenderState.createRenderState(SVertex.factory()); - GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, Region.VARWEIGHT_RENDERING_BIT, 0, false, false); + final GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (rs, Region.VARWEIGHT_RENDERING_BIT, 0, false, false); demo01Listener.attachInputListenerTo(window); window.addGLEventListener(demo01Listener); - RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion02"); + final RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion02"); window.addGLEventListener(listener); listener.setTech(-20, 00, -300, 0f, 2); @@ -211,24 +213,24 @@ public class TestRegionRendererNEWT01 extends UITestCase { @Test public void test20RegionRendererR2T01() throws InterruptedException { - if(Platform.CPUFamily.X86 != Platform.CPU_ARCH.family) { // FIXME + if(Platform.CPUFamily.X86 != PlatformPropsImpl.CPU_ARCH.family) { // FIXME // FIXME: Disabled for now - since it doesn't seem fit for mobile (performance wise). System.err.println("disabled on non desktop (x86) arch for now .."); return; } - GLProfile glp = GLProfile.getGL2ES2(); + final GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); //caps.setOnscreen(false); caps.setAlphaBits(4); - GLWindow window = createWindow("shape-vbaa1-msaa0", caps, 800,400); - RenderState rs = RenderState.createRenderState(SVertex.factory()); - GPURegionGLListener02 demo02Listener = new GPURegionGLListener02 (rs, Region.VBAA_RENDERING_BIT, 4, false, false); + final GLWindow window = createWindow("shape-vbaa1-msaa0", caps, 800,400); + final RenderState rs = RenderState.createRenderState(SVertex.factory()); + final GPURegionGLListener02 demo02Listener = new GPURegionGLListener02 (rs, Region.VBAA_RENDERING_BIT, 4, false, false); demo02Listener.attachInputListenerTo(window); window.addGLEventListener(demo02Listener); - RegionGLListener listener = new RegionGLListener(demo02Listener, window.getTitle(), "GPURegionNewtDemo02"); + final RegionGLListener listener = new RegionGLListener(demo02Listener, window.getTitle(), "GPURegionNewtDemo02"); window.addGLEventListener(listener); listener.setTech(-20, 00, -300, 0f, 2); @@ -248,38 +250,38 @@ public class TestRegionRendererNEWT01 extends UITestCase { String name; GPURendererListenerBase01 impl; - public RegionGLListener(GPURendererListenerBase01 impl, String title, String name) { + public RegionGLListener(final GPURendererListenerBase01 impl, final String title, final String name) { this.impl = impl; this.winTitle = title; this.name = name; } - public void setTech(float xt, float yt, int zt, float angle, int sampleCount){ + public void setTech(final float xt, final float yt, final int zt, final float angle, final int sampleCount){ impl.setMatrix(xt, yt, zt, angle, sampleCount); } - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { impl.init(drawable); } - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { impl.display(drawable); try { impl.printScreen(drawable, "./", winTitle, name, false); - } catch (GLException e) { + } catch (final GLException e) { e.printStackTrace(); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } } - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { impl.dispose(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) { impl.reshape(drawable, x, y, width, height); } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java index 2e0be5b79..cc9762fe8 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java @@ -80,13 +80,13 @@ public class TestTextRendererNEWT00 extends UITestCase { static int fontStylebits = 0; static float fontSizeFixed = 14f; - 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 { ManualTest = args.length > 0; for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { @@ -130,7 +130,7 @@ public class TestTextRendererNEWT00 extends UITestCase { System.err.println("Graph MSAA Samples "+GraphMSAASamples); System.err.println("Graph VBAA Samples "+GraphVBAASamples); System.err.println("swapInterval "+SwapInterval); - String tstname = TestTextRendererNEWT00.class.getName(); + final String tstname = TestTextRendererNEWT00.class.getName(); org.junit.runner.JUnitCore.main(tstname); } @@ -141,19 +141,19 @@ public class TestTextRendererNEWT00 extends UITestCase { try { System.err.println("** new frame ** (sleep: "+d+"ms)"); Thread.sleep(d); - } catch (InterruptedException ie) {} + } catch (final InterruptedException ie) {} } - static void destroyWindow(GLWindow window) { + static void destroyWindow(final GLWindow window) { if(null!=window) { window.destroy(); } } - static GLWindow createWindow(String title, GLCapabilitiesImmutable caps, int width, int height) { + static GLWindow createWindow(final String title, final GLCapabilitiesImmutable caps, final int width, final int height) { Assert.assertNotNull(caps); - GLWindow window = GLWindow.create(caps); + final GLWindow window = GLWindow.create(caps); window.setSize(width, height); window.setPosition(10, 10); window.setTitle(title); @@ -195,8 +195,8 @@ public class TestTextRendererNEWT00 extends UITestCase { } public void testImpl(final int sceneMSAASamples, final int graphMSAASamples, final int graphVBAASamples) throws InterruptedException { - GLProfile glp = GLProfile.get(GLProfile.GL2ES2); - GLCapabilities caps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.get(GLProfile.GL2ES2); + final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(4); if( 0 < sceneMSAASamples ) { caps.setSampleBuffers(true); @@ -204,7 +204,7 @@ public class TestTextRendererNEWT00 extends UITestCase { } System.err.println("Requested: "+caps+", graph[msaaSamples "+graphMSAASamples+", vbaaSamples "+graphVBAASamples+"]"); - GLWindow window = createWindow("text-gvbaa"+graphVBAASamples+"-gmsaa"+graphMSAASamples+"-smsaa"+sceneMSAASamples, caps, 1024, 640); + final GLWindow window = createWindow("text-gvbaa"+graphVBAASamples+"-gmsaa"+graphMSAASamples+"-smsaa"+sceneMSAASamples, caps, 1024, 640); window.display(); System.err.println("Chosen: "+window.getChosenGLCapabilities()); if( WaitStartEnd ) { @@ -228,18 +228,18 @@ public class TestTextRendererNEWT00 extends UITestCase { window.addGLEventListener(textGLListener); - Animator anim = new Animator(); + final Animator anim = new Animator(); anim.add(window); anim.start(); anim.setUpdateFPSFrames(60, null); sleep(); window.invoke(true, new GLRunnable() { @Override - public boolean run(GLAutoDrawable drawable) { + public boolean run(final GLAutoDrawable drawable) { try { textGLListener.printScreen(renderModes, drawable, "./", "TestTextRendererNEWT00-snap"+screenshot_num, false); screenshot_num++; - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } return true; @@ -283,7 +283,7 @@ public class TestTextRendererNEWT00 extends UITestCase { Font _font = null; try { _font = FontFactory.get(getClass(), fontFileName, false); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } font = _font; @@ -305,7 +305,7 @@ public class TestTextRendererNEWT00 extends UITestCase { } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { super.init(drawable); drawable.getGL().setSwapInterval(SwapInterval); t0 = Platform.currentTimeMillis(); @@ -319,7 +319,7 @@ public class TestTextRendererNEWT00 extends UITestCase { } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); screenshot.dispose(gl); regionFPS.destroy(gl); @@ -327,7 +327,7 @@ public class TestTextRendererNEWT00 extends UITestCase { super.dispose(drawable); } - public void printScreen(int renderModes, GLAutoDrawable drawable, String dir, String objName, boolean exportAlpha) throws GLException, IOException { + public void printScreen(final int renderModes, final GLAutoDrawable drawable, final String dir, final String objName, final boolean exportAlpha) throws GLException, IOException { final String modeS = Region.getRenderModeString(renderModes); final String bname = String.format("%s-msaa%02d-fontsz%02.1f-%03dx%03d-%s%04d", objName, drawable.getChosenGLCapabilities().getNumSamples(), @@ -348,7 +348,7 @@ public class TestTextRendererNEWT00 extends UITestCase { } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java index 247ba69b3..a96c1e926 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java @@ -37,6 +37,8 @@ import javax.media.opengl.GLCapabilitiesImmutable; import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; +import jogamp.common.os.PlatformPropsImpl; + import org.junit.Assert; import org.junit.Test; import org.junit.FixMethodOrder; @@ -58,20 +60,20 @@ public class TestTextRendererNEWT01 extends UITestCase { static final boolean TRACE = false; static long duration = 100; // ms - 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<args.length; i++) { if(args[i].equals("-time")) { i++; duration = atoi(args[i]); } } - String tstname = TestTextRendererNEWT01.class.getName(); + final String tstname = TestTextRendererNEWT01.class.getName(); org.junit.runner.JUnitCore.main(tstname); } @@ -79,19 +81,19 @@ public class TestTextRendererNEWT01 extends UITestCase { try { System.err.println("** new frame ** (sleep: "+duration+"ms)"); Thread.sleep(duration); - } catch (InterruptedException ie) {} + } catch (final InterruptedException ie) {} } - static void destroyWindow(GLWindow window) { + static void destroyWindow(final GLWindow window) { if(null!=window) { window.destroy(); } } - static GLWindow createWindow(String title, GLCapabilitiesImmutable caps, int width, int height) { + static GLWindow createWindow(final String title, final GLCapabilitiesImmutable caps, final int width, final int height) { Assert.assertNotNull(caps); - GLWindow window = GLWindow.create(caps); + final GLWindow window = GLWindow.create(caps); window.setSize(width, height); window.setPosition(10, 10); window.setTitle(title); @@ -103,23 +105,23 @@ public class TestTextRendererNEWT01 extends UITestCase { @Test public void testTextRendererR2T01() throws InterruptedException { - if(Platform.CPUFamily.X86 != Platform.CPU_ARCH.family) { // FIXME + if(Platform.CPUFamily.X86 != PlatformPropsImpl.CPU_ARCH.family) { // FIXME // FIXME: Disabled for now - since it doesn't seem fit for mobile (performance wise). System.err.println("disabled on non desktop (x86) arch for now .."); return; } - GLProfile glp = GLProfile.getGL2ES2(); + final GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(4); System.err.println("Requested: "+caps); - GLWindow window = createWindow("text-vbaa1-msaa0", caps, 800,400); + final GLWindow window = createWindow("text-vbaa1-msaa0", caps, 800,400); window.display(); System.err.println("Chosen: "+window.getChosenGLCapabilities()); - RenderState rs = RenderState.createRenderState(SVertex.factory()); - TextGLListener textGLListener = new TextGLListener(rs, Region.VBAA_RENDERING_BIT, DEBUG, TRACE); + final RenderState rs = RenderState.createRenderState(SVertex.factory()); + final TextGLListener textGLListener = new TextGLListener(rs, Region.VBAA_RENDERING_BIT, DEBUG, TRACE); textGLListener.attachInputListenerTo(window); window.addGLEventListener(textGLListener); @@ -156,19 +158,19 @@ public class TestTextRendererNEWT01 extends UITestCase { @Test public void testTextRendererMSAA01() throws InterruptedException { - GLProfile glp = GLProfile.get(GLProfile.GL2ES2); - GLCapabilities caps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.get(GLProfile.GL2ES2); + final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(4); caps.setSampleBuffers(true); caps.setNumSamples(4); System.err.println("Requested: "+caps); - GLWindow window = createWindow("text-vbaa0-msaa1", caps, 800, 400); + final GLWindow window = createWindow("text-vbaa0-msaa1", caps, 800, 400); window.display(); System.err.println("Chosen: "+window.getChosenGLCapabilities()); - RenderState rs = RenderState.createRenderState(SVertex.factory()); - TextGLListener textGLListener = new TextGLListener(rs, 0, DEBUG, TRACE); + final RenderState rs = RenderState.createRenderState(SVertex.factory()); + final TextGLListener textGLListener = new TextGLListener(rs, 0, DEBUG, TRACE); textGLListener.attachInputListenerTo(window); window.addGLEventListener(textGLListener); @@ -206,22 +208,22 @@ public class TestTextRendererNEWT01 extends UITestCase { private class TextGLListener extends GPUTextRendererListenerBase01 { String winTitle; - public TextGLListener(RenderState rs, int type, boolean debug, boolean trace) { + public TextGLListener(final RenderState rs, final int type, final boolean debug, final boolean trace) { super(rs, type, 4, true, debug, trace); } - public void attachInputListenerTo(GLWindow window) { + public void attachInputListenerTo(final GLWindow window) { super.attachInputListenerTo(window); winTitle = window.getTitle(); } - public void setTech(float xt, float yt, float angle, int zoom, int sampleCount){ + public void setTech(final float xt, final float yt, final float angle, final int zoom, final int sampleCount){ setMatrix(xt, yt, zoom, angle, sampleCount); } - 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(); gl.setSwapInterval(1); gl.glEnable(GL.GL_DEPTH_TEST); @@ -229,14 +231,14 @@ public class TestTextRendererNEWT01 extends UITestCase { rs.setColorStatic(0.1f, 0.1f, 0.1f, 1.0f); } - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { super.display(drawable); try { printScreen(drawable, "./", winTitle, false); - } catch (GLException e) { + } catch (final GLException e) { e.printStackTrace(); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java index de71f65d3..cb9f3e3d4 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java @@ -73,13 +73,13 @@ public class TestTextRendererNEWT10 extends UITestCase { font = FontFactory.get(FontFactory.UBUNTU).getDefault(); } - 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 { mainRun = true; for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { @@ -93,7 +93,7 @@ public class TestTextRendererNEWT10 extends UITestCase { forceGL3 = true; } } - String tstname = TestTextRendererNEWT10.class.getName(); + final String tstname = TestTextRendererNEWT10.class.getName(); org.junit.runner.JUnitCore.main(tstname); } @@ -101,7 +101,7 @@ public class TestTextRendererNEWT10 extends UITestCase { try { System.err.println("** new frame ** (sleep: "+duration+"ms)"); Thread.sleep(duration); - } catch (InterruptedException ie) {} + } catch (final InterruptedException ie) {} } // @Test @@ -114,7 +114,7 @@ public class TestTextRendererNEWT10 extends UITestCase { testTextRendererImpl(4); } - void testTextRendererImpl(int sampleCount) throws InterruptedException { + void testTextRendererImpl(final int sampleCount) throws InterruptedException { final GLProfile glp; if(forceGL3) { glp = GLProfile.get(GLProfile.GL3); @@ -180,7 +180,7 @@ public class TestTextRendererNEWT10 extends UITestCase { int lastRow = -1; - void renderString(GLDrawable drawable, GL2ES2 gl, RegionRenderer renderer, TextRegionUtil textRenderUtil, String text, int column, int row, int z0) { + void renderString(final GLDrawable drawable, final GL2ES2 gl, final RegionRenderer renderer, final TextRegionUtil textRenderUtil, final String text, final int column, int row, final int z0) { final int height = drawable.getSurfaceHeight(); int dx = 0; @@ -188,7 +188,7 @@ public class TestTextRendererNEWT10 extends UITestCase { if(0>row) { 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 { * </p> * @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)}. * </p> */ - 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)}. * </p> */ - 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<OutlineShape> outlineShapes = new ArrayList<OutlineShape>(); - 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; i<buttons.size(); i++) { buttons.get(i).translate(tx, ty, tz); } } - private void setButtonsSpacing(float dx, float dy) { + private void setButtonsSpacing(final float dx, final float dy) { for(int i=0; i<buttons.size(); i++) { final RoundButton b = buttons.get(i); if( b instanceof LabelButton ) { @@ -188,7 +188,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { } } - private void setButtonsCorner(float dc) { + private void setButtonsCorner(final float dc) { for(int i=0; i<buttons.size(); i++) { final float c = buttons.get(i).getCorner()+dc; System.err.println("Corner: "+c); @@ -224,7 +224,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) { if( null != labels[currentText] ) { labels[currentText].setEnabled(false); } @@ -243,7 +243,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.setToggle(fpsLabel.isEnabled()); button.addMouseListener(new UIShape.MouseGestureAdapter() { @Override - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { final GLAnimatorControl a = cDrawable.getAnimator(); if( null != a ) { a.resetFPSCounter(); @@ -259,11 +259,11 @@ public class GPUUISceneGLListener0A implements GLEventListener { button.setToggle(gl.getSwapInterval()>0); 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<? extends Vertex> factory, int renderModes, float width, float height, float linewidth) { + public CrossHair(final Factory<? extends Vertex> 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<? extends Vertex> factory, int renderModes, Font font, float pixelSize, String text) { + public Label(final Factory<? extends Vertex> 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<UIShape> 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<shapes.size(); i++) { @@ -121,7 +121,7 @@ public class SceneUIController implements GLEventListener{ public final float[] getScenePlaneOrigin() { return scenePlaneOrigin; } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { System.err.println("SceneUIController: init"); cDrawable = drawable; } @@ -171,7 +171,7 @@ public class SceneUIController implements GLEventListener{ @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); @@ -209,7 +209,7 @@ public class SceneUIController implements GLEventListener{ } cDrawable.invoke(false, new GLRunnable() { @Override - public boolean run(GLAutoDrawable drawable) { + public boolean run(final GLAutoDrawable drawable) { shape[0] = pickShapeImpl(glWinX, glWinY, objPos); if( null != shape[0] ) { runnable.run(); @@ -267,7 +267,7 @@ public class SceneUIController implements GLEventListener{ } cDrawable.invoke(false, new GLRunnable() { @Override - public boolean run(GLAutoDrawable drawable) { + public boolean run(final GLAutoDrawable drawable) { if( windowToShapeCoordsImpl(activeShape, glWinX, glWinY, objPos) ) { runnable.run(); } @@ -294,7 +294,7 @@ public class SceneUIController implements GLEventListener{ } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { System.err.println("SceneUIController: dispose"); final GL2ES2 gl = drawable.getGL().getGL2ES2(); for(int i=0; i<shapes.size(); i++) { @@ -306,14 +306,14 @@ public class SceneUIController 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] = FloatUtil.getOrthoWinZ(orthoDist, zNear, zFar); pmv.gluUnProject(orthoX, orthoY, winZ[0], view, 0, objPos, 0); } @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) { viewport[0] = x; viewport[1] = y; viewport[2] = width; @@ -448,7 +448,7 @@ public class SceneUIController implements GLEventListener{ } @Override - public void mouseReleased(MouseEvent e) { + public void mouseReleased(final MouseEvent e) { // flip to GL window coordinates final int glWinX = e.getX(); final int glWinY = viewport[3] - e.getY() - 1; @@ -496,7 +496,7 @@ public class SceneUIController implements GLEventListener{ } @Override - public void mouseMoved(MouseEvent e) { + public void mouseMoved(final MouseEvent e) { if( -1 == lId || e.getPointerId(0) == lId ) { lx = e.getX(); ly = e.getY(); @@ -504,9 +504,9 @@ public class SceneUIController implements GLEventListener{ } } @Override - public void mouseEntered(MouseEvent e) { } + public void mouseEntered(final MouseEvent e) { } @Override - public void mouseExited(MouseEvent e) { + public void mouseExited(final MouseEvent e) { release(); clear(); } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TextureSeqButton.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TextureSeqButton.java index 2a5212566..25134edf6 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TextureSeqButton.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/TextureSeqButton.java @@ -57,7 +57,7 @@ public class TextureSeqButton extends RoundButton { public final TextureSequence getTextureSequence() { return this.texSeq; } @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, 0f); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java index c57f65567..65031d7a0 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java @@ -45,7 +45,7 @@ import com.jogamp.opengl.util.PMVMatrix; public class UIGLListener01 extends UIListenerBase01 { - public UIGLListener01 (int renderModes, RenderState rs, boolean debug, boolean trace) { + public UIGLListener01 (final int renderModes, final RenderState rs, final boolean debug, final boolean trace) { super(renderModes, RegionRenderer.create(rs, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable), debug, trace); setMatrix(-20, 00, 0f, -50); try { @@ -59,28 +59,28 @@ public class UIGLListener01 extends UIListenerBase01 { button.setSpacing(2.0f); */ System.err.println(button); - } catch (IOException ex) { + } catch (final IOException ex) { System.err.println("Caught: "+ex.getMessage()); ex.printStackTrace(); } } @Override - 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(); gl.setSwapInterval(1); - gl.glEnable(GL2ES2.GL_DEPTH_TEST); - gl.glEnable(GL2ES2.GL_POLYGON_OFFSET_FILL); + gl.glEnable(GL.GL_DEPTH_TEST); + gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); MSAATool.dump(drawable); } @Override - 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); @@ -99,7 +99,7 @@ public class UIGLListener01 extends UIListenerBase01 { } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); button.destroy(gl, getRegionRenderer()); super.dispose(drawable); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java index a2bc57a8b..796ed2513 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java @@ -83,7 +83,7 @@ public abstract class UIListenerBase01 implements GLEventListener { boolean ignoreInput = false; - public UIListenerBase01(int renderModes, RegionRenderer rRenderer, boolean debug, boolean trace) { + public UIListenerBase01(final int renderModes, final RegionRenderer rRenderer, final boolean debug, final boolean trace) { this.renderModes = renderModes; this.rRenderer = rRenderer; this.debug = debug; @@ -98,14 +98,14 @@ public abstract class UIListenerBase01 implements GLEventListener { public final float getAngle() { return ang; } public final float[] getPosition() { return position; } - public void setMatrix(float xtrans, float ytrans, float angle, int zoom) { + public void setMatrix(final float xtrans, final float ytrans, final float angle, final int zoom) { this.xTran = xtrans; this.yTran = ytrans; this.ang = angle; this.zoom = zoom; } - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { autoDrawable = drawable; GL2ES2 gl = drawable.getGL().getGL2ES2(); if(debug) { @@ -118,32 +118,32 @@ public abstract class UIListenerBase01 implements GLEventListener { getRegionRenderer().init(gl, renderModes); } - public void reshape(GLAutoDrawable drawable, int xstart, int ystart, int width, int height) { - GL2ES2 gl = drawable.getGL().getGL2ES2(); + public void reshape(final GLAutoDrawable drawable, final int xstart, final int ystart, final int width, final int height) { + final GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.glViewport(xstart, ystart, width, height); rRenderer.reshapePerspective(45.0f, width, height, 0.1f, 7000.0f); dumpMatrix(); } - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { autoDrawable = null; - GL2ES2 gl = drawable.getGL().getGL2ES2(); + final GL2ES2 gl = drawable.getGL().getGL2ES2(); screenshot.dispose(gl); rRenderer.destroy(gl); } - public void zoom(int v){ + public void zoom(final int v){ zoom += 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(); @@ -154,7 +154,7 @@ public abstract class UIListenerBase01 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); @@ -165,7 +165,7 @@ public abstract class UIListenerBase01 implements GLEventListener { } } - public void detachFrom(GLWindow window) { + public void detachFrom(final GLWindow window) { if ( null == keyAction ) { return; } @@ -177,9 +177,9 @@ public abstract class UIListenerBase01 implements GLEventListener { window.removeMouseListener(mouseAction); } - 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-T%04d-%s", drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), (int)Math.abs(zoom), 0, objName); final String filename = dir + tech + sw +".png"; @@ -190,7 +190,7 @@ public abstract class UIListenerBase01 implements GLEventListener { int screenshot_num = 0; - public void setIgnoreInput(boolean v) { + public void setIgnoreInput(final boolean v) { ignoreInput = v; } public boolean getIgnoreInput() { @@ -199,37 +199,37 @@ public abstract class UIListenerBase01 implements GLEventListener { public class MouseAction implements MouseListener{ - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { } - public void mouseEntered(MouseEvent e) { + public void mouseEntered(final MouseEvent e) { } - public void mouseExited(MouseEvent e) { + public void mouseExited(final MouseEvent e) { } - public void mousePressed(MouseEvent e) { + public void mousePressed(final MouseEvent e) { button.setLabelColor(0.8f,0.8f,0.8f); button.setColor(0.1f, 0.1f, 0.1f, 1.0f); } - public void mouseReleased(MouseEvent e) { + public void mouseReleased(final MouseEvent e) { button.setLabelColor(1.0f,1.0f,1.0f); button.setColor(0.6f,0.6f,0.6f, 1.0f); } - public void mouseMoved(MouseEvent e) { + public void mouseMoved(final MouseEvent e) { // TODO Auto-generated method stub } - public void mouseDragged(MouseEvent e) { + public void mouseDragged(final MouseEvent e) { // TODO Auto-generated method stub } - public void mouseWheelMoved(MouseEvent e) { + public void mouseWheelMoved(final MouseEvent e) { // TODO Auto-generated method stub } @@ -237,7 +237,7 @@ public abstract class UIListenerBase01 implements GLEventListener { } public class KeyAction implements KeyListener { - public void keyPressed(KeyEvent arg0) { + public void keyPressed(final KeyEvent arg0) { if(ignoreInput) { return; } @@ -285,8 +285,8 @@ public abstract class UIListenerBase01 implements GLEventListener { else if(arg0.getKeyCode() == KeyEvent.VK_V) { if(null != autoDrawable) { autoDrawable.invoke(false, new GLRunnable() { - 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); @@ -304,14 +304,14 @@ public abstract class UIListenerBase01 implements GLEventListener { rotate(-1); if(null != autoDrawable) { autoDrawable.invoke(false, new GLRunnable() { - public boolean run(GLAutoDrawable drawable) { + public boolean run(final GLAutoDrawable drawable) { try { final String type = Region.getRenderModeString(renderModes); 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; @@ -320,6 +320,6 @@ public abstract class UIListenerBase01 implements GLEventListener { } } } - public void keyReleased(KeyEvent arg0) {} + public void keyReleased(final KeyEvent arg0) {} } } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java index 27a91befc..cd74f194c 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java @@ -51,9 +51,9 @@ public class UINewtDemo01 { static final boolean DEBUG = false; static final boolean TRACE = false; - public static void main(String[] args) { - GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); + public static void main(final String[] args) { + final GLProfile glp = GLProfile.getGL2ES2(); + final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(4); caps.setSampleBuffers(true); caps.setNumSamples(4); @@ -63,8 +63,8 @@ public class UINewtDemo01 { window.setPosition(10, 10); window.setSize(800, 400); window.setTitle("GPU UI Newt Demo 01"); - RenderState rs = RenderState.createRenderState(SVertex.factory()); - UIGLListener01 uiGLListener = new UIGLListener01 (0, rs, DEBUG, TRACE); + final RenderState rs = RenderState.createRenderState(SVertex.factory()); + final UIGLListener01 uiGLListener = new UIGLListener01 (0, rs, DEBUG, TRACE); uiGLListener.attachInputListenerTo(window); window.addGLEventListener(uiGLListener); window.setVisible(true); @@ -74,14 +74,14 @@ public class UINewtDemo01 { 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/ui/UIShape.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShape.java index e3513d40d..3b8c71ed0 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShape.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShape.java @@ -97,14 +97,14 @@ public abstract class UIShape { public final Vertex.Factory<? extends Vertex> 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()<duration) { try { Thread.sleep(100); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } } @@ -142,7 +142,7 @@ public abstract class InitConcurrentBaseNEWT extends UITestCase { public boolean done() { return done; } } - protected static boolean done(JOGLTask[] tasks) { + protected static boolean done(final JOGLTask[] tasks) { for(int i=tasks.length-1; i>=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; i<tasks.length; i++) { if(i>0) { @@ -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; i<threads.length; i++) { if(i>0) { @@ -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<args.length; i++) { if(args[i].equals("-time")) { i++; try { durationPerTest = Long.parseLong(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } else if(args[i].equals("-loops")) { i++; addRemoveCount = MiscUtils.atoi(args[i], addRemoveCount); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove02GLWindowNewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove02GLWindowNewtCanvasAWT.java index be8dd3d46..7a26c0282 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove02GLWindowNewtCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove02GLWindowNewtCanvasAWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.acore; import java.awt.AWTException; @@ -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; @@ -88,45 +89,45 @@ public class TestAddRemove02GLWindowNewtCanvasAWT extends UITestCase { @AfterClass public static void releaseClass() { } - - protected JPanel create(final JFrame[] top, final int width, final int height, final int num) - throws InterruptedException, InvocationTargetException + + protected JPanel create(final JFrame[] top, final int width, final int height, final int num) + throws InterruptedException, InvocationTargetException { final JPanel[] jPanel = new JPanel[] { null }; SwingUtilities.invokeAndWait(new Runnable() { public void run() { jPanel[0] = new JPanel(); jPanel[0].setLayout(new BorderLayout()); - + 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); - + top[0] = jFrame1; } } ); - return jPanel[0]; + return jPanel[0]; } - protected void add(final Container cont, final Component comp) - throws InterruptedException, InvocationTargetException + protected void add(final Container cont, final Component comp) + throws InterruptedException, InvocationTargetException { SwingUtilities.invokeAndWait(new Runnable() { public void run() { - cont.add(comp, BorderLayout.CENTER); + cont.add(comp, BorderLayout.CENTER); } } ); } - - protected void dispose(final GLCanvas glc) - throws InterruptedException, InvocationTargetException + + protected void dispose(final GLCanvas glc) + throws InterruptedException, InvocationTargetException { SwingUtilities.invokeAndWait(new Runnable() { public void run() { - glc.destroy(); + glc.destroy(); } } ); } - + protected void setVisible(final JFrame jFrame, final boolean visible) throws InterruptedException, InvocationTargetException { SwingUtilities.invokeAndWait(new Runnable() { public void run() { @@ -135,54 +136,54 @@ public class TestAddRemove02GLWindowNewtCanvasAWT extends UITestCase { jFrame.validate(); } jFrame.setVisible(visible); - } } ) ; + } } ) ; } - + protected void dispose(final JFrame jFrame) throws InterruptedException, InvocationTargetException { SwingUtilities.invokeAndWait(new Runnable() { public void run() { jFrame.dispose(); - } } ) ; + } } ) ; } - - 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 { for(int i=0; i<addRemoveOpCount; i++) { System.err.println("Loop # "+i+" / "+addRemoveCount); final GLWindow glw = GLWindow.create(caps); - Assert.assertNotNull(glw); + Assert.assertNotNull(glw); final NewtCanvasAWT glc = new NewtCanvasAWT(glw); Assert.assertNotNull(glc); 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); final GearsES2 gears = new GearsES2(1); gears.setVerbose(false); glw.addGLEventListener(gears); - + final JFrame[] top = new JFrame[] { null }; final Container glcCont = create(top, width, height, i); add(glcCont, glc); - + setVisible(top[0], true); - + final long t0 = System.currentTimeMillis(); do { glw.display(); Thread.sleep(10); } while ( ( System.currentTimeMillis() - t0 ) < durationPerTest ) ; - + System.err.println("GLCanvas isOffscreenLayerSurfaceEnabled: "+glc.isOffscreenLayerSurfaceEnabled()+": "+glw.getChosenGLCapabilities()); - + dispose(top[0]); glw.destroy(); - + if( 0 < pauseEach && 0 == i % pauseEach ) { System.err.println("******* P A U S E ********"); Thread.sleep(pauseDuration); @@ -190,7 +191,7 @@ public class TestAddRemove02GLWindowNewtCanvasAWT extends UITestCase { } if(waitForKeyPost) { UITestCase.waitForKey("End"); - } + } } @Test @@ -201,7 +202,7 @@ public class TestAddRemove02GLWindowNewtCanvasAWT extends UITestCase { System.err.println("No onscreen test requested or platform doesn't support onscreen rendering."); return; } - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(true, caps, addRemoveCount); } @@ -217,10 +218,10 @@ public class TestAddRemove02GLWindowNewtCanvasAWT extends UITestCase { System.err.println("Only PBuffer test is requested."); return; } - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(false, caps, addRemoveCount); } - + @Test public void test03OffscreenPBuffer() throws AWTException, InterruptedException, InvocationTargetException @@ -233,19 +234,19 @@ public class TestAddRemove02GLWindowNewtCanvasAWT extends UITestCase { System.err.println("Only FBO test is requested."); return; } - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); 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<args.length; i++) { if(args[i].equals("-time")) { i++; try { durationPerTest = Long.parseLong(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } else if(args[i].equals("-loops")) { i++; addRemoveCount = MiscUtils.atoi(args[i], addRemoveCount); @@ -267,15 +268,15 @@ public class TestAddRemove02GLWindowNewtCanvasAWT extends UITestCase { waitForKey = true; } else if(args[i].equals("-waitPost")) { waitForKeyPost = true; - } + } } System.err.println("waitForKey "+waitForKey); System.err.println("waitForKeyPost "+waitForKeyPost); - + System.err.println("addRemoveCount "+addRemoveCount); System.err.println("pauseEach "+pauseEach); - System.err.println("pauseDuration "+pauseDuration); - + System.err.println("pauseDuration "+pauseDuration); + System.err.println("noOnscreenTest "+noOnscreenTest); System.err.println("noOffscreenTest "+noOffscreenTest); System.err.println("offscreenPBufferOnly "+offscreenPBufferOnly); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove03GLWindowNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove03GLWindowNEWT.java index d99475442..70aa4dff3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove03GLWindowNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove03GLWindowNEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; @@ -71,33 +71,33 @@ public class TestAddRemove03GLWindowNEWT extends UITestCase { @AfterClass public static void releaseClass() { } - - protected void runTestGL(GLCapabilities caps, int addRemoveOpCount) + + protected void runTestGL(final GLCapabilities caps, final int addRemoveOpCount) throws InterruptedException, InvocationTargetException { for(int i=0; i<addRemoveOpCount; i++) { System.err.println("Loop # "+i+" / "+addRemoveCount); final GLWindow glw = GLWindow.create(caps); - Assert.assertNotNull(glw); + Assert.assertNotNull(glw); glw.setTitle("GLWindow #"+i); glw.setSize(width, height); final GearsES2 gears = new GearsES2(1); gears.setVerbose(false); glw.addGLEventListener(gears); - + glw.setVisible(true); - + final long t0 = System.currentTimeMillis(); do { glw.display(); Thread.sleep(10); } while ( ( System.currentTimeMillis() - t0 ) < durationPerTest ) ; - + System.err.println("GLWindow: "+glw.getChosenGLCapabilities()); - + glw.destroy(); - + if( 0 < pauseEach && 0 == i % pauseEach ) { System.err.println("******* P A U S E ********"); Thread.sleep(pauseDuration); @@ -109,17 +109,17 @@ public class TestAddRemove03GLWindowNEWT extends UITestCase { public void test01Onscreen() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps, addRemoveCount); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { durationPerTest = Long.parseLong(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } else if(args[i].equals("-loops")) { i++; addRemoveCount = MiscUtils.atoi(args[i], addRemoveCount); @@ -131,14 +131,14 @@ public class TestAddRemove03GLWindowNEWT extends UITestCase { pauseDuration = MiscUtils.atoi(args[i], pauseDuration); } else if(args[i].equals("-wait")) { waitForKey = true; - } + } } System.err.println("waitForKey "+waitForKey); - + System.err.println("addRemoveCount "+addRemoveCount); System.err.println("pauseEach "+pauseEach); - System.err.println("pauseDuration "+pauseDuration); - + System.err.println("pauseDuration "+pauseDuration); + if(waitForKey) { UITestCase.waitForKey("Start"); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext01NEWT.java index d61ac9ab3..c17f669ee 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug669RecursiveGLContext01NEWT.java @@ -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. @@ -47,12 +47,12 @@ import com.jogamp.opengl.util.Animator; /** * Tests simple recursive GLContext behavior. - * + * * <p> * Issues {@link GLContext#makeCurrent()} and {@link GLContext#release()} * from within {@link GLEventListener#display(GLAutoDrawable)}. - * </p> - * + * </p> + * * <https://jogamp.org/bugzilla/show_bug.cgi?id=669> */ @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. - * + * * <p> - * Issues {@link GLAutoDrawable#display()} of another {@link GLAutoDrawable} + * Issues {@link GLAutoDrawable#display()} of another {@link GLAutoDrawable} * from within {@link GLEventListener#display(GLAutoDrawable)}. * </p> - * + * * <https://jogamp.org/bugzilla/show_bug.cgi?id=669> */ @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<args.length; i++) {
if(args[i].equals("-time")) {
duration = MiscUtils.atoi(args[++i], (int)duration);
}
}
- String tstname = TestBug692GL3VAONEWT.class.getName();
+ final String tstname = TestBug692GL3VAONEWT.class.getName();
org.junit.runner.JUnitCore.main(tstname);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestCPUSourcingAPINEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestCPUSourcingAPINEWT.java index 388c57904..fe598db35 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestCPUSourcingAPINEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestCPUSourcingAPINEWT.java @@ -36,6 +36,7 @@ import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.util.GLBuffers; +import javax.media.opengl.GL; import javax.media.opengl.GL2; import javax.media.opengl.GL2ES2; import javax.media.opengl.GLAutoDrawable; @@ -71,11 +72,11 @@ public class TestCPUSourcingAPINEWT extends UITestCase { private int fragID = -1; private int progID = -1; - private static int createShader(final GL2ES2 gl, int type, + private static int createShader(final GL2ES2 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(); } @@ -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<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableDeadlockAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableDeadlockAWT.java index 1548c08b5..2559fe363 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableDeadlockAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableDeadlockAWT.java @@ -60,7 +60,7 @@ public class TestFBOAutoDrawableDeadlockAWT extends UITestCase { height = 512; } - protected void runTestGL( GLCapabilities caps ) throws InterruptedException, InvocationTargetException { + protected void runTestGL( final GLCapabilities caps ) throws InterruptedException, InvocationTargetException { final GLOffscreenAutoDrawable fbod = GLDrawableFactory.getFactory(caps.getGLProfile()).createOffscreenAutoDrawable( null, caps, new DefaultGLCapabilitiesChooser(), 512, 512); @@ -88,7 +88,7 @@ public class TestFBOAutoDrawableDeadlockAWT extends UITestCase { System.err.println("BB.2"); rTask.getSyncObject().wait(); System.err.println("BB.3"); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { throw new RuntimeException(e); } System.err.println("BB.X"); @@ -104,20 +104,20 @@ public class TestFBOAutoDrawableDeadlockAWT extends UITestCase { @Test(timeout = 2000) // 2s timeout public void testDeadlock() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities( glp ); + final GLCapabilities caps = new GLCapabilities( glp ); 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 < args.length; i++ ) { if ( args[ i ].equals( "-time" ) ) { i++; try { duration = Integer.parseInt( args[ i ] ); } - catch ( Exception ex ) { + catch ( final Exception ex ) { ex.printStackTrace(); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java index 387000b16..a0a5e8969 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java @@ -141,7 +141,7 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase { } } - void testGLFBODrawableImpl(GLCapabilities caps, GLEventListener demo) throws InterruptedException { + void testGLFBODrawableImpl(final GLCapabilities caps, final GLEventListener demo) throws InterruptedException { caps.setFBO(true); final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile()); final GLOffscreenAutoDrawable.FBO glad = (GLOffscreenAutoDrawable.FBO) @@ -233,24 +233,24 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase { if( chosenCaps.getNumSamples() > 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<durationPerTest; i+=50) { // pass 1 - MRT: Red -> 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atoi(args[++i], (int)durationPerTest); } } - String tstname = TestFBOMRTNEWT01.class.getName(); + final String tstname = TestFBOMRTNEWT01.class.getName(); org.junit.runner.JUnitCore.main(tstname); System.err.println("main - end"); - } + } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java index d337bf938..f8feefdcf 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.acore; import java.io.BufferedReader; @@ -61,7 +61,7 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestFBOMix2DemosES2NEWT extends UITestCase { +public class TestFBOMix2DemosES2NEWT extends UITestCase { static long duration = 500; // ms static int swapInterval = 1; static boolean showFPS = false; @@ -70,19 +70,19 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase { static boolean demo0Only = false; static int globalNumSamples = 0; static boolean mainRun = false; - + @AfterClass public static void releaseClass() { } - protected void runTestGL(GLCapabilitiesImmutable caps, int numSamples) throws InterruptedException { + protected void runTestGL(final GLCapabilitiesImmutable caps, final int numSamples) throws InterruptedException { final GLReadBufferUtil screenshot = new GLReadBufferUtil(true, false); System.err.println("requested: vsync "+swapInterval+", "+caps); final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setTitle("Gears NEWT Test (translucent "+!caps.isBackgroundOpaque()+"), swapInterval "+swapInterval); if(mainRun) { - glWindow.setSize(512, 512); + glWindow.setSize(512, 512); } else { glWindow.setSize(128, 128); } @@ -95,50 +95,50 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase { glWindow.addGLEventListener(new GLEventListener() { int i=0, c=0; int origS; - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { origS = demo.getMSAA(); } - public void dispose(GLAutoDrawable drawable) {} - public void display(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) {} + public void display(final GLAutoDrawable drawable) { if(mainRun) return; - + final int dw = drawable.getSurfaceWidth(); final int dh = drawable.getSurfaceHeight(); c++; - + if(dw<800) { System.err.println("XXX: "+dw+"x"+dh+", c "+c); if(0 == c%3) { - snapshot(i++, "msaa"+demo.getMSAA(), drawable.getGL(), screenshot, TextureIO.PNG, null); + snapshot(i++, "msaa"+demo.getMSAA(), drawable.getGL(), screenshot, TextureIO.PNG, null); } if( 3 == c ) { - new Thread() { + new Thread() { @Override public void run() { demo.setMSAA(4); } }.start(); } else if( 6 == c ) { - new Thread() { + new Thread() { @Override public void run() { demo.setMSAA(8); } }.start(); } else if(9 == c) { c=0; - new Thread() { + new Thread() { @Override public void run() { glWindow.setSize(dw+256, dh+256); demo.setMSAA(origS); - } }.start(); + } }.start(); } } } - 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) { } }); - - 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)); @@ -146,19 +146,19 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase { glWindow.addWindowListener(quitAdapter); glWindow.addWindowListener(new WindowAdapter() { - public void windowResized(WindowEvent e) { + public void windowResized(final WindowEvent e) { System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } - public void windowMoved(WindowEvent e) { + public void windowMoved(final WindowEvent e) { System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); - } + } }); - + glWindow.addKeyListener(new KeyAdapter() { - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { if( !e.isPrintableKey() || e.isAutoRepeat() ) { return; - } + } System.err.println("*** "+e); if(e.getKeyChar()=='f') { new Thread() { @@ -170,11 +170,11 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase { } else if(e.getKeyChar()=='d') { demo.setDemo0Only(!demo.getDemo0Only()); } else { - int num = e.getKeyChar() - '0'; + final int num = e.getKeyChar() - '0'; System.err.println("*** "+num); if(0 <= num && num <= 8) { System.err.println("MSAA: "+demo.getMSAA()+" -> "+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()<duration) { Thread.sleep(100); } @@ -205,25 +205,25 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase { @Test public void test01_Main() throws InterruptedException { if( mainRun ) { - GLCapabilities caps = new GLCapabilities(forceES2 ? GLProfile.get(GLProfile.GLES2) : GLProfile.getGL2ES2()); + final GLCapabilities caps = new GLCapabilities(forceES2 ? GLProfile.get(GLProfile.GLES2) : GLProfile.getGL2ES2()); caps.setAlphaBits(1); - runTestGL(caps, globalNumSamples); + runTestGL(caps, globalNumSamples); } } - + @Test public void test01() throws InterruptedException { if( mainRun ) return ; - GLCapabilities caps = new GLCapabilities(forceES2 ? GLProfile.get(GLProfile.GLES2) : GLProfile.getGL2ES2()); + final GLCapabilities caps = new GLCapabilities(forceES2 ? GLProfile.get(GLProfile.GLES2) : GLProfile.getGL2ES2()); caps.setAlphaBits(1); runTestGL(caps, 0); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { boolean waitForKey = false; - + mainRun = true; - + for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; @@ -248,16 +248,16 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase { mainRun = false; } } - + System.err.println("swapInterval "+swapInterval); System.err.println("forceES2 "+forceES2); 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(TestFBOMix2DemosES2NEWT.class.getName()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java index 8a833be05..e1e1c3fbc 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java @@ -107,7 +107,7 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase { public static void releaseClass() { } - protected void runTestGL(GLCapabilitiesImmutable caps) throws InterruptedException { + protected void runTestGL(final GLCapabilitiesImmutable caps) throws InterruptedException { final GLReadBufferUtil screenshot = new GLReadBufferUtil(false, false); System.err.println("requested: vsync "+swapInterval+", "+caps); @@ -127,7 +127,7 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase { final int fbod2_texUnit = 1; final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile()); - GLCapabilities fbodCaps = (GLCapabilities) caps.cloneMutable(); + final GLCapabilities fbodCaps = (GLCapabilities) caps.cloneMutable(); // fbodCaps.setDoubleBuffered(false); final Mix2TexturesES2 mixerDemo = new Mix2TexturesES2(1, fbod1_texUnit, fbod2_texUnit); @@ -139,14 +139,14 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase { fbod1.setUpstreamWidget(glWindow); // connect the real GLWindow (mouse/key) to offscreen! fbod1.setTextureUnit(fbod1_texUnit); { - GearsES2 demo0 = new GearsES2(-1); + final GearsES2 demo0 = new GearsES2(-1); fbod1.addGLEventListener(demo0); fbod1.addGLEventListener(new GLFinishOnDisplay()); demo0.setIgnoreFocus(true); } fbod1.getNativeSurface().addSurfaceUpdatedListener(new SurfaceUpdatedListener() { @Override - public void surfaceUpdated(Object updater, NativeSurface ns, long when) { + public void surfaceUpdated(final Object updater, final NativeSurface ns, final long when) { mixerDemo.setTexID0(fbod1.getTextureBuffer(GL.GL_FRONT).getName()); } }); fbod1.display(); // init @@ -162,7 +162,7 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase { fbod2.addGLEventListener(new GLFinishOnDisplay()); fbod2.getNativeSurface().addSurfaceUpdatedListener(new SurfaceUpdatedListener() { @Override - public void surfaceUpdated(Object updater, NativeSurface ns, long when) { + public void surfaceUpdated(final Object updater, final NativeSurface ns, final long when) { mixerDemo.setTexID1(fbod2.getTextureBuffer(GL.GL_FRONT).getName()); } }); fbod2.display(); // init @@ -176,9 +176,9 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase { glWindow.addGLEventListener(mixerDemo); glWindow.addGLEventListener(new GLEventListener() { int i=0, c=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) { if(mainRun) return; final int dw = drawable.getSurfaceWidth(); @@ -200,7 +200,7 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase { } } } - 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) { fbod1.setSurfaceSize(width, height); fbod2.setSurfaceSize(width, height); } @@ -213,7 +213,7 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase { final Animator animator1 = new Animator(); animator1.add(glWindow); - QuitAdapter quitAdapter = new QuitAdapter(); + final QuitAdapter quitAdapter = new QuitAdapter(); //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter)); //glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter)); @@ -221,10 +221,10 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase { glWindow.addWindowListener(quitAdapter); glWindow.addWindowListener(new WindowAdapter() { - public void windowResized(WindowEvent e) { + public void windowResized(final WindowEvent e) { System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } - public void windowMoved(WindowEvent e) { + public void windowMoved(final WindowEvent e) { System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } }); @@ -263,12 +263,12 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase { @Test public void test01() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(forceES2 ? GLProfile.get(GLProfile.GLES2) : GLProfile.getGL2ES2()); + final GLCapabilities caps = new GLCapabilities(forceES2 ? GLProfile.get(GLProfile.GLES2) : GLProfile.getGL2ES2()); caps.setAlphaBits(1); runTestGL(caps); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { boolean waitForKey = false; mainRun = true; @@ -295,11 +295,11 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase { System.err.println("forceES2 "+forceES2); 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(TestFBOOffThreadSharedContextMix2DemosES2NEWT.class.getName()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java index 155162964..c9c156218 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java @@ -105,7 +105,7 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase { public static void releaseClass() { } - protected void runTestGL(GLCapabilitiesImmutable caps) throws InterruptedException { + protected void runTestGL(final GLCapabilitiesImmutable caps) throws InterruptedException { final GLReadBufferUtil screenshot = new GLReadBufferUtil(false, false); System.err.println("requested: vsync "+swapInterval+", "+caps); @@ -124,7 +124,7 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase { final int fbod1_texUnit = 0; final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile()); - GLCapabilities fbodCaps = (GLCapabilities) caps.cloneMutable(); + final GLCapabilities fbodCaps = (GLCapabilities) caps.cloneMutable(); // fbodCaps.setDoubleBuffered(false); final Mix2TexturesES2 mixerDemo = new Mix2TexturesES2(1, fbod1_texUnit, 0); @@ -136,14 +136,14 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase { fbod1.setUpstreamWidget(glWindow); // connect the real GLWindow (mouse/key) to offscreen! fbod1.setTextureUnit(fbod1_texUnit); { - GearsES2 demo0 = new GearsES2(-1); + final GearsES2 demo0 = new GearsES2(-1); fbod1.addGLEventListener(demo0); fbod1.addGLEventListener(new GLFinishOnDisplay()); demo0.setIgnoreFocus(true); } fbod1.getNativeSurface().addSurfaceUpdatedListener(new SurfaceUpdatedListener() { @Override - public void surfaceUpdated(Object updater, NativeSurface ns, long when) { + public void surfaceUpdated(final Object updater, final NativeSurface ns, final long when) { mixerDemo.setTexID0(fbod1.getTextureBuffer(GL.GL_FRONT).getName()); } }); fbod1.display(); // init @@ -155,16 +155,16 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase { glWindow.addWindowListener(new WindowAdapter() { @Override - public void windowResized(WindowEvent e) { + public void windowResized(final WindowEvent e) { fbod1.setSurfaceSize(glWindow.getSurfaceWidth(), glWindow.getSurfaceHeight()); } }); glWindow.addGLEventListener(mixerDemo); glWindow.addGLEventListener(new GLEventListener() { int i=0, c=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) { if(mainRun) return; final int dw = drawable.getSurfaceWidth(); @@ -186,14 +186,14 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase { } } } - 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 Animator animator1 = new Animator(); animator1.add(fbod1); animator1.add(glWindow); - QuitAdapter quitAdapter = new QuitAdapter(); + final QuitAdapter quitAdapter = new QuitAdapter(); //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter)); //glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter)); @@ -201,10 +201,10 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase { glWindow.addWindowListener(quitAdapter); glWindow.addWindowListener(new WindowAdapter() { - public void windowResized(WindowEvent e) { + public void windowResized(final WindowEvent e) { System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } - public void windowMoved(WindowEvent e) { + public void windowMoved(final WindowEvent e) { System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } }); @@ -236,12 +236,12 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase { @Test public void test01() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(forceES2 ? GLProfile.get(GLProfile.GLES2) : GLProfile.getGL2ES2()); + final GLCapabilities caps = new GLCapabilities(forceES2 ? GLProfile.get(GLProfile.GLES2) : GLProfile.getGL2ES2()); caps.setAlphaBits(1); runTestGL(caps); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { boolean waitForKey = false; mainRun = true; @@ -268,11 +268,11 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase { System.err.println("forceES2 "+forceES2); 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(TestFBOOnThreadSharedContext1DemoES2NEWT.class.getName()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java index 597d72269..85f9d9e2b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java @@ -55,6 +55,7 @@ import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.QuitAdapter; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.util.Animator; +import com.jogamp.opengl.util.AnimatorBase; /** * Test using a NEWT {@link Window} for onscreen case. @@ -72,7 +73,7 @@ import com.jogamp.opengl.util.Animator; public class TestGLAutoDrawableDelegateNEWT extends UITestCase { static long duration = 500; // ms - void doTest(GLCapabilitiesImmutable reqGLCaps, GLEventListener demo) throws InterruptedException { + void doTest(final GLCapabilitiesImmutable reqGLCaps, final GLEventListener demo) throws InterruptedException { final GLDrawableFactory factory = GLDrawableFactory.getFactory(reqGLCaps.getGLProfile()); // @@ -105,27 +106,27 @@ public class TestGLAutoDrawableDelegateNEWT extends UITestCase { 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()); } }); glad.addGLEventListener(demo); - QuitAdapter quitAdapter = new QuitAdapter(); + final QuitAdapter quitAdapter = new QuitAdapter(); //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter)); //glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter)); window.addKeyListener(quitAdapter); window.addWindowListener(quitAdapter); - Animator animator = new Animator(); + final Animator animator = new Animator(); animator.setUpdateFPSFrames(60, System.err); - animator.setModeBits(false, Animator.MODE_EXPECT_AWT_RENDERING_THREAD); + animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); animator.add(glad); animator.start(); Assert.assertTrue(animator.isStarted()); @@ -150,7 +151,7 @@ public class TestGLAutoDrawableDelegateNEWT extends UITestCase { doTest(reqGLCaps, new GearsES2(1)); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java index 8113f34ee..94bff728e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java @@ -76,7 +76,7 @@ public class TestGLAutoDrawableDelegateOnOffscrnCapsNEWT extends UITestCase { static final int heightStep = 600/4; volatile int szStep = 2; - static GLCapabilities getCaps(String profile) { + static GLCapabilities getCaps(final String profile) { if( !GLProfile.isAvailable(profile) ) { System.err.println("Profile "+profile+" n/a"); return null; @@ -84,7 +84,7 @@ public class TestGLAutoDrawableDelegateOnOffscrnCapsNEWT extends UITestCase { return new GLCapabilities(GLProfile.get(profile)); } - void doTest(GLCapabilitiesImmutable reqGLCaps, GLEventListener demo) throws InterruptedException { + void doTest(final GLCapabilitiesImmutable reqGLCaps, final GLEventListener demo) throws InterruptedException { System.out.println("Requested GL Caps: "+reqGLCaps); final GLDrawableFactory factory = GLDrawableFactory.getFactory(reqGLCaps.getGLProfile()); final GLCapabilitiesImmutable expGLCaps = GLGraphicsConfigurationUtil.fixGLCapabilities(reqGLCaps, factory, null); @@ -140,7 +140,7 @@ public class TestGLAutoDrawableDelegateOnOffscrnCapsNEWT extends UITestCase { final GLContext context = drawable.createContext(null); Assert.assertNotNull(context); - int res = context.makeCurrent(); + final int res = context.makeCurrent(); Assert.assertTrue(GLContext.CONTEXT_CURRENT_NEW==res || GLContext.CONTEXT_CURRENT==res); context.release(); @@ -179,12 +179,12 @@ public class TestGLAutoDrawableDelegateOnOffscrnCapsNEWT extends UITestCase { 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()); } }); @@ -388,7 +388,7 @@ public class TestGLAutoDrawableDelegateOnOffscrnCapsNEWT extends UITestCase { doTest(reqGLCaps, new GearsES2(1)); } */ - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { org.junit.runner.JUnitCore.main(TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.class.getName()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.java index 06c09bbbf..5c90e8021 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.java @@ -64,7 +64,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase { static final int heightStep = 600/4; volatile int szStep = 2; - static GLCapabilities getCaps(String profile) { + static GLCapabilities getCaps(final String profile) { if( !GLProfile.isAvailable(profile) ) { System.err.println("Profile "+profile+" n/a"); return null; @@ -72,7 +72,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase { return new GLCapabilities(GLProfile.get(profile)); } - void doTest(GLCapabilitiesImmutable reqGLCaps, GLEventListener demo) throws InterruptedException { + void doTest(final GLCapabilitiesImmutable reqGLCaps, final GLEventListener demo) throws InterruptedException { System.out.println("Requested GL Caps: "+reqGLCaps); final GLDrawableFactory factory = GLDrawableFactory.getFactory(reqGLCaps.getGLProfile()); final GLCapabilitiesImmutable expGLCaps = GLGraphicsConfigurationUtil.fixGLCapabilities(reqGLCaps, factory, null); @@ -338,7 +338,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase { doTest(reqGLCaps, new GearsES2(1)); } */ - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { org.junit.runner.JUnitCore.main(TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.class.getName()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java index ffa64d894..a5a340b36 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java @@ -64,7 +64,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase { static final int heightStep = 600/4; volatile int szStep = 2; - static GLCapabilities getCaps(String profile) { + static GLCapabilities getCaps(final String profile) { if( !GLProfile.isAvailable(profile) ) { System.err.println("Profile "+profile+" n/a"); return null; @@ -72,7 +72,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase { return new GLCapabilities(GLProfile.get(profile)); } - void doTest(GLCapabilitiesImmutable reqGLCaps, GLEventListener demo) throws InterruptedException { + void doTest(final GLCapabilitiesImmutable reqGLCaps, final GLEventListener demo) throws InterruptedException { System.out.println("Requested GL Caps: "+reqGLCaps); final GLDrawableFactory factory = GLDrawableFactory.getFactory(reqGLCaps.getGLProfile()); final GLCapabilitiesImmutable expGLCaps = GLGraphicsConfigurationUtil.fixGLCapabilities(reqGLCaps, factory, null); @@ -377,7 +377,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase { doTest(reqGLCaps, new Gears(1)); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { org.junit.runner.JUnitCore.main(TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.class.getName()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java index 8d3d05869..51c7c0772 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java @@ -64,7 +64,7 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase { static final int heightStep = 600/4; volatile int szStep = 2; - void doTest(GLCapabilitiesImmutable reqGLCaps, GLEventListener demo) throws InterruptedException { + void doTest(final GLCapabilitiesImmutable reqGLCaps, final GLEventListener demo) throws InterruptedException { System.out.println("Requested GL Caps: "+reqGLCaps); final GLDrawableFactory factory = GLDrawableFactory.getFactory(reqGLCaps.getGLProfile()); final GLCapabilitiesImmutable expGLCaps = GLGraphicsConfigurationUtil.fixGLCapabilities(reqGLCaps, factory, null); @@ -178,7 +178,7 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase { doTest(reqGLCaps, new Gears(1)); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { org.junit.runner.JUnitCore.main(TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.class.getName()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java index 2d231fb6d..8f8bb8f3e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java @@ -67,7 +67,7 @@ public class TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT extends UITestCase { static boolean waitForKey = false; volatile int szStep = 2; - static GLCapabilities getCaps(String profile) { + static GLCapabilities getCaps(final String profile) { if( !GLProfile.isAvailable(profile) ) { System.err.println("Profile "+profile+" n/a"); return null; @@ -86,7 +86,7 @@ public class TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT extends UITestCase { frame.pack(); frame.validate(); } } ); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -96,7 +96,7 @@ public class TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT extends UITestCase { void setMakeSnapshot(); } - void doTest(GLCapabilitiesImmutable reqGLCaps, GLEventListener demo) throws InterruptedException { + void doTest(final GLCapabilitiesImmutable reqGLCaps, final GLEventListener demo) throws InterruptedException { if(reqGLCaps.isOnscreen() && JAWTUtil.isOffscreenLayerRequired()) { System.err.println("onscreen layer n/a"); return; @@ -114,7 +114,7 @@ public class TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT extends UITestCase { // final GLCanvas glad = new GLCanvas(reqGLCaps); // will implicit trigger offscreen layer - if !onscreen && supported Assert.assertNotNull(glad); - Dimension glc_sz = new Dimension(widthStep*szStep, heightStep*szStep); + final Dimension glc_sz = new Dimension(widthStep*szStep, heightStep*szStep); glad.setMinimumSize(glc_sz); glad.setPreferredSize(glc_sz); glad.setSize(glc_sz); @@ -128,7 +128,7 @@ public class TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT extends UITestCase { frame.pack(); frame.setVisible(true); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -179,7 +179,7 @@ public class TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT extends UITestCase { } */ { - GLContext context = glad.getContext(); + final GLContext context = glad.getContext(); System.out.println("Chosen GL CTX (2): "+context.getGLVersion()); Assert.assertNotNull(context); Assert.assertTrue(context.isCreated()); @@ -235,7 +235,7 @@ public class TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT extends UITestCase { frame.remove(glad); frame.dispose(); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -338,7 +338,7 @@ public class TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT extends UITestCase { doTest(reqGLCaps, new GearsES2(1)); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-wait")) { waitForKey = true; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java index 8acec337b..2e29340a1 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java @@ -70,7 +70,7 @@ public class TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT extends UITestCase { void setMakeSnapshot(); } - static GLCapabilities getCaps(String profile) { + static GLCapabilities getCaps(final String profile) { if( !GLProfile.isAvailable(profile) ) { System.err.println("Profile "+profile+" n/a"); return null; @@ -78,7 +78,7 @@ public class TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT extends UITestCase { return new GLCapabilities(GLProfile.get(profile)); } - void doTest(GLCapabilitiesImmutable reqGLCaps, GLEventListener demo) throws InterruptedException { + void doTest(final GLCapabilitiesImmutable reqGLCaps, final GLEventListener demo) throws InterruptedException { System.out.println("Requested GL Caps: "+reqGLCaps); final GLDrawableFactory factory = GLDrawableFactory.getFactory(reqGLCaps.getGLProfile()); final GLCapabilitiesImmutable expGLCaps = GLGraphicsConfigurationUtil.fixGLCapabilities(reqGLCaps, factory, null); @@ -135,7 +135,7 @@ public class TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT extends UITestCase { glad.display(); { - GLContext context = glad.getContext(); + final GLContext context = glad.getContext(); System.out.println("Chosen GL CTX (2): "+context.getGLVersion()); Assert.assertNotNull(context); Assert.assertTrue(context.isCreated()); @@ -462,7 +462,7 @@ public class TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT extends UITestCase { doTest(reqGLCaps, new GearsES2(1)); } */ - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { org.junit.runner.JUnitCore.main(TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.class.getName()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java index bfdad4427..b95fa0c8c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java @@ -72,7 +72,7 @@ public class TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT extends UITestCase static final int heightStep = 600/4; volatile int szStep = 2; - static GLCapabilities getCaps(String profile) { + static GLCapabilities getCaps(final String profile) { if( !GLProfile.isAvailable(profile) ) { System.err.println("Profile "+profile+" n/a"); return null; @@ -91,7 +91,7 @@ public class TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT extends UITestCase frame.pack(); frame.validate(); } } ); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -101,7 +101,7 @@ public class TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT extends UITestCase void setMakeSnapshot(); } - void doTest(boolean offscreenLayer, GLCapabilitiesImmutable reqGLCaps, GLEventListener demo) throws InterruptedException { + void doTest(final boolean offscreenLayer, final GLCapabilitiesImmutable reqGLCaps, final GLEventListener demo) throws InterruptedException { if(!offscreenLayer && JAWTUtil.isOffscreenLayerRequired()) { System.err.println("onscreen layer n/a"); return; @@ -124,7 +124,7 @@ public class TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT extends UITestCase final NewtCanvasAWT nca = new NewtCanvasAWT(glad); Assert.assertNotNull(nca); - Dimension size0 = new Dimension(widthStep*szStep, heightStep*szStep); + final Dimension size0 = new Dimension(widthStep*szStep, heightStep*szStep); nca.setShallUseOffscreenLayer(offscreenLayer); // trigger offscreen layer - if supported nca.setPreferredSize(size0); nca.setMinimumSize(size0); @@ -140,7 +140,7 @@ public class TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT extends UITestCase frame.pack(); frame.setVisible(true); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -191,7 +191,7 @@ public class TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT extends UITestCase } */ { - GLContext context = glad.getContext(); + final GLContext context = glad.getContext(); System.out.println("Chosen GL CTX (2): "+context.getGLVersion()); Assert.assertNotNull(context); Assert.assertTrue(context.isCreated()); @@ -247,7 +247,7 @@ public class TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT extends UITestCase frame.remove(nca); frame.dispose(); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -351,7 +351,7 @@ public class TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT extends UITestCase doTest(true, reqGLCaps, new GearsES2(1)); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { org.junit.runner.JUnitCore.main(TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.class.getName()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java index 1e78e492c..3900817c5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; @@ -47,37 +47,37 @@ import com.jogamp.opengl.test.junit.util.UITestCase; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestGLContextSurfaceLockNEWT extends UITestCase { static final int demoSize = 64; - + public abstract class MyRunnable implements Runnable { final Object postSync; final int id; boolean done = false; - - public MyRunnable(Object postSync, int id) { + + public MyRunnable(final Object postSync, final int id) { this.postSync = postSync; this.id = id; } - + public boolean done() { return done; } } - + public class RudeAnimator extends MyRunnable { private final GLAutoDrawable glad; private final int frameCount; - - public RudeAnimator(GLAutoDrawable glad, int frameCount, Object postSync, int id) { + + public RudeAnimator(final GLAutoDrawable glad, final int frameCount, final Object postSync, final int id) { super(postSync, id); this.glad = glad; this.frameCount = frameCount; } - + public void run() { System.err.println("Animatr "+id+", count "+frameCount+": PRE: "+Thread.currentThread().getName()); - + for(int c=0; c<frameCount; c++) { glad.display(); } - + System.err.println("Animatr "+id+": DONE/SYNC: "+Thread.currentThread().getName()); synchronized (postSync) { done = true; @@ -94,16 +94,16 @@ public class TestGLContextSurfaceLockNEWT extends UITestCase { public class RudeResizer extends MyRunnable { private final GLWindow win; private final int actionCount; - - public RudeResizer(GLWindow win, int actionCount, Object postSync, int id) { + + public RudeResizer(final GLWindow win, final int actionCount, final Object postSync, final int id) { super(postSync, id); this.win = win; this.actionCount = actionCount; } - + public void run() { System.err.println("Resizer "+id+", count "+actionCount+": PRE: "+Thread.currentThread().getName()); - + for(int c=0; c<actionCount; c++) { win.runOnEDTIfAvail(true, new Runnable() { public void run() { @@ -111,9 +111,9 @@ public class TestGLContextSurfaceLockNEWT extends UITestCase { win.setSize(win.getSurfaceWidth()+1, win.getSurfaceHeight()+1); // Force display within surface lock. - // This procedure emulates the sensitive behavior + // This procedure emulates the sensitive behavior // for all platforms directly. - int res = win.lockSurface(); + final int res = win.lockSurface(); if(res > 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<reszThreadCount+animThreadCount; i++) { if(0==i%2) { @@ -227,7 +227,7 @@ public class TestGLContextSurfaceLockNEWT extends UITestCase { while(!done(resizeTasks) || !done(animTasks)) { try { sync.wait(); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { throw new RuntimeException(e); } } @@ -237,30 +237,30 @@ public class TestGLContextSurfaceLockNEWT extends UITestCase { Thread.sleep(100); i++; } - + glWindow.destroy(); } - + @Test public void test01_1A1RThreads_100Resizes() throws InterruptedException { runJOGLTasks(1, 200, 1, 100); } - + @Test public void test01_3A3RThreads_50Resizes() throws InterruptedException { runJOGLTasks(3, 100, 3, 50); } - - public static void main(String args[]) throws IOException { + + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { // duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } - String tstname = TestGLContextSurfaceLockNEWT.class.getName(); + final String tstname = TestGLContextSurfaceLockNEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java index f0950fba8..26a69d463 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java @@ -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,18 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; import javax.media.opengl.GL; +import javax.media.opengl.GL2ES2; import javax.media.opengl.GL2GL3; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLContext; @@ -53,56 +54,56 @@ import com.jogamp.opengl.test.junit.util.UITestCase; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestGLDebug00NEWT extends UITestCase { - + static String dbgTstMsg0 = "Hello World"; static int dbgTstId0 = 42; - - public class WindowContext { + + public class WindowContext { public final Window window; public final GLContext context; - - public WindowContext(Window w, GLContext c) { + + public WindowContext(final Window w, final GLContext c) { window = w; context = c; } - } - - WindowContext createWindow(GLProfile glp, boolean debugGL) { - GLCapabilities caps = new GLCapabilities(glp); + } + + WindowContext createWindow(final GLProfile glp, final boolean debugGL) { + final GLCapabilities caps = new GLCapabilities(glp); // // 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(128, 128); window.setVisible(true); - GLDrawableFactory factory = GLDrawableFactory.getFactory(glp); - GLDrawable drawable = factory.createGLDrawable(window); + final GLDrawableFactory factory = GLDrawableFactory.getFactory(glp); + final GLDrawable drawable = factory.createGLDrawable(window); Assert.assertNotNull(drawable); - + drawable.setRealized(true); - - 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, context); } - void destroyWindow(WindowContext winctx) { - GLDrawable drawable = winctx.context.getGLDrawable(); - + void destroyWindow(final WindowContext winctx) { + final GLDrawable drawable = winctx.context.getGLDrawable(); + Assert.assertNotNull(winctx.context); winctx.context.destroy(); @@ -113,19 +114,19 @@ public class TestGLDebug00NEWT extends UITestCase { winctx.window.destroy(); } - - void test01GLDebug01EnableDisable(boolean enable) throws InterruptedException { - GLProfile glp = GLProfile.getDefault(); - - WindowContext winctx = createWindow(glp, enable); - String glDebugExt = winctx.context.getGLDebugMessageExtension(); + + void test01GLDebug01EnableDisable(final boolean enable) throws InterruptedException { + final GLProfile glp = GLProfile.getDefault(); + + final WindowContext winctx = createWindow(glp, enable); + final String glDebugExt = winctx.context.getGLDebugMessageExtension(); System.err.println("glDebug extension: "+glDebugExt); System.err.println("glDebug enabled: "+winctx.context.isGLDebugMessageEnabled()); System.err.println("glDebug sync: "+winctx.context.isGLDebugSynchronous()); - System.err.println("context version: "+winctx.context.getGLVersion()); - + System.err.println("context version: "+winctx.context.getGLVersion()); + Assert.assertEquals((null == glDebugExt) ? false : enable, winctx.context.isGLDebugMessageEnabled()); - + destroyWindow(winctx); } @@ -138,95 +139,95 @@ public class TestGLDebug00NEWT extends UITestCase { public void test01GLDebugEnabled() throws InterruptedException { test01GLDebug01EnableDisable(true); } - + @Test public void test02GLDebugError() throws InterruptedException { - GLProfile glp = GLProfile.getDefault(); - - WindowContext winctx = createWindow(glp, true); - - MyGLDebugListener myGLDebugListener = new MyGLDebugListener( - GL2GL3.GL_DEBUG_SOURCE_API, - GL2GL3.GL_DEBUG_TYPE_ERROR, - GL2GL3.GL_DEBUG_SEVERITY_HIGH); + final GLProfile glp = GLProfile.getDefault(); + + final WindowContext winctx = createWindow(glp, true); + + final MyGLDebugListener myGLDebugListener = new MyGLDebugListener( + GL2ES2.GL_DEBUG_SOURCE_API, + GL2ES2.GL_DEBUG_TYPE_ERROR, + GL2ES2.GL_DEBUG_SEVERITY_HIGH); winctx.context.addGLDebugListener(myGLDebugListener); - - GL gl = winctx.context.getGL(); - + + final GL gl = winctx.context.getGL(); + gl.glBindFramebuffer(-1, -1); // ERROR ! - + if( winctx.context.isGLDebugMessageEnabled() ) { Assert.assertEquals(true, myGLDebugListener.received()); - } - + } + destroyWindow(winctx); } - + @Test public void test03GLDebugInsert() throws InterruptedException { - GLProfile glp = GLProfile.getDefault(); - WindowContext winctx = createWindow(glp, true); - MyGLDebugListener myGLDebugListener = new MyGLDebugListener(dbgTstMsg0, dbgTstId0); + final GLProfile glp = GLProfile.getDefault(); + final WindowContext winctx = createWindow(glp, true); + final MyGLDebugListener myGLDebugListener = new MyGLDebugListener(dbgTstMsg0, dbgTstId0); winctx.context.addGLDebugListener(myGLDebugListener); - - String glDebugExt = winctx.context.getGLDebugMessageExtension(); + + final String glDebugExt = winctx.context.getGLDebugMessageExtension(); Assert.assertEquals((null == glDebugExt) ? false : true, winctx.context.isGLDebugMessageEnabled()); - + if( winctx.context.isGLDebugMessageEnabled() ) { - winctx.context.glDebugMessageInsert(GL2GL3.GL_DEBUG_SOURCE_APPLICATION, - GL2GL3.GL_DEBUG_TYPE_OTHER, - dbgTstId0, - GL2GL3.GL_DEBUG_SEVERITY_MEDIUM, dbgTstMsg0); + winctx.context.glDebugMessageInsert(GL2ES2.GL_DEBUG_SOURCE_APPLICATION, + GL2ES2.GL_DEBUG_TYPE_OTHER, + dbgTstId0, + GL2ES2.GL_DEBUG_SEVERITY_MEDIUM, dbgTstMsg0); Assert.assertEquals(true, myGLDebugListener.received()); - } - + } + destroyWindow(winctx); } - - public static void main(String args[]) throws IOException { - String tstname = TestGLDebug00NEWT.class.getName(); + + public static void main(final String args[]) throws IOException { + final String tstname = TestGLDebug00NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } - + public class MyGLDebugListener implements GLDebugListener { int recSource; int recType; int recSeverity; - + String recMsg; int recId; boolean received = false; - - public MyGLDebugListener(int recSource, int recType, int recSeverity) { + + public MyGLDebugListener(final int recSource, final int recType, final int recSeverity) { this.recSource = recSource; this.recType = recType; this.recSeverity = recSeverity; this.recMsg = null; this.recId = -1; - + } - public MyGLDebugListener(String recMsg, int recId) { + public MyGLDebugListener(final String recMsg, final int recId) { this.recSource = -1; this.recType = -1; this.recSeverity = -1; this.recMsg = recMsg; this.recId = recId; } - + public boolean received() { return received; } - - public void messageSent(GLDebugMessage event) { - System.err.println("XXX: "+event); + + public void messageSent(final GLDebugMessage event) { + System.err.println("XXX: "+event); if(null != recMsg && recMsg.equals(event.getDbgMsg()) && recId == event.getDbgId()) { received = true; - } else if(0 <= recSource && recSource == event.getDbgSource() && + } else if(0 <= recSource && recSource == event.getDbgSource() && recType == event.getDbgType() && recSeverity== event.getDbgSeverity() ) { - received = true; + received = true; } // Thread.dumpStack(); - } + } } } - + diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java index 76bf33044..67588a0d0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java @@ -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,16 +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.jogl.acore; import java.io.IOException; +import javax.media.opengl.GL2ES2; import javax.media.opengl.GL2GL3; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLCapabilities; @@ -49,16 +50,16 @@ import com.jogamp.opengl.test.junit.util.UITestCase; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestGLDebug01NEWT extends UITestCase { - + static String dbgTstMsg0 = "Hello World"; static int dbgTstId0 = 42; - - GLWindow createWindow(GLProfile glp, boolean debugGL) { - GLCapabilities caps = new GLCapabilities(glp); + + GLWindow createWindow(final GLProfile glp, final boolean debugGL) { + final GLCapabilities caps = new GLCapabilities(glp); // // Create native windowing resources .. X11/Win/OSX - // - GLWindow window = GLWindow.create(caps); + // + final GLWindow window = GLWindow.create(caps); Assert.assertNotNull(window); window.setContextCreationFlags(debugGL?GLContext.CTX_OPTION_DEBUG:0); window.setSize(128, 128); @@ -66,44 +67,44 @@ public class TestGLDebug01NEWT extends UITestCase { Assert.assertNotNull(window.getContext()); Assert.assertNotNull(window.getContext().isCreated()); - + return window; } - void destroyWindow(GLWindow window) { + void destroyWindow(final GLWindow window) { window.destroy(); } - - void test01GLDebug01EnableDisable(boolean enable, final String dbgTstMsg, final int dbgTstId) throws InterruptedException { - GLProfile glp = GLProfile.getDefault(); - + + void test01GLDebug01EnableDisable(final boolean enable, final String dbgTstMsg, final int dbgTstId) throws InterruptedException { + final GLProfile glp = GLProfile.getDefault(); + final GLWindow window = createWindow(glp, enable); final GLContext ctx = window.getContext(); - MyGLDebugListener myGLDebugListener = new MyGLDebugListener(dbgTstMsg, dbgTstId); + final MyGLDebugListener myGLDebugListener = new MyGLDebugListener(dbgTstMsg, dbgTstId); if(enable) { ctx.addGLDebugListener(myGLDebugListener); - } - String glDebugExt = ctx.getGLDebugMessageExtension(); + } + final String glDebugExt = ctx.getGLDebugMessageExtension(); System.err.println("glDebug extension: "+glDebugExt); System.err.println("glDebug enabled: "+ctx.isGLDebugMessageEnabled()); System.err.println("glDebug sync: "+ ctx.isGLDebugSynchronous()); System.err.println("context version: "+ctx.getGLVersion()); - + Assert.assertEquals((null == glDebugExt) ? false : enable, ctx.isGLDebugMessageEnabled()); if(ctx.isGLDebugMessageEnabled() && null != dbgTstMsg && 0 <= dbgTstId) { window.invoke(true, new GLRunnable() { - public boolean run(GLAutoDrawable drawable) { - drawable.getContext().glDebugMessageInsert(GL2GL3.GL_DEBUG_SOURCE_APPLICATION, - GL2GL3.GL_DEBUG_TYPE_OTHER, - dbgTstId, - GL2GL3.GL_DEBUG_SEVERITY_MEDIUM, dbgTstMsg); + public boolean run(final GLAutoDrawable drawable) { + drawable.getContext().glDebugMessageInsert(GL2ES2.GL_DEBUG_SOURCE_APPLICATION, + GL2ES2.GL_DEBUG_TYPE_OTHER, + dbgTstId, + GL2ES2.GL_DEBUG_SEVERITY_MEDIUM, dbgTstMsg); return true; } }); Assert.assertEquals(true, myGLDebugListener.received()); - } - + } + destroyWindow(window); } @@ -116,77 +117,77 @@ public class TestGLDebug01NEWT extends UITestCase { public void test01GLDebug01Enabled() throws InterruptedException { test01GLDebug01EnableDisable(true, dbgTstMsg0, dbgTstId0); } - + @Test public void test02GLDebug01Error() throws InterruptedException { - GLProfile glp = GLProfile.getDefault(); - - GLWindow window = createWindow(glp, true); - - MyGLDebugListener myGLDebugListener = new MyGLDebugListener( - GL2GL3.GL_DEBUG_SOURCE_API, - GL2GL3.GL_DEBUG_TYPE_ERROR, - GL2GL3.GL_DEBUG_SEVERITY_HIGH); + final GLProfile glp = GLProfile.getDefault(); + + final GLWindow window = createWindow(glp, true); + + final MyGLDebugListener myGLDebugListener = new MyGLDebugListener( + GL2ES2.GL_DEBUG_SOURCE_API, + GL2ES2.GL_DEBUG_TYPE_ERROR, + GL2ES2.GL_DEBUG_SEVERITY_HIGH); window.getContext().addGLDebugListener(myGLDebugListener); - + window.invoke(true, new GLRunnable() { - public boolean run(GLAutoDrawable drawable) { + public boolean run(final GLAutoDrawable drawable) { drawable.getGL().glBindFramebuffer(-1, -1); // ERROR ! return true; } } ); - + if( window.getContext().isGLDebugMessageEnabled() ) { Assert.assertEquals(true, myGLDebugListener.received()); - } - + } + destroyWindow(window); } - - - public static void main(String args[]) throws IOException { - String tstname = TestGLDebug01NEWT.class.getName(); + + + public static void main(final String args[]) throws IOException { + final String tstname = TestGLDebug01NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } - + public class MyGLDebugListener implements GLDebugListener { int recSource; int recType; int recSeverity; - + String recMsg; int recId; boolean received = false; - - public MyGLDebugListener(int recSource, int recType, int recSeverity) { + + public MyGLDebugListener(final int recSource, final int recType, final int recSeverity) { this.recSource = recSource; this.recType = recType; this.recSeverity = recSeverity; this.recMsg = null; this.recId = -1; - + } - public MyGLDebugListener(String recMsg, int recId) { + public MyGLDebugListener(final String recMsg, final int recId) { this.recSource = -1; this.recType = -1; this.recSeverity = -1; this.recMsg = recMsg; this.recId = recId; } - + public boolean received() { return received; } - - public void messageSent(GLDebugMessage event) { - System.err.println("XXX: "+event); + + public void messageSent(final GLDebugMessage event) { + System.err.println("XXX: "+event); if(null != recMsg && recMsg.equals(event.getDbgMsg()) && recId == event.getDbgId()) { received = true; - } else if(0 <= recSource && recSource == event.getDbgSource() && + } else if(0 <= recSource && recSource == event.getDbgSource() && recType == event.getDbgType() && recSeverity== event.getDbgSeverity() ) { - received = true; + received = true; } // Thread.dumpStack(); - } + } } } - + diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLExtensionQueryOffscreen.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLExtensionQueryOffscreen.java index 4bc8e7ee3..1e938c200 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLExtensionQueryOffscreen.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLExtensionQueryOffscreen.java @@ -48,8 +48,8 @@ import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestGLExtensionQueryOffscreen { - public static void main(String[] args) { - TestGLExtensionQueryOffscreen instance = new TestGLExtensionQueryOffscreen(); + public static void main(final String[] args) { + final TestGLExtensionQueryOffscreen instance = new TestGLExtensionQueryOffscreen(); instance.testJogl2ExtensionCheck1(); instance.testJogl2ExtensionCheck2(); } @@ -59,8 +59,8 @@ public class TestGLExtensionQueryOffscreen { */ @Test public void testJogl2ExtensionCheck1() { - GLDrawableFactoryImpl factory = (GLDrawableFactoryImpl) GLDrawableFactory.getDesktopFactory(); - GLContext sharedContext = factory.getOrCreateSharedContext(null); + final GLDrawableFactoryImpl factory = (GLDrawableFactoryImpl) GLDrawableFactory.getDesktopFactory(); + final GLContext sharedContext = factory.getOrCreateSharedContext(null); sharedContext.makeCurrent(); String extensions; try { @@ -68,8 +68,8 @@ public class TestGLExtensionQueryOffscreen { } finally { sharedContext.release(); } - String[] tabExtensions = extensions.split(" "); - SortedSet<String> setExtensions = new TreeSet<String>(); + final String[] tabExtensions = extensions.split(" "); + final SortedSet<String> setExtensions = new TreeSet<String>(); 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<String> setExtensions = new TreeSet<String>(); + final String[] tabExtensions = extensions.split(" "); + final SortedSet<String> setExtensions = new TreeSet<String>(); 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. * <p> - * This bug lies within Mesa3D (any renderer) and is fixed in + * This bug lies within Mesa3D (any renderer) and is fixed in * commit 8dc79ae7d73cf6711c2182ff9a5d37ef6c989d23. * </p> * <p> - * 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. * </p> * <https://jogamp.org/bugzilla/show_bug.cgi?id=651> @@ -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<i; j++) { - switch(j) { + switch(j) { case 0: res += "GL_MAX_TEXTURE_SIZE"; break; case 1: res += "GL_ACTIVE_TEXTURE"; break; case 2: res += "GL_MAX_TEXTURE_IMAGE_UNITS"; break; - case 3: res += "GL_MAX_COLOR_ATTACHMENTS"; break; + case 3: res += "GL_MAX_COLOR_ATTACHMENTS"; break; case 4: res += "GL_MAX_SAMPLES"; break; } if(GL.GL_NO_ERROR == glerr[j]) { @@ -156,70 +157,70 @@ public class TestGLMesaBug651NEWT 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) { + } } - - protected void runTestGL(GLCapabilities caps) throws InterruptedException { - GLWindow glWindow = GLWindow.create(caps); + + protected void runTestGL(final GLCapabilities caps) throws InterruptedException { + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setTitle(getSimpleTestName(".")); - UnitTester demo = new UnitTester(); - + final UnitTester demo = new UnitTester(); + glWindow.addGLEventListener(demo); glWindow.setSize(width, height); - glWindow.setVisible(true); + glWindow.setVisible(true); glWindow.display(); - + glWindow.destroy(); } - + @Test public void test01_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); } - + @Test public void test02__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); } - + @Test public void test03_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); } - + @Test public void test04_GL3() throws InterruptedException { if(!GLProfile.isAvailable(GLProfile.GL3)) { System.err.println("GL3 n/a"); return; } - GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL3)); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL3)); runTestGL(caps); } - + @Test public void test05_GL4() throws InterruptedException { if(!GLProfile.isAvailable(GLProfile.GL4)) { System.err.println("GL4 n/a"); return; } - GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL4)); + final GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL4)); runTestGL(caps); } - - public static void main(String args[]) { + + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestGLMesaBug651NEWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug658NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug658NEWT.java index cb225b96f..a91eae04c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug658NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug658NEWT.java @@ -20,11 +20,11 @@ import com.jogamp.opengl.test.junit.util.UITestCase; /** * The 3.1 compatibility context on Mesa >= 9.0 seems to be broken. * <p> - * 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). * </p> * <p> - * Mesa3D Version 9.0 still exposes this bug, + * Mesa3D Version 9.0 still exposes this bug, * where 9.?.? has it fixed w/ above commit. * </p> * <https://jogamp.org/bugzilla/show_bug.cgi?id=658> @@ -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<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } org.junit.runner.JUnitCore.main(TestGLPointsNEWT.class.getName()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile00NEWT.java index df182c5d3..5861d4233 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile00NEWT.java @@ -47,7 +47,7 @@ public class TestGLProfile00NEWT extends UITestCase { public void testInitSingleton() throws InterruptedException { GLProfile.initSingleton(); System.err.println("Desktop"); - GLDrawableFactory desktopFactory = GLDrawableFactory.getDesktopFactory(); + final GLDrawableFactory desktopFactory = GLDrawableFactory.getDesktopFactory(); if( null != desktopFactory ) { System.err.println(JoglVersion.getDefaultOpenGLInfo(desktopFactory.getDefaultDevice(), null, false)); System.err.println(Platform.getNewline()+Platform.getNewline()+Platform.getNewline()); @@ -56,7 +56,7 @@ public class TestGLProfile00NEWT extends UITestCase { } System.err.println("EGL"); - GLDrawableFactory eglFactory = GLDrawableFactory.getEGLFactory(); + final GLDrawableFactory eglFactory = GLDrawableFactory.getEGLFactory(); if( null != eglFactory ) { System.err.println(JoglVersion.getDefaultOpenGLInfo(eglFactory.getDefaultDevice(), null, false)); } else { @@ -64,8 +64,8 @@ public class TestGLProfile00NEWT extends UITestCase { } } - public static void main(String args[]) throws IOException { - String tstname = TestGLProfile00NEWT.class.getName(); + public static void main(final String args[]) throws IOException { + final String tstname = TestGLProfile00NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java index 88d643aa6..633a2822e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfile01NEWT.java @@ -72,7 +72,7 @@ public class TestGLProfile01NEWT extends UITestCase { } } - static void validate(GLProfile glp) { + static void validate(final GLProfile glp) { final boolean gles3CompatAvail = GLContext.isGLES3CompatibleAvailable(GLProfile.getDefaultDevice()); if( glp.getImplName().equals(GLProfile.GL4bc) ) { Assert.assertTrue(GLProfile.isAvailable(GLProfile.GL4bc)); @@ -169,7 +169,7 @@ public class TestGLProfile01NEWT extends UITestCase { } } - static void validate(GL gl) { + static void validate(final GL gl) { final GLContext ctx = gl.getContext(); final boolean gles3CompatAvail = ctx.isGLES3Compatible(); @@ -282,7 +282,7 @@ public class TestGLProfile01NEWT extends UITestCase { public void test01GLProfileDefault() throws InterruptedException { System.out.println("GLProfile "+GLProfile.glAvailabilityToString()); System.out.println("GLProfile.getDefaultDevice(): "+GLProfile.getDefaultDevice()); - GLProfile glp = GLProfile.getDefault(); + final GLProfile glp = GLProfile.getDefault(); System.out.println("GLProfile.getDefault(): "+glp); validate(glp); dumpVersion(glp); @@ -291,7 +291,7 @@ public class TestGLProfile01NEWT extends UITestCase { @Test public void test02GLProfileMaxProgrammable() throws InterruptedException { // Assuming at least one programmable profile is available - GLProfile glp = GLProfile.getMaxProgrammable(true); + final GLProfile glp = GLProfile.getMaxProgrammable(true); System.out.println("GLProfile.getMaxProgrammable(): "+glp); validate(glp); dumpVersion(glp); @@ -300,7 +300,7 @@ public class TestGLProfile01NEWT extends UITestCase { @Test public void test03GLProfileMaxFixedFunc() throws InterruptedException { // Assuming at least one fixed function profile is available - GLProfile glp = GLProfile.getMaxFixedFunc(true); + final GLProfile glp = GLProfile.getMaxFixedFunc(true); System.out.println("GLProfile.getMaxFixedFunc(): "+glp); validate(glp); dumpVersion(glp); @@ -312,7 +312,7 @@ public class TestGLProfile01NEWT extends UITestCase { System.out.println("GLProfile GL2ES1 n/a"); return; } - GLProfile glp = GLProfile.getGL2ES1(); + final GLProfile glp = GLProfile.getGL2ES1(); System.out.println("GLProfile GL2ES1: "+glp); validate(glp); dumpVersion(glp); @@ -324,7 +324,7 @@ public class TestGLProfile01NEWT extends UITestCase { System.out.println("GLProfile GL2ES2 n/a"); return; } - GLProfile glp = GLProfile.getGL2ES2(); + final GLProfile glp = GLProfile.getGL2ES2(); System.out.println("GLProfile GL2ES2: "+glp); validate(glp); dumpVersion(glp); @@ -336,15 +336,15 @@ public class TestGLProfile01NEWT extends UITestCase { System.out.println("GLProfile GL4ES3 n/a"); return; } - GLProfile glp = GLProfile.getGL4ES3(); + final GLProfile glp = GLProfile.getGL4ES3(); System.out.println("GLProfile GL4ES3: "+glp); validate(glp); dumpVersion(glp); } - void testSpecificProfile(String glps) throws InterruptedException { + void testSpecificProfile(final String glps) throws InterruptedException { if(GLProfile.isAvailable(glps)) { - GLProfile glp = GLProfile.get(glps); + final GLProfile glp = GLProfile.get(glps); validate(glp); dumpVersion(glp); } else { @@ -392,15 +392,15 @@ public class TestGLProfile01NEWT extends UITestCase { testSpecificProfile(GLProfile.GLES3); } - protected void dumpVersion(GLProfile glp) throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); - GLWindow glWindow = GLWindow.create(caps); + protected void dumpVersion(final GLProfile glp) throws InterruptedException { + final GLCapabilities caps = new GLCapabilities(glp); + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setTitle("TestGLProfile01NEWT"); glWindow.addGLEventListener(new GLEventListener() { - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { final GL gl = drawable.getGL(); System.err.println(JoglVersion.getGLStrings(gl, null, true)); @@ -446,13 +446,13 @@ public class TestGLProfile01NEWT extends UITestCase { } } - 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) { } }); @@ -464,8 +464,8 @@ public class TestGLProfile01NEWT extends UITestCase { glWindow.destroy(); } - public static void main(String args[]) throws IOException { - String tstname = TestGLProfile01NEWT.class.getName(); + public static void main(final String args[]) throws IOException { + final String tstname = TestGLProfile01NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLCanvasAWT.java index 1da40728a..2b6c84bf3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLCanvasAWT.java @@ -100,7 +100,7 @@ public class TestGLReadBuffer01GLCanvasAWT extends GLReadBuffer00Base { frame.pack(); frame.setVisible(true); } } ); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -118,34 +118,34 @@ public class TestGLReadBuffer01GLCanvasAWT extends GLReadBuffer00Base { textRendererGLEL.userCounter = i + 1; glad.display(); } - try { Thread.sleep(duration); } catch (InterruptedException e) { } + try { Thread.sleep(duration); } catch (final InterruptedException e) { } javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame.setSize(size1); frame.validate(); } } ); - try { Thread.sleep(duration); } catch (InterruptedException e) { } + try { Thread.sleep(duration); } catch (final InterruptedException e) { } javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame.setSize(size2); frame.validate(); } } ); - try { Thread.sleep(duration); } catch (InterruptedException e) { } + try { Thread.sleep(duration); } catch (final InterruptedException e) { } javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame.setSize(size0); frame.validate(); } } ); - try { Thread.sleep(duration); } catch (InterruptedException e) { } + try { Thread.sleep(duration); } catch (final InterruptedException e) { } if( doSnapshot ) { glad.disposeGLEventListener(snapshotGLEL, true /* remove */); } final Animator anim = new Animator(glad); anim.start(); - try { Thread.sleep(2*duration); } catch (InterruptedException e) { } + try { Thread.sleep(2*duration); } catch (final InterruptedException e) { } anim.stop(); - } catch (Exception e1) { + } catch (final Exception e1) { e1.printStackTrace(); } try { @@ -153,7 +153,7 @@ public class TestGLReadBuffer01GLCanvasAWT extends GLReadBuffer00Base { public void run() { frame.dispose(); } } ); - } catch (Exception e1) { + } catch (final Exception e1) { e1.printStackTrace(); } } @@ -182,22 +182,22 @@ public class TestGLReadBuffer01GLCanvasAWT extends GLReadBuffer00Base { } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { defAutoSwapMode = drawable.getAutoSwapBufferMode(); swapBuffersBeforeRead = GLDrawableUtil.swapBuffersBeforeRead(drawable.getChosenGLCapabilities()); drawable.setAutoSwapBufferMode( !swapBuffersBeforeRead ); } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { drawable.setAutoSwapBufferMode( defAutoSwapMode ); } @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) { snapshot(i++, drawable.getGL(), TextureIO.PNG, null); } - public void snapshot(int sn, GL gl, String fileSuffix, String destPath) { + public void snapshot(final int sn, final GL gl, final String fileSuffix, final String destPath) { final GLDrawable drawable = gl.getContext().getGLReadDrawable(); final String postSNDetail = String.format("awt-usr%03d", textRendererGLEL.userCounter); final String filenameAWT = getSnapshotFilename(sn, postSNDetail, @@ -219,7 +219,7 @@ public class TestGLReadBuffer01GLCanvasAWT extends GLReadBuffer00Base { final File fout = new File(filenameAWT); try { ImageIO.write(image, "png", fout); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } /** @@ -235,7 +235,7 @@ public class TestGLReadBuffer01GLCanvasAWT extends GLReadBuffer00Base { static boolean doSnapshot = true; static boolean keyFrame = false; - public static void main(String[] args) { + public static void main(final String[] args) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLJPanelAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLJPanelAWT.java index 633a54ecc..7f5755fc7 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLJPanelAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLJPanelAWT.java @@ -98,7 +98,7 @@ public class TestGLReadBuffer01GLJPanelAWT extends GLReadBuffer00Base { frame.pack(); frame.setVisible(true); } } ); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -116,34 +116,34 @@ public class TestGLReadBuffer01GLJPanelAWT extends GLReadBuffer00Base { textRendererGLEL.userCounter = i + 1; glad.display(); } - try { Thread.sleep(duration); } catch (InterruptedException e) { } + try { Thread.sleep(duration); } catch (final InterruptedException e) { } javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame.setSize(size1); frame.validate(); } } ); - try { Thread.sleep(duration); } catch (InterruptedException e) { } + try { Thread.sleep(duration); } catch (final InterruptedException e) { } javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame.setSize(size2); frame.validate(); } } ); - try { Thread.sleep(duration); } catch (InterruptedException e) { } + try { Thread.sleep(duration); } catch (final InterruptedException e) { } javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame.setSize(size0); frame.validate(); } } ); - try { Thread.sleep(duration); } catch (InterruptedException e) { } + try { Thread.sleep(duration); } catch (final InterruptedException e) { } if( doSnapshot ) { glad.disposeGLEventListener(snapshotGLEL, true /* remove */); } final Animator anim = new Animator(glad); anim.start(); - try { Thread.sleep(2*duration); } catch (InterruptedException e) { } + try { Thread.sleep(2*duration); } catch (final InterruptedException e) { } anim.stop(); - } catch (Exception e1) { + } catch (final Exception e1) { e1.printStackTrace(); } try { @@ -151,7 +151,7 @@ public class TestGLReadBuffer01GLJPanelAWT extends GLReadBuffer00Base { public void run() { frame.dispose(); } } ); - } catch (Exception e1) { + } catch (final Exception e1) { e1.printStackTrace(); } } @@ -184,22 +184,22 @@ public class TestGLReadBuffer01GLJPanelAWT extends GLReadBuffer00Base { } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { defAutoSwapMode = drawable.getAutoSwapBufferMode(); swapBuffersBeforeRead = GLDrawableUtil.swapBuffersBeforeRead(drawable.getChosenGLCapabilities()); drawable.setAutoSwapBufferMode( !swapBuffersBeforeRead ); } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { drawable.setAutoSwapBufferMode( defAutoSwapMode ); } @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) { snapshot(i++, drawable.getGL(), TextureIO.PNG, null); } - public void snapshot(int sn, GL gl, String fileSuffix, String destPath) { + public void snapshot(final int sn, final GL gl, final String fileSuffix, final String destPath) { final GLDrawable drawable = gl.getContext().getGLReadDrawable(); final String postSNDetail = String.format("awt-usr%03d", textRendererGLEL.userCounter); final String filenameAWT = getSnapshotFilename(sn, postSNDetail, @@ -221,7 +221,7 @@ public class TestGLReadBuffer01GLJPanelAWT extends GLReadBuffer00Base { final File fout = new File(filenameAWT); try { ImageIO.write(image, "png", fout); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } /** @@ -237,7 +237,7 @@ public class TestGLReadBuffer01GLJPanelAWT extends GLReadBuffer00Base { static boolean doSnapshot = true; static boolean keyFrame = false; - public static void main(String[] args) { + public static void main(final String[] args) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java index e6ce9e548..8e0e6bfb9 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java @@ -82,7 +82,7 @@ public class TestGLReadBuffer01GLWindowNEWT extends GLReadBuffer00Base { glad.addGLEventListener(snapshotGLEL); } glad.setVisible(true); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -99,22 +99,22 @@ public class TestGLReadBuffer01GLWindowNEWT extends GLReadBuffer00Base { textRendererGLEL.userCounter = i + 1; glad.display(); } - try { Thread.sleep(duration); } catch (InterruptedException e) { } + try { Thread.sleep(duration); } catch (final InterruptedException e) { } glad.setSize(size1.getWidth(), size1.getHeight()); - try { Thread.sleep(duration); } catch (InterruptedException e) { } + try { Thread.sleep(duration); } catch (final InterruptedException e) { } glad.setSize(size2.getWidth(), size2.getHeight()); - try { Thread.sleep(duration); } catch (InterruptedException e) { } + try { Thread.sleep(duration); } catch (final InterruptedException e) { } glad.setSize(size0.getWidth(), size0.getHeight()); - try { Thread.sleep(duration); } catch (InterruptedException e) { } + try { Thread.sleep(duration); } catch (final InterruptedException e) { } if( doSnapshot ) { glad.disposeGLEventListener(snapshotGLEL, true /* remove */); } final Animator anim = new Animator(glad); anim.start(); - try { Thread.sleep(2*duration); } catch (InterruptedException e) { } + try { Thread.sleep(2*duration); } catch (final InterruptedException e) { } anim.stop(); - } catch (Exception e1) { + } catch (final Exception e1) { e1.printStackTrace(); } glad.destroy(); @@ -136,22 +136,22 @@ public class TestGLReadBuffer01GLWindowNEWT extends GLReadBuffer00Base { } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { defAutoSwapMode = drawable.getAutoSwapBufferMode(); swapBuffersBeforeRead = GLDrawableUtil.swapBuffersBeforeRead(drawable.getChosenGLCapabilities()); drawable.setAutoSwapBufferMode( !swapBuffersBeforeRead ); } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { drawable.setAutoSwapBufferMode( defAutoSwapMode ); } @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) { snapshot(i++, drawable, TextureIO.PNG, null); } - public void snapshot(int sn, GLAutoDrawable drawable, String fileSuffix, String destPath) { + public void snapshot(final int sn, final GLAutoDrawable drawable, final String fileSuffix, final String destPath) { final GL gl = drawable.getGL(); final String postSNDetail = String.format("jgl-usr%03d", textRendererGLEL.userCounter); final String filenameJGL = getSnapshotFilename(sn, postSNDetail, @@ -178,7 +178,7 @@ public class TestGLReadBuffer01GLWindowNEWT extends GLReadBuffer00Base { static boolean doSnapshot = true; static boolean keyFrame = false; - public static void main(String[] args) { + public static void main(final String[] args) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLVersionParsing00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLVersionParsing00NEWT.java index 7ae49fe54..44c937251 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLVersionParsing00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLVersionParsing00NEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; @@ -75,20 +75,20 @@ public class TestGLVersionParsing00NEWT extends UITestCase { "OpenGL 2.1 LaLa", // 3 "4.2.11762 Compatibility Profile Context" // 4 }; - + public static final VersionNumberString[] glVersionNumbers = new VersionNumberString[] { - new VersionNumberString(2, 1, 0, glVersionStrings00[0]), - new VersionNumberString(2, 1, 0, glVersionStrings00[1]), + new VersionNumberString(2, 1, 0, glVersionStrings00[0]), + new VersionNumberString(2, 1, 0, glVersionStrings00[1]), new VersionNumberString(4, 2, 0, glVersionStrings00[2]), new VersionNumberString(4, 2, 0, glVersionStrings00[3]), - new VersionNumberString(2, 1, 0, glVersionStrings00[4]), + new VersionNumberString(2, 1, 0, glVersionStrings00[4]), new VersionNumberString(4, 2, 0, glVersionStrings00[5]), new VersionNumberString(4, 2, 0, glVersionStrings00[6]), new VersionNumberString(2, 0, 0, glVersionStrings00[7]), new VersionNumberString(2, 0, 0, glVersionStrings00[8]), new VersionNumberString(2, 0, 0, glVersionStrings00[9]), new VersionNumberString(2, 0, 0, glVersionStrings00[10]), - + new VersionNumberString(2, 1, 0, glVersionStrings01[0]), new VersionNumberString(2, 1, 0, glVersionStrings01[1]), new VersionNumberString(2, 1, 0, glVersionStrings01[2]), @@ -99,7 +99,7 @@ public class TestGLVersionParsing00NEWT extends UITestCase { new VersionNumberString(2, 0, 0, glVersionStrings01[7]), new VersionNumberString(2, 0, 0, glVersionStrings01[8]), new VersionNumberString(2, 0, 0, glVersionStrings01[9]), - + new VersionNumberString(2, 1, 0, glVersionStrings02[0]), new VersionNumberString(2, 0, 0, glVersionStrings02[1]), new VersionNumberString(2, 0, 0, glVersionStrings02[2]), @@ -135,10 +135,10 @@ public class TestGLVersionParsing00NEWT extends UITestCase { new VersionNumberString(0, 0, 0, glVersionStrings02[0]), new VersionNumberString(0, 0, 0, glVersionStrings02[1]), new VersionNumberString(0, 0, 0, glVersionStrings02[2]), - new VersionNumberString(0, 0, 0, glVersionStrings02[3]), - new VersionNumberString(0, 0, 0, glVersionStrings02[4]) + new VersionNumberString(0, 0, 0, glVersionStrings02[3]), + new VersionNumberString(0, 0, 0, glVersionStrings02[4]) }; - + @Test public void test01GLVersion() throws InterruptedException { for(int i=0; i<glVersionNumbers.length; i++) { @@ -166,7 +166,7 @@ public class TestGLVersionParsing00NEWT extends UITestCase { Assert.assertTrue(!has.hasMinor()); Assert.assertTrue(!has.hasSub()); Assert.assertTrue(!has.isValid()); - } + } { final GLVersionNumber has = GLVersionNumber.create("GL Nope"); System.err.println("Test-X3: "+has+", valid "+has.isValid()+", define ["+has.hasMajor()+":"+has.hasMinor()+":"+has.hasSub()+"]"); @@ -174,10 +174,10 @@ public class TestGLVersionParsing00NEWT extends UITestCase { Assert.assertTrue(!has.hasMinor()); Assert.assertTrue(!has.hasSub()); Assert.assertTrue(!has.isValid()); - } + } } - private void testGLVendorVersionImpl(VersionNumberString[] versionNumberString, boolean withMajor, boolean withMinor, boolean withSub) throws InterruptedException { + private void testGLVendorVersionImpl(final VersionNumberString[] versionNumberString, final boolean withMajor, final boolean withMinor, final boolean withSub) throws InterruptedException { for(int i=0; i<versionNumberString.length; i++) { final VersionNumberString exp = versionNumberString[i]; final VersionNumberString has = GLVersionNumber.createVendorVersion(exp.getVersionString()); @@ -188,16 +188,16 @@ public class TestGLVersionParsing00NEWT extends UITestCase { Assert.assertEquals(exp, has); } } - + @Test public void test02GLVendorVersion() throws InterruptedException { testGLVendorVersionImpl(glVendorVersionNumbersWithSub, true, true, true); testGLVendorVersionImpl(glVendorVersionNumbersNoSub, true, true, false); testGLVendorVersionImpl(glVendorVersionNumbersNone, false, false, false); } - - public static void main(String args[]) throws IOException { - String tstname = TestGLVersionParsing00NEWT.class.getName(); + + public static void main(final String args[]) throws IOException { + final String tstname = TestGLVersionParsing00NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGPUMemSec01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGPUMemSec01NEWT.java index 173df57f6..1f9e6e877 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGPUMemSec01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGPUMemSec01NEWT.java @@ -50,17 +50,17 @@ import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestGPUMemSec01NEWT extends UITestCase { - static String hexString(int i) { + static String hexString(final int i) { return "0x"+Integer.toHexString(i); } - static String exceptionMsg(String pre, int format, int type, int components, int width, int height, int rl1, int rl4, int rl8) { + static String exceptionMsg(final String pre, final int format, final int type, final int components, final int width, final int height, final int rl1, final int rl4, final int rl8) { return pre + ": fmt "+hexString(format)+", type "+hexString(type)+", comps "+components+ ", "+width+"x"+height+ ", rowlenA1 "+rl1+", rowlenA4 "+rl4+", rowlenA8 "+rl8; } - static NEWTGLContext.WindowContext createCurrentGLOffscreenWindow(GLProfile glp, int width, int height) throws GLException, InterruptedException { + static NEWTGLContext.WindowContext createCurrentGLOffscreenWindow(final GLProfile glp, final int width, final int height) throws GLException, InterruptedException { final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOffscreenWindow( new GLCapabilities(glp), width, height, true); final GL gl = winctx.context.getGL(); @@ -80,7 +80,7 @@ public class TestGPUMemSec01NEWT extends UITestCase { return winctx; } - static int readPixelsCheck(GL gl, int format, int type, int components, int width, int height) throws InterruptedException { + static int readPixelsCheck(final GL gl, final int format, final int type, final int components, final int width, final int height) throws InterruptedException { int expectedExceptions = 0; final int rowlenA1 = width * components; @@ -91,17 +91,17 @@ public class TestGPUMemSec01NEWT extends UITestCase { final int rowlenA8 = ( ( width * components + 7 ) / 8 ) * 8 ; Assert.assertTrue(rowlenA8 % 8 == 0); - GLPixelStorageModes psm = new GLPixelStorageModes(); + final GLPixelStorageModes psm = new GLPixelStorageModes(); psm.setPackAlignment(gl, 1); Exception ee = null; // ok size ! 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; } Assert.assertNull( @@ -112,10 +112,10 @@ public class TestGPUMemSec01NEWT extends UITestCase { // too small -10 ! try { - ByteBuffer bb = Buffers.newDirectByteBuffer(height*rowlenA1-10); + final ByteBuffer bb = Buffers.newDirectByteBuffer(height*rowlenA1-10); 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; System.err.println( exceptionMsg("OK Expected IndexOutOfBoundsException (size-10 bytes)", @@ -130,10 +130,10 @@ public class TestGPUMemSec01NEWT extends UITestCase { // too small size/4 ! try { - ByteBuffer bb = Buffers.newDirectByteBuffer(height*rowlenA1/4); + final ByteBuffer bb = Buffers.newDirectByteBuffer(height*rowlenA1/4); 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; System.err.println( exceptionMsg("OK Expected IndexOutOfBoundsException (size/4 bytes)", @@ -153,10 +153,10 @@ public class TestGPUMemSec01NEWT extends UITestCase { // ok size ! try { - ByteBuffer bb = Buffers.newDirectByteBuffer(height*rowlenA4); + final ByteBuffer bb = Buffers.newDirectByteBuffer(height*rowlenA4); 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( @@ -166,10 +166,10 @@ public class TestGPUMemSec01NEWT extends UITestCase { // too small if rowlenA1%4 > 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<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } - String tstname = TestInitConcurrent01NEWT.class.getName(); + final String tstname = TestInitConcurrent01NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestInitConcurrent02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestInitConcurrent02NEWT.java index 67b3cef38..71796e5c2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestInitConcurrent02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestInitConcurrent02NEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; @@ -46,7 +46,7 @@ import com.jogamp.common.os.Platform; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestInitConcurrent02NEWT extends InitConcurrentBaseNEWT { static boolean mainRun = false; - + @Test(timeout=180000) // TO 3 min public void test02TwoThreads() throws InterruptedException { if(!mainRun) { @@ -55,7 +55,7 @@ public class TestInitConcurrent02NEWT extends InitConcurrentBaseNEWT { } runJOGLTasks(2, false); } - + @Test(timeout=180000) // TO 3 min public void test02FourThreads() throws InterruptedException { if(!mainRun) { @@ -64,7 +64,7 @@ public class TestInitConcurrent02NEWT extends InitConcurrentBaseNEWT { } runJOGLTasks(4, false); } - + @Test(timeout=180000) // TO 3 min public void test16SixteenThreads() throws InterruptedException { if(!mainRun) { @@ -78,9 +78,9 @@ public class TestInitConcurrent02NEWT extends InitConcurrentBaseNEWT { runJOGLTasks( 6, false); } } - - public static void main(String args[]) throws IOException { - mainRun = true; + + public static void main(final String args[]) throws IOException { + mainRun = true; for(int i=0; i<args.length; i++) { if(args[i].equals("-normalRun")) { mainRun = false; @@ -88,10 +88,10 @@ public class TestInitConcurrent02NEWT extends InitConcurrentBaseNEWT { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } - String tstname = TestInitConcurrent02NEWT.class.getName(); + final String tstname = TestInitConcurrent02NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLCanvasAWT.java index 5c60d094f..5f5053089 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLCanvasAWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; @@ -47,8 +47,8 @@ public class TestMainVersionGLCanvasAWT extends UITestCase { } - public static void main(String args[]) throws IOException { - String tstname = TestMainVersionGLCanvasAWT.class.getName(); + public static void main(final String args[]) throws IOException { + final String tstname = TestMainVersionGLCanvasAWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLWindowNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLWindowNEWT.java index 85de65e2a..3b9a8c97a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLWindowNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLWindowNEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; @@ -43,7 +43,7 @@ public class TestMainVersionGLWindowNEWT extends UITestCase { @Test public void testMain() throws InterruptedException { - JoglVersion j = JoglVersion.getInstance(); + final JoglVersion j = JoglVersion.getInstance(); System.out.println("Implementation-Version: "+j.getImplementationVersion()); System.out.println("Implementation-Build: "+j.getImplementationBuild()); System.out.println("Implementation-Branch: "+j.getImplementationBranch()); @@ -52,9 +52,9 @@ public class TestMainVersionGLWindowNEWT extends UITestCase { } - public static void main(String[] args) throws IOException { + public static void main(final String[] args) throws IOException { TestMainVersionGLWindowNEWT.args = args; - String tstname = TestMainVersionGLWindowNEWT.class.getName(); + final String tstname = TestMainVersionGLWindowNEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMapBufferRead01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMapBufferRead01NEWT.java index 23778ecf6..d94c24af0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMapBufferRead01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMapBufferRead01NEWT.java @@ -63,7 +63,7 @@ public class TestMapBufferRead01NEWT extends UITestCase { System.err.println("Test requires GL2/GL3 profile."); return; } - ByteBuffer verticiesBB = ByteBuffer.allocate(4*9); + final ByteBuffer verticiesBB = ByteBuffer.allocate(4*9); verticiesBB.order(ByteOrder.nativeOrder()); testWriteRead01(verticiesBB, false /* useRange */); } @@ -73,7 +73,7 @@ public class TestMapBufferRead01NEWT extends UITestCase { System.err.println("Test requires GL2/GL3 profile."); return; } - ByteBuffer verticiesBB = Buffers.newDirectByteBuffer(4*9); + final ByteBuffer verticiesBB = Buffers.newDirectByteBuffer(4*9); testWriteRead01(verticiesBB, false /* useRange */); } @@ -83,7 +83,7 @@ public class TestMapBufferRead01NEWT extends UITestCase { System.err.println("Test requires GL3 or GLES3 profile."); return; } - ByteBuffer verticiesBB = ByteBuffer.allocate(4*9); + final ByteBuffer verticiesBB = ByteBuffer.allocate(4*9); verticiesBB.order(ByteOrder.nativeOrder()); testWriteRead01(verticiesBB, true/* useRange */); } @@ -93,18 +93,18 @@ public class TestMapBufferRead01NEWT extends UITestCase { System.err.println("Test requires GL3 or GLES3 profile."); return; } - ByteBuffer verticiesBB = Buffers.newDirectByteBuffer(4*9); + final ByteBuffer verticiesBB = Buffers.newDirectByteBuffer(4*9); testWriteRead01(verticiesBB, true /* useRange */); } - private void testWriteRead01(ByteBuffer verticiesBB, boolean useRange) throws InterruptedException { + private void testWriteRead01(final ByteBuffer verticiesBB, final boolean useRange) throws InterruptedException { final GLProfile glp = GLProfile.getMaxProgrammable(true); final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOffscreenWindow( new GLCapabilities(glp), 800, 600, true); try { final GL gl = winctx.context.getGL(); - int[] vertexBuffer = new int[1]; + final int[] vertexBuffer = new int[1]; verticiesBB.putFloat(-0.3f); verticiesBB.putFloat(-0.2f); @@ -171,8 +171,8 @@ public class TestMapBufferRead01NEWT extends UITestCase { NEWTGLContext.destroyWindow(winctx); } } - public static void main(String args[]) throws IOException { - String tstname = TestMapBufferRead01NEWT.class.getName(); + public static void main(final String args[]) throws IOException { + final String tstname = TestMapBufferRead01NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNEWTCloseX11DisplayBug565.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNEWTCloseX11DisplayBug565.java index 83e55b7e0..f91e34c12 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNEWTCloseX11DisplayBug565.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNEWTCloseX11DisplayBug565.java @@ -36,9 +36,9 @@ public class TestNEWTCloseX11DisplayBug565 { open0 = 0; } - GLCapabilitiesImmutable caps = new GLCapabilities( GLProfile.getDefault( ) ); + final GLCapabilitiesImmutable caps = new GLCapabilities( GLProfile.getDefault( ) ); - GLWindow window = GLWindow.create(caps); + final GLWindow window = GLWindow.create(caps); window.setTitle("NEWT Resource X11 Leak - #" + j ); window.setSize( 128, 128 ); window.setVisible(true); @@ -56,7 +56,7 @@ public class TestNEWTCloseX11DisplayBug565 { } } } - catch ( Exception e ) { + catch ( final Exception e ) { e.printStackTrace(); Assert.fail(e.getMessage()); } @@ -75,10 +75,10 @@ public class TestNEWTCloseX11DisplayBug565 { open0 = 0; } final GLProfile glp = GLProfile.getDefault( ); - GLCapabilitiesImmutable caps = new GLCapabilities( glp ); + final GLCapabilitiesImmutable caps = new GLCapabilities( glp ); - GLPbuffer buffer = GLDrawableFactory.getFactory( glp ).createGLPbuffer( + final GLPbuffer buffer = GLDrawableFactory.getFactory( glp ).createGLPbuffer( null, caps, new DefaultGLCapabilitiesChooser(), @@ -99,7 +99,7 @@ public class TestNEWTCloseX11DisplayBug565 { } } } - catch ( Exception e ) { + catch ( final Exception e ) { e.printStackTrace(); Assert.fail(e.getMessage()); } @@ -117,10 +117,10 @@ public class TestNEWTCloseX11DisplayBug565 { open0 = 0; } final GLProfile glp = GLProfile.getDefault( ); - GLCapabilitiesImmutable caps = new GLCapabilities( glp ); + final GLCapabilitiesImmutable caps = new GLCapabilities( glp ); - GLOffscreenAutoDrawable buffer = GLDrawableFactory.getFactory( glp ).createOffscreenAutoDrawable( + final GLOffscreenAutoDrawable buffer = GLDrawableFactory.getFactory( glp ).createOffscreenAutoDrawable( null, caps, new DefaultGLCapabilitiesChooser(), 256, 256); buffer.display(); buffer.destroy(); @@ -135,13 +135,13 @@ public class TestNEWTCloseX11DisplayBug565 { } } } - 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(TestNEWTCloseX11DisplayBug565.class.getName()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNVSwapGroupNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNVSwapGroupNEWT.java index e41f22ab0..b0c6bd670 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNVSwapGroupNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestNVSwapGroupNEWT.java @@ -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; @@ -63,31 +63,31 @@ public class TestNVSwapGroupNEWT extends UITestCase { height = 256; } - protected GLWindow runTestGL(Animator animator, int x, int y, final int group, final int barrier) { - GLWindow glWindow = GLWindow.create(caps); + protected GLWindow runTestGL(final Animator animator, final int x, final int y, final int group, final int barrier) { + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y); glWindow.setSize(width, height); - GearsES2 gears = new GearsES2(1); + final GearsES2 gears = new GearsES2(1); glWindow.addGLEventListener(new GLEventListener() { - public void init(GLAutoDrawable drawable) { - int[] maxVals = new int[] { -1, -1 } ; - GLContext glc = drawable.getContext(); - boolean r = glc.queryMaxSwapGroups(maxVals, 0, maxVals, 1); + public void init(final GLAutoDrawable drawable) { + final int[] maxVals = new int[] { -1, -1 } ; + final GLContext glc = drawable.getContext(); + final boolean r = glc.queryMaxSwapGroups(maxVals, 0, maxVals, 1); System.err.println("swap group max groups "+maxVals[0]+", barriers "+maxVals[0]+", "+r); if(maxVals[0]>=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()<duration) { Thread.sleep(100); @@ -128,13 +128,13 @@ public class TestNVSwapGroupNEWT 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<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } org.junit.runner.JUnitCore.main(TestNVSwapGroupNEWT.class.getName()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java index c93e54eb9..f96886712 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.acore; import java.awt.BorderLayout; @@ -80,32 +80,32 @@ public class TestOffscreenLayer01GLCanvasAWT extends UITestCase { preferredGLSize = new Dimension(400,200); } - private void setupFrameAndShow(final Frame f, java.awt.Component comp) throws InterruptedException, InvocationTargetException { - - Container c = new Container(); + private void setupFrameAndShow(final Frame f, final java.awt.Component comp) throws InterruptedException, InvocationTargetException { + + final Container c = new Container(); c.setLayout(new BorderLayout()); c.add(new Button("north"), BorderLayout.NORTH); c.add(new Button("south"), BorderLayout.SOUTH); c.add(new Button("east"), BorderLayout.EAST); c.add(new Button("west"), BorderLayout.WEST); c.add(comp, BorderLayout.CENTER); - + f.setLayout(new BorderLayout()); f.add(new Button("NORTH"), BorderLayout.NORTH); f.add(new Button("SOUTH"), BorderLayout.SOUTH); f.add(new Button("EAST"), BorderLayout.EAST); f.add(new Button("WEST"), BorderLayout.WEST); f.add(c, BorderLayout.CENTER); - + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { f.pack(); f.validate(); f.setVisible(true); - }}); + }}); } - - private void end(GLAnimatorControl actrl, final Frame f, Window w) throws InterruptedException, InvocationTargetException { + + private void end(final GLAnimatorControl actrl, final Frame f, final Window w) throws InterruptedException, InvocationTargetException { actrl.stop(); javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { @@ -119,33 +119,33 @@ public class TestOffscreenLayer01GLCanvasAWT extends UITestCase { @Test public void testInfo00() throws InterruptedException, InvocationTargetException { System.err.println("Java Version: "+Platform.getJavaVersionNumber()); - System.err.println("OS Version: "+Platform.getOSVersionNumber()); + System.err.println("OS Version: "+Platform.getOSVersionNumber()); System.err.println("JAWTUtil.isOffscreenLayerRequired(): "+JAWTUtil.isOffscreenLayerRequired()); System.err.println("JAWTUtil.isOffscreenLayerSupported(): "+JAWTUtil.isOffscreenLayerSupported()); } - + @Test - public void test01_GLDefault() throws InterruptedException, InvocationTargetException { + public void test01_GLDefault() throws InterruptedException, InvocationTargetException { testOffscreenLayerGLCanvas_Impl(null); } - + @Test - public void test01_GL3() throws InterruptedException, InvocationTargetException { + public void test01_GL3() throws InterruptedException, InvocationTargetException { if( !GLProfile.isAvailable(GLProfile.GL3) ) { System.err.println("GL3 n/a"); return; } testOffscreenLayerGLCanvas_Impl(GLProfile.get(GLProfile.GL3)); } - - private void testOffscreenLayerGLCanvas_Impl(GLProfile glp) throws InterruptedException, InvocationTargetException { + + private void testOffscreenLayerGLCanvas_Impl(final GLProfile glp) throws InterruptedException, InvocationTargetException { if(!JAWTUtil.isOffscreenLayerSupported()) { System.err.println("offscreen layer n/a"); return; - } + } final Frame frame1 = new Frame("AWT Parent Frame"); - - GLCapabilities caps = new GLCapabilities(glp); + + final GLCapabilities caps = new GLCapabilities(glp); if(singleBuffer) { caps.setDoubleBuffered(false); } @@ -162,20 +162,20 @@ public class TestOffscreenLayer01GLCanvasAWT extends UITestCase { glc.setPreferredSize(preferredGLSize); glc.setMinimumSize(preferredGLSize); glc.setSize(preferredGLSize); - - GearsES2 demo1 = new GearsES2(swapInterval); + + final GearsES2 demo1 = new GearsES2(swapInterval); if(noAnimation) { demo1.setDoRotation(false); } glc.addGLEventListener(demo1); - + frame1.setSize(frameSize0); setupFrameAndShow(frame1, glc); Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glc, true)); Assert.assertEquals(true, AWTRobotUtil.waitForVisible(glc, true)); Assert.assertEquals(true, glc.isOffscreenLayerSurfaceEnabled()); - - GLAnimatorControl animator1 = new Animator(glc); + + final GLAnimatorControl animator1 = new Animator(glc); if(!noAnimation) { animator1.start(); } @@ -187,20 +187,20 @@ public class TestOffscreenLayer01GLCanvasAWT extends UITestCase { frame1.setSize(frameSize1); frame1.pack(); frame1.validate(); - }}); - + }}); + Thread.sleep(durationPerTest/2); - - end(animator1, frame1, null); + + end(animator1, frame1, null); if( waitForKey ) { UITestCase.waitForKey("Continue"); } } - - 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); @@ -210,15 +210,15 @@ public class TestOffscreenLayer01GLCanvasAWT 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); @@ -240,7 +240,7 @@ public class TestOffscreenLayer01GLCanvasAWT extends UITestCase { if(waitForKey) { UITestCase.waitForKey("Start"); } - String tstname = TestOffscreenLayer01GLCanvasAWT.class.getName(); + final String tstname = TestOffscreenLayer01GLCanvasAWT.class.getName(); /* org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { tstname, diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java index 5335d858e..d48d490b2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.acore; import java.awt.BorderLayout; @@ -80,31 +80,31 @@ public class TestOffscreenLayer02NewtCanvasAWT extends UITestCase { preferredGLSize = new Dimension(400,200); } - private void setupFrameAndShow(final Frame f, java.awt.Component comp) throws InterruptedException, InvocationTargetException { - Container c = new Container(); + private void setupFrameAndShow(final Frame f, final java.awt.Component comp) throws InterruptedException, InvocationTargetException { + final Container c = new Container(); c.setLayout(new BorderLayout()); c.add(new Button("north"), BorderLayout.NORTH); c.add(new Button("south"), BorderLayout.SOUTH); c.add(new Button("east"), BorderLayout.EAST); c.add(new Button("west"), BorderLayout.WEST); c.add(comp, BorderLayout.CENTER); - + f.setLayout(new BorderLayout()); f.add(new Button("NORTH"), BorderLayout.NORTH); f.add(new Button("SOUTH"), BorderLayout.SOUTH); f.add(new Button("EAST"), BorderLayout.EAST); f.add(new Button("WEST"), BorderLayout.WEST); f.add(c, BorderLayout.CENTER); - + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { f.pack(); f.validate(); f.setVisible(true); - }}); + }}); } - - private void end(GLAnimatorControl actrl, final Frame f, Window w) throws InterruptedException, InvocationTargetException { + + private void end(final GLAnimatorControl actrl, final Frame f, final Window w) throws InterruptedException, InvocationTargetException { actrl.stop(); javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { @@ -114,12 +114,12 @@ public class TestOffscreenLayer02NewtCanvasAWT extends UITestCase { w.destroy(); } } - + @Test - public void test01_GLDefault() throws InterruptedException, InvocationTargetException { + public void test01_GLDefault() throws InterruptedException, InvocationTargetException { testOffscreenLayerNewtCanvas_Impl(null); } - + @Test public void test02_GL3() throws InterruptedException, InvocationTargetException { if( !GLProfile.isAvailable(GLProfile.GL3) ) { @@ -128,15 +128,15 @@ public class TestOffscreenLayer02NewtCanvasAWT extends UITestCase { } testOffscreenLayerNewtCanvas_Impl(GLProfile.get(GLProfile.GL3)); } - - private void testOffscreenLayerNewtCanvas_Impl(GLProfile glp) throws InterruptedException, InvocationTargetException { + + private void testOffscreenLayerNewtCanvas_Impl(final GLProfile glp) throws InterruptedException, InvocationTargetException { if(!JAWTUtil.isOffscreenLayerSupported()) { System.err.println("offscreen layer n/a"); return; - } + } final Frame frame1 = new Frame("AWT Parent Frame"); - - GLCapabilities caps = new GLCapabilities(glp); + + final GLCapabilities caps = new GLCapabilities(glp); if(singleBuffer) { caps.setDoubleBuffered(false); } @@ -148,30 +148,30 @@ public class TestOffscreenLayer02NewtCanvasAWT extends UITestCase { caps.setPBuffer(true); caps.setOnscreen(true); // get native NEWT Window, not OffscreenWindow } - GLWindow glWindow1 = GLWindow.create(caps); - + final GLWindow glWindow1 = GLWindow.create(caps); + final NewtCanvasAWT newtCanvasAWT1 = new NewtCanvasAWT(glWindow1); newtCanvasAWT1.setShallUseOffscreenLayer(true); // trigger offscreen layer - if supported newtCanvasAWT1.setPreferredSize(preferredGLSize); newtCanvasAWT1.setMinimumSize(preferredGLSize); newtCanvasAWT1.setSize(preferredGLSize); - - GearsES2 demo1 = new GearsES2(swapInterval); + + final GearsES2 demo1 = new GearsES2(swapInterval); if(noAnimation) { demo1.setDoRotation(false); } setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1, null)); - + frame1.setSize(frameSize0); setupFrameAndShow(frame1, newtCanvasAWT1); Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow1, true)); Assert.assertEquals(true, AWTRobotUtil.waitForVisible(glWindow1, true)); Assert.assertEquals(newtCanvasAWT1.getNativeWindow(),glWindow1.getParent()); Assert.assertEquals(true, newtCanvasAWT1.isOffscreenLayerSurfaceEnabled()); - - GLAnimatorControl animator1 = new Animator(glWindow1); + + final GLAnimatorControl animator1 = new Animator(glWindow1); if(!noAnimation) { animator1.start(); } @@ -183,20 +183,20 @@ public class TestOffscreenLayer02NewtCanvasAWT extends UITestCase { frame1.setSize(frameSize1); frame1.pack(); frame1.validate(); - }}); - + }}); + Thread.sleep(durationPerTest/2); - + end(animator1, frame1, glWindow1); if( waitForKey ) { UITestCase.waitForKey("Continue"); } } - 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); @@ -206,15 +206,15 @@ public class TestOffscreenLayer02NewtCanvasAWT 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); @@ -236,7 +236,7 @@ public class TestOffscreenLayer02NewtCanvasAWT extends UITestCase { if(waitForKey) { UITestCase.waitForKey("Start"); } - String tstname = TestOffscreenLayer02NewtCanvasAWT.class.getName(); + final String tstname = TestOffscreenLayer02NewtCanvasAWT.class.getName(); /* org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { tstname, diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPBufferDeadlockAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPBufferDeadlockAWT.java index a1f0d3330..7138513d5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPBufferDeadlockAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPBufferDeadlockAWT.java @@ -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 TestPBufferDeadlockAWT extends UITestCase { height = 512; } - protected void runTestGL( GLCapabilities caps ) throws InterruptedException, InvocationTargetException { + protected void runTestGL( final GLCapabilities caps ) throws InterruptedException, InvocationTargetException { final GLPbuffer pbuffer = GLDrawableFactory.getFactory( GLProfile.getGL2ES2() ).createGLPbuffer( null, caps, new DefaultGLCapabilitiesChooser(), @@ -78,30 +78,30 @@ public class TestPBufferDeadlockAWT extends UITestCase { System.err.println("AA.X"); } }; - + EventQueue.invokeAndWait(new Runnable() { public void run() { Assert.assertTrue(EventQueue.isDispatchThread()); JAWTUtil.lockToolkit(); try { - final RunnableTask rTask = new RunnableTask(pbufferCreationAction, new Object(), false, null); + final RunnableTask rTask = new RunnableTask(pbufferCreationAction, new Object(), false, null); System.err.println("BB.0: "+rTask.getSyncObject()); synchronized (rTask.getSyncObject()) { System.err.println("BB.1: "+rTask.getSyncObject()); - new Thread(rTask, Thread.currentThread().getName()+"-Pbuffer_Creation").start(); + new Thread(rTask, Thread.currentThread().getName()+"-Pbuffer_Creation").start(); try { System.err.println("BB.2"); rTask.getSyncObject().wait(); System.err.println("BB.3"); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { throw new RuntimeException(e); - } + } System.err.println("BB.X"); } } finally { JAWTUtil.unlockToolkit(); } - } + } }); Assert.assertTrue(done[0]); pbuffer.destroy(); @@ -109,24 +109,24 @@ public class TestPBufferDeadlockAWT extends UITestCase { @Test(timeout = 2000) // 2s timeout public void testDeadlock() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities( glp ); + final GLCapabilities caps = new GLCapabilities( glp ); 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 < args.length; i++ ) { if ( args[ i ].equals( "-time" ) ) { i++; try { duration = Integer.parseInt( args[ i ] ); } - catch ( Exception ex ) { + catch ( final Exception ex ) { ex.printStackTrace(); } } } org.junit.runner.JUnitCore.main( TestPBufferDeadlockAWT.class.getName() ); } -} +} diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java index 77657f6f1..44ff2d20b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java @@ -106,7 +106,7 @@ public class TestSharedContextListAWT extends UITestCase { frame.setLocation(x, y); frame.setSize(width, height); - Gears gears = new Gears(vsync ? 1 : 0); + final Gears gears = new Gears(vsync ? 1 : 0); if(useShared) { gears.setGears(sharedGears.getGear1(), sharedGears.getGear2(), sharedGears.getGear3()); } @@ -129,11 +129,11 @@ public class TestSharedContextListAWT extends UITestCase { final Frame f1 = new Frame(); final Frame f2 = new Frame(); final Frame f3 = new Frame(); - Animator animator = new Animator(); + final Animator animator = new Animator(); final GLCanvas glc1 = runTestGL(f1, animator, 0, 0, true, false); - int x0 = f1.getX(); - int y0 = f1.getY(); + final int x0 = f1.getX(); + final int y0 = f1.getY(); final GLCanvas glc2 = runTestGL(f2, animator, x0+width, @@ -166,11 +166,11 @@ public class TestSharedContextListAWT extends UITestCase { Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glc2, false)); f3.dispose(); Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glc3, false)); - } catch (Throwable t) { + } catch (final Throwable t) { throw new RuntimeException(t); } }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -180,13 +180,13 @@ public class TestSharedContextListAWT 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<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } org.junit.runner.JUnitCore.main(TestSharedContextListAWT.class.getName()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java index 09173fb24..0469092fb 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java @@ -87,8 +87,8 @@ public class TestSharedContextListNEWT extends UITestCase { sharedDrawable = null; } - protected GLWindow runTestGL(Animator animator, int x, int y, boolean useShared, boolean vsync) throws InterruptedException { - GLWindow glWindow = GLWindow.create(caps); + protected GLWindow runTestGL(final Animator animator, final int x, final int y, final boolean useShared, final boolean vsync) throws InterruptedException { + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared "+useShared); if(useShared) { @@ -97,7 +97,7 @@ public class TestSharedContextListNEWT extends UITestCase { glWindow.setSize(width, height); - Gears gears = new Gears(vsync ? 1 : 0); + final Gears gears = new Gears(vsync ? 1 : 0); if(useShared) { gears.setGears(sharedGears.getGear1(), sharedGears.getGear2(), sharedGears.getGear3()); } @@ -116,12 +116,12 @@ public class TestSharedContextListNEWT extends UITestCase { @Test public void test01() throws InterruptedException { initShared(); - Animator animator = new Animator(); - GLWindow f1 = runTestGL(animator, 0, 0, true, false); - InsetsImmutable insets = f1.getInsets(); - GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(), + final Animator animator = new Animator(); + final GLWindow f1 = runTestGL(animator, 0, 0, true, false); + final InsetsImmutable insets = f1.getInsets(); + final GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(), f1.getY()+0, true, false); - GLWindow f3 = runTestGL(animator, f1.getX()+0, + final GLWindow f3 = runTestGL(animator, f1.getX()+0, f1.getY()+height+insets.getTotalHeight(), false, true); animator.setUpdateFPSFrames(1, null); animator.start(); @@ -139,13 +139,13 @@ public class TestSharedContextListNEWT extends UITestCase { static long duration = 500; // ms - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } /** diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java index 967c94ec6..a11ddcdb0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; @@ -87,9 +87,9 @@ public class TestSharedContextListNEWT2 extends UITestCase { sharedDrawable = null; } - protected GLWindow runTestGL(Animator animator, int x, int y, boolean useShared, boolean vsync) throws InterruptedException { - GLWindow glWindow = GLWindow.create(caps); - + protected GLWindow runTestGL(final Animator animator, final int x, final int y, final boolean useShared, final boolean vsync) throws InterruptedException { + final GLWindow glWindow = GLWindow.create(caps); + Assert.assertNotNull(glWindow); glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared "+useShared); if(useShared) { @@ -98,7 +98,7 @@ public class TestSharedContextListNEWT2 extends UITestCase { glWindow.setSize(width, height); - Gears gears = new Gears(vsync ? 1 : 0); + final Gears gears = new Gears(vsync ? 1 : 0); if(useShared) { gears.setGears(sharedGears.getGear1(), sharedGears.getGear2(), sharedGears.getGear3()); } @@ -111,31 +111,31 @@ public class TestSharedContextListNEWT2 extends UITestCase { Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true)); glWindow.setPosition(x, y); - + return glWindow; } @Test(timeout=10000) public void test01() throws InterruptedException { initShared(); - + final GLWindow f1 = runTestGL(new Animator(), 0, 0, true, false); final InsetsImmutable insets = f1.getInsets(); - final GLWindow f2 = runTestGL(new Animator(), f1.getX()+width+insets.getTotalWidth(), + final GLWindow f2 = runTestGL(new Animator(), f1.getX()+width+insets.getTotalWidth(), f1.getY()+0, true, false); - final GLWindow f3 = runTestGL(new Animator(), f1.getX()+0, + final GLWindow f3 = runTestGL(new Animator(), f1.getX()+0, f1.getY()+height+insets.getTotalHeight(), true, false); try { Thread.sleep(duration); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } f1.destroy(); f2.destroy(); f3.destroy(); - + // f1.getAnimator().stop(); // f2.getAnimator().stop(); // f3.getAnimator().stop(); @@ -145,19 +145,19 @@ public class TestSharedContextListNEWT2 extends UITestCase { static long duration = 2000; // ms - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } /** BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); System.err.println("Press enter to continue"); - System.err.println(stdin.readLine()); */ + System.err.println(stdin.readLine()); */ org.junit.runner.JUnitCore.main(TestSharedContextListNEWT2.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java index ff98d6f57..a1a33531a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java @@ -51,6 +51,8 @@ import javax.media.opengl.GLEventListener; import javax.media.opengl.GLOffscreenAutoDrawable; import javax.media.opengl.GLProfile; import javax.media.opengl.awt.GLCanvas; +import javax.media.opengl.fixedfunc.GLMatrixFunc; +import javax.media.opengl.fixedfunc.GLPointerFunc; import javax.media.opengl.glu.GLU; import javax.swing.Box; import javax.swing.BoxLayout; @@ -58,6 +60,7 @@ import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSlider; +import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -129,7 +132,7 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { } } - static private GLOffscreenAutoDrawable initShared(GLCapabilities caps) { + static private GLOffscreenAutoDrawable initShared(final GLCapabilities caps) { final GLOffscreenAutoDrawable sharedDrawable = GLDrawableFactory.getFactory(caps.getGLProfile()).createOffscreenAutoDrawable(null, caps, null, 64, 64); Assert.assertNotNull(sharedDrawable); // init and render one frame, which will setup the Gears display lists @@ -140,7 +143,7 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { return sharedDrawable; } - static private void releaseShared(GLOffscreenAutoDrawable sharedDrawable) { + static private void releaseShared(final GLOffscreenAutoDrawable sharedDrawable) { if(null != sharedDrawable) { sharedDrawable.destroy(); } @@ -165,8 +168,8 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { private final int [] privateVertexBufferObjects = {0}; private final int [] privateIndexBufferObjects = {0}; - public static int createVertexBuffer(GL2 gl2) { - final FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(18); + public static int createVertexBuffer(final GL2 gl2) { + final FloatBuffer vertexBuffer = Buffers.newDirectFloatBuffer(18); vertexBuffer.put(new float[]{ 1.0f, -0.5f, 0f, // vertex 1 0f, 0f, 1f, // normal 1 @@ -179,46 +182,46 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { final int[] vbo = { 0 }; gl2.glGenBuffers(1, vbo, 0); - gl2.glBindBuffer(GL2.GL_ARRAY_BUFFER, vbo[0]); - gl2.glBufferData(GL2.GL_ARRAY_BUFFER, vertexBuffer.capacity() * Buffers.SIZEOF_FLOAT, vertexBuffer, GL2.GL_STATIC_DRAW); - gl2.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0); + gl2.glBindBuffer(GL.GL_ARRAY_BUFFER, vbo[0]); + gl2.glBufferData(GL.GL_ARRAY_BUFFER, vertexBuffer.capacity() * Buffers.SIZEOF_FLOAT, vertexBuffer, GL.GL_STATIC_DRAW); + gl2.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); return vbo[0]; } - public static int createVertexIndexBuffer(GL2 gl2) { - final IntBuffer indexBuffer = GLBuffers.newDirectIntBuffer(3); + public static int createVertexIndexBuffer(final GL2 gl2) { + final IntBuffer indexBuffer = Buffers.newDirectIntBuffer(3); indexBuffer.put(new int[]{0, 1, 2}); indexBuffer.position(0); final int[] vbo = { 0 }; gl2.glGenBuffers(1, vbo, 0); - gl2.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, vbo[0]); - gl2.glBufferData(GL2.GL_ELEMENT_ARRAY_BUFFER, indexBuffer.capacity() * Buffers.SIZEOF_INT, indexBuffer, GL2.GL_STATIC_DRAW); - gl2.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, 0); + gl2.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, vbo[0]); + gl2.glBufferData(GL.GL_ELEMENT_ARRAY_BUFFER, indexBuffer.capacity() * Buffers.SIZEOF_INT, indexBuffer, GL.GL_STATIC_DRAW); + gl2.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, 0); return vbo[0]; } - TwoTriangles (int canvasWidth, int canvasHeight, boolean useShared) { + TwoTriangles (final int canvasWidth, final int canvasHeight, final boolean useShared) { // instanceNum = instanceCounter++; this.canvasWidth = canvasWidth; this.canvasHeight = canvasHeight; this.useShared = useShared; } - public void setXAxisRotation(float xRot) { + public void setXAxisRotation(final float xRot) { xAxisRotation = xRot; } - public void setYAxisRotation(float yRot) { + public void setYAxisRotation(final float yRot) { yAxisRotation = yRot; } - public void setViewDistanceFactor(float factor) { + public void setViewDistanceFactor(final float factor) { viewDistanceFactor = factor; } - public void init(GLAutoDrawable drawable) { - GL2 gl2 = drawable.getGL().getGL2(); + public void init(final GLAutoDrawable drawable) { + final GL2 gl2 = drawable.getGL().getGL2(); System.err.println("INIT GL IS: " + gl2.getClass().getName()); @@ -259,13 +262,13 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { // I found that with my system glDrawElements causes a runtime exception 50% of the time. Executing the binds // to unshareable buffers sets up glDrawElements for unpredictable crashes -- sometimes it does, sometimes not. if (gl2.glIsBuffer(vertexBufferObjects[0])) { - gl2.glBindBuffer(GL2.GL_ARRAY_BUFFER, vertexBufferObjects[0]); + gl2.glBindBuffer(GL.GL_ARRAY_BUFFER, vertexBufferObjects[0]); // - gl2.glEnableClientState(GL2.GL_VERTEX_ARRAY); - gl2.glVertexPointer(3, GL2.GL_FLOAT, 6 * GLBuffers.SIZEOF_FLOAT, 0); + gl2.glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY); + gl2.glVertexPointer(3, GL.GL_FLOAT, 6 * Buffers.SIZEOF_FLOAT, 0); // - gl2.glEnableClientState(GL2.GL_NORMAL_ARRAY); - gl2.glNormalPointer(GL2.GL_FLOAT, 6 * GLBuffers.SIZEOF_FLOAT, 3 * GLBuffers.SIZEOF_FLOAT); + gl2.glEnableClientState(GLPointerFunc.GL_NORMAL_ARRAY); + gl2.glNormalPointer(GL.GL_FLOAT, 6 * Buffers.SIZEOF_FLOAT, 3 * Buffers.SIZEOF_FLOAT); } else { System.err.println("Vertex VBO is not a buffer on slave 0x"+Integer.toHexString(hashCode())); } @@ -277,15 +280,15 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { // again, a check in the case that buffer sharing is enabled but context sharing is not enabled if (gl2.glIsBuffer(indexBufferObjects[0])) { - gl2.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, indexBufferObjects[0]); + gl2.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, indexBufferObjects[0]); } else { System.err.println("Index VBO is not a buffer on slave 0x"+Integer.toHexString(hashCode())); } - gl2.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, 0); - gl2.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0); - gl2.glDisableClientState(GL2.GL_VERTEX_ARRAY); - gl2.glDisableClientState(GL2.GL_NORMAL_ARRAY); + gl2.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, 0); + gl2.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); + gl2.glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY); + gl2.glDisableClientState(GLPointerFunc.GL_NORMAL_ARRAY); initializationCounter++; } // synchronized (this) @@ -295,12 +298,12 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { } - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { synchronized (this) { initializationCounter--; - GL2 gl2 = drawable.getGL().getGL2(); + final GL2 gl2 = drawable.getGL().getGL2(); // release shared resources if (initializationCounter == 0 || !useShared) { @@ -328,10 +331,10 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { } // synchronized (this) } - 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) { // wait until all instances are initialized before attempting to draw using the // vertex array object, because the buffers are allocated in init and when the @@ -342,22 +345,22 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { } } - GL2 gl2 = drawable.getGL().getGL2(); - GLU glu = new GLU(); + final GL2 gl2 = drawable.getGL().getGL2(); + final GLU glu = new GLU(); logAnyErrorCodes(this, gl2, "display.0"); // Clear the drawing area - gl2.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT); + gl2.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl2.glViewport(0, 0, canvasWidth, canvasHeight); - gl2.glMatrixMode(GL2.GL_PROJECTION); + gl2.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl2.glLoadIdentity(); glu.gluPerspective(viewFovDegrees, (float)canvasWidth/(float)canvasHeight, viewDistance*viewDistanceFactor-boundsRadius, viewDistance*viewDistanceFactor+boundsRadius); // Reset the current matrix to the "identity" - gl2.glMatrixMode(GL2.GL_MODELVIEW); + gl2.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl2.glLoadIdentity(); // draw the scene @@ -368,8 +371,8 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { gl2.glRotatef(xAxisRotation, 1, 0, 0); gl2.glRotatef(yAxisRotation, 0, 1, 0); - gl2.glDisable(GL2.GL_CULL_FACE); - gl2.glEnable(GL2.GL_DEPTH_TEST); + gl2.glDisable(GL.GL_CULL_FACE); + gl2.glEnable(GL.GL_DEPTH_TEST); logAnyErrorCodes(this, gl2, "display.1"); @@ -385,11 +388,11 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { logAnyErrorCodes(this, gl2, "display.X"); } - public void drawTwoTriangles(GL2 gl2) { + public void drawTwoTriangles(final GL2 gl2) { // draw a red triangle the old fashioned way gl2.glColor3f(1f, 0f, 0f); - gl2.glBegin(GL2.GL_TRIANGLES); + gl2.glBegin(GL.GL_TRIANGLES); gl2.glVertex3d(-1.5, -0.5, 0); gl2.glNormal3d(0, 0, 1); gl2.glVertex3d(-0.5, -0.5, 0); @@ -429,12 +432,12 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { final boolean isVBO2 = gl2.glIsBuffer(vertexBufferObjects[0]); final boolean useVBO = isVBO1 && isVBO2; if ( useVBO ) { - gl2.glBindBuffer(GL2.GL_ARRAY_BUFFER, vertexBufferObjects[0]); - gl2.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, indexBufferObjects[0]); + gl2.glBindBuffer(GL.GL_ARRAY_BUFFER, vertexBufferObjects[0]); + gl2.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, indexBufferObjects[0]); - gl2.glEnableClientState(GL2.GL_VERTEX_ARRAY); + gl2.glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY); // gl2.glVertexPointer(3, GL2.GL_FLOAT, 6 * GLBuffers.SIZEOF_FLOAT, 0); - gl2.glEnableClientState(GL2.GL_NORMAL_ARRAY); + gl2.glEnableClientState(GLPointerFunc.GL_NORMAL_ARRAY); // gl2.glNormalPointer(GL2.GL_FLOAT, 6 * GLBuffers.SIZEOF_FLOAT, 3 * GLBuffers.SIZEOF_FLOAT); vboBound = true; } @@ -444,24 +447,24 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { if (vboBound) { gl2.glColor3f(0f, 0f, 1f); - gl2.glDrawElements(GL2.GL_TRIANGLES, 3, GL2.GL_UNSIGNED_INT, 0); - gl2.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0); - gl2.glBindBuffer(GL2.GL_ELEMENT_ARRAY_BUFFER, 0); - gl2.glDisableClientState(GL2.GL_VERTEX_ARRAY); - gl2.glDisableClientState(GL2.GL_NORMAL_ARRAY); + gl2.glDrawElements(GL.GL_TRIANGLES, 3, GL.GL_UNSIGNED_INT, 0); + gl2.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); + gl2.glBindBuffer(GL.GL_ELEMENT_ARRAY_BUFFER, 0); + gl2.glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY); + gl2.glDisableClientState(GLPointerFunc.GL_NORMAL_ARRAY); } logAnyErrorCodes(this, gl2, "drawTwoTriangles.3"); } - public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) { + public void displayChanged(final GLAutoDrawable drawable, final boolean modeChanged, final boolean deviceChanged) { } } // inner class TwoTriangles private static final Set<String> errorSet = new HashSet<String>(); - 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<args.length; i++) { if(args[i].equals("-time")) { if (++i < args.length) { @@ -810,7 +813,7 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { } } - String testname = TestSharedContextNewtAWTBug523.class.getName(); + final String testname = TestSharedContextNewtAWTBug523.class.getName(); org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { testname, "filtertrace=true", diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java index 0f4f8fc34..a9e7c0cc1 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java @@ -92,7 +92,7 @@ public class TestSharedContextVBOES1NEWT extends UITestCase { } private void initShared() throws InterruptedException { - GLDrawable dummyDrawable = GLDrawableFactory.getFactory(glp).createDummyDrawable(null, true /* createNewDevice */, caps, null); + final GLDrawable dummyDrawable = GLDrawableFactory.getFactory(glp).createDummyDrawable(null, true /* createNewDevice */, caps, null); dummyDrawable.setRealized(true); sharedDrawable = new GLAutoDrawableDelegate(dummyDrawable, null, null, true /*ownDevice*/, null) { }; Assert.assertNotNull(sharedDrawable); @@ -114,8 +114,8 @@ public class TestSharedContextVBOES1NEWT extends UITestCase { sharedDrawable.destroy(); } - protected GLWindow runTestGL(Animator animator, int x, int y, boolean useShared, boolean vsync) throws InterruptedException { - GLWindow glWindow = GLWindow.create(caps); + protected GLWindow runTestGL(final Animator animator, final int x, final int y, final boolean useShared, final boolean vsync) throws InterruptedException { + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setPosition(x, y); glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared "+useShared); @@ -125,7 +125,7 @@ public class TestSharedContextVBOES1NEWT extends UITestCase { glWindow.setSize(width, height); - GearsES1 gears = new GearsES1(vsync ? 1 : 0); + final GearsES1 gears = new GearsES1(vsync ? 1 : 0); if(useShared) { gears.setSharedGearsObjects(sharedGears.getGear1(), sharedGears.getGear2(), sharedGears.getGear3()); } @@ -153,12 +153,12 @@ public class TestSharedContextVBOES1NEWT extends UITestCase { @Test public void test01() throws InterruptedException { initShared(); - Animator animator = new Animator(); - GLWindow f1 = runTestGL(animator, 0, 0, true, false); - InsetsImmutable insets = f1.getInsets(); - GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(), + final Animator animator = new Animator(); + final GLWindow f1 = runTestGL(animator, 0, 0, true, false); + final InsetsImmutable insets = f1.getInsets(); + final GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(), f1.getY()+0, true, false); - GLWindow f3 = runTestGL(animator, f1.getX()+0, + final GLWindow f3 = runTestGL(animator, f1.getX()+0, f1.getY()+height+insets.getTotalHeight(), false, true); animator.setUpdateFPSFrames(1, null); animator.start(); @@ -176,13 +176,13 @@ public class TestSharedContextVBOES1NEWT 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<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } org.junit.runner.JUnitCore.main(TestSharedContextVBOES1NEWT.class.getName()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3.java index 3b576fabd..a0662f862 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3.java @@ -81,7 +81,7 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase { } } - protected GLCanvas createGLCanvas(final Frame frame, int x, int y, GearsES2 gears) throws InterruptedException { + protected GLCanvas createGLCanvas(final Frame frame, final int x, final int y, final GearsES2 gears) throws InterruptedException { final GLCanvas glCanvas = new GLCanvas(caps); Assert.assertNotNull(glCanvas); glCanvas.addGLEventListener(gears); @@ -178,7 +178,7 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase { try { Thread.sleep(duration); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } // Stopped animator allows native windowing system 'repaint' event @@ -199,7 +199,7 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase { } else { f1.dispose(); } - } catch (Throwable t) { + } catch (final Throwable t) { throw new RuntimeException(t); } }}); @@ -212,7 +212,7 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase { } else { f2.dispose(); } - } catch (Throwable t) { + } catch (final Throwable t) { throw new RuntimeException(t); } }}); @@ -225,7 +225,7 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase { } else { f3.dispose(); } - } catch (Throwable t) { + } catch (final Throwable t) { throw new RuntimeException(t); } }}); @@ -332,7 +332,7 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase { try { Thread.sleep(duration); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } // Stopped animator allows native windowing system 'repaint' event @@ -357,7 +357,7 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase { } else { f1.dispose(); } - } catch (Throwable t) { + } catch (final Throwable t) { throw new RuntimeException(t); } }}); @@ -370,7 +370,7 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase { } else { f2.dispose(); } - } catch (Throwable t) { + } catch (final Throwable t) { throw new RuntimeException(t); } }}); @@ -383,7 +383,7 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase { } else { f3.dispose(); } - } catch (Throwable t) { + } catch (final Throwable t) { throw new RuntimeException(t); } }}); @@ -395,13 +395,13 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase { static long duration = 1000; // ms - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } /** diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3b.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3b.java index d4079e30c..4c9cb7253 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3b.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3b.java @@ -81,7 +81,7 @@ public class TestSharedContextVBOES2AWT3b extends UITestCase { } } - protected GLJPanel createGLJPanel(final Frame frame, int x, int y, GearsES2 gears) throws InterruptedException { + protected GLJPanel createGLJPanel(final Frame frame, final int x, final int y, final GearsES2 gears) throws InterruptedException { final GLJPanel glCanvas = new GLJPanel(caps); Assert.assertNotNull(glCanvas); glCanvas.addGLEventListener(gears); @@ -169,7 +169,7 @@ public class TestSharedContextVBOES2AWT3b extends UITestCase { try { Thread.sleep(duration); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } // Stopped animator allows native windowing system 'repaint' event @@ -183,7 +183,7 @@ public class TestSharedContextVBOES2AWT3b extends UITestCase { f3.dispose(); f2.dispose(); f1.dispose(); - } catch (Throwable t) { + } catch (final Throwable t) { throw new RuntimeException(t); } }}); @@ -281,7 +281,7 @@ public class TestSharedContextVBOES2AWT3b extends UITestCase { try { Thread.sleep(duration); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } // Stopped animator allows native windowing system 'repaint' event @@ -299,7 +299,7 @@ public class TestSharedContextVBOES2AWT3b extends UITestCase { f3.dispose(); f2.dispose(); f1.dispose(); - } catch (Throwable t) { + } catch (final Throwable t) { throw new RuntimeException(t); } }}); @@ -311,13 +311,13 @@ public class TestSharedContextVBOES2AWT3b extends UITestCase { static long duration = 1000; // ms - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } /** diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java index 010368b4b..3efbabb20 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java @@ -76,9 +76,9 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase { } } - protected GLWindow runTestGL(Animator animator, int x, int y, GearsES2 gears, GLContext sharedContext) throws InterruptedException { + protected GLWindow runTestGL(final Animator animator, final int x, final int y, final GearsES2 gears, final GLContext sharedContext) throws InterruptedException { final boolean useShared = null != sharedContext; - GLWindow glWindow = GLWindow.create(caps); + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setPosition(x, y); glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared "+useShared); @@ -107,7 +107,7 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase { public void test02CommonAnimatorMapBuffer() throws InterruptedException { testCommonAnimatorSharedImpl(true); } - private void testCommonAnimatorSharedImpl(boolean useMappedBuffers) throws InterruptedException { + private void testCommonAnimatorSharedImpl(final boolean useMappedBuffers) throws InterruptedException { final Animator animator = new Animator(); // @@ -184,7 +184,7 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase { try { Thread.sleep(duration); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } @@ -210,7 +210,7 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase { Assert.assertEquals("Ctx2 has unexpected number of created shares", 1, ctx2Shares.size()); Assert.assertEquals("Ctx3 has unexpected number of created shares", 2, ctx3Shares.size()); } - try { Thread.sleep(durationPostDestroy); } catch(Exception e) { e.printStackTrace(); } + try { Thread.sleep(durationPostDestroy); } catch(final Exception e) { e.printStackTrace(); } f2.destroy(); Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false)); @@ -234,7 +234,7 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase { Assert.assertEquals("Ctx2 has unexpected number of created shares", 1, ctx2Shares.size()); Assert.assertEquals("Ctx3 has unexpected number of created shares", 1, ctx3Shares.size()); } - try { Thread.sleep(durationPostDestroy); } catch(Exception e) { e.printStackTrace(); } + try { Thread.sleep(durationPostDestroy); } catch(final Exception e) { e.printStackTrace(); } f1.destroy(); Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false)); @@ -258,7 +258,7 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase { Assert.assertEquals("Ctx2 has unexpected number of created shares", 0, ctx2Shares.size()); Assert.assertEquals("Ctx3 has unexpected number of created shares", 0, ctx3Shares.size()); } - try { Thread.sleep(durationPostDestroy); } catch(Exception e) { e.printStackTrace(); } + try { Thread.sleep(durationPostDestroy); } catch(final Exception e) { e.printStackTrace(); } animator.stop(); Assert.assertEquals(false, animator.isAnimating()); @@ -267,13 +267,13 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase { static long duration = 1000; // ms static long durationPostDestroy = 1000; // ms - ~60 frames post destroy - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } /** diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java index 7051bac13..3a61f169e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java @@ -97,9 +97,9 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase { } } - private void initShared(boolean onscreen) throws InterruptedException { + private void initShared(final boolean onscreen) throws InterruptedException { if(onscreen) { - GLWindow glWindow = GLWindow.create(caps); + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setSize(width, height); glWindow.setVisible(true); @@ -129,8 +129,8 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase { sharedDrawable = null; } - protected GLWindow runTestGL(Animator animator, int x, int y, boolean useShared, boolean vsync) throws InterruptedException { - GLWindow glWindow = GLWindow.create(caps); + protected GLWindow runTestGL(final Animator animator, final int x, final int y, final boolean useShared, final boolean vsync) throws InterruptedException { + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setPosition(x, y); glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared "+useShared); @@ -140,7 +140,7 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase { glWindow.setSize(width, height); - GearsES2 gears = new GearsES2(vsync ? 1 : 0); + final GearsES2 gears = new GearsES2(vsync ? 1 : 0); if(useShared) { gears.setSharedGearsObjects(sharedGears.getGear1(), sharedGears.getGear2(), sharedGears.getGear3()); } @@ -172,16 +172,16 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase { @Test public void test01CommonAnimatorSharedOnscreen() throws InterruptedException { initShared(true); - Animator animator = new Animator(); - GLWindow f1 = runTestGL(animator, 0, 0, true, false); - InsetsImmutable insets = f1.getInsets(); - GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(), + final Animator animator = new Animator(); + final GLWindow f1 = runTestGL(animator, 0, 0, true, false); + final InsetsImmutable insets = f1.getInsets(); + final GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(), f1.getY()+0, true, false); - GLWindow f3 = runTestGL(animator, f1.getX()+0, + final GLWindow f3 = runTestGL(animator, f1.getX()+0, f1.getY()+height+insets.getTotalHeight(), true, false); try { Thread.sleep(duration); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } animator.stop(); @@ -205,16 +205,16 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase { @Test public void test02CommonAnimatorSharedOffscreen() throws InterruptedException { initShared(false); - Animator animator = new Animator(); - GLWindow f1 = runTestGL(animator, 0, 0, true, false); - InsetsImmutable insets = f1.getInsets(); - GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(), + final Animator animator = new Animator(); + final GLWindow f1 = runTestGL(animator, 0, 0, true, false); + final InsetsImmutable insets = f1.getInsets(); + final GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(), f1.getY()+0, true, false); - GLWindow f3 = runTestGL(animator, f1.getX()+0, + final GLWindow f3 = runTestGL(animator, f1.getX()+0, f1.getY()+height+insets.getTotalHeight(), true, false); try { Thread.sleep(duration); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } animator.stop(); @@ -238,19 +238,19 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase { @Test public void test03EachWithAnimatorSharedOffscreen() throws InterruptedException { initShared(false); - Animator animator1 = new Animator(); - Animator animator2 = new Animator(); - Animator animator3 = new Animator(); - GLWindow f1 = runTestGL(animator1, 0, 0, true, false); - InsetsImmutable insets = f1.getInsets(); - GLWindow f2 = runTestGL(animator2, f1.getX()+width+insets.getTotalWidth(), + final Animator animator1 = new Animator(); + final Animator animator2 = new Animator(); + final Animator animator3 = new Animator(); + final GLWindow f1 = runTestGL(animator1, 0, 0, true, false); + final InsetsImmutable insets = f1.getInsets(); + final GLWindow f2 = runTestGL(animator2, f1.getX()+width+insets.getTotalWidth(), f1.getY()+0, true, false); - GLWindow f3 = runTestGL(animator3, f1.getX()+0, + final GLWindow f3 = runTestGL(animator3, f1.getX()+0, f1.getY()+height+insets.getTotalHeight(), true, false); try { Thread.sleep(duration); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } animator1.stop(); @@ -275,13 +275,13 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase { static long duration = 1000; // ms - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } /** diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java index e8e4cc739..1921dca60 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java @@ -84,8 +84,8 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase { } } - protected GLWindow createGLWindow(int x, int y, GearsES2 gears) throws InterruptedException { - GLWindow glWindow = GLWindow.create(caps); + protected GLWindow createGLWindow(final int x, final int y, final GearsES2 gears) throws InterruptedException { + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setPosition(x, y); glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared true"); @@ -105,12 +105,12 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase { syncedOneAnimator(false); } - public void syncedOneAnimator(boolean destroyCleanOrder) throws InterruptedException { + public void syncedOneAnimator(final boolean destroyCleanOrder) throws InterruptedException { final Animator animator = new Animator(); final GearsES2 g1 = new GearsES2(0); final GLWindow f1 = createGLWindow(0, 0, g1); animator.add(f1); - InsetsImmutable insets = f1.getInsets(); + final InsetsImmutable insets = f1.getInsets(); final GearsES2 g2 = new GearsES2(0); g2.setSharedGears(g1); @@ -127,7 +127,7 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase { // f1's shared GLContext is ready ! f1.invoke(false, new GLRunnable() { @Override - public boolean run(GLAutoDrawable drawable) { + public boolean run(final GLAutoDrawable drawable) { final GLContext ctx1 = f1.getContext(); Assert.assertTrue("Ctx is shared before shared creation", !ctx1.isShared()); f2.setSharedContext(ctx1); @@ -188,7 +188,7 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase { try { Thread.sleep(duration); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } animator.stop(); @@ -223,7 +223,7 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase { asyncEachAnimator(false); } - public void asyncEachAnimator(boolean destroyCleanOrder) throws InterruptedException { + public void asyncEachAnimator(final boolean destroyCleanOrder) throws InterruptedException { final Animator a1 = new Animator(); final GearsES2 g1 = new GearsES2(0); final GLWindow f1 = createGLWindow(0, 0, g1); @@ -231,7 +231,7 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase { a1.start(); f1.setVisible(true); - InsetsImmutable insets = f1.getInsets(); + final InsetsImmutable insets = f1.getInsets(); final Animator a2 = new Animator(); final GearsES2 g2 = new GearsES2(0); @@ -252,7 +252,7 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase { // f1's shared GLContext is ready ! f1.invoke(false, new GLRunnable() { @Override - public boolean run(GLAutoDrawable drawable) { + public boolean run(final GLAutoDrawable drawable) { final GLContext ctx1 = f1.getContext(); Assert.assertTrue("Ctx is shared before shared creation", !ctx1.isShared()); f2.setSharedContext(ctx1); @@ -305,7 +305,7 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase { try { Thread.sleep(duration); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } // Stopped animator allows native windowing system 'repaint' event @@ -338,13 +338,13 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase { static long duration = 1000; // ms - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } /** diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java index a8684ad4c..bfd1a92ce 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java @@ -81,8 +81,8 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase { } } - protected GLWindow createGLWindow(int x, int y, GearsES2 gears) throws InterruptedException { - GLWindow glWindow = GLWindow.create(caps); + protected GLWindow createGLWindow(final int x, final int y, final GearsES2 gears) throws InterruptedException { + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setPosition(x, y); glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared true"); @@ -110,14 +110,14 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase { syncedOneAnimator(false, true); } - public void syncedOneAnimator(boolean destroyCleanOrder, boolean useMappedBuffers) throws InterruptedException { + public void syncedOneAnimator(final boolean destroyCleanOrder, final boolean useMappedBuffers) throws InterruptedException { final Animator animator = new Animator(); final GearsES2 g1 = new GearsES2(0); g1.setUseMappedBuffers(useMappedBuffers); g1.setValidateBuffers(true); final GLWindow f1 = createGLWindow(0, 0, g1); animator.add(f1); - InsetsImmutable insets = f1.getInsets(); + final InsetsImmutable insets = f1.getInsets(); final GearsES2 g2 = new GearsES2(0); g2.setSharedGears(g1); @@ -183,32 +183,32 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase { try { Thread.sleep(duration); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } if( destroyCleanOrder ) { System.err.println("XXX Destroy in clean order NOW"); f3.destroy(); - try { Thread.sleep(durationPostDestroy); } catch(Exception e) { e.printStackTrace(); } + try { Thread.sleep(durationPostDestroy); } catch(final Exception e) { e.printStackTrace(); } f2.destroy(); - try { Thread.sleep(durationPostDestroy); } catch(Exception e) { e.printStackTrace(); } + try { Thread.sleep(durationPostDestroy); } catch(final Exception e) { e.printStackTrace(); } f1.destroy(); - try { Thread.sleep(durationPostDestroy); } catch(Exception e) { e.printStackTrace(); } + try { Thread.sleep(durationPostDestroy); } catch(final Exception e) { e.printStackTrace(); } } else { System.err.println("XXX Destroy in creation order NOW - Driver Impl. Ma trigger driver Bug i.e. not postponing GL ctx destruction after releasing all refs."); animator.pause(); f1.destroy(); animator.resume(); - try { Thread.sleep(durationPostDestroy); } catch(Exception e) { e.printStackTrace(); } + try { Thread.sleep(durationPostDestroy); } catch(final Exception e) { e.printStackTrace(); } animator.pause(); f2.destroy(); animator.resume(); - try { Thread.sleep(durationPostDestroy); } catch(Exception e) { e.printStackTrace(); } + try { Thread.sleep(durationPostDestroy); } catch(final Exception e) { e.printStackTrace(); } f3.destroy(); - try { Thread.sleep(durationPostDestroy); } catch(Exception e) { e.printStackTrace(); } + try { Thread.sleep(durationPostDestroy); } catch(final Exception e) { e.printStackTrace(); } } Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false)); @@ -238,7 +238,7 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase { asyncEachAnimator(false, true); } - public void asyncEachAnimator(boolean destroyCleanOrder, boolean useMappedBuffers) throws InterruptedException { + public void asyncEachAnimator(final boolean destroyCleanOrder, final boolean useMappedBuffers) throws InterruptedException { final Animator a1 = new Animator(); final GearsES2 g1 = new GearsES2(0); g1.setUseMappedBuffers(useMappedBuffers); @@ -248,7 +248,7 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase { a1.start(); // f1.setVisible(true); // we do this post f2 .. to test pending creation! - InsetsImmutable insets = f1.getInsets(); + final InsetsImmutable insets = f1.getInsets(); final Animator a2 = new Animator(); final GearsES2 g2 = new GearsES2(0); @@ -317,7 +317,7 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase { try { Thread.sleep(duration); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } @@ -325,13 +325,13 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase { System.err.println("XXX Destroy in clean order NOW"); a3.stop(); f3.destroy(); - try { Thread.sleep(durationPostDestroy); } catch(Exception e) { e.printStackTrace(); } + try { Thread.sleep(durationPostDestroy); } catch(final Exception e) { e.printStackTrace(); } a2.stop(); f2.destroy(); - try { Thread.sleep(durationPostDestroy); } catch(Exception e) { e.printStackTrace(); } + try { Thread.sleep(durationPostDestroy); } catch(final Exception e) { e.printStackTrace(); } a1.stop(); f1.destroy(); - try { Thread.sleep(durationPostDestroy); } catch(Exception e) { e.printStackTrace(); } + try { Thread.sleep(durationPostDestroy); } catch(final Exception e) { e.printStackTrace(); } } else { System.err.println("XXX Destroy in creation order NOW - Driver Impl. May trigger driver Bug i.e. not postponing GL ctx destruction after releasing all refs."); a1.stop(); @@ -340,17 +340,17 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase { f1.destroy(); a2.resume(); a3.resume(); - try { Thread.sleep(durationPostDestroy); } catch(Exception e) { e.printStackTrace(); } + try { Thread.sleep(durationPostDestroy); } catch(final Exception e) { e.printStackTrace(); } a2.stop(); a3.pause(); f2.destroy(); a3.resume(); - try { Thread.sleep(durationPostDestroy); } catch(Exception e) { e.printStackTrace(); } + try { Thread.sleep(durationPostDestroy); } catch(final Exception e) { e.printStackTrace(); } a3.stop(); f3.destroy(); - try { Thread.sleep(durationPostDestroy); } catch(Exception e) { e.printStackTrace(); } + try { Thread.sleep(durationPostDestroy); } catch(final Exception e) { e.printStackTrace(); } } Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false)); @@ -363,13 +363,13 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase { static long duration = 1000; // ms static long durationPostDestroy = 1000; // ms - ~60 frames post destroy - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } /** diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2SWT3.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2SWT3.java index 9ccfd394f..90cb503ce 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2SWT3.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2SWT3.java @@ -149,7 +149,7 @@ public class TestSharedContextVBOES2SWT3 extends UITestCase { display.dispose(); }}); } - catch( Throwable throwable ) { + catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -162,7 +162,7 @@ public class TestSharedContextVBOES2SWT3 extends UITestCase { composite3 = null; } - protected GLCanvas createGLCanvas(final Shell shell, final Composite composite, final int x, final int y, GearsES2 gears) throws InterruptedException { + protected GLCanvas createGLCanvas(final Shell shell, final Composite composite, final int x, final int y, final GearsES2 gears) throws InterruptedException { final GLCanvas glCanvas = GLCanvas.create( composite, 0, caps, null); Assert.assertNotNull( glCanvas ); glCanvas.addGLEventListener(gears); @@ -241,7 +241,7 @@ public class TestSharedContextVBOES2SWT3 extends UITestCase { try { Thread.sleep(duration); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } // Stopped animator allows native windowing system 'repaint' event @@ -335,7 +335,7 @@ public class TestSharedContextVBOES2SWT3 extends UITestCase { try { Thread.sleep(duration); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } // Stopped animator allows native windowing system 'repaint' event @@ -357,13 +357,13 @@ public class TestSharedContextVBOES2SWT3 extends UITestCase { static long duration = 1000; // ms - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } /** diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextWithJTabbedPaneAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextWithJTabbedPaneAWT.java index d6a6f7bed..e62bbc63e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextWithJTabbedPaneAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextWithJTabbedPaneAWT.java @@ -43,6 +43,9 @@ import javax.media.opengl.GLContext; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLProfile; import javax.media.opengl.awt.GLCanvas; +import javax.media.opengl.fixedfunc.GLLightingFunc; +import javax.media.opengl.fixedfunc.GLMatrixFunc; +import javax.media.opengl.fixedfunc.GLPointerFunc; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTabbedPane; @@ -63,7 +66,7 @@ public class TestSharedContextWithJTabbedPaneAWT extends UITestCase { static class DemoInstance { protected static GLCapabilities getCaps() { - GLCapabilities caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true)); + final GLCapabilities caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true)); caps.setAlphaBits(8); caps.setRedBits(8); @@ -82,8 +85,8 @@ public class TestSharedContextWithJTabbedPaneAWT extends UITestCase { final GLCanvas canvas; final boolean shared; - public SharedGLPanel(GLCanvas shareWith, int width, int height) { - GLContext sharedCtx = shareWith != null ? shareWith.getContext() : null; + public SharedGLPanel(final GLCanvas shareWith, final int width, final int height) { + final GLContext sharedCtx = shareWith != null ? shareWith.getContext() : null; System.err.println("XXX WWPanel: shareWith "+shareWith+", sharedCtx "+sharedCtx); canvas = new GLCanvas(getCaps()); // same caps for 1st and 2nd shared ctx ! if( null != shareWith) { @@ -102,7 +105,7 @@ public class TestSharedContextWithJTabbedPaneAWT extends UITestCase { } @Override - public void init(GLAutoDrawable glAutoDrawable) { + public void init(final GLAutoDrawable glAutoDrawable) { if (!shared) { Assert.assertNull("Buffer is set, but instance is share master", bufferId); makeVBO(glAutoDrawable); @@ -120,56 +123,56 @@ public class TestSharedContextWithJTabbedPaneAWT extends UITestCase { gl.glColor3f(0, 0, 0); gl.glClearColor(1f, 1f, 1f, 1f); } - gl.glShadeModel(GL2.GL_FLAT); + gl.glShadeModel(GLLightingFunc.GL_FLAT); } @Override - public void dispose(GLAutoDrawable glAutoDrawable) {} + public void dispose(final GLAutoDrawable glAutoDrawable) {} @Override - public void display(GLAutoDrawable glAutoDrawable) { + public void display(final GLAutoDrawable glAutoDrawable) { final GL2 gl = glAutoDrawable.getGL().getGL2(); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - gl.glEnableClientState(GL2.GL_VERTEX_ARRAY); - gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, bufferId[0]); - gl.glVertexPointer(3, GL2.GL_FLOAT, 0, 0); - gl.glDrawArrays(GL2.GL_LINES, 0, 2); + gl.glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY); + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, bufferId[0]); + gl.glVertexPointer(3, GL.GL_FLOAT, 0, 0); + gl.glDrawArrays(GL.GL_LINES, 0, 2); } @Override - public void reshape(GLAutoDrawable glAutoDrawable, int i, int i1, int i2, int i3) { - int w = getWidth(); - int h = getHeight(); + public void reshape(final GLAutoDrawable glAutoDrawable, final int i, final int i1, final int i2, final int i3) { + final int w = getWidth(); + final int h = getHeight(); final GL2 gl = glAutoDrawable.getGL().getGL2(); gl.glViewport(0, 0, w, h); - gl.glMatrixMode(GL2.GL_PROJECTION); + gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); gl.glOrtho(0, 1, 0, 1, -1, 1); - gl.glMatrixMode(GL2.GL_MODELVIEW); + gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); } } - protected void makeVBO(GLAutoDrawable drawable) { - GL2 gl = drawable.getGL().getGL2(); + protected void makeVBO(final GLAutoDrawable drawable) { + final GL2 gl = drawable.getGL().getGL2(); bufferId = new int[1]; gl.glGenBuffers(1, bufferId, 0); - gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, bufferId[0]); + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, bufferId[0]); - FloatBuffer vertices = Buffers.newDirectFloatBuffer(6); + final FloatBuffer vertices = Buffers.newDirectFloatBuffer(6); vertices.put(0).put(0).put(0); vertices.put(1).put(1).put(0); - gl.glBufferData(GL2.GL_ARRAY_BUFFER, vertices.capacity() * 4, vertices.rewind(), GL2.GL_STATIC_DRAW); + gl.glBufferData(GL.GL_ARRAY_BUFFER, vertices.capacity() * 4, vertices.rewind(), GL.GL_STATIC_DRAW); } public JTabbedPane tabbedPanel; - public DemoInstance(JFrame f) { + public DemoInstance(final JFrame f) { try { GLProfile.initSingleton(); // Lets have init debug messages above below marker @@ -180,8 +183,8 @@ public class TestSharedContextWithJTabbedPaneAWT extends UITestCase { f.add(tabbedPanel, BorderLayout.CENTER); // Create two World Windows that share resources. - SharedGLPanel wwpA = new SharedGLPanel(null, 600, 600); - SharedGLPanel wwpB = new SharedGLPanel(wwpA.canvas, wwpA.getWidth(), wwpA.getHeight()); + final SharedGLPanel wwpA = new SharedGLPanel(null, 600, 600); + final SharedGLPanel wwpB = new SharedGLPanel(wwpA.canvas, wwpA.getWidth(), wwpA.getHeight()); tabbedPanel.add(wwpA, "Window A"); tabbedPanel.add(wwpB, "Window B"); @@ -194,7 +197,7 @@ public class TestSharedContextWithJTabbedPaneAWT extends UITestCase { f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); f.pack(); f.setResizable(true); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } @@ -251,7 +254,7 @@ public class TestSharedContextWithJTabbedPaneAWT extends UITestCase { } }); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atoi(args[++i], (int)durationPerTest); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java index 9f367ef0b..d8ae8bcc5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java @@ -63,7 +63,7 @@ public class TestShutdownCompleteAWT extends UITestCase { glCanvas.addGLEventListener(new GearsES2(1)); - Animator animator = new Animator(glCanvas); + final Animator animator = new Animator(glCanvas); javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { @@ -103,7 +103,7 @@ public class TestShutdownCompleteAWT extends UITestCase { } } - protected void oneLife(boolean glInfo) throws InterruptedException, InvocationTargetException { + protected void oneLife(final boolean glInfo) throws InterruptedException, InvocationTargetException { final long t0 = Platform.currentTimeMicros(); GLProfile.initSingleton(); final long t1 = Platform.currentTimeMicros(); @@ -148,7 +148,7 @@ public class TestShutdownCompleteAWT extends UITestCase { static boolean initOnly = false; static boolean waitForKey = false; - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-wait")) { waitForKey = true; @@ -160,7 +160,7 @@ public class TestShutdownCompleteAWT extends UITestCase { if(waitForKey) { UITestCase.waitForKey("Start"); } - String tstname = TestShutdownCompleteAWT.class.getName(); + final String tstname = TestShutdownCompleteAWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java index e7d1cb8e9..10f334244 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java @@ -51,18 +51,18 @@ public class TestShutdownCompleteNEWT extends UITestCase { static long duration = 300; // ms - protected void runTestGL(boolean onscreen) throws InterruptedException { - GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2()); + protected void runTestGL(final boolean onscreen) throws InterruptedException { + final GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2()); caps.setOnscreen(onscreen); caps.setPBuffer(!onscreen); - GLWindow glWindow = GLWindow.create(caps); + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setTitle("Gears NEWT Test"); glWindow.addGLEventListener(new GearsES2()); - Animator animator = new Animator(glWindow); + final Animator animator = new Animator(glWindow); glWindow.setSize(256, 256); glWindow.setVisible(true); @@ -88,7 +88,7 @@ public class TestShutdownCompleteNEWT extends UITestCase { } } - protected void oneLife(boolean glInfo) throws InterruptedException { + protected void oneLife(final boolean glInfo) throws InterruptedException { if(waitForEach) { UITestCase.waitForKey("Start One Life"); } @@ -137,7 +137,7 @@ public class TestShutdownCompleteNEWT extends UITestCase { static boolean waitForEach = false; static boolean waitForKey = false; - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-wait")) { waitForKey = true; @@ -153,7 +153,7 @@ public class TestShutdownCompleteNEWT extends UITestCase { UITestCase.waitForKey("Start"); } - String tstname = TestShutdownCompleteNEWT.class.getName(); + final String tstname = TestShutdownCompleteNEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java index 3120264b6..6f38c4b2f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java @@ -106,8 +106,8 @@ public class TestVersionSemanticsNOUI extends JunitTracer { excludes); } - public static void main(String args[]) throws IOException { - String tstname = TestVersionSemanticsNOUI.class.getName(); + public static void main(final String args[]) throws IOException { + final String tstname = TestVersionSemanticsNOUI.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestX11DefaultDisplay.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestX11DefaultDisplay.java index deb800441..9ac190bc7 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestX11DefaultDisplay.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestX11DefaultDisplay.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.acore; import javax.media.nativewindow.AbstractGraphicsDevice; @@ -64,7 +64,7 @@ public class TestX11DefaultDisplay extends UITestCase { System.setProperty("nativewindow.x11.display.default", x11DefaultDisplay); } - protected void runTestGL(GLCapabilities caps) throws InterruptedException { + protected void runTestGL(final GLCapabilities caps) throws InterruptedException { final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setTitle(getSimpleTestName(".")); @@ -76,21 +76,21 @@ public class TestX11DefaultDisplay extends UITestCase { final SnapshotGLEventListener snap = new SnapshotGLEventListener(); 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); animator.start(); - + 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, System.err); snap.setMakeSnapshot(); @@ -106,12 +106,12 @@ public class TestX11DefaultDisplay extends UITestCase { public void test00_DefaultDevice() { final AbstractGraphicsDevice defaultDevice = GLProfile.getDefaultDevice(); System.out.println("GLProfile "+GLProfile.glAvailabilityToString()); - System.out.println("GLProfile.getDefaultDevice(): "+defaultDevice); - GLProfile glp = GLProfile.getDefault(); + System.out.println("GLProfile.getDefaultDevice(): "+defaultDevice); + final GLProfile glp = GLProfile.getDefault(); System.out.println("GLProfile.getDefault(): "+glp); - - GLCapabilities caps = new GLCapabilities(glp); - GLWindow glWindow = GLWindow.create(caps); + + final GLCapabilities caps = new GLCapabilities(glp); + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.addGLEventListener(new DumpGLInfo()); @@ -121,19 +121,19 @@ public class TestX11DefaultDisplay extends UITestCase { glWindow.display(); glWindow.destroy(); - + if( NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true) ) { Assert.assertEquals("X11 Default device does not match", defaultDevice.getConnection(), x11DefaultDisplay); } } - + @Test public void test01_GLDefaultRendering() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(null); + final GLCapabilities caps = new GLCapabilities(null); runTestGL(caps); } - - public static void main(String args[]) { + + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/Bug898AnimatorFromEDTAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/Bug898AnimatorFromEDTAWT.java index 55e045d48..764973f06 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/Bug898AnimatorFromEDTAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/Bug898AnimatorFromEDTAWT.java @@ -56,7 +56,7 @@ public class Bug898AnimatorFromEDTAWT extends javax.swing.JFrame { //Layout setMinimumSize(new Dimension(640, 480)); getContentPane().setLayout(new BorderLayout()); - GLCanvas panel = new GLCanvas(new GLCapabilities(GLProfile.getMaxProgrammable(true))); + final GLCanvas panel = new GLCanvas(new GLCapabilities(GLProfile.getMaxProgrammable(true))); getContentPane().add(panel, BorderLayout.CENTER); pack(); //Animator @@ -69,19 +69,19 @@ public class Bug898AnimatorFromEDTAWT extends javax.swing.JFrame { long step = 1; @Override - public void init(GLAutoDrawable glad) { + public void init(final GLAutoDrawable glad) { startTime = System.currentTimeMillis(); } @Override - public void dispose(GLAutoDrawable glad) { + public void dispose(final GLAutoDrawable glad) { } @Override - public void display(GLAutoDrawable glad) { - long time = System.currentTimeMillis(); + public void display(final GLAutoDrawable glad) { + final long time = System.currentTimeMillis(); if (animator.isAnimating() && step * 2000 < time - startTime) { - long td = time - lastTime; + final long td = time - lastTime; lastTime = time; animator.pause(); System.out.println(Thread.currentThread().getName()+": #"+step+" "+td+" ms: animator.pause(): paused "+animator); @@ -89,13 +89,13 @@ public class Bug898AnimatorFromEDTAWT extends javax.swing.JFrame { public void run() { try { Thread.sleep(1000); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - long td = System.currentTimeMillis() - lastTime; + final long td = System.currentTimeMillis() - lastTime; if (animator.isPaused()) { animator.resume(); //Doesn't work on v2.0.2 or higher System.out.println(Thread.currentThread().getName()+": #"+step+" "+td+" ms: animator.resume(): animating "+animator); @@ -110,7 +110,7 @@ public class Bug898AnimatorFromEDTAWT extends javax.swing.JFrame { } @Override - 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) { } }); //Start animation @@ -118,7 +118,7 @@ public class Bug898AnimatorFromEDTAWT extends javax.swing.JFrame { System.out.println("animator.start()"); } - public static void main(String args[]) { + public static void main(final String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAWTCardLayoutAnimatorStartStopBug532.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAWTCardLayoutAnimatorStartStopBug532.java index 3790a87f7..97f8b3f48 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAWTCardLayoutAnimatorStartStopBug532.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAWTCardLayoutAnimatorStartStopBug532.java @@ -18,6 +18,7 @@ import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.WindowConstants; import org.junit.Test; import org.junit.FixMethodOrder; @@ -74,12 +75,12 @@ public class TestAWTCardLayoutAnimatorStartStopBug532 extends UITestCase { testImpl(AnimatorControlBehavior.Continue, false); } - private static String id(Object obj) { return "0x" + ( null!=obj ? Integer.toHexString(obj.hashCode()) : "nil" ); } - private static String str(Component c) { + private static String id(final Object obj) { return "0x" + ( null!=obj ? Integer.toHexString(obj.hashCode()) : "nil" ); } + private static String str(final Component c) { return id(c)+": "+c.getClass().getSimpleName()+"[visible "+c.isVisible()+", showing "+c.isShowing()+", valid "+c.isValid()+ ", displayable "+c.isDisplayable()+", "+c.getX()+"/"+c.getY()+" "+c.getWidth()+"x"+c.getHeight()+"]"; } - void testImpl(final AnimatorControlBehavior animCtrl, boolean useFPSAnimator) throws InterruptedException, InvocationTargetException { + void testImpl(final AnimatorControlBehavior animCtrl, final boolean useFPSAnimator) throws InterruptedException, InvocationTargetException { final GLProfile glp = GLProfile.get(GLProfile.GL2); final GLCapabilities caps = new GLCapabilities(glp); final GLCanvas canvas = new GLCanvas(caps); @@ -119,12 +120,12 @@ public class TestAWTCardLayoutAnimatorStartStopBug532 extends UITestCase { final JFrame frame = new JFrame(); frame.setTitle(getSimpleTestName(" - ")); frame.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { + public void windowClosing(final WindowEvent e) { animatorCtrl.stop(); shouldStop = true; } }); - frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); final JLabel label = new JLabel("A label to cover the canvas"); @@ -235,7 +236,7 @@ public class TestAWTCardLayoutAnimatorStartStopBug532 extends UITestCase { } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atoi(args[++i], (int)durationPerTest); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLJPanel01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLJPanel01AWT.java index 42f170a06..d39abba41 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLJPanel01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLJPanel01AWT.java @@ -49,7 +49,7 @@ public class TestAnimatorGLJPanel01AWT extends UITestCase { static final int width = 640; static final int height = 480; - protected GLJPanel createGLJPanel(final GLCapabilities caps, final Frame frame, int x, int y, GearsES2 gears) throws InterruptedException { + protected GLJPanel createGLJPanel(final GLCapabilities caps, final Frame frame, final int x, final int y, final GearsES2 gears) throws InterruptedException { final GLJPanel glCanvas = new GLJPanel(caps); Assert.assertNotNull(glCanvas); glCanvas.addGLEventListener(gears); @@ -60,7 +60,7 @@ public class TestAnimatorGLJPanel01AWT extends UITestCase { return glCanvas; } - static void pauseAnimator(Animator animator, boolean pause) { + static void pauseAnimator(final Animator animator, final boolean pause) { if(pause) { animator.pause(); Assert.assertEquals(true, animator.isStarted()); @@ -73,7 +73,7 @@ public class TestAnimatorGLJPanel01AWT extends UITestCase { Assert.assertEquals(true, animator.isAnimating()); } } - static void stopAnimator(Animator animator) { + static void stopAnimator(final Animator animator) { animator.stop(); Assert.assertEquals(false, animator.isStarted()); Assert.assertEquals(false, animator.isPaused()); @@ -133,7 +133,7 @@ public class TestAnimatorGLJPanel01AWT extends UITestCase { try { Thread.sleep(duration/3); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } @@ -141,7 +141,7 @@ public class TestAnimatorGLJPanel01AWT extends UITestCase { try { Thread.sleep(duration/3); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } @@ -149,7 +149,7 @@ public class TestAnimatorGLJPanel01AWT extends UITestCase { try { Thread.sleep(duration/3); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } @@ -163,7 +163,7 @@ public class TestAnimatorGLJPanel01AWT extends UITestCase { f1.dispose(); f2.dispose(); f3.dispose(); - } catch (Throwable t) { + } catch (final Throwable t) { throw new RuntimeException(t); } }}); @@ -235,7 +235,7 @@ public class TestAnimatorGLJPanel01AWT extends UITestCase { try { Thread.sleep(duration/3); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } @@ -245,7 +245,7 @@ public class TestAnimatorGLJPanel01AWT extends UITestCase { try { Thread.sleep(duration/3); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } @@ -255,7 +255,7 @@ public class TestAnimatorGLJPanel01AWT extends UITestCase { try { Thread.sleep(duration/3); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } @@ -271,7 +271,7 @@ public class TestAnimatorGLJPanel01AWT extends UITestCase { f1.dispose(); f2.dispose(); f3.dispose(); - } catch (Throwable t) { + } catch (final Throwable t) { throw new RuntimeException(t); } }}); @@ -283,13 +283,13 @@ public class TestAnimatorGLJPanel01AWT extends UITestCase { static long duration = 3*500; // ms - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } /** diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLWindow01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLWindow01NEWT.java index 7b0fbe9ee..03892518b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLWindow01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLWindow01NEWT.java @@ -48,7 +48,7 @@ public class TestAnimatorGLWindow01NEWT extends UITestCase { static final int width = 640; static final int height = 480; - protected GLWindow createGLWindow(final GLCapabilities caps, int x, int y, GearsES2 gears) throws InterruptedException { + protected GLWindow createGLWindow(final GLCapabilities caps, final int x, final int y, final GearsES2 gears) throws InterruptedException { final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.addGLEventListener(gears); @@ -58,7 +58,7 @@ public class TestAnimatorGLWindow01NEWT extends UITestCase { return glWindow; } - static void pauseAnimator(Animator animator, boolean pause) { + static void pauseAnimator(final Animator animator, final boolean pause) { if(pause) { animator.pause(); Assert.assertEquals(true, animator.isStarted()); @@ -71,7 +71,7 @@ public class TestAnimatorGLWindow01NEWT extends UITestCase { Assert.assertEquals(true, animator.isAnimating()); } } - static void stopAnimator(Animator animator) { + static void stopAnimator(final Animator animator) { animator.stop(); Assert.assertEquals(false, animator.isStarted()); Assert.assertEquals(false, animator.isPaused()); @@ -125,7 +125,7 @@ public class TestAnimatorGLWindow01NEWT extends UITestCase { try { Thread.sleep(duration/3); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } @@ -133,7 +133,7 @@ public class TestAnimatorGLWindow01NEWT extends UITestCase { try { Thread.sleep(duration/3); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } @@ -141,7 +141,7 @@ public class TestAnimatorGLWindow01NEWT extends UITestCase { try { Thread.sleep(duration/3); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } @@ -208,7 +208,7 @@ public class TestAnimatorGLWindow01NEWT extends UITestCase { try { Thread.sleep(duration/3); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } @@ -218,7 +218,7 @@ public class TestAnimatorGLWindow01NEWT extends UITestCase { try { Thread.sleep(duration/3); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } @@ -228,7 +228,7 @@ public class TestAnimatorGLWindow01NEWT extends UITestCase { try { Thread.sleep(duration/3); - } catch(Exception e) { + } catch(final Exception e) { e.printStackTrace(); } @@ -249,13 +249,13 @@ public class TestAnimatorGLWindow01NEWT extends UITestCase { static long duration = 3*500; // ms - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } /** diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00.java index f1a185c31..6e10d65da 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00.java @@ -74,7 +74,7 @@ public abstract class ExclusiveContextBase00 extends UITestCase { @BeforeClass public static void initClass00() { - 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()); @@ -100,7 +100,7 @@ public abstract class ExclusiveContextBase00 extends UITestCase { protected abstract void setGLAutoDrawableVisible(GLAutoDrawable[] glads); protected abstract void destroyGLAutoDrawableVisible(GLAutoDrawable glad); - protected void runTestGL(GLCapabilitiesImmutable caps, int drawableCount, boolean exclusive, boolean preAdd, boolean shortenTest) throws InterruptedException { + protected void runTestGL(final GLCapabilitiesImmutable caps, final int drawableCount, final boolean exclusive, final boolean preAdd, final boolean shortenTest) throws InterruptedException { final boolean useAWTRenderThread = isAWTTestCase(); if( useAWTRenderThread && exclusive ) { if( testExclusiveWithAWT ) { @@ -117,7 +117,7 @@ public abstract class ExclusiveContextBase00 extends UITestCase { final Thread awtRenderThread = getAWTRenderThread(); final AnimatorBase animator = createAnimator(); if( !useAWTRenderThread ) { - animator.setModeBits(false, Animator.MODE_EXPECT_AWT_RENDERING_THREAD); + animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); } final GLAutoDrawable[] drawables = new GLAutoDrawable[drawableCount]; for(int i=0; i<drawableCount; i++) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00AWT.java index 5608fe282..414841ab0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00AWT.java @@ -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.ect; import java.awt.BorderLayout; @@ -49,62 +49,62 @@ import com.jogamp.common.os.Platform; import com.jogamp.common.util.VersionNumber; /** - * ExclusiveContextThread base implementation to test correctness of the ExclusiveContext feature _and_ AnimatorBase with AWT. + * ExclusiveContextThread base implementation to test correctness of the ExclusiveContext feature _and_ AnimatorBase with AWT. */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public abstract class ExclusiveContextBase00AWT extends ExclusiveContextBase00 { static Thread awtEDT; - static boolean osxCALayerAWTModBug; - + static boolean osxCALayerAWTModBug; + @BeforeClass public static void initClass00AWT() { - + final VersionNumber version170 = new VersionNumber(1, 7, 0); - osxCALayerAWTModBug = Platform.OSType.MACOS == Platform.getOSType() && + 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()); - + 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 .. [email protected] // 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<count; i++) { final GLAutoDrawable glad = glads[i]; - final Frame frame = getFrame(glad); + final Frame frame = getFrame(glad); frame.setVisible(true); - } + } } } ); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); Assert.assertNull(e); } } - + @Override - protected void destroyGLAutoDrawableVisible(GLAutoDrawable glad) { + protected void destroyGLAutoDrawableVisible(final GLAutoDrawable glad) { final Frame frame = getFrame(glad); try { EventQueue.invokeAndWait(new Runnable() { public void run() { frame.dispose(); } } ); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); Assert.assertNull(e); } - } + } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00NEWT.java index 3f2de0156..9fe8bd03f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00NEWT.java @@ -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.ect; import com.jogamp.newt.Display; @@ -43,55 +43,55 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; /** - * ExclusiveContextThread base implementation to test correctness of the ExclusiveContext feature _and_ AnimatorBase with NEWT. + * ExclusiveContextThread base implementation to test correctness of the ExclusiveContext feature _and_ AnimatorBase with NEWT. */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public abstract class ExclusiveContextBase00NEWT extends ExclusiveContextBase00 { static Display dpy; static Screen screen; - + @BeforeClass public static void initClass00NEWT() { dpy = NewtFactory.createDisplay(null); - screen = NewtFactory.createScreen(dpy, 0); + screen = NewtFactory.createScreen(dpy, 0); } - + @AfterClass public static void releaseClass00NEWT() { screen = null; dpy = null; } - + @Override protected boolean isAWTTestCase() { return false; } - + @Override protected Thread getAWTRenderThread() { return null; } - + @Override - protected GLAutoDrawable createGLAutoDrawable(String title, int x, int y, int width, int height, GLCapabilitiesImmutable caps) { - GLWindow glWindow = GLWindow.create(screen, caps); + protected GLAutoDrawable createGLAutoDrawable(final String title, final int x, final int y, final int width, final int height, final GLCapabilitiesImmutable caps) { + final GLWindow glWindow = GLWindow.create(screen, caps); Assert.assertNotNull(glWindow); glWindow.setTitle(title); glWindow.setSize(width, height); glWindow.setPosition(x, y); return glWindow; } - + @Override - protected void setGLAutoDrawableVisible(GLAutoDrawable[] glads) { + protected void setGLAutoDrawableVisible(final GLAutoDrawable[] glads) { final int count = glads.length; for(int i=0; i<count; i++) { final GLAutoDrawable glad = glads[i]; ((GLWindow)glad).setVisible(true); } } - + @Override - protected void destroyGLAutoDrawableVisible(GLAutoDrawable glad) { + protected void destroyGLAutoDrawableVisible(final GLAutoDrawable glad) { ((GLWindow)glad).destroy(); - } + } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10.java index b6d4c4e6b..02f6efdeb 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10.java @@ -73,7 +73,7 @@ public abstract class ExclusiveContextBase10 extends UITestCase { @BeforeClass public static void initClass00() { - 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()); @@ -99,7 +99,7 @@ public abstract class ExclusiveContextBase10 extends UITestCase { protected abstract void setGLAutoDrawableVisible(GLAutoDrawable[] glads); protected abstract void destroyGLAutoDrawableVisible(GLAutoDrawable glad); - protected void runTestGL(GLCapabilitiesImmutable caps, int drawableCount, boolean exclusive) throws InterruptedException { + protected void runTestGL(final GLCapabilitiesImmutable caps, final int drawableCount, final boolean exclusive) throws InterruptedException { final boolean useAWTRenderThread = isAWTTestCase(); if( useAWTRenderThread && exclusive ) { if( testExclusiveWithAWT ) { @@ -116,7 +116,7 @@ public abstract class ExclusiveContextBase10 extends UITestCase { final Thread awtRenderThread = getAWTRenderThread(); final AnimatorBase animator = createAnimator(); if( !useAWTRenderThread ) { - animator.setModeBits(false, Animator.MODE_EXPECT_AWT_RENDERING_THREAD); + animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); } final GLAutoDrawable[] drawables = new GLAutoDrawable[drawableCount]; for(int i=0; i<drawableCount; i++) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10AWT.java index 237479e5a..8f4715056 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10AWT.java @@ -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.ect; import java.awt.BorderLayout; @@ -49,62 +49,62 @@ import com.jogamp.common.os.Platform; import com.jogamp.common.util.VersionNumber; /** - * ExclusiveContextThread base implementation to test performance impact of the ExclusiveContext feature with AnimatorBase and AWT. + * ExclusiveContextThread base implementation to test performance impact of the ExclusiveContext feature with AnimatorBase and AWT. */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public abstract class ExclusiveContextBase10AWT extends ExclusiveContextBase10 { static Thread awtEDT; - static boolean osxCALayerAWTModBug; - + static boolean osxCALayerAWTModBug; + @BeforeClass public static void initClass00AWT() { - + final VersionNumber version170 = new VersionNumber(1, 7, 0); - osxCALayerAWTModBug = Platform.OSType.MACOS == Platform.getOSType() && + 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()); - + 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 .. [email protected] // 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<count; i++) { final GLAutoDrawable glad = glads[i]; - final Frame frame = getFrame(glad); + final Frame frame = getFrame(glad); frame.setVisible(true); - } + } } } ); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); Assert.assertNull(e); } } - + @Override - protected void destroyGLAutoDrawableVisible(GLAutoDrawable glad) { + protected void destroyGLAutoDrawableVisible(final GLAutoDrawable glad) { final Frame frame = getFrame(glad); try { EventQueue.invokeAndWait(new Runnable() { public void run() { frame.dispose(); } } ); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); Assert.assertNull(e); } - } + } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10NEWT.java index fc8cad04c..84e6ed7f3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10NEWT.java @@ -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.ect; import com.jogamp.newt.Display; @@ -43,55 +43,55 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; /** - * ExclusiveContextThread base implementation to test performance impact of the ExclusiveContext feature with AnimatorBase and NEWT. + * ExclusiveContextThread base implementation to test performance impact of the ExclusiveContext feature with AnimatorBase and NEWT. */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public abstract class ExclusiveContextBase10NEWT extends ExclusiveContextBase10 { static Display dpy; static Screen screen; - + @BeforeClass public static void initClass00NEWT() { dpy = NewtFactory.createDisplay(null); - screen = NewtFactory.createScreen(dpy, 0); + screen = NewtFactory.createScreen(dpy, 0); } - + @AfterClass public static void releaseClass00NEWT() { screen = null; dpy = null; } - + @Override protected boolean isAWTTestCase() { return false; } - + @Override protected Thread getAWTRenderThread() { return null; } - + @Override - protected GLAutoDrawable createGLAutoDrawable(String title, int x, int y, int width, int height, GLCapabilitiesImmutable caps) { - GLWindow glWindow = GLWindow.create(screen, caps); + protected GLAutoDrawable createGLAutoDrawable(final String title, final int x, final int y, final int width, final int height, final GLCapabilitiesImmutable caps) { + final GLWindow glWindow = GLWindow.create(screen, caps); Assert.assertNotNull(glWindow); glWindow.setTitle(title); glWindow.setSize(width, height); glWindow.setPosition(x, y); return glWindow; } - + @Override - protected void setGLAutoDrawableVisible(GLAutoDrawable[] glads) { + protected void setGLAutoDrawableVisible(final GLAutoDrawable[] glads) { final int count = glads.length; for(int i=0; i<count; i++) { final GLAutoDrawable glad = glads[i]; ((GLWindow)glad).setVisible(true); } } - + @Override - protected void destroyGLAutoDrawableVisible(GLAutoDrawable glad) { + protected void destroyGLAutoDrawableVisible(final GLAutoDrawable glad) { ((GLWindow)glad).destroy(); - } + } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext01VSyncAnimAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext01VSyncAnimAWT.java index 038e0781f..6a6f579a6 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext01VSyncAnimAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext01VSyncAnimAWT.java @@ -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.ect; import java.io.IOException; @@ -39,17 +39,17 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; /** - * ExclusiveContextThread VSync Animator to test correctness of the ExclusiveContext feature _and_ Animator with AWT. + * ExclusiveContextThread VSync Animator to test correctness of the ExclusiveContext feature _and_ Animator with AWT. */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestExclusiveContext01VSyncAnimAWT extends ExclusiveContextBase00AWT { - +public class TestExclusiveContext01VSyncAnimAWT extends ExclusiveContextBase00AWT { + @Override protected AnimatorBase createAnimator() { return new Animator(); } - - public static void main(String args[]) throws IOException { + + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext01VSyncAnimNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext01VSyncAnimNEWT.java index d52347920..a90dc0a5a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext01VSyncAnimNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext01VSyncAnimNEWT.java @@ -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.ect; import java.io.IOException; @@ -38,17 +38,17 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; /** - * ExclusiveContextThread VSync Animator to test correctness of the ExclusiveContext feature _and_ Animator with NEWT. + * ExclusiveContextThread VSync Animator to test correctness of the ExclusiveContext feature _and_ Animator with NEWT. */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestExclusiveContext01VSyncAnimNEWT extends ExclusiveContextBase00NEWT { +public class TestExclusiveContext01VSyncAnimNEWT extends ExclusiveContextBase00NEWT { @Override protected AnimatorBase createAnimator() { return new Animator(); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext02FPSAnimAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext02FPSAnimAWT.java index f6697c608..0769fc93e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext02FPSAnimAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext02FPSAnimAWT.java @@ -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.ect; import java.io.IOException; @@ -38,17 +38,17 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; /** - * ExclusiveContextThread FPS Animator to test correctness of the ExclusiveContext feature _and_ FPSAnimator with AWT. + * ExclusiveContextThread FPS Animator to test correctness of the ExclusiveContext feature _and_ FPSAnimator with AWT. */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestExclusiveContext02FPSAnimAWT extends ExclusiveContextBase00AWT { - +public class TestExclusiveContext02FPSAnimAWT extends ExclusiveContextBase00AWT { + @Override protected AnimatorBase createAnimator() { return new FPSAnimator(0); } - - public static void main(String args[]) throws IOException { + + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext02FPSAnimNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext02FPSAnimNEWT.java index 33819c845..c9193071b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext02FPSAnimNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext02FPSAnimNEWT.java @@ -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.ect; import java.io.IOException; @@ -38,17 +38,17 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; /** - * ExclusiveContextThread FPS Animator to test correctness of the ExclusiveContext feature _and_ FPSAnimator with NEWT. + * ExclusiveContextThread FPS Animator to test correctness of the ExclusiveContext feature _and_ FPSAnimator with NEWT. */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestExclusiveContext02FPSAnimNEWT extends ExclusiveContextBase00NEWT { - +public class TestExclusiveContext02FPSAnimNEWT extends ExclusiveContextBase00NEWT { + @Override protected AnimatorBase createAnimator() { return new FPSAnimator(0); } - - public static void main(String args[]) throws IOException { + + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext11VSyncAnimNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext11VSyncAnimNEWT.java index 5067d6c57..08d385dc3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext11VSyncAnimNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext11VSyncAnimNEWT.java @@ -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.ect; import java.io.IOException; @@ -38,17 +38,17 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; /** - * ExclusiveContextThread base implementation to test performance impact of the ExclusiveContext feature with Animator and NEWT. + * ExclusiveContextThread base implementation to test performance impact of the ExclusiveContext feature with Animator and NEWT. */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestExclusiveContext11VSyncAnimNEWT extends ExclusiveContextBase10NEWT { +public class TestExclusiveContext11VSyncAnimNEWT extends ExclusiveContextBase10NEWT { @Override protected AnimatorBase createAnimator() { return new Animator(); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext12FPSAnimNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext12FPSAnimNEWT.java index 993b67e80..8a4519228 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext12FPSAnimNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/TestExclusiveContext12FPSAnimNEWT.java @@ -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.ect; import java.io.IOException; @@ -38,17 +38,17 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; /** - * ExclusiveContextThread base implementation to test performance impact of the ExclusiveContext feature with FPSAnimator and NEWT. + * ExclusiveContextThread base implementation to test performance impact of the ExclusiveContext feature with FPSAnimator and NEWT. */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestExclusiveContext12FPSAnimNEWT extends ExclusiveContextBase10NEWT { - +public class TestExclusiveContext12FPSAnimNEWT extends ExclusiveContextBase10NEWT { + @Override protected AnimatorBase createAnimator() { return new FPSAnimator(0); } - - public static void main(String args[]) throws IOException { + + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase.java index 8c9d6c24a..b19dc38f2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase.java @@ -76,7 +76,7 @@ public abstract class GLContextDrawableSwitchBase 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; @@ -98,7 +98,7 @@ public abstract class GLContextDrawableSwitchBase extends UITestCase { glc.setPreferredSize(new_sz); glc.setSize(new_sz); } } ); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -111,7 +111,7 @@ public abstract class GLContextDrawableSwitchBase extends UITestCase { frame.pack(); frame.setVisible(true); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -123,18 +123,18 @@ public abstract class GLContextDrawableSwitchBase extends UITestCase { public void run() { frame.dispose(); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } } - private GLOffscreenAutoDrawable createGLOffscreenAutoDrawable(GLCapabilities caps, int width, int height) throws InterruptedException { + private GLOffscreenAutoDrawable createGLOffscreenAutoDrawable(final GLCapabilities caps, final int width, final int height) throws InterruptedException { final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile()); return factory.createOffscreenAutoDrawable(null, caps, null, width, height); } - protected static boolean validateOnOffscreenLayer(GLADType gladType1, GLADType gladType2) { + protected static boolean validateOnOffscreenLayer(final GLADType gladType1, final GLADType gladType2) { final boolean useOffscreenLayer = GLADType.GLCanvasOffscreen == gladType1 || GLADType.GLCanvasOffscreen == gladType2 ; final boolean useOnscreenLayer = GLADType.GLCanvasOnscreen == gladType1 || GLADType.GLCanvasOnscreen == gladType2 ; if( useOffscreenLayer ) { @@ -151,9 +151,9 @@ public abstract class GLContextDrawableSwitchBase extends UITestCase { return true; } - protected void testGLADOneLifecycle(Screen screen, GLCapabilities caps, GLADType gladType, int width, - int height, GLEventListenerCounter glelTracker, - SnapshotGLEventListener snapshotGLEventListener, final GLEventListenerState glelsIn, final GLEventListenerState glelsOut[], GLAnimatorControl animator) + protected void testGLADOneLifecycle(final Screen screen, final GLCapabilities caps, final GLADType gladType, final int width, + final int height, final GLEventListenerCounter glelTracker, + final SnapshotGLEventListener snapshotGLEventListener, final GLEventListenerState glelsIn, final GLEventListenerState glelsOut[], final GLAnimatorControl animator) throws InterruptedException { System.err.println("GLAD Lifecycle.0 "+gladType+", restoring "+((null!=glelsIn)?true:false)+", preserving "+((null!=glelsOut)?true:false)); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestBug722GLContextDrawableSwitchNewt2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestBug722GLContextDrawableSwitchNewt2AWT.java index 24eefe73c..512ebc974 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestBug722GLContextDrawableSwitchNewt2AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestBug722GLContextDrawableSwitchNewt2AWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.acore.glels; import java.io.IOException; @@ -58,16 +58,16 @@ public class TestBug722GLContextDrawableSwitchNewt2AWT extends GLContextDrawable static int loops = 10; static long duration2 = 100; // ms - + /** * Interesting artifact w/ ATI proprietary driver is that the * 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. */ 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<loops; i++) { + + for(int i=0; i<loops; i++) { final GLEventListenerState glels[] = new GLEventListenerState[1]; final GLEventListenerCounter glelTracker = new GLEventListenerCounter(); - + // - create glad1 w/o context // - create context using glad1 and assign it to glad1 { System.err.println("Test "+i+"/"+loops+".1: GLAD-1 "+gladType1+", preserving."); - testGLADOneLifecycle(screen, caps, gladType1, width, height, + testGLADOneLifecycle(screen, caps, gladType1, width, height, glelTracker, snapshotGLEventListener, - null, - glels, animator); + null, + glels, animator); System.err.println("Test "+i+"/"+loops+".1: done"); } - + // - create glad2 w/ survived context { System.err.println("Test "+i+"/"+loops+".2: GLAD-1 "+gladType2+", restoring."); - testGLADOneLifecycle(screen, caps, gladType2, width+100, height+100, + testGLADOneLifecycle(screen, caps, gladType2, width+100, height+100, glelTracker, snapshotGLEventListener, - glels[0], + glels[0], null, null); System.err.println("Test "+i+"/"+loops+".2: done."); } } animator.stop(); - + if( fixedNewtDisplay ) { screen.removeReference(); } } - - public static void main(String args[]) throws IOException { + + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; @@ -148,7 +148,7 @@ public class TestBug722GLContextDrawableSwitchNewt2AWT extends GLContextDrawable /** BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); System.err.println("Press enter to continue"); - System.err.println(stdin.readLine()); */ + System.err.println(stdin.readLine()); */ org.junit.runner.JUnitCore.main(TestBug722GLContextDrawableSwitchNewt2AWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java index 8ad3e0242..603c858c9 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.acore.glels; import java.io.IOException; @@ -69,21 +69,21 @@ import org.junit.runners.MethodSorters; public class TestGLContextDrawableSwitch01NEWT 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 createGLAutoDrawable(GLCapabilities caps, int x, int y, int width, int height, WindowListener wl) throws InterruptedException { + private GLAutoDrawable createGLAutoDrawable(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); @@ -91,71 +91,71 @@ public class TestGLContextDrawableSwitch01NEWT 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 GLContext context = drawable.createContext(null); Assert.assertNotNull(context); - + final GLAutoDrawableDelegate glad = new GLAutoDrawableDelegate(drawable, context, 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 testSwitch2WindowSingleContextGL2ES2() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2); if(null == reqGLCaps) return; testSwitch2WindowSingleContextImpl(reqGLCaps); } - + @Test(timeout=30000) public void testSwitch2WindowSingleContextGLES2() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GLES2); if(null == reqGLCaps) return; testSwitch2WindowSingleContextImpl(reqGLCaps); } - - private void testSwitch2WindowSingleContextImpl(GLCapabilities caps) throws InterruptedException { + + private void testSwitch2WindowSingleContextImpl(final GLCapabilities caps) throws InterruptedException { final QuitAdapter quitAdapter = new QuitAdapter(); - - GLAutoDrawable glad1 = createGLAutoDrawable(caps, 64, 64, width, height, quitAdapter); - GLAutoDrawable glad2 = createGLAutoDrawable(caps, 2*64+width, 64, width+100, height+100, quitAdapter); - + + final GLAutoDrawable glad1 = createGLAutoDrawable(caps, 64, 64, width, height, quitAdapter); + final GLAutoDrawable glad2 = createGLAutoDrawable(caps, 2*64+width, 64, width+100, height+100, quitAdapter); + // create single context using glad1 and assign it to glad1, // destroy the prev. context afterwards. { final GLContext newCtx = glad1.createContext(null); - Assert.assertNotNull(newCtx); + Assert.assertNotNull(newCtx); final GLContext oldCtx = glad1.setContext(newCtx, true); Assert.assertNotNull(oldCtx); Assert.assertFalse(oldCtx.isCreated()); @@ -163,22 +163,22 @@ public class TestGLContextDrawableSwitch01NEWT extends UITestCase { Assert.assertTrue(GLContext.CONTEXT_CURRENT_NEW==res || GLContext.CONTEXT_CURRENT==res); newCtx.release(); } - - final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener(); - GearsES2 gears = new GearsES2(1); + + final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener(); + final GearsES2 gears = new GearsES2(1); glad1.addGLEventListener(gears); glad1.addGLEventListener(snapshotGLEventListener); snapshotGLEventListener.setMakeSnapshot(); - - Animator animator = new Animator(); + + final Animator animator = new Animator(); animator.add(glad1); animator.add(glad2); animator.start(); - + 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++; @@ -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<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } else if(args[i].equals("-period")) { i++; try { period = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } /** BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); System.err.println("Press enter to continue"); - System.err.println(stdin.readLine()); */ + System.err.println(stdin.readLine()); */ org.junit.runner.JUnitCore.main(TestGLContextDrawableSwitch01NEWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch02AWT.java index c612f1204..d665c1a87 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch02AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch02AWT.java @@ -63,7 +63,7 @@ import org.junit.runners.MethodSorters; public class TestGLContextDrawableSwitch02AWT 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; @@ -77,12 +77,12 @@ public class TestGLContextDrawableSwitch02AWT extends UITestCase { height = 256; } - private GLAutoDrawable createGLAutoDrawable(final Frame frame, GLCapabilities caps, int width, int height) throws InterruptedException, InvocationTargetException { + private GLAutoDrawable createGLAutoDrawable(final Frame frame, final GLCapabilities caps, final int width, final int height) throws InterruptedException, InvocationTargetException { final GLAutoDrawable glad; if( caps.isOnscreen() ) { - GLCanvas glCanvas = new GLCanvas(caps); + final GLCanvas glCanvas = new GLCanvas(caps); Assert.assertNotNull(glCanvas); - Dimension glc_sz = new Dimension(width, height); + final Dimension glc_sz = new Dimension(width, height); glCanvas.setMinimumSize(glc_sz); glCanvas.setPreferredSize(glc_sz); glCanvas.setSize(glc_sz); @@ -111,33 +111,33 @@ public class TestGLContextDrawableSwitch02AWT extends UITestCase { testSwitch2AWTGLCanvas2OffscreenImpl(reqGLCaps); } - private void testSwitch2AWTGLCanvas2OffscreenImpl(GLCapabilities capsOnscreen) throws InterruptedException, InvocationTargetException { + private void testSwitch2AWTGLCanvas2OffscreenImpl(final GLCapabilities capsOnscreen) throws InterruptedException, InvocationTargetException { final GLCapabilities capsOffscreen = (GLCapabilities) capsOnscreen.clone(); capsOffscreen.setOnscreen(false); final Frame frame = new Frame("Gears AWT Test"); Assert.assertNotNull(frame); - GLAutoDrawable glCanvas = createGLAutoDrawable(frame, capsOnscreen, width, height); + final GLAutoDrawable glCanvas = createGLAutoDrawable(frame, capsOnscreen, width, height); final QuitAdapter quitAdapter = new QuitAdapter(); new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter), glCanvas).addTo(frame); final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener(); - GearsES2 gears = new GearsES2(1); + final GearsES2 gears = new GearsES2(1); glCanvas.addGLEventListener(gears); glCanvas.addGLEventListener(snapshotGLEventListener); snapshotGLEventListener.setMakeSnapshot(); - Animator animator = new Animator(); + final Animator animator = new Animator(); animator.add(glCanvas); animator.start(); int s = 0; - long t0 = System.currentTimeMillis(); + final long t0 = System.currentTimeMillis(); long t1 = t0; - GLAutoDrawable glOffscreen = createGLAutoDrawable(null, capsOffscreen, width, height); + final GLAutoDrawable glOffscreen = createGLAutoDrawable(null, capsOffscreen, width, height); while( !quitAdapter.shouldQuit() && ( t1 - t0 ) < duration ) { if( ( t1 - t0 ) / period > 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<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } else if(args[i].equals("-period")) { i++; try { period = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } /** diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java index 52743d819..822898e0b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.acore.glels; import java.io.IOException; @@ -63,11 +63,11 @@ import org.junit.runners.MethodSorters; /** * Test re-association of GLContext/GLDrawables, - * here GLContext's survival of GLDrawable destruction + * here GLContext's survival of GLDrawable destruction * and reuse w/ new or recreated GLDrawable. * <p> - * Test utilizes {@link GLEventListenerState} for preserving the - * GLAutoDrawable state, i.e. GLContext, all GLEventListener + * Test utilizes {@link GLEventListenerState} for preserving the + * GLAutoDrawable state, i.e. GLContext, all GLEventListener * and the GLAnimatorControl association. * </p> * <p> @@ -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<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } /** BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); System.err.println("Press enter to continue"); - System.err.println(stdin.readLine()); */ + System.err.println(stdin.readLine()); */ org.junit.runner.JUnitCore.main(TestGLContextDrawableSwitch10NEWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch11NewtAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch11NewtAWT.java index e5f61a4be..9697869bc 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch11NewtAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch11NewtAWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.acore.glels; import java.io.IOException; @@ -45,11 +45,11 @@ import org.junit.runners.MethodSorters; /** * Test re-association of GLContext/GLDrawables, - * here GLContext's survival of GLDrawable destruction + * here GLContext's survival of GLDrawable destruction * and reuse w/ new or recreated GLDrawable. * <p> - * Test utilizes {@link GLEventListenerState} for preserving the - * GLAutoDrawable state, i.e. GLContext, all GLEventListener + * Test utilizes {@link GLEventListenerState} for preserving the + * GLAutoDrawable state, i.e. GLContext, all GLEventListener * and the GLAnimatorControl association. * </p> * <p> @@ -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<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } /** BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); System.err.println("Press enter to continue"); - System.err.println(stdin.readLine()); */ + System.err.println(stdin.readLine()); */ org.junit.runner.JUnitCore.main(TestGLContextDrawableSwitch11NewtAWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch12AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch12AWT.java index d17d899b8..4ad0b1dc5 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch12AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch12AWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.acore.glels; import java.io.IOException; @@ -46,11 +46,11 @@ import org.junit.runners.MethodSorters; /** * Test re-association of GLContext/GLDrawables, - * here GLContext's survival of GLDrawable destruction + * here GLContext's survival of GLDrawable destruction * and reuse w/ new or recreated GLDrawable. * <p> - * Test utilizes {@link GLEventListenerState} for preserving the - * GLAutoDrawable state, i.e. GLContext, all GLEventListener + * Test utilizes {@link GLEventListenerState} for preserving the + * GLAutoDrawable state, i.e. GLContext, all GLEventListener * and the GLAnimatorControl association. * </p> * <p> @@ -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<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } /** BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); System.err.println("Press enter to continue"); - System.err.println(stdin.readLine()); */ + System.err.println(stdin.readLine()); */ org.junit.runner.JUnitCore.main(TestGLContextDrawableSwitch12AWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch21Newt2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch21Newt2AWT.java index 2b0f43d68..eaf3d37d4 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch21Newt2AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch21Newt2AWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.acore.glels; import java.io.IOException; @@ -49,17 +49,17 @@ import org.junit.runners.MethodSorters; /** * Test re-association of GLContext/GLDrawables, - * here GLContext's survival of GLDrawable destruction + * here GLContext's survival of GLDrawable destruction * and reuse w/ new or recreated GLDrawable. * <p> - * Test utilizes {@link GLEventListenerState} for preserving the - * GLAutoDrawable state, i.e. GLContext, all GLEventListener + * Test utilizes {@link GLEventListenerState} for preserving the + * GLAutoDrawable state, i.e. GLContext, all GLEventListener * and the GLAnimatorControl association. * </p> * <p> - * 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 * </p> * <p> * 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. * </p> */ @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<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } /** BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); System.err.println("Press enter to continue"); - System.err.println(stdin.readLine()); */ + System.err.println(stdin.readLine()); */ org.junit.runner.JUnitCore.main(TestGLContextDrawableSwitch21Newt2AWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/ManualHiDPIBufferedImage01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/ManualHiDPIBufferedImage01AWT.java index 0b67cfe46..6ccc9d2c4 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/ManualHiDPIBufferedImage01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/ManualHiDPIBufferedImage01AWT.java @@ -22,7 +22,7 @@ public class ManualHiDPIBufferedImage01AWT { static final int width = 200; static final int height = 100; - public static void main(String[] args) throws InterruptedException, InvocationTargetException { + public static void main(final String[] args) throws InterruptedException, InvocationTargetException { final JFrame frame = new JFrame(); SwingUtilities.invokeLater(new Runnable() { @@ -36,7 +36,7 @@ public class ManualHiDPIBufferedImage01AWT { @SuppressWarnings("serial") final Canvas canvas = new Canvas() { @Override - public void paint(Graphics g) { + public void paint(final Graphics g) { super.paint(g); g.drawImage(image1, 0, 0, width, height, this); g.drawImage(image2, 0, height + 5, width, height, this); @@ -52,14 +52,14 @@ public class ManualHiDPIBufferedImage01AWT { }); } - static JCheckBox getCheckBox(String text, boolean selected) { - JCheckBox checkBox = new JCheckBox(text); + static JCheckBox getCheckBox(final String text, final boolean selected) { + final JCheckBox checkBox = new JCheckBox(text); checkBox.setSelected(selected); checkBox.setSize(new Dimension(width, height)); return checkBox; } - static Image getImage(JComponent component, int width, int height, int scale) { + static Image getImage(final JComponent component, final int width, final int height, final int scale) { final BufferedImage image = new BufferedImage(width*scale, height*scale, BufferedImage.TYPE_INT_ARGB); final Graphics g = image.getGraphics(); ((Graphics2D) g).scale(scale, scale); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT01GLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT01GLn.java index 6152fb144..1bfe313ff 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT01GLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT01GLn.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.awt; import javax.media.opengl.GLProfile; @@ -53,13 +53,13 @@ public class TestAWT01GLn extends UITestCase { System.out.println("GLProfile "+GLProfile.glAvailabilityToString()); } - protected void runTestGL(GLCapabilities caps) throws InterruptedException { + protected void runTestGL(final GLCapabilities caps) throws InterruptedException { final Frame frame = new Frame("Texture Test"); Assert.assertNotNull(frame); - + final GLCanvas glCanvas = new GLCanvas(caps); Assert.assertNotNull(glCanvas); - + glCanvas.addGLEventListener(new GearsES2()); frame.add(glCanvas); @@ -71,23 +71,23 @@ public class TestAWT01GLn extends UITestCase { // Ensure 1st paint of GLCanvas will have a valid size, hence drawable gets created. frame.setSize(512, 512); frame.validate(); - + frame.setVisible(true); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } glCanvas.display(); // one in process display - Animator animator = new Animator(glCanvas); + final Animator animator = new Animator(glCanvas); animator.start(); Thread.sleep(500); // 500 ms animator.stop(); - + try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { @@ -95,7 +95,7 @@ public class TestAWT01GLn extends UITestCase { frame.remove(glCanvas); frame.dispose(); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } @@ -103,10 +103,10 @@ public class TestAWT01GLn extends UITestCase { @Test public void test01GLDefault() throws InterruptedException { - GLProfile glp = GLProfile.getDefault(); + final GLProfile glp = GLProfile.getDefault(); System.out.println("GLProfile Default: "+glp); if(glp.isGL2ES2()) { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps); } else { System.out.println("not a GL2ES2 profile"); @@ -116,9 +116,9 @@ public class TestAWT01GLn extends UITestCase { @Test public void test02GL2() throws InterruptedException { if(GLProfile.isAvailable(GLProfile.GL2)) { - GLProfile glprofile = GLProfile.get(GLProfile.GL2); + final GLProfile glprofile = GLProfile.get(GLProfile.GL2); System.out.println( "GLProfile GL2: " + glprofile ); - GLCapabilities caps = new GLCapabilities(glprofile); + final GLCapabilities caps = new GLCapabilities(glprofile); runTestGL(caps); } else { System.out.println("GL2 n/a"); @@ -128,16 +128,16 @@ public class TestAWT01GLn extends UITestCase { @Test public void test02ES2() throws InterruptedException { if(GLProfile.isAvailable(GLProfile.GLES2)) { - GLProfile glprofile = GLProfile.get(GLProfile.GLES2); + final GLProfile glprofile = GLProfile.get(GLProfile.GLES2); System.out.println( "GLProfile GLES2: " + glprofile ); - GLCapabilities caps = new GLCapabilities(glprofile); + final GLCapabilities caps = new GLCapabilities(glprofile); runTestGL(caps); } else { System.out.println("GLES2 n/a"); } } - - public static void main(String args[]) { + + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestAWT01GLn.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT02WindowClosing.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT02WindowClosing.java index 349674eef..412209482 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT02WindowClosing.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT02WindowClosing.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.awt; import com.jogamp.opengl.test.junit.util.UITestCase; @@ -47,7 +47,7 @@ public class TestAWT02WindowClosing extends UITestCase { @Test public void test01WindowClosing() throws InterruptedException { final Frame frame = new Frame(); - ClosingWindowAdapter closingWindowAdapter = new ClosingWindowAdapter(frame); + final ClosingWindowAdapter closingWindowAdapter = new ClosingWindowAdapter(frame); frame.addWindowListener(closingWindowAdapter); try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { @@ -55,7 +55,7 @@ public class TestAWT02WindowClosing extends UITestCase { frame.setSize(500, 500); frame.setVisible(true); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } @@ -63,8 +63,8 @@ public class TestAWT02WindowClosing extends UITestCase { Thread.sleep(durationPerTest); if(!closingWindowAdapter.closingCalled) { // programatically issue windowClosing - Toolkit tk = Toolkit.getDefaultToolkit(); - EventQueue evtQ = tk.getSystemEventQueue(); + final Toolkit tk = Toolkit.getDefaultToolkit(); + final EventQueue evtQ = tk.getSystemEventQueue(); evtQ.postEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING)); Thread.sleep(200); } @@ -74,25 +74,25 @@ public class TestAWT02WindowClosing extends UITestCase { static class ClosingWindowAdapter extends WindowAdapter { boolean closingCalled = false; Frame frame; - public ClosingWindowAdapter(Frame frame) { + public ClosingWindowAdapter(final Frame frame) { this.frame = frame; } - public void windowClosing(WindowEvent ev) { + public void windowClosing(final WindowEvent ev) { System.out.println("windowClosing() called .."); closingCalled = true; frame.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[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT03GLCanvasRecreate01.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT03GLCanvasRecreate01.java index 7282687e5..920fdda31 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT03GLCanvasRecreate01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWT03GLCanvasRecreate01.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.awt; import javax.media.opengl.GLProfile; @@ -81,7 +81,7 @@ public class TestAWT03GLCanvasRecreate01 extends UITestCase { frame1.add(label); frame1.setSize(512, 512); frame1.setLocation(0, 0); - + frame2 = new Frame("Frame 2"); Assert.assertNotNull(frame2); frame2.add(label); @@ -101,7 +101,7 @@ public class TestAWT03GLCanvasRecreate01 extends UITestCase { frame1.dispose(); frame2.dispose(); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } @@ -121,7 +121,7 @@ public class TestAWT03GLCanvasRecreate01 extends UITestCase { frame.add(glCanvas); frame.validate(); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } @@ -135,7 +135,7 @@ public class TestAWT03GLCanvasRecreate01 extends UITestCase { frame.add(label); frame.validate(); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } @@ -147,7 +147,7 @@ public class TestAWT03GLCanvasRecreate01 extends UITestCase { public void run() { frame.setVisible(v); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } @@ -175,7 +175,7 @@ public class TestAWT03GLCanvasRecreate01 extends UITestCase { Thread.sleep(durationPerTest/4); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atoi(args[++i], (int)durationPerTest); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug460GLCanvasNPEAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug460GLCanvasNPEAWT.java index 00e14b094..8fbe680df 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug460GLCanvasNPEAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug460GLCanvasNPEAWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.awt; import javax.media.opengl.GLCapabilities; @@ -40,18 +40,18 @@ import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestBug460GLCanvasNPEAWT { - public static void main(String[] args) { - TestBug460GLCanvasNPEAWT instance = new TestBug460GLCanvasNPEAWT(); + public static void main(final String[] args) { + final TestBug460GLCanvasNPEAWT instance = new TestBug460GLCanvasNPEAWT(); instance.testIncompleteGLCanvasNPE(); } @Test public void testIncompleteGLCanvasNPE() { - GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); - GLCanvas glc = new GLCanvas(caps); + final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); + final GLCanvas glc = new GLCanvas(caps); // GLDrawableFactory factory = glc.getFactory(); // null ok: not realized // GLCapabilitiesImmutable glci = glc.getChosenGLCapabilities(); -> 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atol(args[++i], durationPerTest); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461PBufferSupersamplingSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461PBufferSupersamplingSwingAWT.java index a1abbe2aa..1e0f8fe4a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461PBufferSupersamplingSwingAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461PBufferSupersamplingSwingAWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -30,7 +30,7 @@ package com.jogamp.opengl.test.junit.jogl.awt; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; - + import java.awt.image.BufferedImage; import java.lang.reflect.InvocationTargetException; @@ -64,11 +64,11 @@ import com.jogamp.opengl.test.junit.util.UITestCase; public class TestBug461PBufferSupersamplingSwingAWT extends UITestCase implements GLEventListener { JFrame jframe; GLPbuffer offScreenBuffer; - - 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); + gl.glClear(GL.GL_COLOR_BUFFER_BIT); // draw a triangle filling the window gl.glBegin(GL.GL_TRIANGLES); @@ -80,34 +80,34 @@ public class TestBug461PBufferSupersamplingSwingAWT extends UITestCase implement gl.glVertex2d(1, -1); gl.glEnd(); } - + /* @Override */ - public void init(GLAutoDrawable drawable) { + public void init(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) { + } + /* @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); + final BufferedImage outputImage = com.jogamp.opengl.util.awt.Screenshot.readToBufferedImage(200, 200, false); Assert.assertNotNull(outputImage); - ImageIcon imageIcon = new ImageIcon(outputImage); - JLabel imageLabel = new JLabel(imageIcon); + final ImageIcon imageIcon = new ImageIcon(outputImage); + final JLabel imageLabel = new JLabel(imageIcon); jframe.getContentPane().add(imageLabel); } /* @Override */ - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { jframe.setVisible(false); jframe.dispose(); }}); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } @@ -118,26 +118,26 @@ public class TestBug461PBufferSupersamplingSwingAWT extends UITestCase implement Assert.assertNotNull(jframe); jframe.setSize( 300, 300); 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. + + // COMMENTING OUT THIS LINE FIXES THE ISSUE. // Setting this in JOGL1 works. Thus this is a JOGL2 issue. glCap.setSampleBuffers(true); - + // Without line below, there is an error on Windows. glCap.setDoubleBuffered(false); // Needed for drop shadows @@ -146,7 +146,7 @@ public class TestBug461PBufferSupersamplingSwingAWT extends UITestCase implement //makes a new buffer offScreenBuffer = fac.createGLPbuffer(GLProfile.getDefaultDevice(), glCap, null, 200, 200, null); Assert.assertNotNull(offScreenBuffer); - offScreenBuffer.addGLEventListener(this); + offScreenBuffer.addGLEventListener(this); offScreenBuffer.display(); javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { @@ -155,7 +155,7 @@ public class TestBug461PBufferSupersamplingSwingAWT extends UITestCase implement offScreenBuffer.destroy(); } - public static void main(String args[]) { + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestBug461PBufferSupersamplingSwingAWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug551AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug551AWT.java index 51eb22210..8b9934310 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug551AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug551AWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.awt; import java.lang.reflect.InvocationTargetException; @@ -61,35 +61,35 @@ public class TestBug551AWT extends UITestCase { static void checkGraphicsEnvironment() { Rectangle virtualBounds = new Rectangle(); - GraphicsEnvironment ge =GraphicsEnvironment.getLocalGraphicsEnvironment(); - GraphicsDevice[] gs = ge.getScreenDevices(); + final GraphicsEnvironment ge =GraphicsEnvironment.getLocalGraphicsEnvironment(); + final GraphicsDevice[] gs = ge.getScreenDevices(); - //write graphics devices to log + //write graphics devices to log System.err.println("number of graphics devices " + gs.length); for(int i =0 ; i < gs.length; i++) { System.err.println(gs[i].toString()); } //check for bounds - for (int j = 0; j < gs.length; j++) { - GraphicsDevice gd = gs[j]; - GraphicsConfiguration[] gc = gd.getConfigurations(); + for (int j = 0; j < gs.length; j++) { + final GraphicsDevice gd = gs[j]; + final GraphicsConfiguration[] gc = gd.getConfigurations(); for (int i=0; i < gc.length; i++) { System.err.println("graphics configuration for device " + j + " is: " + gc[i].getBounds()); virtualBounds = virtualBounds.union(gc[i].getBounds()); - } + } } } - + protected void runTestGL() throws InterruptedException, InvocationTargetException { final Window window = new JFrame(this.getSimpleTestName(" - ")); final GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2()); - + // final array as mutable container hack final GLCanvas[] glCanvas = new GLCanvas[1]; - Runnable test = new Runnable() { + final Runnable test = new Runnable() { public void run() { glCanvas[0] = new GLCanvas(caps); glCanvas[0].addGLEventListener(new GearsES2()); @@ -106,13 +106,13 @@ public class TestBug551AWT extends UITestCase { } }; - Runnable cleanup = new Runnable() { + final Runnable cleanup = new Runnable() { public void run() { System.out.println("cleaning up..."); window.setVisible(false); try { window.removeAll(); - } catch (Throwable t) { + } catch (final Throwable t) { assumeNoException(t); t.printStackTrace(); } @@ -124,7 +124,7 @@ public class TestBug551AWT extends UITestCase { // AWT / Swing on EDT.. invokeAndWait(test); - Animator animator = new Animator(glCanvas[0]); + final Animator animator = new Animator(glCanvas[0]); animator.start(); Thread.sleep(1000); animator.stop(); @@ -144,7 +144,7 @@ public class TestBug551AWT extends UITestCase { runTestGL(); } - public static void main(String args[]) { + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestBug551AWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug572AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug572AWT.java index 234336016..5fb4433c9 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug572AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug572AWT.java @@ -58,7 +58,7 @@ public class TestBug572AWT extends UITestCase { static class Cleanup implements Runnable { Window window; - public Cleanup(Window w) { + public Cleanup(final Window w) { window = w; } @@ -67,7 +67,7 @@ public class TestBug572AWT extends UITestCase { window.setVisible(false); try { window.removeAll(); - } catch (Throwable t) { + } catch (final Throwable t) { Assume.assumeNoException(t); t.printStackTrace(); } @@ -95,7 +95,7 @@ public class TestBug572AWT extends UITestCase { window.setSize(512, 512); window.validate(); } else { - Dimension size = new Dimension(512, 512); + final Dimension size = new Dimension(512, 512); glCanvas.setPreferredSize(size); glCanvas.setMinimumSize(size); window.pack(); @@ -164,7 +164,7 @@ public class TestBug572AWT extends UITestCase { testRealizeGLCanvas(false, false); } - public static void main(String args[]) { + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestBug572AWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug611AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug611AWT.java index d8e781d92..e64df6687 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug611AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug611AWT.java @@ -15,25 +15,25 @@ import com.jogamp.opengl.test.junit.util.UITestCase; /** * As reported in Bug 611, on Windows XP is a performance issue: - * After JOGL initialization there seems to be a huge time lag + * After JOGL initialization there seems to be a huge time lag * when trying to open the Desktop folder. * <p> * 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. * </p> * <p> * Since Windows XP is out of life .. we may not care .. - * </p> + * </p> */ @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) - * + * * <p> * JSplitPane cannot mix hw/lw components, only if setting property '-Dsun.awt.disableMixing=true'. * </p> @@ -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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atol(args[++i], durationPerTest); @@ -189,11 +189,11 @@ public class TestBug642JSplitPaneMixHwLw01AWT extends UITestCase { /** BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); System.err.println("Press enter to continue"); - System.err.println(stdin.readLine()); + System.err.println(stdin.readLine()); */ System.out.println("durationPerTest: "+durationPerTest); - String tstname = TestBug642JSplitPaneMixHwLw01AWT.class.getName(); + final String tstname = TestBug642JSplitPaneMixHwLw01AWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } - + } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug664GLCanvasSetVisibleSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug664GLCanvasSetVisibleSwingAWT.java index 2a0bbfeb8..36c1e11b2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug664GLCanvasSetVisibleSwingAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug664GLCanvasSetVisibleSwingAWT.java @@ -44,6 +44,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; @@ -95,7 +96,7 @@ public class TestBug664GLCanvasSetVisibleSwingAWT 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); @@ -147,33 +148,33 @@ public class TestBug664GLCanvasSetVisibleSwingAWT extends UITestCase { private volatile int frameCount = 0; - protected void runTestGL(boolean onscreen, GLCapabilities caps) + protected void runTestGL(final boolean onscreen, final GLCapabilities caps) throws AWTException, InterruptedException, InvocationTargetException { for(int i=0; i<1; i++) { - Animator anim = new Animator(); + final Animator anim = new Animator(); final GLCanvas glc = new GLCanvas(caps); Assert.assertNotNull(glc); anim.add(glc); 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); glc.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) { + public void display(final GLAutoDrawable drawable) { frameCount++; } @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 GearsES2 gears = new GearsES2(1); gears.setVerbose(false); @@ -235,7 +236,7 @@ public class TestBug664GLCanvasSetVisibleSwingAWT extends UITestCase { System.err.println("Offscreen test requested or platform requires it."); return; } - GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); + final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); if(shallUseOffscreenPBufferLayer) { caps.setPBuffer(true); caps.setOnscreen(true); // simulate normal behavior .. @@ -251,7 +252,7 @@ public class TestBug664GLCanvasSetVisibleSwingAWT extends UITestCase { System.err.println("Platform doesn't support offscreen test."); return; } - GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); + final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); if(shallUseOffscreenPBufferLayer) { caps.setPBuffer(true); caps.setOnscreen(true); // simulate normal behavior .. @@ -259,13 +260,13 @@ public class TestBug664GLCanvasSetVisibleSwingAWT extends UITestCase { runTestGL(false, caps); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { durationPerTest = Long.parseLong(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } else if(args[i].equals("-layeredFBO")) { shallUseOffscreenFBOLayer = true; } else if(args[i].equals("-layeredPBuffer")) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug675BeansInDesignTimeAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug675BeansInDesignTimeAWT.java index 3363fdd52..12ebe88d3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug675BeansInDesignTimeAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug675BeansInDesignTimeAWT.java @@ -97,7 +97,7 @@ public class TestBug675BeansInDesignTimeAWT extends UITestCase { } ); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atol(args[++i], durationPerTest); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java index 913dad8d0..f169a27a9 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java @@ -95,17 +95,17 @@ public class TestBug816GLCanvasFrameHoppingB849B889AWT extends UITestCase { frame2.setSize(640, 480); frame2.setLocation(800, 64); - GLProfile profile = GLProfile.get(GLProfile.GL2ES2); - GLCapabilities glCapabilities = new GLCapabilities(profile); + final GLProfile profile = GLProfile.get(GLProfile.GL2ES2); + final GLCapabilities glCapabilities = new GLCapabilities(profile); final GLCanvas glCanvas = new GLCanvas(glCapabilities); glCanvas.setSize(new java.awt.Dimension(640, 480)); glCanvas.addGLEventListener(new GearsES2(1)); panel1.add(glCanvas, BorderLayout.CENTER); - JButton bMoveP1toP2 = new JButton("Move to Panel2"); + final JButton bMoveP1toP2 = new JButton("Move to Panel2"); bMoveP1toP2.addActionListener(new ActionListener() { @Override - public void actionPerformed(java.awt.event.ActionEvent evt) { + public void actionPerformed(final java.awt.event.ActionEvent evt) { System.err.println("XXXX Move P1 -> 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atoi(args[++i], (int)durationPerTest); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816JTabbedPanelVisibilityB849B878AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816JTabbedPanelVisibilityB849B878AWT.java index 091dc5378..efb7119e4 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816JTabbedPanelVisibilityB849B878AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816JTabbedPanelVisibilityB849B878AWT.java @@ -78,8 +78,8 @@ public class TestBug816JTabbedPanelVisibilityB849B878AWT extends UITestCase { panel1.setLayout(new BorderLayout()); panel2.setLayout(new BorderLayout()); - GLProfile profile = GLProfile.get(GLProfile.GL2ES2); - GLCapabilities glCapabilities = new GLCapabilities(profile); + final GLProfile profile = GLProfile.get(GLProfile.GL2ES2); + final GLCapabilities glCapabilities = new GLCapabilities(profile); final GLCanvas glCanvas = new GLCanvas(glCapabilities); glCanvas.setSize(new java.awt.Dimension(640, 480)); glCanvas.addGLEventListener(new GearsES2(1)); @@ -93,7 +93,7 @@ public class TestBug816JTabbedPanelVisibilityB849B878AWT extends UITestCase { tabbedPanel.addChangeListener(new javax.swing.event.ChangeListener() { @Override - public void stateChanged(javax.swing.event.ChangeEvent evt) { + public void stateChanged(final javax.swing.event.ChangeEvent evt) { if (tabbedPanel.getSelectedIndex() == 0) { System.err.println("XXXX Add GLCanvas Panel2("+id(panel2)+" -> 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atoi(args[++i], (int)durationPerTest); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java index 28e00dfe2..83cde8f2a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java @@ -101,7 +101,7 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase { frame.pack(); } } } ); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -115,13 +115,13 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase { frame.validate(); } } } ); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } } - protected void runTestGL(GLCapabilities caps, FrameLayout frameLayout, final boolean twoCanvas, final boolean resizeByComp) throws InterruptedException, InvocationTargetException { + protected void runTestGL(final GLCapabilities caps, final FrameLayout frameLayout, final boolean twoCanvas, final boolean resizeByComp) throws InterruptedException, InvocationTargetException { final JFrame frame = new JFrame("Bug816: "+this.getTestMethodName()); Assert.assertNotNull(frame); final Container framePane = frame.getContentPane(); @@ -191,33 +191,33 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase { } break; case Split: { - Dimension sbDim = new Dimension(16, 16); - JScrollPane vsp = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + final Dimension sbDim = new Dimension(16, 16); + final JScrollPane vsp = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); { - JScrollBar vsb = vsp.getVerticalScrollBar(); + final JScrollBar vsb = vsp.getVerticalScrollBar(); vsb.setPreferredSize(sbDim); - BoundedRangeModel model = vsb.getModel(); + final BoundedRangeModel model = vsb.getModel(); model.setMinimum(0); model.setMaximum(100); model.setValue(50); model.setExtent(1); vsb.setEnabled(true); } - JScrollPane hsp = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); + final JScrollPane hsp = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); { - JScrollBar hsb = hsp.getHorizontalScrollBar(); + final JScrollBar hsb = hsp.getHorizontalScrollBar(); hsb.setPreferredSize(sbDim); - BoundedRangeModel model = hsb.getModel(); + final BoundedRangeModel model = hsb.getModel(); model.setMinimum(0); model.setMaximum(100); model.setValue(50); model.setExtent(1); hsb.setEnabled(true); } - JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, + final JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, twoCanvas ? glCanvas2 : vsp, glCanvas1 ); horizontalSplitPane.setResizeWeight(0.5); - JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, + final JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, horizontalSplitPane, hsp); verticalSplitPane.setResizeWeight(0.5); framePane.add(verticalSplitPane); @@ -445,7 +445,7 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase { static int testNum = -1; - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java index 5f1b43a61..fa9ea7198 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java @@ -86,13 +86,13 @@ public class TestBug816OSXCALayerPos02AWT extends UITestCase { // 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, + 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); frame.add(intermediateRootPane); @@ -139,7 +139,7 @@ public class TestBug816OSXCALayerPos02AWT extends UITestCase { return GLProfile.getMaxProgrammableCore(true); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java index f37cdf332..74d18ce9b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java @@ -94,7 +94,7 @@ public class TestBug816OSXCALayerPos03aB729AWT extends UITestCase { // Create a check box that hides / shows canvas final Checkbox checkbox = new Checkbox("Visible canvas", true); checkbox.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent ev) { + public void itemStateChanged(final ItemEvent ev) { final boolean visible = checkbox.getState(); System.err.println("XXXX Canvas setVisible "+visible); glCanvas1.setVisible(visible); @@ -153,7 +153,7 @@ public class TestBug816OSXCALayerPos03aB729AWT extends UITestCase { return GLProfile.getMaxProgrammableCore(true); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java index acdd40764..9a9a7fce7 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java @@ -100,7 +100,7 @@ public class TestBug816OSXCALayerPos03bB849AWT extends UITestCase { // Create a check box that hides / shows canvas final Checkbox checkbox = new Checkbox("Visible canvas", true); checkbox.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent ev) { + public void itemStateChanged(final ItemEvent ev) { final boolean visible = checkbox.getState(); System.err.println("XXXX Panel setVisible "+visible); panel.setVisible(visible); @@ -159,7 +159,7 @@ public class TestBug816OSXCALayerPos03bB849AWT extends UITestCase { return GLProfile.getMaxProgrammableCore(true); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java index 52480b89b..afdf6fbcb 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java @@ -102,7 +102,7 @@ public class TestBug816OSXCALayerPos03cB849AWT extends UITestCase { // Create a check box that hides / shows canvas final JCheckBox checkbox = new JCheckBox("Visible canvas", true); checkbox.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent ev) { + public void itemStateChanged(final ItemEvent ev) { final boolean visible = checkbox.getSelectedObjects()!=null; System.err.println("XXXX Panel setVisible "+visible); panel.setVisible(visible); @@ -161,7 +161,7 @@ public class TestBug816OSXCALayerPos03cB849AWT extends UITestCase { return GLProfile.getMaxProgrammableCore(true); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04aAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04aAWT.java index 246c5cdb5..78fcbfed3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04aAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04aAWT.java @@ -139,7 +139,7 @@ public class TestBug816OSXCALayerPos04aAWT extends UITestCase { return GLProfile.getMaxProgrammableCore(true); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04bAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04bAWT.java index 186191b19..8f1917e3a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04bAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04bAWT.java @@ -139,7 +139,7 @@ public class TestBug816OSXCALayerPos04bAWT extends UITestCase { return GLProfile.getMaxProgrammableCore(true); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock00AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock00AWT.java index 46230465f..edb489a4a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock00AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock00AWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.awt; import javax.media.opengl.GLAutoDrawable; @@ -59,100 +59,100 @@ public class TestGLCanvasAWTActionDeadlock00AWT extends UITestCase { GLEventListener gle1 = null; GLEventListener gle2 = null; - + @Test public void test01Animator() throws InterruptedException { testImpl(new Animator(), 0, false); } - + @Test public void test02FPSAnimator() throws InterruptedException { testImpl(new FPSAnimator(30), 0, false); } - + @Test public void test02FPSAnimator_RestartOnAWTEDT() throws InterruptedException { testImpl(new FPSAnimator(30), 100, false); } - + /** May crash due to invalid thread usage, i.e. non AWT-EDT @Test public void test02FPSAnimator_RestartOnCurrentThread() throws InterruptedException { testImpl(new FPSAnimator(30), 100, true); } */ - - void testImpl(final AnimatorBase animator, int restartPeriod, boolean restartOnCurrentThread) throws InterruptedException { + + void testImpl(final AnimatorBase animator, final int restartPeriod, final boolean restartOnCurrentThread) throws InterruptedException { final Frame frame1 = new Frame("Frame 1"); gle1 = 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) { frame1.setTitle("f "+frameCount+", fps "+animator.getLastFPS()); frameCount++; } @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) { + } + }; gle2 = new GearsES2(); Assert.assertNotNull(frame1); { - 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); } frame1.setLocation(0, 0); frame1.setTitle("Generic Title"); - + GLCanvas glCanvas = createGLCanvas(); glCanvas.addGLEventListener(gle1); glCanvas.addGLEventListener(gle2); - + animator.setUpdateFPSFrames(60, System.err); animator.add(glCanvas); animator.start(); attachGLCanvas(frame1, glCanvas, false); - + try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame1.setVisible(true); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } - + final long sleep = 0 < restartPeriod ? restartPeriod : 100; long togo = durationPerTest; while( 0 < togo ) { if(0 < restartPeriod) { glCanvas = restart(frame1, glCanvas, restartOnCurrentThread); } - + Thread.sleep(sleep); - + togo -= sleep; } - + dispose(frame1, glCanvas); animator.stop(); - - gle1 = null; + + gle1 = null; gle2 = null; } - + void dispose(final Frame frame, final GLCanvas glCanvas) { try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { @@ -160,32 +160,32 @@ public class TestGLCanvasAWTActionDeadlock00AWT extends UITestCase { glCanvas.destroy(); frame.dispose(); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } } - - GLCanvas restart(final Frame frame, GLCanvas glCanvas, boolean restartOnCurrentThread) throws InterruptedException { + + GLCanvas restart(final Frame frame, GLCanvas glCanvas, final boolean restartOnCurrentThread) throws InterruptedException { glCanvas.disposeGLEventListener(gle1, true); glCanvas.disposeGLEventListener(gle2, true); detachGLCanvas(frame, glCanvas, restartOnCurrentThread); - + glCanvas = createGLCanvas(); - + attachGLCanvas(frame, glCanvas, restartOnCurrentThread); glCanvas.addGLEventListener(gle1); glCanvas.addGLEventListener(gle2); - + return glCanvas; } - - void attachGLCanvas(final Frame frame, final GLCanvas glCanvas, boolean restartOnCurrentThread) { + + void attachGLCanvas(final Frame frame, final GLCanvas glCanvas, final boolean restartOnCurrentThread) { System.err.println("*** attachGLCanvas.0 on-current-thread "+restartOnCurrentThread+", currentThread "+Thread.currentThread().getName()); if( restartOnCurrentThread ) { frame.setLayout(new BorderLayout()); frame.add(glCanvas, BorderLayout.CENTER); - frame.validate(); + frame.validate(); } else { try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { @@ -194,19 +194,19 @@ public class TestGLCanvasAWTActionDeadlock00AWT extends UITestCase { frame.add(glCanvas, BorderLayout.CENTER); frame.validate(); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } } System.err.println("*** attachGLCanvas.X"); } - - void detachGLCanvas(final Frame frame, final GLCanvas glCanvas, boolean restartOnCurrentThread) { + + void detachGLCanvas(final Frame frame, final GLCanvas glCanvas, final boolean restartOnCurrentThread) { System.err.println("*** detachGLCanvas.0 on-current-thread "+restartOnCurrentThread+", currentThread "+Thread.currentThread().getName()); if( restartOnCurrentThread ) { frame.remove(glCanvas); - frame.validate(); + frame.validate(); } else { try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { @@ -214,26 +214,26 @@ public class TestGLCanvasAWTActionDeadlock00AWT extends UITestCase { frame.remove(glCanvas); frame.validate(); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } } System.err.println("*** detachGLCanvas.X"); } - + int frameCount = 0; - + GLCanvas createGLCanvas() { System.err.println("*** createGLCanvas.0"); final GLCanvas glCanvas = new GLCanvas(); glCanvas.setBounds(0, 0, width, height); Assert.assertNotNull(glCanvas); System.err.println("*** createGLCanvas.X"); - return glCanvas; + return glCanvas; } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atoi(args[++i], (int)durationPerTest); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock01AWT.java index ba06f91a3..5b605ff33 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock01AWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.awt; import javax.media.opengl.GLAutoDrawable; @@ -61,9 +61,9 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; /** - * BUG on OSX/CALayer w/ Java6: + * BUG on OSX/CALayer w/ Java6: * If frame.setTitle() is issued right after initialization the call hangs in - * <pre> + * <pre> * 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] * </pre> @@ -75,7 +75,7 @@ import org.junit.runners.MethodSorters; * e.g. setResizable*(). * </p> * <p> - * 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) ! * </p> */ @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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atoi(args[++i], (int)durationPerTest); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock02AWT.java index 605f97fe3..89b2880c2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock02AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAWTActionDeadlock02AWT.java @@ -202,14 +202,14 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase { height = 300; final MiniPApplet applet = this; - GraphicsEnvironment environment = + final GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment(); - GraphicsDevice displayDevice = environment.getDefaultScreenDevice(); + final GraphicsDevice displayDevice = environment.getDefaultScreenDevice(); frame = new Frame(displayDevice.getDefaultConfiguration()); final Rectangle fullScreenRect; if (fullScreen) { - DisplayMode mode = displayDevice.getDisplayMode(); + final DisplayMode mode = displayDevice.getDisplayMode(); fullScreenRect = new Rectangle(0, 0, mode.getWidth(), mode.getHeight()); } else { fullScreenRect = null; @@ -228,7 +228,7 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase { frame.setBounds(fullScreenRect); frame.setVisible(true); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } @@ -251,21 +251,21 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase { (fullScreenRect.height - applet.height) / 2, applet.width, applet.height); } else { - Insets insets = frame.getInsets(); + final Insets insets = frame.getInsets(); - int windowW = applet.width + insets.left + insets.right; - int windowH = applet.height + insets.top + insets.bottom; - int locationX = 100; - int locationY = 100; + final int windowW = applet.width + insets.left + insets.right; + final int windowH = applet.height + insets.top + insets.bottom; + final int locationX = 100; + final int locationY = 100; frame.setSize(windowW, windowH); frame.setLocation(locationX, locationY); - int usableWindowH = windowH - insets.top - insets.bottom; + final int usableWindowH = windowH - insets.top - insets.bottom; applet.setBounds((windowW - width)/2, insets.top + (usableWindowH - height)/2, width, height); } }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } @@ -273,10 +273,10 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase { frame.add(this); frame.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { + public void windowClosing(final WindowEvent e) { try { dispose(); - } catch (Exception ex) { + } catch (final Exception ex) { Assume.assumeNoException(ex); } } @@ -388,7 +388,7 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase { } } - void draw(GL2 gl) { + void draw(final GL2 gl) { if( !osxCALayerAWTModBug || !justInitialized ) { AWTEDTExecutor.singleton.invoke(true, new Runnable() { public void run() { @@ -408,8 +408,8 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase { System.out.println(OPENGL_VERSION); System.out.println(OPENGL_EXTENSIONS); - int[] temp = { 0 }; - gl.glGetIntegerv(GL2.GL_MAX_SAMPLES, temp, 0); + final int[] temp = { 0 }; + gl.glGetIntegerv(GL2ES3.GL_MAX_SAMPLES, temp, 0); System.out.println("Maximum number of samples supported by the hardware: " + temp[0]); System.out.println("Frame: "+frame); System.out.println("Applet: "+MiniPApplet.this); @@ -418,7 +418,7 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase { } if (currentSamples == -1) { - int[] temp = { 0 }; + final int[] temp = { 0 }; gl.glGetIntegerv(GL.GL_SAMPLES, temp, 0); currentSamples = temp[0]; if (numSamples != currentSamples) { @@ -439,7 +439,7 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase { } if (restarted) { - int[] temp = { 0 }; + final int[] temp = { 0 }; gl.glGetIntegerv(GL.GL_SAMPLES, temp, 0); if (numSamples != temp[0]) { System.err.println("Multisampling level requested " + numSamples + " not supported. Using " + temp[0] + "samples instead."); @@ -465,7 +465,7 @@ public class TestGLCanvasAWTActionDeadlock02AWT extends UITestCase { gl.glFlush(); fcount += 1; - int m = (int) (System.currentTimeMillis() - millisOffset); + final int m = (int) (System.currentTimeMillis() - millisOffset); if (m - lastm > 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<args.length; i++) { if(args[i].equals("-frames")) { framesPerTest = MiscUtils.atoi(args[++i], framesPerTest); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelResize01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelResize01AWT.java index 2133d62a2..cc2c9ef57 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelResize01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelResize01AWT.java @@ -133,13 +133,13 @@ public class TestGLJPanelResize01AWT extends UITestCase { // frame[0].pack(); frame[0].setVisible(true); } } ); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } try { Thread.sleep(duration); - } catch (InterruptedException e1) { + } catch (final InterruptedException e1) { e1.printStackTrace(); } try { @@ -147,7 +147,7 @@ public class TestGLJPanelResize01AWT extends UITestCase { public void run() { frame[0].dispose(); } } ); - } catch (Exception e1) { + } catch (final Exception e1) { e1.printStackTrace(); } } @@ -184,7 +184,7 @@ public class TestGLJPanelResize01AWT extends UITestCase { static long duration = 600; // ms - public static void main(String[] args) { + public static void main(final String[] args) { boolean useSwingDoubleBuffer=false, manual=false; for(int i=0; i<args.length; i++) { @@ -199,7 +199,7 @@ public class TestGLJPanelResize01AWT extends UITestCase { } if( manual ) { GLProfile.initSingleton(); - TestGLJPanelResize01AWT demo = new TestGLJPanelResize01AWT(); + final TestGLJPanelResize01AWT demo = new TestGLJPanelResize01AWT(); demo.test(new GLCapabilities(null), esize01, useSwingDoubleBuffer); } else { org.junit.runner.JUnitCore.main(TestGLJPanelResize01AWT.class.getName()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelTextureStateAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelTextureStateAWT.java index 5a5747a59..8cf4b6899 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelTextureStateAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelTextureStateAWT.java @@ -81,7 +81,7 @@ public class TestGLJPanelTextureStateAWT extends UITestCase { frame.validate(); } } } ); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -135,7 +135,7 @@ public class TestGLJPanelTextureStateAWT extends UITestCase { int tX, tY, tW, tH; int shot = 0; - void setupTex(GL gl) { + void setupTex(final GL gl) { // Note: FBObject uses diff defaults, i.e.: GL_NEAREST and GL_CLAMP_TO_EDGE if( keepTextureBound ) { gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); @@ -146,9 +146,9 @@ public class TestGLJPanelTextureStateAWT extends UITestCase { } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { // Initialize w/ arbitrary values ! - GL2ES2 gl = drawable.getGL().getGL2ES2(); + final GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.glActiveTexture(GL.GL_TEXTURE0 + 1); gl.glBindTexture(GL.GL_TEXTURE_2D, 0); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); @@ -168,13 +168,13 @@ public class TestGLJPanelTextureStateAWT extends UITestCase { } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { gle0.dispose(drawable); gle1.dispose(drawable); } @Override - public void display(GLAutoDrawable drawable) { - GL2ES2 gl = drawable.getGL().getGL2ES2(); + public void display(final GLAutoDrawable drawable) { + final GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); @@ -218,7 +218,7 @@ public class TestGLJPanelTextureStateAWT extends UITestCase { } final int border = 5; @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) { gle0X = x + border; gle0Y = y; gle0W = width/2 - 2*border; @@ -237,7 +237,7 @@ public class TestGLJPanelTextureStateAWT extends UITestCase { tH = height; // System.err.println("Total "+tX+"/"+tY+" "+tW+"x"+tH); - GL2ES2 gl = drawable.getGL().getGL2ES2(); + final GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.glViewport(gle0X, gle0Y, gle0W, gle0H); gle0.reshape(drawable, 0, 0, gle0W, gle0H); // don't 'skip' about gle0X/gle0Y @@ -259,7 +259,7 @@ public class TestGLJPanelTextureStateAWT extends UITestCase { frame.pack(); frame.setVisible(true); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -283,7 +283,7 @@ public class TestGLJPanelTextureStateAWT extends UITestCase { frame.remove(glc); frame.dispose(); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -303,7 +303,7 @@ public class TestGLJPanelTextureStateAWT extends UITestCase { testImpl(true /* keepTextureBound */, 1 /* texUnit */); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestIsRealizedConcurrency01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestIsRealizedConcurrency01AWT.java index 3f8b76a17..d75ff6659 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestIsRealizedConcurrency01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestIsRealizedConcurrency01AWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.awt; import javax.media.opengl.awt.GLCanvas; @@ -49,22 +49,22 @@ import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestIsRealizedConcurrency01AWT extends UITestCase { static long durationPerTest = 500; // ms - + @Test public void testAddRemove() throws InterruptedException, InvocationTargetException { final Dimension f_sz = new Dimension(512, 512); - + final GLCanvas glCanvas = new GLCanvas(); Assert.assertNotNull(glCanvas); glCanvas.addGLEventListener(new GearsES2()); final Animator animator = new Animator(glCanvas); animator.start(); - + final Frame frame = new Frame("Frame"); - Assert.assertNotNull(frame); + Assert.assertNotNull(frame); frame.add(glCanvas); - + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame.setLocation(0, 0); @@ -83,17 +83,17 @@ public class TestIsRealizedConcurrency01AWT extends UITestCase { frame.validate(); }}); Thread.sleep(durationPerTest/2); - + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { glCanvas.destroy(); frame.dispose(); }}); - + animator.stop(); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atoi(args[++i], (int)durationPerTest); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestJScrollPaneMixHwLw01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestJScrollPaneMixHwLw01AWT.java index 28fb79cea..ec9cece53 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestJScrollPaneMixHwLw01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestJScrollPaneMixHwLw01AWT.java @@ -32,7 +32,7 @@ import com.jogamp.opengl.util.Animator; /** * Documenting Bug 586 - * + * * <p> * JScrollPane cannot mix hw/lw components, only if setting property '-Dsun.awt.disableMixing=true'. * </p> @@ -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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atol(args[++i], durationPerTest); @@ -166,11 +166,11 @@ public class TestJScrollPaneMixHwLw01AWT extends UITestCase { /** BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); System.err.println("Press enter to continue"); - System.err.println(stdin.readLine()); + System.err.println(stdin.readLine()); */ System.out.println("durationPerTest: "+durationPerTest); - String tstname = TestJScrollPaneMixHwLw01AWT.class.getName(); + final String tstname = TestJScrollPaneMixHwLw01AWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } - + } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestSwingAWT01GLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestSwingAWT01GLn.java index ccdaf6edc..d24101270 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestSwingAWT01GLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestSwingAWT01GLn.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.awt; import java.lang.reflect.InvocationTargetException; @@ -83,7 +83,7 @@ public class TestSwingAWT01GLn extends UITestCase { // final array as mutable container hack final GLCanvas[] glCanvas = new GLCanvas[1]; - Runnable test = new Runnable() { + final Runnable test = new Runnable() { public void run() { glCanvas[0] = new GLCanvas(caps); glCanvas[0].addGLEventListener(new GearsES2()); @@ -100,13 +100,13 @@ public class TestSwingAWT01GLn extends UITestCase { } }; - Runnable cleanup = new Runnable() { + final Runnable cleanup = new Runnable() { public void run() { System.out.println("cleaning up..."); window.setVisible(false); try { window.removeAll(); - } catch (Throwable t) { + } catch (final Throwable t) { assumeNoException(t); t.printStackTrace(); } @@ -118,7 +118,7 @@ public class TestSwingAWT01GLn extends UITestCase { // AWT / Swing on EDT.. invokeAndWait(test); - Animator animator = new Animator(glCanvas[0]); + final Animator animator = new Animator(glCanvas[0]); animator.start(); Thread.sleep(1000); animator.stop(); @@ -130,10 +130,10 @@ public class TestSwingAWT01GLn extends UITestCase { @Test public void test01GLDefault() throws InterruptedException, InvocationTargetException { - GLProfile glp = GLProfile.getDefault(); + final GLProfile glp = GLProfile.getDefault(); System.out.println("GLProfile Default: "+glp); if(glp.isGL2ES2()) { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps); } else { System.out.println("not a GL2ES2 profile"); @@ -143,16 +143,16 @@ public class TestSwingAWT01GLn extends UITestCase { @Test public void test02GL2() throws InterruptedException, InvocationTargetException { if(GLProfile.isAvailable(GLProfile.GL2)) { - GLProfile glprofile = GLProfile.get(GLProfile.GL2); + final GLProfile glprofile = GLProfile.get(GLProfile.GL2); System.out.println( "GLProfile GL2: " + glprofile ); - GLCapabilities caps = new GLCapabilities(glprofile); + final GLCapabilities caps = new GLCapabilities(glprofile); runTestGL(caps); } else { System.out.println("GL2 n/a"); } } - public static void main(String args[]) { + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestSwingAWT01GLn.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TestAWTTextRendererUseVertexArrayBug464.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TestAWTTextRendererUseVertexArrayBug464.java index 066e5fe0d..4b1da1e2e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TestAWTTextRendererUseVertexArrayBug464.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TestAWTTextRendererUseVertexArrayBug464.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.awt.text; import javax.media.opengl.GLProfile; @@ -49,15 +49,15 @@ import org.junit.runners.MethodSorters; /* * Unit tests for Bug464 - * Some ATI-Drivers crash the JVM if VBO-related glFunctions are called. This test checks + * Some ATI-Drivers crash the JVM if VBO-related glFunctions are called. This test checks * if TextRenderer calls any of these functions while it's useVertexArray variable is set * to false. - * 2D- and 3D-TextRendering is tested by creating a GLCanvas showing a simple line of text + * 2D- and 3D-TextRendering is tested by creating a GLCanvas showing a simple line of text * while filtering all glFunction calls by using a modified version of TraceGL2. * VBO-related function are logged to the disallowedMethodCalls String of the GLEventListener - * instead of being executed (to prevent JVM crashes). Therefore, if the + * instead of being executed (to prevent JVM crashes). Therefore, if the * disallowedMethodCalls isn't an empty String after the test, the test fails. - * + * * Other classes related to this test: * TestTextRendererGLEventListener01 * TestTextRendererTraceGL2Mock01 @@ -67,7 +67,7 @@ import org.junit.runners.MethodSorters; public class TestAWTTextRendererUseVertexArrayBug464 extends UITestCase { static GLProfile glp; static GLCapabilities caps; - + private GLCanvas glCanvas; private Frame frame; @@ -92,7 +92,7 @@ public class TestAWTTextRendererUseVertexArrayBug464 extends UITestCase { frame.setSize(512, 512); frame.setVisible(true); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -107,10 +107,10 @@ public class TestAWTTextRendererUseVertexArrayBug464 extends UITestCase { frame.remove(glCanvas); frame.dispose(); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); - } + } glCanvas=null; frame=null; } @@ -118,45 +118,45 @@ public class TestAWTTextRendererUseVertexArrayBug464 extends UITestCase { @Test public void testTextRendererDraw2D() throws InterruptedException { - TextRendererGLEventListener01 listener = new TextRendererGLEventListener01(1); + final TextRendererGLEventListener01 listener = new TextRendererGLEventListener01(1); Assert.assertNotNull(listener); glCanvas.addGLEventListener(listener); - Animator animator = new Animator(glCanvas); + final Animator animator = new Animator(glCanvas); animator.start(); - + Thread.sleep(500); // 500 ms - + animator.stop(); - - String disallowedMethods = listener.getDisallowedMethodCalls(); + + final String disallowedMethods = listener.getDisallowedMethodCalls(); if (!disallowedMethods.equals("")) { Assert.fail("Following VBO-related glMethods have been called: "+ disallowedMethods); } } - + @Test public void testTextRendererDraw3D() throws InterruptedException { - TextRendererGLEventListener01 listener = new TextRendererGLEventListener01(2); + final TextRendererGLEventListener01 listener = new TextRendererGLEventListener01(2); Assert.assertNotNull(listener); glCanvas.addGLEventListener(listener); - Animator animator = new Animator(glCanvas); + final Animator animator = new Animator(glCanvas); animator.start(); - + Thread.sleep(500); // 500 ms - + animator.stop(); - - String disallowedMethods = listener.getDisallowedMethodCalls(); + + final String disallowedMethods = listener.getDisallowedMethodCalls(); if (!disallowedMethods.equals("")) { Assert.fail("Following VBO-related glMethods have been called: "+ disallowedMethods); } } - public static void main(String args[]) throws IOException { - String tstname = TestAWTTextRendererUseVertexArrayBug464.class.getName(); + public static void main(final String args[]) throws IOException { + final String tstname = TestAWTTextRendererUseVertexArrayBug464.class.getName(); org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { tstname, "filtertrace=true", @@ -168,5 +168,5 @@ public class TestAWTTextRendererUseVertexArrayBug464 extends UITestCase { "logtestlistenerevents=true", "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter", "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } ); - } + } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererGLEventListener01.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererGLEventListener01.java index 3a9f643dc..44089ff67 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererGLEventListener01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererGLEventListener01.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.awt.text; import java.awt.Font; @@ -33,10 +33,12 @@ import java.io.OutputStream; import java.io.PrintStream; import com.jogamp.opengl.util.awt.TextRenderer; + import javax.media.opengl.GL2ES1; import javax.media.opengl.GL2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import javax.media.opengl.glu.GLU; import org.junit.Assert; @@ -45,55 +47,55 @@ import org.junit.Assert; * Unit tests for Bug464 * GLEventListener for unit test TestAWTTextRendererUseVertexArrayBug464. The display * method renders the String "ABC123#+?" to the lower left corner of the canvas. - * + * * The testNumber variable is used to switch between 2D- and 3D-textrendering in the display * method. * The disallowedMethodCalls variable is used to log VBO-related glFunction calls during * the execution of the test. - * + * * Other classes related to this test: * TestAWTTextRendererUseVertexArrayBug464 * TextRendererTraceGL2Mock01 */ public class TextRendererGLEventListener01 implements GLEventListener { - private GLU glu = new GLU(); + private final GLU glu = new GLU(); private TextRenderer renderer; private String text; private String disallowedMethodCalls; - private int testNumber; - - public TextRendererGLEventListener01(int testNumber) { + private final int testNumber; + + public TextRendererGLEventListener01(final int testNumber) { this.disallowedMethodCalls = ""; this.testNumber = testNumber; } - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { renderer = new TextRenderer(new Font("SansSerif", Font.BOLD, 36)); renderer.setUseVertexArrays(false); Assert.assertNotNull(renderer); Assert.assertFalse(renderer.getUseVertexArrays()); - + text = "ABC123#+?"; - - PrintStream nullStream = new PrintStream(new OutputStream(){ public void write(int b){}}); + + final PrintStream nullStream = new PrintStream(new OutputStream(){ public void write(final int b){}}); drawable.setGL(new TextRendererTraceGL2Mock01(drawable.getGL().getGL2(), nullStream, this)); } - 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(); } - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { renderer.dispose(); } - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { if (disallowedMethodCalls.equals("")) { if (testNumber == 1) { renderer.beginRendering(drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); @@ -109,14 +111,14 @@ public class TextRendererGLEventListener01 implements GLEventListener { } } } - - public void disallowedMethodCalled (String method) { + + public void disallowedMethodCalled (final String method) { if (!disallowedMethodCalls.equals("")) { disallowedMethodCalls += ", "; } disallowedMethodCalls += method; } - + public String getDisallowedMethodCalls() { return this.disallowedMethodCalls; } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererTraceGL2Mock01.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererTraceGL2Mock01.java index 86714fcc5..3adcf9823 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererTraceGL2Mock01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererTraceGL2Mock01.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -40,8 +40,8 @@ import com.jogamp.common.nio.Buffers; /* * Unit tests for Bug464 - * Modified Version of TraceGL2 for unit test TestAWTTextRendererUseVertexArrayBug464. - * This class overrides all glFunctions related to VBO's according to + * Modified Version of TraceGL2 for unit test TestAWTTextRendererUseVertexArrayBug464. + * This class overrides all glFunctions related to VBO's according to * http://code.google.com/p/glextensions/wiki/GL_ARB_vertex_buffer_object: * glBindBuffer (glBindBufferARB) * glDeleteBuffers (glDeleteBuffersARB) @@ -56,81 +56,81 @@ import com.jogamp.common.nio.Buffers; * glGetBufferPointerv (glGetBufferPointervARB) * Calls to the overridden methods are logged to the disallowedMethodCalls variable of * the GLEventListener instead of being passed to the downstreamGL object. - * + * * Other classes related to this test: * TestAWTTextRendererUseVertexArrayBug464 * TextRendererGLEventListener01 */ public class TextRendererTraceGL2Mock01 extends TraceGL2 { - + TextRendererGLEventListener01 listener; - public TextRendererTraceGL2Mock01(GL2 downstreamGL2, PrintStream stream, TextRendererGLEventListener01 listener) { + public TextRendererTraceGL2Mock01(final GL2 downstreamGL2, final PrintStream stream, final TextRendererGLEventListener01 listener) { super(downstreamGL2, stream); this.listener = listener; - } + } @Override - public void glGetBufferSubData(int arg0, long arg1, long arg2, Buffer arg3) { + public void glGetBufferSubData(final int arg0, final long arg1, final long arg2, final Buffer arg3) { listener.disallowedMethodCalled("glGetBufferSubData"); } @Override - public ByteBuffer glMapBuffer(int arg0, int arg1) { + public ByteBuffer glMapBuffer(final int arg0, final int arg1) { listener.disallowedMethodCalled("glMapBuffer"); return Buffers.newDirectByteBuffer(0); } @Override - public void glGetBufferParameteriv(int arg0, int arg1, IntBuffer arg2) { + public void glGetBufferParameteriv(final int arg0, final int arg1, final IntBuffer arg2) { listener.disallowedMethodCalled("glGetBufferParameteriv"); } @Override - public boolean glUnmapBuffer(int arg0) { + public boolean glUnmapBuffer(final int arg0) { listener.disallowedMethodCalled("glUnmapBuffer"); return false; } - + @Override - public void glGenBuffers(int arg0, IntBuffer arg1) { + public void glGenBuffers(final int arg0, final IntBuffer arg1) { listener.disallowedMethodCalled("glGenBuffers"); } @Override - public void glGenBuffers(int arg0, int[] arg1, int arg2) { + public void glGenBuffers(final int arg0, final int[] arg1, final int arg2) { listener.disallowedMethodCalled("glGenBuffers"); } @Override - public boolean glIsBuffer(int arg0) { + public boolean glIsBuffer(final int arg0) { listener.disallowedMethodCalled("glIsBuffer"); return false; } @Override - public void glBindBuffer(int arg0, int arg1) { + public void glBindBuffer(final int arg0, final int arg1) { listener.disallowedMethodCalled("glBindBuffer"); } @Override - public void glDeleteBuffers(int arg0, int[] arg1, int arg2) { + public void glDeleteBuffers(final int arg0, final int[] arg1, final int arg2) { listener.disallowedMethodCalled("glDeleteBuffers"); } @Override - public void glBufferSubData(int arg0, long arg1, long arg2, Buffer arg3) { + public void glBufferSubData(final int arg0, final long arg1, final long arg2, final Buffer arg3) { listener.disallowedMethodCalled("glBufferSubData"); } @Override - public void glGetBufferParameteriv(int arg0, int arg1, int[] arg2, int arg3) { + public void glGetBufferParameteriv(final int arg0, final int arg1, final int[] arg2, final int arg3) { listener.disallowedMethodCalled("glGetBufferParameteriv"); } @Override - public void glBufferData(int arg0, long arg1, Buffer arg2, int arg3) { + public void glBufferData(final int arg0, final long arg1, final Buffer arg2, final int arg3) { listener.disallowedMethodCalled("glBufferData"); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleChooser01.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleChooser01.java index efdd2e16d..02265ad0b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleChooser01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/MultisampleChooser01.java @@ -48,22 +48,22 @@ import javax.media.opengl.GLCapabilitiesImmutable; class MultisampleChooser01 extends DefaultGLCapabilitiesChooser { @Override - public int chooseCapabilities(final CapabilitiesImmutable desired, - final List<? extends CapabilitiesImmutable> available, + public int chooseCapabilities(final CapabilitiesImmutable desired, + final List<? extends CapabilitiesImmutable> 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; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atoi(args[++i], 500); } } System.out.println("durationPerTest: "+durationPerTest); - String tstname = TestMultisampleES1AWT.class.getName(); + final String tstname = TestMultisampleES1AWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } @@ -93,11 +93,11 @@ public class TestMultisampleES1AWT extends UITestCase { testMultiSampleAAImpl(8); } - private void testMultiSampleAAImpl(int reqSamples) throws InterruptedException, InvocationTargetException { + private void testMultiSampleAAImpl(final int reqSamples) throws InterruptedException, InvocationTargetException { final GLReadBufferUtil screenshot = new GLReadBufferUtil(true, false); - GLProfile glp = GLProfile.getMaxFixedFunc(true); - GLCapabilities caps = new GLCapabilities(glp); - GLCapabilitiesChooser chooser = new MultisampleChooser01(); + final GLProfile glp = GLProfile.getMaxFixedFunc(true); + final GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilitiesChooser chooser = new MultisampleChooser01(); if(reqSamples>0) { 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; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atoi(args[++i], 500); } } System.out.println("durationPerTest: "+durationPerTest); - String tstname = TestMultisampleES1NEWT.class.getName(); + final String tstname = TestMultisampleES1NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } @@ -113,16 +113,16 @@ public class TestMultisampleES1NEWT extends UITestCase { testMultiSampleAAImpl(true, false, 8); } - private void testMultiSampleAAImpl(boolean useFBO, boolean usePBuffer, int reqSamples) throws InterruptedException { + private void testMultiSampleAAImpl(final boolean useFBO, final boolean usePBuffer, final int reqSamples) throws InterruptedException { final GLReadBufferUtil screenshot = new GLReadBufferUtil(true, false); - GLProfile glp = GLProfile.getMaxFixedFunc(true); - GLCapabilities caps = new GLCapabilities(glp); - GLCapabilitiesChooser chooser = new MultisampleChooser01(); + final GLProfile glp = GLProfile.getMaxFixedFunc(true); + final GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilitiesChooser chooser = new MultisampleChooser01(); caps.setAlphaBits(1); caps.setFBO(useFBO); caps.setPBuffer(usePBuffer); - + if(reqSamples>0) { 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; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atoi(args[++i], 500); } } System.out.println("durationPerTest: "+durationPerTest); - String tstname = TestMultisampleES2NEWT.class.getName(); + final String tstname = TestMultisampleES2NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } @@ -102,16 +102,16 @@ public class TestMultisampleES2NEWT extends UITestCase { testMultiSampleAAImpl(true, false, 8); } - private void testMultiSampleAAImpl(boolean useFBO, boolean usePBuffer, int reqSamples) throws InterruptedException { + private void testMultiSampleAAImpl(final boolean useFBO, final boolean usePBuffer, final int reqSamples) throws InterruptedException { final GLReadBufferUtil screenshot = new GLReadBufferUtil(true, false); - GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); - GLCapabilitiesChooser chooser = new MultisampleChooser01(); + final GLProfile glp = GLProfile.getGL2ES2(); + final GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilitiesChooser chooser = new MultisampleChooser01(); caps.setAlphaBits(1); caps.setFBO(useFBO); caps.setPBuffer(usePBuffer); - + if(reqSamples>0) { 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; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); } } - String tstname = TestTranslucencyAWT.class.getName(); + final String tstname = TestTranslucencyAWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java index 8d65fdef3..8f23b57a0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java @@ -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 com.jogamp.newt.event.KeyAdapter; @@ -60,7 +60,7 @@ public class TestTranslucencyNEWT extends UITestCase { glp = GLProfile.get(GLProfile.getDefaultEGLDevice(), GLProfile.GLES2); } else */ { // default device, somehow ES2 compatible - glp = GLProfile.getGL2ES2(); + glp = GLProfile.getGL2ES2(); } Assert.assertNotNull(glp); width = 512; @@ -71,15 +71,15 @@ public class TestTranslucencyNEWT extends UITestCase { public static void releaseClass() { } - protected void runTestGL(GLCapabilities caps, boolean undecorated) throws InterruptedException { - GLWindow glWindow = GLWindow.create(caps); + protected void runTestGL(final GLCapabilities caps, final boolean undecorated) throws InterruptedException { + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setTitle("Gears NEWT Test (translucent "+!caps.isBackgroundOpaque()+")"); glWindow.setUndecorated(undecorated); glWindow.addGLEventListener(new GearsES2()); - 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)); @@ -88,10 +88,10 @@ public class TestTranslucencyNEWT 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,38 +121,38 @@ public class TestTranslucencyNEWT extends UITestCase { @Test public void test01OpaqueDecorated() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setBackgroundOpaque(true); // default runTestGL(caps, false); } @Test public void test01TransparentDecorated() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setBackgroundOpaque(false); // This is done implicit now .. - // caps.setAlphaBits(1); + // caps.setAlphaBits(1); runTestGL(caps, false); } @Test public void test01TransparentUndecorated() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setBackgroundOpaque(false); // This is done implicit now .. - // caps.setAlphaBits(1); + // caps.setAlphaBits(1); runTestGL(caps, true); } - + static long duration = 500; // ms - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } org.junit.runner.JUnitCore.main(TestTranslucencyNEWT.class.getName()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/GearsObject.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/GearsObject.java index 00d360f6e..01cc4b7f2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/GearsObject.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/GearsObject.java @@ -51,18 +51,18 @@ public abstract class GearsObject { public abstract void addInterleavedVertexAndNormalArrays(GLArrayDataServer array, int components); public abstract void draw(GL gl, float x, float y, float angle); - private GLArrayDataServer createInterleavedClone(GLArrayDataServer ads) { + private GLArrayDataServer createInterleavedClone(final GLArrayDataServer ads) { final GLArrayDataServer n = new GLArrayDataServer(ads); n.setInterleavedOffset(0); return n; } - private void init(GL gl, GLArrayDataServer array) { + private void init(final GL gl, final GLArrayDataServer array) { array.enableBuffer(gl, true); array.enableBuffer(gl, false); } - public void destroy(GL gl) { + public void destroy(final GL gl) { if(!isShared) { // could be already destroyed by shared configuration if(null != frontFace) { @@ -93,7 +93,7 @@ public abstract class GearsObject { isShared = false; } - public GearsObject ( GearsObject shared ) { + public GearsObject ( final GearsObject shared ) { isShared = true; validateBuffers = shared.validateBuffers; frontFace = createInterleavedClone(shared.frontFace); @@ -112,21 +112,21 @@ public abstract class GearsObject { } public GearsObject ( - GL gl, - boolean useMappedBuffers, - FloatBuffer gearColor, - float inner_radius, - float outer_radius, - float width, int teeth, float tooth_depth, boolean validateBuffers) + 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) { final float dz = width * 0.5f; int i; float r0, r1, r2; float angle, da; float u, v, len; - float s[] = new float[5]; - float c[] = new float[5]; - float normal[] = new float[3]; + final float s[] = new float[5]; + final float c[] = new float[5]; + final float normal[] = new float[3]; // final int tris_per_tooth = 32; this.validateBuffers = validateBuffers; @@ -320,7 +320,7 @@ public abstract class GearsObject { return "GearsObj[0x"+Integer.toHexString(hashCode())+", vbo ff "+ffVBO+", fs "+fsVBO+", bf "+bfVBO+", bs "+bsVBO+"]"; } - static void vert(GLArrayDataServer array, float x, float y, float z, float n[]) { + static void vert(final GLArrayDataServer array, final float x, final float y, final float z, final float n[]) { array.putf(x); array.putf(y); array.putf(z); @@ -329,7 +329,7 @@ public abstract class GearsObject { array.putf(n[2]); } - static void sincos(float x, float sin[], int sinIdx, float cos[], int cosIdx) { + static void sincos(final float x, final float sin[], final int sinIdx, final float cos[], final int cosIdx) { sin[sinIdx] = (float) Math.sin(x); cos[cosIdx] = (float) Math.cos(x); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/PointsDemo.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/PointsDemo.java index 4f2e4153e..f394ab31e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/PointsDemo.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/PointsDemo.java @@ -32,17 +32,17 @@ import javax.media.opengl.GLEventListener; public abstract class PointsDemo implements GLEventListener { int swapInterval = 0; final int edge = 8; // 8*8 - - public PointsDemo(int swapInterval) { + + public PointsDemo(final int swapInterval) { this.swapInterval = swapInterval; } public PointsDemo() { this.swapInterval = 1; } - + public abstract void setSmoothPoints(boolean v); - - public abstract void setPointParams(float minSize, float maxSize, float distAttenConst, float distAttenLinear, float distAttenQuadratic, float fadeThreshold); - + + public abstract void setPointParams(float minSize, float maxSize, float distAttenConst, float distAttenLinear, float distAttenQuadratic, float fadeThreshold); + } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureDraw01Accessor.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureDraw01Accessor.java index 7283a204e..a508751c4 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureDraw01Accessor.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/TextureDraw01Accessor.java @@ -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.jogl.demos; import com.jogamp.opengl.util.texture.Texture; public interface TextureDraw01Accessor { - public void setKeepTextureBound(boolean v); + public void setKeepTextureBound(boolean v); public Texture getTexture(); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java index b750c54dd..b1df926dc 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java @@ -31,6 +31,8 @@ import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLPipelineFactory; import javax.media.opengl.GLProfile; +import javax.media.opengl.fixedfunc.GLLightingFunc; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.newt.Window; import com.jogamp.newt.event.KeyAdapter; @@ -73,7 +75,7 @@ public class GearsES1 implements GLEventListener { private int prevMouseX, prevMouseY; - public GearsES1(int swapInterval) { + public GearsES1(final int swapInterval) { this.swapInterval = swapInterval; } @@ -81,20 +83,20 @@ public class GearsES1 implements GLEventListener { 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 setGearsColors(FloatBuffer gear1Color, FloatBuffer gear2Color, FloatBuffer gear3Color) { + public void setGearsColors(final FloatBuffer gear1Color, final FloatBuffer gear2Color, final FloatBuffer gear3Color) { this.gear1Color = gear1Color; this.gear2Color = gear2Color; this.gear3Color = gear3Color; } - public void setSharedGearsObjects(GearsObject g1, GearsObject g2, GearsObject g3) { + public void setSharedGearsObjects(final GearsObject g1, final GearsObject g2, final GearsObject g3) { gear1 = g1; gear2 = g2; gear3 = g3; @@ -117,10 +119,10 @@ public class GearsES1 implements GLEventListener { public boolean usesSharedGears() { return usesSharedGears; } - public void setUseMappedBuffers(boolean v) { useMappedBuffers = v; } - public void setValidateBuffers(boolean v) { validateBuffers = v; } + public void setUseMappedBuffers(final boolean v) { useMappedBuffers = v; } + public void setValidateBuffers(final boolean v) { validateBuffers = v; } - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { System.err.println(Thread.currentThread()+" GearsES1.init ..."); // Use debug pipeline @@ -144,13 +146,13 @@ public class GearsES1 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("GearsES1 init on "+Thread.currentThread()); @@ -158,11 +160,11 @@ public class GearsES1 implements GLEventListener { System.err.println("INIT GL IS: " + gl.getClass().getName()); System.err.println(JoglVersion.getGLStrings(gl, null, false).toString()); - gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_POSITION, pos, 0); + gl.glLightfv(GLLightingFunc.GL_LIGHT0, GLLightingFunc.GL_POSITION, pos, 0); gl.glEnable(GL.GL_CULL_FACE); - gl.glEnable(GL2ES1.GL_LIGHTING); - gl.glEnable(GL2ES1.GL_LIGHT0); - gl.glEnable(GL2ES1.GL_DEPTH_TEST); + gl.glEnable(GLLightingFunc.GL_LIGHTING); + gl.glEnable(GLLightingFunc.GL_LIGHT0); + gl.glEnable(GL.GL_DEPTH_TEST); /* make the gears */ if(null == gear1) { @@ -189,7 +191,7 @@ public class GearsES1 implements GLEventListener { System.err.println("gear3 reused: "+gear3); } - gl.glEnable(GL2ES1.GL_NORMALIZE); + gl.glEnable(GLLightingFunc.GL_NORMALIZE); final Object upstreamWidget = drawable.getUpstreamWidget(); if (upstreamWidget instanceof Window) { @@ -204,29 +206,29 @@ public class GearsES1 implements GLEventListener { System.err.println(Thread.currentThread()+" GearsES1.init FIN"); } - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { System.err.println(Thread.currentThread()+" GearsES1.reshape "+x+"/"+y+" "+width+"x"+height+", swapInterval "+swapInterval); - GL2ES1 gl = drawable.getGL().getGL2ES1(); + final GL2ES1 gl = drawable.getGL().getGL2ES1(); gl.setSwapInterval(swapInterval); - gl.glMatrixMode(GL2ES1.GL_PROJECTION); + gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); if(height>width) { - 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<edge; i++) { for(int j=0; j<edge; j++) { @@ -125,10 +127,10 @@ public class PointsDemoES1 extends PointsDemo { vertices.enableBuffer(gl, false); // OpenGL Render Settings - gl.glEnable(GL2ES1.GL_DEPTH_TEST); + gl.glEnable(GL.GL_DEPTH_TEST); } - 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) { pointMinSize = minSize; pointMaxSize = maxSize; pointFadeThreshold = fadeThreshold; @@ -136,25 +138,25 @@ public class PointsDemoES1 extends PointsDemo { pointDistAtten.put(1, distAttenLinear); pointDistAtten.put(2, distAttenQuadratic); } - + /** default values */ private float pointMinSize = 0.0f; private float pointMaxSize = 4096.0f; private float pointFadeThreshold = 1.0f; private final FloatBuffer pointDistAtten = Buffers.newDirectFloatBuffer(new float[] { 1.0f, 0.0f, 0.0f }); - public void display(GLAutoDrawable glad) { - GL2ES1 gl = glad.getGL().getGL2ES1(); + public void display(final GLAutoDrawable glad) { + final GL2ES1 gl = glad.getGL().getGL2ES1(); gl.glClearColor(0f, 0f, 0f, 0f); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - gl.glMatrixMode(GL2ES1.GL_MODELVIEW); + gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); gl.glTranslatef(0, 0, -10); gl.glColor4f(1.0f, 1.0f, 1.0f, 1.0f ); - + vertices.enableBuffer(gl, true); - + gl.glEnable ( GL.GL_BLEND ); gl.glBlendFunc ( GL.GL_SRC_ALPHA, GL.GL_ONE ); if(smooth) { @@ -164,35 +166,35 @@ public class PointsDemoES1 extends PointsDemo { } gl.glPointParameterf(GL2ES1.GL_POINT_SIZE_MIN, pointMinSize ); gl.glPointParameterf(GL2ES1.GL_POINT_SIZE_MAX, pointMaxSize ); - gl.glPointParameterf(GL2ES1.GL_POINT_FADE_THRESHOLD_SIZE, pointFadeThreshold); + gl.glPointParameterf(GL.GL_POINT_FADE_THRESHOLD_SIZE, pointFadeThreshold); gl.glPointParameterfv(GL2ES1.GL_POINT_DISTANCE_ATTENUATION, pointDistAtten ); - + for(int i=edge*edge-1; 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<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } else if(args[i].equals("-vsync")) { i++; swapInterval = MiscUtils.atoi(args[i], swapInterval); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestOlympicES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestOlympicES1NEWT.java index c12ef9525..a29e9a3a6 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestOlympicES1NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestOlympicES1NEWT.java @@ -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.opengl.GLWindow; @@ -33,8 +33,8 @@ import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.util.QuitAdapter; import com.jogamp.opengl.test.junit.jogl.demos.es1.OlympicES1; - import com.jogamp.opengl.util.Animator; +import com.jogamp.opengl.util.AnimatorBase; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; @@ -65,34 +65,34 @@ public class TestOlympicES1NEWT extends UITestCase { public static void releaseClass() { } - protected void runTestGL(GLCapabilities caps) throws InterruptedException { - GLWindow glWindow = GLWindow.create(caps); + protected void runTestGL(final GLCapabilities caps) throws InterruptedException { + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setTitle("Olympic NEWT Test"); - OlympicES1 demo = new OlympicES1( swapInterval ); - demo.setForceFFPEmu(forceFFPEmu, verboseFFPEmu, false, false); - glWindow.addGLEventListener(demo); + final OlympicES1 demo = new OlympicES1( swapInterval ); + demo.setForceFFPEmu(forceFFPEmu, verboseFFPEmu, false, false); + glWindow.addGLEventListener(demo); final SnapshotGLEventListener snap = new SnapshotGLEventListener(); glWindow.addGLEventListener(snap); - 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); - - QuitAdapter quitAdapter = new QuitAdapter(); + + final QuitAdapter quitAdapter = new QuitAdapter(); glWindow.addKeyListener(quitAdapter); glWindow.addWindowListener(quitAdapter); glWindow.setSize(width, height); glWindow.setVisible(true); - + animator.add(glWindow); animator.start(); animator.setUpdateFPSFrames(60, System.err); Assert.assertTrue(animator.isStarted()); Assert.assertTrue(animator.isAnimating()); Assert.assertEquals(exclusiveContext ? animator.getThread() : null, glWindow.getExclusiveContextThread()); - + snap.setMakeSnapshot(); while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) { @@ -109,19 +109,19 @@ public class TestOlympicES1NEWT 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); } static long duration = 500; // ms - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } else if(args[i].equals("-vsync")) { i++; swapInterval = MiscUtils.atoi(args[i], swapInterval); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestRedSquareES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestRedSquareES1NEWT.java index 200936f34..c164990a4 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestRedSquareES1NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestRedSquareES1NEWT.java @@ -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; @@ -64,8 +64,8 @@ public class TestRedSquareES1NEWT 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"); @@ -75,8 +75,8 @@ public class TestRedSquareES1NEWT 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)); @@ -85,10 +85,10 @@ public class TestRedSquareES1NEWT 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() { @@ -119,19 +119,19 @@ public class TestRedSquareES1NEWT 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 = 1000; // ms - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } else if(args[i].equals("-es2")) { forceES2 = true; } else if(args[i].equals("-ffpemu")) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java index 6080ed2c2..c54dad458 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -40,6 +40,7 @@ import javax.media.opengl.GLCapabilitiesImmutable; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLProfile; import javax.media.opengl.GLUniformData; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.common.nio.Buffers; import com.jogamp.newt.event.KeyAdapter; @@ -54,36 +55,36 @@ import com.jogamp.opengl.util.glsl.ShaderState; /** * <pre> * __ __|_ ___________________________________________________________________________ ___|__ __ - * // /\ _ /\ \\ - * //____/ \__ __ _____ _____ _____ _____ _____ | | __ _____ _____ __ __/ \____\\ - * \ \ / / __| | | __| _ | | _ | | | __| | | __| | /\ \ / / - * \____\/_/ | | | | | | | | | | | __| | | | | | | | | | |__ " \_\/____/ - * /\ \ |_____|_____|_____|__|__|_|_|_|__| | | |_____|_____|_____|_____| _ / /\ - * / \____\ http://jogamp.org |_| /____/ \ - * \ / "' _________________________________________________________________________ `" \ / + * // /\ _ /\ \\ + * //____/ \__ __ _____ _____ _____ _____ _____ | | __ _____ _____ __ __/ \____\\ + * \ \ / / __| | | __| _ | | _ | | | __| | | __| | /\ \ / / + * \____\/_/ | | | | | | | | | | | __| | | | | | | | | | |__ " \_\/____/ + * /\ \ |_____|_____|_____|__|__|_|_|_|__| | | |_____|_____|_____|_____| _ / /\ + * / \____\ http://jogamp.org |_| /____/ \ + * \ / "' _________________________________________________________________________ `" \ / * \/____. .____\/ - * </pre> + * </pre> * * <p> - * 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. * </p> * * <p> - * 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. * </p> * * <p> * 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 :) * </p> * @@ -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 <BR> @@ -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<args.length; i++) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelsAWT.java index e48fc783e..11d9da780 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelsAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelsAWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.demos.es2.awt; import java.awt.AWTException; @@ -69,7 +69,7 @@ import com.jogamp.opengl.util.awt.AWTGLPixelBuffer.SingleAWTGLPixelBufferProvide public class TestGearsES2GLJPanelsAWT extends UITestCase { static int demoCount = 4; static boolean jOpaque = false; // flicker-less w/o opaque, opaque leads to overdraw w/ mixed clipRects -> flicker - due to JComponent _paintImmediately(..) (?) - 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<args.length; i++) { if(args[i].equals("-time")) { i++; @@ -415,8 +415,8 @@ public class TestGearsES2GLJPanelsAWT extends UITestCase { System.err.println("shallUsePBuffer "+shallUsePBuffer); System.err.println("shallUseBitmap "+shallUseBitmap); System.err.println("manualTest "+manualTest); - System.err.println("useSingleBuffer "+initSingleBuffer); - + System.err.println("useSingleBuffer "+initSingleBuffer); + org.junit.runner.JUnitCore.main(TestGearsES2GLJPanelsAWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java index 6c4885308..2d334e837 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.demos.es2.newt; import com.jogamp.newt.event.KeyAdapter; @@ -66,17 +66,17 @@ public class TestElektronenMultipliziererNEWT extends UITestCase { static final int desiredFrameRate = 30; static int startFrame = 1700; static long duration = 5000; // ms - + @BeforeClass public static void initClass() { - GLProfile glp = GLProfile.getDefault(); + final GLProfile glp = GLProfile.getDefault(); if( ! ( glp.isHardwareRasterizer() && glp.isGL2ES3() ) ) { // Sorry .. mobile ES2 is too slow for this one. setTestSupported(false); return; } } - + protected void run() throws InterruptedException { final ElektronenMultiplizierer demo = new ElektronenMultiplizierer( tRoutineClassName, @@ -85,17 +85,17 @@ public class TestElektronenMultipliziererNEWT extends UITestCase { tFrameCapture, tFrameSkip, desiredFrameRate, startFrame ); - GLCapabilitiesImmutable caps = demo.getGLCapabilities(); - - GLWindow glWindow = GLWindow.create(caps); + final GLCapabilitiesImmutable caps = demo.getGLCapabilities(); + + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setSize(width, height); glWindow.setTitle("ElektronenMultiplizierer (GL2ES2/NEWT)"); glWindow.addGLEventListener(demo); - Animator animator = new Animator(glWindow); + final Animator animator = new Animator(glWindow); animator.setUpdateFPSFrames(60, System.err); - QuitAdapter quitAdapter = new QuitAdapter(); + final QuitAdapter quitAdapter = new QuitAdapter(); //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter)); glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter)); @@ -104,10 +104,10 @@ public class TestElektronenMultipliziererNEWT 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() { @@ -137,19 +137,19 @@ public class TestElektronenMultipliziererNEWT extends UITestCase { run(); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } if(args[i].equals("-sframe")) { i++; try { startFrame = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } org.junit.runner.JUnitCore.main(TestElektronenMultipliziererNEWT.class.getName()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java index 578a887d9..cd5e20c40 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java @@ -51,6 +51,7 @@ import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.util.QuitAdapter; import com.jogamp.opengl.util.Animator; +import com.jogamp.opengl.util.AnimatorBase; import com.jogamp.opengl.util.PNGPixelRect; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; @@ -127,10 +128,10 @@ public class TestGearsES2NEWT extends UITestCase { sDPI[1] *= 25.4f; win.setTitle("GLWindow["+capsA+"], swapI "+swapInterval+", win: "+win.getBounds()+", pix: "+win.getSurfaceWidth()+"x"+win.getSurfaceHeight()+", sDPI "+sDPI[0]+" x "+sDPI[1]); } - protected void runTestGL(final GLCapabilitiesImmutable caps, boolean undecorated) throws InterruptedException { + protected void runTestGL(final GLCapabilitiesImmutable caps, final boolean undecorated) throws InterruptedException { System.err.println("requested: vsync "+swapInterval+", "+caps); - Display dpy = NewtFactory.createDisplay(null); - Screen screen = NewtFactory.createScreen(dpy, screenIdx); + final Display dpy = NewtFactory.createDisplay(null); + final Screen screen = NewtFactory.createScreen(dpy, screenIdx); final GLWindow glWindow = GLWindow.create(screen, caps); Assert.assertNotNull(glWindow); glWindow.setSurfaceScale(reqSurfacePixelScale); @@ -154,24 +155,24 @@ public class TestGearsES2NEWT extends UITestCase { glWindow.addGLEventListener(snap); if(waitForKey) { glWindow.addGLEventListener(new GLEventListener() { - public void init(GLAutoDrawable drawable) { } - public void dispose(GLAutoDrawable drawable) { } - public void display(GLAutoDrawable drawable) { - GLAnimatorControl actrl = drawable.getAnimator(); + public void init(final GLAutoDrawable drawable) { } + public void dispose(final GLAutoDrawable drawable) { } + public void display(final GLAutoDrawable drawable) { + final GLAnimatorControl actrl = drawable.getAnimator(); if(waitForKey && actrl.getTotalFPSFrames() == 60*3) { UITestCase.waitForKey("3s mark"); actrl.resetFPSCounter(); waitForKey = false; } } - 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 Animator animator = useAnimator ? new Animator() : null; if( useAnimator ) { - animator.setModeBits(false, Animator.MODE_EXPECT_AWT_RENDERING_THREAD); + animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); animator.setExclusiveContext(exclusiveContext); } @@ -182,11 +183,11 @@ public class TestGearsES2NEWT extends UITestCase { glWindow.addWindowListener(quitAdapter); glWindow.addWindowListener(new WindowAdapter() { - public void windowResized(WindowEvent e) { + public void windowResized(final WindowEvent e) { System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); setTitle(glWindow, caps); } - public void windowMoved(WindowEvent e) { + public void windowMoved(final WindowEvent e) { System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); setTitle(glWindow, caps); } @@ -202,7 +203,7 @@ public class TestGearsES2NEWT extends UITestCase { try { _pointerIcon = disp.createPointerIcon(res, 8, 8); System.err.println("Create PointerIcon #01: "+_pointerIcon); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } pointerIcons[0] = _pointerIcon; @@ -213,7 +214,7 @@ public class TestGearsES2NEWT extends UITestCase { try { _pointerIcon = disp.createPointerIcon(res, 0, 0); System.err.println("Create PointerIcon #02: "+_pointerIcon); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } pointerIcons[1] = _pointerIcon; @@ -227,7 +228,7 @@ public class TestGearsES2NEWT extends UITestCase { System.err.println("Create PointerIcon #03: "+image); _pointerIcon = disp.createPointerIcon(image, 32, 0); System.err.println("Create PointerIcon #03: "+_pointerIcon); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } pointerIcons[2] = _pointerIcon; @@ -371,7 +372,7 @@ public class TestGearsES2NEWT extends UITestCase { } }); glWindow.addMouseListener(new MouseAdapter() { - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { if(e.getClickCount() == 2 && e.getPointerCount() == 1) { glWindow.setFullscreen(!glWindow.isFullscreen()); System.err.println("setFullscreen: "+glWindow.isFullscreen()); @@ -390,11 +391,11 @@ public class TestGearsES2NEWT extends UITestCase { if( SysExit.displayError == sysExit || SysExit.displayExit == sysExit || SysExit.displayEDTError == sysExit ) { glWindow.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) { + public void display(final GLAutoDrawable drawable) { final GLAnimatorControl anim = drawable.getAnimator(); if( null != anim && anim.isAnimating() ) { final long ms = anim.getTotalFPSDuration(); @@ -426,7 +427,7 @@ public class TestGearsES2NEWT 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) { } }); } @@ -560,11 +561,11 @@ public class TestGearsES2NEWT 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, undecorated); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { int x=0, y=0, w=640, h=480, rw=-1, rh=-1; boolean usePos = false; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java index e4ba5f855..2dca3ad5e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java @@ -54,6 +54,7 @@ import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.util.QuitAdapter; import com.jogamp.opengl.util.Animator; +import com.jogamp.opengl.util.AnimatorBase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.test.junit.newt.parenting.NewtAWTReparentingKeyAdapter; @@ -122,7 +123,7 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { frame.pack(); } } ); } - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -131,7 +132,7 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { 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); @@ -139,7 +140,7 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { frame.pack(); } } } ); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -148,13 +149,13 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { 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()); frame.setSize(d); if( frameLayout ) { frame.validate(); } } } ); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -189,8 +190,8 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { // public enum ResizeBy { GLWindow, Component, Frame }; protected void runTestGL(final GLCapabilitiesImmutable caps, final ResizeBy resizeBy, final FrameLayout frameLayout) throws InterruptedException, InvocationTargetException { System.err.println("requested: vsync "+swapInterval+", "+caps); - Display dpy = NewtFactory.createDisplay(null); - Screen screen = NewtFactory.createScreen(dpy, screenIdx); + final Display dpy = NewtFactory.createDisplay(null); + final Screen screen = NewtFactory.createScreen(dpy, screenIdx); final GLWindow glWindow = GLWindow.create(screen, caps); Assert.assertNotNull(glWindow); glWindow.setSurfaceScale(reqSurfacePixelScale); @@ -241,7 +242,7 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { frame.add(newtCanvasAWT, 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); @@ -263,25 +264,25 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { frame.addComponentListener(new ComponentListener() { @Override - public void componentResized(ComponentEvent e) { + public void componentResized(final ComponentEvent e) { setTitle(frame, newtCanvasAWT, glWindow, caps); } @Override - public void componentMoved(ComponentEvent e) { + public void componentMoved(final ComponentEvent e) { setTitle(frame, newtCanvasAWT, glWindow, 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 Animator animator = useAnimator ? new Animator() : null; if( useAnimator ) { - animator.setModeBits(false, Animator.MODE_EXPECT_AWT_RENDERING_THREAD); + animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); animator.setExclusiveContext(exclusiveContext); } @@ -292,10 +293,10 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { glWindow.addWindowListener(quitAdapter); glWindow.addWindowListener(new WindowAdapter() { - public void windowResized(WindowEvent e) { + public void windowResized(final WindowEvent e) { System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } - public void windowMoved(WindowEvent e) { + public void windowMoved(final WindowEvent e) { System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } }); @@ -439,11 +440,11 @@ public class TestGearsES2NewtCanvasAWT 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[]) throws IOException { + public static void main(final String args[]) throws IOException { int x=0, y=0, w=640, h=480; int rw=-1, rh=-1; boolean usePos = false; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java index c667adaba..c3c7d68b3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java @@ -43,16 +43,14 @@ import com.jogamp.opengl.test.junit.util.AWTRobotUtil; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.util.QuitAdapter; - import com.jogamp.opengl.util.Animator; - +import com.jogamp.opengl.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; @@ -142,7 +140,7 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase { display.dispose(); }}); } - catch( Throwable throwable ) { + catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -152,36 +150,36 @@ public class TestGearsES2NewtCanvasSWT 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); - com.jogamp.newt.Screen screen = NewtFactory.createScreen(swtNewtDisplay, screenIdx); + final com.jogamp.newt.Screen screen = NewtFactory.createScreen(swtNewtDisplay, screenIdx); final GLWindow glWindow = GLWindow.create(screen, caps); Assert.assertNotNull(glWindow); final GearsES2 demo = new GearsES2(swapInterval); glWindow.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); - QuitAdapter quitAdapter = new QuitAdapter(); + final QuitAdapter quitAdapter = new QuitAdapter(); //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter)); //glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter)); glWindow.addKeyListener(quitAdapter); glWindow.addWindowListener(quitAdapter); glWindow.addWindowListener(new WindowAdapter() { - public void windowResized(WindowEvent e) { + public void windowResized(final WindowEvent e) { System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } - public void windowMoved(WindowEvent e) { + public void windowMoved(final WindowEvent e) { System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } }); glWindow.addKeyListener(new KeyAdapter() { - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { if( !e.isPrintableKey() || e.isAutoRepeat() ) { return; } @@ -294,7 +292,7 @@ public class TestGearsES2NewtCanvasSWT 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/es2/newt/TestLandscapeES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java index 5b31fdb5e..d7926833c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.demos.es2.newt; import com.jogamp.newt.event.KeyAdapter; @@ -34,9 +34,8 @@ import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.util.QuitAdapter; - import com.jogamp.opengl.util.Animator; - +import com.jogamp.opengl.util.AnimatorBase; import com.jogamp.opengl.test.junit.jogl.demos.es2.LandscapeES2; import javax.media.opengl.GLCapabilities; @@ -56,7 +55,7 @@ public class TestLandscapeES2NEWT extends UITestCase { static boolean exclusiveContext = false; static boolean useAnimator = true; - protected void runTestGL(GLCapabilities caps) throws InterruptedException { + protected void runTestGL(final GLCapabilities caps) throws InterruptedException { System.err.println("requested: swapInterval "+swapInterval+", "+caps); final GLWindow glWindow = GLWindow.create(caps); glWindow.setTitle(getSimpleTestName(".")); @@ -68,14 +67,14 @@ public class TestLandscapeES2NEWT extends UITestCase { final SnapshotGLEventListener snap = new SnapshotGLEventListener(); snap.setPostSNDetail(demo.getClass().getSimpleName()); glWindow.addGLEventListener(snap); - + final Animator animator = useAnimator ? new Animator() : null; if( useAnimator ) { - animator.setModeBits(false, Animator.MODE_EXPECT_AWT_RENDERING_THREAD); + animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); animator.setExclusiveContext(exclusiveContext); } - - QuitAdapter quitAdapter = new QuitAdapter(); + + final QuitAdapter quitAdapter = new QuitAdapter(); //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter)); //glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter)); @@ -83,10 +82,10 @@ public class TestLandscapeES2NEWT extends UITestCase { glWindow.addWindowListener(quitAdapter); 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() { @@ -113,9 +112,9 @@ public class TestLandscapeES2NEWT extends UITestCase { 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()); - + snap.setMakeSnapshot(); - + while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) { Thread.sleep(100); } @@ -139,11 +138,11 @@ public class TestLandscapeES2NEWT extends UITestCase { final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps); } - + @Test public void test02GL3() throws InterruptedException { if(mainRun) return; - + if( !GLProfile.isAvailable(GLProfile.GL3) ) { System.err.println("GL3 n/a"); return; @@ -151,11 +150,11 @@ public class TestLandscapeES2NEWT extends UITestCase { final GLProfile glp = GLProfile.get(GLProfile.GL3); final GLCapabilities caps = new GLCapabilities( glp ); runTestGL(caps); - } + } static long duration = 500; // ms - public static void main(String args[]) { + public static void main(final String args[]) { mainRun = true; for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java index d1139152d..0f55813f8 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.demos.es2.newt; import java.awt.Frame; @@ -43,6 +43,7 @@ import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.util.QuitAdapter; import com.jogamp.opengl.util.Animator; +import com.jogamp.opengl.util.AnimatorBase; import com.jogamp.opengl.test.junit.jogl.demos.es2.LandscapeES2; import com.jogamp.opengl.test.junit.newt.parenting.NewtAWTReparentingKeyAdapter; @@ -58,9 +59,9 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestLandscapeES2NewtCanvasAWT extends UITestCase { +public class TestLandscapeES2NewtCanvasAWT extends UITestCase { static DimensionImmutable wsize = new Dimension(500, 290); - + static long duration = 500; // ms static int swapInterval = 1; static boolean shallUseOffscreenFBOLayer = false; @@ -69,36 +70,36 @@ public class TestLandscapeES2NewtCanvasAWT extends UITestCase { static boolean mainRun = false; static boolean exclusiveContext = false; static boolean useAnimator = true; - + // public enum ResizeBy { GLWindow, Component, Frame }; protected void runTestGL(final GLCapabilitiesImmutable caps) throws InterruptedException, InvocationTargetException { System.err.println("requested: vsync "+swapInterval+", "+caps); - Display dpy = NewtFactory.createDisplay(null); - Screen screen = NewtFactory.createScreen(dpy, 0); + final Display dpy = NewtFactory.createDisplay(null); + final Screen screen = NewtFactory.createScreen(dpy, 0); final GLWindow glWindow = GLWindow.create(screen, caps); - + final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow); if ( shallUseOffscreenFBOLayer ) { newtCanvasAWT.setShallUseOffscreenLayer(true); } - + final Frame frame = new Frame("AWT Parent Frame"); { - java.awt.Dimension d = new java.awt.Dimension(wsize.getWidth(), wsize.getHeight()); + final java.awt.Dimension d = new java.awt.Dimension(wsize.getWidth(), wsize.getHeight()); frame.setSize(d); } frame.add(newtCanvasAWT); frame.setTitle("Gears NewtCanvasAWT Test (translucent "+!caps.isBackgroundOpaque()+"), swapInterval "+swapInterval+", size "+wsize); - + final LandscapeES2 demo = new LandscapeES2(swapInterval); glWindow.addGLEventListener(demo); - + final Animator animator = useAnimator ? new Animator() : null; if( useAnimator ) { - animator.setModeBits(false, Animator.MODE_EXPECT_AWT_RENDERING_THREAD); + animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); animator.setExclusiveContext(exclusiveContext); } - + final QuitAdapter quitAdapter = new QuitAdapter(); //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter)); //glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter)); @@ -106,16 +107,16 @@ public class TestLandscapeES2NewtCanvasAWT extends UITestCase { glWindow.addWindowListener(quitAdapter); glWindow.addWindowListener(new WindowAdapter() { - public void windowResized(WindowEvent e) { + public void windowResized(final WindowEvent e) { System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } - public void windowMoved(WindowEvent e) { + public void windowMoved(final WindowEvent e) { System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); - } + } }); - + glWindow.addKeyListener(new NewtAWTReparentingKeyAdapter(frame, newtCanvasAWT, glWindow, quitAdapter)); - + if( useAnimator ) { animator.add(glWindow); animator.start(); @@ -124,18 +125,18 @@ public class TestLandscapeES2NewtCanvasAWT extends UITestCase { SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame.validate(); - frame.setVisible(true); + frame.setVisible(true); } - }); - + }); + if( useAnimator ) { animator.setUpdateFPSFrames(60, System.err); } - + 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()); - + final long t0 = System.currentTimeMillis(); long t1 = t0; while(!quitAdapter.shouldQuit() && t1-t0<duration) { @@ -147,8 +148,8 @@ public class TestLandscapeES2NewtCanvasAWT extends UITestCase { animator.stop(); } SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - frame.dispose(); + public void run() { + frame.dispose(); } }); glWindow.destroy(); @@ -171,7 +172,7 @@ public class TestLandscapeES2NewtCanvasAWT extends UITestCase { @Test public void test02GL3() throws InterruptedException, InvocationTargetException { if(mainRun) return; - + if( !GLProfile.isAvailable(GLProfile.GL3) ) { System.err.println("GL3 n/a"); return; @@ -180,10 +181,10 @@ public class TestLandscapeES2NewtCanvasAWT extends UITestCase { final GLCapabilities caps = new GLCapabilities( glp ); runTestGL(caps); } - - public static void main(String args[]) throws IOException { + + public static void main(final String args[]) throws IOException { mainRun = true; - + for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; @@ -203,7 +204,7 @@ public class TestLandscapeES2NewtCanvasAWT extends UITestCase { forceGL3 = true; } } - + System.err.println("size "+wsize); System.err.println("shallUseOffscreenFBOLayer "+shallUseOffscreenFBOLayer); System.err.println("forceES2 "+forceES2); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java index de824571e..52f4473c3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java @@ -73,7 +73,7 @@ public class TestRedSquareES2NEWT extends UITestCase { public static void releaseClass() { } - protected void runTestGL(GLCapabilities caps) throws InterruptedException { + protected void runTestGL(final GLCapabilities caps) throws InterruptedException { System.err.println("requested: vsync "+vsync+", "+caps); final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); @@ -96,8 +96,8 @@ public class TestRedSquareES2NEWT 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(new TraceKeyAdapter(quitAdapter)); //glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter)); @@ -105,7 +105,7 @@ public class TestRedSquareES2NEWT extends UITestCase { glWindow.addWindowListener(quitAdapter); glWindow.addKeyListener(new KeyAdapter() { - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { if( !e.isPrintableKey() || e.isAutoRepeat() ) { return; } @@ -182,7 +182,7 @@ public class TestRedSquareES2NEWT extends UITestCase { static long duration = 500; // ms - public static void main(String args[]) { + public static void main(final String args[]) { mainRun = true; for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.java index 07f3a97cb..178887059 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/RedSquareShader.java @@ -38,7 +38,7 @@ public class RedSquareShader { "#if __VERSION__ >= 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<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } org.junit.runner.JUnitCore.main(TestGLJPanelAWTBug450.class.getName()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWT.java index 1b83904a9..8e2b02fb2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWT.java @@ -81,13 +81,13 @@ public class TestGearsAWT extends UITestCase { public static void releaseClass() { } - protected void runTestGL(GLCapabilities caps) throws InterruptedException, InvocationTargetException { + protected void runTestGL(final GLCapabilities caps) throws InterruptedException, InvocationTargetException { final Frame frame = new Frame("Gears AWT Test"); Assert.assertNotNull(frame); final GLCanvas glCanvas = new GLCanvas(caps); Assert.assertNotNull(glCanvas); - Dimension glc_sz = new Dimension(width, height); + final Dimension glc_sz = new Dimension(width, height); glCanvas.setMinimumSize(glc_sz); glCanvas.setPreferredSize(glc_sz); glCanvas.setSize(glc_sz); @@ -133,7 +133,7 @@ public class TestGearsAWT extends UITestCase { @Test public void test01() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); if( msaaCount > 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<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } else if(args[i].equals("-msaa")) { i++; try { msaaCount = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } else if(args[i].equals("-wait")) { waitForKey = true; } } 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(TestGearsAWT.class.getName()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWTAnalyzeBug455.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWTAnalyzeBug455.java index 2c3b3d472..751bd4488 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWTAnalyzeBug455.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWTAnalyzeBug455.java @@ -81,28 +81,28 @@ public class TestGearsAWTAnalyzeBug455 extends UITestCase { } static class Swapper implements GLEventListener { - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { System.err.println("auto-swap: "+drawable.getAutoSwapBufferMode()); } - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { } - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { if(!drawable.getAutoSwapBufferMode()) { - GL2 gl = drawable.getGL().getGL2(); + final GL2 gl = drawable.getGL().getGL2(); // copy the colored content of the back buffer into the front buffer // gl.glPushAttrib(GL.GL_COLOR_BUFFER_BIT); gl.glReadBuffer(GL.GL_BACK); // def. in dbl buff mode: GL_BACK gl.glDrawBuffer(GL.GL_FRONT); // def. in dbl buff mode: GL_BACK - gl.glCopyPixels(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), GL2.GL_COLOR); + gl.glCopyPixels(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), GL2ES3.GL_COLOR); // gl.glPopAttrib(); gl.glDrawBuffer(GL.GL_BACK); // def. in dbl buff mode: GL_BACK } } - 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) { } } - protected void runTestGL(GLCapabilities caps) throws InterruptedException, InvocationTargetException { + protected void runTestGL(final GLCapabilities caps) throws InterruptedException, InvocationTargetException { final Frame frame = new Frame("Gears AWT Test"); Assert.assertNotNull(frame); @@ -152,18 +152,18 @@ public class TestGearsAWTAnalyzeBug455 extends UITestCase { @Test public void test01() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setDoubleBuffered(true); // code assumes dbl buffer setup runTestGL(caps); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } else if(args[i].equals("-wait")) { waitForKey = true; } else if(args[i].equals("-autoswap")) { @@ -172,11 +172,11 @@ public class TestGearsAWTAnalyzeBug455 extends UITestCase { } System.err.println("altSwap "+altSwap); 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(TestGearsAWTAnalyzeBug455.class.getName()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java index d6cc712ee..3650e4955 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java @@ -85,7 +85,7 @@ public class TestGearsGLJPanelAWT extends UITestCase { public static void releaseClass() { } - protected void runTestGL(GLCapabilities caps) + protected void runTestGL(final GLCapabilities caps) throws AWTException, InterruptedException, InvocationTargetException { final JFrame frame = new JFrame("Swing GLJPanel"); @@ -93,7 +93,7 @@ public class TestGearsGLJPanelAWT extends UITestCase { final GLJPanel glJPanel = new GLJPanel(caps); Assert.assertNotNull(glJPanel); - Dimension glc_sz = new Dimension(width, height); + final Dimension glc_sz = new Dimension(width, height); glJPanel.setMinimumSize(glc_sz); glJPanel.setPreferredSize(glc_sz); glJPanel.setSize(glc_sz); @@ -157,7 +157,7 @@ public class TestGearsGLJPanelAWT 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); @@ -178,7 +178,7 @@ public class TestGearsGLJPanelAWT 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); @@ -191,7 +191,7 @@ public class TestGearsGLJPanelAWT extends UITestCase { if( manualTest ) { return; } - GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); + final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); caps.setPBuffer(true); runTestGL(caps); } @@ -203,7 +203,7 @@ public class TestGearsGLJPanelAWT 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); @@ -217,7 +217,7 @@ public class TestGearsGLJPanelAWT extends UITestCase { if( manualTest ) { return; } - GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); + final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault()); caps.setBitmap(true); runTestGL(caps); } @@ -229,7 +229,7 @@ public class TestGearsGLJPanelAWT 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); @@ -238,7 +238,7 @@ public class TestGearsGLJPanelAWT 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<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNEWT.java index a5134254b..4cefd95c0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNEWT.java @@ -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.newt; import com.jogamp.newt.event.KeyAdapter; @@ -69,15 +69,15 @@ public class TestGearsNEWT extends UITestCase { public static void releaseClass() { } - protected void runTestGL(GLCapabilities caps) throws InterruptedException { - GLWindow glWindow = GLWindow.create(caps); + protected void runTestGL(final GLCapabilities caps) throws InterruptedException { + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setTitle("Gears NEWT Test"); glWindow.addGLEventListener(new Gears()); - 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)); @@ -86,10 +86,10 @@ public class TestGearsNEWT 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() { @@ -119,19 +119,19 @@ public class TestGearsNEWT extends UITestCase { @Test public void test01() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); 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<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } org.junit.runner.JUnitCore.main(TestGearsNEWT.class.getName()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java index 50e128b21..beee5ffde 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java @@ -69,19 +69,19 @@ public class TestGearsNewtAWTWrapper extends UITestCase { public static void releaseClass() { } - protected void runTestGL(GLCapabilitiesImmutable caps) throws InterruptedException { - Display nDisplay = NewtFactory.createDisplay(NativeWindowFactory.TYPE_AWT, null, false); // local display - Screen nScreen = NewtFactory.createScreen(nDisplay, 0); // screen 0 - Window nWindow = NewtFactory.createWindow(nScreen, caps); + protected void runTestGL(final GLCapabilitiesImmutable caps) throws InterruptedException { + final Display nDisplay = NewtFactory.createDisplay(NativeWindowFactory.TYPE_AWT, null, false); // local display + final Screen nScreen = NewtFactory.createScreen(nDisplay, 0); // screen 0 + final Window nWindow = NewtFactory.createWindow(nScreen, caps); - GLWindow glWindow = GLWindow.create(nWindow); + final GLWindow glWindow = GLWindow.create(nWindow); Assert.assertNotNull(glWindow); glWindow.setTitle("Gears NewtAWTWrapper Test"); glWindow.addGLEventListener(new GearsES2(1)); - Animator animator = useAnimator ? new Animator(glWindow) : null; - QuitAdapter quitAdapter = new QuitAdapter(); + final Animator animator = useAnimator ? new Animator(glWindow) : null; + final QuitAdapter quitAdapter = new QuitAdapter(); glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter)); glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter)); @@ -136,11 +136,11 @@ public class TestGearsNewtAWTWrapper extends UITestCase { @Test public void test01() throws InterruptedException { - GLCapabilitiesImmutable caps = new GLCapabilities(glp); + final GLCapabilitiesImmutable caps = new GLCapabilities(glp); runTestGL(caps); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestTeapotNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestTeapotNEWT.java index 5a22fc7b1..975d35ad2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestTeapotNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestTeapotNEWT.java @@ -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.newt; import com.jogamp.newt.opengl.GLWindow; @@ -67,11 +67,11 @@ public class TestTeapotNEWT extends UITestCase { public static void releaseClass() { } - protected void runTestGL(GLCapabilities caps, boolean withAnimator) throws InterruptedException { + protected void runTestGL(final GLCapabilities caps, final boolean withAnimator) throws InterruptedException { final GLWindow glWindow = GLWindow.create(caps); - + glWindow.setTitle("Teapot NEWT Test"); - Teapot demo = new Teapot(); + final Teapot demo = new Teapot(); if( !withAnimator ) { demo.rotIncr *= 10f; } @@ -119,13 +119,13 @@ public class TestTeapotNEWT extends UITestCase { final GLCapabilities caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true)); runTestGL(caps, true); } - + @Test public void test02_DefCaps_NoAnim() throws InterruptedException { final GLCapabilities caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true)); runTestGL(caps, false); } - + @Test public void test12_FBOCaps_NoAnim() throws InterruptedException { final GLCapabilities caps = new GLCapabilities(GLProfile.getMaxFixedFunc(true)); @@ -148,13 +148,13 @@ public class TestTeapotNEWT 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<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } org.junit.runner.JUnitCore.main(TestTeapotNEWT.class.getName()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java index 13f299aeb..30840c1b7 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java @@ -78,12 +78,12 @@ public class GeomShader01TextureGL3 implements GLEventListener { static final String shaderBasename = "texture01_xxx"; static final String[] geomShaderBaseNames = new String[] { "passthrough01_xxx", "flipXYZ01_xxx" }; - public GeomShader01TextureGL3(int geomShader) { + public GeomShader01TextureGL3(final int geomShader) { this.geomShader = geomShader; } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { { final GL gl = drawable.getGL(); System.err.println("Init - START - useGeomShader "+geomShader+" -> "+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()<duration) { Thread.sleep(100); } - + animator.stop(); glWindow.destroy(); } - - public static void main(String args[]) throws IOException { + + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/GLSLMiscHelper.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/GLSLMiscHelper.java index f55e331a7..fa8406fa2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/GLSLMiscHelper.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/GLSLMiscHelper.java @@ -39,33 +39,33 @@ import org.junit.Assert; public class GLSLMiscHelper { public static final int frames_perftest = 600; // frames public static final int frames_warmup = 100; // frames - - public static void validateGLArrayDataServerState(GL2ES2 gl, ShaderState st, GLArrayDataServer data) { - int[] qi = new int[1]; - if(null != st) { - Assert.assertEquals(data, st.getAttribute(data.getName())); + + public static void validateGLArrayDataServerState(final GL2ES2 gl, final ShaderState st, final GLArrayDataServer data) { + final int[] qi = new int[1]; + if(null != st) { + Assert.assertEquals(data, st.getAttribute(data.getName())); if(st.shaderProgram().linked()) { Assert.assertEquals(data.getLocation(), st.getCachedAttribLocation(data.getName())); Assert.assertEquals(data.getLocation(), st.getAttribLocation(gl, data)); Assert.assertEquals(data.getLocation(), st.getAttribLocation(gl, data.getName())); - Assert.assertEquals(data.getLocation(), gl.glGetAttribLocation(st.shaderProgram().program(), data.getName())); + Assert.assertEquals(data.getLocation(), gl.glGetAttribLocation(st.shaderProgram().program(), data.getName())); } } gl.glGetVertexAttribiv(data.getLocation(), GL2ES2.GL_VERTEX_ATTRIB_ARRAY_ENABLED, qi, 0); Assert.assertEquals(data.enabled()?GL.GL_TRUE:GL.GL_FALSE, qi[0]); gl.glGetVertexAttribiv(data.getLocation(), GL2ES2.GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, qi, 0); - Assert.assertEquals(data.getVBOName(), qi[0]); - Assert.assertEquals(data.getSizeInBytes(), gl.glGetBufferSize(data.getVBOName())); + Assert.assertEquals(data.getVBOName(), qi[0]); + Assert.assertEquals(data.getSizeInBytes(), gl.glGetBufferSize(data.getVBOName())); } - public static void pause(long ms) throws InterruptedException { - long t0 = System.currentTimeMillis(); + public static void pause(final long ms) throws InterruptedException { + final long t0 = System.currentTimeMillis(); while( System.currentTimeMillis() - t0 < ms) { Thread.sleep(ms); - } + } } - - public static void displayVCArrays(GLDrawable drawable, GL2ES2 gl, ShaderState st, boolean preEnable, GLArrayDataServer vertices, GLArrayDataServer colors, boolean postDisable, int num, long postDelay) throws InterruptedException { + + public static void displayVCArrays(final GLDrawable drawable, final GL2ES2 gl, final ShaderState st, final boolean preEnable, final GLArrayDataServer vertices, final GLArrayDataServer colors, final boolean postDisable, final int num, final long postDelay) throws InterruptedException { System.err.println("screen #"+num); if(preEnable) { vertices.enableBuffer(gl, true); @@ -79,11 +79,11 @@ public class GLSLMiscHelper { } Assert.assertTrue(vertices.enabled()); Assert.assertTrue(colors.enabled()); - + validateGLArrayDataServerState(gl, st, vertices); validateGLArrayDataServerState(gl, st, colors); 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); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); if(postDisable) { vertices.enableBuffer(gl, false); @@ -93,24 +93,24 @@ public class GLSLMiscHelper { } Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); drawable.swapBuffers(); - if(postDelay>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<GLSLMiscHelper.frames_warmup; frames++) { GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, toggleEnable, vertices0, colors0, toggleEnable); } - + // measure .. - long t0 = System.currentTimeMillis(); + final long t0 = System.currentTimeMillis(); int frames; - + for(frames=0; frames<GLSLMiscHelper.frames_perftest; frames++) { GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, toggleEnable, vertices0, colors0, toggleEnable); - } + } final long t1 = System.currentTimeMillis(); - final long dt = t1 - t0; - final double fps = ( frames * 1000.0 ) / (double) dt; - final String fpsS = String.valueOf(fps); - final int fpsSp = fpsS.indexOf('.'); - System.err.println("testShaderState00PerformanceSingle toggleEnable "+toggleEnable+": "+dt/1000.0 +"s: "+ frames + "f, " + fpsS.substring(0, fpsSp+2) + " fps, "+dt/frames+" ms/f"); - + final long dt = t1 - t0; + final double fps = ( frames * 1000.0 ) / dt; + final String fpsS = String.valueOf(fps); + final int fpsSp = fpsS.indexOf('.'); + System.err.println("testShaderState00PerformanceSingle toggleEnable "+toggleEnable+": "+dt/1000.0 +"s: "+ frames + "f, " + fpsS.substring(0, fpsSp+2) + " fps, "+dt/frames+" ms/f"); + // cleanup st.destroy(gl); - - NEWTGLContext.destroyWindow(winctx); + + NEWTGLContext.destroyWindow(winctx); } - + @Test(timeout=240000) public void test04ShaderState_PerformanceDouble() throws InterruptedException { // preset .. @@ -399,12 +401,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", @@ -415,82 +417,82 @@ 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()); st.ownUniform(pmvMatrixUniform); st.uniform(gl, pmvMatrixUniform); - + // Allocate Vertex Array0 final GLArrayDataServer vertices0 = GLSLMiscHelper.createVertices(gl, st, 0, -1, GLSLMiscHelper.vertices0); vertices0.enableBuffer(gl, false); - + // Allocate Vertex Array1 final GLArrayDataServer vertices1 = GLSLMiscHelper.createVertices(gl, st, 0, -1, GLSLMiscHelper.vertices1); vertices1.enableBuffer(gl, false); - + // Allocate Color Array0 final GLArrayDataServer colors0 = GLSLMiscHelper.createColors(gl, st, 0, -1, GLSLMiscHelper.colors0); colors0.enableBuffer(gl, false); - + // Allocate Color Array1 final GLArrayDataServer colors1 = GLSLMiscHelper.createColors(gl, st, 0, -1, GLSLMiscHelper.colors1); colors1.enableBuffer(gl, false); - + // 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, true, vertices0, colors0, true, 1, 0); GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices1, colors1, true, 2, 0); - + // warmup .. for(int frames=0; frames<GLSLMiscHelper.frames_warmup; frames+=2) { GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, true, vertices0, colors0, true); GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, true, vertices1, colors1, true); } - + // measure .. - long t0 = System.currentTimeMillis(); + final long t0 = System.currentTimeMillis(); int frames; - + for(frames=0; frames<GLSLMiscHelper.frames_perftest; frames+=2) { GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, true, vertices0, colors0, true); GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, true, vertices1, colors1, true); - } + } final long t1 = System.currentTimeMillis(); - final long dt = t1 - t0; - final double fps = ( frames * 1000.0 ) / (double) dt; - final String fpsS = String.valueOf(fps); - final int fpsSp = fpsS.indexOf('.'); - System.err.println("testShaderState01PerformanceDouble: "+dt/1000.0 +"s: "+ frames + "f, " + fpsS.substring(0, fpsSp+2) + " fps, "+dt/frames+" ms/f"); - + final long dt = t1 - t0; + final double fps = ( frames * 1000.0 ) / dt; + final String fpsS = String.valueOf(fps); + final int fpsSp = fpsS.indexOf('.'); + System.err.println("testShaderState01PerformanceDouble: "+dt/1000.0 +"s: "+ frames + "f, " + fpsS.substring(0, fpsSp+2) + " fps, "+dt/frames+" ms/f"); + // cleanup st.destroy(gl); - + 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"); boolean wait = false; for(int i=0; i<args.length; i++) { @@ -504,16 +506,16 @@ public class TestGLSLShaderState01NEWT extends UITestCase { } if(wait) { while(-1 == System.in.read()) ; - TestGLSLShaderState01NEWT tst = new TestGLSLShaderState01NEWT(); + final TestGLSLShaderState01NEWT tst = new TestGLSLShaderState01NEWT(); try { tst.test04ShaderState_PerformanceDouble(); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } else { - String tstname = TestGLSLShaderState01NEWT.class.getName(); + final String tstname = TestGLSLShaderState01NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } System.err.println("main - end"); - } + } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java index 6279684d3..21d945470 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java @@ -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; @@ -60,7 +62,7 @@ public class TestGLSLShaderState02NEWT extends UITestCase { static final int vertices0_loc = 0; // FIXME: AMD needs this to be location 0 ? hu ? static final int colors0_loc = 5; - + @Test public void testShaderState01ValidationSP1Linked() throws InterruptedException { testShaderState01Validation(true); @@ -69,20 +71,20 @@ public class TestGLSLShaderState02NEWT extends UITestCase { public void testShaderState01ValidationSP1Unlinked() throws InterruptedException { testShaderState01Validation(false); } - - private void testShaderState01Validation(boolean linkSP1) throws InterruptedException { + + private void testShaderState01Validation(final boolean linkSP1) throws InterruptedException { // preset .. final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow( new GLCapabilities(GLProfile.getGL2ES2()), 480, 480, true); final GLDrawable drawable = winctx.context.getGLDrawable(); final GL2ES2 gl = winctx.context.getGL().getGL2ES2(); System.err.println(winctx.context); - + Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - - // test code .. + + // test code .. final ShaderState st = new ShaderState(); - + final ShaderCode rsVp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, RedSquareES2.class, "shader", "shader/bin", "RedSquareShader", true); final ShaderCode rsFp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, RedSquareES2.class, "shader", @@ -97,9 +99,9 @@ public class TestGLSLShaderState02NEWT extends UITestCase { sp1.add(rsVp0); sp1.add(rsFp1); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - Assert.assertTrue(0 == sp1.program()); + Assert.assertTrue(0 == sp1.program()); Assert.assertTrue(sp1.init(gl)); - Assert.assertTrue(0 != sp1.program()); + Assert.assertTrue(0 != sp1.program()); Assert.assertTrue(!sp1.inUse()); Assert.assertTrue(!sp1.linked()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); @@ -108,134 +110,134 @@ public class TestGLSLShaderState02NEWT extends UITestCase { Assert.assertTrue(sp1.linked()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); } - - final ShaderProgram sp0 = new ShaderProgram(); + + final ShaderProgram sp0 = new ShaderProgram(); sp0.add(rsVp0); sp0.add(rsFp0); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - - Assert.assertTrue(0 == sp0.program()); + + Assert.assertTrue(0 == sp0.program()); Assert.assertTrue(sp0.init(gl)); - 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); Assert.assertTrue(!sp0.inUse()); Assert.assertTrue(!sp0.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(sp0.link(gl, System.err)); Assert.assertTrue(sp0.linked()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - + Assert.assertEquals(vertices0_loc, vertices0.getLocation()); Assert.assertEquals(vertices0_loc, st.getAttribLocation(gl, vertices0.getName())); Assert.assertEquals(vertices0_loc, gl.glGetAttribLocation(st.shaderProgram().program(), vertices0.getName())); - + Assert.assertEquals(colors0_loc, colors0.getLocation()); Assert.assertEquals(colors0_loc, st.getAttribLocation(gl, colors0.getName())); Assert.assertEquals(colors0_loc, gl.glGetAttribLocation(st.shaderProgram().program(), colors0.getName())); - + st.useProgram(gl, true); Assert.assertTrue(sp0.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()); st.ownUniform(pmvMatrixUniform); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - + 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); - + // Allocate Color Array1 final GLArrayDataServer colors1 = GLSLMiscHelper.createColors(gl, st, 0, -1, GLSLMiscHelper.colors1); System.err.println("colors1: " + colors1); colors1.enableBuffer(gl, false); - + // 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()); 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 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); // display #4 vertices1 / colors1 (post-disable) GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices1, colors1, true, 4, durationPerTest); - + // SP1 - st.attachShaderProgram(gl, sp1, true); + st.attachShaderProgram(gl, sp1, true); Assert.assertTrue(sp1.inUse()); Assert.assertTrue(sp1.linked()); - + if(!linkSP1) { // all attribute locations shall be same now, due to impl. glBindAttributeLocation Assert.assertEquals(vertices0_loc, vertices0.getLocation()); Assert.assertEquals(vertices0_loc, st.getAttribLocation(gl, vertices0.getName())); Assert.assertEquals(vertices0_loc, gl.glGetAttribLocation(st.shaderProgram().program(), vertices0.getName())); - + Assert.assertEquals(colors0_loc, colors0.getLocation()); Assert.assertEquals(colors0_loc, st.getAttribLocation(gl, colors0.getName())); Assert.assertEquals(colors0_loc, gl.glGetAttribLocation(st.shaderProgram().program(), colors0.getName())); } - + // display #1 vertices0 / colors0 (post-disable) GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices0, colors0, true, 10, durationPerTest); // display #2 vertices1 / colors1 (post-disable) GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices1, colors1, true, 20, durationPerTest); - + // display #3 vertices0 / colors0 (post-disable) GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices0, colors0, true, 30, durationPerTest); - + // display #4 vertices1 / colors1 (post-disable) GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices1, colors1, true, 40, durationPerTest); - + // cleanup st.destroy(gl); - + NEWTGLContext.destroyWindow(winctx); } - @Test(timeout=240000) + @Test(timeout=240000) public void testShaderState01PerformanceDouble() throws InterruptedException { // preset .. final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow( @@ -244,12 +246,12 @@ public class TestGLSLShaderState02NEWT 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 rsVp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, RedSquareES2.class, "shader", "shader/bin", "RedSquareShader", true); final ShaderCode rsFp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, RedSquareES2.class, "shader", @@ -264,58 +266,58 @@ public class TestGLSLShaderState02NEWT extends UITestCase { sp1.add(rsVp0); sp1.add(rsFp1); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - Assert.assertTrue(0 == sp1.program()); + Assert.assertTrue(0 == sp1.program()); Assert.assertTrue(sp1.init(gl)); Assert.assertTrue(0 != sp1.program()); Assert.assertTrue(sp1.link(gl, System.err)); - + final ShaderProgram sp0 = new ShaderProgram(); sp0.add(rsVp0); sp0.add(rsFp0); - + Assert.assertTrue(sp0.init(gl)); Assert.assertTrue(sp0.link(gl, System.err)); - - st.attachShaderProgram(gl, sp0, true); - + + st.attachShaderProgram(gl, sp0, true); + // setup mgl_PMVMatrix final PMVMatrix pmvMatrix = new PMVMatrix(); 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, false); - + // Allocate Vertex Array1 final GLArrayDataServer vertices1 = GLSLMiscHelper.createVertices(gl, st, 0, -1, GLSLMiscHelper.vertices1); vertices1.enableBuffer(gl, false); - + // Allocate Color Array0 final GLArrayDataServer colors0 = GLSLMiscHelper.createColors(gl, st, 0, -1, GLSLMiscHelper.colors0); colors0.enableBuffer(gl, false); - + // Allocate Color Array1 final GLArrayDataServer colors1 = GLSLMiscHelper.createColors(gl, st, 0, -1, GLSLMiscHelper.colors1); colors1.enableBuffer(gl, false); - + // 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.setSwapInterval(0); - + // validation .. st.attachShaderProgram(gl, sp0, true); GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices0, colors0, true, 1, 0); @@ -323,8 +325,8 @@ public class TestGLSLShaderState02NEWT extends UITestCase { st.attachShaderProgram(gl, sp1, true); GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices0, colors0, true, 1, 0); GLSLMiscHelper.displayVCArrays(drawable, gl, st, true, vertices1, colors1, true, 2, 0); - - // warmup .. + + // warmup .. for(int frames=0; frames<GLSLMiscHelper.frames_warmup; frames+=2) { // SP0 st.attachShaderProgram(gl, sp0, true); @@ -333,11 +335,11 @@ public class TestGLSLShaderState02NEWT extends UITestCase { st.attachShaderProgram(gl, sp1, true); GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, true, vertices1, colors1, true); } - + // measure .. - long t0 = System.currentTimeMillis(); + final long t0 = System.currentTimeMillis(); int frames; - + for(frames=0; frames<GLSLMiscHelper.frames_perftest; frames+=4) { // SP0 st.attachShaderProgram(gl, sp0, true); @@ -348,20 +350,20 @@ public class TestGLSLShaderState02NEWT extends UITestCase { GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, true, vertices0, colors0, true); GLSLMiscHelper.displayVCArraysNoChecks(drawable, gl, true, vertices1, colors1, true); } - + final long t1 = System.currentTimeMillis(); - final long dt = t1 - t0; - final double fps = ( frames * 1000.0 ) / (double) dt; - final String fpsS = String.valueOf(fps); - final int fpsSp = fpsS.indexOf('.'); - System.err.println("testShaderState01PerformanceDouble: "+dt/1000.0 +"s: "+ frames + "f, " + fpsS.substring(0, fpsSp+2) + " fps, "+dt/frames+" ms/f"); - + final long dt = t1 - t0; + final double fps = ( frames * 1000.0 ) / dt; + final String fpsS = String.valueOf(fps); + final int fpsSp = fpsS.indexOf('.'); + System.err.println("testShaderState01PerformanceDouble: "+dt/1000.0 +"s: "+ frames + "f, " + fpsS.substring(0, fpsSp+2) + " fps, "+dt/frames+" ms/f"); + // cleanup st.destroy(gl); 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"); boolean wait = false; for(int i=0; i<args.length; i++) { @@ -374,16 +376,16 @@ public class TestGLSLShaderState02NEWT extends UITestCase { } if(wait) { while(-1 == System.in.read()) ; - TestGLSLShaderState02NEWT tst = new TestGLSLShaderState02NEWT(); + final TestGLSLShaderState02NEWT tst = new TestGLSLShaderState02NEWT(); try { tst.testShaderState01PerformanceDouble(); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); - } + } } else { - String tstname = TestGLSLShaderState02NEWT.class.getName(); + final String tstname = TestGLSLShaderState02NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); System.err.println("main - end"); } - } + } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLSimple01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLSimple01NEWT.java index 9a70a0859..b478fcdb6 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLSimple01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLSimple01NEWT.java @@ -56,19 +56,19 @@ public class TestGLSLSimple01NEWT extends UITestCase { @Test(timeout=60000) public void testGLSLCompilation01() { - GLProfile glp = GLProfile.get(GLProfile.GL2ES2); + final GLProfile glp = GLProfile.get(GLProfile.GL2ES2); Assert.assertNotNull(glp); - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); - GLWindow window = GLWindow.create(caps); + final GLWindow window = GLWindow.create(caps); Assert.assertNotNull(window); window.setSize(800, 600); window.setVisible(true); Assert.assertTrue(window.isNativeValid()); - GLContext context = window.getContext(); - + final GLContext context = window.getContext(); + // trigger native creation of drawable/context window.display(); Assert.assertTrue(window.isRealized()); @@ -78,8 +78,8 @@ public class TestGLSLSimple01NEWT extends UITestCase { // given - GL2ES2 gl = context.getGL().getGL2ES2(); - GLSLSimpleProgram myShader = GLSLSimpleProgram.create(gl, + final GL2ES2 gl = context.getGL().getGL2ES2(); + final GLSLSimpleProgram myShader = GLSLSimpleProgram.create(gl, RedSquareShader.VERTEX_SHADER_TEXT, RedSquareShader.FRAGMENT_SHADER_TEXT, true); @@ -91,20 +91,20 @@ public class TestGLSLSimple01NEWT extends UITestCase { @Test(timeout=60000) public void testGLSLUse01() throws InterruptedException { - GLProfile glp = GLProfile.get(GLProfile.GL2ES2); + final GLProfile glp = GLProfile.get(GLProfile.GL2ES2); Assert.assertNotNull(glp); - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); - GLWindow window = GLWindow.create(caps); + final GLWindow window = GLWindow.create(caps); Assert.assertNotNull(window); window.setSize(800, 600); window.setVisible(true); Assert.assertTrue(window.isNativeValid()); window.addGLEventListener(new RedSquareES2()); - - Animator animator = new Animator(window); - animator.setUpdateFPSFrames(1, null); + + final Animator animator = new Animator(window); + animator.setUpdateFPSFrames(1, null); animator.start(); Assert.assertEquals(true, animator.isAnimating()); while(animator.isAnimating() && animator.getTotalFPSDuration()<durationPerTest) { @@ -116,14 +116,14 @@ public class TestGLSLSimple01NEWT extends UITestCase { animator.stop(); } - 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atoi(args[++i], (int)durationPerTest); } } - String tstname = TestGLSLSimple01NEWT.class.getName(); + final String tstname = TestGLSLSimple01NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); System.err.println("main - end"); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java index b9d77ac0c..e20bbef2d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java @@ -53,6 +53,7 @@ import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLProfile; import javax.media.opengl.GLUniformData; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import org.junit.Assert; import org.junit.Test; @@ -87,7 +88,7 @@ public class TestRulerNEWT01 extends UITestCase { final GLUniformData rulerPixFreq = new GLUniformData("gcu_RulerPixFreq", 2, Buffers.newDirectFloatBuffer(2)); @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); @@ -134,16 +135,16 @@ public class TestRulerNEWT01 extends UITestCase { // 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()); } @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(); vertices0.enableBuffer(gl, true); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); @@ -152,13 +153,13 @@ public class TestRulerNEWT01 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) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); - pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); pmvMatrix.glOrthof(0f, 1f, 0f, 1f, -10f, 10f); // pmvMatrix.gluPerspective(45.0F, (float) drawable.getWidth() / (float) drawable.getHeight(), 1.0F, 100.0F); - pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); // pmvMatrix.glTranslatef(0, 0, -6); // pmvMatrix.glRotatef(45f, 1f, 0f, 0f); @@ -235,7 +236,7 @@ public class TestRulerNEWT01 extends UITestCase { runTestGL(); } - 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<args.length; i++) { if(args[i].equals("-time")) { @@ -249,7 +250,7 @@ public class TestRulerNEWT01 extends UITestCase { manualTest = true; } } - String tstname = TestRulerNEWT01.class.getName(); + final String tstname = TestRulerNEWT01.class.getName(); org.junit.runner.JUnitCore.main(tstname); System.err.println("main - end"); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestShaderCompilationBug459AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestShaderCompilationBug459AWT.java index f26927a5c..e5b2dd2da 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestShaderCompilationBug459AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestShaderCompilationBug459AWT.java @@ -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,8 @@ package com.jogamp.opengl.test.junit.jogl.glsl; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.util.Animator; +import javax.media.opengl.GL; +import javax.media.opengl.GL2ES2; import javax.media.opengl.GL2GL3; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLCapabilities; @@ -37,6 +39,7 @@ import javax.media.opengl.GLEventListener; import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; import javax.media.opengl.awt.GLCanvas; + import java.awt.Frame; import org.junit.Assert; @@ -70,13 +73,13 @@ public class TestShaderCompilationBug459AWT extends UITestCase { @Test public void compileShader() throws InterruptedException { - GLProfile glp = GLProfile.get(GLProfile.GL2GL3); - GLCapabilities caps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.get(GLProfile.GL2GL3); + final GLCapabilities caps = new GLCapabilities(glp); // commenting out this line makes it work caps.setStencilBits(8); // commenting in this line also makes it work - //caps.setSampleBuffers(true); + //caps.setSampleBuffers(true); final Frame frame = new Frame("Bug 459 shader compilation test"); Assert.assertNotNull(frame); @@ -87,62 +90,62 @@ public class TestShaderCompilationBug459AWT extends UITestCase { glCanvas.addGLEventListener(new GLEventListener() { /* @Override */ - public void init(GLAutoDrawable drawable) { - String code = "void main(void){gl_Position = vec4(0,0,0,1);}"; + public void init(final GLAutoDrawable drawable) { + final String code = "void main(void){gl_Position = vec4(0,0,0,1);}"; - GL2GL3 gl = drawable.getGL().getGL2GL3(); - int id = gl.glCreateShader(GL2GL3.GL_VERTEX_SHADER); + final GL2GL3 gl = drawable.getGL().getGL2GL3(); + final int id = gl.glCreateShader(GL2ES2.GL_VERTEX_SHADER); try { - gl.glShaderSource(id, 1, new String[] { code }, (int[])null, 0); - gl.glCompileShader(id); - - int[] compiled = new int[1]; - gl.glGetShaderiv(id, GL2GL3.GL_COMPILE_STATUS, compiled, 0); - if (compiled[0] == GL2GL3.GL_FALSE) { - int[] logLength = new int[1]; - gl.glGetShaderiv(id, GL2GL3.GL_INFO_LOG_LENGTH, logLength, 0); - - byte[] log = new byte[logLength[0]]; - gl.glGetShaderInfoLog(id, logLength[0], (int[])null, 0, log, 0); - - System.err.println("Error compiling the shader: " + new String(log)); - - gl.glDeleteShader(id); - } + gl.glShaderSource(id, 1, new String[] { code }, (int[])null, 0); + gl.glCompileShader(id); + + final int[] compiled = new int[1]; + gl.glGetShaderiv(id, GL2ES2.GL_COMPILE_STATUS, compiled, 0); + if (compiled[0] == GL.GL_FALSE) { + final int[] logLength = new int[1]; + gl.glGetShaderiv(id, GL2ES2.GL_INFO_LOG_LENGTH, logLength, 0); + + final byte[] log = new byte[logLength[0]]; + gl.glGetShaderInfoLog(id, logLength[0], (int[])null, 0, log, 0); + + System.err.println("Error compiling the shader: " + new String(log)); + + gl.glDeleteShader(id); + } else { - System.out.println("Shader compiled: id=" + id); + System.out.println("Shader compiled: id=" + id); } } - catch( GLException e ) { + catch( final GLException e ) { glexception = e; } } /* @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) { } }); - Animator animator = new Animator(glCanvas); + final Animator animator = new Animator(glCanvas); try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame.setSize(512, 512); frame.setVisible(true); } } ); - } catch(Exception ex) { + } catch(final Exception ex) { throw new RuntimeException(ex); } - animator.setUpdateFPSFrames(1, null); + animator.setUpdateFPSFrames(1, null); animator.start(); while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) { @@ -163,13 +166,13 @@ public class TestShaderCompilationBug459AWT extends UITestCase { frame.remove(glCanvas); frame.dispose(); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); - } + } } - public static void main(String args[]) { + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestShaderCompilationBug459AWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestTransformFeedbackVaryingsBug407NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestTransformFeedbackVaryingsBug407NEWT.java index bbfe1dd1a..03e03fce8 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestTransformFeedbackVaryingsBug407NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestTransformFeedbackVaryingsBug407NEWT.java @@ -8,6 +8,7 @@ import java.io.PrintStream; import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2ES3; import javax.media.opengl.GL3; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLException; @@ -30,7 +31,7 @@ import java.io.IOException; public class TestTransformFeedbackVaryingsBug407NEWT extends UITestCase { private static final boolean debugGL = true; - + private static final String VERTEX_SHADER_TEXT = "#version 150 \n" + " \n" @@ -44,22 +45,22 @@ public class TestTransformFeedbackVaryingsBug407NEWT extends UITestCase { int shaderProgram; int vertShader; - MyShader(int shaderProgram, int vertShader) { + MyShader(final int shaderProgram, final int vertShader) { this.shaderProgram = shaderProgram; this.vertShader = vertShader; } } - private MyShader attachShader(GL3 gl, String text, int type) { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - PrintStream pbaos = new PrintStream(baos); + private MyShader attachShader(final GL3 gl, final String text, final int type) { + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final PrintStream pbaos = new PrintStream(baos); - int shaderProgram = gl.glCreateProgram(); + final int shaderProgram = gl.glCreateProgram(); - int vertShader = gl.glCreateShader(type); + final int vertShader = gl.glCreateShader(type); - String[] lines = new String[]{text}; - int[] lengths = new int[]{lines[0].length()}; + final String[] lines = new String[]{text}; + final int[] lengths = new int[]{lines[0].length()}; gl.glShaderSource(vertShader, lines.length, lines, lengths, 0); gl.glCompileShader(vertShader); @@ -75,7 +76,7 @@ public class TestTransformFeedbackVaryingsBug407NEWT extends UITestCase { return new MyShader(shaderProgram, vertShader); } - private void releaseShader(GL3 gl, MyShader myShader) { + private void releaseShader(final GL3 gl, final MyShader myShader) { if(null!=myShader) { gl.glDetachShader(myShader.shaderProgram, myShader.vertShader); gl.glDeleteShader(myShader.vertShader); @@ -85,7 +86,7 @@ public class TestTransformFeedbackVaryingsBug407NEWT extends UITestCase { } final static String glps = GLProfile.GL3; - + private NEWTGLContext.WindowContext prepareTest() throws GLException, InterruptedException { final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow( new GLCapabilities(GLProfile.getMaxProgrammable(true)), 480, 480, debugGL); @@ -94,11 +95,11 @@ public class TestTransformFeedbackVaryingsBug407NEWT extends UITestCase { cleanupTest(winctx); return null; } - Assert.assertEquals(GL.GL_NO_ERROR, winctx.context.getGL().glGetError()); + Assert.assertEquals(GL.GL_NO_ERROR, winctx.context.getGL().glGetError()); return winctx; } - private void cleanupTest(NEWTGLContext.WindowContext winctx) { + private void cleanupTest(final NEWTGLContext.WindowContext winctx) { if(null!=winctx) { NEWTGLContext.destroyWindow(winctx); } @@ -106,27 +107,27 @@ public class TestTransformFeedbackVaryingsBug407NEWT extends UITestCase { @Test(timeout=60000) public void testGlTransformFeedbackVaryings_WhenVarNameOK() throws GLException, InterruptedException { - NEWTGLContext.WindowContext winctx = prepareTest(); + final NEWTGLContext.WindowContext winctx = prepareTest(); if(null == winctx) { return; } - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - PrintStream pbaos = new PrintStream(baos); + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final PrintStream pbaos = new PrintStream(baos); // given final GL3 gl = winctx.context.getGL().getGL3(); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - - MyShader myShader = attachShader(gl, VERTEX_SHADER_TEXT, GL3.GL_VERTEX_SHADER); - String[] vars = new String[]{"Position"}; + + final MyShader myShader = attachShader(gl, VERTEX_SHADER_TEXT, GL2ES2.GL_VERTEX_SHADER); + final String[] vars = new String[]{"Position"}; // when - gl.glTransformFeedbackVaryings(myShader.shaderProgram, 1, vars, GL3.GL_SEPARATE_ATTRIBS); + gl.glTransformFeedbackVaryings(myShader.shaderProgram, 1, vars, GL2ES3.GL_SEPARATE_ATTRIBS); gl.glLinkProgram(myShader.shaderProgram); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - + // then boolean error = false; @@ -136,33 +137,33 @@ public class TestTransformFeedbackVaryingsBug407NEWT extends UITestCase { error = true; } pbaos.flush(); baos.reset(); - Assert.assertEquals(GL3.GL_NO_ERROR, gl.glGetError()); + Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - releaseShader(gl, myShader); + releaseShader(gl, myShader); cleanupTest(winctx); Assert.assertFalse(error); } @Test(timeout=60000) public void testGlTransformFeedbackVaryings_WhenVarNameWrong() throws GLException, InterruptedException { - NEWTGLContext.WindowContext winctx = prepareTest(); + final NEWTGLContext.WindowContext winctx = prepareTest(); if(null == winctx) { return; } - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - PrintStream pbaos = new PrintStream(baos); + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final PrintStream pbaos = new PrintStream(baos); // given final GL3 gl = winctx.context.getGL().getGL3(); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); - MyShader myShader = attachShader(gl, VERTEX_SHADER_TEXT, GL3.GL_VERTEX_SHADER); - String[] vars = new String[]{"PPPosition"}; + final MyShader myShader = attachShader(gl, VERTEX_SHADER_TEXT, GL2ES2.GL_VERTEX_SHADER); + final String[] vars = new String[]{"PPPosition"}; // when - gl.glTransformFeedbackVaryings(myShader.shaderProgram, 1, vars, GL3.GL_SEPARATE_ATTRIBS); + gl.glTransformFeedbackVaryings(myShader.shaderProgram, 1, vars, GL2ES3.GL_SEPARATE_ATTRIBS); gl.glLinkProgram(myShader.shaderProgram); // then @@ -173,21 +174,21 @@ public class TestTransformFeedbackVaryingsBug407NEWT extends UITestCase { System.out.println("GOOD (expected link error) - testGlTransformFeedbackVaryings_WhenVarNameWrong:postLink: "+baos.toString()); // should be invalid, due to wrong var name } else { - // oops + // oops System.out.println("Error (unexpected link success) - testGlTransformFeedbackVaryings_WhenVarNameWrong link worked, but it should not"); error = true; } pbaos.flush(); baos.reset(); - Assert.assertEquals(GL3.GL_NO_ERROR, gl.glGetError()); - + Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); + releaseShader(gl, myShader); cleanupTest(winctx); Assert.assertFalse(error); } - public static void main(String args[]) throws IOException { - String tstname = TestTransformFeedbackVaryingsBug407NEWT.class.getName(); + public static void main(final String args[]) throws IOException { + final String tstname = TestTransformFeedbackVaryingsBug407NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug365TextureGenerateMipMaps.java b/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug365TextureGenerateMipMaps.java index b9e64e1da..dfa26a049 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug365TextureGenerateMipMaps.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug365TextureGenerateMipMaps.java @@ -2,7 +2,9 @@ package com.jogamp.opengl.test.junit.jogl.glu; import java.nio.ByteBuffer;
+import javax.media.opengl.GL;
import javax.media.opengl.GL2;
+import javax.media.opengl.GL2ES2;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawableFactory;
@@ -57,7 +59,7 @@ public class TestBug365TextureGenerateMipMaps extends UITestCase { System.setProperty("jogl.texture.nonpot", "true");
try {
setUpOffscreenAutoDrawable();
- } catch (Throwable t) {
+ } catch (final Throwable t) {
throw t;
}
}
@@ -68,18 +70,18 @@ public class TestBug365TextureGenerateMipMaps extends UITestCase { }
private static void setUpOffscreenAutoDrawable() throws Throwable {
- GLProfile glp = GLProfile.getDefault();
- GLCapabilities caps = new GLCapabilities(glp);
+ final GLProfile glp = GLProfile.getDefault();
+ final GLCapabilities caps = new GLCapabilities(glp);
- GLDrawableFactory factory = GLDrawableFactory.getFactory(glp);
+ final GLDrawableFactory factory = GLDrawableFactory.getFactory(glp);
// Make a drawable to get an offscreen context
drawable = factory.createOffscreenAutoDrawable(null, caps, null, 2, 2);
drawable.display(); // trigger context creation
- GLContext glContext = drawable.getContext();
+ final GLContext glContext = drawable.getContext();
try {
Assert.assertTrue("Could not make context current", GLContext.CONTEXT_NOT_CURRENT < glContext.makeCurrent());
- } catch (Throwable t) {
+ } catch (final Throwable t) {
tearDownOffscreenAutoDrawable();
throw t;
}
@@ -93,17 +95,17 @@ public class TestBug365TextureGenerateMipMaps extends UITestCase { }
}
- private static void testTextureMipMapGeneration(int width, int height, int pixelFormat, int pixelType) {
- int internalFormat = pixelFormat;
- int border = 0;
- boolean mipmap = true;
- boolean dataIsCompressed = false;
- boolean mustFlipVertically = false;
+ private static void testTextureMipMapGeneration(final int width, final int height, final int pixelFormat, final int pixelType) {
+ final int internalFormat = pixelFormat;
+ final int border = 0;
+ final boolean mipmap = true;
+ final boolean dataIsCompressed = false;
+ final boolean mustFlipVertically = false;
- int memReq = Mipmap.image_size( width, height, pixelFormat, pixelType );
+ final int memReq = Mipmap.image_size( width, height, pixelFormat, pixelType );
ByteBuffer buffer = Buffers.newDirectByteBuffer( memReq );
- TextureData data = new TextureData(drawable.getGLProfile(),
+ final TextureData data = new TextureData(drawable.getGLProfile(),
internalFormat,
width,
height,
@@ -116,7 +118,7 @@ public class TestBug365TextureGenerateMipMaps extends UITestCase { buffer,
null);
- Texture texture = TextureIO.newTexture(drawable.getGL(), data);
+ final Texture texture = TextureIO.newTexture(drawable.getGL(), data);
// Cleanup
texture.destroy(drawable.getGL());
data.destroy();
@@ -126,145 +128,145 @@ public class TestBug365TextureGenerateMipMaps extends UITestCase { @Test
public void test00_MipMap_ScaleInternal_RGB_UBYTE () {
- int width = 1;
- int height = 7;
- int pixelFormat = GL2.GL_RGB;
- int pixelType = GL2.GL_UNSIGNED_BYTE;
+ final int width = 1;
+ final int height = 7;
+ final int pixelFormat = GL.GL_RGB;
+ final int pixelType = GL.GL_UNSIGNED_BYTE;
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
@Test
public void test01_MipMap_ScaleInternal_RGBA_UBYTE () {
- int width = 1;
- int height = 7;
- int pixelFormat = GL2.GL_RGBA;
- int pixelType = GL2.GL_UNSIGNED_BYTE;
+ final int width = 1;
+ final int height = 7;
+ final int pixelFormat = GL.GL_RGBA;
+ final int pixelType = GL.GL_UNSIGNED_BYTE;
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
@Test
public void test02_MipMap_ScaleInternal_RGB_BYTE () {
- int width = 1;
- int height = 7;
- int pixelFormat = GL2.GL_RGB;
- int pixelType = GL2.GL_BYTE;
+ final int width = 1;
+ final int height = 7;
+ final int pixelFormat = GL.GL_RGB;
+ final int pixelType = GL.GL_BYTE;
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
@Test
public void test03_MipMap_ScaleInternal_RGBA_BYTE () {
- int width = 1;
- int height = 7;
- int pixelFormat = GL2.GL_RGBA;
- int pixelType = GL2.GL_BYTE;
+ final int width = 1;
+ final int height = 7;
+ final int pixelFormat = GL.GL_RGBA;
+ final int pixelType = GL.GL_BYTE;
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
@Test
public void test04_MipMap_ScaleInternal_RGB_USHORT () {
- int width = 1;
- int height = 7;
- int pixelFormat = GL2.GL_RGB;
- int pixelType = GL2.GL_UNSIGNED_SHORT;
+ final int width = 1;
+ final int height = 7;
+ final int pixelFormat = GL.GL_RGB;
+ final int pixelType = GL.GL_UNSIGNED_SHORT;
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
@Test
public void test05_MipMap_ScaleInternal_RGBA_USHORT () {
- int width = 1;
- int height = 7;
- int pixelFormat = GL2.GL_RGBA;
- int pixelType = GL2.GL_UNSIGNED_SHORT;
+ final int width = 1;
+ final int height = 7;
+ final int pixelFormat = GL.GL_RGBA;
+ final int pixelType = GL.GL_UNSIGNED_SHORT;
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
@Test
public void test06_MipMap_ScaleInternal_RGB_SHORT () {
- int width = 1;
- int height = 7;
- int pixelFormat = GL2.GL_RGB;
- int pixelType = GL2.GL_SHORT;
+ final int width = 1;
+ final int height = 7;
+ final int pixelFormat = GL.GL_RGB;
+ final int pixelType = GL.GL_SHORT;
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
@Test
public void test07_MipMap_ScaleInternal_RGBA_SHORT () {
- int width = 1;
- int height = 7;
- int pixelFormat = GL2.GL_RGBA;
- int pixelType = GL2.GL_SHORT;
+ final int width = 1;
+ final int height = 7;
+ final int pixelFormat = GL.GL_RGBA;
+ final int pixelType = GL.GL_SHORT;
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
@Test
public void test08_MipMap_ScaleInternal_RGB_UINT () {
- int width = 1;
- int height = 7;
- int pixelFormat = GL2.GL_RGB;
- int pixelType = GL2.GL_UNSIGNED_INT;
+ final int width = 1;
+ final int height = 7;
+ final int pixelFormat = GL.GL_RGB;
+ final int pixelType = GL.GL_UNSIGNED_INT;
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
@Test
public void test09_MipMap_ScaleInternal_RGBA_UINT () {
- int width = 1;
- int height = 7;
- int pixelFormat = GL2.GL_RGBA;
- int pixelType = GL2.GL_UNSIGNED_INT;
+ final int width = 1;
+ final int height = 7;
+ final int pixelFormat = GL.GL_RGBA;
+ final int pixelType = GL.GL_UNSIGNED_INT;
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
@Test
public void test10_MipMap_ScaleInternal_RGB_INT () {
- int width = 1;
- int height = 7;
- int pixelFormat = GL2.GL_RGB;
- int pixelType = GL2.GL_INT;
+ final int width = 1;
+ final int height = 7;
+ final int pixelFormat = GL.GL_RGB;
+ final int pixelType = GL2ES2.GL_INT;
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
@Test
public void test11_MipMap_ScaleInternal_RGBA_INT () {
- int width = 1;
- int height = 7;
- int pixelFormat = GL2.GL_RGBA;
- int pixelType = GL2.GL_INT;
+ final int width = 1;
+ final int height = 7;
+ final int pixelFormat = GL.GL_RGBA;
+ final int pixelType = GL2ES2.GL_INT;
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
@Test
public void test12_MipMap_ScaleInternal_RGB_FLOAT () {
- int width = 1;
- int height = 7;
- int pixelFormat = GL2.GL_RGB;
- int pixelType = GL2.GL_FLOAT;
+ final int width = 1;
+ final int height = 7;
+ final int pixelFormat = GL.GL_RGB;
+ final int pixelType = GL.GL_FLOAT;
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
@Test
public void test13_MipMap_ScaleInternal_RGBA_FLOAT () {
- int width = 1;
- int height = 7;
- int pixelFormat = GL2.GL_RGBA;
- int pixelType = GL2.GL_FLOAT;
+ final int width = 1;
+ final int height = 7;
+ final int pixelFormat = GL.GL_RGBA;
+ final int pixelType = GL.GL_FLOAT;
testTextureMipMapGeneration(width, height, pixelFormat, pixelType);
}
- public static void main(String[] args) {
+ public static void main(final String[] args) {
org.junit.runner.JUnitCore.main(TestBug365TextureGenerateMipMaps.class.getName());
}
}
\ No newline at end of file diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug463ScaleImageMemoryAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug463ScaleImageMemoryAWT.java index e5690a0b0..5c63b2e1d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug463ScaleImageMemoryAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug463ScaleImageMemoryAWT.java @@ -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.glu; import java.awt.Frame; @@ -51,33 +51,33 @@ import com.jogamp.opengl.test.junit.util.UITestCase; * 4-byte direct buffer objects inside the tight loops of Image.fill_image() and Image.empty_image(). Since * the JVM apparently can only allocate direct buffer in 4MB chunks, each 4-byte buffer cost us a million times * the memory it should have. Changing the constructor of Type_Widget.java back to non-direct buffer (like it - * was in JOGL 1) solves the problem. + * was in JOGL 1) solves the problem. * @author Wade Walker */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestBug463ScaleImageMemoryAWT extends UITestCase implements GLEventListener { /* @Override */ - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { } /* @Override */ - public void display(GLAutoDrawable drawable) { - int widthin = 559; - int heightin = 425; - - int widthout = 1024; - int heightout = 512; - - int textureInLength = widthin * heightin * 4; - int textureOutLength = widthout * heightout * 4; - - byte[] datain = new byte[textureInLength]; - byte[] dataout = new byte[textureOutLength]; - - ByteBuffer bufferIn = ByteBuffer.wrap(datain); - ByteBuffer bufferOut = ByteBuffer.wrap(dataout); - GLUgl2es1 glu = new GLUgl2es1(); + public void display(final GLAutoDrawable drawable) { + final int widthin = 559; + final int heightin = 425; + + final int widthout = 1024; + final int heightout = 512; + + final int textureInLength = widthin * heightin * 4; + final int textureOutLength = widthout * heightout * 4; + + final byte[] datain = new byte[textureInLength]; + final byte[] dataout = new byte[textureOutLength]; + + final ByteBuffer bufferIn = ByteBuffer.wrap(datain); + final ByteBuffer bufferOut = ByteBuffer.wrap(dataout); + final GLUgl2es1 glu = new GLUgl2es1(); // in the failing case, the system would run out of memory in here glu.gluScaleImage( GL.GL_RGBA, widthin, heightin, GL.GL_UNSIGNED_BYTE, bufferIn, @@ -85,24 +85,24 @@ public class TestBug463ScaleImageMemoryAWT extends UITestCase implements GLEvent } /* @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 dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { } @Test public void test01() throws InterruptedException { - GLProfile glprofile = GLProfile.getGL2ES1(); - GLCapabilities glCapabilities = new GLCapabilities(glprofile); + final GLProfile glprofile = GLProfile.getGL2ES1(); + final GLCapabilities glCapabilities = new GLCapabilities(glprofile); final GLCanvas canvas = new GLCanvas(glCapabilities); canvas.addGLEventListener( this ); - + final Frame frame = new Frame("Test"); frame.add(canvas); - frame.setSize(256, 256); + frame.setSize(256, 256); frame.validate(); try { @@ -110,15 +110,15 @@ public class TestBug463ScaleImageMemoryAWT extends UITestCase implements GLEvent public void run() { frame.setVisible(true); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } - + canvas.display(); Thread.sleep(200); - + try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { @@ -126,13 +126,13 @@ public class TestBug463ScaleImageMemoryAWT extends UITestCase implements GLEvent frame.remove(canvas); frame.dispose(); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); - } + } } - public static void main(String args[]) { + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestBug463ScaleImageMemoryAWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug694ScaleImageUnpackBufferSizeAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug694ScaleImageUnpackBufferSizeAWT.java index 4f87bd7cf..184dea8ba 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug694ScaleImageUnpackBufferSizeAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestBug694ScaleImageUnpackBufferSizeAWT.java @@ -57,11 +57,11 @@ import com.jogamp.opengl.util.GLPixelStorageModes; public class TestBug694ScaleImageUnpackBufferSizeAWT extends UITestCase implements GLEventListener { /* @Override */ - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { } /* @Override */ - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { if( !testDone ) { testDone = true; @@ -76,7 +76,7 @@ public class TestBug694ScaleImageUnpackBufferSizeAWT extends UITestCase implemen boolean testDone = false; - private void testGLUScaleImage(GL gl, GLU glu, int unpackAlignment) { + private void testGLUScaleImage(final GL gl, final GLU glu, final int unpackAlignment) { final GLPixelStorageModes psm = new GLPixelStorageModes(); if(0 < unpackAlignment) { psm.setUnpackAlignment(gl, unpackAlignment); @@ -98,8 +98,8 @@ public class TestBug694ScaleImageUnpackBufferSizeAWT extends UITestCase implemen System.err.println("Unpack-Alignment "+unpackAlignment+": in-size "+unpackSizeInLen); System.err.println("Unpack-Alignment "+unpackAlignment+": out-size "+unpackSizeOutLen); - ByteBuffer bufferIn = Buffers.newDirectByteBuffer(unpackSizeInLen); - ByteBuffer bufferOut = Buffers.newDirectByteBuffer(unpackSizeOutLen); + final ByteBuffer bufferIn = Buffers.newDirectByteBuffer(unpackSizeInLen); + final ByteBuffer bufferOut = Buffers.newDirectByteBuffer(unpackSizeOutLen); glu.gluScaleImage( GL.GL_LUMINANCE, widthin, heightin, GL.GL_UNSIGNED_BYTE, bufferIn, @@ -111,18 +111,18 @@ public class TestBug694ScaleImageUnpackBufferSizeAWT extends UITestCase implemen } /* @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 dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { } @Test public void test01() throws InterruptedException { - GLProfile glprofile = GLProfile.getDefault(); - GLCapabilities glCapabilities = new GLCapabilities(glprofile); + final GLProfile glprofile = GLProfile.getDefault(); + final GLCapabilities glCapabilities = new GLCapabilities(glprofile); final GLCanvas canvas = new GLCanvas(glCapabilities); canvas.addGLEventListener( this ); @@ -136,7 +136,7 @@ public class TestBug694ScaleImageUnpackBufferSizeAWT extends UITestCase implemen public void run() { frame.setVisible(true); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } @@ -152,13 +152,13 @@ public class TestBug694ScaleImageUnpackBufferSizeAWT extends UITestCase implemen frame.remove(canvas); frame.dispose(); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); Assume.assumeNoException(t); } } - public static void main(String args[]) { + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestBug694ScaleImageUnpackBufferSizeAWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestBinary16NOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestBinary16NOUI.java index 8f56c133e..5e4166a49 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestBinary16NOUI.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestBinary16NOUI.java @@ -701,7 +701,7 @@ public final class TestBinary16NOUI extends UITestCase /* due to hardship on ma Assert.assertEquals(r, -1.0, 0.0); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-stepping")) { stepping = MiscUtils.atoi(args[++i], stepping); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil01NOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil01NOUI.java index aeceff981..0d156c42c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil01NOUI.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestFloatUtil01NOUI.java @@ -62,14 +62,14 @@ public class TestFloatUtil01NOUI { System.err.println("deltaFixedEpsMin "+deltaFixedEpsMin+", deltaFixedEpsLEQEpsilon "+deltaFixedEpsLEQEpsilon);
}
- private void dumpTestWE(int tstNum, int expWE, final float a, final float b, final float EPSILON) {
+ private void dumpTestWE(final int tstNum, final int expWE, final float a, final float b, final float EPSILON) {
final float delta = a-b;
final boolean equalWE = FloatUtil.isEqual(a, b, EPSILON);
final int compWE = FloatUtil.compare(a, b, EPSILON);
final String msgWE = ( expWE != compWE ) ? "**** mismatch ****" : " OK";
System.err.println("Print.WE."+tstNum+": a: "+a+", b: "+b+" -> 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; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBuffer2File.java b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBuffer2File.java index 9506d00e5..989bd5e3a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBuffer2File.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBuffer2File.java @@ -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.offscreen; import java.io.IOException; @@ -35,12 +35,12 @@ import java.io.File; public class ReadBuffer2File extends ReadBufferBase { - public ReadBuffer2File(GLDrawable externalRead) { + public ReadBuffer2File(final GLDrawable externalRead) { super(externalRead, false); } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { super.dispose(drawable); } int shotNum = 0; @@ -50,18 +50,18 @@ public class ReadBuffer2File extends ReadBufferBase { return; } - File file = File.createTempFile("shot" + shotNum + "-", ".png"); + final File file = File.createTempFile("shot" + shotNum + "-", ".png"); readBufferUtil.write(file); System.out.println("Wrote: " + file.getAbsolutePath() + ", ..."); shotNum++; } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { super.display(drawable); try { copyTextureData2File(); - } catch (IOException ex) { + } catch (final IOException ex) { throw new RuntimeException("can not read buffer to file", ex); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBuffer2Screen.java b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBuffer2Screen.java index 5bdef2869..3f9a64f5b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBuffer2Screen.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBuffer2Screen.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,21 +20,23 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the 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.offscreen; import java.nio.*; + import javax.media.opengl.*; import javax.media.opengl.fixedfunc.*; import com.jogamp.opengl.util.*; import javax.media.opengl.fixedfunc.GLPointerFunc; + import com.jogamp.opengl.util.texture.TextureCoords; import com.jogamp.opengl.util.GLArrayDataClient; import com.jogamp.opengl.util.GLArrayDataServer; @@ -46,28 +48,28 @@ public class ReadBuffer2Screen extends ReadBufferBase { boolean enableBufferAlways = false; // FIXME boolean enableBufferVBO = true; // FIXME - public ReadBuffer2Screen (GLDrawable externalRead) { + public ReadBuffer2Screen (final GLDrawable externalRead) { super(externalRead, true); } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { super.init(drawable); - GL gl = drawable.getGL(); + final GL gl = drawable.getGL(); pmvMatrix = new PMVMatrix(); - float f_edge = 1f; + final float f_edge = 1f; if(null==readTextureVertices) { - //readTextureVertices = GLArrayDataClient.createFixed(gl, GLPointerFunc.GL_VERTEX_ARRAY, "mgl_Vertex", + //readTextureVertices = GLArrayDataClient.createFixed(gl, GLPointerFunc.GL_VERTEX_ARRAY, "mgl_Vertex", // 2, GL.GL_FLOAT, true, 4); - readTextureVertices = GLArrayDataServer.createFixed(GLPointerFunc.GL_VERTEX_ARRAY, 2, + readTextureVertices = GLArrayDataServer.createFixed(GLPointerFunc.GL_VERTEX_ARRAY, 2, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW); readTextureVertices.setEnableAlways(enableBufferAlways); readTextureVertices.setVBOEnabled(enableBufferVBO); { - FloatBuffer vb = (FloatBuffer)readTextureVertices.getBuffer(); + final FloatBuffer vb = (FloatBuffer)readTextureVertices.getBuffer(); vb.put(-f_edge); vb.put(-f_edge); vb.put( f_edge); vb.put(-f_edge); vb.put(-f_edge); vb.put( f_edge); @@ -82,10 +84,10 @@ public class ReadBuffer2Screen extends ReadBufferBase { } @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) { super.reshape(drawable, x, y, width, height); - GL gl = drawable.getGL(); + final GL gl = drawable.getGL(); gl.glViewport(0, 0, width, height); @@ -101,30 +103,30 @@ public class ReadBuffer2Screen extends ReadBufferBase { } // Identity .. - pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrix.glTranslatef(0, 0, -2.5f); if(null!=glM) { - glM.glMatrixMode(PMVMatrix.GL_MODELVIEW); + glM.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); glM.glLoadMatrixf(pmvMatrix.glGetMvMatrixf()); } // 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, 100.0f); if(null!=glM) { - glM.glMatrixMode(PMVMatrix.GL_PROJECTION); + glM.glMatrixMode(GLMatrixFunc.GL_PROJECTION); glM.glLoadMatrixf(pmvMatrix.glGetPMatrixf()); } } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { super.dispose(drawable); } - void renderOffscreenTexture(GL gl) { + void renderOffscreenTexture(final GL gl) { if(!readBufferUtil.isValid()) return; // Now draw one quad with the texture @@ -152,15 +154,15 @@ public class ReadBuffer2Screen extends ReadBufferBase { readBufferUtil.getTexture().disable(gl); } - void updateTextureCoords(GL gl, boolean force) { + void updateTextureCoords(final GL gl, final boolean force) { if(force || null==readTextureCoords) { - readTextureCoords = GLArrayDataServer.createFixed(GLPointerFunc.GL_TEXTURE_COORD_ARRAY, 2, + readTextureCoords = GLArrayDataServer.createFixed(GLPointerFunc.GL_TEXTURE_COORD_ARRAY, 2, GL.GL_FLOAT, true, 4, GL.GL_STATIC_DRAW); readTextureCoords.setEnableAlways(enableBufferAlways); readTextureCoords.setVBOEnabled(enableBufferVBO); { - TextureCoords coords = readBufferUtil.getTexture().getImageTexCoords(); - FloatBuffer cb = (FloatBuffer)readTextureCoords.getBuffer(); + final TextureCoords coords = readBufferUtil.getTexture().getImageTexCoords(); + final FloatBuffer cb = (FloatBuffer)readTextureCoords.getBuffer(); cb.put(coords.left()); cb.put(coords.bottom()); cb.put(coords.right()); cb.put(coords.bottom()); cb.put(coords.left()); cb.put(coords.top()); @@ -172,12 +174,12 @@ public class ReadBuffer2Screen extends ReadBufferBase { } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { super.display(drawable); - GL gl = drawable.getGL(); + final GL gl = drawable.getGL(); - gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT); + gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); if(gl instanceof GLLightingFunc) { ((GLLightingFunc)gl).glColor4f(1.0f, 1.0f, 1.0f, 1.0f); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBufferBase.java b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBufferBase.java index f8e064a4e..e834775fc 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBufferBase.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/ReadBufferBase.java @@ -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.offscreen; import javax.media.opengl.*; @@ -40,12 +40,12 @@ public class ReadBufferBase implements GLEventListener { GLReadBufferUtil readBufferUtil; - public ReadBufferBase (GLDrawable externalRead, boolean write2Texture) { + public ReadBufferBase (final GLDrawable externalRead, final boolean write2Texture) { this.externalRead = externalRead ; this.readBufferUtil = new GLReadBufferUtil(false, write2Texture); } - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { GL _gl = drawable.getGL(); _gl.glGetError(); // flush error .. @@ -53,7 +53,7 @@ public class ReadBufferBase implements GLEventListener { if(glDebug) { try { _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, _gl, null) ); - } catch (Exception e) { + } catch (final Exception e) { throw new RuntimeException("can not set debug pipeline", e); } } @@ -61,7 +61,7 @@ public class ReadBufferBase implements GLEventListener { if(glTrace) { try { _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, _gl, new Object[] { System.err } ) ); - } catch (Exception e) { + } catch (final Exception e) { throw new RuntimeException("can not set trace pipeline", e); } } @@ -77,14 +77,14 @@ public class ReadBufferBase implements GLEventListener { System.out.println("---------------------------"); } - 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 dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { readBufferUtil.dispose(drawable.getGL()); } - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { readBufferUtil.readPixels(drawable.getGL(), false); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/Surface2File.java b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/Surface2File.java index 974e32289..5c2e80170 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/Surface2File.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/Surface2File.java @@ -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.offscreen; import javax.media.opengl.*; @@ -46,29 +46,29 @@ public class Surface2File implements SurfaceUpdatedListener { final GLReadBufferUtil readBufferUtil; int shotNum = 0; - public Surface2File(String filename, boolean alpha) { + public Surface2File(final String filename, final boolean alpha) { this.filename = filename; - this.alpha = alpha; + this.alpha = alpha; this.readBufferUtil = new GLReadBufferUtil(alpha, false); } - - public void dispose(GL gl) { + + public void dispose(final GL gl) { readBufferUtil.dispose(gl); } - public void surfaceUpdated(Object updater, NativeSurface ns, long when) { + public void surfaceUpdated(final Object updater, final NativeSurface ns, final long when) { if (updater instanceof GLDrawable) { - GLDrawable drawable = (GLDrawable) updater; - GLContext ctx = GLContext.getCurrent(); + final GLDrawable drawable = (GLDrawable) updater; + final GLContext ctx = GLContext.getCurrent(); if (null != ctx && ctx.getGLDrawable() == drawable) { - GL gl = ctx.getGL(); + final GL gl = ctx.getGL(); // FIXME glFinish() is an expensive paranoia sync, should not be necessary due to spec gl.glFinish(); if(readBufferUtil.readPixels(gl, false)) { gl.glFinish(); try { surface2File(); - } catch (IOException ex) { + } catch (final IOException ex) { throw new RuntimeException("can not write survace to file", ex); } } @@ -85,7 +85,7 @@ public class Surface2File implements SurfaceUpdatedListener { final String pfmt = alpha ? "rgba" : "rgb_" ; new PrintWriter(sw).printf("%s-I_%s-%04d.png", filename, pfmt, shotNum); } - File file = new File(sw.toString()); + final File file = new File(sw.toString()); readBufferUtil.write(file); shotNum++; } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen01GLPBufferNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen01GLPBufferNEWT.java index 3f0dae6b0..78224de49 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen01GLPBufferNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen01GLPBufferNEWT.java @@ -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.offscreen; import com.jogamp.newt.Display; @@ -72,22 +72,22 @@ public class TestOffscreen01GLPBufferNEWT extends UITestCase { public void init() { capsDefault = new GLCapabilities(glpDefault); Assert.assertNotNull(capsDefault); - capsDefault.setAlphaBits(1); // req. alpha channel + capsDefault.setAlphaBits(1); // req. alpha channel } - private void do01OffscreenWindowPBuffer(GLCapabilities caps) { - Display display = NewtFactory.createDisplay(null); // local display + private void do01OffscreenWindowPBuffer(final GLCapabilities caps) { + 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); - GLWindow glWindow = GLWindow.create(window); + final GLWindow glWindow = GLWindow.create(window); Assert.assertNotNull(glWindow); glWindow.setVisible(true); - GLEventListener demo = new RedSquareES2(); + final GLEventListener demo = new RedSquareES2(); WindowUtilNEWT.setDemoFields(demo, window, glWindow, false); glWindow.addGLEventListener(demo); @@ -115,7 +115,7 @@ public class TestOffscreen01GLPBufferNEWT extends UITestCase { System.out.println("WARNING: PBuffer not supported on this platform - cannot test"); return; } - GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false); + final GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false); do01OffscreenWindowPBuffer(caps2); } @@ -125,7 +125,7 @@ public class TestOffscreen01GLPBufferNEWT extends UITestCase { System.out.println("WARNING: PBuffer not supported on this platform - cannot test"); return; } - GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false); + final GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false); caps2.setStencilBits(8); do01OffscreenWindowPBuffer(caps2); } @@ -136,7 +136,7 @@ public class TestOffscreen01GLPBufferNEWT extends UITestCase { System.out.println("WARNING: PBuffer not supported on this platform - cannot test"); return; } - GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false); + final GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false); caps2.setStencilBits(8); caps2.setAlphaBits(8); do01OffscreenWindowPBuffer(caps2); @@ -148,7 +148,7 @@ public class TestOffscreen01GLPBufferNEWT extends UITestCase { System.out.println("WARNING: PBuffer not supported on this platform - cannot test"); return; } - GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false); + final GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false); caps2.setRedBits(5); caps2.setGreenBits(5); caps2.setBlueBits(5); @@ -161,15 +161,16 @@ public class TestOffscreen01GLPBufferNEWT extends UITestCase { System.out.println("WARNING: PBuffer not supported on this platform - cannot test"); return; } - GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false); - int winnum = 3, i; - Window windows[] = new Window[winnum]; - GLWindow glWindows[] = new GLWindow[winnum]; - GLEventListener demos[] = new GLEventListener[winnum]; + final GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false); + final int winnum = 3; + int i; + final Window windows[] = new Window[winnum]; + final GLWindow glWindows[] = new GLWindow[winnum]; + final GLEventListener demos[] = new GLEventListener[winnum]; - 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); for(i=0; i<winnum; i++) { @@ -214,13 +215,14 @@ public class TestOffscreen01GLPBufferNEWT extends UITestCase { System.out.println("WARNING: PBuffer not supported on this platform - cannot test"); return; } - GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false); - int winnum = 3, i; - Display displays[] = new Display[winnum]; - Screen screens[] = new Screen[winnum]; - Window windows[] = new Window[winnum]; - GLWindow glWindows[] = new GLWindow[winnum]; - GLEventListener demos[] = new GLEventListener[winnum]; + final GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false); + final int winnum = 3; + int i; + final Display displays[] = new Display[winnum]; + final Screen screens[] = new Screen[winnum]; + final Window windows[] = new Window[winnum]; + final GLWindow glWindows[] = new GLWindow[winnum]; + final GLEventListener demos[] = new GLEventListener[winnum]; for(i=0; i<winnum; i++) { System.out.println("Create Window "+i); @@ -267,21 +269,21 @@ public class TestOffscreen01GLPBufferNEWT extends UITestCase { System.out.println("WARNING: PBuffer not supported on this platform - cannot test"); return; } - GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false); + final GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false); System.out.println("Create Window 1"); - 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, caps2); + final Window window = NewtFactory.createWindow(screen, caps2); Assert.assertNotNull(window); window.setSize(width, height); - GLWindow glWindow = GLWindow.create(window); + final GLWindow glWindow = GLWindow.create(window); Assert.assertNotNull(glWindow); glWindow.setVisible(true); - WindowUtilNEWT.run(getSimpleTestName("."), glWindow, new RedSquareES2(), null, null, null, null, + WindowUtilNEWT.run(getSimpleTestName("."), glWindow, new RedSquareES2(), null, null, null, null, 2 /* frames */, true /*snapshot*/, false /*debug*/); if(null!=glWindow) { @@ -298,8 +300,8 @@ public class TestOffscreen01GLPBufferNEWT extends UITestCase { } } - public static void main(String args[]) throws IOException { - String tstname = TestOffscreen01GLPBufferNEWT.class.getName(); + public static void main(final String args[]) throws IOException { + final String tstname = TestOffscreen01GLPBufferNEWT.class.getName(); org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { tstname, "filtertrace=true", diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen02BitmapNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen02BitmapNEWT.java index 72cb7a512..2202b754c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen02BitmapNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/TestOffscreen02BitmapNEWT.java @@ -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.offscreen; @@ -46,8 +46,8 @@ import com.jogamp.opengl.test.junit.jogl.demos.es1.RedSquareES1; import java.io.IOException; /** - * Using ES1 GL demo, since pixmap might not be hw accelerated, - * hence it is possible to not have GLSL. + * Using ES1 GL demo, since pixmap might not be hw accelerated, + * hence it is possible to not have GLSL. */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestOffscreen02BitmapNEWT extends UITestCase { @@ -55,27 +55,27 @@ public class TestOffscreen02BitmapNEWT extends UITestCase { @Test public void test11OffscreenWindowPixmap() { - // we need to stay w/ generic profile GL2ES1 - // since software rasterizer might be required (pixmap/bitmap) - GLProfile glp = GLProfile.get(GLProfile.GL2ES1); + // we need to stay w/ generic profile GL2ES1 + // since software rasterizer might be required (pixmap/bitmap) + final GLProfile glp = GLProfile.get(GLProfile.GL2ES1); Assert.assertNotNull(glp); - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); - GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, false, false); + final GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, false, false); - 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, caps2); + final Window window = NewtFactory.createWindow(screen, caps2); Assert.assertNotNull(window); window.setSize(width, height); - GLWindow glWindow = GLWindow.create(window); + final GLWindow glWindow = GLWindow.create(window); Assert.assertNotNull(glWindow); glWindow.setVisible(true); - GLEventListener demo = new RedSquareES1(); + final GLEventListener demo = new RedSquareES1(); WindowUtilNEWT.setDemoFields(demo, window, glWindow, false); glWindow.addGLEventListener(demo); @@ -99,27 +99,27 @@ public class TestOffscreen02BitmapNEWT extends UITestCase { @Test public void test14OffscreenSnapshotWithDemoPixmap() { - // we need to stay w/ generic profile GL2ES1 - // since software rasterizer might be required (pixmap/bitmap) - GLProfile glp = GLProfile.get(GLProfile.GL2ES1); + // we need to stay w/ generic profile GL2ES1 + // since software rasterizer might be required (pixmap/bitmap) + final GLProfile glp = GLProfile.get(GLProfile.GL2ES1); Assert.assertNotNull(glp); - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); - GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, false, false); + final GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, false, false); - 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, caps2); + final Window window = NewtFactory.createWindow(screen, caps2); Assert.assertNotNull(window); window.setSize(width, height); - GLWindow glWindow = GLWindow.create(window); + final GLWindow glWindow = GLWindow.create(window); Assert.assertNotNull(glWindow); glWindow.setVisible(true); - WindowUtilNEWT.run(getSimpleTestName("."), glWindow, new RedSquareES1(), null, null, null, null, + WindowUtilNEWT.run(getSimpleTestName("."), glWindow, new RedSquareES1(), null, null, null, null, 2 /* frames */, true /*snapshot*/, false /*debug*/); if(null!=glWindow) { @@ -135,8 +135,8 @@ public class TestOffscreen02BitmapNEWT extends UITestCase { display.destroy(); } } - public static void main(String args[]) throws IOException { - String tstname = TestOffscreen02BitmapNEWT.class.getName(); + public static void main(final String args[]) throws IOException { + final String tstname = TestOffscreen02BitmapNEWT.class.getName(); org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { tstname, "filtertrace=true", diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/WindowUtilNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/WindowUtilNEWT.java index efca752a1..9e66a614e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/WindowUtilNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/offscreen/WindowUtilNEWT.java @@ -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.offscreen; import com.jogamp.opengl.test.junit.util.*; @@ -40,15 +40,15 @@ import com.jogamp.newt.opengl.*; public class WindowUtilNEWT { - public static GLCapabilities fixCaps(GLCapabilities caps, boolean onscreen, boolean pbuffer, boolean undecorated) { - GLCapabilities caps2 = (GLCapabilities) caps.cloneMutable(); + public static GLCapabilities fixCaps(final GLCapabilities caps, final boolean onscreen, final boolean pbuffer, final boolean undecorated) { + final GLCapabilities caps2 = (GLCapabilities) caps.cloneMutable(); caps2.setOnscreen(onscreen); caps2.setPBuffer(!onscreen && pbuffer); caps2.setDoubleBuffered(!onscreen); return caps2; } - 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) { @@ -60,9 +60,9 @@ public class WindowUtilNEWT { } } - public static void run(String testName, GLWindow windowOffScreen, GLEventListener demo, - GLWindow windowOnScreenBlit, WindowListener wl, MouseListener ml, - SurfaceUpdatedListener ul, int frames, boolean snapshot, boolean debug) { + public static void run(final String testName, final GLWindow windowOffScreen, final GLEventListener demo, + final GLWindow windowOnScreenBlit, final WindowListener wl, final MouseListener ml, + final SurfaceUpdatedListener ul, final int frames, final boolean snapshot, final boolean debug) { Assert.assertNotNull(windowOffScreen); Assert.assertNotNull(demo); @@ -79,14 +79,14 @@ public class WindowUtilNEWT { windowOnScreenBlit.setVisible(true); } - GLDrawable readDrawable = windowOffScreen.getContext().getGLDrawable() ; + final GLDrawable readDrawable = windowOffScreen.getContext().getGLDrawable() ; if ( null != windowOnScreenBlit ) { - ReadBuffer2Screen readDemo = new ReadBuffer2Screen( readDrawable ) ; + final ReadBuffer2Screen readDemo = new ReadBuffer2Screen( readDrawable ) ; windowOnScreenBlit.addGLEventListener(readDemo); } if(snapshot) { final boolean alpha = windowOffScreen.getChosenGLCapabilities().getAlphaBits()>0; - 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<args.length; i++) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/stereo/ovr/OVRDemo01.java b/src/test/com/jogamp/opengl/test/junit/jogl/stereo/ovr/OVRDemo01.java index bfd660556..1cc07ec22 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/stereo/ovr/OVRDemo01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/stereo/ovr/OVRDemo01.java @@ -49,6 +49,7 @@ import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.QuitAdapter; import com.jogamp.opengl.util.Animator; +import com.jogamp.opengl.util.AnimatorBase; /** * All distortions, no multisampling, bilinear filtering, manual-swap and using two FBOs (default, good) @@ -177,7 +178,7 @@ public class OVRDemo01 { final Animator animator = useAnimator ? new Animator() : null; if( useAnimator ) { - animator.setModeBits(false, Animator.MODE_EXPECT_AWT_RENDERING_THREAD); + animator.setModeBits(false, AnimatorBase.MODE_EXPECT_AWT_RENDERING_THREAD); animator.setExclusiveContext(exclusiveContext); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashForm.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashForm.java index 36c672179..e6cb48764 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashForm.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashForm.java @@ -44,6 +44,7 @@ import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.util.QuitAdapter; import com.jogamp.opengl.util.Animator; +import com.jogamp.opengl.util.AnimatorBase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import javax.media.nativewindow.util.Dimension; @@ -136,7 +137,7 @@ public class TestBug672NewtCanvasSWTSashForm extends UITestCase { display.dispose(); }}); } - catch( Throwable throwable ) { + catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -150,7 +151,7 @@ public class TestBug672NewtCanvasSWTSashForm extends UITestCase { class WaitAction implements Runnable { private final long sleepMS; - WaitAction(long sleepMS) { + WaitAction(final long sleepMS) { this.sleepMS = sleepMS; } public void run() { @@ -158,41 +159,41 @@ public class TestBug672NewtCanvasSWTSashForm extends UITestCase { // blocks on linux .. display.sleep(); try { Thread.sleep(sleepMS); - } catch (InterruptedException e) { } + } catch (final InterruptedException e) { } } } } final WaitAction awtRobotWaitAction = new WaitAction(AWTRobotUtil.TIME_SLICE); final WaitAction generalWaitAction = new WaitAction(10); - protected void runTestGL(GLCapabilitiesImmutable caps) throws InterruptedException, InvocationTargetException { - com.jogamp.newt.Screen screen = NewtFactory.createScreen(swtNewtDisplay, screenIdx); + protected void runTestGL(final GLCapabilitiesImmutable caps) throws InterruptedException, InvocationTargetException { + final com.jogamp.newt.Screen screen = NewtFactory.createScreen(swtNewtDisplay, screenIdx); final GLWindow glWindow = GLWindow.create(screen, caps); Assert.assertNotNull(glWindow); final GearsES2 demo = new GearsES2(1); glWindow.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); - QuitAdapter quitAdapter = new QuitAdapter(); + final QuitAdapter quitAdapter = new QuitAdapter(); //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter)); //glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter)); glWindow.addKeyListener(quitAdapter); glWindow.addWindowListener(quitAdapter); glWindow.addWindowListener(new WindowAdapter() { - public void windowResized(WindowEvent e) { + public void windowResized(final WindowEvent e) { System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } - public void windowMoved(WindowEvent e) { + public void windowMoved(final WindowEvent e) { System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } }); glWindow.addKeyListener(new KeyAdapter() { - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { if( !e.isPrintableKey() || e.isAutoRepeat() ) { return; } @@ -281,7 +282,7 @@ public class TestBug672NewtCanvasSWTSashForm extends UITestCase { runTestGL(caps); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { int x=0, y=0, w=640, h=480, rw=-1, rh=-1; boolean usePos = false; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashFormComposite.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashFormComposite.java index 9ad6e1f5c..944fa1071 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashFormComposite.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashFormComposite.java @@ -44,6 +44,7 @@ import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.util.QuitAdapter; import com.jogamp.opengl.util.Animator; +import com.jogamp.opengl.util.AnimatorBase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import javax.media.nativewindow.util.Dimension; @@ -142,7 +143,7 @@ public class TestBug672NewtCanvasSWTSashFormComposite extends UITestCase { display.dispose(); }}); } - catch( Throwable throwable ) { + catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -157,7 +158,7 @@ public class TestBug672NewtCanvasSWTSashFormComposite extends UITestCase { class WaitAction implements Runnable { private final long sleepMS; - WaitAction(long sleepMS) { + WaitAction(final long sleepMS) { this.sleepMS = sleepMS; } public void run() { @@ -165,41 +166,41 @@ public class TestBug672NewtCanvasSWTSashFormComposite extends UITestCase { // blocks on linux .. display.sleep(); try { Thread.sleep(sleepMS); - } catch (InterruptedException e) { } + } catch (final InterruptedException e) { } } } } final WaitAction awtRobotWaitAction = new WaitAction(AWTRobotUtil.TIME_SLICE); final WaitAction generalWaitAction = new WaitAction(10); - protected void runTestGL(GLCapabilitiesImmutable caps) throws InterruptedException, InvocationTargetException { - com.jogamp.newt.Screen screen = NewtFactory.createScreen(swtNewtDisplay, screenIdx); + protected void runTestGL(final GLCapabilitiesImmutable caps) throws InterruptedException, InvocationTargetException { + final com.jogamp.newt.Screen screen = NewtFactory.createScreen(swtNewtDisplay, screenIdx); final GLWindow glWindow = GLWindow.create(screen, caps); Assert.assertNotNull(glWindow); final GearsES2 demo = new GearsES2(1); glWindow.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); - QuitAdapter quitAdapter = new QuitAdapter(); + final QuitAdapter quitAdapter = new QuitAdapter(); //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter)); //glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter)); glWindow.addKeyListener(quitAdapter); glWindow.addWindowListener(quitAdapter); glWindow.addWindowListener(new WindowAdapter() { - public void windowResized(WindowEvent e) { + public void windowResized(final WindowEvent e) { System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } - public void windowMoved(WindowEvent e) { + public void windowMoved(final WindowEvent e) { System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } }); glWindow.addKeyListener(new KeyAdapter() { - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { if( !e.isPrintableKey() || e.isAutoRepeat() ) { return; } @@ -288,7 +289,7 @@ public class TestBug672NewtCanvasSWTSashFormComposite extends UITestCase { runTestGL(caps); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { int x=0, y=0, w=640, h=480, rw=-1, rh=-1; boolean usePos = false; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java index be3a11bfc..fb563f955 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java @@ -49,6 +49,7 @@ import javax.media.opengl.GLAutoDrawable ; import javax.media.opengl.GLCapabilities ; import javax.media.opengl.GLEventListener ; import javax.media.opengl.GLProfile; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.nativewindow.swt.SWTAccessor; import com.jogamp.newt.NewtFactory; @@ -72,9 +73,9 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase { { float r = 0f, g = 0f, b = 0f; - public void init( GLAutoDrawable drawable ) + public void init( final GLAutoDrawable drawable ) { - GL2 gl = drawable.getGL().getGL2() ; + final GL2 gl = drawable.getGL().getGL2() ; gl.glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ) ; @@ -83,32 +84,32 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase { gl.glBlendFunc( GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA ) ; } - public void reshape( GLAutoDrawable drawable, int x, int y, int width, int height ) + public void reshape( final GLAutoDrawable drawable, final int x, final int y, final int width, final int height ) { // System.err.println( ">>>>>>>> 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<args.length; i++) { if(args[i].equals("-time")) { duration = MiscUtils.atoi(args[++i], duration); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java index 5426ab7af..380bd3f7d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java @@ -128,7 +128,7 @@ public class TestNewtCanvasSWTGLn extends UITestCase { display.dispose(); }}); } - catch( Throwable throwable ) { + catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -141,7 +141,7 @@ public class TestNewtCanvasSWTGLn extends UITestCase { class WaitAction implements Runnable { private final long sleepMS; - WaitAction(long sleepMS) { + WaitAction(final long sleepMS) { this.sleepMS = sleepMS; } public void run() { @@ -149,15 +149,15 @@ public class TestNewtCanvasSWTGLn extends UITestCase { // blocks on linux .. display.sleep(); try { Thread.sleep(sleepMS); - } catch (InterruptedException e) { } + } catch (final InterruptedException e) { } } } } final WaitAction awtRobotWaitAction = new WaitAction(AWTRobotUtil.TIME_SLICE); final WaitAction generalWaitAction = new WaitAction(10); - protected void runTestAGL( GLCapabilitiesImmutable caps, GLEventListener demo, - boolean postAttach, boolean useAnimator ) throws InterruptedException { + protected void runTestAGL( final GLCapabilitiesImmutable caps, final GLEventListener demo, + final boolean postAttach, final boolean useAnimator ) throws InterruptedException { final GLReadBufferUtil screenshot = new GLReadBufferUtil(false, false); final Screen screen = NewtFactory.createScreen(swtNewtDisplay, 0); @@ -209,13 +209,13 @@ public class TestNewtCanvasSWTGLn extends UITestCase { anim = null; } - long lStartTime = System.currentTimeMillis(); - long lEndTime = lStartTime + duration; + final long lStartTime = System.currentTimeMillis(); + final long lEndTime = lStartTime + duration; try { while( (System.currentTimeMillis() < lEndTime) && !canvas1.isDisposed() ) { generalWaitAction.run(); } - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -243,13 +243,13 @@ public class TestNewtCanvasSWTGLn extends UITestCase { @Test public void test_MultisampleAndAlpha() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2()); + final GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2()); caps.setSampleBuffers(true); caps.setNumSamples(2); runTestAGL( caps, new MultisampleDemoES2(true), false /* postAttach */, false /* animator */); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { duration = MiscUtils.atoi(args[++i], duration); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java index 906dbc879..f18e10bb1 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java @@ -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. @@ -85,7 +85,7 @@ public class TestSWTAccessor03AWTGLn extends UITestCase { UITestCase.setTestSupported(false); return; } - System.out.println( "GLProfile " + GLProfile.glAvailabilityToString() ); + System.out.println( "GLProfile " + GLProfile.glAvailabilityToString() ); final Frame f0 = new Frame("Test - AWT 1st"); f0.add(new java.awt.Label("AWT was here 1st")); try { @@ -94,7 +94,7 @@ public class TestSWTAccessor03AWTGLn extends UITestCase { f0.pack(); f0.setVisible(true); }}); - } catch (Exception e) { + } catch (final Exception e) { throw new RuntimeException(e); } if(!GLProfile.isAvailable(GLProfile.GL2)) { @@ -104,7 +104,7 @@ public class TestSWTAccessor03AWTGLn extends UITestCase { protected void init() throws InterruptedException, InvocationTargetException { SWTAccessor.invoke(true, new Runnable() { - public void run() { + public void run() { display = new Display(); Assert.assertNotNull( display ); shell = new Shell( display ); @@ -135,7 +135,7 @@ public class TestSWTAccessor03AWTGLn extends UITestCase { // Deadlocks Java7 on Windows // javax.swing.SwingUtilities.invokeAndWait( releaseAWT ); releaseAWT.run(); - + SWTAccessor.invoke(true, new Runnable() { public void run() { composite.dispose(); @@ -148,47 +148,47 @@ public class TestSWTAccessor03AWTGLn extends UITestCase { }}); } - protected void runTestGL( GLProfile glprofile ) throws InterruptedException, InvocationTargetException { + protected void runTestGL( final GLProfile glprofile ) throws InterruptedException, InvocationTargetException { init(); try { - GLCapabilities glcapabilities = new GLCapabilities( glprofile ); + final GLCapabilities glcapabilities = new GLCapabilities( glprofile ); glcanvas = new GLCanvas( glcapabilities ); Assert.assertNotNull( glcanvas ); frame.add( glcanvas ); - + glcanvas.addGLEventListener( new GLEventListener() { /* @Override */ - public void init( GLAutoDrawable glautodrawable ) { + public void init( final GLAutoDrawable glautodrawable ) { } - + /* @Override */ - public void dispose( GLAutoDrawable glautodrawable ) { + public void dispose( final GLAutoDrawable glautodrawable ) { } - + /* @Override */ - public void display( GLAutoDrawable glautodrawable ) { - Rectangle rectangle = new Rectangle( 0, 0, glautodrawable.getSurfaceWidth(), glautodrawable.getSurfaceHeight() ); - GL2ES1 gl = glautodrawable.getGL().getGL2ES1(); + public void display( final GLAutoDrawable glautodrawable ) { + final Rectangle rectangle = new Rectangle( 0, 0, glautodrawable.getSurfaceWidth(), glautodrawable.getSurfaceHeight() ); + final GL2ES1 gl = glautodrawable.getGL().getGL2ES1(); OneTriangle.render( gl, rectangle.width, rectangle.height ); } - + /* @Override */ - public void reshape( GLAutoDrawable glautodrawable, int x, int y, int width, int height ) { - Rectangle rectangle = new Rectangle( 0, 0, glautodrawable.getSurfaceWidth(), glautodrawable.getSurfaceHeight() ); - GL2ES1 gl = glautodrawable.getGL().getGL2ES1(); + public void reshape( final GLAutoDrawable glautodrawable, final int x, final int y, final int width, final int height ) { + final Rectangle rectangle = new Rectangle( 0, 0, glautodrawable.getSurfaceWidth(), glautodrawable.getSurfaceHeight() ); + final GL2ES1 gl = glautodrawable.getGL().getGL2ES1(); OneTriangle.setup( gl, rectangle.width, rectangle.height ); } }); - + SWTAccessor.invoke(true, new Runnable() { public void run() { 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) && !composite.isDisposed() ) { SWTAccessor.invoke(true, new Runnable() { @@ -197,12 +197,12 @@ public class TestSWTAccessor03AWTGLn extends UITestCase { // blocks on linux .. display.sleep(); try { Thread.sleep(10); - } catch (InterruptedException e) { } + } catch (final InterruptedException e) { } } }}); } } - catch( Throwable throwable ) { + catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -213,11 +213,11 @@ public class TestSWTAccessor03AWTGLn extends UITestCase { @Test public void test() throws InterruptedException, InvocationTargetException { - GLProfile glprofile = GLProfile.getGL2ES1(); + final GLProfile glprofile = GLProfile.getGL2ES1(); runTestGL( glprofile ); } - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { duration = MiscUtils.atoi(args[++i], duration); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTBug643AsyncExec.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTBug643AsyncExec.java index fd6d370ac..7b64838cc 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTBug643AsyncExec.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTBug643AsyncExec.java @@ -116,7 +116,7 @@ public class TestSWTBug643AsyncExec extends UITestCase { private final jogamp.newt.DisplayImpl newtDisplay; private int swtN, newtN ; - public AsyncExecEDTFeederThread( Display swtDisplay, com.jogamp.newt.Display newtDisplay ) + public AsyncExecEDTFeederThread( final Display swtDisplay, final com.jogamp.newt.Display newtDisplay ) { super(); this.swtDisplay = swtDisplay ; @@ -153,7 +153,7 @@ public class TestSWTBug643AsyncExec extends UITestCase { newtDisplay.runOnEDTIfAvail(false, newtAsyncAction); } Thread.sleep( 50L ) ; - } catch( InterruptedException e ) { + } catch( final InterruptedException e ) { break ; } } @@ -203,7 +203,7 @@ public class TestSWTBug643AsyncExec extends UITestCase { display.dispose(); }}); } - catch( Throwable throwable ) { + catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -213,7 +213,7 @@ public class TestSWTBug643AsyncExec extends UITestCase { } } - private void testImpl(boolean useJOGLGLCanvas, boolean useNewtCanvasSWT, boolean glWindowPreVisible) throws InterruptedException, InvocationTargetException { + private void testImpl(final boolean useJOGLGLCanvas, final boolean useNewtCanvasSWT, final boolean glWindowPreVisible) throws InterruptedException, InvocationTargetException { resetSWTAndNEWTEDTCounter(); final SWT_DSC dsc = new SWT_DSC(); @@ -235,7 +235,7 @@ public class TestSWTBug643AsyncExec extends UITestCase { newtDisplay = null; } else if( useNewtCanvasSWT ) { newtDisplay = NewtFactory.createDisplay(null, false); // no-reuse - com.jogamp.newt.Screen screen = NewtFactory.createScreen(newtDisplay, 0); + final com.jogamp.newt.Screen screen = NewtFactory.createScreen(newtDisplay, 0); final GLWindow glWindow = GLWindow.create( screen, caps ) ; glWindow.addGLEventListener( new GearsES2() ) ; if( glWindowPreVisible ) { @@ -250,7 +250,7 @@ public class TestSWTBug643AsyncExec extends UITestCase { throw new InternalError("XXX"); } if(useAnimator) { - Animator animator = new Animator(glad); + final Animator animator = new Animator(glad); animator.start(); } } @@ -280,7 +280,7 @@ public class TestSWTBug643AsyncExec extends UITestCase { public void run() { try { Thread.sleep(duration); - } catch (InterruptedException e) {} + } catch (final InterruptedException e) {} counterBeforeExit[0] = getSWTCount(); counterBeforeExit[1] = getNEWTCount(); @@ -288,7 +288,7 @@ public class TestSWTBug643AsyncExec extends UITestCase { try { asyncExecFeeder.join(); - } catch( InterruptedException e ) { } + } catch( final InterruptedException e ) { } shallStop = true; dsc.display.wake(); } } ); @@ -304,7 +304,7 @@ public class TestSWTBug643AsyncExec extends UITestCase { Thread.sleep(10); } } - } catch (Exception e0) { + } catch (final Exception e0) { e0.printStackTrace(); Assert.assertTrue("Deadlock @ dispatch: "+e0, false); } @@ -335,7 +335,7 @@ public class TestSWTBug643AsyncExec extends UITestCase { testImpl(false /* useJOGLGLCanvas */, true /* useNewtCanvasSWT */, true /* glWindowPreVisible */); } - public static void main( String[] args ) { + public static void main( final String[] args ) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { duration = MiscUtils.atoi(args[++i], duration); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTEclipseGLCanvas01GLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTEclipseGLCanvas01GLn.java index b0acbedc2..69911c599 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTEclipseGLCanvas01GLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTEclipseGLCanvas01GLn.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.swt; import javax.media.opengl.GL2ES1; @@ -61,7 +61,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase; /** * Tests that a basic SWT app can open without crashing under different GL profiles. - * <p> + * <p> * Uses the SWT GLCanvas <code>org.eclipse.swt.opengl.GLCanvas</code>. * </p> * @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<args.length; i++) { if(args[i].equals("-time")) { duration = atoi(args[++i]); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTJOGLGLCanvas01GLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTJOGLGLCanvas01GLn.java index b38bf0c2c..04ffdcb1c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTJOGLGLCanvas01GLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTJOGLGLCanvas01GLn.java @@ -123,7 +123,7 @@ public class TestSWTJOGLGLCanvas01GLn extends UITestCase { display.dispose(); }}); } - catch( Throwable throwable ) { + catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -132,7 +132,7 @@ public class TestSWTJOGLGLCanvas01GLn extends UITestCase { composite = null; } - protected void runTestAGL( GLCapabilitiesImmutable caps, GLEventListener demo ) throws InterruptedException { + protected void runTestAGL( final GLCapabilitiesImmutable caps, final GLEventListener demo ) throws InterruptedException { final GLReadBufferUtil screenshot = new GLReadBufferUtil(false, false); final GLCanvas canvas = GLCanvas.create( composite, 0, caps, null); @@ -158,14 +158,14 @@ public class TestSWTJOGLGLCanvas01GLn extends UITestCase { shell.open(); } } ); - Animator anim = new Animator(); + final Animator anim = new Animator(); if(doAnimation) { anim.add(canvas); anim.start(); } - long lStartTime = System.currentTimeMillis(); - long lEndTime = lStartTime + duration; + final long lStartTime = System.currentTimeMillis(); + final long lEndTime = lStartTime + duration; try { while( (System.currentTimeMillis() < lEndTime) && !canvas.isDisposed() ) { if( !display.readAndDispatch() ) { @@ -173,7 +173,7 @@ public class TestSWTJOGLGLCanvas01GLn extends UITestCase { Thread.sleep(10); } } - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -193,21 +193,21 @@ public class TestSWTJOGLGLCanvas01GLn extends UITestCase { @Test public void test_MultisampleAndAlpha() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2()); + final GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2()); caps.setSampleBuffers(true); caps.setNumSamples(2); runTestAGL( caps, new MultisampleDemoES2(true) ); } - 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<args.length; i++) { if(args[i].equals("-time")) { duration = atoi(args[++i]); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/OffscreenPrintable.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/OffscreenPrintable.java index 78fdde3ee..a59662bd2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/OffscreenPrintable.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/OffscreenPrintable.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. @@ -50,7 +50,7 @@ import com.jogamp.opengl.util.TileRenderer; /** * {@link Printable} implementation using NIO {@link DirectDataBufferInt} {@link BufferedImage} * for offscreen rendered printing. - * + * * @see OnscreenPrintable * @see PrintableBase */ @@ -58,30 +58,30 @@ public class OffscreenPrintable extends PrintableBase implements Printable { public final int imageType; public final String pngFilename; - + /** - * + * * @param job * @param printContainer * @param printDPI * @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples * @param tileWidth custom tile width for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default. * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default. - * @param imageType AWT BufferedImage type (must be one of the integer types) + * @param 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. - * + * * <h5>Virtual printer driver</h5> * <p> * Note, on OSX you might need to setup a dummy printer, i.e. <i>print to file</i>.<br> @@ -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<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } org.junit.runner.JUnitCore.main(TestRandomTiledRendering2GL2NEWT.class.getName()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java index 74ef0713a..b128f8691 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java @@ -92,7 +92,7 @@ public class TestRandomTiledRendering3GL2AWT 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); if( msaaCount > 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<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } org.junit.runner.JUnitCore.main(TestRandomTiledRendering3GL2AWT.class.getName()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java index dd8a306cc..87f1f3e7d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java @@ -91,7 +91,7 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase { public static void releaseClass() { } - protected void runTestGL(GLCapabilities caps) throws InterruptedException, InvocationTargetException { + protected void runTestGL(final GLCapabilities caps) throws InterruptedException, InvocationTargetException { final Dimension glc_sz = new Dimension(width/2, height); final GLCanvas glCanvas1 = new GLCanvas(caps); Assert.assertNotNull(glCanvas1); @@ -115,15 +115,15 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase { Assert.assertNotNull(frame); final ActionListener print72DPIAction = new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { doPrintManual(frame, 72, 0, -1, -1); } }; final ActionListener print300DPIAction = new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { doPrintManual(frame, 300, -1, -1, -1); } }; final ActionListener print600DPIAction = new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { doPrintManual(frame, 600, -1, -1, -1); } }; final Button print72DPIButton = new Button("72dpi"); @@ -134,15 +134,15 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase { print600DPIButton.addActionListener(print600DPIAction); frame.setLayout(new BorderLayout()); - Panel printPanel = new Panel(); + final Panel printPanel = new Panel(); printPanel.add(print72DPIButton); printPanel.add(print300DPIButton); printPanel.add(print600DPIButton); - Panel southPanel = new Panel(); + final Panel southPanel = new Panel(); southPanel.add(new Label("South")); - Panel eastPanel = new Panel(); + final Panel eastPanel = new Panel(); eastPanel.add(new Label("East")); - Panel westPanel = new Panel(); + final Panel westPanel = new Panel(); westPanel.add(new Label("West")); frame.add(printPanel, BorderLayout.NORTH); frame.add(demoPanel, BorderLayout.CENTER); @@ -151,7 +151,7 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase { frame.add(westPanel, BorderLayout.WEST); frame.setTitle("Tiles AWT Print Test"); - Animator animator = new Animator(); + final Animator animator = new Animator(); animator.add(glCanvas1); animator.add(glCanvas2); @@ -240,13 +240,13 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase { @Test public void test01_aa0() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps); } @Test public void test02_aa8() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setSampleBuffers(true); caps.setNumSamples(8); runTestGL(caps); @@ -254,13 +254,13 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase { static long duration = 500; // ms - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } else if(args[i].equals("-600dpi")) { allow600dpi = true; } else if(args[i].equals("-wait")) { @@ -268,11 +268,11 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase { } } 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(TestTiledPrintingGearsAWT.class.getName()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java index d3abcd01a..274b1eef3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java @@ -92,7 +92,7 @@ public class TestTiledPrintingGearsNewtAWT extends TiledPrintingAWTBase { public static void releaseClass() { } - protected void runTestGL(GLCapabilities caps) throws InterruptedException, InvocationTargetException { + protected void runTestGL(final GLCapabilities caps) throws InterruptedException, InvocationTargetException { final Dimension glc_sz = new Dimension(width/2, height); final GLWindow glad1 = GLWindow.create(caps); Assert.assertNotNull(glad1); @@ -120,15 +120,15 @@ public class TestTiledPrintingGearsNewtAWT extends TiledPrintingAWTBase { Assert.assertNotNull(frame); final ActionListener print72DPIAction = new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { doPrintManual(frame, 72, 0, -1, -1); } }; final ActionListener print300DPIAction = new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { doPrintManual(frame, 300, -1, -1, -1); } }; final ActionListener print600DPIAction = new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { doPrintManual(frame, 600, -1, -1, -1); } }; final Button print72DPIButton = new Button("72dpi"); @@ -139,15 +139,15 @@ public class TestTiledPrintingGearsNewtAWT extends TiledPrintingAWTBase { print600DPIButton.addActionListener(print600DPIAction); frame.setLayout(new BorderLayout()); - Panel printPanel = new Panel(); + final Panel printPanel = new Panel(); printPanel.add(print72DPIButton); printPanel.add(print300DPIButton); printPanel.add(print600DPIButton); - Panel southPanel = new Panel(); + final Panel southPanel = new Panel(); southPanel.add(new Label("South")); - Panel eastPanel = new Panel(); + final Panel eastPanel = new Panel(); eastPanel.add(new Label("East")); - Panel westPanel = new Panel(); + final Panel westPanel = new Panel(); westPanel.add(new Label("West")); frame.add(printPanel, BorderLayout.NORTH); frame.add(demoPanel, BorderLayout.CENTER); @@ -156,7 +156,7 @@ public class TestTiledPrintingGearsNewtAWT extends TiledPrintingAWTBase { frame.add(westPanel, BorderLayout.WEST); frame.setTitle("Tiles Newt/AWT Print Test"); - Animator animator = new Animator(); + final Animator animator = new Animator(); animator.add(glad1); animator.add(glad2); @@ -247,13 +247,13 @@ public class TestTiledPrintingGearsNewtAWT extends TiledPrintingAWTBase { @Test public void test01_aa0() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps); } @Test public void test02_aa8() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setSampleBuffers(true); caps.setNumSamples(8); runTestGL(caps); @@ -261,13 +261,13 @@ public class TestTiledPrintingGearsNewtAWT extends TiledPrintingAWTBase { static long duration = 500; // ms - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } else if(args[i].equals("-600dpi")) { allow600dpi = true; } else if(args[i].equals("-wait")) { @@ -275,11 +275,11 @@ public class TestTiledPrintingGearsNewtAWT extends TiledPrintingAWTBase { } } 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(TestTiledPrintingGearsNewtAWT.class.getName()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java index 34e1b60e9..7c8d65c19 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java @@ -100,7 +100,7 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase { public static void releaseClass() { } - protected void runTestGL(GLCapabilities caps, boolean layered, boolean skipGLOrientationVerticalFlip) throws InterruptedException, InvocationTargetException { + protected void runTestGL(final GLCapabilities caps, final boolean layered, final boolean skipGLOrientationVerticalFlip) throws InterruptedException, InvocationTargetException { final int layerStepX = width/6, layerStepY = height/6; final Dimension glc_sz = new Dimension(layered ? width - 2*layerStepX : width/2, layered ? height - 2*layerStepY : height); final GLJPanel glJPanel1 = new GLJPanel(caps); @@ -160,15 +160,15 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase { Assert.assertNotNull(frame); final ActionListener print72DPIAction = new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { doPrintManual(frame, 72, 0, -1, -1); } }; final ActionListener print300DPIAction = new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { doPrintManual(frame, 300, -1, -1, -1); } }; final ActionListener print600DPIAction = new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { doPrintManual(frame, 600, -1, -1, -1); } }; final Button print72DPIButton = new Button("72dpi"); @@ -189,7 +189,7 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase { final JPanel westPanel = new JPanel(); westPanel.add(new Label("West")); - Animator animator = new Animator(); + final Animator animator = new Animator(); animator.add(glJPanel1); animator.add(glJPanel2); final QuitAdapter quitAdapter = new QuitAdapter(); @@ -302,13 +302,13 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase { @Test public void test01_flip1_aa0() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps, false, false); } @Test public void test01_flip1_aa0_layered() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(8); runTestGL(caps, true, false); } @@ -316,7 +316,7 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase { @Test public void test01_flip1_aa0_bitmap() throws InterruptedException, InvocationTargetException { if( Platform.OSType.WINDOWS == Platform.getOSType() ) { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setBitmap(true); runTestGL(caps, false, false); } // issues w/ AMD catalyst driver and pixmap surface .. @@ -325,7 +325,7 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase { @Test public void test01_flip1_aa0_bitmap_layered() throws InterruptedException, InvocationTargetException { if( Platform.OSType.WINDOWS == Platform.getOSType() ) { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setBitmap(true); caps.setAlphaBits(8); runTestGL(caps, true, false); @@ -334,7 +334,7 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase { @Test public void test02_flip1_aa8() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setSampleBuffers(true); caps.setNumSamples(8); runTestGL(caps, false, false); @@ -342,13 +342,13 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase { @Test public void test11_flip0_aa0() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps, false, true); } @Test public void test11_flip0_aa0_layered() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(8); runTestGL(caps, true, true); } @@ -356,7 +356,7 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase { @Test public void test11_flip0_aa0_bitmap() throws InterruptedException, InvocationTargetException { if( Platform.OSType.WINDOWS == Platform.getOSType() ) { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setBitmap(true); runTestGL(caps, false, true); } // issues w/ AMD catalyst driver and pixmap surface .. @@ -365,7 +365,7 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase { @Test public void test11_flip0_aa0_bitmap_layered() throws InterruptedException, InvocationTargetException { if( Platform.OSType.WINDOWS == Platform.getOSType() ) { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setBitmap(true); caps.setAlphaBits(8); runTestGL(caps, true, true); @@ -374,7 +374,7 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase { @Test public void test12_flip0_aa8() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setSampleBuffers(true); caps.setNumSamples(8); runTestGL(caps, false, true); @@ -382,7 +382,7 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase { static long duration = 500; // ms - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; @@ -400,11 +400,11 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase { } } 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(TestTiledPrintingGearsSwingAWT.class.getName()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java index 8cf1421ae..060b85a34 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java @@ -96,7 +96,7 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase { public static void releaseClass() { } - protected void runTestGL(GLCapabilities caps, final boolean addLayout, boolean layered, boolean skipGLOrientationVerticalFlip, boolean useAnim) throws InterruptedException, InvocationTargetException { + protected void runTestGL(final GLCapabilities caps, final boolean addLayout, final boolean layered, final boolean skipGLOrientationVerticalFlip, final boolean useAnim) throws InterruptedException, InvocationTargetException { final Dimension glc_sz = new Dimension(width, height); final GLJPanel glJPanel1 = new GLJPanel(caps); Assert.assertNotNull(glJPanel1); @@ -146,15 +146,15 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase { Assert.assertNotNull(frame); final ActionListener print72DPIAction = new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { doPrintManual(frame, 72, 0, -1, -1); } }; final ActionListener print150DPIAction = new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { doPrintManual(frame, 150, -1, -1, -1); } }; final ActionListener print300DPIAction = new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { doPrintManual(frame, 300, -1, -1, -1); } }; final Button print72DPIButton = new Button("72dpi"); @@ -253,25 +253,25 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase { @Test public void test001_flip1_norm_layout0_layered0() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps, false /* addLayout */, false /* layered */, false /* skipGLOrientationVerticalFlip */, false /* useAnim */); } @Test public void test002_flip1_norm_layout1_layered0() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps, true /* addLayout */, false /* layered */, false /* skipGLOrientationVerticalFlip */, false /* useAnim */); } @Test public void test003_flip1_norm_layout0_layered1() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps, false /* addLayout */, true /* layered */, false /* skipGLOrientationVerticalFlip */, false /* useAnim */); } @Test public void test004_flip1_norm_layout1_layered1() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps, true /* addLayout */, true /* layered */, false /* skipGLOrientationVerticalFlip */, false /* useAnim */); } @@ -280,7 +280,7 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase { if( Platform.OSType.WINDOWS != Platform.getOSType() ) { return; } - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setBitmap(true); runTestGL(caps, false /* addLayout */, false /* layered */, false /* skipGLOrientationVerticalFlip */, false /* useAnim */); } @@ -290,7 +290,7 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase { if( Platform.OSType.WINDOWS != Platform.getOSType() ) { return; } - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setBitmap(true); runTestGL(caps, true /* addLayout */, false /* layered */, false /* skipGLOrientationVerticalFlip */, false /* useAnim */); } @@ -300,7 +300,7 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase { if( Platform.OSType.WINDOWS != Platform.getOSType() ) { return; } - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setBitmap(true); runTestGL(caps, false /* addLayout */, true /* layered */, false /* skipGLOrientationVerticalFlip */, false /* useAnim */); } @@ -310,32 +310,32 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase { if( Platform.OSType.WINDOWS != Platform.getOSType() ) { return; } - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setBitmap(true); runTestGL(caps, true /* addLayout */, true /* layered */, false /* skipGLOrientationVerticalFlip */, false /* useAnim */); } @Test public void test101_flip1_norm_layout0_layered0() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps, false /* addLayout */, false /* layered */, true /* skipGLOrientationVerticalFlip */, false /* useAnim */); } @Test public void test102_flip1_norm_layout1_layered0() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps, true /* addLayout */, false /* layered */, true /* skipGLOrientationVerticalFlip */, false /* useAnim */); } @Test public void test103_flip1_norm_layout0_layered1() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps, false /* addLayout */, true /* layered */, true /* skipGLOrientationVerticalFlip */, false /* useAnim */); } @Test public void test104_flip1_norm_layout1_layered1() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps, true /* addLayout */, true /* layered */, true /* skipGLOrientationVerticalFlip */, false /* useAnim */); } @@ -344,7 +344,7 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase { if( Platform.OSType.WINDOWS != Platform.getOSType() ) { return; } - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setBitmap(true); runTestGL(caps, false /* addLayout */, false /* layered */, true /* skipGLOrientationVerticalFlip */, false /* useAnim */); } @@ -354,7 +354,7 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase { if( Platform.OSType.WINDOWS != Platform.getOSType() ) { return; } - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setBitmap(true); runTestGL(caps, true /* addLayout */, false /* layered */, true /* skipGLOrientationVerticalFlip */, false /* useAnim */); } @@ -364,7 +364,7 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase { if( Platform.OSType.WINDOWS != Platform.getOSType() ) { return; } - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setBitmap(true); runTestGL(caps, false /* addLayout */, true /* layered */, true /* skipGLOrientationVerticalFlip */, false /* useAnim */); } @@ -374,14 +374,14 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase { if( Platform.OSType.WINDOWS != Platform.getOSType() ) { return; } - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); caps.setBitmap(true); runTestGL(caps, true /* addLayout */, true /* layered */, true /* skipGLOrientationVerticalFlip */, false /* useAnim */); } static long duration = 500; // ms - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; @@ -397,11 +397,11 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase { } } 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(TestTiledPrintingGearsSwingAWT2.class.getName()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java index b51bfae87..85edcda6c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java @@ -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.tile; import java.awt.BorderLayout; @@ -80,7 +80,7 @@ public class TestTiledPrintingNIOImageSwingAWT extends UITestCase { static boolean allow600dpi = false; static GLProfile glp; static int width, height; - + @BeforeClass public static void initClass() { if(GLProfile.isAvailable(GLProfile.GL2)) { @@ -98,7 +98,7 @@ public class TestTiledPrintingNIOImageSwingAWT extends UITestCase { @AfterClass public static void releaseClass() { } - + protected void printOffscreenToFile(final BufferedImage image, final Frame frame, final GLCapabilities caps, final int num, final String detail) { final Insets frameInsets = frame.getInsets(); final int frameWidth = frame.getWidth(); @@ -108,17 +108,17 @@ public class TestTiledPrintingNIOImageSwingAWT extends UITestCase { final double scaleComp72; // Note: Frame size contains the frame border (i.e. insets)! { - final double sx = (double)imageWidth / frameWidth; + final double sx = (double)imageWidth / frameWidth; final double sy = (double)imageHeight / frameHeight; scaleComp72 = Math.min(sx, sy); } System.err.println("PRINT DPI: scaleComp72 "+scaleComp72+", image-size "+imageWidth+"x"+imageHeight+", frame[border "+frameInsets+", size "+frameWidth+"x"+frameHeight+"]"); - + System.err.println("XXX: image "+image); System.err.println("XXX: cm "+image.getColorModel()); System.err.println("XXX: raster "+image.getRaster()); System.err.println("XXX: dataBuffer "+image.getRaster().getDataBuffer()); - + AWTEDTExecutor.singleton.invoke(true, new Runnable() { public void run() { final Graphics2D g2d = (Graphics2D) image.getGraphics(); @@ -126,7 +126,7 @@ public class TestTiledPrintingNIOImageSwingAWT extends UITestCase { g2d.scale(scaleComp72, scaleComp72); // g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); - + // frame.paintAll(g2d); final AWTPrintLifecycle.Context ctx = AWTPrintLifecycle.Context.setupPrint(frame, 1.0/scaleComp72, 1.0/scaleComp72, 0, -1, -1); try { @@ -137,20 +137,20 @@ public class TestTiledPrintingNIOImageSwingAWT extends UITestCase { // to file final String fname = getSnapshotFilename(num, detail, caps, image.getWidth(), image.getHeight(), false, TextureIO.PNG, null); System.err.println("XXX file "+fname); - final File fout = new File(fname); + final File fout = new File(fname); try { ImageIO.write(image, "png", fout); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } } }); } - + protected void runTestGL(final GLCapabilities caps, final boolean layered) throws InterruptedException, InvocationTargetException { final int layerStepX = width/6, layerStepY = height/6; final Dimension glc_sz = new Dimension(layered ? width - 2*layerStepX : width/2, layered ? height - 2*layerStepY : height); final GLJPanel glJPanel1 = new GLJPanel(caps); - Assert.assertNotNull(glJPanel1); + Assert.assertNotNull(glJPanel1); glJPanel1.setMinimumSize(glc_sz); glJPanel1.setPreferredSize(glc_sz); if( layered ) { @@ -159,9 +159,9 @@ public class TestTiledPrintingNIOImageSwingAWT extends UITestCase { glJPanel1.setBounds(0, 0, glc_sz.width, glc_sz.height); } glJPanel1.addGLEventListener(new Gears()); - + final GLJPanel glJPanel2 = new GLJPanel(caps); - Assert.assertNotNull(glJPanel2); + Assert.assertNotNull(glJPanel2); glJPanel2.setMinimumSize(glc_sz); glJPanel2.setPreferredSize(glc_sz); if( layered ) { @@ -171,7 +171,7 @@ public class TestTiledPrintingNIOImageSwingAWT extends UITestCase { } glJPanel2.addGLEventListener(new RedSquareES2()); // glJPanel2.addGLEventListener(new Gears()); - + final JComponent demoPanel; if( layered ) { glJPanel1.setOpaque(true); @@ -192,14 +192,14 @@ public class TestTiledPrintingNIOImageSwingAWT extends UITestCase { demoPanel.add(glJPanel1); demoPanel.add(glJPanel2); } - + final JFrame frame = new JFrame("Swing Print"); Assert.assertNotNull(frame); - + final Button print72DPIButton = new Button("72dpi"); // dummy final Button print300DPIButton = new Button("300dpi"); // dummy final Button print600DPIButton = new Button("600dpi"); // dummy - + final JPanel printPanel = new JPanel(); printPanel.add(print72DPIButton); printPanel.add(print300DPIButton); @@ -210,7 +210,7 @@ public class TestTiledPrintingNIOImageSwingAWT extends UITestCase { eastPanel.add(new Label("East")); final JPanel westPanel = new JPanel(); westPanel.add(new Label("West")); - + SwingUtilities.invokeAndWait(new Runnable() { public void run() { final Container fcont = frame.getContentPane(); @@ -224,11 +224,11 @@ public class TestTiledPrintingNIOImageSwingAWT extends UITestCase { frame.pack(); frame.setVisible(true); } } ) ; - + Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true)); Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel1, true)); Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel2, true)); - + // paint offscreen: array 72dpi ARGB { final BufferedImage image = new BufferedImage(frame.getWidth(), frame.getHeight(), BufferedImage.TYPE_INT_ARGB); @@ -241,29 +241,29 @@ public class TestTiledPrintingNIOImageSwingAWT extends UITestCase { } // paint offscreen: NIO 150dpi ARGB { - final int scale = (int) ( 150.0 / 72.0 + 0.5 ); + final int scale = (int) ( 150.0 / 72.0 + 0.5 ); final BufferedImage image = DirectDataBufferInt.createBufferedImage(frame.getWidth()*scale, frame.getHeight()*scale, BufferedImage.TYPE_INT_ARGB, null /* location */, null /* properties */); printOffscreenToFile(image, frame, caps, 2, "newio_150dpi_argb"); } // paint offscreen: NIO 150dpi ARGB_PRE { - final int scale = (int) ( 150.0 / 72.0 + 0.5 ); + final int scale = (int) ( 150.0 / 72.0 + 0.5 ); final BufferedImage image = DirectDataBufferInt.createBufferedImage(frame.getWidth()*scale, frame.getHeight()*scale, BufferedImage.TYPE_INT_ARGB_PRE, null /* location */, null /* properties */); printOffscreenToFile(image, frame, caps, 2, "newio_150dpi_argbp"); } // paint offscreen: NIO 150dpi RGB { - final int scale = (int) ( 150.0 / 72.0 + 0.5 ); + final int scale = (int) ( 150.0 / 72.0 + 0.5 ); final BufferedImage image = DirectDataBufferInt.createBufferedImage(frame.getWidth()*scale, frame.getHeight()*scale, BufferedImage.TYPE_INT_RGB, null /* location */, null /* properties */); printOffscreenToFile(image, frame, caps, 2, "newio_150dpi_rgb"); } // paint offscreen: NIO 150dpi BGR { - final int scale = (int) ( 150.0 / 72.0 + 0.5 ); + final int scale = (int) ( 150.0 / 72.0 + 0.5 ); final BufferedImage image = DirectDataBufferInt.createBufferedImage(frame.getWidth()*scale, frame.getHeight()*scale, BufferedImage.TYPE_INT_BGR, null /* location */, null /* properties */); printOffscreenToFile(image, frame, caps, 2, "newio_150dpi_bgr"); } - + Assert.assertNotNull(frame); Assert.assertNotNull(glJPanel1); Assert.assertNotNull(glJPanel2); @@ -283,25 +283,25 @@ public class TestTiledPrintingNIOImageSwingAWT extends UITestCase { @Test public void test01_Offscreen_aa0() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps, false); } - + @Test public void test01_Offscreen_aa0_layered() throws InterruptedException, InvocationTargetException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps, true); } - + static long duration = 500; // ms - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } else if(args[i].equals("-600dpi")) { allow600dpi = true; } else if(args[i].equals("-wait")) { @@ -309,11 +309,11 @@ public class TestTiledPrintingNIOImageSwingAWT extends UITestCase { } } 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(TestTiledPrintingNIOImageSwingAWT.class.getName()); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering1GL2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering1GL2NEWT.java index 59bc27c07..9dee67e5e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering1GL2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering1GL2NEWT.java @@ -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,9 +57,9 @@ import org.junit.runners.MethodSorters; * Demos offscreen {@link GLDrawable} being used for * {@link TileRenderer} rendering to produce a PNG file. * <p> - * All {@link TileRenderer} operations are + * All {@link TileRenderer} operations are * being performed from the main thread sequentially - * without {@link GLAutoDrawable} or {@link GLEventListener}. + * without {@link GLAutoDrawable} or {@link GLEventListener}. * </p> */ @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<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } org.junit.runner.JUnitCore.main(TestTiledRendering1GL2NEWT.class.getName()); - } + } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java index cf83d524d..e979ac966 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java @@ -74,7 +74,7 @@ import org.junit.runners.MethodSorters; public class TestTiledRendering2NEWT extends UITestCase { static long duration = 500; // ms - static GLProfile getGLProfile(String profile) { + static GLProfile getGLProfile(final String profile) { if( !GLProfile.isAvailable(profile) ) { System.err.println("Profile "+profile+" n/a"); return null; @@ -92,7 +92,7 @@ public class TestTiledRendering2NEWT extends UITestCase { @Test public void test001_off_gl2___aa0() throws IOException { - GLProfile glp = getGLProfile(GLProfile.GL2); + final GLProfile glp = getGLProfile(GLProfile.GL2); if( null == glp ) { return; } @@ -100,7 +100,7 @@ public class TestTiledRendering2NEWT extends UITestCase { } @Test public void test002_off_gl2___aa8() throws IOException { - GLProfile glp = getGLProfile(GLProfile.GL2); + final GLProfile glp = getGLProfile(GLProfile.GL2); if( null == glp ) { return; } @@ -108,7 +108,7 @@ public class TestTiledRendering2NEWT extends UITestCase { } @Test public void test011_off_gl2es3_aa0() throws IOException { - GLProfile glp = getGL2ES3(); + final GLProfile glp = getGL2ES3(); if( null == glp ) { return; } @@ -116,7 +116,7 @@ public class TestTiledRendering2NEWT extends UITestCase { } @Test public void test012_off_gl2es3_aa8() throws IOException { - GLProfile glp = getGL2ES3(); + final GLProfile glp = getGL2ES3(); if( null == glp ) { return; } @@ -124,7 +124,7 @@ public class TestTiledRendering2NEWT extends UITestCase { } @Test public void test101_on__gl2___aa0() throws IOException { - GLProfile glp = getGLProfile(GLProfile.GL2); + final GLProfile glp = getGLProfile(GLProfile.GL2); if( null == glp ) { return; } @@ -132,7 +132,7 @@ public class TestTiledRendering2NEWT extends UITestCase { } @Test public void test102_on__gl2___aa8() throws IOException { - GLProfile glp = getGLProfile(GLProfile.GL2); + final GLProfile glp = getGLProfile(GLProfile.GL2); if( null == glp ) { return; } @@ -140,7 +140,7 @@ public class TestTiledRendering2NEWT extends UITestCase { } @Test public void test111_on__gl2es3_aa0() throws IOException { - GLProfile glp = getGL2ES3(); + final GLProfile glp = getGL2ES3(); if( null == glp ) { return; } @@ -148,15 +148,15 @@ public class TestTiledRendering2NEWT extends UITestCase { } @Test public void test112_on__gl2es3_aa8() throws IOException { - GLProfile glp = getGL2ES3(); + final GLProfile glp = getGL2ES3(); if( null == glp ) { return; } doTest(true, new GearsES2(), glp, 8); } - void doTest(boolean onscreen, final GLEventListener demo, GLProfile glp, final int msaaCount) throws IOException { - GLCapabilities caps = new GLCapabilities(glp); + void doTest(final boolean onscreen, final GLEventListener demo, final GLProfile glp, final int msaaCount) throws IOException { + final GLCapabilities caps = new GLCapabilities(glp); caps.setDoubleBuffered(onscreen); if( msaaCount > 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<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } org.junit.runner.JUnitCore.main(TestTiledRendering2NEWT.class.getName()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java index 4e9d4bdbe..e84bb4d74 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java @@ -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. @@ -60,13 +60,13 @@ import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.util.TileRenderer; /** - * Base unit test class implementing + * Base unit test class implementing * issuing {@link PrinterJob#print()} on a {@link Printable} implementation, * i.e. {@link OnscreenPrintable} or {@link OffscreenPrintable}. */ public abstract class TiledPrintingAWTBase extends UITestCase { - - private RecursiveLock lock = LockFactory.createRecursiveLock(); + + private final RecursiveLock lock = LockFactory.createRecursiveLock(); private int printCount = 0; public TiledPrintingAWTBase() { @@ -74,19 +74,19 @@ public abstract class TiledPrintingAWTBase extends UITestCase { } /** - * + * * @param cont * @param pOrientation * @param paper * @param offscrnImageType if < 0 onscreen, otherwise integer BufferedImage type * @param dpi - * @param numSamples multisampling value: < 0 turns off, == 0 leaves as-is, > 0 enables using given num samples + * @param 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<args.length; i++) { if(args[i].equals("-time")) { i++; try { duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } org.junit.runner.JUnitCore.main(TestES1FixedFunctionPipelineNEWT.class.getName()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/TestImmModeSinkES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/TestImmModeSinkES1NEWT.java index 0ac01bc31..790f965b6 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/TestImmModeSinkES1NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/TestImmModeSinkES1NEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.util; import java.io.IOException; @@ -52,86 +52,86 @@ public class TestImmModeSinkES1NEWT extends UITestCase { static final int iWidth = 400; static final int iHeight = 400; - 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)); } - - void doTest(GLCapabilitiesImmutable reqGLCaps, GLEventListener demo) throws InterruptedException { + + void doTest(final GLCapabilitiesImmutable reqGLCaps, final GLEventListener demo) throws InterruptedException { System.out.println("Requested GL Caps: "+reqGLCaps); - + // // Create native windowing resources .. X11/Win/OSX - // + // final GLWindow glad = GLWindow.create(reqGLCaps); glad.addGLEventListener(demo); - + final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener(); glad.addGLEventListener(snapshotGLEventListener); glad.setSize(iWidth, iHeight); glad.setVisible(true); - + snapshotGLEventListener.setMakeSnapshot(); glad.display(); // initial resize/display - + Thread.sleep(duration); - + glad.destroy(); } - + @Test public void test01Plain__GL2ES1_VBOOffUsePlain() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES1); if(null == reqGLCaps) return; doTest(reqGLCaps, new DemoGL2ES1Plain(false, false)); } - + @Test public void test02Plain__GL2ES1_VBOOffUseArrayData() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES1); if(null == reqGLCaps) return; doTest(reqGLCaps, new DemoGL2ES1Plain(true, false)); } - + @Test public void test03Plain__GL2ES1_VBOOnUsePlain() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES1); if(null == reqGLCaps) return; doTest(reqGLCaps, new DemoGL2ES1Plain(false, true)); } - + @Test public void test04Plain__GL2ES1_VBOOnUseArrayData() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES1); if(null == reqGLCaps) return; doTest(reqGLCaps, new DemoGL2ES1Plain(true, true)); } - + @Test public void test05ImmSinkGL2ES1_VBOOff() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES1); if(null == reqGLCaps) return; doTest(reqGLCaps, new DemoGL2ES1ImmModeSink(false)); } - + @Test public void test06ImmSinkGL2ES1_VBOOn() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES1); if(null == reqGLCaps) return; doTest(reqGLCaps, new DemoGL2ES1ImmModeSink(true)); } - + @Test public void test07ImmSinkGL2ES1_VBOOnTexture() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES1); if(null == reqGLCaps) return; doTest(reqGLCaps, new DemoGL2ES1TextureImmModeSink()); } - - public static void main(String args[]) throws IOException { + + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { duration = MiscUtils.atoi(args[++i], duration); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/TestImmModeSinkES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/TestImmModeSinkES2NEWT.java index de6aef55e..9cf39a040 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/TestImmModeSinkES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/TestImmModeSinkES2NEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.util; import java.io.IOException; @@ -52,63 +52,63 @@ public class TestImmModeSinkES2NEWT extends UITestCase { static final int iWidth = 400; static final int iHeight = 400; - 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)); } - - void doTest(GLCapabilitiesImmutable reqGLCaps, GLEventListener demo) throws InterruptedException { + + void doTest(final GLCapabilitiesImmutable reqGLCaps, final GLEventListener demo) throws InterruptedException { System.out.println("Requested GL Caps: "+reqGLCaps); - + // // Create native windowing resources .. X11/Win/OSX - // + // final GLWindow glad = GLWindow.create(reqGLCaps); glad.addGLEventListener(demo); - + final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener(); glad.addGLEventListener(snapshotGLEventListener); glad.setSize(iWidth, iHeight); glad.setVisible(true); - + snapshotGLEventListener.setMakeSnapshot(); glad.display(); // initial resize/display - + Thread.sleep(duration); - + glad.destroy(); } - + @Test public void test05ImmSinkGL2ES2_VBOOff_Direct() throws InterruptedException { final GLCapabilities reqGLCaps = new GLCapabilities( GLProfile.getMaxFixedFunc(true) ); doTest(reqGLCaps, new DemoGL2ES2ImmModeSink(false, false)); } - + @Test public void test05ImmSinkGL2ES2_VBOOff_ShaderState() throws InterruptedException { final GLCapabilities reqGLCaps = new GLCapabilities( GLProfile.getMaxFixedFunc(true) ); doTest(reqGLCaps, new DemoGL2ES2ImmModeSink(false, true)); } - + @Test public void test06ImmSinkGL2ES2_VBOOn_Direct() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2); if(null == reqGLCaps) return; doTest(reqGLCaps, new DemoGL2ES2ImmModeSink(true, false)); } - + @Test public void test06ImmSinkGL2ES2_VBOOn_ShaderState() throws InterruptedException { final GLCapabilities reqGLCaps = getCaps(GLProfile.GL2ES2); if(null == reqGLCaps) return; doTest(reqGLCaps, new DemoGL2ES2ImmModeSink(true, true)); } - - public static void main(String args[]) throws IOException { + + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { duration = MiscUtils.atoi(args[++i], duration); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug362DDSImageCreateFromData.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug362DDSImageCreateFromData.java index 4212abae7..a585e9eaf 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug362DDSImageCreateFromData.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug362DDSImageCreateFromData.java @@ -17,13 +17,13 @@ import com.jogamp.opengl.util.texture.spi.DDSImage; import com.jogamp.opengl.util.texture.spi.DDSImage.ImageInfo; /** - * This test uses the DDSImage class to read a dds image from file, extract the data, + * This test uses the DDSImage class to read a dds image from file, extract the data, * and use the class to create a new DDSImage from the extracted data * <br></br> * Bug Reference: https://jogamp.org/bugzilla/show_bug.cgi?id=362 * <br></br> - * 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. * <br></br> * <ul>The following cases are tested: @@ -31,68 +31,68 @@ import com.jogamp.opengl.util.texture.spi.DDSImage.ImageInfo; * <li>DXT1 compressed 64x32 RGB DDS Image with all mipmap levels (64x32 --> 1x1)</li> * <li>DXT5 compressed 64x32 RGB DDS Image with all mipmap levels (64x32 --> 1x1)</li> * </ul> - * + * * @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<numMipMaps;i++){ - ImageInfo info = ddsImage.getMipMap(i); + final ImageInfo info = ddsImage.getMipMap(i); mipMapArray[i] = info.getData(); } - DDSImage newImage = DDSImage.createFromData(ddsImage.getPixelFormat(), ddsImage.getWidth(), ddsImage.getHeight(), mipMapArray); + final DDSImage newImage = DDSImage.createFromData(ddsImage.getPixelFormat(), ddsImage.getWidth(), ddsImage.getHeight(), mipMapArray); Assert.assertNotNull(newImage); } - + @Test public void test00_DDSImage_CreateFromData_Uncompressed_RGB () throws IOException { testImpl(testDDSImage01Uncompressed); } - + @Test public void test01_DDSImage_CreateFromData_DXT1_RGB () throws IOException { testImpl(testDDSImage02DXT1); } - + @Test public void test02_DDSImage_CreateFromData_DXT5_RGB () throws IOException { testImpl(testDDSImage03DXT5); } - - public static void main(String[] args) { + + public static void main(final String[] args) { org.junit.runner.JUnitCore.main(TestBug362DDSImageCreateFromData.class.getName()); } }
\ No newline at end of file diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug817GLReadBufferUtilGLCTXDefFormatTypeES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug817GLReadBufferUtilGLCTXDefFormatTypeES2NEWT.java index 679f0692b..2eb8b45c3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug817GLReadBufferUtilGLCTXDefFormatTypeES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug817GLReadBufferUtilGLCTXDefFormatTypeES2NEWT.java @@ -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. @@ -50,14 +50,14 @@ import com.jogamp.opengl.util.texture.TextureIO; public class TestBug817GLReadBufferUtilGLCTXDefFormatTypeES2NEWT extends UITestCase { static long durationPerTest = 60; // ms - public static void main(String[] args) { + public static void main(final String[] args) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atoi(args[++i], 500); } } System.out.println("durationPerTest: "+durationPerTest); - String tstname = TestBug817GLReadBufferUtilGLCTXDefFormatTypeES2NEWT.class.getName(); + final String tstname = TestBug817GLReadBufferUtilGLCTXDefFormatTypeES2NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } @@ -95,28 +95,28 @@ public class TestBug817GLReadBufferUtilGLCTXDefFormatTypeES2NEWT extends UITestC testImpl(true, true, false, true); } - private void testImpl(final boolean alphaCaps, final boolean readAlpha, boolean pbuffer, boolean fbo) throws InterruptedException { + private void testImpl(final boolean alphaCaps, final boolean readAlpha, final boolean pbuffer, final boolean fbo) throws InterruptedException { final GLReadBufferUtil screenshot = new GLReadBufferUtil(readAlpha ? true : false, false); - GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.getGL2ES2(); + final GLCapabilities caps = new GLCapabilities(glp); - caps.setAlphaBits( alphaCaps ? 1 : 0 ); + caps.setAlphaBits( alphaCaps ? 1 : 0 ); caps.setPBuffer( pbuffer ); caps.setFBO( fbo); - + final GLWindow window = GLWindow.create(caps); window.addGLEventListener(new GearsES2()); window.addGLEventListener(new GLEventListener() { int displayCount = 0; - public void init(GLAutoDrawable drawable) {} - public void dispose(GLAutoDrawable drawable) {} - public void display(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) {} + public void display(final GLAutoDrawable drawable) { final GLPixelBufferProvider pixelBufferProvider = screenshot.getPixelBufferProvider(); final GLPixelAttributes pixelAttribs = pixelBufferProvider.getAttributes(drawable.getGL(), readAlpha ? 4 : 3); System.err.println("GLPixelAttributes: "+pixelAttribs); snapshot(displayCount++, null, drawable.getGL(), screenshot, TextureIO.PNG, null); } - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { } + 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/util/texture/TestGLReadBufferUtilTextureIOWrite01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01AWT.java index 21987c504..e3be8ce33 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01AWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.util.texture; import java.awt.Dimension; @@ -71,10 +71,10 @@ public class TestGLReadBufferUtilTextureIOWrite01AWT extends UITestCase { height = 256; } - protected void testWritePNG_Impl(boolean offscreenLayer) throws InterruptedException { + protected void testWritePNG_Impl(final boolean offscreenLayer) throws InterruptedException { final GLReadBufferUtil screenshotRGB = new GLReadBufferUtil(false, false); final GLReadBufferUtil screenshotRGBA = new GLReadBufferUtil(true, false); - + if(!offscreenLayer && JAWTUtil.isOffscreenLayerRequired()) { System.err.println("onscreen layer n/a"); return; @@ -82,40 +82,40 @@ public class TestGLReadBufferUtilTextureIOWrite01AWT extends UITestCase { if(offscreenLayer && !JAWTUtil.isOffscreenLayerSupported()) { System.err.println("offscreen layer n/a"); return; - } + } final GLCanvas glc = new GLCanvas(caps); glc.setShallUseOffscreenLayer(offscreenLayer); // trigger offscreen layer - if supported - Dimension glc_sz = new Dimension(width, height); + final Dimension glc_sz = new Dimension(width, height); glc.setMinimumSize(glc_sz); glc.setPreferredSize(glc_sz); final Frame frame = new Frame(getSimpleTestName(".")); Assert.assertNotNull(frame); frame.add(glc); - + glc.setSize(width, height); glc.addGLEventListener(new GearsES2(1)); glc.addGLEventListener(new GLEventListener() { int f = 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(f, null, drawable.getGL(), screenshotRGBA, TextureIO.PNG, null); snapshot(f, null, drawable.getGL(), screenshotRGB, TextureIO.PNG, null); f++; } - 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) { } }); - - Animator animator = new Animator(glc); + + final Animator animator = new Animator(glc); animator.setUpdateFPSFrames(60, null); - + try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame.pack(); frame.setVisible(true); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -128,7 +128,7 @@ public class TestGLReadBufferUtilTextureIOWrite01AWT extends UITestCase { while(animator.getTotalFPSFrames() < 2) { Thread.sleep(60); } - + animator.stop(); try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { @@ -137,23 +137,23 @@ public class TestGLReadBufferUtilTextureIOWrite01AWT extends UITestCase { frame.remove(glc); frame.dispose(); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); - } + } } @Test public void testOnscreenWritePNG() throws InterruptedException { testWritePNG_Impl(false); } - + @Test public void testOffscreenWritePNG() throws InterruptedException { testWritePNG_Impl(true); } - public static void main(String args[]) { + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestGLReadBufferUtilTextureIOWrite01AWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01NEWT.java index 521e89a8b..a10870635 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01NEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.util.texture; import com.jogamp.newt.opengl.GLWindow; @@ -68,56 +68,56 @@ public class TestGLReadBufferUtilTextureIOWrite01NEWT extends UITestCase { public void testOnscreenWritePNG_TGA_PAM() throws InterruptedException { final GLReadBufferUtil screenshotRGB = new GLReadBufferUtil(false, false); final GLReadBufferUtil screenshotRGBA = new GLReadBufferUtil(true, false); - GLWindow glWindow = GLWindow.create(caps); + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); glWindow.setTitle("Shared Gears NEWT Test"); glWindow.setSize(width, height); glWindow.addGLEventListener(new GearsES2(1)); glWindow.addGLEventListener(new GLEventListener() { int f = 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(f++, null, drawable.getGL(), screenshotRGBA, TextureIO.PNG, null); - snapshot(f++, null, drawable.getGL(), screenshotRGB, TextureIO.PNG, null); + snapshot(f++, null, drawable.getGL(), screenshotRGB, TextureIO.PNG, null); snapshot(f++, null, drawable.getGL(), screenshotRGBA, TextureIO.TGA, null); - snapshot(f++, null, drawable.getGL(), screenshotRGB, TextureIO.TGA, null); + snapshot(f++, null, drawable.getGL(), screenshotRGB, TextureIO.TGA, null); snapshot(f++, null, drawable.getGL(), screenshotRGBA, TextureIO.PAM, null); - snapshot(f++, null, drawable.getGL(), screenshotRGB, TextureIO.PAM, null); + snapshot(f++, null, drawable.getGL(), screenshotRGB, TextureIO.PAM, 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) { } }); glWindow.setVisible(true); Thread.sleep(60); - glWindow.destroy(); + glWindow.destroy(); } @Test public void testOffscreenWritePNG() throws InterruptedException { final GLReadBufferUtil screenshotRGB = new GLReadBufferUtil(false, false); final GLReadBufferUtil screenshotRGBA = new GLReadBufferUtil(true, false); - final GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, true, false); - GLWindow glWindow = GLWindow.create(caps2); + final GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, true, false); + final GLWindow glWindow = GLWindow.create(caps2); Assert.assertNotNull(glWindow); glWindow.setSize(width, height); glWindow.addGLEventListener(new GearsES2(1)); glWindow.addGLEventListener(new GLEventListener() { int f = 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(f, null, drawable.getGL(), screenshotRGBA, TextureIO.PNG, null); snapshot(f, null, drawable.getGL(), screenshotRGB, TextureIO.PNG, null); f++; } - 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) { } }); glWindow.setVisible(true); Thread.sleep(60); - glWindow.destroy(); + glWindow.destroy(); } - public static void main(String args[]) { + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestGLReadBufferUtilTextureIOWrite01NEWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02AWT.java index 712748d49..8be3fb24b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02AWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.util.texture; import java.awt.Dimension; @@ -72,7 +72,7 @@ public class TestGLReadBufferUtilTextureIOWrite02AWT extends UITestCase { height = 64; } - protected void testWritePNGWithResizeImpl(boolean offscreenLayer) throws InterruptedException { + protected void testWritePNGWithResizeImpl(final boolean offscreenLayer) throws InterruptedException { if(!offscreenLayer && JAWTUtil.isOffscreenLayerRequired()) { System.err.println("onscreen layer n/a"); return; @@ -80,24 +80,24 @@ public class TestGLReadBufferUtilTextureIOWrite02AWT extends UITestCase { if(offscreenLayer && !JAWTUtil.isOffscreenLayerSupported()) { System.err.println("offscreen layer n/a"); return; - } + } final GLReadBufferUtil screenshot = new GLReadBufferUtil(true, false); final GLCanvas glc = new GLCanvas(caps); glc.setShallUseOffscreenLayer(offscreenLayer); // trigger offscreen layer - if supported - 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); final Frame frame = new Frame(getSimpleTestName(".")); Assert.assertNotNull(frame); frame.add(glc); - + glc.addGLEventListener(new GearsES2(1)); glc.addGLEventListener(new GLEventListener() { int i=0, fw_old=0, dw_old=0, c=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) { final int fw = frame.getWidth(); final int fh = frame.getHeight(); final int dw = drawable.getSurfaceWidth(); @@ -110,7 +110,7 @@ public class TestGLReadBufferUtilTextureIOWrite02AWT extends UITestCase { } else { snap = false; } - + if(snap) { System.err.println("XXX: ["+fw_old+", "+dw_old+"], "+fw+"x"+fh+", "+dw+"x"+dh+", sz_changed "+sz_changed+", snap "+snap); c=0; @@ -128,19 +128,19 @@ public class TestGLReadBufferUtilTextureIOWrite02AWT extends UITestCase { } }, glc.getTreeLock()); } } - 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) { } }); - - Animator animator = new Animator(glc); + + final Animator animator = new Animator(glc); animator.setUpdateFPSFrames(60, null); - + try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame.pack(); frame.setVisible(true); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -153,7 +153,7 @@ public class TestGLReadBufferUtilTextureIOWrite02AWT extends UITestCase { while(animator.getTotalFPSFrames() < 30) { Thread.sleep(60); } - + animator.stop(); try { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { @@ -162,23 +162,23 @@ public class TestGLReadBufferUtilTextureIOWrite02AWT extends UITestCase { frame.remove(glc); frame.dispose(); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); - } + } } @Test public void testOnscreenWritePNGWithResize() throws InterruptedException { testWritePNGWithResizeImpl(false); } - + @Test public void testOffscreenWritePNGWithResize() throws InterruptedException { testWritePNGWithResizeImpl(true); } - - public static void main(String args[]) { + + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestGLReadBufferUtilTextureIOWrite02AWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java index c52680dc3..cfae6f0df 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.util.texture; import com.jogamp.newt.opengl.GLWindow; @@ -66,7 +66,7 @@ public class TestGLReadBufferUtilTextureIOWrite02NEWT extends UITestCase { height = 64; } - private void testWritePNGWithResizeImpl(boolean offscreen) throws InterruptedException { + private void testWritePNGWithResizeImpl(final boolean offscreen) throws InterruptedException { final GLReadBufferUtil screenshot = new GLReadBufferUtil(true, false); final GLCapabilities caps2 = offscreen ? WindowUtilNEWT.fixCaps(caps, false, true, false) : caps; final GLWindow glWindow = GLWindow.create(caps2); @@ -76,13 +76,13 @@ public class TestGLReadBufferUtilTextureIOWrite02NEWT extends UITestCase { glWindow.addGLEventListener(new GearsES2(1)); glWindow.addGLEventListener(new GLEventListener() { int i=0, dw_old=0, c=0; - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { System.err.println("XXX: init"); } - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { System.err.println("XXX: dispose"); } - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { final int dw = drawable.getSurfaceWidth(); final int dh = drawable.getSurfaceHeight(); final boolean sz_changed = dw_old != dw && dw <= 512; @@ -93,35 +93,35 @@ public class TestGLReadBufferUtilTextureIOWrite02NEWT extends UITestCase { } else { snap = false; } - + if(snap) { System.err.println("XXX: ["+dw_old+"], "+dw+"x"+dh+", sz_changed "+sz_changed+", snap "+snap); c=0; snapshot(i++, null, drawable.getGL(), screenshot, TextureIO.PNG, null); dw_old = dw; - new Thread() { + new Thread() { @Override public void run() { - glWindow.setSize(2*dw, 2*dh); + glWindow.setSize(2*dw, 2*dh); } }.start(); } } - 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) { } }); - Animator animator = new Animator(glWindow); + final Animator animator = new Animator(glWindow); animator.setUpdateFPSFrames(60, null); - + glWindow.setVisible(true); animator.start(); - + while(animator.getTotalFPSFrames() < 50) { Thread.sleep(60); } - + animator.stop(); - glWindow.destroy(); + glWindow.destroy(); } - + @Test public void testOnscreenWritePNGWithResize() throws InterruptedException { testWritePNGWithResizeImpl(false); @@ -132,7 +132,7 @@ public class TestGLReadBufferUtilTextureIOWrite02NEWT extends UITestCase { testWritePNGWithResizeImpl(true); } - public static void main(String args[]) { + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestGLReadBufferUtilTextureIOWrite02NEWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGImage01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGImage01NEWT.java index c92174a77..156ca20a1 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGImage01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGImage01NEWT.java @@ -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. @@ -65,29 +65,29 @@ import javax.media.opengl.GL; */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestJPEGImage01NEWT extends UITestCase { - + static boolean showFPS = false; static long duration = 100; // ms - + public void testImpl(final InputStream istream) throws InterruptedException, IOException { final JPEGImage image = JPEGImage.read(istream); Assert.assertNotNull(image); final boolean hasAlpha = 4 == image.getBytesPerPixel(); System.err.println("JPEGImage: "+image+", hasAlpha "+hasAlpha); - + final GLReadBufferUtil screenshot = new GLReadBufferUtil(true, false); final GLProfile glp = GLProfile.getGL2ES2(); final GLCapabilities caps = new GLCapabilities(glp); if( hasAlpha ) { caps.setAlphaBits(1); } - + final int internalFormat; if(glp.isGL2ES3()) { internalFormat = hasAlpha ? GL.GL_RGBA8 : GL.GL_RGB8; } else { internalFormat = hasAlpha ? GL.GL_RGBA : GL.GL_RGB; - } + } final TextureData texData = new TextureData(glp, internalFormat, image.getWidth(), image.getHeight(), @@ -99,37 +99,37 @@ public class TestJPEGImage01NEWT extends UITestCase { image.getData(), null); // final TextureData texData = TextureIO.newTextureData(glp, istream, false /* mipmap */, TextureIO.JPG); - System.err.println("TextureData: "+texData); - + System.err.println("TextureData: "+texData); + final GLWindow glad = GLWindow.create(caps); glad.setTitle("TestJPEGImage01NEWT"); // 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 = 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); @@ -138,11 +138,11 @@ public class TestJPEGImage01NEWT extends UITestCase { while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) { Thread.sleep(100); } - + animator.stop(); glad.destroy(); } - + @Test public void testReadES2_RGBn() throws InterruptedException, IOException, MalformedURLException { final String fname = null == _fname ? "test-ntscN_3-01-160x90-90pct-yuv444-base.jpg" : _fname; @@ -151,7 +151,7 @@ public class TestJPEGImage01NEWT extends UITestCase { } static String _fname = null; - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTBenchmarkNewtAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTBenchmarkNewtAWT.java index bd2488e26..7c11d7275 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTBenchmarkNewtAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTBenchmarkNewtAWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.util.texture; @@ -60,7 +60,7 @@ public class TestJPEGJoglAWTBenchmarkNewtAWT extends UITestCase { public void benchmark() throws IOException { benchmarkImpl(100, fname); } - void benchmarkImpl(int loops, String fname) throws IOException { + void benchmarkImpl(final int loops, final String fname) throws IOException { { final long t0 = System.currentTimeMillis(); for(int i = 0; i< loops; i++ ) { @@ -124,15 +124,15 @@ public class TestJPEGJoglAWTBenchmarkNewtAWT extends UITestCase { final InputStream istream = urlConn.getInputStream(); Buffer data = null; try { - BufferedImage img = ImageIO.read(istream); - AWTTextureData texData = new AWTTextureData(GLProfile.getGL2ES2(), 0, 0, false, img); + final BufferedImage img = ImageIO.read(istream); + final AWTTextureData texData = new AWTTextureData(GLProfile.getGL2ES2(), 0, 0, false, img); data = texData.getBuffer(); // completes data conversion !!! if(0==i || loops-1==i) { System.err.println(i+": "+texData+", buffer "+data); } - } catch (Exception e) { + } catch (final Exception e) { System.err.println("AWT ImageIO failure w/ file "+fname+": "+e.getMessage()); - } + } istream.close(); } final long t1 = System.currentTimeMillis(); @@ -141,14 +141,14 @@ public class TestJPEGJoglAWTBenchmarkNewtAWT extends UITestCase { System.err.println("AWT..... Loops "+loops+", dt "+dt+" ms, "+msPl+" ms/l"); } } - - public static void main(String args[]) throws IOException { + + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-file")) { i++; fname = args[i]; } } - org.junit.runner.JUnitCore.main(TestJPEGJoglAWTBenchmarkNewtAWT.class.getName()); + org.junit.runner.JUnitCore.main(TestJPEGJoglAWTBenchmarkNewtAWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTCompareNewtAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTCompareNewtAWT.java index 7079e07bf..067ee9d67 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTCompareNewtAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTCompareNewtAWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.util.texture; @@ -66,7 +66,7 @@ import org.junit.runners.MethodSorters; public class TestJPEGJoglAWTCompareNewtAWT extends UITestCase { static boolean showFPS = false; static long duration = 100; // ms - + String[] files = { "test-ntscN_3-01-160x90-90pct-yuv444-base.jpg", // 0 "test-ntscN_3-01-160x90-90pct-yuv444-prog.jpg", // 1 "test-ntscN_3-01-160x90-60pct-yuv422h-base.jpg", // 2 @@ -79,14 +79,14 @@ public class TestJPEGJoglAWTCompareNewtAWT extends UITestCase { void testImpl(final String fname) throws InterruptedException, IOException { final Animator animator = new Animator(); - + final GLWindow w1 = testJOGLJpeg(fname); final GLWindow w2 = testAWTJpeg(fname, w1.getSurfaceWidth() + 50); - + animator.add(w1); animator.add(w2); animator.setUpdateFPSFrames(60, showFPS ? System.err : null); - QuitAdapter quitAdapter = new QuitAdapter(); + final QuitAdapter quitAdapter = new QuitAdapter(); w1.setVisible(true); w2.setVisible(true); animator.start(); @@ -94,23 +94,23 @@ public class TestJPEGJoglAWTCompareNewtAWT extends UITestCase { while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) { Thread.sleep(100); } - + animator.stop(); w1.destroy(); - w2.destroy(); + w2.destroy(); } - + GLWindow testJOGLJpeg(final String fname) throws InterruptedException, IOException { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), fname); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), fname); Assert.assertNotNull(testTextureUrlConn); - InputStream istream = testTextureUrlConn.getInputStream(); + final InputStream istream = testTextureUrlConn.getInputStream(); Assert.assertNotNull(istream); - + final JPEGImage image = JPEGImage.read(istream); Assert.assertNotNull(image); System.err.println("JPEGImage: "+image); - - GLProfile glp = GLProfile.getGL2ES2(); + + final GLProfile glp = GLProfile.getGL2ES2(); final int internalFormat = (image.getBytesPerPixel()==4)?GL.GL_RGBA:GL.GL_RGB; final TextureData texData = new TextureData(glp, internalFormat, image.getWidth(), @@ -124,71 +124,71 @@ public class TestJPEGJoglAWTCompareNewtAWT extends UITestCase { null); // final TextureData texData = TextureIO.newTextureData(glp, istream, false /* mipmap */, TextureIO.JPG); System.err.println("TextureData: "+texData); - + 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 JOGL"); // Size OpenGL to Video Surface glad1.setSize(texData.getWidth(), texData.getHeight()); glad1.setPosition(0, 0); - + // load texture from file inside current GL context to match the way // the bug submitter was doing it final GLEventListener gle = new TextureDraw01ES2Listener( texData, 0 ) ; glad1.addGLEventListener(gle); - 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!=((TextureDraw01Accessor)gle).getTexture() && !shot) { shot = true; snapshot(0, "JoglJPEG", 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; } - - GLWindow testAWTJpeg(final String fname, int xpos) throws InterruptedException, IOException { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), fname); + + GLWindow testAWTJpeg(final String fname, final int xpos) throws InterruptedException, IOException { + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), fname); Assert.assertNotNull(testTextureUrlConn); - InputStream istream = testTextureUrlConn.getInputStream(); + final InputStream istream = testTextureUrlConn.getInputStream(); Assert.assertNotNull(istream); - - GLProfile glp = GLProfile.getGL2ES2(); + + final GLProfile glp = GLProfile.getGL2ES2(); TextureData texData = null; int w = 300, h = 300; try { - BufferedImage img = ImageIO.read(istream); + final BufferedImage img = ImageIO.read(istream); texData = new AWTTextureData(glp, 0, 0, false, img); System.err.println("TextureData: "+texData); w = texData.getWidth(); h = texData.getHeight(); - } catch (Exception e) { + } catch (final Exception e) { System.err.println("AWT ImageIO failure w/ file "+fname+": "+e.getMessage()); // e.printStackTrace(); // : CMYK, YCCK -> 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<args.length; i++) { if(args[i].equals("-time")) { i++; duration = MiscUtils.atol(args[i], duration); } } - org.junit.runner.JUnitCore.main(TestJPEGJoglAWTCompareNewtAWT.class.getName()); + org.junit.runner.JUnitCore.main(TestJPEGJoglAWTCompareNewtAWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGTextureFromFileNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGTextureFromFileNEWT.java index 60855e5be..565434e2e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGTextureFromFileNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGTextureFromFileNEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.util.texture; @@ -63,87 +63,87 @@ import org.junit.runners.MethodSorters; public class TestJPEGTextureFromFileNEWT extends UITestCase { static boolean showFPS = false; static long duration = 100; // ms - + InputStream testTextureStream01YUV444_Base; InputStream testTextureStream01YUV444_Prog; - + InputStream testTextureStream01YUV422h_Base; InputStream testTextureStream01YUV422h_Prog; - + InputStream testTextureStream02YUV420_Base; InputStream testTextureStream02YUV420_Prog; InputStream testTextureStream02YUV420_BaseGray; - + InputStream testTextureStream03CMYK_01; InputStream testTextureStream03YCCK_01; - + InputStream testTextureStream04QTTDefPostFrame; - + @Before public void initTest() throws IOException { { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90-90pct-yuv444-base.jpg"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90-90pct-yuv444-base.jpg"); Assert.assertNotNull(testTextureUrlConn); testTextureStream01YUV444_Base = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream01YUV444_Base); } { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90-90pct-yuv444-prog.jpg"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90-90pct-yuv444-prog.jpg"); Assert.assertNotNull(testTextureUrlConn); testTextureStream01YUV444_Prog = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream01YUV444_Prog); - } + } { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90-60pct-yuv422h-base.jpg"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90-60pct-yuv422h-base.jpg"); Assert.assertNotNull(testTextureUrlConn); testTextureStream01YUV422h_Base = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream01YUV422h_Base); } { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90-60pct-yuv422h-prog.jpg"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90-60pct-yuv422h-prog.jpg"); Assert.assertNotNull(testTextureUrlConn); testTextureStream01YUV422h_Prog = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream01YUV422h_Prog); } - + { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "j1-baseline.jpg"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "j1-baseline.jpg"); Assert.assertNotNull(testTextureUrlConn); testTextureStream02YUV420_Base = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream02YUV420_Base); } { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "j2-progressive.jpg"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "j2-progressive.jpg"); Assert.assertNotNull(testTextureUrlConn); testTextureStream02YUV420_Prog = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream02YUV420_Prog); } { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "j3-baseline_gray.jpg"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "j3-baseline_gray.jpg"); Assert.assertNotNull(testTextureUrlConn); testTextureStream02YUV420_BaseGray = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream02YUV420_BaseGray); } - + { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-cmyk-01.jpg"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-cmyk-01.jpg"); Assert.assertNotNull(testTextureUrlConn); testTextureStream03CMYK_01 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream03CMYK_01); } { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ycck-01.jpg"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ycck-01.jpg"); Assert.assertNotNull(testTextureUrlConn); testTextureStream03YCCK_01 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream03YCCK_01); } { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "bug745_qttdef_post_frame.jpg"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "bug745_qttdef_post_frame.jpg"); Assert.assertNotNull(testTextureUrlConn); testTextureStream04QTTDefPostFrame = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream04QTTDefPostFrame); } - + } @After @@ -156,11 +156,11 @@ public class TestJPEGTextureFromFileNEWT extends UITestCase { testTextureStream02YUV420_Prog = null; testTextureStream02YUV420_BaseGray = null; testTextureStream03CMYK_01 = null; - testTextureStream03YCCK_01 = null; + testTextureStream03YCCK_01 = null; testTextureStream04QTTDefPostFrame = null; } - 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)) { @@ -173,39 +173,39 @@ public class TestJPEGTextureFromFileNEWT extends UITestCase { } final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(1); - + final TextureData texData = TextureIO.newTextureData(glp, istream, false /* mipmap */, TextureIO.JPG); - System.err.println("TextureData: "+texData); - + System.err.println("TextureData: "+texData); + final GLWindow glad = GLWindow.create(caps); glad.setTitle("TestPNGTextureGL2FromFileNEWT"); // 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); @@ -214,71 +214,71 @@ public class TestJPEGTextureFromFileNEWT extends UITestCase { while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) { Thread.sleep(100); } - + animator.stop(); glad.destroy(); } - + @Test public void test01YUV444Base__GL2() throws InterruptedException, IOException { - testImpl(true, testTextureStream01YUV444_Base); - } + testImpl(true, testTextureStream01YUV444_Base); + } @Test public void test01YUV444Base__ES2() throws InterruptedException, IOException { - testImpl(false, testTextureStream01YUV444_Base); - } + testImpl(false, testTextureStream01YUV444_Base); + } @Test public void test01YUV444Prog__GL2() throws InterruptedException, IOException { - testImpl(true, testTextureStream01YUV444_Prog); - } + testImpl(true, testTextureStream01YUV444_Prog); + } @Test public void test01YUV444Prog__ES2() throws InterruptedException, IOException { - testImpl(false, testTextureStream01YUV444_Prog); - } - + testImpl(false, testTextureStream01YUV444_Prog); + } + @Test public void test01YUV422hBase__ES2() throws InterruptedException, IOException { - testImpl(false, testTextureStream01YUV422h_Base); - } + testImpl(false, testTextureStream01YUV422h_Base); + } @Test public void test01YUV422hProg_ES2() throws InterruptedException, IOException { - testImpl(false, testTextureStream01YUV422h_Prog); - } - + testImpl(false, testTextureStream01YUV422h_Prog); + } + @Test public void test02YUV420Base__ES2() throws InterruptedException, IOException { - testImpl(false, testTextureStream02YUV420_Base); - } + testImpl(false, testTextureStream02YUV420_Base); + } @Test public void test02YUV420Prog_ES2() throws InterruptedException, IOException { - testImpl(false, testTextureStream02YUV420_Prog); - } + testImpl(false, testTextureStream02YUV420_Prog); + } @Test public void test02YUV420BaseGray_ES2() throws InterruptedException, IOException { - testImpl(false, testTextureStream02YUV420_BaseGray); + testImpl(false, testTextureStream02YUV420_BaseGray); } @Test public void test03CMYK_01_ES2() throws InterruptedException, IOException { - testImpl(false, testTextureStream03CMYK_01); - } + testImpl(false, testTextureStream03CMYK_01); + } @Test public void test03YCCK_01_ES2() throws InterruptedException, IOException { - testImpl(false, testTextureStream03YCCK_01); - } + testImpl(false, testTextureStream03YCCK_01); + } @Test public void test04QTTDefPostFrame_ES2() throws InterruptedException, IOException { - testImpl(false, testTextureStream04QTTDefPostFrame); - } - - public static void main(String args[]) throws IOException { + testImpl(false, testTextureStream04QTTDefPostFrame); + } + + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; duration = MiscUtils.atol(args[i], duration); } } - org.junit.runner.JUnitCore.main(TestJPEGTextureFromFileNEWT.class.getName()); + org.junit.runner.JUnitCore.main(TestJPEGTextureFromFileNEWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect00NEWT.java index c2b39f0f3..8f63a4f4c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect00NEWT.java @@ -128,7 +128,7 @@ public class TestPNGPixelRect00NEWT extends UITestCase { final File out2F_f=new File(getSimpleTestName(".")+"-02-"+basename+"-flipped.png"); final File out2R_f=new File(getSimpleTestName(".")+"-03-"+basename+"-reversed.png"); final File out2RF_f=new File(getSimpleTestName(".")+"-04-"+basename+"-reversed_flipped.png"); - URLConnection urlConn = IOUtil.getResource(this.getClass(), pathname+basename+".png"); + final URLConnection urlConn = IOUtil.getResource(this.getClass(), pathname+basename+".png"); if( null == urlConn ) { throw new IOException("Cannot find "+pathname+basename+".png"); } @@ -205,7 +205,7 @@ public class TestPNGPixelRect00NEWT extends UITestCase { System.err.println("Test02: "+pathname+basename+".png, destFmt "+destFmt+", destMinStrideInBytes "+destMinStrideInBytes+", destIsGLOriented "+destIsGLOriented); final File out1_f=new File(getSimpleTestName(".")+"-"+basename+"-orig.png"); - 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(), destFmt, false /* directBuffer */, destMinStrideInBytes, destIsGLOriented); System.err.println("PNGPixelRect - Orig: "+image1); @@ -220,7 +220,7 @@ public class TestPNGPixelRect00NEWT extends UITestCase { } } - public static void main(String args[]) { + public static void main(final String args[]) { org.junit.runner.JUnitCore.main(TestPNGPixelRect00NEWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect01NEWT.java index 3b1d9fbb0..4a324f594 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect01NEWT.java @@ -117,12 +117,12 @@ public class TestPNGPixelRect01NEWT extends UITestCase { glad.addGLEventListener(new GLEventListener() { boolean shot = false; - @Override public void init(GLAutoDrawable drawable) { + @Override public void init(final GLAutoDrawable drawable) { System.err.println("Chosen Caps: " + drawable.getChosenGLCapabilities()); System.err.println("GL ctx: " + drawable.getGL().getContext()); } - @Override public void display(GLAutoDrawable drawable) { + @Override public void display(final GLAutoDrawable drawable) { // 1 snapshot if(null!=((TextureDraw01Accessor)gle).getTexture() && !shot) { shot = true; @@ -130,13 +130,13 @@ public class TestPNGPixelRect01NEWT extends UITestCase { } } - @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); @@ -192,7 +192,7 @@ public class TestPNGPixelRect01NEWT extends UITestCase { } static String _fname = null; - public static void main(String args[]) { + public static void main(final String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java index 7ea053a86..bbcd04454 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java @@ -86,7 +86,7 @@ public class TestPNGTextureFromFileAWT extends UITestCase { grayTextureStream = TestPNGTextureFromFileAWT.class.getResourceAsStream( "grayscale_texture.png" ); Assert.assertNotNull(grayTextureStream); { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90.png"); Assert.assertNotNull(testTextureUrlConn); testTextureStream = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStream); @@ -99,7 +99,7 @@ public class TestPNGTextureFromFileAWT extends UITestCase { testTextureStream = null; } - public void testImpl(boolean useFFP, final InputStream istream, final boolean useAWTIIOP) + public void testImpl(final boolean useFFP, final InputStream istream, final boolean useAWTIIOP) throws InterruptedException, IOException { final GLReadBufferUtil screenshot = new GLReadBufferUtil(true, false); @@ -123,7 +123,7 @@ public class TestPNGTextureFromFileAWT extends UITestCase { System.err.println("TextureData: "+texData); final GLCanvas glc = new GLCanvas(caps); - Dimension glc_sz = new Dimension(texData.getWidth(), texData.getHeight()); + final Dimension glc_sz = new Dimension(texData.getWidth(), texData.getHeight()); glc.setMinimumSize(glc_sz); glc.setPreferredSize(glc_sz); final Frame frame = new Frame("TestPNGTextureGL2FromFileAWT"); @@ -137,10 +137,10 @@ public class TestPNGTextureFromFileAWT extends UITestCase { glc.addGLEventListener(new GLEventListener() { boolean shot = false; - @Override public void init(GLAutoDrawable drawable) {} + @Override public void init(final GLAutoDrawable drawable) {} @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { // 1 snapshot if(null!=((TextureDraw01Accessor)gle).getTexture() && !shot) { shot = true; @@ -148,8 +148,8 @@ public class TestPNGTextureFromFileAWT extends UITestCase { } } - @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) { } }); final QuitAdapter quitAdapter = new QuitAdapter(); @@ -162,12 +162,12 @@ public class TestPNGTextureFromFileAWT extends UITestCase { frame.pack(); frame.setVisible(true); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } - Animator animator = new Animator(glc); + final Animator animator = new Animator(glc); animator.setUpdateFPSFrames(60, showFPS ? System.err : null); animator.start(); @@ -183,7 +183,7 @@ public class TestPNGTextureFromFileAWT extends UITestCase { frame.remove(glc); frame.dispose(); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -225,7 +225,7 @@ public class TestPNGTextureFromFileAWT extends UITestCase { testImpl(false, testTextureStream, false); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileNEWT.java index ce363b612..bbfc2907f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileNEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.util.texture; @@ -64,16 +64,16 @@ public class TestPNGTextureFromFileNEWT extends UITestCase { static boolean showFPS = false; static long duration = 100; // ms InputStream grayTextureStream; - + InputStream testTextureStreamN_3; InputStream testTextureStreamN_4; InputStream testTextureStreamNG4; - + InputStream testTextureStreamI_3; InputStream testTextureStreamIG3; InputStream testTextureStreamI_4; InputStream testTextureStreamIG4; - + InputStream testTextureStreamP_3; InputStream testTextureStreamP_4; @@ -82,58 +82,58 @@ public class TestPNGTextureFromFileNEWT extends UITestCase { grayTextureStream = TestPNGTextureFromFileNEWT.class.getResourceAsStream( "grayscale_texture.png" ); Assert.assertNotNull(grayTextureStream); { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90.png"); Assert.assertNotNull(testTextureUrlConn); testTextureStreamN_3 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStreamN_3); } { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_4-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_4-01-160x90.png"); Assert.assertNotNull(testTextureUrlConn); testTextureStreamN_4 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStreamN_4); } { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscNG4-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscNG4-01-160x90.png"); Assert.assertNotNull(testTextureUrlConn); testTextureStreamNG4 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStreamNG4); } - + { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscI_3-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscI_3-01-160x90.png"); Assert.assertNotNull(testTextureUrlConn); testTextureStreamI_3 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStreamI_3); } { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscIG3-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscIG3-01-160x90.png"); Assert.assertNotNull(testTextureUrlConn); testTextureStreamIG3 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStreamIG3); } { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscI_4-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscI_4-01-160x90.png"); Assert.assertNotNull(testTextureUrlConn); testTextureStreamI_4 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStreamI_4); } { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscIG4-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscIG4-01-160x90.png"); Assert.assertNotNull(testTextureUrlConn); testTextureStreamIG4 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStreamIG4); } - - + + { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscP_3-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscP_3-01-160x90.png"); Assert.assertNotNull(testTextureUrlConn); testTextureStreamP_3 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStreamP_3); } { - URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscP_4-01-160x90.png"); + final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscP_4-01-160x90.png"); Assert.assertNotNull(testTextureUrlConn); testTextureStreamP_4 = testTextureUrlConn.getInputStream(); Assert.assertNotNull(testTextureStreamP_4); @@ -150,7 +150,7 @@ public class TestPNGTextureFromFileNEWT extends UITestCase { testTextureStreamP_4 = null; } - 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)) { @@ -163,39 +163,39 @@ public class TestPNGTextureFromFileNEWT extends UITestCase { } final GLCapabilities caps = new GLCapabilities(glp); caps.setAlphaBits(1); - + final TextureData texData = TextureIO.newTextureData(glp, istream, false /* mipmap */, TextureIO.PNG); - System.err.println("TextureData: "+texData); - + System.err.println("TextureData: "+texData); + final GLWindow glad = GLWindow.create(caps); glad.setTitle("TestPNGTextureGL2FromFileNEWT"); // 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); @@ -204,74 +204,74 @@ public class TestPNGTextureFromFileNEWT extends UITestCase { while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) { Thread.sleep(100); } - + animator.stop(); glad.destroy(); } - + @Test public void testGray__GL2() throws InterruptedException, IOException { - testImpl(true, grayTextureStream); - } + testImpl(true, grayTextureStream); + } @Test public void testGray__ES2() throws InterruptedException, IOException { - testImpl(false, grayTextureStream); + testImpl(false, grayTextureStream); } - + @Test public void testRGB3__GL2() throws InterruptedException, IOException { - testImpl(true, testTextureStreamN_3); - } + testImpl(true, testTextureStreamN_3); + } @Test public void testRGB3__ES2() throws InterruptedException, IOException { - testImpl(false, testTextureStreamN_3); - } + testImpl(false, testTextureStreamN_3); + } @Test public void testRGB4__GL2() throws InterruptedException, IOException { - testImpl(true, testTextureStreamN_4); - } + testImpl(true, testTextureStreamN_4); + } @Test public void testRGB4__ES2() throws InterruptedException, IOException { - testImpl(false, testTextureStreamN_4); - } + testImpl(false, testTextureStreamN_4); + } @Test public void testRGB4G_ES2() throws InterruptedException, IOException { - testImpl(false, testTextureStreamNG4); + testImpl(false, testTextureStreamNG4); } - + @Test public void testInterl3__ES2() throws InterruptedException, IOException { - testImpl(false, testTextureStreamI_3); - } + testImpl(false, testTextureStreamI_3); + } @Test public void testInterl4__ES2() throws InterruptedException, IOException { - testImpl(false, testTextureStreamI_4); + testImpl(false, testTextureStreamI_4); } @Test public void testInterl3G_ES2() throws InterruptedException, IOException { - testImpl(false, testTextureStreamIG3); - } + testImpl(false, testTextureStreamIG3); + } @Test public void testInterl4G_ES2() throws InterruptedException, IOException { - testImpl(false, testTextureStreamIG4); + testImpl(false, testTextureStreamIG4); } - + @Test public void testPalette3__ES2() throws InterruptedException, IOException { - testImpl(false, testTextureStreamP_3); - } + testImpl(false, testTextureStreamP_3); + } @Test public void testPalette4__ES2() throws InterruptedException, IOException { - testImpl(false, testTextureStreamP_4); - } - - public static void main(String args[]) throws IOException { + testImpl(false, testTextureStreamP_4); + } + + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; duration = MiscUtils.atol(args[i], duration); } } - org.junit.runner.JUnitCore.main(TestPNGTextureFromFileNEWT.class.getName()); + org.junit.runner.JUnitCore.main(TestPNGTextureFromFileNEWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil00NEWT.java index bfcf9c2d7..90b8504d9 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil00NEWT.java @@ -271,7 +271,7 @@ public class TestPixelFormatUtil00NEWT extends UITestCase { } } } - private void dumpComponents(PixelRectangle image, int x1, int y1, int w, int h) { + private void dumpComponents(final PixelRectangle image, int x1, int y1, final int w, final int h) { if( x1 + w >= image.getSize().getWidth() ) { x1 = image.getSize().getWidth() - w; } @@ -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()<duration) { Thread.sleep(100); } - + animator.stop(); glad.destroy(); } - + @Test public void test01U32__GL2() throws InterruptedException, IOException { - testImpl(true, testTextureStream01U32); + testImpl(true, testTextureStream01U32); } - + @Test public void test02RLE32__GL2() throws InterruptedException, IOException { - testImpl(true, testTextureStream02RLE32); + testImpl(true, testTextureStream02RLE32); } - + @After public void cleanupTest() { testTextureStream01U32 = null; testTextureStream02RLE32 = null; } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; duration = MiscUtils.atol(args[i], duration); } } - org.junit.runner.JUnitCore.main(TestTGATextureFromFileNEWT.class.getName()); + org.junit.runner.JUnitCore.main(TestTGATextureFromFileNEWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTexture01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTexture01AWT.java index 855529f9c..5a51473b4 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTexture01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTexture01AWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.util.texture; @@ -67,8 +67,8 @@ import org.junit.runners.MethodSorters; /** * Demonstrates TextureData w/ AWT usage in both directions, * i.e. generating a texture based on an AWT BufferedImage data - * as well as reading out GL framebuffer and displaying it - * as an BufferedImage. + * as well as reading out GL framebuffer and displaying it + * as an BufferedImage. */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestTexture01AWT extends UITestCase { @@ -102,7 +102,7 @@ public class TestTexture01AWT extends UITestCase { g.dispose(); // create texture image - int imageType = BufferedImage.TYPE_3BYTE_BGR; + final int imageType = BufferedImage.TYPE_3BYTE_BGR; textureImage = new BufferedImage(baseImage.getWidth(), baseImage.getHeight(), imageType); @@ -129,26 +129,26 @@ public class TestTexture01AWT extends UITestCase { final Frame frame0 = new Frame("GL -> 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atol(args[++i], durationPerTest); } } - String tstname = TestTexture01AWT.class.getName(); + final String tstname = TestTexture01AWT.class.getName(); org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { tstname, "filtertrace=true", diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTexture02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTexture02AWT.java index 566ce0f18..c54b9b3e7 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTexture02AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTexture02AWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.util.texture; @@ -57,8 +57,8 @@ import org.junit.runners.MethodSorters; /** * Demonstrates TextureData w/ AWT usage, - * i.e. reading out an animated GL framebuffer and displaying it - * as an BufferedImage. + * i.e. reading out an animated GL framebuffer and displaying it + * as an BufferedImage. */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestTexture02AWT extends UITestCase { @@ -85,31 +85,31 @@ public class TestTexture02AWT extends UITestCase { final ImageIcon imageIcon = new ImageIcon(); final JLabel imageLabel = new JLabel(imageIcon); frame0.add(imageLabel); - + final GLCanvas glCanvas = new GLCanvas(caps); final Frame frame1 = new Frame("GearsES2"); Assert.assertNotNull(frame1); frame1.add(glCanvas); glCanvas.addGLEventListener(new GearsES2(1)); - glCanvas.addGLEventListener(new GLEventListener() { + 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 */); + public void display(final GLAutoDrawable drawable) { + final BufferedImage outputImage = awtGLReadBufferUtil.readPixelsToBufferedImage(drawable.getGL(), true /* awtOrientation */); imageIcon.setImage(outputImage); imageLabel.repaint(); } @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 { @@ -122,13 +122,13 @@ public class TestTexture02AWT 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 ); - } - FPSAnimator animator = new FPSAnimator(glCanvas, 15); // 15fps + } + final FPSAnimator animator = new FPSAnimator(glCanvas, 15); // 15fps animator.start(); - + Thread.sleep(durationPerTest); animator.stop(); @@ -140,19 +140,19 @@ public class TestTexture02AWT 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atol(args[++i], durationPerTest); } } - String tstname = TestTexture02AWT.class.getName(); + final String tstname = TestTexture02AWT.class.getName(); org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { tstname, "filtertrace=true", diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01AWT.java index 5549254c4..5a294eee9 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01AWT.java @@ -51,19 +51,19 @@ public class TestTextureSequence01AWT extends UITestCase { final ImageSequence texSource = new ImageSequence(0, useBuildInTexLookup); glc.addGLEventListener(new GLEventListener() { @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { try { texSource.addFrame(drawable.getGL(), TestTextureSequence01AWT.class, "test-ntscP_3-01-160x90.png", TextureIO.PNG); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } } @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) { } }); glc.addGLEventListener(new TextureSequenceCubeES2(texSource, false, -2.3f, 0f, 0f)); @@ -77,7 +77,7 @@ public class TestTextureSequence01AWT extends UITestCase { frame.setSize(width, height); frame.setVisible(true); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -100,7 +100,7 @@ public class TestTextureSequence01AWT extends UITestCase { frame.remove(glc); frame.dispose(); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -111,7 +111,7 @@ public class TestTextureSequence01AWT extends UITestCase { testImpl(); } - public static void main(String[] args) { + public static void main(final String[] args) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01NEWT.java index c365b78d6..47b594e9d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01NEWT.java @@ -48,24 +48,24 @@ public class TestTextureSequence01NEWT extends UITestCase { final ImageSequence texSource = new ImageSequence(0, useBuildInTexLookup); window.addGLEventListener(new GLEventListener() { @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { try { texSource.addFrame(drawable.getGL(), TestTextureSequence01NEWT.class, "test-ntscP_3-01-160x90.png", TextureIO.PNG); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } } @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) { } }); window.addGLEventListener(new TextureSequenceCubeES2(texSource, false, -2.3f, 0f, 0f)); final Animator animator = new Animator(window); animator.setUpdateFPSFrames(60, showFPS ? System.err : null); - QuitAdapter quitAdapter = new QuitAdapter(); + final QuitAdapter quitAdapter = new QuitAdapter(); window.addKeyListener(quitAdapter); window.addWindowListener(quitAdapter); animator.start(); @@ -86,7 +86,7 @@ public class TestTextureSequence01NEWT extends UITestCase { testImpl(); } - public static void main(String[] args) { + public static void main(final String[] args) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/DemoCreateAndDisposeOnCloseNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/DemoCreateAndDisposeOnCloseNEWT.java index e82204fd0..9ab81ef82 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/DemoCreateAndDisposeOnCloseNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/DemoCreateAndDisposeOnCloseNEWT.java @@ -50,7 +50,7 @@ import com.jogamp.opengl.util.Animator; * */ public class DemoCreateAndDisposeOnCloseNEWT { - public static void main(String[] args) { + public static void main(final String[] args) { int closeMode = 0; // 0 - none, 1 - window, animator, 2 - animator, window, 3 - System.exit for(int i=0; i<args.length; i++) { @@ -65,26 +65,26 @@ public class DemoCreateAndDisposeOnCloseNEWT { caps.setDoubleBuffered(true); caps.setDepthBits(16); final Animator animator = new Animator(); - GLWindow glWindow = GLWindow.create(caps); + final GLWindow glWindow = GLWindow.create(caps); animator.add(glWindow); glWindow.addGLEventListener(new GLEventListener() { @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { System.out.println("GLEventListener.reshape"); } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { System.out.println("GLEventListener.init"); } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { System.out.println("GLEventListener.dispose"); } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { } }); glWindow.setTitle("Test"); @@ -96,12 +96,12 @@ public class DemoCreateAndDisposeOnCloseNEWT { glWindow.setDefaultCloseOperation(WindowClosingProtocol.WindowClosingMode.DISPOSE_ON_CLOSE); glWindow.addWindowListener(new WindowAdapter() { @Override - public void windowDestroyNotify(WindowEvent e) { + public void windowDestroyNotify(final WindowEvent e) { System.out.println("GLWindow.destroyNotify"); } @Override - public void windowDestroyed(WindowEvent e) { + public void windowDestroyed(final WindowEvent e) { System.out.println("GLWindow.destroyed"); animator.stop(); } @@ -132,7 +132,7 @@ public class DemoCreateAndDisposeOnCloseNEWT { static void sleep1s() { try { Thread.sleep(1000); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestCloseNewtAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestCloseNewtAWT.java index 817f4140e..f9216f082 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestCloseNewtAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestCloseNewtAWT.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. @@ -34,9 +34,10 @@ 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.NativeWindow; import javax.media.nativewindow.util.Point; import javax.media.opengl.GLCapabilities; @@ -58,7 +59,7 @@ public class TestCloseNewtAWT extends UITestCase { @SuppressWarnings("serial") class MyCanvas extends NewtCanvasAWT { - public MyCanvas(Window window) { + public MyCanvas(final Window window) { super(window); } @@ -79,10 +80,10 @@ public class TestCloseNewtAWT extends UITestCase { ", holds AWTTreeLock: "+Thread.holdsLock(MyCanvas.this.getTreeLock())); // Critical: Within NEWT EDT, while AWT is locked - NativeWindow nw = MyCanvas.this.getNativeWindow(); + final NativeWindow nw = MyCanvas.this.getNativeWindow(); if(null != nw) { - Point p = nw.getLocationOnScreen(null); - System.err.println("MyCanvas On NEWT-EDT: position: "+p); + final Point p = nw.getLocationOnScreen(null); + System.err.println("MyCanvas On NEWT-EDT: position: "+p); } else { System.err.println("MyCanvas On NEWT-EDT: position n/a, null NativeWindow"); } @@ -104,7 +105,7 @@ public class TestCloseNewtAWT extends UITestCase { SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame = new JFrame("NEWT Close Test"); - frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); frame.getContentPane().add(newtCanvas); frame.pack(); frame.setSize(800, 600); @@ -118,8 +119,8 @@ public class TestCloseNewtAWT extends UITestCase { Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, true, closingListener)); } - public static void main(String[] args) { - String tstname = TestCloseNewtAWT.class.getName(); + public static void main(final String[] args) { + final String tstname = TestCloseNewtAWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle01NEWT.java index 8989f3a89..c3345708f 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle01NEWT.java @@ -62,7 +62,7 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { caps = new GLCapabilities(glp); } - static GLWindow createWindow(Screen screen, GLCapabilities caps, int width, int height) + static GLWindow createWindow(final Screen screen, final GLCapabilities caps, final int width, final int height) throws InterruptedException { Assert.assertNotNull(caps); @@ -72,7 +72,7 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { // GLWindow glWindow; if(null!=screen) { - Window window = NewtFactory.createWindow(screen, caps); + final Window window = NewtFactory.createWindow(screen, caps); Assert.assertNotNull(window); glWindow = GLWindow.create(window); } else { @@ -80,7 +80,7 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { } glWindow.setUpdateFPSFrames(1, null); - GLEventListener demo = new GearsES2(); + final GLEventListener demo = new GearsES2(); setDemoFields(demo, glWindow); glWindow.addGLEventListener(demo); glWindow.addWindowListener(new TraceWindowAdapter()); @@ -88,7 +88,7 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { return glWindow; } - private void testDisplayCreate01(Display display, Screen screen) throws InterruptedException { + private void testDisplayCreate01(final Display display, final Screen screen) throws InterruptedException { // start-state == end-state Assert.assertEquals(0,Display.getActiveDisplayNumber()); Assert.assertEquals(0,display.getReferenceCount()); @@ -99,7 +99,7 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { Assert.assertEquals(false,screen.isNativeValid()); // Create Window, pending lazy native creation - GLWindow window = createWindow(screen, caps, width, height); + final GLWindow window = createWindow(screen, caps, width, height); Assert.assertEquals(screen,window.getScreen()); Assert.assertEquals(0,Display.getActiveDisplayNumber()); Assert.assertEquals(0,display.getReferenceCount()); @@ -229,15 +229,15 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { Assert.assertEquals(0,Display.getActiveDisplayNumber()); // Create Display/Screen, pending lazy native creation - Display display = NewtFactory.createDisplay(null); - Screen screen = NewtFactory.createScreen(display, 0); // screen 0 + final Display display = NewtFactory.createDisplay(null); + final Screen screen = NewtFactory.createScreen(display, 0); // screen 0 testDisplayCreate01(display, screen); testDisplayCreate01(display, screen); Assert.assertEquals(0,Display.getActiveDisplayNumber()); } - public static void setDemoFields(GLEventListener demo, GLWindow glWindow) { + public static void setDemoFields(final GLEventListener demo, final GLWindow glWindow) { Assert.assertNotNull(demo); Assert.assertNotNull(glWindow); if(!MiscUtils.setFieldIfExists(demo, "window", glWindow)) { @@ -245,22 +245,22 @@ public class TestDisplayLifecycle01NEWT 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); } } System.err.println("durationPerTest: "+durationPerTest); - String tstname = TestDisplayLifecycle01NEWT.class.getName(); + final String tstname = TestDisplayLifecycle01NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle02NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle02NEWT.java index 0679563b8..17a66691a 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle02NEWT.java @@ -63,7 +63,7 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { caps = new GLCapabilities(glp); } - static GLWindow createWindow(GLCapabilities caps, int width, int height) + static GLWindow createWindow(final GLCapabilities caps, final int width, final int height) throws InterruptedException { Assert.assertNotNull(caps); @@ -71,10 +71,10 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { // // Create native windowing resources .. X11/Win/OSX // - GLWindow glWindow = GLWindow.create(caps); + final GLWindow glWindow = GLWindow.create(caps); glWindow.setUpdateFPSFrames(1, null); - GLEventListener demo = new GearsES2(); + final GLEventListener demo = new GearsES2(); setDemoFields(demo, glWindow); glWindow.addGLEventListener(demo); glWindow.addWindowListener(new TraceWindowAdapter()); @@ -87,9 +87,9 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(0,Display.getActiveDisplayNumber()); // Create Window, pending lazy native creation - GLWindow window = createWindow(caps, width, height); - Screen screen = window.getScreen(); - Display display = screen.getDisplay(); + final GLWindow window = createWindow(caps, width, height); + final Screen screen = window.getScreen(); + final Display display = screen.getDisplay(); Assert.assertEquals(screen,window.getScreen()); Assert.assertEquals(0,Display.getActiveDisplayNumber()); @@ -233,12 +233,12 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(0,Display.getActiveDisplayNumber()); // Create Window, pending lazy native creation - GLWindow window1 = createWindow(caps, width, height); + final GLWindow window1 = createWindow(caps, width, height); window1.setPosition(0, 0); - Screen screen = window1.getScreen(); - Display display = screen.getDisplay(); + final Screen screen = window1.getScreen(); + final Display display = screen.getDisplay(); - GLWindow window2 = createWindow(caps, width, height); + final GLWindow window2 = createWindow(caps, width, height); Assert.assertSame(screen, window2.getScreen()); Assert.assertSame(display, window2.getScreen().getDisplay()); final RectangleImmutable screenBoundsInWinU = screen.getViewportInWindowUnits(); @@ -359,7 +359,7 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(0,Display.getActiveDisplayNumber()); } - public static void setDemoFields(GLEventListener demo, GLWindow glWindow) { + public static void setDemoFields(final GLEventListener demo, final GLWindow glWindow) { Assert.assertNotNull(demo); Assert.assertNotNull(glWindow); if(!MiscUtils.setFieldIfExists(demo, "window", glWindow)) { @@ -367,22 +367,22 @@ public class TestDisplayLifecycle02NEWT 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); } } System.err.println("durationPerTest: "+durationPerTest); - String tstname = TestDisplayLifecycle02NEWT.class.getName(); + final String tstname = TestDisplayLifecycle02NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestEventSourceNotAWTBug.java b/src/test/com/jogamp/opengl/test/junit/newt/TestEventSourceNotAWTBug.java index a2100cfc5..eaafd190f 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestEventSourceNotAWTBug.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestEventSourceNotAWTBug.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; import org.junit.BeforeClass; @@ -59,7 +59,7 @@ public class TestEventSourceNotAWTBug extends UITestCase { @Test public void testEventSourceNotNewtBug() throws InterruptedException, InvocationTargetException { - JFrame jf = new JFrame(); + final JFrame jf = new JFrame(); jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); @@ -90,8 +90,8 @@ public class TestEventSourceNotAWTBug extends UITestCase { glWindow.destroy(); } - public static void main(String args[]) throws IOException { - String tstname = TestEventSourceNotAWTBug.class.getName(); + public static void main(final String args[]) throws IOException { + final String tstname = TestEventSourceNotAWTBug.class.getName(); /* org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { tstname, diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowInvisiblePointer01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowInvisiblePointer01NEWT.java index 75a9e87af..546b35503 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowInvisiblePointer01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowInvisiblePointer01NEWT.java @@ -33,13 +33,13 @@ public class TestGLWindowInvisiblePointer01NEWT extends UITestCase { glp = GLProfile.getDefault(); } - static GLWindow createWindow(Screen screen, GLCapabilitiesImmutable caps) + static GLWindow createWindow(final Screen screen, final GLCapabilitiesImmutable caps) throws InterruptedException { Assert.assertNotNull(caps); // // Create native windowing resources .. X11/Win/OSX - // + // GLWindow glWindow; if(null!=screen) { glWindow = GLWindow.create(screen, caps); @@ -48,9 +48,9 @@ public class TestGLWindowInvisiblePointer01NEWT extends UITestCase { glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); } - glWindow.setUpdateFPSFrames(1, null); + glWindow.setUpdateFPSFrames(1, null); - GLEventListener demo = new GearsES1(); + final GLEventListener demo = new GearsES1(); glWindow.addGLEventListener(demo); glWindow.setSize(512, 512); @@ -61,7 +61,7 @@ public class TestGLWindowInvisiblePointer01NEWT 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()); @@ -70,23 +70,23 @@ public class TestGLWindowInvisiblePointer01NEWT extends UITestCase { @Test public void testWindow00() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); - GLWindow window1 = createWindow(null, caps); // local + final GLWindow window1 = createWindow(null, caps); // local Assert.assertEquals(true,window1.isNativeValid()); Assert.assertEquals(true,window1.isVisible()); - Animator animator = new Animator(); + final Animator animator = new Animator(); animator.setUpdateFPSFrames(1, null); animator.add(window1); animator.start(); - AbstractGraphicsDevice device1 = window1.getScreen().getDisplay().getGraphicsDevice(); + final AbstractGraphicsDevice device1 = window1.getScreen().getDisplay().getGraphicsDevice(); System.err.println("GLProfiles window1: "+device1.getConnection()+": "+GLProfile.glAvailabilityToString(device1)); - + window1.warpPointer(width / 2, height / 2); window1.requestFocus(); while(animator.isAnimating() && animator.getTotalFPSDuration()<durationPerTest) { - boolean pointerVisibleNewVal = (animator.getTotalFPSDuration()/100)%2==0; + final boolean pointerVisibleNewVal = (animator.getTotalFPSDuration()/100)%2==0; window1.setPointerVisible(pointerVisibleNewVal); Assert.assertEquals(pointerVisibleNewVal,window1.isPointerVisible()); Thread.sleep(100); @@ -95,22 +95,22 @@ public class TestGLWindowInvisiblePointer01NEWT extends UITestCase { destroyWindow(window1); } - 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); } } System.out.println("durationPerTest: "+durationPerTest); - String tstname = TestGLWindowInvisiblePointer01NEWT.class.getName(); + final String tstname = TestGLWindowInvisiblePointer01NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowWarpPointer01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowWarpPointer01NEWT.java index 818133945..04a27dcc9 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowWarpPointer01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowWarpPointer01NEWT.java @@ -37,13 +37,13 @@ public class TestGLWindowWarpPointer01NEWT extends UITestCase { glp = GLProfile.getDefault(); } - static GLWindow createWindow(Screen screen, GLCapabilitiesImmutable caps) + static GLWindow createWindow(final Screen screen, final GLCapabilitiesImmutable caps) throws InterruptedException { Assert.assertNotNull(caps); // // Create native windowing resources .. X11/Win/OSX - // + // GLWindow glWindow; if(null!=screen) { glWindow = GLWindow.create(screen, caps); @@ -52,9 +52,9 @@ public class TestGLWindowWarpPointer01NEWT extends UITestCase { glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); } - glWindow.setUpdateFPSFrames(1, null); + glWindow.setUpdateFPSFrames(1, null); - GLEventListener demo = new GearsES2(); + final GLEventListener demo = new GearsES2(); glWindow.addGLEventListener(demo); glWindow.setSize(512, 512); @@ -65,7 +65,7 @@ public class TestGLWindowWarpPointer01NEWT 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()); @@ -76,75 +76,75 @@ public class TestGLWindowWarpPointer01NEWT extends UITestCase { public void testWarp01Center() throws InterruptedException { testWarpImpl(false); } - + @Test public void testWarp02Random() throws InterruptedException { testWarpImpl(true); } - + void testWarpImpl(final boolean random) throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); final GLWindow window1 = createWindow(null, caps); // local Assert.assertEquals(true,window1.isNativeValid()); Assert.assertEquals(true,window1.isVisible()); - Animator animator = new Animator(); + final Animator animator = new Animator(); animator.setUpdateFPSFrames(1, null); animator.add(window1); animator.start(); - AbstractGraphicsDevice device1 = window1.getScreen().getDisplay().getGraphicsDevice(); + final AbstractGraphicsDevice device1 = window1.getScreen().getDisplay().getGraphicsDevice(); System.err.println("GLProfiles window1: "+device1.getConnection()+": "+GLProfile.glAvailabilityToString(device1)); - + window1.warpPointer(width / 2, height / 2); window1.requestFocus(); - + window1.addMouseListener(new MouseAdapter() { void warpCenter() { window1.warpPointer(width / 2, height / 2); } - + @Override - public void mouseEntered(MouseEvent e) { + public void mouseEntered(final MouseEvent e) { } @Override - public void mouseExited(MouseEvent e) { + public void mouseExited(final MouseEvent e) { warpCenter(); } @Override - public void mouseMoved(MouseEvent e) { + public void mouseMoved(final MouseEvent e) { } }); - + if( random ) { window1.addGLEventListener(new GLEventListener() { final Random r = new Random(); - - void warpRandom(int width, int height) { - int x = r.nextInt(width); - int y = r.nextInt(height); + + void warpRandom(final int width, final int height) { + final int x = r.nextInt(width); + final int y = r.nextInt(height); window1.warpPointer(x, y); } - + @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) { warpRandom(drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); } - + @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) {} + }); } - + while(animator.isAnimating() && animator.getTotalFPSDuration()<durationPerTest) { Thread.sleep(100); } @@ -152,22 +152,22 @@ public class TestGLWindowWarpPointer01NEWT extends UITestCase { destroyWindow(window1); } - 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); } } System.out.println("durationPerTest: "+durationPerTest); - String tstname = TestGLWindowWarpPointer01NEWT.class.getName(); + final String tstname = TestGLWindowWarpPointer01NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java index 384b6806a..bd84341b8 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.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; import org.junit.Assert; @@ -58,13 +58,13 @@ public class TestGLWindows00NEWT extends UITestCase { glp = GLProfile.getDefault(); } - static GLWindow createWindow(Screen screen, GLCapabilitiesImmutable caps) + static GLWindow createWindow(final Screen screen, final GLCapabilitiesImmutable caps) throws InterruptedException { Assert.assertNotNull(caps); // // Create native windowing resources .. X11/Win/OSX - // + // GLWindow glWindow; if(null!=screen) { glWindow = GLWindow.create(screen, caps); @@ -73,9 +73,9 @@ public class TestGLWindows00NEWT extends UITestCase { glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); } - glWindow.setUpdateFPSFrames(1, null); + glWindow.setUpdateFPSFrames(1, null); - GLEventListener demo = new GearsES2(); + final GLEventListener demo = new GearsES2(); glWindow.addGLEventListener(demo); glWindow.setSize(512, 512); @@ -86,7 +86,7 @@ public class TestGLWindows00NEWT 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()); @@ -95,12 +95,12 @@ public class TestGLWindows00NEWT extends UITestCase { @Test public void testWindow00() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); - GLWindow window1 = createWindow(null, caps); // local + final GLWindow window1 = createWindow(null, caps); // local Assert.assertEquals(true,window1.isNativeValid()); Assert.assertEquals(true,window1.isVisible()); - AbstractGraphicsDevice device1 = window1.getScreen().getDisplay().getGraphicsDevice(); + final AbstractGraphicsDevice device1 = window1.getScreen().getDisplay().getGraphicsDevice(); System.err.println("GLProfiles window1: "+device1.getConnection()+": "+GLProfile.glAvailabilityToString(device1)); @@ -111,22 +111,22 @@ public class TestGLWindows00NEWT extends UITestCase { destroyWindow(window1); } - 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); } } System.out.println("durationPerTest: "+durationPerTest); - String tstname = TestGLWindows00NEWT.class.getName(); + final String tstname = TestGLWindows00NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java index 2b3e448db..ea3e96a47 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.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; import org.junit.Assert; @@ -58,9 +58,9 @@ public class TestGLWindows01NEWT extends UITestCase { glp = GLProfile.getDefault(); } - static GLWindow createWindow(Screen screen, GLCapabilities caps, - int width, int height, boolean onscreen, boolean undecorated, - boolean addGLEventListenerAfterVisible) + static GLWindow createWindow(final Screen screen, final GLCapabilities caps, + final int width, final int height, final boolean onscreen, final boolean undecorated, + final boolean addGLEventListenerAfterVisible) throws InterruptedException { Assert.assertNotNull(caps); @@ -69,7 +69,7 @@ public class TestGLWindows01NEWT extends UITestCase { // // Create native windowing resources .. X11/Win/OSX - // + // GLWindow glWindow; if(null!=screen) { glWindow = GLWindow.create(screen, caps); @@ -83,7 +83,7 @@ public class TestGLWindows01NEWT extends UITestCase { Assert.assertEquals(false,glWindow.isVisible()); Assert.assertEquals(false,glWindow.isNativeValid()); - GLEventListener demo = new GearsES2(); + final GLEventListener demo = new GearsES2(); setDemoFields(demo, glWindow); if(!addGLEventListenerAfterVisible) { glWindow.addGLEventListener(demo); @@ -100,10 +100,10 @@ public class TestGLWindows01NEWT extends UITestCase { Assert.assertTrue(0 < glWindow.getTotalFPSFrames()); // - // Create native OpenGL resources .. XGL/WGL/CGL .. + // Create native OpenGL resources .. XGL/WGL/CGL .. // equivalent to GLAutoDrawable methods: setVisible(true) - // - GLCapabilitiesImmutable caps2 = glWindow.getChosenGLCapabilities(); + // + final GLCapabilitiesImmutable caps2 = glWindow.getChosenGLCapabilities(); Assert.assertNotNull(caps2); Assert.assertTrue(caps2.getGreenBits()>=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<durationPerTest; state++) { @@ -232,21 +232,21 @@ public class TestGLWindows01NEWT extends UITestCase { @Test public void testWindowDecor03TwoWinOneDisplay() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + 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 window1 = createWindow(screen, caps, width, height, - true /* onscreen */, false /* undecorated */, + final GLWindow window1 = createWindow(screen, caps, width, height, + true /* onscreen */, false /* undecorated */, false /*addGLEventListenerAfterVisible*/); Assert.assertNotNull(window1); - GLWindow window2 = createWindow(screen, caps, width, height, - true /* onscreen */, false /* undecorated */, + final GLWindow window2 = createWindow(screen, caps, width, height, + true /* onscreen */, false /* undecorated */, false /*addGLEventListenerAfterVisible*/); Assert.assertNotNull(window2); @@ -282,26 +282,26 @@ public class TestGLWindows01NEWT extends UITestCase { @Test public void testWindowDecor03TwoWinTwoDisplays() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); - Display display1 = NewtFactory.createDisplay(null, false); // local display + final Display display1 = NewtFactory.createDisplay(null, false); // local display Assert.assertNotNull(display1); - Display display2 = NewtFactory.createDisplay(null, false); // local display + final Display display2 = NewtFactory.createDisplay(null, false); // local display Assert.assertNotNull(display2); Assert.assertNotSame(display1, display2); - Screen screen1 = NewtFactory.createScreen(display1, 0); // screen 0 + final Screen screen1 = NewtFactory.createScreen(display1, 0); // screen 0 Assert.assertNotNull(screen1); - GLWindow window1 = createWindow(screen1, caps, width, height, - true /* onscreen */, false /* undecorated */, + final GLWindow window1 = createWindow(screen1, caps, width, height, + true /* onscreen */, false /* undecorated */, false /*addGLEventListenerAfterVisible*/); Assert.assertNotNull(window1); - Screen screen2 = NewtFactory.createScreen(display2, 0); // screen 0 + final Screen screen2 = NewtFactory.createScreen(display2, 0); // screen 0 Assert.assertNotNull(screen2); - GLWindow window2 = createWindow(screen2, caps, width, height, - true /* onscreen */, false /* undecorated */, + final GLWindow window2 = createWindow(screen2, caps, width, height, + true /* onscreen */, false /* undecorated */, false /*addGLEventListenerAfterVisible*/); Assert.assertNotNull(window2); @@ -351,10 +351,10 @@ public class TestGLWindows01NEWT extends UITestCase { Assert.assertNotNull(display2.getEDTUtil()); Assert.assertEquals(false,display2.getEDTUtil().isRunning()); Assert.assertEquals(0,screen2.getReferenceCount()); - Assert.assertEquals(false,screen2.isNativeValid()); + Assert.assertEquals(false,screen2.isNativeValid()); } - public static void setDemoFields(GLEventListener demo, GLWindow glWindow) { + public static void setDemoFields(final GLEventListener demo, final GLWindow glWindow) { Assert.assertNotNull(demo); Assert.assertNotNull(glWindow); if(!MiscUtils.setFieldIfExists(demo, "window", glWindow)) { @@ -362,22 +362,22 @@ public class TestGLWindows01NEWT 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); } } System.out.println("durationPerTest: "+durationPerTest); - String tstname = TestGLWindows01NEWT.class.getName(); + final String tstname = TestGLWindows01NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java index 2987fd389..4969c3b77 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java @@ -63,7 +63,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { glp = GLProfile.getDefault(); } - static GLWindow createWindow(Screen screen, GLCapabilities caps, int width, int height, boolean onscreen, boolean undecorated, boolean vsync) { + static GLWindow createWindow(final Screen screen, final GLCapabilities caps, final int width, final int height, final boolean onscreen, final boolean undecorated, final boolean vsync) { Assert.assertNotNull(caps); caps.setOnscreen(onscreen); // System.out.println("Requested: "+caps); @@ -73,7 +73,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { // GLWindow glWindow; if(null!=screen) { - Window window = NewtFactory.createWindow(screen, caps); + final Window window = NewtFactory.createWindow(screen, caps); Assert.assertNotNull(window); glWindow = GLWindow.create(window); } else { @@ -83,7 +83,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { Assert.assertNotNull(glWindow); glWindow.setUndecorated(onscreen && undecorated); - GLEventListener demo = new GearsES2(vsync ? 1 : 0); + final GLEventListener demo = new GearsES2(vsync ? 1 : 0); setDemoFields(demo, glWindow); glWindow.addGLEventListener(demo); glWindow.addWindowListener(new TraceWindowAdapter()); @@ -102,7 +102,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { // Create native OpenGL resources .. XGL/WGL/CGL .. // equivalent to GLAutoDrawable methods: setVisible(true) // - GLCapabilitiesImmutable caps2 = glWindow.getChosenGLCapabilities(); + final GLCapabilitiesImmutable caps2 = glWindow.getChosenGLCapabilities(); Assert.assertNotNull(caps2); Assert.assertTrue(caps2.getGreenBits()>=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()<durationPerTest) { @@ -146,10 +146,10 @@ public class TestGLWindows02NEWTAnimated 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 */, true /* vsync */); - Animator animator = new Animator(); + final GLWindow window = createWindow(null, caps, width, height, true /* onscreen */, false /* undecorated */, true /* vsync */); + final Animator animator = new Animator(); animator.setUpdateFPSFrames(1, null); Assert.assertTrue(animator.start()); Thread.sleep(250); // give animator a chance to become paused @@ -174,24 +174,24 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { @Test public void testWindowDecor03TwoWinOneDisplay() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + 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 window1 = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */, false /* vsync */); + final GLWindow window1 = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */, false /* vsync */); Assert.assertNotNull(window1); window1.setPosition(0, 0); - GLWindow window2 = createWindow(screen, caps, width-10, height-10, true /* onscreen */, false /* undecorated */, true /* vsync */); + final GLWindow window2 = createWindow(screen, caps, width-10, height-10, true /* onscreen */, false /* undecorated */, true /* vsync */); Assert.assertNotNull(window2); final RectangleImmutable screenBoundsInWinU = screen.getViewportInWindowUnits(); window2.setPosition(screenBoundsInWinU.getWidth()-width, 0); - Animator animator = new Animator(); + final Animator animator = new Animator(); animator.setUpdateFPSFrames(1, null); Assert.assertEquals(false, animator.isStarted()); Assert.assertEquals(false, animator.isAnimating()); // zero drawables @@ -236,29 +236,29 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { @Test public void testWindowDecor03TwoWinTwoDisplays() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); - Display display1 = NewtFactory.createDisplay(null, false); // local display + final Display display1 = NewtFactory.createDisplay(null, false); // local display Assert.assertNotNull(display1); - Display display2 = NewtFactory.createDisplay(null, false); // local display + final Display display2 = NewtFactory.createDisplay(null, false); // local display Assert.assertNotNull(display2); Assert.assertNotSame(display1, display2); - Screen screen1 = NewtFactory.createScreen(display1, 0); // screen 0 + final Screen screen1 = NewtFactory.createScreen(display1, 0); // screen 0 Assert.assertNotNull(screen1); - GLWindow window1 = createWindow(screen1, caps, width, height, true /* onscreen */, false /* undecorated */, false /* vsync */); + final GLWindow window1 = createWindow(screen1, caps, width, height, true /* onscreen */, false /* undecorated */, false /* vsync */); Assert.assertNotNull(window1); window1.setPosition(0, 0); - Screen screen2 = NewtFactory.createScreen(display2, 0); // screen 0 + final Screen screen2 = NewtFactory.createScreen(display2, 0); // screen 0 Assert.assertNotNull(screen2); - GLWindow window2 = createWindow(screen2, caps, width-10, height-10, true /* onscreen */, false /* undecorated */, true /* vsync */); + final GLWindow window2 = createWindow(screen2, caps, width-10, height-10, true /* onscreen */, false /* undecorated */, true /* vsync */); Assert.assertNotNull(window2); final RectangleImmutable screen2BoundsInWinU = screen2.getViewportInWindowUnits(); window2.setPosition(screen2BoundsInWinU.getWidth()-width, 0); - Animator animator = new Animator(); + final Animator animator = new Animator(); animator.setUpdateFPSFrames(1, null); Assert.assertEquals(false, animator.isStarted()); Assert.assertEquals(false, animator.isAnimating()); @@ -322,7 +322,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { Assert.assertEquals(false, animator.isPaused()); } - public static void setDemoFields(GLEventListener demo, GLWindow glWindow) { + public static void setDemoFields(final GLEventListener demo, final GLWindow glWindow) { Assert.assertNotNull(demo); Assert.assertNotNull(glWindow); if(!MiscUtils.setFieldIfExists(demo, "window", glWindow)) { @@ -330,21 +330,21 @@ public class TestGLWindows02NEWTAnimated 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); } } - String tstname = TestGLWindows02NEWTAnimated.class.getName(); + final String tstname = TestGLWindows02NEWTAnimated.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows03NEWTAnimResize.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows03NEWTAnimResize.java index 026656607..f7a45c1b0 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows03NEWTAnimResize.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows03NEWTAnimResize.java @@ -63,7 +63,7 @@ public class TestGLWindows03NEWTAnimResize extends UITestCase { glp = GLProfile.getDefault(); } - static void test(GLCapabilitiesImmutable caps, boolean undecorated) throws InterruptedException { + static void test(final GLCapabilitiesImmutable caps, final boolean undecorated) throws InterruptedException { Assert.assertNotNull(caps); // @@ -75,7 +75,7 @@ public class TestGLWindows03NEWTAnimResize extends UITestCase { Assert.assertNotNull(glWindow); glWindow.setUndecorated(undecorated); - GLEventListener demo = new GearsES2(1); + final GLEventListener demo = new GearsES2(1); glWindow.addGLEventListener(demo); glWindow.addWindowListener(new TraceWindowAdapter()); Assert.assertEquals(false,glWindow.isNativeValid()); @@ -94,7 +94,7 @@ public class TestGLWindows03NEWTAnimResize extends UITestCase { int step_i = 0; for(int i=0; i<durationPerTest; i+=50) { Thread.sleep(50); - int j = (int) ( i / (durationPerTest/step) ) + 1; + final int j = (int) ( i / (durationPerTest/step) ) + 1; if(j>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; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atol(args[++i], durationPerTest); } } - String tstname = TestGLWindows03NEWTAnimResize.class.getName(); + final String tstname = TestGLWindows03NEWTAnimResize.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestListenerCom01AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestListenerCom01AWT.java index 91937c8c8..588e3cc0f 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestListenerCom01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestListenerCom01AWT.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; import org.junit.Assert; @@ -64,19 +64,19 @@ public class TestListenerCom01AWT extends UITestCase { @Test public void testListenerStringPassingAndOrder() throws InterruptedException, InvocationTargetException { // setup NEWT GLWindow .. - GLWindow glWindow = GLWindow.create(new GLCapabilities(null)); + final GLWindow glWindow = GLWindow.create(new GLCapabilities(null)); Assert.assertNotNull(glWindow); glWindow.setTitle("NEWT - CHILD"); System.out.println("durationPerTest "+durationPerTest); - GLEventListener demo = new GearsES2(); + final GLEventListener demo = new GearsES2(); setDemoFields(demo, glWindow, false); glWindow.addGLEventListener(demo); - WindowEventCom1 wl1 = new WindowEventCom1(); - WindowEventCom2 wl2 = new WindowEventCom2(); - WindowEventCom3 wl3 = new WindowEventCom3(); + final WindowEventCom1 wl1 = new WindowEventCom1(); + final WindowEventCom2 wl2 = new WindowEventCom2(); + final WindowEventCom3 wl3 = new WindowEventCom3(); // TraceWindowAdapter wlT = new TraceWindowAdapter(); // glWindow.addWindowListener(0, wlT); @@ -91,7 +91,7 @@ public class TestListenerCom01AWT extends UITestCase { Assert.assertEquals(wl3, glWindow.getWindowListener(2)); // attach NEWT GLWindow to AWT Canvas - NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow); + final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow); final Frame frame = new Frame("AWT Parent Frame"); frame.add(newtCanvasAWT); frame.setSize(width, height); @@ -100,8 +100,8 @@ public class TestListenerCom01AWT extends UITestCase { frame.setVisible(true); }}); - Animator animator1 = new Animator(glWindow); - animator1.setUpdateFPSFrames(1, null); + final Animator animator1 = new Animator(glWindow); + animator1.setUpdateFPSFrames(1, null); animator1.start(); while(animator1.isAnimating() && animator1.getTotalFPSDuration()<durationPerTest) { Thread.sleep(100); @@ -118,10 +118,10 @@ public class TestListenerCom01AWT extends UITestCase { glWindow.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); @@ -131,22 +131,22 @@ public class TestListenerCom01AWT 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 { verbose = true; for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); } } - String tstname = TestListenerCom01AWT.class.getName(); + final String tstname = TestListenerCom01AWT.class.getName(); org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { tstname, "filtertrace=true", diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java index d4e8e7eac..4d662c47f 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteGLWindows01NEWT.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; import org.junit.Assert; @@ -54,13 +54,13 @@ public class TestRemoteGLWindows01NEWT extends UITestCase { static long durationPerTest = 100; // ms static String remoteDisplay = "localhost:0.0"; - static GLWindow createWindow(Screen screen, GLCapabilities caps, GLEventListener demo) + static GLWindow createWindow(final Screen screen, final GLCapabilities caps, final GLEventListener demo) throws InterruptedException { Assert.assertNotNull(caps); // // Create native windowing resources .. X11/Win/OSX - // + // GLWindow glWindow; if(null!=screen) { glWindow = GLWindow.create(screen, caps); @@ -69,7 +69,7 @@ public class TestRemoteGLWindows01NEWT extends UITestCase { glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); } - + glWindow.addGLEventListener(demo); glWindow.setSize(512, 512); @@ -80,7 +80,7 @@ public class TestRemoteGLWindows01NEWT 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()); @@ -89,16 +89,16 @@ public class TestRemoteGLWindows01NEWT extends UITestCase { @Test public void testRemoteWindow01() throws InterruptedException { - Animator animator = new Animator(); - GLProfile glpLocal = GLProfile.getGL2ES1(); + final Animator animator = new Animator(); + final GLProfile glpLocal = GLProfile.getGL2ES1(); Assert.assertNotNull(glpLocal); - GLCapabilities capsLocal = new GLCapabilities(glpLocal); + final GLCapabilities capsLocal = new GLCapabilities(glpLocal); Assert.assertNotNull(capsLocal); - GearsES1 demoLocal = new GearsES1(1); - GLWindow windowLocal = createWindow(null, capsLocal, demoLocal); // local with vsync + final GearsES1 demoLocal = new GearsES1(1); + final GLWindow windowLocal = createWindow(null, capsLocal, demoLocal); // local with vsync Assert.assertEquals(true,windowLocal.isNativeValid()); Assert.assertEquals(true,windowLocal.isVisible()); - AbstractGraphicsDevice device1 = windowLocal.getScreen().getDisplay().getGraphicsDevice(); + final AbstractGraphicsDevice device1 = windowLocal.getScreen().getDisplay().getGraphicsDevice(); System.err.println("GLProfiles window1: "+device1.getConnection()+": "+GLProfile.glAvailabilityToString(device1)); @@ -120,14 +120,14 @@ public class TestRemoteGLWindows01NEWT extends UITestCase { GLProfile.initProfiles(deviceRemote); // just to make sure System.err.println(); System.err.println("GLProfiles window2: "+deviceRemote.getConnection()+": "+GLProfile.glAvailabilityToString(deviceRemote)); - GLProfile glpRemote = GLProfile.get(deviceRemote, GLProfile.GL2ES1); + final GLProfile glpRemote = GLProfile.get(deviceRemote, GLProfile.GL2ES1); Assert.assertNotNull(glpRemote); - GLCapabilities capsRemote = new GLCapabilities(glpRemote); + final GLCapabilities capsRemote = new GLCapabilities(glpRemote); Assert.assertNotNull(capsRemote); screenRemote = NewtFactory.createScreen(displayRemote, 0); // screen 0 demoRemote = new GearsES1(0); windowRemote = createWindow(screenRemote, capsRemote, demoRemote); // remote, no vsync - } catch (NativeWindowException nwe) { + } catch (final NativeWindowException nwe) { System.err.println(nwe); Assume.assumeNoException(nwe); destroyWindow(windowLocal); @@ -138,7 +138,7 @@ public class TestRemoteGLWindows01NEWT extends UITestCase { Assert.assertEquals(true,windowRemote.isVisible()); animator.add(windowRemote); - animator.setUpdateFPSFrames(1, null); + animator.setUpdateFPSFrames(1, null); animator.start(); while(animator.getTotalFPSDuration()<durationPerTest) { @@ -153,15 +153,15 @@ public class TestRemoteGLWindows01NEWT extends UITestCase { destroyWindow(windowRemote); } - 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); @@ -171,7 +171,7 @@ public class TestRemoteGLWindows01NEWT extends UITestCase { } System.out.println("durationPerTest: "+durationPerTest); System.out.println("display: "+remoteDisplay); - String tstname = TestRemoteGLWindows01NEWT.class.getName(); + final String tstname = TestRemoteGLWindows01NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteWindow01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteWindow01NEWT.java index a26b96e38..06e55a5eb 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteWindow01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestRemoteWindow01NEWT.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; @@ -55,15 +55,15 @@ public class TestRemoteWindow01NEWT extends UITestCase { height = 480; } - static Window createWindow(Screen screen, Capabilities caps, int width, int height, boolean onscreen, boolean undecorated) { + static Window createWindow(final Screen screen, final Capabilities caps, final int width, final int height, final boolean onscreen, final boolean undecorated) { Assert.assertNotNull(caps); caps.setOnscreen(onscreen); // System.out.println("Requested: "+caps); // // Create native windowing resources .. X11/Win/OSX - // - Window window = NewtFactory.createWindow(screen, caps); + // + final Window window = NewtFactory.createWindow(screen, caps); Assert.assertNotNull(window); window.setUndecorated(onscreen && undecorated); window.setSize(width, height); @@ -77,10 +77,10 @@ public class TestRemoteWindow01NEWT extends UITestCase { // System.out.println("Created: "+window); // - // Create native OpenGL resources .. XGL/WGL/CGL .. + // Create native OpenGL resources .. XGL/WGL/CGL .. // equivalent to GLAutoDrawable methods: setVisible(true) - // - CapabilitiesImmutable chosenCapabilities = window.getGraphicsConfiguration().getChosenCapabilities(); + // + final CapabilitiesImmutable chosenCapabilities = window.getGraphicsConfiguration().getChosenCapabilities(); Assert.assertNotNull(chosenCapabilities); Assert.assertTrue(chosenCapabilities.getGreenBits()>5); 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<args.length; i++) { if(args[i].equals("-display")) { remoteDisplay = args[++i]; } } System.out.println("display: "+remoteDisplay); - String tstname = TestRemoteWindow01NEWT.class.getName(); + final String tstname = TestRemoteWindow01NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java index a88b20714..40b60ac69 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.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,17 +35,16 @@ import org.junit.Assert; import java.lang.reflect.InvocationTargetException; import java.awt.Frame; + import javax.swing.JFrame; import javax.swing.SwingUtilities; - +import javax.swing.WindowConstants; import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode; - import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; import javax.media.opengl.awt.GLCanvas; import com.jogamp.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,8 +56,8 @@ public class TestWindowClosingProtocol01AWT extends UITestCase { public void testCloseFrameGLCanvas() throws InterruptedException, InvocationTargetException { final Frame frame = new Frame("testCloseFrameGLCanvas AWT"); final WindowClosingListener closingListener = AWTRobotUtil.addClosingListener(frame); - GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.getGL2ES2(); + final GLCapabilities caps = new GLCapabilities(glp); final GLCanvas glCanvas = new GLCanvas(caps); glCanvas.addGLEventListener(new GearsES2()); SwingUtilities.invokeAndWait(new Runnable() { @@ -93,7 +92,7 @@ public class TestWindowClosingProtocol01AWT extends UITestCase { glCanvas.setDefaultCloseOperation(WindowClosingMode.DISPOSE_ON_CLOSE); op = glCanvas.getDefaultCloseOperation(); Assert.assertEquals(WindowClosingMode.DISPOSE_ON_CLOSE, op); - + Thread.sleep(300); Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false, closingListener)); // no frame close, but GLCanvas's GL resources will be destroyed @@ -117,9 +116,9 @@ public class TestWindowClosingProtocol01AWT extends UITestCase { public void testCloseJFrameGLCanvas() throws InterruptedException, InvocationTargetException { final JFrame frame = new JFrame("testCloseJFrameGLCanvas AWT"); final WindowClosingListener closingListener = AWTRobotUtil.addClosingListener(frame); - - GLProfile glp = GLProfile.getGL2ES2(); - GLCapabilities caps = new GLCapabilities(glp); + + final GLProfile glp = GLProfile.getGL2ES2(); + final GLCapabilities caps = new GLCapabilities(glp); final GLCanvas glCanvas = new GLCanvas(caps); glCanvas.addGLEventListener(new GearsES2()); SwingUtilities.invokeAndWait(new Runnable() { @@ -136,12 +135,12 @@ public class TestWindowClosingProtocol01AWT extends UITestCase { // // close with op: DO_NOTHING_ON_CLOSE -> 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<String> _failures = new ArrayList<String>() ; - 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<String> clear() { - ArrayList<String> old = _failures; + final ArrayList<String> old = _failures; _eventCount = 0; @@ -122,7 +122,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { return old; } - public ArrayList<String> getFailures(int waitEventCount) { + public ArrayList<String> 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<String> failures = _testMouseListener.getFailures(waitEventCount) ; + private void _checkFailures(final String descr, final int waitEventCount) { + final ArrayList<String> 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<maxEvents && res[0] ); } - + @Override protected void eventDispatch() { eventDispatchImpl(); } - + //////////////////////////////////////////////////////////////////////////// @BeforeClass public static void beforeClass() throws Exception { - // FIXME: Hangs .. w/ Java7 .. every now and then! + // FIXME: Hangs .. w/ Java7 .. every now and then! setTestSupported(false); - + /*** SWTAccessor.invoke(true, new Runnable() { - public void run() { + public void run() { _display = new Display(); }}); Assert.assertNotNull( _display ); - + SWTAccessor.invoke(_display, true, new Runnable() { - public void run() { + public void run() { _shell = new Shell( _display ); Assert.assertNotNull( _shell ); _shell.setText( "Event Modifier Test NewtCanvasSWT" ) ; @@ -122,24 +122,24 @@ public class TestNewtEventModifiersNewtCanvasSWTAWT extends BaseNewtEventModifie NewtCanvasSWT.create( _composite, SWT.NO_BACKGROUND, _glWindow ) ; } - + SWTAccessor.invoke(_display, true, new Runnable() { public void run() { _shell.setBounds( TEST_FRAME_X, TEST_FRAME_Y, TEST_FRAME_WIDTH, TEST_FRAME_HEIGHT ) ; _shell.open(); } }); - + // no AWT idling, may deadlock on OSX! Assert.assertNotNull(_robot); _robot.setAutoWaitForIdle( false ) ; - + // no waiting for results .. AWTRobotUtil.requestFocus(null, _glWindow, false); // programmatic eventDispatchImpl(); AWTRobotUtil.requestFocus(_robot, _glWindow, INITIAL_MOUSE_X, INITIAL_MOUSE_Y); eventDispatchImpl(); - + _glWindow.addMouseListener( _testMouseListener ) ; */ } @@ -153,7 +153,7 @@ public class TestNewtEventModifiersNewtCanvasSWTAWT extends BaseNewtEventModifie try { SWTAccessor.invoke(_display, true, new Runnable() { - public void run() { + public void run() { if( null != _composite ) { _composite.dispose(); } @@ -173,8 +173,8 @@ public class TestNewtEventModifiersNewtCanvasSWTAWT extends BaseNewtEventModifie //////////////////////////////////////////////////////////////////////////// - public static void main(String args[]) throws Exception { - String testName = TestNewtEventModifiersNewtCanvasSWTAWT.class.getName() ; + public static void main(final String args[]) throws Exception { + final String testName = TestNewtEventModifiersNewtCanvasSWTAWT.class.getName() ; org.junit.runner.JUnitCore.main( testName ) ; } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java index 2516fc536..eebbe5469 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java @@ -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.junit.After; @@ -65,7 +65,7 @@ import com.jogamp.opengl.test.junit.util.*; /** * Testing combinations of key code modifiers of key event. - * + * * <p> * 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<EventObject> 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<EventObject> queue = keyAdapter.copyQueue(); + + final List<EventObject> 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); @@ -297,10 +297,10 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase { /** BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); System.err.println("Press enter to continue"); - System.err.println(stdin.readLine()); + System.err.println(stdin.readLine()); */ System.out.println("durationPerTest: "+durationPerTest); - String tstname = TestNewtKeyCodeModifiersAWT.class.getName(); + final String tstname = TestNewtKeyCodeModifiersAWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java index 71778c611..eecc35e4e 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java @@ -95,7 +95,7 @@ public class TestNewtKeyCodesAWT extends UITestCase { @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); @@ -104,8 +104,8 @@ public class TestNewtKeyCodesAWT extends UITestCase { 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); @@ -132,7 +132,7 @@ public class TestNewtKeyCodesAWT extends UITestCase { frame1.setVisible(false); frame1.dispose(); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -188,7 +188,7 @@ public class TestNewtKeyCodesAWT extends UITestCase { // new CodeSeg(KeyEvent.VK_WINDOWS, KeyEvent.VK_HELP, "windows, meta, hlp"), }; - static void testKeyCodes(Robot robot, Object obj, NEWTKeyAdapter keyAdapter) throws InterruptedException, InvocationTargetException { + static void testKeyCodes(final Robot robot, final Object obj, final NEWTKeyAdapter keyAdapter) throws InterruptedException, InvocationTargetException { final List<List<EventObject>> cse = new ArrayList<List<EventObject>>(); 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); @@ -284,7 +284,7 @@ public class TestNewtKeyCodesAWT extends UITestCase { System.err.println(stdin.readLine()); */ System.out.println("durationPerTest: "+durationPerTest); - String tstname = TestNewtKeyCodesAWT.class.getName(); + final String tstname = TestNewtKeyCodesAWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java index c374f1efe..5e78d908f 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java @@ -112,7 +112,7 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase { @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); @@ -123,7 +123,7 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase { @Test(timeout=180000) // TO 3 min public void test02NewtCanvasAWT() throws AWTException, InterruptedException, InvocationTargetException { - GLWindow glWindow = GLWindow.create(glCaps); + final GLWindow glWindow = GLWindow.create(glCaps); // Wrap the window in a canvas. final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow); @@ -147,17 +147,17 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase { frame1.setVisible(false); frame1.dispose(); }}); - } catch( Throwable throwable ) { + } catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } glWindow.destroy(); } - static void testKeyEventAutoRepeat(Robot robot, NEWTKeyAdapter keyAdapter, int loops, int pressDurationMS) { + static void testKeyEventAutoRepeat(final Robot robot, final NEWTKeyAdapter keyAdapter, final int loops, final int pressDurationMS) { System.err.println("KEY Event Auto-Repeat Test: "+loops); - EventObject[][] first = new EventObject[loops][2]; - EventObject[][] last = new EventObject[loops][2]; + final EventObject[][] first = new EventObject[loops][2]; + final EventObject[][] last = new EventObject[loops][2]; keyAdapter.reset(); int firstIdx = 0; @@ -250,21 +250,21 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase { } } - 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); - 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 @@ -291,15 +291,15 @@ public class TestNewtKeyEventAutoRepeatAWT 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); @@ -311,7 +311,7 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase { System.err.println(stdin.readLine()); */ System.out.println("durationPerTest: "+durationPerTest); - String tstname = TestNewtKeyEventAutoRepeatAWT.class.getName(); + final String tstname = TestNewtKeyEventAutoRepeatAWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java index 8cc427508..3f86c186c 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java @@ -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.junit.After; @@ -61,7 +61,7 @@ import com.jogamp.opengl.test.junit.util.*; /** * Testing key event order excl. auto-repeat (Bug 601) - * + * * <p> * Note Event order: * <ol> @@ -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<loops; i++) { @@ -189,44 +189,44 @@ public class TestNewtKeyEventOrderAWT extends UITestCase { AWTRobotUtil.waitForIdle(robot); robot.delay(250); // dumpKeyEvents(keyAdapter.getQueued()); - + NEWTKeyUtil.validateKeyEventOrder(keyAdapter.copyQueue()); - + final int expTotal = 6*loops; // all typed events - NEWTKeyUtil.validateKeyAdapterStats(keyAdapter, - expTotal /* press-SI */, expTotal /* release-SI */, + NEWTKeyUtil.validateKeyAdapterStats(keyAdapter, + expTotal /* press-SI */, expTotal /* release-SI */, 0 /* press-AR */, 0 /* release-AR */ ); - + } - - 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); - 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(); - // + // // Test the key event order w/o auto-repeat // testKeyEventOrder(robot, glWindow1KA, 6); - + // Remove listeners to avoid logging during dispose/destroy. glWindow.removeKeyListener(glWindow1KA); @@ -234,15 +234,15 @@ public class TestNewtKeyEventOrderAWT 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); @@ -251,10 +251,10 @@ public class TestNewtKeyEventOrderAWT extends UITestCase { /** BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); System.err.println("Press enter to continue"); - System.err.println(stdin.readLine()); + System.err.println(stdin.readLine()); */ System.out.println("durationPerTest: "+durationPerTest); - String tstname = TestNewtKeyEventOrderAWT.class.getName(); + final String tstname = TestNewtKeyEventOrderAWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyPressReleaseUnmaskRepeatAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyPressReleaseUnmaskRepeatAWT.java index f48a07a8c..faf239910 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyPressReleaseUnmaskRepeatAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyPressReleaseUnmaskRepeatAWT.java @@ -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.junit.After; @@ -83,35 +83,35 @@ public class TestNewtKeyPressReleaseUnmaskRepeatAWT 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); @@ -120,24 +120,24 @@ public class TestNewtKeyPressReleaseUnmaskRepeatAWT 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() ) { @@ -146,7 +146,7 @@ public class TestNewtKeyPressReleaseUnmaskRepeatAWT extends UITestCase { } testNewtCanvasAWT_Impl(true); } - + @Test(timeout=180000) // TO 3 min public void test03NewtCanvasAWT_Offsccreen() throws AWTException, InterruptedException, InvocationTargetException { if( !JAWTUtil.isOffscreenLayerSupported() ) { @@ -155,25 +155,25 @@ public class TestNewtKeyPressReleaseUnmaskRepeatAWT extends UITestCase { } testNewtCanvasAWT_Impl(false); } - - 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); - SimpleKeyPressRelease simpleKeyPressRelease = new SimpleKeyPressRelease(); + final SimpleKeyPressRelease simpleKeyPressRelease = new SimpleKeyPressRelease(); glWindow.addKeyListener(simpleKeyPressRelease); - 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 @@ -184,27 +184,27 @@ public class TestNewtKeyPressReleaseUnmaskRepeatAWT 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; } - + static class SimpleKeyPressRelease implements KeyListener { int seq; SimpleKeyPressRelease() { reset(); } - + public void reset() { seq=0; } - + @Override - public void keyPressed(KeyEvent e) { + public void keyPressed(final KeyEvent e) { if( 0 == ( InputEvent.AUTOREPEAT_MASK & e.getModifiers() ) ) { seq++; System.err.println(seq+": "+e); @@ -212,7 +212,7 @@ public class TestNewtKeyPressReleaseUnmaskRepeatAWT extends UITestCase { } @Override - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { if( 0 == ( InputEvent.AUTOREPEAT_MASK & e.getModifiers() ) ) { seq++; System.err.println(seq+": "+e); @@ -220,7 +220,7 @@ public class TestNewtKeyPressReleaseUnmaskRepeatAWT extends UITestCase { } } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); @@ -229,10 +229,10 @@ public class TestNewtKeyPressReleaseUnmaskRepeatAWT extends UITestCase { /** BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); System.err.println("Press enter to continue"); - System.err.println(stdin.readLine()); + System.err.println(stdin.readLine()); */ System.out.println("durationPerTest: "+durationPerTest); - String tstname = TestNewtKeyPressReleaseUnmaskRepeatAWT.class.getName(); + final String tstname = TestNewtKeyPressReleaseUnmaskRepeatAWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus01SwingAWTRobot.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus01SwingAWTRobot.java index d3c29cfac..586c380bf 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus01SwingAWTRobot.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus01SwingAWTRobot.java @@ -93,26 +93,26 @@ public class TestParentingFocus01SwingAWTRobot extends UITestCase { @Test public void testFocus02RobotFocus() throws AWTException, InterruptedException, InvocationTargetException { - Robot robot = new Robot(); + final Robot robot = new Robot(); robot.setAutoWaitForIdle(true); testFocus01ProgrFocusImpl(robot); } - private void testFocus01ProgrFocusImpl(Robot robot) throws AWTException, + private void testFocus01ProgrFocusImpl(final Robot robot) throws AWTException, InvocationTargetException, InterruptedException { - ArrayList<EventCountAdapter> eventCountAdapters = new ArrayList<EventCountAdapter>(); + final ArrayList<EventCountAdapter> eventCountAdapters = new ArrayList<EventCountAdapter>(); // 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); @@ -240,7 +240,7 @@ public class TestParentingFocus01SwingAWTRobot extends UITestCase { System.err.println(stdin.readLine()); */ System.out.println("durationPerTest: "+durationPerTest); - String tstname = TestParentingFocus01SwingAWTRobot.class.getName(); + final String tstname = TestParentingFocus01SwingAWTRobot.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus02SwingAWTRobot.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus02SwingAWTRobot.java index edf82caa8..584344ef5 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus02SwingAWTRobot.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus02SwingAWTRobot.java @@ -42,9 +42,12 @@ import java.awt.Button; import java.awt.BorderLayout; import java.awt.Container; import java.awt.Robot; + import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; +import javax.swing.WindowConstants; + import java.util.ArrayList; import javax.media.opengl.*; @@ -97,41 +100,41 @@ public class TestParentingFocus02SwingAWTRobot extends UITestCase { public static void release() { } - private void testFocus01ProgrFocusImpl(Robot robot) + private void testFocus01ProgrFocusImpl(final Robot robot) throws AWTException, InterruptedException, InvocationTargetException { - ArrayList<EventCountAdapter> eventCountAdapters = new ArrayList<EventCountAdapter>(); + final ArrayList<EventCountAdapter> eventCountAdapters = new ArrayList<EventCountAdapter>(); - 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<args.length; i++) { @@ -310,11 +313,11 @@ public class TestParentingFocus02SwingAWTRobot extends UITestCase { } } if(true) { - String tstname = TestParentingFocus02SwingAWTRobot.class.getName(); + final String tstname = TestParentingFocus02SwingAWTRobot.class.getName(); org.junit.runner.JUnitCore.main(tstname); } else { TestParentingFocus02SwingAWTRobot.initClass(); - TestParentingFocus02SwingAWTRobot test = new TestParentingFocus02SwingAWTRobot(); + final TestParentingFocus02SwingAWTRobot test = new TestParentingFocus02SwingAWTRobot(); test.testFocus01ProgrFocus(); test.testFocus02RobotFocus(); TestParentingFocus02SwingAWTRobot.release(); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus03KeyTraversalAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus03KeyTraversalAWT.java index 71cc3fce3..ace039688 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus03KeyTraversalAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus03KeyTraversalAWT.java @@ -97,8 +97,8 @@ public class TestParentingFocus03KeyTraversalAWT extends UITestCase { testWindowParentingAWTFocusTraversal(false); } - public void testWindowParentingAWTFocusTraversal(boolean onscreen) throws InterruptedException, InvocationTargetException, AWTException { - Robot robot = new Robot(); + public void testWindowParentingAWTFocusTraversal(final boolean onscreen) throws InterruptedException, InvocationTargetException, AWTException { + final Robot robot = new Robot(); // Bug 4908075 - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4908075 // Bug 6463168 - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6463168 @@ -135,28 +135,28 @@ public class TestParentingFocus03KeyTraversalAWT extends UITestCase { newtCanvasAWT1.setFocusable(true); // Test FocusAdapter - NEWTFocusAdapter glWindow1FA = new NEWTFocusAdapter("GLWindow1"); + final NEWTFocusAdapter glWindow1FA = new NEWTFocusAdapter("GLWindow1"); glWindow1.addWindowListener(glWindow1FA); - AWTFocusAdapter bWestFA = new AWTFocusAdapter("WEST"); + final AWTFocusAdapter bWestFA = new AWTFocusAdapter("WEST"); cWest.addFocusListener(bWestFA); - AWTFocusAdapter bEastFA = new AWTFocusAdapter("EAST"); + final AWTFocusAdapter bEastFA = new AWTFocusAdapter("EAST"); cEast.addFocusListener(bEastFA); // Test KeyAdapter - NEWTKeyAdapter glWindow1KA = new NEWTKeyAdapter("GLWindow1"); + final NEWTKeyAdapter glWindow1KA = new NEWTKeyAdapter("GLWindow1"); glWindow1.addKeyListener(glWindow1KA); - AWTKeyAdapter bWestKA = new AWTKeyAdapter("West"); + final AWTKeyAdapter bWestKA = new AWTKeyAdapter("West"); cWest.addKeyListener(bWestKA); - AWTKeyAdapter bEastKA = new AWTKeyAdapter("East"); + final AWTKeyAdapter bEastKA = new AWTKeyAdapter("East"); cEast.addKeyListener(bEastKA); // demo .. - GLEventListener demo1 = new GearsES2(1); + final GLEventListener demo1 = new GearsES2(1); setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1, null)); glWindow1.addKeyListener(new KeyAdapter() { - public void keyReleased(KeyEvent e) { + public void keyReleased(final KeyEvent e) { if( !e.isPrintableKey() || e.isAutoRepeat() ) { return; } @@ -173,7 +173,7 @@ public class TestParentingFocus03KeyTraversalAWT extends UITestCase { cEast.requestFocusInWindow(); } }); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } else if(e.getKeyChar()=='w') { System.err.println("Focus West"); try { @@ -182,11 +182,11 @@ public class TestParentingFocus03KeyTraversalAWT extends UITestCase { cWest.requestFocusInWindow(); } }); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } } } }); - GLAnimatorControl animator1 = new Animator(glWindow1); + final GLAnimatorControl animator1 = new Animator(glWindow1); animator1.start(); // make frame @@ -263,7 +263,7 @@ public class TestParentingFocus03KeyTraversalAWT extends UITestCase { newtCanvasAWT1.requestFocus(); } }); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(glWindow1, glWindow1FA, bWestFA)); Assert.assertEquals(true, glWindow1FA.focusGained()); Assert.assertEquals(true, bWestFA.focusLost()); @@ -276,7 +276,7 @@ public class TestParentingFocus03KeyTraversalAWT extends UITestCase { cWest.requestFocus(); } }); - } catch (Exception ex) { ex.printStackTrace(); } + } catch (final Exception ex) { ex.printStackTrace(); } Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(cWest, bWestFA, glWindow1FA)); Assert.assertEquals(true, bWestFA.focusGained()); Assert.assertEquals(true, glWindow1FA.focusLost()); @@ -310,10 +310,10 @@ public class TestParentingFocus03KeyTraversalAWT 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); @@ -323,15 +323,15 @@ public class TestParentingFocus03KeyTraversalAWT 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); @@ -341,7 +341,7 @@ public class TestParentingFocus03KeyTraversalAWT extends UITestCase { forceGL3 = true; } } - String tstname = TestParentingFocus03KeyTraversalAWT.class.getName(); + final String tstname = TestParentingFocus03KeyTraversalAWT.class.getName(); /* org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { tstname, diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/ManualScreenMode03aNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/ManualScreenMode03aNEWT.java index ee71ba93d..2133f25c2 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/ManualScreenMode03aNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/ManualScreenMode03aNEWT.java @@ -54,10 +54,10 @@ import javax.media.nativewindow.util.Dimension; public class ManualScreenMode03aNEWT extends UITestCase { static int waitTime = 7000; // 1 sec - 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) { caps.setOnscreen(onscreen); - GLWindow window = GLWindow.create(screen, caps); + final GLWindow window = GLWindow.create(screen, caps); window.setSize(width, height); window.addGLEventListener(new GearsES2()); window.setVisible(true); @@ -65,21 +65,21 @@ public class ManualScreenMode03aNEWT extends UITestCase { } public void run() { - int width = 640; - int height = 480; - GLProfile glp = GLProfile.getDefault(); - GLCapabilities caps = new GLCapabilities(glp); - Display display = NewtFactory.createDisplay(null); // local display - Screen screen = NewtFactory.createScreen(display, 0); // screen 0 - GLWindow window = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */); + final int width = 640; + final int height = 480; + final GLProfile glp = GLProfile.getDefault(); + final GLCapabilities caps = new GLCapabilities(glp); + final Display display = NewtFactory.createDisplay(null); // local display + final Screen screen = NewtFactory.createScreen(display, 0); // screen 0 + final GLWindow window = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */); - Animator animator = new Animator(window); + final Animator animator = new Animator(window); animator.start(); - MonitorDevice monitor = window.getMainMonitor(); + final MonitorDevice monitor = window.getMainMonitor(); - MonitorMode mmCurrent = monitor.queryCurrentMode(); - MonitorMode mmOrig = monitor.getOriginalMode(); + final MonitorMode mmCurrent = monitor.queryCurrentMode(); + final MonitorMode mmOrig = monitor.getOriginalMode(); System.err.println("[0] orig : "+mmOrig); System.err.println("[0] current: "+mmCurrent); List<MonitorMode> 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<MonitorMode> allMonitorModes = screen.getMonitorModes(); + final List<MonitorMode> allMonitorModes = screen.getMonitorModes(); Assert.assertTrue(allMonitorModes.size()>0); { int i=0; MonitorMode mmPre = null; - for(Iterator<MonitorMode> iMode=allMonitorModes.iterator(); iMode.hasNext(); i++) { + for(final Iterator<MonitorMode> 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<MonitorMode> iMode=allMonitorModes.iterator(); iMode.hasNext(); i++) { + for(final Iterator<MonitorMode> 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<MonitorDevice> monitors = screen.getMonitorDevices(); + final List<MonitorDevice> monitors = screen.getMonitorDevices(); Assert.assertTrue(monitors.size()>0); int j=0; - for(Iterator<MonitorDevice> iMonitor=monitors.iterator(); iMonitor.hasNext(); j++) { - MonitorDevice monitor = iMonitor.next(); + for(final Iterator<MonitorDevice> iMonitor=monitors.iterator(); iMonitor.hasNext(); j++) { + final MonitorDevice monitor = iMonitor.next(); System.err.println(j+": "+monitor); - List<MonitorMode> modes = monitor.getSupportedModes(); + final List<MonitorMode> modes = monitor.getSupportedModes(); Assert.assertTrue(modes.size()>0); int i=0; MonitorMode mmPre = null; - for(Iterator<MonitorMode> iMode=modes.iterator(); iMode.hasNext(); i++) { + for(final Iterator<MonitorMode> 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<args.length; i++) { if(args[i].equals("-screen")) { i++; screenIdx = atoi(args[i]); } } - String tstname = TestScreenMode00aNEWT.class.getName(); + final String tstname = TestScreenMode00aNEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00bNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00bNEWT.java index 69f19c258..518dbb8db 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00bNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00bNEWT.java @@ -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; @@ -55,15 +55,15 @@ import javax.media.opengl.GLCapabilitiesImmutable; /** * Queries the current MonitorMode 50 times, - * stressing a possible race condition. + * stressing a possible race condition. */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestScreenMode00bNEWT extends UITestCase { static int width, height; - + static int waitTimeShort = 4; //1 sec static int waitTimeLong = 6; //6 sec - + @BeforeClass public static void initClass() { setResetXRandRIfX11AfterClass(); @@ -74,45 +74,45 @@ public class TestScreenMode00bNEWT extends UITestCase { @Test public void testScreenModeInfo01() throws InterruptedException { - Display display = NewtFactory.createDisplay(null); - Screen screen = NewtFactory.createScreen(display, 0); + final Display display = NewtFactory.createDisplay(null); + final Screen screen = NewtFactory.createScreen(display, 0); // screen.addReference(); - + // put some load on the screen/display context .. - GLCapabilitiesImmutable caps = new GLCapabilities(null); - GLWindow window = GLWindow.create(screen, caps); + final GLCapabilitiesImmutable caps = new GLCapabilities(null); + final GLWindow window = GLWindow.create(screen, caps); window.addGLEventListener(new GearsES2()); window.setSize(256, 256); window.setVisible(true); - Animator anim = new Animator(window); + final Animator anim = new Animator(window); anim.start(); Assert.assertEquals(true,window.isNativeValid()); Assert.assertEquals(true,screen.isNativeValid()); Assert.assertEquals(true,display.isNativeValid()); - - List<MonitorMode> screenModes = screen.getMonitorModes(); + + final List<MonitorMode> screenModes = screen.getMonitorModes(); Assert.assertTrue(screenModes.size()>0); int i=0; - for(Iterator<MonitorMode> iter=screenModes.iterator(); iter.hasNext(); i++) { + for(final Iterator<MonitorMode> 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<args.length; i++) { if(args[i].equals("-time")) { @@ -269,7 +269,7 @@ public class TestScreenMode00cNEWT extends UITestCase { } } System.err.println("Desired mode w/ resolution "+mm_width+"x"+mm_height); - String tstname = TestScreenMode00cNEWT.class.getName(); + final String tstname = TestScreenMode00cNEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java index cb9192a70..5ca133302 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java @@ -94,10 +94,10 @@ public class TestScreenMode01aNEWT 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); @@ -108,7 +108,7 @@ public class TestScreenMode01aNEWT 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)); @@ -184,12 +184,12 @@ public class TestScreenMode01aNEWT 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); @@ -228,7 +228,7 @@ public class TestScreenMode01aNEWT extends UITestCase { validateScreenModeReset(mmOrig, 0); } - void validateScreenModeReset(final MonitorMode mmOrig, int mmIdx) { + void validateScreenModeReset(final MonitorMode mmOrig, final int mmIdx) { final Display display = NewtFactory.createDisplay(null); // local display Assert.assertNotNull(display); final Screen screen = NewtFactory.createScreen(display, 0); // screen 0 @@ -247,7 +247,7 @@ public class TestScreenMode01aNEWT extends UITestCase { Assert.assertEquals(false,screen.isNativeValid()); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; @@ -261,7 +261,7 @@ public class TestScreenMode01aNEWT extends UITestCase { } } System.err.println("Desired mode w/ resolution "+mm_width+"x"+mm_height); - String tstname = TestScreenMode01aNEWT.class.getName(); + final String tstname = TestScreenMode01aNEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java index e862e6b8e..bba663a10 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java @@ -85,10 +85,10 @@ public class TestScreenMode01bNEWT extends UITestCase { Thread.sleep(waitTimeShort); } - static GLWindow createWindow(Screen screen, GLCapabilities caps, String name, int screenXPos, int screenYPos, int width, int height) throws InterruptedException { + static GLWindow createWindow(final Screen screen, final GLCapabilities caps, final String name, final int screenXPos, final int screenYPos, final int width, final int height) throws InterruptedException { Assert.assertNotNull(caps); - GLWindow window = GLWindow.create(screen, caps); + final GLWindow window = GLWindow.create(screen, caps); // Window window = NewtFactory.createWindow(screen, caps); final int[] winPos = window.convertToWindowUnits(new int[] { screenXPos, screenYPos }); window.setTitle(name); @@ -102,7 +102,7 @@ public class TestScreenMode01bNEWT 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)); @@ -117,7 +117,7 @@ public class TestScreenMode01bNEWT extends UITestCase { Assert.assertNotNull(screen); screen.addReference(); // trigger creation try { - RectangleImmutable monitorVp = screen.getMonitorDevices().get(0).getViewport(); + final RectangleImmutable monitorVp = screen.getMonitorDevices().get(0).getViewport(); testScreenModeChangeImpl(screen, monitorVp.getX(), monitorVp.getY()); } finally { screen.removeReference(); @@ -137,7 +137,7 @@ public class TestScreenMode01bNEWT extends UITestCase { System.err.println("Test Disabled (1): Monitor count < 2: "+screen); return; } - RectangleImmutable monitorVp = screen.getMonitorDevices().get(1).getViewport(); + final RectangleImmutable monitorVp = screen.getMonitorDevices().get(1).getViewport(); testScreenModeChangeImpl(screen, monitorVp.getX(), monitorVp.getY()); } finally { screen.removeReference(); @@ -145,7 +145,7 @@ public class TestScreenMode01bNEWT extends UITestCase { } } - void testScreenModeChangeImpl(final Screen screen, int screenXPos, int screenYPos) throws InterruptedException { + void testScreenModeChangeImpl(final Screen screen, final int screenXPos, final int screenYPos) throws InterruptedException { Thread.sleep(waitTimeShort); final GLCapabilities caps = new GLCapabilities(glp); @@ -155,7 +155,7 @@ public class TestScreenMode01bNEWT 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()); @@ -165,7 +165,7 @@ public class TestScreenMode01bNEWT extends UITestCase { final Animator anim = new Animator(window0); anim.start(); - List<MonitorMode> allMonitorModes = screen.getMonitorModes(); + final List<MonitorMode> 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<MonitorMode> 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<args.length; i++) { if(args[i].equals("-time")) { i++; duration = MiscUtils.atol(args[i], duration); } } - String tstname = TestScreenMode01bNEWT.class.getName(); + final String tstname = TestScreenMode01bNEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java index bbc1cb2da..377c35ade 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java @@ -85,10 +85,10 @@ public class TestScreenMode01cNEWT extends UITestCase { Thread.sleep(waitTimeShort); } - static GLWindow createWindow(Screen screen, GLCapabilities caps, String name, int screenXPos, int screenYPos, int width, int height) throws InterruptedException { + static GLWindow createWindow(final Screen screen, final GLCapabilities caps, final String name, final int screenXPos, final int screenYPos, final int width, final int height) throws InterruptedException { Assert.assertNotNull(caps); - GLWindow window = GLWindow.create(screen, caps); + final GLWindow window = GLWindow.create(screen, caps); // Window window = NewtFactory.createWindow(screen, caps); final int[] winPos = window.convertToWindowUnits(new int[] { screenXPos, screenYPos }); window.setTitle(name); @@ -102,7 +102,7 @@ public class TestScreenMode01cNEWT extends UITestCase { return window; } - static void destroyWindow(Window window) throws InterruptedException { + static void destroyWindow(final Window window) throws InterruptedException { if(null!=window) { window.destroy(); AWTRobotUtil.waitForRealized(window, false); // don't override a previous assertion failure @@ -117,7 +117,7 @@ public class TestScreenMode01cNEWT extends UITestCase { Assert.assertNotNull(screen); screen.addReference(); // trigger creation try { - RectangleImmutable monitorVp = screen.getMonitorDevices().get(0).getViewport(); + final RectangleImmutable monitorVp = screen.getMonitorDevices().get(0).getViewport(); testScreenFullscreenImpl(screen, monitorVp.getX(), monitorVp.getY(), false, null); } finally { screen.removeReference(); @@ -137,7 +137,7 @@ public class TestScreenMode01cNEWT extends UITestCase { System.err.println("Test Disabled (1): Monitor count < 2: "+screen); return; } - RectangleImmutable monitorVp = screen.getMonitorDevices().get(1).getViewport(); + final RectangleImmutable monitorVp = screen.getMonitorDevices().get(1).getViewport(); testScreenFullscreenImpl(screen, monitorVp.getX(), monitorVp.getY(), false, null); } finally { screen.removeReference(); @@ -160,7 +160,7 @@ public class TestScreenMode01cNEWT extends UITestCase { final ArrayList<MonitorDevice> monitors = new ArrayList<MonitorDevice>(); 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<MonitorMode> allMonitorModes = screen.getMonitorModes(); + final List<MonitorMode> 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<args.length; i++) { if(args[i].equals("-time")) { i++; duration = MiscUtils.atol(args[i], duration); } } - String tstname = TestScreenMode01cNEWT.class.getName(); + final String tstname = TestScreenMode01cNEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java index 2f86d120d..4d109a99f 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java @@ -127,11 +127,11 @@ public class TestScreenMode01dNEWT extends UITestCase { System.err.println("*** cleanupGL.DONE"); } - 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()); Assert.assertNotNull(window); @@ -139,7 +139,7 @@ public class TestScreenMode01dNEWT 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)); @@ -149,15 +149,15 @@ public class TestScreenMode01dNEWT extends UITestCase { @Test public void test01FullscreenChange01() throws InterruptedException { Thread.sleep(waitTimeShort); - GLCapabilities caps = new GLCapabilities(glp); + 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 */); - Animator animator = new Animator(window); + final GLWindow window = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */); + final Animator animator = new Animator(window); animator.start(); final MonitorDevice monitor = window.getMainMonitor(); @@ -200,13 +200,13 @@ public class TestScreenMode01dNEWT extends UITestCase { public void test02ScreenModeChange01() throws InterruptedException { Thread.sleep(waitTimeShort); - GLCapabilities caps = new GLCapabilities(glp); + 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); final RectangleImmutable winRect = window.getBounds(); @@ -221,12 +221,12 @@ public class TestScreenMode01dNEWT extends UITestCase { return; } - Animator animator = new Animator(window); + final Animator animator = new Animator(window); animator.start(); MonitorMode mmCurrent = monitor.queryCurrentMode(); 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); @@ -251,7 +251,7 @@ public class TestScreenMode01dNEWT extends UITestCase { // set mode { - MonitorMode sm = monitorModes.get(0); + final MonitorMode sm = monitorModes.get(0); System.err.println("[0] set current: "+sm); final boolean smOk = monitor.setCurrentMode(sm); mmCurrent = monitor.getCurrentMode(); @@ -299,19 +299,19 @@ public class TestScreenMode01dNEWT extends UITestCase { testScreenModeChangeWithFS01Impl(true) ; } - protected void testScreenModeChangeWithFS01Impl(boolean preFS) throws InterruptedException { - GLCapabilities caps = new GLCapabilities(glp); - Display display = NewtFactory.createDisplay(null); // local display - Screen screen = NewtFactory.createScreen(display, 0); // screen 0 - GLWindow window = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */); - Animator animator = new Animator(window); + protected void testScreenModeChangeWithFS01Impl(final boolean preFS) throws InterruptedException { + final GLCapabilities caps = new GLCapabilities(glp); + final Display display = NewtFactory.createDisplay(null); // local display + final Screen screen = NewtFactory.createScreen(display, 0); // screen 0 + final GLWindow window = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */); + final Animator animator = new Animator(window); animator.start(); final RectangleImmutable winRect = window.getBounds(); final MonitorDevice monitor = screen.getMainMonitor(winRect); MonitorMode mmCurrent = monitor.queryCurrentMode(); 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); @@ -330,7 +330,7 @@ public class TestScreenMode01dNEWT extends UITestCase { monitorModes = MonitorModeUtil.filterByRate(monitorModes, mmOrig.getRefreshRate()); monitorModes = MonitorModeUtil.getHighestAvailableBpp(monitorModes); - MonitorMode monitorMode = monitorModes.get(0); + final MonitorMode monitorMode = monitorModes.get(0); Assert.assertNotNull(monitorMode); if(preFS) { @@ -418,8 +418,8 @@ public class TestScreenMode01dNEWT extends UITestCase { Assert.assertEquals(false,screen.isNativeValid()); } - public static void main(String args[]) throws IOException { - String tstname = TestScreenMode01dNEWT.class.getName(); + public static void main(final String args[]) throws IOException { + final String tstname = TestScreenMode01dNEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02aNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02aNEWT.java index e87194bc6..c2d769a2e 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02aNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02aNEWT.java @@ -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,14 +59,14 @@ import javax.media.nativewindow.util.Dimension; * Tests MonitorMode change w/ changed rotation, * w/ and w/o fullscreen, pre and post MonitorMode change. * <p> - * MonitorMode change does not use highest resolution. + * MonitorMode change does not use highest resolution. * </p> */ @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. * <p> - * MonitorMode change uses highest resolution. + * MonitorMode change uses highest resolution. * </p> * <p> * Bug 734 could not be reproduced, however on tests systems @@ -69,13 +69,13 @@ import javax.media.nativewindow.util.Dimension; * <p> * Documents remedy B) for NV RANDR/GL bug * </p> - * + * * @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<MonitorMode> allMonitorModes = screen.getMonitorModes(); + final List<MonitorMode> 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<MonitorMode> 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<args.length; i++) { if(args[i].equals("-time")) { @@ -767,14 +767,14 @@ public class TestParenting01NEWT extends UITestCase { if( asMain ) { try { TestParenting01NEWT.initClass(); - TestParenting01NEWT m = new TestParenting01NEWT(); + final TestParenting01NEWT m = new TestParenting01NEWT(); m.test02aReparentTop2WinReparentRecreate(); m.test01CreateVisibleDestroy(); - } catch (Throwable t ) { + } catch (final Throwable t ) { t.printStackTrace(); } } else { - String tstname = TestParenting01NEWT.class.getName(); + final String tstname = TestParenting01NEWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java index 420a39cb2..6f39985f4 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java @@ -75,7 +75,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(false, glWindow1.isNativeValid()); Assert.assertNull(glWindow1.getParent()); glWindow1.setTitle("testWindowParenting01CreateVisibleDestroy"); - GLEventListener demo1 = new RedSquareES2(); + final GLEventListener demo1 = new RedSquareES2(); setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); @@ -165,7 +165,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(false, glWindow1.isVisible()); Assert.assertEquals(false, glWindow1.isNativeValid()); Assert.assertNull(glWindow1.getParent()); - GLEventListener demo1 = new RedSquareES2(); + final GLEventListener demo1 = new RedSquareES2(); setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); @@ -194,7 +194,7 @@ public class TestParenting01aAWT extends UITestCase { }); Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); - Animator animator1 = new Animator(glWindow1); + final Animator animator1 = new Animator(glWindow1); animator1.setUpdateFPSFrames(1, null); animator1.start(); while(animator1.isAnimating() && animator1.getTotalFPSDuration()<durationPerTest) { @@ -212,8 +212,8 @@ public class TestParenting01aAWT extends UITestCase { @Test public void test03WindowParenting02CreateVisibleDestroy3Odd() throws InterruptedException, InvocationTargetException { - GLWindow glWindow1 = GLWindow.create(glCaps); - GLEventListener demo1 = new RedSquareES2(); + final GLWindow glWindow1 = GLWindow.create(glCaps); + final GLEventListener demo1 = new RedSquareES2(); setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); @@ -237,7 +237,7 @@ public class TestParenting01aAWT extends UITestCase { } }); - Animator animator1 = new Animator(glWindow1); + final Animator animator1 = new Animator(glWindow1); animator1.setUpdateFPSFrames(1, null); animator1.start(); Assert.assertEquals(true, animator1.isStarted()); @@ -257,8 +257,8 @@ public class TestParenting01aAWT extends UITestCase { @Test public void test04WindowParenting03ReparentNewtWin2Top() throws InterruptedException, InvocationTargetException { - GLWindow glWindow1 = GLWindow.create(glCaps); - GLEventListener demo1 = new RedSquareES2(); + final GLWindow glWindow1 = GLWindow.create(glCaps); + final GLEventListener demo1 = new RedSquareES2(); setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); @@ -282,7 +282,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); - Animator animator1 = new Animator(glWindow1); + final Animator animator1 = new Animator(glWindow1); animator1.setUpdateFPSFrames(1, null); animator1.start(); @@ -316,8 +316,8 @@ public class TestParenting01aAWT extends UITestCase { @Test public void test05WindowParenting04ReparentNewtWin2TopLayouted() throws InterruptedException, InvocationTargetException { - GLWindow glWindow1 = GLWindow.create(glCaps); - GLEventListener demo1 = new RedSquareES2(); + final GLWindow glWindow1 = GLWindow.create(glCaps); + final GLEventListener demo1 = new RedSquareES2(); setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); @@ -347,7 +347,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); - Animator animator1 = new Animator(glWindow1); + final Animator animator1 = new Animator(glWindow1); animator1.setUpdateFPSFrames(1, null); animator1.start(); @@ -381,9 +381,9 @@ public class TestParenting01aAWT extends UITestCase { @Test public void test06WindowParenting05ReparentAWTWinHopFrame2Frame() throws InterruptedException, InvocationTargetException { - GLWindow glWindow1 = GLWindow.create(glCaps); + final GLWindow glWindow1 = GLWindow.create(glCaps); glWindow1.setUndecorated(true); - GLEventListener demo1 = new RedSquareES2(); + final GLEventListener demo1 = new RedSquareES2(); setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); @@ -426,7 +426,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); - Animator animator1 = new Animator(glWindow1); + final Animator animator1 = new Animator(glWindow1); animator1.setUpdateFPSFrames(1, null); animator1.start(); @@ -469,7 +469,7 @@ public class TestParenting01aAWT 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); if(debug) { @@ -481,15 +481,15 @@ public class TestParenting01aAWT 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); @@ -497,7 +497,7 @@ public class TestParenting01aAWT extends UITestCase { waitReparent = atoi(args[++i]); } } - String tstname = TestParenting01aAWT.class.getName(); + final String tstname = TestParenting01aAWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aSWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aSWT.java index 4bb64c766..770b7ce4d 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aSWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aSWT.java @@ -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 java.io.IOException; @@ -70,7 +70,7 @@ public class TestParenting01aSWT extends UITestCase { Shell shell = null; Composite composite1 = null; com.jogamp.newt.Display swtNewtDisplay = null; - + @BeforeClass public static void initClass() { width = 640; @@ -81,7 +81,7 @@ public class TestParenting01aSWT 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 ); @@ -93,7 +93,7 @@ public class TestParenting01aSWT extends UITestCase { }}); swtNewtDisplay = NewtFactory.createDisplay(null, false); // no-reuse } - + @After public void release() { Assert.assertNotNull( display ); @@ -107,7 +107,7 @@ public class TestParenting01aSWT extends UITestCase { display.dispose(); }}); } - catch( Throwable throwable ) { + catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -116,18 +116,18 @@ public class TestParenting01aSWT extends UITestCase { shell = null; composite1 = null; } - + @Test public void testWindowParenting01CreateVisibleDestroy1() throws InterruptedException, InvocationTargetException { - com.jogamp.newt.Screen screen = NewtFactory.createScreen(swtNewtDisplay, 0); - GLWindow glWindow1 = GLWindow.create(screen, glCaps); + final com.jogamp.newt.Screen screen = NewtFactory.createScreen(swtNewtDisplay, 0); + final GLWindow glWindow1 = GLWindow.create(screen, glCaps); Assert.assertNotNull(glWindow1); Assert.assertEquals(false, glWindow1.isVisible()); Assert.assertEquals(false, glWindow1.isNativeValid()); Assert.assertNull(glWindow1.getParent()); glWindow1.setTitle("testWindowParenting01CreateVisibleDestroy"); - GLEventListener demo1 = new RedSquareES2(); + final GLEventListener demo1 = new RedSquareES2(); setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); @@ -144,7 +144,7 @@ public class TestParenting01aSWT extends UITestCase { shell.open(); } }); - + // visible test Assert.assertEquals(canvas1.getNativeWindow(),glWindow1.getParent()); @@ -174,10 +174,10 @@ public class TestParenting01aSWT extends UITestCase { Assert.assertEquals(false, glWindow1.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); @@ -187,21 +187,21 @@ public class TestParenting01aSWT 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); } } - String tstname = TestParenting01aSWT.class.getName(); + final String tstname = TestParenting01aSWT.class.getName(); org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { tstname, "filtertrace=true", diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java index 598e5f10f..49e74ddc0 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java @@ -77,10 +77,10 @@ public class TestParenting01bAWT extends UITestCase { testAWTWinHopFrame2FrameImpl(0); } - public void testAWTWinHopFrame2FrameImpl(int fps) throws InterruptedException, InvocationTargetException { - GLWindow glWindow1 = GLWindow.create(glCaps); + public void testAWTWinHopFrame2FrameImpl(final int fps) throws InterruptedException, InvocationTargetException { + final GLWindow glWindow1 = GLWindow.create(glCaps); glWindow1.setUndecorated(true); - GLEventListener demo1 = new RedSquareES2(); + final GLEventListener demo1 = new RedSquareES2(); setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); @@ -173,10 +173,10 @@ public class TestParenting01bAWT 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); @@ -186,15 +186,15 @@ public class TestParenting01bAWT 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); @@ -202,7 +202,7 @@ public class TestParenting01bAWT extends UITestCase { waitReparent = atoi(args[++i]); } } - String tstname = TestParenting01bAWT.class.getName(); + final String tstname = TestParenting01bAWT.class.getName(); org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { tstname, "filtertrace=true", diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java index 1d7401728..30be67ab3 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java @@ -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 org.junit.Assert; @@ -69,13 +69,13 @@ public class TestParenting01cAWT extends UITestCase { public void test01CreateVisibleDestroy1() throws InterruptedException, InvocationTargetException { int i; - GLWindow glWindow1 = GLWindow.create(glCaps); + final GLWindow glWindow1 = GLWindow.create(glCaps); Assert.assertNotNull(glWindow1); Assert.assertEquals(false, glWindow1.isVisible()); Assert.assertEquals(false, glWindow1.isNativeValid()); Assert.assertNull(glWindow1.getParent()); glWindow1.setTitle("testWindowParenting01CreateVisibleDestroy"); - GLEventListener demo1 = new RedSquareES2(); + final GLEventListener demo1 = new RedSquareES2(); setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); @@ -92,7 +92,7 @@ public class TestParenting01cAWT extends UITestCase { frame1.add(new Button("East"), BorderLayout.EAST); frame1.add(new Button("West"), BorderLayout.WEST); - Container container1 = new Container(); + final Container container1 = new Container(); container1.setLayout(new BorderLayout()); container1.add(new Button("north"), BorderLayout.NORTH); container1.add(new Button("south"), BorderLayout.SOUTH); @@ -130,7 +130,7 @@ public class TestParenting01cAWT extends UITestCase { Assert.assertEquals(true, glWindow1.isNativeValid()); final boolean wasOnscreen = glWindow1.getChosenCapabilities().isOnscreen(); - + SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame1.remove(newtCanvasAWT); @@ -155,9 +155,9 @@ public class TestParenting01cAWT extends UITestCase { @Test public void test02AWTWinHopFrame2Frame() throws InterruptedException, InvocationTargetException { - GLWindow glWindow1 = GLWindow.create(glCaps); + final GLWindow glWindow1 = GLWindow.create(glCaps); glWindow1.setUndecorated(true); - GLEventListener demo1 = new RedSquareES2(); + final GLEventListener demo1 = new RedSquareES2(); setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); @@ -234,10 +234,10 @@ public class TestParenting01cAWT 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); @@ -247,21 +247,21 @@ public class TestParenting01cAWT 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); } } - String tstname = TestParenting01cAWT.class.getName(); + final String tstname = TestParenting01cAWT.class.getName(); org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { tstname, "filtertrace=true", diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java index 4d5c3b25d..3726870e3 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java @@ -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 java.lang.reflect.*; @@ -39,10 +39,11 @@ import org.junit.runners.MethodSorters; import java.awt.Button; import java.awt.BorderLayout; import java.awt.Container; + import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; - +import javax.swing.WindowConstants; import javax.media.opengl.*; import com.jogamp.opengl.util.Animator; @@ -69,38 +70,38 @@ public class TestParenting01cSwingAWT extends UITestCase { glCaps = new GLCapabilities(null); } - static class GLDisturbanceAction implements Runnable { + static class GLDisturbanceAction implements Runnable { public boolean isRunning = false; private volatile boolean shallStop = false; private final GLAutoDrawable glad; private final GLRunnable glRunnable; - - public GLDisturbanceAction(GLAutoDrawable glad) { + + public GLDisturbanceAction(final GLAutoDrawable glad) { this.glad = glad; this.glRunnable = new GLRunnableDummy(); } - + public void waitUntilRunning() { synchronized(this) { while(!isRunning) { try { this.wait(); - } catch (InterruptedException e) { e.printStackTrace(); } - } + } catch (final InterruptedException e) { e.printStackTrace(); } + } } } - + public void stopAndWaitUntilDone() { shallStop = true; synchronized(this) { while(isRunning) { try { this.wait(); - } catch (InterruptedException e) { e.printStackTrace(); } - } + } catch (final InterruptedException e) { e.printStackTrace(); } + } } } - + public void run() { synchronized(this) { isRunning = true; @@ -111,7 +112,7 @@ public class TestParenting01cSwingAWT extends UITestCase { try { glad.invoke(true, glRunnable); Thread.sleep(100); - } catch (Throwable t) {} + } catch (final Throwable t) {} } synchronized(this) { isRunning = false; @@ -119,25 +120,25 @@ public class TestParenting01cSwingAWT extends UITestCase { } } } - + @Test public void test01CreateVisibleDestroy1() throws InterruptedException, InvocationTargetException { /** * JFrame . JPanel . Container . NewtCanvasAWT . GLWindow */ - GLWindow glWindow1 = GLWindow.create(glCaps); + final GLWindow glWindow1 = GLWindow.create(glCaps); Assert.assertNotNull(glWindow1); Assert.assertEquals(false, glWindow1.isVisible()); Assert.assertEquals(false, glWindow1.isNativeValid()); Assert.assertNull(glWindow1.getParent()); glWindow1.setTitle("testWindowParenting01CreateVisibleDestroy"); - GLEventListener demo1 = new RedSquareES2(); + final GLEventListener demo1 = new RedSquareES2(); setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); - Animator animator1 = new Animator(glWindow1); + final Animator animator1 = new Animator(glWindow1); animator1.setUpdateFPSFrames(1, null); animator1.start(); - + final GLDisturbanceAction disturbanceAction = new GLDisturbanceAction(glWindow1); new Thread(disturbanceAction).start(); disturbanceAction.waitUntilRunning(); @@ -166,7 +167,7 @@ public class TestParenting01cSwingAWT 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); System.err.println("Demos: 1 - Visible"); SwingUtilities.invokeAndWait(new Runnable() { @@ -204,7 +205,7 @@ public class TestParenting01cSwingAWT extends UITestCase { Assert.assertEquals(true, AWTRobotUtil.waitForVisible(glWindow1, true)); final boolean wasOnscreen = glWindow1.getChosenCapabilities().isOnscreen(); - + // Always recommended to remove our native parented Window // from the AWT resources before destruction, since it could lead // to a BadMatch X11 error w/o. @@ -227,11 +228,11 @@ public class TestParenting01cSwingAWT extends UITestCase { Assert.assertEquals(true, glWindow1.isNativeValid()); } // else OK to be destroyed - due to offscreen/onscreen transition - System.err.println("Demos: 7 - X GLWindow"); + System.err.println("Demos: 7 - X GLWindow"); glWindow1.destroy(); Assert.assertEquals(false, glWindow1.isNativeValid()); - - System.err.println("Demos: 8 - X DisturbanceThread"); + + System.err.println("Demos: 8 - X DisturbanceThread"); disturbanceAction.stopAndWaitUntilDone(); } @@ -240,23 +241,23 @@ public class TestParenting01cSwingAWT extends UITestCase { /** * JFrame . JPanel . Container . NewtCanvasAWT . GLWindow */ - GLWindow glWindow1 = GLWindow.create(glCaps); + final GLWindow glWindow1 = GLWindow.create(glCaps); Assert.assertNotNull(glWindow1); Assert.assertEquals(false, glWindow1.isVisible()); Assert.assertEquals(false, glWindow1.isNativeValid()); Assert.assertNull(glWindow1.getParent()); glWindow1.setTitle("testWindowParenting01CreateVisibleDestroy"); - GLEventListener demo1 = new RedSquareES2(); + final GLEventListener demo1 = new RedSquareES2(); setDemoFields(demo1, glWindow1, false); /* glWindow1.addGLEventListener(new GLEventListener() { @Override public void init(GLAutoDrawable drawable) { - System.err.println("XXX init"); + System.err.println("XXX init"); } @Override public void dispose(GLAutoDrawable drawable) { - System.err.println("XXX dispose"); + System.err.println("XXX dispose"); // Thread.dumpStack(); } @Override @@ -265,10 +266,10 @@ public class TestParenting01cSwingAWT extends UITestCase { public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { System.err.println("XXX reshape"); // Thread.dumpStack(); - } + } }); */ glWindow1.addGLEventListener(demo1); - Animator animator1 = new Animator(glWindow1); + final Animator animator1 = new Animator(glWindow1); animator1.setUpdateFPSFrames(1, null); animator1.start(); @@ -300,7 +301,7 @@ public class TestParenting01cSwingAWT 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); SwingUtilities.invokeAndWait(new Runnable() { public void run() { @@ -319,7 +320,7 @@ public class TestParenting01cSwingAWT extends UITestCase { final JFrame jFrame2 = new JFrame("Swing Parent JFrame"); // jFrame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - jFrame2.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); // equivalent to Frame, use windowClosing event! + jFrame2.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); // equivalent to Frame, use windowClosing event! jFrame2.setContentPane(jPanel2); SwingUtilities.invokeAndWait(new Runnable() { public void run() { @@ -333,7 +334,7 @@ public class TestParenting01cSwingAWT extends UITestCase { Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); final boolean wasOnscreen = glWindow1.getChosenCapabilities().isOnscreen(); - + int state = 0; while(animator1.isAnimating() && animator1.getTotalFPSDuration()<3*durationPerTest) { Thread.sleep(durationPerTest); @@ -353,7 +354,7 @@ public class TestParenting01cSwingAWT extends UITestCase { jPanel2.remove(newtCanvasAWT); container1.add(newtCanvasAWT, BorderLayout.CENTER); jFrame1.validate(); - jFrame2.validate(); + jFrame2.validate(); } }); break; } @@ -376,11 +377,11 @@ public class TestParenting01cSwingAWT extends UITestCase { jFrame1.validate(); System.err.println("Demos: 1 - X Container 2"); jPanel2.remove(newtCanvasAWT); - jFrame2.validate(); + jFrame2.validate(); } }); */ /* * Invisible X11 windows may also case BadMatch (-> 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; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01dAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01dAWT.java index 288918e48..ad8a6f50e 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01dAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01dAWT.java @@ -75,14 +75,14 @@ public class TestParenting01dAWT extends UITestCase { static class MyGLEventListenerCounter extends GLEventListenerCounter { @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { super.init(drawable); System.err.println("MyGLEventListenerCounter.init: "+this); // Thread.dumpStack(); } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { super.dispose(drawable); System.err.println("MyGLEventListenerCounter.dispose: "+this); // Thread.dumpStack(); @@ -99,7 +99,7 @@ public class TestParenting01dAWT extends UITestCase { testGLWindowInvisibleReparentRecreateImpl(true /* triggerPreserveGLState */); } - private void testGLWindowInvisibleReparentRecreateImpl(boolean triggerPreserveGLState) throws InterruptedException, InvocationTargetException { + private void testGLWindowInvisibleReparentRecreateImpl(final boolean triggerPreserveGLState) throws InterruptedException, InvocationTargetException { final GLWindow glWindow1 = GLWindow.create(glCaps); Assert.assertNotNull(glWindow1); Assert.assertEquals(false, glWindow1.isVisible()); @@ -108,7 +108,7 @@ public class TestParenting01dAWT extends UITestCase { glWindow1.setTitle("testWindowParenting01CreateVisibleDestroy"); final MyGLEventListenerCounter glelCounter = new MyGLEventListenerCounter(); glWindow1.addGLEventListener(glelCounter); - GLEventListener demo1 = new RedSquareES2(); + final GLEventListener demo1 = new RedSquareES2(); glWindow1.addGLEventListener(demo1); Assert.assertEquals("Init Counter Invalid "+glelCounter, 0, glelCounter.initCount); @@ -238,13 +238,13 @@ public class TestParenting01dAWT extends UITestCase { } } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atol(args[++i], durationPerTest); } } - String tstname = TestParenting01dAWT.class.getName(); + final String tstname = TestParenting01dAWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java index b304a2ce7..ed5c2f8a1 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java @@ -85,7 +85,7 @@ public class TestParenting02AWT extends UITestCase { } public void runNewtChildOnAWTParent(final boolean useLayout, final boolean deferredPeer) throws InterruptedException, InvocationTargetException { - NEWTEventFiFo eventFifo = new NEWTEventFiFo(); + final NEWTEventFiFo eventFifo = new NEWTEventFiFo(); // setup NEWT GLWindow .. final GLWindow glWindow = GLWindow.create(new GLCapabilities(null)); @@ -194,7 +194,7 @@ public class TestParenting02AWT extends UITestCase { } long duration = durationPerTest; - long step = 20; + final long step = 20; NEWTEvent event; boolean shouldQuit = false; @@ -204,9 +204,9 @@ public class TestParenting02AWT extends UITestCase { duration -= step; while( null != ( event = eventFifo.get() ) ) { - Window source = (Window) event.getSource(); + final Window source = (Window) event.getSource(); if(event instanceof KeyEvent) { - KeyEvent keyEvent = (KeyEvent) event; + final KeyEvent keyEvent = (KeyEvent) event; switch(keyEvent.getKeyChar()) { case 'q': shouldQuit = true; @@ -237,10 +237,10 @@ public class TestParenting02AWT extends UITestCase { } } ); } - 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); @@ -250,15 +250,15 @@ public class TestParenting02AWT 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 { verbose = true; for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { @@ -267,7 +267,7 @@ public class TestParenting02AWT extends UITestCase { waitReparent = atoi(args[++i]); } } - String tstname = TestParenting02AWT.class.getName(); + final String tstname = TestParenting02AWT.class.getName(); org.junit.runner.JUnitCore.main(tstname); /* org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java index 9f56ecdbf..c9a96868f 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java @@ -61,22 +61,22 @@ public class TestParenting02NEWT extends UITestCase { height = 480; } - static Window createWindow(Screen screen, Capabilities caps) { + static Window createWindow(final Screen screen, final Capabilities caps) { Assert.assertNotNull(caps); - Window window = NewtFactory.createWindow(screen, caps) ; + final Window window = NewtFactory.createWindow(screen, caps) ; Assert.assertNotNull(window); return window; } - static Window createWindow(NativeWindow parent, Capabilities caps) { + static Window createWindow(final NativeWindow parent, final Capabilities caps) { Assert.assertNotNull(caps); - Window window = NewtFactory.createWindow(parent, caps); + final Window window = NewtFactory.createWindow(parent, caps); window.setUndecorated(true); Assert.assertNotNull(window); return window; } - static void destroyWindow(Display display, Screen screen, Window window, GLWindow glWindow) { + static void destroyWindow(final Display display, final Screen screen, final Window window, final GLWindow glWindow) { if(null!=glWindow) { glWindow.destroy(); } @@ -93,21 +93,21 @@ public class TestParenting02NEWT extends UITestCase { @Test public void test01NewtOnNewtParentChildDraw() throws InterruptedException { - GLCapabilities caps = new GLCapabilities(null); + final GLCapabilities caps = new GLCapabilities(null); 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); int x = 1; int y = 1; - NEWTEventFiFo eventFifo = new NEWTEventFiFo(); + final NEWTEventFiFo eventFifo = new NEWTEventFiFo(); - Window window1 = createWindow(screen, caps); + final Window window1 = createWindow(screen, caps); Assert.assertNotNull(window1); - GLWindow glWindow1 = GLWindow.create(window1); + final GLWindow glWindow1 = GLWindow.create(window1); Assert.assertNotNull(glWindow1); glWindow1.setSize(width, height); Assert.assertEquals(width,glWindow1.getWidth()); @@ -117,7 +117,7 @@ public class TestParenting02NEWT extends UITestCase { //glWindow1.addKeyListener(new TraceKeyAdapter(new KeyAction(eventFifo))); //glWindow1.addWindowListener(new TraceWindowAdapter()); - GLEventListener demo1 = new RedSquareES2(); + final GLEventListener demo1 = new RedSquareES2(); setDemoFields(demo1, window1, glWindow1, false); // glWindow1.addGLEventListener(demo1); @@ -126,9 +126,9 @@ public class TestParenting02NEWT extends UITestCase { Assert.assertNotNull(capsChosen); Assert.assertTrue(capsChosen.isOnscreen()==true); - Window window2 = createWindow(window1, caps); + final Window window2 = createWindow(window1, caps); Assert.assertNotNull(window2); - GLWindow glWindow2 = GLWindow.create(window2); + final GLWindow glWindow2 = GLWindow.create(window2); Assert.assertNotNull(glWindow2); glWindow2.setSize(width/2, height/2); //Assert.assertEquals(width/2,glWindow2.getWidth()); @@ -139,7 +139,7 @@ public class TestParenting02NEWT extends UITestCase { //glWindow2.addWindowListener(new TraceWindowAdapter(new WindowAction(eventFifo))); // glWindow2.addMouseListener(new TraceMouseAdapter()); - GLEventListener demo2 = new GearsES2(); + final GLEventListener demo2 = new GearsES2(); setDemoFields(demo2, window2, glWindow2, false); // glWindow2.addGLEventListener(demo2); @@ -153,7 +153,7 @@ public class TestParenting02NEWT extends UITestCase { boolean shouldQuit = false; long duration = durationPerTest; - long step = 20; + final long step = 20; NEWTEvent event; while (duration>0 && !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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); } } - String tstname = TestParenting02NEWT.class.getName(); + final String tstname = TestParenting02NEWT.class.getName(); org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { tstname, "filtertrace=true", diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java index b7497196c..fde366dd2 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java @@ -78,18 +78,18 @@ public class TestParenting03AWT extends UITestCase { testImpl(true); } - public void testImpl(boolean use2nd) throws InterruptedException, InvocationTargetException { + public void testImpl(final boolean use2nd) throws InterruptedException, InvocationTargetException { final Frame frame1 = new Frame("AWT Parent Frame"); - GLWindow glWindow1 = GLWindow.create(glCaps); + final GLWindow glWindow1 = GLWindow.create(glCaps); glWindow1.setUpdateFPSFrames(1, null); final NewtCanvasAWT newtCanvasAWT1 = new NewtCanvasAWT(glWindow1); newtCanvasAWT1.setPreferredSize(glSize); - GLEventListener demo1 = new GearsES2(1); + final GLEventListener demo1 = new GearsES2(1); setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1, null)); - GLAnimatorControl animator1 = new Animator(glWindow1); + final GLAnimatorControl animator1 = new Animator(glWindow1); animator1.start(); GLWindow glWindow2 = null; @@ -101,7 +101,7 @@ public class TestParenting03AWT extends UITestCase { newtCanvasAWT2 = new NewtCanvasAWT(glWindow2); newtCanvasAWT2.setPreferredSize(glSize); - GLEventListener demo2 = new GearsES2(1); + final GLEventListener demo2 = new GearsES2(1); setDemoFields(demo2, glWindow2, false); glWindow2.addGLEventListener(demo2); glWindow2.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT2, glWindow2, null)); @@ -191,10 +191,10 @@ public class TestParenting03AWT extends UITestCase { } } - 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); @@ -204,15 +204,15 @@ public class TestParenting03AWT 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); @@ -220,7 +220,7 @@ public class TestParenting03AWT extends UITestCase { waitAdd2nd = atoi(args[++i]); } } - String tstname = TestParenting03AWT.class.getName(); + final String tstname = TestParenting03AWT.class.getName(); /* org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { tstname, diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04AWT.java index 126aaaffa..3ff4ecdaa 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04AWT.java @@ -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 java.awt.BorderLayout; @@ -74,26 +74,26 @@ public class TestParenting04AWT extends UITestCase { // Will produce some artifacts .. resizing etc winHopFrame2Frame(false); } - + @Test public void test02WinHopFrame2FrameDetachFirst() throws InterruptedException, InvocationTargetException { - // Note: detaching first setNEWTChild(null) is much cleaner visually + // Note: detaching first setNEWTChild(null) is much cleaner visually winHopFrame2Frame(true); } - + protected void winHopFrame2Frame(final boolean detachFirst) throws InterruptedException, InvocationTargetException { final GLWindow glWindow1 = GLWindow.create(glCaps); - GLEventListener demo1 = new RedSquareES2(); + final GLEventListener demo1 = new RedSquareES2(); setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); - Animator anim1 = new Animator(glWindow1); + final Animator anim1 = new Animator(glWindow1); final GLWindow glWindow2 = GLWindow.create(glCaps); - GLEventListener demo2 = new GearsES2(); + final GLEventListener demo2 = new GearsES2(); setDemoFields(demo2, glWindow2, false); glWindow2.addGLEventListener(demo2); - Animator anim2 = new Animator(glWindow2); - + final Animator anim2 = new Animator(glWindow2); + final NewtCanvasAWT canvas1 = new NewtCanvasAWT(glWindow1); final NewtCanvasAWT canvas2 = new NewtCanvasAWT(glWindow2); @@ -119,7 +119,7 @@ public class TestParenting04AWT extends UITestCase { } }); Assert.assertEquals(canvas1.getNativeWindow(),glWindow1.getParent()); - + final Frame frame2 = new Frame("AWT Parent Frame"); frame2.setLayout(new BorderLayout()); frame2.add(new Button("North"), BorderLayout.NORTH); @@ -145,7 +145,7 @@ public class TestParenting04AWT extends UITestCase { anim1.start(); anim2.start(); - + int state; for(state=0; state<3; state++) { Thread.sleep(durationPerTest); @@ -156,7 +156,7 @@ public class TestParenting04AWT extends UITestCase { // 1 -> 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); } } - String tstname = TestParenting04AWT.class.getName(); + final String tstname = TestParenting04AWT.class.getName(); org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { tstname, "filtertrace=true", diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04SWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04SWT.java index 586db8a2b..631d2309a 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04SWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04SWT.java @@ -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 java.io.IOException; @@ -74,7 +74,7 @@ public class TestParenting04SWT extends UITestCase { Composite composite1 = null; Composite composite2 = null; com.jogamp.newt.Display swtNewtDisplay = null; - + @BeforeClass public static void initClass() { width = 400; @@ -85,17 +85,17 @@ public class TestParenting04SWT extends UITestCase { @Before public void init() { SWTAccessor.invoke(true, new Runnable() { - public void run() { + public void run() { display = new Display(); Assert.assertNotNull( display ); - + shell1 = new Shell( display ); Assert.assertNotNull( shell1 ); shell1.setLayout( new FillLayout() ); composite1 = new Composite( shell1, SWT.NONE ); composite1.setLayout( new FillLayout() ); Assert.assertNotNull( composite1 ); - + shell2 = new Shell( display ); Assert.assertNotNull( shell2 ); shell2.setLayout( new FillLayout() ); @@ -105,7 +105,7 @@ public class TestParenting04SWT extends UITestCase { }}); swtNewtDisplay = NewtFactory.createDisplay(null, false); // no-reuse } - + @After public void release() { Assert.assertNotNull( display ); @@ -123,7 +123,7 @@ public class TestParenting04SWT extends UITestCase { display.dispose(); }}); } - catch( Throwable throwable ) { + catch( final Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } @@ -134,37 +134,37 @@ public class TestParenting04SWT extends UITestCase { composite1 = null; composite2 = null; } - + @Test public void test01WinHopFrame2FrameDirectHop() throws InterruptedException, InvocationTargetException { // Will produce some artifacts .. resizing etc winHopFrame2Frame(false); } - + @Test public void test02WinHopFrame2FrameDetachFirst() throws InterruptedException, InvocationTargetException { - // Note: detaching first setNEWTChild(null) is much cleaner visually + // Note: detaching first setNEWTChild(null) is much cleaner visually winHopFrame2Frame(true); } - + protected void winHopFrame2Frame(final boolean detachFirst) throws InterruptedException, InvocationTargetException { - com.jogamp.newt.Screen screen = NewtFactory.createScreen(swtNewtDisplay, 0); - + final com.jogamp.newt.Screen screen = NewtFactory.createScreen(swtNewtDisplay, 0); + final GLWindow glWindow1 = GLWindow.create(screen, glCaps); - GLEventListener demo1 = new RedSquareES2(); + final GLEventListener demo1 = new RedSquareES2(); setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); - Animator anim1 = new Animator(glWindow1); - + final Animator anim1 = new Animator(glWindow1); + final GLWindow glWindow2 = GLWindow.create(screen, glCaps); - GLEventListener demo2 = new GearsES2(); + final GLEventListener demo2 = new GearsES2(); setDemoFields(demo2, glWindow2, false); glWindow2.addGLEventListener(demo2); - Animator anim2 = new Animator(glWindow2); + final Animator anim2 = new Animator(glWindow2); final NewtCanvasSWT canvas1 = NewtCanvasSWT.create( composite1, 0, glWindow1 ); final NewtCanvasSWT canvas2 = NewtCanvasSWT.create( composite2, 0, glWindow2 ); - + SWTAccessor.invoke(true, new Runnable() { public void run() { shell1.setText( getSimpleTestName(".")+"-Win1" ); @@ -176,13 +176,13 @@ public class TestParenting04SWT extends UITestCase { shell2.setLocation(width + 50, 0); shell2.open(); } - }); + }); Assert.assertEquals(canvas1.getNativeWindow(),glWindow1.getParent()); Assert.assertEquals(canvas2.getNativeWindow(),glWindow2.getParent()); anim1.start(); anim2.start(); - + int state; for(state=0; state<3; state++) { for(int i=0; i*10<durationPerTest; i++) { @@ -198,7 +198,7 @@ public class TestParenting04SWT extends UITestCase { // 1 -> 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<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); } } - String tstname = TestParenting04SWT.class.getName(); + final String tstname = TestParenting04SWT.class.getName(); org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { tstname, "filtertrace=true", diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentChildWindowBug632NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentChildWindowBug632NEWT.java index b2286a8b7..c9390f124 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentChildWindowBug632NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentChildWindowBug632NEWT.java @@ -31,44 +31,44 @@ public class TestTranslucentChildWindowBug632NEWT extends UITestCase { glp = GLProfile.getDefault(); opaque = false; } - - static GLWindow createParentWindow(GLCapabilitiesImmutable caps, int width, int height) + + static GLWindow createParentWindow(final GLCapabilitiesImmutable caps, final int width, final int height) throws InterruptedException { Assert.assertNotNull(caps); // // Create native windowing resources .. X11/Win/OSX - // + // GLWindow glWindow; glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); - + glWindow.setTitle("NEWT Parenting Window Test"); - + glWindow.addGLEventListener(new GearsES2(1)); glWindow.setSize(width, height); glWindow.setVisible(true); Assert.assertEquals(true,glWindow.isVisible()); Assert.assertEquals(true,glWindow.isNativeValid()); - + return glWindow; } - - static GLWindow createNestedWindow(NativeWindow nativeParentWindow, GLCapabilitiesImmutable caps, int x, int y, int width, int height) + + static GLWindow createNestedWindow(final NativeWindow nativeParentWindow, final GLCapabilitiesImmutable caps, final int x, final int y, final int width, final int height) throws InterruptedException { - + Assert.assertNotNull(nativeParentWindow); Assert.assertNotNull(caps); // // Create native windowing resources .. X11/Win/OSX - // + // GLWindow glWindow; glWindow = GLWindow.create(nativeParentWindow, caps); Assert.assertNotNull(glWindow); - + glWindow.setTitle("NEWT Parenting Window Test"); - + glWindow.addGLEventListener(new GearsES2(1)); glWindow.setPosition(x, y); @@ -76,60 +76,60 @@ public class TestTranslucentChildWindowBug632NEWT extends UITestCase { glWindow.setVisible(true); Assert.assertEquals(true,glWindow.isVisible()); Assert.assertEquals(true,glWindow.isNativeValid()); - + return glWindow; } - - static void destroyWindow(GLWindow glWindow) { + + static void destroyWindow(final GLWindow glWindow) { if(null!=glWindow) { glWindow.destroy(); Assert.assertEquals(false,glWindow.isNativeValid()); } } - + @Test public void testWindow00() throws InterruptedException { final Animator animator = new Animator(); - GLCapabilities caps = new GLCapabilities(glp); + final GLCapabilities caps = new GLCapabilities(glp); Assert.assertNotNull(caps); caps.setBackgroundOpaque(opaque); - GLWindow window1 = createParentWindow(caps, 400, 400); + final GLWindow window1 = createParentWindow(caps, 400, 400); Assert.assertEquals(true,window1.isNativeValid()); Assert.assertEquals(true,window1.isVisible()); animator.add(window1); - - GLWindow window2 = createNestedWindow(window1, caps, 400-300, 400-300, 300, 300); + + final GLWindow window2 = createNestedWindow(window1, caps, 400-300, 400-300, 300, 300); Assert.assertEquals(true,window2.isNativeValid()); Assert.assertEquals(true,window2.isVisible()); animator.add(window2); - + animator.start(); - - AbstractGraphicsDevice device1 = window1.getScreen().getDisplay().getGraphicsDevice(); + + final AbstractGraphicsDevice device1 = window1.getScreen().getDisplay().getGraphicsDevice(); System.err.println("GLProfiles window1: "+device1.getConnection()+": "+GLProfile.glAvailabilityToString(device1)); Thread.sleep(durationPerTest/2); - + window1.setSize(512, 512); window2.setPosition(512-300, 512-300); - + Thread.sleep(durationPerTest/2); - + animator.stop(); - + destroyWindow(window2); destroyWindow(window1); } - - public static void main(String[] args) throws IOException { + + public static void main(final String[] args) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atol(args[++i], durationPerTest); } } - String testName = TestTranslucentChildWindowBug632NEWT.class.getName(); + final String testName = TestTranslucentChildWindowBug632NEWT.class.getName(); org.junit.runner.JUnitCore.main(testName); - } + } } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentParentingAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentParentingAWT.java index f273f7672..3eb0c1325 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentParentingAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentParentingAWT.java @@ -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 java.awt.BorderLayout; @@ -82,23 +82,23 @@ public class TestTranslucentParentingAWT 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); @@ -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; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = MiscUtils.atol(args[++i], durationPerTest); @@ -188,7 +188,7 @@ public class TestTranslucentParentingAWT extends UITestCase { waitAdd2nd = MiscUtils.atol(args[++i], waitAdd2nd); } } - String tstname = TestTranslucentParentingAWT.class.getName(); + final String tstname = TestTranslucentParentingAWT.class.getName(); /* org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { tstname, diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/WindowAction.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/WindowAction.java index 05793b96e..b960103d9 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/WindowAction.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/WindowAction.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -33,14 +33,14 @@ import com.jogamp.newt.event.*; class WindowAction extends WindowAdapter { NEWTEventFiFo eventFifo; - public WindowAction(NEWTEventFiFo eventFifo) { - this.eventFifo = eventFifo; + public WindowAction(final NEWTEventFiFo eventFifo) { + this.eventFifo = eventFifo; } - public void windowDestroyNotify(WindowEvent e) { + public void windowDestroyNotify(final WindowEvent e) { eventFifo.put(e); } - public void windowDestroyed(WindowEvent e) { + public void windowDestroyed(final WindowEvent e) { eventFifo.put(e); } } diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTFocusAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/AWTFocusAdapter.java index 32ff6022c..d574186cf 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/AWTFocusAdapter.java +++ b/src/test/com/jogamp/opengl/test/junit/util/AWTFocusAdapter.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.awt.event.FocusEvent; @@ -38,21 +38,21 @@ public class AWTFocusAdapter implements FocusEventCountAdapter, FocusListener { boolean wasTemporary; boolean verbose = true; - public AWTFocusAdapter(String prefix) { + public AWTFocusAdapter(final String prefix) { this.prefix = prefix; reset(); } - public void setVerbose(boolean v) { verbose = false; } + public void setVerbose(final boolean v) { verbose = false; } public boolean focusLost() { - return focusCount<0; + return focusCount<0; } - + public boolean focusGained() { return focusCount>0; } - + 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<EventObject> queue = new ArrayList<EventObject>(); 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<EventObject> queue = new ArrayList<EventObject>(); 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; wait<POLL_DIVIDER && !awtEDTAliveFlag; wait++) { try { Thread.sleep(TIME_SLICE); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } } @@ -102,7 +102,7 @@ public class AWTRobotUtil { } /** Issuing {@link #validateAWTEDTIsAlive()} before calling {@link Robot#waitForIdle()}. */ - public static void waitForIdle(Robot robot) { + public static void waitForIdle(final Robot robot) { validateAWTEDTIsAlive(); robot.waitForIdle(); } @@ -121,7 +121,7 @@ public class AWTRobotUtil { System.err.println("******** clearAWTFocus.X"); } - public static int[] getCenterLocation(Object obj, boolean onTitleBarIfWindow) + public static int[] getCenterLocation(final Object obj, final boolean onTitleBarIfWindow) throws InterruptedException, InvocationTargetException { if(obj instanceof com.jogamp.newt.Window) { return getCenterLocationNEWT((com.jogamp.newt.Window)obj, onTitleBarIfWindow); @@ -131,26 +131,26 @@ public class AWTRobotUtil { throw new RuntimeException("Neither AWT nor NEWT: "+obj); } } - private static int[] getCenterLocationNEWT(com.jogamp.newt.Window win, boolean onTitleBarIfWindow) + private static int[] getCenterLocationNEWT(final com.jogamp.newt.Window win, final boolean onTitleBarIfWindow) throws InterruptedException, InvocationTargetException { - javax.media.nativewindow.util.Point p0 = win.getLocationOnScreen(null); + final javax.media.nativewindow.util.Point p0 = win.getLocationOnScreen(null); if( onTitleBarIfWindow ) { - javax.media.nativewindow.util.InsetsImmutable insets = win.getInsets(); + final javax.media.nativewindow.util.InsetsImmutable insets = win.getInsets(); p0.translate(win.getWidth()/2, insets.getTopHeight()/2); } else { p0.translate(win.getWidth()/2, win.getHeight()/2); } return new int[] { p0.getX(), p0.getY() }; } - private static int[] getCenterLocationAWT(java.awt.Component comp, boolean onTitleBarIfWindow) + private static int[] getCenterLocationAWT(final java.awt.Component comp, final boolean onTitleBarIfWindow) throws InterruptedException, InvocationTargetException { int x0, y0; - java.awt.Point p0 = comp.getLocationOnScreen(); - java.awt.Rectangle r0 = comp.getBounds(); + final java.awt.Point p0 = comp.getLocationOnScreen(); + final java.awt.Rectangle r0 = comp.getBounds(); if( onTitleBarIfWindow && comp instanceof java.awt.Window) { - java.awt.Window window = (java.awt.Window) comp; - java.awt.Insets insets = window.getInsets(); + final java.awt.Window window = (java.awt.Window) comp; + final java.awt.Insets insets = window.getInsets(); y0 = (int) ( p0.getY() + insets.top / 2.0 + .5 ) ; } else { y0 = (int) ( p0.getY() + r0.getHeight() / 2.0 + .5 ) ; @@ -159,7 +159,7 @@ public class AWTRobotUtil { return new int[] { x0, y0 }; } - public static int[] getClientLocation(Object obj, int x, int y) + public static int[] getClientLocation(final Object obj, final int x, final int y) throws InterruptedException, InvocationTargetException { if(obj instanceof com.jogamp.newt.Window) { return getClientLocationNEWT((com.jogamp.newt.Window)obj, x, y); @@ -169,18 +169,18 @@ public class AWTRobotUtil { throw new RuntimeException("Neither AWT nor NEWT: "+obj); } } - private static int[] getClientLocationNEWT(com.jogamp.newt.Window win, int x, int y) + private static int[] getClientLocationNEWT(final com.jogamp.newt.Window win, final int x, final int y) throws InterruptedException, InvocationTargetException { - javax.media.nativewindow.util.Point p0 = win.getLocationOnScreen(null); + final javax.media.nativewindow.util.Point p0 = win.getLocationOnScreen(null); return new int[] { p0.getX(), p0.getY() }; } - private static int[] getClientLocationAWT(java.awt.Component comp, int x, int y) + private static int[] getClientLocationAWT(final java.awt.Component comp, final int x, final int y) throws InterruptedException, InvocationTargetException { - java.awt.Point p0 = comp.getLocationOnScreen(); + final java.awt.Point p0 = comp.getLocationOnScreen(); return new int[] { (int)p0.getX(), (int)p0.getY() }; } - public static void awtRobotMouseMove(Robot robot, int x, int y) { + public static void awtRobotMouseMove(final Robot robot, final int x, final int y) { robot.mouseMove( x, y ); robot.delay(ROBOT_DELAY); } @@ -196,14 +196,14 @@ public class AWTRobotUtil { throws AWTException, InterruptedException, InvocationTargetException { // just for event tracing .. - AWTWindowFocusAdapter winFA = new AWTWindowFocusAdapter("window"); + final AWTWindowFocusAdapter winFA = new AWTWindowFocusAdapter("window"); window.addWindowFocusListener(winFA); if(null == robot) { robot = new Robot(); robot.setAutoWaitForIdle(true); } - int[] p0 = getCenterLocation(window, false); + final int[] p0 = getCenterLocation(window, false); System.err.println("toFront: robot pos: "+p0[0]+"/"+p0[1]); awtRobotMouseMove(robot, p0[0], p0[1] ); @@ -237,7 +237,7 @@ public class AWTRobotUtil { * centerMouse * @param onTitleBarIfWindow TODO */ - public static void centerMouse(Robot robot, Object obj, boolean onTitleBarIfWindow) + public static void centerMouse(Robot robot, final Object obj, final boolean onTitleBarIfWindow) throws AWTException, InterruptedException, InvocationTargetException { if(null == robot) { @@ -245,12 +245,12 @@ public class AWTRobotUtil { robot.setAutoWaitForIdle(true); } - int[] p0 = getCenterLocation(obj, onTitleBarIfWindow); + final int[] p0 = getCenterLocation(obj, onTitleBarIfWindow); System.err.println("centerMouse: robot pos: "+p0[0]+"x"+p0[1]+", onTitleBarIfWindow: "+onTitleBarIfWindow); awtRobotMouseMove(robot, p0[0], p0[1] ); } - public static void setMouseToClientLocation(Robot robot, Object obj, int x, int y) + public static void setMouseToClientLocation(Robot robot, final Object obj, final int x, final int y) throws AWTException, InterruptedException, InvocationTargetException { if(null == robot) { @@ -258,11 +258,11 @@ public class AWTRobotUtil { robot.setAutoWaitForIdle(true); } - int[] p0 = getClientLocation(obj, x, y); + final int[] p0 = getClientLocation(obj, x, y); awtRobotMouseMove(robot, p0[0], p0[1] ); } - public static int getClickTimeout(Object obj) { + public static int getClickTimeout(final Object obj) { if(obj instanceof com.jogamp.newt.Window) { return com.jogamp.newt.event.MouseEvent.getClickTimeout(); } else if(NativeWindowFactory.isAWTAvailable() && obj instanceof java.awt.Component) { @@ -283,7 +283,7 @@ public class AWTRobotUtil { * requestFocus, if robot is valid, use mouse operation, * otherwise programmatic, ie call requestFocus */ - public static void requestFocus(Robot robot, Object obj) + public static void requestFocus(final Robot robot, final Object obj) throws AWTException, InterruptedException, InvocationTargetException { requestFocus(robot, obj, true); } @@ -292,7 +292,7 @@ public class AWTRobotUtil { * requestFocus, if robot is valid, use mouse operation, * otherwise programmatic, ie call requestFocus */ - public static void requestFocus(Robot robot, Object obj, boolean onTitleBarIfWindow) + public static void requestFocus(final Robot robot, final Object obj, final boolean onTitleBarIfWindow) throws AWTException, InterruptedException, InvocationTargetException { if(null != robot) { final int mouseButton = java.awt.event.InputEvent.BUTTON1_MASK; @@ -314,12 +314,12 @@ public class AWTRobotUtil { } } } - private static void requestFocusNEWT(com.jogamp.newt.Window win, boolean onTitleBarIfWindow) + private static void requestFocusNEWT(final com.jogamp.newt.Window win, final boolean onTitleBarIfWindow) throws AWTException, InterruptedException, InvocationTargetException { win.requestFocus(); System.err.println("requestFocus: NEWT Component"); } - private static void requestFocusAWT(final java.awt.Component comp, boolean onTitleBarIfWindow) + private static void requestFocusAWT(final java.awt.Component comp, final boolean onTitleBarIfWindow) throws AWTException, InterruptedException, InvocationTargetException { javax.swing.SwingUtilities.invokeAndWait(new Runnable() { public void run() { @@ -328,7 +328,7 @@ public class AWTRobotUtil { }}); } - public static void requestFocus(Robot robot, Object obj, int x, int y) + public static void requestFocus(final Robot robot, final Object obj, final int x, final int y) throws AWTException, InterruptedException, InvocationTargetException { validateAWTEDTIsAlive(); @@ -338,7 +338,7 @@ public class AWTRobotUtil { if( idling ) { robot.waitForIdle(); } else { - try { Thread.sleep(50); } catch (InterruptedException e) { } + try { Thread.sleep(50); } catch (final InterruptedException e) { } } robot.mousePress(mouseButton); robot.mouseRelease(mouseButton); @@ -346,7 +346,7 @@ public class AWTRobotUtil { robot.delay( d ); } - public static boolean hasFocus(Object obj) { + public static boolean hasFocus(final Object obj) { if(obj instanceof com.jogamp.newt.Window) { return ((com.jogamp.newt.Window) obj).hasFocus(); } else if(NativeWindowFactory.isAWTAvailable() && obj instanceof java.awt.Component) { @@ -362,7 +362,7 @@ public class AWTRobotUtil { * * @return True if the Window became the global focused Window within TIME_OUT */ - public static boolean waitForFocus(Object obj) throws InterruptedException { + public static boolean waitForFocus(final Object obj) throws InterruptedException { int wait; if(obj instanceof com.jogamp.newt.Window) { final com.jogamp.newt.Window win = (com.jogamp.newt.Window) obj; @@ -385,8 +385,8 @@ public class AWTRobotUtil { * * @return True if the Window became the global focused Window within TIME_OUT */ - public static boolean waitForFocus(FocusEventCountAdapter gain, - FocusEventCountAdapter lost) throws InterruptedException { + public static boolean waitForFocus(final FocusEventCountAdapter gain, + final FocusEventCountAdapter lost) throws InterruptedException { int wait; for (wait=0; wait<POLL_DIVIDER; wait++) { if( ( null == lost || lost.focusLost() ) && ( null == gain || gain.focusGained() ) ) { @@ -401,16 +401,16 @@ public class AWTRobotUtil { * * @return True if the Window became the global focused Window within TIME_OUT */ - public static boolean waitForFocus(Object obj, FocusEventCountAdapter gain, - FocusEventCountAdapter lost) throws InterruptedException { + public static boolean waitForFocus(final Object obj, final FocusEventCountAdapter gain, + final FocusEventCountAdapter lost) throws InterruptedException { if(!waitForFocus(obj)) { return false; } return waitForFocus(gain, lost); } - public static void assertRequestFocusAndWait(Robot robot, Object requestFocus, Object waitForFocus, - FocusEventCountAdapter gain, FocusEventCountAdapter lost) + public static void assertRequestFocusAndWait(final Robot robot, final Object requestFocus, final Object waitForFocus, + final FocusEventCountAdapter gain, final FocusEventCountAdapter lost) throws AWTException, InterruptedException, InvocationTargetException { int i = 0; @@ -455,8 +455,8 @@ public class AWTRobotUtil { robot.delay(msDelay); } - public static int keyType(int i, Robot robot, int keyCode, - Object obj, KeyEventCountAdapter counter) throws InterruptedException, AWTException, InvocationTargetException + public static int keyType(final int i, final Robot robot, final int keyCode, + final Object obj, final KeyEventCountAdapter counter) throws InterruptedException, AWTException, InvocationTargetException { int tc = 0; int j; @@ -489,7 +489,7 @@ public class AWTRobotUtil { } /** No validation is performed .. */ - public static int keyPress(int i, Robot robot, boolean press, int keyCode, int msDelay) { + public static int keyPress(final int i, final Robot robot, final boolean press, final int keyCode, final int msDelay) { final long t0 = System.currentTimeMillis(); if(press) { awtRobotKeyPress(robot, keyCode, msDelay); @@ -501,7 +501,7 @@ public class AWTRobotUtil { } /** No validation is performed .. */ - public static int newtKeyPress(int i, Robot robot, boolean press, short newtKeyCode, int msDelay) { + public static int newtKeyPress(final int i, final Robot robot, final boolean press, final short newtKeyCode, final int msDelay) { final int keyCode = AWTNewtEventFactory.newtKeyCode2AWTKeyCode(newtKeyCode); final long t0 = System.currentTimeMillis(); if(press) { @@ -517,8 +517,8 @@ public class AWTRobotUtil { * @param keyCode TODO * @param counter shall return the number of keys typed (press + release) */ - public static void assertKeyType(Robot robot, int keyCode, int typeCount, - Object obj, KeyEventCountAdapter counter) + public static void assertKeyType(Robot robot, final int keyCode, final int typeCount, + final Object obj, final KeyEventCountAdapter counter) throws AWTException, InterruptedException, InvocationTargetException { if(null == robot) { @@ -549,8 +549,8 @@ public class AWTRobotUtil { * @param keyCode TODO * @param counter shall return the number of keys typed (press + release) */ - public static void assertKeyPress(Robot robot, int keyCode, int typeCount, - Object obj, KeyEventCountAdapter counter) + public static void assertKeyPress(Robot robot, final int keyCode, final int typeCount, + final Object obj, final KeyEventCountAdapter counter) throws AWTException, InterruptedException, InvocationTargetException { if(null == robot) { @@ -577,8 +577,8 @@ public class AWTRobotUtil { Assert.assertEquals("Wrong key count", typeCount, counter.getCount()-c0); } - static int mouseClick(int i, Robot robot, int mouseButton, - Object obj, InputEventCountAdapter counter) throws InterruptedException, AWTException, InvocationTargetException + static int mouseClick(final int i, final Robot robot, final int mouseButton, + final Object obj, final InputEventCountAdapter counter) throws InterruptedException, AWTException, InvocationTargetException { int j; int tc = 0; @@ -611,8 +611,8 @@ public class AWTRobotUtil { * @param mouseButton ie InputEvent.BUTTON1_MASK * @param clickCount ie 1, or 2 */ - public static void assertMouseClick(Robot robot, int mouseButton, int clickCount, - Object obj, InputEventCountAdapter counter) + public static void assertMouseClick(Robot robot, final int mouseButton, final int clickCount, + final Object obj, final InputEventCountAdapter counter) throws AWTException, InterruptedException, InvocationTargetException { if(null == robot) { @@ -647,15 +647,15 @@ public class AWTRobotUtil { * * @return True if the Component becomes <code>visible</code> 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<POLL_DIVIDER && visible != win.isVisible(); wait++) { Thread.sleep(TIME_SLICE); } } else if(NativeWindowFactory.isAWTAvailable() && obj instanceof java.awt.Component) { - java.awt.Component comp = (java.awt.Component) obj; + final java.awt.Component comp = (java.awt.Component) obj; for (wait=0; wait<POLL_DIVIDER && visible != comp.isShowing(); wait++) { Thread.sleep(TIME_SLICE); } @@ -669,7 +669,7 @@ public class AWTRobotUtil { * * @return True if the GLDrawable receives the expected size within TIME_OUT */ - public static boolean waitForSize(GLDrawable drawable, int width, int height) throws InterruptedException { + public static boolean waitForSize(final GLDrawable drawable, final int width, final int height) throws InterruptedException { int wait; for (wait=0; wait<POLL_DIVIDER && ( width != drawable.getSurfaceWidth() || height != drawable.getSurfaceHeight() ) ; wait++) { Thread.sleep(TIME_SLICE); @@ -683,7 +683,7 @@ public class AWTRobotUtil { * @return True if the Component becomes realized (not displayable, native invalid) within TIME_OUT * @throws InterruptedException */ - public static boolean waitForRealized(Object obj, boolean realized) throws InterruptedException { + public static boolean waitForRealized(final Object obj, final boolean realized) throws InterruptedException { return waitForRealized(obj, null, realized); } @@ -694,11 +694,11 @@ public class AWTRobotUtil { * @return True if the Component becomes realized (not displayable, native invalid) within TIME_OUT * @throws InterruptedException */ - public static boolean waitForRealized(Object obj, Runnable waitAction, boolean realized) throws InterruptedException { + public static boolean waitForRealized(final Object obj, final Runnable waitAction, final boolean realized) throws InterruptedException { long t0 = System.currentTimeMillis(); long t1 = t0; if(obj instanceof com.jogamp.newt.Screen) { - com.jogamp.newt.Screen screen = (com.jogamp.newt.Screen) obj; + final com.jogamp.newt.Screen screen = (com.jogamp.newt.Screen) obj; while( (t1-t0) < TIME_OUT && realized != screen.isNativeValid() ) { if( null != waitAction ) { waitAction.run(); @@ -708,7 +708,7 @@ public class AWTRobotUtil { t1 = System.currentTimeMillis(); } } 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; while( (t1-t0) < TIME_OUT && realized != win.isNativeValid() ) { if( null != waitAction ) { waitAction.run(); @@ -718,7 +718,7 @@ public class AWTRobotUtil { t1 = System.currentTimeMillis(); } } else if (NativeWindowFactory.isAWTAvailable() && obj instanceof java.awt.Component) { - java.awt.Component comp = (java.awt.Component) obj; + final java.awt.Component comp = (java.awt.Component) obj; while( (t1-t0) < TIME_OUT && realized != comp.isShowing() ) { if( null != waitAction ) { waitAction.run(); @@ -729,7 +729,7 @@ public class AWTRobotUtil { } // if GLCanvas, ensure it got also painted -> 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 wait<POLL_DIVIDER; } - public static WindowClosingListener addClosingListener(Object obj) { + public static WindowClosingListener addClosingListener(final Object obj) { WindowClosingListener cl = null; if(obj instanceof java.awt.Window) { final java.awt.Window win = (java.awt.Window) obj; @@ -845,8 +845,8 @@ public class AWTRobotUtil { } } ); cl = acl; } else if(obj instanceof com.jogamp.newt.Window) { - com.jogamp.newt.Window win = (com.jogamp.newt.Window) obj; - NEWTWindowClosingAdapter ncl = new NEWTWindowClosingAdapter(); + final com.jogamp.newt.Window win = (com.jogamp.newt.Window) obj; + final NEWTWindowClosingAdapter ncl = new NEWTWindowClosingAdapter(); win.addWindowListener(ncl); cl = ncl; } else { @@ -883,11 +883,11 @@ public class AWTRobotUtil { public boolean isWindowClosed() { return 0 < closed; } - public void windowClosing(java.awt.event.WindowEvent e) { + public void windowClosing(final java.awt.event.WindowEvent e) { closing++; System.err.println("AWTWindowClosingAdapter.windowClosing: "+this); } - public void windowClosed(java.awt.event.WindowEvent e) { + public void windowClosed(final java.awt.event.WindowEvent e) { closed++; System.err.println("AWTWindowClosingAdapter.windowClosed: "+this); } @@ -917,11 +917,11 @@ public class AWTRobotUtil { public boolean isWindowClosed() { return 0 < closed; } - public void windowDestroyNotify(WindowEvent e) { + public void windowDestroyNotify(final WindowEvent e) { closing++; System.err.println("NEWTWindowClosingAdapter.windowDestroyNotify: "+this); } - public void windowDestroyed(WindowEvent e) { + public void windowDestroyed(final WindowEvent e) { closed++; System.err.println("NEWTWindowClosingAdapter.windowDestroyed: "+this); } diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTWindowFocusAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/AWTWindowFocusAdapter.java index 2e74dfae8..e2cafb1de 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/AWTWindowFocusAdapter.java +++ b/src/test/com/jogamp/opengl/test/junit/util/AWTWindowFocusAdapter.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.awt.event.WindowEvent; @@ -37,27 +37,27 @@ public class AWTWindowFocusAdapter implements FocusEventCountAdapter, WindowFocu int focusCount; boolean verbose = true; - public AWTWindowFocusAdapter(String prefix) { + public AWTWindowFocusAdapter(final String prefix) { this.prefix = prefix; reset(); } - public void setVerbose(boolean v) { verbose = false; } + public void setVerbose(final boolean v) { verbose = false; } public boolean focusLost() { - return focusCount<0; + return focusCount<0; } - + public boolean focusGained() { return focusCount>0; } - + 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.length; i++) { adapters[i].reset(); } } - public static void reset(List/*<EventCountAdapter>*/ adapters) { - for(Iterator i = adapters.iterator(); i.hasNext(); ) { - EventCountAdapter adapter = (EventCountAdapter) i.next(); + public static void reset(final List/*<EventCountAdapter>*/ 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; i<expected.remaining(); i++) { @@ -143,18 +143,18 @@ public class MiscUtils { throw new AssertionError(msg+"; Expected and actual are equal."); } - public static boolean setFieldIfExists(Object instance, String fieldName, Object value) { + public static boolean setFieldIfExists(final Object instance, final String fieldName, final Object value) { try { - Field f = instance.getClass().getField(fieldName); + final Field f = instance.getClass().getField(fieldName); if(value instanceof Boolean || f.getType().isInstance(value)) { f.set(instance, value); return true; } else { System.out.println(instance.getClass()+" '"+fieldName+"' field not assignable with "+value.getClass()+", it's a: "+f.getType()); } - } catch (IllegalAccessException ex) { + } catch (final IllegalAccessException ex) { throw new RuntimeException(ex); - } catch (NoSuchFieldException nsfe) { + } catch (final NoSuchFieldException nsfe) { // OK - throw new RuntimeException(instance.getClass()+" has no '"+fieldName+"' field", nsfe); } return false; @@ -168,14 +168,14 @@ public class MiscUtils { final Object sync; volatile boolean eos = false; - public StreamDump(OutputStream out, String prefix, InputStream is, Object sync) { + public StreamDump(final OutputStream out, final String prefix, final InputStream is, final Object sync) { this.is = is; this.outString = null; this.outStream = out; this.prefix = prefix; this.sync = sync; } - public StreamDump(StringBuilder sb, InputStream is, Object sync) { + public StreamDump(final StringBuilder sb, final InputStream is, final Object sync) { this.is = is; this.outString = sb; this.outStream = null; @@ -203,7 +203,7 @@ public class MiscUtils { outStream.flush(); } } - } catch (IOException ioe) { + } catch (final IOException ioe) { System.err.println("Caught "+ioe.getClass().getName()+": "+ioe.getMessage()); ioe.printStackTrace(); } finally { @@ -214,7 +214,7 @@ public class MiscUtils { } } - public static void dumpSharedGLContext(GLContext self) { + public static void dumpSharedGLContext(final GLContext self) { int i = 0, j = 0; System.err.println("Myself: hash 0x"+Integer.toHexString(self.hashCode())+", \t(isShared "+self.isShared()+", created "+self.isCreated()+")"); { diff --git a/src/test/com/jogamp/opengl/test/junit/util/NEWTFocusAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/NEWTFocusAdapter.java index ccb1bde78..23e08179a 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/NEWTFocusAdapter.java +++ b/src/test/com/jogamp/opengl/test/junit/util/NEWTFocusAdapter.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 com.jogamp.newt.event.WindowEvent; @@ -38,26 +38,26 @@ public class NEWTFocusAdapter implements WindowListener, FocusEventCountAdapter int focusCount; boolean verbose = true; - public NEWTFocusAdapter(String prefix) { + public NEWTFocusAdapter(final String prefix) { this.prefix = prefix; reset(); } - public void setVerbose(boolean v) { verbose = false; } + public void setVerbose(final boolean v) { verbose = false; } public boolean focusLost() { - return focusCount<0; + return focusCount<0; } - + public boolean focusGained() { return focusCount>0; } - + 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<EventObject> queue = new ArrayList<EventObject>(); 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<EventObject> keyEvents) { + public static void dumpKeyEvents(final List<EventObject> keyEvents) { for(int i=0; i<keyEvents.size(); i++) { System.err.println(i+": "+keyEvents.get(i)); } } - public static boolean validateKeyCodes(CodeSeg[] codeSegments, List<List<EventObject>> keyEventsList, boolean verbose) { + public static boolean validateKeyCodes(final CodeSeg[] codeSegments, final List<List<EventObject>> keyEventsList, final boolean verbose) { final List<CodeEvent> missCodes = new ArrayList<CodeEvent>(); int totalCodeCount = 0; boolean res = true; @@ -91,7 +91,7 @@ public class NEWTKeyUtil { } return res; } - public static boolean validateKeyCodes(List<CodeEvent> missCodes, CodeSeg codeSeg, List<EventObject> keyEvents, boolean verbose) { + public static boolean validateKeyCodes(final List<CodeEvent> missCodes, final CodeSeg codeSeg, final List<EventObject> 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<EventObject> keyEvents) { - IntIntHashMap keyCode2NextEvent = new IntIntHashMap(); + public static void validateKeyEventOrder(final List<EventObject> keyEvents) { + final IntIntHashMap keyCode2NextEvent = new IntIntHashMap(); for(int i=0; i<keyEvents.size(); i++) { final KeyEvent e = (KeyEvent) keyEvents.get(i); int eet = keyCode2NextEvent.get(e.getKeyCode()); @@ -168,9 +168,9 @@ public class NEWTKeyUtil { * @param expPressedCountAR number of auto-repeat key press events * @param expReleasedCountAR number of auto-repeat key release events */ - public static void validateKeyAdapterStats(NEWTKeyAdapter keyAdapter, - int expPressedCountSI, int expReleasedCountSI, - int expPressedCountAR, int expReleasedCountAR) { + public static void validateKeyAdapterStats(final NEWTKeyAdapter keyAdapter, + final int expPressedCountSI, final int expReleasedCountSI, + final int expPressedCountAR, final int expReleasedCountAR) { final int expPressReleaseCountSI = expPressedCountSI + expReleasedCountSI; final int expPressReleaseCountAR = expPressedCountAR + expReleasedCountAR; final int expPressReleaseCountALL = expPressReleaseCountSI + expPressReleaseCountAR; diff --git a/src/test/com/jogamp/opengl/test/junit/util/NEWTMouseAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/NEWTMouseAdapter.java index 22e241f71..bd191dd2c 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/NEWTMouseAdapter.java +++ b/src/test/com/jogamp/opengl/test/junit/util/NEWTMouseAdapter.java @@ -44,12 +44,12 @@ public class NEWTMouseAdapter extends MouseAdapter implements InputEventCountAda List<EventObject> queue = new ArrayList<EventObject>(); 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<FrameworkMethod> testMethods = tc.getAnnotatedMethods(org.junit.Test.class); - for(Iterator<FrameworkMethod> iter=testMethods.iterator(); iter.hasNext(); ) { + for(final Iterator<FrameworkMethod> 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 <code>null</code> 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); } } diff --git a/src/test/jogamp/newt/WindowImplAccess.java b/src/test/jogamp/newt/WindowImplAccess.java index 3387a2ae2..b98835f37 100644 --- a/src/test/jogamp/newt/WindowImplAccess.java +++ b/src/test/jogamp/newt/WindowImplAccess.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. @@ -34,13 +34,13 @@ import com.jogamp.newt.Window; * Allows access to protected methods of WindowImpl */ public class WindowImplAccess { - public static final void windowDestroyNotify(Window win) { + public static final void windowDestroyNotify(final Window win) { final WindowImpl winImpl = (WindowImpl) win.getDelegatedWindow(); winImpl.runOnEDTIfAvail(true, new Runnable() { public void run() { winImpl.windowDestroyNotify(false); } - }); + }); } } |