This bug report is a follow-up of the following thread: http://jogamp.762907.n3.nabble.com/GLJPanel-on-JInternalFrame-tp921862p976473.html A GLJPanel is partially painted in some cases. The properly painted area is always the left piece of it and its width appears to be a multiple of 2 pixels (1024, 512, 256, etc...). As far as I could investigate, I noticed that the smaller the GLJPanel's height, the narrower the correct area. Since I noticed the same behaviour on windows XP and on my debian box, I guess the bug is likely to be platform independent. I paste here an interesting piece of code gotten from the forum's thread, which reproduces the bug: public final class TestApp implements GLEventListener { public 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 attach three screenshots of the small app.
Created attachment 147 [details] Test case screenshots
After little investigation, I think that glReadPixels in GLJPanel.AbstractReadbackBackend.postGL() returns empty pixel information for the buggy area. But I can't understand why as everything seems fine in the glReadPixels call. On my machine, glReadPixels is called with those arguments: glFormat = GL2.GL_BGRA glType = GL_UNSIGNED_INT_8_8_8_8_REV It's only my 2 cents...
On my machine, nothing is painted, it is entirely white: import java.awt.Component; import java.awt.Frame; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.media.opengl.GL; import javax.media.opengl.GL2; import javax.media.opengl.GL2ES1; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; import javax.media.opengl.awt.GLJPanel; import javax.media.opengl.fixedfunc.GLLightingFunc; import javax.media.opengl.fixedfunc.GLMatrixFunc; import javax.media.opengl.glu.GLU; import com.jogamp.opengl.util.Animator; public class JOGLTetraHedron implements GLEventListener, KeyListener { float rotateT = 0.0f; static GLU glu = new GLU(); static GLJPanel/*GLCanvas*/canvas = new /*GLCanvas*/GLJPanel(); static Frame frame = new Frame("Jogl 3D Shape/Rotation"); static Animator animator = new Animator(canvas); public void display(GLAutoDrawable gLDrawable) { final GL2 gl = gLDrawable.getGL().getGL2(); gl.glClear(GL.GL_COLOR_BUFFER_BIT); gl.glClear(GL.GL_DEPTH_BUFFER_BIT); gl.glLoadIdentity(); gl.glTranslatef(0.0f, 0.0f, -5.0f); gl.glRotatef(rotateT, 1.0f, 0.0f, 0.0f); gl.glRotatef(rotateT, 0.0f, 1.0f, 0.0f); gl.glRotatef(rotateT, 0.0f, 0.0f, 1.0f); gl.glRotatef(rotateT, 0.0f, 1.0f, 0.0f); gl.glBegin(GL.GL_TRIANGLES); // Front gl.glColor3f(0.0f, 1.0f, 1.0f); gl.glVertex3f(0.0f, 1.0f, 0.0f); gl.glColor3f(0.0f, 0.0f, 1.0f); gl.glVertex3f(-1.0f, -1.0f, 1.0f); gl.glColor3f(0.0f, 0.0f, 0.0f); gl.glVertex3f(1.0f, -1.0f, 1.0f); // Right Side Facing Front gl.glColor3f(0.0f, 1.0f, 1.0f); gl.glVertex3f(0.0f, 1.0f, 0.0f); gl.glColor3f(0.0f, 0.0f, 1.0f); gl.glVertex3f(1.0f, -1.0f, 1.0f); gl.glColor3f(0.0f, 0.0f, 0.0f); gl.glVertex3f(0.0f, -1.0f, -1.0f); // Left Side Facing Front gl.glColor3f(0.0f, 1.0f, 1.0f); gl.glVertex3f(0.0f, 1.0f, 0.0f); gl.glColor3f(0.0f, 0.0f, 1.0f); gl.glVertex3f(0.0f, -1.0f, -1.0f); gl.glColor3f(0.0f, 0.0f, 0.0f); gl.glVertex3f(-1.0f, -1.0f, 1.0f); // Bottom gl.glColor3f(0.0f, 0.0f, 0.0f); gl.glVertex3f(-1.0f, -1.0f, 1.0f); gl.glColor3f(0.1f, 0.1f, 0.1f); gl.glVertex3f(1.0f, -1.0f, 1.0f); gl.glColor3f(0.2f, 0.2f, 0.2f); gl.glVertex3f(0.0f, -1.0f, -1.0f); gl.glEnd(); rotateT += 0.2f; } public void displayChanged(GLAutoDrawable gLDrawable, boolean modeChanged, boolean deviceChanged) { } public void init(GLAutoDrawable gLDrawable) { GL2 gl = gLDrawable.getGL().getGL2(); gl.glShadeModel(GLLightingFunc.GL_SMOOTH); gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); gl.glClearDepth(1.0f); gl.glEnable(GL.GL_DEPTH_TEST); gl.glDepthFunc(GL.GL_LEQUAL); gl.glHint(GL2ES1.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); ((Component) gLDrawable).addKeyListener(this); } public void reshape(GLAutoDrawable gLDrawable, int x, int y, int width, int height) { GL2 gl = gLDrawable.getGL().getGL2(); if (height <= 0) { height = 1; } float h = (float) width / (float) height; gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); glu.gluPerspective(50.0f, h, 1.0, 1000.0); gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glLoadIdentity(); } public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { exit(); } } public void keyReleased(KeyEvent e) { } public void keyTyped(KeyEvent e) { } public static void exit() { animator.stop(); frame.dispose(); System.exit(0); } public static void main(String[] args) { canvas.addGLEventListener(new JOGLTetraHedron()); frame.add(canvas); frame.setSize(640, 480); frame.setUndecorated(true); frame.setExtendedState(Frame.MAXIMIZED_BOTH); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { exit(); } }); frame.setVisible(true); animator.start(); canvas.requestFocus(); } @Override public void dispose(GLAutoDrawable gLDrawable) { // do nothing } }
This bug appears to be a duplicate of bug 450 (https://jogamp.org/bugzilla/show_bug.cgi?id=450). The giveaway is the fact that all pixels with x > height are black. I did a bug fix and unit test for this one, and submitted a pull request to Sven on 12/30/2010. *** This bug has been marked as a duplicate of bug 450 ***