diff options
Diffstat (limited to 'src/net/java/games/jogl')
-rw-r--r-- | src/net/java/games/jogl/GLJPanel.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/net/java/games/jogl/GLJPanel.java b/src/net/java/games/jogl/GLJPanel.java index c24741c1a..59b2ee86d 100644 --- a/src/net/java/games/jogl/GLJPanel.java +++ b/src/net/java/games/jogl/GLJPanel.java @@ -258,6 +258,7 @@ public final class GLJPanel extends JPanel implements GLDrawable { if (toplevel != null) { toplevel.dispose(); } + pbuffer = null; isInitialized = false; pbufferWidth = getNextPowerOf2(fwidth); pbufferHeight = getNextPowerOf2(fheight); @@ -697,6 +698,12 @@ public final class GLJPanel extends JPanel implements GLDrawable { private PaintImmediatelyAction paintImmediatelyAction = new PaintImmediatelyAction(); private int getNextPowerOf2(int number) { + // Workaround for problems where 0 width or height are transiently + // seen during layout + if (number == 0) { + return 2; + } + if (((number-1) & number) == 0) { //ex: 8 -> 0b1000; 8-1=7 -> 0b0111; 0b1000&0b0111 == 0 return number; |