Re: OpenGL changes

[email protected] Sun, 07 May 2006 07:29:24 -0800
Newsgroups gmane.games.devel.opengl
Organization Fat City Network Services, San Diego, California
Message-ID <[email protected]>
Bram Biesbrouck wrote:
> Hi Kent,
> 
> I followed your advise and found the weirdest bug.
> I created a really simple .obj file (just one square), let my parser read the 
> file and print out several vertex-values. Here's what happened:
> 
> The file contains (among others):
> v -1.000000 1.000000 0.000000
> 
> This is the code that reads in the vertices:
> GLfloat x, y, z;
> fscanf(file, "%f %f %f", &x, &y, &z);
> 
> Now, when I try to print out the values:
> printf("Read vertex: %f %f %f \n", x, y, z);
> 
> This is the output:
> Read vertex: -1,000000 0,000000 -0,000029
> 
>

Do you have some kind of locale problem going on?

Your data file seems to use period as the decimal
separator and but at least your printf writes out
comma as separator. This might be sufficient to cause
your problems. (check the return value from fscanf in
order to see how many values it recognized)


some thing like setting your locale to C might
fix the problem.


	Eero



----- 
FAQ and OpenGL Resources at:
  http://www.geocities.com/SiliconValley/Hills/9956/OpenGL

-- 
Author: 
  INET: [email protected]

Fat City Hosting, San Diego, California -- http://www.fatcity.com
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [email protected] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).