After implementing the callback functions in my Canvas3D I'm able to draw the geometry(Thanks Dave and Doug). When I call the draw many times with seperate geometry it is working fine, but when I pass a huge geometry object(~25M) it gives an OutOfMemory error. The same geometry if I break up in number of smaller geometries and call draw multiple times it works. Is there any specific reason for this. And, will I be able to use pick functionality with immediate rendering mode?
Thanks, nitin > -----Original Message----- > From: Yazel, David J. [mailto:[EMAIL PROTECTED]] > Sent: Thursday, May 16, 2002 10:32 PM > To: [EMAIL PROTECTED] > Subject: Re: [JAVA3D] using immediate mode of drawing > > > I stand corrected. > > -----Original Message----- > From: Doug Twilleager [mailto:[EMAIL PROTECTED]] > Sent: Thursday, May 16, 2002 1:00 PM > To: [EMAIL PROTECTED] > Subject: Re: [JAVA3D] using immediate mode of drawing > > > Actually, this is a valid way to do pure immediate mode rendering. > The problem is that the application does not wait for the paint() > event to happen. You can't draw to the on screen canvas until it > is on the screen. > > Doug Twilleager > Java 3D Team > Sun Microsystems > > > >Subject: Re: [JAVA3D] using immediate mode of drawing > >To: [EMAIL PROTECTED] > >MIME-version: 1.0 > >Delivered-to: [EMAIL PROTECTED] > > > >This code is not written according to the specification. > Accessing and > >modifying the graphics context needs to be done on a per > frame basis in the > >callback functions of a derived canvas3d. > > > >Dave > > > >-----Original Message----- > >From: Nitin.Jain [mailto:[EMAIL PROTECTED]] > >Sent: Thursday, May 16, 2002 9:58 AM > >To: [EMAIL PROTECTED] > >Subject: [JAVA3D] using immediate mode of drawing > > > > > > Hi , > >we are not able to use the immediate mode of rendering of > Canvas3D. We are > >doing every thing according to the specification in 1.3 API > documentation(I > >think). Is it necessary for us to create our own implementation of > canvas3d. > >I'm attaching the code we have written to do the same. > > > >Thanks in advance > >Nitin > > > > > >> import javax.media.j3d.*; > >> import java.applet.Applet; > >> import java.awt.BorderLayout; > >> import java.awt.event.*; > >> import java.awt.GraphicsConfiguration; > >> import com.sun.j3d.utils.applet.MainFrame; > >> import com.sun.j3d.utils.geometry.ColorCube; > >> import com.sun.j3d.utils.universe.*; > >> import com.sun.j3d.loaders.objectfile.*; > >> import com.sun.j3d.loaders.*; > >> > >> import javax.vecmath.*; > >> import java.awt.*; > >> > >> import com.sun.j3d.loaders.vrml97.VrmlLoader; > >> import com.sun.j3d.loaders.vrml97.VrmlScene; > >> > >> public class HelloUniverse extends Applet > >> { > >> > >> public HelloUnivers() > >> { > >> > >> } > >> > >> public void init() > >> { > >> createVirtualUniverse(); > >> } > >> > >> private void createVirtualUniverse() > >> { > >> GraphicsConfigTemplate3D template = new > >> GraphicsConfigTemplate3D(); > >> GraphicsConfiguration config = > >> GraphicsEnvironment.getLocalGraphicsEnvironment(). > >> > >> getDefaultScreenDevice().getBestConfiguration(template); > >> > > Canvas3D myCanvas3D = new Canvas3D(config); > >> setLayout(new BorderLayout()); > >> add("Center", myCanvas3D); > >> > >> VirtualUniverse myUniverse = new VirtualUniverse(); > >> Locale myLocale = new Locale(myUniverse); > >> > >> myCanvas3D.stopRenderer(); > >> > > > >> BranchGroup viewBranch = buildViewBranch(myCanvas3D); > >> > >> > >> myLocale.addBranchGraph(viewBranch); > >> > >> GraphicsContext3D gc3D = myCanvas3D.getGraphicsContext3D(); > >> gc3D.clear(); > >> gc3D.draw(new ColorCube(0.5)); > >> gc3D.flush(false); > >> myCanvas3D.swap(); > >> myCanvas3D.startRenderer(); > >> } > >> > >> private BranchGroup buildViewBranch(Canvas3D c) > >> { > >> BranchGroup viewBranch = new BranchGroup(); > >> Transform3D viewXfm = new Transform3D(); > >> viewXfm.set(new Vector3f(0.0f,0.0f,5.0f)); > >> TransformGroup viewXfmGroup = new TransformGroup(viewXfm); > >> ViewPlatform myViewPlatform = new ViewPlatform(); > >> viewXfmGroup.addChild(myViewPlatform); > >> viewBranch.addChild(viewXfmGroup); > >> View myView = new View(); > >> PhysicalBody mybody = new PhysicalBody(); > >> PhysicalEnvironment myEnvironment = new > PhysicalEnvironment(); > >> myView.setPhysicalBody(mybody); > >> myView.setPhysicalEnvironment(myEnvironment); > >> > >> myView.addCanvas3D(c); > >> myView.attachViewPlatform(myViewPlatform); > >> return viewBranch; > >> } > >> > >> public static void main(String[] args) > >> { > >> new MainFrame(new HelloUniverse(), 256, 256); > >> } > >> } > > > >============================================================= > ============== > >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". > > ============================================================== > ============= > 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".