Michael,
Your setup fails in the second condition of the Valid vertex ranges
check.
Valid vertex ranges :
For geometry by-reference, each non-null vertex component must satisfy
the following:
initialARRIndex + validVertexCount <= vertexCount
ARR.length >= nWords * (initialARRindex + validVertexCount)
where ARR refers to one of the coord, color, normal, or texcoord arrays,
while nWords is the number of words per vertex for the particular type of
array. This implies that the lengths of the separate arrays of components
need not be the same (this can be particularly useful for indexed geometry).
Hope this helps.
- Chien Yang
Java 3D Team.
> Date: Thu, 07 Mar 2002 15:29:55 +0100
> From: Michael Nischt <[EMAIL PROTECTED]>
> Subject: [JAVA3D] IndexedGeometryArray
> To: [EMAIL PROTECTED]
> MIME-version: 1.0
> Content-transfer-encoding: 7bit
> X-Accept-Language: en-us
> Delivered-to: [EMAIL PROTECTED]
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4)
Gecko/20011128 Netscape6/6.2.1
> X-Report-Abuse-To: [EMAIL PROTECTED]
>
> hi there,
> I thought since j3d beta the VertexArray's length needn't to be equal -
> only the length of the IndexArrays must.
>
> but follwowing code:
>
> int vertexFormat = IndexedTriangleArray.COORDINATES |
> IndexedTriangleArray.NORMALS
> | IndexedTriangleArray.TEXTURE_COORDINATE_2
> | IndexedTriangleArray.BY_REFERENCE;
>
> triArray = new IndexedTriangleArray(coords.length / 3,
> vertexFormat, coordIndices.length);
>
> triArray.setCoordRefFloat(coords);
> triArray.setNormalRefFloat(normals);
> triArray.setTexCoordRefFloat(0, texCoords);
>
> triArray.setCoordinateIndices(0, coordIndices);
> triArray.setNormalIndices(0, normalIndices);
> triArray.setTextureCoordinateIndices(0, 0, texCoordIndices);
>
>
> throws:
>
> Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException:
> GeometryArray: texture coord array length is incorrect
> at
>
javax.media.j3d.GeometryArrayRetained.setTexCoordRefFloat(GeometryArrayRetained.
java:8766)
> at
> javax.media.j3d.GeometryArray.setTexCoordRefFloat(GeometryArray.java:5368)
> at test.GeomIO.load(GeomIO.java:224)
>
> with:
> coords.length = 2418
> normals.length = 2438
> texCoords.length = 956
>
> and all IndexArrays are at: 2337
>
>
> without texCoords (though normals.length != coords.length) everything is
> working correct, so I'm asking mtself what i have done wrong ?
>
>
> btw. why I still have to set the vertexCount for IndexedGeometryArrays ?
>
>
> greetings
> -Michael Nischt
>
> ===========================================================================
> 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".