PDA

View Full Version : HELP .... MY WORST DAY, .... TEXTURE



bigtime
12-02-2003, 11:10 AM
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_U NSIGNED_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.

Mazy
12-02-2003, 11:28 AM
this is a c/c++ question, not an opengl one..

You dont have a .cpp or .log/.obj that the function exist in.. you must tell the linker where it can find the correct file.

bigtime
12-02-2003, 11:33 AM
how????
I am a Java Programmer,
and I have no clue

nexusone
12-02-2003, 12:04 PM
Do you have the glm library?
Is it in the /lib/ directory?
Do you have in listed in the linker options, to be included during linking?
Is it the correct glm library for VC++?