SFML community forums

Help => General => Topic started by: molmasepic on February 18, 2011, 01:55:23 am

Title: Parsing an OBJ
Post by: molmasepic on February 18, 2011, 01:55:23 am
hey ive been looking around for a while(3 days) and i cant seem to fined a good way to load my .obj mesh into my c++ game....


does anyone know how to parse an obj file or know any tutorials that can help me?


that would be very nice


what im looking for is maybe a way to get started at least(like an outline of some sort)

thanks in advance  :)
Title: Parsing an OBJ
Post by: Gibgezr on February 18, 2011, 02:24:36 am
There are literally thousands of projects floating around the web that demonstrate loading obj files to OpenGL. Try:
http://sourceforge.net/projects/objloader/
or
http://kixor.net/dev/objloader/
for example. The obj format is popular to write loaders for, because it is a very simple format to parse.
Title: Parsing an OBJ
Post by: molmasepic on February 18, 2011, 02:37:28 am
i have tried these before(for 2 hrs straight) and everything i tried ended in an undefined error...

i like this one though(http://kixor.net/dev/objloader/)


what should i be linking in this? ._.


also i want it where i dont have these files in my directory...

is that even possible?

if not then ill *sigh* deal with it


EDIT: tried putting in the directory, didnt work >_<


this works: objLoader *World = new objLoader();
then i get undefined for: World->load("test.obj");

the error says: |undefined reference to `objLoader::load(char*)'|

im not delaying my project for another day........
Title: Parsing an OBJ
Post by: Nexus on February 18, 2011, 09:37:47 am
Did you link the libraries?
Title: Parsing an OBJ
Post by: molmasepic on February 19, 2011, 06:44:28 am
hey im using Perl to convert my obj files so thats not a problem.


BUT

when loading the model, i cant see it ._.


these are what i have used for this

// set input data to arrays
glVertexPointer(3, GL_FLOAT, 0, WorldMap3Dv1Verts);
glTexCoordPointer(2, GL_FLOAT, 0, WorldMap3Dv1TexCoords);

// draw data
glDrawArrays(GL_TRIANGLES, 0, WorldMap3Dv1NumVerts);


also
glEnable(GL_VERTEX_ARRAY);

is there something else im missing?

also i know that its loading because it slows everything down once i enabled
Title: Parsing an OBJ
Post by: Mars_999 on March 20, 2011, 09:08:09 pm
Why not look into ASSIMP?

It loads a billion different formats.... Unless you want to learn how to load an .obj which in that case get ready to struggle a bit until you figure it out. I am assuming you just want to load a mesh.

http://assimp.sourceforge.net/