Why is it so? No matter what I code nothing changes in my program. I can put antialiasing on from my nvidia control panel but that feels quite awkward and in this case I know that it won’t probably look like same on some one elses computer. I found out that some one had same problem with ati in gamedev http://www.gamedev.net/community/forums/topic.asp?topic_id=494201 I have windows.
Hi Haksu,
the driver configuration overwrites application configurations. You should find an option called “Application dependent” in the FSAA and anisotropic filtering options which is normally set as default on ATI and Nvidia hardware.
Thanks it helped a little!
Now I have another problem. AA works now but now there is some kind of weird line which goes through every polygon, how can I make these lines go away? These lines kind of split every polygon to two triangles.
Is there something wrong with my code?
gl.glEnable ( GL.GL_POLYGON_SMOOTH );
gl.glEnable ( GL.GL_BLEND );
gl.glBlendFunc ( GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA );
gl.glHint ( GL.GL_POLYGON_SMOOTH_HINT, GL.GL_NICEST );
gl.glBegin(GL.GL_POLYGON);
No, I believe the problem you’re running into is a result of the anti-aliasing algorithm for polygons. What you’re using is primitive level AA, so for each polygon, point, or line that comes in, open gl will anti-alias the edges of the shape. This works great for lines and points, but for polygons there is often trouble because it changes the polygons boundaries (so when we render a full mesh, the triangles pull away from each other, creating the lines you’re seeing). To fix this, opengl has a mechanism that lets you specify edge flags that will turn off anti-aliasing for a given edge.
I believe that this tricky and tedious to use properly and there is a much better and easier option available. Nowadays, to accomplish full scene anti-aliasing, the best way to do this is to use multi-sampling. To turn on, there are a couple of steps. When creating a GLCanvas (afaik it won’t work for GLJPanel), you pass in a GLCapabilities object to it that has a couple of adjustments (in my experience, I haven’t had to change any other default parameters):
set sample buffers to true, and set the number of samples to a # > 0 (usually 2 or 4 will do the trick).
After this, a canvas will be created that has multi-sampling capabilities. To actually use multi-sampling with opengl, you then call glEnable(GL.GL_MULTISAMPLE) to start using FSAA (if you’d like to turn it off quickly, just use glDisable(GL.GL_MULTISAMPLE) and rendering will appear as if you didn’t have AA). The benefits of this are that you don’t have to enable primitive aa or blending.
Thanks for replying!
I’ll try to do that.