We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
libjogl crash - help (Read 554 times)
libjogl crash - help
Oct 23rd, 2009, 10:25pm
 
With OSX I am getting crashes about 15 seconds after I run the applet i got running today.

I get this data for the crash:

Invalid memory access of location 00000000 eip=95394029



I tried it on three different macs, 2 running snow leopard and one running leopard. I ran the app also on an XP machine, and there it worked fine.

app is drawing a object in space which is controlled by and accelerometer.

the object draw uses both
javax.media.opengl
processing.opengl

the report for Apple says this about the thread which crashed



Thread 18 Crashed:
0   libGL.dylib                        0x95394029 glClearColor + 41
1   libjogl.jnilib                      0x238c3510 Java_com_sun_opengl_impl_GLImpl_glClearColor__FFFF + 38
2   ???                                0x03587d07 0 + 56130823
3   ???                                0x0357fcd9 0 + 56098009
4   ???                                0x0357f9d3 0 + 56097235
5   ???                                0x03667f30 0 + 57048880
6   ???                                0x036693a8 0 + 57054120
7   ???                                0x03648640 0 + 56919616
8   ???                                0x03641dfc 0 + 56892924
9   ???                                0x03649a10 0 + 56924688
10  ???                                0x035f1dc0 0 + 56565184
11  ???                                0x0357fcd9 0 + 56098009
12  ???                                0x0357d227 0 + 56087079
13  libclient.dylib                    0x004d228a 0x3b9000 + 1151626
14  libclient.dylib                    0x004d1fa6 0x3b9000 + 1150886
15  libclient.dylib                    0x0045c2dc 0x3b9000 + 668380
16  libclient.dylib                    0x005c6cba JNI_CreateJavaVM_Impl + 96746
17  librxtxSerial.jnilib                0x25d0a0e7 send_event + 113 (SerialImp.c:4851)
18  librxtxSerial.jnilib                0x25d0b182 report_serial_events + 83 (SerialImp.c:3956)
19  librxtxSerial.jnilib                0x25d0d5a3 Java_gnu_io_RXTXPort_eventLoop + 186 (SerialImp.c:4132)
20  ???                                0x03587d07 0 + 56130823
21  ???                                0x0357f9d3 0 + 56097235
22  ???                                0x0357d227 0 + 56087079
23  libclient.dylib                    0x004d228a 0x3b9000 + 1151626
24  libclient.dylib                    0x00416343 0x3b9000 + 381763
25  libclient.dylib                    0x00416235 0x3b9000 + 381493
26  libclient.dylib                    0x00416175 0x3b9000 + 381301
27  libclient.dylib                    0x00416098 0x3b9000 + 381080
28  libclient.dylib                    0x0067d935 JVM_RaiseSignal + 441077
29  libSystem.B.dylib                  0x90274204 _pthread_body + 27


below is the app's 3-d code


import javax.media.opengl.*;
import processing.opengl.*;
import processing.serial.*;

Serial myPort;        // The serial port

int count = 3;

boolean start = false;

float last[] = {
 0,0,0};
PGraphicsOpenGL pgl = null;

void setup () {
 // set the window size:
 size(800, 600,OPENGL);
 fill(0, 153);
 noStroke();    
 pgl = (PGraphicsOpenGL) g;
}
void draw () {
 float n, angle;
 float down[]={0,1,0};
 float axis[]={0,0,0};
 float gravity[] = {0,0,0};
 
 // shift to get readings centered about zero
 gravity[0] = last[2] - 1023*1.670/5;
 gravity[1] = last[1] - 1023*1.678/5;
 gravity[2] = last[0] - 1023*1.660/5;
 
 //normalize, we only care about direction
 n = sqrt(gravity[0]*gravity[0] + gravity[1]*gravity[1] + gravity[2]*gravity[2]);

 if(n<10) return;

 gravity[0] = gravity[0]/n;
 gravity[1] = gravity[1]/n;
 gravity[2] = gravity[2]/n;
 
 //print(gravity[0] + " " + gravity[1] + " " + gravity[2]);
 //println();
 
 //Cross product (a2b3 ‚àí a3b2, a3b1 ‚àí a1b3, a1b2 ‚àí a2b1).
 axis[0] = down[1]*gravity[2] - down[2]*gravity[1];
 axis[1] = down[2]*gravity[0] - down[0]*gravity[2];
 axis[2] = down[0]*gravity[1] - down[1]*gravity[0];
 
 angle = acos(-1*gravity[1])*180/PI;

 //print(axis[0] + " " + axis[1] + " " + axis[2] + ":" + angle);
 //println();
 
 pgl = (PGraphicsOpenGL) g;
 //print(pgl);
 if(pgl != null)
 {
     // g may change
   GL gl = pgl.beginGL();  // always use the GL object returned by beginGL
   //println(" " + gl);
   background(255);
 
   gl.glColor4f(0.7, 0.7, 0.7, 0.8);
   gl.glTranslatef(width/2, height/2, -400);
   gl.glRotatef(angle, axis[0], axis[1], axis[2]);
   gl.glRotatef(90, 1, 0, 0);
   gl.glRectf(-200, -200, 200, 200);
   pgl.endGL();
 }
}


Page Index Toggle Pages: 1