Hello,
I am having troubles correctly setting up OpenGL blending when using
an orthographic projection. The problem is that when I render a square
using GL_QUADS I can clearly see the two triangle that are used to
construct the square (see :
http://dparks.wikidot.com/local--files/file-dump/WhyCanISeeTheTriangles.jpg).
If I disable blending the problem goes away (I get a nice solid blue
square). Can one not combine blending and orthographic projection? Is
there something special about orthographic projections that cause this
problem? This is my first time using orthographic projections and have
never had this problem when using perspective projections.
My initialization code is as follows:
glClearColor(1.0f, 1.0f, 1.0f, 0.0f); // White Background
glDisable(GL_DEPTH_TEST); // disable depth testing since we are using
a single 2D plane
glDepthMask(GL_FALSE); // disable depth mask to improve visual
quality of lines
// setup antialiasing and blending to optimize appearance
glShadeModel(GL_SMOOTH);
glEnable(GL_POINT_SMOOTH);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glEnable(GL_POLYGON_SMOOTH);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
// setup view****t
glView****t(0, 0, GetSize().x, GetSize().y);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// use a simple orthographic projection
gluOrtho2D(0, GetSize().x, 0, GetSize().y); // the ftgl library
expects the bottom, left corner to be (0,0)
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
I render the square using the following code:
glColor3f(0.2f, 0.2f, 1.0f);
glBegin(GL_QUADS);
glVertex2i (25, 25);
glVertex2i (75, 25);
glVertex2i (75, 75);
glVertex2i (25, 75);
glEnd();
Any and all help is greatly appreciated. I've been banging my head
against this one for a day now and am not sure what to do except turn
off blending (which I had hoped to use!).
Cheers,
Donovan


|