I have a scene graph and need to label certain parts of it for the user
to see.  After trying billboards and being unsatisfied with the results,
I tried using rasters, which were much faster and looked much nicer.
However, they are suffereing from the same problem that my billboards
were - when viewed from certain angles, my labels twist to partially
embed themselves in nearby geometry.  Since these are labels and should
sit on top of any geometry, it would be nice to set the depth they write
into the depth buffer to be it's minimum.  However, no matter what data
I write into my DepthComponent, the depth written into the buffer is the
same as the raster's root position in my scene graph.

Any ideas how to get my raster to do what I want?  I've tried both
integer and float depth components.

               //Create raster image of label
               Image labelImage =
AppImageLoader.instance().getImage(AppImageLoader.IM_AUTO_REF_LOGO);
               int width = labelImage.getWidth(null);
               int height = labelImage.getHeight(null);
               BufferedImage bi = new BufferedImage(width, height,
BufferedImage.TYPE_4BYTE_ABGR);
               Graphics2D g = bi.createGraphics();
               g.drawImage(labelImage, 0, 0, null);
               g.dispose();

               ImageComponent2D ic = new
ImageComponent2D(ImageComponent.FORMAT_RGBA, bi);

               //Create foreground depth buffer
               DepthComponentFloat dc = new DepthComponentFloat(width,
height);
               float[] depthData = new float[width * height];
               for (int i = 0; i < width * height; i++)
               {
                   depthData[i] = 0f;
               }
               dc.setDepthData(depthData);

               //Build raster
               javax.media.j3d.Raster raster = new javax.media.j3d.Raster(
                   new Point3f(0f, 0f, 0f),
                   javax.media.j3d.Raster.RASTER_COLOR_DEPTH,
                   0, 0, width, height, ic, dc);
               raster.setClipMode(javax.media.j3d.Raster.CLIP_IMAGE);

Shape3D labelShape = new Shape3D(raster);


Mark McKay


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