title: Antialiased lines using jogl on Windows 7 look horrible
body: <p>My java application uses jogl to create surfaces with an overlaid grid. The lines of the grid are anti-aliased. However, on Windows the anti-aliasing is complete garbage, unless I add a small alpha value to the surface. Here are screen shots of the same scene on all three platforms:</p>
  
  <p>Mac OS X:</p>
  
  <p><img src="https://i.stack.imgur.com/PE1gK.png" alt="Mac OSX"></p>
  
  <p>Ubuntu 11.10:</p>
  
  <p><img src="https://i.stack.imgur.com/uyAXN.png" alt="Ubuntu 11.10"></p>
  
  <p>Windows 7:</p>
  
  <p><img src="https://i.stack.imgur.com/OhXJC.png" alt="Windows"></p>
  
  <p>Windows 7 with alpha=0.01:</p>
  
  <p><img src="https://i.stack.imgur.com/WmS2D.png" alt="Windows with (small) alpha (0.01)"></p>
  
  <p>The basic procedure to create this is as follows:</p>
  
  <pre><code>gl.glPushAttrib( GL.GL_ALL_ATTRIB_BITS );
  gl.glEnable(GL.GL_POLYGON_OFFSET_FILL);
  gl.glPolygonOffset(1.0f, 1.0f); 
  drawSurface(gl);
  gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
  gl.glPopAttrib();
  
  gl.glDisable( GL.GL_LIGHTING );
  gl.glDepthFunc(GL.GL_LEQUAL);
  float[] c = {0, 0, 0, 0.5f};
  gl.glColor4fv(c, 0);//the alpha here gets overridden if one is specified for the surface (which is why the Windows-with-alpha produces a darker grid)
  drawGrid(gl);
  gl.glDepthFunc(GL.GL_LESS);
  gl.glEnable( GL.GL_LIGHTING );
  </code></pre>
  
  <p>The drawSurface() method also does the following before creating the polygons for the surface (using GL_TRIANGLE_STRIP primitives):</p>
  
  <pre><code>gl.glPushAttrib(GL.GL_LIGHTING_BIT);
  gl.glColorMaterial(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE);
  gl.glEnable(GL.GL_COLOR_MATERIAL);
  </code></pre>
  
  <p>The drawGrid() method sets up anti-aliasing like so:</p>
  
  <pre><code>gl.glEnable(GL.GL_BLEND);
  gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
  gl.glEnable(GL.GL_LINE_SMOOTH);
  gl.glHint(GL.GL_LINE_SMOOTH_HINT, GL.GL_NICEST);
  </code></pre>
  
  <p>The grid itself is created using GL_LINE_STRIPs</p>
  
  <p>I've read up on the <a href="http://www.opengl.org/resources/code/samples/sig99/advanced99/notes/node120.html" rel="nofollow noreferrer">OpenGL documentation regarding line anti-aliasing</a> and also tried out the polygon offset example <a href="http://glprogramming.com/red/chapter06.html" rel="nofollow noreferrer">here</a>.</p>
  
  <p>As for hardware, I have dual boot IBM ThinkPad (64-bit quad core) with an integrated nVidia 3100M card and an Intel Core 2 Duo iMac which has an ATI Radeon. Since Ubuntu and Windows are running on the same hardware, I know it can't be a hardware issue.</p>
  
  <p>I'm looking for suggestions for improving the anti-aliasing of the grid lines on Windows.</p>