Hi Micahel,

    There is a typo in the file
     _think/net/monoid/j3d/animation/models/md3/MD3Model


   Change
     geomArray.setColorRefBuffer(new J3DBuffer(coordBuffer));
    to
     geomArray.setCoordRefBuffer(new J3DBuffer(coordBuffer));

   should work fine.

 - Kelvin

>X-Unix-From: [EMAIL PROTECTED]  Thu Nov 29 00:36:26 2001
>X-Report-Abuse-To: [EMAIL PROTECTED]
>From: "Michael Nischt" <[EMAIL PROTECTED]>
>To: "Kelvin Chung" <[EMAIL PROTECTED]>
>Subject: Re:      Re: [JAVA3D] J3DBuffers - how to use them correctly ? - part 2
>Date: Thu, 29 Nov 2001 09:40:06 +0100
>MIME-Version: 1.0
>Content-Transfer-Encoding: 7bit
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
>
>Hi Kelvin,
>
>the Illigal state Exception is thrown because youe changed useBuffers
>variable in
>net.monoid.j3d.animation.models.md3.MD3MeshDeformer.updateData() so it is
>set to 'true' and the useBuffers variable in
>net.monoid.j3d.animation.models.md3.MD3Model.setMesh()
>remained unchanged (false). You have to change both variables similar. (both
>true or both false)
>(that's why I telled you about both files)
>
>then you'll see that the GeometryArray is constructed correctly with the
>'USE_NIO_BUFFER' flag, but nothing is rendered !
>
>greetings
> -Michael Nischt
>
>
>----- Original Message -----
>From: "Kelvin Chung" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Thursday, November 29, 2001 12:48 AM
>Subject: Re: [JAVA3D] J3DBuffers - how to use them correctly ? - part 2
>
>
>> Hi Michael,
>>
>>    I try your test program, it throws exception at
>>
>>   java.lang.IllegalStateException: GeometryArray: must be in
>USE_NIO_BUFFER mode to use this method
>>         at
>javax.media.j3d.GeometryArray.getCoordRefBuffer(GeometryArray.java:4142)
>>         at
>net.monoid.j3d.animation.models.md3.MD3MeshDeformer.updateData(MD3MeshDeform
>er.java:81)
>>         at
>javax.media.j3d.GeometryArrayRetained.updateData(GeometryArrayRetained.java:
>5305)
>>         at
>javax.media.j3d.GeometryArray.updateData(GeometryArray.java:677)
>>         at
>net.monoid.j3d.animation.models.md3.MD3MeshDeformer.setFrame(MD3MeshDeformer
>.java:53)
>>         at
>net.monoid.j3d.animation.models.md3.MD3Model.setFrame(MD3Model.java:261)
>>         at
>net.monoid.j3d.animation.models.md3.q3a.Q3AModel.linkAll(Q3AModel.java:107)
>>         at
>net.monoid.j3d.animation.models.md3.q3a.Q3AModelIO.load(Q3AModelIO.java:83)
>>         at
>net.monoid.j3d.animation.models.md3.q3a.Q3AModelFactory.createModel(Q3AModel
>Factory.java:36)
>>         at
>net.monoid.j3d.animation.player.SceneController.addModel(SceneController.jav
>a:44)
>>         at
>net.monoid.j3d.animation.player.PlayerIO.parseScriptLine(PlayerIO.java:98)
>>         at
>net.monoid.j3d.animation.player.PlayerIO.readScriptFile(PlayerIO.java:64)
>>         at
>net.monoid.j3d.animation.player.SceneController.playScript(SceneController.j
>ava:39)
>>         at app.App2.createSceneGraph(App2.java:242)
>>         at app.App2.<init>(App2.java:109)
>>         at Main.main(Main.java:7)
>>
>>
>> when trying to updateData()
>> That's why nothing is shown.It may because other GeometryArray pass in
>> is not construct using NIO_BUFFER. If I comment out the call I see
>> the model shown correctly on the screen (but not move since updateData
>> is comment out).
>>
>> Please fix the application.
>>
>> Thanks.
>>
>> - Kelvin
>> ----------------
>> Java 3D Team
>> Sun Microsystems Inc.
>>
>>
>> >Delivered-To: [EMAIL PROTECTED]
>> >MIME-Version: 1.0
>> >Content-Transfer-Encoding: 8BIT
>> >X-Sender: [EMAIL PROTECTED]
>> >Date: Tue, 27 Nov 2001 01:29:39 +0100
>> >From: Michael Nischt <[EMAIL PROTECTED]>
>> >Subject: [JAVA3D] J3DBuffers - how to use them correctly ? - part 2
>> >To: [EMAIL PROTECTED]
>> >
>> >again :o(
>> >
>> >I changed my code parts for using J3DBuffer's, but again I got a problem.
>> >I have compared my code with the 'GeometryByReferenceNIOBuffer' Example
>and I
>> >can't figure out any differences in principle..
>> >
>> >code bellow works fine with useBuffers false, but setting it to true
>nothing is
>> >rendered.. i played it bit with the code and noticed that
>> >geomArray.getCoordRefBuffer() returns a null-reference.. but before
>setting
>> >J3DBuffer everything is fine..
>> >
>> >any ideas what I have done wrong ?
>> >(also removed USE_COORD_INDEX_ONLY and set all indices, but didn't change
>> >anything..)
>> >
>> >greetings
>> > -Michael Nischt
>> >
>> >CODE:
>> >------------------------------------
>> >  boolean useBuffers = false;
>> >        if(useBuffers)
>> >            vertexFormat = GeometryArray.BY_REFERENCE |
>> >GeometryArray.USE_NIO_BUFFER | GeometryArray.USE_COORD_INDEX_ONLY |
>> >GeometryArray.COORDINATES | GeometryArray.NORMALS |
>> >GeometryArray.TEXTURE_COORDINATE_2;
>> >        else
>> >            vertexFormat = GeometryArray.BY_REFERENCE |
>> >GeometryArray.USE_COORD_INDEX_ONLY | GeometryArray.COORDINATES |
>> >GeometryArray.NORMALS | GeometryArray.TEXTURE_COORDINATE_2;
>> >        IndexedTriangleArray geomArray = new
>IndexedTriangleArray(numVertices,
>> >vertexFormat, texCoordSetCount, texCoordSetMap , numIndices);
>> >
>> >        geomArray.setCapability(GeometryArray.ALLOW_REF_DATA_READ);
>> >        geomArray.setCapability(GeometryArray.ALLOW_REF_DATA_WRITE);
>> >
>> >        float[] coords = mesh.getCoords(0);
>> >        float[] normals = mesh.getNormals(0);
>> >
>> >        ByteOrder order = ByteOrder.nativeOrder();
>> >
>> >        if(useBuffers) {
>> >
>> >            FloatBuffer coordBuffer =
>ByteBuffer.allocateDirect(coords.length *
>> >4).order(order).asFloatBuffer();
>> >            FloatBuffer normalBuffer =
>ByteBuffer.allocateDirect(normals.length
>> >* 4).order(order).asFloatBuffer();
>> >
>> >            coordBuffer.put(coords, 0, coords.length);
>> >            normalBuffer.put(normals, 0, normals.length);
>> >
>> >
>> >            geomArray.setColorRefBuffer(new J3DBuffer(coordBuffer));
>> >            geomArray.setNormalRefBuffer(new J3DBuffer(normalBuffer));
>> >        }
>> >        else {
>> >            geomArray.setCoordRefFloat(coords);
>> >            geomArray.setNormalRefFloat(normals);
>> >        }
>> >
>> >        geomArray.setCoordinateIndices(0, mesh.getIndices());
>> >        //geomArray.setNormalIndices(0, mesh.getIndices());
>> >
>> >        TextureUnitState[] texUnits = new
>TextureUnitState[texCoordSetCount];
>> >
>> >        Appearance ap = new Appearance();
>> >        ap.setMaterial(DEFAULT_MATERIAL);
>> >        ap.setPolygonAttributes(DEFAULT_POLYGON_ATTRIBUTES);
>> >        ap.setTextureUnitState(texUnits);
>> >
>> >
>> >        for(int i=0; i<texCoordSetCount; i++) {
>> >            float[] texCoords = mesh.getTexCoords();
>> >            if(useBuffers) {
>> >                FloatBuffer texCoordBuffer =
>> >ByteBuffer.allocateDirect(texCoords.length *
>4).order(order).asFloatBuffer();
>> >                texCoordBuffer.put(texCoords, 0, texCoords.length);
>> >                geomArray.setTexCoordRefBuffer(i, new
>> >J3DBuffer(texCoordBuffer));
>> >            }
>> >            else
>> >                geomArray.setTexCoordRefFloat(i, texCoords);
>> >
>> >
>> >            //geomArray.setTextureCoordinateIndices(i, 0,
>mesh.getIndices());
>> >            TextureUnitState texUnit = new TextureUnitState();
>> >            texUnit.setTexture(mesh.getTexture(i));
>> >            ap.setTextureUnitState(i, texUnit);
>> >        }
>> >
>> >
>> >        shape.setAppearance(ap);
>> >        shape.setGeometry(geomArray);
>> >
>> >        this.getNode().addChild(shape);
>> >------------------------------------
>> >
>>
>>===========================================================================
>> >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".

Reply via email to