Adding two Canvas3d's to a View doesn't work

Hi

I wan’t to have two or more Canvases attached to a View, but always, when I execute it an error occures:


        RenderPeer rp = new RenderPeerImpl();
        CanvasPeer cp = rp.makeCanvas(null,440, 480, 32, false);
        Canvas3D canvas = new Canvas3D();
        canvas.set3DPeer(cp);
        view.addCanvas3D(canvas);
        
        //RenderPeer rp2 = new RenderPeerImpl();
        CanvasPeer cp2 = rp.makeCanvas(null,440, 480, 32, false);
        Canvas3D canvas2 = new Canvas3D();
        canvas2.set3DPeer(cp2);
        view.addCanvas3D(canvas2);
        
        view.getTransform().lookAt(
        new Vector3f(0,0,2.41f), //location of eye
        new Vector3f(0,0,0),     //center of view
        new Vector3f(0.0f,0.6f,0.0f));    //vector pointing up
        view.startView();
        while(true) {
            view.renderOnce();
        }

An unexpected error has been detected by HotSpot Virtual Machine:

EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000, pid=3632, tid=2204

Java VM: Java HotSpot™ Client VM (1.5.0-b64 mixed mode, sharing)

Problematic frame:

C 0x00000000

An error report file with more information is saved as hs_err_pid3632.log

If you would like to submit a bug report, please visit:

http://java.sun.com/webapps/bugreport/crash.jsp

Exception in thread “main” net.java.games.jogl.GLException: Attempt to call setRenderingThread on more than one drawable in this thread
at net.java.games.jogl.impl.GLContext.setRenderingThread(GLContext.java:323)
at net.java.games.jogl.GLCanvas.setRenderingThread(GLCanvas.java:140)
at com.xith3d.render.jogl.CanvasPeerImpl.render(CanvasPeerImpl.java:1148)
at com.xith3d.scenegraph.View.renderOnce(View.java:605)
at com.xith3d.scenegraph.View.renderOnce(View.java:538)


am I doing something wrong??

thanks

Arne

I have had a similar problem when trying to add multiple ViewS to a VirtualUniverse. The virtual machine crashes on my nvidia-based systems, but not with my ATI-based ssystems. It seems like this is a JOGL issue. Hopefully it will get fixed at some point. Has anyone else had similar problems?

Hi,

I was able to run several canvases on different screens and with two different rendering threads. This seems to be a reason - something is happening with makeCurrent() calls.

Do you have a test case? -> IssueZilla

Yuri

i’ve been mulling over this issue for a while now. In my case, only one canvas renders correctly and the other is distorted.
Please can you release your source for displaying multiple canvases?
Thanks

Hi

when I’ve got two different Views, both canvases display fine for me.

Just change the second time I use view to view2 and add it to your virtualUniverse.

Ohh… and you only need to call view.renderOnce() only for view, not for view2. Strange isn’t it ?

I use ATI

hello arne … thanks for the tips, I tried it out but only one view renders and the other doesn’t and sometimes, the other renders and the first doesn’t. Have you run into this? This is the code



               RenderPeer rp = new RenderPeerImpl(); 
               CanvasPeer cp = rp.makeCanvas(null,440, 480, 32, false); 
               Canvas3D canvas = new Canvas3D(); 
               canvas.set3DPeer(cp); 
               view.addCanvas3D(canvas); 
                
               //RenderPeer rp2 = new RenderPeerImpl(); 
               CanvasPeer cp2 = rp.makeCanvas(null,640, 480, 32, false); 
               Canvas3D canvas2 = new Canvas3D(); 
               canvas2.set3DPeer(cp2); 
               view2.addCanvas3D(canvas2); 
                
               view.getTransform().lookAt(      new Vector3f(0, 20, 1.0f), //Loc Camera
                              new Vector3f(0, 0, 0), //COV
                              new Vector3f(0, 1, 0)); //Up Vector
               view2.getTransform().lookAt(      new Vector3f(0, 50, 1.0f), //Loc Camera
                              new Vector3f(0, 0, 0), //COV
                              new Vector3f(0, 1, 0)); //Up Vector
               
               
               view.startView(); 
               view2.startView();
               
                              
               while(true) { 
              view.renderOnce(); 
              
               }
                

