8.2.6 Primitives and the geometry cache The Primitive-derived
8.2.6 Primitives and the geometry cache The Primitive-derived classes use a very simplistic cache to minimize the CPU time used to create the geometry for each class. An analysis of this capability is included in appendix C. 8.3 GeomBuffer The Primitive-derived classes internally make use of the GeomBufferhelper class. This class allows geometry to be defined using an API similar to OpenGL s stateful display list geometry definition API. This capability is discussed in more detail in appendix C and may be useful for porting OpenGL programs. 8.4 Rasters java.lang.Object | +–javax.media.j3d.SceneGraphObject | +–javax.media.j3d.NodeComponent | +–javax.media.j3d.Geometry | +–javax.media.j3d.Raster The Rasterclass serves double duty in Java 3D. It can be used to either render an image into the 3D scene at a given location or to read the depth components of the 3D scene. The first application is much more common and easier to describe because it truly represents geometry definition. 8.4.1 Rendering an image using a Raster A Rasterobject can be used to simply paste a 2Dimage into the 3D view. The Rasterhas a 3D location associated with it, and this serves as the upper-left corner of the rendered image. Note however that the image for the Rasteris rendered as-is and will not have any scaling, translation, or rotation applied to it regardless of the Raster s position within the scenegraph. A Rastermight be appropriate for graphical coordinate axis labels, for example. Since Rasteris derived from Geometryit must be encapsulated by a Shape3D Nodebefore it can be added to the scenegraph. There are six basic steps to using a Raster: 1. Create the BufferedImage. 2. Read in or generate the image data. 3. Create the ImageComponent2Dto wrap the BufferedImage. 4. Create the Rasterto wrap the ImageComponent2D. 5. Create the Shape3Dto contain the Raster. 6. Add the Shape3Dto the scenegraph. For example: //create the image to be rendered using a Raster BufferedImage bufferedImage = new BufferedImage( 128, 128, BufferedImage.TYPE_INT_RGB); 116
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Java Web Hosting services