www.jpct.net
jPCT - a 3d engine for Java => Support => Topic started by: madhava.s on February 14, 2013, 03:35:35 pm
-
Below is the exception i'm getting.
I'm spanning a separate thread for rendering as Below.
new Thread(){
@Override
public void run(){
while(true){
buffer.clear(java.awt.Color.WHITE);
world.renderScene(buffer);
world.draw(buffer);
buffer.update();
buffer.displayGLOnly();
canvas.repaint();
try {
sleep(100);
} catch (InterruptedException ex) {
//do nothing
}
}
}
}.start();
Getting the below exception
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: java.lang.ClassCastException: com.threed.jpct.Camera cannot be cast to com.threed.jpct.World
at com.threed.jpct.AWTJPCTCanvas.paintGL(AWTJPCTCanvas.java:233)
at org.lwjgl.opengl.AWTGLCanvas.paint(AWTGLCanvas.java:339)
at org.lwjgl.opengl.AWTGLCanvas.update(AWTGLCanvas.java:368)
at sun.awt.RepaintArea.updateComponent(RepaintArea.java:239)
at sun.awt.RepaintArea.paint(RepaintArea.java:216)
at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:310)
at java.awt.Component.dispatchEventImpl(Component.java:4727)
at java.awt.Component.dispatchEvent(Component.java:4481)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:643)
at java.awt.EventQueue.access$000(EventQueue.java:84)
at java.awt.EventQueue$1.run(EventQueue.java:602)
at java.awt.EventQueue$1.run(EventQueue.java:600)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:616)
at java.awt.EventQueue$2.run(EventQueue.java:614)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:613)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.ClassCastException: com.threed.jpct.Camera cannot be cast to com.threed.jpct.World
at com.threed.jpct.AWTGLRenderer.executeGL(AWTGLRenderer.java:125)
at com.threed.jpct.AWTJPCTCanvas.paintGL(AWTJPCTCanvas.java:190)
... 25 more
-
Manifest info
Manifest-Version: 1.0
Created-By: EgonOlsen
Version: 1.15beta3
-
Not sure why this happens and i can't look at it ATM, but have you tried to move creation of the frame buffer inside your own thread?
-
I can't reproduce this and looking at jPCT's code, this is actually one of these "this can't happen" errors...unless you have another thread that does funny things with jPCT related objects in parallel to your rendering thread. Do you?
-
unless you have another thread that does funny things with jPCT related objects in parallel to your rendering thread. Do you?
yes Egon, there's another thread that keeps polling mouse and keyboard transforming, removing adding objects based on action. And another thing is ,
I get the error when I decrease the sleep time when I give sleep time above 1000 it never happens
-
It's not consistently reproducible, when i try to reproduce It many times it ends in
ArrayOutOfBoundException in visList.
-
yes Egon, there's another thread that keeps polling mouse and keyboard transforming, removing adding objects based on action.
Don't do that! jPCT isn't thread safe: http://www.jpct.net/wiki/index.php/Multithreading#Thread_safety (http://www.jpct.net/wiki/index.php/Multithreading#Thread_safety)
-
Similar matter has already been discussed at yahoo answers. I can post the link if needed