Antialiasing problem

BlitzMax Forums/OpenGL Module/Antialiasing problem

Ibmurai(Posted 2005) [#1]
I used to program OpenGL in Delphi and now I'm obviously doing it in BlitzMax - But I have a problem enabling antialised lines and polygons. I used to do it like in the example below, and I don't get any errors, but it simply does not happen.

Has anyone had a similar problem, or maybe even solved it? I'm sure I'm just missing something (or something :) )

UPDATE: This bit of code also DOES NOT enable alphablending, which I'm sure it should...

Graphics 1024, 768, 32

glEnable(GL_POLYGON_SMOOTH)
glEnable(GL_LINE_SMOOTH)
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)



Yan(Posted 2005) [#2]
This works fine here...
SetGraphicsDriver GLMax2DDriver()

Graphics 640, 480, 32

glEnable(GL_POLYGON_SMOOTH)
glEnable(GL_LINE_SMOOTH)
SetBlend ALPHABLEND

DrawLine 0, 0, 639, 479

Flip

WaitKey()

End



Extron(Posted 2005) [#3]
And for the 3D :
SetGraphicsDriver GLMax2DDriver()

bglCreateContext(640,480,16,0,BGL_BACKBUFFER | BGL_DEPTHBUFFER | BGL_ALPHABUFFER)
glMatrixMode(GL_PROJECTION)
glLoadIdentity
glFrustum(-0.1, 0.1,-0.1, 0.1, 0.1, 100.0)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity

glEnable(GL_ALPHA_TEST)
glEnable(GL_POLYGON_SMOOTH)
glEnable(GL_LINE_SMOOTH)
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_ALPHA_BUFFER_BIT)
glTranslatef(0.0 , 2.0 , -6.0)
glBegin(GL_QUADS)
	glColor3f(0.0 , 0.5 , 0.5)
	glVertex3f(5.0, 1.0, 0.0)
	glColor3f( 1.0 , 0.0 , 0.5)
	glVertex3f(1.0, 1.0, 0.0)
	glColor3f( 0.0 , 0.5 , 1.0)
	glVertex3f(10.0,-10.0, 0.0)
	glColor3f(1.0 , 0.0 , 0.0)
	glVertex3f(-10.0,-10.0,0.0)
glEnd
bglSwapBuffers

While Not KeyDown(Key_Space)
Wend
bglDeleteContext



The r0nin(Posted 2005) [#4]
BlitzMax 1.10 defaults Windows machines to DirectX. Did you set the graphics driver to OpenGL (as in the examples above)?


Ibmurai(Posted 2005) [#5]
I'm in OS X, so no DirectX problem (Shouldn't antialiasing work somehow in DirectX as well, anyway?)

I'm doing 2D only, so TwoEyedPete's example really helped. Thanks everyone!


JoshK(Posted 2006) [#6]
You need to use the multisample buffer for real antialiasing:
http://blitzmax.com/Community/posts.php?topic=64265


ImaginaryHuman(Posted 2006) [#7]
I wonder if you should also look at glHint() to give the system the hint that you want the nicest smoothing available