diff options
author | Sven Gothel <[email protected]> | 2023-03-19 06:18:26 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-03-19 06:18:26 +0100 |
commit | 5f5bad23d9d84f76855749d4efcda85792f312c9 (patch) | |
tree | 5142ac9d0130263896e4628a9beb3102a9a203fb /src/demos | |
parent | a39c72b5a928a57c074d379f7c426c18eb076f73 (diff) |
Fix MovieSimple regression of commit 00dbacc5af3531af50e77a02d534dc11e08de10f, 913b00f8b876e29af91677ef61b3eb35d6853e6e
Diffstat (limited to 'src/demos')
4 files changed, 19 insertions, 5 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/android/MovieSimpleActivity0.java b/src/demos/com/jogamp/opengl/demos/android/MovieSimpleActivity0.java index 4b051a8cd..ecc417bb8 100644 --- a/src/demos/com/jogamp/opengl/demos/android/MovieSimpleActivity0.java +++ b/src/demos/com/jogamp/opengl/demos/android/MovieSimpleActivity0.java @@ -97,7 +97,7 @@ public class MovieSimpleActivity0 extends NewtBaseActivity { glWindowMain.setVisible(true); final MovieSimple demoMain = new MovieSimple(null); - demoMain.setScaleOrig(true); + demoMain.setUseOriginalScale(true); final GLMediaPlayer mPlayer = demoMain.getGLMediaPlayer(); mPlayer.addEventListener( new GLMediaPlayer.GLMediaEventListener() { @Override diff --git a/src/demos/com/jogamp/opengl/demos/android/MovieSimpleActivity1.java b/src/demos/com/jogamp/opengl/demos/android/MovieSimpleActivity1.java index 64a3c7c69..61eeed08d 100644 --- a/src/demos/com/jogamp/opengl/demos/android/MovieSimpleActivity1.java +++ b/src/demos/com/jogamp/opengl/demos/android/MovieSimpleActivity1.java @@ -135,7 +135,7 @@ public class MovieSimpleActivity1 extends NewtBaseActivity { demoMain.setEffects(MovieSimple.EFFECT_GRADIENT_BOTTOM2TOP); demoMain.setTransparency(0.9f); } - demoMain.setScaleOrig(mPlayerNoZoom); + demoMain.setUseOriginalScale(mPlayerNoZoom); mPlayerMain.addEventListener( new GLMediaPlayer.GLMediaEventListener() { @Override public void newFrameAvailable(final GLMediaPlayer ts, final TextureFrame newFrame, final long when) { } diff --git a/src/demos/com/jogamp/opengl/demos/av/MovieSimple.java b/src/demos/com/jogamp/opengl/demos/av/MovieSimple.java index 26c31ae24..ef4392743 100644 --- a/src/demos/com/jogamp/opengl/demos/av/MovieSimple.java +++ b/src/demos/com/jogamp/opengl/demos/av/MovieSimple.java @@ -96,6 +96,7 @@ public class MovieSimple implements GLEventListener { private TextureSequenceES2 screen=null; private GLMediaPlayer mPlayer; private final boolean mPlayerShared; + private boolean useOriginalScale; private volatile boolean resetGLState = false; private volatile GLAutoDrawable autoDrawable = null; @@ -399,6 +400,7 @@ public class MovieSimple implements GLEventListener { screenshot = new GLReadBufferUtil(false, false); mPlayer = sharedMediaPlayer; mPlayerShared = null != mPlayer; + useOriginalScale = false; if( !mPlayerShared ) { mPlayer = GLMediaPlayerFactory.createDefault(); mPlayer.attachObject(PLAYER, this); @@ -413,6 +415,10 @@ public class MovieSimple implements GLEventListener { public void setSwapInterval(final int v) { this.swapInterval = v; } + public void setUseOriginalScale(final boolean v) { + useOriginalScale = v; + } + public GLMediaPlayer getGLMediaPlayer() { return mPlayer; } /** defaults to true */ @@ -448,6 +454,7 @@ public class MovieSimple implements GLEventListener { screen = new TextureSequenceES2(mPlayer, mPlayerShared, orthoProjection, zoom); screen.setEffects(effects); screen.setTransparency(alpha); + screen.setUseOriginalScale(useOriginalScale); if(waitForKey) { JunitTracer.waitForKey("Init>"); @@ -667,6 +674,7 @@ public class MovieSimple implements GLEventListener { int height = 600; int textureCount = 3; // default - threaded boolean ortho = true; + boolean zoom = false; boolean forceES2 = false; boolean forceES3 = false; @@ -721,6 +729,8 @@ public class MovieSimple implements GLEventListener { swapInterval = MiscUtils.atoi(args[i], swapInterval); } else if(args[i].equals("-projection")) { ortho=false; + } else if(args[i].equals("-zoom")) { + zoom=true; } else if(args[i].equals("-loop")) { loopEOS=true; } else if(args[i].equals("-urlN")) { @@ -795,6 +805,7 @@ public class MovieSimple implements GLEventListener { }); mss[i] = new MovieSimple(null); mss[i].setSwapInterval(swapInterval); + mss[i].setUseOriginalScale(!zoom); mss[i].setOrthoProjection(ortho); mss[i].mPlayer.attachObject(WINDOW_KEY, windows[i]); mss[i].mPlayer.addEventListener(myGLMediaEventListener); diff --git a/src/demos/com/jogamp/opengl/demos/es2/TextureSequenceES2.java b/src/demos/com/jogamp/opengl/demos/es2/TextureSequenceES2.java index 95b4df8d6..2814313c5 100644 --- a/src/demos/com/jogamp/opengl/demos/es2/TextureSequenceES2.java +++ b/src/demos/com/jogamp/opengl/demos/es2/TextureSequenceES2.java @@ -72,7 +72,7 @@ public class TextureSequenceES2 implements GLEventListener { private int effects = EFFECT_NORMAL; private float alpha = 1.0f; - private boolean mPlayerScaleOrig; + private boolean useOriginalScale = false; private float[] verts = null; private GLArrayDataServer interleavedVBO; @@ -92,6 +92,9 @@ public class TextureSequenceES2 implements GLEventListener { this.effects |= EFFECT_TRANSPARENT; this.alpha = alpha; } + public void setUseOriginalScale(final boolean v) { + useOriginalScale = v; + } private static final String shaderBasename = "texsequence_xxx"; private static final String myTextureLookupName = "myTexture2D"; @@ -179,13 +182,13 @@ public class TextureSequenceES2 implements GLEventListener { System.err.println("XXX0: mov aspect: "+mAspect); float xs, ys; if(orthoProjection) { - if(mPlayerScaleOrig && mWidth < dWidth && mHeight < dHeight) { + if(useOriginalScale && mWidth < dWidth && mHeight < dHeight) { xs = mWidth/2f; ys = xs / mAspect; } else { xs = dWidth/2f; ys = xs / mAspect; // w>h } } else { - if(mPlayerScaleOrig && mWidth < dWidth && mHeight < dHeight) { + if(useOriginalScale && mWidth < dWidth && mHeight < dHeight) { xs = mAspect * ( mWidth / dWidth ) ; ys = xs / mAspect ; } else { xs = mAspect; ys = 1f; // b>h |