Login  Register

Please help with Mountain Lion Problem

Posted by Gene on Oct 07, 2012; 9:00pm
URL: https://forum.jogamp.org/Please-help-with-Mountain-Lion-Problem-tp4026415.html

Hello! You have helped me with an urgent problem before.  This is another one. Really need to find a resolution for several 10,000's of Mac users.  Same JOGL 2 app.  

The switch to Mountain Lion (10.8.2) has broken it badly.  The beginning of the dump is below.

The problem goes away if I _remove_ a GLCapabilities setting  

      GLProfile glp = GLProfile.get(GLProfile.GL2);
      GLCapabilities caps = new GLCapabilities(glp);
      caps.setDepthBits(24);  // COMMENTING OUT THIS LINE STOPS THE CRASH
      GLCanvas canvas = new GLCanvas(caps);

But when I do this, depth buffering drops to some low resolution (looks like 8 bits), and the output is unacceptable.

I get this crash with even a small test app, which is at the bottom of the post.

While fiddling I also tried caps.setFBO(true).  No crash, but the screen remains blank.  Nothing is drawn.

This hardware previously worked fine with both JOGL 1.1 and 2.0.  Only change is Mountain Lion:

Model Name: MacBook Pro
  Model Identifier: MacBookPro5,1
  Processor Name: Intel Core 2 Duo
  Processor Speed: 2.8 GHz
  Number of Processors: 1
  Total Number of Cores: 2
  L2 Cache: 6 MB
  Memory: 4 GB
  Bus Speed: 1.07 GHz
  Boot ROM Version: MBP51.007E.B06
  SMC Version (system): 1.33f8
NVIDIA GeForce 9400M:

  Chipset Model: NVIDIA GeForce 9400M
  Type: GPU
  Bus: PCI
  VRAM (Total): 256 MB
  Vendor: NVIDIA (0x10de)
  Device ID: 0x0863
  Revision ID: 0x00b1
  ROM Revision: 3437
  gMux Version: 1.7.3

------------- Exception dump ----------------

Process:         java [12166]
Path:            /usr/bin/java
Identifier:      com.apple.javajdk16.cmd
Version:         1.0 (1.0)
Code Type:       X86-64 (Native)
Parent Process:  java [11514]
User ID:         501

