Quite likely it is the ATI driver, but what can I do?     I am unable to downgrade to FC1.   I suppose I have a workaround - remove DRI support from Xorg.conf.  Everything in Java3D works in that case.

Attached is a sample app (DirectRenderIssue.java) that demos a problem which *may* be related to what I'm seeing with the main application that we're developing.

I wonder if anyone else can reproduce the symptoms I see?

The application constructs a relatively simple TriangleFanArray and uses a TextureLoader to partially display an image (smile.png) draped over the fan.  I've tried running this app with jdk 1.4.2_05 + J3D 1.3.1, and 1.5.0 beta2 + J3D 1.3.2, with identical results.  Without DRI, the app works correctly, with DRI, the app works correctly without the texture, and incorrectly with the texture.

After compiling the app, you can run it either as:
    java  DirectRenderIssue  t
which displays the texture (you can see what this looks like in the attached smiley3d.jpg) or
    java  DirectRenderIssue  w
which displays the wire-frame (see wireframe3d.jpg)

Actually, the app works fine with or without DRI *to begin with*.

If DRI is loaded, the problem occurs if you take focus away from the application window, then give the window focus once more.  In this case, I see what is shown in the attached wrong3d.jpg).  I have "focus follows mouse" set for Windows behaviour, but similar things occur for "click to focus".

When the app starts, it looks correct.  I move the mouse into another window - which removes focus from the app, and the app still looks ok.  But when I move the mouse back into the app window, it immediately looks wrong, as shown.

As stated, I don't know if this is the same issue that I'm seeing as reported earlier, but it certainly seems like a bad one.

-- Russell



Paul Byrne wrote:

I suspect this problem is being caused by the ATI drivers. We have had a number of problems with ATI's OpenGL and would love to work with them to resolve the issues, anyone from ATI out there.....

Java 3D is a large system and makes extensive and fairly optimized use of  OpenGL so it's probably not the fact that you are trying to use textures but the way in which those textures are being used on the specific geometry type.

I have had a lot of problems installing the ATI drivers on my Suse 9.1 box, I ended up making kernel modifications, recompiling the kernel, recompiling the drivers and I still don't get reliable results.

My recommendation, go back to Fedora 1 until ATI updates the drivers

Rgds

Paul

Russell East wrote:
I tried using  "MahJongg Solitaire 3D"
   http://www.reto-schoelly.de/mahjongg3d/downloads.html
It is a c++ application, and just a quick look at the code suggests it
is using textures.   It is working fine for me, when DRI is enabled -
not a bad game actually.  :-)

Attached are some screen shots of what is happening in my Java3D-based
application:

   Wireframe.jpg - this shows the wire-frame I am using.  it works with
or without DRI
   WithoutDRI.jpg - shows the app with textures, working fine when DRI
is disabled
   WithDRI.jpg - shows the mess when DRI is enabled.

I'm a bit inexperienced with 3D stuff in general.  Does the last
screenshot mean anything?

-- Russell

Alessandro Borges wrote:

Russel,
glxgears doesnot uses textures.
Try another 3D application with textures. I guess this bug is not Java3D
related.

Try Quake, Doom or  Xith WebStart demos available at
http://www.xith.org/demos/com.xith3d.test.php

Some upgrades are real downgrades...
Alessandro


--- Russell East <[EMAIL PROTECTED]> escreveu: > Hi Todd,


no, 'cause I have a Radeon 7500 graphics card - the system is a Compaq
Evo N800c.   Everything else is mostly working fine.  If I enable DRI
and restart X, glxgears works Ok, it's just that the J3D texture
rendering seems to be failing.
-- Russell



Did you install the latest NVidia drivers according to the procedure
described here: http://www.fedorafaq.org/#nvidia ?  You may want to try
this if you haven't.  I also believe the readme that comes with the
drivers discusses "dri" module issues.

~Todd

On Jul 7, 2004, at 3:22 PM, Russell East wrote:



Uh oh.

I've been working my way through the XF86Config/xorg.conf and made it
to
the "Module" section.  Here is what my XF86Config used to have there:
Section "Module"
  Load  "dbe"
  Load  "extmod"
  Load  "fbdevhw"
  Load  "glx"
  Load  "record"
  Load  "freetype"
  Load  "type1"
  Load  "dri"
EndSection

and here is what the default xorg.conf has (without comments):
Section "Module"
  Load    "dbe"
  SubSection    "extmod"
  Option    "omit xfree86-dga"
  EndSubSection
  Load    "type1"
  Load    "freetype"
