> Date: Wed, 18 Apr 2001 22:10:30 +0200
> From: Artur Biesiadowski <[EMAIL PROTECTED]>
> Subject: Re: [JAVA3D] Lighting/Normals problem
> To: [EMAIL PROTECTED]
>
> Paul Pantera wrote:
>
> > Why not use the NormalGenerator on custom geometry?
>
> Because you need to use GeometryInfo to use NormalGenerator. And
> GeometryInfo, while quite powerful and useful, is performance and memory
> hog.
But after you use it, you just throw it away. You never need to keep
a GeometryInfo (or Stripifier or NormalGenerator) around. It's usually
only used during setup.
>
> If you are creating specific geometric shapes for which you exactly know
> normals, coords, optimal strip arrays etc, generating everything
> directly for *GeometryArray is a lot faster (I mean faster execution at
> runtime).
You mean the setup time is faster, not the rendering time, right?
If you use the Stripifier and pull out an un-indexed GeometryArray,
the rendering performance is going to be hard to beat.
>
> To give you example - I was experimenting with very detailed spheres.
> I've either set up all vertices and normals by hand (especially normals
> are easy :) or used GeometryInfo. Difference in runtime size (peak) was
> something like 10MB versus 70MB.
It doesn't really use the memory, it just borrows it and gives it
back :).
If you use the native data types of GeometryInfo, it will consume
less memory by using your data instead of copying it. For example,
use an array of Point3f for your coordinate lists. This is
documented in the javadoc for GeometryInfo:
public void setCoordinates(Point3f[] coordinates)
Sets the coordinates array. No data copying is done because a
reference to user data is used.
public void setCoordinates(Point3d[] coordinates)
Sets the coordinates array. The points are copied into the
GeometryInfo object.
public void setCoordinates(float[] coordinates)
Sets the coordinates array. The points are copied into the
GeometryInfo object.
public void setCoordinates(double[] coordinates)
Sets the coordinates array. The points are copied into the
GeometryInfo object.
Then, of course, after you pull your GeometryArray out of
GeometryInfo, you may destroy the arrays containing the
original data.
If your program is keeping a GeometryInfo around for some reason,
call GeometryInfo.reset() to tell it to release all of its internal
data.
-Paul
===========================================================================
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".