Original Post
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();
}