diff options
-rw-r--r-- | gl4java/awt/GLCanvas.java | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/gl4java/awt/GLCanvas.java b/gl4java/awt/GLCanvas.java index 0b89bf8..a7ade2a 100644 --- a/gl4java/awt/GLCanvas.java +++ b/gl4java/awt/GLCanvas.java @@ -449,11 +449,15 @@ public class GLCanvas extends Canvas context handling by calling {@link #setAWTThreadRenderingEnabled} and {@link #setAutoMakeContextCurrent} with the given boolean. */ - public void optimizeContextHandling(boolean yesOrNo) { + public void setOptimizeContextHandling(boolean yesOrNo) { setAWTThreadRenderingEnabled(yesOrNo); setAutoMakeContextCurrent(yesOrNo); } + public boolean getOptimizeContextHandling() { + return getAWTThreadRenderingEnabled() || getAutoMakeContextCurrent(); + } + /** * this function overrides the Canvas paint method ! * @@ -804,18 +808,7 @@ public class GLCanvas extends Canvas if( mustResize ) { - if (getAutoMakeContextCurrent() && getAWTThreadRenderingEnabled()) { - if( glj.gljMakeCurrent() == true ) - { - size = getSize(); - glj.gljResize( size.width, size.height ) ; - reshape(size.width, size.height); - mustResize = false; - invalidate(); - repaint(100); - glj.gljFree(); - } - } else if (getAutoMakeContextCurrent()) { + if (getAutoMakeContextCurrent()) { if( glj.gljMakeCurrent() == true ) { size = getSize(); @@ -826,17 +819,17 @@ public class GLCanvas extends Canvas repaint(100); glj.gljFree(); } - } else if (getAWTThreadRenderingEnabled()) { - size = getSize(); - glj.gljResize( size.width, size.height ) ; - reshape(size.width, size.height); - mustResize = false; - invalidate(); - repaint(100); } else { size = getSize(); glj.gljResize( size.width, size.height ) ; + if (getAWTThreadRenderingEnabled()) { + reshape(size.width, size.height); + } mustResize = false; + if (getAWTThreadRenderingEnabled()) { + invalidate(); + repaint(100); + } } } |