|
Hi,
I want to close my application with the X-Button of the NEWT-Window. But the button doesn't respond if my renderloop is running (windowDestroyNotify is never called). I'm pretty sure this worked on JOGL 2.0 Beta 10 but now I'm using JOGL 2.0 b300 and it doesn't work anymore.
System: Win7 x64; 32Bit JDK
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLProfile;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.event.WindowListener;
import com.jogamp.newt.event.WindowUpdateEvent;
import com.jogamp.newt.opengl.GLWindow;
public class NewtCloseBug implements GLEventListener, WindowListener
{
/**
* @param args
*/
public static void main(String[] args)
{
GLProfile.initSingleton(true);
new NewtCloseBug();
}
public GLCapabilities getGLCapabilities()
{
GLProfile glp = GLProfile.get("GL2GL3");
return new GLCapabilities(glp);
}
public NewtCloseBug()
{
GLWindow window = GLWindow.create(getGLCapabilities());
window.addGLEventListener(this);
window.addWindowListener(this);
window.setAutoSwapBufferMode(false);
window.setSize(800, 600);
window.setVisible(true);
while (true)
{
window.display();
}
}
@Override
public void display(GLAutoDrawable arg0)
{
}
@Override
public void dispose(GLAutoDrawable arg0)
{
}
@Override
public void init(GLAutoDrawable arg0)
{
}
@Override
public void reshape(GLAutoDrawable arg0, int arg1, int arg2, int arg3, int arg4)
{
}
@Override
public void windowDestroyNotify(WindowEvent arg0)
{
System.exit(0); // is never called :-(
}
@Override
public void windowDestroyed(WindowEvent arg0)
{
}
@Override
public void windowGainedFocus(WindowEvent arg0)
{
}
@Override
public void windowLostFocus(WindowEvent arg0)
{
}
@Override
public void windowMoved(WindowEvent arg0)
{
}
@Override
public void windowRepaint(WindowUpdateEvent arg0)
{
}
@Override
public void windowResized(WindowEvent arg0)
{
}
}
|