Jump to content
  • Advertisement
Sign in to follow this  
athan91

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

This topic is 3028 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
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!