If you need urgent support, call 999 or go to your nearest A&E. To contact our Crisis Messenger (open 24/7) text THEMIX to 85258.
Options
OpenGL and C programming problem
Former Member
Posts: 1,876,323 The Mix Honorary Guru
in General Chat
I know this is pretty geeky and prolly not likely to be resloved here ... but
I am progamming in opengl and reading co-ordinates from a file for triangles.
x[0] y[0] z[0] x[1] y[1] z[1] x[2] y[2] z[2]
the co-ordinates are positive and neagive floats.
I use
fscanf(pFile,"%f %f %f %f %f %f %f %f %f",&x[0],&y[0],&z[0],&x[1],&y[1],&z[1],&x[2],&y[2],&z[2]);
to read in the co-ordinates but when I printf the same variables the first two arent whats in the file.
The first line in the file is
0.882353 0.000000 2.088235 1.952941 -0.000000 1.795588 1.700000 0.000000 0.839706
but the program outputs
0.000000 0.839706 2.088235 1.952941 0.000000 1.795588 1.700000 0.000000 0.839706
(you should notice the x[0] = y[2] and y[0] = z[2])
This obviously plays havoc with my models! Could anyone help me out?
I am progamming in opengl and reading co-ordinates from a file for triangles.
x[0] y[0] z[0] x[1] y[1] z[1] x[2] y[2] z[2]
the co-ordinates are positive and neagive floats.
I use
fscanf(pFile,"%f %f %f %f %f %f %f %f %f",&x[0],&y[0],&z[0],&x[1],&y[1],&z[1],&x[2],&y[2],&z[2]);
to read in the co-ordinates but when I printf the same variables the first two arent whats in the file.
The first line in the file is
0.882353 0.000000 2.088235 1.952941 -0.000000 1.795588 1.700000 0.000000 0.839706
but the program outputs
0.000000 0.839706 2.088235 1.952941 0.000000 1.795588 1.700000 0.000000 0.839706
(you should notice the x[0] = y[2] and y[0] = z[2])
This obviously plays havoc with my models! Could anyone help me out?
0
Comments
www.codingforums.com