Sign in to follow this  
Beaverbutt8

What to do now

Recommended Posts

Beaverbutt8    100
Hey guys, I found a 3ds loader on some site called space simulator. It works pretty well. The problem is that it's several C++ and .h files. So, how would i use it in my game? Thanks :) And Happy Thanksgiving :) Mike

Share this post


Link to post
Share on other sites
pulpfist    528
If I understand correct, what you have is a library source.

You can try to make a new library project, add all the .cpp files to it,
make sure the .h files are visible to your project, and compile it.

The result should be a .lib file, which you will include/link with your original project.

Happy Thanksgiving :)

Share this post


Link to post
Share on other sites
dave    2187
Hi bud,

You could use visual studio to build the code into a static library. That way when you want several other projects to use the same code, you can use the header files as they are and link in the library.

Hope that helps,

ace

Share this post


Link to post
Share on other sites
ZMaster    240
Quote:
Original post by Beaverbutt8
So, once i do that, i can just type something like load( "model.3ds" )????


That depends on the implementation of the loader, but generally: yes.
Function naming conventions may somehow be different but if you're really talking about a loader library here, something like load("...") is possible.
Try to find some documentation of the library you're using...

Share this post


Link to post
Share on other sites
Beaverbutt8    100

[/quote]

Try to find some documentation of the library you're using...[/quote]

Ok, it's starting to make sense. The library i use has no documentation. Could you reccomend a 3ds loader library for OpenGL? I'm using dev cpp if that helps.








Happy Thanksgiving :)


Mike



Share this post


Link to post
Share on other sites
c0uchm0nster    182
I can't help you as far as a better-documented / more popular loader, but I suggest you read the code of the loader you have... look at the functions, see if they're commented saying what they do - and if not, try and figure out what each function actually does... that's all a library is, you're just calling the functions of the library from your computer. It might not be soo important to know exactly what a model loader is doing - but then again, it's a great way to learn about how it all happens. After all, the main way you learn to code is by reading and understanding code - so why skip over this code just because is might not be as neatly wrapped?

Share this post


Link to post
Share on other sites
pulpfist    528

The example* files, containing main(...), is probably just a testbed for the library.

All you need to do realy is to add 3dsloader.cpp/h and texture.cpp/h to your project as if you had written them yourself.

EDIT:
Wait a second... I get it... you are compiling the whole thing as it is, right?
If so, there is probably not any "serious" errors to deal with, just a few adjustments.

Share this post


Link to post
Share on other sites
Beaverbutt8    100
ok, i got 6 errors



"In file included 3dsloader.h"



Here's the line on which these errors are

"extern char Load3DS (obj_type_ptr ogg, char *filename);"



"obj_type_ptr was pot declared in this scope"
"initializer expression list treated as a compound expression"


"in function 'DrawGLScene()'"

Here's the line on which these errors are

"Load3DS (&object,"sword.3ds");"


"'object' undeclared ( first use this function )"
"Load3DS cannot be used as a function"



NOTE: I'm using Dev Cpp if that helps

Share this post


Link to post
Share on other sites
pulpfist    528
Hey!

I dont have GL so I cant test it, but I saw at the code and as far as I could see "obj_type_ptr" is declared in tutorial4.h (or something... dont remeber the file names), so 3dsloader.h must include tutorial4.h.
That will solve some errors...

Share this post


Link to post
Share on other sites
pulpfist    528
Hehehe... sorry about that, but this is not necessarily a bad sign...
One more fix and you could be back at 0 errors ^^
Infact this often happens to me when I manage to get rid of all the compiler errors, becouse at that point the compiler is done, and the linker kicks in.
This time it is linker errors however, not compiler errors.

(Maybe the inclusion of tutorial4.h solved one error and created some new ones :/ I realy cant tell without testing, or seeing the errors)

Quote:

Do you know of any easy to use 3ds loaders out there? It would really help alot.


I saw you have asked this before... unfortunatly I dont have any good references for you on that one

GL man

Share this post


Link to post
Share on other sites
ZMaster    240
The problem is that there probably is no such library, which is ready to use. You will most likely find some source code or tutorials on the net, but no library. I might be wrong, but at least I haven't heard of any.
If you are more advanced in OpenGL and programming in general, it should be no problem for you, to write your own loader.
If you feel uncomfortable with writing your own implementation, I think you should try one of those OpenSource engines out there. They most likely come with a ready-to-use implementation for various model file formats, including 3DS. I heard that a lot of people are using the Ogre engine.
I could still give you the source of my 3DS loader implementation, but it's very much specific for my own engine and includes a lot of "unnecessary" stuff like animations, which would just make it more complicated to learn from...

Share this post


Link to post
Share on other sites

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