FxPlug / OpenGL Smooth Line Artifact
FxPlug / OpenGL Smooth Line Artifact
- Subject: FxPlug / OpenGL Smooth Line Artifact
- From: George King <email@hidden>
- Date: Fri, 17 Oct 2008 17:10:29 -0700
Hello,
I am seeing an odd artifact in my FxPlug OpenGL context when I draw a
white line on a white background using GL_LINE_SMOOTH. In my test app
that uses an NSOpenGL context (with no multisampling), i get pure
white. However, when I run the same code in my FxPlug, I get dark
artifacts where the line is blending. It looks as though the smooth
line rasterizer is fading the color to black as the alpha fades to
zero. As an example, take a white line with a small positive slope
(almost horizontal). If I disable GL_BLEND, then I see two series of
horizontal gradients in a staircase pattern, fading white to black and
black to white. If I enable GL_BLEND, then the alpha for each gradient
goes to zero as the color goes to black, leaving semi-transparent dark
spots for every pixel of vertical rise.
I hope that makes some sense! Attached are a few screen shots which
should make the problem apparent.
Note that this is not affected by glBlendColor, or the
GL_TEXTURE_ENV_COLOR; changing either of those does not alter the
black coloring. The problem occurs with and without texturing. Below
is example code that can be pasted directly into the default FxFilter
Xcode project. Insert it just before the glPopAttrib() call. You
should also change *canRenderSoftware to NO to force OpenGL use.
I'm hoping that I'm just missing some gl state call, but I've been
scouring the red book all day to no avail. Let me know if I should
post this to the OpenGL list too; I thought I'd ask here first since
it works in regular contexts.
Thanks,
George King
glClearColor(1,1,1,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glLineWidth(1);
glColor(1,1,1,1);
glBegin(GL_LINES);
glVertex2f(0,0);
glVertex2f(100, 1000);
glEnd();
blend disabled w/ red bg:
blend enabled w/ white bg:
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Pro-apps-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden