Sign in to follow this  
athan91

i am making a .obj loader [having an issue]

Recommended Posts

ok so i am trying to load a .obj into the code have writen i have followed the breakpoints i needed and i think i made an infinite loop with this code here
 

void model_loader()
{
    char buffer[350];
    FILE * myfile;
	myfile = fopen("Sphere.obj","r");
	if(myfile == NULL)
	{
	printf("File was not found");
	}
	
	else
	{		
		 while(fgets(buffer,350,myfile))
		 {
			if (buffer[0] == 'v')
			{
				scanf(buffer, "%*c %f %f %f", &v[vertexCount].x, &v[vertexCount].y, &v[vertexCount].z);
				vertexCount++;
			}
			else if (buffer[0] == 'f')
			{
				scanf(buffer, "%*c %d %d %d",  &t[triangleCount].ver1, &t[triangleCount].ver2, &t[triangleCount].ver3);
				triangleCount++;

			}
		 }
    }
	
    fclose(myfile);
	

}

would mean alot if someone can just point it out or throw me in the right direction if you need more of the code i will put it up

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this