Hi

Is there a way to change pixels in the color buffer after rendering
the scene. I've got a raster which I use inside a subclass of Canvas3D
with getGraphicsContext3D().read

I can get the Depth data and the ImageComponent2D. But when I return
the BufferedImage from the ImageComponent2D and try
setRGB(x,y,rgbvalue) on it nothing happens.
Doesn't matter if it's in postRender() or postSwap() both have no
effect. The BufferedImage is set by Reference in the ImageComponent2D

Here are the lines I'm using:

  public void postRender() {
    if (readRaster != null) {
     synchronized(readRaster) {
       this.getGraphicsContext3D().readRaster(readRaster);
     }
     int xsize = this.getSize().width;
     int ysize = this.getSize().height;
     float depthBuffer[] = new float[xsize*ysize];
     BufferedImage bImage = readImageComponent.getImage();
     depthComponent.getDepthData(depthBuffer);
      for (int y=0; y<ysize; y++)
        for (int x=0; x<xsize; x++) {
          int color = (255 << 8)+255;
          bImage.setRGB(x,y,color);
        }
    }
  }

  public void postSwap() {
    if (readRaster != null) {
     synchronized(readRaster) {
       this.getGraphicsContext3D().readRaster(readRaster);
     }
     int xsize = this.getSize().width;
     int ysize = this.getSize().height;
     float depthBuffer[] = new float[xsize*ysize];
     BufferedImage bImage = readImageComponent.getImage();
     depthComponent.getDepthData(depthBuffer);
      for (int y=0; y<ysize; y++)
        for (int x=0; x<xsize; x++) {
          int color = (255 << 8)+255;
          bImage.setRGB(x,y,color);
        }
    }
  }


And readRaster and ImageComponent2D are initialized
following:

BufferedImage bImage =
 new  BufferedImage(width,height,java.awt.image.
                    BufferedImage.TYPE_4BYTE_ABGR);

readImageComponent =
  new ImageComponent2D(ImageComponent.FORMAT_RGB,
                       bImage,true,false);

depthComponent = new DepthComponentFloat(width,height);

readRaster = new Raster(new Point3f(-1.0f,-1.0f,-1.0f),
                        Raster.RASTER_COLOR_DEPTH,0, 0,
                        width,height, readImageComponent,
                        depthComponent);

Help would be really appreciated.

EOF,
 J.D.

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