Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  An unexpected exception has been detected in nativ  (Read 725 times)
0 Members and 1 Guest are viewing this topic.
Offline sss

JGO n00b
*

Posts: 12


Java games rock!


« on: 2003-09-18 11:49:56 »

The following pretty simple program blows up with an exception in the VM.  All the code does is draw a cube and if you click in the window it opens another window with another cube.

Any idea how to get around this problem?

import java.awt.*;
import java.awt.event.*;

import net.java.games.jogl.*;
import net.java.games.jogl.util.GLUT;

public class Cube {
     public static void main(String[] args) {
           Cube c = new Cube(0, 0);
     }
     
     public Cube(int x, int y) {      
           Frame frame = new Frame("Cube Demo");      
           GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities());
           canvas.addGLEventListener(new CubeRenderer());
           frame.add(canvas);
           frame.setSize(300, 300);
           frame.setLocation(new Point(x,y));

           frame.addWindowListener(new WindowAdapter() {
                 public void windowClosing(WindowEvent e) {
                   System.exit(0);
                 }
             });
           frame.show();
     }
     
static class CubeRenderer implements GLEventListener, MouseListener{
     int x=0, y=0;
     public void init(GLDrawable drawable) {
       GL gl = drawable.getGL();
       gl.glClearColor(0,0,0,0);
       
       drawable.addMouseListener(this);
     }
     
     public void reshape(GLDrawable drawable, int x, int y, int width, int height) {
           GLU glu = drawable.getGLU();
           GL gl = drawable.getGL();
           gl.glViewport(x, y, width, height);
           gl.glMatrixMode(GL.GL_PROJECTION);
           gl.glLoadIdentity();
           
           if(width>height)
                 gl.glOrtho(-(double)width/height, (double)width/height, -1, 1, -1, 1);
           else
                 gl.glOrtho(-1, 1, -(double)height/width, (double)height/width, -1, 1);

           gl.glMatrixMode(GL.GL_MODELVIEW);
     }

     public void display(GLDrawable drawable) {      
           GL gl = drawable.getGL();
           GLUT glut = new GLUT();
           gl.glClear(GL.GL_COLOR_BUFFER_BIT);
           gl.glColor3d(1, .25, .75);

           gl.glPushMatrix();
                 glut.glutSolidCube(gl, 1);
           gl.glPopMatrix();
     }
     
     public void displayChanged(GLDrawable drawable, boolean modeChanged, boolean deviceChanged) {}
     
     public void mouseEntered(MouseEvent e) {}
     public void mouseExited(MouseEvent e) {}
     public void mousePressed(MouseEvent e) { }  
     public void mouseReleased(MouseEvent e) {}
     public void mouseClicked(MouseEvent e) {new Cube(x+=100, y+=100);}
 }
}


An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION (0xc0000005) occurred at PC=0x69350594
Function=DrvSetContext+0xF0874
Library=C:\WINDOWS\System32\atioglxx.dll

Current Java thread:
     at net.java.games.jogl.impl.windows.WGL.wglCreateContext(Native Method)
     at net.java.games.jogl.impl.windows.WindowsGLContext.choosePixelFormatAndCreateContext(WindowsGLContext.java:296)
     at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.create(WindowsOnscreenGLContext.java:204)
     at net.java.games.jogl.impl.windows.WindowsGLContext.makeCurrent(WindowsGLContext.java:117)
     - locked <0x10058138> (a net.java.games.jogl.impl.windows.WindowsOnscreenGLContext)
     at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.makeCurrent(WindowsOnscreenGLContext.java:110)
     - locked <0x10058138> (a net.java.games.jogl.impl.windows.WindowsOnscreenGLContext)
     at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:162)
     - locked <0x10058138> (a net.java.games.jogl.impl.windows.WindowsOnscreenGLContext)
     at net.java.games.jogl.GLCanvas.reshape(GLCanvas.java:105)
     at java.awt.Component.setBounds(Unknown Source)
     at java.awt.BorderLayout.layoutContainer(Unknown Source)
     - locked <0x1050de98> (a java.awt.Component$AWTTreeLock)
     at java.awt.Container.layout(Unknown Source)
     at java.awt.Container.doLayout(Unknown Source)
     at java.awt.Container.validateTree(Unknown Source)
     at java.awt.Container.validate(Unknown Source)
     - locked <0x1050de98> (a java.awt.Component$AWTTreeLock)
     at java.awt.Window.show(Unknown Source)
     at JOGLstructuredArguments.Cube.<init>(Cube.java:28)
     at JOGLstructuredArguments.Cube$CubeRenderer.mouseClicked(Cube.java:73)
     at java.awt.Component.processMouseEvent(Unknown Source)
     at java.awt.Component.processEvent(Unknown Source)
     at java.awt.Component.dispatchEventImpl(Unknown Source)
     at java.awt.Component.dispatchEvent(Unknown Source)
     at java.awt.EventQueue.dispatchEvent(Unknown Source)
     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
     at java.awt.EventDispatchThread.run(Unknown Source)

Dynamic libraries:
0x00400000 - 0x00407000       C:\Program Files\Java\j2re1.4.2\bin\javaw.exe
0x77F50000 - 0x77FF7000       C:\WINDOWS\System32\ntdll.dll
0x77E60000 - 0x77F46000       C:\WINDOWS\system32\kernel32.dll
0x77DD0000 - 0x77E5D000       C:\WINDOWS\system32\ADVAPI32.dll
0x78000000 - 0x78086000       C:\WINDOWS\system32\RPCRT4.dll
0x77D40000 - 0x77DC6000       C:\WINDOWS\system32\USER32.dll
0x77C70000 - 0x77CB0000       C:\WINDOWS\system32\GDI32.dll
0x77C10000 - 0x77C63000       C:\WINDOWS\system32\MSVCRT.dll
0x629C0000 - 0x629C8000       C:\WINDOWS\System32\LPK.DLL
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.142 seconds with 21 queries.