Hi John,

   We can reproduce the problem and bug 4433400 is filed
for this.

Thanks for your bug report.

- Kelvin
-------------
Java 3D Team
Sun Microsystems Inc.

>X-Unix-From: [EMAIL PROTECTED]  Tue Apr  3 10:04:56 2001
>X-Accept-Language: en
>MIME-Version: 1.0
>X-OriginalArrivalTime: 03 Apr 2001 17:03:31.0031 (UTC) FILETIME=[02726E70:01C0BC60]
>Date: Tue, 3 Apr 2001 18:03:59 +0100
>From: John Davies <[EMAIL PROTECTED]>
>Subject: [JAVA3D] Bug/problem with OrientedShape3D with Offscreen rendering
>To: [EMAIL PROTECTED]
>
>We're using an off screen buffer and have several simple shapes identified but
>text names using Text3D. In order to keep the text in the correct orientation
>we've used OrientedShape3D.
>
>This has worked fine up until the point we actually used the Off screen buffer.
>The text itself doesn't seem to scale with the other shapes.
>
>Below is a simple example, simply enter a scaling factor in the dialog
>(0.something to about 10 should work fine) and view the result. The Sphere
>scales but the Text does not.
>
>There is a SHOW_BUG boolean you can switch in the code to demonstrate what we
>expect to happen.
>
>Comments would be welcome.
>
>-John Davies-
>
>-------------------------------- BugPanel.java --------------------
>import java.awt.event.*;
>import java.awt.image.*;
>import java.awt.*;
>import javax.swing.*;
>import com.sun.j3d.utils.geometry.*;
>import com.sun.j3d.utils.universe.*;
>import javax.media.j3d.*;
>import javax.vecmath.*;
>
>/**
> * Copyright (c) 2001 Century 24 Solutions Ltd.
> *
> * www.c24solutions.com
> * Suite 10
> * Three Tuns House
> * 109 Borough High Street
> * London, SE1 1NL
> *
> * Tel: +44 (0)20 7744 6220
> *
> * Simon Heinrich
> * [EMAIL PROTECTED]
> *
> * 3rd April 2001
> */
>public class BugPanel extends JPanel implements ActionListener
>{
>    private static final boolean SHOW_BUG = true;
>
>    private static final int WIDTH = 640;
>    private static final int HEIGHT = 480;
>    private static final Color3f RED = new Color3f(1.0f, 0.0f, 0.0f);
>    private static final Color3f WHITE = new Color3f(1.0f, 1.0f, 1.0f);
>    private static final Color3f BLACK = new Color3f(0.0f, 0.0f, 0.0f);
>
>    private SimpleUniverse universe;
>    private BoundingSphere bounds;
>    private BranchGroup objRoot;
>    private JLabel label;
>    private Canvas3D canvas;
>    private TransformGroup textTG;
>    private TransformGroup sphTG;
>
>    public BugPanel()
>    {
>        initGUI();
>        addSceneGraph();
>
>        canvas.renderOffScreenBuffer();
>    }
>
>    private void initGUI()
>    {
>        GraphicsConfiguration config =
>SimpleUniverse.getPreferredConfiguration();
>        canvas = new Canvas3D(config, true)
>        {
>            public void postSwap()
>            {
>                label.setIcon(new
>ImageIcon(canvas.getOffScreenBuffer().getImage()));
>            }
>        };
>
>        BufferedImage offScreenImg = new BufferedImage(WIDTH, HEIGHT ,
>                                               BufferedImage.TYPE_INT_RGB);
>        ImageComponent2D buffer = new
>ImageComponent2D(ImageComponent.FORMAT_RGB, offScreenImg);
>        buffer.setCapability(ImageComponent2D.ALLOW_IMAGE_READ);
>        canvas.setOffScreenBuffer(buffer);
>        canvas.getScreen3D().setSize(new Dimension(1280, 1024));
>        canvas.getScreen3D().setPhysicalScreenWidth(0.36124);
>        canvas.getScreen3D().setPhysicalScreenHeight(0.28899555);
>
>        bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
>
>        objRoot = new BranchGroup();
>        objRoot.setCapability(Group.ALLOW_CHILDREN_EXTEND);
>
>        // Set up background
>        Background background = new Background(0.0f, 0.0f, 0.0f);
>        background.setApplicationBounds(bounds);
>        objRoot.addChild(background);
>
>        // Set up lighting
>        DirectionalLight dLgt = new DirectionalLight(true, new Color3f(0.8f,
>0.8f, 0.8f), new Vector3f(0.5f, -0.2f, -1.0f));
>        dLgt.setInfluencingBounds(bounds);
>        objRoot.addChild(dLgt);
>
>        // Set up universe
>        universe = new SimpleUniverse(canvas);
>        universe.getViewingPlatform().setNominalViewingTransform();
>
>universe.getViewer().getView().setProjectionPolicy(javax.media.j3d.View.PARALLEL_PROJECTION);
>
>        universe.addBranchGraph(objRoot);
>
>        label = new JLabel();
>
>        this.setLayout(new BorderLayout());
>        this.add(label, BorderLayout.CENTER);
>    }
>
>    private void addSceneGraph()
>    {
>        BranchGroup bg = new BranchGroup();
>        TransformGroup tg = new TransformGroup();
>
>        TransformGroup state = new TransformGroup();
>
>        //Text
>        Transform3D textT3D = new Transform3D();
>        textT3D.setScale(1.0);
>        textTG = new TransformGroup(textT3D);
>        textTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
>        textTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
>
>        Font3D f3d = new Font3D(new Font("Comic Sans MS", Font.PLAIN, 1), new
>FontExtrusion());
>        Text3D txt = new Text3D(f3d, "x");
>
>        Material redMaterial = new Material(RED, BLACK, RED, WHITE, 128.0f);
>        redMaterial.setLightingEnable(true);
>        Appearance redAppearance  = new Appearance();
>        redAppearance.setMaterial(redMaterial);
>
>        if (SHOW_BUG)
>        {
>            OrientedShape3D textShape = new OrientedShape3D(txt, redAppearance,
>OrientedShape3D.ROTATE_ABOUT_AXIS, new Vector3f( 0.0f, 1.0f, 0.0f));
>            textTG.addChild(textShape);
>        }
>        else
>        {
>            Shape3D textShape = new Shape3D(txt, redAppearance);
>            textTG.addChild(textShape);
>        }
>
>        state.addChild(textTG);
>
>        //Sphere
>        Transform3D sphT3D = new Transform3D();
>        sphT3D.setScale(1.0);
>        sphTG = new TransformGroup(sphT3D);
>        sphTG.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
>        sphTG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
>
>        Sphere sphShape = new Sphere(0.05f, Sphere.GENERATE_NORMALS |
>Sphere.GENERATE_TEXTURE_COORDS | Sphere.ENABLE_GEOMETRY_PICKING |
>Sphere.ENABLE_APPEARANCE_MODIFY, 15, redAppearance);
>        sphTG.addChild(sphShape);
>
>        state.addChild(sphTG);
>
>        tg.addChild(state);
>
>        bg.addChild(tg);
>        objRoot.addChild(bg);
>    }
>
>    public void actionPerformed(ActionEvent e)
>    {
>        double scale = new Double(JOptionPane.showInputDialog(this, "Enter scale
>ratio (0.001 - 10.000):")).doubleValue();
>        System.out.println("Setting scale to: "+scale);
>        Transform3D t3d = new Transform3D();
>
>        // Scale text
>        textTG.getTransform(t3d);
>        t3d.setScale(scale);
>        textTG.setTransform(t3d);
>
>        // Scale sphere
>        sphTG.getTransform(t3d);
>        t3d.setScale(scale);
>        sphTG.setTransform(t3d);
>
>        System.out.println("Rendering off screen buffer");
>        canvas.renderOffScreenBuffer();
>    }
>
>    public static void main(String args[])
>    {
>        JFrame f = new JFrame();
>        BugPanel bugPanel = new BugPanel();
>        f.getContentPane().add(bugPanel);
>
>        JToolBar toolBar = new JToolBar();
>        JButton refresh = new JButton("Change scaling");
>        refresh.addActionListener(bugPanel);
>        toolBar.add(refresh);
>
>        f.getContentPane().add(toolBar, BorderLayout.NORTH);
>
>        f.setSize(bugPanel.WIDTH, bugPanel.HEIGHT);
>        f.setVisible(true);
>        System.out.println("Ready...");
>    }
>}

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