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 6721611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:20:59+00:00 2026-05-26T09:20:59+00:00

I’m drawing some 2D lines in OpenGL (using the AGL API). I’ve turned on

  • 0

I’m drawing some 2D lines in OpenGL (using the AGL API). I’ve turned on line anti-aliasing using GL_LINE_SMOOTH and I’ve set GL_LINE_SMOOTH_HINT to GL_NICEST.

So for example, here’s a magnified view of a diagonal line*:

Line with anti-aliased edges
(source: whileyouweregone.co.uk)

However, the problem is that my code draws some shapes which are built up of large numbers of vertical lines, and it seems the end points of lines are not anti-aliased. Here’s one of those:

Lines without anti-aliased endpoints
(source: whileyouweregone.co.uk)

(Each step you can see is made up of 10 vertical lines, with the x coordinates of each line incrementing in steps of 1.0, and the y coordinates incrementing in steps of 0.1.)

Is there a way of getting OpenGL to also anti-alias the lines’ end points?

Edit:

As per Calvin1602’s answer, I’ve tried removing the GL_LINE_SMOOTH stuff and am instead enabling MSAA by adding the following to my AGL attributes array:

AGL_SAMPLE_BUFFERS_ARB, 1, AGL_SAMPLES_ARB, 4, AGL_MULTISAMPLE

…and calling:

glEnable(GL_MULTISAMPLE_ARB);

However, I still have the same problem. The line edges are anti-aliased (in a slightly different way), but the end-points aren’t.

* Screenshots are from a Mac Pro running OS X 10.7.1 with a ATI Radeon HD 5770 1024 MB.

Edit 2:

Using MSAA doesn’t work for me, but simply drawing all my lines as very thin rectangles as suggested by ltjax seems to have done the trick. (I didn’t need to use a texture or a gradient.)

  • 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-26T09:21:00+00:00Added an answer on May 26, 2026 at 9:21 am

    Yes, full-screen anti-aliasing will do this for you. For example, multi-sampling will work and is widely supported. If you want to stick with just anti-aliased lines, you can emulate it by drawing quads instead (which are slightly larger than your line) and using either a predefined “gradient” texture or a shader that evaluates the distance from the real line.

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

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

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.