Hello Guest

OBJ loader

  • 2 Replies

Offline siD

  • *
  • 1
OBJ loader
« on: January 11, 2015, 08:12:21 »

I have been having problems loading .obj in to my project.
I'm using the model loader as used here: https://www.youtube.com/watch?v=izKAvSV3qk0
and it works great until the models have textures. I have tried to use the createTexturedDisplayList() and loadTexturedModel() methods thought they have just given my really weird shapes and no visible texture.
This is the only thing I could find on .obj files: http://wiki.lwjgl.org/index.php?title=Importing_Blender_Models_%28.obj%29_to_LWJGL and it is not much use.

How would I use texture obj models and does any one have a loader that works with them?

thanks in advance,


Offline abcdef

  • ****
  • 335
Re: OBJ loader
« Reply #1 on: January 11, 2015, 13:30:41 »
Not really much to go on as you haven't actually posted any of your own code. Some questions for you

1) Have you written anything before that loads a texture and displays that in opengl? If the answer is no, go do this so you understand what to do (There are plenty of tutorials on how to do this), if yes then use this as a working example
2) Do you understand the the .obj file format? Its quite simple (https://en.wikipedia.org/wiki/Wavefront_.obj_file), if you have some example code that loads textures successfully in opengl then you just need to map everything from .obj file format to the way you drew it befoew

Re: OBJ loader
« Reply #2 on: January 15, 2015, 11:14:05 »
Hello @siD,

I wrote my an obj reader for my own engine based off that same video, and haven't had any issues.

Could you at the very least post a screen shot of this "really weird shapes and no visible texture" and possibly the .obj file?

Your comment leads me to believe that it has incorrectly parsed the obj file, the vertex ordering sounds wrong, that's what usually gives you a weird pointy model.

Also, is the model your own or one you have exported your self? With blender you have to make sure to check all the right settings before exporting ("include normals" and "include uvs")