I wanted to add transparency for my UI elements, so I enabled blending by adding:
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
before renderer and
glDisable(GL_BLEND);
after renderer.
So I tried to render simple rectangle (with glDrawArrays()
because I'm using GLSL shaders).
Before I enabled blending my rectangle (1 quad) looked like this:
And now, after blending it looks like this (Like a two triangles):
Do I need some extra settings for my blending or what?
Edit:
I noticed that if I remove anti-aliasing code:
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_POINT_SMOOTH);
glEnable(GL_POLYGON_SMOOTH);
Problem will disappear, but I want to keep anti-aliasing in my game. Any ideas?