Fix items in Translucent bucket not be rendered in AWT panels

This commit is contained in:
shadowislord 2014-11-23 18:39:19 -05:00
parent 64b3be5334
commit 595183fb64
2 changed files with 20 additions and 12 deletions

View File

@ -288,19 +288,15 @@ public class AwtPanel extends Canvas implements SceneProcessor {
repaintRequest.set(true); repaintRequest.set(true);
} }
public void postFrame(FrameBuffer out) { void onFrameEnd() {
if (!attachAsMain && out != fb){ if (reshapeNeeded.getAndSet(false)) {
throw new IllegalStateException("Why did you change the output framebuffer?");
}
if (reshapeNeeded.getAndSet(false)){
reshapeInThread(newWidth, newHeight); reshapeInThread(newWidth, newHeight);
}else{ } else {
if (!checkVisibilityState()){ if (!checkVisibilityState()) {
return; return;
} }
switch (paintMode){ switch (paintMode) {
case Accelerated: case Accelerated:
drawFrameInThread(); drawFrameInThread();
break; break;
@ -308,7 +304,7 @@ public class AwtPanel extends Canvas implements SceneProcessor {
repaintInThread(); repaintInThread();
break; break;
case OnRequest: case OnRequest:
if (repaintRequest.getAndSet(false)){ if (repaintRequest.getAndSet(false)) {
repaintInThread(); repaintInThread();
} }
break; break;
@ -316,6 +312,14 @@ public class AwtPanel extends Canvas implements SceneProcessor {
} }
} }
public void postFrame(FrameBuffer out) {
if (!attachAsMain && out != fb){
throw new IllegalStateException("Why did you change the output framebuffer?");
}
// onFrameEnd();
}
public void reshape(ViewPort vp, int w, int h) { public void reshape(ViewPort vp, int w, int h) {
} }

View File

@ -178,7 +178,7 @@ public class AwtPanelsContext implements JmeContext {
} }
} }
if (needThrottle){ if (needThrottle) {
try { try {
Thread.sleep(100); Thread.sleep(100);
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
@ -186,6 +186,10 @@ public class AwtPanelsContext implements JmeContext {
} }
listener.update(); listener.update();
for (AwtPanel panel : panels){
panel.onFrameEnd();
}
} }
private void destroyInThread(){ private void destroyInThread(){