Hi

I've still problems with my ZBuffer. I have extended
Canvas3D with my own subclass. But everytime I
call readRaster and get the DepthComponent it
contains only zeros. It doesn't matter if I call
it after postRender() or postSwap(). Here's my
source

public class ExtCanvas3D extends Canvas3D {

  private Raster zRaster;
  private DepthComponentFloat zDepth;
  private float[] bufferZ = new float[640*480];
  private ImageComponent2D imageComp;


  public ExtCanvas3D(java.awt.GraphicsConfiguration
                     graphicsConfiguration) {
    super(graphicsConfiguration);
    zRaster = new Raster();
    zDepth  = new DepthComponentFloat(640,480);
    zRaster.setDepthComponent(zDepth);
    ImageComponent2D imageComp =
       new ImageComponent2D(ImageComponent2D.FORMAT_RGB,
                            new BufferedImage(640, 480, BufferedImage.TYPE_INT_BGR));

    zRaster.setImage(imageComp);
  }

  public ExtCanvas3D(java.awt.GraphicsConfiguration graphicsConfiguration,
                     boolean offScreen) {

    super(graphicsConfiguration,offScreen);
  }

  public void postRender() {
    this.getGraphicsContext3D().readRaster(zRaster);
    zDepth.getDepthData(bufferZ);
    for (int y=0; y<480; y++)
      for (int x=0; x<640; x++)
        System.out.println(bufferZ[x+y*640]);
  }

}


--
Jmark2k+1 (http://www.antiflash.net/jmark)
Test the performance of your PC online!

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