JOGL problems with OSX 10.8.2 and HD3000

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

JOGL problems with OSX 10.8.2 and HD3000

Alex
Hello, I have problems using OpenGL with my 2011 Macbook Pro 13".

My system has the following configuration:
Mac OSX 10.8.2 Mountain Lion
Sandy Bridge @ 2,3Ghz with HD3000 graphic

I've tryed different releases of JOGL and Gluegen, downloading the automatic builds here: http://jogamp.org/deployment/autobuilds/master/

I run the attached code using Eclipse with the jogl-all.jar and gluegen-rt.jar both imported and the result (see "Crecked" image) is that spheres appear "cracked". This seems connected with the light, becouse drawing flat-color spheres without light gives no problems.

I've tryed installing Eclipse on my Windows 7 BootCamp partition and the result this time is perfect (see "Correct" image).

I can't find a solution.

Attached images:
http://imageshack.us/photo/my-images/809/crackedg.jpg/
http://imageshack.us/photo/my-images/560/correct.jpg/

CODE:
package Esercitazione02;

import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.glu.GLU;
import javax.media.opengl.glu.GLUquadric;
import javax.swing.JFrame;

import com.jogamp.opengl.util.FPSAnimator;

public class Esercizio01 extends JFrame implements java.awt.event.KeyListener {

        public static void main(String[] args) {
       
                Esercizio01 ex=new Esercizio01();
                ex.setDefaultCloseOperation(EXIT_ON_CLOSE);
                ex.setSize(400,400);
               
                GLCanvas canvas=new GLCanvas();
                canvas.addGLEventListener(new Graphics());
                ex.getContentPane().add(canvas);
               
                FPSAnimator animator=new FPSAnimator(canvas,30);
                animator.start();
                ex.setVisible(true);
               
                ex.addKeyListener(ex);
                canvas.addKeyListener(ex);
        }
       
        private static float z1=0, z2=0;
       
        @Override
        public void keyPressed(java.awt.event.KeyEvent event) {
                if(event.getKeyCode()==java.awt.event.KeyEvent.VK_A){
                        z1+=0.1f;
                }
                if(event.getKeyCode()==java.awt.event.KeyEvent.VK_Q){
                        z1-=0.1f;
                }
                if(event.getKeyCode()==java.awt.event.KeyEvent.VK_W){
                        z2+=0.1f;
                }
                if(event.getKeyCode()==java.awt.event.KeyEvent.VK_S){
                        z2-=0.1f;
                }
        }
       
        @Override
        public void keyReleased(java.awt.event.KeyEvent arg0){
               
        }
       
        @Override
        public void keyTyped(java.awt.event.KeyEvent arg0){
               
        }
       
        public static class Graphics implements GLEventListener{

                public void display(GLAutoDrawable arg0) {
                               
                        GL2 gl=(GL2)arg0.getGL();
                       
                        gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
                       
                        gl.glMatrixMode(GL2.GL_PROJECTION);
                        gl.glLoadIdentity();
                        gl.glMatrixMode(GL2.GL_MODELVIEW);
                        gl.glEnable(GL2.GL_NORMALIZE);
                       
                        GLU glu = new GLU();
                       
                        GLUquadric quadric = glu.gluNewQuadric();
                       
                        gl.glEnable(GL2.GL_DEPTH_TEST);
                       
                        gl.glLoadIdentity();
                        gl.glTranslatef(0.5f,0,z2);
                       
                        gl.glColor3f(0,1,0);
                       
                        glu.gluSphere(quadric, 0.5f, 100, 50);

                        gl.glLoadIdentity();
                        gl.glTranslatef(0.0f,0,z1);
                        gl.glColor3f(1,0,0);
                        glu.gluSphere(quadric, 0.5f, 12, 6);
                }
               
                @Override
                public void dispose(GLAutoDrawable arg0) {
                        // TODO Auto-generated method stub
                }
               
                public void displayChanged(GLAutoDrawable arg0, boolean arg1, boolean arg2) {
                        // TODO Auto-generated method stub
                       
                }
               
                public void init(GLAutoDrawable arg0) {
                       
                        GL2 gl=(GL2)arg0.getGL();

                        gl.glEnable(GL2.GL_LIGHTING);
                       
                        gl.glEnable(GL2.GL_LIGHT0);
                        float[] position={1.0f, 1.0f, -1.0f, 1};
                        float[] intensity={1.0f, 1.0f, 1.0f, 1.0f};
                        gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, position, 0);
                        gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_DIFFUSE, intensity, 0);
                       
                        gl.glEnable(GL2.GL_COLOR_MATERIAL);
                        gl.glColorMaterial(GL.GL_FRONT_AND_BACK, GL2.GL_AMBIENT_AND_DIFFUSE);
                                               
                }
               
                public void reshape(GLAutoDrawable arg0, int x, int y, int w, int h) {

                       
                }
               
        }
       
}
Reply | Threaded
Open this post in threaded view
|

Re: JOGL problems with OSX 10.8.2 and HD3000

Sven Gothel
Administrator
On 10/16/2012 09:20 PM, Alex [via jogamp] wrote:
> Hello, I have problems using OpenGL with my 2011 Macbook Pro 13".
>

Well, one orthogonal way (disregarding platform) to test your application
is to enable the DebugGL pipeline (-Djogl.debug.DebugGL) which will
throw a detailed exception in case your app triggers a GL error.

Another one is to see the GL trace via -Djogl.debug.TraceGL.

It is possible that some driver may be generous
and others are not - or some even simply have bugs.

You mention HD3000, I have tested a few apps on Sandy Bridge
and latest Mesa trunk is pretty stable on GNU/Linux.

Usually JOGL errors on a platform manifest in crashes
or no visibility at all, it's quite rare that GL artifacts
are being produce - i.e. not seen yet.

~Sven

> My system has the following configuration:
> Mac OSX 10.8.2 Mountain Lion
> Sandy Bridge @ 2,3Ghz with HD3000 graphic
>


signature.asc (907 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: JOGL problems with OSX 10.8.2 and HD3000

Alex
In reply to this post by Alex
Found a solution. It seems a problem related to the default value of Shininess on MAC OSX, in fact defining the Shininess property makes the problem disappear, while set Shininess to 0 under Windows creates a similar artefact.