how to load model 3D into opengl program

37a45533a356485d9857e7f49bfef724
0
rosma 101 Feb 11, 2009 at 06:09

hye all.. please help me to teach me how to load model 3D into opengl program.. i feel excited to know about it.. to ANUDYAN, COULD U PLEASE HELP ME AND GIVE ME YOUR CODE LIKE YOU GIVE IT TO CHINGCHING? I’M APPRECIATE THAT..

12 Replies

Please log in or register to post a reply.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Feb 11, 2009 at 06:32

Who are Anudyan and Chingching? There is no one by those names on this forum.

As for loading models, if it’s in a standard format you’ll need to find a loader on the internet (or write your own if the format specification is available). What format are your models in?

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Feb 12, 2009 at 16:44

The best place to start with loading models into opengl, and also the furthest I ever got with it, is loading wavefront object models. They end in .obj. Most modelers export in this format. If you open them with a text editor they are written in plain text and the format is pretty easy to figure out, specifying faces and vertices, etc. Doing a search in Google for some like “opengl obj loader” will probably find you some examples.

37a45533a356485d9857e7f49bfef724
0
rosma 101 Feb 16, 2009 at 06:30

ok thnks a lot fireside.. can u give me a sample code or project to load the model into opengl?? i really need ur help.. thnks

3c5be51fdeec526e1f232d6b68cc0954
0
Sol_HSA 119 Feb 16, 2009 at 07:43

I think you need to do some of the work yourself if you are to learn anything.
Alternatively, download irrlicht or ogre or some other freely available engine and use their model loading functions. You won’t be using opengl directly that way, though.

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Feb 16, 2009 at 07:56

There’s some c++ code for loading obj on this page:

http://www.robthebloke.org/opengl_programming.html#5

There’s a 3ds loader here:

http://www.garagegames.com/community/resources/view/506

Like Sol HSA says, though, you’ll learn more if you write your loader and obj is pretty easy to figure out if you open the file. NEHE also has a model loading tutorial but its for milkshape 3d. The first link is a tutorial for obj files so it’s probably your best bet.

37a45533a356485d9857e7f49bfef724
0
rosma 101 Feb 18, 2009 at 14:08

@fireside

There’s some c++ code for loading obj on this page:

http://www.robthebloke.org/opengl_programming.html#5

There’s a 3ds loader here:

http://www.garagegames.com/community/resources/view/506

Like Sol HSA says, though, you’ll learn more if you write your loader and obj is pretty easy to figure out if you open the file. NEHE also has a model loading tutorial but its for milkshape 3d. The first link is a tutorial for obj files so it’s probably your best bet.

ooo really.. thnks a lot.. well, may i ask u about AUGMENTED REALITY IN EDUCATION.. actually my final year project is about ARToolkit.. so may i know how to build my own program and combine with ARToolkit? can u help me? please i really2 need your help… thnks….

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Feb 18, 2009 at 17:15

I took a quick look. It’s just c and opengl, so you should be able to load a model and display it like the tutorial for loading objects. You should be working through the tutorials for ArTool and probably ask your teacher for help if you can’t understand it. ArtTool looks like it may have model loaders, are you sure it doesn’t? If there is a forum for it, that’s the first place you should go to ask questions, rather than a general forum like this one. Otherwise it uses Glut, so just find some Glut tutorials on opengl if you can’t understand the tutorials from ArtTool. You should start by making triangles and quads and such before working on a model loader. NeHe has some opengl tutorials. From the looks of it, though, I would guess they already have a model loader set up.

37a45533a356485d9857e7f49bfef724
0
rosma 101 Feb 23, 2009 at 04:08

NeHe?? what is that?

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Feb 23, 2009 at 04:45

As a two-second Google search would have told you, it’s http://nehe.gamedev.net/

500367065665a05a847242a39a0bc69e
0
mmakrzem 101 Feb 26, 2009 at 22:37

On my website you’ll find instruction for creating a caligari COB file loader. I also show how to create your own file format. In the next little while I’ll be posting code how to load FBX files too.

37a45533a356485d9857e7f49bfef724
0
rosma 101 Mar 03, 2009 at 05:02

orait.. thnks a lot because helping me.. ermm do u know about augmented reality in education? actually my final year project is about augmented reality.. and my lecturer(supervisor) said must use ARToolkit.. do u know about ARToolkit? i want to build my own program using ARToolkit.. could u please give me some guide for build my own program?.

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Mar 03, 2009 at 19:59

I don’t know if you are having problems with Google, but I looked up the forum for you to ask questions:

http://www.hitlabnz.org/forum/forumdisplay.php?f=4

Go to the development and code sections. There are some questions about model loading there so read them and then ask for help if you don’t understand.