how to read a file ?

I hava made a function who would read my objects from a file and put everything in my object class.

It works fine when it reads the first object but when it would read the second object it doesn´t work! the only thin it reads is the rotation speed.

is there any good example or tutorial how I could do to read an object ? I have used Nehe´s to made my file reader.

That’s not an OpenGL related question but…
In every C/C++ guide u can find file routines examples, try to search also MSDN online (even if you don’t use MS compiler).
If it’s not too long post some code.

rIO http://www.spinningkids.org/umine

thats the problem it is to much code! and I don´t have it with me… but the code works fine when I made a console program and printed the file info to the console! but it doesn´t work in OpenGL

Hi,
Here is my LoadGLTexture function.
This function reads in a file the path (“Data/Textures/Wall.bmp”).

This function can load 50 textures and max 40 caracters per path.
The code :

int LoadGLTextures() // Fonction pour charger les bitmap et les convertir en textures
{
AUX_RGBImageRec *TextureImage[50]; // 50 textures to load
memset(TextureImage,0,sizeof(void *)*50); // Memory for the 50 textures

char Noms_des_textures_a_charger [50] [40]; // Tab for stocking 50 textures and 40 caracters

int Status = FALSE;	// Statu = false

FILE *Fichier_Textures;	// Pointeur pour le fichier


// The file
Fichier_Textures = fopen("Data/Noms_Textures.txt", "r");
int c = 0;	// Pour stocker dans le tableau

for (int cpt0 = 0; cpt0 < nombre_de_textures; cpt0 ++)	// La boucle se base sur le nombre de textures
	{
		fscanf(Fichier_Textures, "%s

", Noms_des_textures_a_charger[c]); // On pète dans un tableau
c ++; // Pour mettre à la position suivante dans le tableau
}
fclose(Fichier_Textures); // On referme le fichier

// On fait une boucle pour charger toutes les textures en mémoire
for (int cpt1 = 0; cpt1 < 50; cpt1 ++)
	{
		TextureImage[cpt1] = LoadBMP(Noms_des_textures_a_charger[cpt1]);	// On charge
		Status = TRUE;	// Ok, ça marche, on continue
		glGenTextures(nombre_de_textures, &texture[cpt1]);	// On génère les textures

		glBindTexture(GL_TEXTURE_2D, texture[cpt1]);	// On dit que c'est une texture 2D
		glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[cpt1]->sizeX, TextureImage[cpt1]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[cpt1]->data);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,Filtre[optimise]);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,Filtre[optimise]);
		// Ce qui précède, c'est les paramètres pour créer les textures

		if (TextureImage[cpt1])	// Faut libérer après ...
			{
				if (TextureImage[cpt1]->data)		// Si l'image de la texture existe
					{
						free(TextureImage[cpt1]->data);	// Libère la mémoire
					}
				free(TextureImage[cpt1]);		// Libère la structure de l'image
			}
	} // Fin *****

return Status;	// Retourne le statut

} // Fin de la fonction