Hi, I have used Integer.MAX_VAL as the vertex count in the constructor. This works but I have no idea if it is wasting any resources. It seems not to be but I haven't investigated closely yet. I actualy asked a question a little while back if this wasted any resources and rescieved no answers.
Cheers, Brad Nick Stark wrote: > > Thanks for the response. However, to construct a geometry array, one of > the parameters that must be passed is the vertex count, which is simply an > integer. If you pass 0 as the vertex count, then I have not been able to > later increase this vertex count which has been the problem here. Any > ideas to address that would be great... > > Thanks, > Nick > > |---------+------------------------------> > | | "Dirk L. van | > | | Krimpen" | > | | <[EMAIL PROTECTED]| > | | .COM> | > | | Sent by: Discussion| > | | list for Java 3D | > | | API | > | | <[EMAIL PROTECTED]| > | | VA.SUN.COM> | > | | | > | | | > | | 03/07/2003 02:48 AM| > | | Please respond to | > | | Discussion list for| > | | Java 3D API | > | | | > |---------+------------------------------> > > >--------------------------------------------------------------------------------------------------------------------------------------------------| > | > | > | To: [EMAIL PROTECTED] > | > | cc: > | > | Subject: Re: [JAVA3D] Instantiating GeometryArrays without knowing their > size | > > >--------------------------------------------------------------------------------------------------------------------------------------------------| > > Hi Nick, > > Not sure if this is what you're looking for, but in cases I don't know the > size of the array beforehand, I do the following: > > At initialization (so, before the first constructor) I declare: > > float cords[]; > > And inside the constructor, just before the GeometryArray, when the number > of vertices are known, I state: > > cords=new float[whatever number]; > > Again, not sure if this will help you, but it works for me. > > Have fun, Dirk > > ----- Original Message ----- > From: "Nick Stark" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, March 06, 2003 2:38 PM > Subject: [JAVA3D] Instantiating GeometryArrays without knowing their size > > > Hi everyone - > > > > I am forced by using the Externalizable interface to have a default > > constructor for my class that extends a TriangleStripArray. However, > > GeometryArrays do not have a default constructor, so I am wondering if > > anyone knows a way of instantiating a GeometryArray without knowing its > > size. I have figured out that I can make the GeometryArray larger than I > > need, and I will only have the needed validVertexCount, but the non-valid > > vertices are still stored in the array (vertices that are never used, but > > are taking up memory). And I've also determined that you can't initially > > create the GeometryArray smaller than necessary, because calling > > setStripCounts on a TriangleStripArray throws an exception if the > > vertexCount is less than the number of vertices listed in the > stripCounts. > > Any ideas or workarounds that anyone can think of? > > > > Thanks a lot, > > Nick > > > > > =========================================================================== > > 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". ---------------------------------------------------------------------------- This Email may contain confidential and/or privileged information and is intended solely for the addressee(s) named. If you have received this information in error, or are advised that you have been posted this Email by accident, please notify the sender by return Email, do not redistribute it, delete the Email and keep no copies. ---------------------------------------------------------------------------- =========================================================================== 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".
