I’m trying to draw a transparent bubble by texture map a rectangle with an image of a bubble, and then make them transparent. In fact, I have made it work on my computer and my friend’s. But at many other computers, the tranparency doesn’t work. Does anybody know how could something be transparent on one machine and not on others?
Here is part of my code where I texture map the image:
GLubyte *bits;
BITMAPINFO *info;
bits = LoadRGBA("Data/bubble5.bmp", &info);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, 3, info->bmiHeader.biWidth,
info->bmiHeader.biHeight, 0,
GL_RGBA, GL_UNSIGNED_BYTE, bits);
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBegin(GL_POLYGON);
glTexCoord2f(0.0, 0.0); glVertex3f(xPos, yPos, 0.0);
glTexCoord2f(1.0, 0.0); glVertex3f(xPos + rSize, yPos, 0.0);
glTexCoord2f(1.0, 1.0); glVertex3f(xPos + rSize, yPos + rSize, 0.0);
glTexCoord2f(0.0, 1.0); glVertex3f(xPos, yPos + rSize, 0.0);
glEnd();
glDisable(GL_BLEND);
Thanks!