Don,

You've got to love these high-level graphics APIs that abstract us from
proprietary vendor APIs... ;-)

I will have a crack at trying to get hold of some instrumented OpenGL DLLs,
or hooking them using WinICE/HiProf or something. If I have any luck in
figuring out which OpenGL calls your sample is making I'll get back to you.

G'luck,

Daniel Selman
Tornado Labs Ltd.

Email:   [EMAIL PROTECTED]
Web:     http://www.tornadolabs.com
Phone:   +44 (0131) 343 2513
Fax:     +44 07070 800 483



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Don Scales
Sent: 26 April 1999 10:23
To: [EMAIL PROTECTED]
Subject: [java3d] Diamond Viper 550 Test Program


Hi,
I think I am getting closer to the problem(s) with the drivers for the
Diamond Viper 550. In my previous test program, I expected to see part of
two
cubes. Three faces should be visible on each. The problem with the top
cube was the following missing line:
    l1Trans.setCapability(Group.ALLOW_CHILDREN_READ);
I am unsure why this prevented all the cube being displayed. It was ok
with an S3 graphics adapter.

The bottom cube was where I was focusing my investigation. This cube
uses the TriangleStripArray but this time uses a stripVertexCounts
array with six entries. It seems that the Diamond drivers may only
use the first entry of this array.

A quick test with an array with a single entry of 24 produced the whole
cube.

