I have encountered some troubling  behavior in Java3D beta1 on
Solaris platform(didn't test any other).  It occurs under immediate
mode in J3D and only in the new beta version: the previous
release(j3dv1.2) is working just fine.  Here are the relevant steps
that I am taking in "public void paint(Graphics g)" of subclass of
Canvas3D:
1. GraphicsContext3D.setBackground(blue)
2. J3DGraphics2D.setColor(Red)
3. J3DGraphics2D.drawRect(10, 10, 100, 100)
4. J3DGraphics2D.flush(true)

So when the program gets executed the expected result is red
rectangle on blue background.  Well, blue background is always there
but red rectangle is not.  What makes this story more interesting is
that red rectangle is not getting rendered most of the time but not
always: sometimes the program works just fine.  So if I execute the
program say 10 times, 3 of those times the program would actually
work correctly.  In the process of creating the test case, I found
out that it doesn't matter what particular method of J3DGraphics2D is
called or how many of them are there, triggering the repaint also
doesn't help.  Also I think the problem is occurring less frequently
if application runs remotely.

I guess that's all the useful info I can provide on this issue.
Below is my exact Hardware and Software configuration and the Test
program.
Any help would be greatly appreciated,

-Oleg Pariser  @  NASA-JPL Multimission Image Processing Lab
[EMAIL PROTECTED]

---Configuration----------------------------------------
Java(TM) 2 Runtime Environment, Standard Edition (build
1.4.0-rc)
Java 3D(TM) 1.3 Beta 1

FULL OPERATING SYSTEM VERSION :
SunOS monolith 5.7 Generic_106541-16 sun4u sparc
SUNW,Ultra-5_10

--TestCanvas3D.java-------------------------------------------------------------
import java.awt.*;
import java.awt.color.*;
import javax.swing.*;
import javax.vecmath.*;
import javax.media.j3d.*;
import com.sun.j3d.utils.universe.SimpleUniverse;

class TestCanvas3D extends Canvas3D {

     private GraphicsContext3D     _gc3D;
     private J3DGraphics2D         _j3DG2D;

     public TestCanvas3D()
     {
         super(GraphicsEnvironment.getLocalGraphicsEnvironment().
               getDefaultScreenDevice().getBestConfiguration(
                                              new GraphicsConfigTemplate3D()));
         //Stop the renderer, since we use immediate mode rendering.
         stopRenderer();
         // Create a simple scene and attach it to the virtual universe
         SimpleUniverse universe = new SimpleUniverse(this);

         // This will move the ViewPlatform back a bit so the
         // objects in the scene can be viewed.
         universe.getViewingPlatform().setNominalViewingTransform();
     }
     public void paint(Graphics g)
     {
         System.out.println("paint called: bounds="+g.getClipBounds());

         super.paint(g);

         if(_gc3D == null || _j3DG2D == null) {
             System.out.println("Either _gc3D or _j3DG2D are null");
             setDoubleBufferEnable(false);

             _gc3D = getGraphicsContext3D();
             _gc3D.setBufferOverride(true);
             _gc3D.setAppearance(new Appearance());
             _gc3D.setBackground(new Background(new Color3f(Color.blue)));
         }

         _gc3D.clear();
         _j3DG2D = getGraphics2D();
         _j3DG2D.flush(true);
         _gc3D.flush(true);

         _j3DG2D.setColor(Color.red);
         _j3DG2D.drawRect(10, 10, 100, 100);
         _j3DG2D.flush(true);
         _gc3D.flush(true);
         System.out.println("done with paint");
     }
     public void update(Graphics g)
     {
         paint(g);
     }
     public static void main(String[] argv)
     {
         TestCanvas3D myCanvas = new TestCanvas3D();
         JFrame jFrame = new JFrame();
         jFrame.getContentPane().setLayout(new BorderLayout());
         jFrame.getContentPane().add(myCanvas);

         jFrame.pack();
         jFrame.setTitle("TestCanvas3D");
         jFrame.setLocation(250, 200);
         jFrame.setSize(200, 300);
         jFrame.setVisible(true);
     }
}
---end of TestCanvas3D.java---------------------------------------
--

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