summaryrefslogtreecommitdiffstats
path: root/objloader.c
diff options
context:
space:
mode:
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);