We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › antialiasing in opengl
Page Index Toggle Pages: 1
antialiasing in opengl (Read 2770 times)
antialiasing in opengl
Jul 15th, 2009, 11:51am
 
hi im using pure opengl in processing, Do anybody know which is the command for activating antialiasing in pure opengl ?


thanks


Seb
Re: antialiasing in opengl
Reply #1 - Jul 16th, 2009, 2:41am
 
a quick google for 'jogl antialiasing' gives me

gl.glEnable ( GL.GL_LINE_SMOOTH );
gl.glEnable ( GL.GL_BLEND );
gl.glBlendFunc ( GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA );
gl.glHint ( GL.GL_LINE_SMOOTH_HINT, GL.GL_NICEST );

(processing uses jogl for its opengl binding, i think)
Re: antialiasing in opengl
Reply #2 - Jul 16th, 2009, 5:41am
 
Don't forget this one...
Code:

hint( ENABLE_OPENGL_4X_SMOOTH );
Re: antialiasing in opengl
Reply #3 - Jul 18th, 2009, 6:12am
 
One of either:

a) if you are using the OPENGL renderer, then you are using the opengl context it creates for you, which enables 2X AA by default (regardless of pure opengl calls that follows).  jeffg's answer will also work, bumping up the AA to 4X

b) if for some reason you are creating your own OpenGL context, then you have to enable antialiasing using a glCapabilities object _before_ you create the context. I'd suggest taking a peek at the source code for PGraphicsOpenGL to see how its done (http://dev.processing.org/source/index.cgi/trunk/processing/opengl/src/processing/opengl/PGraphicsOpenGL.java?view=markup) (search for "hint")

Best,
d.
Re: antialiasing in opengl
Reply #4 - Jul 18th, 2009, 1:52pm
 
afaik gl.glEnable ( GL.GL_BLEND ) and gl.glBlendFunc() are required for alpha blending, they don't affect AA. Be careful about enabling this flag only when you really need it (and disable GL_BLEND when you're done drawing alpha blended triangles) because in many situations it might have a serious impact on performances.
Page Index Toggle Pages: 1