How do I antialias my lines / polys?
Antialiasing DrawLine()
BlitzMax Forums/BlitzMax Beginners Area/Antialiasing DrawLine() Add:
glEnable(GL_LINE_SMOOTH)
Anything drawn after that will draw antialiased lines so long as it is supported by the OpenGL implementation, and it doesn't necessarily work on all systems.
glDisable(GL_LINE_SMOOTH) switches it off.
also glEnable(GL_POLYGON_SMOOTH) enables smoothing for polygon edges, but you are supposed to also set up glEnable(GL_BLEND) and glBlendFunc() with the appropriate blend mode, and supposed to draw the polygons in order I think.
You could perhaps draw a regular polygon and then draw the outline using antialised lines over the top, or underneath.
glEnable(GL_LINE_SMOOTH)
Anything drawn after that will draw antialiased lines so long as it is supported by the OpenGL implementation, and it doesn't necessarily work on all systems.
glDisable(GL_LINE_SMOOTH) switches it off.
also glEnable(GL_POLYGON_SMOOTH) enables smoothing for polygon edges, but you are supposed to also set up glEnable(GL_BLEND) and glBlendFunc() with the appropriate blend mode, and supposed to draw the polygons in order I think.
You could perhaps draw a regular polygon and then draw the outline using antialised lines over the top, or underneath.
You should also increase the line width to get it looking better, something like this works well:
glLineWidth(1.7)
glEnable(GL_LINE_SMOOTH)
glLineWidth(1.7)
glEnable(GL_LINE_SMOOTH)
i tried putting
"glLineWidth(1.7)
glEnable(GL_LINE_SMOOTH)"
in my main while loop, but i cant see any difference, zooming in on my app shows jaggies are just as jagged as before. Is there anything else i need to do to enable it, or are there commands i might be using that disable it?
"glLineWidth(1.7)
glEnable(GL_LINE_SMOOTH)"
in my main while loop, but i cant see any difference, zooming in on my app shows jaggies are just as jagged as before. Is there anything else i need to do to enable it, or are there commands i might be using that disable it?
You only need it at the start of your program. If you do not see any difference your graphics card probably doesn't support it.
You shouldn't need an alpha blend for line antialiasing. It may be that it is not supported by your hardware.
I am using a radeon 9600 - its not too old, probably supports it.
I am using ATI X800XT PT and it still needs ALPHABLEND in order to get GL_LINE_SMOOTH working properly.
Barney
Barney
Thanks, it works for me now.