I tried the code addition in each of my 4 canvases (canvasi) but I still have the same refresh problem...it still has a delay before I regain control of the window. Do you think it may have to to something with the GraphicsConfiguration? or is there something else that I could be doing wrong?
Mario -----Original Message----- From: George Hedges [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 19, 2002 9:36 AM To: [EMAIL PROTECTED] Subject: Re: [JAVA3D] extending Canvas3D Hi Mariusz, It may not be a problem with having multiple canvases. We had a similar issue with our canvas. This code seems to have fixed the problem. When you create your Canvas3D, over-ride your paint method like this: GraphicsConfiguration gc = getGraphicsConfig(); canvas3d = new Canvas3D(gc) { public void paint(Graphics g) { super.paint(g); Toolkit.getDefaultToolkit().sync(); } // paint() }; // Canvas3D Hopefully that will solve the problem for you. George ----- Original Message ----- From: "ZACZEK, MARIUSZ P. (JSC-DM) (NASA)" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, November 19, 2002 8:17 AM Subject: Re: [JAVA3D] extending Canvas3D > Sorry..I have to take it all back...I double checked my code and I must have > been thinking about something else or I was just too stupid to double check > correctly...you guess which it was :) > > Anyway, I noticed that the definite reason for the "refresh" issue is that > fact that I have multiple Canvas3D windows (I have 4). Does anyone have any > example code of using a VirtualUniverse (not SimpleUniverse) too do at least > 2 Canvas3D windows together? I think I'm doing it correctly but who > knows...I did notice that having just 2 windows caused a problem so having 4 > causes an even bigger problem....and so example code would be great help. > This is what I do for making my Canvas3d objects: > > ///////////////////////////////////////////////////////////////////// > > // 1 - Create Canvas3D object. > Canvas3D canvas3D = new Canvas3D > SimpleUniverse.getPreferredConfiguration()); > Canvas3D second_canvas3D = new > Canvas3D(SimpleUniverse.getPreferredConfiguration()); > Canvas3D third_canvas3D = new > Canvas3D(SimpleUniverse.getPreferredConfiguration()); > Canvas3D fourth_canvas3D = new Canvas3D > SimpleUniverse.getPreferredConfiguration()); > > canvas3D.setDoubleBufferEnable(true); > second_canvas3D.setDoubleBufferEnable(true); > third_canvas3D.setDoubleBufferEnable(true); > fourth_canvas3D.setDoubleBufferEnable(true); > > // 2 - Create a VirtualUniverse object. > VirtualUniverse universe = new VirtualUniverse(); > > // 3 - Create a Locale object, attaching it to the VirtualUniverse > object. > Locale locale = new Locale(universe); > > // 4 - Create a view branch graph. > // a - create a View object. > View view = new View(); > View view2 = new View(); > View view3 = new View(); > View view4 = new View(); > > // b - create a ViewPlatform object. > viewplatform = new ViewPlatform(); > viewplatform2 = new ViewPlatform(); > viewplatform3 = new ViewPlatform(); > viewplatform4 = new ViewPlatform(); > > // c - Create a PhysicalBody object. > PhysicalBody physicalbody = new PhysicalBody(); > PhysicalBody physicalbody2 = new PhysicalBody(); > PhysicalBody physicalbody3 = new PhysicalBody(); > PhysicalBody physicalbody4 = new PhysicalBody(); > > // d - create a PhysicalEnvironment object. > PhysicalEnvironment physicalenvironment = new PhysicalEnvironment(); > PhysicalEnvironment physicalenvironment2 = new PhysicalEnvironment(); > PhysicalEnvironment physicalenvironment3 = new PhysicalEnvironment(); > PhysicalEnvironment physicalenvironment4 = new PhysicalEnvironment(); > > > // 5 - Contruct content branch graph(s) > BranchGroup scene = new BranchGroup(); > > // Draw the stuff in the scene > scene = createSceneGraph(); > > // e - attach objects to View object. > view.attachViewPlatform(viewplatform); > view.setPhysicalBody(physicalbody); > view.setPhysicalEnvironment(physicalenvironment); > view.addCanvas3D(canvas3D); > > view2.attachViewPlatform(viewplatform2); > view2.setPhysicalBody(physicalbody2); > view2.setPhysicalEnvironment(physicalenvironment2); > view2.addCanvas3D(second_canvas3D); > > view3.attachViewPlatform(viewplatform3); > view3.setPhysicalBody(physicalbody3); > view3.setPhysicalEnvironment(physicalenvironment3); > view3.addCanvas3D(third_canvas3D); > > view4.attachViewPlatform(viewplatform4); > view4.setPhysicalBody(physicalbody4); > view4.setPhysicalEnvironment(physicalenvironment4); > view4.addCanvas3D(fourth_canvas3D); > > // Set the viewplatform to the scene > scene.addChild(viewplatform); > > // Set the view clip planes > view.setBackClipDistance( 3000.0 ); > view.setFrontClipDistance( 0.001 ); > view2.setBackClipDistance( 300000.0 ); > view2.setFrontClipDistance( 0.1 ); > view3.setBackClipDistance( 300000.0 ); > view3.setFrontClipDistance( 0.1 ); > view4.setBackClipDistance( 3000.0 ); > view4.setFrontClipDistance( 0.001 ); > > // 6 - Compile branch graph(s) > // doing in scene.. > > // 7 - Insert subgraphs into the Locale > locale.addBranchGraph(scene); > > > > // > // FINAL - add the canvases to the main panel so that the original > // canvas is in the biggest window, and the other three canvases > // are in 3 side windows. > this.setLayout(new BorderLayout()); > > JPanel mainpanel = new JPanel(new BorderLayout()); > JPanel viewpanel2 = new JPanel(new BorderLayout()); > > mainpanel.add("Center", canvas3D); > mainpanel.setBorder(BorderFactory.createEtchedBorder()); > > viewpanel2.setPreferredSize(new Dimension(300,400)); > viewpanel2.setLayout(new GridLayout(3,0)); > viewpanel2.add(second_canvas3D); > viewpanel2.add(third_canvas3D); > viewpanel2.add(fourth_canvas3D); > > this.add(mainpanel, BorderLayout.CENTER); > > this.add(viewpanel2,BorderLayout.EAST); > > > > > ///////////////////////////////////////////////////////////////////// > > > > > > > > > > > Mario > > > > > > -----Original Message----- > From: ZACZEK, MARIUSZ P. (JSC-DM) (NASA) > To: [EMAIL PROTECTED] > Sent: 11/17/2002 5:57 PM > Subject: [JAVA3D] extending Canvas3D > > I'm having trouble with extending a Canvas3d...I've attached the code > where > I > extend the Canvas3D...I removed all my preRender() postSwap(), etc code > and > I > get the same effect as with having just the code below. Basically what > happens is that my Canvas3D and SWING seems to have problems ONLY if I > extend the > Canvas3D as I do below....I've attached a picture to show you the > effect. > This > effect is noticable if I move the window off screen and bring it back. > The > SWING > portion does not redraw for a few seconds (typically 5-10) ... on > another > computer > I had a "paint smudge effect" instead of a simple white space as I show > in > this picture. > Basically the same thing happens but instead of being white space the > swing > side looks > like someone smudged it up...(hope that makes sense). > > One thing though, if I simply use a Canvas3D (i.e. canvas3D = new > Canvas3D(Simple....) > I have absolutely NO problems....NONE. Refreshes right away without any > issue. > Only if I try to extend the Canvas3D do I have problems. Also, the > Canvas > actually is > also unusable for the 5-10 seconds because when I move the window around > I > can't > move anything in the canvas around. > > Does anyone have any suggestions??? Am I missing something when I > declare > the SpecialCanvas > and extend the Canvas3D??? > > I'm trying to use this extended canvas so I can overwrite the preRender, > postSwap, etc > routines for doing Overlays....they work great if I don't move the > window > around > but If I move it then it gets screwed up...also, it does NOT get > affected if > I open > a window on top of my Java Program...you know, if I move Explorer or > Netscape over > on top of the window it still is ok...only has problems when I move the > window itself. > > Please give me all of your suggestions.... > > I'm using the latest Java3d api, but I believe I'm using the Java 2D > 1.3...did not upgrade > to the new one because I had problems. > > Thanks, > > Mario > > //////////////////////////////////////////////////////////////////////// > //// > //// > canvas3D = new > SpecialCanvas3D(SimpleUniverse.getPreferredConfiguration()); > > //////////////////////////////////////////////////////////////////////// > //// > //// > private class SpecialCanvas3D extends Canvas3D { > > private J3DGraphics2D graphics2D; > > public SpecialCanvas3D(GraphicsConfiguration graphicsConfiguration) > { > super(graphicsConfiguration); > } > > public SpecialCanvas3D(GraphicsConfiguration graphicsConfiguration, > boolean offScreen) { > super(graphicsConfiguration, offScreen); > } > > } > //////////////////////////////////////////////////////////////////////// > //// > //// > > > Mario > > Mariusz Zaczek > NASA - Johnson Space Center > Automated Vehicles and Orbit Analysis / DM35 > Flight Design and Dynamics Division > Mission Operations Directorate > Bldg: 30A Room: 3048B > > Disclaimer: "The opinions, observations and comments expressed in my > email > are strictly my own and do not necessarily reflect > those > of NASA." > > <<test.jpg>> > > =========================================================================== > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body > of the message "signoff JAVA3D-INTEREST". For general help, send email to > [EMAIL PROTECTED] and include in the body of the message "help". =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help". =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".