I occured the same program on Java3D 1.1 but I solved the problem.
I see your program some lines should modify according the follow.
original line
Texture tex = new TextureLoader("apimage.jpg", this).getTexture();
The line should modify follow it more well.
Appearance app = new Appearance();
Image image = null;
image = this.getImage(this.getCodeBase(),filename);
MediaTracker mt = new MediaTracker(this);
mt.addImage(image, 0);
mt.checkAll(true);
try { mt.waitForID(0); }
catch (InterruptedException e) { e.printStackTrace(); }
TextureLoader texloader = new TextureLoader(image, this);
app.setTexture(texloader.getTexture());
Must wait the jpg file read all right.The texture only can use.
Hope to help with you
Chen Lu
----- Original Message -----
$BAw?.<T (B : Julian Scheid <[EMAIL PROTECTED]>
$B08@h (B : <[EMAIL PROTECTED]>
$BAw?.F|;~ (B : 2000 $BG/ (B 1 $B7n (B 30 $BF| (B $BF|MKF| (B $B8aA0 (B 08:49
$B7oL> (B : [JAVA3D] Please help - cannot get Textures to work in Immediate Mode
> Hello folks,
>
> Summarized, my problem is: I do not get Textures to work in Immediate
Mode, whatever I try.
>
> The problem occurs with Java3D 1.2 Beta 1 under JDK 1.2.2 on Windows 98.
>
> The "TextureTest" example works fine on my system, but when I try to adapt
the Appearance setup from TextureImage and put it into the PureImmediate
Example (a code snippet is included at the end of this text.), the geometry
isn't texture mapped as I would expect.
>
> Instead I see only a white rectangle. I already tried a lot: putting
lights into the scene, attaching ColoringAttributes and
TransparencyAttributes to the Appearance object, selecting different image
types as source for the Texture, explicitly calling setEnable() on the
Texture and so on - nothing helps.
>
> Is there some "main switch" for texturing support that I need to enable
when using immediate mode and that I have overlooked so far?
>
> Thanks for you advice.
>
> -- Julian Scheid
>
> Code snippet follows:
> <hr>
> <pre>
>
> class ImmediateTexture {
>
> // ...
>
> Geometry testGeom=null;
> GraphicsContext3D gc=null;
> Appearance app=null;
>
> public void render() {
>
> // Setup stuff on first call to render()
> if (gc == null) {
> gc = canvas.getGraphicsContext3D();
>
> app = new Appearance();
> Texture tex = new TextureLoader("apimage.jpg", this).getTexture();
> app.setTexture(tex);
> TextureAttributes texAttr = new TextureAttributes();
> texAttr.setTextureMode(TextureAttributes.REPLACE);
> app.setTextureAttributes(texAttr);
>
> testGeom = new Box(80.f, 80.f, 80.f,
> Box.GENERATE_TEXTURE_COORDS|Box.GENERATE_NORMALS, app)
> .getShape(Box.FRONT).getGeometry();
>
> gc.setAppearance(app);
> }
>
> // Draw stuff and swap buffers
> gc.clear();
> gc.setModelTransform(cmt);
> gc.setAppearance(app);
> gc.draw(testGeom);
> canvas.swap();
> }
>
> // ...
> }
> </pre>
> <hr>
>
>
===========================================================================
> 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".
>
===========================================================================
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".