|
|
@ -51,6 +51,8 @@ import java.nio.IntBuffer; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.concurrent.atomic.AtomicBoolean; |
|
|
|
import java.util.concurrent.atomic.AtomicBoolean; |
|
|
|
|
|
|
|
import java.util.logging.Level; |
|
|
|
|
|
|
|
import java.util.logging.Logger; |
|
|
|
|
|
|
|
|
|
|
|
public class AwtPanel extends Canvas implements SceneProcessor { |
|
|
|
public class AwtPanel extends Canvas implements SceneProcessor { |
|
|
|
|
|
|
|
|
|
|
@ -99,7 +101,6 @@ public class AwtPanel extends Canvas implements SceneProcessor { |
|
|
|
newWidth = newWidth2; |
|
|
|
newWidth = newWidth2; |
|
|
|
newHeight = newHeight2; |
|
|
|
newHeight = newHeight2; |
|
|
|
reshapeNeeded.set(true); |
|
|
|
reshapeNeeded.set(true); |
|
|
|
System.out.println("EDT: componentResized " + newWidth + ", " + newHeight); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -112,7 +113,6 @@ public class AwtPanel extends Canvas implements SceneProcessor { |
|
|
|
|
|
|
|
|
|
|
|
synchronized (lock) { |
|
|
|
synchronized (lock) { |
|
|
|
hasNativePeer.set(true); |
|
|
|
hasNativePeer.set(true); |
|
|
|
System.out.println("EDT: addNotify"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
requestFocusInWindow(); |
|
|
|
requestFocusInWindow(); |
|
|
@ -122,7 +122,6 @@ public class AwtPanel extends Canvas implements SceneProcessor { |
|
|
|
public void removeNotify() { |
|
|
|
public void removeNotify() { |
|
|
|
synchronized (lock) { |
|
|
|
synchronized (lock) { |
|
|
|
hasNativePeer.set(false); |
|
|
|
hasNativePeer.set(false); |
|
|
|
System.out.println("EDT: removeNotify"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
super.removeNotify(); |
|
|
|
super.removeNotify(); |
|
|
@ -141,19 +140,12 @@ public class AwtPanel extends Canvas implements SceneProcessor { |
|
|
|
if (strategy != null) { |
|
|
|
if (strategy != null) { |
|
|
|
// strategy.dispose();
|
|
|
|
// strategy.dispose();
|
|
|
|
strategy = null; |
|
|
|
strategy = null; |
|
|
|
System.out.println("OGL: Not visible. Destroy strategy."); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
boolean currentShowing = isShowing(); |
|
|
|
boolean currentShowing = isShowing(); |
|
|
|
if (showing.getAndSet(currentShowing) != currentShowing){ |
|
|
|
showing.set(currentShowing); |
|
|
|
if (currentShowing){ |
|
|
|
|
|
|
|
System.out.println("OGL: Enter showing state."); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
System.out.println("OGL: Exit showing state."); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return currentShowing; |
|
|
|
return currentShowing; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -190,7 +182,6 @@ public class AwtPanel extends Canvas implements SceneProcessor { |
|
|
|
ex.printStackTrace(); |
|
|
|
ex.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
strategy = getBufferStrategy(); |
|
|
|
strategy = getBufferStrategy(); |
|
|
|
System.out.println("OGL: Visible. Create strategy."); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Draw screenshot.
|
|
|
|
// Draw screenshot.
|
|
|
@ -198,7 +189,7 @@ public class AwtPanel extends Canvas implements SceneProcessor { |
|
|
|
do { |
|
|
|
do { |
|
|
|
Graphics2D g2d = (Graphics2D) strategy.getDrawGraphics(); |
|
|
|
Graphics2D g2d = (Graphics2D) strategy.getDrawGraphics(); |
|
|
|
if (g2d == null) { |
|
|
|
if (g2d == null) { |
|
|
|
System.out.println("OGL: DrawGraphics was null."); |
|
|
|
Logger.getLogger(AwtPanel.class.getName()).log(Level.WARNING, "OGL: DrawGraphics was null."); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -231,6 +222,7 @@ public class AwtPanel extends Canvas implements SceneProcessor { |
|
|
|
this.attachAsMain = overrideMainFramebuffer; |
|
|
|
this.attachAsMain = overrideMainFramebuffer; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void initialize(RenderManager rm, ViewPort vp) { |
|
|
|
public void initialize(RenderManager rm, ViewPort vp) { |
|
|
|
if (this.rm == null) { |
|
|
|
if (this.rm == null) { |
|
|
|
// First time called in OGL thread
|
|
|
|
// First time called in OGL thread
|
|
|
@ -264,7 +256,6 @@ public class AwtPanel extends Canvas implements SceneProcessor { |
|
|
|
// synchronized (lock){
|
|
|
|
// synchronized (lock){
|
|
|
|
// img = (BufferedImage) getGraphicsConfiguration().createCompatibleImage(width, height);
|
|
|
|
// img = (BufferedImage) getGraphicsConfiguration().createCompatibleImage(width, height);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
AffineTransform tx = AffineTransform.getScaleInstance(1, -1); |
|
|
|
AffineTransform tx = AffineTransform.getScaleInstance(1, -1); |
|
|
|
tx.translate(0, -img.getHeight()); |
|
|
|
tx.translate(0, -img.getHeight()); |
|
|
|
transformOp = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR); |
|
|
|
transformOp = new AffineTransformOp(tx, AffineTransformOp.TYPE_NEAREST_NEIGHBOR); |
|
|
@ -283,13 +274,16 @@ public class AwtPanel extends Canvas implements SceneProcessor { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public boolean isInitialized() { |
|
|
|
public boolean isInitialized() { |
|
|
|
return fb != null; |
|
|
|
return fb != null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void preFrame(float tpf) { |
|
|
|
public void preFrame(float tpf) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void postQueue(RenderQueue rq) { |
|
|
|
public void postQueue(RenderQueue rq) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -323,6 +317,7 @@ public class AwtPanel extends Canvas implements SceneProcessor { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void postFrame(FrameBuffer out) { |
|
|
|
public void postFrame(FrameBuffer out) { |
|
|
|
if (!attachAsMain && out != fb) { |
|
|
|
if (!attachAsMain && out != fb) { |
|
|
|
throw new IllegalStateException("Why did you change the output framebuffer?"); |
|
|
|
throw new IllegalStateException("Why did you change the output framebuffer?"); |
|
|
@ -331,9 +326,11 @@ public class AwtPanel extends Canvas implements SceneProcessor { |
|
|
|
// onFrameEnd();
|
|
|
|
// onFrameEnd();
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void reshape(ViewPort vp, int w, int h) { |
|
|
|
public void reshape(ViewPort vp, int w, int h) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void cleanup() { |
|
|
|
public void cleanup() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|