Login  Register

Re: NewtCanvasAWT resize bug

Posted by Job Zwiers on Jul 27, 2012; 8:23am
URL: https://forum.jogamp.org/NewtCanvasAWT-resize-bug-tp4025658p4025676.html

Sven Gothel wrote
On 07/26/2012 05:43 PM, Job Zwiers [via jogamp] wrote:

We sure handle a zero sized component (NEWT, NewtCanvasAWT)
as a non realized drawable - at creation time.
Good that you report this behavior, since I haven't validated
the resize to zero behavior with an already realized drawable.
Problem: On some platforms a zero drawable surface is invalid.
Ok, but the bug appears also when, after temporarlity resizing to zero, I later on resize back to normal.

Can you describe your test case a bit more in detail ?
I assume you setup an arbitrary NewtCanvasAWT as shown in your snippet
and _manually_ attempt to resize it to zero ?
Right. I did include a programmatically resize to zero, and that on it own seems to work fine. It goes wrong with a manual resize.
The testcase as a whole:

package firstopengl ;
import javax.media.opengl.*;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.newt.awt.NewtCanvasAWT;
import javax.swing.JFrame;

/** Will hang on termination after (vertically) manually resizing to zero */
public class SwingNEWTBug implements   GLEventListener {
   public SwingNEWTBug() {          
     GLWindow glWindow = GLWindow.create(new GLCapabilities(GLProfile.getDefault()));
     NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow);
     glWindow.addGLEventListener(this);
     JFrame jFrame = new JFrame("Resize BUG");
     jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     jFrame.add(newtCanvasAWT);
     jFrame.setSize(640, 480);
     jFrame.setVisible(true);
     jFrame.setSize(640, 0); // This is still ok and has no adverse effect.
     jFrame.setSize(640, 200);    
   }
   public void init(GLAutoDrawable drawable) { }  
   public void dispose(GLAutoDrawable drawable) { }
   public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { }
   public void display(GLAutoDrawable drawable) { }
   public static void main(String[] arg) {  new SwingNEWTBug();  }
}

Can you attach a log file w/ all debug flags enabled ?
See the attachment.
log.txt

Guess we are working on this together here.
~Sven
Sure, and keep up the good work.

Job