PDA

View Full Version : Max files, Help I almost got it.



RobertSI
05-22-2000, 01:10 PM
So far I have downloaded Explorer 3D, saved
a test 3DMax file to .ASC and have also saved it as .cpp in Explorer3D.
I have read up on opening files in C with fopen, etc. Okay, so I see how I could just incorperate the .cpp file into a GLUT program
I've written, but don't understand how to open a .ASE file in an OpenGL program. Do you have to edit the file, since I'm using the console window for feedback I keep on getting my error message Can't find file, which means the filePtr is NULL. Any advice or another clue would be appreciated. Any simple by the hand examples showing how to open and ascii file to a glut window would be great.

Cyrius
05-22-2000, 02:35 PM
Well Robert, I'm not familiar with the ASE format (is it any good?), but I do have several programs that read in 3D objects from POV (.inc) files, which are ASCII.

There are two issues you must make sure you have right before you can start reading a file:

1. The file must be in the right place. This basically means that you either give the correct pathname to fopen, or have the file sitting in the program directory. As pathnames differ significantly from one platform to another, I prefer to have the file in the working directory. In VC++, this means it must be sitting in the same folder as the .dsw project file, and not the debug folder.

2. Then, you must make sure you are passing a string to fopen which totaly matches the actual filename. Keep in mind that windows hides extensions in the explorer, but you will still need to have the extension when you call fopen. So, for example, if you had a file 747.inc (thats my 3D I read), explorer would simply show it as 747 but when you call fopen you must pass it the string 747.inc. Oh, btw, the file must be readable ascii, and the string you pass to fopen must be terminated by an endline (I think... might not be the case).

I hope that helps you out! Good luck writing the parser to read the thing, its been my experience that writing parser to read 3D objects can be more challenging than writing the OpenGL to display them!! Another bit of advice is to use the strtok and strtod family of commands, I found them very handy.

[This message has been edited by Cyrius (edited 05-22-2000).]

Eric
05-22-2000, 10:57 PM
Hi !

You might run into a problem I have everytime....
Let's say you want to access the file "D:\models\toto.ase".
You should write in your code :

FILE *in=fopen("D:\\models\\toto.ase","rb");

The backslash is a special token when used inside a string in C/C++. To make the compiler understand that it is indeed a backslash, you have to double it... (I forget this almost every time I use a path in one of my programs !).

I am not sure if this is your problem : perhaps you are less dumb than I am !

Concerning the other question : yes, ASE files are really good except that you can only export one frame at a time (bye bye animated meshes !).

Hope I helped you !

Regards

Eric

dmy
05-23-2000, 12:43 AM
everything is right.
personally i use to specify files directories with the slash / symbol, because msvc understands it the same, and is less prone to errors.
not a strictly opengl issue, but can be annoying sometime http://www.opengl.org/discussion_boards/ubb/smile.gif

Dolo/\/\ightY