Summary: | GLCanvas + GLJPanel Ignore Visibility (was OS X 10.8 + Java 7 + GLCanvas => Poor animation, lock ups, memory leak) | ||
---|---|---|---|
Product: | [JogAmp] Jogl | Reporter: | Gene <gene.ressler> |
Component: | macosx | Assignee: | Sven Gothel <sgothel> |
Status: | RESOLVED FIXED | ||
Severity: | critical | ||
Priority: | --- | ||
Version: | 2 | ||
Hardware: | pc_x86_64 | ||
OS: | macosx | ||
Type: | --- | SCM Refs: |
1cee0f1ac437de952c5cc15d5a23c8c5ddfdda8a
|
Workaround: | --- |
Description
Gene
2013-01-07 04:38:24 CET
More investigation: The animation uses a big FBO for a shadow map. Turning off shadows causes most of the jerkiness to stop. Frame rate goes back to normal. I cannot reproduce the memory leak. Cross that off the list. The failure of the setVisible() call remains the same. Note that I had an earlier problem with setVisible() on a GLCanvas with the early version of JOGL 2, but it was on Intel HD Graphics displays only. See bug 532: https://jogamp.org/bugzilla/show_bug.cgi?id=532 Here is a smaller example that just shows how setVisible() fails. There is no animation. If I do a remove(canvas) rather than serVisible(false), then the canvas disappears and can be restored with add(canvas, side). However I can't use this as a workaround, since it causes other problems in some Windows machines, and this is a cross-platform app. Thanks for any help you can provide. import java.awt.*; import java.awt.event.*; import javax.media.opengl.*; import javax.media.opengl.awt.GLCanvas; import javax.swing.*; public class JOGLTest extends JFrame implements GLEventListener { boolean there = true; public JOGLTest() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GLProfile glp = GLProfile.get(GLProfile.GL2); GLCapabilities caps = new GLCapabilities(glp); final GLCanvas canvas = new GLCanvas(caps); canvas.setPreferredSize(new Dimension(640, 480)); canvas.addGLEventListener(this); JButton button = new JButton("Make Invisible!"); add(button, BorderLayout.NORTH); add(canvas, BorderLayout.CENTER); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("Make canvas invisible!"); canvas.setVisible(false); } }); pack(); setTitle("setVisible(false) fails!"); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new JOGLTest().setVisible(true); } }); } public void init(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); } public void display(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); gl.glClear(GL2.GL_COLOR_BUFFER_BIT); gl.glPushMatrix(); gl.glColor3f(1.0f, 1.0f, 1.0f); gl.glRectf(-25.0f, -25.0f, 25.0f, 25.0f); gl.glPopMatrix(); } public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) { GL2 gl = drawable.getGL().getGL2(); gl.glViewport(0, 0, w, h); gl.glMatrixMode(GL2.GL_PROJECTION); gl.glLoadIdentity(); gl.glOrtho(-50.0, 50.0, -50.0 * (float) h / (float) w, 50.0 * (float) h / (float) w, -1.0, 1.0); gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glLoadIdentity(); } public void dispose(GLAutoDrawable drawable) { } } http://jogamp.org/git/?p=jogl.git;a=commit;h=1cee0f1ac437de952c5cc15d5a23c8c5ddfdda8a The visibility bug of GLCanvas and GLJPanel is fixed in general and I have tested on OSX Java6 and Java7 (latest) manually - all fine. Memory leak in general has been addressed in Bug 691 and should be fixed - since it had been closed today as well. |