I have a texture problem, look at below(url), the left image is original and the right one is mapped on quad.
<a href=“Yahoo | Mail, Weather, Search, Politics, News, Finance, Sports & Videos” target=“_blank”>
Click to link to the image
</a>
The format is BMP 24 bits with height and width same and in power of 2 dimension.
And in case code needed,
void LoadBitmap(char * filename, int texture_ID)
{
ifstream bmpfile;
GLubyte *bitmap;
int width, height;
int size, offset;bmpfile.open(filename);
if(bmpfile == NULL)
{
MessageBox( NULL, “Cannot open bitmap file”,
“ERROR”, MB_OK | MB_ICONSTOP);
return;
}bmpfile.seekg(0x0012);
bmpfile.read(reinterpret_cast<char*>(&width), 4);
bmpfile.read(reinterpret_cast<char*>(&height), 4);bmpfile.seekg(0x0022);
bmpfile.read(reinterpret_cast<char*>(&size), 4);bmpfile.seekg(0x000A);
bmpfile.read(reinterpret_cast<char*>(&offset), 4);if( width != height && width != 64 && width != 128 &&
width != 256 && width != 512)
{
MessageBox( NULL, “Bitmap dimension not compatible”,
“ERROR”, MB_OK | MB_ICONSTOP);
return;
}bitmap = new GLubyte[size];
bmpfile.seekg(offset);
bmpfile.read(reinterpret_cast<char*>(bitmap), size);GLubyte temp;
for(int i = 0; i < size; i += 3)
{
temp = bitmap[i];
bitmap[i] = bitmap[i+2];
bitmap[i + 2] = temp;
}glBindTexture(GL_TEXTURE_2D, texture_ID);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height,
0, GL_RGB, GL_UNSIGNED_BYTE, bitmap);delete bitmap;
}
[This message has been edited by Questions Burner (edited 12-09-2001).]