my program displays just one object instead of 14 what's wrong ?

the for loop is well executed 14 times (i have tested it with a cout)but the program display the first object of the ase file and not the others! why ? what can i do ?

#include <stdio.h>
#include <iostream.h>
#include <string.h>
#include <conio.h>
#include <stdlib.h>
#include <GL/glut.h>

#define nb_vertices 20000
#define nb_faces 20000

struct donnees
{
float tab_vertices [nb_vertices][3] ;
int tab_sommets [nb_faces][3] ;
};
donnees tab_struct[50] ;
int nb_indices[100] ;

int i=0 ;
int j=0 ;
int k=0 ;
int n=0 ;
int m;
int l, b ;
int a=0 ;

void lecture ()
{

char tmp [100] ;
char tmp2 [100] ;
char tmp3 [100] ;
int temp [nb_vertices] ;
char passe_ligne [200] ;

char nom_fichier = “cool.ase” ;

FILE *pointeur ; //pointeur sur le fichier

if ((pointeur = fopen(nom_fichier, “r”)) == NULL)
return ;

do
{
fscanf(pointeur, “%s”, tmp) ;
if(strcmp (“*MESH”, tmp) == 0)
{
a++ ;
}
}
while (!feof(pointeur)) ;

fseek (pointeur, 0,SEEK_SET) ;
//cout<< a ;

for (b=0; b<a ;b++)
{

  do
  {

  	fscanf(pointeur, "%s", tmp) ;
  }
  while (strcmp ("*MESH_VERTEX", tmp) != 0) ; //passe toutes les chaines en revue jusqu'a qu'a ce que tmp soit égal à chaine ("*MESH_VERTEX")
  do//rempli le tableau de structure avec des coordonnées de vertices
  {

  	fscanf (pointeur, "%d%f%f%f%s", &(temp[0]) ,&(tab_struct[b].tab_vertices[i][0]), 
  		&(tab_struct[b].tab_vertices[i][1]),&(tab_struct[b].tab_vertices[i][2]), tmp) ;

  	//cout << tab_struct[b].tab_vertices[i][0]<<" "<<tab_struct[b].tab_vertices[i][1]<<" "<< tab_struct[b].tab_vertices[i][2]<<endl ;
  	i++ ;

  }
    while (strcmp (tmp, "}")!=0) ;

  do
  {

  	fscanf(pointeur, "%s", tmp2) ;
  }
  while (strcmp ("A:", tmp2) != 0) ;

  do //rempli le tableau de la structure avec le numero des sommets
  {
  	fscanf (pointeur, "%d%s%d%s%d", &(tab_struct[b].tab_sommets[j][0]),tmp,
  			&(tab_struct[b].tab_sommets[j][1]),tmp, &(tab_struct[b].tab_sommets[j][2])) ;
  	//cout << tab_struct[b].tab_sommets[j][0]<<" "<<tab_struct[b].tab_sommets[j][1]<<" "<<tab_struct[b].tab_sommets[j][2]<< endl ;
  
  	fgets (passe_ligne, 200, pointeur) ; //saute une ligne dans le fichier où les données ne servent pas
  	fscanf (pointeur, "%s%s%s", tmp3, tmp, tmp);
  	j=j+1 ;
  	l=l+1 ;
  }
  while (strcmp(tmp3, "}")!=0) ;

  nb_indices[b] = l*3;
  //cout << nb_indices[b]<<endl ;
  l=0 ;
}
//cout<< "hello1"<<endl ;


 fclose (pointeur) ;


}

void reshape (int w, int h)
{
glViewport (0, 0, w, h) ;
glMatrixMode (GL_PROJECTION) ;
glLoadIdentity () ;
glFrustum(-100.0 , 100.0, -100.0, 100.0, 5.0, 500.0); //perspective conique
glMatrixMode(GL_MODELVIEW); //la matrice active de modelisation/visualisation sera affectée
glLoadIdentity(); //charge la matrice identité

gluLookAt (0.0, 0.0, 150.0, 0.0,0.0,0.0, 0.0, 1.0, 0.0) ; //caméra placée sur l’axe des Z et regardant vers l’origine
}
void display ()
{

glEnableClientState (GL_VERTEX_ARRAY);

glPolygonMode (GL_FRONT_AND_BACK, GL_LINE) ;

glClear (GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT ) ;

for (m=0 ; m<= a ; m++)
{
glVertexPointer (3, GL_FLOAT, 0, &(tab_struct[m].tab_vertices[0][0]));
glDrawElements (GL_TRIANGLES, nb_indices[m], GL_UNSIGNED_INT,&(tab_struct[m].tab_sommets[0][0])) ;
}

glutSwapBuffers() ;

}

void main (int argc, char** argv)

{

lecture () ;
cout<<“hello”<<endl ;
glutInit (&argc, argv) ;
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH) ;
glutInitWindowSize (640, 480) ;
glutInitWindowPosition (250,250) ;
glutCreateWindow (argv [0]) ;

glEnable( GL_DEPTH_TEST );

glutReshapeFunc (reshape) ;
glutDisplayFunc (display) ;
glutMainLoop () ;

}

Do you reset i and j to 0 before reading
another mesh ?

Bye Claude

no, thanks !