Original Post
Hi i am rendering some 2d images using my own format and am trying to blend out one colour. In my images all pixels with a value of 0,255,0 has its alpha set to 1 else it is 0, I am certain my data is correct. I then want to render the image with none of the 0,255,0 pixel showing. This is my code :
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
// blend out the colour mask (0,255,0)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// bind texture
glBindTexture(GL_TEXTURE_2D, GetTexture());
glBegin(GL_QUADS);
glTexCoord2f(0,1);
glVertex2f( (float) x, (float) y); // tl
glTexCoord2f(0,0);
glVertex2f( (float) x, (float) y + iYRes); // bl
glTexCoord2f(1,0);
glVertex2f( (float) x + iXRes, (float) y + iYRes); // br
glTexCoord2f(1,1);
glVertex2f( (float) x + iXRes, (float) y); // tr
glEnd();
glDisable(GL_BLEND);
When i run this with blending i just get solid black quads (i am using an orthogonal projection to render in 2d if that matters).
If i turn blending off my images render fine but with the solid quads and colour key showing. This code is rendering on my HUD and i have quite a bit of other 3D stuff going on before i get here so maybe i am doing something to the state machine previously? Any ideas?
Cheers