EndSection

So, I've been adding each of the modules, in turn, from my old
XF86Config into the new xorg.conf.   Actually, Java3D didn't work until
I had added:
  Load  "glx"
which I guess is expected.

But, the problem occurs when I add in
  Load  "dri"
(direct rendering)

Without this module, MesaGL is being used, with poorer FPS performance
as reported by glxgears (about 140).

With this module loaded, glxgears reports about an 8-10 times
improvement (about 1000 fps).

However, with DRI loaded, Java3D textures no longer work, on my system
at least.

So far, I've tried removing the following section that was in my
original XF86Config:
Section "DRI"
  Group        0
  Mode         0666
EndSection
But with this removed, it seems to disable DRI anyway.

I'm going to investigate this a bit further, but has anyone gone down
this path already?

-- Russell


Russell East wrote:



I think I figured it out.

For several versions of RH (8 and 9 I think) as well as FC1, I have a
custom rc.local that toggles 3-button emulation value within the
XF86Config, based on presence/absence of 3 button USB mouse.  It
copies one or other private copies of the config into the right place.

Well I forgot it was still there when I installed FC2 and rebooted
after the install without turning off the rc.local.  So, on the first
boot-up, it plonked an XF86Config into /etc/X11.   It looks to me like
Xorg is willing to work with an XF86Config, so Xorg was getting
configured from the older config file.  Possibly one of the options
was messing Xorg around.

What I did was remove the rc.local behaviour and the XF86Config file.
I was hoping the system would notice no config, and try to
re-configure a (new) xorg.conf, but it didn't, so everything worked
off of supposedly reasonable defaults.   Anyway, after rebooting
without the XF6Config, Xorg came up fine, and Java3D textures were
working again.

Seems to me like Xorg is a bit slower when modifying the transform of
my 3D model when I do rotates and zooms - the animation seems jerkier
than just a couple of days ago.

I'm now going to try to set up a custom xorg.conf, since my usb mouse
scroller no longer works.  With any luck, I can get it to work....

-- Russell



Original email:

Russell East wrote:



Hi,
I just installed FC2 as an update over the top of my FC1 (Linux)
system.   Java+J3D was working fine with FC1.  But after the update,
my J3D application is failing as follows.

Everything compiles no problem.  The app starts up displaying a swing
UI, but no J3D at first (correctly).  After selecting some stuff, the
J3D canvas is shown, and an initial wire-frame is displayed - this
works no problem also.   After working with the UI some more, some
images are supposed to be draped over the wire-frame as J3D textures -
here is where it goes haywire.   The textures look totally random
looking 3d strips of color - actually looks really cool artistically,
but not what was expected sadly...

I've tried using JDK 1.5, 1.4.2, J3D 1.3.1 and J3D 1.3.2Alpha.  All
have the same result.

I also have tried the two available kernel options - 2.6.5-1.358 and
the updated 2.6.6-1.435.2.3 - again with same result.

Of course, there are two main changes going from FC1 -> FC2:
o    change kernel from 2.4 -> 2.6, and
o    change X server from XFree to Xorg

