Pascal, Aside from two lines being a heck of a lot easier to read and code, using TextureLoader also assures that the image loaded is properly scaled to a size that is a power of two.
- John Wright Starfire Research Pascal Vuylsteker wrote: > > When reading Sun tutorial, you often have the feeling that if you want > to use Java3D, then you absolutely need the com.sun.j3d.utils. So why on > earth aren't these classes in the official Java3D API ? > Looks like there is nothing useful for the developer in that API ;-) > > How could we be sure that those external packages (com.sun...) will be > available in all the Java3D implementations (the MacOSX one for > instance, or the next releases) ? > > On the other hand do we really need them ? > For instance what is the use of that > com.sun.j3d.utils.image.TextureLoader when it's look like all what we > need to get a javax.media.j3d.ImageComponent2D object (needed to create > a Texture object) is a buffered image which can be get by the usual > Toolkit method > > Toolkit tk = Toolkit.getDefaultToolkit(); > > img = tk.getImage("AnyImage.gif"); > > try { > MediaTracker tracker = new MediaTracker(this); > tracker.addImage(img, 0); > tracker.waitForID(0); > } > catch ( Exception e ) {} > > ImageComponent2D image = new > ImageComponent2D(ImageComponent2D.FORMAT_RGB, img); > > So, does anybody understand the interest of the following code proposed > in the tutorial ? > > TextureLoader loader = new TextureLoader("stripe.jpg", this); > ImageComponent2D image = loader.getImage(); > > -- > | Pascal Vuylsteker | 00 (61 2) 6125 8192 | mailto:[EMAIL PROTECTED] | > | URL : http://www.vuylsteker.net/ | IT Lecturer at ANU (eScience) | > > | Department of Computer Science. The Australian National University | > | Canberra, ACT 0200. Australia | > > | Home : 12 Fowles Street. Weston - Canberra. ACT 2611. Australia | > > ----------------------------------------- > La seule révolution possible, c'est d'essayer de s'améliorer soi-même, > en espérant que les autres fassent la même démarche. > Le monde ira mieux alors. [ Georges Brassens ] > > =========================================================================== > 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".