Wavefront applying a texture

Problems with Canvas, OpenGL, etc...

Wavefront applying a texture

Postby afail » Tue Jan 04, 2011 4:49 pm

Hi, I have a complex model in Wavefront format. I foundout about this example for loading OBJ files here: http://sourceforge.net/projects/objloaderforand/ (objLoader for Android) and I load the model just fine. But when the model loads, there is no texture on the model. I load the mtl file also, and it loads also fine, but I don't actually know how to apply a texture (which is 2D) over the complex 3D model loaded from Obj file? (the model is more like mountain terrain and staf).

The texture coordinates are loaded also correctly. Just don't know how to use them (there are 100s of them).

Any tip would be gladly appreciated.
Thanks in advance
afail
Developer
Developer
 
Posts: 31
Joined: Sat Oct 02, 2010 8:43 pm

Top

Re: Wavefront applying a texture

Postby afail » Wed Jan 05, 2011 3:46 pm

Ok, can you at least tell me if when I load OBJ file with some obj loader, it should show the texture as exported from Blender or I am supposed to handle this things?!
afail
Developer
Developer
 
Posts: 31
Joined: Sat Oct 02, 2010 8:43 pm

Re: Wavefront applying a texture

Postby jonbonazza » Fri Jan 07, 2011 5:44 am

When you load an OBJ file, it loads the files texture coordinates. These coordinates will determine how the texture is mapped to the model. You have to load the OBJ file into memory, then load the texture into memory, then render them together.
jonbonazza
Master Developer
Master Developer
 
Posts: 665
Joined: Thu Jul 15, 2010 2:58 pm
Location: WV USA

Re: Wavefront applying a texture

Postby afail » Mon Jan 10, 2011 8:44 am

then why is the MTL file for?
afail
Developer
Developer
 
Posts: 31
Joined: Sat Oct 02, 2010 8:43 pm

Re: Wavefront applying a texture

Postby jonbonazza » Mon Jan 10, 2011 3:34 pm

An MTL file is for the object's material. It has nothing to do with HOW the texture is mapped. it just contains information regarding the material properties of the object such as shininess, color, transparency, etc... It also contains the name of the texture file, but not how it should or shouldn't be mapped.
Look here:
http://people.sc.fsu.edu/~jburkardt/data/mtl/mtl.html
jonbonazza
Master Developer
Master Developer
 
Posts: 665
Joined: Thu Jul 15, 2010 2:58 pm
Location: WV USA

Top

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 3 guests