I’m going through NeHe’s tutorials and I’m running into a problem when it comes to bump mapping. Up until now I’ve been using the SOIL library to load image files into OpenGL which works great. But the bump mapping tutorial uses a pointer to the image data to modify the colors of the image pixel by pixel. To my knowledge I can’t do this with the SOIL library. Is there a good way to get this affect now that glaux is deprecated? Apparently we’re trying to set the alpha channel to be the value of the red component of the pixel color. On another note are we loading these into a char array because c++ doesn’t care about the difference between bytes and char (they’re the same size right?) or is there some other thing I’m missing in all this?
// Load The Logo-Bitmaps
if (Image=auxDIBImageLoad("Data/OpenGL_ALPHA.bmp")) {
alpha=new char[4*Image->sizeX*Image->sizeY];
// Create Memory For RGBA8-Texture
for (int a=0; a<Image->sizeX*Image->sizeY; a++)
alpha[4*a+3]=Image->data[a*3]; // Pick Only Red Value As Alpha!
if (!(Image=auxDIBImageLoad("Data/OpenGL.bmp"))) status=false;
for (a=0; a<Image->sizeX*Image->sizeY; a++) {
alpha[4*a]=Image->data[a*3]; // R
alpha[4*a+1]=Image->data[a*3+1]; // G
alpha[4*a+2]=Image->data[a*3+2]; // B
}
SOIL_load_image()should give you the raw image bits: