anti aliasing

BlitzMax Forums/BlitzMax Beginners Area/anti aliasing

hub(Posted 2007) [#1]
Hi !
Have some newbies questions about antialiasing...

1) today, could i consider that's a majority of player's config video card support it ?

2) how to init anti-alisaing in bmax (opengl and directx) i use this into my program :

		Case CTE_DRIVER_DIRECTX
			'Const D3DRS_ANTIALIAS = 2 ' ou 1
			'D3D7GraphicsDriver().Direct3DDevice7().SetRenderState D3DRS_MULTISAMPLEANTIALIAS,True
			'D3D7GraphicsDriver().Direct3DDevice7().SetRenderState D3DRS_ANTIALIAS,True
			
		Case CTE_DRIVER_OPENGL
			'GlEnable GL_POLYGON_SMOOTH
			'GlEnable GL_BLEND
			'glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA
			'glHint GL_LINE_SMOOTH_HINT, GL_NICEST


...but if i use this code with my config i see the edges of the triangles when i draw an image (opengl) !!! Perhaps a driver bug ?

Thanks !

Thanks !


ImaginaryHuman(Posted 2007) [#2]
Your Blend Func for OpenGL is wrong. You are meant to use GL_SRC_ALPHA_SATURATE with GL_ONE. What you have it set up to do is alphablending not antialiasing. The line smooth hint also has no real effect on polygon antialiasing. You should do glHint GL_POLYGON_SMOOTH_HINT, GL_NICEST. That said, if you are going to do glEnable(GL_LINE_SMOOTH) then you can set the hint for line smoothing. I've found that these features are not always supported on all systems. On one of my systems line smoothing does not work and line width cannot be larger than about 2. Also I don't think that your DX and GL antialiasing is comparable. It looks like DX is doing full-screen multisampling. You can do that in OpenGL too (see the module mod forum), but it's not the same as doing individual polygon antialiasing which only antialiases the edges.


hub(Posted 2007) [#3]
AngelDaniel i'm not an opengl guru, could you correct me with the gl part of the code ? Thanks


ImaginaryHuman(Posted 2007) [#4]
Look at the full-screen antialiasing code in the modules forum, or at least just do what I already said.