Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Java 3D / August 2004

Tip: Looking for answers? Try searching our database.

Texture is not matched to the geometry after transformations

Thread view: 
James - 12 Aug 2004 05:36 GMT
Hi,

I create a triangle and set the texture coordinate. Then I put the
texture on it. However, after I do a transformation, the triangle is
transformed and the texture is not tranformed following the triangle.
Is there anybody can tell me how to bind the texture with the triangle
together? Do I need to transform the texture? I guess the problem is
in the method to create the appearance.

The following is my code to create the appearance:

   private void createAppearance() {
   Appearance app = new Appearance();
   
   // blended transparency so texture can be irregular
   TransparencyAttributes tra = new TransparencyAttributes();
   tra.setTransparencyMode(TransparencyAttributes.BLENDED);
   app.setTransparencyAttributes(tra);

   // mix the texture and the material colour
   TextureAttributes ta = new TextureAttributes();
   ta.setTextureMode(TextureAttributes.MODULATE);
   app.setTextureAttributes(ta);
   
   // load and set the texture
//    System.out.println("Loading textures from " + TEX_FNM);
   TextureLoader loader = new TextureLoader(TEX_FNM, null);
   Texture2D texture = (Texture2D) loader.getTexture();
   app.setTexture(texture);      // set the texture

   Material mat = new Material(.....);
   mat.setLightingEnable(true);
   app.setMaterial(mat);
   
   setAppearance(app);
   }

Thank you in advance!
Looking forward to hearing from you!

Regards,

James
BADBOY - 24 Aug 2004 23:51 GMT
Hi, I suspect the problem lies within the texture coordinates of the
GeometryArray.
J3d has been put to 1 side for a while for me so cant remember explicitly
what todo,
Have a look at the source for TextureCoordinateGenerator and particularly
the texture stuff in LWLoader source
thats how i originally got my head round texture coordinates.

hope that helps
John

> Hi,
>
[quoted text clipped - 39 lines]
>
> James
BADBOY - 26 Aug 2004 23:14 GMT
More specifically it sounds like u are using automitac
TextureCoordinateGenerator and
hav set EYE_LINEAR as thats exactly what thats meant todo.

> Hi, I suspect the problem lies within the texture coordinates of the
> GeometryArray.
[quoted text clipped - 55 lines]
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.