Reply – Re: GLJPanel on JInternalFrame
Your Name
Subject
Message
or Cancel
In Reply To
Re: GLJPanel on JInternalFrame
— by Sven Gothel Sven Gothel
On Friday, June 25, 2010 02:32:52 pm JensZ [via jogamp] wrote:

>
> Hi,
>
> i trying to use the GLJPanel on JInternalFrame which is placed on a
> JDesktopPane. Everthing works fine so far.
> But resizing the JInternalFrame causes some problems. To be more precise: If
> JInternalFrame is relatively small everything works fine and GLJPanel is
> resized correctly. But reaching some critical dimension, the GLJPanel is no
> longer resized in the right way. It seems to me that a part of the GLJPanel
> is not repainted any more. I have checked the dimension given to the
> reshape-method of the GLEventListener and they seem to be correct. Is it a
> bug in GLJPanel or am I doing something wrong?
> Can anyone help me please?

Maybe .. just maybe this is related to lightweight/heavyweight mixing
introduced with 6u14 ? (Just had this issue lately)

 /**
 * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6776743
 * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6788954
 * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6797587
 *
 * Bug 6788954:
 * If an existing application embedds a heavyweight component in a frame,
 * and at the same time installs a custom glass pane,
 * the heavyweight component will disappear.
 * This regression is not very serious since we never supported mixing of hw and lw components
 * in general. The developer will have two options to resolve the problem:
 * 1. By modifying the software to tag the glass pane properly, or
 * 2. To suggest users to use the sun.awt.disableMixing system property
 * to disable the hw/lw mixing code at all.
 */

What worked for us was using: -Dsun.awt.disableMixing=true

~Sven

>
> Here are some snippets of my code:
>
>
> public class openGLModeFrame extends JInternalFrame {
>                   private openGLModePanel = new openGLModePanel();
>
>                   public openGLModeFrame() {
>                            this.add(plot);
>                            this.setLayout(new BorderLayout());
>                   }
> }
>
>
> public class openGLModePanel extends GLJPanel {
>          
>                   private openGLMode plotter = new openGLMode();
>
>                   public openGLModePanel() {
>                           this.addGLEventListener(this.plotter);
>                   }
>
> }
>
>
> public class openGLMode implements GLEventListener {
>
>             @Override
> public synchronized void display(GLAutoDrawable drawable) {
> GL2 gl = drawable.getGL().getGL2();
> gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
>
>                         //do some GL drawings
>
>                         gl.glFlush();
>            }
>
>             @Override
>   public void init(GLAutoDrawable drawable) {
> GL2 gl = drawable.getGL().getGL2();
>
> gl.setSwapInterval(1);
>
>
> gl.glClearColor(0f, 0f, 0f, 0f);
>
>
> gl.glShadeModel(GL2.GL_SMOOTH);
>
>
> gl.glEnable(GL2.GL_NORMALIZE);
>
>
> gl.glLineWidth(2f);
> gl.glPointSize(2f);
>
>
> gl.glPolygonMode(GL.GL_FRONT, GL2GL3.GL_LINES);
> gl.glPolygonMode(GL.GL_BACK, GL2GL3.GL_LINES);
>
>
> gl.glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
> gl.glEnableClientState(GLPointerFunc.GL_NORMAL_ARRAY);
> gl.glEnableClientState(GLPointerFunc.GL_COLOR_ARRAY);
>
>
> gl.glEnable(GL.GL_DEPTH_TEST);
>
>
> gl.glEnable(GL2.GL_BLEND);
> gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE_MINUS_SRC_ALPHA);
>
>
> gl.glEnable(GL2.GL_LINE_SMOOTH);
> gl.glHint(GL2.GL_LINE_SMOOTH_HINT, GL2.GL_DONT_CARE);
> gl.glEnable(GL2.GL_POLYGON_SMOOTH);
> gl.glHint(GL2.GL_POLYGON_SMOOTH_HINT, GL2.GL_DONT_CARE);
>
>
> }
>
>             @Override
> public void reshape(GLAutoDrawable drawable, int xstart, int ystart, int
> width,
> int height) {
> GL2 gl = drawable.getGL().getGL2();
>
>
> gl.glViewport(0, 0, width-1, height-1);
> gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
> gl.glLoadIdentity();
> gl.glOrthof(-2f, 2f, -2f, 2f, 2f, -2f); //looking from negative -2 (z) to
> positive 2 (z)
> gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
> gl.glLoadIdentity();
>
>
> this.createLights(gl);
>
>                    }  
> }
>
>
> ______________________________________
> View message @ http://jogamp.762907.n3.nabble.com/GLJPanel-on-JInternalFrame-tp921862p921862.html
> To start a new topic under jogamp, email [hidden email]
> To unsubscribe from jogamp, click http://jogamp.762907.n3.nabble.com/subscriptions/Unsubscribe.jtp?code=c2dvdGhlbEBqYXVzb2Z0LmNvbXw3NjI5MDd8MzkxNDI4MzU5
>