t3jem
06-21-2005, 08:34 AM
Hi,
I have a program that has fire, but so far to show the fire correctly I must use
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
This workes ok, but when it is very hard to see against a white background so I thought maybe it would be easier just to pick the pixels in the bmp file that I want to be transparent. Here is a thread that is on the topic http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=2;t=018804 , but I can't figure out how to convert the code they have into my bitmap loader below.
void text(UINT textureArray[], LPSTR strFileName, int ID)
{
if(!strFileName) return;
AUX_RGBImageRec *pBitMap = auxDIBImageLoad(strFileName);
if(pBitMap == NULL) exit(0);
glGenTextures(1, &textureArray[ID]);
glBindTexture(GL_TEXTURE_2D, textureArray[ID]);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pBitMap->sizeX, pBitMap->sizeY, GL_RGB, GL_UNSIGNED_BYTE, pBitMap->data);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR);
if (pBitMap)
{
if (pBitMap->data)
{
free(pBitMap->data);
}
free(pBitMap);
}
}all replies are greatly appreciated.
I have a program that has fire, but so far to show the fire correctly I must use
glBlendFunc(GL_SRC_ALPHA,GL_ONE);
This workes ok, but when it is very hard to see against a white background so I thought maybe it would be easier just to pick the pixels in the bmp file that I want to be transparent. Here is a thread that is on the topic http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=2;t=018804 , but I can't figure out how to convert the code they have into my bitmap loader below.
void text(UINT textureArray[], LPSTR strFileName, int ID)
{
if(!strFileName) return;
AUX_RGBImageRec *pBitMap = auxDIBImageLoad(strFileName);
if(pBitMap == NULL) exit(0);
glGenTextures(1, &textureArray[ID]);
glBindTexture(GL_TEXTURE_2D, textureArray[ID]);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pBitMap->sizeX, pBitMap->sizeY, GL_RGB, GL_UNSIGNED_BYTE, pBitMap->data);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR);
if (pBitMap)
{
if (pBitMap->data)
{
free(pBitMap->data);
}
free(pBitMap);
}
}all replies are greatly appreciated.