This is the file format: The les contain two types of information: faces and ver
ID: 3639691 • Letter: T
Question
This is the file format:The les contain two types of information: faces and vertices. The vertices are always dened rst. The
vertex line begins with a small v letter followed by 3
oating point numbers describing the x,y and z
coordinates of a particular vertex. Here is an example:
v 45.0000 45.0000 0.000000E+00
Faces make triangles that consist of three vertices that we have already dened in the le. For instance:
f 1 3 4
The above line makes a triangle consisting of the rst, third and fourth vertex. The vertices are numbered
from top to bottom, in the order they are read from the le.
And this is the code I have written so far:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main ()
{
int faces [9];
float vertice[3];
char let;
ifstream myfile ("info.txt");
myfile.open("info.txt");
if(!myfile)
{
cout<<"File does not exist"<<endl;
}
while(!myfile.eof())
{
if(let = 'f')
{
myfile>>faces[9];
}
if(let = 'v')
{
myfile>>vertice[3];
}
}
return 0;
}
My problem is putting the information into an array, and using open gl to draw the triangles and make a 3D shape. Any suggestions for improvement?
Explanation / Answer
hey buddy I am a classmate from Brian Temple I dont blame you to come here for some help as he is not very help full.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.