Re: Poor performances on Linux Ubuntu unless desktop effects are disabled
Posted by riccaricca68 on Jul 28, 2014; 9:14pm
URL: https://forum.jogamp.org/Poor-performances-on-Linux-Ubuntu-unless-desktop-effects-are-disabled-tp4032647p4032667.html
Hi Julien,
I've tested the suggested JOGL example and it behaves exactly like the Java3D applications:
Ubuntu 3D session, VSYNC ON ==> BAD behavior, flickering, vibrating borders.
Ubuntu 3D session, VSYNC OFF ==> Quite good, it is not perfectly smooth probably because the frame rate is not constant while the rotation angle increments are fixed.
LXDE session, VSYNC ON ==> GOOD, very smooth!
Also my application is very smooth under LXDE sessions with VSYNC ON. I installed the LXDE package when I read that you had not problems under Lubuntu.
At the beginning I had discarded the JOGL sample because it shows only one polygon that moves in a "strange" way (it rotates around three axes) and it seems difficult to assess.
So, I decided to transform the display() function in order to show a colored cube rotating around the Y axis. This way it was very easy to recognize the complained defect.
The modified function is reported below.
@Override
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);
GLU glu = GLU.createGLU(gl);
glu.gluLookAt(0.0f, 3.0f, -5.0f, // look from camera XYZ
0, 0, 0, // look at
0, 1, 0); // direction
// rotate about the three axes
//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);
// Draw A Quad
gl.glBegin(GL2.GL_QUADS);
gl.glColor3f(0.0f, 1.0f, 1.0f); // set the color of the quad
gl.glVertex3f(-1.0f, 1.0f, -1.0f); // Top Left
gl.glVertex3f( 1.0f, 1.0f, -1.0f); // Top Right
gl.glVertex3f( 1.0f,-1.0f, -1.0f); // Bottom Right
gl.glVertex3f(-1.0f,-1.0f, -1.0f); // Bottom Left
// Done Drawing The Quad
gl.glEnd();
// Draw A Quad
gl.glBegin(GL2.GL_QUADS);
gl.glColor3f(1.0f, 1.0f, 0.0f);
gl.glVertex3f(-1.0f,-1.0f, -1.0f);
gl.glVertex3f( 1.0f,-1.0f, -1.0f);
gl.glVertex3f( 1.0f,-1.0f, 1.0f);
gl.glVertex3f(-1.0f,-1.0f, 1.0f);
// Done Drawing The Quad
gl.glEnd();
// Draw A Quad
gl.glBegin(GL2.GL_QUADS);
gl.glColor3f(1.0f, 0.0f, 1.0f);
gl.glVertex3f(-1.0f, 1.0f, 1.0f);
gl.glVertex3f( 1.0f, 1.0f, 1.0f);
gl.glVertex3f( 1.0f,-1.0f, 1.0f);
gl.glVertex3f(-1.0f,-1.0f, 1.0f);
// Done Drawing The Quad
gl.glEnd();
// Draw A Quad
gl.glBegin(GL2.GL_QUADS);
gl.glColor3f(1.0f, 0.0f, 0.0f);
gl.glVertex3f(-1.0f, 1.0f, -1.0f);
gl.glVertex3f( 1.0f, 1.0f, -1.0f);
gl.glVertex3f( 1.0f, 1.0f, 1.0f);
gl.glVertex3f(-1.0f, 1.0f, 1.0f);
// Done Drawing The Quad
gl.glEnd();
// Draw A Quad
gl.glBegin(GL2.GL_QUADS);
gl.glColor3f(0.0f, 1.0f, 0.0f);
gl.glVertex3f(-1.0f, 1.0f, 1.0f);
gl.glVertex3f(-1.0f, -1.0f, 1.0f);
gl.glVertex3f(-1.0f, -1.0f, -1.0f);
gl.glVertex3f(-1.0f, 1.0f, -1.0f);
// Done Drawing The Quad
gl.glEnd();
// Draw A Quad
gl.glBegin(GL2.GL_QUADS);
gl.glColor3f(0.0f, 0.0f, 1.0f);
gl.glVertex3f(1.0f, 1.0f, 1.0f);
gl.glVertex3f(1.0f, -1.0f, 1.0f);
gl.glVertex3f(1.0f, -1.0f, -1.0f);
gl.glVertex3f(1.0f, 1.0f, -1.0f);
// Done Drawing The Quad
gl.glEnd();
// increasing rotation for the next iteration
rotateT += 1.3f; // divide by 20 when VSYNC is OFF;
}
It would be interesting to know how many people have the same problem, or have not, with similar or different hardware.
Regards,
Riccardo.