Please I want the easiest way If you can, I am a begginer please don’t complicate me.
I am using VC++ to model a room and I am trying to read a .ppm file named fisherman.ppm and use it as texture, now here is the relevant code:
// called from the main
// this is what i use to read the
//fisherman.ppm
GLubyte*
glmReadPPM(char* filename, int* width, int* height);
int iheight;
int iwidth;
char* name =0;
unsigned char* image = NULL;
//this is called from display method
void texture_example()
{
glEnable(GL_TEXTURE_2D);
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE,image);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, iwidth, iheight, GL_RGB, GL_UNSIGNED_BYTE, image);
glTexImage2D(GL_TEXTURE_2D,0,3,18,10,0,GL_RGB,GL_UNSIGNED_BYTE,image);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, 0);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(-1, 1, 0);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(-1, -1, 0);
glTexCoord2f(1.0f, 1.0f);
glVertex3f(1, -1, 0);
glTexCoord2f(1.0f, 0.0f);
glVertex3f(1, 1, 0);
glEnd();
glutPostRedisplay();
free(image);
glutSwapBuffers ();
}
int main(int argc, char **argv)
{
name = “fisherman.ppm”;
glutInit (&argc, argv);
image = glmReadPPM(name, &iwidth, &iheight);
if (!image)
exit(0);
… and then other stuff…
but then I get the following error during LINKING, after compiling …
[Is there a way to do texture, any way because my nick is paining. ALL THE THANKS IN THE WORLD TO YOU FOR EVEN READING THIS MESSAGE]
error LNK2001: unresolved external symbol “unsigned char * __cdecl glmReadPPM(char *,int *,int *)” (?glmReadPPM@@YAPAEPADPAH1@Z)
Debug/room4.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.