Skip to main content
gamedev.net
🔒 Locked

texture mapping problem

Started by gl_newbie Mar 13, 2003 at 1:28 AM 3 replies 300+ views
Original Post
gl_newbie
gl_newbie
i kinda have problems linking a user defined library i got from some site. i doesn''t seem to recognize the functions on the library. i got these error messages. **************************************************************** Linking... bmpTexture.obj : error LNK2001: unresolved external symbol _TextureLoadBitmap Debug/bmpTexture.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. bmpTexture.exe - 2 error(s), 0 warning(s) **************************************************************** and the code /* BMP Texture.c * This program texture maps an BMP image onto * two rectangles. */ #include <GL/glut.h> #include <stdio.h> /* including BMP library header */ #include "texture.h" char *texFileName = 0; void myinit(void) { glClearColor (0.0, 0.0, 0.0, 0.0); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL); /* enabling texture mapping */ glEnable(GL_TEXTURE_2D); } void displayWin(void) { glClear(GL_COLOR_BUFFER_BIT); /* draw two rectangles with texture coordinates */ glBegin(GL_QUADS); glTexCoord2d(0.0, 0.0); glVertex3d(-2.0, -1.0, 0.0); glTexCoord2d(0.0, 1.0); glVertex3d(-2.0, 1.0, 0.0); glTexCoord2d(1.0, 1.0); glVertex3d(0.0, 1.0, 0.0); glTexCoord2d(1.0, 0.0); glVertex3d(0.0, -1.0, 0.0); glTexCoord2d(0.0, 0.0); glVertex3d(1.0, -1.0, 0.0); glTexCoord2d(0.0, 1.0); glVertex3d(1.0, 1.0, 0.0); glTexCoord2d(1.0, 1.0); glVertex3d(2.41421, 1.0, -1.41421); glTexCoord2d(1.0, 0.0); glVertex3d(2.41421, -1.0, -1.41421); glEnd(); glFlush(); } void reshapeWin(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(60.0, 1.0*(GLfloat)w/(GLfloat)h, 1.0, 30.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslated(0.0, 0.0, -3.6); } int main(int argc, char** argv) { glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); glutInitWindowPosition (0, 0); glutInitWindowSize(500, 500); glutCreateWindow (argv[0]); /* the file name */ texFileName = argv[1]; if (texFileName == 0) { printf("No image file.\n"); exit(1); } // load the texture TextureLoadBitmap(texFileName); // set other parameters myinit(); glutReshapeFunc (reshapeWin); glutDisplayFunc (displayWin); glutMainLoop(); }
HailHead
HailHead
You''re a big vague with your information.

From your linker output I assume you''re using Visual C.

All I can do is ask whether you are linking the bitmap library in your project settings for both build configurations?
If you do not know how to do this, then go to the:
Project->Settings->Link menu and tab, and check whether your library is listed under "Object/Library modules".

If you do know how to do this, and it is there, then all I can think of is that maybe you changed the filename of the library, and it''s having problems there.

If anyone thinks I''m talking bollocks, then hey, correct me, I am only trying to help.
Crayons don''t kill people, death does.
YodaTheCoda
YodaTheCoda
did you put the lib file in yuor vc98/lib directery?
gl_newbie
gl_newbie
thanks for the fast replies, guys and sorry bout the lack of info. yes i''m using VC++ and i meant to say user defined header file (not library). still trying to connect the header file but so far i''ve had no luck.
HailHead
HailHead
Dude, no offence, but I understood even less this time

Answering the following questions would probably lead to a quicker conclusion:

1) Did you make the library yourself, or is it one you downloaded?
2) What is the filename of the library?
3) Is "texture.h" part of the library package, or did you write it yourself to wrap certain functions?
4) Have you referenced the library from the Project Settings page as I asked earlier? And is the path to the library correct, or have you put it in the vc98/lib folder like Yoda said?

Basically: what are the all the components of this project?

I assume that "texture.h" is the header for a single library eg: texture.lib, if so, you are not linking texture.lib correctly.

And as for calling it without saving the return value, or passing a variable to store the texture in, just seems plain weird.
Crayons don''t kill people, death does.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.