Hi all
I moved my application from Linux to Windows for testing. So far all the functionality in the application Works without any issue. The only issue I've found is that whenever I click the X button on the window to close the application, eventhough the GLWindow closes, the Frame that contains it remains opened, empty (i.e White) and unresponsive. This is the code I'm using to handle the closing request: canvas.addWindowListener(new WindowAdapter() { @Override public void windowDestroyNotify(WindowEvent e) { System.exit(0); } }); Needless to say, this same application worked just fine under Linux. Closing the application was not an issue. thanks |
Administrator
|
Hi
Can you elaborate please? Do you use an AWT frame as a container? Do you use NewtCanvasAWT? Please provide a rudimentary test case to reproduce this bug. Is it reproducible under Windows 7 too?
Julien Gouesse | Personal blog | Website
|
Hi gouessej
Yes, I use an AWT Frame and I added an NewtCanvasAWT which contains the GLWindow. The code is the following: public abstract class GameWindow implements GLEventListener { protected static int windowHeight; protected static int windowWidth; public static int getWindowHeight() { return windowHeight; } public static int getWindowWidth() { return windowWidth; } protected GLWindow canvas; private KeyListener currentKeyListener; private MouseListener currentMouseListener; /** The recorded fps */ protected int fps; private Frame frame; protected GL gl; protected List<ByteBuffer> icons = new ArrayList<ByteBuffer>(); final int TARGET_FPS = 60; final long OPTIMAL_TIME = 1000 / TARGET_FPS; protected boolean running; protected String windowTitle; protected AnimatorBase animator; public GameWindow() { this.running = true; } public GameWindow(int windowWidth, int windowHeight, String windowTitle) { this(); windowWidth = windowWidth; windowHeight = windowHeight; this.windowTitle = windowTitle; createDisplay(); } public void createDisplay() { GLProfile glp = GLProfile.getGL2GL3(); GLCapabilities caps = new GLCapabilities(glp); canvas = GLWindow.create(caps); frame = new Frame(windowTitle); frame.setSize(windowWidth, windowHeight); frame.setResizable(false); // Get the screen size GraphicsConfiguration gc = frame.getGraphicsConfiguration(); Rectangle bounds = gc.getBounds(); canvas.addWindowListener(new WindowAdapter() { public void windowDestroyNotify(WindowEvent e) { System.exit(0); } }); canvas.addGLEventListener(this); canvas.setSize(windowWidth, windowHeight); final NewtCanvasAWT canvasAWT = new NewtCanvasAWT(canvas); canvasAWT.setSize(windowWidth, windowHeight); frame.add(canvasAWT); frame.setUndecorated(false); frame.pack(); Dimension size = frame.getPreferredSize(); frame.setLocation((int) ((bounds.width / 2) - (size.getWidth() / 2)), (int) ((bounds.height / 2) - (size.getHeight() / 2))); Image icon = Toolkit.getDefaultToolkit().getImage( ResourceLoader.loadResource("icons/icon32x32.png")); frame.setIconImage(icon); frame.setVisible(true); animator = new FPSAnimator(canvas, TARGET_FPS); animator.setUpdateFPSFrames(TARGET_FPS, null); animator.start(); } @Override public void display(GLAutoDrawable drawable) { this.gl = canvas.getGL(); this.gl.glClear(GL.GL_COLOR_BUFFER_BIT); onUpdate(); if(animator != null) this.frame.setTitle(windowTitle + " (FPS: " + animator.getTotalFPS()+ ")"); onRender(); } @Override public void dispose(GLAutoDrawable drawable) { onClose(); } @Override public void init(GLAutoDrawable drawable) { onInit(drawable); } public abstract void onClose(); public abstract void onInit(GLAutoDrawable drawable); public abstract void onRender(); public abstract void onStart(); public abstract void onUpdate(); public void replaceMouseListener(MouseListener mouseListener) { if(this.currentMouseListener != null) { this.canvas.removeMouseListener(this.currentMouseListener); } this.currentMouseListener = mouseListener; this.canvas.addMouseListener(this.currentMouseListener); } @Override public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) { } } That is what I use to create my OpenGL window. That class is used by another one that sets the window width and height and calls createDisplay(). Nothing fancy in my opinion. About Windows 7 I really dont know as I dont have access to a Windows 7 machine. Im just wondering if such an issue could be due to bad or outdated drivers? Thank you for your response. Regards |
Administrator
|
Please try to reproduce your problem with AWT GLCanvas in order to know whether it comes from NewtCanvasAWT, provide a full test case (with a main method) and add it to a bug report here. I don't think it might be caused by an outdated driver by update yours if necessary.
Julien Gouesse | Personal blog | Website
|
Thanks, Ill try to do that as soon as I get home.
Regards, |
Administrator
|
I'm still waiting for your feedback in order to know whether to write a new bug report.
Julien Gouesse | Personal blog | Website
|
Free forum by Nabble | Edit this page |