I'm doing some 2D drawing, so depth testing is disabled. I have a texture, and if I turn blending on when I draw it, it doesn't render. If blending is of, it's fine. Any ideas what could be the problem?
Here's a part of the code:
Code:
//The problem is, if I enable blending, then the texture isn't displayed. If I disable it, it's there (however, the transparent pixels on texture's image are black)
//Texture loading part:
glEnable(GL_TEXTURE_2D);
glGenTextures( 1, &tex );
glBindTexture( GL_TEXTURE_2D, tex );
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_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D( GL_TEXTURE_2D, 0, image->format->BytesPerPixel, w, h, 0, texture_format, GL_UNSIGNED_BYTE, image->pixels );
glDisable(GL_TEXTURE_2D);
//Drawing part (blending is enabled, depth test disabled)
glEnable(GL_TEXTURE_2D);
glEnable(GL_COLOR_MATERIAL);
glColor4f( m_r, m_g, m_b, m_a );
glBindTexture( GL_TEXTURE_2D, tex->tex );
glCallList(m_draw_texture);//draws from a list I've set up and tested (works)
glDisable(GL_TEXTURE_2D);
Thanks[/code]