Sign in to follow this  

Loading .Obj into Opengl

This topic is 4196 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I think I have enough knowledge of opengl(on win32 platform) to write a very basic pong game and I wanted to be able to load my models.I've searched the web for many many hours and have come up with not much. What I am asking , please, is there anyone who can point me to a good .obj loader? my meshs are simple (I customized the paddles). Thank you who respond in advance.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
OBJ file format:

http://www.royriggs.com/obj.html

Share this post


Link to post
Share on other sites
If it's a simple pong game, do you really need models?

Anyway, I've been looking a bit, and can't really find anything good, so you should find the obj file specifications (just google it) and you should be able to find the documents on the way the obj format is laid out.

I haven't tried it myself, but I've heard that it's not particularly complicated, and if you're doing graphics, you should have had experience with file IO, so you should start writing a loader and then come to us with your questions.

Assuming you're talking about the text format and not the binary, here's something that might get you started: Fileformat.info: Wavefront OBJ

Share this post


Link to post
Share on other sites
true Endar but it would be better in the long run. Thanks, I'll go through and check it out. Just in general, doesn't it seem wierd that there is no easy load library for objects in opengl or at least some agreed apon format like direct3d has .x format. Hmm oh well and thanks :)

[Edited by - Asem on June 11, 2006 10:45:25 AM]

Share this post


Link to post
Share on other sites
GLM is a pretty good and stable library(from my experience). You're right that it's not easy to find OBJ loaders in the web, it took me almost an hour of googling to track it down.

You can build it as a .lib, but I usually just add all the files in the "/glm-0.3/glm" folder in my project, specify "/glm-0.3/glm" as an additional include directory and that's it. In case you need a quick start, an example:


//Loading the model
GLMModel* model;
model=glmReadOBJ("c:/models/airplane.obj");
glmVertexNormals(model,180.0,false);//Optional-recalculates and smooths the normals

//Drawing the model
glPushMatrix();
//transformations here...
glmDraw(model,GLM_SMOOTH|GLM_TEXTURE|GLM_MATERIAL);
glPopMatrix();








Beware: You need to use "/" and not "\\" when specifying the path for the .obj files. GLM only understands it this way.

Also, you can go and download 3DWin, which is a converter for many 3d formats, including Wavefront OBJ. So you can take a,say, .3ds file, convert it to .obj and load it using GLM.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Is there anything like GLM but for windows? I need to load obj models using openGL and I can not find something quick and easy on the web. Any help?

Thanks!

Edgar

Share this post


Link to post
Share on other sites

This topic is 4196 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this