PDA

View Full Version : for anyone who likes a challange...



robert
12-05-2000, 01:44 AM
this is my semi-finished code for loading a bmp, but when linking i get... error LNK2001: unresolved external symbol _auxDIBImageLoadA@4 .... any ideas??

void LoadTexture(patch *tmp)
{

glGenTextures(1, &tmp->Texture); // Generate 1 Texture

ifstream inputFile(tmp->TexFilename);

tmp->TextureImage = NULL;


if (!(inputFile))
{
delete tmp->TextureImage;
exit(0);
}
else
{
inputFile.close(); // Close The File
tmp->TextureImage = auxDIBImageLoad(tmp->TexFilename); // And Load The Texture
}


// Typical Texture Generation Using Data From The Bitmap
glBindTexture(GL_TEXTURE_2D, tmp->Texture);

// Generate The Texture
glTexImage2D(GL_TEXTURE_2D, // 2D texture
0, // Detail level
3, // No. of components (RGB)
tmp->TextureImage->sizeX,// Dimensions of texture
tmp->TextureImage->sizeY,
0,
GL_RGB, // Using RGB
GL_UNSIGNED_BYTE, // Made up of UB's
tmp->TextureImage->data);// Position of actual data


glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_LINEAR); // Linear Filtering
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR); // Linear Filtering


if (tmp->TextureImage->data)
delete tmp->TextureImage->data;

}

FragCool
12-05-2000, 02:07 AM
Yes =)

You have to link the libary wich contains the funktion (in your case auxDIBImageLoad()) to your project!

i thing it's the glaux.lib (Don't hit me for that, i'm at work and can't take a fast look)

robert
12-05-2000, 02:10 AM
arrrrrrg I cant belive i missed that! previously the program had been running so I didnt think that id need another lib file.

arrg I think ill blame Microsoft to make me feel better http://www.opengl.org/discussion_boards/ubb/smile.gif :P

Succinct
12-05-2000, 03:40 AM
of course, you could write your own bmp loader, but i guess it's not as portable?

(i just hate aux anything)

robert
12-05-2000, 12:56 PM
thanx for all you help. I have got it going now, but for some reason my whole scene has change to a darker color. any ideas?

john
12-05-2000, 01:38 PM
the whole scene is darker? your bmp, or everything you draw?

if it's just the bitmap then i'd suggest you're casting your pixels to a higher integer. i mean, if your bitmap is stored n GL_UNSIGNED_BYTE and you cast the RGB to GLU_UNSIGNED_INT, then you're going to end up with a markedly darker image.

just an idea

cheers,
John

robert
12-05-2000, 07:52 PM
It is my whole image that appears darker. Im just playing around now, and if i delete these lines:

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_LINEAR); // Linear Filtering
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR); // Linear Filtering
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

Then it works. I do know that these may not be the actual problem, but if anyone has any ideas......

thanks

Deiussum
12-06-2000, 06:13 AM
Does it appear that the texture could be blending with the color of the objects? Try using

glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);

(Or GL_REPLACE instead of GL_DECAL)

robert
12-06-2000, 04:58 PM
Hmmmm that didnt work. Thanks for you help though. http://www.opengl.org/discussion_boards/ubb/smile.gif :eek: :P