diff options
Diffstat (limited to 'src/test/com')
19 files changed, 68 insertions, 56 deletions
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 7897d0a00..5c217a7dc 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 @@ -108,7 +108,7 @@ public class GPURegionNewtDemo { final GLWindow window = GLWindow.create(caps); window.setPosition(10, 10); - window.setSize(800, 400); + window.setSurfaceSize(800, 400); window.setTitle("GPU Curve Region Newt Demo - graph[vbaa"+GraphVBAASamples+" msaa"+GraphMSAASamples+"], msaa "+SceneMSAASamples); RenderState rs = RenderState.createRenderState(SVertex.factory()); 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 e6b1f9c9c..09cf706ce 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 @@ -106,7 +106,7 @@ public class GPUTextNewtDemo { final GLWindow window = GLWindow.create(caps); window.setPosition(10, 10); - window.setSize(800, 400); + window.setSurfaceSize(800, 400); window.setTitle("GPU Text Newt Demo - graph[vbaa"+GraphVBAASamples+" msaa"+GraphMSAASamples+"], msaa "+SceneMSAASamples); RenderState rs = RenderState.createRenderState(SVertex.factory()); 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 79f6d7bb8..c26cb467a 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 @@ -21,7 +21,7 @@ public class GPUUISceneNewtDemo { static boolean GraphMSAAMode = false; public static void main(String[] args) { - int wwidth = 800, wheight = 400; + int swidth = 800, sheight = 400; if( 0 != args.length ) { for(int i=0; i<args.length; i++) { if(args[i].equals("-smsaa")) { @@ -37,10 +37,10 @@ public class GPUUISceneNewtDemo { GraphVBAAMode = true; } else if(args[i].equals("-width")) { i++; - wwidth = MiscUtils.atoi(args[i], wwidth); + swidth = MiscUtils.atoi(args[i], swidth); } else if(args[i].equals("-height")) { i++; - wheight = MiscUtils.atoi(args[i], wheight); + sheight = MiscUtils.atoi(args[i], sheight); } } } @@ -68,7 +68,7 @@ public class GPUUISceneNewtDemo { final GLWindow window = GLWindow.create(caps); window.setPosition(10, 10); - window.setSize(wwidth, wheight); + window.setSurfaceSize(swidth, sheight); window.setTitle("GraphUI Newt Demo: graph["+Region.getRenderModeString(rmode)+"], msaa "+SceneMSAASamples); final RenderState rs = RenderState.createRenderState(SVertex.factory()); 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 ae2cf6c5a..1f6faf15b 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 @@ -115,7 +115,7 @@ public class GLEventListenerButton extends TextureSeqButton { imgSeq.addFrame(gl, tex); markStateDirty(); } else if( 0 != fboWidth*fboHeight ) { - fboGLAD.setSize(fboWidth, fboHeight); + fboGLAD.setSurfaceSize(fboWidth, fboHeight); fboWidth = 0; fboHeight = 0; } else if( animateGLEL ) { 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..5fe863527 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 @@ -61,7 +61,7 @@ public class UINewtDemo01 { final GLWindow window = GLWindow.create(caps); window.setPosition(10, 10); - window.setSize(800, 400); + window.setSurfaceSize(800, 400); window.setTitle("GPU UI Newt Demo 01"); RenderState rs = RenderState.createRenderState(SVertex.factory()); UIGLListener01 uiGLListener = new UIGLListener01 (0, rs, DEBUG, TRACE); 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 3ad1b90dc..665cb2df4 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 @@ -265,7 +265,7 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase { // 2, 3 (resize + display) szStep = 1; - glad.setSize(widthStep*szStep, heightStep*szStep); // SWAP_EVEN + glad.setSurfaceSize(widthStep*szStep, heightStep*szStep); // SWAP_EVEN Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); snapshotGLEventListener.setMakeSnapshot(); @@ -309,7 +309,7 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase { // 4, 5 (resize + display) szStep = 4; - glad.setSize(widthStep*szStep, heightStep*szStep); // SWAP_ODD + glad.setSurfaceSize(widthStep*szStep, heightStep*szStep); // SWAP_ODD Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); snapshotGLEventListener.setMakeSnapshot(); @@ -361,7 +361,7 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase { // 8, 9 (resize + samples + display) szStep = 3; - glad.setSize(widthStep*szStep, heightStep*szStep); + glad.setSurfaceSize(widthStep*szStep, heightStep*szStep); Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); snapshotGLEventListener.setMakeSnapshot(); 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 f1c019f2c..8a833be05 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 @@ -201,8 +201,8 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase { } } public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { - fbod1.setSize(width, height); - fbod2.setSize(width, height); + fbod1.setSurfaceSize(width, height); + fbod2.setSurfaceSize(width, height); } }); 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 baa8a965b..155162964 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 @@ -156,7 +156,7 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase { glWindow.addWindowListener(new WindowAdapter() { @Override public void windowResized(WindowEvent e) { - fbod1.setSize(glWindow.getSurfaceWidth(), glWindow.getSurfaceHeight()); + fbod1.setSurfaceSize(glWindow.getSurfaceWidth(), glWindow.getSurfaceHeight()); } }); glWindow.addGLEventListener(mixerDemo); 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 33c0508a1..06c09bbbf 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 @@ -134,7 +134,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase { // 2, 3 (resize + display) szStep = 1; - glad.setSize(widthStep*szStep, heightStep*szStep); + glad.setSurfaceSize(widthStep*szStep, heightStep*szStep); Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); snapshotGLEventListener.setMakeSnapshot(); @@ -142,7 +142,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase { // 4, 5 (resize + display) szStep = 4; - glad.setSize(widthStep*szStep, heightStep*szStep); + glad.setSurfaceSize(widthStep*szStep, heightStep*szStep); Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); snapshotGLEventListener.setMakeSnapshot(); 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 f482a4468..ffa64d894 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 @@ -134,7 +134,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase { // 2, 3 (resize + display) szStep = 1; - glad.setSize(widthStep*szStep, heightStep*szStep); + glad.setSurfaceSize(widthStep*szStep, heightStep*szStep); Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); snapshotGLEventListener.setMakeSnapshot(); @@ -142,7 +142,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase { // 4, 5 (resize + display) szStep = 4; - glad.setSize(widthStep*szStep, heightStep*szStep); + glad.setSurfaceSize(widthStep*szStep, heightStep*szStep); Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); snapshotGLEventListener.setMakeSnapshot(); 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 2f3c8c7e8..8d3d05869 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 @@ -126,7 +126,7 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase { // 2, 3 (resize + display) szStep = 1; - glad.setSize(widthStep*szStep, heightStep*szStep); + glad.setSurfaceSize(widthStep*szStep, heightStep*szStep); Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); snapshotGLEventListener.setMakeSnapshot(); @@ -134,7 +134,7 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase { // 4, 5 (resize + display) szStep = 4; - glad.setSize(widthStep*szStep, heightStep*szStep); + glad.setSurfaceSize(widthStep*szStep, heightStep*szStep); Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); snapshotGLEventListener.setMakeSnapshot(); 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 218093689..6cddce62c 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 @@ -327,9 +327,13 @@ public class GearsES1 implements GLEventListener { Window window = (Window) source; width=window.getSurfaceWidth(); height=window.getSurfaceHeight(); + } else if (source instanceof GLAutoDrawable) { + 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; - width=comp.getWidth(); + 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); 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 09fd911a7..b2b1dd642 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 @@ -619,7 +619,7 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererL height = glad.getSurfaceHeight(); } else if (GLProfile.isAWTAvailable() && source instanceof java.awt.Component) { java.awt.Component comp = (java.awt.Component) source; - width=comp.getWidth(); + 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); 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 17332a4e2..db0e11734 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 @@ -98,9 +98,13 @@ public class TextureSequenceCubeES2 implements GLEventListener { window = (Window) source; width=window.getSurfaceWidth(); height=window.getSurfaceHeight(); + } else if (source instanceof GLAutoDrawable) { + 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; - width=comp.getWidth(); + 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); 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 730e6e562..116d5d245 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 @@ -561,7 +561,7 @@ public class MovieCube implements GLEventListener { anim.stop(); } }); - window.setSize(width, height); + window.setSurfaceSize(width, height); window.setVisible(true); System.err.println("Chosen: "+window.getChosenGLCapabilities()); anim.start(); @@ -577,7 +577,7 @@ public class MovieCube implements GLEventListener { System.err.println("MovieCube State: "+mp); if( 0 != ( GLMediaEventListener.EVENT_CHANGE_SIZE & event_mask ) ) { if( origSize ) { - window.setSize(mp.getWidth(), mp.getHeight()); + window.setSurfaceSize(mp.getWidth(), mp.getHeight()); } // window.disposeGLEventListener(ms, false /* remove */ ); mc.resetGLState(); 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 7afd31352..1997739e3 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 @@ -94,7 +94,7 @@ public class MovieSimple implements GLEventListener { private static final String PLAYER = "player"; private static boolean waitForKey = false; - private int winWidth, winHeight; + private int surfWidth, surfHeight; private int prevMouseX; // , prevMouseY; private int rotate = 0; private boolean orthoProjection = true; @@ -213,7 +213,7 @@ public class MovieSimple implements GLEventListener { private final MouseListener mouseAction = new MouseAdapter() { public void mousePressed(MouseEvent e) { - if(e.getY()<=winHeight/2 && null!=mPlayer && 1 == e.getClickCount()) { + if(e.getY()<=surfHeight/2 && null!=mPlayer && 1 == e.getClickCount()) { if(GLMediaPlayer.State.Playing == mPlayer.getState()) { mPlayer.pause(false); } else { @@ -222,7 +222,7 @@ public class MovieSimple implements GLEventListener { } } public void mouseReleased(MouseEvent e) { - if(e.getY()<=winHeight/2) { + if(e.getY()<=surfHeight/2) { rotate = -1; zoom = zoom0; System.err.println("zoom: "+zoom); @@ -236,8 +236,8 @@ public class MovieSimple implements GLEventListener { int x = e.getX(); int y = e.getY(); - if(y>winHeight/2) { - final float dp = (float)(x-prevMouseX)/(float)winWidth; + if(y>surfHeight/2) { + final float dp = (float)(x-prevMouseX)/(float)surfWidth; final int pts0 = GLMediaPlayer.STREAM_ID_NONE != mPlayer.getVID() ? mPlayer.getVideoPTS() : mPlayer.getAudioPTS(); mPlayer.seek(pts0 + (int) (mPlayer.getDuration() * dp)); } else { @@ -602,8 +602,8 @@ public class MovieSimple implements GLEventListener { final Window window = (Window) upstreamWidget; window.addMouseListener(mouseAction); window.addKeyListener(keyAction); - winWidth = window.getSurfaceWidth(); - winHeight = window.getSurfaceHeight(); + surfWidth = window.getSurfaceWidth(); + surfHeight = window.getSurfaceHeight(); } final int rmode = drawable.getChosenGLCapabilities().getSampleBuffers() ? 0 : Region.VBAA_RENDERING_BIT; final boolean lowPerfDevice = gl.isGLES(); @@ -669,8 +669,8 @@ public class MovieSimple implements GLEventListener { public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { final GL2ES2 gl = drawable.getGL().getGL2ES2(); if(null == mPlayer) { return; } - winWidth = width; - winHeight = height; + surfWidth = width; + surfHeight = height; if(null != st) { reshapePMV(width, height); @@ -827,7 +827,7 @@ public class MovieSimple implements GLEventListener { if( 0 != ( GLMediaEventListener.EVENT_CHANGE_SIZE & event_mask ) ) { System.err.println("MovieSimple State: CHANGE_SIZE"); if( origSize ) { - window.setSize(mp.getWidth(), mp.getHeight()); + window.setSurfaceSize(mp.getWidth(), mp.getHeight()); } // window.disposeGLEventListener(ms, false /* remove */ ); ms.resetGLState(); @@ -1050,7 +1050,7 @@ public class MovieSimple implements GLEventListener { mss[i].mPlayer.addEventListener(myGLMediaEventListener); windows[i].setTitle("Player "+i); - windows[i].setSize(width, height); + windows[i].setSurfaceSize(width, height); windows[i].setVisible(true); anim.add(windows[i]); 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 049945bda..9c5d1e249 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 @@ -501,9 +501,13 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList Window window = (Window) source; width=window.getSurfaceWidth(); height=window.getSurfaceHeight(); + } else if (source instanceof GLAutoDrawable) { + 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; - width=comp.getWidth(); + 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); 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 19b6fbd07..082a900a0 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT 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,14 +54,14 @@ public class TestWindows01NEWT extends UITestCase { static Window createWindow(Capabilities caps, int x, int y, int width, int height, boolean onscreen, boolean undecorated) throws InterruptedException { final boolean userPos = x>=0 && y>=0 ; // user has specified a position - + Assert.assertNotNull(caps); caps.setOnscreen(onscreen); // System.out.println("Requested: "+caps); // // Create native windowing resources .. X11/Win/OSX - // + // Window window = NewtFactory.createWindow(caps); Assert.assertNotNull(window); Screen screen = window.getScreen(); @@ -75,13 +75,13 @@ public class TestWindows01NEWT extends UITestCase { Assert.assertEquals(false,window.isVisible()); window.setVisible(true); // System.err.println("************* Created: "+window); - - Assert.assertEquals(true,display.isNativeValid()); + + Assert.assertEquals(true,display.isNativeValid()); Assert.assertEquals(true,screen.isNativeValid()); Assert.assertEquals(true,window.isVisible()); Assert.assertEquals(true,window.isNativeValid()); - Assert.assertEquals(width, window.getSurfaceWidth()); - Assert.assertEquals(height, window.getSurfaceHeight()); + Assert.assertEquals(width, window.getWindowWidth()); + Assert.assertEquals(height, window.getWindowHeight()); /** we don't sync on position - unreliable test Point p0 = window.getLocationOnScreen(null); @@ -98,7 +98,7 @@ public class TestWindows01NEWT extends UITestCase { Assert.assertTrue(chosenCapabilities.getBlueBits()>=5); Assert.assertTrue(chosenCapabilities.getRedBits()>=5); Assert.assertEquals(chosenCapabilities.isOnscreen(),onscreen); - + return window; } @@ -115,7 +115,7 @@ public class TestWindows01NEWT extends UITestCase { Assert.assertEquals(false,display.isNativeValid()); } else { Assert.assertEquals(true,screen.isNativeValid()); - Assert.assertEquals(true,display.isNativeValid()); + Assert.assertEquals(true,display.isNativeValid()); } Assert.assertEquals(false,window.isNativeValid()); Assert.assertEquals(false,window.isVisible()); @@ -148,16 +148,16 @@ public class TestWindows01NEWT extends UITestCase { Window window = createWindow(caps, -1, -1, width, height, true /* onscreen */, false /* undecorated */); destroyWindow(window, true); - + window.setVisible(true); Assert.assertEquals(true,window.isNativeValid()); Assert.assertEquals(true,window.isVisible()); - Assert.assertEquals(width, window.getSurfaceWidth()); - Assert.assertEquals(height, window.getSurfaceHeight()); + Assert.assertEquals(width, window.getWindowWidth()); + Assert.assertEquals(height, window.getWindowHeight()); destroyWindow(window, true); } - + @Test public void testWindowDecorDestroyWinTwiceA() throws InterruptedException { Capabilities caps = new Capabilities(); 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 45df52220..a9fc53eec 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java +++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java @@ -137,9 +137,9 @@ public class AWTRobotUtil { javax.media.nativewindow.util.Point p0 = win.getLocationOnScreen(null); if( onTitleBarIfWindow ) { javax.media.nativewindow.util.InsetsImmutable insets = win.getInsets(); - p0.translate(win.getSurfaceWidth()/2, insets.getTopHeight()/2); + p0.translate(win.getWindowWidth()/2, insets.getTopHeight()/2); } else { - p0.translate(win.getSurfaceWidth()/2, win.getSurfaceHeight()/2); + p0.translate(win.getWindowWidth()/2, win.getWindowHeight()/2); } return new int[] { p0.getX(), p0.getY() }; } |