 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Rene Tschirley Guest
|
Posted: Tue Aug 16, 2005 4:35 pm Post subject: Textured Box |
|
|
Hi!
Seems that I have been a little too euphoric when I tried to put a
texture onto one surface of a box. The result
http://lava.cs.tu-berlin.de/java/textur_muell.png
is not exactly what I expected to see. It should have been the cube with
this texture
http://lava.cs.tu-berlin.de/java/textur.png
on the front side placed on a blue background. Below is the relevant
part of the source code. I'd be very happy and thankful if anybody of
you could give me a hint and tell me what I did wrong.
Yours,
Rene
---8<---Code---
public class RotationCube extends JPanel {
...
// box erzeugen
Box box = new Box(1.0f, 1.0f, 1.0f, Box.GENERATE_TEXTURE_COORDS |
Box.GENERATE_NORMALS | Box.ENABLE_APPEARANCE_MODIFY, null);
// textur anlegen
Texture2D anteriorTexture = (Texture2D) new
TextureLoader("c:\temp\cube_anterior.png", this).getTexture();
anteriorTexture.setEnable(true);
// textur auf box bringen
Shape3D anteriorShape = box.getShape(Box.FRONT);
Appearance anteriorAppearance = anteriorShape.getAppearance();
anteriorAppearance.setColoringAttributes(new
ColoringAttributes(new Color3f(1,0,0), ColoringAttributes.NICEST));
anteriorAppearance.setTexture(anteriorTexture);
// box in den szenegraphen einbringen
transformGroup.addChild(box);
...
// szenegraphen fertig machen
sceneGraph.compile();
}
---Code--->8---
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|