summaryrefslogtreecommitdiffstats
path: root/objloader.c
diff options
context:
space:
mode:
authorKyle K <kylek389@gmail.com>2010-10-16 14:16:51 -0500
committerKamil Kaminski <kamilkss@gmail.com>2010-10-16 14:16:51 -0500
commit4f008bf699888b51f7888cbbc24cab711483ac4a (patch)
tree6c726df85bb7f96d7a020430c27c578010bd351a /objloader.c
parent8aff7ce656f9022263df56fbcb10e41500a8da8f (diff)
downloadOBJLoader-4f008bf699888b51f7888cbbc24cab711483ac4a.tar.gz
OBJLoader-4f008bf699888b51f7888cbbc24cab711483ac4a.tar.bz2
OBJLoader-4f008bf699888b51f7888cbbc24cab711483ac4a.zip
Make a helper func for extracting path
Diffstat (limited to 'objloader.c')
-rw-r--r--objloader.c8
1 files changed, 2 insertions, 6 deletions
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);