aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-01-11 07:35:05 +0100
committerSven Gothel <[email protected]>2014-01-11 07:35:05 +0100
commitcf75fbde9f7081bb253eff2bb8f36a39992352e1 (patch)
tree7c475c348141f99f73b917025a7eb31ea2f0319f /src
parent6ea03078e162eed89653ae123d172b6fca7c6d61 (diff)
Fix GLDrawableHelper.resizeOffscreenDrawable(..): Do nothing if !drawable.isRealized() - similar to it's recreateDrawable() and test only _after_ having the surface lock!
Only after the surface lock we are thread safe. In case drawable has been pulled, do nothing ..
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDrawableHelper.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
index c0bf43d2c..b498748fd 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
@@ -331,9 +331,6 @@ public class GLDrawableHelper {
public static final GLDrawableImpl resizeOffscreenDrawable(GLDrawableImpl drawable, GLContext context, int newWidth, int newHeight)
throws NativeWindowException, GLException
{
- if(drawable.getChosenGLCapabilities().isOnscreen()) {
- throw new NativeWindowException("Drawable is not offscreen: "+drawable);
- }
final NativeSurface ns = drawable.getNativeSurface();
final int lockRes = ns.lockSurface();
if ( NativeSurface.LOCK_SURFACE_NOT_READY >= lockRes ) {
@@ -341,7 +338,13 @@ public class GLDrawableHelper {
}
boolean validateSize = true;
try {
- if(DEBUG && ( 0>=newWidth || 0>=newHeight) ) {
+ if( ! drawable.isRealized() ) {
+ return drawable;
+ }
+ if( drawable.getChosenGLCapabilities().isOnscreen() ) {
+ throw new NativeWindowException("Drawable is not offscreen: "+drawable);
+ }
+ if( DEBUG && ( 0>=newWidth || 0>=newHeight) ) {
System.err.println("WARNING: Odd size detected: "+newWidth+"x"+newHeight+", using safe size 1x1. Drawable "+drawable);
Thread.dumpStack();
}