Hi, i'm having trouble tweaking the Text2D class to create its QuadArray
with referenced vertices instead of by copying. I've essentially altered
the setupGeometry function to do things by reference instead. Only when I
use the altered class, the Text2D object doesn't appear anywhere. In the
code you'll see two commented out lines. When I uncomment them (and
comment out the 4 lines that tell it to do reference) the Text2D object
works as normally (via copy). I really need it to work by reference.
Please let me know if you can think of anything. Thanks!

    private final float[] verts1 = {0,0,0,0,0,0,0,0,0,0,0,0};
    int widthTemp;
    int heightTemp;

    private QuadArray setupGeometry(int width, int height) {
        widthTemp = width;
        heightTemp= height;
        calcVerts();

        float[] texCoords = {
            0f, -1f,
            0f, 0f,
            (-1f), 0f,
            (-1f), -1f
        };

        QuadArray rect = new QuadArray(4, QuadArray.COORDINATES |
                                        QuadArray.TEXTURE_COORDINATE_2
                                        |QuadArray.BY_REFERENCE
                                        );

//      rect.setCoordinates(0,verts1);
//      rect.setTextureCoordinates(0, 0, texCoords);
        rect.setCoordRefFloat(verts1);
        rect.setTexCoordRefFloat(0, texCoords);
        rect.setCapability(rect.ALLOW_REF_DATA_WRITE);

        return rect;
    }

    private void calcVerts()
    {
        float zPosition = origin.z;
        float rectWidth = (float)widthTemp * rectangleScaleFactor;
        float rectHeight = (float)heightTemp * rectangleScaleFactor;
        verts1[0] = rectWidth + origin.x;
        verts1[1] = origin.y;
        verts1[2] = origin.z;
        verts1[3] = rectWidth + origin.x;
        verts1[4] = rectHeight + origin.y;
        verts1[5] = origin.z;
        verts1[6] = origin.x;
        verts1[7] = rectHeight + origin.y;
        verts1[8] = origin.z;
        verts1[9] = origin.x;
        verts1[10]= origin.y;
        verts1[11]= origin.z;
   }

Will

===========================================================================
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