Sonja
Sonja

Reputation: 11

OpenGL texture, doesn't like my bmp

don't worry, I don't want to ask how to use textures. :)

My problem is: I'm using several textures. But if I want to change the file name like this:

(LoadBMP("grass.bmp", textureImage[3])) // I can see the grass

to

(LoadBMP("parkett.bmp", textureImage[3])) // No texture, only white color

Both pictures are in the same directory and there is no error message.

Any ideas? Thanks Sonja (OpenGL, Visual Studio C++ 2010)

Upvotes: 1

Views: 1460

Answers (3)

datenwolf
datenwolf

Reputation: 162164

Are the dimensions of the non-working texture powers of 2 (i.e. 1, 2, 4, 8, 16, 32, ...)? If not, then that's why it's not working. Either scale or pad.

Upvotes: 0

shybovycha
shybovycha

Reputation: 12245

Can just assume your second BMP has wrong internal data format (non-BGR or something like that). Agreed with Kos - you should try using some libraries for this purpose. There are lots of 'em - SFML, SDL_image, DevIL...

Upvotes: 0

Kos
Kos

Reputation: 72271

Most likely, those textures use a different format (.bmp is not just a single format) and your function only supports one.

The simplest and best solution is to use a good library to load your textures, instead of some mystical LoadBMP. I recommend SOIL - Simple OpenGL Image Loader. Just add it to your project and you'll be able to load any bmp, jpg or png textures to an OpenGL texture ID with a single function call.

Upvotes: 2

Related Questions