Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7066289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:03:54+00:00 2026-05-28T05:03:54+00:00

My java application uses jogl to create surfaces with an overlaid grid. The lines

  • 0

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:

Mac OS X:

Mac OSX

Ubuntu 11.10:

Ubuntu 11.10

Windows 7:

Windows

Windows 7 with alpha=0.01:

Windows with (small) alpha (0.01)

The basic procedure to create this is as follows:

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 );

The drawSurface() method also does the following before creating the polygons for the surface (using GL_TRIANGLE_STRIP primitives):

gl.glPushAttrib(GL.GL_LIGHTING_BIT);
gl.glColorMaterial(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE);
gl.glEnable(GL.GL_COLOR_MATERIAL);

The drawGrid() method sets up anti-aliasing like so:

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);

The grid itself is created using GL_LINE_STRIPs

I’ve read up on the OpenGL documentation regarding line anti-aliasing and also tried out the polygon offset example here.

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.

I’m looking for suggestions for improving the anti-aliasing of the grid lines on Windows.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:03:55+00:00Added an answer on May 28, 2026 at 5:03 am

    Turns out I had not tried (I thought I had, but I did not rebuild and test it correctly)
    gl.glDepthMask( false );

    Adding that in correctly did greatly improve the fragmentation of the anti-aliased lines of the grid.

    That said, I’m still not 100% happy with the look of the lines, but, for now, this question is resolved. Here is a screen shot of the ‘improved’ grid lines:

    enter image description here

    While this is a great improvement, it’s still not as good as Mac OS X or even Ubuntu.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a Java application that uses the Slick library to load images. However,
Currently our Java application uses the values held within a tab delimited *.cfg file.
I support a legacy Java application that uses flat files (plain text) for persistence.
I'm developing a Java application that uses java.util.logging for its logging needs. This application
So I'm writing a Java application that uses Simple to store data as xml
I'm working on a Java application that uses JavaSpace. We're developing this in Eclipse.
My Android application uses Java OAuth library, found here for authorization on Twitter. I
I am working on a Java/Struts application that uses Tomcat 6.0.10. It's a typical
My application uses loads of Java threads. I am looking for a reliable understanding
I wrote a complex Java application with eclipse that uses many .jar libraries included

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.