i got a little proble to implement memory allocation using array. Here's the situation, i got a sample data stored in textfile:
tri1 (1,7,1) (2,8,2) (3,7,3)
tri2 (2,8,2) (5,7,5) (3,7,3)
tri3 (5,7,5) (3,5,2) (3,7,3)
tri4 (3,7,3) (3,5,2) (1,7,1)
tri5 (5,7,5) (5,5,7) (3,5,2)
it is a triangulation table.. so later i'll plot it as a triangle..
i would like to read the text file and pass it into array.. consisting node1, node2 and node3..
i started like this..
int i;
float node1[3];
float node2[3];
float node3[3];
std::ifstream in("sample.txt" ,std::ios::in |std::ios::bina ry);
if(!in)
{
std::cout<<"cou ld not open file"<<std::end l;
return 1;
}
then i ran out of idea to pass the value...
so, can anyone help me out?
p/s: anyway.. this is not a school assignment.. i just want to try graphic programming - openGL..
tri1 (1,7,1) (2,8,2) (3,7,3)
tri2 (2,8,2) (5,7,5) (3,7,3)
tri3 (5,7,5) (3,5,2) (3,7,3)
tri4 (3,7,3) (3,5,2) (1,7,1)
tri5 (5,7,5) (5,5,7) (3,5,2)
it is a triangulation table.. so later i'll plot it as a triangle..
i would like to read the text file and pass it into array.. consisting node1, node2 and node3..
i started like this..
int i;
float node1[3];
float node2[3];
float node3[3];
std::ifstream in("sample.txt" ,std::ios::in |std::ios::bina ry);
if(!in)
{
std::cout<<"cou ld not open file"<<std::end l;
return 1;
}
then i ran out of idea to pass the value...
so, can anyone help me out?
p/s: anyway.. this is not a school assignment.. i just want to try graphic programming - openGL..
Comment