Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm working on a game engine and just started with mesh loading. I started with the format .obj. I ran into this problem:

The guide I'm following gave me a couple of .obj files to try and they all worked fine. I then asked a friend who is working with 3D animation to give me a couple of .obj files to try in addition, but his files, when opened up in a txt format, contain no newlines to separate the information at all. (Everything was on one line). The loading function I use depends on this to extract the information.

Are the files he gave me bad in some way? Is my function bad because it depends on newlines being there? (I can't see .obj files having any other delimiter character...)

My friend made and exported the 3D models in Blender. This is the guide I'm following.

share|improve this question
2  
What OS does your friend use? Different operating systems use different newline characters, and it's possible that is causing the issue. –  jhocking Jun 14 '13 at 12:27
    
He is using windows 7, and so am I, but do you really think the blender export function should be affected by that :O ? –  Fredrik Boston Westman Jun 14 '13 at 12:28
    
dunno, perhaps it uses system default filestream commands. whatever it doesn't matter now, thanks for crossing off that possibility –  jhocking Jun 14 '13 at 12:32
1  
Windows version doesnt relly matter, locale can affect this too. But it highly probably that its caused by him exporting it with line breaks as \n and you are expecting \n\r. –  Kikaimaru Jun 14 '13 at 12:43
    
Ok, but to the question at hand, is the file structur of .obj built so you seperate the information via new lines or not :) ? –  Fredrik Boston Westman Jun 14 '13 at 14:02
show 1 more comment

1 Answer 1

up vote 5 down vote accepted

I'm assuming you opened the file in Notepad. Notepad doesn't recognize some new line formats.

The OBJ format does indeed use newlines as delimiters, and your files likely contain them. It's just not looking that way in Notepad. Try opening them in Notepad++ instead: I'll bet they'll appear correctly.

To make sure your parser function works correctly on all platforms, it should consider both \n (newline) and \r (carriage feed) characters as newlines.

share|improve this answer
    
The tutorial code probably assumes you are in the USA and using Windows. –  jhocking Jun 14 '13 at 17:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.