how do I do antialised polygons/circles

BlitzMax Forums/BlitzMax Programming/how do I do antialised polygons/circles

Najdorf(Posted 2005) [#1]
Ok, So I have a progam that draws polygons and circles, but they're kind of ugly:



How do i get them antialised? (I use "drawoval" and "drawpolygon" to draw them).


Robert Cummings(Posted 2005) [#2]
Enable FSAA? I understand lines are just stretched quads..


Najdorf(Posted 2005) [#3]
what's FSAA? How do you enable it?

Please keep in mind that they're not images you paste, they're drawn with the "draw" commands


PowerPC603(Posted 2005) [#4]
From the NeHe tutorials (nr. 46):
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=46


For more specific information on anti-aliasing, as well as the information I'm about to present, please check out the following links:

GDC2002 -- OpenGL Multisample
OpenGL Pixel Formats and Multisample Antialiasing

With that being said, a brief overview of how our process is going to work. Unlike other extensions, which relate to OpenGL rendering, the ARB_MULTISAMPLE extension must be dealt with during the creation of your rendering window. Our process shall go as follows:

1. Create our Window as normal
2. Query the possible Multisample pixel values (InitMultisample)
3. If Multisampling is available, destroy this Window and recreate it with our NEW pixelFormat
4. For parts we want to antialias, simply call glEnable(GL_ARB_MULTISAMPLE);

Let's start off from the top, and talk about our source file arbMultiSample.cpp. We start off with the standard includes for gl.h & glu.h, as well as windows.h, we'll talk about arb_multisample.h later.



Another source:
http://fly.cc.fer.hr/~unreal/theredbook/chapter07.html

Just found it by googling for "opengl anti-alias".


Najdorf(Posted 2005) [#5]
I get there is no way to do it with Max2D?


ImaginaryHuman(Posted 2005) [#6]
Sounds like it's an extension.

There is such a thing as line antialiasing which probably would suffice.

something like glEnable(GL_LINE_SMOOTH)? ... although you need to be in alpha blend I think.\


TartanTangerine (was Indiepath)(Posted 2005) [#7]
DirectX
PrimaryDevice.device.SetRenderState D3DRS_EDGEANTIALIAS,True

Example:
Graphics 640,480,0,60
SetBlend(ALPHABLEND)
PrimaryDevice.device.SetRenderState D3DRS_EDGEANTIALIAS,True
DrawLine 10,10,100,600
Flip
WaitKey()



Robert Cummings(Posted 2005) [#8]
That snippet doesn't work tim. Complains about D3DRS_EDGEANTIALIAS not being found.


TartanTangerine (was Indiepath)(Posted 2005) [#9]
Lol, you have to set the constant, seems Mark left it out.

Const D3DRS_EDGEANTIALIAS=40



Najdorf(Posted 2005) [#10]
what about on openGL?


ImaginaryHuman(Posted 2005) [#11]
I wonder if you need to enable GL_SMOOTH as the type of rendering, in order to make antialiased edges - like the FILTEREDIMAGE flag does for images. It might be that the polygons are being draw in in GL_FLAT mode.


Nigel Brown(Posted 2006) [#12]
Example looks really good on my graphics card, however if you add an oval there is no improvement in this command at all?

Const D3DRS_EDGEANTIALIAS=40

Graphics 640,480,0,60
SetBlend(ALPHABLEND)
PrimaryDevice.device.SetRenderState D3DRS_EDGEANTIALIAS,True
DrawLine 10,10,100,600
DrawOval 100,100,50,50
Flip
WaitKey()