I'm wondering if there isn't some simple thing I need to do to tweak
Xorg to get it to work properly.   My computer has an ATI Radeon 7500
(it's a laptop).

This is really a disaster - would anybody else have tried FC2 with
positive results?

-- Russell


=========================================================================== 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".
import com.sun.j3d.utils.image.TextureLoader;

import java.awt.*;
import java.io.File;
import javax.swing.*;
import javax.media.j3d.*;
import javax.vecmath.*;

public class DirectRenderIssue extends JFrame {
    private static boolean _useTexturedAppearance = true;

    public static void main(String args[]) {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            setRendererType(args);
            DirectRenderIssue frame = new DirectRenderIssue();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(200, 200);
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            Rectangle bounds = frame.getBounds();
            frame.setLocation((screenSize.width - bounds.width) / 2,
                    (screenSize.height - bounds.height) / 2);
            frame.setVisible(true);

        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e, "Error starting application",
                    JOptionPane.ERROR_MESSAGE);
            e.printStackTrace();
            System.exit(0);
        }
    }

    private static void setRendererType(String args[]) {
        if (args.length > 0) {
            _useTexturedAppearance = (args[0].startsWith("T") || 
args[0].startsWith("t"));
        }
    }

    private static final int BACK_CLIP_POLICY = View.VIRTUAL_EYE;
    private static final int FRONT_CLIP_POLICY = View.VIRTUAL_EYE;
    private static final double INITIAL_BACK_CLIP_DISTANCE = 20.0;
    private static final double INITIAL_FRONT_CLIP_DISTANCE = 0.01;
    private static final Color3f White = new Color3f(1, 1, 1);
    private static final Point3d ORIGIN = new Point3d(0.0, 0.0, 0.0);
    private static final BoundingSphere LIGHT_BOUNDS =
            new BoundingSphere(ORIGIN, INITIAL_BACK_CLIP_DISTANCE);

    private Canvas3D canvas;
    private VirtualUniverse universe;
    private Locale locale;
    private BranchGroup viewGroup;
    private TransformGroup transformGroup;
    private Transform3D transform3d;
    private BranchGroup geomGroup;
    private ViewPlatform platform;
    private View view;
    private DirectionalLight headlight;
    private PhysicalBody body;
    private PhysicalEnvironment environment;

    public DirectRenderIssue() throws Exception {
        canvas = constructCanvas();
        getContentPane().add(canvas, BorderLayout.CENTER);

        constructUniverse();
        constructView();
        constructShape();

        makeLive();
    }

    private Canvas3D constructCanvas() {
        GraphicsConfigTemplate3D tmpl = new GraphicsConfigTemplate3D();
        GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice device = env.getDefaultScreenDevice();
        GraphicsConfiguration config = device.getBestConfiguration(tmpl);
        return new Canvas3D(config);
    }

    private void constructUniverse() {
        universe = new VirtualUniverse();
        locale = new Locale(universe);

        viewGroup = new BranchGroup();
        viewGroup.setCapability(Group.ALLOW_CHILDREN_EXTEND);
        viewGroup.setCapability(Group.ALLOW_CHILDREN_READ);

        geomGroup = new BranchGroup();
        geomGroup.setCapability(Group.ALLOW_CHILDREN_EXTEND);
        geomGroup.setCapability(Group.ALLOW_CHILDREN_READ);

        transformGroup = new TransformGroup();
        transformGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
        transformGroup.setCapability(TransformGroup.ALLOW_CHILDREN_READ);
        viewGroup.addChild(transformGroup);
    }

    private void constructView() {
        platform = new ViewPlatform();
        transformGroup.addChild(platform);

        transform3d = constructTransform();    //new Transform3D();
        //lookAtOrigin(6.0,45.0,45.0);
        transformGroup.setTransform(transform3d);

        headlight = new DirectionalLight();
        headlight.setCapability(Light.ALLOW_STATE_WRITE);
        headlight.setColor(White);
        headlight.setInfluencingBounds(LIGHT_BOUNDS);
        headlight.setEnable(true);
        transformGroup.addChild(headlight);

        body = new PhysicalBody();
        environment = new PhysicalEnvironment();

        view = new View();
        view.setBackClipPolicy(BACK_CLIP_POLICY);
        view.setBackClipDistance(INITIAL_BACK_CLIP_DISTANCE);
        view.setFrontClipPolicy(FRONT_CLIP_POLICY);
        view.setFrontClipDistance(INITIAL_FRONT_CLIP_DISTANCE);
        view.setPhysicalBody(body);
        view.setPhysicalEnvironment(environment);
        view.attachViewPlatform(platform);
        view.addCanvas3D(canvas);
    }

    private void constructShape() throws Exception {
        Fan fan = new Fan();
        Shape3D shape = new Shape3D(fan);
        Appearance a = constructAppearance();
        shape.setAppearance(a);
        geomGroup.addChild(shape);
    }

    private Appearance constructAppearance() throws Exception {
        return _useTexturedAppearance? constructTexturedAppearance(): 
constructWireframeAppearance();
    }

    private Appearance constructWireframeAppearance() {
        Appearance wireframe = new Appearance();
        PolygonAttributes polygonAttributes = new PolygonAttributes();
        polygonAttributes.setPolygonMode(PolygonAttributes.POLYGON_LINE);
        wireframe.setPolygonAttributes(polygonAttributes);
        return wireframe;
    }

    private Appearance constructTexturedAppearance() throws Exception {
        String workingDirectory = System.getProperty("user.dir");
        File file = new File(workingDirectory,"smile.png");
        JPanel observer = new JPanel();
        TextureLoader loader = new TextureLoader(file.getAbsolutePath(),observer);
        Texture texture = loader.getTexture();
        Appearance appearance = new Appearance( );
        appearance.setTexture( texture );
        TextureAttributes texAttr = new TextureAttributes();
        texAttr.setTextureMode(TextureAttributes.MODULATE);
        appearance.setTextureAttributes(texAttr);
        return appearance;
    }

    private void makeLive() {
        viewGroup.compile();
        locale.addBranchGraph(viewGroup);
        geomGroup.compile();
        locale.addBranchGraph(geomGroup);
    }

    private Transform3D constructTransform() {
        double sqrt2 = Math.sqrt(2.0);
        double sqrt0point5 = 1.0/sqrt2;
        double matrix[] = {
            sqrt0point5, -0.5, 0.5, 3.0,
            0.0, sqrt0point5, sqrt0point5, 3.0*sqrt2,
            -sqrt0point5, -0.5, 0.5, 3.0,
            0.0, 0.0, 0.0, 1.0
        };
        return new Transform3D(matrix);
    }
}

