• Advertisement
Sign in to follow this  

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

This topic is 2852 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
Sign in to follow this  

  • Advertisement