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 li开发者_运维问答ke 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)
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.
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...
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.
精彩评论