class Fan extends TriangleFanArray {
    private static final int TotalVertexCount = 10;
    private static final int[] stripVertexCounts = {TotalVertexCount};
    private static final int Flags =
            GeometryArray.BY_REFERENCE |
            TriangleFanArray.COORDINATES |
            TriangleFanArray.NORMALS |
            TriangleFanArray.TEXTURE_COORDINATE_2;
    private static final int[] TextureCoordinateSetupMap = {0};

    private double[] coords = new double[3 * TotalVertexCount];
    private float[] normals = new float[3 * TotalVertexCount];
    private float[] tcoords = new float[2 * TotalVertexCount];

    private int icoords = 0;
    private int inormals = 0;
    private int itcoords = 0;

    Fan() {
        super(TotalVertexCount,
                Flags, 1,
                TextureCoordinateSetupMap,
                stripVertexCounts);
        setCapability(GeometryArray.ALLOW_REF_DATA_READ);
        setCapability(GeometryArray.ALLOW_COORDINATE_READ);
        setCapability(GeometryArray.ALLOW_COORDINATE_WRITE);
        setCapability(GeometryArray.ALLOW_NORMAL_READ);
        setCapability(GeometryArray.ALLOW_TEXCOORD_READ);
        constructVertices();
        constructTextureCoordinates();
        constructNormals();
        setCoordRefDouble(coords);
        setNormalRefFloat(normals);
        setTexCoordRefFloat(0, tcoords);
    }

    private void constructVertices() {
        vertex(1.0,1.0,0.0);
        vertex(2.0,0.0,0.0);
        vertex(2.0,1.0,0.0);
        vertex(2.0,2.0,0.0);
        vertex(1.0,2.0,0.0);
        vertex(0.0,2.0,0.0);
        vertex(0.0,1.0,0.0);
        vertex(0.0,0.0,0.0);
        vertex(1.0,0.0,0.0);
        vertex(2.0,0.0,0.0);
    }

    private void constructTextureCoordinates() {
        texCoord(0.5,0.5);
        texCoord(0.75,0.25);
        texCoord(0.75,0.5);
        texCoord(0.75,0.75);
        texCoord(0.5,0.75);
        texCoord(0.25,0.75);
        texCoord(0.25,0.5);
        texCoord(0.25,0.25);
        texCoord(0.5,0.25);
        texCoord(0.75,0.25);
    }

    private final void constructNormals() {
        normal(1.0,1.0,1.0);
        normal(2.0,0.0,1.0);
        normal(2.0,1.0,1.0);
        normal(2.0,2.0,1.0);
        normal(1.0,2.0,1.0);
        normal(0.0,2.0,1.0);
        normal(0.0,1.0,1.0);
        normal(0.0,0.0,1.0);
        normal(1.0,0.0,1.0);
        normal(2.0,0.0,1.0);
    }

    private void vertex(double x, double y, double z) {
        coords[icoords++] = x;
        coords[icoords++] = y;
        coords[icoords++] = z;
    }

    private void normal(double x, double y, double z) {
        //System.out.println("normal("+x+","+y+","+z+");");
        normals[inormals++] = (float) x;
        normals[inormals++] = (float) y;
        normals[inormals++] = (float) z;
    }

    private void texCoord(double s, double t) {
        tcoords[itcoords++] = (float) s;
        tcoords[itcoords++] = (float) t;
    }
}

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

<<inline: smile.png>>

<<inline: smiley3d.jpg>>

<<inline: wireframe3d.jpg>>

<<inline: wrong3d.jpg>>

Reply via email to