.md2 OpenGL
Hello everybody,
I have a question about how to load a md2 file into my C++ Xcode project. I've read a lot of tutorials about md2, but it just won't work. Can somebody here explain it, do I have to include the file in my project? Where do I have to load it?
In advanced thanks
Stijn van der Schoor
I have a question about how to load a md2 file into my C++ Xcode project. I've read a lot of tutorials about md2, but it just won't work. Can somebody here explain it, do I have to include the file in my project? Where do I have to load it?
In advanced thanks
Stijn van der Schoor
stijnschoor Wrote:but it just won't work.
If you give us details of what doesn't work, we might be able to help troubleshoot it.
At a very high level, the basic concept is likely to go something like this: You'll include .md2 files in your application bundle, read their contents with standard file I/O APIs, parse the file contents into some sort of internal data structure, then send vertices from that data structure to OpenGL each time you want to render the model.
I don't know any specifics about md2, but these approximate high-level concepts should apply to any 3D model file format.
for example: tutorial 9 from videotutorialrocks.com, it shows how to load a md2 file. I've downloaded the source code and built a Xcode project. But when I run the project I get the following error:
ZeroLink: unknown symbol __Z7loadBMPPKc'
Do you know what this mean?
ZeroLink: unknown symbol __Z7loadBMPPKc'
Do you know what this mean?
Quote:ZeroLink: unknown symbol __Z7loadBMPPKc'That's a linker error. It means that you have some code somewhere trying to call a function called Z7loadBMPPKc() (it may have arguments) which is not defined anywhere. Since you are not getting a compiler error you probably have it declared in a header somewhere but the function is missing from your code or you have not included the library it is contained in. I'd start by looking for a library called Z7 or similar since that appears to be a prefix.
By the way, the domain videotutorialrocks.com is not registered. Try again if you want anyone to have a look at it for you.
sorry the url is videotutorialsrock.com/ (notice the "s")
I will looking for a libraby called Z7
I will looking for a libraby called Z7
The symbol is a bit mangled, but it's referring to a function named loadBMP, which is defined in imageloader.cpp here: http://videotutorialsrock.com/opengl_tut...s/text.php
Make sure this file is compiled in with your program. You'd also be well-served by turning off ZeroLink in Xcode, as you'll get more informative errors earlier that way.
Make sure this file is compiled in with your program. You'd also be well-served by turning off ZeroLink in Xcode, as you'll get more informative errors earlier that way.
Code:
keith$ c++filt
__Z7loadBMPPKc
loadBMP(char const*)
^DAs others have said: something in your program is using a C++ function called loadBMP taking a C string, and that function doesn't exist in your program.
Thanks a lot!
The problem is almost solved.
The only error I receive now is:
failed assertion `!input.fail() || !"Could not find file"
Any ideas?
The problem is almost solved.
The only error I receive now is:
failed assertion `!input.fail() || !"Could not find file"
Any ideas?
Your file isn't where your app expects it to be. Read this:
http://blog.onesadcookie.com/2007/12/fin...files.html
http://blog.onesadcookie.com/2007/12/fin...files.html
Just another question.
In the directory /Developer/Examples/OpenGL/GLUT/GLUTExamples.xcodeproj is an example of how to import models into OpenGL (see Target GLUTMecha). Which file format is used? I found a .dat file, but what does that mean? Are there any tutorials on the web?
Advanced thanks
In the directory /Developer/Examples/OpenGL/GLUT/GLUTExamples.xcodeproj is an example of how to import models into OpenGL (see Target GLUTMecha). Which file format is used? I found a .dat file, but what does that mean? Are there any tutorials on the web?
Advanced thanks
A quick look at glutmech.c shows that it's all procedural; no model file is loaded.
Googling for "md2 loader OpenGL" gives me quite a few tutorial links right near the top. Your best bet is probably to look through those and find one that suits your needs.
Googling for "md2 loader OpenGL" gives me quite a few tutorial links right near the top. Your best bet is probably to look through those and find one that suits your needs.
Another random thing google probably doesn't find: http://onesadcookie.com/svn/MD2/Resources/Ruby/MD2.rb
Once upon a time this worked perfectly. It still should, but for some reason I can't get it to break on any breakpoints, so I can't figure out why it's not.
If you're still on PPC it should work fine. It seems that on Intel it's still thinking it's on PPC and is byte swapping. The code is pretty clean, so if someone has 10 minutes and get the flippin' debugger to work (I blame SDL) then it'll work just fine.
http://www.sethwillits.com/temp/MD2Loading.zip
If you're still on PPC it should work fine. It seems that on Intel it's still thinking it's on PPC and is byte swapping. The code is pretty clean, so if someone has 10 minutes and get the flippin' debugger to work (I blame SDL) then it'll work just fine.
http://www.sethwillits.com/temp/MD2Loading.zip
At the bottom of the page there is some good C source code for loading md2 format.
http://tfc.duke.free.fr/coding/md2-specs-en.html
http://tfc.duke.free.fr/coding/md2-specs-en.html

