Problem about the textures mapping of obj file loader

hi everybody~ :slight_smile:

You know I used GLM library.(Wavefront .obj file format)
So I succeed to read obj file.
But I don’t know why I failed to textures mapping to image. :confused:
what’s the matter to this source code?
help plz~


#include <math.h>
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include <GL/glut.h>

void models()
{
GLfloat dimensions[3];

car = glmReadOBJ(“OBJ_LW/nsx_mod.obj”);
glmUnitize(car);
glmSpheremapTexture(car);
glmScale(car, 10.0);
glmDimensions(car, dimensions);

}

void display(void)
{
int i;

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);	
glPushMatrix();{
	
	glTranslatef(0.0,0.0,-5.0);
	car_list = glmList(car, GLM_SMOOTH | GLM_TEXTURE | GLM_COLOR);
	glCallList(car_list);
}glPopMatrix();

glFlush();
}
:
:

void init(void)
{
float position[] = {3.0, 3.0, 3.0, 0.0};
float local_view[] = {0.0};
float ambient[] = {0.1745, 0.01175, 0.01175};
float diffuse[] = {0.61424, 0.04136, 0.04136};
float specular[] = {0.727811, 0.626959, 0.626959};

glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);

glLightfv(GL_LIGHT0, GL_POSITION, position);
glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, local_view);

glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);

glMaterialfv(GL_FRONT, GL_AMBIENT, ambient);
glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, specular);
glMaterialf(GL_FRONT, GL_SHININESS, 0.6*128.0);

glClearColor(0.0f ,0.0f, 0.0f, 0.0f); 
glShadeModel(GL_SMOOTH); 
glEnable(GL_COLOR_MATERIAL); 

models(); 

}

int main(int argc, char** argv)
{

glutInitWindowSize(320, 240);
glutCreateWindow(“Car”);

init();

:

glutDisplayFunc(display);

glutMainLoop();
return 0;
}