Author Topic: Texturing Object3D objects made using addTriangle() method  (Read 2467 times)

Offline AcidBurnz

  • byte
  • *
  • Posts: 6
    • View Profile
Texturing Object3D objects made using addTriangle() method
« on: January 07, 2008, 05:35:55 am »
In the map editor we're working on, the terrain is loaded via heightmaps (binary file) and inserted into an instance of Object3D called terrain via the addTriangle method. Now in order to texture it, I've followed exactly how the 3ds terrain was textured in the car benchmark demo source (Cartest.java). The texture itself is a 128x128 jpg, and it's being loaded fine. I've added it to the texture manager, then added the texture to the terrain via setTexture method. Still nothing is happening.

My guess is that it has something to do with texture coordinates? Is it even possible to texture a mesh created with addTriangles? Thanks for the help in advance.

http://pastebin.com/m849de17 <-- HeightMap.java
http://pastebin.com/m1d208e45 <-- MapEditor.java (contains main method)

ps- I deleted my other thread by accident, the one about camera vectors, is it possible to bring it back?  :o

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
Re: Texturing Object3D objects made using addTriangle() method
« Reply #1 on: January 07, 2008, 12:36:28 pm »
addTriangle(...) exists as a variant that takes texture coordinates, either directly or via a TextureInfo. Without that, the coordinates are always 0/0, which is why setting the texture via setTexture has no or at least not the desired effect.

Sorry about the deleted thread, but there seems to be no way to get it back. At least i can't find one in the forum's admin section.

Offline AcidBurnz

  • byte
  • *
  • Posts: 6
    • View Profile
Re: Texturing Object3D objects made using addTriangle() method
« Reply #2 on: January 07, 2008, 02:42:03 pm »
Thanks for the quick reply. I'll attempt using that info, and post back with my findings :D

Cheers!