PlugIn Path:       /var/folders/*/libjogl_desktop.jnilib
PlugIn Identifier: libjogl_desktop.jnilib
PlugIn Version:    ??? (0)

Date/Time:       2012-10-07 16:34:18.971 -0400
OS Version:      Mac OS X 10.8.2 (12C54)
Report Version:  10
Sleep/Wake UUID: C249365F-B1C0-48E7-8239-E8CEE4DC7445

Interval Since Last Report:          11379 sec
Crashes Since Last Report:           4
Per-App Interval Since Last Report:  427 sec
Per-App Crashes Since Last Report:   4
Anonymous UUID:                      9D722369-981A-CFA7-0438-0C6F62BE4D2D

Crashed Thread:  22  Java: AWT-EventQueue-0

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSViewAWT CGLPBufferObj]: unrecognized selector sent to instance 0x7fe71949f5c0'
terminate called throwing an exception
abort() called

Application Specific Backtrace 1:
0   CoreFoundation                      0x00007fff8511b0a6 __exceptionPreprocess + 198
1   libobjc.A.dylib                     0x00007fff894033f0 objc_exception_throw + 43
2   CoreFoundation                      0x00007fff851b16ea -[NSObject(NSObject) doesNotRecognizeSelector:] + 186
3   CoreFoundation                      0x00007fff851095ce ___forwarding___ + 414
4   CoreFoundation                      0x00007fff851093b8 _CF_forwarding_prep_0 + 232
5   AppKit                              0x00007fff8ddf85be -[NSOpenGLContext setPixelBuffer:cubeMapFace:mipMapLevel:currentVirtualScreen:] + 59
6   libjogl_desktop.jnilib              0x000000010d3348cb setContextPBuffer + 203
7   libjogl_desktop.jnilib              0x000000010d39828b Java_jogamp_opengl_macosx_cgl_CGL_setContextPBuffer__JJ + 43
8   ???                                 0x0000000101e84eee 0x0 + 4326969070
9   ???                                 0x0000000101e7985a 0x0 + 4326922330
10  ???                                 0x0000000101e79e03 0x0 + 4326923779
11  ???                                 0x0000000101e79929 0x0 + 4326922537


package wpbd;

import com.jogamp.opengl.util.FPSAnimator;
import java.awt.*;
import java.awt.event.*;
import javax.media.opengl.*;
import javax.media.opengl.awt.GLCanvas;
import javax.swing.*;

public class Test extends JFrame implements GLEventListener {
   private CardLayout cards;
   private static final String LABEL = "label";
   private static final String CANVAS = "canvas";
   private String selected = LABEL;

   public Test() {
      GLProfile glp = GLProfile.get(GLProfile.GL2);
      GLCapabilities caps = new GLCapabilities(glp);
      caps.setDepthBits(24);
      GLCanvas canvas = new GLCanvas(caps);
      canvas.setPreferredSize(new Dimension(640, 480));
      canvas.addGLEventListener(this);
      final FPSAnimator animator = new FPSAnimator(canvas, 60);
      addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
            new Thread() {
               public void run() {
                  animator.stop();
                  System.exit(0);
               }
            }.start();
         }
      });
      JButton button = new JButton("Switch Cards");
      add(button, BorderLayout.NORTH);
      final JPanel cardHolder = new JPanel();
      cards = new CardLayout();
      cardHolder.setLayout(cards);
      cardHolder.add(new JLabel("A label to cover the canvas"), LABEL);
      cardHolder.add(canvas, CANVAS);
      add(cardHolder, BorderLayout.CENTER);
      animator.start();
      animator.pause();
      button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (selected.equals(LABEL)) {
                    animator.resume();
                    cards.show(cardHolder, CANVAS);
                    selected = CANVAS;
                }
                else {
                    animator.pause();
                    cards.show(cardHolder, LABEL);
                    selected = LABEL;
                }
            }
        });
      pack();
      setTitle("OpenGL 2 Test");
      setVisible(true);
   }

   public static void main(String[] args) {
      new Test();
   }

   public void init(GLAutoDrawable drawable) {
     GL2 gl = drawable.getGL().getGL2();
     gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
   }

   float spin = 0;

   public void display(GLAutoDrawable drawable) {
     GL2 gl = drawable.getGL().getGL2();
     gl.glClear(GL2.GL_COLOR_BUFFER_BIT);
     gl.glPushMatrix();
     gl.glRotatef(spin, 0.0f, 0.0f, 1.0f);
     gl.glColor3f(1.0f, 1.0f, 1.0f);
     gl.glRectf(-25.0f, -25.0f, 25.0f, 25.0f);
     gl.glPopMatrix();
     gl.glFlush();
     spin += 1;
     while (spin > 360) spin -= 360;
   }

   public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {
     GL2 gl = drawable.getGL().getGL2();
     gl.glViewport(0, 0, w, h);
     gl.glMatrixMode(GL2.GL_PROJECTION);
     gl.glLoadIdentity();
     if (w <= h) gl.glOrtho(-50.0, 50.0,
         -50.0 * (float) h / (float) w,
         50.0 * (float) h / (float) w,
         -1.0, 1.0);
     else gl.glOrtho(-50.0 * (float) w / (float) h,
         50.0 * (float) w / (float) h, -50.0, 50.0,
         -1.0, 1.0);
     gl.glMatrixMode(GL2.GL_MODELVIEW);
     gl.glLoadIdentity();
   }

   public void dispose(GLAutoDrawable drawable) { }
}