In regards to your question:

I ran this program on a Pentium II 300MHZ 128MBram 8GBhard under Windows 98.
Installed is jdk1.2.2 standard edition with the latest alpha release of
java3d runtime.  The square appears a square when the colorcube is
uncommented.  So I could not find the bug.

Java3d

http://java.sun.com/products/java-media/3D/1_2_api/

Yours today,

Reynold DeMarco Jr.
http://www.handtech.com/default.asp?HOST=reynolddemarcojr




-----Original Message-----
From: Discussion list for Java 3D API
[mailto:[EMAIL PROTECTED]]On Behalf Of Heiko Gottschling
Sent: Thu, September 30, 1999 9:51 AM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] ??? Where does this bug come from ???


Hi,

I'm having great problems using the IndexedQuadArray class. I've
included a little demo program below, which can be started with "java
Buggy" (after compilation).

As is, this program works fine: it displays a big white square, which
can be rotated using the mouse (due to culling effects, only the front
face of the square is visible, but that's ok). The square was
constructed using an IndexedQuadArray geometry (which contains just one
quadrilateral, being the square itself).

The problem comes into being only if you uncomment the marked line,
which simply adds a ColorCube to the scene graph. The former square now
turns into a TRIANGLE. But what happened to the specified SQUARE?

Now, can anyone tell where this bug comes from? Did I miss something?
BTW, I'm running this on Solaris 2.6 with OpenGL 1.1.2.

I am not interested in any workarounds, since I could (hopefully) figure
out them by myself :-), but I'd really like to know what causes the bug
(me, Java or OpenGL).

thx
Heiko

------------------ cut here ---------------------

import javax.swing.JFrame;
import javax.media.j3d.*;
import com.sun.j3d.utils.geometry.ColorCube;
import com.sun.j3d.utils.universe.SimpleUniverse;
import com.sun.j3d.utils.behaviors.mouse.*;
import javax.vecmath.*;

public class Buggy extends JFrame {
  public Buggy() {
    super("Buggy");

    Canvas3D canvas = new Canvas3D(null);
    getContentPane().add(canvas);

    BranchGroup scene = createSceneGraph();
    scene.compile();

    SimpleUniverse universe = new SimpleUniverse(canvas);
    universe.getViewingPlatform().setNominalViewingTransform();

    universe.addBranchGraph(scene);

    setSize(500, 600);
    setVisible(true);
  }

  public BranchGroup createSceneGraph() {
    BranchGroup scene = new BranchGroup();
    TransformGroup trans = new TransformGroup();

    trans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    trans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);

    Shape3D buggyShape = createBuggyShape();
    trans.addChild(buggyShape);

    MouseRotate mouseRotate = new MouseRotate(trans);
    mouseRotate.setSchedulingBounds(new BoundingSphere());

    scene.addChild(mouseRotate);
    scene.addChild(trans);

    // ------------------ This is the line!!!! ---------------
    // If this line is uncommented, the bug will appear

    // scene.addChild(new ColorCube(0.1f));

    // ------------------ This was the line!!!! ---------------

    return scene;
  }

  // here the shape is created using a IndexedQuadArray
  public Shape3D createBuggyShape() {
    Shape3D buggyShape = new Shape3D();

    // define 4 triples of coordinates (x, y, z) = a square
    float c[] = { -0.5f, -0.5f, 0,
     0.5f, -0.5f, 0,
     0.5f,  0.5f, 0,
                  -0.5f,  0.5f, 0 };

    int i[] = { 0, 1, 2 , 3};

    IndexedQuadArray quadArray = new IndexedQuadArray(4,
  IndexedQuadArray.COORDINATES,4);

    quadArray.setCoordinates(0, c);
    quadArray.setCoordinateIndices(0,i);

    buggyShape.setGeometry(quadArray);

    return buggyShape;
  }

  public static void main(String[] args) {
    new Buggy();
  }
}

===========================================================================
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".
BEGIN:VCARD
VERSION:2.1
N:DeMarco Jr;Reynold;;Mr.
FN:Reynold DeMarco Jr
NICKNAME:Reynold
ORG:same;none
TITLE:same
TEL;WORK;VOICE:617-720-4527
TEL;HOME;VOICE:6177204527
TEL;CELL;VOICE:none
TEL;PAGER;VOICE:none
TEL;WORK;FAX:none
TEL;HOME;FAX:none
ADR;WORK:;none;P.O. Box 3584;Boston;Massachusetts;02101;United States
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:none=0D=0AP.O. Box 3584=0D=0ABoston, Massachusetts 02101=0D=0AUnited States
ADR;HOME:;;P.O. BOX 3584;BOSTON;MA;02101-3584;United States
LABEL;HOME;ENCODING=QUOTED-PRINTABLE:P.O. BOX 3584=0D=0ABOSTON, MA 02101-3584=0D=0AUnited States
X-WAB-GENDER:2
BDAY:19990127
EMAIL;PREF;INTERNET:[EMAIL PROTECTED]
REV:19990409T045118Z
END:VCARD

Reply via email to