The following changes to GeomBuffer.java in package
com.sun.j3d.utils.geometry
resulted in SphereMotion running (note - these changes are not a fix and
will
produce incorrect results with other examples)

  private GeometryArray processQuadStrips()
  {
.
.
    // Calculate how many vertices needed to hold all of the individual
quads
    int stripCounts[] = new int[currPrimCnt];
    int scs[] = new int[1];
.
.
    // Create GeometryArray to pass back
    scs[0] = totalVerts;
    obj = new TriangleStripArray(totalVerts, tsaFlags, scs);

The next step requires translating my test program into opengl.
Maybe Sun can help me here and show me how TriangleStripArray translates
into opengl calls. Then maybe I can give nVidia and Diamond something to
work with.

Come on Sun - give us some help with this problem !!!!!!

Regards
Don

Don Scales
Senior Systems Consultant
Schlumberger Geco-Prakla
Gatwick
UK
[EMAIL PROTECTED]

----------------------------------
/*
 * DiamondTest - test program for Diamond Viper 550 problem
 *               based on SphereMotion Java3D example from Sun
 */
import java.applet.Applet;
import java.awt.BorderLayout;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.geometry.*;
import com.sun.j3d.utils.universe.*;
import javax.media.j3d.*;
import javax.vecmath.*;
import java.util.Enumeration;

public class DiamondTest extends Applet {

  public BranchGroup createSceneGraph(SimpleUniverse u) {

    // normals
    Vector3f[] bn = {
      new Vector3f( 0.0f,  0.0f,  1.0f),
      new Vector3f( 0.0f,  0.0f,  1.0f),
      new Vector3f( 0.0f,  0.0f,  1.0f),
      new Vector3f( 0.0f,  0.0f,  1.0f),
      new Vector3f( 0.0f,  0.0f, -1.0f),
      new Vector3f( 0.0f,  0.0f, -1.0f),
      new Vector3f( 0.0f,  0.0f, -1.0f),
      new Vector3f( 0.0f,  0.0f, -1.0f),
      new Vector3f( 1.0f,  0.0f,  0.0f),
      new Vector3f( 1.0f,  0.0f,  0.0f),
      new Vector3f( 1.0f,  0.0f,  0.0f),
      new Vector3f( 1.0f,  0.0f,  0.0f),
      new Vector3f(-1.0f,  0.0f,  0.0f),
      new Vector3f(-1.0f,  0.0f,  0.0f),
      new Vector3f(-1.0f,  0.0f,  0.0f),
      new Vector3f(-1.0f,  0.0f,  0.0f),
      new Vector3f( 0.0f,  1.0f,  0.0f),
      new Vector3f( 0.0f,  1.0f,  0.0f),
      new Vector3f( 0.0f,  1.0f,  0.0f),
      new Vector3f( 0.0f,  1.0f,  0.0f),
      new Vector3f( 0.0f, -1.0f,  0.0f),
      new Vector3f( 0.0f, -1.0f,  0.0f),
      new Vector3f( 0.0f, -1.0f,  0.0f),
      new Vector3f( 0.0f, -1.0f,  0.0f)
    };
    // textures
    Point2f[] bt = {
      new Point2f(1.0f, 0.0f),
      new Point2f(1.0f, 1.0f),
      new Point2f(0.0f, 0.0f),
      new Point2f(0.0f, 1.0f),
      new Point2f(1.0f, 0.0f),
      new Point2f(1.0f, 1.0f),
      new Point2f(0.0f, 0.0f),
      new Point2f(0.0f, 1.0f),
      new Point2f(1.0f, 0.0f),
      new Point2f(1.0f, 1.0f),
      new Point2f(0.0f, 0.0f),
      new Point2f(0.0f, 1.0f),
      new Point2f(1.0f, 0.0f),
      new Point2f(1.0f, 1.0f),
      new Point2f(0.0f, 0.0f),
      new Point2f(0.0f, 1.0f),
      new Point2f(1.0f, 0.0f),
      new Point2f(1.0f, 1.0f),
      new Point2f(0.0f, 0.0f),
      new Point2f(0.0f, 1.0f),
      new Point2f(0.0f, 1.0f),
      new Point2f(0.0f, 0.0f),
      new Point2f(1.0f, 1.0f),
      new Point2f(1.0f, 0.0f)
    };
    // verts
    Point3f[] bv = {
      new Point3f( 1.0f, -1.0f,  1.0f),
      new Point3f( 1.0f,  1.0f,  1.0f),
      new Point3f(-1.0f, -1.0f,  1.0f),
      new Point3f(-1.0f,  1.0f,  1.0f),
      new Point3f(-1.0f, -1.0f, -1.0f),
      new Point3f(-1.0f,  1.0f, -1.0f),
      new Point3f( 1.0f, -1.0f, -1.0f),
      new Point3f( 1.0f,  1.0f, -1.0f),
      new Point3f( 1.0f, -1.0f, -1.0f),
      new Point3f( 1.0f,  1.0f, -1.0f),
      new Point3f( 1.0f, -1.0f,  1.0f),
      new Point3f( 1.0f,  1.0f,  1.0f),
      new Point3f(-1.0f, -1.0f,  1.0f),
      new Point3f(-1.0f,  1.0f,  1.0f),
      new Point3f(-1.0f, -1.0f, -1.0f),
      new Point3f(-1.0f,  1.0f, -1.0f),
      new Point3f( 1.0f,  1.0f,  1.0f),
      new Point3f( 1.0f,  1.0f, -1.0f),
      new Point3f(-1.0f,  1.0f,  1.0f),
      new Point3f(-1.0f,  1.0f, -1.0f),
      new Point3f(-1.0f, -1.0f,  1.0f),
      new Point3f(-1.0f, -1.0f, -1.0f),
      new Point3f( 1.0f, -1.0f,  1.0f),
      new Point3f( 1.0f, -1.0f, -1.0f)
    };
    // strip counts
    int[] stca = new int[1];
    stca[0] = 4;
    int[] stcb = {4,4,4,4,4,4};

    int i,j,k;

    Color3f eColor    = new Color3f(0.0f, 0.0f, 0.0f);
    Color3f sColor    = new Color3f(1.0f, 1.0f, 1.0f);
    Color3f objColor  = new Color3f(0.6f, 0.6f, 0.6f);
    Color3f lColor1   = new Color3f(1.0f, 0.0f, 0.0f);
    Color3f lColor2   = new Color3f(0.0f, 1.0f, 0.0f);
    Color3f lColor3   = new Color3f(0.0f, 0.0f, 1.0f);
    Color3f alColor   = new Color3f(0.2f, 0.2f, 0.2f);
    Color3f bgColor   = new Color3f(0.05f, 0.05f, 0.2f);

    Transform3D t;

    //  Create the root of the branch graph
    BranchGroup objRoot = new BranchGroup();

    // Create a Transformgroup to scale all objects so they
    // appear in the scene.
    TransformGroup objScale = new TransformGroup();
    Transform3D t3d = new Transform3D();
    t3d.setScale(0.4);
    objScale.setTransform(t3d);
    objRoot.addChild(objScale);

    // Create a bounds for the background and lights
    BoundingSphere bounds =
      new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);

    // Set up the background
    Background bg = new Background(bgColor);
    bg.setApplicationBounds(bounds);
    objScale.addChild(bg);

    // Create first object,
    // and add it into the scene graph.
    Material m = new Material(objColor, eColor, objColor, sColor, 100.0f);
    Appearance a = new Appearance();
    m.setLightingEnable(true);
    a.setMaterial(m);

    // Create transformations for first object
    t = new Transform3D();
    Vector3d lPos1 = new Vector3d(-2.0, 2.0, 0.0);
    t.set(lPos1);
    TransformGroup l1Trans = new TransformGroup(t);

//**** The following line is required by the Diamond Viper 550 ****
    l1Trans.setCapability(Group.ALLOW_CHILDREN_READ);

    objScale.addChild(l1Trans);

    // Create Geometry for first object
    j = 0;
    for (i = 0;i < 6;i++) {
      GeometryArray goa = new TriangleStripArray(4,
                              TriangleStripArray.COORDINATES |
                              TriangleStripArray.NORMALS |
                              TriangleStripArray.TEXTURE_COORDINATE_2,
                              stca);
      Point3f[]  bpts = new Point3f[4];
      Vector3f[] bnrm = new Vector3f[4];
      Point2f[]  bcrd = new Point2f[4];
      for (k = 0;k<4;k++) {
        bpts[k] = bv[j];
        bnrm[k] = bn[j];
        bcrd[k] = bt[j];
        j++;
      };
      goa.setCoordinates(0,bpts);
      goa.setNormals(0,bnrm);
      goa.setTextureCoordinates(0,bcrd);
      Shape3D shp = new Shape3D(goa);
      shp.setAppearance(a);
      l1Trans.addChild(shp);
    };

    // Create transformations for second object
    t = new Transform3D();
    Vector3d lPos2 = new Vector3d(-2.0, -2.0, 0.0);
    t.set(lPos2);
    TransformGroup l2Trans = new TransformGroup(t);
    objScale.addChild(l2Trans);

    // Create Geometry for second object
    stca[0] = 24;  // bodge for Diamond Viper 550
    GeometryArray goa = new TriangleStripArray(24,
                            TriangleStripArray.COORDINATES |
                            TriangleStripArray.NORMALS |
                            TriangleStripArray.TEXTURE_COORDINATE_2,
                            stcb);
//****                      stca);   // bodge for Diamond Viper 550
    goa.setCoordinates(0,bv);
    goa.setNormals(0,bn);
    goa.setTextureCoordinates(0,bt);
    Shape3D shp = new Shape3D(goa);
    shp.setAppearance(a);
    l2Trans.addChild(shp);

    // Create transformations for the positional lights
    TransformGroup llRotTrans = new TransformGroup();
    llRotTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    objScale.addChild(llRotTrans);

    t = new Transform3D();
    Vector3d lPosl = new Vector3d(0.5, 0.8, 2.0);
    t.set(lPosl);
    TransformGroup llTrans = new TransformGroup(t);
    llRotTrans.addChild(llTrans);

    // Create Geometry for point lights
    ColoringAttributes caLl = new ColoringAttributes();
    caLl.setColor(lColor2);
    Appearance appLl = new Appearance();
    appLl.setColoringAttributes(caLl);

    // Create lights
    Light lgtl = null;

    Point3f lPoint  = new Point3f(0.0f, 0.0f, 0.0f);
    Point3f atten = new Point3f(1.0f, 0.0f, 0.0f);
    Vector3f lDirectl = new Vector3f(lPosl);
    lDirectl.negate();

    lgtl = new PointLight(lColor2, lPoint, atten);

    // Set the influencing bounds
    lgtl.setInfluencingBounds(bounds);

    // Add the lights into the scene graph
    llTrans.addChild(lgtl);

    // Let Java 3D perform optimizations on this scene graph.
    objRoot.compile();

    return objRoot;
  }

  public DiamondTest() {
    setLayout(new BorderLayout());
    Canvas3D c = new Canvas3D(null);
    add("Center", c);

    SimpleUniverse u = new SimpleUniverse(c);
    BranchGroup scene = createSceneGraph(u);

    // This will move the ViewPlatform back a bit so the
    // objects in the scene can be viewed.
    u.getViewingPlatform().setNominalViewingTransform();

    u.addBranchGraph(scene);
  }

  //
  // The following allows DiamondTest to be run as an application
  // as well as an applet
  //
  public static void main(String[] args) {
    new MainFrame(new DiamondTest(), 700, 700);
  }
}

=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/


=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/

Reply via email to