Edit:
If I ask it to render both views, I sometimes get the distortion I was speaking of earlier…
Edit #2:
It renders both views correctly sometimes :-/

Hi LaLiLuLeLo

It works fine at my computer. I had never any distortions.
Maybe it’s something like ewills was speaking of. What kind of system do you use?

Arne

I use Windows XP, ATI Radeon 9800 Pro

mmh… I too have XP, but ATI Radeon 9000 Series.

So there’s still the case with different graphic-cards, but i think it should be minimal.

At the moment I really have no idea :-/

Hopefully somebody else has an idea

Arne

Edit: Maybe you should update xith (it could be a bug that is fixed by now)

I am trying to have multiple Canvas…but getting this exception


Exception in thread "AWT-EventQueue-0" net.java.games.jogl.GLException: Unable to enumerate pixel formats of window using wglGetPixelFormatAttribivARB: error code -1073283059 at net.java.games.jogl.impl.windows.WindowsGLContext.choosePixelFormatAndCreateContext(WindowsGLContext.java:464) at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.create(WindowsOnscreenGLContext.java:230) at net.java.games.jogl.impl.windows.WindowsGLContext.makeCurrent(WindowsGLContext.java:136) at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.makeCurrent(WindowsOnscreenGLContext.java:129) at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:246) at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.invokeGL(WindowsOnscreenGLContext.java:76) at net.java.games.jogl.GLCanvas$2.run(GLCanvas.java:130) at java.awt.event.InvocationEvent.dispatch(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) Error Making WGLC Current: 0 Error Making WGLC Current: -1073278755 Error Making WGLC Current: -1073278755 Exception in thread "main" net.java.games.jogl.GLException: java.lang.reflect.InvocationTargetException at net.java.games.jogl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:233) at net.java.games.jogl.GLCanvas.display(GLCanvas.java:77) at com.xith3d.render.jogl.CanvasPeerImpl.render(CanvasPeerImpl.java:1256) at com.xith3d.scenegraph.View.renderOnce(View.java:604) at com.xith3d.scenegraph.View.renderOnce(View.java:537) at com.lorts.rebar.visualization.XithScreen.loop(XithScreen.java:183) at com.lorts.rebar.ui.frame.MainScreenFrame.main(MainScreenFrame.java:68) Caused by: java.lang.reflect.InvocationTargetException at java.awt.EventQueue.invokeAndWait(Unknown Source) at net.java.games.jogl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:228) ... 6 more Caused by: net.java.games.jogl.GLException: Unable to enumerate pixel formats of window using wglGetPixelFormatAttribivARB: error code -1073283059 at net.java.games.jogl.impl.windows.WindowsGLContext.choosePixelFormatAndCreateContext(WindowsGLContext.java:464) at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.create(WindowsOnscreenGLContext.java:230) at net.java.games.jogl.impl.windows.WindowsGLContext.makeCurrent(WindowsGLContext.java:136) at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.makeCurrent(WindowsOnscreenGLContext.java:129) at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:246) at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.invokeGL(WindowsOnscreenGLContext.java:76) at net.java.games.jogl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:266) at java.awt.event.InvocationEvent.dispatch(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) Error Making WGLC Current: -1073278755

my code is very similar to the Arne post …


                RenderPeer renderPeer = new RenderPeerImpl();	
		canvasPeer = renderPeer.makeCanvas(this,this.width, this.height, 16,false);
		canvas = new Canvas3D();		
		this.canvasPeer.getRenderOptions().setOption(Option.ERROR_CHECK, true);
		canvas.set3DPeer(canvasPeer);
		
		  RenderPeer rp2 = new RenderPeerImpl();
	       CanvasPeer cp2 = rp2.makeCanvas(null,440, 480, 16, false);
	       Canvas3D canvas2 = new Canvas3D();
	       canvas2.set3DPeer(cp2);
	       view2.addCanvas3D(canvas2);

my requirement is have one canvas in a Parent (Panel) and another one does not have a parent…

not able to figure out what exactly i am doing wrong.

Also if i need to have multiple canvas …do i have to render them in seperate threads…