summaryrefslogtreecommitdiffstats
path: root/src/net/java/games
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2005-06-17 16:55:44 +0000
committerKenneth Russel <[email protected]>2005-06-17 16:55:44 +0000
commit25ca1fe0e24cdd14f090ff7df67bcdb8c052e842 (patch)
tree4f4d0a8678306d011cd70ef2c7cae9abf5135991 /src/net/java/games
parent0ccddf3f8e1bff9dca70955478307397937b8e9e (diff)
Fixed problem with temporary (or otherwise) resizes of GLJPanel to
width == 0 or height == 0 git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@301 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net/java/games')
-rw-r--r--src/net/java/games/jogl/GLJPanel.java7
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;