From 4f008bf699888b51f7888cbbc24cab711483ac4a Mon Sep 17 00:00:00 2001 From: Kyle K Date: Sat, 16 Oct 2010 14:16:51 -0500 Subject: Make a helper func for extracting path --- objloader.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'objloader.c') diff --git a/objloader.c b/objloader.c index 1374530..1f5eddd 100644 --- a/objloader.c +++ b/objloader.c @@ -78,12 +78,8 @@ static void setup_opengl(ObjModel *model) GLint iWidth, iHeight, iComponents; GLenum eFormat; - /* get the filename from obj file */ - char *fname = (char *) malloc(sizeof(char) * 31); - char *delimeter = strrchr(obj_last_fname, '/'); - unsigned int offset = delimeter - obj_last_fname; - strncpy(fname, obj_last_fname, offset + 1); - strcat(fname, model->mtl->map_Ka); /* ambient texture map */ + /* get the texture filename from obj */ + char *fname = ObjGetPath(model->mtl->map_Ka); /* ambient texture map */ if (model->mtl != NULL) printf("ambient texture map: %s\n", model->mtl->map_Ka); -- cgit v1.2.3