OpenGL + Loading 3ds models

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
Spikey
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 98
Joined: Sat Dec 13, 2008 6:39 am
Programming Language of Choice: C++
Location: Ottawa, Canada
Contact:

OpenGL + Loading 3ds models

Post by Spikey »

I need to find a library or something that will load 3d models into a win32 opengl scene. I have found tutorials and such for milkshape, obj, 3ds, md2, asc, and some other uncommon ones. I just need to load a model with numerous textures, and maybe materials and groups. I don't need animations or any other fancy bull. Although lightmaps would probably be cool... But I can live without it. Mainly just need a model with a bunch of textures and a format that is common enough for artists to easily export to.

My search continues, and I'll keep weeding them out until I can get one to work properly, unfortunely many libraries are like a decade old and can cause problems. I'm wondering if anyone knows of any *secret kick ass* libraries, or has gone through this gauntlet before and found a decent library or experience...

At the moment I have a 3ds loader from http://www.morrowland.com It was working for me a while ago when I had VS2003, but now I'm getting linker errors and such. Missing libc.lib, yada yada. The battle continues, I'm going to try to get this 3ds loader back working, if not, then I'm not sure which format I should try next, I might give obj another shot. If that fails, then maybe .ms3d, haven't tried that one before.

Besides from that I just want to rant how even though you might have a loader, it can be difficult, because different programs export to different versions of the format you're loading, which has caused problems. grrrr [/rant]

[EDIT]

A little update. Using Apron's 3ds loader, had to switch stdafx.h's to windows.h and since I'm not using GLuax, I had to get a simple replacement, which I found here http://www.gamedev.net/community/forums ... _id=275238. This is still temporary, because I don't actually want to use bitmaps as textures, and I just want this thing working at least.

Then I was getting errors for missing libc.lib, tracked it down to the jpeg library, so I removed the jpeg stuff. Error gone, the 3ds loader can still load bitmaps, so I will try that before I actually link to my texture manager. Also for notes, libc.lib is no longer available in visual studio 2008, so either you can try finding it, or if you have the source for the dependant library you can recompile it in 2008 to fix problem, but since jpeg.lib here doesnt have source, you'll have to scratch that.

Then I was getting this error ""Run-Time Check Failure #2 - Stack around the variable 'version' was corrupted"". Originally the version was stored as an unsigned short, changing that to an unsigned int helped. Was getting error on chunk 0x4D4D aka Main, just ignore it. The following code explains more how to ignore that plus more.
http://www.codeguru.com/forum/archive/i ... 16477.html

Now I can get 3ds models to load with numerous objects, materials and textures, it seems the worst is over.....
Also I don't know this is because of the 3ds format or bitmaps, but it seems your texture filenames have to be equal or less than 8 characters long...
And also, take note, that 3D Studio Max's top view is OpenGL's front view!

I guess I'm writing my progress for others to read in case they need any help. Some of my classmates were having difficulties with 3ds and took the obj, or md2 formats. I mean this would've saved me time a few hours ago...

Also here's another page that explains the insides of the 3ds format for reference.
http://www.spacesimulator.net/tut4_3dsloader.html
Last edited by Spikey on Sat Mar 28, 2009 10:05 am, edited 8 times in total.
User avatar
Spikey
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 98
Joined: Sat Dec 13, 2008 6:39 am
Programming Language of Choice: C++
Location: Ottawa, Canada
Contact:

Re: OpenGL + Loading models

Post by Spikey »

[edit] oops double post :nono:
OverlordYertle
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 12
Joined: Fri Mar 06, 2009 8:42 pm
Favorite Gaming Platforms: Dreamcast
Programming Language of Choice: C++

Re: OpenGL + Loading 3ds models

Post by OverlordYertle »

for 3d i really liked irrlicht. It loads a lot but i think it may be too much for what you want? It's kind of like SDL, it has window creation and all that.
but it's really fast and well done, with lighting shadows etc. Might be worth checking out?
Post Reply