Author Topic: How to load texture inside file .obj.  (Read 223 times)

Offline tinhtinhcd

  • byte
  • *
  • Posts: 16
    • View Profile
How to load texture inside file .obj.
« on: May 19, 2017, 10:57:40 am »
Hi,

My app load object from file .obj.
Inside the .obj also contain texture

Code: [Select]
vt  1.000000 0.011329 0.000000
vt  1.000000 0.011329 0.000000
vt  1.000000 0.024390 0.000000
vt  1.000000 0.024390 0.000000
vt  1.000000 0.024390 0.000000
vt  1.000000 0.975610 0.000000
vt  1.000000 0.975610 0.000000


how can i load that texture.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net

Offline tinhtinhcd

  • byte
  • *
  • Posts: 16
    • View Profile
Re: How to load texture inside file .obj.
« Reply #2 on: May 22, 2017, 05:02:07 am »
Hi,

I don't get it, in that example need to create a texture from a png file.
Code: [Select]
Texture skinTex=new Texture("textures/dogtex.png");But I don't have that .png file, I only have the .obj.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: How to load texture inside file .obj.
« Reply #3 on: May 22, 2017, 10:02:35 am »
OBJ file are ASCII files. They don't contain any texture data. They contain texture coordinates, but these are just pointers into a texture. You have the provide the texture file somehow.

Offline tinhtinhcd

  • byte
  • *
  • Posts: 16
    • View Profile
Re: How to load texture inside file .obj.
« Reply #4 on: May 22, 2017, 11:28:12 am »
Thanks EgonOlsen,

It is first time I work with 3D object, so I don't know it.