1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
...
ifstream fichier("truc.txt");
const char * machin;
string ligne, flottant;
vector<const char *> coord;
float float1;
...
coord.clear();
getline(fichier,ligne);
for (int i = 0; i<4; i++) //je veux lire que les 4 premières lignes pour l'instant
{istringstream temp(ligne);
while (getline(temp,flottant,'\t')) //on récupère les valeurs séparés par des tab
{machin= ((string)flottant).c_str();
coord.push_back(machin);}
getline(fichier,ligne);
}
glColor3d (0.84f,0.64f,0.97f);
int j = 0;
glBegin (GL_POLYGON);
while (j < coord.size())
{float1 = (float)(atof(coord[j]));
float2 = (float)atof(coord[j+1]);
float3 = (float)atof(coord[j+2]);
glVertex3f (((float)float1)+58.0f,((float)float3)-7.0f,((float)float2)-10.0f);
j+=3;
}
glEnd();
... |
Partager