Re: GLJPanel on JInternalFrame
Posted by Cyrille on Jul 18, 2010; 10:17am
URL: https://forum.jogamp.org/GLJPanel-on-JInternalFrame-tp921862p976183.html
I just wanted to point out the fact that I reproduced this painting issue with a GLJPanel in a top level JFrame. This is the proof that the bug is not related to the use of JInternalFrame.
Here is a very simple application that reproduces the bug:
public final class TestApp implements GLEventListener
{
private TestApp()
{
}
public static void main(final String[] inArguments)
{
JFrame frame = new JFrame();
javax.media.opengl.awt.GLJPanel canvas = new javax.media.opengl.awt.GLJPanel();
canvas.addGLEventListener(new TestApp());
frame.add(canvas);
// Give frame the screen size as initial size.
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
frame.setSize(screenSize);
frame.setVisible(true);
}
@Override
public void display(GLAutoDrawable arg0)
{
GL2 gl = arg0.getGL().getGL2();
// Simply draw something: a green triangle on a red background.
gl.glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glColor3f(0.0f, 1.0f, 0.0f);
gl.glBegin(GL2.GL_LINES);
gl.glVertex2d(0.0, 0.0);
gl.glVertex2d(1.0, 0.0);
gl.glVertex2d(1.0, 1.0);
gl.glVertex2d(0.0, 0.0);
gl.glEnd();
gl.glFlush();
}
@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)
{
}
}
On my computer, here is what I witness on my 1680x1050 screen:
-at startup the GLJPanel is properly painted from its left bound til the 1024th pixel. At the right of this limit, the panel is black.
-when I reduce panel's height below 400 pixels, the properly painted portion's width lowers to 512 pixels. From that point, when I increase panel's height again, the portion's becomes 1024 pixel wide again when panel's height exceeds 512 pixels.
-if I keep on reducing panel's height, the painted portion's width reduces to 256, then 128, then 64 pixels, etc...
I hope this code sample will help. I would be happy to file a bug in Bugzilla or to perform other investigation if you feel like it could be useful.
Thanks again for your help.
Cyrille