Qu0ll
May 9, 2011, 8:06am
1
I am drawing a line without enabling line smoothing, then I enable line smoothing with:
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
and to my surprise the first line is smoothed as well (which is not what I want).
So why is this seemingly retrospective and how can I draw one line not smoothed and then another one with smoothing applied? I have tried glFlush() between drawing the lines but it didn’t help.
Do you disable GL_LINE_SMOOTH before drawing the first line ?
Nothing to do at all with glFlush()
Qu0ll
May 9, 2011, 8:29am
3
OK, I do now and it is working, but why do I need to disable line smoothing BEFORE I draw the first line? Does that mean it is enabled by default?
State carries over from frame to frame. So what you’re doing is effectively this:
frame 1:
clear screen
draw line 1 // line smoothing is disabled
enable line smoothing
draw line 2 // line smoothing is enabled
frame 2 and above:
clear screen
draw line 1 // line smoothing is still enabled!!!
enable line smoothing
draw line 2 // line smoothing is enabled
Qu0ll
May 9, 2011, 10:08am
5
Yes, that is correct indeed! Thanks to you both