I have a very strange problem.
This is my GLFW OpenGL inizialization.
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 1);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_ANY_PROFILE);// GLFW_OPENGL_CORE_PROFILE);// );
glfwWindowHint(GLFW_SAMPLES, 8);
glfwWindowHint(GLFW_ALPHA_BITS, 8);
glfwWindowHint(GLFW_DEPTH_BITS, 24);
glfwWindowHint(GLFW_STENCIL_BITS, 8);
glfwWindowHint(GLFW_ALPHA_BITS, 8);
glfwWindowHint(GLFW_DECORATED, GLFW_FALSE);
g_Window = glfwCreateWindow(iw, ih, "APP", NULL, NULL);
if (g_Window == NULL)
{
printf("Failed to create GLFW window\n");
glfwTerminate();
return -1;
}
...
then My OpenGL configuration…
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, g_iWidthGL, 0, g_iHeightGL, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
my load RGBA Tga Load File funtion…
void LoadTextureFromTga(uint32_t *uiTextureID, const char* caImg, int32_t* w, int32_t* h )
{
if (!caImg) return;
struct tImageTGA* pImgData = 0;
pImgData = Load_TGA(caImg);
if (pImgData == 0) {
printf("TGA_Texture\n ERROR\n: %s \n ERROR\n", caImg);
return;
}
glGenTextures(1, uiTextureID);
glBindTexture(GL_TEXTURE_2D, *uiTextureID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
*w = pImgData->size_x;
*h = pImgData->size_y;
// Give the image to OpenGL // GL_RGBA
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, pImgData->size_x, pImgData->size_y, 0, GL_RGBA, GL_UNSIGNED_BYTE, pImgData->data);
}
and my drawing texture function…
glBindTexture(GL_TEXTURE_2D, uiTexture);
glBindTexture(GL_TEXTURE_2D, uiTexture);
glEnable(GL_TEXTURE_2D);
glBegin(GL_QUADS);
glTexCoord2d(0, 0);
glVertex2i(v.x, v.y);
glTexCoord2d(1, 0);
glVertex2i(v.x + v.w, v.y);
glTexCoord2d(1, 1);
glVertex2i(v.x + v.w, v.y + v.h);
glTexCoord2d(0, 1);
glVertex2i(v.x, v.y + v.h);
glEnd();
glDisable(GL_TEXTURE_2D);
So the problem is… when I Draw a plygon with alpha is drawing with thwe correct transparency… but if draw a TGA with RGBA Channels… I Obtain a full white colour insted the tranparency.
I test the same code with glut and it works correwctly.
Any tip for that …!!!
Thank you.