Currently, my rendering works except for the textures rendering totally black. I am getting the error 1380, or GL_INVALID_ENUM, right after calling glTexture2D in this segment of code. I have tried everything that I can think of, but the error will not go away.
-Calling get error right before this block of code -Texture is in powers of 2 (128 x 128) -Using new 24-bit photoshop .bmp
glEnable(GL_TEXTURE_2D);
FREE_IMAGE_FORMAT imageFormat = FreeImage_GetFileType(filename, 0);
FIBITMAP* bmpImage = FreeImage_ConvertTo32Bits(FreeImage_Load(imageFormat, filename));
int width = FreeImage_GetWidth(bmpImage);
int height = FreeImage_GetHeight(bmpImage);
int nBPP = FreeImage_GetBPP(bmpImage);
if (nBPP == 32)
{
// Generate an ID for the texture.
glGenTextures(1, &m_texture);
// Bind the texture as a 2D texture.
glBindTexture(GL_TEXTURE_2D, m_texture);
// Load the image data into the texture unit.
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)FreeImage_GetBits(bmpImage));
if(auto temp = glGetError())
{
// GL_INVALID_ENUM/1380 here
}
}
FreeImage_Unload(bmpImage);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
You say the image is 24-bits but in your code you write:
if (nBPP == 32)