I am using glEvalMesh2() to draw a bunch of translucent bezier patches. The first patch draws correctly, but all subsequent patches are drawn completely opaque. Querying GL_CURRENT_COLOR confirms that the alpha is reset to 1 during EvalMesh2, but the RGB values are untouched. I can’t find anything explaining this in any docs anywhere and Google wasn’t helping.
Is this the expected behaviour? Does this happen to other people? Suggestions?
Below is a minimal bit of code that hopefully demonstrates the problem.
double[] controlPoints =
{-1.5, -1.5, 4.0, -0.5, -1.5, 2.0, 0.5, -1.5, -1.0,
-1.5, -0.5, 1.0, -0.5, -0.5, 3.0, 0.5, -0.5, 0.0,
-1.5, 0.5, 4.0, -0.5, 0.5, 0.0, 0.5, 0.5, 3.0,
-1.5, 1.5, -2.0, -0.5, 1.5, -2.0,0.5, 1.5, 0.0,};
//Set up the evaluator
gl.glEnable(GL.GL_MAP2_VERTEX_3);
gl.glEnable(GL.GL_AUTO_NORMAL);
gl.glMapGrid2f(20, 0.0f, 1.0f, 20, 0.0f, 1.0f);
//turn on blending, and set the color I want.
gl.glEnable(GL.GL_BLEND);
gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
gl.glColor4d(.5,0.5,1,0.5);
//draws with transparency:
gl.glTranslatef(-3,0,0);
gl.glMap2d(GL.GL_MAP2_VERTEX_3, 0, 1, 3, 3, 0, 1, 9, 3, controlPoints,0);
gl.glMapGrid2d(10, 0.0, 1.0, 10, 0.0, 1.0);
gl.glEvalMesh2(GL.GL_FILL, 0, 10, 0, 10);
//draws opaque:
gl.glTranslatef(6,0,0);
gl.glEvalMesh2(GL.GL_FILL, 0, 10, 0, 10);