Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (523)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (592)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / Java 3D / Re: Texture Nightmare on: 2005-02-03 13:32:39
Thanks Mike!

I kinda think (?  Smiley ) I know what you're getting at, but I'm not sure how to work it in (been trying all morning) so I will post some code and if you can give me some pointers I would be most grateful.

BoundingBox boundBox = new BoundingBox(shape.getBounds());
         System.out.println("BOUNDING BOX = " + boundBox);
         Point3d lower = new Point3d();
         Point3d upper = new Point3d();
         boundBox.getLower(lower);
         boundBox.getUpper(upper);
   
              float width = (float)(upper.x - lower.x);
         float height = (float)(upper.y - lower.y);
               float depth = (float)(upper.z - lower.z);
     
                 RenderingAttributes ra = new RenderingAttributes();
             ra.setDepthBufferEnable(true);
         ra.setIgnoreVertexColors(true);
   
         PolygonAttributes pa = new PolygonAttributes();
             pa.setCullFace(PolygonAttributes.CULL_NONE);
         pa.setPolygonMode(pa.POLYGON_FILL);
         
         

   
         TextureLoader texLoader = new TextureLoader( image,null );
                 texture = (Texture2D) texLoader.getTexture();
                 texture.setEnable(true);
   
          TextureAttributes ta = new TextureAttributes();
     ta.setTextureMode(ta.MODULATE);
     Transform3D trans = new Transform3D( );
     trans.setScale( 1.0 );
     ta.setTextureTransform( trans );
         
     // Setup the automatic texture coordinate generation

     Vector4f planeS = new Vector4f( (float)(1.0/width), 0.0f, 0.0f, (float)(-lower.x/width));
     Vector4f planeT = new Vector4f( 0.0f, (float)(1.0/height), 0.0f, (float)(-lower.y/height));  
     TexCoordGeneration texCoord = new TexCoordGeneration(
        TexCoordGeneration.TEXTURE_COORDINATE_2, TexCoordGeneration.OBJECT_LINEAR, planeS, planeT);
           
                 Material material = new Material();
     material.setLightingEnable(true);

     material.setEmissiveColor(5,5,5);
           
     Appearance a = new Appearance();
             a.setRenderingAttributes(ra);
             a.setPolygonAttributes(pa);
     a.setTexture(texture);
     a.setTextureAttributes(ta);
     a.setMaterial(material);
     a.setTexCoordGeneration(texCoord);
             
     // set up
     shape.setAppearance(a);

I hope thats clear
2  Game Development / Newbie & Debugging Questions / Texture Nightmare on: 2005-02-02 17:06:51
Hi

I am moderately new to Java3D and have like most other people delved into the world of terrain generation. My problem lies with texture mapping my generated terrain. I have been through the many tutorials on offer via Sun and Java world and can tile textures fairly ok, but what I want to do is drape a single texture over the whole terrain like a blanket which for some reason I can not do.

The size of the world I am trying to texture ranges from  
-64 to 64 on the x and z axis and the y axis varies from 0 to 10. Therefore obviously I want the bottom left of the world to correlate with the bottom left of the loaded texture, the bottom right to the bottom right of the texture and so on. Is it possible to stretch a texture in this way and if so how? I would be most grateful if you could help as I have been trying to do this for a very long time and now beginning to get a little frustrated.
3  Java Game APIs & Engines / Java 3D / Texture Nightmare on: 2005-02-02 13:14:23
Hi

I am moderately new to Java3D and have like most other people delved into the world of terrain generation. My problem lies with texture mapping my generated terrain. I have been through the many tutorials on offer via Sun and Java world and can tile textures fairly ok, but what I want to do is drape a single texture over the whole terrain like a blanket which for some reason I can not do.

The size of the world I am trying to texture ranges from
-64 to 64 on the x and z axis and the y axis varies from 0 to 10. Therefore obviously I want the bottom left of the world to correlate with the bottom left of the loaded texture, the bottom right to the bottom right of the texture and so on. Is it possible to stretch a texture in this way and if so how? I would be most grateful if you could help as I have been trying to do this for a very long time and now beginning to get a little frustrated.
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

SHC (24 views)
2014-11-25 12:00:59

SHC (24 views)
2014-11-25 11:53:45

Norakomi (22 views)
2014-11-25 11:26:43

Gibbo3771 (22 views)
2014-11-24 19:59:16

trollwarrior1 (36 views)
2014-11-22 12:13:56

xFryIx (74 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50

digdugdiggy (46 views)
2014-11-12 21:10:15

digdugdiggy (41 views)
2014-11-12 21:09:33

kovacsa (69 views)
2014-11-07 19:57:14
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!