List of usage examples for javax.media.j3d Texture RGBA
int RGBA
To view the source code for javax.media.j3d Texture RGBA.
Click Source Link
From source file:ImageComponentByReferenceTest.java
public BranchGroup createSceneGraph() { objRoot = new BranchGroup(); objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE); objTrans.setCapability(Group.ALLOW_CHILDREN_WRITE); objRoot.addChild(objTrans);// w w w.j ava 2s . c om BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0); app.setCapability(Appearance.ALLOW_TEXTURE_WRITE); textureCube = new Box(0.4f, 0.4f, 0.4f, Box.GENERATE_TEXTURE_COORDS | Box.GENERATE_NORMALS, app); boxShape = textureCube.getShape(Box.FRONT); boxShape.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE); objTrans.addChild(textureCube); checkBoard = new TiledImage(); TextureLoader texLoader = new TextureLoader(texImage, this); ImageComponent2D oneImage = texLoader.getImage(); bImage1 = oneImage.getImage(); int index = 0; image[index++] = new ImageComponent2D(oneImage.getFormat(), (RenderedImage) bImage1, false, true); image[index++] = new ImageComponent2D(oneImage.getFormat(), (RenderedImage) bImage1, true, true); image[index++] = new ImageComponent2D(oneImage.getFormat(), (RenderedImage) bImage1, false, false); image[index++] = new ImageComponent2D(oneImage.getFormat(), (RenderedImage) bImage1, true, false); createRaster(objRoot); image[index++] = new ImageComponent2D(ImageComponent.FORMAT_RGBA, checkBoard, false, true); image[index++] = new ImageComponent2D(ImageComponent.FORMAT_RGBA, checkBoard, true, true); image[index++] = new ImageComponent2D(ImageComponent.FORMAT_RGBA, checkBoard, false, false); image[index++] = new ImageComponent2D(ImageComponent.FORMAT_RGBA, checkBoard, true, false); texOne = new Texture2D(Texture.BASE_LEVEL, Texture.RGBA, image[2].getWidth(), image[2].getHeight()); texOne.setCapability(Texture.ALLOW_IMAGE_WRITE); texOne.setImage(0, image[2]); app.setTexture(texOne); texCheckBoard = new Texture2D(Texture.BASE_LEVEL, Texture.RGBA, image[4].getWidth(), image[4].getHeight()); texCheckBoard.setCapability(Texture.ALLOW_IMAGE_WRITE); objRoot.compile(); return objRoot; }
From source file:BooksDemo.java
private Appearance createTexture(String fileName) { Image sourceImage = UIHelper.readImage(fileName); if (sourceImage == null) System.out.println("Image could not be loaded from " + fileName); TextureLoader loader = new TextureLoader(sourceImage, this); ImageComponent2D image = loader.getImage(); if (image == null) System.out.println("Texture could not be loaded from " + fileName); Texture2D texture = new Texture2D(Texture.BASE_LEVEL, Texture.RGBA, image.getWidth(), image.getHeight()); texture.setImage(0, image);/*from ww w. jav a 2 s. c o m*/ texture.setEnable(true); texture.setMagFilter(Texture.BASE_LEVEL_LINEAR); texture.setMinFilter(Texture.BASE_LEVEL_LINEAR); Appearance appearance = new Appearance(); PolygonAttributes polyAttributes = new PolygonAttributes(PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_NONE, 0f); appearance.setPolygonAttributes(polyAttributes); appearance.setTexture(texture); TextureAttributes textureAttributes = new TextureAttributes(); appearance.setTextureAttributes(textureAttributes); return appearance; }
From source file:AppearanceTest.java
protected NodeComponent createComponent() { TextureLoader texLoader = new TextureLoader("texture00.jpg", m_Component); ImageComponent2D image = texLoader.getImage(); Texture2D tex2D = new Texture2D(Texture.MULTI_LEVEL_MIPMAP, Texture.RGBA, image.getWidth(), image.getHeight());//from w ww . java 2s. c o m for (int n = 0; n <= 6; n++) { texLoader = new TextureLoader("texture0" + n + ".jpg", m_Component); tex2D.setImage(n, texLoader.getImage()); } return (NodeComponent) tex2D; }